@apps-in-toss/devtools 3.1.0-beta.0 → 3.1.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/mock/3x.d.ts CHANGED
@@ -156,7 +156,6 @@ declare const isMinVersionSupported: typeof SDK.isMinVersionSupported;
156
156
  declare const GoogleAdMob: typeof SDK.GoogleAdMob;
157
157
  declare const loadFullScreenAd: typeof SDK.loadFullScreenAd;
158
158
  declare const showFullScreenAd: typeof SDK.showFullScreenAd;
159
- declare const Ads: typeof SDK.Ads;
160
159
  declare const IAP: typeof SDK.IAP;
161
160
  declare const Analytics: typeof SDK.Analytics;
162
161
  declare const Clipboard: typeof SDK.Clipboard;
@@ -164,6 +163,30 @@ declare const Device: typeof SDK.Device;
164
163
  declare const Environment: typeof SDK.Environment;
165
164
  declare const File: typeof SDK.File;
166
165
  declare const Game: typeof SDK.Game;
166
+ declare const Migration: {
167
+ getOriginStorage: () => Promise<{
168
+ previous: {
169
+ origin: string;
170
+ localStorage: {};
171
+ indexedDB: never[];
172
+ opfs: {
173
+ directories: never[];
174
+ files: never[];
175
+ };
176
+ errors: never[];
177
+ };
178
+ current: {
179
+ origin: string;
180
+ localStorage: {};
181
+ indexedDB: never[];
182
+ opfs: {
183
+ directories: never[];
184
+ files: never[];
185
+ };
186
+ errors: never[];
187
+ };
188
+ }>;
189
+ };
167
190
  declare const Notification: typeof SDK.Notification;
168
191
  declare const Promotion: typeof SDK.Promotion;
169
192
  declare const Review: typeof SDK.Review;
@@ -650,8 +673,8 @@ interface AddAccessoryButtonOptions {
650
673
  };
651
674
  }
652
675
  declare const partner: {
653
- addAccessoryButton(options: AddAccessoryButtonOptions): Promise<void>;
654
- removeAccessoryButton(): Promise<void>;
676
+ addAccessoryButton: (options: AddAccessoryButtonOptions) => Promise<void>;
677
+ removeAccessoryButton: () => Promise<void>;
655
678
  };
656
679
  //#endregion
657
680
  //#region src/mock/permissions.d.ts
@@ -1027,123 +1050,4 @@ declare function listUserPresets(): MockPreset[];
1027
1050
  declare function saveUserPreset(label: string, state: MockPresetState, description?: string): MockPreset;
1028
1051
  declare function deleteUserPreset(id: string): void;
1029
1052
  //#endregion
