@grabjs/superapp-sdk 2.0.0-beta.28 → 2.0.0-beta.31

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/skills/SKILL.md CHANGED
@@ -8,19 +8,68 @@ license: 'MIT'
8
8
 
9
9
  Use this SDK to call native Grab SuperApp features from a MiniApp running in the WebView. Each module covers one domain (camera, payments, location, etc.) and communicates with the native layer via JSBridge.
10
10
 
11
+ ## Setup
12
+
13
+ ### Installation
14
+
15
+ #### NPM
16
+
17
+ ```bash
18
+ npm install @grabjs/superapp-sdk
19
+ ```
20
+
21
+ #### Yarn
22
+
23
+ ```bash
24
+ yarn add @grabjs/superapp-sdk
25
+ ```
26
+
27
+ ### Importing
28
+
29
+ #### ES Modules (recommended)
30
+
31
+ Import only the modules you need:
32
+
33
+ ```typescript
34
+ import { ContainerModule, ScopeModule } from '@grabjs/superapp-sdk';
35
+ ```
36
+
37
+ Type guards and response types are also available as named exports:
38
+
39
+ ```typescript
40
+ import { isSuccess, isError } from '@grabjs/superapp-sdk';
41
+ ```
42
+
43
+ #### CDN (UMD Bundle)
44
+
45
+ If you are not using a bundler, load the SDK from a CDN and access it via the `SuperAppSDK` global:
46
+
47
+ ```html
48
+ <script src="https://cdn.jsdelivr.net/npm/@grabjs/superapp-sdk/dist/index.js"></script>
49
+ <script>
50
+ const { ContainerModule, ScopeModule, isSuccess, isError } = window.SuperAppSDK;
51
+ </script>
52
+ ```
53
+
54
+
11
55
  ## Core Concepts
12
56
 
13
- **Every method returns a bridge response** with an HTTP-style `status_code`. Never use try/catch SDK methods never throw.
57
+ SDK methods communicate with the native Grab SuperApp via JSBridge. They only work when your page is running inside the **Grab SuperApp WebView**. Calling a method outside that environment returns `{ status_code: 501 }`.
58
+
59
+ ### Response Pattern
14
60
 
15
- Use type guards to narrow the response before accessing fields:
61
+ Every SDK method returns a bridge response object with an HTTP-style `status_code`. SDK methods never throw — use type guards instead of try/catch.
16
62
 
17
63
  ```typescript
18
- import { isSuccess, isError } from '@grabjs/superapp-sdk'; // isClientError, isServerError, isRedirection also available
64
+ import { CameraModule, isSuccess, isError } from '@grabjs/superapp-sdk';
65
+
66
+ const camera = new CameraModule();
67
+ const response = await camera.scanQRCode({ title: 'Scan Payment QR' });
19
68
 
20
69
  if (isSuccess(response)) {
21
70
  switch (response.status_code) {
22
71
  case 200:
23
- console.log(response.result);
72
+ console.log('QR Code scanned:', response.result.qrCode);
24
73
  break;
25
74
  case 204:
26
75
  // operation completed with no content
@@ -38,34 +87,75 @@ if (isSuccess(response)) {
38
87
  }
39
88
  ```
40
89
 
41
- **Status codes**:
90
+ ### Status Codes
91
+
92
+ The SDK uses HTTP-style status codes for all responses:
93
+
94
+ | Code | Type | Description |
95
+ | ----- | ----------------- | --------------------------------------------------- |
96
+ | `200` | OK | Request successful, `result` contains response data |
97
+ | `204` | No Content | Request successful, no data returned |
98
+ | `302` | Redirect | Redirect in progress |
99
+ | `400` | Bad Request | Invalid request parameters |
100
+ | `401` | Unauthorized | Authentication required |
101
+ | `403` | Forbidden | Insufficient permissions for this operation |
102
+ | `404` | Not Found | Resource not found |
103
+ | `424` | Failed Dependency | Underlying native request failed |
104
+ | `426` | Upgrade Required | Requires newer Grab app version |
105
+ | `500` | Internal Error | Unexpected SDK error |
106
+ | `501` | Not Implemented | Method requires Grab SuperApp environment |
107
+
108
+ ### Type Guards
109
+
110
+ Type guards narrow the response type so TypeScript knows which fields are available:
111
+
112
+ | Guard | Matches |
113
+ | --------------------------------- | ---------------------------------------- |
114
+ | `isSuccess(r)` | `200`, `204` |
115
+ | `isOk(r)` | `200` |
116
+ | `isNoContent(r)` | `204` |
117
+ | `isRedirection(r)` / `isFound(r)` | `302` |
118
+ | `isClientError(r)` | `400`, `401`, `403`, `404`, `424`, `426` |
119
+ | `isServerError(r)` | `500`, `501` |
120
+ | `isError(r)` | any 4xx or 5xx |
42
121
 
