@alien_org/contract 1.0.0-alpha.2 → 1.0.0-alpha.4

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 CHANGED
@@ -33,6 +33,7 @@ import type {
33
33
  // Launch parameters
34
34
  LaunchParams, // Host-injected params (authToken, contractVersion, etc.)
35
35
  Platform, // 'ios' | 'android'
36
+ DisplayMode, // 'standard' | 'fullscreen' | 'immersive'
36
37
 
37
38
  // Utilities
38
39
  Version, // Semantic version string type
@@ -42,10 +43,11 @@ import type {
42
43
  ### Constants
43
44
 
44
45
  ```typescript
45
- import { PLATFORMS, releases } from '@alien_org/contract';
46
+ import { DISPLAY_MODES, PLATFORMS, releases } from '@alien_org/contract';
46
47
 
47
- PLATFORMS // ['ios', 'android']
48
- releases // Record<Version, MethodName[]> - version to methods mapping
48
+ PLATFORMS // ['ios', 'android']
49
+ DISPLAY_MODES // ['standard', 'fullscreen', 'immersive']
50
+ releases // Record<Version, MethodName[]> - version to methods mapping
49
51
  ```
50
52
 
51
53
  ### Version Utilities
@@ -114,10 +116,22 @@ interface LaunchParams {
114
116
  platform: Platform | undefined; // 'ios' | 'android'
115
117
  safeAreaInsets: SafeAreaInsets | undefined; // System UI insets (CSS px)
116
118
  startParam: string | undefined; // Custom param (referrals, etc.)
117
- isFullscreen: boolean | undefined; // Launched in fullscreen mode
119
+ displayMode: DisplayMode; // 'standard' | 'fullscreen' | 'immersive'
118
120
  }
119
121
  ```
120
122
 
123
+ ### DisplayMode
124
+
125
+ Controls how the host app renders the miniapp webview.
126
+
127
+ | Mode | Header | Close / Options | WebView area | Use case |
128
+ | ---- | ------ | --------------- | ------------ | -------- |
129
+ | `standard` | Visible (title, close, options) | In header | Below header | Default for most miniapps |
130
+ | `fullscreen` | Hidden | Floating overlay | Entire screen | Games, media, maps |
131
+ | `immersive` | Hidden | **None** | Entire screen | Custom UIs that provide their own exit (must call `app:close`) |
132
+
133
+ In all modes the miniapp receives `safeAreaInsets` and should respect them for system UI (status bar, notch, home indicator).
134
+
121
135
  ## Adding New Methods/Events
122
136
 
123
137
  1. Define in `src/methods/definitions/methods.ts` or `src/events/definitions/events.ts`
package/dist/index.cjs CHANGED
@@ -4,6 +4,28 @@
4
4
  * Supported platforms for miniapps.
5
5
  */
6
6
  const PLATFORMS = ["ios", "android"];
7
+ /**
8
+ * Supported display modes for miniapps.
9
+ *
10
+ * - `standard` — Default. Native header with close button, options menu, and
11
+ * miniapp title is visible. WebView is inset below the header. Safe area
12
+ * insets account for the header height.
13
+ *
14
+ * - `fullscreen` — WebView occupies the entire screen. The native close button
15
+ * and options menu remain as floating overlays so the user can always exit.
16
+ * The miniapp must respect safe area insets for system UI (status bar, notch,
17
+ * home indicator).
18
+ *
19
+ * - `immersive` — WebView occupies the entire screen with zero native UI.
20
+ * No close button, no options menu, no header — the miniapp owns the full
21
+ * viewport. The miniapp is responsible for providing its own exit mechanism
22
+ * (e.g. calling `app:close`). Safe area insets still apply for system UI.
23
+ */
24
+ const DISPLAY_MODES = [
25
+ "standard",
26
+ "fullscreen",
27
+ "immersive"
28
+ ];
7
29
 
8
30
  //#endregion
9
31
  //#region src/methods/versions/releases.ts
@@ -115,6 +137,7 @@ const WALLET_ERROR = {
115
137
  };
116
138
 
117
139
  //#endregion
140
+ exports.DISPLAY_MODES = DISPLAY_MODES;
118
141
  exports.PLATFORMS = PLATFORMS;
119
142
  exports.WALLET_ERROR = WALLET_ERROR;
120
143
  exports.getMethodMinVersion = getMethodMinVersion;
package/dist/index.d.cts CHANGED
@@ -320,6 +320,28 @@ declare const PLATFORMS: readonly ["ios", "android"];
320
320
  * Platform the miniapp is running on.
321
321
  */
322
322
  type Platform = (typeof PLATFORMS)[number];
323
+ /**
324
+ * Supported display modes for miniapps.
325
+ *
326
+ * - `standard` — Default. Native header with close button, options menu, and
327
+ * miniapp title is visible. WebView is inset below the header. Safe area
328
+ * insets account for the header height.
329
+ *
330
+ * - `fullscreen` — WebView occupies the entire screen. The native close button
331
+ * and options menu remain as floating overlays so the user can always exit.
332
+ * The miniapp must respect safe area insets for system UI (status bar, notch,
333
+ * home indicator).
334
+ *
335
+ * - `immersive` — WebView occupies the entire screen with zero native UI.
336
+ * No close button, no options menu, no header — the miniapp owns the full
337
+ * viewport. The miniapp is responsible for providing its own exit mechanism
338
+ * (e.g. calling `app:close`). Safe area insets still apply for system UI.
339
+ */
340
+ declare const DISPLAY_MODES: readonly ["standard", "fullscreen", "immersive"];
341
+ /**
342
+ * Display mode for the miniapp webview.
343
+ */
344
+ type DisplayMode = (typeof DISPLAY_MODES)[number];
323
345
  /**
324
346
  * Safe area insets in CSS pixels, injected by the host app.
325
347
  * Accounts for system UI (status bar, notch, home indicator, nav bar).
@@ -350,10 +372,11 @@ interface LaunchParams {
350
372
  */
351
373
  startParam: string | undefined;
352
374
  /**
353
- * Whether the miniapp was launched in fullscreen mode.
375
+ * Display mode for the miniapp webview.
376
+ * Defaults to `'standard'` when not provided by the host app.
354
377
  * @since 1.0.0
355
378
  */
356
- isFullscreen: boolean | undefined;
379
+ displayMode: DisplayMode;
357
380
  }
358
381
  //#endregion
359
382
  //#region src/methods/types/payload.d.ts
@@ -717,4 +740,4 @@ declare function isMethodSupported(method: MethodName, version: Version): boolea
717
740
  */
718
741
  declare function getMethodMinVersion(method: MethodName): Version | undefined;
719
742
  //#endregion
720
- export { type CreateEventPayload, type CreateMethodPayload, type EventName, type EventPayload, type Events, type HapticImpactStyle, type HapticNotificationType, type LaunchParams, type MethodName, type MethodNameWithVersionedPayload, type MethodPayload, type MethodVersionedPayload, type Methods, PLATFORMS, type PaymentErrorCode, type PaymentTestScenario, type PaymentWebhookStatus, type Platform, type SafeAreaInsets, type SolanaChain, type SolanaCommitment, type Version, WALLET_ERROR, type WalletSolanaErrorCode, getMethodMinVersion, getReleaseVersion, isMethodSupported, releases };
743
+ export { type CreateEventPayload, type CreateMethodPayload, DISPLAY_MODES, type DisplayMode, type EventName, type EventPayload, type Events, type HapticImpactStyle, type HapticNotificationType, type LaunchParams, type MethodName, type MethodNameWithVersionedPayload, type MethodPayload, type MethodVersionedPayload, type Methods, PLATFORMS, type PaymentErrorCode, type PaymentTestScenario, type PaymentWebhookStatus, type Platform, type SafeAreaInsets, type SolanaChain, type SolanaCommitment, type Version, WALLET_ERROR, type WalletSolanaErrorCode, getMethodMinVersion, getReleaseVersion, isMethodSupported, releases };
package/dist/index.d.mts CHANGED
@@ -320,6 +320,28 @@ declare const PLATFORMS: readonly ["ios", "android"];
320
320
  * Platform the miniapp is running on.
321
321
  */
322
322
  type Platform = (typeof PLATFORMS)[number];
323
+ /**
324
+ * Supported display modes for miniapps.
325
+ *
326
+ * - `standard` — Default. Native header with close button, options menu, and
327
+ * miniapp title is visible. WebView is inset below the header. Safe area
328
+ * insets account for the header height.
329
+ *
330
+ * - `fullscreen` — WebView occupies the entire screen. The native close button
331
+ * and options menu remain as floating overlays so the user can always exit.
332
+ * The miniapp must respect safe area insets for system UI (status bar, notch,
333
+ * home indicator).
334
+ *
335
+ * - `immersive` — WebView occupies the entire screen with zero native UI.
336
+ * No close button, no options menu, no header — the miniapp owns the full
337
+ * viewport. The miniapp is responsible for providing its own exit mechanism
338
+ * (e.g. calling `app:close`). Safe area insets still apply for system UI.
339
+ */
340
+ declare const DISPLAY_MODES: readonly ["standard", "fullscreen", "immersive"];
341
+ /**
342
+ * Display mode for the miniapp webview.
343
+ */
344
+ type DisplayMode = (typeof DISPLAY_MODES)[number];
323
345
  /**
324
346
  * Safe area insets in CSS pixels, injected by the host app.
325
347
  * Accounts for system UI (status bar, notch, home indicator, nav bar).
@@ -350,10 +372,11 @@ interface LaunchParams {
350
372
  */
351
373
  startParam: string | undefined;
352
374
  /**
353
- * Whether the miniapp was launched in fullscreen mode.
375
+ * Display mode for the miniapp webview.
376
+ * Defaults to `'standard'` when not provided by the host app.
354
377
  * @since 1.0.0
355
378
  */
356
- isFullscreen: boolean | undefined;
379
+ displayMode: DisplayMode;
357
380
  }
358
381
  //#endregion
359
382
  //#region src/methods/types/payload.d.ts
@@ -717,4 +740,4 @@ declare function isMethodSupported(method: MethodName, version: Version): boolea
717
740
  */
718
741
  declare function getMethodMinVersion(method: MethodName): Version | undefined;
719
742
  //#endregion
720
- export { type CreateEventPayload, type CreateMethodPayload, type EventName, type EventPayload, type Events, type HapticImpactStyle, type HapticNotificationType, type LaunchParams, type MethodName, type MethodNameWithVersionedPayload, type MethodPayload, type MethodVersionedPayload, type Methods, PLATFORMS, type PaymentErrorCode, type PaymentTestScenario, type PaymentWebhookStatus, type Platform, type SafeAreaInsets, type SolanaChain, type SolanaCommitment, type Version, WALLET_ERROR, type WalletSolanaErrorCode, getMethodMinVersion, getReleaseVersion, isMethodSupported, releases };
743
+ export { type CreateEventPayload, type CreateMethodPayload, DISPLAY_MODES, type DisplayMode, type EventName, type EventPayload, type Events, type HapticImpactStyle, type HapticNotificationType, type LaunchParams, type MethodName, type MethodNameWithVersionedPayload, type MethodPayload, type MethodVersionedPayload, type Methods, PLATFORMS, type PaymentErrorCode, type PaymentTestScenario, type PaymentWebhookStatus, type Platform, type SafeAreaInsets, type SolanaChain, type SolanaCommitment, type Version, WALLET_ERROR, type WalletSolanaErrorCode, getMethodMinVersion, getReleaseVersion, isMethodSupported, releases };
package/dist/index.mjs CHANGED
@@ -3,6 +3,28 @@
3
3
  * Supported platforms for miniapps.
4
4
  */
5
5
  const PLATFORMS = ["ios", "android"];
6
+ /**
7
+ * Supported display modes for miniapps.
8
+ *
9
+ * - `standard` — Default. Native header with close button, options menu, and
10
+ * miniapp title is visible. WebView is inset below the header. Safe area
11
+ * insets account for the header height.
12
+ *
13
+ * - `fullscreen` — WebView occupies the entire screen. The native close button
14
+ * and options menu remain as floating overlays so the user can always exit.
15
+ * The miniapp must respect safe area insets for system UI (status bar, notch,
16
+ * home indicator).
17
+ *
18
+ * - `immersive` — WebView occupies the entire screen with zero native UI.
19
+ * No close button, no options menu, no header — the miniapp owns the full
20
+ * viewport. The miniapp is responsible for providing its own exit mechanism
21
+ * (e.g. calling `app:close`). Safe area insets still apply for system UI.
22
+ */
23
+ const DISPLAY_MODES = [
24
+ "standard",
25
+ "fullscreen",
26
+ "immersive"
27
+ ];
6
28
 
7
29
  //#endregion
8
30
  //#region src/methods/versions/releases.ts
@@ -114,4 +136,4 @@ const WALLET_ERROR = {
114
136
  };
115
137
 
116
138
  //#endregion
117
- export { PLATFORMS, WALLET_ERROR, getMethodMinVersion, getReleaseVersion, isMethodSupported, releases };
139
+ export { DISPLAY_MODES, PLATFORMS, WALLET_ERROR, getMethodMinVersion, getReleaseVersion, isMethodSupported, releases };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alien_org/contract",
3
- "version": "1.0.0-alpha.2",
3
+ "version": "1.0.0-alpha.4",
4
4
  "type": "module",
5
5
  "main": "./dist/index.cjs",
6
6
  "module": "./dist/index.mjs",