@series-inc/venus-sdk 2.6.2 → 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +131 -95
- package/dist/{AdsApi-C_GcWmfO.d.mts → AdsApi-3DEYUUuj.d.mts} +529 -60
- package/dist/{AdsApi-C_GcWmfO.d.ts → AdsApi-3DEYUUuj.d.ts} +529 -60
- package/dist/{chunk-YDXFZ2A2.mjs → chunk-6DYG4RFQ.mjs} +1725 -106
- package/dist/chunk-6DYG4RFQ.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 +511 -306
- 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 +12 -1422
- 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,126 @@ 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 InitializeOptions {
|
|
847
|
+
usePreloader?: boolean;
|
|
848
|
+
mock?: Record<string, any>;
|
|
849
|
+
[key: string]: any;
|
|
850
|
+
}
|
|
851
|
+
interface HudInsets {
|
|
852
|
+
left: number;
|
|
853
|
+
top: number;
|
|
854
|
+
right: number;
|
|
855
|
+
bottom: number;
|
|
856
|
+
}
|
|
857
|
+
interface InitializationOptions {
|
|
858
|
+
helpText?: string;
|
|
859
|
+
hardDisableMock?: boolean;
|
|
860
|
+
mock?: Record<string, any>;
|
|
861
|
+
usePreloader?: boolean;
|
|
862
|
+
}
|
|
863
|
+
interface InitializationContext {
|
|
864
|
+
hudInsets?: HudInsets;
|
|
865
|
+
initializeAsleep: boolean;
|
|
866
|
+
}
|
|
867
|
+
interface Host {
|
|
868
|
+
readonly ads: AdsApi;
|
|
869
|
+
readonly analytics: AnalyticsApi;
|
|
870
|
+
readonly deviceCache: StorageApi;
|
|
871
|
+
readonly appStorage: StorageApi;
|
|
872
|
+
readonly globalStorage: StorageApi;
|
|
873
|
+
readonly avatar3d: Avatar3dApi;
|
|
874
|
+
readonly navigation: NavigationApi;
|
|
875
|
+
readonly notifications: NotificationsApi;
|
|
876
|
+
readonly popups: PopupsApi;
|
|
877
|
+
readonly profile: ProfileApi;
|
|
878
|
+
readonly cdn: CdnApi;
|
|
879
|
+
readonly time: TimeApi;
|
|
880
|
+
readonly post: PostApi;
|
|
881
|
+
readonly ai: AiApi;
|
|
882
|
+
readonly haptics: HapticsApi;
|
|
883
|
+
readonly features: FeaturesApi;
|
|
884
|
+
readonly lifecycle: LifecycleApi;
|
|
885
|
+
readonly simulation: SimulationApi;
|
|
886
|
+
readonly rooms: RoomsApi;
|
|
887
|
+
readonly logging: LoggingApi;
|
|
888
|
+
readonly leaderboard: LeaderboardApi;
|
|
889
|
+
readonly preloader: PreloaderApi;
|
|
890
|
+
readonly social: SocialApi;
|
|
891
|
+
readonly isInitialized: boolean;
|
|
892
|
+
readonly iap: IapApi;
|
|
893
|
+
initialize(options?: InitializationOptions): Promise<InitializationContext>;
|
|
894
|
+
}
|
|
895
|
+
declare function createHost(venusApi: VenusAPI, isMock: boolean): Host;
|
|
896
|
+
|
|
424
897
|
interface Avatar3dConfig {
|
|
425
898
|
headAsset: string | null;
|
|
426
899
|
outfitAsset: string | null;
|
|
@@ -686,18 +1159,15 @@ interface Profile {
|
|
|
686
1159
|
}
|
|
687
1160
|
interface VenusAPI {
|
|
688
1161
|
config: VenusConfig;
|
|
1162
|
+
launchParams: Record<string, string>;
|
|
689
1163
|
_mock: any;
|
|
690
1164
|
_bootstrap: {
|
|
691
1165
|
apiInjected: boolean;
|
|
692
1166
|
venus: any;
|
|
693
1167
|
};
|
|
694
|
-
initializeAsync(options?:
|
|
695
|
-
helpText?: string;
|
|
696
|
-
hardDisableMock?: boolean;
|
|
697
|
-
mock?: Record<string, any>;
|
|
698
|
-
usePreloader?: boolean;
|
|
699
|
-
}): Promise<boolean>;
|
|
1168
|
+
initializeAsync(options?: InitializationOptions): Promise<InitializationContext>;
|
|
700
1169
|
simulation: VenusSimulationAPI;
|
|
1170
|
+
leaderboard: LeaderboardApi;
|
|
701
1171
|
log(message: string, ...args: any[]): void;
|
|
702
1172
|
error(message: string, ...args: any[]): void;
|
|
703
1173
|
isAvailable(): boolean;
|
|
@@ -722,6 +1192,7 @@ interface VenusAPI {
|
|
|
722
1192
|
gateName: string;
|
|
723
1193
|
}): Promise<any>;
|
|
724
1194
|
getCurrentProfile(): Profile;
|
|
1195
|
+
getLaunchParams(): Record<string, string>;
|
|
725
1196
|
/**
|
|
726
1197
|
* @deprecated Please use the popups API. (e.g, VenusAPI.popups)
|
|
727
1198
|
*/
|
|
@@ -791,24 +1262,12 @@ interface VenusAPI {
|
|
|
791
1262
|
length(): Promise<number>;
|
|
792
1263
|
key(index: number): Promise<string | null>;
|
|
793
1264
|
};
|
|
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
1265
|
requestPopOrQuit(options?: QuitOptions): Promise<boolean>;
|
|
802
1266
|
getPostInteractionsAsync(): Promise<any>;
|
|
803
1267
|
getPostInteractions(): Promise<any>;
|
|
804
1268
|
toggleLikeAsync(): Promise<any>;
|
|
805
1269
|
toggleFollowAsync(): Promise<any>;
|
|
806
1270
|
openCommentsAsync(options?: any): Promise<void>;
|
|
807
|
-
sharePostAsync(options: {
|
|
808
|
-
message: string;
|
|
809
|
-
title?: string;
|
|
810
|
-
additionalInfo?: any;
|
|
811
|
-
}): Promise<void>;
|
|
812
1271
|
/**
|
|
813
1272
|
* @deprecated Please use the ads API. (e.g, VenusAPI.ads)
|
|
814
1273
|
*/
|
|
@@ -934,12 +1393,22 @@ interface VenusAPI {
|
|
|
934
1393
|
sharedAssets: SharedAssetsApi;
|
|
935
1394
|
preloader: PreloaderApi;
|
|
936
1395
|
notifications: NotificationsApi;
|
|
1396
|
+
lifecycles: LifecycleApi;
|
|
1397
|
+
social: SocialApi;
|
|
937
1398
|
}
|
|
938
1399
|
|
|
1400
|
+
interface ShowInterstitialAdOptions {
|
|
1401
|
+
adDisplayId?: string;
|
|
1402
|
+
adDisplayName?: string;
|
|
1403
|
+
}
|
|
1404
|
+
interface ShowRewardedAdOptions {
|
|
1405
|
+
adDisplayId?: string;
|
|
1406
|
+
adDisplayName?: string;
|
|
1407
|
+
}
|
|
939
1408
|
interface AdsApi {
|
|
940
1409
|
isRewardedAdReadyAsync(): Promise<boolean>;
|
|
941
|
-
showRewardedAdAsync(): Promise<boolean>;
|
|
942
|
-
showInterstitialAd(): Promise<boolean>;
|
|
1410
|
+
showRewardedAdAsync(options?: ShowRewardedAdOptions): Promise<boolean>;
|
|
1411
|
+
showInterstitialAd(options?: ShowInterstitialAdOptions): Promise<boolean>;
|
|
943
1412
|
}
|
|
944
1413
|
|
|
945
|
-
export { type
|
|
1414
|
+
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 Avatar3dApi as ak, type AssetManifest as al, type Avatar3dConfig as am, type ShowEditorOptions as an, type Avatar3dEdits as ao, type SocialApi as ap, type ShareMetadata as aq, type ShareLinkResult as ar, type SocialQRCodeOptions as as, type QRCodeResult 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, type InitializeOptions as b1, createHost as b2, type VenusSimulationState as b3, type VenusSimulationEffect as b4, type VenusSimulationRecipe as b5, type RecipeRequirementQuery as b6, type BatchRecipeRequirementsResult as b7, type VenusSimulationAPI as b8, type VenusConfig as b9, type VenusRoomsConfig as ba, type ActionSheetOption as bb, 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 };
|