@series-inc/venus-sdk 2.6.2 → 3.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.
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { A as AnalyticsApi, R as RpcRequest, a as RpcResponse, b as RpcNotification, c as RpcClient, V as VenusAPI, N as NavigationApi, Q as QuitOptions, d as NavigationStackInfo, P as PushAppOptions, e as NotificationsApi, S as ScheduleLocalNotification, f as ScheduleNotificationOptions, g as PopupsApi, h as ActionSheetItem, i as ShowActionSheetOptions, j as ShowAlertOptions, k as ShowConfirmOptions, l as ShowToastOptions, m as Profile, n as AiApi, o as AiChatCompletionRequest, p as AiChatCompletionData, H as HapticsApi, q as HapticFeedbackStyle, L as LifecycleApi, O as OnCleanupCallback, r as OnShowCallback, s as OnHideCallback, t as OnPauseCallback, u as OnPlayCallback, v as OnQuitCallback, w as OnResumeCallback, x as PlayContext, y as ShowContext, z as VenusSimulationConfig, B as RecipeRequirementResult, C as VenusRoom, D as VenusTransport, E as Subscription, I as IapApi, F as SpendCurrencyOptions, G as LoadEmbeddedAssetsResponse, J as SharedAssetsApi, K as PreloaderApi, M as AdsApi, T as Avatar3dApi, U as CdnApi, W as AssetManifest, X as Avatar3dConfig, Y as ShowEditorOptions, Z as Avatar3dEdits, _ as SubPath, $ as FetchBlobOptions } from './AdsApi-C_GcWmfO.js';
2
- export { a0 as AiMessage, a1 as Asset, a2 as Category, a4 as Insets, ad as LoadEmbeddedAssetsRequest, a3 as MockAvatarApi, a7 as NotificationTriggerInput, aa as OnNotificationCallback, a8 as OnRequestCallback, a9 as OnResponseCallback, a5 as PostInfo, ac as RpcSharedAssetsApi, ab as RpcTransport, a6 as TimeIntervalTriggerInput } from './AdsApi-C_GcWmfO.js';
1
+ import { A as AnalyticsApi, R as RpcRequest, a as RpcResponse, b as RpcNotification, c as RpcClient, V as VenusAPI, H as Host, S as StorageApi, N as NavigationApi, Q as QuitOptions, d as NavigationStackInfo, P as PushAppOptions, e as NotificationsApi, f as ScheduleLocalNotification, g as ScheduleNotificationOptions, h as PopupsApi, i as ActionSheetItem, j as ShowActionSheetOptions, k as ShowAlertOptions, l as ShowConfirmOptions, m as ShowToastOptions, n as ShowInterstitialAdOptions, o as ShowRewardedAdOptions, p as ProfileApi, q as Profile, C as CdnApi, r as SubPath, F as FetchBlobOptions, T as TimeApi, s as ServerTimeData, G as GetFutureTimeOptions, t as AiApi, u as AiChatCompletionRequest, v as AiChatCompletionData, w as HapticsApi, x as HapticFeedbackStyle, y as FeaturesApi, E as Experiment, L as LifecycleApi, z as SleepCallback, B as Subscription, D as AwakeCallback, I as PauseCallback, J as ResumeCallback, K as QuitCallback, M as SimulationApi, O as VenusSimulationConfig, U as ExecuteRecipeOptions, W as CollectRecipeResult, X as GetActiveRunsOptions, Y as ExecuteScopedRecipeResult, Z as GetAvailableRecipesOptions, _ as GetAvailableRecipesResult, $ as Recipe, a0 as GetBatchRecipeRequirements, a1 as TriggerRecipeChainOptions, a2 as RecipeRequirementResult, a3 as VenusTransport, a4 as LoggingApi, a5 as IapApi, a6 as SpendCurrencyOptions, a7 as LoadEmbeddedAssetsResponse, a8 as SharedAssetsApi, a9 as LeaderboardApi, aa as StartRunResult, ab as SubmitScoreOptions, ac as SubmitScoreResult, ad as GetLeaderboardOptions, ae as LeaderboardResponse, af as PlayerStatsOptions, ag as PlayerStats, ah as LeaderboardHighlightOptions, ai as LeaderboardHighlightResponse, aj as PreloaderApi, ak as Avatar3dApi, al as AssetManifest, am as Avatar3dConfig, an as ShowEditorOptions, ao as Avatar3dEdits, ap as SocialApi, aq as ShareMetadata, ar as ShareLinkResult, as as SocialQRCodeOptions, at as QRCodeResult, au as AdsApi, av as PostApi, aw as RoomsApi, ax as InitializationOptions, ay as InitializationContext, az as HudInsets } from './AdsApi-3DEYUUuj.js';
2
+ export { aA as AiMessage, aB as Asset, aC as Category, aL as CreateRoomOptions, aR as ExecuteScopedRecipeOptions, b1 as InitializeOptions, aM as JoinOrCreateResult, aY as LeaderboardAntiCheatConfig, a_ as LeaderboardConfig, aZ as LeaderboardDisplaySettings, a$ as LeaderboardEntry, b0 as LeaderboardHighlightContext, aV as LeaderboardModeConfig, aX as LeaderboardPeriodConfig, aW as LeaderboardPeriodType, aU as LoadEmbeddedAssetsRequest, aD as MockAvatarApi, aF as NotificationTriggerInput, aI as OnNotificationCallback, aG as OnRequestCallback, aH as OnResponseCallback, aO as ProposeMovePayload, aP as ProposeMoveResult, aS as RecipeInfo, aN as RoomSubscriptionOptions, aT as RpcSharedAssetsApi, aJ as RpcTransport, aE as TimeIntervalTriggerInput, aQ as ValidateMoveResult, aK as VenusRoom, b2 as createHost } from './AdsApi-3DEYUUuj.js';
3
3
 