43
- - `400` — invalid request parameters; check inputs before assuming a server error
44
- - `403` permission denied; call `IdentityModule.authorize()` for the required scope, then `ScopeModule.reloadScopes()` before retrying
45
- - `426` — method requires a newer version of the Grab app; advise the user to upgrade
46
- - `501` — running outside the Grab SuperApp WebView
122
+ ```typescript
123
+ import { isSuccess, isOk, isNoContent, isError } from '@grabjs/superapp-sdk';
124
+
125
+ if (isSuccess(response)) {
126
+ // narrow further if needed
127
+ if (isOk(response)) console.log(response.result);
128
+ if (isNoContent(response)) console.log('done, no data');
129
+ }
47
130
 
48
- ## Common Patterns
131
+ if (isError(response)) {
132
+ // response.error: string is guaranteed here
133
+ console.error(response.error);
134
+ }
135
+ ```
49
136
 
50
- **MiniApp initialization**: always call `ScopeModule.reloadScopes()` on launch before making any module calls — scopes are not loaded automatically.
137
+ ### Streams
51
138
 
52
- **Subscribing to a stream** (location updates, media events):
139
+ Some modules provide streaming methods for real-time data (location updates, media events). Subscribe to receive values over time:
53
140
 
54
141
  ```typescript
55
- const subscription = locationModule.observeLocationChange().subscribe({
142
+ import { LocationModule, isSuccess } from '@grabjs/superapp-sdk';
143
+
144
+ const location = new LocationModule();
145
+
146
+ const subscription = location.observeLocationChange().subscribe({
56
147
  next: (response) => {
57
148
  if (isSuccess(response)) console.log(response.result);
58
149
  },
59
150
  complete: () => console.log('Stream ended'),
60
151
  });
61
152
 
62
- // Always unsubscribe when done to conserve battery and resources:
153
+ // Always unsubscribe when done to conserve battery and resources
63
154
  subscription.unsubscribe();
64
155
  ```
65
156
 
66
157
  You can also `await` a stream method directly to get its first value.
67
158
 
68
- **Validating request parameters**: methods that accept a request object return `{ status_code: 400 }` when parameters are invalid.
69
159
 
70
160
  ## Integration Guide
71
161
 
