@series-inc/venus-sdk 3.1.2 → 3.2.1-beta.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/{AdsApi-CNGRf6j0.d.mts → AdsApi-or6zfdzM.d.mts} +499 -293
- package/dist/{AdsApi-CNGRf6j0.d.ts → AdsApi-or6zfdzM.d.ts} +499 -293
- package/dist/chunk-NSSMTXJJ.mjs +7 -0
- package/dist/chunk-NSSMTXJJ.mjs.map +1 -0
- package/dist/{chunk-W7IPHM67.mjs → chunk-QABXMFND.mjs} +3 -26
- package/dist/chunk-QABXMFND.mjs.map +1 -0
- package/dist/chunk-UXY5CKKG.mjs +12 -0
- package/dist/chunk-UXY5CKKG.mjs.map +1 -0
- package/dist/{chunk-PXWCNWJ6.mjs → chunk-YOBDYPKZ.mjs} +1528 -1577
- package/dist/chunk-YOBDYPKZ.mjs.map +1 -0
- package/dist/core-62LWDHN7.mjs +4 -0
- package/dist/{core-R3FHW62G.mjs.map → core-62LWDHN7.mjs.map} +1 -1
- package/dist/index.cjs +1556 -1585
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +290 -92
- package/dist/index.d.ts +290 -92
- package/dist/index.mjs +4 -6
- package/dist/index.mjs.map +1 -1
- package/dist/venus-api/index.cjs +1613 -2008
- package/dist/venus-api/index.cjs.map +1 -1
- package/dist/venus-api/index.d.mts +2 -2
- package/dist/venus-api/index.d.ts +2 -2
- package/dist/venus-api/index.mjs +92 -391
- package/dist/venus-api/index.mjs.map +1 -1
- package/dist/vite/index.cjs +534 -0
- package/dist/vite/index.cjs.map +1 -0
- package/dist/vite/index.mjs +527 -0
- package/dist/vite/index.mjs.map +1 -0
- package/dist/webview/index.cjs +15 -0
- package/dist/webview/index.cjs.map +1 -0
- package/dist/webview/index.d.mts +15 -0
- package/dist/webview/index.d.ts +15 -0
- package/dist/webview/index.mjs +4 -0
- package/dist/webview/index.mjs.map +1 -0
- package/package.json +1 -1
- package/dist/chunk-PXWCNWJ6.mjs.map +0 -1
- package/dist/chunk-W7IPHM67.mjs.map +0 -1
- package/dist/core-R3FHW62G.mjs +0 -3
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export {
|
|
1
|
+
import { r as AnalyticsApi, s as RpcRequest, t as RpcResponse, u as RpcNotification, v as RpcClient, V as VenusAPI, 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 ActionSheetItem, G as ShowActionSheetOptions, I as ShowAlertOptions, J as ShowConfirmOptions, K as ShowToastOptions, L as ShowInterstitialAdOptions, M as ShowRewardedAdOptions, O as ProfileApi, P as Profile, T as DeviceApi, U as DeviceInfo, W as EnvironmentApi, X as EnvironmentInfo, Y as SystemApi, Z as SafeArea, _ as CdnApi, $ as SubPath, a0 as FetchBlobOptions, a1 as TimeApi, a2 as ServerTimeData, a3 as GetFutureTimeOptions, a4 as AiApi, a5 as AiChatCompletionRequest, a6 as AiChatCompletionData, a7 as HapticsApi, a8 as HapticFeedbackStyle, a9 as FeaturesApi, aa as Experiment, ab as LifecycleApi, ac as SleepCallback, ad as Subscription, ae as AwakeCallback, af as PauseCallback, ag as ResumeCallback, ah as QuitCallback, ai as SimulationApi, aj as SimulationSlotValidationResult, g as SimulationSubscribeOptions, ak as SimulationBatchOperation, al as SimulationBatchOperationsResult, am as SimulationAvailableItem, an as SimulationPowerPreview, ao as SimulationSlotMutationResult, ap as SimulationSlotContainer, aq as SimulationAssignment, ar as SimulationState, j as VenusSimulationConfig, as as ExecuteRecipeOptions, at as ExecuteRecipeResponse, au as CollectRecipeResult, av as GetActiveRunsOptions, S as SimulationRunSummary, aw as ExecuteScopedRecipeOptions, ax as ExecuteScopedRecipeResult, ay as GetAvailableRecipesOptions, az as GetAvailableRecipesResult, aA as Recipe, R as RecipeRequirementResult, aB as GetBatchRecipeRequirements, aC as TriggerRecipeChainOptions, aD as RoomDataUpdate, aE as RoomMessageEvent, aF as ProposedMoveEvent, aG as VenusTransport, aH as RoomsApi, aI as CreateRoomOptions, q as VenusRoom, aJ as JoinOrCreateRoomOptions, aK as JoinOrCreateResult, aL as ListRoomsOptions, aM as UpdateRoomDataOptions, aN as RoomMessageRequest, aO as StartRoomGameOptions, aP as ProposeMoveRequest, aQ as ProposeMoveResult, aR as ValidateMoveVerdict, aS as ValidateMoveResult, aT as RoomSubscriptionOptions, aU as LoggingApi, aV as IapApi, aW as SpendCurrencyOptions, aX as LoadEmbeddedAssetsResponse, aY as SharedAssetsApi, aZ as LeaderboardApi, a_ as ScoreToken, a$ as SubmitScoreParams, b0 as SubmitScoreResult, b1 as GetPagedScoresOptions, b2 as PagedScoresResponse, b3 as PlayerRankOptions, b4 as PlayerRankResult, b5 as GetPodiumScoresOptions, b6 as PodiumScoresResponse, b7 as PreloaderApi, b8 as SocialApi, b9 as ShareMetadata, ba as ShareLinkResult, bb as SocialQRCodeOptions, bc as QRCodeResult, bd as Avatar3dApi, be as AssetManifest, bf as Avatar3dConfig, bg as ShowEditorOptions, bh as Avatar3dEdits, bi as AdsApi, bj as InitializationOptions, bk as InitializationContext } from './AdsApi-or6zfdzM.mjs';
|
|
2
|
+
export { bl as AiMessage, bm as Asset, bn as Category, bP as HudInsets, bv as JoinRoomMatchCriteria, bK as LeaderboardAntiCheatConfig, bM as LeaderboardConfig, bL as LeaderboardDisplaySettings, bN as LeaderboardEntry, bH as LeaderboardModeConfig, bJ as LeaderboardPeriodConfig, bI as LeaderboardPeriodType, bG as LoadEmbeddedAssetsRequest, bo as MockAvatarApi, bq as NotificationTriggerInput, bt as OnNotificationCallback, br as OnRequestCallback, bs as OnResponseCallback, bO as PodiumScoresContext, by as RecipeInfo, bw as RoomMessageEventType, bF as RpcSharedAssetsApi, bu as RpcTransport, bC as SimulationBatchOperationAssign, bD as SimulationBatchOperationRemove, bE as SimulationBatchOperationResult, bz as SimulationPersonalState, bA as SimulationRoomActiveRecipe, bB as SimulationRoomState, bp as TimeIntervalTriggerInput, bx as VenusRoomPayload, bQ as createHost } from './AdsApi-or6zfdzM.mjs';
|
|
3
|
+
export { WEBVIEW_LIBRARY_SHIM_SOURCE, getWebviewLibraryShimSource } from './webview/index.mjs';
|
|
3
4
|
|
|
4
5
|
declare class MockAnalyticsApi implements AnalyticsApi {
|
|
5
6
|
recordCustomEvent(eventName: string, payload: Record<string, any>): Promise<void>;
|
|
@@ -22,6 +23,7 @@ declare function createMockStorageApi(storageType: StorageType, appUrl?: string)
|
|
|
22
23
|
declare class MockStorageApi implements StorageApi {
|
|
23
24
|
private readonly prefix;
|
|
24
25
|
private readonly syncDelay;
|
|
26
|
+
private readonly orderStorageKey;
|
|
25
27
|
constructor(prefix: string, syncDelay: number);
|
|
26
28
|
clear(): Promise<void>;
|
|
27
29
|
getAllItems(): Promise<string[]>;
|
|
@@ -39,6 +41,16 @@ declare class MockStorageApi implements StorageApi {
|
|
|
39
41
|
private extractKey;
|
|
40
42
|
private keys;
|
|
41
43
|
private simulateSyncDelay;
|
|
44
|
+
private readOrder;
|
|
45
|
+
private normalizeOrder;
|
|
46
|
+
private rebuildOrderFromStorage;
|
|
47
|
+
private upsertOrder;
|
|
48
|
+
private bulkUpsertOrder;
|
|
49
|
+
private removeFromOrder;
|
|
50
|
+
private bulkRemoveFromOrder;
|
|
51
|
+
private writeOrder;
|
|
52
|
+
private clearOrder;
|
|
53
|
+
private dedupeKeys;
|
|
42
54
|
}
|
|
43
55
|
|
|
44
56
|
interface MethodIds {
|
|
@@ -160,15 +172,77 @@ declare class MockPopupsApi implements PopupsApi {
|
|
|
160
172
|
declare function initializePopups(venusApi: VenusAPI, host: Host): void;
|
|
161
173
|
|
|
162
174
|
declare class HostProfileApi implements ProfileApi {
|
|
175
|
+
private readonly venusApi;
|
|
176
|
+
constructor(venusApi: VenusAPI);
|
|
163
177
|
getCurrentProfile(): Profile;
|
|
164
178
|
}
|
|
165
179
|
|
|
166
180
|
declare class MockProfileApi implements ProfileApi {
|
|
181
|
+
private readonly venusApi;
|
|
182
|
+
constructor(venusApi: VenusAPI);
|
|
167
183
|
getCurrentProfile(): Profile;
|
|
168
184
|
}
|
|
169
185
|
|
|
170
186
|
declare function initializeProfile(venusApi: VenusAPI, host: Host): void;
|
|
171
187
|
|
|
188
|
+
declare class HostDeviceApi implements DeviceApi {
|
|
189
|
+
private readonly venusApi;
|
|
190
|
+
constructor(venusApi: VenusAPI);
|
|
191
|
+
getDevice(): DeviceInfo;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
declare class MockDeviceApi implements DeviceApi {
|
|
195
|
+
private readonly venusApi;
|
|
196
|
+
constructor(venusApi: VenusAPI);
|
|
197
|
+
getDevice(): DeviceInfo;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
declare class HostEnvironmentApi implements EnvironmentApi {
|
|
201
|
+
private readonly venusApi;
|
|
202
|
+
constructor(venusApi: VenusAPI);
|
|
203
|
+
getEnvironment(): EnvironmentInfo;
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
declare class MockEnvironmentApi implements EnvironmentApi {
|
|
207
|
+
private readonly venusApi;
|
|
208
|
+
constructor(venusApi: VenusAPI);
|
|
209
|
+
getEnvironment(): EnvironmentInfo;
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
/**
|
|
213
|
+
* Host implementation of SystemApi that delegates to device and environment APIs.
|
|
214
|
+
* Acts as a facade combining both system-level information sources.
|
|
215
|
+
*/
|
|
216
|
+
declare class HostSystemApi implements SystemApi {
|
|
217
|
+
private readonly deviceApi;
|
|
218
|
+
private readonly environmentApi;
|
|
219
|
+
private readonly venusApi;
|
|
220
|
+
constructor(deviceApi: DeviceApi, environmentApi: EnvironmentApi, venusApi: VenusAPI);
|
|
221
|
+
getDevice(): DeviceInfo;
|
|
222
|
+
getEnvironment(): EnvironmentInfo;
|
|
223
|
+
getSafeArea(): SafeArea;
|
|
224
|
+
isMobile(): boolean;
|
|
225
|
+
isWeb(): boolean;
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
/**
|
|
229
|
+
* Mock implementation of SystemApi for local development.
|
|
230
|
+
* Delegates to mock device and environment APIs.
|
|
231
|
+
*/
|
|
232
|
+
declare class MockSystemApi implements SystemApi {
|
|
233
|
+
private readonly deviceApi;
|
|
234
|
+
private readonly environmentApi;
|
|
235
|
+
private readonly venusApi;
|
|
236
|
+
constructor(deviceApi: DeviceApi, environmentApi: EnvironmentApi, venusApi: VenusAPI);
|
|
237
|
+
getDevice(): DeviceInfo;
|
|
238
|
+
getEnvironment(): EnvironmentInfo;
|
|
239
|
+
getSafeArea(): SafeArea;
|
|
240
|
+
isMobile(): boolean;
|
|
241
|
+
isWeb(): boolean;
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
declare function initializeSystem(venusApi: VenusAPI, host: Host): void;
|
|
245
|
+
|
|
172
246
|
declare class HostCdnApi implements CdnApi {
|
|
173
247
|
private readonly baseUrl;
|
|
174
248
|
constructor(baseUrl: string);
|
|
@@ -181,8 +255,10 @@ declare class HostCdnApi implements CdnApi {
|
|
|
181
255
|
}
|
|
182
256
|
|
|
183
257
|
declare class MockCdnApi implements CdnApi {
|
|
184
|
-
private readonly
|
|
185
|
-
constructor();
|
|
258
|
+
private readonly venusApi;
|
|
259
|
+
constructor(venusApi: VenusAPI);
|
|
260
|
+
private get baseUrl();
|
|
261
|
+
private get forceRemoteCdn();
|
|
186
262
|
fetchBlob(path: SubPath, options?: FetchBlobOptions): Promise<Blob>;
|
|
187
263
|
getAssetCdnBaseUrl(): string;
|
|
188
264
|
resolveAssetUrl(subPath: string): string;
|
|
@@ -195,7 +271,8 @@ declare function initializeCdn(venusApi: VenusAPI, host: Host): void;
|
|
|
195
271
|
|
|
196
272
|
declare class HostTimeApi implements TimeApi {
|
|
197
273
|
private readonly rpcClient;
|
|
198
|
-
|
|
274
|
+
private readonly venusApi;
|
|
275
|
+
constructor(rpcClient: RpcClient, venusApi: VenusAPI);
|
|
199
276
|
requestTimeAsync(): Promise<ServerTimeData>;
|
|
200
277
|
formatTime(timestamp: number, options?: any): string;
|
|
201
278
|
formatNumber(value: number, options?: Intl.NumberFormatOptions): string;
|
|
@@ -211,7 +288,6 @@ declare class MockTimeApi implements TimeApi {
|
|
|
211
288
|
formatTime(timestamp: number, options?: any): string;
|
|
212
289
|
getFutureTimeAsync(options?: GetFutureTimeOptions): Promise<number>;
|
|
213
290
|
requestTimeAsync(): Promise<ServerTimeData>;
|
|
214
|
-
private getLocale;
|
|
215
291
|
}
|
|
216
292
|
|
|
217
293
|
declare function initializeTime(venusApi: VenusAPI, host: Host): void;
|
|
@@ -293,69 +369,41 @@ declare function initializeLifecycleApi(venusApi: VenusAPI, host: Host): void;
|
|
|
293
369
|
declare class RpcSimulationApi implements SimulationApi {
|
|
294
370
|
private readonly rpcClient;
|
|
295
371
|
private _simulationConfig;
|
|
372
|
+
private readonly subscriptionCallbacks;
|
|
296
373
|
constructor(rpcClient: RpcClient);
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
374
|
+
isEnabled(): boolean;
|
|
375
|
+
validateSlotAssignmentAsync(containerId: string, slotId: string, itemId: string): Promise<SimulationSlotValidationResult>;
|
|
376
|
+
subscribeAsync(options: SimulationSubscribeOptions): Promise<() => void>;
|
|
377
|
+
executeBatchOperationsAsync(operations: Array<SimulationBatchOperation>, validateOnly?: boolean): Promise<SimulationBatchOperationsResult>;
|
|
378
|
+
getAvailableItemsAsync(containerId: string, slotId: string): Promise<SimulationAvailableItem[]>;
|
|
379
|
+
calculatePowerPreviewAsync(containerId: string, slotId: string, candidateItemId: string): Promise<SimulationPowerPreview>;
|
|
380
|
+
assignItemToSlotAsync(containerId: string, slotId: string, itemId: string): Promise<SimulationSlotMutationResult>;
|
|
381
|
+
removeItemFromSlotAsync(containerId: string, slotId: string): Promise<SimulationSlotMutationResult>;
|
|
382
|
+
getSlotContainersAsync(): Promise<SimulationSlotContainer[]>;
|
|
383
|
+
getSlotAssignmentsAsync(containerId: string): Promise<SimulationAssignment[]>;
|
|
384
|
+
getStateAsync(roomId?: string): Promise<SimulationState>;
|
|
307
385
|
getConfigAsync(roomId?: string): Promise<VenusSimulationConfig>;
|
|
308
|
-
executeRecipeAsync(recipeId: string, inputs?:
|
|
386
|
+
executeRecipeAsync(recipeId: string, inputs?: Record<string, unknown>, options?: ExecuteRecipeOptions): Promise<ExecuteRecipeResponse>;
|
|
309
387
|
collectRecipeAsync(runId: string): Promise<CollectRecipeResult>;
|
|
310
|
-
getActiveRunsAsync(options?: GetActiveRunsOptions): Promise<
|
|
311
|
-
executeScopedRecipeAsync(recipeId: string, entity: string, inputs?:
|
|
388
|
+
getActiveRunsAsync(options?: GetActiveRunsOptions): Promise<SimulationRunSummary[]>;
|
|
389
|
+
executeScopedRecipeAsync(recipeId: string, entity: string, inputs?: Record<string, unknown>, options?: ExecuteScopedRecipeOptions): Promise<ExecuteScopedRecipeResult>;
|
|
312
390
|
getAvailableRecipesAsync(options?: GetAvailableRecipesOptions): Promise<GetAvailableRecipesResult>;
|
|
313
|
-
getRecipeRequirementsAsync(recipe: Recipe): Promise<any>;
|
|
314
|
-
getBatchRecipeRequirementsAsync(recipes: Recipe[]): Promise<GetBatchRecipeRequirements>;
|
|
315
|
-
triggerRecipeChainAsync(recipeId: string, options?: TriggerRecipeChainOptions): Promise<any>;
|
|
316
|
-
getEntityMetadataAsync(entityId: string): Promise<any>;
|
|
317
|
-
resolveFieldValueAsync(entityId: string, fieldPath: string, entity?: string): Promise<any>;
|
|
318
|
-
}
|
|
319
|
-
|
|
320
|
-
declare class MockSimulationApi implements SimulationApi {
|
|
321
|
-
private readonly mockSimulationConfigs;
|
|
322
|
-
private readonly mockSimulationStates;
|
|
323
|
-
private readonly mockActiveTimers;
|
|
324
|
-
private readonly appId;
|
|
325
|
-
private readonly providedSimulationConfig;
|
|
326
|
-
constructor(simulationConfig?: VenusSimulationConfig | null);
|
|
327
|
-
sumContributions(contributions: Record<string, any>): Record<string, number>;
|
|
328
|
-
validateSlotAssignmentAsync(containerId: string, slotId: string, itemId: string): Promise<any>;
|
|
329
|
-
executeBatchOperationsAsync(operations: Array<any>, validateOnly?: boolean): Promise<any>;
|
|
330
|
-
getAvailableItemsAsync(containerId: string, slotId: string): Promise<Array<any>>;
|
|
331
|
-
calculatePowerPreviewAsync(containerId: string, slotId: string, candidateItemId: string): Promise<any>;
|
|
332
|
-
getSlotContainersAsync(): Promise<any>;
|
|
333
|
-
getSlotAssignmentsAsync(containerId: string): Promise<any>;
|
|
334
|
-
resolveFieldValueAsync(entityId: string, fieldPath: string, entity?: string): Promise<any>;
|
|
335
|
-
getEntityMetadataAsync(entityId: string): Promise<any>;
|
|
336
|
-
collectRecipeAsync(runId: string): Promise<CollectRecipeResult>;
|
|
337
|
-
executeRecipeAsync(recipeId: string, inputs?: any, options?: ExecuteRecipeOptions): Promise<any>;
|
|
338
|
-
executeScopedRecipeAsync(recipeId: string, entity: string, inputs?: any, options?: any): Promise<ExecuteScopedRecipeResult>;
|
|
339
|
-
getActiveRunsAsync(options?: GetActiveRunsOptions): Promise<any>;
|
|
340
|
-
getAvailableRecipesAsync(options?: GetAvailableRecipesOptions): Promise<GetAvailableRecipesResult>;
|
|
341
|
-
getBatchRecipeRequirementsAsync(recipes: Recipe[]): Promise<GetBatchRecipeRequirements>;
|
|
342
391
|
getRecipeRequirementsAsync(recipe: Recipe): Promise<RecipeRequirementResult>;
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
private
|
|
348
|
-
private
|
|
349
|
-
private createSeededRandom;
|
|
350
|
-
private applyEffects;
|
|
351
|
-
getConfigAsync(): Promise<any>;
|
|
352
|
-
getStateAsync(roomId?: string): Promise<any>;
|
|
353
|
-
assignItemToSlotAsync(containerId: string, slotId: string, itemId: string): Promise<any>;
|
|
354
|
-
removeItemFromSlotAsync(containerId: string, slotId: string): Promise<any>;
|
|
392
|
+
getBatchRecipeRequirementsAsync(recipes: Recipe[]): Promise<GetBatchRecipeRequirements>;
|
|
393
|
+
triggerRecipeChainAsync(recipeId: string, options?: TriggerRecipeChainOptions): Promise<ExecuteRecipeResponse>;
|
|
394
|
+
getEntityMetadataAsync(entityId: string): Promise<Record<string, unknown>>;
|
|
395
|
+
resolveFieldValueAsync(entityId: string, fieldPath: string, entity?: string): Promise<unknown>;
|
|
396
|
+
private handleSimulationUpdate;
|
|
397
|
+
private ensureValidSubscribeOptions;
|
|
355
398
|
}
|
|
356
399
|
|
|
357
400
|
declare function initializeSimulation(venusApi: VenusAPI, host: Host): void;
|
|
358
401
|
|
|
402
|
+
interface RoomNotificationSubscriptionState {
|
|
403
|
+
data: Record<string, Array<(event: RoomDataUpdate) => void>>;
|
|
404
|
+
messages: Record<string, Array<(event: RoomMessageEvent) => void>>;
|
|
405
|
+
gameEvents: Record<string, Array<(event: ProposedMoveEvent) => void>>;
|
|
406
|
+
}
|
|
359
407
|
/**
|
|
360
408
|
* Set up room notification listeners using the transport's onVenusMessage hook.
|
|
361
409
|
* This routes host-sent room notifications (H5_ROOM_DATA_UPDATED, etc.) to the
|
|
@@ -363,7 +411,34 @@ declare function initializeSimulation(venusApi: VenusAPI, host: Host): void;
|
|
|
363
411
|
* @param transport The Venus transport to listen for messages
|
|
364
412
|
* @param getSubscriptions Function to retrieve subscription state from RoomsApi
|
|
365
413
|
*/
|
|
366
|
-
declare function setupRoomNotifications(transport: VenusTransport, getSubscriptions: () =>
|
|
414
|
+
declare function setupRoomNotifications(transport: VenusTransport, getSubscriptions: () => RoomNotificationSubscriptionState): Subscription;
|
|
415
|
+
|
|
416
|
+
declare class RpcRoomsApi implements RoomsApi {
|
|
417
|
+
private readonly rpcClient;
|
|
418
|
+
private readonly subscriptions;
|
|
419
|
+
constructor(rpcClient: RpcClient);
|
|
420
|
+
/**
|
|
421
|
+
* Get the subscription state for external access (used by setupRoomNotifications)
|
|
422
|
+
*/
|
|
423
|
+
getSubscriptions(): RoomNotificationSubscriptionState;
|
|
424
|
+
/**
|
|
425
|
+
* Set up room notification routing from the transport
|
|
426
|
+
*/
|
|
427
|
+
setupNotifications(transport: VenusTransport): void;
|
|
428
|
+
createRoomAsync(options: CreateRoomOptions): Promise<VenusRoom>;
|
|
429
|
+
joinOrCreateRoomAsync(options: JoinOrCreateRoomOptions): Promise<JoinOrCreateResult>;
|
|
430
|
+
joinRoomByCodeAsync(roomCode: string): Promise<VenusRoom>;
|
|
431
|
+
getUserRoomsAsync(options?: ListRoomsOptions): Promise<VenusRoom[]>;
|
|
432
|
+
updateRoomDataAsync(room: VenusRoom, updates: Record<string, unknown>, options?: UpdateRoomDataOptions): Promise<void>;
|
|
433
|
+
getRoomDataAsync(room: VenusRoom): Promise<Record<string, unknown>>;
|
|
434
|
+
sendRoomMessageAsync(venusRoom: VenusRoom, request: RoomMessageRequest): Promise<string>;
|
|
435
|
+
leaveRoomAsync(room: VenusRoom): Promise<void>;
|
|
436
|
+
startRoomGameAsync(room: VenusRoom, options?: StartRoomGameOptions): Promise<void>;
|
|
437
|
+
proposeMoveAsync(room: VenusRoom, proposalPayload: ProposeMoveRequest): Promise<ProposeMoveResult>;
|
|
438
|
+
validateMoveAsync(_room: VenusRoom, moveId: string, verdict: ValidateMoveVerdict): Promise<ValidateMoveResult>;
|
|
439
|
+
subscribeAsync(room: VenusRoom, options?: RoomSubscriptionOptions): Promise<() => void>;
|
|
440
|
+
}
|
|
441
|
+
|
|
367
442
|
declare function initializeRoomsApi(venusApi: VenusAPI, host: Host): void;
|
|
368
443
|
|
|
369
444
|
declare class MockLoggingApi implements LoggingApi {
|
|
@@ -395,9 +470,60 @@ declare class RpcIapApi implements IapApi {
|
|
|
395
470
|
declare class MockSharedAssetsApi implements SharedAssetsApi {
|
|
396
471
|
private readonly venusApi;
|
|
397
472
|
constructor(venusApi: VenusAPI);
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
473
|
+
loadAssetsBundle(game: string, bundleKey: string, fileType?: string): Promise<ArrayBuffer>;
|
|
474
|
+
}
|
|
475
|
+
|
|
476
|
+
type ModuleSpecifierMatch = 'exact' | 'prefix';
|
|
477
|
+
interface ModuleSpecifierConfig {
|
|
478
|
+
match: ModuleSpecifierMatch;
|
|
479
|
+
value: string;
|
|
480
|
+
behavior?: 'default' | 'react-jsx-runtime' | 'react-jsx-dev-runtime' | 'namespace';
|
|
481
|
+
}
|
|
482
|
+
interface EmbeddedLibraryDefinition {
|
|
483
|
+
libraryKey: string;
|
|
484
|
+
assetKey: string;
|
|
485
|
+
packageName: string;
|
|
486
|
+
version: string;
|
|
487
|
+
globalVar: string;
|
|
488
|
+
cdnPath: string;
|
|
489
|
+
moduleSpecifiers: ModuleSpecifierConfig[];
|
|
490
|
+
loadStage: number;
|
|
491
|
+
enabled: boolean;
|
|
492
|
+
}
|
|
493
|
+
declare const DEFAULT_SHARED_LIB_CDN_BASE = "https://venus-static-01293ak.web.app/libs";
|
|
494
|
+
declare const EMBEDDED_LIBRARIES: EmbeddedLibraryDefinition[];
|
|
495
|
+
declare const EMBEDDED_LIBRARY_BY_KEY: Record<string, EmbeddedLibraryDefinition>;
|
|
496
|
+
declare const MODULE_TO_LIBRARY_SPECIFIERS: {
|
|
497
|
+
libraryKey: string;
|
|
498
|
+
match: ModuleSpecifierMatch;
|
|
499
|
+
value: string;
|
|
500
|
+
behavior?: "default" | "react-jsx-runtime" | "react-jsx-dev-runtime" | "namespace";
|
|
501
|
+
}[];
|
|
502
|
+
/**
|
|
503
|
+
* Get library definition by key, throwing if not found.
|
|
504
|
+
* @param libraryKey - Library key (e.g., 'phaser@3.90.0')
|
|
505
|
+
* @returns Library definition
|
|
506
|
+
* @throws Error if library key is not found
|
|
507
|
+
*/
|
|
508
|
+
declare function getLibraryDefinition(libraryKey: string): EmbeddedLibraryDefinition;
|
|
509
|
+
|
|
510
|
+
/**
|
|
511
|
+
* Base64 encoding/decoding utilities for embedded assets and libraries.
|
|
512
|
+
*
|
|
513
|
+
* These utilities handle base64 data received from the Venus host via RPC,
|
|
514
|
+
* converting it to ArrayBuffer or UTF-8 strings with appropriate fallbacks
|
|
515
|
+
* for different JavaScript environments.
|
|
516
|
+
*/
|
|
517
|
+
/**
|
|
518
|
+
* Convert base64 string to ArrayBuffer.
|
|
519
|
+
* Uses native atob() when available for best performance.
|
|
520
|
+
*/
|
|
521
|
+
declare function base64ToArrayBuffer(base64: string): ArrayBuffer;
|
|
522
|
+
/**
|
|
523
|
+
* Convert base64 string to UTF-8 string.
|
|
524
|
+
* Tries multiple decoding strategies for maximum compatibility.
|
|
525
|
+
*/
|
|
526
|
+
declare function base64ToUtf8(base64: string): string;
|
|
401
527
|
|
|
402
528
|
declare class MockIapApi implements IapApi {
|
|
403
529
|
private _hardCurrency;
|
|
@@ -413,35 +539,96 @@ declare function initializeIap(venusApiInstance: VenusAPI, host: Host): void;
|
|
|
413
539
|
|
|
414
540
|
declare class RpcLeaderboardApi implements LeaderboardApi {
|
|
415
541
|
private readonly rpcClient;
|
|
542
|
+
/** Cache of score tokens for automatic hash computation */
|
|
543
|
+
private tokenCache;
|
|
416
544
|
constructor(rpcClient: RpcClient);
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
545
|
+
/**
|
|
546
|
+
* Create a score token for submitting a score.
|
|
547
|
+
* Token is cached for automatic hash computation if score sealing is enabled.
|
|
548
|
+
*
|
|
549
|
+
* @param mode - Optional game mode
|
|
550
|
+
* @returns Score token with sealing data if enabled
|
|
551
|
+
*/
|
|
552
|
+
createScoreToken(mode?: string): Promise<ScoreToken>;
|
|
553
|
+
/**
|
|
554
|
+
* Submit a score to the leaderboard.
|
|
555
|
+
* Automatically computes hash if score sealing is enabled and token was created via createScoreToken().
|
|
556
|
+
*
|
|
557
|
+
* @param params - Score submission parameters
|
|
558
|
+
* @returns Submission result with acceptance status and rank
|
|
559
|
+
* @throws Error if token not found in cache
|
|
560
|
+
*/
|
|
561
|
+
submitScore(params: SubmitScoreParams): Promise<SubmitScoreResult>;
|
|
562
|
+
getPagedScores(options?: GetPagedScoresOptions): Promise<PagedScoresResponse>;
|
|
563
|
+
getMyRank(options?: PlayerRankOptions): Promise<PlayerRankResult>;
|
|
564
|
+
getPodiumScores(options?: GetPodiumScoresOptions): Promise<PodiumScoresResponse>;
|
|
422
565
|
}
|
|
423
566
|
|
|
424
567
|
declare class MockLeaderboardApi implements LeaderboardApi {
|
|
425
|
-
private
|
|
568
|
+
private tokens;
|
|
569
|
+
/** Cache of score tokens for automatic hash computation */
|
|
570
|
+
private tokenCache;
|
|
426
571
|
private entriesByMode;
|
|
427
|
-
private
|
|
428
|
-
private
|
|
572
|
+
private tokenCounter;
|
|
573
|
+
private enableScoreSealing;
|
|
574
|
+
private scoreSealingSecret;
|
|
429
575
|
constructor(options?: {
|
|
430
|
-
|
|
576
|
+
enableScoreSealing?: boolean;
|
|
577
|
+
scoreSealingSecret?: string;
|
|
431
578
|
});
|
|
579
|
+
/**
|
|
580
|
+
* Configure mock leaderboard settings
|
|
581
|
+
*
|
|
582
|
+
* @param options - Configuration options
|
|
583
|
+
*/
|
|
432
584
|
configure(options: {
|
|
433
|
-
|
|
585
|
+
enableScoreSealing?: boolean;
|
|
586
|
+
scoreSealingSecret?: string;
|
|
434
587
|
}): void;
|
|
435
588
|
private generateNonce;
|
|
436
589
|
private getModeKey;
|
|
437
590
|
private getEntriesForMode;
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
591
|
+
/**
|
|
592
|
+
* Create a mock score token for testing.
|
|
593
|
+
* Token is cached for automatic hash computation if score sealing is enabled.
|
|
594
|
+
*
|
|
595
|
+
* @param mode - Optional game mode
|
|
596
|
+
* @returns Score token with sealing data if enabled
|
|
597
|
+
*/
|
|
598
|
+
createScoreToken(mode?: string): Promise<ScoreToken>;
|
|
599
|
+
/**
|
|
600
|
+
* Submit a mock score to the leaderboard.
|
|
601
|
+
* Automatically computes hash if score sealing is enabled and token was created via createScoreToken().
|
|
602
|
+
*
|
|
603
|
+
* @param params - Score submission parameters
|
|
604
|
+
* @returns Submission result with acceptance status and rank
|
|
605
|
+
* @throws Error if token not found in cache or validation fails
|
|
606
|
+
*/
|
|
607
|
+
submitScore(params: SubmitScoreParams): Promise<SubmitScoreResult>;
|
|
608
|
+
getPagedScores(options?: GetPagedScoresOptions): Promise<PagedScoresResponse>;
|
|
609
|
+
getMyRank(_options?: PlayerRankOptions): Promise<PlayerRankResult>;
|
|
610
|
+
getPodiumScores(options?: GetPodiumScoresOptions): Promise<PodiumScoresResponse>;
|
|
443
611
|
}
|
|
444
612
|
|
|
613
|
+
/**
|
|
614
|
+
* Hash algorithm used for score sealing
|
|
615
|
+
*/
|
|
616
|
+
declare const HASH_ALGORITHM_WEB_CRYPTO = "SHA-256";
|
|
617
|
+
declare const HASH_ALGORITHM_NODE = "sha256";
|
|
618
|
+
/**
|
|
619
|
+
* Compute HMAC-SHA256 hash for score sealing.
|
|
620
|
+
* Hash always includes: score, duration, token
|
|
621
|
+
* Matches server-side hash computation exactly.
|
|
622
|
+
*
|
|
623
|
+
* @param score - The score value
|
|
624
|
+
* @param duration - Duration in seconds
|
|
625
|
+
* @param token - Score token
|
|
626
|
+
* @param sealingNonce - One-time nonce for this submission
|
|
627
|
+
* @param sealingSecret - Secret key for HMAC
|
|
628
|
+
* @returns Hex-encoded hash string
|
|
629
|
+
*/
|
|
630
|
+
declare function computeScoreHash(score: number, duration: number, token: string, sealingNonce: string, sealingSecret: string): Promise<string>;
|
|
631
|
+
|
|
445
632
|
declare function initializeLeaderboard(venusApiInstance: VenusAPI, host: Host): void;
|
|
446
633
|
|
|
447
634
|
declare class MockPreloaderApi implements PreloaderApi {
|
|
@@ -571,10 +758,6 @@ declare enum VenusMessageId {
|
|
|
571
758
|
CONFIRM_DIALOG = "H5_CONFIRM_DIALOG",
|
|
572
759
|
ACTION_SHEET_SHOW = "H5_ACTION_SHEET_SHOW",
|
|
573
760
|
REQUEST_SERVER_TIME = "H5_REQUEST_SERVER_TIME",
|
|
574
|
-
GET_POST_INTERACTIONS = "H5_GET_POST_INTERACTIONS",
|
|
575
|
-
TOGGLE_LIKE = "H5_TOGGLE_LIKE",
|
|
576
|
-
OPEN_COMMENTS = "H5_OPEN_COMMENTS",// For opening comments with callback support
|
|
577
|
-
TOGGLE_FOLLOW = "H5_TOGGLE_FOLLOW",
|
|
578
761
|
SHARE_LINK = "H5_SHARE_LINK",
|
|
579
762
|
CREATE_SHARE_QRCODE = "H5_CREATE_SHARE_QRCODE",
|
|
580
763
|
AI_CHAT_COMPLETION = "H5_AI_CHAT_COMPLETION",
|
|
@@ -619,11 +802,14 @@ declare enum VenusMessageId {
|
|
|
619
802
|
H5_SIMULATION_GET_AVAILABLE_ITEMS = "H5_SIMULATION_GET_AVAILABLE_ITEMS",
|
|
620
803
|
H5_SIMULATION_VALIDATE_ASSIGNMENT = "H5_SIMULATION_VALIDATE_ASSIGNMENT",
|
|
621
804
|
H5_SIMULATION_BATCH_OPERATIONS = "H5_SIMULATION_BATCH_OPERATIONS",
|
|
622
|
-
|
|
805
|
+
H5_SIMULATION_SUBSCRIBE = "H5_SIMULATION_SUBSCRIBE",
|
|
806
|
+
H5_SIMULATION_UNSUBSCRIBE = "H5_SIMULATION_UNSUBSCRIBE",
|
|
807
|
+
H5_SIMULATION_UPDATE = "H5_SIMULATION_UPDATE",
|
|
808
|
+
H5_LEADERBOARD_CREATE_SCORE_TOKEN = "H5_LEADERBOARD_CREATE_SCORE_TOKEN",
|
|
623
809
|
H5_LEADERBOARD_SUBMIT_SCORE = "H5_LEADERBOARD_SUBMIT_SCORE",
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
810
|
+
H5_LEADERBOARD_GET_PAGED_SCORES = "H5_LEADERBOARD_GET_PAGED_SCORES",
|
|
811
|
+
H5_LEADERBOARD_GET_PODIUM_SCORES = "H5_LEADERBOARD_GET_PODIUM_SCORES",
|
|
812
|
+
H5_LEADERBOARD_GET_MY_RANK = "H5_LEADERBOARD_GET_MY_RANK",
|
|
627
813
|
H5_ROOM_CREATE = "H5_ROOM_CREATE",
|
|
628
814
|
H5_ROOM_JOIN = "H5_ROOM_JOIN",
|
|
629
815
|
H5_ROOM_JOIN_OR_CREATE = "H5_ROOM_JOIN_OR_CREATE",
|
|
@@ -666,9 +852,9 @@ declare class RemoteHost implements Host {
|
|
|
666
852
|
readonly notifications: NotificationsApi;
|
|
667
853
|
readonly popups: PopupsApi;
|
|
668
854
|
readonly profile: ProfileApi;
|
|
855
|
+
readonly system: SystemApi;
|
|
669
856
|
readonly cdn: CdnApi;
|
|
670
857
|
readonly time: TimeApi;
|
|
671
|
-
readonly post: PostApi;
|
|
672
858
|
readonly ai: AiApi;
|
|
673
859
|
readonly haptics: HapticsApi;
|
|
674
860
|
readonly features: FeaturesApi;
|
|
@@ -691,14 +877,26 @@ declare class RemoteHost implements Host {
|
|
|
691
877
|
interface InitResponse {
|
|
692
878
|
initializeAsleep: boolean;
|
|
693
879
|
instanceId: string;
|
|
694
|
-
profile
|
|
880
|
+
profile: {
|
|
695
881
|
id: string;
|
|
696
882
|
username: string;
|
|
697
883
|
avatarUrl?: string | null;
|
|
698
884
|
isAnonymous?: boolean;
|
|
699
885
|
};
|
|
700
|
-
|
|
701
|
-
launchParams
|
|
886
|
+
safeArea?: SafeArea;
|
|
887
|
+
launchParams: Record<string, string>;
|
|
888
|
+
environment: EnvironmentInfo;
|
|
889
|
+
device: DeviceInfo;
|
|
890
|
+
locale: string;
|
|
891
|
+
languageCode: string;
|
|
892
|
+
rooms?: {
|
|
893
|
+
gameType?: string;
|
|
894
|
+
rulesPreset?: string;
|
|
895
|
+
matchmaking?: Record<string, any>;
|
|
896
|
+
createOptions?: Record<string, any>;
|
|
897
|
+
privateMatchDefaults?: Record<string, any>;
|
|
898
|
+
[key: string]: any;
|
|
899
|
+
};
|
|
702
900
|
}
|
|
703
901
|
|
|
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,
|
|
902
|
+
export { ActionSheetItem, AdsApi, AiApi, AiChatCompletionData, AiChatCompletionRequest, AnalyticsApi, AssetManifest, Avatar3dApi, Avatar3dConfig, Avatar3dEdits, AwakeCallback, 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, FetchBlobOptions, 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, RemoteHost, 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, SDK_VERSION, SafeArea, ScheduleLocalNotification, ScheduleNotificationOptions, ScoreToken, ServerTimeData, ShareLinkResult, ShareMetadata, SharedAssetsApi, ShowActionSheetOptions, ShowAlertOptions, ShowConfirmOptions, 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, SubPath, SubmitScoreParams, SubmitScoreResult, Subscription, SystemApi, TimeApi, TriggerRecipeChainOptions, UpdateRoomDataOptions, ValidateMoveResult, ValidateMoveVerdict, VenusMessageId, VenusRoom, 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 };
|