完善原生内容卡与H5详情分工

This commit is contained in:
2026-03-27 21:03:55 +08:00
parent 0e0a724025
commit 0703fd47a2
21 changed files with 903 additions and 83 deletions

View File

@@ -250,6 +250,7 @@ function parseContentExperienceOverride(
return {
type: 'native',
fallback: 'native',
presentation: 'sheet',
}
}
@@ -265,12 +266,19 @@ function parseContentExperienceOverride(
const bridgeValue = typeof normalized.bridge === 'string' && normalized.bridge.trim()
? normalized.bridge.trim()
: 'content-v1'
const rawPresentation = typeof normalized.presentation === 'string'
? normalized.presentation.trim().toLowerCase()
: ''
const presentationValue = rawPresentation === 'dialog' || rawPresentation === 'fullscreen'
? rawPresentation
: 'sheet'
return {
type: 'h5',
url: resolveUrl(baseUrl, rawUrl),
bridge: bridgeValue,
fallback: 'native',
presentation: presentationValue,
}
}
@@ -818,6 +826,12 @@ function parseGameConfigFromJson(text: string, gameConfigUrl: string): ParsedGam
const titleValue = typeof (item as Record<string, unknown>).title === 'string'
? ((item as Record<string, unknown>).title as string).trim()
: ''
const templateRaw = typeof (item as Record<string, unknown>).template === 'string'
? ((item as Record<string, unknown>).template as string).trim().toLowerCase()
: ''
const templateValue = templateRaw === 'minimal' || templateRaw === 'story' || templateRaw === 'focus'
? templateRaw
: ''
const bodyValue = typeof (item as Record<string, unknown>).body === 'string'
? ((item as Record<string, unknown>).body as string).trim()
: ''
@@ -836,7 +850,8 @@ function parseGameConfigFromJson(text: string, gameConfigUrl: string): ParsedGam
const hasOnce = typeof onceValue === 'boolean'
const hasPriority = Number.isFinite(priorityNumeric)
if (
titleValue
templateValue
|| titleValue
|| bodyValue
|| clickTitleValue
|| clickBodyValue
@@ -847,6 +862,7 @@ function parseGameConfigFromJson(text: string, gameConfigUrl: string): ParsedGam
|| clickExperienceValue
) {
controlContentOverrides[key] = {
...(templateValue ? { template: templateValue } : {}),
...(titleValue ? { title: titleValue } : {}),
...(bodyValue ? { body: bodyValue } : {}),
...(clickTitleValue ? { clickTitle: clickTitleValue } : {}),