@series-inc/venus-sdk 3.1.2 → 3.2.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-DFutZ7_q.d.mts} +501 -293
- package/dist/{AdsApi-CNGRf6j0.d.ts → AdsApi-DFutZ7_q.d.ts} +501 -293
- package/dist/{chunk-PXWCNWJ6.mjs → chunk-AGXMORDL.mjs} +1442 -1586
- package/dist/chunk-AGXMORDL.mjs.map +1 -0
- 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/core-62LWDHN7.mjs +4 -0
- package/dist/{core-R3FHW62G.mjs.map → core-62LWDHN7.mjs.map} +1 -1
- package/dist/index.cjs +1461 -1585
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +280 -92
- package/dist/index.d.ts +280 -92
- package/dist/index.mjs +4 -6
- package/dist/index.mjs.map +1 -1
- package/dist/venus-api/index.cjs +1557 -2020
- 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-DFutZ7_q.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-DFutZ7_q.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>;
|
|
@@ -160,15 +161,77 @@ declare class MockPopupsApi implements PopupsApi {
|
|
|
160
161
|
declare function initializePopups(venusApi: VenusAPI, host: Host): void;
|
|
161
162
|
|
|
162
163
|
declare class HostProfileApi implements ProfileApi {
|
|
164
|
+
private readonly venusApi;
|
|
165
|
+
constructor(venusApi: VenusAPI);
|
|
163
166
|
getCurrentProfile(): Profile;
|
|
164
167
|
}
|
|
165
168
|
|
|
166
169
|
declare class MockProfileApi implements ProfileApi {
|
|
170
|
+
private readonly venusApi;
|
|
171
|
+
constructor(venusApi: VenusAPI);
|
|
167
172
|
getCurrentProfile(): Profile;
|
|
168
173
|
}
|
|
169
174
|
|
|
170
175
|
declare function initializeProfile(venusApi: VenusAPI, host: Host): void;
|
|
171
176
|
|
|
177
|
+
declare class HostDeviceApi implements DeviceApi {
|
|
178
|
+
private readonly venusApi;
|
|
179
|
+
constructor(venusApi: VenusAPI);
|
|
180
|
+
getDevice(): DeviceInfo;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
declare class MockDeviceApi implements DeviceApi {
|
|
184
|
+
private readonly venusApi;
|
|
185
|
+
constructor(venusApi: VenusAPI);
|
|
186
|
+
getDevice(): DeviceInfo;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
declare class HostEnvironmentApi implements EnvironmentApi {
|
|
190
|
+
private readonly venusApi;
|
|
191
|
+
constructor(venusApi: VenusAPI);
|
|
192
|
+
getEnvironment(): EnvironmentInfo;
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
declare class MockEnvironmentApi implements EnvironmentApi {
|
|
196
|
+
private readonly venusApi;
|
|
197
|
+
constructor(venusApi: VenusAPI);
|
|
198
|
+
getEnvironment(): EnvironmentInfo;
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
/**
|
|
202
|
+
* Host implementation of SystemApi that delegates to device and environment APIs.
|
|
203
|
+
* Acts as a facade combining both system-level information sources.
|
|
204
|
+
*/
|
|
205
|
+
declare class HostSystemApi implements SystemApi {
|
|
206
|
+
private readonly deviceApi;
|
|
207
|
+
private readonly environmentApi;
|
|
208
|
+
private readonly venusApi;
|
|
209
|
+
constructor(deviceApi: DeviceApi, environmentApi: EnvironmentApi, venusApi: VenusAPI);
|
|
210
|
+
getDevice(): DeviceInfo;
|
|
211
|
+
getEnvironment(): EnvironmentInfo;
|
|
212
|
+
getSafeArea(): SafeArea;
|
|
213
|
+
isMobile(): boolean;
|
|
214
|
+
isWeb(): boolean;
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
/**
|
|
218
|
+
* Mock implementation of SystemApi for local development.
|
|
219
|
+
* Delegates to mock device and environment APIs.
|
|
220
|
+
*/
|
|
221
|
+
declare class MockSystemApi implements SystemApi {
|
|
222
|
+
private readonly deviceApi;
|
|
223
|
+
private readonly environmentApi;
|
|
224
|
+
private readonly venusApi;
|
|
225
|
+
constructor(deviceApi: DeviceApi, environmentApi: EnvironmentApi, venusApi: VenusAPI);
|
|
226
|
+
getDevice(): DeviceInfo;
|
|
227
|
+
getEnvironment(): EnvironmentInfo;
|
|
228
|
+
getSafeArea(): SafeArea;
|
|
229
|
+
isMobile(): boolean;
|
|
230
|
+
isWeb(): boolean;
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
declare function initializeSystem(venusApi: VenusAPI, host: Host): void;
|
|
234
|
+
|
|
172
235
|
declare class HostCdnApi implements CdnApi {
|
|
173
236
|
private readonly baseUrl;
|
|
174
237
|
constructor(baseUrl: string);
|
|
@@ -181,8 +244,10 @@ declare class HostCdnApi implements CdnApi {
|
|
|
181
244
|
}
|
|
182
245
|
|
|
183
246
|
declare class MockCdnApi implements CdnApi {
|
|
184
|
-
private readonly
|
|
185
|
-
constructor();
|
|
247
|
+
private readonly venusApi;
|
|
248
|
+
constructor(venusApi: VenusAPI);
|
|
249
|
+
private get baseUrl();
|
|
250
|
+
private get forceRemoteCdn();
|
|
186
251
|
fetchBlob(path: SubPath, options?: FetchBlobOptions): Promise<Blob>;
|
|
187
252
|
getAssetCdnBaseUrl(): string;
|
|
188
253
|
resolveAssetUrl(subPath: string): string;
|
|
@@ -195,7 +260,8 @@ declare function initializeCdn(venusApi: VenusAPI, host: Host): void;
|
|
|
195
260
|
|
|
196
261
|
declare class HostTimeApi implements TimeApi {
|
|
197
262
|
private readonly rpcClient;
|
|
198
|
-
|
|
263
|
+
private readonly venusApi;
|
|
264
|
+
constructor(rpcClient: RpcClient, venusApi: VenusAPI);
|
|
199
265
|
requestTimeAsync(): Promise<ServerTimeData>;
|
|
200
266
|
formatTime(timestamp: number, options?: any): string;
|
|
201
267
|
formatNumber(value: number, options?: Intl.NumberFormatOptions): string;
|
|
@@ -211,7 +277,6 @@ declare class MockTimeApi implements TimeApi {
|
|
|
211
277
|
formatTime(timestamp: number, options?: any): string;
|
|
212
278
|
getFutureTimeAsync(options?: GetFutureTimeOptions): Promise<number>;
|
|
213
279
|
requestTimeAsync(): Promise<ServerTimeData>;
|
|
214
|
-
private getLocale;
|
|
215
280
|
}
|
|
216
281
|
|
|
217
282
|
declare function initializeTime(venusApi: VenusAPI, host: Host): void;
|
|
@@ -293,69 +358,41 @@ declare function initializeLifecycleApi(venusApi: VenusAPI, host: Host): void;
|
|
|
293
358
|
declare class RpcSimulationApi implements SimulationApi {
|
|
294
359
|
private readonly rpcClient;
|
|
295
360
|
private _simulationConfig;
|
|
361
|
+
private readonly subscriptionCallbacks;
|
|
296
362
|
constructor(rpcClient: RpcClient);
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
363
|
+
isEnabled(): boolean;
|
|
364
|
+
validateSlotAssignmentAsync(containerId: string, slotId: string, itemId: string): Promise<SimulationSlotValidationResult>;
|
|
365
|
+
subscribeAsync(options: SimulationSubscribeOptions): Promise<() => void>;
|
|
366
|
+
executeBatchOperationsAsync(operations: Array<SimulationBatchOperation>, validateOnly?: boolean): Promise<SimulationBatchOperationsResult>;
|
|
367
|
+
getAvailableItemsAsync(containerId: string, slotId: string): Promise<SimulationAvailableItem[]>;
|
|
368
|
+
calculatePowerPreviewAsync(containerId: string, slotId: string, candidateItemId: string): Promise<SimulationPowerPreview>;
|
|
369
|
+
assignItemToSlotAsync(containerId: string, slotId: string, itemId: string): Promise<SimulationSlotMutationResult>;
|
|
370
|
+
removeItemFromSlotAsync(containerId: string, slotId: string): Promise<SimulationSlotMutationResult>;
|
|
371
|
+
getSlotContainersAsync(): Promise<SimulationSlotContainer[]>;
|
|
372
|
+
getSlotAssignmentsAsync(containerId: string): Promise<SimulationAssignment[]>;
|
|
373
|
+
getStateAsync(roomId?: string): Promise<SimulationState>;
|
|
307
374
|
getConfigAsync(roomId?: string): Promise<VenusSimulationConfig>;
|
|
308
|
-
executeRecipeAsync(recipeId: string, inputs?:
|
|
375
|
+
executeRecipeAsync(recipeId: string, inputs?: Record<string, unknown>, options?: ExecuteRecipeOptions): Promise<ExecuteRecipeResponse>;
|
|
309
376
|
collectRecipeAsync(runId: string): Promise<CollectRecipeResult>;
|
|
310
|
-
getActiveRunsAsync(options?: GetActiveRunsOptions): Promise<
|
|
311
|
-
executeScopedRecipeAsync(recipeId: string, entity: string, inputs?:
|
|
377
|
+
getActiveRunsAsync(options?: GetActiveRunsOptions): Promise<SimulationRunSummary[]>;
|
|
378
|
+
executeScopedRecipeAsync(recipeId: string, entity: string, inputs?: Record<string, unknown>, options?: ExecuteScopedRecipeOptions): Promise<ExecuteScopedRecipeResult>;
|
|
312
379
|
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
380
|
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>;
|
|
381
|
+
getBatchRecipeRequirementsAsync(recipes: Recipe[]): Promise<GetBatchRecipeRequirements>;
|
|
382
|
+
triggerRecipeChainAsync(recipeId: string, options?: TriggerRecipeChainOptions): Promise<ExecuteRecipeResponse>;
|
|
383
|
+
getEntityMetadataAsync(entityId: string): Promise<Record<string, unknown>>;
|
|
384
|
+
resolveFieldValueAsync(entityId: string, fieldPath: string, entity?: string): Promise<unknown>;
|
|
385
|
+
private handleSimulationUpdate;
|
|
386
|
+
private ensureValidSubscribeOptions;
|
|
355
387
|
}
|
|
356
388
|
|
|
357
389
|
declare function initializeSimulation(venusApi: VenusAPI, host: Host): void;
|
|
358
390
|
|
|
391
|
+
interface RoomNotificationSubscriptionState {
|
|
392
|
+
data: Record<string, Array<(event: RoomDataUpdate) => void>>;
|
|
393
|
+
messages: Record<string, Array<(event: RoomMessageEvent) => void>>;
|
|
394
|
+
gameEvents: Record<string, Array<(event: ProposedMoveEvent) => void>>;
|
|
395
|
+
}
|
|
359
396
|
/**
|
|
360
397
|
* Set up room notification listeners using the transport's onVenusMessage hook.
|
|
361
398
|
* This routes host-sent room notifications (H5_ROOM_DATA_UPDATED, etc.) to the
|
|
@@ -363,7 +400,34 @@ declare function initializeSimulation(venusApi: VenusAPI, host: Host): void;
|
|
|
363
400
|
* @param transport The Venus transport to listen for messages
|
|
364
401
|
* @param getSubscriptions Function to retrieve subscription state from RoomsApi
|
|
365
402
|
*/
|
|
366
|
-
declare function setupRoomNotifications(transport: VenusTransport, getSubscriptions: () =>
|
|
403
|
+
declare function setupRoomNotifications(transport: VenusTransport, getSubscriptions: () => RoomNotificationSubscriptionState): Subscription;
|
|
404
|
+
|
|
405
|
+
declare class RpcRoomsApi implements RoomsApi {
|
|
406
|
+
private readonly rpcClient;
|
|
407
|
+
private readonly subscriptions;
|
|
408
|
+
constructor(rpcClient: RpcClient);
|
|
409
|
+
/**
|
|
410
|
+
* Get the subscription state for external access (used by setupRoomNotifications)
|
|
411
|
+
*/
|
|
412
|
+
getSubscriptions(): RoomNotificationSubscriptionState;
|
|
413
|
+
/**
|
|
414
|
+
* Set up room notification routing from the transport
|
|
415
|
+
*/
|
|
416
|
+
setupNotifications(transport: VenusTransport): void;
|
|
417
|
+
createRoomAsync(options: CreateRoomOptions): Promise<VenusRoom>;
|
|
418
|
+
joinOrCreateRoomAsync(options: JoinOrCreateRoomOptions): Promise<JoinOrCreateResult>;
|
|
419
|
+
joinRoomByCodeAsync(roomCode: string): Promise<VenusRoom>;
|
|
420
|
+
getUserRoomsAsync(options?: ListRoomsOptions): Promise<VenusRoom[]>;
|
|
421
|
+
updateRoomDataAsync(room: VenusRoom, updates: Record<string, unknown>, options?: UpdateRoomDataOptions): Promise<void>;
|
|
422
|
+
getRoomDataAsync(room: VenusRoom): Promise<Record<string, unknown>>;
|
|
423
|
+
sendRoomMessageAsync(venusRoom: VenusRoom, request: RoomMessageRequest): Promise<string>;
|
|
424
|
+
leaveRoomAsync(room: VenusRoom): Promise<void>;
|
|
425
|
+
startRoomGameAsync(room: VenusRoom, options?: StartRoomGameOptions): Promise<void>;
|
|
426
|
+
proposeMoveAsync(room: VenusRoom, proposalPayload: ProposeMoveRequest): Promise<ProposeMoveResult>;
|
|
427
|
+
validateMoveAsync(_room: VenusRoom, moveId: string, verdict: ValidateMoveVerdict): Promise<ValidateMoveResult>;
|
|
428
|
+
subscribeAsync(room: VenusRoom, options?: RoomSubscriptionOptions): Promise<() => void>;
|
|
429
|
+
}
|
|
430
|
+
|
|
367
431
|
declare function initializeRoomsApi(venusApi: VenusAPI, host: Host): void;
|
|
368
432
|
|
|
369
433
|
declare class MockLoggingApi implements LoggingApi {
|
|
@@ -395,9 +459,61 @@ declare class RpcIapApi implements IapApi {
|
|
|
395
459
|
declare class MockSharedAssetsApi implements SharedAssetsApi {
|
|
396
460
|
private readonly venusApi;
|
|
397
461
|
constructor(venusApi: VenusAPI);
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
}
|
|
462
|
+
loadAssetsBundle(game: string, bundleKey: string, fileType?: string): Promise<ArrayBuffer>;
|
|
463
|
+
loadLibraryCode(libraryKey: string): Promise<string>;
|
|
464
|
+
}
|
|
465
|
+
|
|
466
|
+
type ModuleSpecifierMatch = 'exact' | 'prefix';
|
|
467
|
+
interface ModuleSpecifierConfig {
|
|
468
|
+
match: ModuleSpecifierMatch;
|
|
469
|
+
value: string;
|
|
470
|
+
behavior?: 'default' | 'react-jsx-runtime' | 'react-jsx-dev-runtime' | 'namespace';
|
|
471
|
+
}
|
|
472
|
+
interface EmbeddedLibraryDefinition {
|
|
473
|
+
libraryKey: string;
|
|
474
|
+
assetKey: string;
|
|
475
|
+
packageName: string;
|
|
476
|
+
version: string;
|
|
477
|
+
globalVar: string;
|
|
478
|
+
cdnPath: string;
|
|
479
|
+
moduleSpecifiers: ModuleSpecifierConfig[];
|
|
480
|
+
loadStage: number;
|
|
481
|
+
enabled: boolean;
|
|
482
|
+
}
|
|
483
|
+
declare const DEFAULT_SHARED_LIB_CDN_BASE = "https://venus-static-01293ak.web.app/libs";
|
|
484
|
+
declare const EMBEDDED_LIBRARIES: EmbeddedLibraryDefinition[];
|
|
485
|
+
declare const EMBEDDED_LIBRARY_BY_KEY: Record<string, EmbeddedLibraryDefinition>;
|
|
486
|
+
declare const MODULE_TO_LIBRARY_SPECIFIERS: {
|
|
487
|
+
libraryKey: string;
|
|
488
|
+
match: ModuleSpecifierMatch;
|
|
489
|
+
value: string;
|
|
490
|
+
behavior?: "default" | "react-jsx-runtime" | "react-jsx-dev-runtime" | "namespace";
|
|
491
|
+
}[];
|
|
492
|
+
/**
|
|
493
|
+
* Get library definition by key, throwing if not found.
|
|
494
|
+
* @param libraryKey - Library key (e.g., 'phaser@3.90.0')
|
|
495
|
+
* @returns Library definition
|
|
496
|
+
* @throws Error if library key is not found
|
|
497
|
+
*/
|
|
498
|
+
declare function getLibraryDefinition(libraryKey: string): EmbeddedLibraryDefinition;
|
|
499
|
+
|
|
500
|
+
/**
|
|
501
|
+
* Base64 encoding/decoding utilities for embedded assets and libraries.
|
|
502
|
+
*
|
|
503
|
+
* These utilities handle base64 data received from the Venus host via RPC,
|
|
504
|
+
* converting it to ArrayBuffer or UTF-8 strings with appropriate fallbacks
|
|
505
|
+
* for different JavaScript environments.
|
|
506
|
+
*/
|
|
507
|
+
/**
|
|
508
|
+
* Convert base64 string to ArrayBuffer.
|
|
509
|
+
* Uses native atob() when available for best performance.
|
|
510
|
+
*/
|
|
511
|
+
declare function base64ToArrayBuffer(base64: string): ArrayBuffer;
|
|
512
|
+
/**
|
|
513
|
+
* Convert base64 string to UTF-8 string.
|
|
514
|
+
* Tries multiple decoding strategies for maximum compatibility.
|
|
515
|
+
*/
|
|
516
|
+
declare function base64ToUtf8(base64: string): string;
|
|
401
517
|
|
|
402
518
|
declare class MockIapApi implements IapApi {
|
|
403
519
|
private _hardCurrency;
|
|
@@ -413,35 +529,96 @@ declare function initializeIap(venusApiInstance: VenusAPI, host: Host): void;
|
|
|
413
529
|
|
|
414
530
|
declare class RpcLeaderboardApi implements LeaderboardApi {
|
|
415
531
|
private readonly rpcClient;
|
|
532
|
+
/** Cache of score tokens for automatic hash computation */
|
|
533
|
+
private tokenCache;
|
|
416
534
|
constructor(rpcClient: RpcClient);
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
535
|
+
/**
|
|
536
|
+
* Create a score token for submitting a score.
|
|
537
|
+
* Token is cached for automatic hash computation if score sealing is enabled.
|
|
538
|
+
*
|
|
539
|
+
* @param mode - Optional game mode
|
|
540
|
+
* @returns Score token with sealing data if enabled
|
|
541
|
+
*/
|
|
542
|
+
createScoreToken(mode?: string): Promise<ScoreToken>;
|
|
543
|
+
/**
|
|
544
|
+
* Submit a score to the leaderboard.
|
|
545
|
+
* Automatically computes hash if score sealing is enabled and token was created via createScoreToken().
|
|
546
|
+
*
|
|
547
|
+
* @param params - Score submission parameters
|
|
548
|
+
* @returns Submission result with acceptance status and rank
|
|
549
|
+
* @throws Error if token not found in cache
|
|
550
|
+
*/
|
|
551
|
+
submitScore(params: SubmitScoreParams): Promise<SubmitScoreResult>;
|
|
552
|
+
getPagedScores(options?: GetPagedScoresOptions): Promise<PagedScoresResponse>;
|
|
553
|
+
getMyRank(options?: PlayerRankOptions): Promise<PlayerRankResult>;
|
|
554
|
+
getPodiumScores(options?: GetPodiumScoresOptions): Promise<PodiumScoresResponse>;
|
|
422
555
|
}
|
|
423
556
|
|
|
424
557
|
declare class MockLeaderboardApi implements LeaderboardApi {
|
|
425
|
-
private
|
|
558
|
+
private tokens;
|
|
559
|
+
/** Cache of score tokens for automatic hash computation */
|
|
560
|
+
private tokenCache;
|
|
426
561
|
private entriesByMode;
|
|
427
|
-
private
|
|
428
|
-
private
|
|
562
|
+
private tokenCounter;
|
|
563
|
+
private enableScoreSealing;
|
|
564
|
+
private scoreSealingSecret;
|
|
429
565
|
constructor(options?: {
|
|
430
|
-
|
|
566
|
+
enableScoreSealing?: boolean;
|
|
567
|
+
scoreSealingSecret?: string;
|
|
431
568
|
});
|
|
569
|
+
/**
|
|
570
|
+
* Configure mock leaderboard settings
|
|
571
|
+
*
|
|
572
|
+
* @param options - Configuration options
|
|
573
|
+
*/
|
|
432
574
|
configure(options: {
|
|
433
|
-
|
|
575
|
+
enableScoreSealing?: boolean;
|
|
576
|
+
scoreSealingSecret?: string;
|
|
434
577
|
}): void;
|
|
435
578
|
private generateNonce;
|
|
436
579
|
private getModeKey;
|
|
437
580
|
private getEntriesForMode;
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
581
|
+
/**
|
|
582
|
+
* Create a mock score token for testing.
|
|
583
|
+
* Token is cached for automatic hash computation if score sealing is enabled.
|
|
584
|
+
*
|
|
585
|
+
* @param mode - Optional game mode
|
|
586
|
+
* @returns Score token with sealing data if enabled
|
|
587
|
+
*/
|
|
588
|
+
createScoreToken(mode?: string): Promise<ScoreToken>;
|
|
589
|
+
/**
|
|
590
|
+
* Submit a mock score to the leaderboard.
|
|
591
|
+
* Automatically computes hash if score sealing is enabled and token was created via createScoreToken().
|
|
592
|
+
*
|
|
593
|
+
* @param params - Score submission parameters
|
|
594
|
+
* @returns Submission result with acceptance status and rank
|
|
595
|
+
* @throws Error if token not found in cache or validation fails
|
|
596
|
+
*/
|
|
597
|
+
submitScore(params: SubmitScoreParams): Promise<SubmitScoreResult>;
|
|
598
|
+
getPagedScores(options?: GetPagedScoresOptions): Promise<PagedScoresResponse>;
|
|
599
|
+
getMyRank(_options?: PlayerRankOptions): Promise<PlayerRankResult>;
|
|
600
|
+
getPodiumScores(options?: GetPodiumScoresOptions): Promise<PodiumScoresResponse>;
|
|
443
601
|
}
|
|
444
602
|
|
|
603
|
+
/**
|
|
604
|
+
* Hash algorithm used for score sealing
|
|
605
|
+
*/
|
|
606
|
+
declare const HASH_ALGORITHM_WEB_CRYPTO = "SHA-256";
|
|
607
|
+
declare const HASH_ALGORITHM_NODE = "sha256";
|
|
608
|
+
/**
|
|
609
|
+
* Compute HMAC-SHA256 hash for score sealing.
|
|
610
|
+
* Hash always includes: score, duration, token
|
|
611
|
+
* Matches server-side hash computation exactly.
|
|
612
|
+
*
|
|
613
|
+
* @param score - The score value
|
|
614
|
+
* @param duration - Duration in seconds
|
|
615
|
+
* @param token - Score token
|
|
616
|
+
* @param sealingNonce - One-time nonce for this submission
|
|
617
|
+
* @param sealingSecret - Secret key for HMAC
|
|
618
|
+
* @returns Hex-encoded hash string
|
|
619
|
+
*/
|
|
620
|
+
declare function computeScoreHash(score: number, duration: number, token: string, sealingNonce: string, sealingSecret: string): Promise<string>;
|
|
621
|
+
|
|
445
622
|
declare function initializeLeaderboard(venusApiInstance: VenusAPI, host: Host): void;
|
|
446
623
|
|
|
447
624
|
declare class MockPreloaderApi implements PreloaderApi {
|
|
@@ -571,10 +748,6 @@ declare enum VenusMessageId {
|
|
|
571
748
|
CONFIRM_DIALOG = "H5_CONFIRM_DIALOG",
|
|
572
749
|
ACTION_SHEET_SHOW = "H5_ACTION_SHEET_SHOW",
|
|
573
750
|
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
751
|
SHARE_LINK = "H5_SHARE_LINK",
|
|
579
752
|
CREATE_SHARE_QRCODE = "H5_CREATE_SHARE_QRCODE",
|
|
580
753
|
AI_CHAT_COMPLETION = "H5_AI_CHAT_COMPLETION",
|
|
@@ -619,11 +792,14 @@ declare enum VenusMessageId {
|
|
|
619
792
|
H5_SIMULATION_GET_AVAILABLE_ITEMS = "H5_SIMULATION_GET_AVAILABLE_ITEMS",
|
|
620
793
|
H5_SIMULATION_VALIDATE_ASSIGNMENT = "H5_SIMULATION_VALIDATE_ASSIGNMENT",
|
|
621
794
|
H5_SIMULATION_BATCH_OPERATIONS = "H5_SIMULATION_BATCH_OPERATIONS",
|
|
622
|
-
|
|
795
|
+
H5_SIMULATION_SUBSCRIBE = "H5_SIMULATION_SUBSCRIBE",
|
|
796
|
+
H5_SIMULATION_UNSUBSCRIBE = "H5_SIMULATION_UNSUBSCRIBE",
|
|
797
|
+
H5_SIMULATION_UPDATE = "H5_SIMULATION_UPDATE",
|
|
798
|
+
H5_LEADERBOARD_CREATE_SCORE_TOKEN = "H5_LEADERBOARD_CREATE_SCORE_TOKEN",
|
|
623
799
|
H5_LEADERBOARD_SUBMIT_SCORE = "H5_LEADERBOARD_SUBMIT_SCORE",
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
800
|
+
H5_LEADERBOARD_GET_PAGED_SCORES = "H5_LEADERBOARD_GET_PAGED_SCORES",
|
|
801
|
+
H5_LEADERBOARD_GET_PODIUM_SCORES = "H5_LEADERBOARD_GET_PODIUM_SCORES",
|
|
802
|
+
H5_LEADERBOARD_GET_MY_RANK = "H5_LEADERBOARD_GET_MY_RANK",
|
|
627
803
|
H5_ROOM_CREATE = "H5_ROOM_CREATE",
|
|
628
804
|
H5_ROOM_JOIN = "H5_ROOM_JOIN",
|
|
629
805
|
H5_ROOM_JOIN_OR_CREATE = "H5_ROOM_JOIN_OR_CREATE",
|
|
@@ -666,9 +842,9 @@ declare class RemoteHost implements Host {
|
|
|
666
842
|
readonly notifications: NotificationsApi;
|
|
667
843
|
readonly popups: PopupsApi;
|
|
668
844
|
readonly profile: ProfileApi;
|
|
845
|
+
readonly system: SystemApi;
|
|
669
846
|
readonly cdn: CdnApi;
|
|
670
847
|
readonly time: TimeApi;
|
|
671
|
-
readonly post: PostApi;
|
|
672
848
|
readonly ai: AiApi;
|
|
673
849
|
readonly haptics: HapticsApi;
|
|
674
850
|
readonly features: FeaturesApi;
|
|
@@ -691,14 +867,26 @@ declare class RemoteHost implements Host {
|
|
|
691
867
|
interface InitResponse {
|
|
692
868
|
initializeAsleep: boolean;
|
|
693
869
|
instanceId: string;
|
|
694
|
-
profile
|
|
870
|
+
profile: {
|
|
695
871
|
id: string;
|
|
696
872
|
username: string;
|
|
697
873
|
avatarUrl?: string | null;
|
|
698
874
|
isAnonymous?: boolean;
|
|
699
875
|
};
|
|
700
|
-
|
|
701
|
-
launchParams
|
|
876
|
+
safeArea?: SafeArea;
|
|
877
|
+
launchParams: Record<string, string>;
|
|
878
|
+
environment: EnvironmentInfo;
|
|
879
|
+
device: DeviceInfo;
|
|
880
|
+
locale: string;
|
|
881
|
+
languageCode: string;
|
|
882
|
+
rooms?: {
|
|
883
|
+
gameType?: string;
|
|
884
|
+
rulesPreset?: string;
|
|
885
|
+
matchmaking?: Record<string, any>;
|
|
886
|
+
createOptions?: Record<string, any>;
|
|
887
|
+
privateMatchDefaults?: Record<string, any>;
|
|
888
|
+
[key: string]: any;
|
|
889
|
+
};
|
|
702
890
|
}
|
|
703
891
|
|
|
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,
|
|
892
|
+
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 };
|