@oasiz/sdk 1.6.1 → 1.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/dist/index.d.cts CHANGED
@@ -41,6 +41,83 @@ declare function getViewportInsets(): ViewportInsets;
41
41
  declare function getSafeAreaTop(): number;
42
42
  declare function setLeaderboardVisible(visible: boolean): void;
43
43
 
44
+ type Unsubscribe = () => void;
45
+ declare function onPause(callback: () => void): Unsubscribe;
46
+ declare function onResume(callback: () => void): Unsubscribe;
47
+
48
+ interface BackButtonTestingOptions {
49
+ /**
50
+ * When true, pressing Escape dispatches the same event the host app sends for
51
+ * back actions. Defaults to true.
52
+ */
53
+ keyboard?: boolean;
54
+ /**
55
+ * When true, the SDK traps one browser-history entry while back override is
56
+ * active, so the browser Back button can be used for local testing. Defaults
57
+ * to true.
58
+ */
59
+ browserHistory?: boolean;
60
+ /** Log setup details to the console. Defaults to false. */
61
+ log?: boolean;
62
+ }
63
+ interface BackButtonTestingHandle {
64
+ destroy: () => void;
65
+ isBackOverrideActive: () => boolean;
66
+ triggerBack: () => void;
67
+ triggerLeave: () => void;
68
+ }
69
+ declare function enableBackButtonTesting(options?: BackButtonTestingOptions): BackButtonTestingHandle;
70
+ declare function onBackButton(callback: () => void): Unsubscribe;
71
+ declare function onLeaveGame(callback: () => void): Unsubscribe;
72
+ declare function leaveGame(): void;
73
+
74
+ type AppSimulatorDeviceName = "iphone-11" | "iphone-11-pro" | "iphone-11-pro-max" | "iphone-12-mini" | "iphone-12" | "iphone-12-pro" | "iphone-12-pro-max" | "iphone-13-mini" | "iphone-13" | "iphone-13-pro" | "iphone-13-pro-max" | "iphone-14" | "iphone-14-plus" | "iphone-14-pro" | "iphone-14-pro-max" | "iphone-15" | "iphone-15-plus" | "iphone-15-pro" | "iphone-15-pro-max" | "iphone-16" | "iphone-16-plus" | "iphone-16-pro" | "iphone-16-pro-max" | "iphone-16e" | "iphone-17" | "iphone-17-pro" | "iphone-17-pro-max" | "iphone-17e" | "iphone-air" | "iphone-se" | "pixel-8";
75
+ type AppSimulatorOrientation = "portrait" | "landscape";
76
+ interface AppSimulatorDevice {
77
+ height: number;
78
+ name?: string;
79
+ safeArea?: Partial<ViewportInsetEdges>;
80
+ width: number;
81
+ }
82
+ interface AppSimulatorOptions {
83
+ browserHistoryBack?: BackButtonTestingOptions["browserHistory"];
84
+ comments?: number;
85
+ device?: AppSimulatorDeviceName | AppSimulatorDevice;
86
+ enabled?: boolean;
87
+ /**
88
+ * When true, the SDK tries to place the current game DOM inside a centered
89
+ * phone viewport on desktop. Use false if your game already runs in browser
90
+ * device emulation or owns its own preview frame. Defaults to true.
91
+ */
92
+ frame?: boolean | "auto";
93
+ keyboardBack?: BackButtonTestingOptions["keyboard"];
94
+ leaderboardVisible?: boolean;
95
+ likes?: number;
96
+ log?: boolean;
97
+ orientation?: AppSimulatorOrientation;
98
+ score?: number;
99
+ title?: string;
100
+ }
101
+ interface AppSimulatorHandle {
102
+ closeSheet: () => void;
103
+ destroy: () => void;
104
+ getViewportInsets: () => ViewportInsets;
105
+ hide: () => void;
106
+ isVisible: () => boolean;
107
+ openComments: () => void;
108
+ openLeaderboard: () => void;
109
+ setCounts: (counts: {
110
+ comments?: number;
111
+ likes?: number;
112
+ }) => void;
113
+ setLeaderboardVisible: (visible: boolean) => void;
114
+ setLiked: (liked: boolean) => void;
115
+ show: () => void;
116
+ triggerBack: () => void;
117
+ triggerLeave: () => void;
118
+ }
119
+ declare function enableAppSimulator(options?: AppSimulatorOptions): AppSimulatorHandle;
120
+
44
121
  type HapticType = "light" | "medium" | "heavy" | "success" | "error";
