@grabjs/superapp-sdk 2.0.0-beta.53 → 2.0.0-beta.54

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.ts CHANGED
@@ -191,29 +191,29 @@ export declare const BackResponseSchema: v.UnionSchema<[v.ObjectSchema<{
191
191
  export declare type BackResult = void;
192
192
 
193
193
  /**
194
- * Base class for all JSBridge modules.
194
+ * Base class for all modules.
195
195
  *
196
196
  * @group Core
197
197
  *
198
198
  * @remarks
199
- * On construction, the class wraps the JSBridge module on `window` (e.g., `WrappedContainerModule`).
199
+ * On construction, the class wraps the module on `window` (e.g., `WrappedContainerModule`).
200
200
  * This code must run on the Grab SuperApp's webview to function correctly.
201
201
  *
202
202
  * @public
203
203
  */
204
204
  export declare class BaseModule {
205
205
  /**
206
- * The module name used to identify the JSBridge module.
206
+ * The module name.
207
207
  */
208
208
  private readonly name;
209
209
  /**
210
- * Logger scoped to this module (e.g. `[SuperAppSDK][ContainerModule.setTitle] ...`).
210
+ * Logger scoped to this module.
211
211
  *
212
212
  * @protected
213
213
  */
214
214
  protected readonly logger: Logger;
215
215
  /**
216
- * Returns the wrapped JSBridge module from the global `window` object.
216
+ * Returns the wrapped module from the global `window` object.
217
217
  *
218
218
  * @returns The wrapped module instance with native method bindings.
219
219
  *
@@ -224,7 +224,7 @@ export declare class BaseModule {
224
224
  * Creates a new module instance and wraps it on the global `window` object.
225
225
  *
226
226
  * @param moduleName - The name of the module (e.g., "ContainerModule", "ProfileModule").
227
- * @throws Error when the bridge SDK fails to wrap the module.
227
+ * @throws Error when the module fails to initialize.
228
228
  */
229
229
  constructor(moduleName: string);
230
230
  /**
@@ -241,10 +241,9 @@ export declare class BaseModule {
241
241
  * Checks whether the current app version supports this method.
242
242
  *
243
243
  * @remarks
244
- * Returns 501 if not running in the Grab app, 426 if the version check fails,
245
- * or `null` if the method is supported.
244
+ * Returns `501` status code if not running in the Grab app, `426` status code if the version check fails. Otherwise, returns `null`.
246
245
  *
247
- * @param isSupported - A function receiving the detected app info, returning true if supported.
246
+ * @param isSupported - A function receiving the detected app info, returning `true` if supported.
248
247
  * @returns An error response, or `null` if supported.
249
248
  *
250
249
  * @protected
@@ -257,116 +256,44 @@ export declare class BaseModule {
257
256
  error: string;
258
257
  } | null;
259
258
  /**
260
- * Invokes a JSBridge method.
259
+ * Invokes a method.
261
260
  *
262
261
  * @remarks
263
- * - Always checks if running in Grab app (returns 501 if not).
262
+ * - Always checks if running in Grab app (returns `501` status code if not).
264
263
  * - All errors are reported via the `status_code` field; this method never rejects.
265
- * - For streaming methods, use `invokeStream` instead.
266
264
  *
267
265
  * @param options - The invoke options including method name and params.
268
- * @returns A promise resolving to the JSBridge response.
266
+ * @returns A promise resolving to the SDK response.
269
267
  *
270
268
  * @protected
271
269
  */
272
- protected invoke(options: InvokeOptions): Promise<BridgeResponse>;
270
+ protected invoke(options: ModuleInvokeOptions): Promise<SDKResponse>;
273
271
  /**
274
- * Creates a BridgeStream that immediately emits an error response.
275
- * Used for 501, 426, and 500 error scenarios in invokeStream.
272
+ * Creates a {@link SDKStream} that immediately emits an error response.
276
273
  *
277
- * @returns A BridgeStream that emits the error and immediately completes.
274
+ * @returns A {@link SDKStream} that immediately emits an error response.
278
275
  *
279
276
  * @private
280
277
  */
281
278
  private createErrorStream;
282
279
  /**
283
- * Invokes a JSBridge streaming method that returns a `BridgeStream`.
280
+ * Invokes a streaming method that returns a {@link SDKStream}.
284
281
  *
285
282
  * @remarks
286
- * - Always checks if running in Grab app (returns 501 error response if not).
287
- * - Returns a `BridgeStream` that can be subscribed to or awaited for the first value.
283
+ * - Always checks if running in Grab app (returns `501` status code if not).
284
+ * - Returns a {@link SDKStream} that can be subscribed to or awaited for the first value.
288
285
  * - All errors are reported via error responses in the stream; this method never rejects.
289
286
  *
290
287
  * @param options - The invoke options including method name and params.
291
- * @returns A `BridgeStream` for receiving continuous data from the JSBridge.
288
+ * @returns A {@link SDKStream} for receiving continuous data.
292
289
  *
293
290
  * @protected
294
291
  */
295
- protected invokeStream(options: InvokeOptions): BridgeStream;
292
+ protected invokeStream(options: ModuleInvokeOptions): SDKStream;
296
293
  }
297
294
 
298
295
  /**
299
- * Base response type for all JSBridge calls.
300
- *
301
- * @group Core
302
- *
303
- * @remarks
304
- * Every response has a numeric `status_code`. Success responses (200) carry `result`;
305
- * error responses (4xx/5xx) carry `error`. Use the type guards ({@link isSuccess},
306
- * {@link isError}, etc.) to narrow to a specific shape.
307
- *
308
- * Per-module response types (e.g., `ScanQRCodeResponse`) are derived from their valibot
309
- * schemas via `v.InferOutput` and form proper discriminated unions — enabling precise
310
- * TypeScript narrowing while this base type serves as the internal contract.
311
- *
312
- * @public
313
- */
314
- export declare type BridgeResponse = {
315
- /** HTTP-style status code indicating the outcome of the JSBridge method call */
316
- status_code: number;
317
- /** The result data from the JSBridge method, present on 200 responses */
318
- result?: unknown;
319
- /** Error message, present on 4xx/5xx responses */
320
- error?: string;
321
- };
322
-
323
- /**
324
- * A stream for receiving continuous data from JSBridge methods (e.g., location updates).
325
- *
326
- * @group Core
327
- *
328
- * @remarks
329
- * Provides both Observable-like and Promise-like interfaces:
330
- * - Use `subscribe()` to receive all values over time
331
- * - Use `then()` or `await` to receive only the first value
332
- *
333
- * Note: Each `subscribe()` call creates a fresh subscription, allowing multiple independent listeners.
334
- *
335
- * @typeParam T - The response type emitted by the stream.
336
- *
337
- * @public
338
- */
339
- export declare type BridgeStream<T extends BridgeResponse = BridgeResponse> = Readonly<{
340
- /**
341
- * Subscribe to receive stream data.
342
- *
343
- * @param handlers - Optional callbacks for data (`next`) and completion (`complete`).
344
- * @returns A `Subscription` to terminate the stream when needed.
345
- */
346
- subscribe: (handlers?: BridgeStreamHandlers<T>) => Subscription;
347
- }> & PromiseLike<T>;
348
-
349
- /**
350
- * Callbacks for handling stream events.
351
- *
352
- * @group Core
353
- *
354
- * @remarks
355
- * Pass these to `subscribe()` to receive data via `next` and completion via `complete`.
356
- *
357
- * @typeParam T - The response type emitted by the stream.
358
- *
359
- * @public
360
- */
361
- export declare type BridgeStreamHandlers<T extends BridgeResponse = BridgeResponse> = Readonly<{
362
- /** Called with each new value from the stream. */
363
- next?: (data: T) => unknown;
364
- /** Called when the stream ends and no more data will arrive. */
365
- complete?: () => unknown;
366
- }>;
367
-
368
- /**
369
- * JSBridge module for accessing the device camera.
296
+ * SDK module for accessing the device camera via `JSBridge`.
370
297
  *
371
298
  * @group Modules
372
299
  * @category Camera
@@ -411,7 +338,7 @@ export declare class CameraModule extends BaseModule {
411
338
  * // Initialize the camera module
412
339
  * const camera = new CameraModule();
413
340
  *
414
- * // Scan the QR code
341
+ * // Scan a QR code
415
342
  * const response = await camera.scanQRCode({ title: 'Scan Payment QR' });
416
343
  *
417
344
  * // Handle the response
@@ -443,7 +370,7 @@ export declare class CameraModule extends BaseModule {
443
370
  }
444
371
 
445
372
  /**
446
- * JSBridge module for triggering native payment flows.
373
+ * SDK module for triggering native payment flows via `JSBridge`.
447
374
  *
448
375
  * @group Modules
449
376
  * @category Checkout
@@ -542,7 +469,7 @@ export declare class CheckoutModule extends BaseModule {
542
469
  * @category Identity
543
470
  *
544
471
  * @remarks
545
- * This response returns status code `204` when artifacts are successfully cleared.
472
+ * This response returns status code `204` when artifacts are cleared successfully.
546
473
  *
547
474
  * @public
548
475
  */
@@ -658,7 +585,7 @@ export declare const ContainerAnalyticsEventState: {
658
585
  };
659
586
 
660
587
  /**
661
- * JSBridge module for controlling the WebView container.
588
+ * SDK module for controlling the WebView container via `JSBridge`.
662
589
  *
663
590
  * @group Modules
664
591
  * @category Container
@@ -1103,7 +1030,7 @@ export declare class ContainerModule extends BaseModule {
1103
1030
  */
1104
1031
  sendAnalyticsEvent(request: SendAnalyticsEventRequest): Promise<SendAnalyticsEventResponse>;
1105
1032
  /**
1106
- * Check if the web app is connected to the Grab SuperApp via JSBridge.
1033
+ * Check if the web app is connected to the Grab SuperApp via `JSBridge`.
1107
1034
  *
1108
1035
  * @remarks
1109
1036
  * Call this method to verify the connection status before using other features.
@@ -1176,7 +1103,7 @@ export declare class ContainerModule extends BaseModule {
1176
1103
  }
1177
1104
 
1178
1105
  /**
1179
- * JSBridge module for querying native device information.
1106
+ * SDK module for querying native device information via `JSBridge`.
1180
1107
  *
1181
1108
  * @group Modules
1182
1109
  * @category Device
@@ -1264,7 +1191,7 @@ export declare class DeviceModule extends BaseModule {
1264
1191
  * - `204`: No splash screen shown, or it was closed successfully.
1265
1192
  * - `400`: Invalid input (Grablet / client validation error).
1266
1193
  * - `403`: Missing consent for the required OAuth scope.
1267
- * - `500`: Unexpected error while invoking the native bridge.
1194
+ * - `500`: Unexpected error while invoking `JSBridge`.
1268
1195
  * - `501`: Not in the Grab app WebView environment.
1269
1196
  *
1270
1197
  * @example
@@ -1320,7 +1247,7 @@ export declare const DismissSplashScreenResponseSchema: v.UnionSchema<[v.ObjectS
1320
1247
  }, undefined>], undefined>;
1321
1248
 
1322
1249
  /**
1323
- * Request parameters for downloading a file via native bridge.
1250
+ * Request parameters for downloading a file through `JSBridge`.
1324
1251
  *
1325
1252
  * @group Modules
1326
1253
  * @category File
@@ -1395,7 +1322,7 @@ export declare const DownloadFileResponseSchema: v.UnionSchema<[v.ObjectSchema<{
1395
1322
  * @category File
1396
1323
  *
1397
1324
  * @remarks
1398
- * This is a void result type as successful downloads return status code 204 with no content.
1325
+ * This is a void result type as successful downloads return status code `204` with no content.
1399
1326
  *
1400
1327
  * @public
1401
1328
  */
@@ -1575,7 +1502,7 @@ export declare const FetchEmailResultSchema: v.ObjectSchema<{
1575
1502
  }, undefined>;
1576
1503
 
1577
1504
  /**
1578
- * JSBridge module for downloading files to the user's device.
1505
+ * SDK module for downloading files to the user's device via `JSBridge`.
1579
1506
  *
1580
1507
  * @group Modules
1581
1508
  * @category File
@@ -1606,7 +1533,7 @@ export declare const FetchEmailResultSchema: v.ObjectSchema<{
1606
1533
  export declare class FileModule extends BaseModule {
1607
1534
  constructor();
1608
1535
  /**
1609
- * Downloads a file via the native bridge.
1536
+ * Downloads a file through `JSBridge`.
1610
1537
  *
1611
1538
  * @param request - File information, including URL and target file name. See {@link DownloadFileRequest}.
1612
1539
  *
@@ -1939,7 +1866,7 @@ export declare const GetCountryCodeResponseSchema: v.UnionSchema<[v.ObjectSchema
1939
1866
  }, undefined>], undefined>;
1940
1867
 
1941
1868
  /**
1942
- * The ISO country code string returned from the native bridge.
1869
+ * The ISO country code string returned from `JSBridge`.
1943
1870
  *
1944
1871
  * @group Modules
1945
1872
  * @category Location
@@ -2612,25 +2539,25 @@ export declare type HasAccessToResult = InferOutput<typeof HasAccessToResultSche
2612
2539
  export declare const HasAccessToResultSchema: v.BooleanSchema<undefined>;
2613
2540
 
2614
2541
  /**
2615
- * Type guard to check if a JSBridge response has a defined result (not null or undefined).
2542
+ * Type guard to check if an SDK response has a `result` that is neither `null` nor `undefined`.
2616
2543
  *
2617
2544
  * @group Type Guards
2618
2545
  *
2619
- * @param response - The JSBridge response to check
2620
- * @returns True if the response has a result that is neither null nor undefined, false otherwise
2546
+ * @param response - The SDK response to check
2547
+ * @returns `true` if the response has a `result` that is neither `null` nor `undefined`, `false` otherwise
2621
2548
  *
2622
2549
  * @example
2623
2550
  * ```typescript
2624
2551
  * const response = await someBridgeMethod();
2625
- * if (isSuccess(response) && hasResult(response)) {
2626
- * // response.result is guaranteed to be defined
2552
+ * if (isOk(response) && hasResult(response)) {
2553
+ * // response narrowed to status code `200` variant, and `result` is available
2627
2554
  * console.log('Result:', response.result);
2628
2555
  * }
2629
2556
  * ```
2630
2557
  *
2631
2558
  * @public
2632
2559
  */
2633
- export declare function hasResult<T extends BridgeResponse>(response: T): response is Extract<T, {
2560
+ export declare function hasResult<T extends SDKResponse>(response: T): response is Extract<T, {
2634
2561
  result: NonNullable<unknown>;
2635
2562
  }>;
2636
2563
 
@@ -2770,7 +2697,7 @@ export declare const HideRefreshButtonResponseSchema: v.UnionSchema<[v.ObjectSch
2770
2697
  export declare type HideRefreshButtonResult = void;
2771
2698
 
2772
2699
  /**
2773
- * JSBridge module for authenticating users via GrabID.
2700
+ * SDK module for authenticating users with GrabID via `JSBridge`.
2774
2701
  *
2775
2702
  * @group Modules
2776
2703
  * @category Identity
@@ -2943,7 +2870,7 @@ export declare class IdentityModule extends BaseModule {
2943
2870
  * Determines whether to use web-based consent flow based on app version and environment.
2944
2871
  *
2945
2872
  * @param request - The authorization request containing the environment setting.
2946
- * @returns True if web consent should be used, false for native consent.
2873
+ * @returns `true` if web consent should be used, `false` for native consent.
2947
2874
  *
2948
2875
  * @internal
2949
2876
  */
@@ -2959,7 +2886,7 @@ export declare class IdentityModule extends BaseModule {
2959
2886
  */
2960
2887
  private performWebAuthorization;
2961
2888
  /**
2962
- * Performs native in-app OAuth2 authorization using the JSBridge.
2889
+ * Performs native in-app OAuth2 authorization using `JSBridge`.
2963
2890
  *
2964
2891
  * @param invokeParams - The authorization parameters.
2965
2892
  *
@@ -3057,38 +2984,25 @@ export declare class IdentityModule extends BaseModule {
3057
2984
  }
3058
2985
 
3059
2986
  /**
3060
- * Options for invoking a JSBridge method.
3061
- *
3062
- * @group Core
3063
- *
3064
- * @public
3065
- */
3066
- export declare interface InvokeOptions {
3067
- /** The name of the JSBridge method to invoke */
3068
- method: string;
3069
- /** The parameters to pass to the method */
3070
- params?: unknown;
3071
- }
3072
-
3073
- /**
3074
- * Type guard to check if a JSBridge response is a client error (4xx status codes).
2987
+ * Type guard to check if an SDK response has a client error status code (`400`, `401`, `403`, `404`, `424`, `426`).
3075
2988
  *
3076
2989
  * @group Type Guards
3077
2990
  *
3078
- * @param response - The JSBridge response to check
3079
- * @returns True if the response is a client error (400-499), false otherwise
2991
+ * @param response - The SDK response to check
2992
+ * @returns `true` if the response is a client error, `false` otherwise
3080
2993
  *
3081
2994
  * @example
3082
2995
  * ```typescript
3083
2996
  * const response = await someBridgeMethod();
3084
2997
  * if (isClientError(response)) {
3085
- * console.error('Client error:', response.error);
2998
+ * // response narrowed to client error variants, `error` is available
2999
+ * console.error(response.error);
3086
3000
  * }
3087
3001
  * ```
3088
3002
  *
3089
3003
  * @public
3090
3004
  */
3091
- export declare function isClientError<T extends BridgeResponse>(response: T): response is Extract<T, {
3005
+ export declare function isClientError<T extends SDKResponse>(response: T): response is Extract<T, {
3092
3006
  status_code: 400 | 401 | 403 | 404 | 424 | 426;
3093
3007
  }>;
3094
3008
 
@@ -3160,27 +3074,25 @@ export declare const IsConnectedResultSchema: v.ObjectSchema<{
3160
3074
  }, undefined>;
3161
3075
 
3162
3076
  /**
3163
- * Type guard to check if a JSBridge response is an error (4xx or 5xx status codes).
3077
+ * Type guard to check if an SDK response has an error status code (`400`, `401`, `403`, `404`, `424`, `426`, `500`, `501`).
3164
3078
  *
3165
3079
  * @group Type Guards
3166
3080
  *
3167
- * @param response - The JSBridge response to check
3168
- * @returns True if the response is any error (4xx or 5xx), false otherwise
3081
+ * @param response - The SDK response to check
3082
+ * @returns `true` if the response is an error, `false` otherwise
3169
3083
  *
3170
3084
  * @example
3171
3085
  * ```typescript
3172
3086
  * const response = await someBridgeMethod();
3173
3087
  * if (isError(response)) {
3174
- * // response narrowed to error variants error: string is guaranteed
3175
- * console.error('Error:', response.error);
3176
- * } else {
3177
- * console.log('Success!');
3088
+ * // response narrowed to error variants, `error` is available
3089
+ * console.error(response.error);
3178
3090
  * }
3179
3091
  * ```
3180
3092
  *
3181
3093
  * @public
3182
3094
  */
3183
- export declare function isError<T extends BridgeResponse>(response: T): response is Extract<T, {
3095
+ export declare function isError<T extends SDKResponse>(response: T): response is Extract<T, {
3184
3096
  error: string;
3185
3097
  }>;
3186
3098
 
@@ -3262,116 +3174,145 @@ export declare type IsEsimSupportedResult = InferOutput<typeof IsEsimSupportedRe
3262
3174
  export declare const IsEsimSupportedResultSchema: v.BooleanSchema<undefined>;
3263
3175
 
3264
3176
  /**
3265
- * Type guard to check if a JSBridge response is a 302 Found redirect.
3177
+ * Type guard to check if an SDK response has a `302` status code.
3266
3178
  *
3267
3179
  * @group Type Guards
3268
3180
  *
3269
- * @param response - The JSBridge response to check
3270
- * @returns True if the response has status code 302, false otherwise
3181
+ * @param response - The SDK response to check
3182
+ * @returns `true` if the response has `302` status code, `false` otherwise
3183
+ *
3184
+ * @example
3185
+ * ```typescript
3186
+ * const response = await someBridgeMethod();
3187
+ * if (isFound(response)) {
3188
+ * // response narrowed to status code `302` variant
3189
+ * console.log('Redirecting...');
3190
+ * }
3191
+ * ```
3271
3192
  *
3272
3193
  * @public
3273
3194
  */
3274
- export declare function isFound<T extends BridgeResponse>(response: T): response is Extract<T, {
3195
+ export declare function isFound<T extends SDKResponse>(response: T): response is Extract<T, {
3275
3196
  status_code: 302;
3276
3197
  }>;
3277
3198
 
3278
3199
  /**
3279
- * Type guard to check if a JSBridge response is a 204 No Content (operation succeeded with no result).
3200
+ * Type guard to check if an SDK response has a `204` status code.
3280
3201
  *
3281
3202
  * @group Type Guards
3282
3203
  *
3283
- * @param response - The JSBridge response to check
3284
- * @returns True if the response has status code 204, false otherwise
3204
+ * @param response - The SDK response to check
3205
+ * @returns `true` if the response has `204` status code, `false` otherwise
3206
+ *
3207
+ * @example
3208
+ * ```typescript
3209
+ * const response = await someBridgeMethod();
3210
+ * if (isNoContent(response)) {
3211
+ * // response narrowed to status code `204` variant, `result` is not available
3212
+ * console.log('No content');
3213
+ * }
3214
+ * ```
3285
3215
  *
3286
3216
  * @public
3287
3217
  */
3288
- export declare function isNoContent<T extends BridgeResponse>(response: T): response is Extract<T, {
3218
+ export declare function isNoContent<T extends SDKResponse>(response: T): response is Extract<T, {
3289
3219
  status_code: 204;
3290
3220
  }>;
3291
3221
 
3292
3222
  /**
3293
- * Type guard to check if a JSBridge response is a 200 OK (operation succeeded with a result).
3223
+ * Type guard to check if an SDK response has a `200` status code.
3294
3224
  *
3295
3225
  * @group Type Guards
3296
3226
  *
3297
- * @param response - The JSBridge response to check
3298
- * @returns True if the response has status code 200, false otherwise
3227
+ * @param response - The SDK response to check
3228
+ * @returns `true` if the response has `200` status code, `false` otherwise
3229
+ *
3230
+ * @example
3231
+ * ```typescript
3232
+ * const response = await someBridgeMethod();
3233
+ * if (isOk(response)) {
3234
+ * // response narrowed to status code `200` variant, `result` is available
3235
+ * console.log(response.result);
3236
+ * }
3237
+ * ```
3299
3238
  *
3300
3239
  * @public
3301
3240
  */
3302
- export declare function isOk<T extends BridgeResponse>(response: T): response is Extract<T, {
3241
+ export declare function isOk<T extends SDKResponse>(response: T): response is Extract<T, {
3303
3242
  status_code: 200;
3304
3243
  }>;
3305
3244
 
3306
3245
  /**
3307
- * Type guard to check if a JSBridge response is a redirect (status code 302).
3246
+ * Type guard to check if an SDK response has a `302` status code.
3308
3247
  *
3309
3248
  * @group Type Guards
3310
3249
  *
3311
- * @param response - The JSBridge response to check
3312
- * @returns True if the response is a redirect (302), false otherwise
3250
+ * @param response - The SDK response to check
3251
+ * @returns `true` if the response is a redirect, `false` otherwise
3313
3252
  *
3314
3253
  * @example
3315
3254
  * ```typescript
3316
3255
  * const response = await someBridgeMethod();
3317
3256
  * if (isRedirection(response)) {
3257
+ * // response narrowed to status code `302` variant
3318
3258
  * console.log('Redirecting...');
3319
3259
  * }
3320
3260
  * ```
3321
3261
  *
3322
3262
  * @public
3323
3263
  */
3324
- export declare function isRedirection<T extends BridgeResponse>(response: T): response is Extract<T, {
3264
+ export declare function isRedirection<T extends SDKResponse>(response: T): response is Extract<T, {
3325
3265
  status_code: 302;
3326
3266
  }>;
3327
3267
 
3328
3268
  /**
3329
- * Type guard to check if a JSBridge response is a server error (5xx status codes).
3269
+ * Type guard to check if an SDK response has a server error status code (`500`, `501`).
3330
3270
  *
3331
3271
  * @group Type Guards
3332
3272
  *
3333
- * @param response - The JSBridge response to check
3334
- * @returns True if the response is a server error (500-599), false otherwise
3273
+ * @param response - The SDK response to check
3274
+ * @returns `true` if the response is a server error, `false` otherwise
3335
3275
  *
3336
3276
  * @example
3337
3277
  * ```typescript
3338
3278
  * const response = await someBridgeMethod();
3339
3279
  * if (isServerError(response)) {
3340
- * console.error('Server error:', response.error);
3280
+ * // response narrowed to server error variants, `error` is available
3281
+ * console.error(response.error);
3341
3282
  * }
3342
3283
  * ```
3343
3284
  *
3344
3285
  * @public
3345
3286
  */
3346
- export declare function isServerError<T extends BridgeResponse>(response: T): response is Extract<T, {
3287
+ export declare function isServerError<T extends SDKResponse>(response: T): response is Extract<T, {
3347
3288
  status_code: 500 | 501;
3348
3289
  }>;
3349
3290
 
3350
3291
  /**
3351
- * Type guard to check if a JSBridge response is successful (2xx status codes).
3292
+ * Type guard to check if an SDK response has a success status code (`200`, `204`).
3352
3293
  *
3353
3294
  * @group Type Guards
3354
3295
  *
3355
- * @param response - The JSBridge response to check
3356
- * @returns True if the response is successful (200-299), false otherwise
3296
+ * @param response - The SDK response to check
3297
+ * @returns `true` if the response is successful, `false` otherwise
3357
3298
  *
3358
3299
  * @example
3359
3300
  * ```typescript
3360
3301
  * const response = await someBridgeMethod();
3361
3302
  * if (isSuccess(response)) {
3362
- * // response narrowed to success variants — result is available
3363
- * console.log(response.result);
3303
+ * // response narrowed to success variants
3304
+ * console.log(response);
3364
3305
  * }
3365
3306
  * ```
3366
3307
  *
3367
3308
  * @public
3368
3309
  */
3369
- export declare function isSuccess<T extends BridgeResponse>(response: T): response is Extract<T, {
3310
+ export declare function isSuccess<T extends SDKResponse>(response: T): response is Extract<T, {
3370
3311
  status_code: 200 | 204;
3371
3312
  }>;
3372
3313
 
3373
3314
  /**
3374
- * JSBridge module for accessing device locale settings.
3315
+ * SDK module for accessing device locale settings via `JSBridge`.
3375
3316
  *
3376
3317
  * @group Modules
3377
3318
  * @category Locale
@@ -3433,7 +3374,7 @@ export declare class LocaleModule extends BaseModule {
3433
3374
  }
3434
3375
 
3435
3376
  /**
3436
- * JSBridge module for accessing device location services.
3377
+ * SDK module for accessing device location services via `JSBridge`.
3437
3378
  *
3438
3379
  * @group Modules
3439
3380
  * @category Location
@@ -3507,11 +3448,11 @@ export declare class LocationModule extends BaseModule {
3507
3448
  * @requiredOAuthScope mobile.geolocation
3508
3449
  *
3509
3450
  * @remarks
3510
- * This method returns a `BridgeStream` that continuously emits location updates.
3451
+ * This method returns an `SDKStream` that continuously emits location updates.
3511
3452
  * Remember to call `unsubscribe()` on the subscription when you no longer need updates
3512
3453
  * to conserve battery and free resources.
3513
3454
  *
3514
- * @returns A `BridgeStream` that emits location updates as the device location changes.
3455
+ * @returns An `SDKStream` that emits location updates as the device location changes.
3515
3456
  * Use `subscribe()` to listen for updates, or `await` to get the first value only. See {@link ObserveLocationChangeResponse}.
3516
3457
  *
3517
3458
  * @example
@@ -3608,7 +3549,7 @@ export declare class Logger {
3608
3549
  }
3609
3550
 
3610
3551
  /**
3611
- * JSBridge module for playing DRM-protected media content.
3552
+ * SDK module for playing DRM-protected media content via `JSBridge`.
3612
3553
  *
3613
3554
  * @group Modules
3614
3555
  * @category Media
@@ -3729,7 +3670,21 @@ export declare class MediaModule extends BaseModule {
3729
3670
  }
3730
3671
 
3731
3672
  /**
3732
- * JSBridge module for making network requests via the native bridge.
3673
+ * Options for invoking an SDK method.
3674
+ *
3675
+ * @group Core
3676
+ *
3677
+ * @public
3678
+ */
3679
+ export declare interface ModuleInvokeOptions {
3680
+ /** The name of the SDK method to invoke */
3681
+ method: string;
3682
+ /** The parameters to pass to the method */
3683
+ params?: unknown;
3684
+ }
3685
+
3686
+ /**
3687
+ * SDK module for making network requests through the native layer via `JSBridge`.
3733
3688
  *
3734
3689
  * @group Modules
3735
3690
  * @category Network
@@ -3762,7 +3717,7 @@ export declare class MediaModule extends BaseModule {
3762
3717
  export declare class NetworkModule extends BaseModule {
3763
3718
  constructor();
3764
3719
  /**
3765
- * Sends a network request via the native bridge.
3720
+ * Sends a network request through `JSBridge`.
3766
3721
  *
3767
3722
  * @param request - The network request parameters including endpoint, method, headers, query, body, and timeout. See {@link SendRequest}.
3768
3723
  *
@@ -3807,15 +3762,15 @@ export declare class NetworkModule extends BaseModule {
3807
3762
  * @category Media
3808
3763
  *
3809
3764
  * @remarks
3810
- * This is a `BridgeStream` that can be:
3765
+ * This is an `SDKStream` that can be:
3811
3766
  * - Subscribed to via `.subscribe()` for continuous updates
3812
3767
  * - Awaited via `await` to get the first value only
3813
3768
  *
3814
- * The stream can emit status codes 200 (event data), 500 (server error), or 501 (not implemented).
3769
+ * The stream can emit status codes `200` (event data), `500` (server error), or `501` (not implemented).
3815
3770
  *
3816
3771
  * @public
3817
3772
  */
3818
- export declare type ObserveDRMPlaybackResponse = BridgeStream<InferOutput<typeof ObserveDRMPlaybackResponseSchema>>;
3773
+ export declare type ObserveDRMPlaybackResponse = SDKStream<InferOutput<typeof ObserveDRMPlaybackResponseSchema>>;
3819
3774
 
3820
3775
  /**
3821
3776
  * @group Modules
@@ -3846,7 +3801,7 @@ export declare const ObserveDRMPlaybackResponseSchema: v.UnionSchema<[v.ObjectSc
3846
3801
  * @category Location
3847
3802
  *
3848
3803
  * @remarks
3849
- * This is a `BridgeStream` that can be:
3804
+ * This is an `SDKStream` that can be:
3850
3805
  * - Subscribed to via `.subscribe()` for continuous updates
3851
3806
  * - Awaited via `await` to get the first value only
3852
3807
  *
@@ -3854,7 +3809,7 @@ export declare const ObserveDRMPlaybackResponseSchema: v.UnionSchema<[v.ObjectSc
3854
3809
  *
3855
3810
  * @public
3856
3811
  */
3857
- export declare type ObserveLocationChangeResponse = BridgeStream<GetCoordinateResponse>;
3812
+ export declare type ObserveLocationChangeResponse = SDKStream<GetCoordinateResponse>;
3858
3813
 
3859
3814
  /**
3860
3815
  * Response when notifying content loaded.
@@ -4040,7 +3995,7 @@ export declare type OpenExternalLinkResult = void;
4040
3995
  export declare type Platform = 'Android' | 'iOS';
4041
3996
 
4042
3997
  /**
4043
- * JSBridge module for controlling platform navigation.
3998
+ * SDK module for controlling platform navigation via `JSBridge`.
4044
3999
  *
4045
4000
  * @group Modules
4046
4001
  * @category Platform
@@ -4163,7 +4118,7 @@ export declare const PlayDRMContentResponseSchema: v.UnionSchema<[v.ObjectSchema
4163
4118
  export declare type PlayDRMContentResult = void;
4164
4119
 
4165
4120
  /**
4166
- * JSBridge module for accessing user profile information.
4121
+ * SDK module for accessing user profile information via `JSBridge`.
4167
4122
  *
4168
4123
  * @group Modules
4169
4124
  * @category Profile
@@ -4652,7 +4607,7 @@ export declare const ScanQRCodeResultSchema: v.ObjectSchema<{
4652
4607
  }, undefined>;
4653
4608
 
4654
4609
  /**
4655
- * JSBridge module for checking and refreshing API access permissions.
4610
+ * SDK module for checking and refreshing API access permissions via `JSBridge`.
4656
4611
  *
4657
4612
  * @group Modules
4658
4613
  * @category Scope
@@ -4683,9 +4638,9 @@ export declare const ScanQRCodeResultSchema: v.ObjectSchema<{
4683
4638
  export declare class ScopeModule extends BaseModule {
4684
4639
  constructor();
4685
4640
  /**
4686
- * Checks if the current client has access to a specific JSBridge API method.
4641
+ * Checks if the current client has access to a specific `JSBridge` API method.
4687
4642
  *
4688
- * @param module - The name of the bridge module to check access for (e.g., 'CameraModule').
4643
+ * @param module - The name of the SDK module to check access for (e.g., 'CameraModule').
4689
4644
  * @param method - The method name within the module to check access for (e.g., 'scanQRCode').
4690
4645
  *
4691
4646
  * @returns Whether the MiniApp has permission to access the specified method. See {@link HasAccessToResponse}.
@@ -4746,6 +4701,143 @@ export declare class ScopeModule extends BaseModule {
4746
4701
  reloadScopes(): Promise<ReloadScopesResponse>;
4747
4702
  }
4748
4703
 
4704
+ /**
4705
+ * Client error status codes for SDK error responses.
4706
+ *
4707
+ * @group Core
4708
+ *
4709
+ * @public
4710
+ */
4711
+ export declare type SDKClientErrorStatusCode = 400 | 401 | 403 | 404 | 424 | 426;
4712
+
4713
+ /**
4714
+ * SDK error status code response with a `error` message.
4715
+ *
4716
+ * @group Core
4717
+ *
4718
+ * @public
4719
+ */
4720
+ export declare interface SDKErrorResponse<C extends SDKErrorStatusCode> {
4721
+ readonly status_code: C;
4722
+ readonly error: string;
4723
+ }
4724
+
4725
+ /**
4726
+ * Error status codes for SDK error responses.
4727
+ *
4728
+ * @group Core
4729
+ *
4730
+ * @public
4731
+ */
4732
+ export declare type SDKErrorStatusCode = SDKClientErrorStatusCode | SDKServerErrorStatusCode;
4733
+
4734
+ /**
4735
+ * SDK `204` status code response.
4736
+ *
4737
+ * @group Core
4738
+ *
4739
+ * @public
4740
+ */
4741
+ export declare interface SDKNoContentResponse {
4742
+ readonly status_code: 204;
4743
+ }
4744
+
4745
+ /**
4746
+ * SDK `200` status code response with a typed `result` payload.
4747
+ *
4748
+ * @group Core
4749
+ *
4750
+ * @public
4751
+ */
4752
+ export declare interface SDKOkResponse<T> {
4753
+ readonly status_code: 200;
4754
+ readonly result: T;
4755
+ }
4756
+
4757
+ /**
4758
+ * SDK `302` status code response.
4759
+ *
4760
+ * @group Core
4761
+ *
4762
+ * @public
4763
+ */
4764
+ export declare interface SDKRedirectResponse {
4765
+ readonly status_code: 302;
4766
+ }
4767
+
4768
+ /**
4769
+ * Base SDK response shape.
4770
+ *
4771
+ * @group Core
4772
+ *
4773
+ * @remarks
4774
+ * Use the type guards to narrow to a specific shape.
4775
+ *
4776
+ * @public
4777
+ */
4778
+ export declare type SDKResponse = {
4779
+ /** HTTP-style status code indicating the outcome of the SDK method call */
4780
+ status_code: number;
4781
+ /** The result data from the SDK method, present on 200 status code responses */
4782
+ result?: unknown;
4783
+ /** Error message, present on error status code responses */
4784
+ error?: string;
4785
+ };
4786
+
4787
+ /**
4788
+ * Server error status codes for SDK error responses.
4789
+ *
4790
+ * @group Core
4791
+ *
4792
+ * @public
4793
+ */
4794
+ export declare type SDKServerErrorStatusCode = 500 | 501;
4795
+
4796
+ /**
4797
+ * A stream for receiving continuous data from SDK methods (e.g., location updates).
4798
+ *
4799
+ * @group Core
4800
+ *
4801
+ * @remarks
4802
+ * Provides both Observable-like and Promise-like interfaces:
4803
+ * - Use `subscribe()` to receive all values over time
4804
+ * - Use `then()` or `await` to receive only the first value
4805
+ *
4806
+ * Note: Each `subscribe()` call creates a fresh subscription, allowing multiple independent listeners.
4807
+ *
4808
+ * @typeParam T - The response type emitted by the stream.
4809
+ *
4810
+ * @public
4811
+ */
4812
+ export declare type SDKStream<T extends SDKResponse = SDKResponse> = Readonly<{
4813
+ /**
4814
+ * Subscribe to receive stream data.
4815
+ *
4816
+ * @param handlers - Optional callbacks for data (`next`) and completion (`complete`).
4817
+ * @returns A `Subscription` to terminate the stream when needed.
4818
+ */
4819
+ subscribe: (handlers?: SDKStreamHandlers<T>) => Subscription;
4820
+ }> & PromiseLike<T>;
4821
+
4822
+ /**
4823
+ * Callbacks for handling stream events.
4824
+ *
4825
+ * @group Core
4826
+ *
4827
+ * @remarks
4828
+ * Pass these to `subscribe()` to receive data via `next` and completion via `complete`.
4829
+ *
4830
+ * @typeParam T - The response type emitted by the stream.
4831
+ *
4832
+ * @public
4833
+ */
4834
+ export declare type SDKStreamHandlers<T extends SDKResponse = SDKResponse> = Readonly<{
4835
+ /** Called with each new value from the stream. */
4836
+ next?: (data: T) => unknown;
4837
+ /** Called when the stream ends and no more data will arrive. */
4838
+ complete?: () => unknown;
4839
+ }>;
4840
+
4749
4841
  /**
4750
4842
  * Request parameters for sending analytics events.
4751
4843
  *
@@ -4975,7 +5067,7 @@ export declare const SendResponseSchema: v.UnionSchema<[v.ObjectSchema<{
4975
5067
  *
4976
5068
  * @remarks
4977
5069
  * The result type is `Record<string, unknown>` as response bodies are always
4978
- * returned as objects. String responses from the native bridge are automatically
5070
+ * returned as objects. String responses from `JSBridge` are automatically
4979
5071
  * parsed to JSON.
4980
5072
  *
4981
5073
  * @public
@@ -5580,7 +5672,7 @@ export declare const ShowRefreshButtonResponseSchema: v.UnionSchema<[v.ObjectSch
5580
5672
  export declare type ShowRefreshButtonResult = void;
5581
5673
 
5582
5674
  /**
5583
- * JSBridge module for controlling the native splash / Lottie loading screen.
5675
+ * SDK module for controlling the native splash / Lottie loading screen via `JSBridge`.
5584
5676
  *
5585
5677
  * @group Modules
5586
5678
  * @category Splash Screen
@@ -5636,7 +5728,7 @@ export declare class SplashScreenModule extends BaseModule {
5636
5728
  }
5637
5729
 
5638
5730
  /**
5639
- * JSBridge module for persisting key-value data to native storage.
5731
+ * SDK module for persisting key-value data to native storage via `JSBridge`.
5640
5732
  *
5641
5733
  * @group Modules
5642
5734
  * @category Storage
@@ -6018,7 +6110,7 @@ export declare class StorageModule extends BaseModule {
6018
6110
  }
6019
6111
 
6020
6112
  /**
6021
- * Controls an active stream subscription. Call `unsubscribe()` to stop receiving data.
6113
+ * Controls an active stream subscription.
6022
6114
  *
6023
6115
  * @group Core
6024
6116
  *
@@ -6029,14 +6121,14 @@ export declare class StorageModule extends BaseModule {
6029
6121
  * @public
6030
6122
  */
6031
6123
  export declare type Subscription = Readonly<{
6032
- /** Returns true if this subscription has been terminated. */
6124
+ /** Returns `true` if this subscription has been terminated. */
6033
6125
  isUnsubscribed: () => boolean;
6034
6126
  /** Terminates the subscription. No further data will be received. */
6035
6127
  unsubscribe: () => unknown;
6036
6128
  }>;
6037
6129
 
6038
6130
  /**
6039
- * JSBridge module for opening URLs in the device's system browser.
6131
+ * SDK module for opening URLs in the device's system browser via `JSBridge`.
6040
6132
  *
6041
6133
  * @group Modules
6042
6134
  * @category System WebView Kit
@@ -6270,7 +6362,7 @@ export declare const TriggerCheckoutResultSchema: v.VariantSchema<"status", [v.O
6270
6362
  }, undefined>], undefined>;
6271
6363
 
6272
6364
  /**
6273
- * JSBridge module for reading user-related attributes from native code.
6365
+ * SDK module for reading user-related attributes from native code via `JSBridge`.
6274
6366
  *
6275
6367
  * @group Modules
6276
6368
  * @category User Attributes
@@ -6481,14 +6573,14 @@ export declare interface Version {
6481
6573
  }
6482
6574
 
6483
6575
  /**
6484
- * Generic interface for all native JSBridge module wrappers.
6576
+ * Generic interface for all SDK module wrappers exposed through `JSBridge`.
6485
6577
  *
6486
6578
  * @group Core
6487
6579
  *
6488
6580
  * @public
6489
6581
  */
6490
6582
  export declare interface WrappedModule {
6491
- invoke(method: string, params?: unknown): BridgeStream | Promise<BridgeResponse>;
6583
+ invoke(method: string, params?: unknown): SDKStream | Promise<SDKResponse>;
6492
6584
  }
6493
6585
 
6494
6586
  export { }