@series-inc/venus-sdk 3.3.0 → 3.4.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{AdsApi-OXtzPhiB.d.mts → AdsApi-CrobHGGD.d.ts} +2 -1
- package/dist/{chunk-QABXMFND.mjs → chunk-3APM3V2M.js} +2 -2
- package/dist/chunk-3APM3V2M.js.map +1 -0
- package/dist/{chunk-UXY5CKKG.mjs → chunk-3UPXLWK7.js} +3 -3
- package/dist/chunk-3UPXLWK7.js.map +1 -0
- package/dist/{chunk-FFDRA6ET.mjs → chunk-RUYSUI26.js} +176 -179
- package/dist/chunk-RUYSUI26.js.map +1 -0
- package/dist/core-NMKO2UFW.js +3 -0
- package/dist/{core-62LWDHN7.mjs.map → core-NMKO2UFW.js.map} +1 -1
- package/dist/index.d.ts +3 -2
- package/dist/{index.mjs → index.js} +5 -6
- package/dist/{index.mjs.map → index.js.map} +1 -1
- package/dist/venus-api/index.d.ts +2 -2
- package/dist/venus-api/{index.mjs → index.js} +20 -34
- package/dist/venus-api/index.js.map +1 -0
- package/dist/vite/{index.mjs → index.js} +2 -2
- package/dist/vite/index.js.map +1 -0
- package/dist/webview/index.js +3 -0
- package/dist/webview/{index.mjs.map → index.js.map} +1 -1
- package/package.json +13 -18
- package/dist/AdsApi-OXtzPhiB.d.ts +0 -1551
- package/dist/chunk-FFDRA6ET.mjs.map +0 -1
- package/dist/chunk-NSSMTXJJ.mjs +0 -7
- package/dist/chunk-NSSMTXJJ.mjs.map +0 -1
- package/dist/chunk-QABXMFND.mjs.map +0 -1
- package/dist/chunk-UXY5CKKG.mjs.map +0 -1
- package/dist/core-62LWDHN7.mjs +0 -4
- package/dist/index.cjs +0 -5273
- package/dist/index.cjs.map +0 -1
- package/dist/index.d.mts +0 -904
- package/dist/venus-api/index.cjs +0 -7186
- package/dist/venus-api/index.cjs.map +0 -1
- package/dist/venus-api/index.d.mts +0 -15
- package/dist/venus-api/index.mjs.map +0 -1
- package/dist/vite/index.cjs +0 -554
- package/dist/vite/index.cjs.map +0 -1
- package/dist/vite/index.mjs.map +0 -1
- package/dist/webview/index.cjs +0 -15
- package/dist/webview/index.cjs.map +0 -1
- package/dist/webview/index.d.mts +0 -15
- package/dist/webview/index.mjs +0 -4
|
@@ -1,1551 +0,0 @@
|
|
|
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 handleRpcResponse;
|
|
60
|
-
private handleRpcNotification;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
interface StorageApi {
|
|
64
|
-
key(index: number): Promise<string | null>;
|
|
65
|
-
clear(): Promise<void>;
|
|
66
|
-
length(): Promise<number>;
|
|
67
|
-
getAllItems(): Promise<string[]>;
|
|
68
|
-
setMultipleItems(items: {
|
|
69
|
-
key: string;
|
|
70
|
-
value: string;
|
|
71
|
-
}[]): Promise<void>;
|
|
72
|
-
removeMultipleItems(keys: string[]): Promise<void>;
|
|
73
|
-
setItem(key: string, item: string): Promise<void>;
|
|
74
|
-
getItem(key: string): Promise<string | null>;
|
|
75
|
-
removeItem(key: string): Promise<void>;
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
interface NavigationStackInfo {
|
|
79
|
-
isInStack: boolean;
|
|
80
|
-
stackPosition: number;
|
|
81
|
-
isTopOfStack: boolean;
|
|
82
|
-
stackDepth: number;
|
|
83
|
-
parentInstanceId: string;
|
|
84
|
-
}
|
|
85
|
-
interface PushAppOptions {
|
|
86
|
-
contextData?: any;
|
|
87
|
-
appParams?: any;
|
|
88
|
-
}
|
|
89
|
-
interface QuitOptions {
|
|
90
|
-
reason?: string;
|
|
91
|
-
forceClose?: boolean;
|
|
92
|
-
[key: string]: any;
|
|
93
|
-
}
|
|
94
|
-
interface NavigationApi {
|
|
95
|
-
pushApp(appId: string, options?: PushAppOptions): Promise<void>;
|
|
96
|
-
popApp(): Promise<void>;
|
|
97
|
-
getStackInfo(): NavigationStackInfo;
|
|
98
|
-
requestPopOrQuit(options?: QuitOptions): Promise<boolean>;
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
type TimeIntervalTriggerInput = {
|
|
102
|
-
type: 'timeInterval';
|
|
103
|
-
seconds: number;
|
|
104
|
-
repeats?: boolean;
|
|
105
|
-
channelId?: string;
|
|
106
|
-
};
|
|
107
|
-
type NotificationTriggerInput = TimeIntervalTriggerInput | null;
|
|
108
|
-
interface ScheduleNotificationOptions {
|
|
109
|
-
priority?: number;
|
|
110
|
-
groupId?: string;
|
|
111
|
-
payload?: Record<string, any>;
|
|
112
|
-
}
|
|
113
|
-
interface ScheduleLocalNotification {
|
|
114
|
-
id: string;
|
|
115
|
-
title?: string | null;
|
|
116
|
-
body?: string | null;
|
|
117
|
-
payload?: Record<string, any>;
|
|
118
|
-
trigger?: NotificationTriggerInput;
|
|
119
|
-
}
|
|
120
|
-
interface NotificationsApi {
|
|
121
|
-
scheduleAsync(title: string, body: string, seconds: number, notificationId?: string, options?: ScheduleNotificationOptions): Promise<string | null>;
|
|
122
|
-
cancelNotification(notificationId: string): Promise<boolean>;
|
|
123
|
-
getAllScheduledLocalNotifications(): Promise<ScheduleLocalNotification[]>;
|
|
124
|
-
isLocalNotificationsEnabled(): Promise<boolean>;
|
|
125
|
-
setLocalNotificationsEnabled(enabled: boolean): Promise<boolean>;
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
interface ShowToastOptions {
|
|
129
|
-
duration?: number;
|
|
130
|
-
variant?: 'success' | 'error' | 'warning' | 'info';
|
|
131
|
-
action?: {
|
|
132
|
-
label: string;
|
|
133
|
-
};
|
|
134
|
-
}
|
|
135
|
-
interface PopupsApi {
|
|
136
|
-
showToast(message: string, options?: ShowToastOptions): Promise<boolean>;
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
interface ProfileApi {
|
|
140
|
-
getCurrentProfile(): Profile;
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
interface DeviceInfo {
|
|
144
|
-
readonly screenSize: {
|
|
145
|
-
readonly width: number;
|
|
146
|
-
readonly height: number;
|
|
147
|
-
};
|
|
148
|
-
readonly viewportSize: {
|
|
149
|
-
readonly width: number;
|
|
150
|
-
readonly height: number;
|
|
151
|
-
};
|
|
152
|
-
readonly orientation: string;
|
|
153
|
-
readonly pixelRatio: number;
|
|
154
|
-
readonly fontScale: number;
|
|
155
|
-
readonly deviceType: string;
|
|
156
|
-
readonly hapticsEnabled: boolean;
|
|
157
|
-
readonly haptics: {
|
|
158
|
-
readonly supported: boolean;
|
|
159
|
-
readonly enabled: boolean;
|
|
160
|
-
};
|
|
161
|
-
}
|
|
162
|
-
interface DeviceApi {
|
|
163
|
-
getDevice(): DeviceInfo;
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
interface EnvironmentInfo {
|
|
167
|
-
readonly isDevelopment: boolean;
|
|
168
|
-
readonly platform: string;
|
|
169
|
-
readonly platformVersion: string;
|
|
170
|
-
readonly browserInfo?: {
|
|
171
|
-
readonly browser: string;
|
|
172
|
-
readonly userAgent: string;
|
|
173
|
-
readonly isMobile: boolean;
|
|
174
|
-
readonly isTablet: boolean;
|
|
175
|
-
readonly language: string;
|
|
176
|
-
};
|
|
177
|
-
}
|
|
178
|
-
interface EnvironmentApi {
|
|
179
|
-
getEnvironment(): EnvironmentInfo;
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
/**
|
|
183
|
-
* System API provides access to device and environment information.
|
|
184
|
-
* This is a unified namespace for system-level configuration data.
|
|
185
|
-
*/
|
|
186
|
-
interface SystemApi {
|
|
187
|
-
/**
|
|
188
|
-
* Get device information (screen size, orientation, capabilities, etc.)
|
|
189
|
-
* @throws Error if called before VenusAPI.initializeAsync() completes
|
|
190
|
-
*/
|
|
191
|
-
getDevice(): DeviceInfo;
|
|
192
|
-
/**
|
|
193
|
-
* Get environment information (platform, browser, development mode, etc.)
|
|
194
|
-
* @throws Error if called before VenusAPI.initializeAsync() completes
|
|
195
|
-
*/
|
|
196
|
-
getEnvironment(): EnvironmentInfo;
|
|
197
|
-
/**
|
|
198
|
-
* Get safe area insets (padding to avoid device notches and host UI).
|
|
199
|
-
* This includes the toolbar/feedHeader height plus device safe areas.
|
|
200
|
-
* Safe area is static - it's set once during initialization and doesn't change.
|
|
201
|
-
* @returns SafeArea with top, right, bottom, left padding values in pixels
|
|
202
|
-
* @throws Error if called before VenusAPI.initializeAsync() completes
|
|
203
|
-
*/
|
|
204
|
-
getSafeArea(): SafeArea;
|
|
205
|
-
/**
|
|
206
|
-
* Check if running on mobile device
|
|
207
|
-
* @returns true if on mobile device (iOS, Android, or mobile browser)
|
|
208
|
-
*/
|
|
209
|
-
isMobile(): boolean;
|
|
210
|
-
/**
|
|
211
|
-
* Check if running on web platform
|
|
212
|
-
* @returns true if on web platform
|
|
213
|
-
*/
|
|
214
|
-
isWeb(): boolean;
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
type SubPath = string;
|
|
218
|
-
interface FetchBlobOptions {
|
|
219
|
-
timeout?: number;
|
|
220
|
-
}
|
|
221
|
-
interface CdnApi {
|
|
222
|
-
resolveAssetUrl(subPath: string): string;
|
|
223
|
-
resolveAvatarAssetUrl(subPath: string): string;
|
|
224
|
-
resolveSharedLibUrl(subPath: string): string;
|
|
225
|
-
getAssetCdnBaseUrl(): string;
|
|
226
|
-
fetchFromCdn(url: string, request?: RequestInit): Promise<Response>;
|
|
227
|
-
fetchBlob(path: SubPath, options?: FetchBlobOptions): Promise<Blob>;
|
|
228
|
-
}
|
|
229
|
-
|
|
230
|
-
interface ServerTimeData {
|
|
231
|
-
serverTime: number;
|
|
232
|
-
localTime: number;
|
|
233
|
-
timezoneOffset: number;
|
|
234
|
-
formattedTime: string;
|
|
235
|
-
locale: string;
|
|
236
|
-
}
|
|
237
|
-
interface GetFutureTimeOptions {
|
|
238
|
-
days?: number;
|
|
239
|
-
hours?: number;
|
|
240
|
-
minutes?: number;
|
|
241
|
-
timeOfDay?: {
|
|
242
|
-
hour: number;
|
|
243
|
-
minute: number;
|
|
244
|
-
second: number;
|
|
245
|
-
};
|
|
246
|
-
timezone?: any;
|
|
247
|
-
}
|
|
248
|
-
interface TimeApi {
|
|
249
|
-
requestTimeAsync(): Promise<ServerTimeData>;
|
|
250
|
-
formatTime(timestamp: number, options?: any): string;
|
|
251
|
-
formatNumber(value: number, options?: Intl.NumberFormatOptions): string;
|
|
252
|
-
getFutureTimeAsync(options?: GetFutureTimeOptions): Promise<number>;
|
|
253
|
-
}
|
|
254
|
-
|
|
255
|
-
interface AiMessage {
|
|
256
|
-
/**
|
|
257
|
-
* Depends on the model you are using. Most common is user, system, and assistant.
|
|
258
|
-
* If you are unsure, look up the specific model you are using.
|
|
259
|
-
*/
|
|
260
|
-
role: string;
|
|
261
|
-
content: string;
|
|
262
|
-
}
|
|
263
|
-
type AiChatCompletionRequest = {
|
|
264
|
-
model: string;
|
|
265
|
-
messages?: Array<AiMessage>;
|
|
266
|
-
maxTokens?: number;
|
|
267
|
-
temperature?: number;
|
|
268
|
-
topP?: number;
|
|
269
|
-
topK?: number;
|
|
270
|
-
n?: number;
|
|
271
|
-
stop?: string | string[];
|
|
272
|
-
presencePenalty?: number;
|
|
273
|
-
frequencyPenalty?: number;
|
|
274
|
-
logitBias?: Record<string, number>;
|
|
275
|
-
seed?: number;
|
|
276
|
-
/**
|
|
277
|
-
* This is ONLY ever used when running the sdk outside of venus.
|
|
278
|
-
* This gets ignored when the game using the sdk is used within a venus instance.
|
|
279
|
-
*
|
|
280
|
-
* In other words, this should only be uswed when developing a game locally.
|
|
281
|
-
*/
|
|
282
|
-
apiKey?: string;
|
|
283
|
-
};
|
|
284
|
-
type AiChatCompletionData = {
|
|
285
|
-
id: string;
|
|
286
|
-
ullm_id: string;
|
|
287
|
-
cost: {
|
|
288
|
-
prompt_cost: number;
|
|
289
|
-
completion_cost: number;
|
|
290
|
-
};
|
|
291
|
-
object: string;
|
|
292
|
-
created: number;
|
|
293
|
-
model: string;
|
|
294
|
-
choices: Array<{
|
|
295
|
-
index: number;
|
|
296
|
-
message: {
|
|
297
|
-
role: string;
|
|
298
|
-
content: string;
|
|
299
|
-
};
|
|
300
|
-
finish_reason: string;
|
|
301
|
-
}>;
|
|
302
|
-
usage: {
|
|
303
|
-
prompt_tokens: number;
|
|
304
|
-
completion_tokens: number;
|
|
305
|
-
total_tokens: number;
|
|
306
|
-
reasoning_tokens?: number;
|
|
307
|
-
cache_read_tokens?: number;
|
|
308
|
-
cache_write_tokens?: number;
|
|
309
|
-
};
|
|
310
|
-
};
|
|
311
|
-
interface AiApi {
|
|
312
|
-
requestChatCompletionAsync(request: AiChatCompletionRequest): Promise<AiChatCompletionData>;
|
|
313
|
-
getAvailableCompletionModels(): Promise<Array<string>>;
|
|
314
|
-
}
|
|
315
|
-
|
|
316
|
-
declare enum HapticFeedbackStyle {
|
|
317
|
-
Light = "light",
|
|
318
|
-
Medium = "medium",
|
|
319
|
-
Heavy = "heavy",
|
|
320
|
-
Success = "success",
|
|
321
|
-
Warning = "warning",
|
|
322
|
-
Error = "error"
|
|
323
|
-
}
|
|
324
|
-
interface HapticsApi {
|
|
325
|
-
triggerHapticAsync(style: HapticFeedbackStyle): Promise<void>;
|
|
326
|
-
}
|
|
327
|
-
|
|
328
|
-
interface Experiment {
|
|
329
|
-
readonly name: string;
|
|
330
|
-
readonly ruleID: string;
|
|
331
|
-
readonly value: Record<string, unknown>;
|
|
332
|
-
readonly groupName: string | null;
|
|
333
|
-
}
|
|
334
|
-
interface FeaturesApi {
|
|
335
|
-
getExperiment(experimentName: string): Promise<Experiment | null>;
|
|
336
|
-
getFeatureFlag(flagName: string): Promise<boolean>;
|
|
337
|
-
getFeatureGate(gateName: string): Promise<boolean>;
|
|
338
|
-
}
|
|
339
|
-
|
|
340
|
-
type AwakeCallback = () => void;
|
|
341
|
-
type SleepCallback = () => void;
|
|
342
|
-
type ResumeCallback = () => void;
|
|
343
|
-
type PauseCallback = () => void;
|
|
344
|
-
type QuitCallback = () => void;
|
|
345
|
-
interface LifecycleApi {
|
|
346
|
-
/**
|
|
347
|
-
* Registers a callback for when the game transitions from "idle" to "active" state.
|
|
348
|
-
*
|
|
349
|
-
* This occurs when the game comes to the foreground. Use this to load heavy resources
|
|
350
|
-
* or resume activities that were paused during sleep.
|
|
351
|
-
*
|
|
352
|
-
* @param callback - Function to execute when the game awakens
|
|
353
|
-
* @returns Subscription object that can be used to unsubscribe from the event
|
|
354
|
-
*/
|
|
355
|
-
onAwake(callback: AwakeCallback): Subscription;
|
|
356
|
-
/**
|
|
357
|
-
* Registers a callback for when the game transitions from "active" to "idle" state.
|
|
358
|
-
*
|
|
359
|
-
* This occurs when the game goes to the background. Use this to unload heavy resources,
|
|
360
|
-
* save state, or pause non-essential activities.
|
|
361
|
-
*
|
|
362
|
-
* @param callback - Function to execute when the game goes to sleep
|
|
363
|
-
* @returns Subscription object that can be used to unsubscribe from the event
|
|
364
|
-
*/
|
|
365
|
-
onSleep(callback: SleepCallback): Subscription;
|
|
366
|
-
/**
|
|
367
|
-
* Registers a callback for when gameplay should resume.
|
|
368
|
-
*
|
|
369
|
-
* This occurs when the platform dismisses dialogs or overlays, or when players
|
|
370
|
-
* return from a temporary switch. Use this to resume game logic and animations.
|
|
371
|
-
*
|
|
372
|
-
* @param callback - Function to execute when gameplay resumes
|
|
373
|
-
* @returns Subscription object that can be used to unsubscribe from the event
|
|
374
|
-
*/
|
|
375
|
-
onResume(callback: ResumeCallback): Subscription;
|
|
376
|
-
/**
|
|
377
|
-
* Registers a callback for when gameplay should pause.
|
|
378
|
-
*
|
|
379
|
-
* This occurs when the platform brings up dialogs or overlays, or when players
|
|
380
|
-
* temporarily switch away. Use this to pause game logic and animations.
|
|
381
|
-
*
|
|
382
|
-
* @param callback - Function to execute when gameplay pauses
|
|
383
|
-
* @returns Subscription object that can be used to unsubscribe from the event
|
|
384
|
-
*/
|
|
385
|
-
onPause(callback: PauseCallback): Subscription;
|
|
386
|
-
/**
|
|
387
|
-
* Registers a callback for final teardown before the game instance is destroyed.
|
|
388
|
-
*
|
|
389
|
-
* This is the last chance to clean up resources, save state, and perform any
|
|
390
|
-
* necessary cleanup before the game instance is destroyed or replaced.
|
|
391
|
-
*
|
|
392
|
-
* @param callback - Function to execute during cleanup
|
|
393
|
-
* @returns Subscription object that can be used to unsubscribe from the event
|
|
394
|
-
*/
|
|
395
|
-
onQuit(callback: QuitCallback): Subscription;
|
|
396
|
-
}
|
|
397
|
-
|
|
398
|
-
interface ExecuteRecipeOptions {
|
|
399
|
-
roomId?: string;
|
|
400
|
-
batchAmount?: number;
|
|
401
|
-
allowPartialBatch?: boolean;
|
|
402
|
-
entity?: string;
|
|
403
|
-
}
|
|
404
|
-
interface GetActiveRunsOptions {
|
|
405
|
-
roomId?: string;
|
|
406
|
-
}
|
|
407
|
-
interface ExecuteScopedRecipeOptions {
|
|
408
|
-
roomId?: string;
|
|
409
|
-
}
|
|
410
|
-
interface GetAvailableRecipesOptions {
|
|
411
|
-
roomId?: string;
|
|
412
|
-
includeActorRecipes?: boolean;
|
|
413
|
-
}
|
|
414
|
-
interface Recipe {
|
|
415
|
-
recipeId: string;
|
|
416
|
-
entity?: string;
|
|
417
|
-
batchAmount?: number;
|
|
418
|
-
}
|
|
419
|
-
interface TriggerRecipeChainOptions {
|
|
420
|
-
roomId?: string;
|
|
421
|
-
context?: Record<string, unknown>;
|
|
422
|
-
}
|
|
423
|
-
interface CollectRecipeResult {
|
|
424
|
-
success: boolean;
|
|
425
|
-
runId: string;
|
|
426
|
-
rewards: Record<string, unknown>;
|
|
427
|
-
message: string;
|
|
428
|
-
}
|
|
429
|
-
interface ExecuteScopedRecipeResult {
|
|
430
|
-
success: boolean;
|
|
431
|
-
message: string;
|
|
432
|
-
}
|
|
433
|
-
interface RecipeInfo {
|
|
434
|
-
id: string;
|
|
435
|
-
scope: string;
|
|
436
|
-
clientViewable: boolean;
|
|
437
|
-
}
|
|
438
|
-
interface GetAvailableRecipesResult {
|
|
439
|
-
success: boolean;
|
|
440
|
-
recipes: RecipeInfo[];
|
|
441
|
-
}
|
|
442
|
-
interface GetBatchRecipeRequirements {
|
|
443
|
-
success: boolean;
|
|
444
|
-
results: RecipeRequirementResult[];
|
|
445
|
-
}
|
|
446
|
-
interface SimulationPersonalState {
|
|
447
|
-
inventory: Record<string, number | string>;
|
|
448
|
-
activeRuns: SimulationRunSummary[];
|
|
449
|
-
disabledRecipes: string[];
|
|
450
|
-
}
|
|
451
|
-
interface SimulationRoomActiveRecipe {
|
|
452
|
-
recipeId: string;
|
|
453
|
-
scope: 'room' | 'actor';
|
|
454
|
-
startedAt: number;
|
|
455
|
-
expiresAt: number;
|
|
456
|
-
commitmentEndsAt?: number;
|
|
457
|
-
}
|
|
458
|
-
interface SimulationRoomState {
|
|
459
|
-
activeRecipes: Record<string, SimulationRoomActiveRecipe>;
|
|
460
|
-
sharedAssets: Record<string, number | string>;
|
|
461
|
-
actors: Array<Record<string, unknown>>;
|
|
462
|
-
activeRuns: SimulationRunSummary[];
|
|
463
|
-
}
|
|
464
|
-
type SimulationState = SimulationPersonalState | SimulationRoomState;
|
|
465
|
-
interface SimulationSlotContainer {
|
|
466
|
-
entityId: string;
|
|
467
|
-
slots: Record<string, unknown>;
|
|
468
|
-
isOwned: boolean;
|
|
469
|
-
powerCalculationRecipe?: string;
|
|
470
|
-
}
|
|
471
|
-
interface SimulationAvailableItem {
|
|
472
|
-
entityId: string;
|
|
473
|
-
quantity: number;
|
|
474
|
-
metadata: Record<string, unknown>;
|
|
475
|
-
tags: string[];
|
|
476
|
-
isCompatible: boolean;
|
|
477
|
-
}
|
|
478
|
-
interface SimulationSlotValidationResult {
|
|
479
|
-
valid: boolean;
|
|
480
|
-
error?: string;
|
|
481
|
-
}
|
|
482
|
-
interface SimulationAssignment {
|
|
483
|
-
id: string;
|
|
484
|
-
containerId: string;
|
|
485
|
-
slotId: string;
|
|
486
|
-
itemId: string | null;
|
|
487
|
-
profileId: string;
|
|
488
|
-
appId: string;
|
|
489
|
-
createdAt: number;
|
|
490
|
-
metadata?: Record<string, unknown>;
|
|
491
|
-
}
|
|
492
|
-
interface SimulationSlotMutationResult {
|
|
493
|
-
success: boolean;
|
|
494
|
-
error?: string;
|
|
495
|
-
association?: SimulationAssignment;
|
|
496
|
-
}
|
|
497
|
-
interface SimulationBatchOperationAssign {
|
|
498
|
-
type: 'assign';
|
|
499
|
-
containerId: string;
|
|
500
|
-
slotId: string;
|
|
501
|
-
itemId: string;
|
|
502
|
-
}
|
|
503
|
-
interface SimulationBatchOperationRemove {
|
|
504
|
-
type: 'remove';
|
|
505
|
-
containerId: string;
|
|
506
|
-
slotId: string;
|
|
507
|
-
itemId?: string;
|
|
508
|
-
}
|
|
509
|
-
type SimulationBatchOperation = SimulationBatchOperationAssign | SimulationBatchOperationRemove;
|
|
510
|
-
interface SimulationBatchOperationResult {
|
|
511
|
-
success: boolean;
|
|
512
|
-
error?: string;
|
|
513
|
-
association?: SimulationAssignment;
|
|
514
|
-
operation: SimulationBatchOperation;
|
|
515
|
-
}
|
|
516
|
-
interface SimulationBatchOperationsResult {
|
|
517
|
-
success: boolean;
|
|
518
|
-
results: SimulationBatchOperationResult[];
|
|
519
|
-
affectedContainers: string[];
|
|
520
|
-
}
|
|
521
|
-
interface SimulationPowerPreview {
|
|
522
|
-
currentPower: number;
|
|
523
|
-
previewPower: number;
|
|
524
|
-
powerDelta: number;
|
|
525
|
-
breakdown: Record<string, number>;
|
|
526
|
-
}
|
|
527
|
-
interface ExecuteRecipeResponse {
|
|
528
|
-
success: boolean;
|
|
529
|
-
status?: string;
|
|
530
|
-
runId?: string;
|
|
531
|
-
expiresAt?: string;
|
|
532
|
-
queuePosition?: number;
|
|
533
|
-
outputs?: Record<string, number | string>;
|
|
534
|
-
data?: Record<string, unknown>;
|
|
535
|
-
message?: string;
|
|
536
|
-
amountRequested?: number;
|
|
537
|
-
amountFulfilled?: number;
|
|
538
|
-
partialSuccess?: boolean;
|
|
539
|
-
}
|
|
540
|
-
interface SimulationApi {
|
|
541
|
-
isEnabled(): boolean;
|
|
542
|
-
getStateAsync(roomId?: string): Promise<SimulationState>;
|
|
543
|
-
getConfigAsync(roomId?: string): Promise<VenusSimulationConfig>;
|
|
544
|
-
executeRecipeAsync(recipeId: string, inputs?: Record<string, unknown>, options?: ExecuteRecipeOptions): Promise<ExecuteRecipeResponse>;
|
|
545
|
-
getActiveRunsAsync(options?: GetActiveRunsOptions): Promise<SimulationRunSummary[]>;
|
|
546
|
-
collectRecipeAsync(runId: string): Promise<CollectRecipeResult>;
|
|
547
|
-
executeScopedRecipeAsync(recipeId: string, entity: string, inputs?: Record<string, unknown>, options?: ExecuteScopedRecipeOptions): Promise<ExecuteScopedRecipeResult>;
|
|
548
|
-
triggerRecipeChainAsync(recipeId: string, options?: TriggerRecipeChainOptions): Promise<ExecuteRecipeResponse>;
|
|
549
|
-
getAvailableRecipesAsync(options?: GetAvailableRecipesOptions): Promise<GetAvailableRecipesResult>;
|
|
550
|
-
getRecipeRequirementsAsync(recipe: Recipe): Promise<RecipeRequirementResult>;
|
|
551
|
-
getBatchRecipeRequirementsAsync(recipes: Recipe[]): Promise<GetBatchRecipeRequirements>;
|
|
552
|
-
resolveFieldValueAsync(entityId: string, fieldPath: string, entity?: string): Promise<unknown>;
|
|
553
|
-
getEntityMetadataAsync(entityId: string): Promise<Record<string, unknown>>;
|
|
554
|
-
getSlotContainersAsync(): Promise<SimulationSlotContainer[]>;
|
|
555
|
-
getSlotAssignmentsAsync(containerId: string): Promise<SimulationAssignment[]>;
|
|
556
|
-
assignItemToSlotAsync(containerId: string, slotId: string, itemId: string): Promise<SimulationSlotMutationResult>;
|
|
557
|
-
removeItemFromSlotAsync(containerId: string, slotId: string): Promise<SimulationSlotMutationResult>;
|
|
558
|
-
getAvailableItemsAsync(containerId: string, slotId: string): Promise<SimulationAvailableItem[]>;
|
|
559
|
-
calculatePowerPreviewAsync(containerId: string, slotId: string, candidateItemId: string): Promise<SimulationPowerPreview>;
|
|
560
|
-
validateSlotAssignmentAsync(containerId: string, slotId: string, itemId: string): Promise<SimulationSlotValidationResult>;
|
|
561
|
-
executeBatchOperationsAsync(operations: Array<SimulationBatchOperation>, validateOnly?: boolean): Promise<SimulationBatchOperationsResult>;
|
|
562
|
-
subscribeAsync(options: SimulationSubscribeOptions): Promise<() => void>;
|
|
563
|
-
}
|
|
564
|
-
|
|
565
|
-
interface VenusRoomPayload extends Record<string, unknown> {
|
|
566
|
-
id: string;
|
|
567
|
-
name?: string;
|
|
568
|
-
currentPlayers?: string[];
|
|
569
|
-
maxPlayers?: number;
|
|
570
|
-
gameType?: string;
|
|
571
|
-
appId?: string;
|
|
572
|
-
type?: string;
|
|
573
|
-
createdBy?: string;
|
|
574
|
-
createdAt?: number;
|
|
575
|
-
updatedAt?: number;
|
|
576
|
-
isPrivate?: boolean;
|
|
577
|
-
status?: string;
|
|
578
|
-
customMetadata?: Record<string, unknown>;
|
|
579
|
-
admins?: string[];
|
|
580
|
-
roomCode?: string;
|
|
581
|
-
description?: string;
|
|
582
|
-
data?: Record<string, unknown>;
|
|
583
|
-
version?: string;
|
|
584
|
-
}
|
|
585
|
-
declare class VenusRoom {
|
|
586
|
-
readonly id: string;
|
|
587
|
-
name?: string;
|
|
588
|
-
players: string[];
|
|
589
|
-
maxPlayers?: number;
|
|
590
|
-
gameType?: string;
|
|
591
|
-
appId?: string;
|
|
592
|
-
type?: string;
|
|
593
|
-
createdBy?: string;
|
|
594
|
-
createdAt?: number;
|
|
595
|
-
updatedAt?: number;
|
|
596
|
-
isPrivate?: boolean;
|
|
597
|
-
status?: string;
|
|
598
|
-
customMetadata: Record<string, unknown>;
|
|
599
|
-
admins: string[];
|
|
600
|
-
roomCode?: string;
|
|
601
|
-
description?: string;
|
|
602
|
-
data: Record<string, unknown>;
|
|
603
|
-
version?: string;
|
|
604
|
-
constructor(roomData: VenusRoomPayload);
|
|
605
|
-
}
|
|
606
|
-
|
|
607
|
-
interface CreateRoomOptions {
|
|
608
|
-
maxPlayers?: number;
|
|
609
|
-
gameType?: string;
|
|
610
|
-
isPrivate?: boolean;
|
|
611
|
-
roomCode?: string;
|
|
612
|
-
name?: string;
|
|
613
|
-
description?: string;
|
|
614
|
-
customMetadata?: Record<string, unknown>;
|
|
615
|
-
data?: Record<string, unknown>;
|
|
616
|
-
}
|
|
617
|
-
interface JoinRoomMatchCriteria {
|
|
618
|
-
isPrivate?: boolean;
|
|
619
|
-
hasSpace?: boolean;
|
|
620
|
-
gameType?: string;
|
|
621
|
-
[key: string]: unknown;
|
|
622
|
-
}
|
|
623
|
-
interface JoinOrCreateRoomOptions {
|
|
624
|
-
matchCriteria?: JoinRoomMatchCriteria;
|
|
625
|
-
createOptions: CreateRoomOptions;
|
|
626
|
-
}
|
|
627
|
-
interface JoinOrCreateResult {
|
|
628
|
-
action: 'created' | 'joined';
|
|
629
|
-
room: VenusRoom;
|
|
630
|
-
playersJoined: number;
|
|
631
|
-
}
|
|
632
|
-
interface ListRoomsOptions {
|
|
633
|
-
includeArchived?: boolean;
|
|
634
|
-
}
|
|
635
|
-
interface RoomDataUpdate {
|
|
636
|
-
type: 'H5_ROOM_DATA_UPDATED';
|
|
637
|
-
roomId: string;
|
|
638
|
-
roomData: Record<string, unknown>;
|
|
639
|
-
timestamp?: number;
|
|
640
|
-
}
|
|
641
|
-
type RoomMessageEventType = 'H5_ROOM_MESSAGE_RECEIVED' | 'H5_ROOM_MESSAGE_UPDATED' | 'H5_ROOM_MESSAGE_DELETED';
|
|
642
|
-
interface RoomMessageEvent {
|
|
643
|
-
type: RoomMessageEventType;
|
|
644
|
-
roomId: string;
|
|
645
|
-
message: Record<string, unknown>;
|
|
646
|
-
timestamp?: number;
|
|
647
|
-
}
|
|
648
|
-
interface ProposedMoveEvent {
|
|
649
|
-
type: 'app:h5:proposedMoveValidationUpdated';
|
|
650
|
-
roomId: string;
|
|
651
|
-
proposedMoveData: Record<string, unknown>;
|
|
652
|
-
proposedMoveId?: string;
|
|
653
|
-
changeType?: string;
|
|
654
|
-
timestamp?: number;
|
|
655
|
-
}
|
|
656
|
-
interface RoomSubscriptionOptions {
|
|
657
|
-
onData?: (event: RoomDataUpdate) => void;
|
|
658
|
-
onMessages?: (event: RoomMessageEvent) => void;
|
|
659
|
-
onGameEvents?: (event: ProposedMoveEvent) => void;
|
|
660
|
-
}
|
|
661
|
-
interface ProposeMoveRequest {
|
|
662
|
-
gameSpecificState: Record<string, unknown>;
|
|
663
|
-
moveType: string;
|
|
664
|
-
clientContext?: Record<string, unknown>;
|
|
665
|
-
clientProposalId?: string;
|
|
666
|
-
}
|
|
667
|
-
interface ProposeMoveResult {
|
|
668
|
-
proposedMoveId: string;
|
|
669
|
-
}
|
|
670
|
-
interface ValidateMoveVerdict {
|
|
671
|
-
isValid: boolean;
|
|
672
|
-
reason?: string | null;
|
|
673
|
-
validatorId?: string | null;
|
|
674
|
-
}
|
|
675
|
-
interface ValidateMoveResult {
|
|
676
|
-
success: boolean;
|
|
677
|
-
moveId: string;
|
|
678
|
-
isValid: boolean;
|
|
679
|
-
reason?: string | null;
|
|
680
|
-
}
|
|
681
|
-
interface UpdateRoomDataOptions {
|
|
682
|
-
merge?: boolean;
|
|
683
|
-
}
|
|
684
|
-
interface RoomMessageRequest {
|
|
685
|
-
message: Record<string, unknown>;
|
|
686
|
-
metadata?: Record<string, unknown>;
|
|
687
|
-
}
|
|
688
|
-
interface StartRoomGameOptions {
|
|
689
|
-
gameConfig?: Record<string, unknown>;
|
|
690
|
-
turnOrder?: string[] | null;
|
|
691
|
-
}
|
|
692
|
-
interface RoomsApi {
|
|
693
|
-
createRoomAsync(options: CreateRoomOptions): Promise<VenusRoom>;
|
|
694
|
-
joinOrCreateRoomAsync(options: JoinOrCreateRoomOptions): Promise<JoinOrCreateResult>;
|
|
695
|
-
joinRoomByCodeAsync(roomCode: string): Promise<VenusRoom>;
|
|
696
|
-
getUserRoomsAsync(options?: ListRoomsOptions): Promise<VenusRoom[]>;
|
|
697
|
-
subscribeAsync(room: VenusRoom, options?: RoomSubscriptionOptions): Promise<() => void>;
|
|
698
|
-
updateRoomDataAsync(room: VenusRoom, updates: Record<string, unknown>, options?: UpdateRoomDataOptions): Promise<void>;
|
|
699
|
-
getRoomDataAsync(room: VenusRoom): Promise<Record<string, unknown>>;
|
|
700
|
-
sendRoomMessageAsync(room: VenusRoom, message: RoomMessageRequest): Promise<string>;
|
|
701
|
-
leaveRoomAsync(room: VenusRoom): Promise<void>;
|
|
702
|
-
startRoomGameAsync(room: VenusRoom, options?: StartRoomGameOptions): Promise<void>;
|
|
703
|
-
proposeMoveAsync(room: VenusRoom, request: ProposeMoveRequest): Promise<ProposeMoveResult>;
|
|
704
|
-
validateMoveAsync(room: VenusRoom, moveId: string, verdict: ValidateMoveVerdict): Promise<ValidateMoveResult>;
|
|
705
|
-
}
|
|
706
|
-
|
|
707
|
-
interface VenusMessage {
|
|
708
|
-
type: string;
|
|
709
|
-
direction: string;
|
|
710
|
-
data?: {
|
|
711
|
-
requestId?: string;
|
|
712
|
-
success?: boolean;
|
|
713
|
-
value?: any;
|
|
714
|
-
data?: any;
|
|
715
|
-
error?: string;
|
|
716
|
-
script?: string;
|
|
717
|
-
};
|
|
718
|
-
instanceId: string;
|
|
719
|
-
timestamp: number;
|
|
720
|
-
}
|
|
721
|
-
declare global {
|
|
722
|
-
interface Window {
|
|
723
|
-
_venusInitState?: {
|
|
724
|
-
poolId: string;
|
|
725
|
-
apiInjected: boolean;
|
|
726
|
-
gameInitialized: boolean;
|
|
727
|
-
};
|
|
728
|
-
ReactNativeWebView?: {
|
|
729
|
-
postMessage(message: string): void;
|
|
730
|
-
};
|
|
731
|
-
venus: {
|
|
732
|
-
_config: {
|
|
733
|
-
locale: string;
|
|
734
|
-
instanceId: string;
|
|
735
|
-
context?: any;
|
|
736
|
-
profile?: {
|
|
737
|
-
id?: string;
|
|
738
|
-
username?: string;
|
|
739
|
-
name?: string;
|
|
740
|
-
displayName?: string;
|
|
741
|
-
avatarUrl?: string | null;
|
|
742
|
-
isAnonymous?: boolean;
|
|
743
|
-
};
|
|
744
|
-
environment: {
|
|
745
|
-
browserInfo?: {
|
|
746
|
-
language: string;
|
|
747
|
-
};
|
|
748
|
-
};
|
|
749
|
-
_handlers: Record<string, any>;
|
|
750
|
-
};
|
|
751
|
-
profile?: {
|
|
752
|
-
id?: string;
|
|
753
|
-
username?: string;
|
|
754
|
-
avatarUrl?: string | null;
|
|
755
|
-
name?: string;
|
|
756
|
-
displayName?: string;
|
|
757
|
-
isAnonymous?: boolean;
|
|
758
|
-
} | null;
|
|
759
|
-
_fetchFromCdn: (url: string) => Promise<string>;
|
|
760
|
-
};
|
|
761
|
-
}
|
|
762
|
-
}
|
|
763
|
-
type OnVenusMessageCallback = (message: VenusMessage) => void;
|
|
764
|
-
declare class VenusTransport implements RpcTransport {
|
|
765
|
-
private readonly messageHandler;
|
|
766
|
-
private readonly onNotificationCallbacks;
|
|
767
|
-
private readonly onNotificationCallbacksToRemove;
|
|
768
|
-
private readonly onVenusMessageCallbacks;
|
|
769
|
-
private readonly onResponseCallbacks;
|
|
770
|
-
private readonly onResponseCallbacksToRemove;
|
|
771
|
-
private _instanceId;
|
|
772
|
-
private isStarted;
|
|
773
|
-
private isProcessingMessage;
|
|
774
|
-
constructor();
|
|
775
|
-
onNotification(callback: OnNotificationCallback): Subscription;
|
|
776
|
-
onRequest(callback: OnRequestCallback): Subscription;
|
|
777
|
-
onResponse(callback: OnResponseCallback): Subscription;
|
|
778
|
-
get instanceId(): string | null;
|
|
779
|
-
set instanceId(instanceId: string);
|
|
780
|
-
sendRequest(request: RpcRequest): void;
|
|
781
|
-
sendVenusMessage(message: VenusMessage): void;
|
|
782
|
-
sendResponse(response: RpcResponse): void;
|
|
783
|
-
start(): void;
|
|
784
|
-
stop(): void;
|
|
785
|
-
private handleNotification;
|
|
786
|
-
private handleResponse;
|
|
787
|
-
private removeOnResponseCallback;
|
|
788
|
-
private removeOnNotificationCallback;
|
|
789
|
-
private logInfo;
|
|
790
|
-
private logWarn;
|
|
791
|
-
onVenusMessage(callback: OnVenusMessageCallback): Subscription;
|
|
792
|
-
private notifyVenusMessageReceived;
|
|
793
|
-
}
|
|
794
|
-
|
|
795
|
-
interface LoggingApi {
|
|
796
|
-
logDebug(message: string, ...args: any[]): void;
|
|
797
|
-
logError(message: string, ...args: any[]): void;
|
|
798
|
-
}
|
|
799
|
-
|
|
800
|
-
interface SharedAssetsApi {
|
|
801
|
-
loadAssetsBundle(game: string, bundleKey: string): Promise<ArrayBuffer>;
|
|
802
|
-
}
|
|
803
|
-
|
|
804
|
-
declare class RpcSharedAssetsApi implements SharedAssetsApi {
|
|
805
|
-
private readonly venusApi;
|
|
806
|
-
private readonly rpcClient;
|
|
807
|
-
constructor(rpcClient: RpcClient, venusApi: VenusAPI);
|
|
808
|
-
loadAssetsBundle(game: string, bundleKey: string, fileType?: string): Promise<ArrayBuffer>;
|
|
809
|
-
}
|
|
810
|
-
interface LoadEmbeddedAssetsRequest {
|
|
811
|
-
assetKey: string;
|
|
812
|
-
}
|
|
813
|
-
interface LoadEmbeddedAssetsResponse {
|
|
814
|
-
base64Data: string;
|
|
815
|
-
}
|
|
816
|
-
|
|
817
|
-
interface SpendCurrencyOptions {
|
|
818
|
-
screenName?: string;
|
|
819
|
-
}
|
|
820
|
-
interface IapApi {
|
|
821
|
-
getHardCurrencyBalance(): Promise<number>;
|
|
822
|
-
spendCurrency(productId: string, amount: number, options?: SpendCurrencyOptions): Promise<void>;
|
|
823
|
-
openStore(): Promise<void>;
|
|
824
|
-
getCurrencyIcon(): Promise<LoadEmbeddedAssetsResponse>;
|
|
825
|
-
}
|
|
826
|
-
|
|
827
|
-
interface LeaderboardModeConfig {
|
|
828
|
-
displayName: string;
|
|
829
|
-
minDurationSec?: number;
|
|
830
|
-
maxDurationSec?: number;
|
|
831
|
-
minScore?: number;
|
|
832
|
-
maxScore?: number;
|
|
833
|
-
}
|
|
834
|
-
type LeaderboardPeriodType = 'daily' | 'weekly' | 'monthly' | 'alltime';
|
|
835
|
-
interface LeaderboardPeriodConfig {
|
|
836
|
-
displayName: string;
|
|
837
|
-
type: LeaderboardPeriodType;
|
|
838
|
-
}
|
|
839
|
-
interface LeaderboardAntiCheatConfig {
|
|
840
|
-
enableZScoreDetection: boolean;
|
|
841
|
-
zScoreThreshold: number;
|
|
842
|
-
enableRateLimit: boolean;
|
|
843
|
-
minTimeBetweenSubmissionsSec: number;
|
|
844
|
-
trustScoreDecayPerFlag: number;
|
|
845
|
-
shadowBanThreshold: number;
|
|
846
|
-
}
|
|
847
|
-
interface LeaderboardDisplaySettings {
|
|
848
|
-
maxEntriesPerPage: number;
|
|
849
|
-
}
|
|
850
|
-
interface LeaderboardConfig {
|
|
851
|
-
minDurationSec: number;
|
|
852
|
-
maxDurationSec: number;
|
|
853
|
-
minScore: number;
|
|
854
|
-
maxScore: number;
|
|
855
|
-
requiresToken: boolean;
|
|
856
|
-
enableScoreSealing: boolean;
|
|
857
|
-
scoreSealingSecret?: string;
|
|
858
|
-
modes: Record<string, LeaderboardModeConfig>;
|
|
859
|
-
periods: Record<string, LeaderboardPeriodConfig>;
|
|
860
|
-
antiCheat: LeaderboardAntiCheatConfig;
|
|
861
|
-
displaySettings: LeaderboardDisplaySettings;
|
|
862
|
-
}
|
|
863
|
-
interface ScoreToken {
|
|
864
|
-
token: string;
|
|
865
|
-
startTime: number;
|
|
866
|
-
expiresAt: number;
|
|
867
|
-
sealingNonce?: string | null;
|
|
868
|
-
sealingSecret?: string | null;
|
|
869
|
-
mode: string;
|
|
870
|
-
}
|
|
871
|
-
interface SubmitScoreParams {
|
|
872
|
-
token?: string;
|
|
873
|
-
score: number;
|
|
874
|
-
duration: number;
|
|
875
|
-
mode?: string;
|
|
876
|
-
telemetry?: Record<string, any>;
|
|
877
|
-
metadata?: Record<string, any>;
|
|
878
|
-
}
|
|
879
|
-
interface SubmitScoreResult {
|
|
880
|
-
accepted: boolean;
|
|
881
|
-
rank?: number | null;
|
|
882
|
-
zScore?: number | null;
|
|
883
|
-
isAnomaly?: boolean;
|
|
884
|
-
}
|
|
885
|
-
interface GetPagedScoresOptions {
|
|
886
|
-
mode?: string;
|
|
887
|
-
period?: string;
|
|
888
|
-
periodDate?: number | string;
|
|
889
|
-
cursor?: string | null;
|
|
890
|
-
limit?: number;
|
|
891
|
-
variant?: 'standard' | 'highlight';
|
|
892
|
-
topCount?: number;
|
|
893
|
-
contextAhead?: number;
|
|
894
|
-
contextBehind?: number;
|
|
895
|
-
}
|
|
896
|
-
interface LeaderboardEntry {
|
|
897
|
-
profileId: string;
|
|
898
|
-
username: string;
|
|
899
|
-
avatarUrl: string | null;
|
|
900
|
-
score: number;
|
|
901
|
-
duration: number;
|
|
902
|
-
submittedAt: number;
|
|
903
|
-
token?: string;
|
|
904
|
-
rank: number | null;
|
|
905
|
-
zScore?: number | null;
|
|
906
|
-
isAnomaly?: boolean;
|
|
907
|
-
trustScore?: number | null;
|
|
908
|
-
isShadowBanned?: boolean;
|
|
909
|
-
expiresAt?: number | null;
|
|
910
|
-
metadata?: Record<string, any> | null;
|
|
911
|
-
isSeed?: boolean;
|
|
912
|
-
}
|
|
913
|
-
interface PagedScoresResponse {
|
|
914
|
-
variant: 'standard' | 'highlight';
|
|
915
|
-
entries: LeaderboardEntry[];
|
|
916
|
-
totalEntries: number;
|
|
917
|
-
nextCursor?: string | null;
|
|
918
|
-
playerRank: number | null;
|
|
919
|
-
periodInstance: string;
|
|
920
|
-
}
|
|
921
|
-
interface PlayerRankOptions {
|
|
922
|
-
mode?: string;
|
|
923
|
-
period?: string;
|
|
924
|
-
periodDate?: number | string;
|
|
925
|
-
}
|
|
926
|
-
interface PlayerRankResult {
|
|
927
|
-
rank: number | null;
|
|
928
|
-
score?: number;
|
|
929
|
-
totalPlayers: number;
|
|
930
|
-
percentile?: number;
|
|
931
|
-
trustScore: number;
|
|
932
|
-
periodInstance: string;
|
|
933
|
-
}
|
|
934
|
-
interface PodiumScoresContext {
|
|
935
|
-
topEntries: LeaderboardEntry[];
|
|
936
|
-
beforePlayer: LeaderboardEntry[];
|
|
937
|
-
playerEntry?: LeaderboardEntry | null;
|
|
938
|
-
afterPlayer: LeaderboardEntry[];
|
|
939
|
-
totalBefore: number;
|
|
940
|
-
totalAfter: number;
|
|
941
|
-
omittedBefore: number;
|
|
942
|
-
omittedAfter: number;
|
|
943
|
-
}
|
|
944
|
-
interface PodiumScoresResponse extends PagedScoresResponse {
|
|
945
|
-
variant: 'highlight';
|
|
946
|
-
context: PodiumScoresContext;
|
|
947
|
-
}
|
|
948
|
-
interface GetPodiumScoresOptions extends Omit<GetPagedScoresOptions, 'variant'> {
|
|
949
|
-
}
|
|
950
|
-
interface LeaderboardApi {
|
|
951
|
-
createScoreToken(mode?: string): Promise<ScoreToken>;
|
|
952
|
-
submitScore(params: SubmitScoreParams): Promise<SubmitScoreResult>;
|
|
953
|
-
getPagedScores(options?: GetPagedScoresOptions): Promise<PagedScoresResponse>;
|
|
954
|
-
getMyRank(options?: PlayerRankOptions): Promise<PlayerRankResult>;
|
|
955
|
-
getPodiumScores(options?: GetPodiumScoresOptions): Promise<PodiumScoresResponse>;
|
|
956
|
-
}
|
|
957
|
-
|
|
958
|
-
interface PreloaderApi {
|
|
959
|
-
showLoadScreen(): Promise<void>;
|
|
960
|
-
hideLoadScreen(): Promise<void>;
|
|
961
|
-
setLoaderText(text: string): Promise<void>;
|
|
962
|
-
setLoaderProgress(progress: number): Promise<void>;
|
|
963
|
-
}
|
|
964
|
-
|
|
965
|
-
/**
|
|
966
|
-
* OpenGraph metadata for rich social previews.
|
|
967
|
-
*
|
|
968
|
-
* H5 games provide these values so social networks can render rich cards when
|
|
969
|
-
* a share link is posted.
|
|
970
|
-
*/
|
|
971
|
-
interface ShareMetadata {
|
|
972
|
-
/** Preview title shown in link cards (e.g. Twitter, iMessage). */
|
|
973
|
-
title?: string;
|
|
974
|
-
/** Preview description shown under the title. */
|
|
975
|
-
description?: string;
|
|
976
|
-
/** Preview image URL (must be HTTPS for most social platforms). */
|
|
977
|
-
imageUrl?: string;
|
|
978
|
-
}
|
|
979
|
-
interface SocialQRCodeOptions {
|
|
980
|
-
/** Size of the QR code image in pixels. */
|
|
981
|
-
size?: number;
|
|
982
|
-
/** Margin around the QR code in pixels. */
|
|
983
|
-
margin?: number;
|
|
984
|
-
/** Output format for the rendered QR code. */
|
|
985
|
-
format?: 'png' | 'svg';
|
|
986
|
-
}
|
|
987
|
-
interface ShareLinkResult {
|
|
988
|
-
shareUrl: string;
|
|
989
|
-
}
|
|
990
|
-
interface QRCodeResult {
|
|
991
|
-
shareUrl: string;
|
|
992
|
-
qrCode: string;
|
|
993
|
-
}
|
|
994
|
-
/**
|
|
995
|
-
* Social distribution API used by H5 games.
|
|
996
|
-
*
|
|
997
|
-
* This unified API powers both share links and QR codes, backed by a single
|
|
998
|
-
* Firestore document that stores arbitrary launch parameters supplied by the
|
|
999
|
-
* game.
|
|
1000
|
-
*/
|
|
1001
|
-
interface SocialApi {
|
|
1002
|
-
/**
|
|
1003
|
-
* Create a share link and invoke the host platform's native share UX.
|
|
1004
|
-
*
|
|
1005
|
-
* Platform behaviour:
|
|
1006
|
-
* - iOS / Android: opens the native share sheet.
|
|
1007
|
-
* - Web: copies the generated URL to the clipboard (with fallback toast).
|
|
1008
|
-
*
|
|
1009
|
-
* @param options.launchParams Arbitrary launch parameters for your game.
|
|
1010
|
-
* @param options.metadata Optional OpenGraph metadata for rich previews.
|
|
1011
|
-
* @returns The generated share URL.
|
|
1012
|
-
*/
|
|
1013
|
-
shareLinkAsync(options: {
|
|
1014
|
-
launchParams: Record<string, string>;
|
|
1015
|
-
metadata?: ShareMetadata;
|
|
1016
|
-
}): Promise<ShareLinkResult>;
|
|
1017
|
-
/**
|
|
1018
|
-
* Create a share document and return both the URL and a QR code image.
|
|
1019
|
-
*
|
|
1020
|
-
* Games can render or print the returned QR image or re-use the share URL.
|
|
1021
|
-
*
|
|
1022
|
-
* @param options.launchParams Arbitrary launch parameters for your game.
|
|
1023
|
-
* @param options.metadata Optional OpenGraph metadata for the share.
|
|
1024
|
-
* @param options.qrOptions Customisation for the generated QR code.
|
|
1025
|
-
* @returns The generated share URL and QR code (as a data URL).
|
|
1026
|
-
*/
|
|
1027
|
-
createQRCodeAsync(options: {
|
|
1028
|
-
launchParams: Record<string, string>;
|
|
1029
|
-
metadata?: ShareMetadata;
|
|
1030
|
-
qrOptions?: SocialQRCodeOptions;
|
|
1031
|
-
}): Promise<QRCodeResult>;
|
|
1032
|
-
}
|
|
1033
|
-
|
|
1034
|
-
/**
|
|
1035
|
-
* Safe area insets representing padding needed to avoid device notches and host UI.
|
|
1036
|
-
* Includes toolbar/feedHeader height + device safe areas.
|
|
1037
|
-
*/
|
|
1038
|
-
interface SafeArea {
|
|
1039
|
-
left: number;
|
|
1040
|
-
top: number;
|
|
1041
|
-
right: number;
|
|
1042
|
-
bottom: number;
|
|
1043
|
-
}
|
|
1044
|
-
/**
|
|
1045
|
-
* @deprecated Use SafeArea instead. Will be removed in v4.0.0
|
|
1046
|
-
*/
|
|
1047
|
-
type HudInsets = SafeArea;
|
|
1048
|
-
interface InitializationOptions {
|
|
1049
|
-
helpText?: string;
|
|
1050
|
-
hardDisableMock?: boolean;
|
|
1051
|
-
mock?: Record<string, any>;
|
|
1052
|
-
usePreloader?: boolean;
|
|
1053
|
-
}
|
|
1054
|
-
interface InitializationContext {
|
|
1055
|
-
/**
|
|
1056
|
-
* Safe area insets from INIT_SDK response.
|
|
1057
|
-
* @deprecated Use VenusAPI.system.getSafeArea() instead. Will be removed in v4.0.0
|
|
1058
|
-
*/
|
|
1059
|
-
safeArea?: SafeArea;
|
|
1060
|
-
initializeAsleep: boolean;
|
|
1061
|
-
}
|
|
1062
|
-
interface Host {
|
|
1063
|
-
readonly ads: AdsApi;
|
|
1064
|
-
readonly analytics: AnalyticsApi;
|
|
1065
|
-
readonly deviceCache: StorageApi;
|
|
1066
|
-
readonly appStorage: StorageApi;
|
|
1067
|
-
readonly globalStorage: StorageApi;
|
|
1068
|
-
readonly avatar3d: Avatar3dApi;
|
|
1069
|
-
readonly navigation: NavigationApi;
|
|
1070
|
-
readonly notifications: NotificationsApi;
|
|
1071
|
-
readonly popups: PopupsApi;
|
|
1072
|
-
readonly profile: ProfileApi;
|
|
1073
|
-
readonly system: SystemApi;
|
|
1074
|
-
readonly cdn: CdnApi;
|
|
1075
|
-
readonly time: TimeApi;
|
|
1076
|
-
readonly ai: AiApi;
|
|
1077
|
-
readonly haptics: HapticsApi;
|
|
1078
|
-
readonly features: FeaturesApi;
|
|
1079
|
-
readonly lifecycle: LifecycleApi;
|
|
1080
|
-
readonly simulation: SimulationApi;
|
|
1081
|
-
readonly rooms: RoomsApi;
|
|
1082
|
-
readonly logging: LoggingApi;
|
|
1083
|
-
readonly leaderboard: LeaderboardApi;
|
|
1084
|
-
readonly preloader: PreloaderApi;
|
|
1085
|
-
readonly social: SocialApi;
|
|
1086
|
-
readonly isInitialized: boolean;
|
|
1087
|
-
readonly iap: IapApi;
|
|
1088
|
-
initialize(options?: InitializationOptions): Promise<InitializationContext>;
|
|
1089
|
-
}
|
|
1090
|
-
declare function createHost(venusApi: VenusAPI, isMock: boolean): Host;
|
|
1091
|
-
|
|
1092
|
-
interface Avatar3dConfig {
|
|
1093
|
-
headAsset: string | null;
|
|
1094
|
-
outfitAsset: string | null;
|
|
1095
|
-
hatAsset: string | null;
|
|
1096
|
-
hairAsset: string | null;
|
|
1097
|
-
faceAccessoryAsset: string | null;
|
|
1098
|
-
animationAsset: string | null;
|
|
1099
|
-
skinColor: string | null;
|
|
1100
|
-
}
|
|
1101
|
-
|
|
1102
|
-
interface Asset {
|
|
1103
|
-
id: string;
|
|
1104
|
-
filename: string;
|
|
1105
|
-
displayName: string;
|
|
1106
|
-
preload?: boolean;
|
|
1107
|
-
tags?: string[];
|
|
1108
|
-
metadata?: Record<string, any>;
|
|
1109
|
-
}
|
|
1110
|
-
interface Category {
|
|
1111
|
-
displayName?: string;
|
|
1112
|
-
type: 'mesh';
|
|
1113
|
-
assets: Asset[];
|
|
1114
|
-
}
|
|
1115
|
-
interface AssetManifest {
|
|
1116
|
-
version: string;
|
|
1117
|
-
generatedAt: string;
|
|
1118
|
-
categories: Record<string, Category>;
|
|
1119
|
-
}
|
|
1120
|
-
|
|
1121
|
-
interface Avatar3dEdits {
|
|
1122
|
-
wasChanged: boolean;
|
|
1123
|
-
config: Avatar3dConfig | null;
|
|
1124
|
-
savedAvatarId: string | null;
|
|
1125
|
-
}
|
|
1126
|
-
interface ShowEditorOptions {
|
|
1127
|
-
currentAvatar?: any;
|
|
1128
|
-
contextData?: any;
|
|
1129
|
-
onSave?: () => void;
|
|
1130
|
-
onCancel?: () => void;
|
|
1131
|
-
}
|
|
1132
|
-
interface Avatar3dApi {
|
|
1133
|
-
loadAvatar(avatarId?: string): Promise<Avatar3dConfig | null>;
|
|
1134
|
-
saveAvatar(config: Avatar3dConfig): Promise<string>;
|
|
1135
|
-
deleteAvatar(): Promise<void>;
|
|
1136
|
-
downloadManifest(): Promise<AssetManifest>;
|
|
1137
|
-
showEditor(options?: ShowEditorOptions): Promise<Avatar3dEdits>;
|
|
1138
|
-
downloadAssetPaths(): Promise<Record<string, string[]>>;
|
|
1139
|
-
}
|
|
1140
|
-
|
|
1141
|
-
declare global {
|
|
1142
|
-
interface Window {
|
|
1143
|
-
VenusPrototyping?: {
|
|
1144
|
-
showAvatarEditorOverlay: (options: any, resolve: (args: any) => void) => Promise<void>;
|
|
1145
|
-
};
|
|
1146
|
-
}
|
|
1147
|
-
}
|
|
1148
|
-
declare class MockAvatarApi implements Avatar3dApi {
|
|
1149
|
-
private readonly _venusApi;
|
|
1150
|
-
private cachedAssets;
|
|
1151
|
-
private cachedVersion;
|
|
1152
|
-
constructor(venusApi: VenusAPI);
|
|
1153
|
-
downloadAssetPaths(): Promise<Record<string, string[]>>;
|
|
1154
|
-
deleteAvatar(): Promise<void>;
|
|
1155
|
-
loadAvatar(avatar3dId?: string): Promise<Avatar3dConfig | null>;
|
|
1156
|
-
saveAvatar(config: Avatar3dConfig): Promise<string>;
|
|
1157
|
-
downloadManifest(): Promise<AssetManifest>;
|
|
1158
|
-
showEditor(options?: ShowEditorOptions): Promise<Avatar3dEdits>;
|
|
1159
|
-
private getAssets;
|
|
1160
|
-
private loadAssetsManifest;
|
|
1161
|
-
private selectAvatarConfig;
|
|
1162
|
-
private selectAsset;
|
|
1163
|
-
private seededRandom;
|
|
1164
|
-
private simpleHash;
|
|
1165
|
-
private getAllAssetPaths;
|
|
1166
|
-
private log;
|
|
1167
|
-
}
|
|
1168
|
-
|
|
1169
|
-
/**
|
|
1170
|
-
* DEFINITIVE TypeScript definitions for Venus H5 API
|
|
1171
|
-
*
|
|
1172
|
-
* This is the single source of truth for all H5 games.
|
|
1173
|
-
*
|
|
1174
|
-
* Usage in H5 games:
|
|
1175
|
-
* ```typescript
|
|
1176
|
-
* import type { VenusAPI } from '../../venus-api/types';
|
|
1177
|
-
* declare const VenusAPI: VenusAPI;
|
|
1178
|
-
* ```
|
|
1179
|
-
*/
|
|
1180
|
-
|
|
1181
|
-
interface RecipeRequirementResult {
|
|
1182
|
-
recipeId: string;
|
|
1183
|
-
entity: string | null;
|
|
1184
|
-
amount?: number;
|
|
1185
|
-
inputs: Record<string, number | string>;
|
|
1186
|
-
canAfford: boolean;
|
|
1187
|
-
disabled: boolean;
|
|
1188
|
-
}
|
|
1189
|
-
interface SimulationRunSummary {
|
|
1190
|
-
id: string;
|
|
1191
|
-
recipeId: string;
|
|
1192
|
-
status: string;
|
|
1193
|
-
startTime: number;
|
|
1194
|
-
expiresAt: number;
|
|
1195
|
-
entity?: string;
|
|
1196
|
-
inputs?: Record<string, number | string>;
|
|
1197
|
-
outputs?: Record<string, number | string>;
|
|
1198
|
-
commitmentEndsAt?: number;
|
|
1199
|
-
participantCount?: number;
|
|
1200
|
-
}
|
|
1201
|
-
type VenusSimulationStateResponse = SimulationPersonalState | SimulationRoomState;
|
|
1202
|
-
type SimulationUpdateType = 'entity' | 'activeRuns' | 'snapshot';
|
|
1203
|
-
interface SimulationUpdateBase {
|
|
1204
|
-
timestamp: number;
|
|
1205
|
-
reason?: 'recipe_completed' | 'auto_restart' | 'manual_update' | 'state_sync';
|
|
1206
|
-
}
|
|
1207
|
-
interface SimulationEntityUpdate extends SimulationUpdateBase {
|
|
1208
|
-
type: 'entity';
|
|
1209
|
-
entities: Array<{
|
|
1210
|
-
entityId: string;
|
|
1211
|
-
quantity: number | string;
|
|
1212
|
-
}>;
|
|
1213
|
-
}
|
|
1214
|
-
interface SimulationActiveRunsUpdate extends SimulationUpdateBase {
|
|
1215
|
-
type: 'activeRuns';
|
|
1216
|
-
activeRuns: Array<{
|
|
1217
|
-
id: string;
|
|
1218
|
-
recipeId: string;
|
|
1219
|
-
status: string;
|
|
1220
|
-
startTime: number;
|
|
1221
|
-
expiresAt: number;
|
|
1222
|
-
entity?: string;
|
|
1223
|
-
inputs?: Record<string, number | string>;
|
|
1224
|
-
outputs?: Record<string, number | string>;
|
|
1225
|
-
}>;
|
|
1226
|
-
}
|
|
1227
|
-
interface SimulationSnapshotUpdate extends SimulationUpdateBase {
|
|
1228
|
-
type: 'snapshot';
|
|
1229
|
-
entities?: Array<{
|
|
1230
|
-
entityId: string;
|
|
1231
|
-
quantity: number | string;
|
|
1232
|
-
}>;
|
|
1233
|
-
activeRuns?: Array<{
|
|
1234
|
-
id: string;
|
|
1235
|
-
recipeId: string;
|
|
1236
|
-
status: string;
|
|
1237
|
-
startTime: number;
|
|
1238
|
-
expiresAt: number;
|
|
1239
|
-
entity?: string;
|
|
1240
|
-
inputs?: Record<string, number | string>;
|
|
1241
|
-
outputs?: Record<string, number | string>;
|
|
1242
|
-
}>;
|
|
1243
|
-
}
|
|
1244
|
-
type SimulationUpdateData = SimulationEntityUpdate | SimulationActiveRunsUpdate | SimulationSnapshotUpdate;
|
|
1245
|
-
interface SimulationSubscribeOptions {
|
|
1246
|
-
entities?: string[];
|
|
1247
|
-
tags?: string[];
|
|
1248
|
-
activeRuns?: boolean;
|
|
1249
|
-
roomId?: string;
|
|
1250
|
-
onUpdate: (data: SimulationUpdateData) => void;
|
|
1251
|
-
}
|
|
1252
|
-
interface VenusSimulationEffect {
|
|
1253
|
-
type: string;
|
|
1254
|
-
target: any;
|
|
1255
|
-
value: any;
|
|
1256
|
-
}
|
|
1257
|
-
interface VenusSimulationRecipe {
|
|
1258
|
-
scope: 'player' | 'room' | 'actor';
|
|
1259
|
-
inputs: Record<string, any>;
|
|
1260
|
-
autoRestart?: boolean;
|
|
1261
|
-
beginEffects?: VenusSimulationEffect[];
|
|
1262
|
-
endEffects?: VenusSimulationEffect[];
|
|
1263
|
-
outputs?: Record<string, any>;
|
|
1264
|
-
duration?: number;
|
|
1265
|
-
maxRestartCondition?: any;
|
|
1266
|
-
metadata?: {
|
|
1267
|
-
startsDisabled?: boolean;
|
|
1268
|
-
autoRestart?: boolean;
|
|
1269
|
-
maxRestartCondition?: any;
|
|
1270
|
-
};
|
|
1271
|
-
guards?: Record<string, any>;
|
|
1272
|
-
effects?: Array<any>;
|
|
1273
|
-
clientViewable?: boolean;
|
|
1274
|
-
}
|
|
1275
|
-
interface VenusSimulationConfig {
|
|
1276
|
-
version: string;
|
|
1277
|
-
entities: Record<string, {
|
|
1278
|
-
tags?: string[];
|
|
1279
|
-
metadata?: Record<string, any>;
|
|
1280
|
-
stackable?: boolean;
|
|
1281
|
-
neverConsumable?: boolean;
|
|
1282
|
-
clientViewable?: boolean;
|
|
1283
|
-
slots?: Record<string, {
|
|
1284
|
-
allowedTags: string[];
|
|
1285
|
-
maxItems: number;
|
|
1286
|
-
}>;
|
|
1287
|
-
actorTemplate?: {
|
|
1288
|
-
defaultState?: Record<string, any>;
|
|
1289
|
-
availableRecipes?: string[];
|
|
1290
|
-
};
|
|
1291
|
-
}>;
|
|
1292
|
-
recipes: Record<string, VenusSimulationRecipe>;
|
|
1293
|
-
fieldResolution?: Record<string, any>;
|
|
1294
|
-
matchmaking?: Record<string, any>;
|
|
1295
|
-
}
|
|
1296
|
-
interface RecipeRequirementQuery {
|
|
1297
|
-
recipeId: string;
|
|
1298
|
-
entity?: string;
|
|
1299
|
-
batchAmount?: number;
|
|
1300
|
-
}
|
|
1301
|
-
interface BatchRecipeRequirementsResult {
|
|
1302
|
-
success: boolean;
|
|
1303
|
-
results: RecipeRequirementResult[];
|
|
1304
|
-
errors?: Array<unknown>;
|
|
1305
|
-
}
|
|
1306
|
-
interface VenusExecuteRecipeOptions {
|
|
1307
|
-
roomId?: string;
|
|
1308
|
-
batchAmount?: number;
|
|
1309
|
-
allowPartialBatch?: boolean;
|
|
1310
|
-
entity?: string;
|
|
1311
|
-
}
|
|
1312
|
-
interface VenusExecuteScopedRecipeOptions {
|
|
1313
|
-
roomId?: string;
|
|
1314
|
-
}
|
|
1315
|
-
interface VenusAvailableRecipe {
|
|
1316
|
-
id: string;
|
|
1317
|
-
scope: string;
|
|
1318
|
-
clientViewable: boolean;
|
|
1319
|
-
}
|
|
1320
|
-
interface VenusCollectRecipeResult {
|
|
1321
|
-
success: boolean;
|
|
1322
|
-
runId: string;
|
|
1323
|
-
rewards: Record<string, unknown>;
|
|
1324
|
-
message: string;
|
|
1325
|
-
}
|
|
1326
|
-
interface VenusExecuteRecipeResult {
|
|
1327
|
-
success: boolean;
|
|
1328
|
-
status?: string;
|
|
1329
|
-
runId?: string;
|
|
1330
|
-
expiresAt?: string;
|
|
1331
|
-
queuePosition?: number;
|
|
1332
|
-
outputs?: Record<string, number | string>;
|
|
1333
|
-
data?: Record<string, unknown>;
|
|
1334
|
-
message?: string;
|
|
1335
|
-
amountRequested?: number;
|
|
1336
|
-
amountFulfilled?: number;
|
|
1337
|
-
partialSuccess?: boolean;
|
|
1338
|
-
}
|
|
1339
|
-
interface Profile {
|
|
1340
|
-
id: string;
|
|
1341
|
-
username: string;
|
|
1342
|
-
name?: string;
|
|
1343
|
-
avatarUrl?: string | null;
|
|
1344
|
-
isAnonymous?: boolean;
|
|
1345
|
-
}
|
|
1346
|
-
interface VenusAPI {
|
|
1347
|
-
/**
|
|
1348
|
-
* @deprecated All config properties have been removed. Use VenusAPI methods instead.
|
|
1349
|
-
* Will be removed in v4.0.0
|
|
1350
|
-
*/
|
|
1351
|
-
config: Record<string, never>;
|
|
1352
|
-
launchParams: Record<string, string>;
|
|
1353
|
-
_profileData?: Profile;
|
|
1354
|
-
_deviceData?: DeviceInfo;
|
|
1355
|
-
_environmentData?: EnvironmentInfo;
|
|
1356
|
-
_safeAreaData?: SafeArea;
|
|
1357
|
-
_localeData?: string;
|
|
1358
|
-
_languageCodeData?: string;
|
|
1359
|
-
_mock: any;
|
|
1360
|
-
_bootstrap: {
|
|
1361
|
-
apiInjected: boolean;
|
|
1362
|
-
venus: any;
|
|
1363
|
-
};
|
|
1364
|
-
initializeAsync(options?: InitializationOptions): Promise<InitializationContext>;
|
|
1365
|
-
simulation: SimulationApi;
|
|
1366
|
-
leaderboard: LeaderboardApi;
|
|
1367
|
-
log(message: string, ...args: any[]): void;
|
|
1368
|
-
error(message: string, ...args: any[]): void;
|
|
1369
|
-
isAvailable(): boolean;
|
|
1370
|
-
/**
|
|
1371
|
-
* @deprecated Use VenusAPI.system.isMobile() instead
|
|
1372
|
-
*/
|
|
1373
|
-
isMobile(): boolean;
|
|
1374
|
-
/**
|
|
1375
|
-
* @deprecated Use VenusAPI.system.isWeb() instead
|
|
1376
|
-
*/
|
|
1377
|
-
isWeb(): boolean;
|
|
1378
|
-
isMock(): boolean;
|
|
1379
|
-
/**
|
|
1380
|
-
* @deprecated Please use the new analytics API. VenusAPI.analytics
|
|
1381
|
-
* @param options
|
|
1382
|
-
*/
|
|
1383
|
-
logCustomEvent(options: {
|
|
1384
|
-
eventName: string;
|
|
1385
|
-
params?: Record<string, any>;
|
|
1386
|
-
}): Promise<void>;
|
|
1387
|
-
getExperiment(options: {
|
|
1388
|
-
experimentName: string;
|
|
1389
|
-
}): Promise<any>;
|
|
1390
|
-
getFeatureFlag(options: {
|
|
1391
|
-
flagName: string;
|
|
1392
|
-
}): Promise<any>;
|
|
1393
|
-
getFeatureGate(options: {
|
|
1394
|
-
gateName: string;
|
|
1395
|
-
}): Promise<any>;
|
|
1396
|
-
system: SystemApi;
|
|
1397
|
-
getProfile(): Profile;
|
|
1398
|
-
/**
|
|
1399
|
-
* @deprecated Use getProfile() instead
|
|
1400
|
-
*/
|
|
1401
|
-
getCurrentProfile(): Profile;
|
|
1402
|
-
getLaunchParams(): Record<string, string>;
|
|
1403
|
-
getLocale(): string;
|
|
1404
|
-
getLanguageCode(): string;
|
|
1405
|
-
triggerHapticAsync(style: HapticFeedbackStyle): Promise<void>;
|
|
1406
|
-
deviceCache: {
|
|
1407
|
-
setItem(key: string, value: string): Promise<void>;
|
|
1408
|
-
getItem(key: string): Promise<string | null>;
|
|
1409
|
-
removeItem(key: string): Promise<void>;
|
|
1410
|
-
clear(): Promise<void>;
|
|
1411
|
-
length(): Promise<number>;
|
|
1412
|
-
key(index: number): Promise<string | null>;
|
|
1413
|
-
};
|
|
1414
|
-
appStorage: {
|
|
1415
|
-
setItem(key: string, value: string): Promise<void>;
|
|
1416
|
-
getItem(key: string): Promise<string | null>;
|
|
1417
|
-
removeItem(key: string): Promise<void>;
|
|
1418
|
-
clear(): Promise<void>;
|
|
1419
|
-
length(): Promise<number>;
|
|
1420
|
-
key(index: number): Promise<string | null>;
|
|
1421
|
-
getAllItems(): Promise<string[]>;
|
|
1422
|
-
setMultipleItems(items: {
|
|
1423
|
-
key: string;
|
|
1424
|
-
value: string;
|
|
1425
|
-
}[]): Promise<void>;
|
|
1426
|
-
removeMultipleItems(keys: string[]): Promise<void>;
|
|
1427
|
-
};
|
|
1428
|
-
globalStorage: {
|
|
1429
|
-
setItem(key: string, value: string): Promise<void>;
|
|
1430
|
-
getItem(key: string): Promise<string | null>;
|
|
1431
|
-
removeItem(key: string): Promise<void>;
|
|
1432
|
-
clear(): Promise<void>;
|
|
1433
|
-
length(): Promise<number>;
|
|
1434
|
-
key(index: number): Promise<string | null>;
|
|
1435
|
-
};
|
|
1436
|
-
requestPopOrQuit(options?: QuitOptions): Promise<boolean>;
|
|
1437
|
-
/**
|
|
1438
|
-
* @deprecated Please use the ads API. (e.g, VenusAPI.ads)
|
|
1439
|
-
*/
|
|
1440
|
-
isRewardedAdReadyAsync(): Promise<boolean>;
|
|
1441
|
-
/**
|
|
1442
|
-
* @deprecated Please use the ads API. (e.g, VenusAPI.ads)
|
|
1443
|
-
*/
|
|
1444
|
-
showRewardedAdAsync(): Promise<boolean>;
|
|
1445
|
-
requestTimeAsync(): Promise<ServerTimeData>;
|
|
1446
|
-
getFutureTimeAsync(options: GetFutureTimeOptions): Promise<number>;
|
|
1447
|
-
formatTime(timestamp: number, options?: any): string;
|
|
1448
|
-
formatNumber(value: number, options?: any): string;
|
|
1449
|
-
/**
|
|
1450
|
-
* @deprecated Please use the cdn API. VenusAPI.cdn
|
|
1451
|
-
*/
|
|
1452
|
-
fetchFromCdn(url: string, options?: RequestInit): Promise<Response>;
|
|
1453
|
-
/**
|
|
1454
|
-
* @deprecated Please use the cdn API. VenusAPI.cdn
|
|
1455
|
-
*/
|
|
1456
|
-
resolveAssetUrl(path: string): string;
|
|
1457
|
-
/**
|
|
1458
|
-
* @deprecated Please use the cdn API. VenusAPI.cdn
|
|
1459
|
-
*/
|
|
1460
|
-
resolveAvatarAssetUrl(path: string): string;
|
|
1461
|
-
/**
|
|
1462
|
-
* @deprecated Please use the cdn API. VenusAPI.cdn
|
|
1463
|
-
*/
|
|
1464
|
-
resolveSharedLibUrl(path: string): string;
|
|
1465
|
-
/**
|
|
1466
|
-
* @deprecated Please use the cdn API. VenusAPI.cdn
|
|
1467
|
-
*/
|
|
1468
|
-
getAssetCdnBaseUrl(): string;
|
|
1469
|
-
loadAsset(url: string, options?: {
|
|
1470
|
-
type?: string;
|
|
1471
|
-
streaming?: boolean;
|
|
1472
|
-
cache?: boolean;
|
|
1473
|
-
timeout?: number;
|
|
1474
|
-
isOptional?: boolean;
|
|
1475
|
-
}): Promise<string>;
|
|
1476
|
-
preloadAssets(assets: Array<string | {
|
|
1477
|
-
url: string;
|
|
1478
|
-
isOptional?: boolean;
|
|
1479
|
-
}>, options?: {
|
|
1480
|
-
onProgress?: (progress: number, info: any) => void;
|
|
1481
|
-
}): Promise<Array<{
|
|
1482
|
-
success: boolean;
|
|
1483
|
-
isOptional?: boolean;
|
|
1484
|
-
}>>;
|
|
1485
|
-
cleanupAssets(): void;
|
|
1486
|
-
assetLoader: {
|
|
1487
|
-
getCached(url: string): string | null;
|
|
1488
|
-
};
|
|
1489
|
-
showAvatar3dEditorAsync(options: {
|
|
1490
|
-
currentAvatar?: any;
|
|
1491
|
-
contextData?: any;
|
|
1492
|
-
}): Promise<Avatar3dEdits>;
|
|
1493
|
-
loadAvatar3dAsync(avatarId?: string): Promise<any>;
|
|
1494
|
-
saveAvatar3dAsync(config: any): Promise<string>;
|
|
1495
|
-
deleteAvatar3dAsync(): Promise<void>;
|
|
1496
|
-
downloadAvatar3dAssetPathsAsync(): Promise<Record<string, string[]>>;
|
|
1497
|
-
downloadAvatar3dManifestAsync(): Promise<AssetManifest>;
|
|
1498
|
-
pushAppAsync(appId: string, options?: {
|
|
1499
|
-
contextData?: any;
|
|
1500
|
-
appParams?: any;
|
|
1501
|
-
}): Promise<any>;
|
|
1502
|
-
popAppAsync(): Promise<void>;
|
|
1503
|
-
getStackInfo(): {
|
|
1504
|
-
isInStack: boolean;
|
|
1505
|
-
stackPosition: number;
|
|
1506
|
-
};
|
|
1507
|
-
rooms: RoomsApi;
|
|
1508
|
-
notifyCleanupComplete(): void;
|
|
1509
|
-
RoomEvents: {
|
|
1510
|
-
OPTIMISTIC_GAME_STATE_UPDATED: string;
|
|
1511
|
-
PROPOSED_MOVE_VALIDATION_UPDATED: string;
|
|
1512
|
-
};
|
|
1513
|
-
numbers: {
|
|
1514
|
-
isBigNumber(value: any): boolean;
|
|
1515
|
-
normalize(value: string | number | any): any;
|
|
1516
|
-
format: {
|
|
1517
|
-
incremental(value: any): string;
|
|
1518
|
-
};
|
|
1519
|
-
calculateGeometricSeriesCost(baseCost: number | string, multiplier: number, currentQuantity: number, purchaseAmount: number): any;
|
|
1520
|
-
calculateMaxAffordableDecimal(availableCash: number | string, baseCost: number | string, multiplier: number, currentQuantity: number): number;
|
|
1521
|
-
formatDecimalCurrency(decimalValue: any): string;
|
|
1522
|
-
Decimal: any;
|
|
1523
|
-
};
|
|
1524
|
-
iap: IapApi;
|
|
1525
|
-
cdn: CdnApi;
|
|
1526
|
-
ads: AdsApi;
|
|
1527
|
-
ai: AiApi;
|
|
1528
|
-
popups: PopupsApi;
|
|
1529
|
-
analytics: AnalyticsApi;
|
|
1530
|
-
sharedAssets: SharedAssetsApi;
|
|
1531
|
-
preloader: PreloaderApi;
|
|
1532
|
-
notifications: NotificationsApi;
|
|
1533
|
-
lifecycles: LifecycleApi;
|
|
1534
|
-
social: SocialApi;
|
|
1535
|
-
}
|
|
1536
|
-
|
|
1537
|
-
interface ShowInterstitialAdOptions {
|
|
1538
|
-
adDisplayId?: string;
|
|
1539
|
-
adDisplayName?: string;
|
|
1540
|
-
}
|
|
1541
|
-
interface ShowRewardedAdOptions {
|
|
1542
|
-
adDisplayId?: string;
|
|
1543
|
-
adDisplayName?: string;
|
|
1544
|
-
}
|
|
1545
|
-
interface AdsApi {
|
|
1546
|
-
isRewardedAdReadyAsync(): Promise<boolean>;
|
|
1547
|
-
showRewardedAdAsync(options?: ShowRewardedAdOptions): Promise<boolean>;
|
|
1548
|
-
showInterstitialAd(options?: ShowInterstitialAdOptions): Promise<boolean>;
|
|
1549
|
-
}
|
|
1550
|
-
|
|
1551
|
-
export { type AiApi as $, type AnalyticsApi as A, type BatchRecipeRequirementsResult as B, type ScheduleNotificationOptions as C, type PopupsApi as D, type ShowToastOptions as E, type ShowInterstitialAdOptions as F, type ShowRewardedAdOptions as G, type Host as H, type ProfileApi as I, type DeviceApi as J, type DeviceInfo as K, type EnvironmentApi as L, type EnvironmentInfo as M, type NavigationApi as N, type SystemApi as O, type Profile as P, type QuitOptions as Q, type RecipeRequirementResult as R, type SimulationRunSummary as S, type SafeArea as T, type CdnApi as U, type VenusAPI as V, type SubPath as W, type FetchBlobOptions as X, type TimeApi as Y, type ServerTimeData as Z, type GetFutureTimeOptions as _, type VenusSimulationStateResponse as a, type PlayerRankResult as a$, type AiChatCompletionRequest as a0, type AiChatCompletionData as a1, type HapticsApi as a2, HapticFeedbackStyle as a3, type FeaturesApi as a4, type Experiment as a5, type LifecycleApi as a6, type SleepCallback as a7, type Subscription as a8, type AwakeCallback as a9, type ProposedMoveEvent as aA, VenusTransport as aB, type RoomsApi as aC, type CreateRoomOptions as aD, type JoinOrCreateRoomOptions as aE, type JoinOrCreateResult as aF, type ListRoomsOptions as aG, type UpdateRoomDataOptions as aH, type RoomMessageRequest as aI, type StartRoomGameOptions as aJ, type ProposeMoveRequest as aK, type ProposeMoveResult as aL, type ValidateMoveVerdict as aM, type ValidateMoveResult as aN, type RoomSubscriptionOptions as aO, type LoggingApi as aP, type IapApi as aQ, type SpendCurrencyOptions as aR, type LoadEmbeddedAssetsResponse as aS, type SharedAssetsApi as aT, type LeaderboardApi as aU, type ScoreToken as aV, type SubmitScoreParams as aW, type SubmitScoreResult as aX, type GetPagedScoresOptions as aY, type PagedScoresResponse as aZ, type PlayerRankOptions as a_, type PauseCallback as aa, type ResumeCallback as ab, type QuitCallback as ac, type SimulationApi as ad, type SimulationSlotValidationResult as ae, type SimulationBatchOperation as af, type SimulationBatchOperationsResult as ag, type SimulationAvailableItem as ah, type SimulationPowerPreview as ai, type SimulationSlotMutationResult as aj, type SimulationSlotContainer as ak, type SimulationAssignment as al, type SimulationState as am, type ExecuteRecipeOptions as an, type ExecuteRecipeResponse as ao, type CollectRecipeResult as ap, type GetActiveRunsOptions as aq, type ExecuteScopedRecipeOptions as ar, type ExecuteScopedRecipeResult as as, type GetAvailableRecipesOptions as at, type GetAvailableRecipesResult as au, type Recipe as av, type GetBatchRecipeRequirements as aw, type TriggerRecipeChainOptions as ax, type RoomDataUpdate as ay, type RoomMessageEvent as az, type SimulationUpdateType as b, type GetPodiumScoresOptions as b0, type PodiumScoresResponse as b1, type PreloaderApi as b2, type SocialApi as b3, type ShareMetadata as b4, type ShareLinkResult as b5, type SocialQRCodeOptions as b6, type QRCodeResult as b7, type Avatar3dApi as b8, type AssetManifest as b9, RpcSharedAssetsApi as bA, type LoadEmbeddedAssetsRequest as bB, type LeaderboardModeConfig as bC, type LeaderboardPeriodType as bD, type LeaderboardPeriodConfig as bE, type LeaderboardAntiCheatConfig as bF, type LeaderboardDisplaySettings as bG, type LeaderboardConfig as bH, type LeaderboardEntry as bI, type PodiumScoresContext as bJ, type HudInsets as bK, createHost as bL, type Avatar3dConfig as ba, type ShowEditorOptions as bb, type Avatar3dEdits as bc, type AdsApi as bd, type InitializationOptions as be, type InitializationContext as bf, type AiMessage as bg, type Asset as bh, type Category as bi, MockAvatarApi as bj, type TimeIntervalTriggerInput as bk, type NotificationTriggerInput as bl, type OnRequestCallback as bm, type OnResponseCallback as bn, type OnNotificationCallback as bo, type RpcTransport as bp, type JoinRoomMatchCriteria as bq, type RoomMessageEventType as br, type VenusRoomPayload as bs, type RecipeInfo as bt, type SimulationPersonalState as bu, type SimulationRoomActiveRecipe as bv, type SimulationRoomState as bw, type SimulationBatchOperationAssign as bx, type SimulationBatchOperationRemove as by, type SimulationBatchOperationResult as bz, type SimulationEntityUpdate as c, type SimulationActiveRunsUpdate as d, type SimulationSnapshotUpdate as e, type SimulationUpdateData as f, type SimulationSubscribeOptions as g, type VenusSimulationEffect as h, type VenusSimulationRecipe as i, type VenusSimulationConfig as j, type RecipeRequirementQuery as k, type VenusExecuteRecipeOptions as l, type VenusExecuteScopedRecipeOptions as m, type VenusAvailableRecipe as n, type VenusCollectRecipeResult as o, type VenusExecuteRecipeResult as p, VenusRoom as q, type RpcRequest as r, type RpcResponse as s, type RpcNotification as t, RpcClient as u, type StorageApi as v, type NavigationStackInfo as w, type PushAppOptions as x, type NotificationsApi as y, type ScheduleLocalNotification as z };
|