@series-inc/rundot-game-sdk 5.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,1085 @@
1
+ import { A as AnalyticsApi, s as RpcRequest, t as RpcResponse, u as RpcNotification, v as RpcClient, R as RundotGameAPI, H as Host, w as StorageApi, N as NavigationApi, Q as QuitOptions, x as NavigationStackInfo, y as PushAppOptions, z as NotificationsApi, C as ScheduleLocalNotification, D as ScheduleNotificationOptions, E as PopupsApi, F as ShowToastOptions, G as ShowInterstitialAdOptions, I as ShowRewardedAdOptions, J as ProfileApi, P as Profile, K as DeviceApi, L as DeviceInfo, M as EnvironmentApi, O as EnvironmentInfo, T as SystemApi, U as SafeArea, V as CdnApi, W as FetchFromCdnOptions, X as TimeApi, Y as ServerTimeData, Z as GetFutureTimeOptions, _ as AiApi, $ as AiChatCompletionRequest, a0 as AiChatCompletionData, a1 as HapticsApi, a2 as HapticFeedbackStyle, a3 as FeaturesApi, a4 as Experiment, a5 as LifecycleApi, a6 as SleepCallback, a7 as Subscription, a8 as AwakeCallback, a9 as PauseCallback, aa as ResumeCallback, ab as QuitCallback, ac as SimulationApi, ad as SimulationSlotValidationResult, h as SimulationSubscribeOptions, ae as SimulationBatchOperation, af as SimulationBatchOperationsResult, ag as SimulationAvailableItem, ah as SimulationPowerPreview, ai as SimulationSlotMutationResult, aj as SimulationSlotContainer, ak as SimulationAssignment, al as SimulationState, k as RundotGameSimulationConfig, am as ExecuteRecipeOptions, an as ExecuteRecipeResponse, ao as CollectRecipeResult, ap as ResetStateOptions, aq as ResetStateResult, ar as GetActiveRunsOptions, S as SimulationRunSummary, as as ExecuteScopedRecipeOptions, at as ExecuteScopedRecipeResult, au as GetAvailableRecipesOptions, av as GetAvailableRecipesResult, aw as Recipe, a as RecipeRequirementResult, ax as GetBatchRecipeRequirements, ay as TriggerRecipeChainOptions, az as RoomDataUpdate, aA as RoomMessageEvent, aB as ProposedMoveEvent, aC as RundotGameTransport, aD as RoomsApi, aE as CreateRoomOptions, r as RundotGameRoom, aF as JoinOrCreateRoomOptions, aG as JoinOrCreateResult, aH as ListRoomsOptions, aI as UpdateRoomDataOptions, aJ as RoomMessageRequest, aK as StartRoomGameOptions, aL as ProposeMoveRequest, aM as ProposeMoveResult, aN as ValidateMoveVerdict, aO as ValidateMoveResult, aP as RoomSubscriptionOptions, aQ as LoggingApi, aR as IapApi, aS as SpendCurrencyOptions, aT as LoadEmbeddedAssetsResponse, aU as SharedAssetsApi, aV as LeaderboardApi, aW as ScoreToken, aX as SubmitScoreParams, aY as SubmitScoreResult, aZ as GetPagedScoresOptions, a_ as PagedScoresResponse, a$ as PlayerRankOptions, b0 as PlayerRankResult, b1 as GetPodiumScoresOptions, b2 as PodiumScoresResponse, b3 as PreloaderApi, b4 as SocialApi, b5 as ShareMetadata, b6 as ShareLinkResult, b7 as SocialQRCodeOptions, b8 as QRCodeResult, b9 as Avatar3dApi, ba as AssetManifest, bb as Avatar3dConfig, bc as ShowEditorOptions, bd as Avatar3dEdits, be as AdsApi, bf as InitializationContext, bg as InitializationOptions } from './AdsApi-B_d_w_jB.js';
2
+ export { bh as AiMessage, bi as Asset, bj as Category, bW as HudInsets, bE as JoinOrCreateRoomEnvelopeResponse, bs as JoinRoomMatchCriteria, bR as LeaderboardAntiCheatConfig, bT as LeaderboardConfig, bS as LeaderboardDisplaySettings, bU as LeaderboardEntry, bO as LeaderboardModeConfig, bQ as LeaderboardPeriodConfig, bP as LeaderboardPeriodType, bN as LoadEmbeddedAssetsRequest, bk as MockAvatarApi, bn as NotificationTriggerInput, bq as OnNotificationCallback, bo as OnRequestCallback, bp as OnResponseCallback, bV as PodiumScoresContext, bv as ProposedMovePayload, bw as ROOM_GAME_PHASES, bF as RecipeInfo, bC as RoomEnvelopeResponse, bx as RoomGamePhase, bt as RoomMessageEventType, bu as RoomMessagePayload, bD as RoomsEnvelopeResponse, bM as RpcSharedAssetsApi, br as RpcTransport, bA as RundotGameRoomCustomMetadata, bB as RundotGameRoomPayload, bz as RundotGameRoomRules, by as RundotGameRoomRulesGameState, bJ as SimulationBatchOperationAssign, bK as SimulationBatchOperationRemove, bL as SimulationBatchOperationResult, bG as SimulationPersonalState, bH as SimulationRoomActiveRecipe, bI as SimulationRoomState, bl as SubPath, bm as TimeIntervalTriggerInput, bX as createHost } from './AdsApi-B_d_w_jB.js';
3
+ export { WEBVIEW_LIBRARY_SHIM_SOURCE, getWebviewLibraryShimSource } from './webview/index.js';
4
+
5
+ declare class MockAnalyticsApi implements AnalyticsApi {
6
+ recordCustomEvent(eventName: string, payload: Record<string, any>): Promise<void>;
7
+ trackFunnelStep(stepNumber: number, stepName: string, funnelName?: string): Promise<void>;
8
+ }
9
+
10
+ type RpcMessage = RpcRequest | RpcResponse | RpcNotification;
11
+
12
+ declare class RpcAnalyticsApi implements AnalyticsApi {
13
+ private readonly rpcClient;
14
+ constructor(rpcClient: RpcClient);
15
+ recordCustomEvent(eventName: string, payload: Record<string, any>): Promise<void>;
16
+ trackFunnelStep(stepNumber: number, stepName: string, funnelName?: string): Promise<void>;
17
+ }
18
+
19
+ declare function initializeAnalytics(rundotGameApiInstance: RundotGameAPI, host: Host): void;
20
+
21
+ type StorageType = 'globalStorage' | 'deviceCache' | 'appStorage';
22
+ declare function createMockStorageApi(storageType: StorageType, appUrl?: string): MockStorageApi;
23
+ declare class MockStorageApi implements StorageApi {
24
+ private readonly prefix;
25
+ private readonly syncDelay;
26
+ private readonly orderStorageKey;
27
+ constructor(prefix: string, syncDelay: number);
28
+ clear(): Promise<void>;
29
+ getAllItems(): Promise<string[]>;
30
+ getAllData(): Promise<Record<string, string>>;
31
+ getItem(key: string): Promise<string | null>;
32
+ key(index: number): Promise<string | null>;
33
+ length(): Promise<number>;
34
+ removeItem(key: string): Promise<void>;
35
+ setItem(key: string, item: string): Promise<void>;
36
+ setMultipleItems(entries: {
37
+ key: string;
38
+ value: string;
39
+ }[]): Promise<void>;
40
+ removeMultipleItems(keys: string[]): Promise<void>;
41
+ private buildKey;
42
+ private extractKey;
43
+ private keys;
44
+ private simulateSyncDelay;
45
+ private readOrder;
46
+ private normalizeOrder;
47
+ private rebuildOrderFromStorage;
48
+ private upsertOrder;
49
+ private bulkUpsertOrder;
50
+ private removeFromOrder;
51
+ private bulkRemoveFromOrder;
52
+ private writeOrder;
53
+ private clearOrder;
54
+ private dedupeKeys;
55
+ }
56
+
57
+ interface MethodIds {
58
+ clear: string;
59
+ getItem: string;
60
+ getKey: string;
61
+ length: string;
62
+ removeItem: string;
63
+ setItem: string;
64
+ getAllItems?: string;
65
+ removeMultipleItems?: string;
66
+ setMultipleItems?: string;
67
+ }
68
+ declare class RpcStorageApi implements StorageApi {
69
+ private readonly rpcClient;
70
+ private readonly methodIds;
71
+ constructor(rpcClient: RpcClient, methodIds: MethodIds);
72
+ clear(): Promise<void>;
73
+ getItem(key: string): Promise<string | null>;
74
+ setItem(key: string, value: string): Promise<void>;
75
+ key(index: number): Promise<string | null>;
76
+ length(): Promise<number>;
77
+ removeItem(key: string): Promise<void>;
78
+ removeMultipleItems(keys: string[]): Promise<void>;
79
+ getAllItems(): Promise<string[]>;
80
+ getAllData(): Promise<Record<string, string>>;
81
+ setMultipleItems(items: {
82
+ key: string;
83
+ value: string;
84
+ }[]): Promise<void>;
85
+ }
86
+
87
+ declare function initializeStorage(rundotGameApiInstance: RundotGameAPI, host: Host): void;
88
+
89
+ declare class MockNavigationApi implements NavigationApi {
90
+ private readonly rundotGameApi;
91
+ constructor(rundotGameApi: RundotGameAPI);
92
+ requestPopOrQuit(options?: QuitOptions): Promise<boolean>;
93
+ getStackInfo(): NavigationStackInfo;
94
+ popApp(): Promise<void>;
95
+ pushApp(appId: string, options?: PushAppOptions): Promise<void>;
96
+ private log;
97
+ }
98
+
99
+ declare class RpcNavigationApi implements NavigationApi {
100
+ private readonly rundotGameApi;
101
+ private readonly rpcClient;
102
+ constructor(rpcClient: RpcClient, rundotGameApi: RundotGameAPI);
103
+ requestPopOrQuit(options?: QuitOptions): Promise<boolean>;
104
+ getStackInfo(): NavigationStackInfo;
105
+ popApp(): Promise<void>;
106
+ pushApp(appId: string, options?: PushAppOptions): Promise<void>;
107
+ }
108
+
109
+ declare function initializeStackNavigation(rundotGameApi: RundotGameAPI, host: Host): void;
110
+
111
+ declare class MockNotificationsApi implements NotificationsApi {
112
+ private readonly rundotGameApi;
113
+ constructor(rundotGameApi: RundotGameAPI);
114
+ cancelNotification(notificationId: string): Promise<boolean>;
115
+ getAllScheduledLocalNotifications(): Promise<ScheduleLocalNotification[]>;
116
+ isLocalNotificationsEnabled(): Promise<boolean>;
117
+ scheduleAsync(title: string, body: string, seconds: number, notificationId?: string, options?: ScheduleNotificationOptions): Promise<string | null>;
118
+ setLocalNotificationsEnabled(enabled: boolean): Promise<boolean>;
119
+ }
120
+
121
+ declare class RpcNotificationsApi implements NotificationsApi {
122
+ private readonly rpcClient;
123
+ constructor(rpcClient: RpcClient);
124
+ scheduleAsync(title: string, body: string, seconds: number, notificationId?: string, options?: ScheduleNotificationOptions): Promise<string | null>;
125
+ cancelNotification(id: string): Promise<boolean>;
126
+ getAllScheduledLocalNotifications(): Promise<ScheduleLocalNotification[]>;
127
+ isLocalNotificationsEnabled(): Promise<boolean>;
128
+ setLocalNotificationsEnabled(enabled: boolean): Promise<boolean>;
129
+ }
130
+ type NotificationContent = {
131
+ title: string | null;
132
+ subtitle: string | null;
133
+ body: string | null;
134
+ data?: Record<string, any>;
135
+ };
136
+
137
+ declare function initializeLocalNotifications(rundotGameApi: RundotGameAPI, host: Host): void;
138
+
139
+ declare class RpcPopupsApi implements PopupsApi {
140
+ private readonly rpcClient;
141
+ constructor(rpcClient: RpcClient);
142
+ showToast(message: string, options?: ShowToastOptions): Promise<boolean>;
143
+ }
144
+ interface ShowToastResponse {
145
+ shown: boolean;
146
+ actionTriggered: boolean;
147
+ }
148
+
149
+ interface MockActionSheetItem {
150
+ id?: string;
151
+ label: string;
152
+ icon?: string;
153
+ }
154
+ interface MockActionSheetOptions {
155
+ title?: string;
156
+ message?: string;
157
+ cancelButtonText?: string;
158
+ disableCancel?: boolean;
159
+ }
160
+ interface MockOverlay {
161
+ container: HTMLElement;
162
+ elements: OverlayElements;
163
+ adOverlay: HTMLElement;
164
+ actionSheetOverlay: HTMLElement;
165
+ appVisibilityState: 'visible' | 'hidden';
166
+ showAdOverlay: (options?: ShowInterstitialAdOptions | ShowRewardedAdOptions) => Promise<boolean>;
167
+ showActionSheet: (items: MockActionSheetItem[], options?: MockActionSheetOptions) => Promise<string | number | null>;
168
+ }
169
+ interface OverlayElements {
170
+ menuButton: HTMLElement;
171
+ }
172
+
173
+ declare class MockPopupsApi implements PopupsApi {
174
+ private readonly overlay;
175
+ constructor(override: MockOverlay);
176
+ showToast(message: string, options?: ShowToastOptions): Promise<boolean>;
177
+ }
178
+
179
+ declare function initializePopups(rundotGameApi: RundotGameAPI, host: Host): void;
180
+
181
+ declare class HostProfileApi implements ProfileApi {
182
+ private readonly rundotGameApi;
183
+ constructor(rundotGameApi: RundotGameAPI);
184
+ getCurrentProfile(): Profile;
185
+ }
186
+
187
+ declare class MockProfileApi implements ProfileApi {
188
+ private readonly rundotGameApi;
189
+ constructor(rundotGameApi: RundotGameAPI);
190
+ getCurrentProfile(): Profile;
191
+ }
192
+
193
+ /**
194
+ * Sandbox profile API.
195
+ *
196
+ * In sandbox mode (browser + real backend), profile identity must match the backend's
197
+ * notion of profileId (which is effectively the Firebase Auth UID in this codebase).
198
+ *
199
+ * This implementation reads from `rundotGameApi._profileData`, which is populated by
200
+ * SandboxHost when Firebase auth state changes.
201
+ *
202
+ * NOTE: `ProfileApi` is synchronous, so we return a placeholder profile until the
203
+ * user signs in and `_profileData` is available.
204
+ */
205
+ declare class SandboxProfileApi implements ProfileApi {
206
+ private readonly rundotGameApi;
207
+ constructor(rundotGameApi: RundotGameAPI);
208
+ getCurrentProfile(): Profile;
209
+ }
210
+
211
+ declare function initializeProfile(rundotGameApi: RundotGameAPI, host: Host): void;
212
+
213
+ declare class HostDeviceApi implements DeviceApi {
214
+ private readonly rundotGameApi;
215
+ constructor(rundotGameApi: RundotGameAPI);
216
+ getDevice(): DeviceInfo;
217
+ }
218
+
219
+ declare class MockDeviceApi implements DeviceApi {
220
+ private readonly rundotGameApi;
221
+ constructor(rundotGameApi: RundotGameAPI);
222
+ getDevice(): DeviceInfo;
223
+ }
224
+
225
+ declare class HostEnvironmentApi implements EnvironmentApi {
226
+ private readonly rundotGameApi;
227
+ constructor(rundotGameApi: RundotGameAPI);
228
+ getEnvironment(): EnvironmentInfo;
229
+ }
230
+
231
+ declare class MockEnvironmentApi implements EnvironmentApi {
232
+ private readonly rundotGameApi;
233
+ constructor(rundotGameApi: RundotGameAPI);
234
+ getEnvironment(): EnvironmentInfo;
235
+ }
236
+
237
+ /**
238
+ * Host implementation of SystemApi that delegates to device and environment APIs.
239
+ * Acts as a facade combining both system-level information sources.
240
+ */
241
+ declare class HostSystemApi implements SystemApi {
242
+ private readonly deviceApi;
243
+ private readonly environmentApi;
244
+ private readonly rundotGameApi;
245
+ constructor(deviceApi: DeviceApi, environmentApi: EnvironmentApi, rundotGameApi: RundotGameAPI);
246
+ getDevice(): DeviceInfo;
247
+ getEnvironment(): EnvironmentInfo;
248
+ getSafeArea(): SafeArea;
249
+ isMobile(): boolean;
250
+ isWeb(): boolean;
251
+ }
252
+
253
+ /**
254
+ * Mock implementation of SystemApi for local development.
255
+ * Delegates to mock device and environment APIs.
256
+ */
257
+ declare class MockSystemApi implements SystemApi {
258
+ private readonly deviceApi;
259
+ private readonly environmentApi;
260
+ private readonly rundotGameAPI;
261
+ constructor(deviceApi: DeviceApi, environmentApi: EnvironmentApi, rundotGameApi: RundotGameAPI);
262
+ getDevice(): DeviceInfo;
263
+ getEnvironment(): EnvironmentInfo;
264
+ getSafeArea(): SafeArea;
265
+ isMobile(): boolean;
266
+ isWeb(): boolean;
267
+ }
268
+
269
+ declare function initializeSystem(rundotGameApi: RundotGameAPI, host: Host): void;
270
+
271
+ /**
272
+ * Base class for CDN API implementations with shared utility methods
273
+ */
274
+ declare abstract class BaseCdnApi implements CdnApi {
275
+ private static readonly AVATAR_ASSETS_PREFIX;
276
+ private static readonly SHARED_LIBS_PREFIX;
277
+ protected abstract getCdnAssetsBaseUrl(): string;
278
+ protected abstract getCdnBaseUrl(): string;
279
+ protected abstract getSharedAssetsCdnBaseUrl(): string;
280
+ /**
281
+ * Remove leading slash from subPath
282
+ */
283
+ protected cleanSubPath(subPath: string): string;
284
+ /**
285
+ * Encode path parts - only encode the filename (last part) to preserve directory structure
286
+ */
287
+ protected encodePathParts(subPath: string): string;
288
+ /**
289
+ * Check if subPath is already a full URL
290
+ */
291
+ protected isFullUrl(subPath: string): boolean;
292
+ /**
293
+ * Normalize base URL to not end with trailing slash
294
+ */
295
+ protected normalizeBaseUrl(url: string): string;
296
+ /**
297
+ * Build full URL with encoding
298
+ */
299
+ protected buildCdnUrl(subPath: string, baseUrl: string): string;
300
+ /**
301
+ * Execute a fetch request with timeout handling
302
+ */
303
+ protected executeFetch(url: string, options?: FetchFromCdnOptions): Promise<Blob>;
304
+ getAssetCdnBaseUrl(): string;
305
+ resolveAssetUrl(subPath: string): string;
306
+ resolveAvatarAssetUrl(subPath: string): string;
307
+ resolveSharedLibUrl(subPath: string): string;
308
+ abstract fetchAsset(relativePath: string, options?: FetchFromCdnOptions): Promise<Blob>;
309
+ abstract fetchFromCdn(subPath: string, options?: FetchFromCdnOptions): Promise<Blob>;
310
+ }
311
+
312
+ /**
313
+ * CDN API implementation for production/remote environments.
314
+ * Automatically derives the CDN URL from the current window location.
315
+ */
316
+ declare class HostCdnApi extends BaseCdnApi {
317
+ private static readonly CDN_FOLDER_NAME;
318
+ private static readonly MIN_PATH_PARTS_FOR_CDN;
319
+ private static readonly MANIFEST_FILE_PREFIX;
320
+ private static readonly SHARED_ASSETS_CDN_BASE;
321
+ private readonly bucketBaseUrl;
322
+ private readonly gameId;
323
+ private readonly version;
324
+ private manifestCache;
325
+ private manifestPromise;
326
+ constructor();
327
+ protected getCdnAssetsBaseUrl(): string;
328
+ protected getCdnBaseUrl(): string;
329
+ protected getSharedAssetsCdnBaseUrl(): string;
330
+ /**
331
+ * Compute CDN information from the current window location.
332
+ *
333
+ * Expected URL structure:
334
+ * - App: {origin}/{bucket}/{gameId}/{version}/...
335
+ * - Bucket root: {origin}/{bucket}/
336
+ *
337
+ * Example:
338
+ * - App: https://h5-apps.development.getreel.com/development/game123/v1.0.0/index.html
339
+ * - Bucket: https://h5-apps.development.getreel.com/development
340
+ * - Game ID: game123
341
+ * - Version: v1.0.0
342
+ *
343
+ * @throws {Error} If not in browser environment or URL structure doesn't match expected pattern
344
+ */
345
+ private computeCdnInfo;
346
+ private isBrowserEnvironment;
347
+ /**
348
+ * Fetch directly from CDN root (bucket root).
349
+ * This is the primitive fetch operation that accesses files from the bucket base URL.
350
+ *
351
+ * @param subPath - Path relative to bucket root (e.g., "othergame/bundle.stow", "game123/cdn-assets/file.png")
352
+ * @param options - Optional fetch options including timeout
353
+ * @returns Promise<Blob> - The asset data as a Blob
354
+ *
355
+ * @example
356
+ * // App URL: https://h5-apps.dev.com/development/game123/v1.0.0/
357
+ * // fetchFromCdn("othergame/asset.png")
358
+ * // → https://h5-apps.dev.com/development/othergame/asset.png
359
+ */
360
+ fetchFromCdn(subPath: string, options?: FetchFromCdnOptions): Promise<Blob>;
361
+ /**
362
+ * Fetch an asset using the manifest to resolve the actual hashed filename.
363
+ * The manifest maps logical paths (e.g., "images/hero.png") to file hashes.
364
+ * The actual files are stored as {hash}.{extension} in the CDN.
365
+ *
366
+ * @param relativePath - The logical path to the asset (e.g., "/assets/sample.json" or "assets/sample.json")
367
+ * @param options - Optional fetch options including timeout
368
+ * @returns Promise<Blob> - The asset data as a Blob
369
+ * @throws {Error} If the asset is not found in the manifest or the fetch fails
370
+ */
371
+ fetchAsset(relativePath: string, options?: FetchFromCdnOptions): Promise<Blob>;
372
+ /**
373
+ * Get the manifest, either from cache or by fetching it.
374
+ * Uses promise caching to prevent multiple simultaneous fetches.
375
+ */
376
+ private getManifest;
377
+ /**
378
+ * Fetch the manifest file from the CDN.
379
+ * The manifest filename is based on the version: manifest_{version}.json
380
+ */
381
+ private fetchManifest;
382
+ }
383
+
384
+ /**
385
+ * CDN API implementation for mock/development environments.
386
+ * Serves assets from the public/cdn-assets folder via Vite dev server.
387
+ */
388
+ declare class MockCdnApi extends BaseCdnApi {
389
+ private static readonly LEGACY_CDN_PREFIX;
390
+ private static readonly SHARED_ASSETS_CDN_BASE;
391
+ private readonly rundotGameApi;
392
+ constructor(rundotGameApi: RundotGameAPI);
393
+ protected getCdnAssetsBaseUrl(): string;
394
+ protected getCdnBaseUrl(): string;
395
+ protected getSharedAssetsCdnBaseUrl(): string;
396
+ resolveAssetUrl(subPath: string): string;
397
+ /**
398
+ * Fetch an asset directly from the bucket root (public folder root in mock mode).
399
+ * This mimics production behavior where cross-game assets are at the bucket root.
400
+ *
401
+ * @param subPath - The path relative to public folder root (e.g., "othergame/bundle.stow")
402
+ * @param options - Optional fetch options including timeout
403
+ * @returns Promise<Blob> - The asset data as a Blob
404
+ *
405
+ * @example
406
+ * // In mock mode with public folder structure:
407
+ * // fetchFromCdn("othergame/bundle.stow")
408
+ * // → othergame/bundle.stow (from public root, not public/cdn-assets)
409
+ */
410
+ fetchFromCdn(subPath: string, options?: FetchFromCdnOptions): Promise<Blob>;
411
+ /**
412
+ * Fetch an asset in mock/development mode.
413
+ * In development, assets are served directly without manifest transformation,
414
+ * so this method fetches from the cdn-assets folder.
415
+ *
416
+ * @param relativePath - The path to the asset (e.g., "/some/asset.png" or "some/asset.png")
417
+ * @param options - Optional fetch options including timeout
418
+ * @returns Promise<Blob> - The asset data as a Blob
419
+ */
420
+ fetchAsset(relativePath: string, options?: FetchFromCdnOptions): Promise<Blob>;
421
+ }
422
+
423
+ declare function initializeCdn(rundotGameApi: RundotGameAPI, host: Host): void;
424
+
425
+ declare class HostTimeApi implements TimeApi {
426
+ private readonly rpcClient;
427
+ private readonly rundotGameApi;
428
+ constructor(rpcClient: RpcClient, rundotGameApi: RundotGameAPI);
429
+ requestTimeAsync(): Promise<ServerTimeData>;
430
+ formatTime(timestamp: number, options?: any): string;
431
+ formatNumber(value: number, options?: Intl.NumberFormatOptions): string;
432
+ getFutureTimeAsync(options?: GetFutureTimeOptions): Promise<number>;
433
+ }
434
+
435
+ declare function isPacificDaylightTime(date: Date): boolean;
436
+
437
+ declare class MockTimeApi implements TimeApi {
438
+ private readonly rundotGameApi;
439
+ constructor(rundotGameApi: RundotGameAPI);
440
+ formatNumber(value: number, options?: Intl.NumberFormatOptions): string;
441
+ formatTime(timestamp: number, options?: any): string;
442
+ getFutureTimeAsync(options?: GetFutureTimeOptions): Promise<number>;
443
+ requestTimeAsync(): Promise<ServerTimeData>;
444
+ }
445
+
446
+ declare function initializeTime(rundotGameApi: RundotGameAPI, host: Host): void;
447
+
448
+ declare class RpcAiApi implements AiApi {
449
+ private readonly rpcClient;
450
+ constructor(rpcClient: RpcClient);
451
+ requestChatCompletionAsync(request: AiChatCompletionRequest): Promise<AiChatCompletionData>;
452
+ getAvailableCompletionModels(): Promise<Array<string>>;
453
+ }
454
+
455
+ declare class MockAiApi implements AiApi {
456
+ requestChatCompletionAsync(request: AiChatCompletionRequest): Promise<AiChatCompletionData>;
457
+ getAvailableCompletionModels(): Promise<Array<string>>;
458
+ }
459
+
460
+ declare function initializeAi(rundotGameApi: RundotGameAPI, host: Host): void;
461
+
462
+ declare class RpcHapticsApi implements HapticsApi {
463
+ private readonly rpcClient;
464
+ constructor(rpcClient: RpcClient);
465
+ triggerHapticAsync(style: HapticFeedbackStyle): Promise<void>;
466
+ }
467
+
468
+ declare class MockHapticsApi implements HapticsApi {
469
+ private readonly rundotGameApi;
470
+ constructor(rundotGameApi: RundotGameAPI);
471
+ triggerHapticAsync(style: HapticFeedbackStyle): Promise<void>;
472
+ }
473
+
474
+ declare function initializeHaptics(rundotGameApi: RundotGameAPI, host: Host): void;
475
+
476
+ declare class RpcFeaturesApi implements FeaturesApi {
477
+ private readonly rpcClient;
478
+ constructor(rcpClient: RpcClient);
479
+ getExperiment(experimentName: string): Promise<Experiment | null>;
480
+ getFeatureFlag(flagName: string): Promise<boolean>;
481
+ getFeatureGate(gateName: string): Promise<boolean>;
482
+ }
483
+
484
+ declare class MockFeaturesApi implements FeaturesApi {
485
+ getExperiment(experimentName: string): Promise<Experiment | null>;
486
+ getFeatureFlag(flagName: string): Promise<boolean>;
487
+ getFeatureGate(gateName: string): Promise<boolean>;
488
+ }
489
+
490
+ declare function initializeFeaturesApi(rundotGameApi: RundotGameAPI, host: Host): void;
491
+
492
+ declare class MockLifecycleApi implements LifecycleApi {
493
+ private pauseCallbacks;
494
+ private resumeCallbacks;
495
+ private awakeCallbacks;
496
+ private sleepCallbacks;
497
+ private quitCallbacks;
498
+ onSleep(callback: SleepCallback): Subscription;
499
+ onAwake(callback: AwakeCallback): Subscription;
500
+ onPause(callback: PauseCallback): Subscription;
501
+ onResume(callback: ResumeCallback): Subscription;
502
+ onQuit(callback: QuitCallback): Subscription;
503
+ triggerPauseCallbacks(): void;
504
+ triggerResumeCallbacks(): void;
505
+ triggerAwakeCallbacks(): void;
506
+ triggerSleepCallbacks(): void;
507
+ triggerQuitCallbacks(): void;
508
+ }
509
+
510
+ declare class RpcLifecycleApi implements LifecycleApi {
511
+ private readonly rpcClient;
512
+ constructor(rpcClient: RpcClient);
513
+ onQuit(callback: QuitCallback): Subscription;
514
+ onSleep(callback: SleepCallback): Subscription;
515
+ onAwake(callback: AwakeCallback): Subscription;
516
+ onResume(callback: ResumeCallback): Subscription;
517
+ onPause(callback: PauseCallback): Subscription;
518
+ }
519
+
520
+ declare function initializeLifecycleApi(rundotGameApi: RundotGameAPI, host: Host): void;
521
+
522
+ declare class RpcSimulationApi implements SimulationApi {
523
+ private readonly rpcClient;
524
+ private _simulationConfig;
525
+ private readonly subscriptionCallbacks;
526
+ constructor(rpcClient: RpcClient);
527
+ isEnabled(): boolean;
528
+ validateSlotAssignmentAsync(containerId: string, slotId: string, itemId: string): Promise<SimulationSlotValidationResult>;
529
+ subscribeAsync(options: SimulationSubscribeOptions): Promise<() => void>;
530
+ executeBatchOperationsAsync(operations: Array<SimulationBatchOperation>, validateOnly?: boolean): Promise<SimulationBatchOperationsResult>;
531
+ getAvailableItemsAsync(containerId: string, slotId: string): Promise<SimulationAvailableItem[]>;
532
+ calculatePowerPreviewAsync(containerId: string, slotId: string, candidateItemId: string): Promise<SimulationPowerPreview>;
533
+ assignItemToSlotAsync(containerId: string, slotId: string, itemId: string): Promise<SimulationSlotMutationResult>;
534
+ removeItemFromSlotAsync(containerId: string, slotId: string): Promise<SimulationSlotMutationResult>;
535
+ getSlotContainersAsync(): Promise<SimulationSlotContainer[]>;
536
+ getSlotAssignmentsAsync(containerId: string): Promise<SimulationAssignment[]>;
537
+ getStateAsync(roomId?: string): Promise<SimulationState>;
538
+ getConfigAsync(roomId?: string): Promise<RundotGameSimulationConfig>;
539
+ executeRecipeAsync(recipeId: string, inputs?: Record<string, unknown>, options?: ExecuteRecipeOptions): Promise<ExecuteRecipeResponse>;
540
+ collectRecipeAsync(runId: string): Promise<CollectRecipeResult>;
541
+ resetStateAsync(options?: ResetStateOptions): Promise<ResetStateResult>;
542
+ getActiveRunsAsync(options?: GetActiveRunsOptions): Promise<SimulationRunSummary[]>;
543
+ executeScopedRecipeAsync(recipeId: string, entity: string, inputs?: Record<string, unknown>, options?: ExecuteScopedRecipeOptions): Promise<ExecuteScopedRecipeResult>;
544
+ getAvailableRecipesAsync(options?: GetAvailableRecipesOptions): Promise<GetAvailableRecipesResult>;
545
+ getRecipeRequirementsAsync(recipe: Recipe): Promise<RecipeRequirementResult>;
546
+ getBatchRecipeRequirementsAsync(recipes: Recipe[]): Promise<GetBatchRecipeRequirements>;
547
+ triggerRecipeChainAsync(recipeId: string, options?: TriggerRecipeChainOptions): Promise<ExecuteRecipeResponse>;
548
+ getEntityMetadataAsync(entityId: string): Promise<Record<string, unknown>>;
549
+ resolveFieldValueAsync(entityId: string, fieldPath: string, entity?: string): Promise<unknown>;
550
+ private handleSimulationUpdate;
551
+ private ensureValidSubscribeOptions;
552
+ }
553
+
554
+ declare function initializeSimulation(rundotGameApi: RundotGameAPI, host: Host): void;
555
+
556
+ interface RoomNotificationSubscriptionState {
557
+ data: Record<string, Array<(event: RoomDataUpdate) => void>>;
558
+ messages: Record<string, Array<(event: RoomMessageEvent) => void>>;
559
+ gameEvents: Record<string, Array<(event: ProposedMoveEvent) => void>>;
560
+ }
561
+ /**
562
+ * Set up room notification listeners using the transport's onRundotGameMessage hook.
563
+ * This routes host-sent room notifications (H5_ROOM_DATA_UPDATED, etc.) to the
564
+ * callbacks registered in the RoomsApi instance.
565
+ * @param transport The RUN.game transport to listen for messages
566
+ * @param getSubscriptions Function to retrieve subscription state from RoomsApi
567
+ */
568
+ declare function setupRoomNotifications(transport: RundotGameTransport, getSubscriptions: () => RoomNotificationSubscriptionState): Subscription;
569
+
570
+ declare class RpcRoomsApi implements RoomsApi {
571
+ private readonly rpcClient;
572
+ private readonly subscriptions;
573
+ constructor(rpcClient: RpcClient);
574
+ /**
575
+ * Get the subscription state for external access (used by setupRoomNotifications)
576
+ */
577
+ getSubscriptions(): RoomNotificationSubscriptionState;
578
+ /**
579
+ * Set up room notification routing from the transport
580
+ */
581
+ setupNotifications(transport: RundotGameTransport): void;
582
+ createRoomAsync(options: CreateRoomOptions): Promise<RundotGameRoom>;
583
+ joinOrCreateRoomAsync(options: JoinOrCreateRoomOptions): Promise<JoinOrCreateResult>;
584
+ joinRoomByCodeAsync(roomCode: string): Promise<RundotGameRoom>;
585
+ getUserRoomsAsync(options?: ListRoomsOptions): Promise<RundotGameRoom[]>;
586
+ /**
587
+ * @deprecated Prefer server-authoritative flows (e.g. `proposeMoveAsync` / `startRoomGameAsync`)
588
+ * and treat `customMetadata.rules.gameState` as the canonical room lifecycle state.
589
+ */
590
+ updateRoomDataAsync(room: RundotGameRoom, updates: Record<string, unknown>, options?: UpdateRoomDataOptions): Promise<void>;
591
+ getRoomDataAsync(room: RundotGameRoom): Promise<Record<string, unknown>>;
592
+ sendRoomMessageAsync(rundotGameRoom: RundotGameRoom, request: RoomMessageRequest): Promise<string>;
593
+ leaveRoomAsync(room: RundotGameRoom): Promise<void>;
594
+ kickPlayerAsync(room: RundotGameRoom, targetProfileId: string, options?: {
595
+ reason?: string;
596
+ }): Promise<void>;
597
+ startRoomGameAsync(room: RundotGameRoom, options?: StartRoomGameOptions): Promise<void>;
598
+ proposeMoveAsync(room: RundotGameRoom, proposalPayload: ProposeMoveRequest): Promise<ProposeMoveResult>;
599
+ validateMoveAsync(_room: RundotGameRoom, moveId: string, verdict: ValidateMoveVerdict): Promise<ValidateMoveResult>;
600
+ subscribeAsync(room: RundotGameRoom, options?: RoomSubscriptionOptions): Promise<() => void>;
601
+ }
602
+
603
+ declare function initializeRoomsApi(rundotGameApi: RundotGameAPI, host: Host): void;
604
+
605
+ declare class MockLoggingApi implements LoggingApi {
606
+ logDebug(message?: any, ...args: any[]): void;
607
+ logError(message: string, ...args: any[]): void;
608
+ }
609
+
610
+ declare class RpcLoggingApi implements LoggingApi {
611
+ private readonly host;
612
+ private readonly rpcClient;
613
+ constructor(host: Host, rpcClient: RpcClient);
614
+ logDebug(message: string, ...args: any[]): void;
615
+ logError(message: string, ...args: any[]): void;
616
+ private buildMessage;
617
+ private toStringArg;
618
+ }
619
+
620
+ declare function initializeLoggingApi(rundotGameApi: RundotGameAPI, host: Host): void;
621
+
622
+ declare class RpcIapApi implements IapApi {
623
+ private readonly rpcClient;
624
+ constructor(rpcClient: RpcClient);
625
+ getHardCurrencyBalance(): Promise<number>;
626
+ spendCurrency(productId: string, cost: number, options?: SpendCurrencyOptions): Promise<void>;
627
+ openStore(): Promise<void>;
628
+ getCurrencyIcon(): Promise<LoadEmbeddedAssetsResponse>;
629
+ }
630
+
631
+ declare class MockSharedAssetsApi implements SharedAssetsApi {
632
+ private readonly rundotGameApi;
633
+ constructor(rundotGameApi: RundotGameAPI);
634
+ loadAssetsBundle(game: string, bundleKey: string, fileType?: string): Promise<ArrayBuffer>;
635
+ }
636
+
637
+ type ModuleSpecifierMatch = 'exact' | 'prefix';
638
+ interface ModuleSpecifierConfig {
639
+ match: ModuleSpecifierMatch;
640
+ value: string;
641
+ behavior?: 'default' | 'react-jsx-runtime' | 'react-jsx-dev-runtime' | 'namespace';
642
+ }
643
+ interface EmbeddedLibraryDefinition {
644
+ libraryKey: string;
645
+ assetKey: string;
646
+ packageName: string;
647
+ version: string;
648
+ globalVar: string;
649
+ cdnPath: string;
650
+ moduleSpecifiers: ModuleSpecifierConfig[];
651
+ loadStage: number;
652
+ enabled: boolean;
653
+ }
654
+ declare const DEFAULT_SHARED_LIB_CDN_BASE = "https://venus-static-01293ak.web.app/libs";
655
+ declare const EMBEDDED_LIBRARIES: EmbeddedLibraryDefinition[];
656
+ declare const EMBEDDED_LIBRARY_BY_KEY: Record<string, EmbeddedLibraryDefinition>;
657
+ declare const MODULE_TO_LIBRARY_SPECIFIERS: {
658
+ libraryKey: string;
659
+ match: ModuleSpecifierMatch;
660
+ value: string;
661
+ behavior?: "default" | "react-jsx-runtime" | "react-jsx-dev-runtime" | "namespace";
662
+ }[];
663
+ /**
664
+ * Get library definition by key, throwing if not found.
665
+ * @param libraryKey - Library key (e.g., 'phaser@3.90.0')
666
+ * @returns Library definition
667
+ * @throws Error if library key is not found
668
+ */
669
+ declare function getLibraryDefinition(libraryKey: string): EmbeddedLibraryDefinition;
670
+
671
+ /**
672
+ * Base64 encoding/decoding utilities for embedded assets and libraries.
673
+ *
674
+ * These utilities handle base64 data received from the RUN.game host via RPC,
675
+ * converting it to ArrayBuffer or UTF-8 strings with appropriate fallbacks
676
+ * for different JavaScript environments.
677
+ */
678
+ /**
679
+ * Convert base64 string to ArrayBuffer.
680
+ * Uses native atob() when available for best performance.
681
+ */
682
+ declare function base64ToArrayBuffer(base64: string): ArrayBuffer;
683
+ /**
684
+ * Convert base64 string to UTF-8 string.
685
+ * Tries multiple decoding strategies for maximum compatibility.
686
+ */
687
+ declare function base64ToUtf8(base64: string): string;
688
+
689
+ declare class MockIapApi implements IapApi {
690
+ private _hardCurrency;
691
+ get hardCurrency(): number;
692
+ set hardCurrency(value: number);
693
+ spendCurrency(productId: string, cost: number, options?: SpendCurrencyOptions): Promise<void>;
694
+ getHardCurrencyBalance(): Promise<number>;
695
+ openStore(): Promise<void>;
696
+ getCurrencyIcon(): Promise<LoadEmbeddedAssetsResponse>;
697
+ }
698
+
699
+ declare function initializeIap(rundotGameApiInstance: RundotGameAPI, host: Host): void;
700
+
701
+ declare class RpcLeaderboardApi implements LeaderboardApi {
702
+ private readonly rpcClient;
703
+ /** Cache of score tokens for automatic hash computation */
704
+ private tokenCache;
705
+ constructor(rpcClient: RpcClient);
706
+ /**
707
+ * Create a score token for submitting a score.
708
+ * Token is cached for automatic hash computation if score sealing is enabled.
709
+ *
710
+ * @param mode - Optional game mode
711
+ * @returns Score token with sealing data if enabled
712
+ */
713
+ createScoreToken(mode?: string): Promise<ScoreToken>;
714
+ /**
715
+ * Submit a score to the leaderboard.
716
+ * Automatically computes hash if score sealing is enabled and token was created via createScoreToken().
717
+ *
718
+ * @param params - Score submission parameters
719
+ * @returns Submission result with acceptance status and rank
720
+ * @throws Error if token not found in cache
721
+ */
722
+ submitScore(params: SubmitScoreParams): Promise<SubmitScoreResult>;
723
+ getPagedScores(options?: GetPagedScoresOptions): Promise<PagedScoresResponse>;
724
+ getMyRank(options?: PlayerRankOptions): Promise<PlayerRankResult>;
725
+ getPodiumScores(options?: GetPodiumScoresOptions): Promise<PodiumScoresResponse>;
726
+ }
727
+
728
+ declare class MockLeaderboardApi implements LeaderboardApi {
729
+ private tokens;
730
+ /** Cache of score tokens for automatic hash computation */
731
+ private tokenCache;
732
+ private entriesByMode;
733
+ private tokenCounter;
734
+ private enableScoreSealing;
735
+ private scoreSealingSecret;
736
+ constructor(options?: {
737
+ enableScoreSealing?: boolean;
738
+ scoreSealingSecret?: string;
739
+ });
740
+ /**
741
+ * Configure mock leaderboard settings
742
+ *
743
+ * @param options - Configuration options
744
+ */
745
+ configure(options: {
746
+ enableScoreSealing?: boolean;
747
+ scoreSealingSecret?: string;
748
+ }): void;
749
+ private generateNonce;
750
+ private getModeKey;
751
+ private getEntriesForMode;
752
+ /**
753
+ * Create a mock score token for testing.
754
+ * Token is cached for automatic hash computation if score sealing is enabled.
755
+ *
756
+ * @param mode - Optional game mode
757
+ * @returns Score token with sealing data if enabled
758
+ */
759
+ createScoreToken(mode?: string): Promise<ScoreToken>;
760
+ /**
761
+ * Submit a mock score to the leaderboard.
762
+ * Automatically computes hash if score sealing is enabled and token was created via createScoreToken().
763
+ *
764
+ * @param params - Score submission parameters
765
+ * @returns Submission result with acceptance status and rank
766
+ * @throws Error if token not found in cache or validation fails
767
+ */
768
+ submitScore(params: SubmitScoreParams): Promise<SubmitScoreResult>;
769
+ getPagedScores(options?: GetPagedScoresOptions): Promise<PagedScoresResponse>;
770
+ getMyRank(_options?: PlayerRankOptions): Promise<PlayerRankResult>;
771
+ getPodiumScores(options?: GetPodiumScoresOptions): Promise<PodiumScoresResponse>;
772
+ }
773
+
774
+ /**
775
+ * Hash algorithm used for score sealing
776
+ */
777
+ declare const HASH_ALGORITHM_WEB_CRYPTO = "SHA-256";
778
+ declare const HASH_ALGORITHM_NODE = "sha256";
779
+ /**
780
+ * Compute HMAC-SHA256 hash for score sealing.
781
+ * Hash always includes: score, duration, token
782
+ * Matches server-side hash computation exactly.
783
+ *
784
+ * @param score - The score value
785
+ * @param duration - Duration in seconds
786
+ * @param token - Score token
787
+ * @param sealingNonce - One-time nonce for this submission
788
+ * @param sealingSecret - Secret key for HMAC
789
+ * @returns Hex-encoded hash string
790
+ */
791
+ declare function computeScoreHash(score: number, duration: number, token: string, sealingNonce: string, sealingSecret: string): Promise<string>;
792
+
793
+ declare function initializeLeaderboard(rundotGameApiInstance: RundotGameAPI, host: Host): void;
794
+
795
+ declare class MockPreloaderApi implements PreloaderApi {
796
+ showLoadScreen(): Promise<void>;
797
+ hideLoadScreen(): Promise<void>;
798
+ setLoaderText(text: string): Promise<void>;
799
+ setLoaderProgress(progress: number): Promise<void>;
800
+ }
801
+
802
+ declare class RpcPreloaderApi implements PreloaderApi {
803
+ private readonly rpcClient;
804
+ constructor(rpcClient: RpcClient);
805
+ showLoadScreen(): Promise<void>;
806
+ hideLoadScreen(): Promise<void>;
807
+ setLoaderText(text: string): Promise<void>;
808
+ setLoaderProgress(progress: number): Promise<void>;
809
+ }
810
+
811
+ declare function initializePreloader(rundotGameApi: RundotGameAPI, host: Host): void;
812
+
813
+ declare class RpcSocialApi implements SocialApi {
814
+ private readonly rpcClient;
815
+ constructor(rpcClient: RpcClient);
816
+ shareLinkAsync(options: {
817
+ shareParams: Record<string, string>;
818
+ metadata?: ShareMetadata;
819
+ }): Promise<ShareLinkResult>;
820
+ createQRCodeAsync(options: {
821
+ shareParams: Record<string, string>;
822
+ metadata?: ShareMetadata;
823
+ qrOptions?: SocialQRCodeOptions;
824
+ }): Promise<QRCodeResult>;
825
+ }
826
+
827
+ declare class MockSocialApi implements SocialApi {
828
+ shareLinkAsync(options: {
829
+ shareParams: Record<string, string>;
830
+ }): Promise<ShareLinkResult>;
831
+ createQRCodeAsync(options: {
832
+ shareParams: Record<string, string>;
833
+ qrOptions?: SocialQRCodeOptions;
834
+ }): Promise<QRCodeResult>;
835
+ private createMockUrl;
836
+ }
837
+
838
+ declare function initializeSocial(rundotGameApi: RundotGameAPI, host: Host): void;
839
+
840
+ declare class RpcAvatarApi implements Avatar3dApi {
841
+ private readonly rundotGameApi;
842
+ private readonly rpcClient;
843
+ constructor(rpcClient: RpcClient, rundotGameApi: RundotGameAPI);
844
+ downloadAssetPaths(): Promise<Record<string, string[]>>;
845
+ downloadManifest(): Promise<AssetManifest>;
846
+ loadAvatar(avatarId?: string): Promise<Avatar3dConfig | null>;
847
+ saveAvatar(config: Avatar3dConfig): Promise<string>;
848
+ deleteAvatar(): Promise<void>;
849
+ showEditor(options?: ShowEditorOptions): Promise<Avatar3dEdits>;
850
+ private fetchFromCdn;
851
+ private log;
852
+ }
853
+
854
+ declare function initializeAvatar3d(rundotGameApi: RundotGameAPI, host: Host): void;
855
+
856
+ declare class RpcAdsApi implements AdsApi {
857
+ private readonly rpcClient;
858
+ constructor(rpcClient: RpcClient);
859
+ showInterstitialAd(options?: ShowInterstitialAdOptions): Promise<boolean>;
860
+ isRewardedAdReadyAsync(): Promise<boolean>;
861
+ showRewardedAdAsync(options?: ShowRewardedAdOptions): Promise<boolean>;
862
+ }
863
+
864
+ declare class MockAdsApi implements AdsApi {
865
+ private mockOverlay;
866
+ constructor(mockOverlay: MockOverlay);
867
+ isRewardedAdReadyAsync(): Promise<boolean>;
868
+ showRewardedAdAsync(options?: ShowRewardedAdOptions): Promise<boolean>;
869
+ showInterstitialAd(options?: ShowInterstitialAdOptions): Promise<boolean>;
870
+ private log;
871
+ }
872
+
873
+ declare function initializeAds(rundotGameApiInstance: RundotGameAPI, host: Host): void;
874
+
875
+ /**
876
+ * HTTP wrapper for calling Cloud Functions.
877
+ *
878
+ * Gets the ID token from Firebase Auth (user signs in once via Google).
879
+ * Token is refreshed automatically by Firebase SDK.
880
+ *
881
+ * @example
882
+ * ```typescript
883
+ * const state = await callRemoteFunction<SimulationState>('apiGetSimulationState', {
884
+ * appId: 'my-game',
885
+ * })
886
+ * ```
887
+ *
888
+ * ⚠️ SANDBOX-ONLY: This file depends on Firebase and should ONLY be imported by SandboxHost
889
+ * and other sandbox-only modules. Do NOT import from barrel exports (http/index.ts).
890
+ * This ensures Firebase is not bundled in production builds.
891
+ */
892
+ /**
893
+ * Type for a function that invokes a remote Cloud Function.
894
+ */
895
+ type RemoteFunctionInvoker = <TResponse>(functionName: string, payload?: unknown) => Promise<TResponse>;
896
+
897
+ declare const SDK_VERSION: string;
898
+
899
+ declare enum RundotGameMessageId {
900
+ H5_RESPONSE = "H5_RESPONSE",
901
+ IS_REWARDED_AD_READY = "H5_IS_REWARDED_AD_READY",
902
+ SHOW_REWARDED_AD = "H5_SHOW_REWARDED_AD",
903
+ LOG_ANALYTICS_EVENT = "H5_LOG_ANALYTICS_EVENT",
904
+ TRACK_FUNNEL_STEP = "H5_TRACK_FUNNEL_STEP",
905
+ DEVICE_CACHE_GET_ITEM = "H5_DEVICE_CACHE_GET_ITEM",
906
+ DEVICE_CACHE_SET_ITEM = "H5_DEVICE_CACHE_SET_ITEM",
907
+ DEVICE_CACHE_REMOVE_ITEM = "H5_DEVICE_CACHE_REMOVE_ITEM",
908
+ DEVICE_CACHE_CLEAR = "H5_DEVICE_CACHE_CLEAR",
909
+ DEVICE_CACHE_KEY = "H5_DEVICE_CACHE_KEY",
910
+ DEVICE_CACHE_LENGTH = "H5_DEVICE_CACHE_LENGTH",
911
+ APP_STORAGE_GET_ITEM = "H5_APP_STORAGE_GET_ITEM",
912
+ APP_STORAGE_SET_ITEM = "H5_APP_STORAGE_SET_ITEM",
913
+ APP_STORAGE_REMOVE_ITEM = "H5_APP_STORAGE_REMOVE_ITEM",
914
+ APP_STORAGE_CLEAR = "H5_APP_STORAGE_CLEAR",
915
+ APP_STORAGE_KEY = "H5_APP_STORAGE_KEY",
916
+ APP_STORAGE_LENGTH = "H5_APP_STORAGE_LENGTH",
917
+ APP_STORAGE_GET_ALL_ITEMS = "H5_APP_STORAGE_GET_ALL_ITEMS",
918
+ APP_STORAGE_SET_MULTIPLE_ITEMS = "H5_APP_STORAGE_SET_MULTIPLE_ITEMS",
919
+ APP_STORAGE_REMOVE_MULTIPLE_ITEMS = "H5_APP_STORAGE_REMOVE_MULTIPLE_ITEMS",
920
+ GLOBAL_STORAGE_GET_ITEM = "H5_GLOBAL_STORAGE_GET_ITEM",
921
+ GLOBAL_STORAGE_SET_ITEM = "H5_GLOBAL_STORAGE_SET_ITEM",
922
+ GLOBAL_STORAGE_REMOVE_ITEM = "H5_GLOBAL_STORAGE_REMOVE_ITEM",
923
+ GLOBAL_STORAGE_CLEAR = "H5_GLOBAL_STORAGE_CLEAR",
924
+ GLOBAL_STORAGE_KEY = "H5_GLOBAL_STORAGE_KEY",
925
+ GLOBAL_STORAGE_LENGTH = "H5_GLOBAL_STORAGE_LENGTH",
926
+ GLOBAL_STORAGE_GET_ALL_ITEMS = "H5_GLOBAL_STORAGE_GET_ALL_ITEMS",
927
+ GLOBAL_STORAGE_SET_MULTIPLE_ITEMS = "H5_GLOBAL_STORAGE_SET_MULTIPLE_ITEMS",
928
+ GLOBAL_STORAGE_REMOVE_MULTIPLE_ITEMS = "H5_GLOBAL_STORAGE_REMOVE_MULTIPLE_ITEMS",
929
+ AVATAR3D_LOAD = "H5_AVATAR3D_LOAD",
930
+ AVATAR3D_SAVE = "H5_AVATAR3D_SAVE",
931
+ AVATAR3D_DELETE = "H5_AVATAR3D_DELETE",
932
+ H5_STACK_PUSH_REQUEST = "H5_STACK_PUSH_REQUEST",
933
+ H5_STACK_POP_REQUEST = "H5_STACK_POP_REQUEST",
934
+ SCHEDULE_LOCAL_NOTIFICATION = "H5_SCHEDULE_LOCAL_NOTIFICATION",
935
+ CANCEL_LOCAL_NOTIFICATION = "H5_CANCEL_LOCAL_NOTIFICATION",
936
+ GET_ALL_SCHEDULED_LOCAL_NOTIFICATIONS = "H5_GET_ALL_SCHEDULED_LOCAL_NOTIFICATIONS",
937
+ IS_LOCAL_NOTIFICATIONS_ENABLED = "H5_IS_LOCAL_NOTIFICATIONS_ENABLED",
938
+ SET_LOCAL_NOTIFICATIONS_ENABLED = "H5_SET_LOCAL_NOTIFICATIONS_ENABLED",
939
+ TOAST = "H5_TOAST",
940
+ REQUEST_SERVER_TIME = "H5_REQUEST_SERVER_TIME",
941
+ SHARE_LINK = "H5_SHARE_LINK",
942
+ CREATE_SHARE_QRCODE = "H5_CREATE_SHARE_QRCODE",
943
+ AI_CHAT_COMPLETION = "H5_AI_CHAT_COMPLETION",
944
+ AI_GET_AVAILABLE_MODELS = "H5_AI_GET_AVAILABLE_MODELS",
945
+ TRIGGER_HAPTIC = "H5_TRIGGER_HAPTIC",
946
+ DEBUG = "H5_DEBUG",
947
+ H5_IAP_GET_WALLET = "H5_IAP_GET_WALLET",
948
+ H5_IAP_SPEND_CURRENCY = "H5_IAP_SPEND_CURRENCY",
949
+ SHOW_INTERSTITIAL_AD = "H5_SHOW_INTERSTITIAL_AD",
950
+ IAP_SPEND_CURRENCY_COMPLETE = "IAP_SPEND_CURRENCY_COMPLETE",
951
+ IAP_WALLET_UPDATE = "IAP_WALLET_UPDATE",
952
+ READY = "READY",
953
+ INIT_SDK = "INITIALIZE_SDK",
954
+ PAUSE = "PAUSE",
955
+ RESUME = "RESUME",
956
+ AWAKE = "AWAKE",
957
+ SLEEP = "SLEEP",
958
+ QUIT = "QUIT",
959
+ /** given the experiment name, returns the entire experiment object as configured for the current user */
960
+ GET_EXPERIMENT = "H5_GET_EXPERIMENT",
961
+ /** returns the boolean value for a feature flag using the statsig parameter store, or the feature flags constants as fallback */
962
+ GET_FEATURE_FLAG = "H5_GET_FEATURE_FLAG",
963
+ /** returns the gate value (boolean) for a given feature gate for the current user */
964
+ GET_FEATURE_GATE = "H5_GET_FEATURE_GATE",
965
+ H5_SIMULATION_EXECUTE_RECIPE = "H5_SIMULATION_EXECUTE_RECIPE",
966
+ H5_SIMULATION_GET_ACTIVE_RUNS = "H5_SIMULATION_GET_ACTIVE_RUNS",
967
+ H5_SIMULATION_COLLECT_RECIPE = "H5_SIMULATION_COLLECT_RECIPE",
968
+ H5_SIMULATION_EXECUTE_SCOPED_RECIPE = "H5_SIMULATION_EXECUTE_SCOPED_RECIPE",
969
+ H5_SIMULATION_GET_AVAILABLE_RECIPES = "H5_SIMULATION_GET_AVAILABLE_RECIPES",
970
+ H5_SIMULATION_GET_RECIPE_REQUIREMENTS = "H5_SIMULATION_GET_RECIPE_REQUIREMENTS",
971
+ H5_SIMULATION_GET_BATCH_RECIPE_REQUIREMENTS = "H5_SIMULATION_GET_BATCH_RECIPE_REQUIREMENTS",
972
+ H5_SIMULATION_TRIGGER_RECIPE_CHAIN = "H5_SIMULATION_TRIGGER_RECIPE_CHAIN",
973
+ H5_SIMULATION_RESOLVE_VALUE = "H5_SIMULATION_RESOLVE_VALUE",
974
+ H5_SIMULATION_GET_ENTITY_METADATA = "H5_SIMULATION_GET_ENTITY_METADATA",
975
+ H5_SIMULATION_GET_STATE = "H5_SIMULATION_GET_STATE",
976
+ H5_SIMULATION_GET_CONFIG = "H5_SIMULATION_GET_CONFIG",
977
+ H5_SIMULATION_GET_CONTAINERS = "H5_SIMULATION_GET_CONTAINERS",
978
+ H5_SIMULATION_GET_ASSIGNMENTS = "H5_SIMULATION_GET_ASSIGNMENTS",
979
+ H5_SIMULATION_ASSIGN_ITEM = "H5_SIMULATION_ASSIGN_ITEM",
980
+ H5_SIMULATION_REMOVE_ITEM = "H5_SIMULATION_REMOVE_ITEM",
981
+ H5_SIMULATION_CALCULATE_POWER_PREVIEW = "H5_SIMULATION_CALCULATE_POWER_PREVIEW",
982
+ H5_SIMULATION_GET_AVAILABLE_ITEMS = "H5_SIMULATION_GET_AVAILABLE_ITEMS",
983
+ H5_SIMULATION_VALIDATE_ASSIGNMENT = "H5_SIMULATION_VALIDATE_ASSIGNMENT",
984
+ H5_SIMULATION_BATCH_OPERATIONS = "H5_SIMULATION_BATCH_OPERATIONS",
985
+ H5_SIMULATION_SUBSCRIBE = "H5_SIMULATION_SUBSCRIBE",
986
+ H5_SIMULATION_UNSUBSCRIBE = "H5_SIMULATION_UNSUBSCRIBE",
987
+ H5_SIMULATION_UPDATE = "H5_SIMULATION_UPDATE",
988
+ H5_SIMULATION_RESET_STATE = "H5_SIMULATION_RESET_STATE",
989
+ H5_LEADERBOARD_CREATE_SCORE_TOKEN = "H5_LEADERBOARD_CREATE_SCORE_TOKEN",
990
+ H5_LEADERBOARD_SUBMIT_SCORE = "H5_LEADERBOARD_SUBMIT_SCORE",
991
+ H5_LEADERBOARD_GET_PAGED_SCORES = "H5_LEADERBOARD_GET_PAGED_SCORES",
992
+ H5_LEADERBOARD_GET_PODIUM_SCORES = "H5_LEADERBOARD_GET_PODIUM_SCORES",
993
+ H5_LEADERBOARD_GET_MY_RANK = "H5_LEADERBOARD_GET_MY_RANK",
994
+ H5_ROOM_CREATE = "H5_ROOM_CREATE",
995
+ H5_ROOM_JOIN = "H5_ROOM_JOIN",
996
+ H5_ROOM_JOIN_OR_CREATE = "H5_ROOM_JOIN_OR_CREATE",
997
+ H5_ROOM_LEAVE = "H5_ROOM_LEAVE",
998
+ H5_ROOM_UPDATE_DATA = "H5_ROOM_UPDATE_DATA",
999
+ H5_ROOM_GET_DATA = "H5_ROOM_GET_DATA",
1000
+ H5_ROOM_SUBSCRIBE = "H5_ROOM_SUBSCRIBE",
1001
+ H5_ROOM_UNSUBSCRIBE = "H5_ROOM_UNSUBSCRIBE",
1002
+ H5_ROOM_SEND_MESSAGE = "H5_ROOM_SEND_MESSAGE",
1003
+ H5_ROOM_GET_MESSAGES = "H5_ROOM_GET_MESSAGES",
1004
+ H5_ROOM_LIST_ROOMS = "H5_ROOM_LIST_ROOMS",
1005
+ H5_ROOM_LIST_PUBLIC = "H5_ROOM_LIST_PUBLIC",
1006
+ H5_ROOM_SEARCH = "H5_ROOM_SEARCH",
1007
+ H5_ROOM_JOIN_BY_CODE = "H5_ROOM_JOIN_BY_CODE",
1008
+ H5_ROOM_GET_USER_ROOMS = "H5_ROOM_GET_USER_ROOMS",
1009
+ H5_ROOM_GET_PLAYERS = "H5_ROOM_GET_PLAYERS",
1010
+ H5_ROOM_UPDATE_PLAYER_DATA = "H5_ROOM_UPDATE_PLAYER_DATA",
1011
+ H5_ROOM_START_GAME = "H5_ROOM_START_GAME",
1012
+ H5_ROOM_PROPOSE_MOVE = "h5:room:proposeMove",
1013
+ H5_ROOM_END_GAME = "H5_ROOM_END_GAME",
1014
+ H5_ROOM_KICK_PLAYER = "H5_ROOM_KICK_PLAYER",
1015
+ H5_ROOM_PROMOTE_TO_SPECTATOR = "H5_ROOM_PROMOTE_TO_SPECTATOR",
1016
+ H5_LOAD_EMBEDDED_ASSET = "H5_LOAD_EMBEDDED_ASSET",
1017
+ H5_SHOW_LOAD_SCREEN = "H5_SHOW_LOAD_SCREEN",
1018
+ H5_HIDE_LOAD_SCREEN = "H5_HIDE_LOAD_SCREEN",
1019
+ H5_SET_LOADER_TEXT = "H5_SET_LOADER_TEXT",
1020
+ H5_SET_LOADER_PROGRESS = "H5_SET_LOADER_PROGRESS",
1021
+ H5_IAP_OPEN_STORE = "H5_IAP_OPEN_STORE",
1022
+ H5_IAP_GET_CURRENCY_ICON = "H5_IAP_GET_CURRENCY_ICON"
1023
+ }
1024
+
1025
+ declare class RemoteHost implements Host {
1026
+ readonly ads: AdsApi;
1027
+ readonly analytics: AnalyticsApi;
1028
+ readonly deviceCache: StorageApi;
1029
+ readonly appStorage: StorageApi;
1030
+ readonly globalStorage: StorageApi;
1031
+ readonly avatar3d: Avatar3dApi;
1032
+ readonly navigation: NavigationApi;
1033
+ readonly notifications: NotificationsApi;
1034
+ readonly popups: PopupsApi;
1035
+ readonly profile: ProfileApi;
1036
+ readonly system: SystemApi;
1037
+ readonly cdn: CdnApi;
1038
+ readonly time: TimeApi;
1039
+ readonly ai: AiApi;
1040
+ readonly haptics: HapticsApi;
1041
+ readonly features: FeaturesApi;
1042
+ readonly lifecycle: LifecycleApi;
1043
+ readonly simulation: SimulationApi;
1044
+ readonly rooms: RoomsApi;
1045
+ readonly logging: LoggingApi;
1046
+ readonly iap: IapApi;
1047
+ readonly leaderboard: LeaderboardApi;
1048
+ readonly preloader: PreloaderApi;
1049
+ readonly social: SocialApi;
1050
+ context?: InitializationContext;
1051
+ get isInitialized(): boolean;
1052
+ private readonly rundotGameApi;
1053
+ private readonly rpcClient;
1054
+ private _isInitialized;
1055
+ constructor(rundotGameApi: RundotGameAPI);
1056
+ initialize(options?: InitializationOptions): Promise<InitializationContext>;
1057
+ private log;
1058
+ }
1059
+ interface InitResponse {
1060
+ initializeAsleep: boolean;
1061
+ instanceId: string;
1062
+ profile: {
1063
+ id: string;
1064
+ username: string;
1065
+ avatarUrl?: string | null;
1066
+ isAnonymous?: boolean;
1067
+ };
1068
+ safeArea?: SafeArea;
1069
+ launchParams: Record<string, string>;
1070
+ shareParams: Record<string, string>;
1071
+ environment: EnvironmentInfo;
1072
+ device: DeviceInfo;
1073
+ locale: string;
1074
+ languageCode: string;
1075
+ rooms?: {
1076
+ gameType?: string;
1077
+ rulesPreset?: string;
1078
+ matchmaking?: Record<string, any>;
1079
+ createOptions?: Record<string, any>;
1080
+ privateMatchDefaults?: Record<string, any>;
1081
+ [key: string]: any;
1082
+ };
1083
+ }
1084
+
1085
+ export { AdsApi, AiApi, AiChatCompletionData, AiChatCompletionRequest, AnalyticsApi, AssetManifest, Avatar3dApi, Avatar3dConfig, Avatar3dEdits, AwakeCallback, BaseCdnApi, CdnApi, CollectRecipeResult, CreateRoomOptions, DEFAULT_SHARED_LIB_CDN_BASE, DeviceApi, DeviceInfo, EMBEDDED_LIBRARIES, EMBEDDED_LIBRARY_BY_KEY, type EmbeddedLibraryDefinition, EnvironmentApi, EnvironmentInfo, ExecuteRecipeOptions, ExecuteRecipeResponse, ExecuteScopedRecipeOptions, ExecuteScopedRecipeResult, Experiment, FeaturesApi, FetchFromCdnOptions, GetActiveRunsOptions, GetAvailableRecipesOptions, GetAvailableRecipesResult, GetBatchRecipeRequirements, GetFutureTimeOptions, GetPagedScoresOptions, GetPodiumScoresOptions, HASH_ALGORITHM_NODE, HASH_ALGORITHM_WEB_CRYPTO, HapticFeedbackStyle, HapticsApi, Host, HostCdnApi, HostDeviceApi, HostEnvironmentApi, HostProfileApi, HostSystemApi, HostTimeApi, IapApi, type InitResponse, InitializationContext, InitializationOptions, JoinOrCreateResult, JoinOrCreateRoomOptions, LeaderboardApi, LifecycleApi, ListRoomsOptions, LoadEmbeddedAssetsResponse, LoggingApi, MODULE_TO_LIBRARY_SPECIFIERS, type MethodIds, MockAdsApi, MockAiApi, MockAnalyticsApi, MockCdnApi, MockDeviceApi, MockEnvironmentApi, MockFeaturesApi, MockHapticsApi, MockIapApi, MockLeaderboardApi, MockLifecycleApi, MockLoggingApi, MockNavigationApi, MockNotificationsApi, MockPopupsApi, MockPreloaderApi, MockProfileApi, MockSharedAssetsApi, MockSocialApi, MockStorageApi, MockSystemApi, MockTimeApi, type ModuleSpecifierConfig, type ModuleSpecifierMatch, NavigationApi, NavigationStackInfo, type NotificationContent, NotificationsApi, PagedScoresResponse, PauseCallback, PlayerRankOptions, PlayerRankResult, PodiumScoresResponse, PopupsApi, PreloaderApi, ProfileApi, ProposeMoveRequest, ProposeMoveResult, ProposedMoveEvent, PushAppOptions, QRCodeResult, QuitCallback, QuitOptions, Recipe, type RemoteFunctionInvoker, RemoteHost, ResetStateOptions, ResetStateResult, ResumeCallback, RoomDataUpdate, RoomMessageEvent, RoomMessageRequest, type RoomNotificationSubscriptionState, RoomSubscriptionOptions, RoomsApi, RpcAdsApi, RpcAiApi, RpcAnalyticsApi, RpcAvatarApi, RpcClient, RpcFeaturesApi, RpcHapticsApi, RpcIapApi, RpcLeaderboardApi, RpcLifecycleApi, RpcLoggingApi, type RpcMessage, RpcNavigationApi, RpcNotification, RpcNotificationsApi, RpcPopupsApi, RpcPreloaderApi, RpcRequest, RpcResponse, RpcRoomsApi, RpcSimulationApi, RpcSocialApi, RpcStorageApi, RundotGameMessageId, RundotGameRoom, SDK_VERSION, SafeArea, SandboxProfileApi, ScheduleLocalNotification, ScheduleNotificationOptions, ScoreToken, ServerTimeData, ShareLinkResult, ShareMetadata, SharedAssetsApi, ShowEditorOptions, ShowInterstitialAdOptions, ShowRewardedAdOptions, ShowToastOptions, type ShowToastResponse, SimulationApi, SimulationAssignment, SimulationAvailableItem, SimulationBatchOperation, SimulationBatchOperationsResult, SimulationPowerPreview, SimulationRunSummary, SimulationSlotContainer, SimulationSlotMutationResult, SimulationSlotValidationResult, SimulationState, SleepCallback, SocialApi, SocialQRCodeOptions, SpendCurrencyOptions, StartRoomGameOptions, StorageApi, type StorageType, SubmitScoreParams, SubmitScoreResult, Subscription, SystemApi, TimeApi, TriggerRecipeChainOptions, UpdateRoomDataOptions, ValidateMoveResult, ValidateMoveVerdict, base64ToArrayBuffer, base64ToUtf8, computeScoreHash, createMockStorageApi, getLibraryDefinition, initializeAds, initializeAi, initializeAnalytics, initializeAvatar3d, initializeCdn, initializeFeaturesApi, initializeHaptics, initializeIap, initializeLeaderboard, initializeLifecycleApi, initializeLocalNotifications, initializeLoggingApi, initializePopups, initializePreloader, initializeProfile, initializeRoomsApi, initializeSimulation, initializeSocial, initializeStackNavigation, initializeStorage, initializeSystem, initializeTime, isPacificDaylightTime, setupRoomNotifications };