45
122
  type LogOverlayLevel = "debug" | "log" | "info" | "warn" | "error";
46
123
  interface LogOverlayEntry {
@@ -235,38 +312,9 @@ declare function loadGameState(): GameState;
235
312
  declare function saveGameState(state: GameState): void;
236
313
  declare function flushGameState(): void;
237
314
 
238
- type Unsubscribe = () => void;
239
- declare function onPause(callback: () => void): Unsubscribe;
240
- declare function onResume(callback: () => void): Unsubscribe;
241
-
242
- interface BackButtonTestingOptions {
243
- /**
244
- * When true, pressing Escape dispatches the same event the host app sends for
245
- * back actions. Defaults to true.
246
- */
247
- keyboard?: boolean;
248
- /**
249
- * When true, the SDK traps one browser-history entry while back override is
250
- * active, so the browser Back button can be used for local testing. Defaults
251
- * to true.
252
- */
253
- browserHistory?: boolean;
254
- /** Log setup details to the console. Defaults to false. */
255
- log?: boolean;
256
- }
257
- interface BackButtonTestingHandle {
258
- destroy: () => void;
259
- isBackOverrideActive: () => boolean;
260
- triggerBack: () => void;
261
- triggerLeave: () => void;
262
- }
263
- declare function enableBackButtonTesting(options?: BackButtonTestingOptions): BackButtonTestingHandle;
264
- declare function onBackButton(callback: () => void): Unsubscribe;
265
- declare function onLeaveGame(callback: () => void): Unsubscribe;
266
- declare function leaveGame(): void;
267
-
268
315
  declare const oasiz: {
269
316
  submitScore: typeof submitScore;
317
+ enableAppSimulator: typeof enableAppSimulator;
270
318
  addScore: typeof addScore;
271
319
  setScore: typeof setScore;
272
320
  getPlayerCharacter: typeof getPlayerCharacter;
@@ -298,4 +346,4 @@ declare const oasiz: {
298
346
  readonly graphicsPerformance: GraphicsPerformanceMetric;
299
347
  };
300
348
 
301
- export { type BackButtonTestingHandle, type BackButtonTestingOptions, type FacingFrameMap, type GameState, type GraphicsPerformanceMetric, type GraphicsPerformanceTier, type HapticType, type LogOverlayEntry, type LogOverlayHandle, type LogOverlayLevel, type LogOverlayOptions, type PlayerCharacter, type ScoreEditResult, type ShareRequest, type ShareRoomCodeOptions, type TextureAtlas, type TextureAtlasAnimation, type TextureAtlasFrame, type Unsubscribe, type ViewportInsetEdges, type ViewportInsetSide, type ViewportInsets, addScore, enableBackButtonTesting, enableLogOverlay, flushGameState, getGameId, getGraphicsPerformance, getPlayerAvatar, getPlayerCharacter, getPlayerId, getPlayerName, getRoomCode, getSafeAreaTop, getViewportInsets, leaveGame, loadGameState, oasiz, onBackButton, onLeaveGame, onPause, onResume, openInviteModal, saveGameState, setLeaderboardVisible, setScore, share, shareRoomCode, submitScore, triggerHaptic };
349
+ export { type AppSimulatorDevice, type AppSimulatorDeviceName, type AppSimulatorHandle, type AppSimulatorOptions, type AppSimulatorOrientation, type BackButtonTestingHandle, type BackButtonTestingOptions, type FacingFrameMap, type GameState, type GraphicsPerformanceMetric, type GraphicsPerformanceTier, type HapticType, type LogOverlayEntry, type LogOverlayHandle, type LogOverlayLevel, type LogOverlayOptions, type PlayerCharacter, type ScoreEditResult, type ShareRequest, type ShareRoomCodeOptions, type TextureAtlas, type TextureAtlasAnimation, type TextureAtlasFrame, type Unsubscribe, type ViewportInsetEdges, type ViewportInsetSide, type ViewportInsets, addScore, enableAppSimulator, enableBackButtonTesting, enableLogOverlay, flushGameState, getGameId, getGraphicsPerformance, getPlayerAvatar, getPlayerCharacter, getPlayerId, getPlayerName, getRoomCode, getSafeAreaTop, getViewportInsets, leaveGame, loadGameState, oasiz, onBackButton, onLeaveGame, onPause, onResume, openInviteModal, saveGameState, setLeaderboardVisible, setScore, share, shareRoomCode, submitScore, triggerHaptic };
package/dist/index.d.ts CHANGED
@@ -41,6 +41,83 @@ declare function getViewportInsets(): ViewportInsets;
41
41
  declare function getSafeAreaTop(): number;
42
42
  declare function setLeaderboardVisible(visible: boolean): void;
43
43
 
44
+ type Unsubscribe = () => void;
45
+ declare function onPause(callback: () => void): Unsubscribe;
46
+ declare function onResume(callback: () => void): Unsubscribe;
47
+
48
+ interface BackButtonTestingOptions {
49
+ /**
50
+ * When true, pressing Escape dispatches the same event the host app sends for
51
+ * back actions. Defaults to true.
52
+ */
53
+ keyboard?: boolean;
54
+ /**
55
+ * When true, the SDK traps one browser-history entry while back override is
56
+ * active, so the browser Back button can be used for local testing. Defaults
57
+ * to true.
58
+ */
59
+ browserHistory?: boolean;
60
+ /** Log setup details to the console. Defaults to false. */
61
+ log?: boolean;
62
+ }
63
+ interface BackButtonTestingHandle {
64
+ destroy: () => void;
65
+ isBackOverrideActive: () => boolean;
66
+ triggerBack: () => void;
67
+ triggerLeave: () => void;
68
+ }
69
+ declare function enableBackButtonTesting(options?: BackButtonTestingOptions): BackButtonTestingHandle;
70
+ declare function onBackButton(callback: () => void): Unsubscribe;
71
+ declare function onLeaveGame(callback: () => void): Unsubscribe;
72
+ declare function leaveGame(): void;
73
+
74
+ type AppSimulatorDeviceName = "iphone-11" | "iphone-11-pro" | "iphone-11-pro-max" | "iphone-12-mini" | "iphone-12" | "iphone-12-pro" | "iphone-12-pro-max" | "iphone-13-mini" | "iphone-13" | "iphone-13-pro" | "iphone-13-pro-max" | "iphone-14" | "iphone-14-plus" | "iphone-14-pro" | "iphone-14-pro-max" | "iphone-15" | "iphone-15-plus" | "iphone-15-pro" | "iphone-15-pro-max" | "iphone-16" | "iphone-16-plus" | "iphone-16-pro" | "iphone-16-pro-max" | "iphone-16e" | "iphone-17" | "iphone-17-pro" | "iphone-17-pro-max" | "iphone-17e" | "iphone-air" | "iphone-se" | "pixel-8";
75
+ type AppSimulatorOrientation = "portrait" | "landscape";
76
+ interface AppSimulatorDevice {
77
+ height: number;
78
+ name?: string;
79
+ safeArea?: Partial<ViewportInsetEdges>;
80
+ width: number;
81
+ }
82
+ interface AppSimulatorOptions {
83
+ browserHistoryBack?: BackButtonTestingOptions["browserHistory"];
84
+ comments?: number;
85
+ device?: AppSimulatorDeviceName | AppSimulatorDevice;
86
+ enabled?: boolean;
87
+ /**
88
+ * When true, the SDK tries to place the current game DOM inside a centered
89
+ * phone viewport on desktop. Use false if your game already runs in browser
90
+ * device emulation or owns its own preview frame. Defaults to true.
91
+ */
92
+ frame?: boolean | "auto";
93
+ keyboardBack?: BackButtonTestingOptions["keyboard"];
94
+ leaderboardVisible?: boolean;
95
+ likes?: number;
96
+ log?: boolean;
97
+ orientation?: AppSimulatorOrientation;
98
+ score?: number;
99
+ title?: string;
100
+ }
101
+ interface AppSimulatorHandle {
102
+ closeSheet: () => void;
103
+ destroy: () => void;
104
+ getViewportInsets: () => ViewportInsets;
105
+ hide: () => void;
106
+ isVisible: () => boolean;
107
+ openComments: () => void;
108
+ openLeaderboard: () => void;
109
+ setCounts: (counts: {
110
+ comments?: number;
111
+ likes?: number;
112
+ }) => void;
113
+ setLeaderboardVisible: (visible: boolean) => void;
114
+ setLiked: (liked: boolean) => void;
115
+ show: () => void;
116
+ triggerBack: () => void;
117
+ triggerLeave: () => void;
118
+ }
119
+ declare function enableAppSimulator(options?: AppSimulatorOptions): AppSimulatorHandle;
120
+
44
121
  type HapticType = "light" | "medium" | "heavy" | "success" | "error";
45
122
  type LogOverlayLevel = "debug" | "log" | "info" | "warn" | "error";
46
123
  interface LogOverlayEntry {
@@ -235,38 +312,9 @@ declare function loadGameState(): GameState;
235
312
  declare function saveGameState(state: GameState): void;
236
313
  declare function flushGameState(): void;
237
314
 
238
- type Unsubscribe = () => void;
239
- declare function onPause(callback: () => void): Unsubscribe;
240
- declare function onResume(callback: () => void): Unsubscribe;
241
-
242
- interface BackButtonTestingOptions {
243
- /**
244
- * When true, pressing Escape dispatches the same event the host app sends for
245
- * back actions. Defaults to true.
246
- */
247
- keyboard?: boolean;
248
- /**
249
- * When true, the SDK traps one browser-history entry while back override is
250
- * active, so the browser Back button can be used for local testing. Defaults
251
- * to true.
252
- */
253
- browserHistory?: boolean;
254
- /** Log setup details to the console. Defaults to false. */
255
- log?: boolean;
256
- }
257
- interface BackButtonTestingHandle {
258
- destroy: () => void;
259
- isBackOverrideActive: () => boolean;
260
- triggerBack: () => void;
261
- triggerLeave: () => void;
262
- }
263
- declare function enableBackButtonTesting(options?: BackButtonTestingOptions): BackButtonTestingHandle;
264
- declare function onBackButton(callback: () => void): Unsubscribe;
265
- declare function onLeaveGame(callback: () => void): Unsubscribe;
266
- declare function leaveGame(): void;
267
-
268
315
  declare const oasiz: {
269
316
  submitScore: typeof submitScore;
317
+ enableAppSimulator: typeof enableAppSimulator;
270
318
  addScore: typeof addScore;
271
319
  setScore: typeof setScore;
272
320
  getPlayerCharacter: typeof getPlayerCharacter;
@@ -298,4 +346,4 @@ declare const oasiz: {
298
346
  readonly graphicsPerformance: GraphicsPerformanceMetric;
299
347
  };
300
348
 
301
- export { type BackButtonTestingHandle, type BackButtonTestingOptions, type FacingFrameMap, type GameState, type GraphicsPerformanceMetric, type GraphicsPerformanceTier, type HapticType, type LogOverlayEntry, type LogOverlayHandle, type LogOverlayLevel, type LogOverlayOptions, type PlayerCharacter, type ScoreEditResult, type ShareRequest, type ShareRoomCodeOptions, type TextureAtlas, type TextureAtlasAnimation, type TextureAtlasFrame, type Unsubscribe, type ViewportInsetEdges, type ViewportInsetSide, type ViewportInsets, addScore, enableBackButtonTesting, enableLogOverlay, flushGameState, getGameId, getGraphicsPerformance, getPlayerAvatar, getPlayerCharacter, getPlayerId, getPlayerName, getRoomCode, getSafeAreaTop, getViewportInsets, leaveGame, loadGameState, oasiz, onBackButton, onLeaveGame, onPause, onResume, openInviteModal, saveGameState, setLeaderboardVisible, setScore, share, shareRoomCode, submitScore, triggerHaptic };
349
+ export { type AppSimulatorDevice, type AppSimulatorDeviceName, type AppSimulatorHandle, type AppSimulatorOptions, type AppSimulatorOrientation, type BackButtonTestingHandle, type BackButtonTestingOptions, type FacingFrameMap, type GameState, type GraphicsPerformanceMetric, type GraphicsPerformanceTier, type HapticType, type LogOverlayEntry, type LogOverlayHandle, type LogOverlayLevel, type LogOverlayOptions, type PlayerCharacter, type ScoreEditResult, type ShareRequest, type ShareRoomCodeOptions, type TextureAtlas, type TextureAtlasAnimation, type TextureAtlasFrame, type Unsubscribe, type ViewportInsetEdges, type ViewportInsetSide, type ViewportInsets, addScore, enableAppSimulator, enableBackButtonTesting, enableLogOverlay, flushGameState, getGameId, getGraphicsPerformance, getPlayerAvatar, getPlayerCharacter, getPlayerId, getPlayerName, getRoomCode, getSafeAreaTop, getViewportInsets, leaveGame, loadGameState, oasiz, onBackButton, onLeaveGame, onPause, onResume, openInviteModal, saveGameState, setLeaderboardVisible, setScore, share, shareRoomCode, submitScore, triggerHaptic };