@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.
@@ -90,56 +90,14 @@ type TimeIntervalTriggerInput = {
90
90
  repeats?: boolean;
91
91
  channelId?: string;
92
92
  };
93
- type DateTriggerInput = {
94
- type: 'date';
95
- date: string;
96
- channelId?: string;
97
- };
98
- type CalendarTriggerInput = {
99
- type: 'calendar';
100
- year?: number;
101
- month?: number;
102
- day?: number;
103
- hour?: number;
104
- minute?: number;
105
- second?: number;
106
- repeats?: boolean;
107
- channelId?: string;
108
- };
109
- type DailyTriggerInput = {
110
- type: 'daily';
111
- hour: number;
112
- minute: number;
113
- channelId?: string;
114
- };
115
- type WeeklyTriggerInput = {
116
- type: 'weekly';
117
- weekday: number;
118
- hour: number;
119
- minute: number;
120
- channelId?: string;
121
- };
122
- type MonthlyTriggerInput = {
123
- type: 'monthly';
124
- day: number;
125
- hour: number;
126
- minute: number;
127
- channelId?: string;
128
- };
129
- type YearlyTriggerInput = {
130
- type: 'yearly';
131
- month: number;
132
- day: number;
133
- hour: number;
134
- minute: number;
135
- channelId?: string;
136
- };
137
- type NotificationTriggerInput = null | TimeIntervalTriggerInput | DateTriggerInput | CalendarTriggerInput | DailyTriggerInput | WeeklyTriggerInput | MonthlyTriggerInput | YearlyTriggerInput;
138
- interface ScheduleLocalNotificationOptions {
93
+ type NotificationTriggerInput = TimeIntervalTriggerInput | null;
94
+ interface ScheduleNotificationOptions {
95
+ title: string;
96
+ body: string;
97
+ trigger: NotificationTriggerInput;
139
98
  priority?: number;
140
99
  groupId?: string;
141
100
  payload?: Record<string, any>;
142
- trigger?: NotificationTriggerInput;
143
101
  }
144
102
  interface ScheduleLocalNotification {
145
103
  id: string;
@@ -149,8 +107,8 @@ interface ScheduleLocalNotification {
149
107
  trigger?: NotificationTriggerInput;
150
108
  }
151
109
  interface NotificationsApi {
152
- scheduleLocalNotification(title: string, body: string, options?: ScheduleLocalNotificationOptions): Promise<string | null>;
153
- cancelLocalNotification(notificationId: string): Promise<boolean>;
110
+ scheduleAsync(options: ScheduleNotificationOptions): Promise<string | null>;
111
+ cancelNotification(notificationId: string): Promise<boolean>;
154
112
  getAllScheduledLocalNotifications(): Promise<ScheduleLocalNotification[]>;
155
113
  isLocalNotificationsEnabled(): Promise<boolean>;
156
114
  setLocalNotificationsEnabled(enabled: boolean): Promise<boolean>;
@@ -314,6 +272,119 @@ interface LifecycleApi {
314
272
  onCleanup(callback: OnCleanupCallback): void;
315
273
  }
316
274
 
275
+ interface VenusMessage {
276
+ type: string;
277
+ direction: string;
278
+ data?: {
279
+ requestId?: string;
280
+ success?: boolean;
281
+ value?: any;
282
+ data?: any;
283
+ error?: string;
284
+ script?: string;
285
+ };
286
+ instanceId: string;
287
+ timestamp: number;
288
+ }
289
+ declare global {
290
+ interface Window {
291
+ _venusInitState?: {
292
+ poolId: string;
293
+ apiInjected: boolean;
294
+ gameInitialized: boolean;
295
+ };
296
+ ReactNativeWebView?: {
297
+ postMessage(message: string): void;
298
+ };
299
+ venus: {
300
+ _config: {
301
+ locale: string;
302
+ instanceId: string;
303
+ context?: any;
304
+ profile?: {
305
+ id?: string;
306
+ username?: string;
307
+ name?: string;
308
+ displayName?: string;
309
+ avatarUrl?: string | null;
310
+ isAnonymous?: boolean;
311
+ };
312
+ environment: {
313
+ browserInfo?: {
314
+ language: string;
315
+ };
316
+ };
317
+ _handlers: Record<string, any>;
318
+ };
319
+ profile?: {
320
+ id?: string;
321
+ username?: string;
322
+ avatarUrl?: string | null;
323
+ name?: string;
324
+ displayName?: string;
325
+ isAnonymous?: boolean;
326
+ } | null;
327
+ _fetchFromCdn: (url: string) => Promise<string>;
328
+ };
329
+ }
330
+ }
331
+ type OnVenusMessageCallback = (message: VenusMessage) => void;
332
+ declare class VenusTransport implements RpcTransport {
333
+ private readonly messageHandler;
334
+ private readonly onNotificationCallbacks;
335
+ private readonly onNotificationCallbacksToRemove;
336
+ private readonly onVenusMessageCallbacks;
337
+ private readonly onResponseCallbacks;
338
+ private readonly onResponseCallbacksToRemove;
339
+ private _instanceId;
340
+ private isStarted;
341
+ private isProcessingMessage;
342
+ constructor();
343
+ onNotification(callback: OnNotificationCallback): Subscription;
344
+ onRequest(callback: OnRequestCallback): Subscription;
345
+ onResponse(callback: OnResponseCallback): Subscription;
346
+ get instanceId(): string | null;
347
+ set instanceId(instanceId: string);
348
+ sendRequest(request: RpcRequest): void;
349
+ sendVenusMessage(message: VenusMessage): void;
350
+ sendResponse(response: RpcResponse): void;
351
+ start(): void;
352
+ stop(): void;
353
+ private handleNotification;
354
+ private handleResponse;
355
+ private removeOnResponseCallback;
356
+ private removeOnNotificationCallback;
357
+ private logInfo;
358
+ private logWarn;
359
+ onVenusMessage(callback: OnVenusMessageCallback): Subscription;
360
+ private notifyVenusMessageReceived;
361
+ }
362
+
363
+ declare class VenusRoom {
364
+ readonly id: string;
365
+ name: string;
366
+ players: any[];
367
+ maxPlayers: number;
368
+ gameType: string;
369
+ appId: string;
370
+ type: any;
371
+ createdBy: string;
372
+ createdAt: number;
373
+ updatedAt: number;
374
+ isPrivate: boolean;
375
+ currentPlayers: string[];
376
+ status: any;
377
+ customMetadata: Record<string, any>;
378
+ admins: string[];
379
+ roomCode: string;
380
+ description: string;
381
+ data: Record<string, any>;
382
+ version: string;
383
+ private _subscriptions;
384
+ constructor(roomData: any);
385
+ private updateFromRoomData;
386
+ }
387
+
317
388
  interface SharedAssetsApi {
318
389
  loadCharactersBundle(): Promise<ArrayBuffer>;
319
390
  loadBurgerTimeAssetsBundle(): Promise<ArrayBuffer>;
@@ -343,6 +414,13 @@ interface IapApi {
343
414
  getCurrencyIcon(): Promise<LoadEmbeddedAssetsResponse>;
344
415
  }
345
416
 
417
+ interface PreloaderApi {
418
+ showLoadScreen(): Promise<void>;
419
+ hideLoadScreen(): Promise<void>;
420
+ setLoaderText(text: string): Promise<void>;
421
+ setLoaderProgress(progress: number): Promise<void>;
422
+ }
423
+
346
424
  interface Avatar3dConfig {
347
425
  headAsset: string | null;
348
426
  outfitAsset: string | null;
@@ -545,6 +623,7 @@ interface VenusConfig {
545
623
  id: string;
546
624
  username: string;
547
625
  avatarUrl?: string;
626
+ isAnonymous?: boolean;
548
627
  };
549
628
  device?: {
550
629
  screenSize: {
@@ -577,6 +656,21 @@ interface VenusConfig {
577
656
  };
578
657
  controls: Record<string, any>;
579
658
  };
659
+ rooms?: VenusRoomsConfig;
660
+ }
661
+ interface VenusRoomsConfig {
662
+ gameType?: string;
663
+ rulesPreset?: string;
664
+ matchmaking?: {
665
+ defaultCriteria?: Record<string, any>;
666
+ [key: string]: any;
667
+ };
668
+ createOptions?: Record<string, any>;
669
+ privateMatchDefaults?: {
670
+ createOptions?: Record<string, any>;
671
+ allowCustomCode?: boolean;
672
+ };
673
+ [key: string]: any;
580
674
  }
581
675
  interface ActionSheetOption {
582
676
  label: string;
@@ -585,8 +679,10 @@ interface ActionSheetOption {
585
679
  }
586
680
  interface Profile {
587
681
  id: string;
588
- name: string;
589
682
  username: string;
683
+ name?: string;
684
+ avatarUrl?: string | null;
685
+ isAnonymous?: boolean;
590
686
  }
591
687
  interface VenusAPI {
592
688
  config: VenusConfig;
@@ -599,6 +695,7 @@ interface VenusAPI {
599
695
  helpText?: string;
600
696
  hardDisableMock?: boolean;
601
697
  mock?: Record<string, any>;
698
+ usePreloader?: boolean;
602
699
  }): Promise<boolean>;
603
700
  simulation: VenusSimulationAPI;
604
701
  log(message: string, ...args: any[]): void;
@@ -772,22 +869,6 @@ interface VenusAPI {
772
869
  assetLoader?: {
773
870
  getCached(url: string): string | null;
774
871
  };
775
- scheduleLocalNotifAsync(options: {
776
- title: string;
777
- body: string;
778
- timeFromNow?: number;
779
- trigger?: NotificationTriggerInput;
780
- priority?: number;
781
- groupId?: string;
782
- payload?: any;
783
- data?: any;
784
- sound?: string;
785
- badge?: number;
786
- }): Promise<string>;
787
- cancelLocalNotifAsync(notificationId: string): Promise<void>;
788
- getAllLocalNotifsAsync(): Promise<ScheduleLocalNotification[]>;
789
- isLocalNotifEnabledAsync(): Promise<boolean>;
790
- setLocalNotifEnabledAsync(enabled: boolean): Promise<void>;
791
872
  showAvatar3dEditorAsync(options: {
792
873
  currentAvatar?: any;
793
874
  contextData?: any;
@@ -807,21 +888,35 @@ interface VenusAPI {
807
888
  stackPosition: number;
808
889
  };
809
890
  rooms: {
810
- create(options: any): Promise<any>;
811
- join(roomId: string): Promise<any>;
812
- joinOrCreate(options: any): Promise<any>;
891
+ create(options: any): Promise<VenusRoom>;
892
+ joinOrCreate(options: any): Promise<{
893
+ action: 'created' | 'joined';
894
+ room: VenusRoom;
895
+ playersJoined: number;
896
+ }>;
897
+ joinByCode(roomCode: string): Promise<VenusRoom>;
898
+ list(includeArchived?: boolean): Promise<VenusRoom[]>;
899
+ subscribeToRoom(room: VenusRoom, options: {
900
+ onData?: (event: any) => void;
901
+ onMessages?: (event: any) => void;
902
+ onMoves?: (event: any) => void;
903
+ onGameEvents?: (event: any) => void;
904
+ }): () => void;
905
+ proposeMove(room: VenusRoom, proposalPayload: {
906
+ gameSpecificState: any;
907
+ moveType: string;
908
+ clientContext?: Record<string, any>;
909
+ clientProposalId?: string;
910
+ }): Promise<{
911
+ proposedMoveId: string;
912
+ }>;
913
+ validateMove(room: VenusRoom, moveId: string, isValid: boolean, reason?: string, validatorId?: string): Promise<any>;
914
+ updateRoomData(room: VenusRoom, updates: any, merge?: boolean): Promise<any>;
915
+ getRoomData(room: VenusRoom): Promise<any>;
916
+ sendRoomMessage(room: VenusRoom, messageData: any): Promise<string>;
917
+ startRoomGame(room: VenusRoom, gameConfig?: any, turnOrder?: any): Promise<any>;
918
+ leaveRoom(room: VenusRoom): Promise<any>;
813
919
  };
814
- createRoom(options: any): Promise<any>;
815
- joinRoom(roomId: string): Promise<any>;
816
- joinOrCreateRoom(options: any): Promise<any>;
817
- listPublicRooms(gameType?: string, limit?: number): Promise<any>;
818
- searchRooms(searchQuery: string, gameType?: string, limit?: number): Promise<any>;
819
- joinRoomByCode(roomCode: string): Promise<any>;
820
- getUserRooms(appId: string, includeArchived?: boolean): Promise<any>;
821
- quickMatch(gameType: string): Promise<any>;
822
- isRoomSystemEnabled(): boolean;
823
- createGameRoom(options: any): Promise<any>;
824
- subscribeToGameEvents(roomId: string, callback: (event: any) => void): () => void;
825
920
  notifyCleanupComplete(): void;
826
921
  RoomEvents: {
827
922
  OPTIMISTIC_GAME_STATE_UPDATED: string;
@@ -837,15 +932,14 @@ interface VenusAPI {
837
932
  popups: PopupsApi;
838
933
  analytics: AnalyticsApi;
839
934
  sharedAssets: SharedAssetsApi;
935
+ preloader: PreloaderApi;
936
+ notifications: NotificationsApi;
840
937
  }
841
938
 
842
939
  interface AdsApi {
843
- /**
844
- * @deprecated This is no longer needed. Do not use
845
- */
846
940
  isRewardedAdReadyAsync(): Promise<boolean>;
847
941
  showRewardedAdAsync(): Promise<boolean>;
848
942
  showInterstitialAd(): Promise<boolean>;
849
943
  }
850
944
 
851
- export { MockAvatarApi as $, type AnalyticsApi as A, type RecipeRequirementResult as B, type SpendCurrencyOptions as C, type LoadEmbeddedAssetsResponse as D, type SharedAssetsApi as E, type AdsApi as F, type Avatar3dApi as G, type HapticsApi as H, type IapApi as I, type CdnApi as J, type AssetManifest as K, type LifecycleApi as L, type Avatar3dConfig as M, type NavigationApi as N, type OnCleanupCallback as O, type PushAppOptions as P, type QuitOptions as Q, type RpcRequest as R, type ScheduleLocalNotification as S, type ShowEditorOptions as T, type Avatar3dEdits as U, type VenusAPI as V, type SubPath as W, type FetchBlobOptions as X, type AiMessage as Y, type Asset as Z, type Category as _, type RpcResponse as a, type Insets as a0, type PostInfo as a1, type TimeIntervalTriggerInput as a2, type DateTriggerInput as a3, type CalendarTriggerInput as a4, type DailyTriggerInput as a5, type WeeklyTriggerInput as a6, type MonthlyTriggerInput as a7, type YearlyTriggerInput as a8, type NotificationTriggerInput as a9, type Subscription as aa, type OnRequestCallback as ab, type OnResponseCallback as ac, type OnNotificationCallback as ad, type RpcTransport as ae, RpcSharedAssetsApi as af, type LoadEmbeddedAssetsRequest as ag, type VenusSimulationState as ah, type VenusSimulationEffect as ai, type VenusSimulationRecipe as aj, type RecipeRequirementQuery as ak, type BatchRecipeRequirementsResult as al, type VenusSimulationAPI as am, type VenusConfig as an, type ActionSheetOption as ao, type RpcNotification as b, RpcClient as c, type NavigationStackInfo as d, type NotificationsApi as e, type ScheduleLocalNotificationOptions as f, type PopupsApi as g, type ActionSheetItem as h, type ShowActionSheetOptions as i, type ShowAlertOptions as j, type ShowConfirmOptions as k, type ShowToastOptions as l, type Profile as m, type AiApi as n, type AiChatCompletionRequest as o, type AiChatCompletionData as p, HapticFeedbackStyle as q, type OnShowCallback as r, type OnHideCallback as s, type OnPauseCallback as t, type OnPlayCallback as u, type OnQuitCallback as v, type OnResumeCallback as w, type PlayContext as x, type ShowContext as y, type VenusSimulationConfig as z };
945
+ export { type FetchBlobOptions as $, type AnalyticsApi as A, type RecipeRequirementResult as B, VenusRoom as C, VenusTransport as D, type Subscription as E, type SpendCurrencyOptions as F, type LoadEmbeddedAssetsResponse as G, type HapticsApi as H, type IapApi as I, type SharedAssetsApi as J, type PreloaderApi as K, type LifecycleApi as L, type AdsApi as M, type NavigationApi as N, type OnCleanupCallback as O, type PushAppOptions as P, type QuitOptions as Q, type RpcRequest as R, type ScheduleLocalNotification as S, type Avatar3dApi as T, type CdnApi as U, type VenusAPI as V, type AssetManifest as W, type Avatar3dConfig as X, type ShowEditorOptions as Y, type Avatar3dEdits as Z, type SubPath as _, type RpcResponse as a, type AiMessage as a0, type Asset as a1, type Category as a2, MockAvatarApi as a3, type Insets as a4, type PostInfo as a5, type TimeIntervalTriggerInput as a6, type NotificationTriggerInput as a7, type OnRequestCallback as a8, type OnResponseCallback as a9, type OnNotificationCallback as aa, type RpcTransport as ab, RpcSharedAssetsApi as ac, type LoadEmbeddedAssetsRequest as ad, type VenusSimulationState as ae, type VenusSimulationEffect as af, type VenusSimulationRecipe as ag, type RecipeRequirementQuery as ah, type BatchRecipeRequirementsResult as ai, type VenusSimulationAPI as aj, type VenusConfig as ak, type VenusRoomsConfig as al, type ActionSheetOption as am, type RpcNotification as b, RpcClient as c, type NavigationStackInfo as d, type NotificationsApi as e, type ScheduleNotificationOptions as f, type PopupsApi as g, type ActionSheetItem as h, type ShowActionSheetOptions as i, type ShowAlertOptions as j, type ShowConfirmOptions as k, type ShowToastOptions as l, type Profile as m, type AiApi as n, type AiChatCompletionRequest as o, type AiChatCompletionData as p, HapticFeedbackStyle as q, type OnShowCallback as r, type OnHideCallback as s, type OnPauseCallback as t, type OnPlayCallback as u, type OnQuitCallback as v, type OnResumeCallback as w, type PlayContext as x, type ShowContext as y, type VenusSimulationConfig as z };