@series-inc/venus-sdk 2.4.1 → 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 +345 -249
- package/dist/AdsApi-3DEYUUuj.d.mts +1414 -0
- package/dist/AdsApi-3DEYUUuj.d.ts +1414 -0
- package/dist/{chunk-KQZIPQLJ.mjs → chunk-6DYG4RFQ.mjs} +2066 -133
- package/dist/chunk-6DYG4RFQ.mjs.map +1 -0
- package/dist/{chunk-MWUS3A7C.mjs → chunk-W7IPHM67.mjs} +22 -3
- package/dist/chunk-W7IPHM67.mjs.map +1 -0
- package/dist/core-R3FHW62G.mjs +3 -0
- package/dist/{core-RDMPQV6U.mjs.map → core-R3FHW62G.mjs.map} +1 -1
- package/dist/index.cjs +2084 -129
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +253 -303
- package/dist/index.d.ts +253 -303
- package/dist/index.mjs +6 -2
- package/dist/index.mjs.map +1 -1
- package/dist/venus-api/index.cjs +1072 -1654
- 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 +31 -2552
- package/dist/venus-api/index.mjs.map +1 -1
- package/package.json +2 -2
- package/dist/AdsApi-Cz0XgLM8.d.mts +0 -851
- package/dist/AdsApi-Cz0XgLM8.d.ts +0 -851
- package/dist/chunk-KQZIPQLJ.mjs.map +0 -1
- package/dist/chunk-MWUS3A7C.mjs.map +0 -1
- package/dist/core-RDMPQV6U.mjs +0 -3
|
@@ -0,0 +1,1414 @@
|
|
|
1
|
+
interface AnalyticsApi {
|
|
2
|
+
recordCustomEvent(eventName: string, payload?: Record<string, any>): Promise<void>;
|
|
3
|
+
trackFunnelStep(stepNumber: number, stepName: string, funnelName?: string): Promise<void>;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
interface RpcRequest {
|
|
7
|
+
type: 'rpc-request';
|
|
8
|
+
id: string;
|
|
9
|
+
method: string;
|
|
10
|
+
args?: any[];
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
interface RpcResponse {
|
|
14
|
+
type: 'rpc-response';
|
|
15
|
+
id: string;
|
|
16
|
+
method: string;
|
|
17
|
+
result?: any;
|
|
18
|
+
error?: {
|
|
19
|
+
message: string;
|
|
20
|
+
stack?: string;
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
interface RpcNotification {
|
|
25
|
+
type: 'rpc-notification';
|
|
26
|
+
id: string;
|
|
27
|
+
payload?: any;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
type OnRequestCallback = (request: RpcRequest) => Promise<boolean>;
|
|
31
|
+
type OnResponseCallback = (response: RpcResponse) => Promise<boolean>;
|
|
32
|
+
type OnNotificationCallback = (notification: RpcNotification) => void;
|
|
33
|
+
interface RpcTransport {
|
|
34
|
+
onRequest(callback: OnRequestCallback): Subscription;
|
|
35
|
+
onResponse(callback: OnResponseCallback): Subscription;
|
|
36
|
+
onNotification(callback: OnNotificationCallback): Subscription;
|
|
37
|
+
sendRequest(request: RpcRequest): void;
|
|
38
|
+
sendResponse(response: RpcResponse): void;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
interface Subscription {
|
|
42
|
+
unsubscribe: () => void;
|
|
43
|
+
}
|
|
44
|
+
declare class RpcClient {
|
|
45
|
+
private readonly pendingCalls;
|
|
46
|
+
private readonly notificationCallbacks;
|
|
47
|
+
private onResponseSub;
|
|
48
|
+
private onNotificationSub;
|
|
49
|
+
private transport;
|
|
50
|
+
start(transport: RpcTransport): void;
|
|
51
|
+
stop(): void;
|
|
52
|
+
onNotification<TPayload>(id: string, callback: (payload: TPayload) => void): Subscription;
|
|
53
|
+
callT<TArgs, TResult>(method: string, args: TArgs, timeout?: number): Promise<TResult>;
|
|
54
|
+
call<TResponse>(method: string, args?: any, timeout?: number): Promise<TResponse>;
|
|
55
|
+
private hasPendingCall;
|
|
56
|
+
private addPendingCall;
|
|
57
|
+
private removePendingCall;
|
|
58
|
+
private getPendingCall;
|
|
59
|
+
private generateId;
|
|
60
|
+
private handleRpcResponse;
|
|
61
|
+
private handleRpcNotification;
|
|
62
|
+
}
|
|
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
|
+
|
|
79
|
+
interface NavigationStackInfo {
|
|
80
|
+
isInStack: boolean;
|
|
81
|
+
stackPosition: number;
|
|
82
|
+
isTopOfStack: boolean;
|
|
83
|
+
stackDepth: number;
|
|
84
|
+
parentInstanceId: string;
|
|
85
|
+
}
|
|
86
|
+
interface PushAppOptions {
|
|
87
|
+
contextData?: any;
|
|
88
|
+
appParams?: any;
|
|
89
|
+
}
|
|
90
|
+
interface QuitOptions {
|
|
91
|
+
reason?: string;
|
|
92
|
+
forceClose?: boolean;
|
|
93
|
+
[key: string]: any;
|
|
94
|
+
}
|
|
95
|
+
interface NavigationApi {
|
|
96
|
+
pushApp(appId: string, options?: PushAppOptions): Promise<void>;
|
|
97
|
+
popApp(): Promise<void>;
|
|
98
|
+
getStackInfo(): NavigationStackInfo;
|
|
99
|
+
requestPopOrQuit(options?: QuitOptions): Promise<boolean>;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
type TimeIntervalTriggerInput = {
|
|
103
|
+
type: 'timeInterval';
|
|
104
|
+
seconds: number;
|
|
105
|
+
repeats?: boolean;
|
|
106
|
+
channelId?: string;
|
|
107
|
+
};
|
|
108
|
+
type NotificationTriggerInput = TimeIntervalTriggerInput | null;
|
|
109
|
+
interface ScheduleNotificationOptions {
|
|
110
|
+
priority?: number;
|
|
111
|
+
groupId?: string;
|
|
112
|
+
payload?: Record<string, any>;
|
|
113
|
+
}
|
|
114
|
+
interface ScheduleLocalNotification {
|
|
115
|
+
id: string;
|
|
116
|
+
title?: string | null;
|
|
117
|
+
body?: string | null;
|
|
118
|
+
payload?: Record<string, any>;
|
|
119
|
+
trigger?: NotificationTriggerInput;
|
|
120
|
+
}
|
|
121
|
+
interface NotificationsApi {
|
|
122
|
+
scheduleAsync(title: string, body: string, seconds: number, notificationId?: string, options?: ScheduleNotificationOptions): Promise<string | null>;
|
|
123
|
+
cancelNotification(notificationId: string): Promise<boolean>;
|
|
124
|
+
getAllScheduledLocalNotifications(): Promise<ScheduleLocalNotification[]>;
|
|
125
|
+
isLocalNotificationsEnabled(): Promise<boolean>;
|
|
126
|
+
setLocalNotificationsEnabled(enabled: boolean): Promise<boolean>;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
interface ShowConfirmOptions {
|
|
130
|
+
confirmText?: string;
|
|
131
|
+
cancelText?: string;
|
|
132
|
+
}
|
|
133
|
+
interface ShowAlertOptions {
|
|
134
|
+
buttonText?: string;
|
|
135
|
+
}
|
|
136
|
+
interface ShowToastOptions {
|
|
137
|
+
duration?: number;
|
|
138
|
+
variant?: 'success' | 'error' | 'warning' | 'info';
|
|
139
|
+
action?: {
|
|
140
|
+
label: string;
|
|
141
|
+
};
|
|
142
|
+
}
|
|
143
|
+
interface PopupsApi {
|
|
144
|
+
showAlert(title: string, message: string, options?: ShowAlertOptions): Promise<void>;
|
|
145
|
+
showConfirm(title: string, message: string, options?: ShowConfirmOptions): Promise<boolean>;
|
|
146
|
+
showToast(message: string, options?: ShowToastOptions): Promise<boolean>;
|
|
147
|
+
showActionSheet(items: ActionSheetItem[], options?: ShowActionSheetOptions): Promise<string | number | null>;
|
|
148
|
+
}
|
|
149
|
+
interface ActionSheetItem {
|
|
150
|
+
id?: string;
|
|
151
|
+
label: string;
|
|
152
|
+
icon?: string;
|
|
153
|
+
}
|
|
154
|
+
interface ShowActionSheetOptions {
|
|
155
|
+
title?: string;
|
|
156
|
+
message?: string;
|
|
157
|
+
cancelButtonText?: string;
|
|
158
|
+
disableCancel?: boolean;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
interface ProfileApi {
|
|
162
|
+
getCurrentProfile(): Profile;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
type SubPath = string;
|
|
166
|
+
interface FetchBlobOptions {
|
|
167
|
+
timeout?: number;
|
|
168
|
+
}
|
|
169
|
+
interface CdnApi {
|
|
170
|
+
resolveAssetUrl(subPath: string): string;
|
|
171
|
+
resolveAvatarAssetUrl(subPath: string): string;
|
|
172
|
+
resolveSharedLibUrl(subPath: string): string;
|
|
173
|
+
getAssetCdnBaseUrl(): string;
|
|
174
|
+
fetchFromCdn(url: string, request?: RequestInit): Promise<Response>;
|
|
175
|
+
fetchBlob(path: SubPath, options?: FetchBlobOptions): Promise<Blob>;
|
|
176
|
+
}
|
|
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
|
+
|
|
229
|
+
interface AiMessage {
|
|
230
|
+
/**
|
|
231
|
+
* Depends on the model you are using. Most common is user, system, and assistant.
|
|
232
|
+
* If you are unsure, look up the specific model you are using.
|
|
233
|
+
*/
|
|
234
|
+
role: string;
|
|
235
|
+
content: string;
|
|
236
|
+
}
|
|
237
|
+
type AiChatCompletionRequest = {
|
|
238
|
+
model: string;
|
|
239
|
+
messages?: Array<AiMessage>;
|
|
240
|
+
maxTokens?: number;
|
|
241
|
+
temperature?: number;
|
|
242
|
+
topP?: number;
|
|
243
|
+
topK?: number;
|
|
244
|
+
n?: number;
|
|
245
|
+
stop?: string | string[];
|
|
246
|
+
presencePenalty?: number;
|
|
247
|
+
frequencyPenalty?: number;
|
|
248
|
+
logitBias?: Record<string, number>;
|
|
249
|
+
seed?: number;
|
|
250
|
+
/**
|
|
251
|
+
* This is ONLY ever used when running the sdk outside of venus.
|
|
252
|
+
* This gets ignored when the game using the sdk is used within a venus instance.
|
|
253
|
+
*
|
|
254
|
+
* In other words, this should only be uswed when developing a game locally.
|
|
255
|
+
*/
|
|
256
|
+
apiKey?: string;
|
|
257
|
+
};
|
|
258
|
+
type AiChatCompletionData = {
|
|
259
|
+
id: string;
|
|
260
|
+
ullm_id: string;
|
|
261
|
+
cost: {
|
|
262
|
+
prompt_cost: number;
|
|
263
|
+
completion_cost: number;
|
|
264
|
+
};
|
|
265
|
+
object: string;
|
|
266
|
+
created: number;
|
|
267
|
+
model: string;
|
|
268
|
+
choices: Array<{
|
|
269
|
+
index: number;
|
|
270
|
+
message: {
|
|
271
|
+
role: string;
|
|
272
|
+
content: string;
|
|
273
|
+
};
|
|
274
|
+
finish_reason: string;
|
|
275
|
+
}>;
|
|
276
|
+
usage: {
|
|
277
|
+
prompt_tokens: number;
|
|
278
|
+
completion_tokens: number;
|
|
279
|
+
total_tokens: number;
|
|
280
|
+
reasoning_tokens?: number;
|
|
281
|
+
cache_read_tokens?: number;
|
|
282
|
+
cache_write_tokens?: number;
|
|
283
|
+
};
|
|
284
|
+
};
|
|
285
|
+
interface AiApi {
|
|
286
|
+
requestChatCompletionAsync(request: AiChatCompletionRequest): Promise<AiChatCompletionData>;
|
|
287
|
+
getAvailableCompletionModels(): Promise<Array<string>>;
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
declare enum HapticFeedbackStyle {
|
|
291
|
+
Light = "light",
|
|
292
|
+
Medium = "medium",
|
|
293
|
+
Heavy = "heavy",
|
|
294
|
+
Success = "success",
|
|
295
|
+
Warning = "warning",
|
|
296
|
+
Error = "error"
|
|
297
|
+
}
|
|
298
|
+
interface HapticsApi {
|
|
299
|
+
triggerHapticAsync(style: HapticFeedbackStyle): Promise<void>;
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
interface Experiment {
|
|
303
|
+
readonly name: string;
|
|
304
|
+
readonly ruleID: string;
|
|
305
|
+
readonly value: Record<string, unknown>;
|
|
306
|
+
readonly groupName: string | null;
|
|
307
|
+
}
|
|
308
|
+
interface FeaturesApi {
|
|
309
|
+
getExperiment(experimentName: string): Promise<Experiment | null>;
|
|
310
|
+
getFeatureFlag(flagName: string): Promise<boolean>;
|
|
311
|
+
getFeatureGate(gateName: string): Promise<boolean>;
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
type AwakeCallback = () => void;
|
|
315
|
+
type SleepCallback = () => void;
|
|
316
|
+
type ResumeCallback = () => void;
|
|
317
|
+
type PauseCallback = () => void;
|
|
318
|
+
type QuitCallback = () => void;
|
|
319
|
+
interface LifecycleApi {
|
|
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>;
|
|
442
|
+
}
|
|
443
|
+
|
|
444
|
+
interface VenusMessage {
|
|
445
|
+
type: string;
|
|
446
|
+
direction: string;
|
|
447
|
+
data?: {
|
|
448
|
+
requestId?: string;
|
|
449
|
+
success?: boolean;
|
|
450
|
+
value?: any;
|
|
451
|
+
data?: any;
|
|
452
|
+
error?: string;
|
|
453
|
+
script?: string;
|
|
454
|
+
};
|
|
455
|
+
instanceId: string;
|
|
456
|
+
timestamp: number;
|
|
457
|
+
}
|
|
458
|
+
declare global {
|
|
459
|
+
interface Window {
|
|
460
|
+
_venusInitState?: {
|
|
461
|
+
poolId: string;
|
|
462
|
+
apiInjected: boolean;
|
|
463
|
+
gameInitialized: boolean;
|
|
464
|
+
};
|
|
465
|
+
ReactNativeWebView?: {
|
|
466
|
+
postMessage(message: string): void;
|
|
467
|
+
};
|
|
468
|
+
venus: {
|
|
469
|
+
_config: {
|
|
470
|
+
locale: string;
|
|
471
|
+
instanceId: string;
|
|
472
|
+
context?: any;
|
|
473
|
+
profile?: {
|
|
474
|
+
id?: string;
|
|
475
|
+
username?: string;
|
|
476
|
+
name?: string;
|
|
477
|
+
displayName?: string;
|
|
478
|
+
avatarUrl?: string | null;
|
|
479
|
+
isAnonymous?: boolean;
|
|
480
|
+
};
|
|
481
|
+
environment: {
|
|
482
|
+
browserInfo?: {
|
|
483
|
+
language: string;
|
|
484
|
+
};
|
|
485
|
+
};
|
|
486
|
+
_handlers: Record<string, any>;
|
|
487
|
+
};
|
|
488
|
+
profile?: {
|
|
489
|
+
id?: string;
|
|
490
|
+
username?: string;
|
|
491
|
+
avatarUrl?: string | null;
|
|
492
|
+
name?: string;
|
|
493
|
+
displayName?: string;
|
|
494
|
+
isAnonymous?: boolean;
|
|
495
|
+
} | null;
|
|
496
|
+
_fetchFromCdn: (url: string) => Promise<string>;
|
|
497
|
+
};
|
|
498
|
+
}
|
|
499
|
+
}
|
|
500
|
+
type OnVenusMessageCallback = (message: VenusMessage) => void;
|
|
501
|
+
declare class VenusTransport implements RpcTransport {
|
|
502
|
+
private readonly messageHandler;
|
|
503
|
+
private readonly onNotificationCallbacks;
|
|
504
|
+
private readonly onNotificationCallbacksToRemove;
|
|
505
|
+
private readonly onVenusMessageCallbacks;
|
|
506
|
+
private readonly onResponseCallbacks;
|
|
507
|
+
private readonly onResponseCallbacksToRemove;
|
|
508
|
+
private _instanceId;
|
|
509
|
+
private isStarted;
|
|
510
|
+
private isProcessingMessage;
|
|
511
|
+
constructor();
|
|
512
|
+
onNotification(callback: OnNotificationCallback): Subscription;
|
|
513
|
+
onRequest(callback: OnRequestCallback): Subscription;
|
|
514
|
+
onResponse(callback: OnResponseCallback): Subscription;
|
|
515
|
+
get instanceId(): string | null;
|
|
516
|
+
set instanceId(instanceId: string);
|
|
517
|
+
sendRequest(request: RpcRequest): void;
|
|
518
|
+
sendVenusMessage(message: VenusMessage): void;
|
|
519
|
+
sendResponse(response: RpcResponse): void;
|
|
520
|
+
start(): void;
|
|
521
|
+
stop(): void;
|
|
522
|
+
private handleNotification;
|
|
523
|
+
private handleResponse;
|
|
524
|
+
private removeOnResponseCallback;
|
|
525
|
+
private removeOnNotificationCallback;
|
|
526
|
+
private logInfo;
|
|
527
|
+
private logWarn;
|
|
528
|
+
onVenusMessage(callback: OnVenusMessageCallback): Subscription;
|
|
529
|
+
private notifyVenusMessageReceived;
|
|
530
|
+
}
|
|
531
|
+
|
|
532
|
+
declare class VenusRoom {
|
|
533
|
+
readonly id: string;
|
|
534
|
+
name: string;
|
|
535
|
+
players: any[];
|
|
536
|
+
maxPlayers: number;
|
|
537
|
+
gameType: string;
|
|
538
|
+
appId: string;
|
|
539
|
+
type: any;
|
|
540
|
+
createdBy: string;
|
|
541
|
+
createdAt: number;
|
|
542
|
+
updatedAt: number;
|
|
543
|
+
isPrivate: boolean;
|
|
544
|
+
currentPlayers: string[];
|
|
545
|
+
status: any;
|
|
546
|
+
customMetadata: Record<string, any>;
|
|
547
|
+
admins: string[];
|
|
548
|
+
roomCode: string;
|
|
549
|
+
description: string;
|
|
550
|
+
data: Record<string, any>;
|
|
551
|
+
version: string;
|
|
552
|
+
private _subscriptions;
|
|
553
|
+
constructor(roomData: any);
|
|
554
|
+
private updateFromRoomData;
|
|
555
|
+
}
|
|
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
|
+
|
|
614
|
+
interface SharedAssetsApi {
|
|
615
|
+
loadCharactersBundle(): Promise<ArrayBuffer>;
|
|
616
|
+
loadBurgerTimeAssetsBundle(): Promise<ArrayBuffer>;
|
|
617
|
+
}
|
|
618
|
+
|
|
619
|
+
declare class RpcSharedAssetsApi implements SharedAssetsApi {
|
|
620
|
+
private readonly venusApi;
|
|
621
|
+
private readonly rpcClient;
|
|
622
|
+
constructor(rpcClient: RpcClient, venusApi: VenusAPI);
|
|
623
|
+
loadBurgerTimeAssetsBundle(): Promise<ArrayBuffer>;
|
|
624
|
+
loadCharactersBundle(): Promise<ArrayBuffer>;
|
|
625
|
+
}
|
|
626
|
+
interface LoadEmbeddedAssetsRequest {
|
|
627
|
+
assetKey: string;
|
|
628
|
+
}
|
|
629
|
+
interface LoadEmbeddedAssetsResponse {
|
|
630
|
+
base64Data: string;
|
|
631
|
+
}
|
|
632
|
+
|
|
633
|
+
interface SpendCurrencyOptions {
|
|
634
|
+
screenName?: string;
|
|
635
|
+
}
|
|
636
|
+
interface IapApi {
|
|
637
|
+
getHardCurrencyBalance(): Promise<number>;
|
|
638
|
+
spendCurrency(productId: string, amount: number, options?: SpendCurrencyOptions): Promise<void>;
|
|
639
|
+
openStore(): Promise<void>;
|
|
640
|
+
getCurrencyIcon(): Promise<LoadEmbeddedAssetsResponse>;
|
|
641
|
+
}
|
|
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
|
+
|
|
770
|
+
interface PreloaderApi {
|
|
771
|
+
showLoadScreen(): Promise<void>;
|
|
772
|
+
hideLoadScreen(): Promise<void>;
|
|
773
|
+
setLoaderText(text: string): Promise<void>;
|
|
774
|
+
setLoaderProgress(progress: number): Promise<void>;
|
|
775
|
+
}
|
|
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
|
+
|
|
897
|
+
interface Avatar3dConfig {
|
|
898
|
+
headAsset: string | null;
|
|
899
|
+
outfitAsset: string | null;
|
|
900
|
+
hatAsset: string | null;
|
|
901
|
+
hairAsset: string | null;
|
|
902
|
+
faceAccessoryAsset: string | null;
|
|
903
|
+
animationAsset: string | null;
|
|
904
|
+
skinColor: string | null;
|
|
905
|
+
}
|
|
906
|
+
|
|
907
|
+
interface Asset {
|
|
908
|
+
id: string;
|
|
909
|
+
filename: string;
|
|
910
|
+
displayName: string;
|
|
911
|
+
preload?: boolean;
|
|
912
|
+
tags?: string[];
|
|
913
|
+
metadata?: Record<string, any>;
|
|
914
|
+
}
|
|
915
|
+
interface Category {
|
|
916
|
+
displayName?: string;
|
|
917
|
+
type: 'mesh';
|
|
918
|
+
assets: Asset[];
|
|
919
|
+
}
|
|
920
|
+
interface AssetManifest {
|
|
921
|
+
version: string;
|
|
922
|
+
generatedAt: string;
|
|
923
|
+
categories: Record<string, Category>;
|
|
924
|
+
}
|
|
925
|
+
|
|
926
|
+
interface Avatar3dEdits {
|
|
927
|
+
wasChanged: boolean;
|
|
928
|
+
config: Avatar3dConfig | null;
|
|
929
|
+
savedAvatarId: string | null;
|
|
930
|
+
}
|
|
931
|
+
interface ShowEditorOptions {
|
|
932
|
+
currentAvatar?: any;
|
|
933
|
+
contextData?: any;
|
|
934
|
+
onSave?: () => void;
|
|
935
|
+
onCancel?: () => void;
|
|
936
|
+
}
|
|
937
|
+
interface Avatar3dApi {
|
|
938
|
+
loadAvatar(avatarId?: string): Promise<Avatar3dConfig | null>;
|
|
939
|
+
saveAvatar(config: Avatar3dConfig): Promise<string>;
|
|
940
|
+
deleteAvatar(): Promise<void>;
|
|
941
|
+
downloadManifest(): Promise<AssetManifest>;
|
|
942
|
+
showEditor(options?: ShowEditorOptions): Promise<Avatar3dEdits>;
|
|
943
|
+
downloadAssetPaths(): Promise<Record<string, string[]>>;
|
|
944
|
+
}
|
|
945
|
+
|
|
946
|
+
declare global {
|
|
947
|
+
interface Window {
|
|
948
|
+
VenusPrototyping?: {
|
|
949
|
+
showAvatarEditorOverlay: (options: any, resolve: (args: any) => void) => Promise<void>;
|
|
950
|
+
};
|
|
951
|
+
}
|
|
952
|
+
}
|
|
953
|
+
declare class MockAvatarApi implements Avatar3dApi {
|
|
954
|
+
private readonly _venusApi;
|
|
955
|
+
private cachedAssets;
|
|
956
|
+
private cachedVersion;
|
|
957
|
+
constructor(venusApi: VenusAPI);
|
|
958
|
+
downloadAssetPaths(): Promise<Record<string, string[]>>;
|
|
959
|
+
deleteAvatar(): Promise<void>;
|
|
960
|
+
loadAvatar(avatar3dId?: string): Promise<Avatar3dConfig | null>;
|
|
961
|
+
saveAvatar(config: Avatar3dConfig): Promise<string>;
|
|
962
|
+
downloadManifest(): Promise<AssetManifest>;
|
|
963
|
+
showEditor(options?: ShowEditorOptions): Promise<Avatar3dEdits>;
|
|
964
|
+
private getAssets;
|
|
965
|
+
private loadAssetsManifest;
|
|
966
|
+
private selectAvatarConfig;
|
|
967
|
+
private selectAsset;
|
|
968
|
+
private seededRandom;
|
|
969
|
+
private simpleHash;
|
|
970
|
+
private getAllAssetPaths;
|
|
971
|
+
private log;
|
|
972
|
+
}
|
|
973
|
+
|
|
974
|
+
/**
|
|
975
|
+
* DEFINITIVE TypeScript definitions for Venus H5 API
|
|
976
|
+
*
|
|
977
|
+
* This is the single source of truth for all H5 games.
|
|
978
|
+
*
|
|
979
|
+
* Usage in H5 games:
|
|
980
|
+
* ```typescript
|
|
981
|
+
* import type { VenusAPI } from '../../venus-api/types';
|
|
982
|
+
* declare const VenusAPI: VenusAPI;
|
|
983
|
+
* ```
|
|
984
|
+
*/
|
|
985
|
+
|
|
986
|
+
interface RecipeRequirementResult {
|
|
987
|
+
recipeId: string;
|
|
988
|
+
entity: string | null;
|
|
989
|
+
amount?: number;
|
|
990
|
+
inputs: Record<string, any>;
|
|
991
|
+
canAfford: boolean;
|
|
992
|
+
disabled: boolean;
|
|
993
|
+
}
|
|
994
|
+
interface VenusSimulationState {
|
|
995
|
+
inventory: Record<string, number | string>;
|
|
996
|
+
activeRuns: Array<{
|
|
997
|
+
id: string;
|
|
998
|
+
recipeId: string;
|
|
999
|
+
status: string;
|
|
1000
|
+
startTime: number;
|
|
1001
|
+
expiresAt: number;
|
|
1002
|
+
inputs?: Record<string, number | string>;
|
|
1003
|
+
outputs?: Record<string, number | string>;
|
|
1004
|
+
entity?: string;
|
|
1005
|
+
}>;
|
|
1006
|
+
disabledRecipes: string[];
|
|
1007
|
+
}
|
|
1008
|
+
interface VenusSimulationEffect {
|
|
1009
|
+
type: string;
|
|
1010
|
+
target: any;
|
|
1011
|
+
value: any;
|
|
1012
|
+
}
|
|
1013
|
+
interface VenusSimulationRecipe {
|
|
1014
|
+
scope: 'player' | 'room' | 'actor';
|
|
1015
|
+
inputs: Record<string, any>;
|
|
1016
|
+
autoRestart?: boolean;
|
|
1017
|
+
beginEffects?: VenusSimulationEffect[];
|
|
1018
|
+
endEffects?: VenusSimulationEffect[];
|
|
1019
|
+
outputs?: Record<string, any>;
|
|
1020
|
+
duration?: number;
|
|
1021
|
+
maxRestartCondition?: any;
|
|
1022
|
+
metadata?: {
|
|
1023
|
+
startsDisabled?: boolean;
|
|
1024
|
+
autoRestart?: boolean;
|
|
1025
|
+
maxRestartCondition?: any;
|
|
1026
|
+
};
|
|
1027
|
+
guards?: Record<string, any>;
|
|
1028
|
+
effects?: Array<any>;
|
|
1029
|
+
clientViewable?: boolean;
|
|
1030
|
+
}
|
|
1031
|
+
interface VenusSimulationConfig {
|
|
1032
|
+
version: string;
|
|
1033
|
+
entities: Record<string, {
|
|
1034
|
+
tags?: string[];
|
|
1035
|
+
metadata?: Record<string, any>;
|
|
1036
|
+
stackable?: boolean;
|
|
1037
|
+
neverConsumable?: boolean;
|
|
1038
|
+
clientViewable?: boolean;
|
|
1039
|
+
slots?: Record<string, {
|
|
1040
|
+
allowedTags: string[];
|
|
1041
|
+
maxItems: number;
|
|
1042
|
+
}>;
|
|
1043
|
+
actorTemplate?: {
|
|
1044
|
+
defaultState?: Record<string, any>;
|
|
1045
|
+
availableRecipes?: string[];
|
|
1046
|
+
};
|
|
1047
|
+
}>;
|
|
1048
|
+
recipes: Record<string, VenusSimulationRecipe>;
|
|
1049
|
+
fieldResolution?: Record<string, any>;
|
|
1050
|
+
matchmaking?: Record<string, any>;
|
|
1051
|
+
}
|
|
1052
|
+
interface RecipeRequirementQuery {
|
|
1053
|
+
recipeId: string;
|
|
1054
|
+
entity?: string;
|
|
1055
|
+
batchAmount?: number;
|
|
1056
|
+
}
|
|
1057
|
+
interface BatchRecipeRequirementsResult {
|
|
1058
|
+
success: boolean;
|
|
1059
|
+
results: RecipeRequirementResult[];
|
|
1060
|
+
errors?: Array<any>;
|
|
1061
|
+
}
|
|
1062
|
+
interface VenusSimulationAPI {
|
|
1063
|
+
isEnabled(): boolean;
|
|
1064
|
+
getStateAsync(options?: {
|
|
1065
|
+
roomId?: string;
|
|
1066
|
+
}): Promise<VenusSimulationState>;
|
|
1067
|
+
getConfigAsync(): Promise<VenusSimulationConfig>;
|
|
1068
|
+
executeRecipeAsync(recipeId: string, inputs?: Record<string, any>, options?: any): Promise<any>;
|
|
1069
|
+
executeScopedRecipeAsync(recipeId: string, entity: string, inputs?: Record<string, any>, roomId?: string, options?: any): Promise<any>;
|
|
1070
|
+
getActiveRunsAsync(): Promise<any[]>;
|
|
1071
|
+
collectRecipeAsync(runId: string): Promise<any>;
|
|
1072
|
+
triggerRecipeChainAsync(triggerRecipeId: string, context?: any, roomId?: string): Promise<any>;
|
|
1073
|
+
getRecipeRequirementsAsync(recipeId: string, entity?: string, amount?: number): Promise<RecipeRequirementResult>;
|
|
1074
|
+
getBatchRecipeRequirementsAsync(queries: RecipeRequirementQuery[]): Promise<BatchRecipeRequirementsResult>;
|
|
1075
|
+
getAvailableRecipesAsync(roomId?: string, includeActorRecipes?: boolean): Promise<Array<any>>;
|
|
1076
|
+
resolveFieldValueAsync(entityId: string, fieldPath: string, entity?: string): Promise<any>;
|
|
1077
|
+
getEntityMetadataAsync(entityId: string): Promise<any>;
|
|
1078
|
+
getSlotContainersAsync(): Promise<Array<any>>;
|
|
1079
|
+
getSlotAssignmentsAsync(containerId: string): Promise<Array<any>>;
|
|
1080
|
+
assignItemToSlotAsync(containerId: string, slotId: string, itemId: string): Promise<any>;
|
|
1081
|
+
removeItemFromSlotAsync(containerId: string, slotId: string): Promise<any>;
|
|
1082
|
+
getAvailableItemsAsync(containerId: string, slotId: string): Promise<Array<any>>;
|
|
1083
|
+
calculatePowerPreviewAsync(containerId: string, slotId: string, candidateItemId: string): Promise<any>;
|
|
1084
|
+
validateSlotAssignmentAsync(containerId: string, slotId: string, itemId: string): Promise<any>;
|
|
1085
|
+
executeBatchOperationsAsync(operations: Array<any>, validateOnly?: boolean): Promise<any>;
|
|
1086
|
+
sumContributions(contributions: Record<string, any>): Record<string, number>;
|
|
1087
|
+
}
|
|
1088
|
+
interface VenusConfig {
|
|
1089
|
+
user?: {
|
|
1090
|
+
id: string;
|
|
1091
|
+
username?: string;
|
|
1092
|
+
languageCode: string;
|
|
1093
|
+
locale: string;
|
|
1094
|
+
};
|
|
1095
|
+
profile?: {
|
|
1096
|
+
id: string;
|
|
1097
|
+
username: string;
|
|
1098
|
+
avatarUrl?: string;
|
|
1099
|
+
isAnonymous?: boolean;
|
|
1100
|
+
};
|
|
1101
|
+
device?: {
|
|
1102
|
+
screenSize: {
|
|
1103
|
+
width: number;
|
|
1104
|
+
height: number;
|
|
1105
|
+
};
|
|
1106
|
+
viewportSize: {
|
|
1107
|
+
width: number;
|
|
1108
|
+
height: number;
|
|
1109
|
+
};
|
|
1110
|
+
orientation: string;
|
|
1111
|
+
hapticsEnabled: boolean;
|
|
1112
|
+
};
|
|
1113
|
+
theme?: Record<string, any>;
|
|
1114
|
+
environment?: {
|
|
1115
|
+
isDevelopment: boolean;
|
|
1116
|
+
platform: string;
|
|
1117
|
+
platformVersion: string;
|
|
1118
|
+
browserInfo?: {
|
|
1119
|
+
browser: string;
|
|
1120
|
+
isMobile: boolean;
|
|
1121
|
+
};
|
|
1122
|
+
};
|
|
1123
|
+
ui: {
|
|
1124
|
+
safeArea: {
|
|
1125
|
+
top: number;
|
|
1126
|
+
left: number;
|
|
1127
|
+
right: number;
|
|
1128
|
+
bottom: number;
|
|
1129
|
+
};
|
|
1130
|
+
controls: Record<string, any>;
|
|
1131
|
+
};
|
|
1132
|
+
rooms?: VenusRoomsConfig;
|
|
1133
|
+
}
|
|
1134
|
+
interface VenusRoomsConfig {
|
|
1135
|
+
gameType?: string;
|
|
1136
|
+
rulesPreset?: string;
|
|
1137
|
+
matchmaking?: {
|
|
1138
|
+
defaultCriteria?: Record<string, any>;
|
|
1139
|
+
[key: string]: any;
|
|
1140
|
+
};
|
|
1141
|
+
createOptions?: Record<string, any>;
|
|
1142
|
+
privateMatchDefaults?: {
|
|
1143
|
+
createOptions?: Record<string, any>;
|
|
1144
|
+
allowCustomCode?: boolean;
|
|
1145
|
+
};
|
|
1146
|
+
[key: string]: any;
|
|
1147
|
+
}
|
|
1148
|
+
interface ActionSheetOption {
|
|
1149
|
+
label: string;
|
|
1150
|
+
icon?: string;
|
|
1151
|
+
id?: string;
|
|
1152
|
+
}
|
|
1153
|
+
interface Profile {
|
|
1154
|
+
id: string;
|
|
1155
|
+
username: string;
|
|
1156
|
+
name?: string;
|
|
1157
|
+
avatarUrl?: string | null;
|
|
1158
|
+
isAnonymous?: boolean;
|
|
1159
|
+
}
|
|
1160
|
+
interface VenusAPI {
|
|
1161
|
+
config: VenusConfig;
|
|
1162
|
+
launchParams: Record<string, string>;
|
|
1163
|
+
_mock: any;
|
|
1164
|
+
_bootstrap: {
|
|
1165
|
+
apiInjected: boolean;
|
|
1166
|
+
venus: any;
|
|
1167
|
+
};
|
|
1168
|
+
initializeAsync(options?: InitializationOptions): Promise<InitializationContext>;
|
|
1169
|
+
simulation: VenusSimulationAPI;
|
|
1170
|
+
leaderboard: LeaderboardApi;
|
|
1171
|
+
log(message: string, ...args: any[]): void;
|
|
1172
|
+
error(message: string, ...args: any[]): void;
|
|
1173
|
+
isAvailable(): boolean;
|
|
1174
|
+
isMobile(): boolean;
|
|
1175
|
+
isWeb(): boolean;
|
|
1176
|
+
isMock(): boolean;
|
|
1177
|
+
/**
|
|
1178
|
+
* @deprecated Please use the new analytics API. VenusAPI.analytics
|
|
1179
|
+
* @param options
|
|
1180
|
+
*/
|
|
1181
|
+
logCustomEvent(options: {
|
|
1182
|
+
eventName: string;
|
|
1183
|
+
params?: Record<string, any>;
|
|
1184
|
+
}): Promise<void>;
|
|
1185
|
+
getExperiment(options: {
|
|
1186
|
+
experimentName: string;
|
|
1187
|
+
}): Promise<any>;
|
|
1188
|
+
getFeatureFlag(options: {
|
|
1189
|
+
flagName: string;
|
|
1190
|
+
}): Promise<any>;
|
|
1191
|
+
getFeatureGate(options: {
|
|
1192
|
+
gateName: string;
|
|
1193
|
+
}): Promise<any>;
|
|
1194
|
+
getCurrentProfile(): Profile;
|
|
1195
|
+
getLaunchParams(): Record<string, string>;
|
|
1196
|
+
/**
|
|
1197
|
+
* @deprecated Please use the popups API. (e.g, VenusAPI.popups)
|
|
1198
|
+
*/
|
|
1199
|
+
showToast(message: string | {
|
|
1200
|
+
message: string;
|
|
1201
|
+
duration?: number;
|
|
1202
|
+
variant?: string;
|
|
1203
|
+
action?: {
|
|
1204
|
+
label: string;
|
|
1205
|
+
};
|
|
1206
|
+
}): Promise<boolean>;
|
|
1207
|
+
/**
|
|
1208
|
+
* @deprecated Please use the popups API. (e.g, VenusAPI.popups)
|
|
1209
|
+
*/
|
|
1210
|
+
showAlert(options: {
|
|
1211
|
+
title: string;
|
|
1212
|
+
message: string;
|
|
1213
|
+
buttonText?: string;
|
|
1214
|
+
}): Promise<void>;
|
|
1215
|
+
/**
|
|
1216
|
+
* @deprecated Please use the popups API. (e.g, VenusAPI.popups)
|
|
1217
|
+
*/
|
|
1218
|
+
showConfirm(options: {
|
|
1219
|
+
title: string;
|
|
1220
|
+
message: string;
|
|
1221
|
+
confirmText?: string;
|
|
1222
|
+
cancelText?: string;
|
|
1223
|
+
}): Promise<boolean>;
|
|
1224
|
+
/**
|
|
1225
|
+
* @deprecated Please use the popups API. (e.g, VenusAPI.popups)
|
|
1226
|
+
*/
|
|
1227
|
+
showActionSheet(options: {
|
|
1228
|
+
title: string;
|
|
1229
|
+
message?: string;
|
|
1230
|
+
options: ActionSheetOption[];
|
|
1231
|
+
cancelButtonText?: string;
|
|
1232
|
+
disableCancel?: boolean;
|
|
1233
|
+
}): Promise<string | number | null>;
|
|
1234
|
+
triggerHapticAsync(style: HapticFeedbackStyle): Promise<void>;
|
|
1235
|
+
deviceCache: {
|
|
1236
|
+
setItem(key: string, value: string): Promise<void>;
|
|
1237
|
+
getItem(key: string): Promise<string | null>;
|
|
1238
|
+
removeItem(key: string): Promise<void>;
|
|
1239
|
+
clear(): Promise<void>;
|
|
1240
|
+
length(): Promise<number>;
|
|
1241
|
+
key(index: number): Promise<string | null>;
|
|
1242
|
+
};
|
|
1243
|
+
appStorage: {
|
|
1244
|
+
setItem(key: string, value: string): Promise<void>;
|
|
1245
|
+
getItem(key: string): Promise<string | null>;
|
|
1246
|
+
removeItem(key: string): Promise<void>;
|
|
1247
|
+
clear(): Promise<void>;
|
|
1248
|
+
length(): Promise<number>;
|
|
1249
|
+
key(index: number): Promise<string | null>;
|
|
1250
|
+
getAllItems(): Promise<string[]>;
|
|
1251
|
+
setMultipleItems(items: {
|
|
1252
|
+
key: string;
|
|
1253
|
+
value: string;
|
|
1254
|
+
}[]): Promise<void>;
|
|
1255
|
+
removeMultipleItems(keys: string[]): Promise<void>;
|
|
1256
|
+
};
|
|
1257
|
+
globalStorage: {
|
|
1258
|
+
setItem(key: string, value: string): Promise<void>;
|
|
1259
|
+
getItem(key: string): Promise<string | null>;
|
|
1260
|
+
removeItem(key: string): Promise<void>;
|
|
1261
|
+
clear(): Promise<void>;
|
|
1262
|
+
length(): Promise<number>;
|
|
1263
|
+
key(index: number): Promise<string | null>;
|
|
1264
|
+
};
|
|
1265
|
+
requestPopOrQuit(options?: QuitOptions): Promise<boolean>;
|
|
1266
|
+
getPostInteractionsAsync(): Promise<any>;
|
|
1267
|
+
getPostInteractions(): Promise<any>;
|
|
1268
|
+
toggleLikeAsync(): Promise<any>;
|
|
1269
|
+
toggleFollowAsync(): Promise<any>;
|
|
1270
|
+
openCommentsAsync(options?: any): Promise<void>;
|
|
1271
|
+
/**
|
|
1272
|
+
* @deprecated Please use the ads API. (e.g, VenusAPI.ads)
|
|
1273
|
+
*/
|
|
1274
|
+
isRewardedAdReadyAsync(): Promise<boolean>;
|
|
1275
|
+
/**
|
|
1276
|
+
* @deprecated Please use the ads API. (e.g, VenusAPI.ads)
|
|
1277
|
+
*/
|
|
1278
|
+
showRewardedAdAsync(): Promise<boolean>;
|
|
1279
|
+
requestTimeAsync(): Promise<{
|
|
1280
|
+
serverTime: number;
|
|
1281
|
+
}>;
|
|
1282
|
+
getFutureTimeAsync(options: {
|
|
1283
|
+
days?: number;
|
|
1284
|
+
hours?: number;
|
|
1285
|
+
minutes?: number;
|
|
1286
|
+
timeOfDay?: any;
|
|
1287
|
+
timezone?: string;
|
|
1288
|
+
}): Promise<number>;
|
|
1289
|
+
formatTime(timestamp: number, options?: any): string;
|
|
1290
|
+
formatNumber(value: number, options?: any): string;
|
|
1291
|
+
/**
|
|
1292
|
+
* @deprecated Please use the cdn API. VenusAPI.cdn
|
|
1293
|
+
*/
|
|
1294
|
+
fetchFromCdn(url: string, options?: RequestInit): Promise<Response>;
|
|
1295
|
+
/**
|
|
1296
|
+
* @deprecated Please use the cdn API. VenusAPI.cdn
|
|
1297
|
+
*/
|
|
1298
|
+
resolveAssetUrl(path: string): string;
|
|
1299
|
+
/**
|
|
1300
|
+
* @deprecated Please use the cdn API. VenusAPI.cdn
|
|
1301
|
+
*/
|
|
1302
|
+
resolveAvatarAssetUrl(path: string): string;
|
|
1303
|
+
/**
|
|
1304
|
+
* @deprecated Please use the cdn API. VenusAPI.cdn
|
|
1305
|
+
*/
|
|
1306
|
+
resolveSharedLibUrl(path: string): string;
|
|
1307
|
+
/**
|
|
1308
|
+
* @deprecated Please use the cdn API. VenusAPI.cdn
|
|
1309
|
+
*/
|
|
1310
|
+
getAssetCdnBaseUrl(): string;
|
|
1311
|
+
loadAsset(url: string, options?: {
|
|
1312
|
+
type?: string;
|
|
1313
|
+
streaming?: boolean;
|
|
1314
|
+
cache?: boolean;
|
|
1315
|
+
timeout?: number;
|
|
1316
|
+
isOptional?: boolean;
|
|
1317
|
+
}): Promise<string>;
|
|
1318
|
+
preloadAssets(assets: Array<string | {
|
|
1319
|
+
url: string;
|
|
1320
|
+
isOptional?: boolean;
|
|
1321
|
+
}>, options?: {
|
|
1322
|
+
onProgress?: (progress: number, info: any) => void;
|
|
1323
|
+
}): Promise<Array<{
|
|
1324
|
+
success: boolean;
|
|
1325
|
+
isOptional?: boolean;
|
|
1326
|
+
}>>;
|
|
1327
|
+
cleanupAssets(): void;
|
|
1328
|
+
assetLoader?: {
|
|
1329
|
+
getCached(url: string): string | null;
|
|
1330
|
+
};
|
|
1331
|
+
showAvatar3dEditorAsync(options: {
|
|
1332
|
+
currentAvatar?: any;
|
|
1333
|
+
contextData?: any;
|
|
1334
|
+
}): Promise<Avatar3dEdits>;
|
|
1335
|
+
loadAvatar3dAsync(avatarId?: string): Promise<any>;
|
|
1336
|
+
saveAvatar3dAsync(config: any): Promise<string>;
|
|
1337
|
+
deleteAvatar3dAsync(): Promise<void>;
|
|
1338
|
+
downloadAvatar3dAssetPathsAsync(): Promise<Record<string, string[]>>;
|
|
1339
|
+
downloadAvatar3dManifestAsync(): Promise<AssetManifest>;
|
|
1340
|
+
pushAppAsync(appId: string, options?: {
|
|
1341
|
+
contextData?: any;
|
|
1342
|
+
appParams?: any;
|
|
1343
|
+
}): Promise<any>;
|
|
1344
|
+
popAppAsync(): Promise<void>;
|
|
1345
|
+
getStackInfo(): {
|
|
1346
|
+
isInStack: boolean;
|
|
1347
|
+
stackPosition: number;
|
|
1348
|
+
};
|
|
1349
|
+
rooms: {
|
|
1350
|
+
create(options: any): Promise<VenusRoom>;
|
|
1351
|
+
joinOrCreate(options: any): Promise<{
|
|
1352
|
+
action: 'created' | 'joined';
|
|
1353
|
+
room: VenusRoom;
|
|
1354
|
+
playersJoined: number;
|
|
1355
|
+
}>;
|
|
1356
|
+
joinByCode(roomCode: string): Promise<VenusRoom>;
|
|
1357
|
+
list(includeArchived?: boolean): Promise<VenusRoom[]>;
|
|
1358
|
+
subscribeToRoom(room: VenusRoom, options: {
|
|
1359
|
+
onData?: (event: any) => void;
|
|
1360
|
+
onMessages?: (event: any) => void;
|
|
1361
|
+
onMoves?: (event: any) => void;
|
|
1362
|
+
onGameEvents?: (event: any) => void;
|
|
1363
|
+
}): () => void;
|
|
1364
|
+
proposeMove(room: VenusRoom, proposalPayload: {
|
|
1365
|
+
gameSpecificState: any;
|
|
1366
|
+
moveType: string;
|
|
1367
|
+
clientContext?: Record<string, any>;
|
|
1368
|
+
clientProposalId?: string;
|
|
1369
|
+
}): Promise<{
|
|
1370
|
+
proposedMoveId: string;
|
|
1371
|
+
}>;
|
|
1372
|
+
validateMove(room: VenusRoom, moveId: string, isValid: boolean, reason?: string, validatorId?: string): Promise<any>;
|
|
1373
|
+
updateRoomData(room: VenusRoom, updates: any, merge?: boolean): Promise<any>;
|
|
1374
|
+
getRoomData(room: VenusRoom): Promise<any>;
|
|
1375
|
+
sendRoomMessage(room: VenusRoom, messageData: any): Promise<string>;
|
|
1376
|
+
startRoomGame(room: VenusRoom, gameConfig?: any, turnOrder?: any): Promise<any>;
|
|
1377
|
+
leaveRoom(room: VenusRoom): Promise<any>;
|
|
1378
|
+
};
|
|
1379
|
+
notifyCleanupComplete(): void;
|
|
1380
|
+
RoomEvents: {
|
|
1381
|
+
OPTIMISTIC_GAME_STATE_UPDATED: string;
|
|
1382
|
+
PROPOSED_MOVE_VALIDATION_UPDATED: string;
|
|
1383
|
+
};
|
|
1384
|
+
numbers?: {
|
|
1385
|
+
normalize(value: string | number): string;
|
|
1386
|
+
};
|
|
1387
|
+
iap: IapApi;
|
|
1388
|
+
cdn: CdnApi;
|
|
1389
|
+
ads: AdsApi;
|
|
1390
|
+
ai: AiApi;
|
|
1391
|
+
popups: PopupsApi;
|
|
1392
|
+
analytics: AnalyticsApi;
|
|
1393
|
+
sharedAssets: SharedAssetsApi;
|
|
1394
|
+
preloader: PreloaderApi;
|
|
1395
|
+
notifications: NotificationsApi;
|
|
1396
|
+
lifecycles: LifecycleApi;
|
|
1397
|
+
social: SocialApi;
|
|
1398
|
+
}
|
|
1399
|
+
|
|
1400
|
+
interface ShowInterstitialAdOptions {
|
|
1401
|
+
adDisplayId?: string;
|
|
1402
|
+
adDisplayName?: string;
|
|
1403
|
+
}
|
|
1404
|
+
interface ShowRewardedAdOptions {
|
|
1405
|
+
adDisplayId?: string;
|
|
1406
|
+
adDisplayName?: string;
|
|
1407
|
+
}
|
|
1408
|
+
interface AdsApi {
|
|
1409
|
+
isRewardedAdReadyAsync(): Promise<boolean>;
|
|
1410
|
+
showRewardedAdAsync(options?: ShowRewardedAdOptions): Promise<boolean>;
|
|
1411
|
+
showInterstitialAd(options?: ShowInterstitialAdOptions): Promise<boolean>;
|
|
1412
|
+
}
|
|
1413
|
+
|
|
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 };
|