完善原生内容卡与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

@@ -227,8 +227,11 @@ export interface MapEngineViewState {
punchFeedbackText: string
punchFeedbackTone: 'neutral' | 'success' | 'warning'
contentCardVisible: boolean
contentCardTemplate: 'minimal' | 'story' | 'focus'
contentCardTitle: string
contentCardBody: string
contentCardActionVisible: boolean
contentCardActionText: string
pendingContentEntryVisible: boolean
pendingContentEntryText: string
punchButtonFxClass: string
@@ -252,6 +255,7 @@ export interface MapEngineCallbacks {
}
interface ContentCardEntry {
template: 'minimal' | 'story' | 'focus'
title: string
body: string
motionClass: string
@@ -381,8 +385,11 @@ const VIEW_SYNC_KEYS: Array<keyof MapEngineViewState> = [
'punchFeedbackText',
'punchFeedbackTone',
'contentCardVisible',
'contentCardTemplate',
'contentCardTitle',
'contentCardBody',
'contentCardActionVisible',
'contentCardActionText',
'pendingContentEntryVisible',
'pendingContentEntryText',
'punchButtonFxClass',
@@ -1281,8 +1288,11 @@ export class MapEngine {
punchFeedbackText: '',
punchFeedbackTone: 'neutral',
contentCardVisible: false,
contentCardTemplate: 'story',
contentCardTitle: '',
contentCardBody: '',
contentCardActionVisible: false,
contentCardActionText: '查看详情',
pendingContentEntryVisible: false,
pendingContentEntryText: '',
punchButtonFxClass: '',
@@ -1801,8 +1811,10 @@ export class MapEngine {
return {
kind: 'content',
title: title || resolved.control.label || '内容体验',
subtitle: resolved.displayMode === 'click' ? '点击查看内容' : '打点内容体验',
url: experienceConfig.url,
bridgeVersion: experienceConfig.bridge || 'content-v1',
presentation: experienceConfig.presentation || 'sheet',
context: {
eventId: this.configAppId || '',
configTitle: this.state.mapName || '',
@@ -1847,33 +1859,13 @@ export class MapEngine {
openContentCardEntry(item: ContentCardEntry): void {
this.clearContentCardTimer()
if (item.h5Request && this.onOpenH5Experience) {
this.setState({
contentCardVisible: false,
contentCardFxClass: '',
pendingContentEntryVisible: false,
pendingContentEntryText: '',
}, true)
this.currentContentCardPriority = item.priority
this.currentContentCard = item
this.currentH5ExperienceOpen = true
if (item.once && item.contentKey) {
this.shownContentCardKeys[item.contentKey] = true
}
try {
this.onOpenH5Experience(item.h5Request)
return
} catch {
this.currentH5ExperienceOpen = false
this.currentContentCardPriority = 0
this.currentContentCard = null
}
}
this.setState({
contentCardVisible: true,
contentCardTemplate: item.template,
contentCardTitle: item.title,
contentCardBody: item.body,
contentCardActionVisible: !!item.h5Request,
contentCardActionText: '查看详情',
contentCardFxClass: item.motionClass,
pendingContentEntryVisible: false,
pendingContentEntryText: '',
@@ -1883,18 +1875,77 @@ export class MapEngine {
if (item.once && item.contentKey) {
this.shownContentCardKeys[item.contentKey] = true
}
if (item.h5Request) {
return
}
this.contentCardTimer = setTimeout(() => {
this.contentCardTimer = 0
this.currentContentCardPriority = 0
this.currentContentCard = null
this.setState({
contentCardVisible: false,
contentCardTemplate: 'story',
contentCardFxClass: '',
contentCardActionVisible: false,
contentCardActionText: '查看详情',
}, true)
this.flushQueuedContentCards()
}, 2600) as unknown as number
}
openCurrentContentCardDetail(): void {
if (!this.currentContentCard) {
this.setState({
statusText: `当前没有可打开的内容详情 (${this.buildVersion})`,
}, true)
return
}
if (!this.currentContentCard.h5Request) {
this.setState({
statusText: `当前内容未配置 H5 详情 (${this.buildVersion})`,
}, true)
return
}
if (!this.onOpenH5Experience) {
this.setState({
statusText: `H5 详情入口未就绪 (${this.buildVersion})`,
}, true)
return
}
if (this.currentH5ExperienceOpen) {
this.setState({
statusText: `H5 详情页已在打开中 (${this.buildVersion})`,
}, true)
return
}
const request = this.currentContentCard.h5Request
this.clearContentCardTimer()
this.setState({
contentCardVisible: false,
contentCardTemplate: 'story',
contentCardTitle: '',
contentCardBody: '',
contentCardFxClass: '',
contentCardActionVisible: false,
contentCardActionText: '查看详情',
}, true)
this.currentH5ExperienceOpen = true
try {
this.onOpenH5Experience(request)
} catch {
this.currentH5ExperienceOpen = false
this.openContentCardEntry({
...this.currentContentCard,
h5Request: null,
})
}
}
flushQueuedContentCards(): void {
if (this.state.contentCardVisible || !this.pendingContentCards.length) {
this.syncPendingContentEntryState()
@@ -1949,8 +2000,11 @@ export class MapEngine {
punchFeedbackTone: 'neutral',
punchFeedbackFxClass: '',
contentCardVisible: false,
contentCardTemplate: 'story',
contentCardTitle: '',
contentCardBody: '',
contentCardActionVisible: false,
contentCardActionText: '查看详情',
pendingContentEntryVisible: this.getPendingManualContentCount() > 0,
pendingContentEntryText: this.buildPendingContentEntryText(),
contentCardFxClass: '',
@@ -2137,7 +2191,9 @@ export class MapEngine {
const once = !!(options && options.once)
const priority = options && typeof options.priority === 'number' ? options.priority : 0
const contentKey = options && options.contentKey ? options.contentKey : ''
const resolved = this.resolveContentControlByKey(contentKey)
const entry = {
template: resolved && resolved.control.displayContent ? resolved.control.displayContent.template : 'story',
title,
body,
motionClass,
@@ -2182,7 +2238,12 @@ export class MapEngine {
this.currentH5ExperienceOpen = false
this.setState({
contentCardVisible: false,
contentCardTemplate: 'story',
contentCardTitle: '',
contentCardBody: '',
contentCardFxClass: '',
contentCardActionVisible: false,
contentCardActionText: '查看详情',
}, true)
this.flushQueuedContentCards()
}
@@ -2228,6 +2289,7 @@ export class MapEngine {
this.currentContentCardPriority = 0
this.currentContentCard = null
this.openContentCardEntry({
template: 'story',
...fallback,
h5Request: null,
})

View File

@@ -35,6 +35,7 @@ function applyExperienceOverride(
url: null,
bridge: 'content-v1',
fallback: 'native',
presentation: 'sheet',
}
}
@@ -44,6 +45,7 @@ function applyExperienceOverride(
url: override.url,
bridge: override.bridge || (baseExperience ? baseExperience.bridge : 'content-v1'),
fallback: override.fallback || 'native',
presentation: override.presentation || (baseExperience ? baseExperience.presentation : 'sheet'),
}
}
@@ -59,6 +61,7 @@ function applyDisplayContentOverride(
}
return {
template: override.template || baseContent.template,
title: override.title || baseContent.title,
body: override.body || baseContent.body,
autoPopup: override.autoPopup !== undefined ? override.autoPopup : baseContent.autoPopup,
@@ -100,6 +103,7 @@ export function buildGameDefinitionFromCourse(
sequence: null,
score: null,
displayContent: applyDisplayContentOverride({
template: 'focus',
title: '比赛开始',
body: `${start.label || '开始点'}已激活,按提示前往下一个目标点。`,
autoPopup: true,
@@ -128,6 +132,7 @@ export function buildGameDefinitionFromCourse(
sequence: control.sequence,
score,
displayContent: applyDisplayContentOverride({
template: 'story',
title: score !== null ? `收集 ${label} (+${score}分)` : `收集 ${label}`,
body: score !== null ? `${buildDisplayBody(label, control.sequence)} · ${score}` : buildDisplayBody(label, control.sequence),
autoPopup: true,
@@ -154,6 +159,7 @@ export function buildGameDefinitionFromCourse(
sequence: null,
score: null,
displayContent: applyDisplayContentOverride({
template: 'focus',
title: '完成路线',
body: `${finish.label || '结束点'}已完成,准备查看本局结果。`,
autoPopup: true,

View File

@@ -1,5 +1,6 @@
import { type LonLatPoint } from '../../utils/projection'
import { type GameAudioConfig } from '../audio/audioConfig'
import { type H5ExperiencePresentation } from '../experience/h5Experience'
export type GameMode = 'classic-sequential' | 'score-o'
export type GameControlKind = 'start' | 'control' | 'finish'
@@ -10,6 +11,7 @@ export interface GameContentExperienceConfig {
url: string | null
bridge: string
fallback: 'native'
presentation: H5ExperiencePresentation
}
export interface GameContentExperienceConfigOverride {
@@ -17,9 +19,11 @@ export interface GameContentExperienceConfigOverride {
url?: string
bridge?: string
fallback?: 'native'
presentation?: H5ExperiencePresentation
}
export interface GameControlDisplayContent {
template: 'minimal' | 'story' | 'focus'
title: string
body: string
autoPopup: boolean
@@ -32,6 +36,7 @@ export interface GameControlDisplayContent {
}
export interface GameControlDisplayContentOverride {
template?: 'minimal' | 'story' | 'focus'
title?: string
body?: string
autoPopup?: boolean

View File

@@ -1,4 +1,5 @@
export type H5ExperienceKind = 'content' | 'result'
export type H5ExperiencePresentation = 'sheet' | 'dialog' | 'fullscreen'
export interface H5ExperienceFallbackPayload {
title: string
@@ -13,8 +14,10 @@ export interface H5ExperienceFallbackPayload {
export interface H5ExperienceRequest {
kind: H5ExperienceKind
title: string
subtitle?: string
url: string
bridgeVersion: string
presentation: H5ExperiencePresentation
context: Record<string, unknown>
fallback: H5ExperienceFallbackPayload
}

View File

@@ -39,19 +39,29 @@ function emitCloseAndBack(payload) {
Page({
data: {
pageTitle: '内容体验',
pageSubtitle: '',
presentation: 'sheet',
webViewSrc: '',
webViewReady: false,
loadErrorText: '',
panelBodyHeightPx: 420,
},
onLoad() {
const systemInfo = wx.getSystemInfoSync()
const windowHeight = typeof systemInfo.windowHeight === 'number' ? systemInfo.windowHeight : 700
pageResolved = false
currentRequest = null
currentEventChannel = null
this.setData({
pageTitle: '内容体验',
pageSubtitle: '',
presentation: 'sheet',
webViewSrc: '',
webViewReady: false,
loadErrorText: '',
panelBodyHeightPx: Math.max(420, Math.floor(windowHeight * 0.62)),
})
try {
@@ -66,14 +76,21 @@ Page({
currentEventChannel.on('init', (request) => {
currentRequest = request
wx.setNavigationBarTitle({
title: request.title || '内容体验',
fail() {},
})
const presentation = request.presentation || 'sheet'
const panelHeightPx = presentation === 'dialog'
? Math.max(420, Math.floor(windowHeight * 0.7))
: presentation === 'fullscreen'
? Math.max(520, windowHeight - 24)
: Math.max(420, Math.floor(windowHeight * 0.72))
const headerHeightPx = presentation === 'fullscreen' ? 84 : 76
this.setData({
pageTitle: request.title || '内容体验',
pageSubtitle: request.subtitle || '',
presentation,
webViewSrc: buildWebViewSrc(request),
webViewReady: true,
loadErrorText: '',
panelBodyHeightPx: Math.max(240, panelHeightPx - headerHeightPx),
})
})
},
@@ -124,4 +141,8 @@ Page({
})
emitFallbackAndClose()
},
handleCloseTap() {
emitCloseAndBack({})
},
})

View File

@@ -1,3 +1,5 @@
{
"navigationStyle": "custom",
"disableScroll": true,
"navigationBarTitleText": "内容体验"
}

View File

@@ -1,9 +1,13 @@
import { type H5BridgeMessage, type H5ExperienceRequest } from '../../game/experience/h5Experience'
type ExperienceWebViewPageData = {
pageTitle: string
pageSubtitle: string
presentation: 'sheet' | 'dialog' | 'fullscreen'
webViewSrc: string
webViewReady: boolean
loadErrorText: string
panelBodyHeightPx: number
}
let currentRequest: H5ExperienceRequest | null = null
@@ -47,19 +51,29 @@ function emitCloseAndBack(payload?: Record<string, unknown>) {
Page<ExperienceWebViewPageData, WechatMiniprogram.IAnyObject>({
data: {
pageTitle: '内容体验',
pageSubtitle: '',
presentation: 'sheet',
webViewSrc: '',
webViewReady: false,
loadErrorText: '',
panelBodyHeightPx: 420,
},
onLoad() {
const systemInfo = wx.getSystemInfoSync()
const windowHeight = typeof systemInfo.windowHeight === 'number' ? systemInfo.windowHeight : 700
pageResolved = false
currentRequest = null
currentEventChannel = null
this.setData({
pageTitle: '内容体验',
pageSubtitle: '',
presentation: 'sheet',
webViewSrc: '',
webViewReady: false,
loadErrorText: '',
panelBodyHeightPx: Math.max(420, Math.floor(windowHeight * 0.62)),
})
try {
@@ -74,14 +88,21 @@ Page<ExperienceWebViewPageData, WechatMiniprogram.IAnyObject>({
currentEventChannel.on('init', (request: H5ExperienceRequest) => {
currentRequest = request
wx.setNavigationBarTitle({
title: request.title || '内容体验',
fail: () => {},
})
const presentation = request.presentation || 'sheet'
const panelHeightPx = presentation === 'dialog'
? Math.max(420, Math.floor(windowHeight * 0.7))
: presentation === 'fullscreen'
? Math.max(520, windowHeight - 24)
: Math.max(420, Math.floor(windowHeight * 0.72))
const headerHeightPx = presentation === 'fullscreen' ? 84 : 76
this.setData({
pageTitle: request.title || '内容体验',
pageSubtitle: request.subtitle || '',
presentation,
webViewSrc: buildWebViewSrc(request),
webViewReady: true,
loadErrorText: '',
panelBodyHeightPx: Math.max(240, panelHeightPx - headerHeightPx),
})
})
},
@@ -133,4 +154,8 @@ Page<ExperienceWebViewPageData, WechatMiniprogram.IAnyObject>({
})
emitFallbackAndClose()
},
handleCloseTap() {
emitCloseAndBack({})
},
})

View File

@@ -1,11 +1,27 @@
<view wx:if="{{!webViewReady}}" class="experience-webview__loading">
<view class="experience-webview__loading-title">内容页加载中</view>
<view wx:if="{{loadErrorText}}" class="experience-webview__loading-error">{{loadErrorText}}</view>
</view>
<view class="experience-shell experience-shell--{{presentation}}">
<view class="experience-shell__backdrop" catchtap="handleCloseTap"></view>
<view class="experience-shell__panel experience-shell__panel--{{presentation}}">
<view class="experience-shell__header">
<view class="experience-shell__header-copy">
<view class="experience-shell__title">{{pageTitle}}</view>
<view wx:if="{{pageSubtitle}}" class="experience-shell__subtitle">{{pageSubtitle}}</view>
</view>
<view class="experience-shell__close" catchtap="handleCloseTap">关闭</view>
</view>
<web-view
wx:if="{{webViewReady && webViewSrc}}"
src="{{webViewSrc}}"
bindmessage="handleWebViewMessage"
binderror="handleWebViewError"
></web-view>
<view class="experience-shell__body" style="height: {{panelBodyHeightPx}}px;">
<view wx:if="{{!webViewReady}}" class="experience-webview__loading">
<view class="experience-webview__loading-title">内容页加载中</view>
<view wx:if="{{loadErrorText}}" class="experience-webview__loading-error">{{loadErrorText}}</view>
</view>
<web-view
wx:if="{{webViewReady && webViewSrc}}"
style="height: 100%;"
src="{{webViewSrc}}"
bindmessage="handleWebViewMessage"
binderror="handleWebViewError"
></web-view>
</view>
</view>
</view>

View File

@@ -1,12 +1,94 @@
.page {
height: 100%;
}
page {
background: #f5f7f6;
background: transparent;
}
.experience-shell {
position: relative;
min-height: 100vh;
overflow: hidden;
}
.experience-shell__backdrop {
position: absolute;
inset: 0;
background: rgba(14, 18, 17, 0.48);
}
.experience-shell__panel {
position: absolute;
left: 24rpx;
right: 24rpx;
background: #f6faf7;
border: 2rpx solid rgba(21, 36, 27, 0.08);
box-shadow: 0 24rpx 64rpx rgba(19, 31, 25, 0.22);
overflow: hidden;
}
.experience-shell__panel--sheet {
bottom: 24rpx;
border-radius: 36rpx 36rpx 24rpx 24rpx;
}
.experience-shell__panel--dialog {
top: 50%;
transform: translateY(-50%);
border-radius: 32rpx;
}
.experience-shell__panel--fullscreen {
top: 12rpx;
bottom: 12rpx;
left: 12rpx;
right: 12rpx;
border-radius: 24rpx;
}
.experience-shell__header {
display: flex;
align-items: center;
justify-content: space-between;
gap: 20rpx;
padding: 24rpx 24rpx 18rpx;
background: linear-gradient(180deg, rgba(227, 243, 234, 0.96), rgba(246, 250, 247, 0.96));
border-bottom: 2rpx solid rgba(30, 63, 46, 0.08);
}
.experience-shell__header-copy {
min-width: 0;
flex: 1;
}
.experience-shell__title {
color: #13241c;
font-size: 32rpx;
font-weight: 700;
line-height: 1.25;
}
.experience-shell__subtitle {
margin-top: 6rpx;
color: #557463;
font-size: 22rpx;
line-height: 1.35;
}
.experience-shell__close {
flex-shrink: 0;
padding: 12rpx 22rpx;
border-radius: 999rpx;
background: rgba(23, 46, 34, 0.08);
color: #244432;
font-size: 24rpx;
font-weight: 600;
}
.experience-shell__body {
position: relative;
background: #f6faf7;
}
.experience-webview__loading {
min-height: 100vh;
height: 100%;
display: flex;
flex-direction: column;
align-items: center;

View File

@@ -800,8 +800,11 @@ Page({
punchFeedbackText: '',
punchFeedbackTone: 'neutral',
contentCardVisible: false,
contentCardTemplate: 'story',
contentCardTitle: '',
contentCardBody: '',
contentCardActionVisible: false,
contentCardActionText: '查看详情',
punchButtonFxClass: '',
panelProgressFxClass: '',
panelDistanceFxClass: '',
@@ -1117,8 +1120,11 @@ Page({
punchFeedbackText: '',
punchFeedbackTone: 'neutral',
contentCardVisible: false,
contentCardTemplate: 'story',
contentCardTitle: '',
contentCardBody: '',
contentCardActionVisible: false,
contentCardActionText: '查看详情',
punchButtonFxClass: '',
panelProgressFxClass: '',
panelDistanceFxClass: '',
@@ -1903,6 +1909,19 @@ Page({
}
},
handleOpenContentCardDetail() {
if (mapEngine) {
wx.showToast({
title: '打开详情',
icon: 'none',
duration: 900,
})
mapEngine.openCurrentContentCardDetail()
}
},
handleContentCardTap() {},
openH5Experience(request: H5ExperienceRequest) {
wx.navigateTo({
url: '/pages/experience-webview/experience-webview',

View File

@@ -29,13 +29,6 @@
<view class="map-stage__stage-fx {{stageFxClass}}" wx:if="{{stageFxVisible}}"></view>
<view class="game-punch-feedback game-punch-feedback--{{punchFeedbackTone}} {{punchFeedbackFxClass}}" wx:if="{{punchFeedbackVisible}}">{{punchFeedbackText}}</view>
<view class="game-content-card {{contentCardFxClass}}" wx:if="{{contentCardVisible}}" bindtap="handleCloseContentCard">
<view class="game-content-card__title">{{contentCardTitle}}</view>
<view class="game-content-card__body">{{contentCardBody}}</view>
<view class="game-content-card__hint">点击关闭</view>
</view>
<view class="map-stage__overlay-center-layer" wx:if="{{!showDebugPanel && !showGameInfoPanel && !showResultScene && !showSystemSettingsPanel}}">
<view class="center-scale-ruler" wx:if="{{centerScaleRulerVisible}}" style="left: {{centerScaleRulerCenterXPx}}px; top: {{centerScaleRulerZeroYPx}}px; height: {{centerScaleRulerHeightPx}}px;">
<view class="center-scale-ruler__axis" style="bottom: {{centerScaleRulerAxisBottomPx}}px;"></view>
@@ -80,6 +73,23 @@
</view>
</view>
<view
class="game-content-card game-content-card--{{contentCardTemplate}} {{contentCardFxClass}}"
wx:if="{{contentCardVisible}}"
catchtap="handleContentCardTap"
>
<view class="game-content-card__title">{{contentCardTitle}}</view>
<view class="game-content-card__body">{{contentCardBody}}</view>
<view class="game-content-card__action-row {{contentCardActionVisible ? 'game-content-card__action-row--split' : ''}}">
<view
wx:if="{{contentCardActionVisible}}"
class="game-content-card__action"
catchtap="handleOpenContentCardDetail"
>{{contentCardActionText}}</view>
<view class="game-content-card__close" catchtap="handleCloseContentCard">关闭</view>
</view>
</view>
<view class="game-punch-hint" wx:if="{{!showResultScene && showPunchHintBanner && punchHintText}}" style="top: {{topInsetHeight}}px;" catchtouchstart="handlePunchHintTap" catchtouchmove="handlePunchHintTap" catchtouchend="handlePunchHintTap">
<view class="game-punch-hint__text">{{punchHintText}}</view>
<view class="game-punch-hint__close" catchtouchstart="handlePunchHintTap" catchtouchmove="handlePunchHintTap" catchtouchend="handlePunchHintTap" catchtap="handleClosePunchHint">×</view>

View File

@@ -2003,7 +2003,24 @@
background: rgba(248, 251, 244, 0.96);
box-shadow: 0 18rpx 48rpx rgba(22, 48, 32, 0.18);
box-sizing: border-box;
z-index: 17;
z-index: 33;
pointer-events: auto;
}
.game-content-card--minimal {
width: 396rpx;
padding: 24rpx 24rpx 20rpx;
border-radius: 24rpx;
background: rgba(248, 251, 244, 0.94);
}
.game-content-card--focus {
width: 468rpx;
padding: 30rpx 30rpx 26rpx;
border-radius: 30rpx;
background: linear-gradient(180deg, rgba(240, 248, 241, 0.98), rgba(248, 251, 244, 0.96));
box-shadow: 0 22rpx 54rpx rgba(22, 48, 32, 0.2);
border: 2rpx solid rgba(92, 139, 109, 0.14);
}
.game-content-card__title {
@@ -2013,6 +2030,15 @@
color: #163020;
}
.game-content-card--minimal .game-content-card__title {
font-size: 30rpx;
}
.game-content-card--focus .game-content-card__title {
font-size: 36rpx;
color: #103020;
}
.game-content-card__body {
margin-top: 12rpx;
font-size: 24rpx;
@@ -2020,10 +2046,52 @@
color: #45624b;
}
.game-content-card__hint {
margin-top: 16rpx;
font-size: 20rpx;
color: #809284;
.game-content-card--minimal .game-content-card__body {
margin-top: 10rpx;
font-size: 22rpx;
}
.game-content-card--focus .game-content-card__body {
margin-top: 14rpx;
color: #3f5f49;
}
.game-content-card__action-row {
margin-top: 18rpx;
display: flex;
align-items: center;
justify-content: flex-end;
gap: 16rpx;
}
.game-content-card__action-row--split {
justify-content: space-between;
}
.game-content-card__action {
display: inline-flex;
align-items: center;
justify-content: center;
min-height: 56rpx;
padding: 0 22rpx;
border-radius: 999rpx;
background: rgba(25, 78, 47, 0.1);
color: #18472d;
font-size: 22rpx;
font-weight: 700;
}
.game-content-card__close {
display: inline-flex;
align-items: center;
justify-content: center;
min-height: 56rpx;
padding: 0 22rpx;
border-radius: 999rpx;
background: rgba(16, 32, 20, 0.06);
color: #5a685f;
font-size: 22rpx;
font-weight: 600;
}
.game-content-card--fx-pop {

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 } : {}),