@series-inc/venus-sdk 2.6.2 → 3.0.1
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/README.md +131 -95
- package/dist/{AdsApi-C_GcWmfO.d.mts → AdsApi-CNGRf6j0.d.mts} +524 -60
- package/dist/{AdsApi-C_GcWmfO.d.ts → AdsApi-CNGRf6j0.d.ts} +524 -60
- package/dist/{chunk-YDXFZ2A2.mjs → chunk-354W7EXH.mjs} +1725 -106
- package/dist/chunk-354W7EXH.mjs.map +1 -0
- package/dist/index.cjs +1987 -330
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +208 -359
- package/dist/index.d.ts +208 -359
- package/dist/index.mjs +2 -2
- package/dist/index.mjs.map +1 -1
- package/dist/venus-api/index.cjs +512 -307
- 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 +13 -1423
- package/dist/venus-api/index.mjs.map +1 -1
- package/package.json +1 -1
- package/dist/chunk-YDXFZ2A2.mjs.map +0 -1
|
@@ -61,6 +61,21 @@ declare class RpcClient {
|
|
|
61
61
|
private handleRpcNotification;
|
|
62
62
|
}
|
|
63
63
|
|
|
64
|
+
interface StorageApi {
|
|
65
|
+
key(index: number): Promise<string | null>;
|
|
66
|
+
clear(): Promise<void>;
|
|
67
|
+
length(): Promise<number>;
|
|
68
|
+
getAllItems(): Promise<string[]>;
|
|
69
|
+
setMultipleItems(items: {
|
|
70
|
+
key: string;
|
|
71
|
+
value: string;
|
|
72
|
+
}[]): Promise<void>;
|
|
73
|
+
removeMultipleItems(keys: string[]): Promise<void>;
|
|
74
|
+
setItem(key: string, item: string): Promise<void>;
|
|
75
|
+
getItem(key: string): Promise<string | null>;
|
|
76
|
+
removeItem(key: string): Promise<void>;
|
|
77
|
+
}
|
|
78
|
+
|
|
64
79
|
interface NavigationStackInfo {
|
|
65
80
|
isInStack: boolean;
|
|
66
81
|
stackPosition: number;
|
|
@@ -92,9 +107,6 @@ type TimeIntervalTriggerInput = {
|
|
|
92
107
|
};
|
|
93
108
|
type NotificationTriggerInput = TimeIntervalTriggerInput | null;
|
|
94
109
|
interface ScheduleNotificationOptions {
|
|
95
|
-
title: string;
|
|
96
|
-
body: string;
|
|
97
|
-
trigger: NotificationTriggerInput;
|
|
98
110
|
priority?: number;
|
|
99
111
|
groupId?: string;
|
|
100
112
|
payload?: Record<string, any>;
|
|
@@ -107,7 +119,7 @@ interface ScheduleLocalNotification {
|
|
|
107
119
|
trigger?: NotificationTriggerInput;
|
|
108
120
|
}
|
|
109
121
|
interface NotificationsApi {
|
|
110
|
-
scheduleAsync(
|
|
122
|
+
scheduleAsync(title: string, body: string, seconds: number, notificationId?: string, options?: ScheduleNotificationOptions): Promise<string | null>;
|
|
111
123
|
cancelNotification(notificationId: string): Promise<boolean>;
|
|
112
124
|
getAllScheduledLocalNotifications(): Promise<ScheduleLocalNotification[]>;
|
|
113
125
|
isLocalNotificationsEnabled(): Promise<boolean>;
|
|
@@ -146,6 +158,10 @@ interface ShowActionSheetOptions {
|
|
|
146
158
|
disableCancel?: boolean;
|
|
147
159
|
}
|
|
148
160
|
|
|
161
|
+
interface ProfileApi {
|
|
162
|
+
getCurrentProfile(): Profile;
|
|
163
|
+
}
|
|
164
|
+
|
|
149
165
|
type SubPath = string;
|
|
150
166
|
interface FetchBlobOptions {
|
|
151
167
|
timeout?: number;
|
|
@@ -159,6 +175,57 @@ interface CdnApi {
|
|
|
159
175
|
fetchBlob(path: SubPath, options?: FetchBlobOptions): Promise<Blob>;
|
|
160
176
|
}
|
|
161
177
|
|
|
178
|
+
interface ServerTimeData {
|
|
179
|
+
serverTime: number;
|
|
180
|
+
localTime: number;
|
|
181
|
+
timezoneOffset: number;
|
|
182
|
+
formattedTime: string;
|
|
183
|
+
locale: string;
|
|
184
|
+
}
|
|
185
|
+
interface GetFutureTimeOptions {
|
|
186
|
+
days?: number;
|
|
187
|
+
hours?: number;
|
|
188
|
+
minutes?: number;
|
|
189
|
+
timeOfDay?: {
|
|
190
|
+
hour: number;
|
|
191
|
+
minute: number;
|
|
192
|
+
second: number;
|
|
193
|
+
};
|
|
194
|
+
timezone?: any;
|
|
195
|
+
}
|
|
196
|
+
interface TimeApi {
|
|
197
|
+
requestTimeAsync(): Promise<ServerTimeData>;
|
|
198
|
+
formatTime(timestamp: number, options?: any): string;
|
|
199
|
+
formatNumber(value: number, options?: Intl.NumberFormatOptions): string;
|
|
200
|
+
getFutureTimeAsync(options?: GetFutureTimeOptions): Promise<number>;
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
interface PostInfo {
|
|
204
|
+
isLiked: boolean;
|
|
205
|
+
isFollowing: boolean;
|
|
206
|
+
likesCount: number;
|
|
207
|
+
commentsCount: number;
|
|
208
|
+
}
|
|
209
|
+
interface ToggleLikeResult {
|
|
210
|
+
isLiked: boolean;
|
|
211
|
+
likesCount: number;
|
|
212
|
+
action: 'liked' | 'unliked';
|
|
213
|
+
}
|
|
214
|
+
interface ToggleFollowResult {
|
|
215
|
+
isFollowing: boolean;
|
|
216
|
+
action: 'followed' | 'unfollowed';
|
|
217
|
+
}
|
|
218
|
+
interface OpenCommentsResult {
|
|
219
|
+
opened: boolean;
|
|
220
|
+
commentsCount: number;
|
|
221
|
+
}
|
|
222
|
+
interface PostApi {
|
|
223
|
+
getPostInfo(): Promise<PostInfo>;
|
|
224
|
+
toggleLikeAsync(): Promise<ToggleLikeResult>;
|
|
225
|
+
openCommentsAsync(): Promise<OpenCommentsResult>;
|
|
226
|
+
toggleFollowAsync(): Promise<ToggleFollowResult>;
|
|
227
|
+
}
|
|
228
|
+
|
|
162
229
|
interface AiMessage {
|
|
163
230
|
/**
|
|
164
231
|
* Depends on the model you are using. Most common is user, system, and assistant.
|
|
@@ -232,44 +299,146 @@ interface HapticsApi {
|
|
|
232
299
|
triggerHapticAsync(style: HapticFeedbackStyle): Promise<void>;
|
|
233
300
|
}
|
|
234
301
|
|
|
235
|
-
interface
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
302
|
+
interface Experiment {
|
|
303
|
+
readonly name: string;
|
|
304
|
+
readonly ruleID: string;
|
|
305
|
+
readonly value: Record<string, unknown>;
|
|
306
|
+
readonly groupName: string | null;
|
|
240
307
|
}
|
|
241
|
-
interface
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
isFollowing: boolean;
|
|
246
|
-
likesCount: number;
|
|
247
|
-
commentsCount: number;
|
|
308
|
+
interface FeaturesApi {
|
|
309
|
+
getExperiment(experimentName: string): Promise<Experiment | null>;
|
|
310
|
+
getFeatureFlag(flagName: string): Promise<boolean>;
|
|
311
|
+
getFeatureGate(gateName: string): Promise<boolean>;
|
|
248
312
|
}
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
type
|
|
255
|
-
type OnPauseCallback = () => void;
|
|
256
|
-
type OnResumeCallback = () => void;
|
|
257
|
-
type OnQuitCallback = () => void;
|
|
258
|
-
type OnHideCallback = () => void;
|
|
259
|
-
interface ShowContext {
|
|
260
|
-
hudInsets: Insets;
|
|
261
|
-
postData?: PostInfo;
|
|
262
|
-
}
|
|
263
|
-
type OnShowCallback = (context: ShowContext) => void;
|
|
264
|
-
type OnCleanupCallback = () => void;
|
|
313
|
+
|
|
314
|
+
type AwakeCallback = () => void;
|
|
315
|
+
type SleepCallback = () => void;
|
|
316
|
+
type ResumeCallback = () => void;
|
|
317
|
+
type PauseCallback = () => void;
|
|
318
|
+
type QuitCallback = () => void;
|
|
265
319
|
interface LifecycleApi {
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
320
|
+
/**
|
|
321
|
+
* Registers a callback for when the game transitions from "idle" to "active" state.
|
|
322
|
+
*
|
|
323
|
+
* This occurs when the game comes to the foreground. Use this to load heavy resources
|
|
324
|
+
* or resume activities that were paused during sleep.
|
|
325
|
+
*
|
|
326
|
+
* @param callback - Function to execute when the game awakens
|
|
327
|
+
* @returns Subscription object that can be used to unsubscribe from the event
|
|
328
|
+
*/
|
|
329
|
+
onAwake(callback: AwakeCallback): Subscription;
|
|
330
|
+
/**
|
|
331
|
+
* Registers a callback for when the game transitions from "active" to "idle" state.
|
|
332
|
+
*
|
|
333
|
+
* This occurs when the game goes to the background. Use this to unload heavy resources,
|
|
334
|
+
* save state, or pause non-essential activities.
|
|
335
|
+
*
|
|
336
|
+
* @param callback - Function to execute when the game goes to sleep
|
|
337
|
+
* @returns Subscription object that can be used to unsubscribe from the event
|
|
338
|
+
*/
|
|
339
|
+
onSleep(callback: SleepCallback): Subscription;
|
|
340
|
+
/**
|
|
341
|
+
* Registers a callback for when gameplay should resume.
|
|
342
|
+
*
|
|
343
|
+
* This occurs when the platform dismisses dialogs or overlays, or when players
|
|
344
|
+
* return from a temporary switch. Use this to resume game logic and animations.
|
|
345
|
+
*
|
|
346
|
+
* @param callback - Function to execute when gameplay resumes
|
|
347
|
+
* @returns Subscription object that can be used to unsubscribe from the event
|
|
348
|
+
*/
|
|
349
|
+
onResume(callback: ResumeCallback): Subscription;
|
|
350
|
+
/**
|
|
351
|
+
* Registers a callback for when gameplay should pause.
|
|
352
|
+
*
|
|
353
|
+
* This occurs when the platform brings up dialogs or overlays, or when players
|
|
354
|
+
* temporarily switch away. Use this to pause game logic and animations.
|
|
355
|
+
*
|
|
356
|
+
* @param callback - Function to execute when gameplay pauses
|
|
357
|
+
* @returns Subscription object that can be used to unsubscribe from the event
|
|
358
|
+
*/
|
|
359
|
+
onPause(callback: PauseCallback): Subscription;
|
|
360
|
+
/**
|
|
361
|
+
* Registers a callback for final teardown before the game instance is destroyed.
|
|
362
|
+
*
|
|
363
|
+
* This is the last chance to clean up resources, save state, and perform any
|
|
364
|
+
* necessary cleanup before the game instance is destroyed or replaced.
|
|
365
|
+
*
|
|
366
|
+
* @param callback - Function to execute during cleanup
|
|
367
|
+
* @returns Subscription object that can be used to unsubscribe from the event
|
|
368
|
+
*/
|
|
369
|
+
onQuit(callback: QuitCallback): Subscription;
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
interface ExecuteRecipeOptions {
|
|
373
|
+
roomId?: string;
|
|
374
|
+
batchAmount?: number;
|
|
375
|
+
allowPartialBatch?: boolean;
|
|
376
|
+
entity?: string;
|
|
377
|
+
}
|
|
378
|
+
interface GetActiveRunsOptions {
|
|
379
|
+
roomId?: string;
|
|
380
|
+
}
|
|
381
|
+
interface ExecuteScopedRecipeOptions {
|
|
382
|
+
roomId?: string;
|
|
383
|
+
}
|
|
384
|
+
interface GetAvailableRecipesOptions {
|
|
385
|
+
roomId?: string;
|
|
386
|
+
includeActorRecipes?: boolean;
|
|
387
|
+
}
|
|
388
|
+
interface Recipe {
|
|
389
|
+
recipeId: string;
|
|
390
|
+
entity?: string;
|
|
391
|
+
batchAmount?: number;
|
|
392
|
+
}
|
|
393
|
+
interface TriggerRecipeChainOptions {
|
|
394
|
+
roomId?: string;
|
|
395
|
+
context?: any;
|
|
396
|
+
}
|
|
397
|
+
interface CollectRecipeResult {
|
|
398
|
+
success: boolean;
|
|
399
|
+
runId: string;
|
|
400
|
+
rewards: any;
|
|
401
|
+
message: string;
|
|
402
|
+
}
|
|
403
|
+
interface ExecuteScopedRecipeResult {
|
|
404
|
+
success: boolean;
|
|
405
|
+
message: string;
|
|
406
|
+
}
|
|
407
|
+
interface RecipeInfo {
|
|
408
|
+
id: string;
|
|
409
|
+
scope: string;
|
|
410
|
+
clientViewable: boolean;
|
|
411
|
+
}
|
|
412
|
+
interface GetAvailableRecipesResult {
|
|
413
|
+
success: boolean;
|
|
414
|
+
recipes: RecipeInfo[];
|
|
415
|
+
}
|
|
416
|
+
interface GetBatchRecipeRequirements {
|
|
417
|
+
success: boolean;
|
|
418
|
+
results: RecipeRequirementResult[];
|
|
419
|
+
}
|
|
420
|
+
interface SimulationApi {
|
|
421
|
+
getStateAsync(roomId?: string): Promise<any>;
|
|
422
|
+
getConfigAsync(roomId?: string): Promise<VenusSimulationConfig>;
|
|
423
|
+
executeRecipeAsync(recipeId: string, inputs?: any, options?: ExecuteRecipeOptions): Promise<any>;
|
|
424
|
+
getActiveRunsAsync(options?: GetActiveRunsOptions): Promise<any>;
|
|
425
|
+
collectRecipeAsync(runId: string): Promise<CollectRecipeResult>;
|
|
426
|
+
executeScopedRecipeAsync(recipeId: string, entity: string, inputs?: any, options?: ExecuteScopedRecipeOptions | any): Promise<ExecuteScopedRecipeResult>;
|
|
427
|
+
triggerRecipeChainAsync(recipeId: string, options?: TriggerRecipeChainOptions): Promise<any>;
|
|
428
|
+
getAvailableRecipesAsync(options?: GetAvailableRecipesOptions): Promise<GetAvailableRecipesResult>;
|
|
429
|
+
getRecipeRequirementsAsync(recipe: Recipe): Promise<RecipeRequirementResult>;
|
|
430
|
+
getBatchRecipeRequirementsAsync(recipes: Recipe[]): Promise<GetBatchRecipeRequirements>;
|
|
431
|
+
resolveFieldValueAsync(entityId: string, fieldPath: string, entity?: string): Promise<any>;
|
|
432
|
+
getEntityMetadataAsync(entityId: string): Promise<any>;
|
|
433
|
+
getSlotContainersAsync(): Promise<any>;
|
|
434
|
+
getSlotAssignmentsAsync(containerId: string): Promise<any>;
|
|
435
|
+
assignItemToSlotAsync(containerId: string, slotId: string, itemId: string): Promise<any>;
|
|
436
|
+
removeItemFromSlotAsync(containerId: string, slotId: string): Promise<any>;
|
|
437
|
+
getAvailableItemsAsync(containerId: string, slotId: string): Promise<Array<any>>;
|
|
438
|
+
calculatePowerPreviewAsync(containerId: string, slotId: string, candidateItemId: string): Promise<any>;
|
|
439
|
+
validateSlotAssignmentAsync(containerId: string, slotId: string, itemId: string): Promise<any>;
|
|
440
|
+
executeBatchOperationsAsync(operations: Array<any>, validateOnly?: boolean): Promise<any>;
|
|
441
|
+
sumContributions(contributions: Record<string, any>): Record<string, number>;
|
|
273
442
|
}
|
|
274
443
|
|
|
275
444
|
interface VenusMessage {
|
|
@@ -385,6 +554,63 @@ declare class VenusRoom {
|
|
|
385
554
|
private updateFromRoomData;
|
|
386
555
|
}
|
|
387
556
|
|
|
557
|
+
interface CreateRoomOptions {
|
|
558
|
+
maxPlayers?: number;
|
|
559
|
+
gameType?: string;
|
|
560
|
+
isPrivate?: boolean;
|
|
561
|
+
roomCode?: string;
|
|
562
|
+
name?: string;
|
|
563
|
+
description?: string;
|
|
564
|
+
customMetadata?: Record<string, any>;
|
|
565
|
+
}
|
|
566
|
+
interface JoinOrCreateResult {
|
|
567
|
+
action: 'created' | 'joined';
|
|
568
|
+
room: VenusRoom;
|
|
569
|
+
playersJoined: number;
|
|
570
|
+
}
|
|
571
|
+
interface RoomSubscriptionOptions {
|
|
572
|
+
onData?: (roomData: any) => void;
|
|
573
|
+
onMessages?: (messagePayload: any) => void;
|
|
574
|
+
onMoves?: (movePayload: any) => void;
|
|
575
|
+
onGameEvents?: (eventPayload: any) => void;
|
|
576
|
+
}
|
|
577
|
+
interface ProposeMovePayload {
|
|
578
|
+
gameSpecificState: any;
|
|
579
|
+
moveType: string;
|
|
580
|
+
clientContext?: Record<string, any>;
|
|
581
|
+
clientProposalId?: string;
|
|
582
|
+
}
|
|
583
|
+
interface ProposeMoveResult {
|
|
584
|
+
proposedMoveId: string;
|
|
585
|
+
}
|
|
586
|
+
interface ValidateMoveResult {
|
|
587
|
+
success: boolean;
|
|
588
|
+
moveId: string;
|
|
589
|
+
isValid: boolean;
|
|
590
|
+
reason?: string | null;
|
|
591
|
+
}
|
|
592
|
+
interface RoomsApi {
|
|
593
|
+
createRoom(options: CreateRoomOptions): Promise<VenusRoom>;
|
|
594
|
+
joinOrCreateRoom(options: CreateRoomOptions): Promise<JoinOrCreateResult>;
|
|
595
|
+
joinRoomByCode?(roomCode: string): Promise<VenusRoom>;
|
|
596
|
+
getUserRooms?(includeArchived?: boolean): Promise<VenusRoom[]>;
|
|
597
|
+
subscribe?(room: VenusRoom, options: RoomSubscriptionOptions): (() => void) | {
|
|
598
|
+
unsubscribe(): void;
|
|
599
|
+
};
|
|
600
|
+
updateData?(room: VenusRoom, updates: Record<string, any>, merge?: boolean): Promise<any>;
|
|
601
|
+
getData?(room: VenusRoom): Promise<any>;
|
|
602
|
+
sendMessage?(room: VenusRoom, messageData: any): Promise<string>;
|
|
603
|
+
leave?(room: VenusRoom): Promise<any>;
|
|
604
|
+
startGame?(room: VenusRoom, gameConfig?: Record<string, any>, turnOrder?: string[] | null): Promise<any>;
|
|
605
|
+
proposeMove?(room: VenusRoom, proposalPayload: ProposeMovePayload): Promise<ProposeMoveResult>;
|
|
606
|
+
validateMove?(room: VenusRoom, moveId: string, isValid: boolean, reason?: string | null, validatorId?: string | null): Promise<ValidateMoveResult>;
|
|
607
|
+
}
|
|
608
|
+
|
|
609
|
+
interface LoggingApi {
|
|
610
|
+
logDebug(message: string, ...args: any[]): void;
|
|
611
|
+
logError(message: string, ...args: any[]): void;
|
|
612
|
+
}
|
|
613
|
+
|
|
388
614
|
interface SharedAssetsApi {
|
|
389
615
|
loadCharactersBundle(): Promise<ArrayBuffer>;
|
|
390
616
|
loadBurgerTimeAssetsBundle(): Promise<ArrayBuffer>;
|
|
@@ -414,6 +640,133 @@ interface IapApi {
|
|
|
414
640
|
getCurrencyIcon(): Promise<LoadEmbeddedAssetsResponse>;
|
|
415
641
|
}
|
|
416
642
|
|
|
643
|
+
interface LeaderboardModeConfig {
|
|
644
|
+
displayName: string;
|
|
645
|
+
minDurationSec?: number;
|
|
646
|
+
maxDurationSec?: number;
|
|
647
|
+
minScore?: number;
|
|
648
|
+
maxScore?: number;
|
|
649
|
+
}
|
|
650
|
+
type LeaderboardPeriodType = 'daily' | 'weekly' | 'monthly' | 'alltime';
|
|
651
|
+
interface LeaderboardPeriodConfig {
|
|
652
|
+
displayName: string;
|
|
653
|
+
type: LeaderboardPeriodType;
|
|
654
|
+
}
|
|
655
|
+
interface LeaderboardAntiCheatConfig {
|
|
656
|
+
enableZScoreDetection: boolean;
|
|
657
|
+
zScoreThreshold: number;
|
|
658
|
+
enableRateLimit: boolean;
|
|
659
|
+
minTimeBetweenSubmissionsSec: number;
|
|
660
|
+
trustScoreDecayPerFlag: number;
|
|
661
|
+
shadowBanThreshold: number;
|
|
662
|
+
}
|
|
663
|
+
interface LeaderboardDisplaySettings {
|
|
664
|
+
maxEntriesPerPage: number;
|
|
665
|
+
}
|
|
666
|
+
interface LeaderboardConfig {
|
|
667
|
+
minDurationSec: number;
|
|
668
|
+
maxDurationSec: number;
|
|
669
|
+
minScore: number;
|
|
670
|
+
maxScore: number;
|
|
671
|
+
requiresHash: boolean;
|
|
672
|
+
scoringFields: string[];
|
|
673
|
+
modes: Record<string, LeaderboardModeConfig>;
|
|
674
|
+
periods: Record<string, LeaderboardPeriodConfig>;
|
|
675
|
+
antiCheat: LeaderboardAntiCheatConfig;
|
|
676
|
+
displaySettings: LeaderboardDisplaySettings;
|
|
677
|
+
}
|
|
678
|
+
interface StartRunResult {
|
|
679
|
+
sessionId: string;
|
|
680
|
+
startTime: number;
|
|
681
|
+
expiresAt: number;
|
|
682
|
+
hashNonce?: string | null;
|
|
683
|
+
mode: string;
|
|
684
|
+
}
|
|
685
|
+
interface SubmitScoreOptions {
|
|
686
|
+
mode?: string;
|
|
687
|
+
telemetry?: Record<string, any>;
|
|
688
|
+
metadata?: Record<string, any>;
|
|
689
|
+
hash?: string;
|
|
690
|
+
}
|
|
691
|
+
interface SubmitScoreResult {
|
|
692
|
+
accepted: boolean;
|
|
693
|
+
rank?: number | null;
|
|
694
|
+
zScore?: number | null;
|
|
695
|
+
isAnomaly?: boolean;
|
|
696
|
+
}
|
|
697
|
+
interface GetLeaderboardOptions {
|
|
698
|
+
mode?: string;
|
|
699
|
+
period?: string;
|
|
700
|
+
periodDate?: number | string;
|
|
701
|
+
cursor?: string | null;
|
|
702
|
+
limit?: number;
|
|
703
|
+
variant?: 'standard' | 'highlight';
|
|
704
|
+
topCount?: number;
|
|
705
|
+
contextAhead?: number;
|
|
706
|
+
contextBehind?: number;
|
|
707
|
+
}
|
|
708
|
+
interface LeaderboardEntry {
|
|
709
|
+
profileId: string;
|
|
710
|
+
username: string;
|
|
711
|
+
avatarUrl: string | null;
|
|
712
|
+
score: number;
|
|
713
|
+
durationSec: number;
|
|
714
|
+
submittedAt: number;
|
|
715
|
+
sessionId?: string;
|
|
716
|
+
rank: number | null;
|
|
717
|
+
zScore?: number | null;
|
|
718
|
+
isAnomaly?: boolean;
|
|
719
|
+
trustScore?: number | null;
|
|
720
|
+
isShadowBanned?: boolean;
|
|
721
|
+
expiresAt?: number | null;
|
|
722
|
+
metadata?: Record<string, any> | null;
|
|
723
|
+
isSeed?: boolean;
|
|
724
|
+
}
|
|
725
|
+
interface LeaderboardResponse {
|
|
726
|
+
variant: 'standard' | 'highlight';
|
|
727
|
+
entries: LeaderboardEntry[];
|
|
728
|
+
totalEntries: number;
|
|
729
|
+
nextCursor?: string | null;
|
|
730
|
+
playerRank: number | null;
|
|
731
|
+
periodInstance: string;
|
|
732
|
+
}
|
|
733
|
+
interface PlayerStatsOptions {
|
|
734
|
+
mode?: string;
|
|
735
|
+
period?: string;
|
|
736
|
+
periodDate?: number | string;
|
|
737
|
+
}
|
|
738
|
+
interface PlayerStats {
|
|
739
|
+
rank: number | null;
|
|
740
|
+
score?: number;
|
|
741
|
+
totalPlayers: number;
|
|
742
|
+
percentile?: number;
|
|
743
|
+
trustScore: number;
|
|
744
|
+
periodInstance: string;
|
|
745
|
+
}
|
|
746
|
+
interface LeaderboardHighlightContext {
|
|
747
|
+
topEntries: LeaderboardEntry[];
|
|
748
|
+
beforePlayer: LeaderboardEntry[];
|
|
749
|
+
playerEntry?: LeaderboardEntry | null;
|
|
750
|
+
afterPlayer: LeaderboardEntry[];
|
|
751
|
+
totalBefore: number;
|
|
752
|
+
totalAfter: number;
|
|
753
|
+
omittedBefore: number;
|
|
754
|
+
omittedAfter: number;
|
|
755
|
+
}
|
|
756
|
+
interface LeaderboardHighlightResponse extends LeaderboardResponse {
|
|
757
|
+
variant: 'highlight';
|
|
758
|
+
context: LeaderboardHighlightContext;
|
|
759
|
+
}
|
|
760
|
+
interface LeaderboardHighlightOptions extends Omit<GetLeaderboardOptions, 'variant'> {
|
|
761
|
+
}
|
|
762
|
+
interface LeaderboardApi {
|
|
763
|
+
startRun(mode?: string): Promise<StartRunResult>;
|
|
764
|
+
submitScore(sessionId: string, score: number, durationSec: number, options?: SubmitScoreOptions): Promise<SubmitScoreResult>;
|
|
765
|
+
getLeaderboard(options?: GetLeaderboardOptions): Promise<LeaderboardResponse>;
|
|
766
|
+
getPlayerStats(options?: PlayerStatsOptions): Promise<PlayerStats>;
|
|
767
|
+
getLeaderboardHighlight(options?: LeaderboardHighlightOptions): Promise<LeaderboardHighlightResponse>;
|
|
768
|
+
}
|
|
769
|
+
|
|
417
770
|
interface PreloaderApi {
|
|
418
771
|
showLoadScreen(): Promise<void>;
|
|
419
772
|
hideLoadScreen(): Promise<void>;
|
|
@@ -421,6 +774,121 @@ interface PreloaderApi {
|
|
|
421
774
|
setLoaderProgress(progress: number): Promise<void>;
|
|
422
775
|
}
|
|
423
776
|
|
|
777
|
+
/**
|
|
778
|
+
* OpenGraph metadata for rich social previews.
|
|
779
|
+
*
|
|
780
|
+
* H5 games provide these values so social networks can render rich cards when
|
|
781
|
+
* a share link is posted.
|
|
782
|
+
*/
|
|
783
|
+
interface ShareMetadata {
|
|
784
|
+
/** Preview title shown in link cards (e.g. Twitter, iMessage). */
|
|
785
|
+
title?: string;
|
|
786
|
+
/** Preview description shown under the title. */
|
|
787
|
+
description?: string;
|
|
788
|
+
/** Preview image URL (must be HTTPS for most social platforms). */
|
|
789
|
+
imageUrl?: string;
|
|
790
|
+
}
|
|
791
|
+
interface SocialQRCodeOptions {
|
|
792
|
+
/** Size of the QR code image in pixels. */
|
|
793
|
+
size?: number;
|
|
794
|
+
/** Margin around the QR code in pixels. */
|
|
795
|
+
margin?: number;
|
|
796
|
+
/** Output format for the rendered QR code. */
|
|
797
|
+
format?: 'png' | 'svg';
|
|
798
|
+
}
|
|
799
|
+
interface ShareLinkResult {
|
|
800
|
+
shareUrl: string;
|
|
801
|
+
}
|
|
802
|
+
interface QRCodeResult {
|
|
803
|
+
shareUrl: string;
|
|
804
|
+
qrCode: string;
|
|
805
|
+
}
|
|
806
|
+
/**
|
|
807
|
+
* Social distribution API used by H5 games.
|
|
808
|
+
*
|
|
809
|
+
* This unified API powers both share links and QR codes, backed by a single
|
|
810
|
+
* Firestore document that stores arbitrary launch parameters supplied by the
|
|
811
|
+
* game.
|
|
812
|
+
*/
|
|
813
|
+
interface SocialApi {
|
|
814
|
+
/**
|
|
815
|
+
* Create a share link and invoke the host platform's native share UX.
|
|
816
|
+
*
|
|
817
|
+
* Platform behaviour:
|
|
818
|
+
* - iOS / Android: opens the native share sheet.
|
|
819
|
+
* - Web: copies the generated URL to the clipboard (with fallback toast).
|
|
820
|
+
*
|
|
821
|
+
* @param options.launchParams Arbitrary launch parameters (must include gameId).
|
|
822
|
+
* @param options.metadata Optional OpenGraph metadata for rich previews.
|
|
823
|
+
* @returns The generated share URL.
|
|
824
|
+
*/
|
|
825
|
+
shareLinkAsync(options: {
|
|
826
|
+
launchParams: Record<string, string>;
|
|
827
|
+
metadata?: ShareMetadata;
|
|
828
|
+
}): Promise<ShareLinkResult>;
|
|
829
|
+
/**
|
|
830
|
+
* Create a share document and return both the URL and a QR code image.
|
|
831
|
+
*
|
|
832
|
+
* Games can render or print the returned QR image or re-use the share URL.
|
|
833
|
+
*
|
|
834
|
+
* @param options.launchParams Arbitrary launch parameters (must include gameId).
|
|
835
|
+
* @param options.metadata Optional OpenGraph metadata for the share.
|
|
836
|
+
* @param options.qrOptions Customisation for the generated QR code.
|
|
837
|
+
* @returns The generated share URL and QR code (as a data URL).
|
|
838
|
+
*/
|
|
839
|
+
createQRCodeAsync(options: {
|
|
840
|
+
launchParams: Record<string, string>;
|
|
841
|
+
metadata?: ShareMetadata;
|
|
842
|
+
qrOptions?: SocialQRCodeOptions;
|
|
843
|
+
}): Promise<QRCodeResult>;
|
|
844
|
+
}
|
|
845
|
+
|
|
846
|
+
interface HudInsets {
|
|
847
|
+
left: number;
|
|
848
|
+
top: number;
|
|
849
|
+
right: number;
|
|
850
|
+
bottom: number;
|
|
851
|
+
}
|
|
852
|
+
interface InitializationOptions {
|
|
853
|
+
helpText?: string;
|
|
854
|
+
hardDisableMock?: boolean;
|
|
855
|
+
mock?: Record<string, any>;
|
|
856
|
+
usePreloader?: boolean;
|
|
857
|
+
}
|
|
858
|
+
interface InitializationContext {
|
|
859
|
+
hudInsets?: HudInsets;
|
|
860
|
+
initializeAsleep: boolean;
|
|
861
|
+
}
|
|
862
|
+
interface Host {
|
|
863
|
+
readonly ads: AdsApi;
|
|
864
|
+
readonly analytics: AnalyticsApi;
|
|
865
|
+
readonly deviceCache: StorageApi;
|
|
866
|
+
readonly appStorage: StorageApi;
|
|
867
|
+
readonly globalStorage: StorageApi;
|
|
868
|
+
readonly avatar3d: Avatar3dApi;
|
|
869
|
+
readonly navigation: NavigationApi;
|
|
870
|
+
readonly notifications: NotificationsApi;
|
|
871
|
+
readonly popups: PopupsApi;
|
|
872
|
+
readonly profile: ProfileApi;
|
|
873
|
+
readonly cdn: CdnApi;
|
|
874
|
+
readonly time: TimeApi;
|
|
875
|
+
readonly post: PostApi;
|
|
876
|
+
readonly ai: AiApi;
|
|
877
|
+
readonly haptics: HapticsApi;
|
|
878
|
+
readonly features: FeaturesApi;
|
|
879
|
+
readonly lifecycle: LifecycleApi;
|
|
880
|
+
readonly simulation: SimulationApi;
|
|
881
|
+
readonly rooms: RoomsApi;
|
|
882
|
+
readonly logging: LoggingApi;
|
|
883
|
+
readonly leaderboard: LeaderboardApi;
|
|
884
|
+
readonly preloader: PreloaderApi;
|
|
885
|
+
readonly social: SocialApi;
|
|
886
|
+
readonly isInitialized: boolean;
|
|
887
|
+
readonly iap: IapApi;
|
|
888
|
+
initialize(options?: InitializationOptions): Promise<InitializationContext>;
|
|
889
|
+
}
|
|
890
|
+
declare function createHost(venusApi: VenusAPI, isMock: boolean): Host;
|
|
891
|
+
|
|
424
892
|
interface Avatar3dConfig {
|
|
425
893
|
headAsset: string | null;
|
|
426
894
|
outfitAsset: string | null;
|
|
@@ -686,18 +1154,15 @@ interface Profile {
|
|
|
686
1154
|
}
|
|
687
1155
|
interface VenusAPI {
|
|
688
1156
|
config: VenusConfig;
|
|
1157
|
+
launchParams: Record<string, string>;
|
|
689
1158
|
_mock: any;
|
|
690
1159
|
_bootstrap: {
|
|
691
1160
|
apiInjected: boolean;
|
|
692
1161
|
venus: any;
|
|
693
1162
|
};
|
|
694
|
-
initializeAsync(options?:
|
|
695
|
-
helpText?: string;
|
|
696
|
-
hardDisableMock?: boolean;
|
|
697
|
-
mock?: Record<string, any>;
|
|
698
|
-
usePreloader?: boolean;
|
|
699
|
-
}): Promise<boolean>;
|
|
1163
|
+
initializeAsync(options?: InitializationOptions): Promise<InitializationContext>;
|
|
700
1164
|
simulation: VenusSimulationAPI;
|
|
1165
|
+
leaderboard: LeaderboardApi;
|
|
701
1166
|
log(message: string, ...args: any[]): void;
|
|
702
1167
|
error(message: string, ...args: any[]): void;
|
|
703
1168
|
isAvailable(): boolean;
|
|
@@ -722,6 +1187,7 @@ interface VenusAPI {
|
|
|
722
1187
|
gateName: string;
|
|
723
1188
|
}): Promise<any>;
|
|
724
1189
|
getCurrentProfile(): Profile;
|
|
1190
|
+
getLaunchParams(): Record<string, string>;
|
|
725
1191
|
/**
|
|
726
1192
|
* @deprecated Please use the popups API. (e.g, VenusAPI.popups)
|
|
727
1193
|
*/
|
|
@@ -791,24 +1257,12 @@ interface VenusAPI {
|
|
|
791
1257
|
length(): Promise<number>;
|
|
792
1258
|
key(index: number): Promise<string | null>;
|
|
793
1259
|
};
|
|
794
|
-
onShow(handler: (context?: ShowContext) => void): void;
|
|
795
|
-
onPlay(handler: (context?: PlayContext) => void): void;
|
|
796
|
-
onPause(handler: () => void): void;
|
|
797
|
-
onResume(handler: () => void): void;
|
|
798
|
-
onQuit(handler: () => void): void;
|
|
799
|
-
onHide(handler: (context?: any) => void): void;
|
|
800
|
-
onCleanup(handler: () => void): void;
|
|
801
1260
|
requestPopOrQuit(options?: QuitOptions): Promise<boolean>;
|
|
802
1261
|
getPostInteractionsAsync(): Promise<any>;
|
|
803
1262
|
getPostInteractions(): Promise<any>;
|
|
804
1263
|
toggleLikeAsync(): Promise<any>;
|
|
805
1264
|
toggleFollowAsync(): Promise<any>;
|
|
806
1265
|
openCommentsAsync(options?: any): Promise<void>;
|
|
807
|
-
sharePostAsync(options: {
|
|
808
|
-
message: string;
|
|
809
|
-
title?: string;
|
|
810
|
-
additionalInfo?: any;
|
|
811
|
-
}): Promise<void>;
|
|
812
1266
|
/**
|
|
813
1267
|
* @deprecated Please use the ads API. (e.g, VenusAPI.ads)
|
|
814
1268
|
*/
|
|
@@ -934,12 +1388,22 @@ interface VenusAPI {
|
|
|
934
1388
|
sharedAssets: SharedAssetsApi;
|
|
935
1389
|
preloader: PreloaderApi;
|
|
936
1390
|
notifications: NotificationsApi;
|
|
1391
|
+
lifecycles: LifecycleApi;
|
|
1392
|
+
social: SocialApi;
|
|
937
1393
|
}
|
|
938
1394
|
|
|
1395
|
+
interface ShowInterstitialAdOptions {
|
|
1396
|
+
adDisplayId?: string;
|
|
1397
|
+
adDisplayName?: string;
|
|
1398
|
+
}
|
|
1399
|
+
interface ShowRewardedAdOptions {
|
|
1400
|
+
adDisplayId?: string;
|
|
1401
|
+
adDisplayName?: string;
|
|
1402
|
+
}
|
|
939
1403
|
interface AdsApi {
|
|
940
1404
|
isRewardedAdReadyAsync(): Promise<boolean>;
|
|
941
|
-
showRewardedAdAsync(): Promise<boolean>;
|
|
942
|
-
showInterstitialAd(): Promise<boolean>;
|
|
1405
|
+
showRewardedAdAsync(options?: ShowRewardedAdOptions): Promise<boolean>;
|
|
1406
|
+
showInterstitialAd(options?: ShowInterstitialAdOptions): Promise<boolean>;
|
|
943
1407
|
}
|
|
944
1408
|
|
|
945
|
-
export { type
|
|
1409
|
+
export { type Recipe as $, type AnalyticsApi as A, type Subscription as B, type CdnApi as C, type AwakeCallback as D, type Experiment as E, type FetchBlobOptions as F, type GetFutureTimeOptions as G, type Host as H, type PauseCallback as I, type ResumeCallback as J, type QuitCallback as K, type LifecycleApi as L, type SimulationApi as M, type NavigationApi as N, type VenusSimulationConfig as O, type PushAppOptions as P, type QuitOptions as Q, type RpcRequest as R, type StorageApi as S, type TimeApi as T, type ExecuteRecipeOptions as U, type VenusAPI as V, type CollectRecipeResult as W, type GetActiveRunsOptions as X, type ExecuteScopedRecipeResult as Y, type GetAvailableRecipesOptions as Z, type GetAvailableRecipesResult as _, type RpcResponse as a, type LeaderboardEntry as a$, type GetBatchRecipeRequirements as a0, type TriggerRecipeChainOptions as a1, type RecipeRequirementResult as a2, VenusTransport as a3, type LoggingApi as a4, type IapApi as a5, type SpendCurrencyOptions as a6, type LoadEmbeddedAssetsResponse as a7, type SharedAssetsApi as a8, type LeaderboardApi as a9, type AiMessage as aA, type Asset as aB, type Category as aC, MockAvatarApi as aD, type TimeIntervalTriggerInput as aE, type NotificationTriggerInput as aF, type OnRequestCallback as aG, type OnResponseCallback as aH, type OnNotificationCallback as aI, type RpcTransport as aJ, VenusRoom as aK, type CreateRoomOptions as aL, type JoinOrCreateResult as aM, type RoomSubscriptionOptions as aN, type ProposeMovePayload as aO, type ProposeMoveResult as aP, type ValidateMoveResult as aQ, type ExecuteScopedRecipeOptions as aR, type RecipeInfo as aS, RpcSharedAssetsApi as aT, type LoadEmbeddedAssetsRequest as aU, type LeaderboardModeConfig as aV, type LeaderboardPeriodType as aW, type LeaderboardPeriodConfig as aX, type LeaderboardAntiCheatConfig as aY, type LeaderboardDisplaySettings as aZ, type LeaderboardConfig as a_, type StartRunResult as aa, type SubmitScoreOptions as ab, type SubmitScoreResult as ac, type GetLeaderboardOptions as ad, type LeaderboardResponse as ae, type PlayerStatsOptions as af, type PlayerStats as ag, type LeaderboardHighlightOptions as ah, type LeaderboardHighlightResponse as ai, type PreloaderApi as aj, type SocialApi as ak, type ShareMetadata as al, type ShareLinkResult as am, type SocialQRCodeOptions as an, type QRCodeResult as ao, type Avatar3dApi as ap, type AssetManifest as aq, type Avatar3dConfig as ar, type ShowEditorOptions as as, type Avatar3dEdits as at, type AdsApi as au, type PostApi as av, type RoomsApi as aw, type InitializationOptions as ax, type InitializationContext as ay, type HudInsets as az, type RpcNotification as b, type LeaderboardHighlightContext as b0, createHost as b1, type VenusSimulationState as b2, type VenusSimulationEffect as b3, type VenusSimulationRecipe as b4, type RecipeRequirementQuery as b5, type BatchRecipeRequirementsResult as b6, type VenusSimulationAPI as b7, type VenusConfig as b8, type VenusRoomsConfig as b9, type ActionSheetOption as ba, RpcClient as c, type NavigationStackInfo as d, type NotificationsApi as e, type ScheduleLocalNotification as f, type ScheduleNotificationOptions as g, type PopupsApi as h, type ActionSheetItem as i, type ShowActionSheetOptions as j, type ShowAlertOptions as k, type ShowConfirmOptions as l, type ShowToastOptions as m, type ShowInterstitialAdOptions as n, type ShowRewardedAdOptions as o, type ProfileApi as p, type Profile as q, type SubPath as r, type ServerTimeData as s, type AiApi as t, type AiChatCompletionRequest as u, type AiChatCompletionData as v, type HapticsApi as w, HapticFeedbackStyle as x, type FeaturesApi as y, type SleepCallback as z };
|