统一推荐页游客运行态与切换队列

统一推荐页各玩法正式 runtime 的游客鉴权透传。

收口推荐页首页展示队列和嵌入运行态切换队列。

补齐未登录读档、签名资产和个人数据读取的游客态处理。

新增运行态 HUD 小尺寸 logo 资源并更新拼图与抓鹅展示。

补充推荐切换、runtime guest 启动和客户端请求回归测试。

更新玩法链路、后端契约和团队记忆文档。
This commit is contained in:
2026-06-10 22:00:19 +08:00
parent e29992cf01
commit 7dd53e95d8
41 changed files with 1372 additions and 376 deletions

View File

@@ -318,6 +318,7 @@ import {
submitRpgProfileFeedback,
} from '../../services/rpg-entry/rpgProfileClient';
import { requestRpgRuntimeJson } from '../../services/rpg-runtime/rpgRuntimeRequest';
import { type RuntimeGuestRequestOptions } from '../../services/runtimeGuestAuth';
import { squareHoleCreationClient } from '../../services/square-hole-creation';
import {
dropSquareHoleShape,
@@ -372,13 +373,16 @@ import {
type CreationWorkShelfItem,
isPersistedBarkBattleDraftGenerating,
} from '../custom-world-home/creationWorkShelf';
import { selectAdjacentPlatformRecommendEntry } from '../rpg-entry/rpgEntryPublicGalleryViewModel';
import {
buildPlatformRecommendFeedEntries,
selectAdjacentPlatformRecommendEntry,
} from '../rpg-entry/rpgEntryPublicGalleryViewModel';
import {
isBigFishGalleryEntry,
isEdutainmentGalleryEntry,
isJumpHopGalleryEntry,
isPuzzleGalleryEntry,
isPuzzleClearGalleryEntry,
isPuzzleGalleryEntry,
mapPuzzleClearWorkToPlatformGalleryCard,
mapPuzzleWorkToPlatformGalleryCard,
type PlatformPublicGalleryCard,
@@ -492,7 +496,6 @@ import {
import {
canExposePublicWork,
EDUTAINMENT_HIDDEN_MESSAGE,
filterGeneralPublicWorks,
} from './platformEdutainmentVisibility';
import { PlatformEntryCreationTypeModal } from './PlatformEntryCreationTypeModal';
import type { PlatformCreationTypeId } from './platformEntryCreationTypes';
@@ -523,7 +526,6 @@ import { PlatformEntryWorldDetailView } from './PlatformEntryWorldDetailView';
import { PlatformErrorDialog } from './PlatformErrorDialog';
import { PlatformFeedbackView } from './PlatformFeedbackView';
import { resolvePlatformGenerationProgressTickDecision } from './platformGenerationProgressTickModel';
import { buildPlatformRecommendedEntries } from './platformRecommendation';
import {
buildMatch3DProfileFromSession,
hasMatch3DRuntimeAsset,
@@ -1476,6 +1478,8 @@ export function PlatformEntryFlowShellImpl({
useState<MiniGameDraftGenerationState | null>(null);
const [jumpHopError, setJumpHopError] = useState<string | null>(null);
const [isJumpHopBusy, setIsJumpHopBusy] = useState(false);
const [barkBattleRuntimeRequestOptions, setBarkBattleRuntimeRequestOptions] =
useState<RuntimeGuestRequestOptions | null>(null);
const [puzzleClearSession, setPuzzleClearSession] =
useState<PuzzleClearSessionSnapshotResponse | null>(null);
const [puzzleClearRun, setPuzzleClearRun] = useState<
@@ -1579,6 +1583,34 @@ export function PlatformEntryFlowShellImpl({
useState<PuzzleRuntimeReturnStage>('puzzle-gallery-detail');
const [puzzleRuntimeAuthMode, setPuzzleRuntimeAuthMode] =
useState<PuzzleRuntimeAuthMode>('default');
const buildRecommendRuntimeRequestOptions = useCallback(
async (
input: {
kind?: RecommendRuntimeKind;
embedded?: boolean;
forcePublicRuntime?: boolean;
} = {},
) => {
const shouldUseRuntimeOptions = Boolean(
input.forcePublicRuntime ||
input.embedded ||
(input.kind && activeRecommendRuntimeKind === input.kind),
);
return shouldUseRuntimeOptions
? buildRecommendRuntimeAuthOptions(authUi, true)
: {};
},
[activeRecommendRuntimeKind, authUi],
);
const buildPuzzleRuntimeRequestOptions = useCallback(
() =>
buildRecommendRuntimeRequestOptions({
kind: 'puzzle',
forcePublicRuntime: puzzleRuntimeAuthMode === 'isolated',
}),
[buildRecommendRuntimeRequestOptions, puzzleRuntimeAuthMode],
);
const [isPuzzleLeaderboardBusy, setIsPuzzleLeaderboardBusy] = useState(false);
const submittedPuzzleLeaderboardKeysRef = useRef(new Set<string>());
const puzzleStartInFlightKeyRef = useRef<string | null>(null);
@@ -2910,10 +2942,10 @@ export function PlatformEntryFlowShellImpl({
} = publicGalleryFeeds;
const recommendRuntimeEntries = useMemo(
() =>
buildPlatformRecommendedEntries({
featuredEntries: filterGeneralPublicWorks(featuredGalleryEntries),
latestEntries: filterGeneralPublicWorks(latestGalleryEntries),
}),
buildPlatformRecommendFeedEntries(
featuredGalleryEntries,
latestGalleryEntries,
),
[featuredGalleryEntries, latestGalleryEntries],
);
@@ -6971,15 +7003,17 @@ export function PlatformEntryFlowShellImpl({
profileId: targetProfileId,
mode: 'play' as const,
};
const runtimeGuestOptions =
options.embedded || workDetail.summary.publishStatus === 'draft'
? await buildRecommendRuntimeAuthOptions(authUi, true)
: {};
const runtimeRequestOptions = await buildRecommendRuntimeRequestOptions(
{
kind: 'visual-novel',
embedded: options.embedded,
},
);
const { run } = options.embedded
? await startVisualNovelRun(
targetProfileId,
startRunPayload,
runtimeGuestOptions,
runtimeRequestOptions,
)
: await startVisualNovelRun(targetProfileId, startRunPayload);
setVisualNovelWork(workDetail);
@@ -7005,7 +7039,7 @@ export function PlatformEntryFlowShellImpl({
}
},
[
authUi,
buildRecommendRuntimeRequestOptions,
resolvePuzzleErrorMessage,
setIsVisualNovelBusy,
setSelectionStage,
@@ -7027,14 +7061,14 @@ export function PlatformEntryFlowShellImpl({
setVisualNovelError(null);
setIsVisualNovelBusy(true);
try {
const runtimeGuestOptions =
activeRecommendRuntimeKind === 'visual-novel'
? await buildRecommendRuntimeAuthOptions(authUi, true)
: {};
const runtimeRequestOptions =
await buildRecommendRuntimeRequestOptions({
kind: 'visual-novel',
});
const nextRun = await streamVisualNovelRuntimeAction(
visualNovelRun.runId,
payload,
runtimeGuestOptions,
runtimeRequestOptions,
);
setVisualNovelRun(nextRun);
} catch (error) {
@@ -7046,8 +7080,7 @@ export function PlatformEntryFlowShellImpl({
}
},
[
activeRecommendRuntimeKind,
authUi,
buildRecommendRuntimeRequestOptions,
isVisualNovelBusy,
resolvePuzzleErrorMessage,
setIsVisualNovelBusy,
@@ -7496,22 +7529,15 @@ export function PlatformEntryFlowShellImpl({
setJumpHopError(null);
setJumpHopRuntimeReturnStage(options.returnStage ?? 'work-detail');
try {
const runtimeGuestOptions =
options.embedded || shouldUseRecommendRuntimeGuestAuth(authUi)
? await buildRecommendRuntimeAuthOptions(authUi, true)
: RECOMMEND_RUNTIME_BACKGROUND_AUTH_OPTIONS;
const runtimeRequestOptions =
await buildRecommendRuntimeRequestOptions({
kind: 'jump-hop',
embedded: options.embedded,
forcePublicRuntime: shouldUseRecommendRuntimeGuestAuth(authUi),
});
setJumpHopRuntimeRequestOptions(
runtimeGuestOptions.runtimeGuestToken?.trim()
? {
runtimeGuestToken: runtimeGuestOptions.runtimeGuestToken,
authImpact: runtimeGuestOptions.authImpact,
skipAuth: runtimeGuestOptions.skipAuth,
skipRefresh: runtimeGuestOptions.skipRefresh,
notifyAuthStateChange:
runtimeGuestOptions.notifyAuthStateChange,
clearAuthOnUnauthorized:
runtimeGuestOptions.clearAuthOnUnauthorized,
}
Object.keys(runtimeRequestOptions).length > 0
? runtimeRequestOptions
: null,
);
const [detail, runResponse] = await Promise.all([
@@ -7521,7 +7547,7 @@ export function PlatformEntryFlowShellImpl({
.getWorkDetail(normalizedProfileId)
.catch(() => null),
jumpHopClient.startRun(normalizedProfileId, {
...runtimeGuestOptions,
...runtimeRequestOptions,
runtimeMode: 'published',
}),
]);
@@ -7548,7 +7574,7 @@ export function PlatformEntryFlowShellImpl({
setIsJumpHopBusy(false);
}
},
[authUi, setSelectionStage],
[authUi, buildRecommendRuntimeRequestOptions, setSelectionStage],
);
useEffect(() => {
@@ -7989,15 +8015,16 @@ export function PlatformEntryFlowShellImpl({
setPuzzleClearError(null);
setPuzzleClearRuntimeReturnStage(options.returnStage ?? 'work-detail');
try {
const runtimeGuestOptions = await buildRecommendRuntimeAuthOptions(
authUi,
options.embedded,
);
const runtimeRequestOptions =
await buildRecommendRuntimeRequestOptions({
kind: 'puzzle-clear',
embedded: options.embedded,
});
const [detail, runResponse] = await Promise.all([
puzzleClearClient
.getRuntimeWorkDetail(normalizedProfileId)
.catch(() => null),
puzzleClearClient.startRun(normalizedProfileId, runtimeGuestOptions),
puzzleClearClient.startRun(normalizedProfileId, runtimeRequestOptions),
]);
if (detail?.item) {
setPuzzleClearWork(detail.item);
@@ -8022,7 +8049,7 @@ export function PlatformEntryFlowShellImpl({
setIsPuzzleClearBusy(false);
}
},
[authUi, setSelectionStage],
[buildRecommendRuntimeRequestOptions, setSelectionStage],
);
const retryPuzzleClearLevelRun = useCallback(async () => {
@@ -8047,7 +8074,14 @@ export function PlatformEntryFlowShellImpl({
setIsPuzzleClearBusy(true);
setPuzzleClearError(null);
try {
const response = await puzzleClearClient.retryLevel(runId);
const runtimeRequestOptions =
await buildRecommendRuntimeRequestOptions({
kind: 'puzzle-clear',
});
const response = await puzzleClearClient.retryLevel(
runId,
runtimeRequestOptions,
);
setPuzzleClearRun(response.run);
} catch (error) {
setPuzzleClearError(
@@ -8059,6 +8093,7 @@ export function PlatformEntryFlowShellImpl({
}, [
puzzleClearRun,
puzzleClearWork,
buildRecommendRuntimeRequestOptions,
setSelectionStage,
startPuzzleClearTestRunFromProfile,
]);
@@ -8084,7 +8119,14 @@ export function PlatformEntryFlowShellImpl({
setIsPuzzleClearBusy(true);
setPuzzleClearError(null);
try {
const response = await puzzleClearClient.advanceNextLevel(runId);
const runtimeRequestOptions =
await buildRecommendRuntimeRequestOptions({
kind: 'puzzle-clear',
});
const response = await puzzleClearClient.advanceNextLevel(
runId,
runtimeRequestOptions,
);
setPuzzleClearRun(response.run);
} catch (error) {
setPuzzleClearError(
@@ -8093,7 +8135,12 @@ export function PlatformEntryFlowShellImpl({
} finally {
setIsPuzzleClearBusy(false);
}
}, [puzzleClearRun, puzzleClearWork, setSelectionStage]);
}, [
puzzleClearRun,
puzzleClearWork,
buildRecommendRuntimeRequestOptions,
setSelectionStage,
]);
const markPuzzleClearLevelTimeUp = useCallback(async () => {
const runId = puzzleClearRun?.runId;
@@ -8107,14 +8154,21 @@ export function PlatformEntryFlowShellImpl({
}
try {
const response = await puzzleClearClient.markTimeUp(runId);
const runtimeRequestOptions =
await buildRecommendRuntimeRequestOptions({
kind: 'puzzle-clear',
});
const response = await puzzleClearClient.markTimeUp(
runId,
runtimeRequestOptions,
);
setPuzzleClearRun(response.run);
} catch (error) {
setPuzzleClearError(
resolveRpgCreationErrorMessage(error, '同步拼消消倒计时失败。'),
);
}
}, [puzzleClearRun]);
}, [puzzleClearRun, buildRecommendRuntimeRequestOptions]);
const swapPuzzleClearCardsInRun = useCallback(
async (payload: {
@@ -8133,7 +8187,15 @@ export function PlatformEntryFlowShellImpl({
return;
}
try {
const response = await puzzleClearClient.swapCards(runId, payload);
const runtimeRequestOptions =
await buildRecommendRuntimeRequestOptions({
kind: 'puzzle-clear',
});
const response = await puzzleClearClient.swapCards(
runId,
payload,
runtimeRequestOptions,
);
setPuzzleClearRun(response.run);
} catch (error) {
setPuzzleClearError(
@@ -8141,7 +8203,7 @@ export function PlatformEntryFlowShellImpl({
);
}
},
[puzzleClearRun],
[puzzleClearRun, buildRecommendRuntimeRequestOptions],
);
const compileWoodenFishSession = useCallback(
@@ -8493,16 +8555,17 @@ export function PlatformEntryFlowShellImpl({
setWoodenFishError(null);
setWoodenFishRuntimeReturnStage(options.returnStage ?? 'work-detail');
try {
const runtimeGuestOptions = await buildRecommendRuntimeAuthOptions(
authUi,
options.embedded,
);
const runtimeRequestOptions =
await buildRecommendRuntimeRequestOptions({
kind: 'wooden-fish',
embedded: options.embedded,
});
const [detail, runResponse] = await Promise.all([
woodenFishClient.getWorkDetail(normalizedProfileId).catch(() => null),
options.embedded
? woodenFishClient.startRun(
normalizedProfileId,
runtimeGuestOptions,
runtimeRequestOptions,
)
: woodenFishClient.startRun(normalizedProfileId),
]);
@@ -8529,7 +8592,7 @@ export function PlatformEntryFlowShellImpl({
setIsWoodenFishBusy(false);
}
},
[authUi, setSelectionStage],
[buildRecommendRuntimeRequestOptions, setSelectionStage],
);
const checkpointWoodenFishRuntimeRun = useCallback(
@@ -8541,10 +8604,18 @@ export function PlatformEntryFlowShellImpl({
if (!runId) {
return;
}
const response = await woodenFishClient.checkpointRun(runId, payload);
const runtimeRequestOptions =
await buildRecommendRuntimeRequestOptions({
kind: 'wooden-fish',
});
const response = await woodenFishClient.checkpointRun(
runId,
payload,
runtimeRequestOptions,
);
setWoodenFishRun(response.run);
},
[woodenFishRun?.runId],
[buildRecommendRuntimeRequestOptions, woodenFishRun?.runId],
);
const executePuzzleAction = puzzleFlow.executeAction;
@@ -9015,9 +9086,12 @@ export function PlatformEntryFlowShellImpl({
try {
let runtimeProfile: Match3DWorkProfile | Match3DWorkSummary = profile;
const canReadProtectedMatch3DDetail =
!options.embedded || !shouldUseRecommendRuntimeGuestAuth(authUi);
if (
!hasMatch3DRuntimeAsset(profile.generatedItemAssets) ||
!hasMatch3DRuntimeBackgroundAsset(profile)
canReadProtectedMatch3DDetail &&
(!hasMatch3DRuntimeAsset(profile.generatedItemAssets) ||
!hasMatch3DRuntimeBackgroundAsset(profile))
) {
try {
const { item } = await getMatch3DWorkDetail(profile.profileId);
@@ -9043,12 +9117,14 @@ export function PlatformEntryFlowShellImpl({
runtimeProfile.generatedBackgroundAsset,
{ expireSeconds: 300 },
);
const runtimeGuestOptions =
options.authMode === 'isolated'
? RECOMMEND_RUNTIME_BACKGROUND_AUTH_OPTIONS
: await buildRecommendRuntimeAuthOptions(authUi, options.embedded);
const runtimeRequestOptions =
await buildRecommendRuntimeRequestOptions({
kind: 'match3d',
embedded: options.embedded,
forcePublicRuntime: options.authMode === 'isolated',
});
const runtimeOptions = {
...runtimeGuestOptions,
...runtimeRequestOptions,
...(typeof options.itemTypeCountOverride === 'number'
? { itemTypeCountOverride: options.itemTypeCountOverride }
: {}),
@@ -9097,6 +9173,7 @@ export function PlatformEntryFlowShellImpl({
[
isMatch3DBusy,
authUi,
buildRecommendRuntimeRequestOptions,
match3dFlow,
resolveMatch3DErrorMessage,
resolveMatch3DRuntimeAdapter,
@@ -9120,12 +9197,13 @@ export function PlatformEntryFlowShellImpl({
setSquareHoleError(null);
try {
const runtimeGuestOptions = await buildRecommendRuntimeAuthOptions(
authUi,
options.embedded,
);
const runtimeRequestOptions =
await buildRecommendRuntimeRequestOptions({
kind: 'square-hole',
embedded: options.embedded,
});
const { run } = options.embedded
? await startSquareHoleRun(profile.profileId, runtimeGuestOptions)
? await startSquareHoleRun(profile.profileId, runtimeRequestOptions)
: await startSquareHoleRun(profile.profileId);
setSquareHoleRun(run);
setSquareHoleRuntimeReturnStage(returnStage);
@@ -9157,7 +9235,7 @@ export function PlatformEntryFlowShellImpl({
},
[
isSquareHoleBusy,
authUi,
buildRecommendRuntimeRequestOptions,
resolveSquareHoleErrorMessage,
setSelectionStage,
setSquareHoleError,
@@ -9275,14 +9353,14 @@ export function PlatformEntryFlowShellImpl({
bigFishInputInFlightRef.current = true;
try {
const runtimeGuestOptions =
activeRecommendRuntimeKind === 'big-fish'
? await buildRecommendRuntimeAuthOptions(authUi, true)
: {};
const runtimeRequestOptions =
await buildRecommendRuntimeRequestOptions({
kind: 'big-fish',
});
const { run } = await submitBigFishRuntimeInput(
bigFishRun.runId,
payload,
runtimeGuestOptions,
runtimeRequestOptions,
);
setBigFishRun(run);
} catch (error) {
@@ -9294,8 +9372,7 @@ export function PlatformEntryFlowShellImpl({
}
},
[
activeRecommendRuntimeKind,
authUi,
buildRecommendRuntimeRequestOptions,
bigFishRun,
resolveBigFishErrorMessage,
setBigFishError,
@@ -9310,21 +9387,18 @@ export function PlatformEntryFlowShellImpl({
const elapsedMs = Math.max(1_000, Date.now() - bigFishRuntimeStartedAt);
setBigFishRuntimeStartedAt(null);
const reportPromise =
activeRecommendRuntimeKind === 'big-fish'
? buildRecommendRuntimeAuthOptions(authUi, true).then(
(runtimeAuthOptions) =>
recordBigFishPlay(sessionId, { elapsedMs }, runtimeAuthOptions),
)
: recordBigFishPlay(sessionId, { elapsedMs });
const reportPromise = buildRecommendRuntimeRequestOptions({
kind: 'big-fish',
}).then((runtimeRequestOptions) =>
recordBigFishPlay(sessionId, { elapsedMs }, runtimeRequestOptions),
);
void reportPromise.catch((error) => {
setBigFishError(
resolveBigFishErrorMessage(error, '记录大鱼吃小鱼游玩时长失败。'),
);
});
}, [
activeRecommendRuntimeKind,
authUi,
buildRecommendRuntimeRequestOptions,
bigFishRun?.sessionId,
bigFishRuntimeStartedAt,
resolveBigFishErrorMessage,
@@ -9642,14 +9716,11 @@ export function PlatformEntryFlowShellImpl({
profileId: currentLevel.profileId,
levelId: resolvePuzzleRestartLevelId(currentRun, detailItem),
};
const runtimeGuestOptions =
puzzleRuntimeAuthMode === 'isolated'
? await buildRecommendRuntimeGuestOptions()
: {};
const { run } =
puzzleRuntimeAuthMode === 'isolated'
? await startPuzzleRun(startRunPayload, runtimeGuestOptions)
: await startPuzzleRun(startRunPayload);
const runtimeRequestOptions = await buildPuzzleRuntimeRequestOptions();
const { run } = await startPuzzleRun(
startRunPayload,
runtimeRequestOptions,
);
setSelectedPuzzleDetail(detailItem);
puzzleRunRef.current = run;
setPuzzleRun(run);
@@ -9663,7 +9734,7 @@ export function PlatformEntryFlowShellImpl({
}, [
isPuzzleBusy,
puzzleRun,
puzzleRuntimeAuthMode,
buildPuzzleRuntimeRequestOptions,
resolvePuzzleErrorMessage,
selectedPuzzleDetail,
setIsPuzzleBusy,
@@ -9775,16 +9846,10 @@ export function PlatformEntryFlowShellImpl({
return;
}
const submitLeaderboardPromise =
puzzleRuntimeAuthMode === 'isolated'
? buildRecommendRuntimeGuestOptions().then((runtimeGuestOptions) =>
submitPuzzleLeaderboard(
puzzleRun.runId,
payload,
runtimeGuestOptions,
),
)
: submitPuzzleLeaderboard(puzzleRun.runId, payload);
const submitLeaderboardPromise = buildPuzzleRuntimeRequestOptions().then(
(runtimeRequestOptions) =>
submitPuzzleLeaderboard(puzzleRun.runId, payload, runtimeRequestOptions),
);
void submitLeaderboardPromise
.then(({ run }) => {
@@ -9808,7 +9873,7 @@ export function PlatformEntryFlowShellImpl({
authUi?.user?.displayName,
platformBootstrap,
puzzleRun,
puzzleRuntimeAuthMode,
buildPuzzleRuntimeRequestOptions,
resolvePuzzleErrorMessage,
setPuzzleError,
]);
@@ -9838,10 +9903,7 @@ export function PlatformEntryFlowShellImpl({
return;
}
const runtimeGuestOptions =
puzzleRuntimeAuthMode === 'isolated'
? await buildRecommendRuntimeGuestOptions()
: {};
const runtimeRequestOptions = await buildPuzzleRuntimeRequestOptions();
const targetProfileId = _target?.profileId?.trim() ?? '';
if (puzzleRun.nextLevelMode === 'similarWorks' && targetProfileId) {
const itemPromise =
@@ -9850,18 +9912,13 @@ export function PlatformEntryFlowShellImpl({
: getPuzzleGalleryDetail(targetProfileId).then(
(response) => response.item,
);
const advancePromise =
puzzleRuntimeAuthMode === 'isolated'
? advancePuzzleNextLevel(
puzzleRun.runId,
{
targetProfileId,
},
runtimeGuestOptions,
)
: advancePuzzleNextLevel(puzzleRun.runId, {
targetProfileId,
});
const advancePromise = advancePuzzleNextLevel(
puzzleRun.runId,
{
targetProfileId,
},
runtimeRequestOptions,
);
const [{ run }, item] = await Promise.all([
advancePromise,
itemPromise,
@@ -9878,14 +9935,11 @@ export function PlatformEntryFlowShellImpl({
return;
}
const { run } =
puzzleRuntimeAuthMode === 'isolated'
? await advancePuzzleNextLevel(
puzzleRun.runId,
{},
runtimeGuestOptions,
)
: await advancePuzzleNextLevel(puzzleRun.runId, {});
const { run } = await advancePuzzleNextLevel(
puzzleRun.runId,
{},
runtimeRequestOptions,
);
setPuzzleRun(run);
} catch (error) {
setPuzzleError(resolvePuzzleErrorMessage(error, '准备下一关失败。'));
@@ -9898,7 +9952,7 @@ export function PlatformEntryFlowShellImpl({
isPuzzleBusy,
isPuzzleLeaderboardBusy,
puzzleRun,
puzzleRuntimeAuthMode,
buildPuzzleRuntimeRequestOptions,
resolvePuzzleErrorMessage,
selectedPuzzleDetail,
setIsPuzzleBusy,
@@ -12436,12 +12490,13 @@ export function PlatformEntryFlowShellImpl({
setBigFishRuntimeReturnStage(returnStage);
setBigFishRun(null);
try {
const runtimeGuestOptions = await buildRecommendRuntimeAuthOptions(
authUi,
options.embedded,
);
const runtimeRequestOptions =
await buildRecommendRuntimeRequestOptions({
kind: 'big-fish',
embedded: options.embedded,
});
const { run } = options.embedded
? await startBigFishRuntimeRun(sessionId, runtimeGuestOptions)
? await startBigFishRuntimeRun(sessionId, runtimeRequestOptions)
: await startBigFishRuntimeRun(sessionId);
setBigFishRuntimeStartedAt(Date.now());
setBigFishRun(run);
@@ -12452,7 +12507,7 @@ export function PlatformEntryFlowShellImpl({
);
}
const recordPlayPromise = options.embedded
? recordBigFishPlay(sessionId, { elapsedMs: 0 }, runtimeGuestOptions)
? recordBigFishPlay(sessionId, { elapsedMs: 0 }, runtimeRequestOptions)
: recordBigFishPlay(sessionId, { elapsedMs: 0 });
void recordPlayPromise.catch((error) => {
setBigFishError(
@@ -12468,7 +12523,7 @@ export function PlatformEntryFlowShellImpl({
}
},
[
authUi,
buildRecommendRuntimeRequestOptions,
bigFishFlow,
resolveBigFishErrorMessage,
setBigFishError,
@@ -12495,12 +12550,18 @@ export function PlatformEntryFlowShellImpl({
);
setBarkBattleRuntimeReturnStage(returnStage);
try {
const runtimeGuestOptions = await buildRecommendRuntimeAuthOptions(
authUi,
options.embedded,
const runtimeRequestOptions =
await buildRecommendRuntimeRequestOptions({
kind: 'bark-battle',
embedded: options.embedded,
});
setBarkBattleRuntimeRequestOptions(
Object.keys(runtimeRequestOptions).length > 0
? runtimeRequestOptions
: null,
);
const runResponse = options.embedded
? await startBarkBattleRun(item.workId, {}, runtimeGuestOptions)
? await startBarkBattleRun(item.workId, {}, runtimeRequestOptions)
: await startBarkBattleRun(item.workId);
void runResponse;
selectionStageRef.current = 'bark-battle-runtime';
@@ -12521,7 +12582,11 @@ export function PlatformEntryFlowShellImpl({
return false;
}
},
[authUi, resolveBarkBattleErrorMessage, setSelectionStage],
[
buildRecommendRuntimeRequestOptions,
resolveBarkBattleErrorMessage,
setSelectionStage,
],
);
const startSelectedPublicWork = useCallback(() => {
@@ -12975,10 +13040,12 @@ export function PlatformEntryFlowShellImpl({
match3dFlow.setIsBusy(true);
setMatch3DError(null);
void resolveMatch3DRuntimeAdapter(
activeMatch3DRuntimeProfile?.profileId,
)
.restartRun(match3dRun.runId)
void buildRecommendRuntimeRequestOptions({ kind: 'match3d' })
.then((runtimeRequestOptions) =>
resolveMatch3DRuntimeAdapter(
activeMatch3DRuntimeProfile?.profileId,
).restartRun(match3dRun.runId, runtimeRequestOptions),
)
.then(({ run }) => {
setMatch3DRun(run);
})
@@ -12992,24 +13059,28 @@ export function PlatformEntryFlowShellImpl({
});
}}
onOptimisticRunChange={setMatch3DRun}
onClickItem={(payload) => {
onClickItem={async (payload) => {
const runId = payload.runId ?? match3dRun?.runId;
if (!runId) {
return Promise.reject(new Error('抓大鹅运行态缺少 runId。'));
}
const runtimeRequestOptions =
await buildRecommendRuntimeRequestOptions({ kind: 'match3d' });
return resolveMatch3DRuntimeAdapter(
activeMatch3DRuntimeProfile?.profileId,
).clickItem(runId, payload);
).clickItem(runId, payload, runtimeRequestOptions);
}}
onTimeExpired={() => {
if (!match3dRun?.runId) {
return;
}
void resolveMatch3DRuntimeAdapter(
activeMatch3DRuntimeProfile?.profileId,
)
.finishTimeUp(match3dRun.runId)
void buildRecommendRuntimeRequestOptions({ kind: 'match3d' })
.then((runtimeRequestOptions) =>
resolveMatch3DRuntimeAdapter(
activeMatch3DRuntimeProfile?.profileId,
).finishTimeUp(match3dRun.runId, runtimeRequestOptions),
)
.then(({ run }) => {
setMatch3DRun(run);
})
@@ -13143,9 +13214,17 @@ export function PlatformEntryFlowShellImpl({
squareHoleRun?.runId &&
squareHoleRun.status.toLowerCase() === 'running'
) {
void stopSquareHoleRun(squareHoleRun.runId).catch(
() => undefined,
);
void buildRecommendRuntimeRequestOptions({
kind: 'square-hole',
})
.then((runtimeRequestOptions) =>
stopSquareHoleRun(
squareHoleRun.runId,
undefined,
runtimeRequestOptions,
),
)
.catch(() => undefined);
}
setActiveRecommendRuntimeKind(null);
}}
@@ -13156,7 +13235,12 @@ export function PlatformEntryFlowShellImpl({
squareHoleFlow.setIsBusy(true);
setSquareHoleError(null);
void restartSquareHoleRun(squareHoleRun.runId)
void buildRecommendRuntimeRequestOptions({
kind: 'square-hole',
})
.then((runtimeRequestOptions) =>
restartSquareHoleRun(squareHoleRun.runId, runtimeRequestOptions),
)
.then(({ run }) => {
setSquareHoleRun(run);
})
@@ -13178,14 +13262,26 @@ export function PlatformEntryFlowShellImpl({
if (!runId) {
return Promise.reject(new Error('方洞挑战运行态缺少 runId。'));
}
return dropSquareHoleShape(runId, payload);
return buildRecommendRuntimeRequestOptions({
kind: 'square-hole',
}).then((runtimeRequestOptions) =>
dropSquareHoleShape(runId, payload, runtimeRequestOptions),
);
}}
onTimeExpired={() => {
if (!squareHoleRun?.runId) {
return;
}
void finishSquareHoleTimeUp(squareHoleRun.runId)
void buildRecommendRuntimeRequestOptions({
kind: 'square-hole',
})
.then((runtimeRequestOptions) =>
finishSquareHoleTimeUp(
squareHoleRun.runId,
runtimeRequestOptions,
),
)
.then(({ run }) => {
setSquareHoleRun(run);
})
@@ -13230,6 +13326,7 @@ export function PlatformEntryFlowShellImpl({
workId={barkBattlePublishedConfig.workId}
publishedConfig={barkBattlePublishedConfig}
runtimeMode="published"
runtimeRequestOptions={barkBattleRuntimeRequestOptions ?? undefined}
onExit={() => {
setActiveRecommendRuntimeKind(null);
}}
@@ -13260,7 +13357,9 @@ export function PlatformEntryFlowShellImpl({
activeRecommendEntryKey,
activeRecommendRuntimeKind,
barkBattlePublishedConfig,
barkBattleRuntimeRequestOptions,
babyObjectMatchDraft,
buildRecommendRuntimeRequestOptions,
bigFishError,
bigFishRun,
bigFishRuntimeShare,
@@ -13297,6 +13396,7 @@ export function PlatformEntryFlowShellImpl({
recommendRuntimeEntries,
remodelCurrentPuzzleRuntimeWork,
resolveMatch3DErrorMessage,
resolveMatch3DRuntimeAdapter,
resolveSquareHoleErrorMessage,
reportBigFishObservedPlayTime,
restartBigFishRun,
@@ -16663,6 +16763,9 @@ export function PlatformEntryFlowShellImpl({
workId={barkBattlePublishedConfig.workId}
publishedConfig={barkBattlePublishedConfig}
runtimeMode={barkBattleRuntimeMode}
runtimeRequestOptions={
barkBattleRuntimeRequestOptions ?? undefined
}
onExit={() => {
if (
barkBattleRuntimeReturnStage === 'bark-battle-result' &&