@series-inc/venus-sdk 2.4.1 → 2.6.2
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 +264 -204
- package/dist/{AdsApi-Cz0XgLM8.d.mts → AdsApi-C_GcWmfO.d.mts} +178 -84
- package/dist/{AdsApi-Cz0XgLM8.d.ts → AdsApi-C_GcWmfO.d.ts} +178 -84
- package/dist/{chunk-MWUS3A7C.mjs → chunk-W7IPHM67.mjs} +22 -3
- package/dist/chunk-W7IPHM67.mjs.map +1 -0
- package/dist/{chunk-KQZIPQLJ.mjs → chunk-YDXFZ2A2.mjs} +363 -49
- package/dist/chunk-YDXFZ2A2.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 +343 -45
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +110 -9
- package/dist/index.d.ts +110 -9
- package/dist/index.mjs +6 -2
- package/dist/index.mjs.map +1 -1
- package/dist/venus-api/index.cjs +579 -1366
- 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 +159 -1270
- package/dist/venus-api/index.mjs.map +1 -1
- package/package.json +2 -2
- package/dist/chunk-KQZIPQLJ.mjs.map +0 -1
- package/dist/chunk-MWUS3A7C.mjs.map +0 -1
- package/dist/core-RDMPQV6U.mjs +0 -3
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { A as AnalyticsApi, R as RpcRequest, a as RpcResponse, b as RpcNotification, c as RpcClient, V as VenusAPI, N as NavigationApi, Q as QuitOptions, d as NavigationStackInfo, P as PushAppOptions, e as NotificationsApi, S as ScheduleLocalNotification, f as
|
|
2
|
-
export {
|
|
1
|
+
import { A as AnalyticsApi, R as RpcRequest, a as RpcResponse, b as RpcNotification, c as RpcClient, V as VenusAPI, N as NavigationApi, Q as QuitOptions, d as NavigationStackInfo, P as PushAppOptions, e as NotificationsApi, S as ScheduleLocalNotification, f as ScheduleNotificationOptions, g as PopupsApi, h as ActionSheetItem, i as ShowActionSheetOptions, j as ShowAlertOptions, k as ShowConfirmOptions, l as ShowToastOptions, m as Profile, n as AiApi, o as AiChatCompletionRequest, p as AiChatCompletionData, H as HapticsApi, q as HapticFeedbackStyle, L as LifecycleApi, O as OnCleanupCallback, r as OnShowCallback, s as OnHideCallback, t as OnPauseCallback, u as OnPlayCallback, v as OnQuitCallback, w as OnResumeCallback, x as PlayContext, y as ShowContext, z as VenusSimulationConfig, B as RecipeRequirementResult, C as VenusRoom, D as VenusTransport, E as Subscription, I as IapApi, F as SpendCurrencyOptions, G as LoadEmbeddedAssetsResponse, J as SharedAssetsApi, K as PreloaderApi, M as AdsApi, T as Avatar3dApi, U as CdnApi, W as AssetManifest, X as Avatar3dConfig, Y as ShowEditorOptions, Z as Avatar3dEdits, _ as SubPath, $ as FetchBlobOptions } from './AdsApi-C_GcWmfO.mjs';
|
|
2
|
+
export { a0 as AiMessage, a1 as Asset, a2 as Category, a4 as Insets, ad as LoadEmbeddedAssetsRequest, a3 as MockAvatarApi, a7 as NotificationTriggerInput, aa as OnNotificationCallback, a8 as OnRequestCallback, a9 as OnResponseCallback, a5 as PostInfo, ac as RpcSharedAssetsApi, ab as RpcTransport, a6 as TimeIntervalTriggerInput } from './AdsApi-C_GcWmfO.mjs';
|
|
3
3
|
|
|
4
4
|
declare class MockAnalyticsApi implements AnalyticsApi {
|
|
5
5
|
recordCustomEvent(eventName: string, payload: Record<string, any>): Promise<void>;
|
|
@@ -57,13 +57,29 @@ declare function initializeStackNavigation(venusApi: VenusAPI, host: Host): void
|
|
|
57
57
|
declare class MockNotificationsApi implements NotificationsApi {
|
|
58
58
|
private readonly venusApi;
|
|
59
59
|
constructor(venusApi: VenusAPI);
|
|
60
|
-
|
|
60
|
+
cancelNotification(notificationId: string): Promise<boolean>;
|
|
61
61
|
getAllScheduledLocalNotifications(): Promise<ScheduleLocalNotification[]>;
|
|
62
62
|
isLocalNotificationsEnabled(): Promise<boolean>;
|
|
63
|
-
|
|
63
|
+
scheduleAsync(options: ScheduleNotificationOptions): Promise<string | null>;
|
|
64
64
|
setLocalNotificationsEnabled(enabled: boolean): Promise<boolean>;
|
|
65
65
|
}
|
|
66
66
|
|
|
67
|
+
declare class RpcNotificationsApi implements NotificationsApi {
|
|
68
|
+
private readonly rpcClient;
|
|
69
|
+
constructor(rpcClient: RpcClient);
|
|
70
|
+
scheduleAsync(options: ScheduleNotificationOptions): Promise<string | null>;
|
|
71
|
+
cancelNotification(id: string): Promise<boolean>;
|
|
72
|
+
getAllScheduledLocalNotifications(): Promise<ScheduleLocalNotification[]>;
|
|
73
|
+
isLocalNotificationsEnabled(): Promise<boolean>;
|
|
74
|
+
setLocalNotificationsEnabled(enabled: boolean): Promise<boolean>;
|
|
75
|
+
}
|
|
76
|
+
type NotificationContent = {
|
|
77
|
+
title: string | null;
|
|
78
|
+
subtitle: string | null;
|
|
79
|
+
body: string | null;
|
|
80
|
+
data?: Record<string, any>;
|
|
81
|
+
};
|
|
82
|
+
|
|
67
83
|
declare function initializeLocalNotifications(venusApi: VenusAPI, host: Host): void;
|
|
68
84
|
|
|
69
85
|
declare class RpcPopupsApi implements PopupsApi {
|
|
@@ -433,10 +449,67 @@ declare class MockSimulationApi implements SimulationApi {
|
|
|
433
449
|
|
|
434
450
|
declare function initializeSimulation(venusApi: VenusAPI, host: Host): void;
|
|
435
451
|
|
|
436
|
-
interface
|
|
437
|
-
|
|
438
|
-
|
|
452
|
+
interface CreateRoomOptions {
|
|
453
|
+
maxPlayers?: number;
|
|
454
|
+
gameType?: string;
|
|
455
|
+
isPrivate?: boolean;
|
|
456
|
+
roomCode?: string;
|
|
457
|
+
name?: string;
|
|
458
|
+
description?: string;
|
|
459
|
+
customMetadata?: Record<string, any>;
|
|
460
|
+
}
|
|
461
|
+
interface JoinOrCreateResult {
|
|
462
|
+
action: 'created' | 'joined';
|
|
463
|
+
room: VenusRoom;
|
|
464
|
+
playersJoined: number;
|
|
465
|
+
}
|
|
466
|
+
interface RoomSubscriptionOptions {
|
|
467
|
+
onData?: (roomData: any) => void;
|
|
468
|
+
onMessages?: (messagePayload: any) => void;
|
|
469
|
+
onMoves?: (movePayload: any) => void;
|
|
470
|
+
onGameEvents?: (eventPayload: any) => void;
|
|
471
|
+
}
|
|
472
|
+
interface ProposeMovePayload {
|
|
473
|
+
gameSpecificState: any;
|
|
474
|
+
moveType: string;
|
|
475
|
+
clientContext?: Record<string, any>;
|
|
476
|
+
clientProposalId?: string;
|
|
477
|
+
}
|
|
478
|
+
interface ProposeMoveResult {
|
|
479
|
+
proposedMoveId: string;
|
|
480
|
+
}
|
|
481
|
+
interface ValidateMoveResult {
|
|
482
|
+
success: boolean;
|
|
483
|
+
moveId: string;
|
|
484
|
+
isValid: boolean;
|
|
485
|
+
reason?: string | null;
|
|
439
486
|
}
|
|
487
|
+
interface RoomsApi {
|
|
488
|
+
createRoom(options: CreateRoomOptions): Promise<VenusRoom>;
|
|
489
|
+
joinOrCreateRoom(options: CreateRoomOptions): Promise<JoinOrCreateResult>;
|
|
490
|
+
joinRoomByCode?(roomCode: string): Promise<VenusRoom>;
|
|
491
|
+
getUserRooms?(includeArchived?: boolean): Promise<VenusRoom[]>;
|
|
492
|
+
subscribe?(room: VenusRoom, options: RoomSubscriptionOptions): (() => void) | {
|
|
493
|
+
unsubscribe(): void;
|
|
494
|
+
};
|
|
495
|
+
updateData?(room: VenusRoom, updates: Record<string, any>, merge?: boolean): Promise<any>;
|
|
496
|
+
getData?(room: VenusRoom): Promise<any>;
|
|
497
|
+
sendMessage?(room: VenusRoom, messageData: any): Promise<string>;
|
|
498
|
+
leave?(room: VenusRoom): Promise<any>;
|
|
499
|
+
startGame?(room: VenusRoom, gameConfig?: Record<string, any>, turnOrder?: string[] | null): Promise<any>;
|
|
500
|
+
proposeMove?(room: VenusRoom, proposalPayload: ProposeMovePayload): Promise<ProposeMoveResult>;
|
|
501
|
+
validateMove?(room: VenusRoom, moveId: string, isValid: boolean, reason?: string | null, validatorId?: string | null): Promise<ValidateMoveResult>;
|
|
502
|
+
}
|
|
503
|
+
|
|
504
|
+
/**
|
|
505
|
+
* Set up room notification listeners using the transport's onVenusMessage hook.
|
|
506
|
+
* This routes host-sent room notifications (H5_ROOM_DATA_UPDATED, etc.) to the
|
|
507
|
+
* callbacks registered in the RoomsApi instance.
|
|
508
|
+
* @param transport The Venus transport to listen for messages
|
|
509
|
+
* @param getSubscriptions Function to retrieve subscription state from RoomsApi
|
|
510
|
+
*/
|
|
511
|
+
declare function setupRoomNotifications(transport: VenusTransport, getSubscriptions: () => any): Subscription;
|
|
512
|
+
declare function initializeRoomsApi(venusApi: VenusAPI, host: Host): void;
|
|
440
513
|
|
|
441
514
|
interface LoggingApi {
|
|
442
515
|
logDebug(message: string, ...args: any[]): void;
|
|
@@ -488,6 +561,29 @@ declare class MockIapApi implements IapApi {
|
|
|
488
561
|
|
|
489
562
|
declare function initializeIap(venusApiInstance: VenusAPI, host: Host): void;
|
|
490
563
|
|
|
564
|
+
declare class MockPreloaderApi implements PreloaderApi {
|
|
565
|
+
showLoadScreen(): Promise<void>;
|
|
566
|
+
hideLoadScreen(): Promise<void>;
|
|
567
|
+
setLoaderText(text: string): Promise<void>;
|
|
568
|
+
setLoaderProgress(progress: number): Promise<void>;
|
|
569
|
+
}
|
|
570
|
+
|
|
571
|
+
declare class RpcPreloaderApi implements PreloaderApi {
|
|
572
|
+
private readonly rpcClient;
|
|
573
|
+
constructor(rpcClient: RpcClient);
|
|
574
|
+
showLoadScreen(): Promise<void>;
|
|
575
|
+
hideLoadScreen(): Promise<void>;
|
|
576
|
+
setLoaderText(text: string): Promise<void>;
|
|
577
|
+
setLoaderProgress(progress: number): Promise<void>;
|
|
578
|
+
}
|
|
579
|
+
|
|
580
|
+
declare function initializePreloader(venusApi: VenusAPI, host: Host): void;
|
|
581
|
+
|
|
582
|
+
interface InitializeOptions {
|
|
583
|
+
usePreloader?: boolean;
|
|
584
|
+
mock?: Record<string, any>;
|
|
585
|
+
[key: string]: any;
|
|
586
|
+
}
|
|
491
587
|
interface Host {
|
|
492
588
|
readonly ads: AdsApi;
|
|
493
589
|
readonly analytics: AnalyticsApi;
|
|
@@ -509,8 +605,9 @@ interface Host {
|
|
|
509
605
|
readonly simulation: SimulationApi;
|
|
510
606
|
readonly rooms: RoomsApi;
|
|
511
607
|
readonly logging: LoggingApi;
|
|
608
|
+
readonly preloader: PreloaderApi;
|
|
512
609
|
readonly isInitialized: boolean;
|
|
513
|
-
initialize(): Promise<void>;
|
|
610
|
+
initialize(options?: InitializeOptions): Promise<void>;
|
|
514
611
|
readonly iap: IapApi;
|
|
515
612
|
}
|
|
516
613
|
|
|
@@ -747,8 +844,12 @@ declare enum VenusMessageId {
|
|
|
747
844
|
H5_ROOM_ELIMINATE_PLAYER = "H5_ROOM_ELIMINATE_PLAYER",
|
|
748
845
|
H5_ROOM_PROMOTE_TO_SPECTATOR = "H5_ROOM_PROMOTE_TO_SPECTATOR",
|
|
749
846
|
H5_LOAD_EMBEDDED_ASSET = "H5_LOAD_EMBEDDED_ASSET",
|
|
847
|
+
H5_SHOW_LOAD_SCREEN = "H5_SHOW_LOAD_SCREEN",
|
|
848
|
+
H5_HIDE_LOAD_SCREEN = "H5_HIDE_LOAD_SCREEN",
|
|
849
|
+
H5_SET_LOADER_TEXT = "H5_SET_LOADER_TEXT",
|
|
850
|
+
H5_SET_LOADER_PROGRESS = "H5_SET_LOADER_PROGRESS",
|
|
750
851
|
H5_IAP_OPEN_STORE = "H5_IAP_OPEN_STORE",
|
|
751
852
|
H5_IAP_GET_CURRENCY_ICON = "H5_IAP_GET_CURRENCY_ICON"
|
|
752
853
|
}
|
|
753
854
|
|
|
754
|
-
export { ActionSheetItem, AdsApi, AiApi, AiChatCompletionData, AiChatCompletionRequest, AnalyticsApi, AssetManifest, Avatar3dApi, Avatar3dConfig, Avatar3dEdits, CdnApi, type CollectRecipeResult, type ExecuteRecipeOptions, type ExecuteScopedRecipeOptions, type ExecuteScopedRecipeResult, type Experiment, type FeaturesApi, FetchBlobOptions, type GetActiveRunsOptions, type GetAvailableRecipesOptions, type GetAvailableRecipesResult, type GetBatchRecipeRequirements, type GetFutureTimeOptions, HapticFeedbackStyle, HapticsApi, HostCdnApi, HostProfileApi, HostTimeApi, IapApi, LifecycleApi, LoadEmbeddedAssetsResponse, type LoggingApi, type MethodIds, MockAdsApi, MockAiApi, MockAnalyticsApi, MockCdnApi, MockFeaturesApi, MockHapticsApi, MockIapApi, MockLifecycleApi, MockLoggingApi, MockNavigationApi, MockNotificationsApi, MockPopupsApi, MockProfileApi, MockSharedAssetsApi, MockSimulationApi, MockStorageApi, MockTimeApi, NavigationApi, NavigationStackInfo, NotificationsApi, OnCleanupCallback, OnHideCallback, OnPauseCallback, OnPlayCallback, OnQuitCallback, OnResumeCallback, OnShowCallback, PlayContext, PopupsApi, type ProfileApi, PushAppOptions, QuitOptions, type Recipe, type RecipeInfo, RpcAdsApi, RpcAiApi, RpcAnalyticsApi, RpcAvatarApi, RpcClient, RpcFeaturesApi, RpcHapticsApi, RpcIapApi, RpcLifecycleApi, RpcLoggingApi, type RpcMessage, RpcNavigationApi, RpcNotification, RpcPopupsApi, RpcRequest, RpcResponse, RpcSimulationApi, RpcStorageApi, SDK_VERSION, ScheduleLocalNotification,
|
|
855
|
+
export { ActionSheetItem, AdsApi, AiApi, AiChatCompletionData, AiChatCompletionRequest, AnalyticsApi, AssetManifest, Avatar3dApi, Avatar3dConfig, Avatar3dEdits, CdnApi, type CollectRecipeResult, type CreateRoomOptions, type ExecuteRecipeOptions, type ExecuteScopedRecipeOptions, type ExecuteScopedRecipeResult, type Experiment, type FeaturesApi, FetchBlobOptions, type GetActiveRunsOptions, type GetAvailableRecipesOptions, type GetAvailableRecipesResult, type GetBatchRecipeRequirements, type GetFutureTimeOptions, HapticFeedbackStyle, HapticsApi, HostCdnApi, HostProfileApi, HostTimeApi, IapApi, type JoinOrCreateResult, LifecycleApi, LoadEmbeddedAssetsResponse, type LoggingApi, type MethodIds, MockAdsApi, MockAiApi, MockAnalyticsApi, MockCdnApi, MockFeaturesApi, MockHapticsApi, MockIapApi, MockLifecycleApi, MockLoggingApi, MockNavigationApi, MockNotificationsApi, MockPopupsApi, MockPreloaderApi, MockProfileApi, MockSharedAssetsApi, MockSimulationApi, MockStorageApi, MockTimeApi, NavigationApi, NavigationStackInfo, type NotificationContent, NotificationsApi, OnCleanupCallback, OnHideCallback, OnPauseCallback, OnPlayCallback, OnQuitCallback, OnResumeCallback, OnShowCallback, PlayContext, PopupsApi, PreloaderApi, type ProfileApi, type ProposeMovePayload, type ProposeMoveResult, PushAppOptions, QuitOptions, type Recipe, type RecipeInfo, type RoomSubscriptionOptions, type RoomsApi, RpcAdsApi, RpcAiApi, RpcAnalyticsApi, RpcAvatarApi, RpcClient, RpcFeaturesApi, RpcHapticsApi, RpcIapApi, RpcLifecycleApi, RpcLoggingApi, type RpcMessage, RpcNavigationApi, RpcNotification, RpcNotificationsApi, RpcPopupsApi, RpcPreloaderApi, RpcRequest, RpcResponse, RpcSimulationApi, RpcStorageApi, SDK_VERSION, ScheduleLocalNotification, ScheduleNotificationOptions, type ServerTimeData, SharedAssetsApi, ShowActionSheetOptions, ShowAlertOptions, ShowConfirmOptions, ShowContext, ShowEditorOptions, ShowToastOptions, type ShowToastResponse, type SimulationApi, SpendCurrencyOptions, type StorageApi, type StorageType, SubPath, Subscription, type TimeApi, type TriggerRecipeChainOptions, type ValidateMoveResult, VenusMessageId, VenusRoom, createMockStorageApi, initializeAds, initializeAi, initializeAnalytics, initializeAvatar3d, initializeCdn, initializeFeaturesApi, initializeHaptics, initializeIap, initializeLifecycleApi, initializeLocalNotifications, initializeLoggingApi, initializePopups, initializePreloader, initializeProfile, initializeRoomsApi, initializeSimulation, initializeStackNavigation, initializeStorage, initializeTime, isPacificDaylightTime, setupRoomNotifications };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { A as AnalyticsApi, R as RpcRequest, a as RpcResponse, b as RpcNotification, c as RpcClient, V as VenusAPI, N as NavigationApi, Q as QuitOptions, d as NavigationStackInfo, P as PushAppOptions, e as NotificationsApi, S as ScheduleLocalNotification, f as
|
|
2
|
-
export {
|
|
1
|
+
import { A as AnalyticsApi, R as RpcRequest, a as RpcResponse, b as RpcNotification, c as RpcClient, V as VenusAPI, N as NavigationApi, Q as QuitOptions, d as NavigationStackInfo, P as PushAppOptions, e as NotificationsApi, S as ScheduleLocalNotification, f as ScheduleNotificationOptions, g as PopupsApi, h as ActionSheetItem, i as ShowActionSheetOptions, j as ShowAlertOptions, k as ShowConfirmOptions, l as ShowToastOptions, m as Profile, n as AiApi, o as AiChatCompletionRequest, p as AiChatCompletionData, H as HapticsApi, q as HapticFeedbackStyle, L as LifecycleApi, O as OnCleanupCallback, r as OnShowCallback, s as OnHideCallback, t as OnPauseCallback, u as OnPlayCallback, v as OnQuitCallback, w as OnResumeCallback, x as PlayContext, y as ShowContext, z as VenusSimulationConfig, B as RecipeRequirementResult, C as VenusRoom, D as VenusTransport, E as Subscription, I as IapApi, F as SpendCurrencyOptions, G as LoadEmbeddedAssetsResponse, J as SharedAssetsApi, K as PreloaderApi, M as AdsApi, T as Avatar3dApi, U as CdnApi, W as AssetManifest, X as Avatar3dConfig, Y as ShowEditorOptions, Z as Avatar3dEdits, _ as SubPath, $ as FetchBlobOptions } from './AdsApi-C_GcWmfO.js';
|
|
2
|
+
export { a0 as AiMessage, a1 as Asset, a2 as Category, a4 as Insets, ad as LoadEmbeddedAssetsRequest, a3 as MockAvatarApi, a7 as NotificationTriggerInput, aa as OnNotificationCallback, a8 as OnRequestCallback, a9 as OnResponseCallback, a5 as PostInfo, ac as RpcSharedAssetsApi, ab as RpcTransport, a6 as TimeIntervalTriggerInput } from './AdsApi-C_GcWmfO.js';
|
|
3
3
|
|
|
4
4
|
declare class MockAnalyticsApi implements AnalyticsApi {
|
|
5
5
|
recordCustomEvent(eventName: string, payload: Record<string, any>): Promise<void>;
|
|
@@ -57,13 +57,29 @@ declare function initializeStackNavigation(venusApi: VenusAPI, host: Host): void
|
|
|
57
57
|
declare class MockNotificationsApi implements NotificationsApi {
|
|
58
58
|
private readonly venusApi;
|
|
59
59
|
constructor(venusApi: VenusAPI);
|
|
60
|
-
|
|
60
|
+
cancelNotification(notificationId: string): Promise<boolean>;
|
|
61
61
|
getAllScheduledLocalNotifications(): Promise<ScheduleLocalNotification[]>;
|
|
62
62
|
isLocalNotificationsEnabled(): Promise<boolean>;
|
|
63
|
-
|
|
63
|
+
scheduleAsync(options: ScheduleNotificationOptions): Promise<string | null>;
|
|
64
64
|
setLocalNotificationsEnabled(enabled: boolean): Promise<boolean>;
|
|
65
65
|
}
|
|
66
66
|
|
|
67
|
+
declare class RpcNotificationsApi implements NotificationsApi {
|
|
68
|
+
private readonly rpcClient;
|
|
69
|
+
constructor(rpcClient: RpcClient);
|
|
70
|
+
scheduleAsync(options: ScheduleNotificationOptions): Promise<string | null>;
|
|
71
|
+
cancelNotification(id: string): Promise<boolean>;
|
|
72
|
+
getAllScheduledLocalNotifications(): Promise<ScheduleLocalNotification[]>;
|
|
73
|
+
isLocalNotificationsEnabled(): Promise<boolean>;
|
|
74
|
+
setLocalNotificationsEnabled(enabled: boolean): Promise<boolean>;
|
|
75
|
+
}
|
|
76
|
+
type NotificationContent = {
|
|
77
|
+
title: string | null;
|
|
78
|
+
subtitle: string | null;
|
|
79
|
+
body: string | null;
|
|
80
|
+
data?: Record<string, any>;
|
|
81
|
+
};
|
|
82
|
+
|
|
67
83
|
declare function initializeLocalNotifications(venusApi: VenusAPI, host: Host): void;
|
|
68
84
|
|
|
69
85
|
declare class RpcPopupsApi implements PopupsApi {
|
|
@@ -433,10 +449,67 @@ declare class MockSimulationApi implements SimulationApi {
|
|
|
433
449
|
|
|
434
450
|
declare function initializeSimulation(venusApi: VenusAPI, host: Host): void;
|
|
435
451
|
|
|
436
|
-
interface
|
|
437
|
-
|
|
438
|
-
|
|
452
|
+
interface CreateRoomOptions {
|
|
453
|
+
maxPlayers?: number;
|
|
454
|
+
gameType?: string;
|
|
455
|
+
isPrivate?: boolean;
|
|
456
|
+
roomCode?: string;
|
|
457
|
+
name?: string;
|
|
458
|
+
description?: string;
|
|
459
|
+
customMetadata?: Record<string, any>;
|
|
460
|
+
}
|
|
461
|
+
interface JoinOrCreateResult {
|
|
462
|
+
action: 'created' | 'joined';
|
|
463
|
+
room: VenusRoom;
|
|
464
|
+
playersJoined: number;
|
|
465
|
+
}
|
|
466
|
+
interface RoomSubscriptionOptions {
|
|
467
|
+
onData?: (roomData: any) => void;
|
|
468
|
+
onMessages?: (messagePayload: any) => void;
|
|
469
|
+
onMoves?: (movePayload: any) => void;
|
|
470
|
+
onGameEvents?: (eventPayload: any) => void;
|
|
471
|
+
}
|
|
472
|
+
interface ProposeMovePayload {
|
|
473
|
+
gameSpecificState: any;
|
|
474
|
+
moveType: string;
|
|
475
|
+
clientContext?: Record<string, any>;
|
|
476
|
+
clientProposalId?: string;
|
|
477
|
+
}
|
|
478
|
+
interface ProposeMoveResult {
|
|
479
|
+
proposedMoveId: string;
|
|
480
|
+
}
|
|
481
|
+
interface ValidateMoveResult {
|
|
482
|
+
success: boolean;
|
|
483
|
+
moveId: string;
|
|
484
|
+
isValid: boolean;
|
|
485
|
+
reason?: string | null;
|
|
439
486
|
}
|
|
487
|
+
interface RoomsApi {
|
|
488
|
+
createRoom(options: CreateRoomOptions): Promise<VenusRoom>;
|
|
489
|
+
joinOrCreateRoom(options: CreateRoomOptions): Promise<JoinOrCreateResult>;
|
|
490
|
+
joinRoomByCode?(roomCode: string): Promise<VenusRoom>;
|
|
491
|
+
getUserRooms?(includeArchived?: boolean): Promise<VenusRoom[]>;
|
|
492
|
+
subscribe?(room: VenusRoom, options: RoomSubscriptionOptions): (() => void) | {
|
|
493
|
+
unsubscribe(): void;
|
|
494
|
+
};
|
|
495
|
+
updateData?(room: VenusRoom, updates: Record<string, any>, merge?: boolean): Promise<any>;
|
|
496
|
+
getData?(room: VenusRoom): Promise<any>;
|
|
497
|
+
sendMessage?(room: VenusRoom, messageData: any): Promise<string>;
|
|
498
|
+
leave?(room: VenusRoom): Promise<any>;
|
|
499
|
+
startGame?(room: VenusRoom, gameConfig?: Record<string, any>, turnOrder?: string[] | null): Promise<any>;
|
|
500
|
+
proposeMove?(room: VenusRoom, proposalPayload: ProposeMovePayload): Promise<ProposeMoveResult>;
|
|
501
|
+
validateMove?(room: VenusRoom, moveId: string, isValid: boolean, reason?: string | null, validatorId?: string | null): Promise<ValidateMoveResult>;
|
|
502
|
+
}
|
|
503
|
+
|
|
504
|
+
/**
|
|
505
|
+
* Set up room notification listeners using the transport's onVenusMessage hook.
|
|
506
|
+
* This routes host-sent room notifications (H5_ROOM_DATA_UPDATED, etc.) to the
|
|
507
|
+
* callbacks registered in the RoomsApi instance.
|
|
508
|
+
* @param transport The Venus transport to listen for messages
|
|
509
|
+
* @param getSubscriptions Function to retrieve subscription state from RoomsApi
|
|
510
|
+
*/
|
|
511
|
+
declare function setupRoomNotifications(transport: VenusTransport, getSubscriptions: () => any): Subscription;
|
|
512
|
+
declare function initializeRoomsApi(venusApi: VenusAPI, host: Host): void;
|
|
440
513
|
|
|
441
514
|
interface LoggingApi {
|
|
442
515
|
logDebug(message: string, ...args: any[]): void;
|
|
@@ -488,6 +561,29 @@ declare class MockIapApi implements IapApi {
|
|
|
488
561
|
|
|
489
562
|
declare function initializeIap(venusApiInstance: VenusAPI, host: Host): void;
|
|
490
563
|
|
|
564
|
+
declare class MockPreloaderApi implements PreloaderApi {
|
|
565
|
+
showLoadScreen(): Promise<void>;
|
|
566
|
+
hideLoadScreen(): Promise<void>;
|
|
567
|
+
setLoaderText(text: string): Promise<void>;
|
|
568
|
+
setLoaderProgress(progress: number): Promise<void>;
|
|
569
|
+
}
|
|
570
|
+
|
|
571
|
+
declare class RpcPreloaderApi implements PreloaderApi {
|
|
572
|
+
private readonly rpcClient;
|
|
573
|
+
constructor(rpcClient: RpcClient);
|
|
574
|
+
showLoadScreen(): Promise<void>;
|
|
575
|
+
hideLoadScreen(): Promise<void>;
|
|
576
|
+
setLoaderText(text: string): Promise<void>;
|
|
577
|
+
setLoaderProgress(progress: number): Promise<void>;
|
|
578
|
+
}
|
|
579
|
+
|
|
580
|
+
declare function initializePreloader(venusApi: VenusAPI, host: Host): void;
|
|
581
|
+
|
|
582
|
+
interface InitializeOptions {
|
|
583
|
+
usePreloader?: boolean;
|
|
584
|
+
mock?: Record<string, any>;
|
|
585
|
+
[key: string]: any;
|
|
586
|
+
}
|
|
491
587
|
interface Host {
|
|
492
588
|
readonly ads: AdsApi;
|
|
493
589
|
readonly analytics: AnalyticsApi;
|
|
@@ -509,8 +605,9 @@ interface Host {
|
|
|
509
605
|
readonly simulation: SimulationApi;
|
|
510
606
|
readonly rooms: RoomsApi;
|
|
511
607
|
readonly logging: LoggingApi;
|
|
608
|
+
readonly preloader: PreloaderApi;
|
|
512
609
|
readonly isInitialized: boolean;
|
|
513
|
-
initialize(): Promise<void>;
|
|
610
|
+
initialize(options?: InitializeOptions): Promise<void>;
|
|
514
611
|
readonly iap: IapApi;
|
|
515
612
|
}
|
|
516
613
|
|
|
@@ -747,8 +844,12 @@ declare enum VenusMessageId {
|
|
|
747
844
|
H5_ROOM_ELIMINATE_PLAYER = "H5_ROOM_ELIMINATE_PLAYER",
|
|
748
845
|
H5_ROOM_PROMOTE_TO_SPECTATOR = "H5_ROOM_PROMOTE_TO_SPECTATOR",
|
|
749
846
|
H5_LOAD_EMBEDDED_ASSET = "H5_LOAD_EMBEDDED_ASSET",
|
|
847
|
+
H5_SHOW_LOAD_SCREEN = "H5_SHOW_LOAD_SCREEN",
|
|
848
|
+
H5_HIDE_LOAD_SCREEN = "H5_HIDE_LOAD_SCREEN",
|
|
849
|
+
H5_SET_LOADER_TEXT = "H5_SET_LOADER_TEXT",
|
|
850
|
+
H5_SET_LOADER_PROGRESS = "H5_SET_LOADER_PROGRESS",
|
|
750
851
|
H5_IAP_OPEN_STORE = "H5_IAP_OPEN_STORE",
|
|
751
852
|
H5_IAP_GET_CURRENCY_ICON = "H5_IAP_GET_CURRENCY_ICON"
|
|
752
853
|
}
|
|
753
854
|
|
|
754
|
-
export { ActionSheetItem, AdsApi, AiApi, AiChatCompletionData, AiChatCompletionRequest, AnalyticsApi, AssetManifest, Avatar3dApi, Avatar3dConfig, Avatar3dEdits, CdnApi, type CollectRecipeResult, type ExecuteRecipeOptions, type ExecuteScopedRecipeOptions, type ExecuteScopedRecipeResult, type Experiment, type FeaturesApi, FetchBlobOptions, type GetActiveRunsOptions, type GetAvailableRecipesOptions, type GetAvailableRecipesResult, type GetBatchRecipeRequirements, type GetFutureTimeOptions, HapticFeedbackStyle, HapticsApi, HostCdnApi, HostProfileApi, HostTimeApi, IapApi, LifecycleApi, LoadEmbeddedAssetsResponse, type LoggingApi, type MethodIds, MockAdsApi, MockAiApi, MockAnalyticsApi, MockCdnApi, MockFeaturesApi, MockHapticsApi, MockIapApi, MockLifecycleApi, MockLoggingApi, MockNavigationApi, MockNotificationsApi, MockPopupsApi, MockProfileApi, MockSharedAssetsApi, MockSimulationApi, MockStorageApi, MockTimeApi, NavigationApi, NavigationStackInfo, NotificationsApi, OnCleanupCallback, OnHideCallback, OnPauseCallback, OnPlayCallback, OnQuitCallback, OnResumeCallback, OnShowCallback, PlayContext, PopupsApi, type ProfileApi, PushAppOptions, QuitOptions, type Recipe, type RecipeInfo, RpcAdsApi, RpcAiApi, RpcAnalyticsApi, RpcAvatarApi, RpcClient, RpcFeaturesApi, RpcHapticsApi, RpcIapApi, RpcLifecycleApi, RpcLoggingApi, type RpcMessage, RpcNavigationApi, RpcNotification, RpcPopupsApi, RpcRequest, RpcResponse, RpcSimulationApi, RpcStorageApi, SDK_VERSION, ScheduleLocalNotification,
|
|
855
|
+
export { ActionSheetItem, AdsApi, AiApi, AiChatCompletionData, AiChatCompletionRequest, AnalyticsApi, AssetManifest, Avatar3dApi, Avatar3dConfig, Avatar3dEdits, CdnApi, type CollectRecipeResult, type CreateRoomOptions, type ExecuteRecipeOptions, type ExecuteScopedRecipeOptions, type ExecuteScopedRecipeResult, type Experiment, type FeaturesApi, FetchBlobOptions, type GetActiveRunsOptions, type GetAvailableRecipesOptions, type GetAvailableRecipesResult, type GetBatchRecipeRequirements, type GetFutureTimeOptions, HapticFeedbackStyle, HapticsApi, HostCdnApi, HostProfileApi, HostTimeApi, IapApi, type JoinOrCreateResult, LifecycleApi, LoadEmbeddedAssetsResponse, type LoggingApi, type MethodIds, MockAdsApi, MockAiApi, MockAnalyticsApi, MockCdnApi, MockFeaturesApi, MockHapticsApi, MockIapApi, MockLifecycleApi, MockLoggingApi, MockNavigationApi, MockNotificationsApi, MockPopupsApi, MockPreloaderApi, MockProfileApi, MockSharedAssetsApi, MockSimulationApi, MockStorageApi, MockTimeApi, NavigationApi, NavigationStackInfo, type NotificationContent, NotificationsApi, OnCleanupCallback, OnHideCallback, OnPauseCallback, OnPlayCallback, OnQuitCallback, OnResumeCallback, OnShowCallback, PlayContext, PopupsApi, PreloaderApi, type ProfileApi, type ProposeMovePayload, type ProposeMoveResult, PushAppOptions, QuitOptions, type Recipe, type RecipeInfo, type RoomSubscriptionOptions, type RoomsApi, RpcAdsApi, RpcAiApi, RpcAnalyticsApi, RpcAvatarApi, RpcClient, RpcFeaturesApi, RpcHapticsApi, RpcIapApi, RpcLifecycleApi, RpcLoggingApi, type RpcMessage, RpcNavigationApi, RpcNotification, RpcNotificationsApi, RpcPopupsApi, RpcPreloaderApi, RpcRequest, RpcResponse, RpcSimulationApi, RpcStorageApi, SDK_VERSION, ScheduleLocalNotification, ScheduleNotificationOptions, type ServerTimeData, SharedAssetsApi, ShowActionSheetOptions, ShowAlertOptions, ShowConfirmOptions, ShowContext, ShowEditorOptions, ShowToastOptions, type ShowToastResponse, type SimulationApi, SpendCurrencyOptions, type StorageApi, type StorageType, SubPath, Subscription, type TimeApi, type TriggerRecipeChainOptions, type ValidateMoveResult, VenusMessageId, VenusRoom, createMockStorageApi, initializeAds, initializeAi, initializeAnalytics, initializeAvatar3d, initializeCdn, initializeFeaturesApi, initializeHaptics, initializeIap, initializeLifecycleApi, initializeLocalNotifications, initializeLoggingApi, initializePopups, initializePreloader, initializeProfile, initializeRoomsApi, initializeSimulation, initializeStackNavigation, initializeStorage, initializeTime, isPacificDaylightTime, setupRoomNotifications };
|
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import { init_rooms } from './chunk-YDXFZ2A2.mjs';
|
|
2
|
+
export { HapticFeedbackStyle, HostCdnApi, HostProfileApi, HostTimeApi, MockAdsApi, MockAiApi, MockAnalyticsApi, MockAvatarApi, MockCdnApi, MockFeaturesApi, MockHapticsApi, MockIapApi, MockLifecycleApi, MockLoggingApi, MockNavigationApi, MockNotificationsApi, MockPopupsApi, MockPreloaderApi, MockProfileApi, MockSharedAssetsApi, MockSimulationApi, MockStorageApi, MockTimeApi, RpcAdsApi, RpcAiApi, RpcAnalyticsApi, RpcAvatarApi, RpcClient, RpcFeaturesApi, RpcHapticsApi, RpcIapApi, RpcLifecycleApi, RpcLoggingApi, RpcNavigationApi, RpcNotificationsApi, RpcPopupsApi, RpcPreloaderApi, RpcSharedAssetsApi, RpcSimulationApi, RpcStorageApi, SDK_VERSION, VenusMessageId, VenusRoom, createMockStorageApi, initializeAds, initializeAi, initializeAnalytics, initializeAvatar3d, initializeCdn, initializeFeaturesApi, initializeHaptics, initializeIap, initializeLifecycleApi, initializeLocalNotifications, initializeLoggingApi, initializePopups, initializePreloader, initializeProfile, initializeRoomsApi, initializeSimulation, initializeStackNavigation, initializeStorage, initializeTime, isPacificDaylightTime, setupRoomNotifications } from './chunk-YDXFZ2A2.mjs';
|
|
3
|
+
import './chunk-W7IPHM67.mjs';
|
|
4
|
+
|
|
5
|
+
// src/index.ts
|
|
6
|
+
init_rooms();
|
|
3
7
|
//# sourceMappingURL=index.mjs.map
|
|
4
8
|
//# sourceMappingURL=index.mjs.map
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[],"names":[],"mappings":"","file":"index.mjs"}
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"names":[],"mappings":";;;;;AAeA,UAAA,EAAA","file":"index.mjs","sourcesContent":["export * from './ads'\r\nexport * from './ai'\r\nexport * from './analytics'\r\nexport * from './avatar3d'\r\nexport * from './cdn'\r\nexport * from './features'\r\nexport * from './haptics'\r\nexport * from './iap'\r\nexport * from './lifecycles'\r\nexport * from './logging'\r\nexport * from './navigation'\r\nexport * from './notifications'\r\nexport * from './popups'\r\nexport * from './profile'\r\nexport * from './rpc'\r\nexport * from './rooms'\r\nexport * from './storage'\r\nexport * from './simulation'\r\nexport * from './time'\r\nexport * from './version'\r\nexport * from './shared-assets'\r\nexport * from './VenusMessageId'\r\nexport * from './game-preloader'\r\n"]}
|