@@ -160,93 +250,47 @@ if (isError(response)) {
160
250
  ```
161
251
 
162
252
 
163
- ## Setup
164
-
165
- ### Installation
166
-
167
- #### NPM
168
-
169
- ```bash
170
- npm install @grabjs/superapp-sdk
171
- ```
172
-
173
- #### Yarn
253
+ ## API Reference
174
254
 
175
- ```bash
176
- yarn add @grabjs/superapp-sdk
177
- ```
178
-
179
- ### Importing
180
-
181
- #### ES Modules (recommended)
182
-
183
- Import only the modules you need:
184
-
185
- ```typescript
186
- import { ContainerModule, ScopeModule } from '@grabjs/superapp-sdk';
187
- ```
255
+ ### Classes
188
256
 
189
- Type guards and response types are also available as named exports:
190
-
191
- ```typescript
192
- import { isSuccess, isError } from '@grabjs/superapp-sdk';
193
- ```
194
-
195
- #### CDN (UMD Bundle)
196
-
197
- If you are not using a bundler, load the SDK from a CDN and access it via the `SuperAppSDK` global:
198
-
199
- ```html
200
- <script src="https://cdn.jsdelivr.net/npm/@grabjs/superapp-sdk/dist/index.js"></script>
201
- <script>
202
- const { ContainerModule, ScopeModule, isSuccess, isError } = window.SuperAppSDK;
203
- </script>
204
- ```
205
-
206
- ### Requirements
207
-
208
- SDK methods communicate with the native Grab SuperApp via JSBridge. They only work when your page is running inside the **Grab SuperApp WebView**. Calling a method outside that environment returns `{ status_code: 501 }`.
209
-
210
-
211
- ## Classes
212
-
213
- ### `CameraModule`
257
+ #### `CameraModule`
214
258
  JSBridge module for accessing the device camera.
215
259
  - `scanQRCode(request: { title?: string }): Promise<{ result: { qrCode: string }; status_code: 200 } | { status_code: 204 } | { error: string; status_code: 400 } | { error: string; status_code: 403 } | { error: string; status_code: 500 } | { error: string; status_code: 501 }>` — Opens the native camera to scan a QR code.
216
260
 
217
- ### `CheckoutModule`
261
+ #### `CheckoutModule`
218
262
  JSBridge module for triggering native payment flows.
219
- - `triggerCheckout(request: Record<string, unknown>): Promise<{ error: string; status_code: 400 } | { error: string; status_code: 500 } | { error: string; status_code: 501 } | { result: { errorCode?: string; errorMessage?: string; status: "success" | "failure" | "pending" | "userInitiatedCancel"; transactionID: string }; status_code: 200 }>` — Triggers the native checkout flow for payment processing.
263
+ - `triggerCheckout(request: Record<string, unknown>): Promise<{ error: string; status_code: 400 } | { error: string; status_code: 500 } | { error: string; status_code: 501 } | { result: { status: "success"; transactionID: string } | { errorCode: string; errorMessage: string; status: "failure"; transactionID: string } | { status: "pending"; transactionID: string } | { status: "userInitiatedCancel" }; status_code: 200 }>` — Triggers the native checkout flow for payment processing.
220
264
 
221
- ### `ContainerModule`
265
+ #### `ContainerModule`
222
266
  JSBridge module for controlling the WebView container.
223
- - `close(): Promise<{ error: string; status_code: 500 } | { error: string; status_code: 501 } | { status_code: 200 }>` — Close the container and return to the previous screen.
224
- - `getSessionParams(): Promise<{ error: string; status_code: 500 } | { error: string; status_code: 501 } | { result: { result: string }; status_code: 200 }>` — Get the session parameters from the container.
225
- - `hideBackButton(): Promise<{ error: string; status_code: 500 } | { error: string; status_code: 501 } | { status_code: 200 }>` — Hide the back button on the container header.
226
- - `hideLoader(): Promise<{ error: string; status_code: 500 } | { error: string; status_code: 501 } | { status_code: 200 }>` — Hide the full-screen loading indicator.
227
- - `hideRefreshButton(): Promise<{ error: string; status_code: 500 } | { error: string; status_code: 501 } | { status_code: 200 }>` — Hide the refresh button on the container header.
267
+ - `close(): Promise<{ status_code: 204 } | { error: string; status_code: 500 } | { error: string; status_code: 501 } | { result: boolean; status_code: 200 }>` — Close the container and return to the previous screen.
268
+ - `getSessionParams(): Promise<{ status_code: 204 } | { error: string; status_code: 500 } | { error: string; status_code: 501 } | { result: string; status_code: 200 }>` — Get the session parameters from the container.
269
+ - `hideBackButton(): Promise<{ status_code: 204 } | { error: string; status_code: 500 } | { error: string; status_code: 501 } | { result: boolean; status_code: 200 }>` — Hide the back button on the container header.
270
+ - `hideLoader(): Promise<{ status_code: 204 } | { error: string; status_code: 500 } | { error: string; status_code: 501 } | { result: boolean; status_code: 200 }>` — Hide the full-screen loading indicator.
271
+ - `hideRefreshButton(): Promise<{ status_code: 204 } | { error: string; status_code: 500 } | { error: string; status_code: 501 } | { result: boolean; status_code: 200 }>` — Hide the refresh button on the container header.
228
272
  - `isConnected(): Promise<{ result: { connected: boolean }; status_code: 200 } | { error: string; status_code: 404 }>` — Check if the web app is connected to the Grab SuperApp via JSBridge.
229
- - `onContentLoaded(): Promise<{ error: string; status_code: 500 } | { error: string; status_code: 501 } | { status_code: 200 }>` — Notify the Grab SuperApp that the page content has loaded.
230
- - `onCtaTap(request: string): Promise<{ error: string; status_code: 500 } | { error: string; status_code: 501 } | { status_code: 200 }>` — Notify the client that the user has tapped a call-to-action (CTA).
231
- - `openExternalLink(request: string): Promise<{ error: string; status_code: 400 } | { error: string; status_code: 500 } | { error: string; status_code: 501 } | { status_code: 200 }>` — Open a link in the external browser.
232
- - `sendAnalyticsEvent(request: { data?: Record<string, unknown>; name: string; state: string }): Promise<{ error: string; status_code: 400 } | { error: string; status_code: 500 } | { error: string; status_code: 501 } | { status_code: 200 }>` — Use this method to track user interactions and page transitions.
233
- - `setBackgroundColor(request: string): Promise<{ status_code: 204 } | { error: string; status_code: 400 } | { error: string; status_code: 500 } | { error: string; status_code: 501 }>` — Set the background color of the container header.
234
- - `setTitle(request: string): Promise<{ error: string; status_code: 400 } | { error: string; status_code: 500 } | { error: string; status_code: 501 } | { status_code: 200 }>` — Set the title of the container header.
235
- - `showBackButton(): Promise<{ error: string; status_code: 500 } | { error: string; status_code: 501 } | { status_code: 200 }>` — Show the back button on the container header.
236
- - `showLoader(): Promise<{ error: string; status_code: 500 } | { error: string; status_code: 501 } | { status_code: 200 }>` — Show the full-screen loading indicator.
237
- - `showRefreshButton(): Promise<{ error: string; status_code: 500 } | { error: string; status_code: 501 } | { status_code: 200 }>` — Show the refresh button on the container header.
238
-
239
- ### `DeviceCapabilityModule`
273
+ - `onContentLoaded(): Promise<{ status_code: 204 } | { error: string; status_code: 500 } | { error: string; status_code: 501 } | { result: boolean; status_code: 200 }>` — Notify the Grab SuperApp that the page content has loaded.
274
+ - `onCtaTap(request: string): Promise<{ error: string; status_code: 500 } | { error: string; status_code: 501 } | { result: boolean; status_code: 200 }>` — Notify the client that the user has tapped a call-to-action (CTA).
275
+ - `openExternalLink(request: string): Promise<{ status_code: 204 } | { error: string; status_code: 400 } | { error: string; status_code: 500 } | { error: string; status_code: 501 } | { result: boolean; status_code: 200 }>` — Open a link in the external browser.
276
+ - `sendAnalyticsEvent(request: { data?: Record<string, unknown>; name: string; state: string }): Promise<{ status_code: 204 } | { error: string; status_code: 400 } | { error: string; status_code: 500 } | { error: string; status_code: 501 } | { result: boolean; status_code: 200 }>` — Use this method to track user interactions and page transitions.
277
+ - `setBackgroundColor(request: string): Promise<{ status_code: 204 } | { error: string; status_code: 400 } | { error: string; status_code: 500 } | { error: string; status_code: 501 } | { result: boolean; status_code: 200 }>` — Set the background color of the container header.
278
+ - `setTitle(request: string): Promise<{ status_code: 204 } | { error: string; status_code: 400 } | { error: string; status_code: 500 } | { error: string; status_code: 501 } | { result: boolean; status_code: 200 }>` — Set the title of the container header.
279
+ - `showBackButton(): Promise<{ status_code: 204 } | { error: string; status_code: 500 } | { error: string; status_code: 501 } | { result: boolean; status_code: 200 }>` — Show the back button on the container header.
280
+ - `showLoader(): Promise<{ status_code: 204 } | { error: string; status_code: 500 } | { error: string; status_code: 501 } | { result: boolean; status_code: 200 }>` — Show the full-screen loading indicator.
281
+ - `showRefreshButton(): Promise<{ status_code: 204 } | { error: string; status_code: 500 } | { error: string; status_code: 501 } | { result: boolean; status_code: 200 }>` — Show the refresh button on the container header.
282
+
283
+ #### `DeviceCapabilityModule`
240
284
  JSBridge module for querying native device capability information.
241
285
  - `isEsimSupported(): Promise<{ error: string; status_code: 500 } | { error: string; status_code: 501 } | { result: boolean; status_code: 200 }>` — Checks whether the current device supports eSIM.
242
286
 
243
- ### `FileModule`
287
+ #### `FileModule`
244
288
  JSBridge module for downloading files to the user's device.
245
289
  - `downloadFile(request: { fileName: string; fileUrl: string }): Promise<{ status_code: 204 } | { error: string; status_code: 400 } | { error: string; status_code: 500 } | { error: string; status_code: 501 }>` — Downloads a file via the native bridge.
246
290
 
247
- ### `IdentityModule`
291
+ #### `IdentityModule`
248
292
  JSBridge module for authenticating users via GrabID.
249
- - `authorize(request: { clientId: string; environment: "staging" | "production"; redirectUri: string; responseMode?: "redirect" | "in_place"; scope: string }): Promise<{ status_code: 204 } | { error: string; status_code: 400 } | { error: string; status_code: 403 } | { error: string; status_code: 500 } | { error: string; status_code: 501 } | { result: { code: string; state: string }; status_code: 200 } | { status_code: 302 } | { error: string; status_code: 401 }>` — Initiates an OAuth2 authorization flow with PKCE (Proof Key for Code Exchange).
293
+ - `authorize(request: { clientId: string; environment: "staging" | "production"; redirectUri: string; responseMode?: "redirect" | "in_place"; scope: string }): Promise<{ status_code: 204 } | { error: string; status_code: 400 } | { error: string; status_code: 403 } | { error: string; status_code: 500 } | { error: string; status_code: 501 } | { result: { code: string; state: string }; status_code: 200 } | { status_code: 302 }>` — Initiates an OAuth2 authorization flow with PKCE (Proof Key for Code Exchange).
250
294
  This method handles both native in-app consent and web-based fallback flows.
251
295
  - `clearAuthorizationArtifacts(): Promise<{ status_code: 204 }>` — Clears all stored PKCE authorization artifacts from local storage.
252
296
  This should be called after a successful token exchange or when you need to
@@ -254,114 +298,110 @@ reset the authorization state (e.g., on error or logout).
254
298
  - `getAuthorizationArtifacts(): Promise<{ status_code: 204 } | { error: string; status_code: 400 } | { result: { codeVerifier: string; nonce: string; redirectUri: string; state: string }; status_code: 200 }>` — Retrieves stored PKCE authorization artifacts from local storage.
255
299
  These artifacts are used to complete the OAuth2 authorization code exchange.
256
300
 
257
- ### `LocaleModule`
301
+ #### `LocaleModule`
258
302
  JSBridge module for accessing device locale settings.
259
- - `getLanguageLocaleIdentifier(): Promise<{ error: string; status_code: 500 } | { error: string; status_code: 501 } | { result: string; status_code: 200 }>` — Retrieves the current language locale identifier from the device.
303
+ - `getLanguageLocaleIdentifier(): Promise<{ status_code: 204 } | { error: string; status_code: 400 } | { error: string; status_code: 500 } | { error: string; status_code: 501 } | { result: string; status_code: 200 }>` — Retrieves the current language locale identifier from the device.
260
304
 
261
- ### `LocationModule`
305
+ #### `LocationModule`
262
306
  JSBridge module for accessing device location services.
263
307
  - `getCoordinate(): Promise<{ error: string; status_code: 403 } | { error: string; status_code: 500 } | { error: string; status_code: 501 } | { result: { lat: number; lng: number }; status_code: 200 } | { error: string; status_code: 424 }>` — Get the current geographic coordinates of the device.
264
- - `getCountryCode(): Promise<{ error: string; status_code: 403 } | { error: string; status_code: 500 } | { error: string; status_code: 501 } | { error: string; status_code: 424 } | { result: { countryCode: string }; status_code: 200 }>` — Get the country code based on the device's current location.
308
+ - `getCountryCode(): Promise<{ status_code: 204 } | { error: string; status_code: 403 } | { error: string; status_code: 500 } | { error: string; status_code: 501 } | { result: string; status_code: 200 } | { error: string; status_code: 424 }>` — Get the country code based on the device's current location.
265
309
  - `observeLocationChange(): ObserveLocationChangeResponse` — Subscribe to location change updates from the device.
266
310
 
267
- ### `MediaModule`
311
+ #### `Logger`
312
+ Provides scoped logging for SDK modules.
313
+
314
+ #### `MediaModule`
268
315
  JSBridge module for playing DRM-protected media content.
269
316
  - `observePlayDRMContent(data: DRMContentConfig): ObserveDRMPlaybackResponse` — Observes DRM-protected media content playback events.
270
- - `playDRMContent(data: DRMContentConfig): Promise<{ status_code: 204 } | { error: string; status_code: 500 } | { error: string; status_code: 501 } | { status_code: 200 }>` — Plays DRM-protected media content in the native media player.
317
+ - `playDRMContent(data: DRMContentConfig): Promise<{ status_code: 204 } | { error: string; status_code: 400 } | { error: string; status_code: 500 } | { error: string; status_code: 501 } | { error: string; status_code: 424 } | { result: { length: number; position: number; titleId: string; type: "START_PLAYBACK" | "PROGRESS_PLAYBACK" | "START_SEEK" | "STOP_SEEK" | "STOP_PLAYBACK" | "CLOSE_PLAYBACK" | "PAUSE_PLAYBACK" | "RESUME_PLAYBACK" | "FAST_FORWARD_PLAYBACK" | "REWIND_PLAYBACK" | "ERROR_PLAYBACK" | "CHANGE_VOLUME" }; status_code: 200 }>` — Plays DRM-protected media content in the native media player.
271
318
 
272
- ### `PlatformModule`
319
+ #### `PlatformModule`
273
320
  JSBridge module for controlling platform navigation.
274
321
  - `back(): Promise<{ status_code: 204 } | { error: string; status_code: 500 } | { error: string; status_code: 501 }>` — Triggers the native platform back navigation.
275
322
  This navigates back in the native navigation stack.
276
323
 
277
- ### `ProfileModule`
324
+ #### `ProfileModule`
278
325
  JSBridge module for accessing user profile information.
279
- - `fetchEmail(): Promise<{ error: string; status_code: 400 } | { error: string; status_code: 403 } | { error: string; status_code: 500 } | { error: string; status_code: 501 } | { result: { email: string }; status_code: 200 } | { error: string; status_code: 426 }>` — Fetches the user's email address from their Grab profile.
280
- - `verifyEmail(request: { email: string; otp: string }): Promise<{ error: string; status_code: 400 } | { error: string; status_code: 403 } | { error: string; status_code: 500 } | { error: string; status_code: 501 } | { status_code: 200 } | { error: string; status_code: 426 }>` — Verifies the user's email address using a one-time password (OTP).
326
+ - `fetchEmail(): Promise<{ status_code: 204 } | { error: string; status_code: 400 } | { error: string; status_code: 403 } | { error: string; status_code: 500 } | { error: string; status_code: 501 } | { result: { email: string }; status_code: 200 } | { error: string; status_code: 426 }>` — Fetches the user's email address from their Grab profile.
327
+ - `verifyEmail(request?: { email?: string; skipUserInput?: boolean }): Promise<{ status_code: 204 } | { error: string; status_code: 400 } | { error: string; status_code: 403 } | { error: string; status_code: 500 } | { error: string; status_code: 501 } | { error: string; status_code: 426 } | { result: { email: string }; status_code: 200 }>` — Verifies the user's email address by triggering email capture bottom sheet and OTP verification.
281
328
 
282
- ### `ScopeModule`
329
+ #### `ScopeModule`
283
330
  JSBridge module for checking and refreshing API access permissions.
284
331
  - `hasAccessTo(module: string, method: string): Promise<{ error: string; status_code: 400 } | { error: string; status_code: 500 } | { error: string; status_code: 501 } | { error: string; status_code: 424 } | { result: { hasAccess: boolean }; status_code: 200 }>` — Checks if the current client has access to a specific JSBridge API method.
285
- - `reloadScopes(): Promise<{ error: string; status_code: 500 } | { error: string; status_code: 501 } | { status_code: 200 } | { error: string; status_code: 424 }>` — Requests to reload the consented OAuth scopes for the current client.
332
+ - `reloadScopes(): Promise<{ status_code: 204 } | { error: string; status_code: 500 } | { error: string; status_code: 501 } | { error: string; status_code: 424 }>` — Requests to reload the consented OAuth scopes for the current client.
286
333
  This refreshes the permissions from the server.
287
334
 
288
- ### `SplashScreenModule`
335
+ #### `SplashScreenModule`
289
336
  JSBridge module for controlling the native splash / Lottie loading screen.
290
337
  - `dismiss(): Promise<{ status_code: 204 } | { error: string; status_code: 400 } | { error: string; status_code: 403 } | { error: string; status_code: 500 } | { error: string; status_code: 501 }>` — Dismisses the native splash (Lottie) loading view if it is presented.
291
338
 
292
- ### `StorageModule`
339
+ #### `StorageModule`
293
340
  JSBridge module for persisting key-value data to native storage.
294
- - `getBoolean(key: string): Promise<{ error: string; status_code: 400 } | { error: string; status_code: 500 } | { error: string; status_code: 501 } | { result: { value: boolean | null }; status_code: 200 }>` — Retrieves a boolean value from the native storage.
295
- - `getDouble(key: string): Promise<{ error: string; status_code: 400 } | { error: string; status_code: 500 } | { error: string; status_code: 501 } | { result: { value: number | null }; status_code: 200 }>` — Retrieves a double (floating point) value from the native storage.
296
- - `getInt(key: string): Promise<{ error: string; status_code: 400 } | { error: string; status_code: 500 } | { error: string; status_code: 501 } | { result: { value: number | null }; status_code: 200 }>` — Retrieves an integer value from the native storage.
297
- - `getString(key: string): Promise<{ error: string; status_code: 400 } | { error: string; status_code: 500 } | { error: string; status_code: 501 } | { result: { value: string | null }; status_code: 200 }>` — Retrieves a string value from the native storage.
298
- - `remove(key: string): Promise<{ status_code: 204 } | { error: string; status_code: 400 } | { error: string; status_code: 500 } | { error: string; status_code: 501 }>` — Removes a single value from the native storage by key.
299
- - `removeAll(): Promise<{ status_code: 204 } | { error: string; status_code: 500 } | { error: string; status_code: 501 }>` — Removes all values from the native storage.
300
- - `setBoolean(key: string, value: boolean): Promise<{ status_code: 204 } | { error: string; status_code: 400 } | { error: string; status_code: 500 } | { error: string; status_code: 501 }>` — Stores a boolean value in the native storage.
301
- - `setDouble(key: string, value: number): Promise<{ status_code: 204 } | { error: string; status_code: 400 } | { error: string; status_code: 500 } | { error: string; status_code: 501 }>` — Stores a double (floating point) value in the native storage.
302
- - `setInt(key: string, value: number): Promise<{ status_code: 204 } | { error: string; status_code: 400 } | { error: string; status_code: 500 } | { error: string; status_code: 501 }>` — Stores an integer value in the native storage.
303
- - `setString(key: string, value: string): Promise<{ status_code: 204 } | { error: string; status_code: 400 } | { error: string; status_code: 500 } | { error: string; status_code: 501 }>` — Stores a string value in the native storage.
304
-
305
- ### `SystemWebViewKitModule`
341
+ - `getBoolean(key: string): Promise<{ error: string; status_code: 400 } | { error: string; status_code: 500 } | { error: string; status_code: 501 } | { error: string; status_code: 424 } | { result: { value: boolean | null }; status_code: 200 }>` — Retrieves a boolean value from the native storage.
342
+ - `getDouble(key: string): Promise<{ error: string; status_code: 400 } | { error: string; status_code: 500 } | { error: string; status_code: 501 } | { error: string; status_code: 424 } | { result: { value: number | null }; status_code: 200 }>` — Retrieves a double (floating point) value from the native storage.
343
+ - `getInt(key: string): Promise<{ error: string; status_code: 400 } | { error: string; status_code: 500 } | { error: string; status_code: 501 } | { error: string; status_code: 424 } | { result: { value: number | null }; status_code: 200 }>` — Retrieves an integer value from the native storage.
344
+ - `getString(key: string): Promise<{ error: string; status_code: 400 } | { error: string; status_code: 500 } | { error: string; status_code: 501 } | { error: string; status_code: 424 } | { result: { value: string | null }; status_code: 200 }>` — Retrieves a string value from the native storage.
345
+ - `remove(key: string): Promise<{ status_code: 204 } | { error: string; status_code: 400 } | { error: string; status_code: 500 } | { error: string; status_code: 501 } | { error: string; status_code: 424 }>` — Removes a single value from the native storage by key.
346
+ - `removeAll(): Promise<{ status_code: 204 } | { error: string; status_code: 500 } | { error: string; status_code: 501 } | { error: string; status_code: 424 }>` — Removes all values from the native storage.
347
+ - `setBoolean(key: string, value: boolean): Promise<{ status_code: 204 } | { error: string; status_code: 400 } | { error: string; status_code: 500 } | { error: string; status_code: 501 } | { error: string; status_code: 424 }>` — Stores a boolean value in the native storage.
348
+ - `setDouble(key: string, value: number): Promise<{ status_code: 204 } | { error: string; status_code: 400 } | { error: string; status_code: 500 } | { error: string; status_code: 501 } | { error: string; status_code: 424 }>` — Stores a double (floating point) value in the native storage.
349
+ - `setInt(key: string, value: number): Promise<{ status_code: 204 } | { error: string; status_code: 400 } | { error: string; status_code: 500 } | { error: string; status_code: 501 } | { error: string; status_code: 424 }>` — Stores an integer value in the native storage.
350
+ - `setString(key: string, value: string): Promise<{ status_code: 204 } | { error: string; status_code: 400 } | { error: string; status_code: 500 } | { error: string; status_code: 501 } | { error: string; status_code: 424 }>` — Stores a string value in the native storage.
351
+
352
+ #### `SystemWebViewKitModule`
306
353
  JSBridge module for opening URLs in the device's system browser.
307
- - `redirectToSystemWebView(request: { url: string }): Promise<{ error: string; status_code: 400 } | { error: string; status_code: 500 } | { error: string; status_code: 501 } | { status_code: 200 } | { error: string; status_code: 424 }>` — Opens a URL in the device's system web browser or web view.
354
+ - `redirectToSystemWebView(request: { url: string }): Promise<{ error: string; status_code: 400 } | { error: string; status_code: 500 } | { error: string; status_code: 501 } | { result: string; status_code: 200 } | { error: string; status_code: 424 }>` — Opens a URL in the device's system web browser or web view.
308
355
 
309
- ### `UserAttributesModule`
356
+ #### `UserAttributesModule`
310
357
  JSBridge module for reading user-related attributes from native code.
311
358
  - `getSelectedTravelDestination(): Promise<{ status_code: 204 } | { error: string; status_code: 500 } | { error: string; status_code: 501 } | { result: string; status_code: 200 }>` — Returns the currently selected travel destination as a lowercase ISO 3166-1 alpha-2 country code.
312
359
 
313
- ## Functions
360
+ ### Functions
314
361
 
315
- ### `isClientError`
362
+ #### `isClientError`
316
363
  Type guard to check if a JSBridge response is a client error (4xx status codes).
317
364
  ```ts
318
365
  isClientError<T>(response: T): response is Extract<T, { status_code: 400 | 401 | 403 | 404 | 424 | 426 }>
319
366
  ```
320
367
 
321
- ### `isError`
368
+ #### `isError`
322
369
  Type guard to check if a JSBridge response is an error (4xx or 5xx status codes).
323
370
  ```ts
324
371
  isError<T>(response: T): response is Extract<T, { error: string }>
325
372
  ```
326
373
 
327
- ### `isErrorWithMessage`
328
- Type guard to check if an error has a message property.
329
- Use this to safely narrow errors in catch blocks.
330
- ```ts
331
- isErrorWithMessage(error: unknown): error is { message: string }
332
- ```
333
-
334
- ### `isFound`
374
+ #### `isFound`
335
375
  Type guard to check if a JSBridge response is a 302 Found redirect.
336
376
  ```ts
337
377
  isFound<T>(response: T): response is Extract<T, { status_code: 302 }>
338
378
  ```
339
379
 
340
- ### `isNoContent`
380
+ #### `isNoContent`
341
381
  Type guard to check if a JSBridge response is a 204 No Content (operation succeeded with no result).
342
382
  ```ts
343
383
  isNoContent<T>(response: T): response is Extract<T, { status_code: 204 }>
344
384
  ```
345
385
 
346
- ### `isOk`
386
+ #### `isOk`
347
387
  Type guard to check if a JSBridge response is a 200 OK (operation succeeded with a result).
348
388
  ```ts
349
389
  isOk<T>(response: T): response is Extract<T, { status_code: 200 }>
350
390
  ```
351
391
 
352
- ### `isRedirection`
392
+ #### `isRedirection`
353
393
  Type guard to check if a JSBridge response is a redirect (status code 302).
354
394
  ```ts
355
395
  isRedirection<T>(response: T): response is Extract<T, { status_code: 302 }>
356
396
  ```
357
397
 
358
- ### `isServerError`
398
+ #### `isServerError`
359
399
  Type guard to check if a JSBridge response is a server error (5xx status codes).
360
400
  ```ts
361
401
  isServerError<T>(response: T): response is Extract<T, { status_code: 500 | 501 }>
362
402
  ```
363
403
 
364
- ### `isSuccess`
404
+ #### `isSuccess`
365
405
  Type guard to check if a JSBridge response is successful (status codes 200 or 204).
366
406
  ```ts
367
407
  isSuccess<T>(response: T): response is Extract<T, { status_code: 200 | 204 }>