@grabjs/superapp-sdk 1.8.10 → 2.0.0-beta.12

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.
@@ -0,0 +1,3494 @@
1
+ import { DataStream as DataStream_2 } from '@grabjs/mobile-kit-bridge-sdk';
2
+
3
+ /**
4
+ * Request parameters for initiating an OAuth2 authorization flow with PKCE.
5
+ *
6
+ * @public
7
+ */
8
+ export declare type AuthorizeRequest = {
9
+ /** The OAuth2 client ID for your MiniApp. */
10
+ clientId: string;
11
+ /** The redirect URI registered for your MiniApp. */
12
+ redirectUri: string;
13
+ /** The OAuth2 scopes to request (space-separated string). */
14
+ scope: string;
15
+ /** The environment to use for authorization ('staging' or 'production'). */
16
+ environment: 'staging' | 'production';
17
+ /**
18
+ * The response mode for the authorization flow.
19
+ * - 'redirect': User is redirected to the redirect URI after authorization
20
+ * - 'in_place': Authorization happens within the current page context
21
+ * @defaultValue 'redirect'
22
+ */
23
+ responseMode?: 'redirect' | 'in_place';
24
+ };
25
+
26
+ /**
27
+ * Response when initiating an authorization flow.
28
+ *
29
+ * @public
30
+ */
31
+ export declare type AuthorizeResponse = ConstrainedBridgeResponse<AuthorizeResult, 200 | 302 | 204 | 400>;
32
+
33
+ /**
34
+ * Result object for the authorization flow.
35
+ * Contains the authorization code and state when native in_place flow completes successfully.
36
+ *
37
+ * @public
38
+ */
39
+ export declare type AuthorizeResult = {
40
+ /** The authorization code returned from the server. */
41
+ code: string;
42
+ /** The state parameter returned from the server for CSRF protection. */
43
+ state: string;
44
+ };
45
+
46
+ /**
47
+ * Base class for all JSBridge modules.
48
+ *
49
+ * @remarks
50
+ * On construction, the class wraps the JSBridge module on `window` (e.g., `WrappedContainerModule`).
51
+ * This code must run on the Grab SuperApp's webview to function correctly.
52
+ *
53
+ * @public
54
+ */
55
+ export declare class BaseModule {
56
+ /**
57
+ * The module name used to identify the JSBridge module.
58
+ */
59
+ private readonly name;
60
+ /**
61
+ * Returns the wrapped JSBridge module from the global `window` object.
62
+ *
63
+ * @returns The wrapped module instance with native method bindings.
64
+ *
65
+ * @internal
66
+ */
67
+ protected get wrappedModule(): WrappedModule;
68
+ /**
69
+ * Creates a new module instance and wraps it on the global `window` object.
70
+ *
71
+ * @param moduleName - The name of the module (e.g., "ContainerModule", "ProfileModule").
72
+ * @throws Error when the bridge SDK fails to wrap the module.
73
+ */
74
+ constructor(moduleName: string);
75
+ }
76
+
77
+ /**
78
+ * Union type representing all client error JSBridge responses (4xx status codes).
79
+ * Includes: 400 (Bad Request), 403 (Forbidden), 404 (Not Found), and 424 (Failed Dependency).
80
+ *
81
+ * @public
82
+ */
83
+ export declare type BridgeClientErrorResponse = BridgeStatusCode400Response | BridgeStatusCode403Response | BridgeStatusCode404Response | BridgeStatusCode424Response;
84
+
85
+ /**
86
+ * Union type representing all error JSBridge responses (4xx and 5xx status codes).
87
+ * Combines both client errors and server errors.
88
+ *
89
+ * @public
90
+ */
91
+ export declare type BridgeErrorResponse = BridgeClientErrorResponse | BridgeServerErrorResponse;
92
+
93
+ /**
94
+ * Union type representing redirect JSBridge responses.
95
+ * Currently only includes status code 302.
96
+ *
97
+ * @public
98
+ */
99
+ export declare type BridgeRedirectResponse = BridgeStatusCode302Response;
100
+
101
+ /**
102
+ * Universal response format for all JSBridge methods.
103
+ *
104
+ * @remarks
105
+ * All JSBridge method calls resolve to this type. After destructuring,
106
+ * use type guards (e.g., if (error), if (status_code === 200)) to narrow the type.
107
+ *
108
+ * @public
109
+ */
110
+ export declare type BridgeResponse<T> = BridgeSuccessResponse<T> | BridgeRedirectResponse | BridgeClientErrorResponse | BridgeServerErrorResponse;
111
+
112
+ /**
113
+ * Union type representing server error JSBridge responses (5xx status codes).
114
+ * Currently only includes status code 500 (Internal Server Error).
115
+ *
116
+ * @public
117
+ */
118
+ export declare type BridgeServerErrorResponse = BridgeStatusCode500Response;
119
+
120
+ /**
121
+ * Success response from the bridge SDK.
122
+ *
123
+ * @remarks
124
+ * Returned when a JSBridge method completes successfully.
125
+ * The `result` field contains the JSBridge method's data.
126
+ *
127
+ * @public
128
+ */
129
+ export declare type BridgeStatusCode200Response<T> = {
130
+ /** HTTP-style status code indicating the outcome of the JSBridge method call */
131
+ status_code: 200;
132
+ /** The result data from the JSBridge method, or undefined if no result was returned */
133
+ result: T;
134
+ };
135
+
136
+ /**
137
+ * No result response with status code 204.
138
+ *
139
+ * @remarks
140
+ * Returned when a JSBridge method completes with no content (e.g., user cancelled a dialog).
141
+ * No `result` or `error` data is returned.
142
+ *
143
+ * @public
144
+ */
145
+ export declare type BridgeStatusCode204Response = {
146
+ /** HTTP-style status code indicating the outcome of the JSBridge method call */
147
+ status_code: 204;
148
+ };
149
+
150
+ /**
151
+ * Redirect response with status code 302.
152
+ *
153
+ * @remarks
154
+ * Returned when a JSBridge method initiates a redirect (e.g., OAuth2 redirect flow).
155
+ * No `result` or `error` data is returned as the page will navigate away.
156
+ *
157
+ * @public
158
+ */
159
+ export declare type BridgeStatusCode302Response = {
160
+ /** HTTP-style status code indicating the outcome of the JSBridge method call */
161
+ status_code: 302;
162
+ };
163
+
164
+ /**
165
+ * Error response with status code 400
166
+ *
167
+ * @public
168
+ */
169
+ export declare type BridgeStatusCode400Response = {
170
+ /** HTTP-style status code indicating the outcome of the JSBridge method call */
171
+ status_code: 400;
172
+ /** Error message if the call failed */
173
+ error: string;
174
+ };
175
+
176
+ /**
177
+ * Error response with status code 403
178
+ *
179
+ * @public
180
+ */
181
+ export declare type BridgeStatusCode403Response = {
182
+ /** HTTP-style status code indicating the outcome of the JSBridge method call */
183
+ status_code: 403;
184
+ /** Error message if the call failed */
185
+ error: string;
186
+ };
187
+
188
+ /**
189
+ * Error response with status code 404
190
+ *
191
+ * @public
192
+ */
193
+ export declare type BridgeStatusCode404Response = {
194
+ /** HTTP-style status code indicating the outcome of the JSBridge method call */
195
+ status_code: 404;
196
+ /** Error message if the call failed */
197
+ error: string;
198
+ };
199
+
200
+ /**
201
+ * Error response with status code 424
202
+ *
203
+ * @public
204
+ */
205
+ export declare type BridgeStatusCode424Response = {
206
+ /** HTTP-style status code indicating the outcome of the JSBridge method call */
207
+ status_code: 424;
208
+ /** Error message if the call failed */
209
+ error: string;
210
+ };
211
+
212
+ /**
213
+ * Error response with status code 500
214
+ *
215
+ * @public
216
+ */
217
+ export declare type BridgeStatusCode500Response = {
218
+ /** HTTP-style status code indicating the outcome of the JSBridge method call */
219
+ status_code: 500;
220
+ /** Error message if the call failed */
221
+ error: string;
222
+ };
223
+
224
+ /**
225
+ * Union type representing all successful JSBridge responses.
226
+ * Includes status codes 200 (with result data) and 204 (no content).
227
+ *
228
+ * @public
229
+ */
230
+ export declare type BridgeSuccessResponse<T> = BridgeStatusCode200Response<T> | BridgeStatusCode204Response;
231
+
232
+ /**
233
+ * JSBridge module for accessing the device camera.
234
+ *
235
+ * @group Modules
236
+ *
237
+ * @remarks
238
+ * Provides access to native camera functionality including QR code scanning.
239
+ * This code must run on the Grab SuperApp's webview to function correctly.
240
+ *
241
+ * @example
242
+ * **ES Module:**
243
+ * ```typescript
244
+ * import { CameraModule } from '@grabjs/superapp-sdk';
245
+ * const cameraModule = new CameraModule();
246
+ * ```
247
+ *
248
+ * @example
249
+ * **CDN (UMD):**
250
+ * ```html
251
+ * <script src="https://cdn.jsdelivr.net/npm/@grabjs/superapp-sdk/dist/index.js"></script>
252
+ * <script>
253
+ * const cameraModule = new SuperAppSDK.CameraModule();
254
+ * </script>
255
+ * ```
256
+ *
257
+ * @public
258
+ */
259
+ export declare class CameraModule extends BaseModule {
260
+ constructor();
261
+ /**
262
+ * Opens the native camera to scan a QR code.
263
+ *
264
+ * @param request - Configuration for the QR code scan.
265
+ *
266
+ * @returns A promise that resolves to a response with one of the following possible status codes:
267
+ * - `200`: Successfully scanned QR code
268
+ * - `204`: User cancelled the QR code scanning
269
+ * - `400`: Bad request
270
+ * - `403`: Camera permission is not enabled for the Grab app
271
+ *
272
+ * @throws Error when the JSBridge method fails unexpectedly.
273
+ *
274
+ * @example
275
+ * **Simple usage**
276
+ * ```typescript
277
+ * // Imports using ES Module built
278
+ * import { CameraModule, isResponseOk, isResponseNoContent, isResponseError, isResponseForbidden, isResponseClientError } from '@grabjs/superapp-sdk';
279
+ * // Imports using UMD built (via CDN)
280
+ * const { CameraModule, isResponseOk, isResponseNoContent, isResponseError, isResponseForbidden, isResponseClientError } = window.SuperAppSDK;
281
+ *
282
+ * // Initialize the camera module
283
+ * const cameraModule = new CameraModule();
284
+ *
285
+ * // Scan the QR code
286
+ * try {
287
+ * const response = await cameraModule.scanQRCode({ title: 'Scan Payment QR' });
288
+ * if (isResponseError(response)) {
289
+ * if (isResponseForbidden(response)) {
290
+ * console.log('User has not granted camera permission for the Grab app');
291
+ * } else if (isResponseClientError(response)) {
292
+ * console.log('Client error:', response.status_code, response.error);
293
+ * }
294
+ * } else {
295
+ * if (isResponseOk(response)) {
296
+ * console.log('QR Code scanned:', response.result.qrCode);
297
+ * } else if (isResponseNoContent(response)) {
298
+ * console.log('User cancelled QR code scanning');
299
+ * }
300
+ * }
301
+ * } catch (error) {
302
+ * console.log('Unexpected error:', error);
303
+ * }
304
+ * ```
305
+ * @public
306
+ */
307
+ scanQRCode(request: ScanQRCodeRequest): Promise<ScanQRCodeResponse>;
308
+ }
309
+
310
+ /**
311
+ * JSBridge module for triggering native payment flows.
312
+ *
313
+ * @group Modules
314
+ *
315
+ * @remarks
316
+ * Invokes the native Grab checkout/pay component to process payments.
317
+ * This code must run on the Grab SuperApp's webview to function correctly.
318
+ *
319
+ * @example
320
+ * **ES Module:**
321
+ * ```typescript
322
+ * import { CheckoutModule } from '@grabjs/superapp-sdk';
323
+ * const checkoutModule = new CheckoutModule();
324
+ * ```
325
+ *
326
+ * @example
327
+ * **CDN (UMD):**
328
+ * ```html
329
+ * <script src="https://cdn.jsdelivr.net/npm/@grabjs/superapp-sdk/dist/index.js"></script>
330
+ * <script>
331
+ * const checkoutModule = new SuperAppSDK.CheckoutModule();
332
+ * </script>
333
+ * ```
334
+ *
335
+ * @public
336
+ */
337
+ export declare class CheckoutModule extends BaseModule {
338
+ constructor();
339
+ /**
340
+ * Triggers the native checkout flow for payment processing.
341
+ *
342
+ * @param request - The checkout configuration.
343
+ *
344
+ * @returns A promise that resolves to a response with one of the following possible status codes:
345
+ * - `200`: Checkout completed
346
+ * - `400`: Bad request
347
+ *
348
+ * @throws Error when the JSBridge method fails unexpectedly.
349
+ *
350
+ * @example
351
+ * **Simple usage**
352
+ * ```typescript
353
+ * // Imports using ES Module built
354
+ * import { CheckoutModule, isResponseOk, isResponseError } from '@grabjs/superapp-sdk';
355
+ * // Imports using UMD built (via CDN)
356
+ * const { CheckoutModule, isResponseOk, isResponseError } = window.SuperAppSDK;
357
+ *
358
+ * // Initialize the checkout module
359
+ * const checkoutModule = new CheckoutModule();
360
+ *
361
+ * // Trigger checkout with response params
362
+ * try {
363
+ * const transactionResponse = await createTransaction(); // Call POST /grabpay/partner/v4/charge/init from Grab API to create a transaction
364
+ * const response = await checkoutModule.triggerCheckout(transactionResponse);
365
+ *
366
+ * if (isResponseError(response)) {
367
+ * console.log('Transaction failed:', response.status_code, response.error);
368
+ * } else {
369
+ * if (isResponseOk(response)) {
370
+ * if (response.result.status === 'success') {
371
+ * console.log('Transaction successful:', response.result.transactionID);
372
+ * } else if (response.result.status === 'failure') {
373
+ * console.log('Transaction failed:', response.result.errorMessage, response.result.errorCode);
374
+ * } else if (response.result.status === 'pending') {
375
+ * console.log('Transaction pending:', response.result.transactionID);
376
+ * } else if (response.result.status === 'userInitiatedCancel') {
377
+ * console.log('User cancelled the checkout');
378
+ * }
379
+ * }
380
+ * }
381
+ * } catch (error) {
382
+ * console.log('Could not trigger checkout:', error);
383
+ * }
384
+ * ```
385
+ *
386
+ * @public
387
+ */
388
+ triggerCheckout(request: TriggerCheckoutRequest): Promise<TriggerCheckoutResponse>;
389
+ }
390
+
391
+ /**
392
+ * Response when clearing stored authorization artifacts.
393
+ *
394
+ * @public
395
+ */
396
+ export declare type ClearAuthorizationArtifactsResponse = ConstrainedBridgeResponse<ClearAuthorizationArtifactsResult, 204>;
397
+
398
+ /**
399
+ * Result object for clearing authorization artifacts.
400
+ * This operation returns no data on success.
401
+ *
402
+ * @public
403
+ */
404
+ export declare type ClearAuthorizationArtifactsResult = void;
405
+
406
+ /**
407
+ * Response when closing the container.
408
+ *
409
+ * @public
410
+ */
411
+ export declare type CloseResponse = ConstrainedBridgeResponse<CloseResult, 200>;
412
+
413
+ /**
414
+ * Result when closing the container.
415
+ *
416
+ * @public
417
+ */
418
+ export declare type CloseResult = void;
419
+
420
+ /**
421
+ * Create a constrained JSBridge response type with only specific status codes.
422
+ *
423
+ * @example
424
+ * ```typescript
425
+ * // Only status code 200
426
+ * type OnlySuccess = ConstrainedBridgeResponse<string, 200>;
427
+ *
428
+ * // Only status codes 200 and 500
429
+ * type SuccessOrServerError = ConstrainedBridgeResponse<string, 200 | 500>;
430
+ *
431
+ * // Only error status codes
432
+ * type OnlyErrors = ConstrainedBridgeResponse<string, 400 | 403 | 424 | 500>;
433
+ * ```
434
+ *
435
+ * @public
436
+ */
437
+ export declare type ConstrainedBridgeResponse<T, Codes extends keyof StatusCodeMap<T>> = StatusCodeMap<T>[Codes];
438
+
439
+ /**
440
+ * Constants for container analytics event data.
441
+ *
442
+ * @public
443
+ */
444
+ export declare const ContainerAnalyticsEventData: {
445
+ TRANSACTION_AMOUNT: string;
446
+ TRANSACTION_CURRENCY: string;
447
+ PAGE: string;
448
+ };
449
+
450
+ /**
451
+ * Constants for container analytics event names.
452
+ *
453
+ * @public
454
+ */
455
+ export declare const ContainerAnalyticsEventName: {
456
+ DEFAULT: string;
457
+ };
458
+
459
+ /**
460
+ * Constants for container analytics event states.
461
+ *
462
+ * @public
463
+ */
464
+ export declare const ContainerAnalyticsEventState: {
465
+ HOMEPAGE: string;
466
+ CHECKOUT_PAGE: string;
467
+ BOOKING_COMPLETION: string;
468
+ CUSTOM: string;
469
+ };
470
+
471
+ /**
472
+ * JSBridge module for controlling the webview container.
473
+ *
474
+ * @group Modules
475
+ *
476
+ * @remarks
477
+ * Provides methods to interact with the webview container.
478
+ * This code must run on the Grab SuperApp's webview to function correctly.
479
+ *
480
+ * @example
481
+ * **ES Module:**
482
+ * ```typescript
483
+ * import { ContainerModule } from '@grabjs/superapp-sdk';
484
+ * const containerModule = new ContainerModule();
485
+ * ```
486
+ *
487
+ * @example
488
+ * **CDN (UMD):**
489
+ * ```html
490
+ * <script src="https://cdn.jsdelivr.net/npm/@grabjs/superapp-sdk/dist/index.js"></script>
491
+ * <script>
492
+ * const containerModule = new SuperAppSDK.ContainerModule();
493
+ * </script>
494
+ * ```
495
+ *
496
+ * @public
497
+ */
498
+ export declare class ContainerModule extends BaseModule {
499
+ constructor();
500
+ /**
501
+ * Set the background color of the container header.
502
+ *
503
+ * @param request - The background color configuration.
504
+ *
505
+ * @returns A promise that resolves to a response with one of the following possible status codes:
506
+ * - `200`: Background color set successfully
507
+ * - `400`: Invalid background color
508
+ *
509
+ * @throws Error when the JSBridge method fails unexpectedly.
510
+ *
511
+ * @example
512
+ * **Simple usage**
513
+ * ```typescript
514
+ * // Imports using ES Module built
515
+ * import { ContainerModule, isResponseOk, isResponseError } from '@grabjs/superapp-sdk';
516
+ * // Imports using UMD built (via CDN)
517
+ * const { ContainerModule, isResponseOk, isResponseError } = window.SuperAppSDK;
518
+ *
519
+ * // Initialize the container module
520
+ * const containerModule = new ContainerModule();
521
+ *
522
+ * // Set background color
523
+ * try {
524
+ * const response = await containerModule.setBackgroundColor('#ffffff');
525
+ *
526
+ * if (isResponseError(response)) {
527
+ * console.log('Could not set background color:', response.error);
528
+ * } else if (isResponseOk(response)) {
529
+ * console.log('Background color set successfully');
530
+ * }
531
+ * } catch (error) {
532
+ * console.log('Unexpected error:', error);
533
+ * }
534
+ * ```
535
+ *
536
+ * @public
537
+ */
538
+ setBackgroundColor(request: SetBackgroundColorRequest): Promise<SetBackgroundColorResponse>;
539
+ /**
540
+ * Set the title of the container header.
541
+ *
542
+ * @param request - The title configuration.
543
+ *
544
+ * @returns A promise that resolves to a response with one of the following possible status codes:
545
+ * - `200`: Title set successfully
546
+ * - `400`: Invalid title parameter
547
+ *
548
+ * @throws Error when the JSBridge method fails unexpectedly.
549
+ *
550
+ * @example
551
+ * **Simple usage**
552
+ * ```typescript
553
+ * // Imports using ES Module built
554
+ * import { ContainerModule, isResponseOk, isResponseError } from '@grabjs/superapp-sdk';
555
+ * // Imports using UMD built (via CDN)
556
+ * const { ContainerModule, isResponseOk, isResponseError } = window.SuperAppSDK;
557
+ *
558
+ * // Initialize the container module
559
+ * const containerModule = new ContainerModule();
560
+ *
561
+ * // Set title
562
+ * try {
563
+ * const response = await containerModule.setTitle('Home');
564
+ *
565
+ * if (isResponseError(response)) {
566
+ * console.log('Could not set title:', response.error);
567
+ * } else if (isResponseOk(response)) {
568
+ * console.log('Title set successfully');
569
+ * }
570
+ * } catch (error) {
571
+ * console.log('Unexpected error:', error);
572
+ * }
573
+ * ```
574
+ *
575
+ * @public
576
+ */
577
+ setTitle(request: SetTitleRequest): Promise<SetTitleResponse>;
578
+ /**
579
+ * Hide the back button on the container header.
580
+ *
581
+ * @returns A promise that resolves to a `200` status code when the back button is hidden.
582
+ *
583
+ * @throws Error when the JSBridge method fails unexpectedly.
584
+ *
585
+ * @example
586
+ * **Simple usage**
587
+ * ```typescript
588
+ * // Imports using ES Module built
589
+ * import { ContainerModule, isResponseOk } from '@grabjs/superapp-sdk';
590
+ * // Imports using UMD built (via CDN)
591
+ * const { ContainerModule, isResponseOk } = window.SuperAppSDK;
592
+ *
593
+ * // Initialize the container module
594
+ * const containerModule = new ContainerModule();
595
+ *
596
+ * // Hide back button
597
+ * try {
598
+ * const response = await containerModule.hideBackButton();
599
+ *
600
+ * if (isResponseOk(response)) {
601
+ * console.log('Back button hidden successfully');
602
+ * }
603
+ * } catch (error) {
604
+ * console.log('Unexpected error:', error);
605
+ * }
606
+ * ```
607
+ *
608
+ * @public
609
+ */
610
+ hideBackButton(): Promise<HideBackButtonResponse>;
611
+ /**
612
+ * Show the back button on the container header.
613
+ *
614
+ * @returns A promise that resolves to a `200` status code when the back button is shown.
615
+ *
616
+ * @throws Error when the JSBridge method fails unexpectedly.
617
+ *
618
+ * @example
619
+ * **Simple usage**
620
+ * ```typescript
621
+ * // Imports using ES Module built
622
+ * import { ContainerModule, isResponseOk } from '@grabjs/superapp-sdk';
623
+ * // Imports using UMD built (via CDN)
624
+ * const { ContainerModule, isResponseOk } = window.SuperAppSDK;
625
+ *
626
+ * // Initialize the container module
627
+ * const containerModule = new ContainerModule();
628
+ *
629
+ * // Show back button
630
+ * try {
631
+ * const response = await containerModule.showBackButton();
632
+ *
633
+ * if (isResponseOk(response)) {
634
+ * console.log('Back button shown successfully');
635
+ * }
636
+ * } catch (error) {
637
+ * console.log('Unexpected error:', error);
638
+ * }
639
+ * ```
640
+ *
641
+ * @public
642
+ */
643
+ showBackButton(): Promise<ShowBackButtonResponse>;
644
+ /**
645
+ * Hide the refresh button on the container header.
646
+ *
647
+ * @returns A promise that resolves to a `200` status code when the refresh button is hidden.
648
+ *
649
+ * @throws Error when the JSBridge method fails unexpectedly.
650
+ *
651
+ * @example
652
+ * **Simple usage**
653
+ * ```typescript
654
+ * // Imports using ES Module built
655
+ * import { ContainerModule, isResponseOk } from '@grabjs/superapp-sdk';
656
+ * // Imports using UMD built (via CDN)
657
+ * const { ContainerModule, isResponseOk } = window.SuperAppSDK;
658
+ *
659
+ * // Initialize the container module
660
+ * const containerModule = new ContainerModule();
661
+ *
662
+ * // Hide refresh button
663
+ * try {
664
+ * const response = await containerModule.hideRefreshButton();
665
+ *
666
+ * if (isResponseOk(response)) {
667
+ * console.log('Refresh button hidden successfully');
668
+ * }
669
+ * } catch (error) {
670
+ * console.log('Unexpected error:', error);
671
+ * }
672
+ * ```
673
+ *
674
+ * @public
675
+ */
676
+ hideRefreshButton(): Promise<HideRefreshButtonResponse>;
677
+ /**
678
+ * Show the refresh button on the container header.
679
+ *
680
+ * @returns A promise that resolves to a `200` status code when the refresh button is shown.
681
+ *
682
+ * @throws Error when the JSBridge method fails unexpectedly.
683
+ *
684
+ * @example
685
+ * **Simple usage**
686
+ * ```typescript
687
+ * // Imports using ES Module built
688
+ * import { ContainerModule, isResponseOk } from '@grabjs/superapp-sdk';
689
+ * // Imports using UMD built (via CDN)
690
+ * const { ContainerModule, isResponseOk } = window.SuperAppSDK;
691
+ *
692
+ * // Initialize the container module
693
+ * const containerModule = new ContainerModule();
694
+ *
695
+ * // Show refresh button
696
+ * try {
697
+ * const response = await containerModule.showRefreshButton();
698
+ *
699
+ * if (isResponseOk(response)) {
700
+ * console.log('Refresh button shown successfully');
701
+ * }
702
+ * } catch (error) {
703
+ * console.log('Unexpected error:', error);
704
+ * }
705
+ * ```
706
+ *
707
+ * @public
708
+ */
709
+ showRefreshButton(): Promise<ShowRefreshButtonResponse>;
710
+ /**
711
+ * Close the container and return to the previous screen.
712
+ *
713
+ * @returns A promise that resolves to a `200` status code when the container closes.
714
+ *
715
+ * @throws Error when the JSBridge method fails unexpectedly.
716
+ *
717
+ * @example
718
+ * **Simple usage**
719
+ * ```typescript
720
+ * // Imports using ES Module built
721
+ * import { ContainerModule, isResponseOk } from '@grabjs/superapp-sdk';
722
+ * // Imports using UMD built (via CDN)
723
+ * const { ContainerModule, isResponseOk } = window.SuperAppSDK;
724
+ *
725
+ * // Initialize the container module
726
+ * const containerModule = new ContainerModule();
727
+ *
728
+ * // Close the container
729
+ * try {
730
+ * const response = await containerModule.close();
731
+ *
732
+ * if (isResponseOk(response)) {
733
+ * console.log('Container closed successfully');
734
+ * }
735
+ * } catch (error) {
736
+ * console.log('Unexpected error:', error);
737
+ * }
738
+ * ```
739
+ *
740
+ * @public
741
+ */
742
+ close(): Promise<CloseResponse>;
743
+ /**
744
+ * Notify the Grab SuperApp that the page content has loaded.
745
+ *
746
+ * @returns A promise that resolves to a `200` status code when the notification is sent.
747
+ *
748
+ * @throws Error when the JSBridge method fails unexpectedly.
749
+ *
750
+ * @example
751
+ * **Simple usage**
752
+ * ```typescript
753
+ * // Imports using ES Module built
754
+ * import { ContainerModule, isResponseOk } from '@grabjs/superapp-sdk';
755
+ * // Imports using UMD built (via CDN)
756
+ * const { ContainerModule, isResponseOk } = window.SuperAppSDK;
757
+ *
758
+ * // Initialize the container module
759
+ * const containerModule = new ContainerModule();
760
+ *
761
+ * // Notify content loaded
762
+ * try {
763
+ * const response = await containerModule.onContentLoaded();
764
+ *
765
+ * if (isResponseOk(response)) {
766
+ * console.log('Content loaded notification sent successfully');
767
+ * }
768
+ * } catch (error) {
769
+ * console.log('Unexpected error:', error);
770
+ * }
771
+ * ```
772
+ *
773
+ * @public
774
+ */
775
+ onContentLoaded(): Promise<OnContentLoadedResponse>;
776
+ /**
777
+ * Show the full-screen loading indicator.
778
+ *
779
+ * @remarks
780
+ * Remember to call {@link ContainerModule.hideLoader} when the operation completes.
781
+ *
782
+ * @returns A promise that resolves to a `200` status code when the loading indicator is displayed.
783
+ *
784
+ * @throws Error when the JSBridge method fails unexpectedly.
785
+ *
786
+ * @example
787
+ * **Simple usage**
788
+ * ```typescript
789
+ * // Imports using ES Module built
790
+ * import { ContainerModule, isResponseOk } from '@grabjs/superapp-sdk';
791
+ * // Imports using UMD built (via CDN)
792
+ * const { ContainerModule, isResponseOk } = window.SuperAppSDK;
793
+ *
794
+ * // Initialize the container module
795
+ * const containerModule = new ContainerModule();
796
+ *
797
+ * // Show loader
798
+ * try {
799
+ * const response = await containerModule.showLoader();
800
+ *
801
+ * if (isResponseOk(response)) {
802
+ * console.log('Loader shown successfully');
803
+ * }
804
+ * } catch (error) {
805
+ * console.log('Unexpected error:', error);
806
+ * }
807
+ * ```
808
+ *
809
+ * @public
810
+ */
811
+ showLoader(): Promise<ShowLoaderResponse>;
812
+ /**
813
+ * Hide the full-screen loading indicator.
814
+ *
815
+ * @remarks
816
+ * Should be called when the entry point has finished loading.
817
+ *
818
+ * @returns A promise that resolves to a `200` status code when the loading indicator is hidden.
819
+ *
820
+ * @throws Error when the JSBridge method fails unexpectedly.
821
+ *
822
+ * @example
823
+ * **Simple usage**
824
+ * ```typescript
825
+ * // Imports using ES Module built
826
+ * import { ContainerModule, isResponseOk } from '@grabjs/superapp-sdk';
827
+ * // Imports using UMD built (via CDN)
828
+ * const { ContainerModule, isResponseOk } = window.SuperAppSDK;
829
+ *
830
+ * // Initialize the container module
831
+ * const containerModule = new ContainerModule();
832
+ *
833
+ * // Hide loader
834
+ * try {
835
+ * const response = await containerModule.hideLoader();
836
+ *
837
+ * if (isResponseOk(response)) {
838
+ * console.log('Loader hidden successfully');
839
+ * }
840
+ * } catch (error) {
841
+ * console.log('Unexpected error:', error);
842
+ * }
843
+ * ```
844
+ *
845
+ * @public
846
+ */
847
+ hideLoader(): Promise<HideLoaderResponse>;
848
+ /**
849
+ * Open a link in the external browser.
850
+ *
851
+ * @remarks
852
+ * Call this method to open the specified URL in an external browser (outside of the Grab app).
853
+ *
854
+ * @param request - The URL configuration.
855
+ *
856
+ * @returns A promise that resolves to a response with one of the following possible status codes:
857
+ * - `200`: External link opened successfully
858
+ * - `400`: URL parameter not found
859
+ *
860
+ * @throws Error when the JSBridge method fails unexpectedly.
861
+ *
862
+ * @example
863
+ * **Simple usage**
864
+ * ```typescript
865
+ * // Imports using ES Module built
866
+ * import { ContainerModule, isResponseOk, isResponseError } from '@grabjs/superapp-sdk';
867
+ * // Imports using UMD built (via CDN)
868
+ * const { ContainerModule, isResponseOk, isResponseError } = window.SuperAppSDK;
869
+ *
870
+ * // Initialize the container module
871
+ * const containerModule = new ContainerModule();
872
+ *
873
+ * // Open external link
874
+ * try {
875
+ * const response = await containerModule.openExternalLink('https://grab.com');
876
+ *
877
+ * if (isResponseError(response)) {
878
+ * console.log('Could not open external link:', response.error);
879
+ * } else if (isResponseOk(response)) {
880
+ * console.log('External link opened successfully');
881
+ * }
882
+ * } catch (error) {
883
+ * console.log('Unexpected error:', error);
884
+ * }
885
+ * ```
886
+ *
887
+ * @public
888
+ */
889
+ openExternalLink(request: OpenExternalLinkRequest): Promise<OpenExternalLinkResponse>;
890
+ /**
891
+ * Notify the client that the user has tapped a call-to-action (CTA).
892
+ *
893
+ * @param request - The CTA action configuration.
894
+ *
895
+ * @returns A promise that resolves to a `200` response when the CTA tap notification is sent.
896
+ *
897
+ * @throws Error when the JSBridge method fails unexpectedly.
898
+ *
899
+ * @example
900
+ * **Simple usage**
901
+ * ```typescript
902
+ * // Imports using ES Module built
903
+ * import { ContainerModule, isResponseOk } from '@grabjs/superapp-sdk';
904
+ * // Imports using UMD built (via CDN)
905
+ * const { ContainerModule, isResponseOk } = window.SuperAppSDK;
906
+ *
907
+ * // Initialize the container module
908
+ * const containerModule = new ContainerModule();
909
+ *
910
+ * // Notify CTA tap
911
+ * try {
912
+ * const response = await containerModule.onCtaTap('AV_LANDING_PAGE_CONTINUE');
913
+ *
914
+ * if (isResponseOk(response)) {
915
+ * console.log('CTA tap notified successfully');
916
+ * }
917
+ * } catch (error) {
918
+ * console.log('Unexpected error:', error);
919
+ * }
920
+ * ```
921
+ *
922
+ * @public
923
+ */
924
+ onCtaTap(request: OnCtaTapRequest): Promise<OnCtaTapResponse>;
925
+ /**
926
+ * Use this method to track user interactions and page transitions.
927
+ *
928
+ * @remarks
929
+ * You can use predefined constants to ensure consistency across the platform.
930
+ *
931
+ * **Predefined Values:**
932
+ * - **States:** {@link ContainerAnalyticsEventState}
933
+ * - **Names:** {@link ContainerAnalyticsEventName}
934
+ * - **Data Keys:** {@link ContainerAnalyticsEventData}
935
+ *
936
+ * @param request - The analytics event configuration.
937
+ *
938
+ * @returns A promise that resolves to a `200` response when the analytics event is sent.
939
+ *
940
+ * @throws Error when the JSBridge method fails unexpectedly.
941
+ *
942
+ * @see {@link ContainerAnalyticsEventState}, {@link ContainerAnalyticsEventName}, {@link ContainerAnalyticsEventData}
943
+ *
944
+ * @example
945
+ * **Simple usage**
946
+ * ```typescript
947
+ * // Imports using ES Module built
948
+ * import {
949
+ * ContainerModule,
950
+ * ContainerAnalyticsEventState,
951
+ * ContainerAnalyticsEventName,
952
+ * isResponseOk
953
+ * } from '@grabjs/superapp-sdk';
954
+ * // Imports using UMD built (via CDN)
955
+ * const {
956
+ * ContainerModule,
957
+ * ContainerAnalyticsEventState,
958
+ * ContainerAnalyticsEventName,
959
+ * isResponseOk
960
+ * } = window.SuperAppSDK;
961
+ *
962
+ * // Initialize the container module
963
+ * const containerModule = new ContainerModule();
964
+ *
965
+ * // Send analytics event
966
+ * try {
967
+ * const response = await containerModule.sendAnalyticsEvent({
968
+ * state: ContainerAnalyticsEventState.HOMEPAGE,
969
+ * name: ContainerAnalyticsEventName.DEFAULT,
970
+ * });
971
+ *
972
+ * if (isResponseOk(response)) {
973
+ * console.log('Analytics event sent successfully');
974
+ * }
975
+ * } catch (error) {
976
+ * console.log('Unexpected error:', error);
977
+ * }
978
+ * ```
979
+ *
980
+ * @public
981
+ */
982
+ sendAnalyticsEvent(request: SendAnalyticsEventRequest): Promise<SendAnalyticsEventResponse>;
983
+ /**
984
+ * Check if the web app is connected to the Grab SuperApp via JSBridge.
985
+ *
986
+ * @remarks
987
+ * Call this method to verify the connection status before using other features.
988
+ *
989
+ * @returns A promise that resolves to a response with one of the following possible status codes:
990
+ * - `200`: Connected to Grab SuperApp
991
+ * - `404`: Not connected to Grab SuperApp
992
+ *
993
+ * @throws Error when the JSBridge method fails unexpectedly.
994
+ *
995
+ * @example
996
+ * **Simple usage**
997
+ * ```typescript
998
+ * // Imports using ES Module built
999
+ * import { ContainerModule, isResponseOk, isResponseError } from '@grabjs/superapp-sdk';
1000
+ * // Imports using UMD built (via CDN)
1001
+ * const { ContainerModule, isResponseOk, isResponseError } = window.SuperAppSDK;
1002
+ *
1003
+ * // Initialize the container module
1004
+ * const containerModule = new ContainerModule();
1005
+ *
1006
+ * // Check connection status
1007
+ * try {
1008
+ * const response = await containerModule.isConnected();
1009
+ *
1010
+ * if (isResponseError(response)) {
1011
+ * console.log('Not connected to Grab SuperApp');
1012
+ * } else if (isResponseOk(response)) {
1013
+ * console.log('Connected to Grab SuperApp');
1014
+ * }
1015
+ * } catch (error) {
1016
+ * console.log('Unexpected error:', error);
1017
+ * }
1018
+ * ```
1019
+ *
1020
+ * @public
1021
+ */
1022
+ isConnected(): Promise<IsConnectedResponse>;
1023
+ /**
1024
+ * Get the session parameters from the container.
1025
+ *
1026
+ * @remarks
1027
+ * The native layer returns session parameters as a JSON string.
1028
+ * Parse with `JSON.parse(result.result)` to use as an object.
1029
+ * Session parameters can contain primitives, base64 encoded strings, or nested objects.
1030
+ *
1031
+ * @returns A promise that resolves to a `200` status code with session parameters.
1032
+ *
1033
+ * @throws Error when the JSBridge method fails unexpectedly.
1034
+ *
1035
+ * @example
1036
+ * **Simple usage**
1037
+ * ```typescript
1038
+ * // Imports using ES Module built
1039
+ * import { ContainerModule, isResponseOk } from '@grabjs/superapp-sdk';
1040
+ * // Imports using UMD built (via CDN)
1041
+ * const { ContainerModule, isResponseOk } = window.SuperAppSDK;
1042
+ *
1043
+ * // Initialize the container module
1044
+ * const containerModule = new ContainerModule();
1045
+ *
1046
+ * // Get session parameters
1047
+ * try {
1048
+ * const response = await containerModule.getSessionParams();
1049
+ *
1050
+ * if (isResponseOk(response)) {
1051
+ * const sessionParams = JSON.parse(response.result?.result || '{}');
1052
+ * console.log('Session params retrieved:', sessionParams);
1053
+ * }
1054
+ * } catch (error) {
1055
+ * console.log('Unexpected error:', error);
1056
+ * }
1057
+ * ```
1058
+ *
1059
+ * @public
1060
+ */
1061
+ getSessionParams(): Promise<GetSessionParamsResponse>;
1062
+ /**
1063
+ * Validate the analytics event details.
1064
+ *
1065
+ * @param request - Analytics event details to be validated.
1066
+ * @returns Error message if invalid, `null` if valid.
1067
+ * @internal
1068
+ */
1069
+ private validateAnalyticsEvent;
1070
+ }
1071
+
1072
+ /**
1073
+ * A stream for receiving continuous data from JSBridge methods (e.g., location updates).
1074
+ *
1075
+ * @remarks
1076
+ * Provides both Observable-like and Promise-like interfaces:
1077
+ * - Use `subscribe()` to receive all values over time
1078
+ * - Use `then()` or `await` to receive only the first value
1079
+ *
1080
+ * Note: Each `subscribe()` call creates a fresh subscription, allowing multiple independent listeners.
1081
+ *
1082
+ * @typeParam T - The type of data emitted by the stream.
1083
+ *
1084
+ * @public
1085
+ */
1086
+ export declare type DataStream<T> = Readonly<{
1087
+ /**
1088
+ * Subscribe to receive stream data.
1089
+ * @param handlers - Optional callbacks for data (`next`) and completion (`complete`).
1090
+ * @returns A `Subscription` to terminate the stream when needed.
1091
+ */
1092
+ subscribe: (handlers?: DataStreamHandlers<T>) => Subscription;
1093
+ }> & PromiseLike<BridgeResponse<T>>;
1094
+
1095
+ /**
1096
+ * Callbacks for handling stream events.
1097
+ *
1098
+ * @remarks
1099
+ * Pass these to `subscribe()` to receive data via `next` and completion via `complete`.
1100
+ *
1101
+ * @typeParam T - The type of data emitted by the stream.
1102
+ *
1103
+ * @public
1104
+ */
1105
+ export declare type DataStreamHandlers<T> = Readonly<{
1106
+ /** Called with each new value from the stream. */
1107
+ next?: (data: BridgeResponse<T>) => unknown;
1108
+ /** Called when the stream ends and no more data will arrive. */
1109
+ complete?: () => unknown;
1110
+ }>;
1111
+
1112
+ /**
1113
+ * DRM content configuration for playback.
1114
+ *
1115
+ * @remarks
1116
+ * Configuration object containing DRM license information, content URLs, and playback settings.
1117
+ * The exact structure depends on the DRM provider (e.g., FairPlay, Widevine).
1118
+ *
1119
+ * @public
1120
+ */
1121
+ export declare type DRMContentConfig = Record<string, unknown>;
1122
+
1123
+ /**
1124
+ * Result object for DRM playback events.
1125
+ *
1126
+ * @public
1127
+ */
1128
+ export declare type DRMPlaybackEvent = {
1129
+ /** The type of playback event (e.g., 'started', 'paused', 'ended', 'error'). */
1130
+ eventType: string;
1131
+ /** Additional event data as key-value pairs. */
1132
+ data?: Record<string, unknown>;
1133
+ };
1134
+
1135
+ /**
1136
+ * Response when fetching the user's email.
1137
+ *
1138
+ * @public
1139
+ */
1140
+ export declare type FetchEmailResponse = ConstrainedBridgeResponse<FetchEmailResult, 200 | 400 | 403>;
1141
+
1142
+ /**
1143
+ * Result object containing the user's email address.
1144
+ *
1145
+ * @public
1146
+ */
1147
+ export declare type FetchEmailResult = {
1148
+ /** The user's email address. */
1149
+ email: string;
1150
+ };
1151
+
1152
+ /**
1153
+ * Response when retrieving stored authorization artifacts.
1154
+ *
1155
+ * @public
1156
+ */
1157
+ export declare type GetAuthorizationArtifactsResponse = ConstrainedBridgeResponse<GetAuthorizationArtifactsResult, 200 | 204 | 400>;
1158
+
1159
+ /**
1160
+ * Result object containing the stored PKCE authorization artifacts.
1161
+ * These are used to complete the OAuth2 authorization code exchange.
1162
+ *
1163
+ * @public
1164
+ */
1165
+ export declare type GetAuthorizationArtifactsResult = {
1166
+ /** The state parameter used in the authorization request. */
1167
+ state: string;
1168
+ /** The code verifier for PKCE. */
1169
+ codeVerifier: string;
1170
+ /** The nonce used in the authorization request. */
1171
+ nonce: string;
1172
+ /** The redirect URI used in the authorization request. */
1173
+ redirectUri: string;
1174
+ } | null;
1175
+
1176
+ /**
1177
+ * Request parameters for getting a boolean value from storage.
1178
+ *
1179
+ * @public
1180
+ */
1181
+ export declare type GetBooleanRequest = {
1182
+ /** The key to retrieve the value for. */
1183
+ key: string;
1184
+ };
1185
+
1186
+ /**
1187
+ * Response when getting a boolean value.
1188
+ *
1189
+ * @public
1190
+ */
1191
+ export declare type GetBooleanResponse = ConstrainedBridgeResponse<boolean | null, 200 | 400>;
1192
+
1193
+ /**
1194
+ * Result object containing the boolean value.
1195
+ *
1196
+ * @public
1197
+ */
1198
+ export declare type GetBooleanResult = {
1199
+ /** The stored boolean value, or null if not found. */
1200
+ value: boolean | null;
1201
+ };
1202
+
1203
+ /**
1204
+ * Response when getting the device coordinates.
1205
+ *
1206
+ * @public
1207
+ */
1208
+ export declare type GetCoordinateResponse = ConstrainedBridgeResponse<GetCoordinateResult, 200 | 424>;
1209
+
1210
+ /**
1211
+ * Result object containing the geographic coordinates.
1212
+ *
1213
+ * @public
1214
+ */
1215
+ export declare type GetCoordinateResult = {
1216
+ /** Latitude in degrees */
1217
+ lat: number;
1218
+ /** Longitude in degrees */
1219
+ lng: number;
1220
+ };
1221
+
1222
+ /**
1223
+ * Response when getting the country code.
1224
+ *
1225
+ * @public
1226
+ */
1227
+ export declare type GetCountryCodeResponse = ConstrainedBridgeResponse<GetCountryCodeResult, 200 | 424>;
1228
+
1229
+ /**
1230
+ * Result object containing the country code.
1231
+ *
1232
+ * @public
1233
+ */
1234
+ export declare type GetCountryCodeResult = {
1235
+ /** ISO country code (e.g., "SG", "ID", "MY") */
1236
+ countryCode: string;
1237
+ };
1238
+
1239
+ /**
1240
+ * Request parameters for getting a double value from storage.
1241
+ *
1242
+ * @public
1243
+ */
1244
+ export declare type GetDoubleRequest = {
1245
+ /** The key to retrieve the value for. */
1246
+ key: string;
1247
+ };
1248
+
1249
+ /**
1250
+ * Response when getting a double value.
1251
+ *
1252
+ * @public
1253
+ */
1254
+ export declare type GetDoubleResponse = ConstrainedBridgeResponse<number | null, 200 | 400>;
1255
+
1256
+ /**
1257
+ * Result object containing the double value.
1258
+ *
1259
+ * @public
1260
+ */
1261
+ export declare type GetDoubleResult = {
1262
+ /** The stored double value, or null if not found. */
1263
+ value: number | null;
1264
+ };
1265
+
1266
+ /**
1267
+ * Request parameters for getting an integer value from storage.
1268
+ *
1269
+ * @public
1270
+ */
1271
+ export declare type GetIntRequest = {
1272
+ /** The key to retrieve the value for. */
1273
+ key: string;
1274
+ };
1275
+
1276
+ /**
1277
+ * Response when getting an integer value.
1278
+ *
1279
+ * @public
1280
+ */
1281
+ export declare type GetIntResponse = ConstrainedBridgeResponse<number | null, 200 | 400>;
1282
+
1283
+ /**
1284
+ * Result object containing the integer value.
1285
+ *
1286
+ * @public
1287
+ */
1288
+ export declare type GetIntResult = {
1289
+ /** The stored integer value, or null if not found. */
1290
+ value: number | null;
1291
+ };
1292
+
1293
+ /**
1294
+ * Response when getting the language locale identifier from the device.
1295
+ *
1296
+ * @remarks
1297
+ * The locale identifier is the language and region code of the device's language settings.
1298
+ * Examples:
1299
+ * - "en" (English),
1300
+ * - "id" (Indonesia),
1301
+ * - "zh" (Chinese),
1302
+ * - "ms" (Malaysia),
1303
+ * - "th" (Thai),
1304
+ * - "vi" (Vietnamese),
1305
+ * - "zg" (Burmese Zawgyi),
1306
+ * - "my" (Burmese Unicode),
1307
+ * - "km" (Khmer)
1308
+ *
1309
+ * @public
1310
+ */
1311
+ export declare type GetLanguageLocaleIdentifierResponse = ConstrainedBridgeResponse<string, 200>;
1312
+
1313
+ /**
1314
+ * Response when getting session parameters.
1315
+ *
1316
+ * @public
1317
+ */
1318
+ export declare type GetSessionParamsResponse = ConstrainedBridgeResponse<GetSessionParamsResult, 200>;
1319
+
1320
+ /**
1321
+ * Result object containing session parameters as a JSON string.
1322
+ *
1323
+ * @remarks
1324
+ * The `result` field contains a JSON string that must be parsed with `JSON.parse()` to use as an object.
1325
+ * Session parameters can contain primitives, base64 encoded strings, or nested objects depending on the
1326
+ * SuperApp's configuration.
1327
+ *
1328
+ * @public
1329
+ */
1330
+ export declare type GetSessionParamsResult = {
1331
+ /** JSON string containing session parameters. */
1332
+ result: string;
1333
+ };
1334
+
1335
+ /**
1336
+ * Request parameters for getting a string value from storage.
1337
+ *
1338
+ * @public
1339
+ */
1340
+ export declare type GetStringRequest = {
1341
+ /** The key to retrieve the value for. */
1342
+ key: string;
1343
+ };
1344
+
1345
+ /**
1346
+ * Response when getting a string value.
1347
+ *
1348
+ * @public
1349
+ */
1350
+ export declare type GetStringResponse = ConstrainedBridgeResponse<string | null, 200 | 400>;
1351
+
1352
+ /**
1353
+ * Result object containing the string value.
1354
+ *
1355
+ * @public
1356
+ */
1357
+ export declare type GetStringResult = {
1358
+ /** The stored string value, or null if not found. */
1359
+ value: string | null;
1360
+ };
1361
+
1362
+ /**
1363
+ * Response when checking API access permissions.
1364
+ *
1365
+ * @public
1366
+ */
1367
+ export declare type HasAccessToResponse = ConstrainedBridgeResponse<HasAccessToResult, 200 | 400 | 424>;
1368
+
1369
+ /**
1370
+ * Result object containing the access check result.
1371
+ *
1372
+ * @public
1373
+ */
1374
+ export declare type HasAccessToResult = {
1375
+ /** True if the current client has access to the specified API, false otherwise. */
1376
+ hasAccess: boolean;
1377
+ };
1378
+
1379
+ /**
1380
+ * Response when hiding the back button.
1381
+ *
1382
+ * @public
1383
+ */
1384
+ export declare type HideBackButtonResponse = ConstrainedBridgeResponse<HideBackButtonResult, 200>;
1385
+
1386
+ /**
1387
+ * Result when hiding the back button.
1388
+ *
1389
+ * @public
1390
+ */
1391
+ export declare type HideBackButtonResult = void;
1392
+
1393
+ /**
1394
+ * Response when hiding the loader.
1395
+ *
1396
+ * @public
1397
+ */
1398
+ export declare type HideLoaderResponse = ConstrainedBridgeResponse<HideLoaderResult, 200>;
1399
+
1400
+ /**
1401
+ * Result when hiding the loader.
1402
+ *
1403
+ * @public
1404
+ */
1405
+ export declare type HideLoaderResult = void;
1406
+
1407
+ /**
1408
+ * Response when hiding the refresh button.
1409
+ *
1410
+ * @public
1411
+ */
1412
+ export declare type HideRefreshButtonResponse = ConstrainedBridgeResponse<HideRefreshButtonResult, 200>;
1413
+
1414
+ /**
1415
+ * Result when hiding the refresh button.
1416
+ *
1417
+ * @public
1418
+ */
1419
+ export declare type HideRefreshButtonResult = void;
1420
+
1421
+ /**
1422
+ * JSBridge module for authenticating users via GrabID.
1423
+ *
1424
+ * @group Modules
1425
+ *
1426
+ * @remarks
1427
+ * Handles OAuth2/OIDC authentication flows with PKCE support, enabling MiniApps to obtain user identity tokens.
1428
+ * Supports both native in-app consent and web-based fallback flows.
1429
+ * This code must run on the Grab SuperApp's webview to function correctly.
1430
+ *
1431
+ * @example
1432
+ * **ES Module:**
1433
+ * ```typescript
1434
+ * import { IdentityModule } from '@grabjs/superapp-sdk';
1435
+ * const identity = new IdentityModule();
1436
+ * ```
1437
+ *
1438
+ * @example
1439
+ * **CDN (UMD):**
1440
+ * ```html
1441
+ * <script src="https://cdn.jsdelivr.net/npm/@grabjs/superapp-sdk/dist/index.js"></script>
1442
+ * <script>
1443
+ * const identity = new SuperAppSDK.IdentityModule();
1444
+ * </script>
1445
+ * ```
1446
+ *
1447
+ * @public
1448
+ */
1449
+ export declare class IdentityModule extends BaseModule {
1450
+ constructor();
1451
+ get NAMESPACE(): string;
1452
+ get CODE_CHALLENGE_METHOD(): string;
1453
+ get NONCE_LENGTH(): number;
1454
+ get STATE_LENGTH(): number;
1455
+ get CODE_VERIFIER_LENGTH(): number;
1456
+ get OPENID_CONFIG_ENDPOINTS(): {
1457
+ staging: string;
1458
+ production: string;
1459
+ };
1460
+ /**
1461
+ * Fetches the authorization endpoint URL from the OpenID configuration.
1462
+ *
1463
+ * @param environment - The environment to fetch configuration for ('staging' or 'production').
1464
+ * @returns The authorization endpoint URL.
1465
+ * @throws Error when the environment is invalid or the configuration cannot be fetched.
1466
+ *
1467
+ * @internal
1468
+ */
1469
+ fetchAuthorizationEndpoint(environment: any): Promise<any>;
1470
+ static generateRandomString(length: any): string;
1471
+ static base64URLEncode(str: any): any;
1472
+ static generateCodeVerifier(len: any): any;
1473
+ static generateCodeChallenge(codeVerifier: any): any;
1474
+ /**
1475
+ * Generates PKCE (Proof Key for Code Exchange) artifacts for the OAuth2 authorization flow.
1476
+ *
1477
+ * @returns An object containing the nonce, state, code verifier, code challenge, and code challenge method.
1478
+ *
1479
+ * @internal
1480
+ */
1481
+ generatePKCEArtifacts(): {
1482
+ nonce: string;
1483
+ state: string;
1484
+ codeVerifier: any;
1485
+ codeChallenge: any;
1486
+ codeChallengeMethod: string;
1487
+ };
1488
+ /**
1489
+ * Stores PKCE artifacts in local storage for later retrieval during token exchange.
1490
+ *
1491
+ * @param artifacts - The PKCE artifacts to store, including nonce, state, code verifier, and redirect URI.
1492
+ *
1493
+ * @internal
1494
+ */
1495
+ storePKCEArtifacts(artifacts: any): void;
1496
+ /**
1497
+ * Retrieves stored PKCE authorization artifacts from local storage.
1498
+ * These artifacts are used to complete the OAuth2 authorization code exchange.
1499
+ *
1500
+ * @returns A promise that resolves to a response with one of the following possible status codes:
1501
+ * - `200`: All artifacts present - proceed with token exchange
1502
+ * - `204`: No artifacts yet - user hasn't authorized
1503
+ * - `400`: Inconsistent state - possible data corruption
1504
+ *
1505
+ * @remarks
1506
+ * **Important:** The `redirectUri` returned by this method is the actual redirect URI
1507
+ * that was sent to the authorization server. This may differ from the `redirectUri`
1508
+ * you provided to `authorize()` if you used `responseMode: 'in_place'` with native flow.
1509
+ * You must use this returned `redirectUri` for token exchange to ensure OAuth compliance.
1510
+ *
1511
+ * @example
1512
+ * **Simple usage**
1513
+ * ```typescript
1514
+ * // Imports using ES Module built
1515
+ * import { IdentityModule, isResponseOk, isResponseNoContent, isResponseError } from '@grabjs/superapp-sdk';
1516
+ * // Imports using UMD built (via CDN)
1517
+ * const { IdentityModule, isResponseOk, isResponseNoContent, isResponseError } = window.SuperAppSDK;
1518
+ *
1519
+ * // Initialize the identity module
1520
+ * const identityModule = new IdentityModule();
1521
+ *
1522
+ * // Retrieve stored authorization artifacts after authorization redirect
1523
+ * try {
1524
+ * const response = await identityModule.getAuthorizationArtifacts();
1525
+ *
1526
+ * if (isResponseError(response)) {
1527
+ * // Inconsistent state - possible data corruption
1528
+ * console.error('Authorization artifacts error:', response.error);
1529
+ * } else if (isResponseOk(response)) {
1530
+ * // All artifacts present - proceed with token exchange
1531
+ * const { state, codeVerifier, nonce, redirectUri } = response.result;
1532
+ * console.log('State:', state);
1533
+ * console.log('Code Verifier:', codeVerifier);
1534
+ * console.log('Nonce:', nonce);
1535
+ * console.log('Redirect URI:', redirectUri);
1536
+ * } else if (isResponseNoContent(response)) {
1537
+ * // No artifacts yet - user hasn't authorized
1538
+ * console.log('No authorization artifacts found. Authorization has not been initiated.');
1539
+ * }
1540
+ * } catch (error) {
1541
+ * console.log('Unexpected error:', error);
1542
+ * }
1543
+ * ```
1544
+ *
1545
+ * @public
1546
+ */
1547
+ getAuthorizationArtifacts(): Promise<GetAuthorizationArtifactsResponse>;
1548
+ /**
1549
+ * Clears all stored PKCE authorization artifacts from local storage.
1550
+ * This should be called after a successful token exchange or when you need to
1551
+ * reset the authorization state (e.g., on error or logout).
1552
+ *
1553
+ * @returns A promise that resolves to a `204` status code when artifacts are cleared.
1554
+ *
1555
+ * @example
1556
+ * **Simple usage**
1557
+ * ```typescript
1558
+ * // Imports using ES Module built
1559
+ * import { IdentityModule, isResponseNoContent } from '@grabjs/superapp-sdk';
1560
+ * // Imports using UMD built (via CDN)
1561
+ * const { IdentityModule, isResponseNoContent } = window.SuperAppSDK;
1562
+ *
1563
+ * // Initialize the identity module
1564
+ * const identityModule = new IdentityModule();
1565
+ *
1566
+ * // Clear stored authorization artifacts after successful token exchange
1567
+ * try {
1568
+ * const response = await identityModule.clearAuthorizationArtifacts();
1569
+ *
1570
+ * if (isResponseNoContent(response)) {
1571
+ * console.log('Authorization artifacts cleared');
1572
+ * }
1573
+ * } catch (error) {
1574
+ * console.log('Unexpected error:', error);
1575
+ * }
1576
+ * ```
1577
+ *
1578
+ * @public
1579
+ */
1580
+ clearAuthorizationArtifacts(): Promise<ClearAuthorizationArtifactsResponse>;
1581
+ /**
1582
+ * Stores a value in local storage with the GrabID namespace prefix.
1583
+ *
1584
+ * @param key - The storage key (without namespace prefix).
1585
+ * @param value - The value to store.
1586
+ *
1587
+ * @internal
1588
+ */
1589
+ setStorageItem(key: any, value: any): void;
1590
+ /**
1591
+ * Retrieves a value from local storage with the GrabID namespace prefix.
1592
+ *
1593
+ * @param key - The storage key (without namespace prefix).
1594
+ * @returns The stored value or null if not found.
1595
+ *
1596
+ * @internal
1597
+ */
1598
+ getStorageItem(key: any): string;
1599
+ static normalizeUrl(urlString: any): string;
1600
+ static buildAuthorizeUrl(authorizationEndpoint: any, requestMap: any): string;
1601
+ static shouldUseWebConsent(request: any): boolean;
1602
+ /**
1603
+ * Performs web-based OAuth2 authorization by redirecting to the authorization server.
1604
+ *
1605
+ * @param params - The authorization parameters including client ID, redirect URI, scope, and PKCE artifacts.
1606
+ * @returns A promise that resolves to a 302 redirect response or a 400 error response.
1607
+ *
1608
+ * @internal
1609
+ */
1610
+ performWebAuthorization(params: any): Promise<AuthorizeResponse>;
1611
+ /**
1612
+ * Performs native in-app OAuth2 authorization using the JSBridge.
1613
+ *
1614
+ * @param invokeParams - The authorization parameters including client ID, redirect URI, scope, and PKCE artifacts.
1615
+ * @returns A promise that resolves to the native authorization response.
1616
+ *
1617
+ * @internal
1618
+ */
1619
+ performNativeAuthorization(invokeParams: any): Promise<AuthorizeResponse>;
1620
+ /**
1621
+ * Initiates an OAuth2 authorization flow with PKCE (Proof Key for Code Exchange).
1622
+ * This method handles both native in-app consent and web-based fallback flows.
1623
+ *
1624
+ * @param request - The authorization request parameters including client ID, redirect URI,
1625
+ * scopes, and environment.
1626
+ *
1627
+ * @returns A promise that resolves to a response with one of the following possible status codes:
1628
+ * - `200`: Authorization completed successfully (native in_place flow)
1629
+ * - `302`: Redirect in progress (web redirect flow). The page will
1630
+ * be redirected to the authorization URL. This response has no result data.
1631
+ * - `400`: Missing required OAuth parameters, redirect mismatch, or no webview URL
1632
+ *
1633
+ * @throws Error when the JSBridge method fails unexpectedly.
1634
+ *
1635
+ * @remarks
1636
+ * **Important Note on redirectUri and responseMode:**
1637
+ *
1638
+ * The actual `redirectUri` used during authorization may differ from the one you provide,
1639
+ * depending on the flow:
1640
+ *
1641
+ * - `responseMode: 'in_place'` when native flow is available: Uses the current page URL
1642
+ * (normalized) as the `redirectUri`, overriding your provided value
1643
+ * - `responseMode: 'in_place'` falling back to web flow if native flow is not available:
1644
+ * Uses your provided `redirectUri`
1645
+ * - `responseMode: 'redirect'`: Always uses your provided `redirectUri`
1646
+ *
1647
+ * To ensure successful token exchange (which requires matching `redirectUri` values),
1648
+ * always retrieve the actual `redirectUri` from `getAuthorizationArtifacts()`
1649
+ * after authorization completes.
1650
+ *
1651
+ * **Consent Selection Rules (Native vs Web):**
1652
+ *
1653
+ * - If the user agent does not match the Grab app pattern, the SDK uses web consent
1654
+ * - If the app version in the user agent is below 5.396.0 (iOS or Android),
1655
+ * the SDK uses web consent
1656
+ * - For supported versions, the SDK attempts native consent first and falls back to
1657
+ * web on specific native errors (400, 401, 403)
1658
+ *
1659
+ * @example
1660
+ * **Simple usage**
1661
+ * ```typescript
1662
+ * // Imports using ES Module built
1663
+ * import { IdentityModule, isResponseOk, isResponseError, isResponseRedirect } from '@grabjs/superapp-sdk';
1664
+ * // Imports using UMD built (via CDN)
1665
+ * const { IdentityModule, isResponseOk, isResponseError, isResponseRedirect } = window.SuperAppSDK;
1666
+ *
1667
+ * // Initialize the identity module
1668
+ * const identityModule = new IdentityModule();
1669
+ *
1670
+ * // Initiate authorization with redirect mode
1671
+ * try {
1672
+ * const response = await identityModule.authorize({
1673
+ * clientId: 'your-client-id',
1674
+ * redirectUri: 'https://your-app.com/callback',
1675
+ * scope: 'openid profile',
1676
+ * environment: 'production',
1677
+ * responseMode: 'redirect'
1678
+ * });
1679
+ *
1680
+ * if (isResponseError(response)) {
1681
+ * // Authorization failed
1682
+ * console.error('Auth error:', response.error);
1683
+ * } else if (isResponseOk(response)) {
1684
+ * // Authorization successful (in_place mode with native flow)
1685
+ * console.log('Auth Code:', response.result.code);
1686
+ * console.log('State:', response.result.state);
1687
+ * } else if (isResponseRedirect(response)) {
1688
+ * // Redirect in progress (web flow with responseMode: 'redirect')
1689
+ * // The page will be redirected to the authorization URL
1690
+ * console.log('Redirecting to authorization...');
1691
+ * }
1692
+ * } catch (error) {
1693
+ * console.log('Unexpected error:', error);
1694
+ * }
1695
+ * ```
1696
+ *
1697
+ * @public
1698
+ */
1699
+ authorize(request: AuthorizeRequest): Promise<AuthorizeResponse>;
1700
+ static validateRequiredString(value: any, fieldName: any): string;
1701
+ static validateAuthorizeRequest(request: any): string;
1702
+ }
1703
+
1704
+ /**
1705
+ * Response when checking connection status.
1706
+ *
1707
+ * @public
1708
+ */
1709
+ export declare type IsConnectedResponse = ConstrainedBridgeResponse<IsConnectedResult, 200 | 404>;
1710
+
1711
+ /**
1712
+ * Result object containing the connection status.
1713
+ *
1714
+ * @public
1715
+ */
1716
+ export declare type IsConnectedResult = {
1717
+ /** Whether the MiniApp is connected to the Grab SuperApp. */
1718
+ connected: boolean;
1719
+ };
1720
+
1721
+ /**
1722
+ * Type guard that checks if the response is a bad request error (status code 400).
1723
+ * Narrows the type to BridgeErrorResponse400.
1724
+ *
1725
+ * @example
1726
+ * ```typescript
1727
+ * const response = await cameraModule.scanQRCode(request);
1728
+ * if (isResponseBadRequest(response)) {
1729
+ * console.log('Bad request:', response.error);
1730
+ * }
1731
+ * ```
1732
+ *
1733
+ * @public
1734
+ */
1735
+ export declare function isResponseBadRequest<T>(response: BridgeResponse<T>): response is BridgeStatusCode400Response;
1736
+
1737
+ /**
1738
+ * Type guard that checks if the response is a client error (status code 400, 403, 404, or 424).
1739
+ * Narrows the type to client error responses.
1740
+ *
1741
+ * @example
1742
+ * ```typescript
1743
+ * const response = await cameraModule.scanQRCode(request);
1744
+ * if (isResponseClientError(response)) {
1745
+ * console.log('Client error:', response.status_code, response.error);
1746
+ * }
1747
+ * ```
1748
+ *
1749
+ * @public
1750
+ */
1751
+ export declare function isResponseClientError<T>(response: BridgeResponse<T>): response is BridgeClientErrorResponse;
1752
+
1753
+ /**
1754
+ * Type guard that checks if the response is an error (status code 4xx or 5xx).
1755
+ * Narrows the type to BridgeErrorResponse, giving access to the error message.
1756
+ *
1757
+ * @example
1758
+ * ```typescript
1759
+ * const response = await cameraModule.scanQRCode(request);
1760
+ * if (isResponseError(response)) {
1761
+ * console.log('Error:', response.error);
1762
+ * }
1763
+ * ```
1764
+ *
1765
+ * @public
1766
+ */
1767
+ export declare function isResponseError<T>(response: BridgeResponse<T>): response is BridgeErrorResponse;
1768
+
1769
+ /**
1770
+ * Type guard that checks if the response is a failed dependency error (status code 424).
1771
+ * Narrows the type to BridgeErrorResponse424.
1772
+ *
1773
+ * @example
1774
+ * ```typescript
1775
+ * const response = await cameraModule.scanQRCode(request);
1776
+ * if (isResponseFailedDependency(response)) {
1777
+ * console.log('Failed dependency:', response.error);
1778
+ * }
1779
+ * ```
1780
+ *
1781
+ * @public
1782
+ */
1783
+ export declare function isResponseFailedDependency<T>(response: BridgeResponse<T>): response is BridgeStatusCode424Response;
1784
+
1785
+ /**
1786
+ * Type guard that checks if the response is a forbidden error (status code 403).
1787
+ * Narrows the type to BridgeErrorResponse403.
1788
+ *
1789
+ * @example
1790
+ * ```typescript
1791
+ * const response = await cameraModule.scanQRCode(request);
1792
+ * if (isResponseForbidden(response)) {
1793
+ * console.log('Forbidden:', response.error);
1794
+ * }
1795
+ * ```
1796
+ *
1797
+ * @public
1798
+ */
1799
+ export declare function isResponseForbidden<T>(response: BridgeResponse<T>): response is BridgeStatusCode403Response;
1800
+
1801
+ /**
1802
+ * Type guard that checks if the response is an internal server error (status code 500).
1803
+ * Narrows the type to BridgeErrorResponse500.
1804
+ *
1805
+ * @example
1806
+ * ```typescript
1807
+ * const response = await cameraModule.scanQRCode(request);
1808
+ * if (isResponseInternalServerError(response)) {
1809
+ * console.log('Internal server error:', response.error);
1810
+ * }
1811
+ * ```
1812
+ *
1813
+ * @public
1814
+ */
1815
+ export declare function isResponseInternalServerError<T>(response: BridgeResponse<T>): response is BridgeStatusCode500Response;
1816
+
1817
+ /**
1818
+ * Type guard that checks if the response has no content (status code 204).
1819
+ * This typically means the operation completed with no content to return.
1820
+ *
1821
+ * @example
1822
+ * ```typescript
1823
+ * const response = await cameraModule.scanQRCode(request);
1824
+ * if (isResponseNoContent(response)) {
1825
+ * console.log('No content available');
1826
+ * }
1827
+ * ```
1828
+ *
1829
+ * @public
1830
+ */
1831
+ export declare function isResponseNoContent<T>(response: BridgeResponse<T>): response is BridgeStatusCode204Response;
1832
+
1833
+ /**
1834
+ * Type guard that checks if the response is a not found error (status code 404).
1835
+ * Narrows the type to BridgeErrorResponse404.
1836
+ *
1837
+ * @example
1838
+ * ```typescript
1839
+ * const response = await cameraModule.scanQRCode(request);
1840
+ * if (isResponseNotFound(response)) {
1841
+ * console.log('Not found:', response.error);
1842
+ * }
1843
+ * ```
1844
+ *
1845
+ * @public
1846
+ */
1847
+ export declare function isResponseNotFound<T>(response: BridgeResponse<T>): response is BridgeStatusCode404Response;
1848
+
1849
+ /**
1850
+ * Type guard that checks if the response is OK (status code 200).
1851
+ * Narrows the type to BridgeSuccessResponse<T>, giving access to the result.
1852
+ *
1853
+ * @example
1854
+ * ```typescript
1855
+ * const response = await cameraModule.scanQRCode(request);
1856
+ * if (isResponseOk(response)) {
1857
+ * console.log('QR Code:', response.result.qrCode);
1858
+ * }
1859
+ * ```
1860
+ *
1861
+ * @public
1862
+ */
1863
+ export declare function isResponseOk<T>(response: BridgeResponse<T>): response is BridgeStatusCode200Response<T>;
1864
+
1865
+ /**
1866
+ * Type guard that checks if the response is a redirect (status code 302).
1867
+ * This typically means a redirect occurred.
1868
+ *
1869
+ * @example
1870
+ * ```typescript
1871
+ * const response = await someModule.someMethod(request);
1872
+ * if (isResponseRedirect(response)) {
1873
+ * console.log('Redirect occurred');
1874
+ * }
1875
+ * ```
1876
+ *
1877
+ * @public
1878
+ */
1879
+ export declare function isResponseRedirect<T>(response: BridgeResponse<T>): response is BridgeStatusCode302Response;
1880
+
1881
+ /**
1882
+ * Type guard that checks if the response is a server error (status code 500).
1883
+ * Narrows the type to server error response.
1884
+ *
1885
+ * @example
1886
+ * ```typescript
1887
+ * const response = await cameraModule.scanQRCode(request);
1888
+ * if (isResponseServerError(response)) {
1889
+ * console.log('Server error - retry later:', response.error);
1890
+ * }
1891
+ * ```
1892
+ *
1893
+ * @public
1894
+ */
1895
+ export declare function isResponseServerError<T>(response: BridgeResponse<T>): response is BridgeServerErrorResponse;
1896
+
1897
+ /**
1898
+ * Type guard that checks if the response is a success (status code 200 or 204).
1899
+ * Narrows the type to BridgeSuccessResponse<T> | BridgeNoResultResponse, excluding errors and redirects.
1900
+ *
1901
+ * @example
1902
+ * ```typescript
1903
+ * const response = await cameraModule.scanQRCode(request);
1904
+ * if (isResponseSuccess(response)) {
1905
+ * // Response is not an error, check isResponseOk() to access result
1906
+ * }
1907
+ * ```
1908
+ *
1909
+ * @public
1910
+ */
1911
+ export declare function isResponseSuccess<T>(response: BridgeResponse<T>): response is BridgeSuccessResponse<T>;
1912
+
1913
+ /**
1914
+ * JSBridge module for accessing device locale settings.
1915
+ *
1916
+ * @group Modules
1917
+ *
1918
+ * @remarks
1919
+ * Provides the user's preferred language and region settings from the native device.
1920
+ * This code must run on the Grab SuperApp's webview to function correctly.
1921
+ *
1922
+ * @example
1923
+ * **ES Module:**
1924
+ * ```typescript
1925
+ * import { LocaleModule } from '@grabjs/superapp-sdk';
1926
+ * const locale = new LocaleModule();
1927
+ * ```
1928
+ *
1929
+ * @example
1930
+ * **CDN (UMD):**
1931
+ * ```html
1932
+ * <script src="https://cdn.jsdelivr.net/npm/@grabjs/superapp-sdk/dist/index.js"></script>
1933
+ * <script>
1934
+ * const locale = new SuperAppSDK.LocaleModule();
1935
+ * </script>
1936
+ * ```
1937
+ *
1938
+ * @public
1939
+ */
1940
+ export declare class LocaleModule extends BaseModule {
1941
+ constructor();
1942
+ /**
1943
+ * Retrieves the current language locale identifier from the device.
1944
+ *
1945
+ * @returns A promise that resolves to a `200` status code with the locale identifier.
1946
+ *
1947
+ * @throws Error when the JSBridge method fails unexpectedly.
1948
+ *
1949
+ * @example
1950
+ * **Simple usage**
1951
+ * ```typescript
1952
+ * // Imports using ES Module built
1953
+ * import { LocaleModule, isResponseOk } from '@grabjs/superapp-sdk';
1954
+ * // Imports using UMD built (via CDN)
1955
+ * const { LocaleModule, isResponseOk } = window.SuperAppSDK;
1956
+ *
1957
+ * // Initialize the locale module
1958
+ * const localeModule = new LocaleModule();
1959
+ *
1960
+ * // Get the current locale
1961
+ * try {
1962
+ * const response = await localeModule.getLanguageLocaleIdentifier();
1963
+ *
1964
+ * if (isResponseOk(response)) {
1965
+ * console.log('Current locale:', response.result);
1966
+ * }
1967
+ * } catch (error) {
1968
+ * console.log('Unexpected error:', error);
1969
+ * }
1970
+ * ```
1971
+ *
1972
+ * @public
1973
+ */
1974
+ getLanguageLocaleIdentifier(): Promise<GetLanguageLocaleIdentifierResponse>;
1975
+ }
1976
+
1977
+ /**
1978
+ * JSBridge module for accessing device location services.
1979
+ *
1980
+ * @group Modules
1981
+ *
1982
+ * @remarks
1983
+ * Provides access to the device's geolocation data including coordinates and country code.
1984
+ * This code must run on the Grab SuperApp's webview to function correctly.
1985
+ *
1986
+ * @example
1987
+ * **ES Module:**
1988
+ * ```typescript
1989
+ * import { LocationModule } from '@grabjs/superapp-sdk';
1990
+ * const location = new LocationModule();
1991
+ * ```
1992
+ *
1993
+ * @example
1994
+ * **CDN (UMD):**
1995
+ * ```html
1996
+ * <script src="https://cdn.jsdelivr.net/npm/@grabjs/superapp-sdk/dist/index.js"></script>
1997
+ * <script>
1998
+ * const location = new SuperAppSDK.LocationModule();
1999
+ * </script>
2000
+ * ```
2001
+ *
2002
+ * @public
2003
+ */
2004
+ export declare class LocationModule extends BaseModule {
2005
+ constructor();
2006
+ /**
2007
+ * Get the current geographic coordinates of the device.
2008
+ *
2009
+ * @returns A promise that resolves to a response with one of the following possible status codes:
2010
+ * - `200`: Coordinates retrieved successfully
2011
+ * - `424`: GeoKit error
2012
+ *
2013
+ * @throws Error when the JSBridge method fails unexpectedly.
2014
+ *
2015
+ * @example
2016
+ * **Simple usage**
2017
+ * ```typescript
2018
+ * // Imports using ES Module built
2019
+ * import { LocationModule, isResponseOk, isResponseError } from '@grabjs/superapp-sdk';
2020
+ * // Imports using UMD built (via CDN)
2021
+ * const { LocationModule, isResponseOk, isResponseError } = window.SuperAppSDK;
2022
+ *
2023
+ * // Initialize the location module
2024
+ * const locationModule = new LocationModule();
2025
+ *
2026
+ * // Get current coordinates
2027
+ * try {
2028
+ * const response = await locationModule.getCoordinate();
2029
+ *
2030
+ * if (isResponseError(response)) {
2031
+ * console.log('Could not get coordinates:', response.error);
2032
+ * } else if (isResponseOk(response)) {
2033
+ * console.log('Coordinates:', response.result.lat, response.result.lng);
2034
+ * }
2035
+ * } catch (error) {
2036
+ * console.log('Unexpected error:', error);
2037
+ * }
2038
+ * ```
2039
+ *
2040
+ * @public
2041
+ */
2042
+ getCoordinate(): Promise<GetCoordinateResponse>;
2043
+ /**
2044
+ * Subscribe to location change updates from the device.
2045
+ *
2046
+ * @returns A `DataStream` that emits location updates as the device location changes.
2047
+ * Use `subscribe()` to listen for updates, or `await` to get the first value only.
2048
+ *
2049
+ * @throws Error when the JSBridge method fails unexpectedly.
2050
+ *
2051
+ * @example
2052
+ * **Simple usage**
2053
+ * ```typescript
2054
+ * // Imports using ES Module built
2055
+ * import { LocationModule, isResponseOk } from '@grabjs/superapp-sdk';
2056
+ * // Imports using UMD built (via CDN)
2057
+ * const { LocationModule, isResponseOk } = window.SuperAppSDK;
2058
+ *
2059
+ * // Initialize the location module
2060
+ * const locationModule = new LocationModule();
2061
+ *
2062
+ * // Subscribe to location changes
2063
+ * const subscription = locationModule.observeLocationChange().subscribe({
2064
+ * next: (response) => {
2065
+ * if (isResponseOk(response)) {
2066
+ * console.log('Location updated:', response.result.lat, response.result.lng);
2067
+ * }
2068
+ * },
2069
+ * complete: () => console.log('Location stream completed')
2070
+ * });
2071
+ *
2072
+ * // Later, to stop receiving updates:
2073
+ * subscription.unsubscribe();
2074
+ * ```
2075
+ *
2076
+ * @public
2077
+ */
2078
+ observeLocationChange(): ObserveLocationChangeResponse;
2079
+ /**
2080
+ * Get the country code based on the device's current location.
2081
+ *
2082
+ * @returns A promise that resolves to a response with one of the following possible status codes:
2083
+ * - `200`: Country code retrieved successfully
2084
+ * - `424`: GeoKit/Resolver error
2085
+ *
2086
+ * @throws Error when the JSBridge method fails unexpectedly.
2087
+ *
2088
+ * @example
2089
+ * **Simple usage**
2090
+ * ```typescript
2091
+ * // Imports using ES Module built
2092
+ * import { LocationModule, isResponseOk, isResponseError } from '@grabjs/superapp-sdk';
2093
+ * // Imports using UMD built (via CDN)
2094
+ * const { LocationModule, isResponseOk, isResponseError } = window.SuperAppSDK;
2095
+ *
2096
+ * // Initialize the location module
2097
+ * const locationModule = new LocationModule();
2098
+ *
2099
+ * // Get country code
2100
+ * try {
2101
+ * const response = await locationModule.getCountryCode();
2102
+ *
2103
+ * if (isResponseError(response)) {
2104
+ * console.log('Could not get country code:', response.error);
2105
+ * } else if (isResponseOk(response)) {
2106
+ * console.log('Country code:', response.result.countryCode);
2107
+ * }
2108
+ * } catch (error) {
2109
+ * console.log('Unexpected error:', error);
2110
+ * }
2111
+ * ```
2112
+ *
2113
+ * @public
2114
+ */
2115
+ getCountryCode(): Promise<GetCountryCodeResponse>;
2116
+ }
2117
+
2118
+ /**
2119
+ * JSBridge module for playing DRM-protected media content.
2120
+ *
2121
+ * @group Modules
2122
+ *
2123
+ * @remarks
2124
+ * Provides access to the native media player with DRM support for secure content playback.
2125
+ * This code must run on the Grab SuperApp's webview to function correctly.
2126
+ *
2127
+ * @example
2128
+ * **ES Module:**
2129
+ * ```typescript
2130
+ * import { MediaModule } from '@grabjs/superapp-sdk';
2131
+ * const media = new MediaModule();
2132
+ * ```
2133
+ *
2134
+ * @example
2135
+ * **CDN (UMD):**
2136
+ * ```html
2137
+ * <script src="https://cdn.jsdelivr.net/npm/@grabjs/superapp-sdk/dist/index.js"></script>
2138
+ * <script>
2139
+ * const media = new SuperAppSDK.MediaModule();
2140
+ * </script>
2141
+ * ```
2142
+ *
2143
+ * @public
2144
+ */
2145
+ export declare class MediaModule extends BaseModule {
2146
+ constructor();
2147
+ /**
2148
+ * Plays DRM-protected media content in the native media player.
2149
+ *
2150
+ * @param data - The DRM content configuration.
2151
+ *
2152
+ * @returns A promise that resolves to a response with one of the following possible status codes:
2153
+ * - `200`: Playback initiated (streaming)
2154
+ * - `204`: Invalid parameters
2155
+ *
2156
+ * @throws Error when the JSBridge method fails unexpectedly.
2157
+ *
2158
+ * @example
2159
+ * **Simple usage**
2160
+ * ```typescript
2161
+ * // Imports using ES Module built
2162
+ * import { MediaModule, isResponseOk, isResponseNoContent } from '@grabjs/superapp-sdk';
2163
+ * // Imports using UMD built (via CDN)
2164
+ * const { MediaModule, isResponseOk, isResponseNoContent } = window.SuperAppSDK;
2165
+ *
2166
+ * // Initialize the media module
2167
+ * const mediaModule = new MediaModule();
2168
+ *
2169
+ * // Play DRM content
2170
+ * try {
2171
+ * const response = await mediaModule.playDRMContent({
2172
+ * // DRM content configuration
2173
+ * });
2174
+ *
2175
+ * if (isResponseOk(response)) {
2176
+ * console.log('Playback initiated');
2177
+ * } else if (isResponseNoContent(response)) {
2178
+ * console.log('Invalid parameters');
2179
+ * }
2180
+ * } catch (error) {
2181
+ * console.log('Unexpected error:', error);
2182
+ * }
2183
+ * ```
2184
+ *
2185
+ * @public
2186
+ */
2187
+ playDRMContent(data: DRMContentConfig): Promise<PlayDRMContentResponse>;
2188
+ /**
2189
+ * Observes DRM-protected media content playback events.
2190
+ *
2191
+ * @param data - The DRM content configuration.
2192
+ *
2193
+ * @returns A `DataStream` that emits playback events as the media plays.
2194
+ * Emits `200` responses with video player events.
2195
+ * Use `subscribe()` to listen for events.
2196
+ *
2197
+ * @throws Error when the JSBridge method fails unexpectedly.
2198
+ *
2199
+ * @example
2200
+ * **Simple usage**
2201
+ * ```typescript
2202
+ * // Imports using ES Module built
2203
+ * import { MediaModule, isResponseOk } from '@grabjs/superapp-sdk';
2204
+ * // Imports using UMD built (via CDN)
2205
+ * const { MediaModule, isResponseOk } = window.SuperAppSDK;
2206
+ *
2207
+ * // Initialize the media module
2208
+ * const mediaModule = new MediaModule();
2209
+ *
2210
+ * // Observe DRM content playback
2211
+ * const subscription = mediaModule.observePlayDRMContent({
2212
+ * // DRM content configuration
2213
+ * }).subscribe({
2214
+ * next: (response) => {
2215
+ * if (isResponseOk(response)) {
2216
+ * console.log('Playback event:', response.result);
2217
+ * }
2218
+ * },
2219
+ * complete: () => console.log('Playback completed')
2220
+ * });
2221
+ *
2222
+ * // Later, to stop receiving events:
2223
+ * subscription.unsubscribe();
2224
+ * ```
2225
+ *
2226
+ * @public
2227
+ */
2228
+ observePlayDRMContent(data: DRMContentConfig): ObserveDRMPlaybackResponse;
2229
+ }
2230
+
2231
+ /**
2232
+ * Response stream for observing DRM playback events.
2233
+ *
2234
+ * @public
2235
+ */
2236
+ export declare type ObserveDRMPlaybackResponse = DataStream<DRMPlaybackEvent>;
2237
+
2238
+ /**
2239
+ * Response when observing the device coordinates.
2240
+ *
2241
+ * @public
2242
+ */
2243
+ export declare type ObserveLocationChangeResponse = DataStream_2<GetCoordinateResult>;
2244
+
2245
+ /**
2246
+ * Response when notifying content loaded.
2247
+ *
2248
+ * @public
2249
+ */
2250
+ export declare type OnContentLoadedResponse = ConstrainedBridgeResponse<OnContentLoadedResult, 200>;
2251
+
2252
+ /**
2253
+ * Result when notifying content loaded.
2254
+ *
2255
+ * @public
2256
+ */
2257
+ export declare type OnContentLoadedResult = void;
2258
+
2259
+ /**
2260
+ * Request parameters for notifying CTA tap.
2261
+ *
2262
+ * @public
2263
+ */
2264
+ export declare type OnCtaTapRequest = string;
2265
+
2266
+ /**
2267
+ * Response when notifying CTA tap.
2268
+ *
2269
+ * @public
2270
+ */
2271
+ export declare type OnCtaTapResponse = ConstrainedBridgeResponse<OnCtaTapResult, 200>;
2272
+
2273
+ /**
2274
+ * Result when notifying CTA tap.
2275
+ *
2276
+ * @public
2277
+ */
2278
+ export declare type OnCtaTapResult = void;
2279
+
2280
+ /**
2281
+ * Request parameters for opening an external link.
2282
+ *
2283
+ * @public
2284
+ */
2285
+ export declare type OpenExternalLinkRequest = string;
2286
+
2287
+ /**
2288
+ * Response when opening an external link.
2289
+ *
2290
+ * @public
2291
+ */
2292
+ export declare type OpenExternalLinkResponse = ConstrainedBridgeResponse<OpenExternalLinkResult, 200 | 400>;
2293
+
2294
+ /**
2295
+ * Result when opening an external link.
2296
+ *
2297
+ * @public
2298
+ */
2299
+ export declare type OpenExternalLinkResult = void;
2300
+
2301
+ /**
2302
+ * JSBridge module for controlling platform navigation.
2303
+ *
2304
+ * @group Modules
2305
+ *
2306
+ * @remarks
2307
+ * Provides methods to interact with the native platform navigation stack, such as triggering the back action.
2308
+ * This code must run on the Grab SuperApp's webview to function correctly.
2309
+ *
2310
+ * @example
2311
+ * **ES Module:**
2312
+ * ```typescript
2313
+ * import { PlatformModule } from '@grabjs/superapp-sdk';
2314
+ * const platform = new PlatformModule();
2315
+ * ```
2316
+ *
2317
+ * @example
2318
+ * **CDN (UMD):**
2319
+ * ```html
2320
+ * <script src="https://cdn.jsdelivr.net/npm/@grabjs/superapp-sdk/dist/index.js"></script>
2321
+ * <script>
2322
+ * const platform = new SuperAppSDK.PlatformModule();
2323
+ * </script>
2324
+ * ```
2325
+ *
2326
+ * @public
2327
+ */
2328
+ export declare class PlatformModule extends BaseModule {
2329
+ constructor();
2330
+ /**
2331
+ * Triggers the native platform back navigation.
2332
+ * This navigates back in the native navigation stack.
2333
+ *
2334
+ * @returns A promise that resolves to a `204` status code when back navigation is triggered.
2335
+ *
2336
+ * @throws Error when the JSBridge method fails unexpectedly.
2337
+ *
2338
+ * @example
2339
+ * **Simple usage**
2340
+ * ```typescript
2341
+ * // Imports using ES Module built
2342
+ * import { PlatformModule, isResponseNoContent } from '@grabjs/superapp-sdk';
2343
+ * // Imports using UMD built (via CDN)
2344
+ * const { PlatformModule, isResponseNoContent } = window.SuperAppSDK;
2345
+ *
2346
+ * // Initialize the platform module
2347
+ * const platformModule = new PlatformModule();
2348
+ *
2349
+ * // Trigger back navigation
2350
+ * try {
2351
+ * const response = await platformModule.back();
2352
+ *
2353
+ * if (isResponseNoContent(response)) {
2354
+ * console.log('Back navigation triggered');
2355
+ * }
2356
+ * } catch (error) {
2357
+ * console.log('Unexpected error:', error);
2358
+ * }
2359
+ * ```
2360
+ *
2361
+ * @public
2362
+ */
2363
+ back(): Promise<BridgeResponse<unknown>>;
2364
+ }
2365
+
2366
+ /**
2367
+ * Response when initiating DRM content playback.
2368
+ *
2369
+ * @public
2370
+ */
2371
+ export declare type PlayDRMContentResponse = ConstrainedBridgeResponse<PlayDRMContentResult, 200 | 204>;
2372
+
2373
+ /**
2374
+ * Result object for DRM content playback initiation.
2375
+ * This operation returns no data on success.
2376
+ *
2377
+ * @public
2378
+ */
2379
+ export declare type PlayDRMContentResult = void;
2380
+
2381
+ /**
2382
+ * JSBridge module for accessing user profile information.
2383
+ *
2384
+ * @group Modules
2385
+ *
2386
+ * @remarks
2387
+ * Provides access to user profile data such as email verification.
2388
+ * This code must run on the Grab SuperApp's webview to function correctly.
2389
+ *
2390
+ * @example
2391
+ * **ES Module:**
2392
+ * ```typescript
2393
+ * import { ProfileModule } from '@grabjs/superapp-sdk';
2394
+ * const profile = new ProfileModule();
2395
+ * ```
2396
+ *
2397
+ * @example
2398
+ * **CDN (UMD):**
2399
+ * ```html
2400
+ * <script src="https://cdn.jsdelivr.net/npm/@grabjs/superapp-sdk/dist/index.js"></script>
2401
+ * <script>
2402
+ * const profile = new SuperAppSDK.ProfileModule();
2403
+ * </script>
2404
+ * ```
2405
+ *
2406
+ * @public
2407
+ */
2408
+ export declare class ProfileModule extends BaseModule {
2409
+ constructor();
2410
+ static isSupported(): boolean;
2411
+ /**
2412
+ * Fetches the user's email address from their Grab profile.
2413
+ *
2414
+ * @returns A promise that resolves to a response with one of the following possible status codes:
2415
+ * - `200`: Email fetched successfully
2416
+ * - `400`: Invalid request
2417
+ * - `403`: Feature requires Grab app version 5.399 or above (returned client-side, not from JSBridge)
2418
+ *
2419
+ * @throws Error when the JSBridge method fails unexpectedly.
2420
+ *
2421
+ * @example
2422
+ * **Simple usage**
2423
+ * ```typescript
2424
+ * // Imports using ES Module built
2425
+ * import { ProfileModule, isResponseOk, isResponseError } from '@grabjs/superapp-sdk';
2426
+ * // Imports using UMD built (via CDN)
2427
+ * const { ProfileModule, isResponseOk, isResponseError } = window.SuperAppSDK;
2428
+ *
2429
+ * // Initialize the profile module
2430
+ * const profileModule = new ProfileModule();
2431
+ *
2432
+ * // Fetch the user's email
2433
+ * try {
2434
+ * const response = await profileModule.fetchEmail();
2435
+ *
2436
+ * if (isResponseError(response)) {
2437
+ * // Feature not available or other error
2438
+ * console.log('Could not fetch email:', response.error);
2439
+ * } else if (isResponseOk(response)) {
2440
+ * console.log('User email:', response.result.email);
2441
+ * }
2442
+ * } catch (err) {
2443
+ * console.log(`Could not fetch email${err ? `: ${err}` : ''}`);
2444
+ * }
2445
+ * ```
2446
+ *
2447
+ * @public
2448
+ */
2449
+ fetchEmail(): Promise<FetchEmailResponse>;
2450
+ /**
2451
+ * Verifies the user's email address using a one-time password (OTP).
2452
+ *
2453
+ * @param request - The email verification configuration.
2454
+ *
2455
+ * @returns A promise that resolves to a response with one of the following possible status codes:
2456
+ * - `200`: Email verified successfully
2457
+ * - `400`: Invalid request
2458
+ * - `403`: Feature requires Grab app version 5.399 or above (returned client-side, not from JSBridge)
2459
+ *
2460
+ * @throws Error when the JSBridge method fails unexpectedly.
2461
+ *
2462
+ * @example
2463
+ * **Simple usage**
2464
+ * ```typescript
2465
+ * // Imports using ES Module built
2466
+ * import { ProfileModule, isResponseOk, isResponseError } from '@grabjs/superapp-sdk';
2467
+ * // Imports using UMD built (via CDN)
2468
+ * const { ProfileModule, isResponseOk, isResponseError } = window.SuperAppSDK;
2469
+ *
2470
+ * // Initialize the profile module
2471
+ * const profileModule = new ProfileModule();
2472
+ *
2473
+ * // Verify email with OTP
2474
+ * try {
2475
+ * const response = await profileModule.verifyEmail({
2476
+ * email: 'user@example.com',
2477
+ * otp: '123456'
2478
+ * });
2479
+ *
2480
+ * if (isResponseError(response)) {
2481
+ * // Feature not available or other error
2482
+ * console.log('Could not verify email:', response.error);
2483
+ * } else if (isResponseOk(response)) {
2484
+ * console.log('Email verified successfully');
2485
+ * }
2486
+ * } catch (err) {
2487
+ * console.log(`Could not verify email${err ? `: ${err}` : ''}`);
2488
+ * }
2489
+ * ```
2490
+ *
2491
+ * @public
2492
+ */
2493
+ verifyEmail(request: VerifyEmailRequest): Promise<VerifyEmailResponse>;
2494
+ }
2495
+
2496
+ /**
2497
+ * Request parameters for redirecting to the system web view.
2498
+ *
2499
+ * @public
2500
+ */
2501
+ export declare type RedirectToSystemWebViewRequest = {
2502
+ /** The URL to open in the system web view. */
2503
+ url: string;
2504
+ };
2505
+
2506
+ /**
2507
+ * Response when redirecting to the system web view.
2508
+ *
2509
+ * @public
2510
+ */
2511
+ export declare type RedirectToSystemWebViewResponse = ConstrainedBridgeResponse<RedirectToSystemWebViewResult, 200 | 400 | 424>;
2512
+
2513
+ /**
2514
+ * Result object for redirecting to the system web view.
2515
+ * This operation returns no data on success.
2516
+ *
2517
+ * @public
2518
+ */
2519
+ export declare type RedirectToSystemWebViewResult = void;
2520
+
2521
+ /**
2522
+ * Response when reloading consented scopes.
2523
+ *
2524
+ * @public
2525
+ */
2526
+ export declare type ReloadScopesResponse = ConstrainedBridgeResponse<ReloadScopesResult, 200 | 424>;
2527
+
2528
+ /**
2529
+ * Result object for reloading scopes.
2530
+ * This operation returns no data on success.
2531
+ *
2532
+ * @public
2533
+ */
2534
+ export declare type ReloadScopesResult = void;
2535
+
2536
+ /**
2537
+ * Response when removing all values.
2538
+ *
2539
+ * @public
2540
+ */
2541
+ export declare type RemoveAllResponse = ConstrainedBridgeResponse<RemoveAllResult, 204>;
2542
+
2543
+ /**
2544
+ * Result object for removing all values.
2545
+ * This operation returns no data on success.
2546
+ *
2547
+ * @public
2548
+ */
2549
+ export declare type RemoveAllResult = void;
2550
+
2551
+ /**
2552
+ * Response when removing a value.
2553
+ *
2554
+ * @public
2555
+ */
2556
+ export declare type RemoveResponse = ConstrainedBridgeResponse<RemoveResult, 204 | 400>;
2557
+
2558
+ /**
2559
+ * Result object for removing a value.
2560
+ * This operation returns no data on success.
2561
+ *
2562
+ * @public
2563
+ */
2564
+ export declare type RemoveResult = void;
2565
+
2566
+ /**
2567
+ * Request parameters for scanning QR codes
2568
+ *
2569
+ * @public
2570
+ */
2571
+ export declare type ScanQRCodeRequest = {
2572
+ /** Optional title shown in the camera view header. */
2573
+ title?: string;
2574
+ };
2575
+
2576
+ /**
2577
+ * Response when scanning a QR code
2578
+ *
2579
+ * @public
2580
+ */
2581
+ export declare type ScanQRCodeResponse = ConstrainedBridgeResponse<ScanQRCodeResult, 200 | 204 | 400 | 403>;
2582
+
2583
+ /**
2584
+ * Result object containing the scanned QR code data
2585
+ *
2586
+ * @public
2587
+ */
2588
+ export declare type ScanQRCodeResult = {
2589
+ /** The raw string content decoded from the scanned QR code. */
2590
+ qrCode: string;
2591
+ };
2592
+
2593
+ /**
2594
+ * JSBridge module for checking and refreshing API access permissions.
2595
+ *
2596
+ * @group Modules
2597
+ *
2598
+ * @remarks
2599
+ * Manages OAuth scope permissions, allowing the MiniApp to check access rights and reload scopes from the server.
2600
+ * This code must run on the Grab SuperApp's webview to function correctly.
2601
+ *
2602
+ * @example
2603
+ * **ES Module:**
2604
+ * ```typescript
2605
+ * import { ScopeModule } from '@grabjs/superapp-sdk';
2606
+ * const scope = new ScopeModule();
2607
+ * ```
2608
+ *
2609
+ * @example
2610
+ * **CDN (UMD):**
2611
+ * ```html
2612
+ * <script src="https://cdn.jsdelivr.net/npm/@grabjs/superapp-sdk/dist/index.js"></script>
2613
+ * <script>
2614
+ * const scope = new SuperAppSDK.ScopeModule();
2615
+ * </script>
2616
+ * ```
2617
+ *
2618
+ * @public
2619
+ */
2620
+ export declare class ScopeModule extends BaseModule {
2621
+ constructor();
2622
+ /**
2623
+ * Checks if the current client has access to a specific JSBridge API method.
2624
+ *
2625
+ * @param module - The name of the bridge module to check access for (e.g., 'CameraModule').
2626
+ * @param method - The method name within the module to check access for (e.g., 'scanQRCode').
2627
+ *
2628
+ * @returns A promise that resolves to a response with one of the following possible status codes:
2629
+ * - `200`: Access check completed successfully
2630
+ * - `400`: Missing required parameters
2631
+ * - `424`: ScopeKit error
2632
+ *
2633
+ * @throws Error when the JSBridge method fails unexpectedly.
2634
+ *
2635
+ * @example
2636
+ * **Simple usage**
2637
+ * ```typescript
2638
+ * // Imports using ES Module built
2639
+ * import { ScopeModule, isResponseOk, isResponseError } from '@grabjs/superapp-sdk';
2640
+ * // Imports using UMD built (via CDN)
2641
+ * const { ScopeModule, isResponseOk, isResponseError } = window.SuperAppSDK;
2642
+ *
2643
+ * // Initialize the scope module
2644
+ * const scopeModule = new ScopeModule();
2645
+ *
2646
+ * // Check access to CameraModule.scanQRCode
2647
+ * try {
2648
+ * const response = await scopeModule.hasAccessTo('CameraModule', 'scanQRCode');
2649
+ *
2650
+ * if (isResponseError(response)) {
2651
+ * console.log('Could not check access:', response.error);
2652
+ * } else if (isResponseOk(response)) {
2653
+ * console.log('Has access:', response.result.hasAccess);
2654
+ * }
2655
+ * } catch (error) {
2656
+ * console.log('Unexpected error:', error);
2657
+ * }
2658
+ * ```
2659
+ *
2660
+ * @public
2661
+ */
2662
+ hasAccessTo(module: string, method: string): Promise<HasAccessToResponse>;
2663
+ /**
2664
+ * Requests to reload the consented OAuth scopes for the current client.
2665
+ * This refreshes the permissions from the server.
2666
+ *
2667
+ * @returns A promise that resolves to a response with one of the following possible status codes:
2668
+ * - `200`: Scopes reloaded successfully
2669
+ * - `424`: ScopeKit error
2670
+ *
2671
+ * @throws Error when the JSBridge method fails unexpectedly.
2672
+ *
2673
+ * @example
2674
+ * **Simple usage**
2675
+ * ```typescript
2676
+ * // Imports using ES Module built
2677
+ * import { ScopeModule, isResponseOk, isResponseError } from '@grabjs/superapp-sdk';
2678
+ * // Imports using UMD built (via CDN)
2679
+ * const { ScopeModule, isResponseOk, isResponseError } = window.SuperAppSDK;
2680
+ *
2681
+ * // Initialize the scope module
2682
+ * const scopeModule = new ScopeModule();
2683
+ *
2684
+ * // Reload scopes
2685
+ * try {
2686
+ * const response = await scopeModule.reloadScopes();
2687
+ *
2688
+ * if (isResponseError(response)) {
2689
+ * console.log('Could not reload scopes:', response.error);
2690
+ * } else if (isResponseOk(response)) {
2691
+ * console.log('Scopes reloaded successfully');
2692
+ * }
2693
+ * } catch (error) {
2694
+ * console.log('Unexpected error:', error);
2695
+ * }
2696
+ * ```
2697
+ *
2698
+ * @public
2699
+ */
2700
+ reloadScopes(): Promise<ReloadScopesResponse>;
2701
+ }
2702
+
2703
+ /**
2704
+ * Request parameters for sending analytics events.
2705
+ *
2706
+ * @remarks
2707
+ * Use predefined constants to ensure consistency across the platform:
2708
+ * - **States:** {@link ContainerAnalyticsEventState}
2709
+ * - **Names:** {@link ContainerAnalyticsEventName}
2710
+ *
2711
+ * @public
2712
+ */
2713
+ export declare type SendAnalyticsEventRequest = {
2714
+ /** The analytics event state (e.g., "HOMEPAGE", "CHECKOUT_PAGE"). */
2715
+ state: string;
2716
+ /** The analytics event name (e.g., "DEFAULT", "BOOK"). */
2717
+ name: string;
2718
+ /** Optional additional data for the analytics event as key-value pairs. */
2719
+ data?: Record<string, unknown>;
2720
+ };
2721
+
2722
+ /**
2723
+ * Response when sending analytics events.
2724
+ *
2725
+ * @public
2726
+ */
2727
+ export declare type SendAnalyticsEventResponse = ConstrainedBridgeResponse<SendAnalyticsEventResult, 200 | 400>;
2728
+
2729
+ /**
2730
+ * Result when sending analytics events.
2731
+ *
2732
+ * @public
2733
+ */
2734
+ export declare type SendAnalyticsEventResult = void;
2735
+
2736
+ /**
2737
+ * Request parameters for setting the background color.
2738
+ *
2739
+ * @public
2740
+ */
2741
+ export declare type SetBackgroundColorRequest = string;
2742
+
2743
+ /**
2744
+ * Response when setting the background color.
2745
+ *
2746
+ * @public
2747
+ */
2748
+ export declare type SetBackgroundColorResponse = ConstrainedBridgeResponse<SetBackgroundColorResult, 200 | 400>;
2749
+
2750
+ /**
2751
+ * Result when setting the background color.
2752
+ *
2753
+ * @public
2754
+ */
2755
+ export declare type SetBackgroundColorResult = void;
2756
+
2757
+ /**
2758
+ * Response when setting a boolean value.
2759
+ *
2760
+ * @public
2761
+ */
2762
+ export declare type SetBooleanResponse = ConstrainedBridgeResponse<SetBooleanResult, 204 | 400>;
2763
+
2764
+ /**
2765
+ * Result object for setting a boolean value.
2766
+ * This operation returns no data on success.
2767
+ *
2768
+ * @public
2769
+ */
2770
+ export declare type SetBooleanResult = void;
2771
+
2772
+ /**
2773
+ * Response when setting a double value.
2774
+ *
2775
+ * @public
2776
+ */
2777
+ export declare type SetDoubleResponse = ConstrainedBridgeResponse<SetDoubleResult, 204 | 400>;
2778
+
2779
+ /**
2780
+ * Result object for setting a double value.
2781
+ * This operation returns no data on success.
2782
+ *
2783
+ * @public
2784
+ */
2785
+ export declare type SetDoubleResult = void;
2786
+
2787
+ /**
2788
+ * Response when setting an integer value.
2789
+ *
2790
+ * @public
2791
+ */
2792
+ export declare type SetIntResponse = ConstrainedBridgeResponse<SetIntResult, 204 | 400>;
2793
+
2794
+ /**
2795
+ * Result object for setting an integer value.
2796
+ * This operation returns no data on success.
2797
+ *
2798
+ * @public
2799
+ */
2800
+ export declare type SetIntResult = void;
2801
+
2802
+ /**
2803
+ * Response when setting a string value.
2804
+ *
2805
+ * @public
2806
+ */
2807
+ export declare type SetStringResponse = ConstrainedBridgeResponse<SetStringResult, 204 | 400>;
2808
+
2809
+ /**
2810
+ * Result object for setting a string value.
2811
+ * This operation returns no data on success.
2812
+ *
2813
+ * @public
2814
+ */
2815
+ export declare type SetStringResult = void;
2816
+
2817
+ /**
2818
+ * Request parameters for setting the title.
2819
+ *
2820
+ * @public
2821
+ */
2822
+ export declare type SetTitleRequest = string;
2823
+
2824
+ /**
2825
+ * Response when setting the title.
2826
+ *
2827
+ * @public
2828
+ */
2829
+ export declare type SetTitleResponse = ConstrainedBridgeResponse<SetTitleResult, 200 | 400>;
2830
+
2831
+ /**
2832
+ * Result when setting the title.
2833
+ *
2834
+ * @public
2835
+ */
2836
+ export declare type SetTitleResult = void;
2837
+
2838
+ /**
2839
+ * Response when showing the back button.
2840
+ *
2841
+ * @public
2842
+ */
2843
+ export declare type ShowBackButtonResponse = ConstrainedBridgeResponse<ShowBackButtonResult, 200>;
2844
+
2845
+ /**
2846
+ * Result when showing the back button.
2847
+ *
2848
+ * @public
2849
+ */
2850
+ export declare type ShowBackButtonResult = void;
2851
+
2852
+ /**
2853
+ * Response when showing the loader.
2854
+ *
2855
+ * @public
2856
+ */
2857
+ export declare type ShowLoaderResponse = ConstrainedBridgeResponse<ShowLoaderResult, 200>;
2858
+
2859
+ /**
2860
+ * Result when showing the loader.
2861
+ *
2862
+ * @public
2863
+ */
2864
+ export declare type ShowLoaderResult = void;
2865
+
2866
+ /**
2867
+ * Response when showing the refresh button.
2868
+ *
2869
+ * @public
2870
+ */
2871
+ export declare type ShowRefreshButtonResponse = ConstrainedBridgeResponse<ShowRefreshButtonResult, 200>;
2872
+
2873
+ /**
2874
+ * Result when showing the refresh button.
2875
+ *
2876
+ * @public
2877
+ */
2878
+ export declare type ShowRefreshButtonResult = void;
2879
+
2880
+ /**
2881
+ * Map of individual status codes to their JSBridge response types.
2882
+ * Used internally by ConstrainedBridgeResponse to select specific response types.
2883
+ *
2884
+ * @public
2885
+ */
2886
+ export declare type StatusCodeMap<T> = {
2887
+ 200: BridgeStatusCode200Response<T>;
2888
+ 204: BridgeStatusCode204Response;
2889
+ 302: BridgeStatusCode302Response;
2890
+ 400: BridgeStatusCode400Response;
2891
+ 403: BridgeStatusCode403Response;
2892
+ 404: BridgeStatusCode404Response;
2893
+ 424: BridgeStatusCode424Response;
2894
+ 500: BridgeStatusCode500Response;
2895
+ };
2896
+
2897
+ /**
2898
+ * JSBridge module for persisting key-value data to native storage.
2899
+ *
2900
+ * @group Modules
2901
+ *
2902
+ * @remarks
2903
+ * Stores data in the native app's persistent storage, allowing data to survive webview restarts.
2904
+ * This code must run on the Grab SuperApp's webview to function correctly.
2905
+ *
2906
+ * @example
2907
+ * **ES Module:**
2908
+ * ```typescript
2909
+ * import { StorageModule } from '@grabjs/superapp-sdk';
2910
+ * const storage = new StorageModule();
2911
+ * ```
2912
+ *
2913
+ * @example
2914
+ * **CDN (UMD):**
2915
+ * ```html
2916
+ * <script src="https://cdn.jsdelivr.net/npm/@grabjs/superapp-sdk/dist/index.js"></script>
2917
+ * <script>
2918
+ * const storage = new SuperAppSDK.StorageModule();
2919
+ * </script>
2920
+ * ```
2921
+ *
2922
+ * @public
2923
+ */
2924
+ export declare class StorageModule extends BaseModule {
2925
+ constructor();
2926
+ /**
2927
+ * Stores a boolean value in the native storage.
2928
+ *
2929
+ * @param key - The key to store the value under.
2930
+ * @param value - The boolean value to store.
2931
+ *
2932
+ * @returns A promise that resolves to a response with one of the following possible status codes:
2933
+ * - `204`: Value stored successfully
2934
+ * - `400`: Missing required parameters
2935
+ *
2936
+ * @throws Error when the JSBridge method fails unexpectedly.
2937
+ *
2938
+ * @example
2939
+ * **Simple usage**
2940
+ * ```typescript
2941
+ * // Imports using ES Module built
2942
+ * import { StorageModule, isResponseNoContent, isResponseError } from '@grabjs/superapp-sdk';
2943
+ * // Imports using UMD built (via CDN)
2944
+ * const { StorageModule, isResponseNoContent, isResponseError } = window.SuperAppSDK;
2945
+ *
2946
+ * // Initialize the storage module
2947
+ * const storageModule = new StorageModule();
2948
+ *
2949
+ * // Set a boolean value
2950
+ * try {
2951
+ * const response = await storageModule.setBoolean('isDarkMode', true);
2952
+ *
2953
+ * if (isResponseError(response)) {
2954
+ * console.log('Could not store value:', response.error);
2955
+ * } else if (isResponseNoContent(response)) {
2956
+ * console.log('Value stored successfully');
2957
+ * }
2958
+ * } catch (error) {
2959
+ * console.log('Unexpected error:', error);
2960
+ * }
2961
+ * ```
2962
+ *
2963
+ * @public
2964
+ */
2965
+ setBoolean(key: string, value: boolean): Promise<SetBooleanResponse>;
2966
+ /**
2967
+ * Retrieves a boolean value from the native storage.
2968
+ *
2969
+ * @param key - The key to retrieve the value for.
2970
+ *
2971
+ * @returns A promise that resolves to a response with one of the following possible status codes:
2972
+ * - `200`: Value retrieved successfully
2973
+ * - `400`: Missing required parameters
2974
+ *
2975
+ * @throws Error when the JSBridge method fails unexpectedly.
2976
+ *
2977
+ * @example
2978
+ * **Simple usage**
2979
+ * ```typescript
2980
+ * // Imports using ES Module built
2981
+ * import { StorageModule, isResponseOk, isResponseError } from '@grabjs/superapp-sdk';
2982
+ * // Imports using UMD built (via CDN)
2983
+ * const { StorageModule, isResponseOk, isResponseError } = window.SuperAppSDK;
2984
+ *
2985
+ * // Initialize the storage module
2986
+ * const storageModule = new StorageModule();
2987
+ *
2988
+ * // Get a boolean value
2989
+ * try {
2990
+ * const response = await storageModule.getBoolean('isDarkMode');
2991
+ *
2992
+ * if (isResponseError(response)) {
2993
+ * console.log('Could not retrieve value:', response.error);
2994
+ * } else if (isResponseOk(response)) {
2995
+ * console.log('Stored value:', response.result);
2996
+ * }
2997
+ * } catch (error) {
2998
+ * console.log('Unexpected error:', error);
2999
+ * }
3000
+ * ```
3001
+ *
3002
+ * @public
3003
+ */
3004
+ getBoolean(key: string): Promise<GetBooleanResponse>;
3005
+ /**
3006
+ * Stores an integer value in the native storage.
3007
+ *
3008
+ * @param key - The key to store the value under.
3009
+ * @param value - The integer value to store.
3010
+ *
3011
+ * @returns A promise that resolves to a response with one of the following possible status codes:
3012
+ * - `204`: Value stored successfully
3013
+ * - `400`: Missing required parameters
3014
+ *
3015
+ * @throws Error when the JSBridge method fails unexpectedly.
3016
+ *
3017
+ * @example
3018
+ * **Simple usage**
3019
+ * ```typescript
3020
+ * // Imports using ES Module built
3021
+ * import { StorageModule, isResponseNoContent, isResponseError } from '@grabjs/superapp-sdk';
3022
+ * // Imports using UMD built (via CDN)
3023
+ * const { StorageModule, isResponseNoContent, isResponseError } = window.SuperAppSDK;
3024
+ *
3025
+ * // Initialize the storage module
3026
+ * const storageModule = new StorageModule();
3027
+ *
3028
+ * // Set an integer value
3029
+ * try {
3030
+ * const response = await storageModule.setInt('userCount', 42);
3031
+ *
3032
+ * if (isResponseError(response)) {
3033
+ * console.log('Could not store value:', response.error);
3034
+ * } else if (isResponseNoContent(response)) {
3035
+ * console.log('Value stored successfully');
3036
+ * }
3037
+ * } catch (error) {
3038
+ * console.log('Unexpected error:', error);
3039
+ * }
3040
+ * ```
3041
+ *
3042
+ * @public
3043
+ */
3044
+ setInt(key: string, value: number): Promise<SetIntResponse>;
3045
+ /**
3046
+ * Retrieves an integer value from the native storage.
3047
+ *
3048
+ * @param key - The key to retrieve the value for.
3049
+ *
3050
+ * @returns A promise that resolves to a response with one of the following possible status codes:
3051
+ * - `200`: Value retrieved successfully
3052
+ * - `400`: Missing required parameters
3053
+ *
3054
+ * @throws Error when the JSBridge method fails unexpectedly.
3055
+ *
3056
+ * @example
3057
+ * **Simple usage**
3058
+ * ```typescript
3059
+ * // Imports using ES Module built
3060
+ * import { StorageModule, isResponseOk, isResponseError } from '@grabjs/superapp-sdk';
3061
+ * // Imports using UMD built (via CDN)
3062
+ * const { StorageModule, isResponseOk, isResponseError } = window.SuperAppSDK;
3063
+ *
3064
+ * // Initialize the storage module
3065
+ * const storageModule = new StorageModule();
3066
+ *
3067
+ * // Get an integer value
3068
+ * try {
3069
+ * const response = await storageModule.getInt('userCount');
3070
+ *
3071
+ * if (isResponseError(response)) {
3072
+ * console.log('Could not retrieve value:', response.error);
3073
+ * } else if (isResponseOk(response)) {
3074
+ * console.log('Stored value:', response.result);
3075
+ * }
3076
+ * } catch (error) {
3077
+ * console.log('Unexpected error:', error);
3078
+ * }
3079
+ * ```
3080
+ *
3081
+ * @public
3082
+ */
3083
+ getInt(key: string): Promise<GetIntResponse>;
3084
+ /**
3085
+ * Stores a string value in the native storage.
3086
+ *
3087
+ * @param key - The key to store the value under.
3088
+ * @param value - The string value to store.
3089
+ *
3090
+ * @returns A promise that resolves to a response with one of the following possible status codes:
3091
+ * - `204`: Value stored successfully
3092
+ * - `400`: Missing required parameters
3093
+ *
3094
+ * @throws Error when the JSBridge method fails unexpectedly.
3095
+ *
3096
+ * @example
3097
+ * **Simple usage**
3098
+ * ```typescript
3099
+ * // Imports using ES Module built
3100
+ * import { StorageModule, isResponseNoContent, isResponseError } from '@grabjs/superapp-sdk';
3101
+ * // Imports using UMD built (via CDN)
3102
+ * const { StorageModule, isResponseNoContent, isResponseError } = window.SuperAppSDK;
3103
+ *
3104
+ * // Initialize the storage module
3105
+ * const storageModule = new StorageModule();
3106
+ *
3107
+ * // Set a string value
3108
+ * try {
3109
+ * const response = await storageModule.setString('username', 'john_doe');
3110
+ *
3111
+ * if (isResponseError(response)) {
3112
+ * console.log('Could not store value:', response.error);
3113
+ * } else if (isResponseNoContent(response)) {
3114
+ * console.log('Value stored successfully');
3115
+ * }
3116
+ * } catch (error) {
3117
+ * console.log('Unexpected error:', error);
3118
+ * }
3119
+ * ```
3120
+ *
3121
+ * @public
3122
+ */
3123
+ setString(key: string, value: string): Promise<SetStringResponse>;
3124
+ /**
3125
+ * Retrieves a string value from the native storage.
3126
+ *
3127
+ * @param key - The key to retrieve the value for.
3128
+ *
3129
+ * @returns A promise that resolves to a response with one of the following possible status codes:
3130
+ * - `200`: Value retrieved successfully
3131
+ * - `400`: Missing required parameters
3132
+ *
3133
+ * @throws Error when the JSBridge method fails unexpectedly.
3134
+ *
3135
+ * @example
3136
+ * **Simple usage**
3137
+ * ```typescript
3138
+ * // Imports using ES Module built
3139
+ * import { StorageModule, isResponseOk, isResponseError } from '@grabjs/superapp-sdk';
3140
+ * // Imports using UMD built (via CDN)
3141
+ * const { StorageModule, isResponseOk, isResponseError } = window.SuperAppSDK;
3142
+ *
3143
+ * // Initialize the storage module
3144
+ * const storageModule = new StorageModule();
3145
+ *
3146
+ * // Get a string value
3147
+ * try {
3148
+ * const response = await storageModule.getString('username');
3149
+ *
3150
+ * if (isResponseError(response)) {
3151
+ * console.log('Could not retrieve value:', response.error);
3152
+ * } else if (isResponseOk(response)) {
3153
+ * console.log('Stored value:', response.result);
3154
+ * }
3155
+ * } catch (error) {
3156
+ * console.log('Unexpected error:', error);
3157
+ * }
3158
+ * ```
3159
+ *
3160
+ * @public
3161
+ */
3162
+ getString(key: string): Promise<GetStringResponse>;
3163
+ /**
3164
+ * Stores a double (floating point) value in the native storage.
3165
+ *
3166
+ * @param key - The key to store the value under.
3167
+ * @param value - The double value to store.
3168
+ *
3169
+ * @returns A promise that resolves to a response with one of the following possible status codes:
3170
+ * - `204`: Value stored successfully
3171
+ * - `400`: Missing required parameters
3172
+ *
3173
+ * @throws Error when the JSBridge method fails unexpectedly.
3174
+ *
3175
+ * @example
3176
+ * **Simple usage**
3177
+ * ```typescript
3178
+ * // Imports using ES Module built
3179
+ * import { StorageModule, isResponseNoContent, isResponseError } from '@grabjs/superapp-sdk';
3180
+ * // Imports using UMD built (via CDN)
3181
+ * const { StorageModule, isResponseNoContent, isResponseError } = window.SuperAppSDK;
3182
+ *
3183
+ * // Initialize the storage module
3184
+ * const storageModule = new StorageModule();
3185
+ *
3186
+ * // Set a double value
3187
+ * try {
3188
+ * const response = await storageModule.setDouble('price', 19.99);
3189
+ *
3190
+ * if (isResponseError(response)) {
3191
+ * console.log('Could not store value:', response.error);
3192
+ * } else if (isResponseNoContent(response)) {
3193
+ * console.log('Value stored successfully');
3194
+ * }
3195
+ * } catch (error) {
3196
+ * console.log('Unexpected error:', error);
3197
+ * }
3198
+ * ```
3199
+ *
3200
+ * @public
3201
+ */
3202
+ setDouble(key: string, value: number): Promise<SetDoubleResponse>;
3203
+ /**
3204
+ * Retrieves a double (floating point) value from the native storage.
3205
+ *
3206
+ * @param key - The key to retrieve the value for.
3207
+ *
3208
+ * @returns A promise that resolves to a response with one of the following possible status codes:
3209
+ * - `200`: Value retrieved successfully
3210
+ * - `400`: Missing required parameters
3211
+ *
3212
+ * @throws Error when the JSBridge method fails unexpectedly.
3213
+ *
3214
+ * @example
3215
+ * **Simple usage**
3216
+ * ```typescript
3217
+ * // Imports using ES Module built
3218
+ * import { StorageModule, isResponseOk, isResponseError } from '@grabjs/superapp-sdk';
3219
+ * // Imports using UMD built (via CDN)
3220
+ * const { StorageModule, isResponseOk, isResponseError } = window.SuperAppSDK;
3221
+ *
3222
+ * // Initialize the storage module
3223
+ * const storageModule = new StorageModule();
3224
+ *
3225
+ * // Get a double value
3226
+ * try {
3227
+ * const response = await storageModule.getDouble('price');
3228
+ *
3229
+ * if (isResponseError(response)) {
3230
+ * console.log('Could not retrieve value:', response.error);
3231
+ * } else if (isResponseOk(response)) {
3232
+ * console.log('Stored value:', response.result);
3233
+ * }
3234
+ * } catch (error) {
3235
+ * console.log('Unexpected error:', error);
3236
+ * }
3237
+ * ```
3238
+ *
3239
+ * @public
3240
+ */
3241
+ getDouble(key: string): Promise<GetDoubleResponse>;
3242
+ /**
3243
+ * Removes a single value from the native storage by key.
3244
+ *
3245
+ * @param key - The key to remove from storage.
3246
+ *
3247
+ * @returns A promise that resolves to a response with one of the following possible status codes:
3248
+ * - `204`: Value removed successfully
3249
+ * - `400`: Missing required parameters
3250
+ *
3251
+ * @throws Error when the JSBridge method fails unexpectedly.
3252
+ *
3253
+ * @example
3254
+ * **Simple usage**
3255
+ * ```typescript
3256
+ * // Imports using ES Module built
3257
+ * import { StorageModule, isResponseNoContent, isResponseError } from '@grabjs/superapp-sdk';
3258
+ * // Imports using UMD built (via CDN)
3259
+ * const { StorageModule, isResponseNoContent, isResponseError } = window.SuperAppSDK;
3260
+ *
3261
+ * // Initialize the storage module
3262
+ * const storageModule = new StorageModule();
3263
+ *
3264
+ * // Remove a value
3265
+ * try {
3266
+ * const response = await storageModule.remove('username');
3267
+ *
3268
+ * if (isResponseError(response)) {
3269
+ * console.log('Could not remove value:', response.error);
3270
+ * } else if (isResponseNoContent(response)) {
3271
+ * console.log('Value removed successfully');
3272
+ * }
3273
+ * } catch (error) {
3274
+ * console.log('Unexpected error:', error);
3275
+ * }
3276
+ * ```
3277
+ *
3278
+ * @public
3279
+ */
3280
+ remove(key: string): Promise<RemoveResponse>;
3281
+ /**
3282
+ * Removes all values from the native storage.
3283
+ *
3284
+ * @returns A promise that resolves to a `204` status code when all values are removed.
3285
+ *
3286
+ * @throws Error when the JSBridge method fails unexpectedly.
3287
+ *
3288
+ * @example
3289
+ * **Simple usage**
3290
+ * ```typescript
3291
+ * // Imports using ES Module built
3292
+ * import { StorageModule, isResponseNoContent } from '@grabjs/superapp-sdk';
3293
+ * // Imports using UMD built (via CDN)
3294
+ * const { StorageModule, isResponseNoContent } = window.SuperAppSDK;
3295
+ *
3296
+ * // Initialize the storage module
3297
+ * const storageModule = new StorageModule();
3298
+ *
3299
+ * // Remove all values
3300
+ * try {
3301
+ * const response = await storageModule.removeAll();
3302
+ *
3303
+ * if (isResponseNoContent(response)) {
3304
+ * console.log('All values removed successfully');
3305
+ * }
3306
+ * } catch (error) {
3307
+ * console.log('Unexpected error:', error);
3308
+ * }
3309
+ * ```
3310
+ *
3311
+ * @public
3312
+ */
3313
+ removeAll(): Promise<RemoveAllResponse>;
3314
+ }
3315
+
3316
+ /**
3317
+ * Controls an active stream subscription. Call `unsubscribe()` to stop receiving data.
3318
+ *
3319
+ * @remarks
3320
+ * Returned by `subscribe()`. Use `unsubscribe()` to terminate the stream early.
3321
+ * Use `isUnsubscribed()` to check if already terminated.
3322
+ *
3323
+ * @public
3324
+ */
3325
+ export declare type Subscription = Readonly<{
3326
+ /** Returns true if this subscription has been terminated. */
3327
+ isUnsubscribed: () => boolean;
3328
+ /** Terminates the subscription. No further data will be received. */
3329
+ unsubscribe: () => unknown;
3330
+ }>;
3331
+
3332
+ /**
3333
+ * JSBridge module for opening URLs in the device's system browser.
3334
+ *
3335
+ * @group Modules
3336
+ *
3337
+ * @remarks
3338
+ * Allows MiniApps to redirect users to external content using the native system webview.
3339
+ * This code must run on the Grab SuperApp's webview to function correctly.
3340
+ *
3341
+ * @example
3342
+ * **ES Module:**
3343
+ * ```typescript
3344
+ * import { SystemWebViewKitModule } from '@grabjs/superapp-sdk';
3345
+ * const webViewKit = new SystemWebViewKitModule();
3346
+ * ```
3347
+ *
3348
+ * @example
3349
+ * **CDN (UMD):**
3350
+ * ```html
3351
+ * <script src="https://cdn.jsdelivr.net/npm/@grabjs/superapp-sdk/dist/index.js"></script>
3352
+ * <script>
3353
+ * const webViewKit = new SuperAppSDK.SystemWebViewKitModule();
3354
+ * </script>
3355
+ * ```
3356
+ *
3357
+ * @public
3358
+ */
3359
+ export declare class SystemWebViewKitModule extends BaseModule {
3360
+ constructor();
3361
+ /**
3362
+ * Opens a URL in the device's system web browser or web view.
3363
+ *
3364
+ * @param request - The URL configuration.
3365
+ *
3366
+ * @returns A promise that resolves to a response with one of the following possible status codes:
3367
+ * - `200`: Redirect initiated successfully
3368
+ * - `400`: Invalid URL, domain not whitelisted, or missing callback URL
3369
+ * - `424`: ASWebAuthenticationSession error
3370
+ *
3371
+ * @throws Error when the JSBridge method fails unexpectedly.
3372
+ *
3373
+ * @example
3374
+ * **Simple usage**
3375
+ * ```typescript
3376
+ * // Imports using ES Module built
3377
+ * import { SystemWebViewKitModule, isResponseOk, isResponseError } from '@grabjs/superapp-sdk';
3378
+ * // Imports using UMD built (via CDN)
3379
+ * const { SystemWebViewKitModule, isResponseOk, isResponseError } = window.SuperAppSDK;
3380
+ *
3381
+ * // Initialize the system web view kit module
3382
+ * const systemWebViewKitModule = new SystemWebViewKitModule();
3383
+ *
3384
+ * // Open a URL in system web view
3385
+ * try {
3386
+ * const response = await systemWebViewKitModule.redirectToSystemWebView({
3387
+ * url: 'https://www.example.com'
3388
+ * });
3389
+ *
3390
+ * if (isResponseError(response)) {
3391
+ * console.log('Could not redirect:', response.error);
3392
+ * } else if (isResponseOk(response)) {
3393
+ * console.log('Redirect initiated successfully');
3394
+ * }
3395
+ * } catch (err) {
3396
+ * console.log('Unexpected error:', err);
3397
+ * }
3398
+ * ```
3399
+ *
3400
+ * @public
3401
+ */
3402
+ redirectToSystemWebView(request: RedirectToSystemWebViewRequest): Promise<RedirectToSystemWebViewResponse>;
3403
+ }
3404
+
3405
+ /**
3406
+ * Request parameters for triggering the checkout flow.
3407
+ *
3408
+ * @remarks
3409
+ * This type is intentionally flexible as the checkout parameters vary depending on the specific payment flow and partner requirements.
3410
+ * Consult the Grab SuperApp SDK documentation for the specific parameters required for your use case.
3411
+ *
3412
+ * @public
3413
+ */
3414
+ export declare type TriggerCheckoutRequest = Record<string, unknown>;
3415
+
3416
+ /**
3417
+ * Response when triggering the checkout flow.
3418
+ *
3419
+ * @public
3420
+ */
3421
+ export declare type TriggerCheckoutResponse = ConstrainedBridgeResponse<TriggerCheckoutResult, 200 | 400>;
3422
+
3423
+ /**
3424
+ * Result object containing the checkout transaction details.
3425
+ *
3426
+ * @public
3427
+ */
3428
+ export declare type TriggerCheckoutResult = {
3429
+ /** Unique identifier for the transaction at Grab side. */
3430
+ transactionID: string;
3431
+ /** Status of the transaction: "success", "failure", "pending", or "userInitiatedCancel". */
3432
+ status: string;
3433
+ /** Error message if the transaction failed. */
3434
+ errorMessage?: string;
3435
+ /** Error code associated with the failed transaction. */
3436
+ errorCode?: string;
3437
+ };
3438
+
3439
+ /**
3440
+ * Request parameters for verifying the user's email with an OTP.
3441
+ *
3442
+ * @public
3443
+ */
3444
+ export declare type VerifyEmailRequest = {
3445
+ /** The email address to verify. */
3446
+ email: string;
3447
+ /** The one-time password (OTP) entered by the user. */
3448
+ otp: string;
3449
+ };
3450
+
3451
+ /**
3452
+ * Response when verifying the user's email.
3453
+ *
3454
+ * @public
3455
+ */
3456
+ export declare type VerifyEmailResponse = ConstrainedBridgeResponse<VerifyEmailResult, 200 | 400 | 403>;
3457
+
3458
+ /**
3459
+ * Result object for verifying the user's email.
3460
+ * This operation returns no data on success.
3461
+ *
3462
+ * @public
3463
+ */
3464
+ export declare type VerifyEmailResult = void;
3465
+
3466
+ /**
3467
+ * Generic interface for all native JSBridge module wrappers.
3468
+ *
3469
+ * @remarks
3470
+ * This is the base interface that all Wrapped*Module interfaces implement.
3471
+ * Modules can use this directly for generic method invocation, or extend it
3472
+ * with method-specific overloads for stricter typing.
3473
+ *
3474
+ * @example
3475
+ * Using directly (CameraModule, ContainerModule):
3476
+ * ```typescript
3477
+ * invoke<ScanQRCodeResult>('scanQRCode', request)
3478
+ * ```
3479
+ *
3480
+ * @example
3481
+ * Extending with method overloads (ProfileModule, LocationModule):
3482
+ * ```typescript
3483
+ * export interface WrappedProfileModule extends WrappedModule {
3484
+ * invoke(method: 'fetchEmail', params?: any): Promise<BridgeResponse<string>>;
3485
+ * }
3486
+ * ```
3487
+ *
3488
+ * @public
3489
+ */
3490
+ export declare interface WrappedModule {
3491
+ invoke<T, P = unknown, R = BridgeResponse<T>, M extends string = string>(method: M, params?: P): M extends `observe${string}` ? DataStream<T> : Promise<R>;
3492
+ }
3493
+
3494
+ export { }