4
4
  declare class MockAnalyticsApi implements AnalyticsApi {
5
5
  recordCustomEvent(eventName: string, payload: Record<string, any>): Promise<void>;
@@ -17,21 +17,61 @@ declare class RpcAnalyticsApi implements AnalyticsApi {
17
17
 
18
18
  declare function initializeAnalytics(venusApiInstance: VenusAPI, host: Host): void;
19
19
 
20
- interface StorageApi {
21
- key(index: number): Promise<string | null>;
20
+ type StorageType = 'globalStorage' | 'deviceCache' | 'appStorage';
21
+ declare function createMockStorageApi(storageType: StorageType, appUrl?: string): MockStorageApi;
22
+ declare class MockStorageApi implements StorageApi {
23
+ private readonly prefix;
24
+ private readonly syncDelay;
25
+ constructor(prefix: string, syncDelay: number);
22
26
  clear(): Promise<void>;
23
- length(): Promise<number>;
24
27
  getAllItems(): Promise<string[]>;
25
- setMultipleItems(items: {
28
+ getItem(key: string): Promise<string | null>;
29
+ key(index: number): Promise<string | null>;
30
+ length(): Promise<number>;
31
+ removeItem(key: string): Promise<void>;
32
+ setItem(key: string, item: string): Promise<void>;
33
+ setMultipleItems(entries: {
26
34
  key: string;
27
35
  value: string;
28
36
  }[]): Promise<void>;
29
37
  removeMultipleItems(keys: string[]): Promise<void>;
30
- setItem(key: string, item: string): Promise<void>;
38
+ private buildKey;
39
+ private extractKey;
40
+ private keys;
41
+ private simulateSyncDelay;
42
+ }
43
+
44
+ interface MethodIds {
45
+ clear: string;
46
+ getItem: string;
47
+ getKey: string;
48
+ length: string;
49
+ removeItem: string;
50
+ setItem: string;
51
+ getAllItems?: string;
52
+ removeMultipleItems?: string;
53
+ setMultipleItems?: string;
54
+ }
55
+ declare class RpcStorageApi implements StorageApi {
56
+ private readonly rpcClient;
57
+ private readonly methodIds;
58
+ constructor(rpcClient: RpcClient, methodIds: MethodIds);
59
+ clear(): Promise<void>;
31
60
  getItem(key: string): Promise<string | null>;
61
+ setItem(key: string, value: string): Promise<void>;
62
+ key(index: number): Promise<string | null>;
63
+ length(): Promise<number>;
32
64
  removeItem(key: string): Promise<void>;
65
+ removeMultipleItems(keys: string[]): Promise<void>;
66
+ getAllItems(): Promise<string[]>;
67
+ setMultipleItems(items: {
68
+ key: string;
69
+ value: string;
70
+ }[]): Promise<void>;
33
71
  }
34
72
 
73
+ declare function initializeStorage(venusApiInstance: VenusAPI, host: Host): void;
74
+
35
75
  declare class MockNavigationApi implements NavigationApi {
36
76
  private readonly venusApi;
37
77
  constructor(venusApi: VenusAPI);
@@ -60,14 +100,14 @@ declare class MockNotificationsApi implements NotificationsApi {
60
100
  cancelNotification(notificationId: string): Promise<boolean>;
61
101
  getAllScheduledLocalNotifications(): Promise<ScheduleLocalNotification[]>;
62
102
  isLocalNotificationsEnabled(): Promise<boolean>;
63
- scheduleAsync(options: ScheduleNotificationOptions): Promise<string | null>;
103
+ scheduleAsync(title: string, body: string, seconds: number, notificationId?: string, options?: ScheduleNotificationOptions): Promise<string | null>;
64
104
  setLocalNotificationsEnabled(enabled: boolean): Promise<boolean>;
65
105
  }
66
106
 
67
107
  declare class RpcNotificationsApi implements NotificationsApi {
68
108
  private readonly rpcClient;
69
109
  constructor(rpcClient: RpcClient);
70
- scheduleAsync(options: ScheduleNotificationOptions): Promise<string | null>;
110
+ scheduleAsync(title: string, body: string, seconds: number, notificationId?: string, options?: ScheduleNotificationOptions): Promise<string | null>;
71
111
  cancelNotification(id: string): Promise<boolean>;
72
112
  getAllScheduledLocalNotifications(): Promise<ScheduleLocalNotification[]>;
73
113
  isLocalNotificationsEnabled(): Promise<boolean>;
@@ -101,7 +141,7 @@ interface MockOverlay {
101
141
  adOverlay: HTMLElement;
102
142
  actionSheetOverlay: HTMLElement;
103
143
  appVisibilityState: 'visible' | 'hidden';
104
- showAdOverlay: () => Promise<boolean>;
144
+ showAdOverlay: (options?: ShowInterstitialAdOptions | ShowRewardedAdOptions) => Promise<boolean>;
105
145
  showActionSheet: (items: ActionSheetItem[], options?: ShowActionSheetOptions) => Promise<string | number | null>;
106
146
  }
107
147
  interface OverlayElements {
@@ -119,10 +159,6 @@ declare class MockPopupsApi implements PopupsApi {
119
159
 
120
160
  declare function initializePopups(venusApi: VenusAPI, host: Host): void;
121
161
 
122
- interface ProfileApi {
123
- getCurrentProfile(): Profile;
124
- }
125
-
126
162
  declare class HostProfileApi implements ProfileApi {
127
163
  getCurrentProfile(): Profile;
128
164
  }
@@ -133,31 +169,30 @@ declare class MockProfileApi implements ProfileApi {
133
169
 
134
170
  declare function initializeProfile(venusApi: VenusAPI, host: Host): void;
135
171
 
136
- interface ServerTimeData {
137
- serverTime: number;
138
- localTime: number;
139
- timezoneOffset: number;
140
- formattedTime: string;
141
- locale: string;
142
- }
143
- interface GetFutureTimeOptions {
144
- days?: number;
145
- hours?: number;
146
- minutes?: number;
147
- timeOfDay?: {
148
- hour: number;
149
- minute: number;
150
- second: number;
151
- };
152
- timezone?: any;
172
+ declare class HostCdnApi implements CdnApi {
173
+ private readonly baseUrl;
174
+ constructor(baseUrl: string);
175
+ fetchBlob(path: SubPath, options?: FetchBlobOptions): Promise<Blob>;
176
+ fetchFromCdn(url: string, request?: RequestInit): Promise<Response>;
177
+ getAssetCdnBaseUrl(): string;
178
+ resolveAssetUrl(subPath: string): string;
179
+ resolveAvatarAssetUrl(subPath: string): string;
180
+ resolveSharedLibUrl(subPath: string): string;
153
181
  }
154
- interface TimeApi {
155
- requestTimeAsync(): Promise<ServerTimeData>;
156
- formatTime(timestamp: number, options?: any): string;
157
- formatNumber(value: number, options?: Intl.NumberFormatOptions): string;
158
- getFutureTimeAsync(options?: GetFutureTimeOptions): Promise<number>;
182
+
183
+ declare class MockCdnApi implements CdnApi {
184
+ private readonly baseUrl;
185
+ constructor();
186
+ fetchBlob(path: SubPath, options?: FetchBlobOptions): Promise<Blob>;
187
+ getAssetCdnBaseUrl(): string;
188
+ resolveAssetUrl(subPath: string): string;
189
+ resolveAvatarAssetUrl(subPath: string): string;
190
+ resolveSharedLibUrl(subPath: string): string;
191
+ fetchFromCdn(url: string, options?: RequestInit): Promise<Response>;
159
192
  }
160
193
 
194
+ declare function initializeCdn(venusApi: VenusAPI, host: Host): void;
195
+
161
196
  declare class HostTimeApi implements TimeApi {
162
197
  private readonly rpcClient;
163
198
  constructor(rpcClient: RpcClient);
@@ -181,44 +216,6 @@ declare class MockTimeApi implements TimeApi {
181
216
 
182
217
  declare function initializeTime(venusApi: VenusAPI, host: Host): void;
183
218
 
184
- interface PostInfo {
185
- isLiked: boolean;
186
- isFollowing: boolean;
187
- likesCount: number;
188
- commentsCount: number;
189
- }
190
- interface ToggleLikeResult {
191
- isLiked: boolean;
192
- likesCount: number;
193
- action: 'liked' | 'unliked';
194
- }
195
- interface ToggleFollowResult {
196
- isFollowing: boolean;
197
- action: 'followed' | 'unfollowed';
198
- }
199
- interface OpenCommentsResult {
200
- opened: boolean;
201
- commentsCount: number;
202
- }
203
- interface ShareContext {
204
- message?: string;
205
- title?: string;
206
- senderId?: string | null;
207
- additionalInfo?: Record<string, any>;
208
- }
209
- interface SharePostResult {
210
- shared: true;
211
- platform: string;
212
- customMessage?: string;
213
- }
214
- interface PostApi {
215
- getPostInfo(): Promise<PostInfo>;
216
- toggleLikeAsync(): Promise<ToggleLikeResult>;
217
- openCommentsAsync(): Promise<OpenCommentsResult>;
218
- toggleFollowAsync(): Promise<ToggleFollowResult>;
219
- sharePostAsync(context: ShareContext): Promise<SharePostResult>;
220
- }
221
-
222
219
  declare class RpcAiApi implements AiApi {
223
220
  private readonly rpcClient;
224
221
  constructor(rpcClient: RpcClient);
@@ -247,18 +244,6 @@ declare class MockHapticsApi implements HapticsApi {
247
244
 
248
245
  declare function initializeHaptics(venusApi: VenusAPI, host: Host): void;
249
246
 
250
- interface Experiment {
251
- readonly name: string;
252
- readonly ruleID: string;
253
- readonly value: Record<string, unknown>;
254
- readonly groupName: string | null;
255
- }
256
- interface FeaturesApi {
257
- getExperiment(experimentName: string): Promise<Experiment | null>;
258
- getFeatureFlag(flagName: string): Promise<boolean>;
259
- getFeatureGate(gateName: string): Promise<boolean>;
260
- }
261
-
262
247
  declare class RpcFeaturesApi implements FeaturesApi {
263
248
  private readonly rpcClient;
264
249
  constructor(rcpClient: RpcClient);
@@ -276,113 +261,35 @@ declare class MockFeaturesApi implements FeaturesApi {
276
261
  declare function initializeFeaturesApi(venusApi: VenusAPI, host: Host): void;
277
262
 
278
263
  declare class MockLifecycleApi implements LifecycleApi {
279
- private playCallbacks;
280
264
  private pauseCallbacks;
281
265
  private resumeCallbacks;
266
+ private awakeCallbacks;
267
+ private sleepCallbacks;
282
268
  private quitCallbacks;
283
- private showCallbacks;
284
- private hideCallbacks;
285
- onCleanup(callback: OnCleanupCallback): void;
286
- onShow(callback: OnShowCallback): void;
287
- onHide(callback: OnHideCallback): void;
288
- onPause(callback: OnPauseCallback): void;
289
- onPlay(callback: OnPlayCallback): void;
290
- onQuit(callback: OnQuitCallback): void;
291
- onResume(callback: OnResumeCallback): void;
292
- triggerOnPlayCallbacks(context: PlayContext): void;
293
- triggerOnPauseCallbacks(): void;
294
- triggerOnResumeCallbacks(): void;
295
- triggerOnShowCallbacks(context: ShowContext): void;
296
- triggerOnHideCallbacks(): void;
297
- triggerOnQuitCallbacks(): void;
269
+ onSleep(callback: SleepCallback): Subscription;
270
+ onAwake(callback: AwakeCallback): Subscription;
271
+ onPause(callback: PauseCallback): Subscription;
272
+ onResume(callback: ResumeCallback): Subscription;
273
+ onQuit(callback: QuitCallback): Subscription;
274
+ triggerPauseCallbacks(): void;
275
+ triggerResumeCallbacks(): void;
276
+ triggerAwakeCallbacks(): void;
277
+ triggerSleepCallbacks(): void;
278
+ triggerQuitCallbacks(): void;
298
279
  }
299
280
 
300
281
  declare class RpcLifecycleApi implements LifecycleApi {
301
282
  private readonly rpcClient;
302
283
  constructor(rpcClient: RpcClient);
303
- onCleanup(callback: OnCleanupCallback): void;
304
- onHide(callback: OnHideCallback): void;
305
- onPause(callback: OnPauseCallback): void;
306
- onPlay(callback: OnPlayCallback): void;
307
- onQuit(callback: OnQuitCallback): void;
308
- onResume(callback: OnResumeCallback): void;
309
- onShow(callback: OnShowCallback): void;
284
+ onQuit(callback: QuitCallback): Subscription;
285
+ onSleep(callback: SleepCallback): Subscription;
286
+ onAwake(callback: AwakeCallback): Subscription;
287
+ onResume(callback: ResumeCallback): Subscription;
288
+ onPause(callback: PauseCallback): Subscription;
310
289
  }
311
290
 
312
291
  declare function initializeLifecycleApi(venusApi: VenusAPI, host: Host): void;
313
292
 
314
- interface ExecuteRecipeOptions {
315
- roomId?: string;
316
- batchAmount?: number;
317
- allowPartialBatch?: boolean;
318
- entity?: string;
319
- }
320
- interface GetActiveRunsOptions {
321
- roomId?: string;
322
- }
323
- interface ExecuteScopedRecipeOptions {
324
- roomId?: string;
325
- }
326
- interface GetAvailableRecipesOptions {
327
- roomId?: string;
328
- includeActorRecipes?: boolean;
329
- }
330
- interface Recipe {
331
- recipeId: string;
332
- entity?: string;
333
- batchAmount?: number;
334
- }
335
- interface TriggerRecipeChainOptions {
336
- roomId?: string;
337
- context?: any;
338
- }
339
- interface CollectRecipeResult {
340
- success: boolean;
341
- runId: string;
342
- rewards: any;
343
- message: string;
344
- }
345
- interface ExecuteScopedRecipeResult {
346
- success: boolean;
347
- message: string;
348
- }
349
- interface RecipeInfo {
350
- id: string;
351
- scope: string;
352
- clientViewable: boolean;
353
- }
354
- interface GetAvailableRecipesResult {
355
- success: boolean;
356
- recipes: RecipeInfo[];
357
- }
358
- interface GetBatchRecipeRequirements {
359
- success: boolean;
360
- results: RecipeRequirementResult[];
361
- }
362
- interface SimulationApi {
363
- getStateAsync(roomId?: string): Promise<any>;
364
- getConfigAsync(roomId?: string): Promise<VenusSimulationConfig>;
365
- executeRecipeAsync(recipeId: string, inputs?: any, options?: ExecuteRecipeOptions): Promise<any>;
366
- getActiveRunsAsync(options?: GetActiveRunsOptions): Promise<any>;
367
- collectRecipeAsync(runId: string): Promise<CollectRecipeResult>;
368
- executeScopedRecipeAsync(recipeId: string, entity: string, inputs?: any, options?: ExecuteScopedRecipeOptions | any): Promise<ExecuteScopedRecipeResult>;
369
- triggerRecipeChainAsync(recipeId: string, options?: TriggerRecipeChainOptions): Promise<any>;
370
- getAvailableRecipesAsync(options?: GetAvailableRecipesOptions): Promise<GetAvailableRecipesResult>;
371
- getRecipeRequirementsAsync(recipe: Recipe): Promise<RecipeRequirementResult>;
372
- getBatchRecipeRequirementsAsync(recipes: Recipe[]): Promise<GetBatchRecipeRequirements>;
373
- resolveFieldValueAsync(entityId: string, fieldPath: string, entity?: string): Promise<any>;
374
- getEntityMetadataAsync(entityId: string): Promise<any>;
375
- getSlotContainersAsync(): Promise<any>;
376
- getSlotAssignmentsAsync(containerId: string): Promise<any>;
377
- assignItemToSlotAsync(containerId: string, slotId: string, itemId: string): Promise<any>;
378
- removeItemFromSlotAsync(containerId: string, slotId: string): Promise<any>;
379
- getAvailableItemsAsync(containerId: string, slotId: string): Promise<Array<any>>;
380
- calculatePowerPreviewAsync(containerId: string, slotId: string, candidateItemId: string): Promise<any>;
381
- validateSlotAssignmentAsync(containerId: string, slotId: string, itemId: string): Promise<any>;
382
- executeBatchOperationsAsync(operations: Array<any>, validateOnly?: boolean): Promise<any>;
383
- sumContributions(contributions: Record<string, any>): Record<string, number>;
384
- }
385
-
386
293
  declare class RpcSimulationApi implements SimulationApi {
387
294
  private readonly rpcClient;
388
295
  private _simulationConfig;
@@ -449,58 +356,6 @@ declare class MockSimulationApi implements SimulationApi {
449
356
 
450
357
  declare function initializeSimulation(venusApi: VenusAPI, host: Host): void;
451
358
 
452
- interface CreateRoomOptions {
453
- maxPlayers?: number;
454
- gameType?: string;
455
- isPrivate?: boolean;
456
- roomCode?: string;
457
- name?: string;
458
- description?: string;
459
- customMetadata?: Record<string, any>;
460
- }
461
- interface JoinOrCreateResult {
462
- action: 'created' | 'joined';
463
- room: VenusRoom;
464
- playersJoined: number;
465
- }
466
- interface RoomSubscriptionOptions {
467
- onData?: (roomData: any) => void;
468
- onMessages?: (messagePayload: any) => void;
469
- onMoves?: (movePayload: any) => void;
470
- onGameEvents?: (eventPayload: any) => void;
471
- }
472
- interface ProposeMovePayload {
473
- gameSpecificState: any;
474
- moveType: string;
475
- clientContext?: Record<string, any>;
476
- clientProposalId?: string;
477
- }
478
- interface ProposeMoveResult {
479
- proposedMoveId: string;
480
- }
481
- interface ValidateMoveResult {
482
- success: boolean;
483
- moveId: string;
484
- isValid: boolean;
485
- reason?: string | null;
486
- }
487
- interface RoomsApi {
488
- createRoom(options: CreateRoomOptions): Promise<VenusRoom>;
489
- joinOrCreateRoom(options: CreateRoomOptions): Promise<JoinOrCreateResult>;
490
- joinRoomByCode?(roomCode: string): Promise<VenusRoom>;
491
- getUserRooms?(includeArchived?: boolean): Promise<VenusRoom[]>;
492
- subscribe?(room: VenusRoom, options: RoomSubscriptionOptions): (() => void) | {
493
- unsubscribe(): void;
494
- };
495
- updateData?(room: VenusRoom, updates: Record<string, any>, merge?: boolean): Promise<any>;
496
- getData?(room: VenusRoom): Promise<any>;
497
- sendMessage?(room: VenusRoom, messageData: any): Promise<string>;
498
- leave?(room: VenusRoom): Promise<any>;
499
- startGame?(room: VenusRoom, gameConfig?: Record<string, any>, turnOrder?: string[] | null): Promise<any>;
500
- proposeMove?(room: VenusRoom, proposalPayload: ProposeMovePayload): Promise<ProposeMoveResult>;
501
- validateMove?(room: VenusRoom, moveId: string, isValid: boolean, reason?: string | null, validatorId?: string | null): Promise<ValidateMoveResult>;
502
- }
503
-
504
359
  /**
505
360
  * Set up room notification listeners using the transport's onVenusMessage hook.
506
361
  * This routes host-sent room notifications (H5_ROOM_DATA_UPDATED, etc.) to the
@@ -511,11 +366,6 @@ interface RoomsApi {
511
366
  declare function setupRoomNotifications(transport: VenusTransport, getSubscriptions: () => any): Subscription;
512
367
  declare function initializeRoomsApi(venusApi: VenusAPI, host: Host): void;
513
368
 
514
- interface LoggingApi {
515
- logDebug(message: string, ...args: any[]): void;
516
- logError(message: string, ...args: any[]): void;
517
- }
518
-
519
369
  declare class MockLoggingApi implements LoggingApi {
520
370
  logDebug(message?: any, ...args: any[]): void;
521
371
  logError(message: string, ...args: any[]): void;
@@ -561,6 +411,39 @@ declare class MockIapApi implements IapApi {
561
411
 
562
412
  declare function initializeIap(venusApiInstance: VenusAPI, host: Host): void;
563
413
 
414
+ declare class RpcLeaderboardApi implements LeaderboardApi {
415
+ private readonly rpcClient;
416
+ constructor(rpcClient: RpcClient);
417
+ startRun(mode?: string): Promise<StartRunResult>;
418
+ submitScore(sessionId: string, score: number, durationSec: number, options?: SubmitScoreOptions): Promise<SubmitScoreResult>;
419
+ getLeaderboard(options?: GetLeaderboardOptions): Promise<LeaderboardResponse>;
420
+ getPlayerStats(options?: PlayerStatsOptions): Promise<PlayerStats>;
421
+ getLeaderboardHighlight(options?: LeaderboardHighlightOptions): Promise<LeaderboardHighlightResponse>;
422
+ }
423
+
424
+ declare class MockLeaderboardApi implements LeaderboardApi {
425
+ private sessions;
426
+ private entriesByMode;
427
+ private sessionCounter;
428
+ private requiresHash;
429
+ constructor(options?: {
430
+ requiresHash?: boolean;
431
+ });
432
+ configure(options: {
433
+ requiresHash?: boolean;
434
+ }): void;
435
+ private generateNonce;
436
+ private getModeKey;
437
+ private getEntriesForMode;
438
+ startRun(mode?: string): Promise<StartRunResult>;
439
+ submitScore(sessionId: string, score: number, durationSec: number, options?: SubmitScoreOptions): Promise<SubmitScoreResult>;
440
+ getLeaderboard(options?: GetLeaderboardOptions): Promise<LeaderboardResponse>;
441
+ getPlayerStats(_options?: PlayerStatsOptions): Promise<PlayerStats>;
442
+ getLeaderboardHighlight(options?: LeaderboardHighlightOptions): Promise<LeaderboardHighlightResponse>;
443
+ }
444
+
445
+ declare function initializeLeaderboard(venusApiInstance: VenusAPI, host: Host): void;
446
+
564
447
  declare class MockPreloaderApi implements PreloaderApi {
565
448
  showLoadScreen(): Promise<void>;
566
449
  hideLoadScreen(): Promise<void>;
@@ -579,38 +462,6 @@ declare class RpcPreloaderApi implements PreloaderApi {
579
462
 
580
463
  declare function initializePreloader(venusApi: VenusAPI, host: Host): void;
581
464
 
582
- interface InitializeOptions {
583
- usePreloader?: boolean;
584
- mock?: Record<string, any>;
585
- [key: string]: any;
586
- }
587
- interface Host {
588
- readonly ads: AdsApi;
589
- readonly analytics: AnalyticsApi;
590
- readonly deviceCache: StorageApi;
591
- readonly appStorage: StorageApi;
592
- readonly globalStorage: StorageApi;
593
- readonly avatar3d: Avatar3dApi;
594
- readonly navigation: NavigationApi;
595
- readonly notifications: NotificationsApi;
596
- readonly popups: PopupsApi;
597
- readonly profile: ProfileApi;
598
- readonly cdn: CdnApi;
599
- readonly time: TimeApi;
600
- readonly post: PostApi;
601
- readonly ai: AiApi;
602
- readonly haptics: HapticsApi;
603
- readonly features: FeaturesApi;
604
- readonly lifecycle: LifecycleApi;
605
- readonly simulation: SimulationApi;
606
- readonly rooms: RoomsApi;
607
- readonly logging: LoggingApi;
608
- readonly preloader: PreloaderApi;
609
- readonly isInitialized: boolean;
610
- initialize(options?: InitializeOptions): Promise<void>;
611
- readonly iap: IapApi;
612
- }
613
-
614
465
  declare class RpcAvatarApi implements Avatar3dApi {
615
466
  private readonly venusApi;
616
467
  private readonly rpcClient;
@@ -627,104 +478,52 @@ declare class RpcAvatarApi implements Avatar3dApi {
627
478
 
628
479
  declare function initializeAvatar3d(venusApi: VenusAPI, host: Host): void;
629
480
 
630
- declare class HostCdnApi implements CdnApi {
631
- private readonly baseUrl;
632
- constructor(baseUrl: string);
633
- fetchBlob(path: SubPath, options?: FetchBlobOptions): Promise<Blob>;
634
- fetchFromCdn(url: string, request?: RequestInit): Promise<Response>;
635
- getAssetCdnBaseUrl(): string;
636
- resolveAssetUrl(subPath: string): string;
637
- resolveAvatarAssetUrl(subPath: string): string;
638
- resolveSharedLibUrl(subPath: string): string;
639
- }
640
-
641
- declare class MockCdnApi implements CdnApi {
642
- private readonly baseUrl;
643
- constructor();
644
- fetchBlob(path: SubPath, options?: FetchBlobOptions): Promise<Blob>;
645
- getAssetCdnBaseUrl(): string;
646
- resolveAssetUrl(subPath: string): string;
647
- resolveAvatarAssetUrl(subPath: string): string;
648
- resolveSharedLibUrl(subPath: string): string;
649
- fetchFromCdn(url: string, options?: RequestInit): Promise<Response>;
650
- }
651
-
652
- declare function initializeCdn(venusApi: VenusAPI, host: Host): void;
481
+ declare class RpcSocialApi implements SocialApi {
482
+ private readonly rpcClient;
483
+ constructor(rpcClient: RpcClient);
484
+ shareLinkAsync(options: {
485
+ launchParams: Record<string, string>;
486
+ metadata?: ShareMetadata;
487
+ }): Promise<ShareLinkResult>;
488
+ createQRCodeAsync(options: {
489
+ launchParams: Record<string, string>;
490
+ metadata?: ShareMetadata;
491
+ qrOptions?: SocialQRCodeOptions;
492
+ }): Promise<QRCodeResult>;
493
+ }
494
+
495
+ declare class MockSocialApi implements SocialApi {
496
+ shareLinkAsync(options: {
497
+ launchParams: Record<string, string>;
498
+ }): Promise<ShareLinkResult>;
499
+ createQRCodeAsync(options: {
500
+ launchParams: Record<string, string>;
501
+ qrOptions?: SocialQRCodeOptions;
502
+ }): Promise<QRCodeResult>;
503
+ private createMockUrl;
504
+ }
505
+
506
+ declare function initializeSocial(venusApi: VenusAPI, host: Host): void;
653
507
 
654
508
  declare class RpcAdsApi implements AdsApi {
655
509
  private readonly rpcClient;
656
510
  constructor(rpcClient: RpcClient);
657
- showInterstitialAd(): Promise<boolean>;
511
+ showInterstitialAd(options?: ShowInterstitialAdOptions): Promise<boolean>;
658
512
  isRewardedAdReadyAsync(): Promise<boolean>;
659
- showRewardedAdAsync(): Promise<boolean>;
513
+ showRewardedAdAsync(options?: ShowRewardedAdOptions): Promise<boolean>;
660
514
  }
661
515
 
662
516
  declare class MockAdsApi implements AdsApi {
663
517
  private mockOverlay;
664
518
  constructor(mockOverlay: MockOverlay);
665
519
  isRewardedAdReadyAsync(): Promise<boolean>;
666
- showRewardedAdAsync(): Promise<boolean>;
667
- showInterstitialAd(): Promise<boolean>;
520
+ showRewardedAdAsync(options?: ShowRewardedAdOptions): Promise<boolean>;
521
+ showInterstitialAd(options?: ShowInterstitialAdOptions): Promise<boolean>;
668
522
  private log;
669
523
  }
670
524
 
671
525
  declare function initializeAds(venusApiInstance: VenusAPI, host: Host): void;
672
526
 
673
- type StorageType = 'globalStorage' | 'deviceCache' | 'appStorage';
674
- declare function createMockStorageApi(storageType: StorageType, appUrl?: string): MockStorageApi;
675
- declare class MockStorageApi implements StorageApi {
676
- private readonly prefix;
677
- private readonly syncDelay;
678
- constructor(prefix: string, syncDelay: number);
679
- clear(): Promise<void>;
680
- getAllItems(): Promise<string[]>;
681
- getItem(key: string): Promise<string | null>;
682
- key(index: number): Promise<string | null>;
683
- length(): Promise<number>;
684
- removeItem(key: string): Promise<void>;
685
- setItem(key: string, item: string): Promise<void>;
686
- setMultipleItems(entries: {
687
- key: string;
688
- value: string;
689
- }[]): Promise<void>;
690
- removeMultipleItems(keys: string[]): Promise<void>;
691
- private buildKey;
692
- private extractKey;
693
- private keys;
694
- private simulateSyncDelay;
695
- }
696
-
697
- interface MethodIds {
698
- clear: string;
699
- getItem: string;
700
- getKey: string;
701
- length: string;
702
- removeItem: string;
703
- setItem: string;
704
- getAllItems?: string;
705
- removeMultipleItems?: string;
706
- setMultipleItems?: string;
707
- }
708
- declare class RpcStorageApi implements StorageApi {
709
- private readonly rpcClient;
710
- private readonly methodIds;
711
- constructor(rpcClient: RpcClient, methodIds: MethodIds);
712
- clear(): Promise<void>;
713
- getItem(key: string): Promise<string | null>;
714
- setItem(key: string, value: string): Promise<void>;
715
- key(index: number): Promise<string | null>;
716
- length(): Promise<number>;
717
- removeItem(key: string): Promise<void>;
718
- removeMultipleItems(keys: string[]): Promise<void>;
719
- getAllItems(): Promise<string[]>;
720
- setMultipleItems(items: {
721
- key: string;
722
- value: string;
723
- }[]): Promise<void>;
724
- }
725
-
726
- declare function initializeStorage(venusApiInstance: VenusAPI, host: Host): void;
727
-
728
527
  declare const SDK_VERSION: string;
729
528
 
730
529
  declare enum VenusMessageId {
@@ -776,7 +575,8 @@ declare enum VenusMessageId {
776
575
  TOGGLE_LIKE = "H5_TOGGLE_LIKE",
777
576
  OPEN_COMMENTS = "H5_OPEN_COMMENTS",// For opening comments with callback support
778
577
  TOGGLE_FOLLOW = "H5_TOGGLE_FOLLOW",
779
- SHARE_POST = "H5_SHARE_POST",
578
+ SHARE_LINK = "H5_SHARE_LINK",
579
+ CREATE_SHARE_QRCODE = "H5_CREATE_SHARE_QRCODE",
780
580
  AI_CHAT_COMPLETION = "H5_AI_CHAT_COMPLETION",
781
581
  AI_GET_AVAILABLE_MODELS = "H5_AI_GET_AVAILABLE_MODELS",
782
582
  TRIGGER_HAPTIC = "H5_TRIGGER_HAPTIC",
@@ -788,13 +588,11 @@ declare enum VenusMessageId {
788
588
  IAP_WALLET_UPDATE = "IAP_WALLET_UPDATE",
789
589
  READY = "READY",
790
590
  INIT_SDK = "INITIALIZE_SDK",
791
- PLAY = "PLAY",
792
591
  PAUSE = "PAUSE",
793
592
  RESUME = "RESUME",
794
- SHOWN = "SHOWN",// Previously AWAKE
795
- HIDDEN = "HIDDEN",// Previously SLEEP
796
- QUIT = "QUIT",// Previously STOP
797
- CLEANUP = "CLEANUP",
593
+ AWAKE = "AWAKE",
594
+ SLEEP = "SLEEP",
595
+ QUIT = "QUIT",
798
596
  /** given the experiment name, returns the entire experiment object as configured for the current user */
799
597
  GET_EXPERIMENT = "H5_GET_EXPERIMENT",
800
598
  /** returns the boolean value for a feature flag using the statsig parameter store, or the feature flags constants as fallback */
@@ -821,6 +619,11 @@ declare enum VenusMessageId {
821
619
  H5_SIMULATION_GET_AVAILABLE_ITEMS = "H5_SIMULATION_GET_AVAILABLE_ITEMS",
822
620
  H5_SIMULATION_VALIDATE_ASSIGNMENT = "H5_SIMULATION_VALIDATE_ASSIGNMENT",
823
621
  H5_SIMULATION_BATCH_OPERATIONS = "H5_SIMULATION_BATCH_OPERATIONS",
622
+ H5_LEADERBOARD_START_RUN = "H5_LEADERBOARD_START_RUN",
623
+ H5_LEADERBOARD_SUBMIT_SCORE = "H5_LEADERBOARD_SUBMIT_SCORE",
624
+ H5_LEADERBOARD_GET = "H5_LEADERBOARD_GET",
625
+ H5_LEADERBOARD_GET_HIGHLIGHT = "H5_LEADERBOARD_GET_HIGHLIGHT",
626
+ H5_LEADERBOARD_GET_PLAYER_STATS = "H5_LEADERBOARD_GET_PLAYER_STATS",
824
627
  H5_ROOM_CREATE = "H5_ROOM_CREATE",
825
628
  H5_ROOM_JOIN = "H5_ROOM_JOIN",
826
629
  H5_ROOM_JOIN_OR_CREATE = "H5_ROOM_JOIN_OR_CREATE",
@@ -852,4 +655,50 @@ declare enum VenusMessageId {
852
655
  H5_IAP_GET_CURRENCY_ICON = "H5_IAP_GET_CURRENCY_ICON"
853
656
  }
854
657
 
855
- export { ActionSheetItem, AdsApi, AiApi, AiChatCompletionData, AiChatCompletionRequest, AnalyticsApi, AssetManifest, Avatar3dApi, Avatar3dConfig, Avatar3dEdits, CdnApi, type CollectRecipeResult, type CreateRoomOptions, type ExecuteRecipeOptions, type ExecuteScopedRecipeOptions, type ExecuteScopedRecipeResult, type Experiment, type FeaturesApi, FetchBlobOptions, type GetActiveRunsOptions, type GetAvailableRecipesOptions, type GetAvailableRecipesResult, type GetBatchRecipeRequirements, type GetFutureTimeOptions, HapticFeedbackStyle, HapticsApi, HostCdnApi, HostProfileApi, HostTimeApi, IapApi, type JoinOrCreateResult, LifecycleApi, LoadEmbeddedAssetsResponse, type LoggingApi, type MethodIds, MockAdsApi, MockAiApi, MockAnalyticsApi, MockCdnApi, MockFeaturesApi, MockHapticsApi, MockIapApi, MockLifecycleApi, MockLoggingApi, MockNavigationApi, MockNotificationsApi, MockPopupsApi, MockPreloaderApi, MockProfileApi, MockSharedAssetsApi, MockSimulationApi, MockStorageApi, MockTimeApi, NavigationApi, NavigationStackInfo, type NotificationContent, NotificationsApi, OnCleanupCallback, OnHideCallback, OnPauseCallback, OnPlayCallback, OnQuitCallback, OnResumeCallback, OnShowCallback, PlayContext, PopupsApi, PreloaderApi, type ProfileApi, type ProposeMovePayload, type ProposeMoveResult, PushAppOptions, QuitOptions, type Recipe, type RecipeInfo, type RoomSubscriptionOptions, type RoomsApi, RpcAdsApi, RpcAiApi, RpcAnalyticsApi, RpcAvatarApi, RpcClient, RpcFeaturesApi, RpcHapticsApi, RpcIapApi, RpcLifecycleApi, RpcLoggingApi, type RpcMessage, RpcNavigationApi, RpcNotification, RpcNotificationsApi, RpcPopupsApi, RpcPreloaderApi, RpcRequest, RpcResponse, RpcSimulationApi, RpcStorageApi, SDK_VERSION, ScheduleLocalNotification, ScheduleNotificationOptions, type ServerTimeData, SharedAssetsApi, ShowActionSheetOptions, ShowAlertOptions, ShowConfirmOptions, ShowContext, ShowEditorOptions, ShowToastOptions, type ShowToastResponse, type SimulationApi, SpendCurrencyOptions, type StorageApi, type StorageType, SubPath, Subscription, type TimeApi, type TriggerRecipeChainOptions, type ValidateMoveResult, VenusMessageId, VenusRoom, createMockStorageApi, initializeAds, initializeAi, initializeAnalytics, initializeAvatar3d, initializeCdn, initializeFeaturesApi, initializeHaptics, initializeIap, initializeLifecycleApi, initializeLocalNotifications, initializeLoggingApi, initializePopups, initializePreloader, initializeProfile, initializeRoomsApi, initializeSimulation, initializeStackNavigation, initializeStorage, initializeTime, isPacificDaylightTime, setupRoomNotifications };
658
+ declare class RemoteHost implements Host {
659
+ readonly ads: AdsApi;
660
+ readonly analytics: AnalyticsApi;
661
+ readonly deviceCache: StorageApi;
662
+ readonly appStorage: StorageApi;
663
+ readonly globalStorage: StorageApi;
664
+ readonly avatar3d: Avatar3dApi;
665
+ readonly navigation: NavigationApi;
666
+ readonly notifications: NotificationsApi;
667
+ readonly popups: PopupsApi;
668
+ readonly profile: ProfileApi;
669
+ readonly cdn: CdnApi;
670
+ readonly time: TimeApi;
671
+ readonly post: PostApi;
672
+ readonly ai: AiApi;
673
+ readonly haptics: HapticsApi;
674
+ readonly features: FeaturesApi;
675
+ readonly lifecycle: LifecycleApi;
676
+ readonly simulation: SimulationApi;
677
+ readonly rooms: RoomsApi;
678
+ readonly logging: LoggingApi;
679
+ readonly iap: IapApi;
680
+ readonly leaderboard: LeaderboardApi;
681
+ readonly preloader: PreloaderApi;
682
+ readonly social: SocialApi;
683
+ get isInitialized(): boolean;
684
+ private readonly venusApi;
685
+ private readonly rpcClient;
686
+ private _isInitialized;
687
+ constructor(venusApi: VenusAPI);
688
+ initialize(options?: InitializationOptions): Promise<InitializationContext>;
689
+ private log;
690
+ }
691
+ interface InitResponse {
692
+ initializeAsleep: boolean;
693
+ instanceId: string;
694
+ profile?: {
695
+ id: string;
696
+ username: string;
697
+ avatarUrl?: string | null;
698
+ isAnonymous?: boolean;
699
+ };
700
+ hudInsets?: HudInsets;
701
+ launchParams?: Record<string, string>;
702
+ }
703
+
704
+ export { ActionSheetItem, AdsApi, AiApi, AiChatCompletionData, AiChatCompletionRequest, AnalyticsApi, AssetManifest, Avatar3dApi, Avatar3dConfig, Avatar3dEdits, AwakeCallback, CdnApi, CollectRecipeResult, ExecuteRecipeOptions, ExecuteScopedRecipeResult, Experiment, FeaturesApi, FetchBlobOptions, GetActiveRunsOptions, GetAvailableRecipesOptions, GetAvailableRecipesResult, GetBatchRecipeRequirements, GetFutureTimeOptions, GetLeaderboardOptions, HapticFeedbackStyle, HapticsApi, Host, HostCdnApi, HostProfileApi, HostTimeApi, HudInsets, IapApi, type InitResponse, InitializationContext, InitializationOptions, LeaderboardApi, LeaderboardHighlightOptions, LeaderboardHighlightResponse, LeaderboardResponse, LifecycleApi, LoadEmbeddedAssetsResponse, LoggingApi, type MethodIds, MockAdsApi, MockAiApi, MockAnalyticsApi, MockCdnApi, MockFeaturesApi, MockHapticsApi, MockIapApi, MockLeaderboardApi, MockLifecycleApi, MockLoggingApi, MockNavigationApi, MockNotificationsApi, MockPopupsApi, MockPreloaderApi, MockProfileApi, MockSharedAssetsApi, MockSimulationApi, MockSocialApi, MockStorageApi, MockTimeApi, NavigationApi, NavigationStackInfo, type NotificationContent, NotificationsApi, PauseCallback, PlayerStats, PlayerStatsOptions, PopupsApi, PreloaderApi, ProfileApi, PushAppOptions, QRCodeResult, QuitCallback, QuitOptions, Recipe, RemoteHost, ResumeCallback, RoomsApi, RpcAdsApi, RpcAiApi, RpcAnalyticsApi, RpcAvatarApi, RpcClient, RpcFeaturesApi, RpcHapticsApi, RpcIapApi, RpcLeaderboardApi, RpcLifecycleApi, RpcLoggingApi, type RpcMessage, RpcNavigationApi, RpcNotification, RpcNotificationsApi, RpcPopupsApi, RpcPreloaderApi, RpcRequest, RpcResponse, RpcSimulationApi, RpcSocialApi, RpcStorageApi, SDK_VERSION, ScheduleLocalNotification, ScheduleNotificationOptions, ServerTimeData, ShareLinkResult, ShareMetadata, SharedAssetsApi, ShowActionSheetOptions, ShowAlertOptions, ShowConfirmOptions, ShowEditorOptions, ShowInterstitialAdOptions, ShowRewardedAdOptions, ShowToastOptions, type ShowToastResponse, SimulationApi, SleepCallback, SocialApi, SocialQRCodeOptions, SpendCurrencyOptions, StartRunResult, StorageApi, type StorageType, SubPath, SubmitScoreOptions, SubmitScoreResult, Subscription, TimeApi, TriggerRecipeChainOptions, VenusMessageId, createMockStorageApi, initializeAds, initializeAi, initializeAnalytics, initializeAvatar3d, initializeCdn, initializeFeaturesApi, initializeHaptics, initializeIap, initializeLeaderboard, initializeLifecycleApi, initializeLocalNotifications, initializeLoggingApi, initializePopups, initializePreloader, initializeProfile, initializeRoomsApi, initializeSimulation, initializeSocial, initializeStackNavigation, initializeStorage, initializeTime, isPacificDaylightTime, setupRoomNotifications };