1030
- //#region src/mock/safe-area-bridge.d.ts
1031
- /** The postMessage envelope the launcher posts to the framed dev app (inset forward). */
1032
- declare const SAFE_AREA_INSETS_MESSAGE_TYPE: "ait:safe-area-insets";
1033
- /**
1034
- * The postMessage command the launcher partner bar's `←` button sends to the
1035
- * framed dev app (#510). The framed page calls `history.back()` in response.
1036
- *
1037
- * Protocol: only `{ type: 'ait:navigate-back' }` is valid. No other fields are
1038
- * read or acted on — extra fields are silently ignored by the shape guard.
1039
- * Game variant never sends this message (back button is partner-bar-only).
1040
- */
1041
- declare const NAVIGATE_BACK_MESSAGE_TYPE: "ait:navigate-back";
1042
- /**
1043
- * The postMessage envelope the framed mini-app self-reports its webViewType
1044
- * with (#580). The mini-app knows its own type from the build constant
1045
- * `__WEB_VIEW_TYPE__` (`granite.config.ts`'s `webViewProps.type`, injected by
1046
- * the devtools unplugin). The launcher is cross-origin so it cannot read that
1047
- * constant directly — the mini-app posts it to `window.parent` once so the
1048
- * launcher (env-2 PWA shell) switches to game mode automatically, with no
1049
- * manual `?navBarType=game` URL edit.
1050
- *
1051
- * Direction: this is the SEND side's contract (posted from inside the iframe by
1052
- * `@ait-co/debug-console`'s `packages/debug-console/src/attach.ts`). The
1053
- * launcher's receive half lives in
1054
- * `e2e/fixture/launcher/Launcher.tsx` and mirrors the same value enum inline,
1055
- * staying decoupled from the mock package internals — the same pattern the
1056
- * other launcher message types follow.
1057
- *
1058
- * Value enum: only `'partner'` and `'game'` are valid. The SDK's deprecated
1059
- * `'external'` alias of `partner` (web-framework 2.6.1) is mapped to `'partner'`
1060
- * at the send site so the wire only ever carries the two shapes the launcher
1061
- * emulates.
1062
- */
1063
- declare const WEB_VIEW_TYPE_MESSAGE_TYPE: "ait:web-view-type";
1064
- /** The two webViewType shapes the launcher can emulate (#580). */
1065
- type WebViewTypeValue = "partner" | "game";
1066
- /**
1067
- * Parse + validate a raw postMessage payload into a `SafeAreaInsets`, or return
1068
- * null when it is not a well-formed `ait:safe-area-insets` message. Pure — unit
1069
- * tested without a real MessageEvent.
1070
- */
1071
- declare function parseSafeAreaInsetsMessage(data: unknown): SafeAreaInsets$1 | null;
1072
- /**
1073
- * Parse + validate a raw postMessage payload into a webViewType value
1074
- * (`'partner'` | `'game'`), or return `null` when it is not a well-formed
1075
- * `ait:web-view-type` message (#580). Pure — unit tested without a real
1076
- * MessageEvent.
1077
- *
1078
- * Strict shape guard (the safety boundary for the cross-origin receive path):
1079
- * the payload must be a non-null object whose `type` is exactly
1080
- * {@link WEB_VIEW_TYPE_MESSAGE_TYPE} and whose `value` is exactly `'partner'`
1081
- * or `'game'` (an enum allow-list). Anything else — a foreign type, a missing
1082
- * or non-string value, the deprecated `'external'` alias, or any other string —
1083
- * returns `null` so a stray postMessage can never flip the launcher's visual
1084
- * mode. The send site is responsible for collapsing `'external'` → `'partner'`
1085
- * before posting; the parser does NOT silently accept it.
1086
- */
1087
- declare function parseWebViewTypeMessage(data: unknown): WebViewTypeValue | null;
1088
- /**
1089
- * Apply forwarded insets to the mock state. Skips the write (and the resulting
1090
- * subscribe notify) when nothing changed, so repeated identical messages from a
1091
- * resize storm don't churn subscribers.
1092
- */
1093
- declare function applyForwardedSafeAreaInsets(insets: SafeAreaInsets$1): void;
1094
- /**
1095
- * Install the window `message` listener that receives forwarded insets. Safe to
1096
- * call multiple times (idempotent) and a no-op outside a browser (SSR/jsdom
1097
- * without a window). Imported for its side effect by the mock barrel so any
1098
- * consumer that aliases `@apps-in-toss/web-framework` to the mock gets it wired.
1099
- *
1100
- * On each valid `ait:safe-area-insets` message:
1101
- * 1. Writes the corrected insets into the mock `SafeAreaInsets` state
1102
- * (existing #484 behaviour — for apps that still read SDK insets).
1103
- * 2. Drives the env-2 dead-band compensation style via
1104
- * {@link applyEnv2Compensation} — injects a `body { margin-top: calc(-1 *
1105
- * env(safe-area-inset-top)) }` style when `top === 0` (partner mode) and
1106
- * removes it when `top > 0` (game / full-bleed mode).
1107
- */
1108
- declare function installSafeAreaInsetsBridge(): void;
1109
- /**
1110
- * Parse a raw postMessage payload as an `ait:navigate-back` command.
1111
- *
1112
- * Returns true when the payload is a well-formed navigate-back command
1113
- * (`{ type: 'ait:navigate-back' }`), false otherwise. Pure — unit tested
1114
- * without a real MessageEvent.
1115
- *
1116
- * Shape guard: only the `type` field is inspected; any extra fields are
1117
- * ignored so future extensions do not break older receivers. The function
1118
- * does NOT read any data field beyond `type` — no sensitive values, no host
1119
- * disclosure (same principle as the insets bridge).
1120
- */
1121
- declare function isNavigateBackMessage(data: unknown): boolean;
1122
- /**
1123
- * Install the window `message` listener that handles `ait:navigate-back`
1124
- * commands (#510). When the launcher partner bar's `←` button is clicked it
1125
- * posts `{ type: 'ait:navigate-back' }` to the framed dev app; this listener
1126
- * calls `dispatchHostBackNavigation()` from the navigation module.
1127
- *
1128
- * Dispatch semantics: if there are any `graniteEvent.addEventListener('backEvent', …)`
1129
- * subscribers the CustomEvent `__ait:backEvent` is fired (same path as the env-1
1130
- * panel back button — the mini-app intercept channel). When there are no
1131
- * subscribers `history.back()` is called as the fallback. Back semantics are
1132
- * owned entirely by the navigation module; this bridge only delegates.
1133
- *
1134
- * Safe to call multiple times (idempotent) and a no-op outside a browser.
1135
- * Installed together with the inset bridge by `installBridges()` so any consumer
1136
- * of the mock barrel gets both wired automatically.
1137
- *
1138
- * No-op on apps that predate this bridge — the launcher posts the message but
1139
- * older mocks simply have no listener (harmless).
1140
- */
1141
- declare function installNavigateBackBridge(): void;
1142
- /**
1143
- * Install both env-2 postMessage bridges in one call (#484 insets + #510
1144
- * navigate-back). The mock barrel calls this at import time so consumers get
1145
- * all bridges wired without any explicit setup.
1146
- */
1147
- declare function installBridges(): void;
1148
- //#endregion
1149
- export { Accuracy, Ads, type AitDevtoolsState, Analytics, type AnalyticsLogEntry, Clipboard, type ConsentedUserData, type ConsentedUserDataKey, type DeclaredAgeRange, Device, type DeviceApiMode, type DeviceModes, Environment, FetchAlbumPhotosPermissionError, FetchContactsPermissionError, File, Game, GetClipboardTextPermissionError, GetCurrentLocationPermissionError, GoogleAdMob, type HapticFeedbackType, IAP, type IapNextResult, type LocationCoords, type MockContact, type MockData, type MockIapProduct, type MockLocation, type MockPreset, type MockPresetState, NAVIGATE_BACK_MESSAGE_TYPE, type NetworkStatus, Notification, OpenCameraPermissionError, type OperationalEnvironment, PermissionError, type PermissionName, type PermissionStatus, type PlatformOS, type Primitive, Promotion, Review, SAFE_AREA_INSETS_MESSAGE_TYPE, SafeArea, SafeAreaInsets, type SafeAreaInsets$1 as SafeAreaInsetsType, Screen, SetClipboardTextPermissionError, Share, StartUpdateLocationPermissionError, Storage, TossAds, TossAuth, TossPay, User, WEB_VIEW_TYPE_MESSAGE_TYPE, type WebViewTypeValue, aitState, appLogin, applyForwardedSafeAreaInsets, applyPreset, appsInTossEvent, appsInTossSignTossCert, builtInPresets, captureCurrentState, checkoutPayment, closeView, contactsViral, createAsyncBridge, createConstantBridge, createEventBridge, deleteUserPreset, env, eventLog, fetchAlbumItems, fetchAlbumPhotos, fetchContacts, generateHapticFeedback, getAnonymousKey, getAppsInTossGlobals, getClipboardText, getConsentedUserData, getCurrentLocation, getDeclaredAgeRange, getDefaultPlaceholderImages, getDeviceId, getGameCenterGameProfile, getGroupId, getIsTossLoginIntegratedService, getLocale, getNetworkStatus, getOperationalEnvironment, getPermission, getPlatformOS, getSafeAreaInsets, getSchemeUri, getServerTime, getTossAppVersion, getTossShareLink, getUserKeyForGame, graniteEvent, grantPromotionReward, grantPromotionRewardForGame, installBridges, installNavigateBackBridge, installSafeAreaInsetsBridge, isMinVersionSupported, isNavigateBackMessage, listUserPresets, loadFullScreenAd, matchesPreset, onVisibilityChangedByTransparentServiceWeb, openCamera, openGameCenterLeaderboard, openPDFViewer, openPermissionDialog, openURL, parseSafeAreaInsetsMessage, parseWebViewTypeMessage, partner, requestNotificationAgreement, requestPermission, requestReview, requestTossPayPaysBilling, saveBase64Data, saveUserPreset, setClipboardText, setDeviceOrientation, setIosSwipeGestureEnabled, setScreenAwakeMode, setSecureScreen, share, showFullScreenAd, startUpdateLocation, submitGameCenterLeaderBoardScore, tdsEvent };
1053
+ export { Accuracy, type AitDevtoolsState, Analytics, type AnalyticsLogEntry, Clipboard, type ConsentedUserData, type ConsentedUserDataKey, type DeclaredAgeRange, Device, type DeviceApiMode, type DeviceModes, Environment, FetchAlbumPhotosPermissionError, FetchContactsPermissionError, File, Game, GetClipboardTextPermissionError, GetCurrentLocationPermissionError, GoogleAdMob, type HapticFeedbackType, IAP, type IapNextResult, type LocationCoords, Migration, type MockContact, type MockData, type MockIapProduct, type MockLocation, type MockPreset, type MockPresetState, type NetworkStatus, Notification, OpenCameraPermissionError, type OperationalEnvironment, PermissionError, type PermissionName, type PermissionStatus, type PlatformOS, type Primitive, Promotion, Review, SafeArea, SafeAreaInsets, type SafeAreaInsets$1 as SafeAreaInsetsType, Screen, SetClipboardTextPermissionError, Share, StartUpdateLocationPermissionError, Storage, TossAds, TossAuth, TossPay, User, aitState, appLogin, applyPreset, appsInTossEvent, appsInTossSignTossCert, builtInPresets, captureCurrentState, checkoutPayment, closeView, contactsViral, createAsyncBridge, createConstantBridge, createEventBridge, deleteUserPreset, env, eventLog, fetchAlbumItems, fetchAlbumPhotos, fetchContacts, generateHapticFeedback, getAnonymousKey, getAppsInTossGlobals, getClipboardText, getConsentedUserData, getCurrentLocation, getDeclaredAgeRange, getDefaultPlaceholderImages, getDeviceId, getGameCenterGameProfile, getGroupId, getIsTossLoginIntegratedService, getLocale, getNetworkStatus, getOperationalEnvironment, getPermission, getPlatformOS, getSafeAreaInsets, getSchemeUri, getServerTime, getTossAppVersion, getTossShareLink, getUserKeyForGame, graniteEvent, grantPromotionReward, grantPromotionRewardForGame, isMinVersionSupported, listUserPresets, loadFullScreenAd, matchesPreset, onVisibilityChangedByTransparentServiceWeb, openCamera, openGameCenterLeaderboard, openPDFViewer, openPermissionDialog, openURL, partner, requestNotificationAgreement, requestPermission, requestReview, requestTossPayPaysBilling, saveBase64Data, saveUserPreset, setClipboardText, setDeviceOrientation, setIosSwipeGestureEnabled, setScreenAwakeMode, setSecureScreen, share, showFullScreenAd, startUpdateLocation, submitGameCenterLeaderBoardScore, tdsEvent };