@grabjs/superapp-sdk 2.0.0-beta.14 → 2.0.0-beta.23

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.
Files changed (165) hide show
  1. package/README.md +170 -55
  2. package/{dist → api-reference/json}/api.json +17192 -7721
  3. package/api-reference/markdown/README.md +194 -0
  4. package/api-reference/markdown/classes/BaseModule.md +123 -0
  5. package/api-reference/markdown/classes/CameraModule.md +177 -0
  6. package/api-reference/markdown/classes/CheckoutModule.md +181 -0
  7. package/api-reference/markdown/classes/ContainerModule.md +751 -0
  8. package/api-reference/markdown/classes/DeviceCapabilityModule.md +161 -0
  9. package/api-reference/markdown/classes/FileModule.md +178 -0
  10. package/api-reference/markdown/classes/IdentityModule.md +299 -0
  11. package/api-reference/markdown/classes/LocaleModule.md +161 -0
  12. package/api-reference/markdown/classes/LocationModule.md +239 -0
  13. package/api-reference/markdown/classes/MediaModule.md +219 -0
  14. package/api-reference/markdown/classes/PlatformModule.md +162 -0
  15. package/api-reference/markdown/classes/ProfileModule.md +224 -0
  16. package/api-reference/markdown/classes/ScopeModule.md +219 -0
  17. package/api-reference/markdown/classes/StorageModule.md +608 -0
  18. package/api-reference/markdown/classes/SystemWebViewKitModule.md +177 -0
  19. package/api-reference/markdown/classes/UserAttributesModule.md +164 -0
  20. package/api-reference/markdown/functions/isClientError.md +37 -0
  21. package/api-reference/markdown/functions/isErrorResponse.md +40 -0
  22. package/api-reference/markdown/functions/isRedirection.md +37 -0
  23. package/api-reference/markdown/functions/isServerError.md +37 -0
  24. package/api-reference/markdown/functions/isSuccess.md +39 -0
  25. package/api-reference/markdown/globals.md +176 -0
  26. package/api-reference/markdown/interfaces/GrabAppInfo.md +23 -0
  27. package/api-reference/markdown/interfaces/InvokeOptions.md +63 -0
  28. package/api-reference/markdown/interfaces/Version.md +23 -0
  29. package/api-reference/markdown/interfaces/WrappedModule.md +51 -0
  30. package/api-reference/markdown/type-aliases/AuthorizeRequest.md +79 -0
  31. package/api-reference/markdown/type-aliases/AuthorizeResponse.md +58 -0
  32. package/api-reference/markdown/type-aliases/AuthorizeResult.md +33 -0
  33. package/api-reference/markdown/type-aliases/BackResponse.md +37 -0
  34. package/api-reference/markdown/type-aliases/BackResult.md +8 -0
  35. package/api-reference/markdown/type-aliases/BridgeClientError.md +9 -0
  36. package/api-reference/markdown/type-aliases/BridgeError.md +8 -0
  37. package/api-reference/markdown/type-aliases/BridgeRedirection.md +8 -0
  38. package/api-reference/markdown/type-aliases/BridgeResponse.md +40 -0
  39. package/api-reference/markdown/type-aliases/BridgeServerError.md +8 -0
  40. package/api-reference/markdown/type-aliases/BridgeStatusCode.md +7 -0
  41. package/api-reference/markdown/type-aliases/BridgeStream.md +29 -0
  42. package/api-reference/markdown/type-aliases/BridgeStreamHandlers.md +25 -0
  43. package/api-reference/markdown/type-aliases/BridgeSuccessResponse.md +14 -0
  44. package/api-reference/markdown/type-aliases/ClearAuthorizationArtifactsResponse.md +18 -0
  45. package/api-reference/markdown/type-aliases/ClearAuthorizationArtifactsResult.md +8 -0
  46. package/api-reference/markdown/type-aliases/CloseResponse.md +37 -0
  47. package/api-reference/markdown/type-aliases/CloseResult.md +8 -0
  48. package/api-reference/markdown/type-aliases/DRMContentConfig.md +34 -0
  49. package/api-reference/markdown/type-aliases/DRMPlaybackEvent.md +43 -0
  50. package/api-reference/markdown/type-aliases/DownloadFileRequest.md +32 -0
  51. package/api-reference/markdown/type-aliases/DownloadFileResponse.md +48 -0
  52. package/api-reference/markdown/type-aliases/DownloadFileResult.md +11 -0
  53. package/api-reference/markdown/type-aliases/ErrorResponse.md +32 -0
  54. package/api-reference/markdown/type-aliases/FetchEmailResponse.md +58 -0
  55. package/api-reference/markdown/type-aliases/FetchEmailResult.md +21 -0
  56. package/api-reference/markdown/type-aliases/GetAuthorizationArtifactsResponse.md +42 -0
  57. package/api-reference/markdown/type-aliases/GetAuthorizationArtifactsResult.md +57 -0
  58. package/api-reference/markdown/type-aliases/GetBooleanRequest.md +21 -0
  59. package/api-reference/markdown/type-aliases/GetBooleanResponse.md +57 -0
  60. package/api-reference/markdown/type-aliases/GetBooleanResult.md +27 -0
  61. package/api-reference/markdown/type-aliases/GetCoordinateResponse.md +49 -0
  62. package/api-reference/markdown/type-aliases/GetCoordinateResult.md +29 -0
  63. package/api-reference/markdown/type-aliases/GetCountryCodeResponse.md +57 -0
  64. package/api-reference/markdown/type-aliases/GetCountryCodeResult.md +25 -0
  65. package/api-reference/markdown/type-aliases/GetDoubleRequest.md +21 -0
  66. package/api-reference/markdown/type-aliases/GetDoubleResponse.md +57 -0
  67. package/api-reference/markdown/type-aliases/GetDoubleResult.md +27 -0
  68. package/api-reference/markdown/type-aliases/GetIntRequest.md +21 -0
  69. package/api-reference/markdown/type-aliases/GetIntResponse.md +57 -0
  70. package/api-reference/markdown/type-aliases/GetIntResult.md +27 -0
  71. package/api-reference/markdown/type-aliases/GetLanguageLocaleIdentifierResponse.md +48 -0
  72. package/api-reference/markdown/type-aliases/GetLanguageLocaleIdentifierResult.md +31 -0
  73. package/api-reference/markdown/type-aliases/GetSelectedTravelDestinationResponse.md +48 -0
  74. package/api-reference/markdown/type-aliases/GetSelectedTravelDestinationResult.md +17 -0
  75. package/api-reference/markdown/type-aliases/GetSessionParamsResponse.md +40 -0
  76. package/api-reference/markdown/type-aliases/GetSessionParamsResult.md +27 -0
  77. package/api-reference/markdown/type-aliases/GetStringRequest.md +21 -0
  78. package/api-reference/markdown/type-aliases/GetStringResponse.md +57 -0
  79. package/api-reference/markdown/type-aliases/GetStringResult.md +27 -0
  80. package/api-reference/markdown/type-aliases/HasAccessToResponse.md +66 -0
  81. package/api-reference/markdown/type-aliases/HasAccessToResult.md +27 -0
  82. package/api-reference/markdown/type-aliases/HideBackButtonResponse.md +37 -0
  83. package/api-reference/markdown/type-aliases/HideBackButtonResult.md +8 -0
  84. package/api-reference/markdown/type-aliases/HideLoaderResponse.md +37 -0
  85. package/api-reference/markdown/type-aliases/HideLoaderResult.md +8 -0
  86. package/api-reference/markdown/type-aliases/HideRefreshButtonResponse.md +37 -0
  87. package/api-reference/markdown/type-aliases/HideRefreshButtonResult.md +8 -0
  88. package/api-reference/markdown/type-aliases/IsConnectedResponse.md +31 -0
  89. package/api-reference/markdown/type-aliases/IsConnectedResult.md +27 -0
  90. package/api-reference/markdown/type-aliases/IsEsimSupportedResponse.md +48 -0
  91. package/api-reference/markdown/type-aliases/IsEsimSupportedResult.md +17 -0
  92. package/api-reference/markdown/type-aliases/ObserveDRMPlaybackResponse.md +15 -0
  93. package/api-reference/markdown/type-aliases/ObserveLocationChangeResponse.md +15 -0
  94. package/api-reference/markdown/type-aliases/OnContentLoadedResponse.md +37 -0
  95. package/api-reference/markdown/type-aliases/OnContentLoadedResult.md +8 -0
  96. package/api-reference/markdown/type-aliases/OnCtaTapRequest.md +13 -0
  97. package/api-reference/markdown/type-aliases/OnCtaTapResponse.md +37 -0
  98. package/api-reference/markdown/type-aliases/OnCtaTapResult.md +8 -0
  99. package/api-reference/markdown/type-aliases/OpenExternalLinkRequest.md +13 -0
  100. package/api-reference/markdown/type-aliases/OpenExternalLinkResponse.md +46 -0
  101. package/api-reference/markdown/type-aliases/OpenExternalLinkResult.md +8 -0
  102. package/api-reference/markdown/type-aliases/Platform.md +7 -0
  103. package/api-reference/markdown/type-aliases/PlayDRMContentResponse.md +43 -0
  104. package/api-reference/markdown/type-aliases/PlayDRMContentResult.md +8 -0
  105. package/api-reference/markdown/type-aliases/RedirectToSystemWebViewRequest.md +23 -0
  106. package/api-reference/markdown/type-aliases/RedirectToSystemWebViewResponse.md +55 -0
  107. package/api-reference/markdown/type-aliases/RedirectToSystemWebViewResult.md +8 -0
  108. package/api-reference/markdown/type-aliases/ReloadScopesResponse.md +46 -0
  109. package/api-reference/markdown/type-aliases/ReloadScopesResult.md +8 -0
  110. package/api-reference/markdown/type-aliases/RemoveAllResponse.md +37 -0
  111. package/api-reference/markdown/type-aliases/RemoveAllResult.md +8 -0
  112. package/api-reference/markdown/type-aliases/RemoveResponse.md +46 -0
  113. package/api-reference/markdown/type-aliases/RemoveResult.md +8 -0
  114. package/api-reference/markdown/type-aliases/ResponseStatusCode200.md +34 -0
  115. package/api-reference/markdown/type-aliases/ResponseStatusCode204.md +20 -0
  116. package/api-reference/markdown/type-aliases/ResponseStatusCode302.md +20 -0
  117. package/api-reference/markdown/type-aliases/ResponseStatusCode400.md +7 -0
  118. package/api-reference/markdown/type-aliases/ResponseStatusCode401.md +7 -0
  119. package/api-reference/markdown/type-aliases/ResponseStatusCode403.md +7 -0
  120. package/api-reference/markdown/type-aliases/ResponseStatusCode404.md +7 -0
  121. package/api-reference/markdown/type-aliases/ResponseStatusCode424.md +7 -0
  122. package/api-reference/markdown/type-aliases/ResponseStatusCode426.md +12 -0
  123. package/api-reference/markdown/type-aliases/ResponseStatusCode500.md +7 -0
  124. package/api-reference/markdown/type-aliases/ResponseStatusCode501.md +12 -0
  125. package/api-reference/markdown/type-aliases/ScanQRCodeRequest.md +27 -0
  126. package/api-reference/markdown/type-aliases/ScanQRCodeResponse.md +64 -0
  127. package/api-reference/markdown/type-aliases/ScanQRCodeResult.md +21 -0
  128. package/api-reference/markdown/type-aliases/SendAnalyticsEventRequest.md +56 -0
  129. package/api-reference/markdown/type-aliases/SendAnalyticsEventResponse.md +46 -0
  130. package/api-reference/markdown/type-aliases/SendAnalyticsEventResult.md +8 -0
  131. package/api-reference/markdown/type-aliases/SetBackgroundColorRequest.md +13 -0
  132. package/api-reference/markdown/type-aliases/SetBackgroundColorResponse.md +46 -0
  133. package/api-reference/markdown/type-aliases/SetBackgroundColorResult.md +8 -0
  134. package/api-reference/markdown/type-aliases/SetBooleanResponse.md +46 -0
  135. package/api-reference/markdown/type-aliases/SetBooleanResult.md +8 -0
  136. package/api-reference/markdown/type-aliases/SetDoubleResponse.md +46 -0
  137. package/api-reference/markdown/type-aliases/SetDoubleResult.md +8 -0
  138. package/api-reference/markdown/type-aliases/SetIntResponse.md +46 -0
  139. package/api-reference/markdown/type-aliases/SetIntResult.md +8 -0
  140. package/api-reference/markdown/type-aliases/SetStringResponse.md +46 -0
  141. package/api-reference/markdown/type-aliases/SetStringResult.md +8 -0
  142. package/api-reference/markdown/type-aliases/SetTitleRequest.md +13 -0
  143. package/api-reference/markdown/type-aliases/SetTitleResponse.md +46 -0
  144. package/api-reference/markdown/type-aliases/SetTitleResult.md +8 -0
  145. package/api-reference/markdown/type-aliases/ShowBackButtonResponse.md +37 -0
  146. package/api-reference/markdown/type-aliases/ShowBackButtonResult.md +8 -0
  147. package/api-reference/markdown/type-aliases/ShowLoaderResponse.md +37 -0
  148. package/api-reference/markdown/type-aliases/ShowLoaderResult.md +8 -0
  149. package/api-reference/markdown/type-aliases/ShowRefreshButtonResponse.md +37 -0
  150. package/api-reference/markdown/type-aliases/ShowRefreshButtonResult.md +8 -0
  151. package/api-reference/markdown/type-aliases/StatusCodeMap.md +80 -0
  152. package/api-reference/markdown/type-aliases/Subscription.md +12 -0
  153. package/api-reference/markdown/type-aliases/TriggerCheckoutRequest.md +26 -0
  154. package/api-reference/markdown/type-aliases/TriggerCheckoutResponse.md +76 -0
  155. package/api-reference/markdown/type-aliases/TriggerCheckoutResult.md +75 -0
  156. package/api-reference/markdown/type-aliases/VerifyEmailRequest.md +32 -0
  157. package/api-reference/markdown/type-aliases/VerifyEmailResponse.md +55 -0
  158. package/api-reference/markdown/type-aliases/VerifyEmailResult.md +8 -0
  159. package/api-reference/markdown/variables/ContainerAnalyticsEventData.md +21 -0
  160. package/api-reference/markdown/variables/ContainerAnalyticsEventName.md +13 -0
  161. package/api-reference/markdown/variables/ContainerAnalyticsEventState.md +25 -0
  162. package/dist/index.d.ts +1825 -1298
  163. package/dist/index.esm.js +1 -1
  164. package/dist/index.js +1 -1
  165. package/package.json +22 -10
@@ -0,0 +1,751 @@
1
+ [@grabjs/superapp-sdk](../globals.md) / ContainerModule
2
+
3
+ # Class: ContainerModule
4
+
5
+ JSBridge module for controlling the webview container.
6
+
7
+ ## Remarks
8
+
9
+ Provides methods to interact with the webview container.
10
+ This code must run on the Grab SuperApp's webview to function correctly.
11
+
12
+ ## Examples
13
+
14
+ **ES Module:**
15
+ ```typescript
16
+ import { ContainerModule } from '@grabjs/superapp-sdk';
17
+ const containerModule = new ContainerModule();
18
+ ```
19
+
20
+ **CDN (UMD):**
21
+ ```html
22
+ <script src="https://cdn.jsdelivr.net/npm/@grabjs/superapp-sdk/dist/index.js"></script>
23
+ <script>
24
+ const containerModule = new SuperAppSDK.ContainerModule();
25
+ </script>
26
+ ```
27
+
28
+ ## No Inherit Doc
29
+
30
+ ## Extends
31
+
32
+ - [`BaseModule`](BaseModule.md)
33
+
34
+ ## Constructors
35
+
36
+ ### Constructor
37
+
38
+ > **new ContainerModule**(): `ContainerModule`
39
+
40
+ #### Returns
41
+
42
+ `ContainerModule`
43
+
44
+ #### Overrides
45
+
46
+ [`BaseModule`](BaseModule.md).[`constructor`](BaseModule.md#constructor)
47
+
48
+ ## Methods
49
+
50
+ ### close()
51
+
52
+ > **close**(): `Promise`\<[`CloseResponse`](../type-aliases/CloseResponse.md)\>
53
+
54
+ Close the container and return to the previous screen.
55
+
56
+ #### Returns
57
+
58
+ `Promise`\<[`CloseResponse`](../type-aliases/CloseResponse.md)\>
59
+
60
+ Confirmation that the container is closing.
61
+
62
+ #### Example
63
+
64
+ **Simple usage**
65
+ ```typescript
66
+ // Initialize the container module
67
+ const containerModule = new ContainerModule();
68
+
69
+ // Close the container
70
+ const response = await containerModule.close();
71
+
72
+ switch (response.status_code) {
73
+ case 200:
74
+ console.log('Container closed successfully');
75
+ break;
76
+ case 501:
77
+ console.log('Not in Grab app:', response.error);
78
+ break;
79
+ }
80
+ ```
81
+
82
+ ***
83
+
84
+ ### getSessionParams()
85
+
86
+ > **getSessionParams**(): `Promise`\<[`GetSessionParamsResponse`](../type-aliases/GetSessionParamsResponse.md)\>
87
+
88
+ Get the session parameters from the container.
89
+
90
+ #### Returns
91
+
92
+ `Promise`\<[`GetSessionParamsResponse`](../type-aliases/GetSessionParamsResponse.md)\>
93
+
94
+ The session parameters as a JSON string that can be parsed into an object.
95
+
96
+ #### Remarks
97
+
98
+ The native layer returns session parameters as a JSON string.
99
+ Parse with `JSON.parse(result.result)` to use as an object.
100
+ Session parameters can contain primitives, base64 encoded strings, or nested objects.
101
+
102
+ #### Example
103
+
104
+ **Simple usage**
105
+ ```typescript
106
+ // Initialize the container module
107
+ const containerModule = new ContainerModule();
108
+
109
+ // Get session parameters
110
+ const response = await containerModule.getSessionParams();
111
+
112
+ switch (response.status_code) {
113
+ case 200: {
114
+ const sessionParams = JSON.parse(response.result?.result || '{}');
115
+ console.log('Session params retrieved:', sessionParams);
116
+ break;
117
+ }
118
+ case 501:
119
+ console.log('Not in Grab app:', response.error);
120
+ break;
121
+ }
122
+ ```
123
+
124
+ ***
125
+
126
+ ### hideBackButton()
127
+
128
+ > **hideBackButton**(): `Promise`\<[`HideBackButtonResponse`](../type-aliases/HideBackButtonResponse.md)\>
129
+
130
+ Hide the back button on the container header.
131
+
132
+ #### Returns
133
+
134
+ `Promise`\<[`HideBackButtonResponse`](../type-aliases/HideBackButtonResponse.md)\>
135
+
136
+ Confirmation that the back button is now hidden.
137
+
138
+ #### Example
139
+
140
+ **Simple usage**
141
+ ```typescript
142
+ // Initialize the container module
143
+ const containerModule = new ContainerModule();
144
+
145
+ // Hide back button
146
+ const response = await containerModule.hideBackButton();
147
+
148
+ switch (response.status_code) {
149
+ case 200:
150
+ console.log('Back button hidden successfully');
151
+ break;
152
+ case 501:
153
+ console.log('Not in Grab app:', response.error);
154
+ break;
155
+ }
156
+ ```
157
+
158
+ ***
159
+
160
+ ### hideLoader()
161
+
162
+ > **hideLoader**(): `Promise`\<[`HideLoaderResponse`](../type-aliases/HideLoaderResponse.md)\>
163
+
164
+ Hide the full-screen loading indicator.
165
+
166
+ #### Returns
167
+
168
+ `Promise`\<[`HideLoaderResponse`](../type-aliases/HideLoaderResponse.md)\>
169
+
170
+ Confirmation that the loader is now hidden.
171
+
172
+ #### Remarks
173
+
174
+ Should be called when the entry point has finished loading.
175
+
176
+ #### Example
177
+
178
+ **Simple usage**
179
+ ```typescript
180
+ // Initialize the container module
181
+ const containerModule = new ContainerModule();
182
+
183
+ // Hide loader
184
+ const response = await containerModule.hideLoader();
185
+
186
+ switch (response.status_code) {
187
+ case 200:
188
+ console.log('Loader hidden successfully');
189
+ break;
190
+ case 501:
191
+ console.log('Not in Grab app:', response.error);
192
+ break;
193
+ }
194
+ ```
195
+
196
+ ***
197
+
198
+ ### hideRefreshButton()
199
+
200
+ > **hideRefreshButton**(): `Promise`\<[`HideRefreshButtonResponse`](../type-aliases/HideRefreshButtonResponse.md)\>
201
+
202
+ Hide the refresh button on the container header.
203
+
204
+ #### Returns
205
+
206
+ `Promise`\<[`HideRefreshButtonResponse`](../type-aliases/HideRefreshButtonResponse.md)\>
207
+
208
+ Confirmation that the refresh button is now hidden.
209
+
210
+ #### Example
211
+
212
+ **Simple usage**
213
+ ```typescript
214
+ // Initialize the container module
215
+ const containerModule = new ContainerModule();
216
+
217
+ // Hide refresh button
218
+ const response = await containerModule.hideRefreshButton();
219
+
220
+ switch (response.status_code) {
221
+ case 200:
222
+ console.log('Refresh button hidden successfully');
223
+ break;
224
+ case 501:
225
+ console.log('Not in Grab app:', response.error);
226
+ break;
227
+ }
228
+ ```
229
+
230
+ ***
231
+
232
+ ### invoke()
233
+
234
+ > **invoke**\<`T`\>(`options`: [`InvokeOptions`](../interfaces/InvokeOptions.md)\<`T`\>): `Promise`\<[`BridgeResponse`](../type-aliases/BridgeResponse.md)\<keyof [`StatusCodeMap`](../type-aliases/StatusCodeMap.md)\<`unknown`\>, `T`\>\>
235
+
236
+ Invokes a JSBridge method with optional app validation and response transformation.
237
+
238
+ #### Type Parameters
239
+
240
+ ##### T
241
+
242
+ `T`
243
+
244
+ #### Parameters
245
+
246
+ ##### options
247
+
248
+ [`InvokeOptions`](../interfaces/InvokeOptions.md)\<`T`\>
249
+
250
+ The invoke options including method name, params, validation, and transformation.
251
+
252
+ #### Returns
253
+
254
+ `Promise`\<[`BridgeResponse`](../type-aliases/BridgeResponse.md)\<keyof [`StatusCodeMap`](../type-aliases/StatusCodeMap.md)\<`unknown`\>, `T`\>\>
255
+
256
+ A promise resolving to the JSBridge response.
257
+
258
+ #### Remarks
259
+
260
+ - Always checks if running in Grab app (returns 501 if not).
261
+ - When `isSupported` returns false, returns 426 (Upgrade Required).
262
+ - When `transformResponse` is provided, applies it to successful responses.
263
+ - All errors are reported via the `status_code` field; this method never rejects.
264
+ - For streaming methods, use `invokeStream` instead.
265
+
266
+ #### Inherited from
267
+
268
+ [`BaseModule`](BaseModule.md).[`invoke`](BaseModule.md#invoke)
269
+
270
+ ***
271
+
272
+ ### invokeStream()
273
+
274
+ > **invokeStream**\<`T`\>(`options`: [`InvokeOptions`](../interfaces/InvokeOptions.md)\<`T`\>): [`BridgeStream`](../type-aliases/BridgeStream.md)\<keyof [`StatusCodeMap`](../type-aliases/StatusCodeMap.md)\<`unknown`\>, `T`\>
275
+
276
+ Invokes a JSBridge streaming method that returns a `BridgeStream`.
277
+
278
+ #### Type Parameters
279
+
280
+ ##### T
281
+
282
+ `T`
283
+
284
+ #### Parameters
285
+
286
+ ##### options
287
+
288
+ [`InvokeOptions`](../interfaces/InvokeOptions.md)\<`T`\>
289
+
290
+ The invoke options including method name, params, and validation.
291
+
292
+ #### Returns
293
+
294
+ [`BridgeStream`](../type-aliases/BridgeStream.md)\<keyof [`StatusCodeMap`](../type-aliases/StatusCodeMap.md)\<`unknown`\>, `T`\>
295
+
296
+ A `BridgeStream` for receiving continuous data from the JSBridge.
297
+
298
+ #### Remarks
299
+
300
+ - Always checks if running in Grab app (returns 501 error response if not).
301
+ - When `isSupported` returns false, returns 426 error response.
302
+ - Returns a `BridgeStream` that can be subscribed to or awaited for the first value.
303
+ - All errors are reported via error responses in the stream; this method never rejects.
304
+
305
+ #### Inherited from
306
+
307
+ [`BaseModule`](BaseModule.md).[`invokeStream`](BaseModule.md#invokestream)
308
+
309
+ ***
310
+
311
+ ### isConnected()
312
+
313
+ > **isConnected**(): `Promise`\<[`IsConnectedResponse`](../type-aliases/IsConnectedResponse.md)\>
314
+
315
+ Check if the web app is connected to the Grab SuperApp via JSBridge.
316
+
317
+ #### Returns
318
+
319
+ `Promise`\<[`IsConnectedResponse`](../type-aliases/IsConnectedResponse.md)\>
320
+
321
+ The connection status, indicating whether the MiniApp is running inside the Grab SuperApp.
322
+
323
+ #### Remarks
324
+
325
+ Call this method to verify the connection status before using other features.
326
+
327
+ #### Example
328
+
329
+ **Simple usage**
330
+ ```typescript
331
+ // Initialize the container module
332
+ const containerModule = new ContainerModule();
333
+
334
+ // Check connection status
335
+ const response = await containerModule.isConnected();
336
+
337
+ switch (response.status_code) {
338
+ case 200:
339
+ console.log('Connected to Grab SuperApp');
340
+ break;
341
+ case 404:
342
+ console.log('Not connected to Grab SuperApp');
343
+ break;
344
+ default:
345
+ console.log('Unexpected status code:', response);
346
+ }
347
+ ```
348
+
349
+ ***
350
+
351
+ ### onContentLoaded()
352
+
353
+ > **onContentLoaded**(): `Promise`\<[`OnContentLoadedResponse`](../type-aliases/OnContentLoadedResponse.md)\>
354
+
355
+ Notify the Grab SuperApp that the page content has loaded.
356
+
357
+ #### Returns
358
+
359
+ `Promise`\<[`OnContentLoadedResponse`](../type-aliases/OnContentLoadedResponse.md)\>
360
+
361
+ Confirmation that the content loaded notification was sent.
362
+
363
+ #### Example
364
+
365
+ **Simple usage**
366
+ ```typescript
367
+ // Initialize the container module
368
+ const containerModule = new ContainerModule();
369
+
370
+ // Notify content loaded
371
+ const response = await containerModule.onContentLoaded();
372
+
373
+ switch (response.status_code) {
374
+ case 200:
375
+ console.log('Content loaded notification sent successfully');
376
+ break;
377
+ case 501:
378
+ console.log('Not in Grab app:', response.error);
379
+ break;
380
+ }
381
+ ```
382
+
383
+ ***
384
+
385
+ ### onCtaTap()
386
+
387
+ > **onCtaTap**(`request`: `string`): `Promise`\<[`OnCtaTapResponse`](../type-aliases/OnCtaTapResponse.md)\>
388
+
389
+ Notify the client that the user has tapped a call-to-action (CTA).
390
+
391
+ #### Parameters
392
+
393
+ ##### request
394
+
395
+ `string`
396
+
397
+ The action identifier for the CTA that was tapped.
398
+
399
+ #### Returns
400
+
401
+ `Promise`\<[`OnCtaTapResponse`](../type-aliases/OnCtaTapResponse.md)\>
402
+
403
+ Confirmation that the CTA tap was notified.
404
+
405
+ #### Example
406
+
407
+ **Simple usage**
408
+ ```typescript
409
+ // Initialize the container module
410
+ const containerModule = new ContainerModule();
411
+
412
+ // Notify CTA tap
413
+ const response = await containerModule.onCtaTap('AV_LANDING_PAGE_CONTINUE');
414
+
415
+ switch (response.status_code) {
416
+ case 200:
417
+ console.log('CTA tap notified successfully');
418
+ break;
419
+ case 501:
420
+ console.log('Not in Grab app:', response.error);
421
+ break;
422
+ }
423
+ ```
424
+
425
+ ***
426
+
427
+ ### openExternalLink()
428
+
429
+ > **openExternalLink**(`request`: `string`): `Promise`\<[`OpenExternalLinkResponse`](../type-aliases/OpenExternalLinkResponse.md)\>
430
+
431
+ Open a link in the external browser.
432
+
433
+ #### Parameters
434
+
435
+ ##### request
436
+
437
+ `string`
438
+
439
+ The URL to open in the external browser.
440
+
441
+ #### Returns
442
+
443
+ `Promise`\<[`OpenExternalLinkResponse`](../type-aliases/OpenExternalLinkResponse.md)\>
444
+
445
+ Confirmation of whether the external link was opened successfully.
446
+
447
+ #### Remarks
448
+
449
+ Call this method to open the specified URL in an external browser (outside of the Grab app).
450
+
451
+ #### Example
452
+
453
+ **Simple usage**
454
+ ```typescript
455
+ // Initialize the container module
456
+ const containerModule = new ContainerModule();
457
+
458
+ // Open external link
459
+ const response = await containerModule.openExternalLink('https://grab.com');
460
+
461
+ switch (response.status_code) {
462
+ case 200:
463
+ console.log('External link opened successfully');
464
+ break;
465
+ case 400:
466
+ console.log('Could not open external link:', response.error);
467
+ break;
468
+ case 501:
469
+ console.log('Not in Grab app:', response.error);
470
+ break;
471
+ default:
472
+ console.log('Unexpected status code:', response);
473
+ }
474
+ ```
475
+
476
+ ***
477
+
478
+ ### sendAnalyticsEvent()
479
+
480
+ > **sendAnalyticsEvent**(`request`: [`SendAnalyticsEventRequest`](../type-aliases/SendAnalyticsEventRequest.md)): `Promise`\<[`SendAnalyticsEventResponse`](../type-aliases/SendAnalyticsEventResponse.md)\>
481
+
482
+ Use this method to track user interactions and page transitions.
483
+
484
+ #### Parameters
485
+
486
+ ##### request
487
+
488
+ [`SendAnalyticsEventRequest`](../type-aliases/SendAnalyticsEventRequest.md)
489
+
490
+ Analytics event details including state, name, and optional data.
491
+
492
+ #### Returns
493
+
494
+ `Promise`\<[`SendAnalyticsEventResponse`](../type-aliases/SendAnalyticsEventResponse.md)\>
495
+
496
+ Confirmation of whether the analytics event was sent successfully.
497
+
498
+ #### Remarks
499
+
500
+ You can use predefined constants to ensure consistency across the platform.
501
+
502
+ **Predefined Values:**
503
+ - **States:** [ContainerAnalyticsEventState](../variables/ContainerAnalyticsEventState.md)
504
+ - **Names:** [ContainerAnalyticsEventName](../variables/ContainerAnalyticsEventName.md)
505
+
506
+ #### Throws
507
+
508
+ Error when the JSBridge method fails unexpectedly.
509
+
510
+ #### See
511
+
512
+ [ContainerAnalyticsEventState](../variables/ContainerAnalyticsEventState.md), [ContainerAnalyticsEventName](../variables/ContainerAnalyticsEventName.md)
513
+
514
+ #### Example
515
+
516
+ **Simple usage**
517
+ ```typescript
518
+ // Imports using ES Module built
519
+ import {
520
+ ContainerAnalyticsEventState,
521
+ ContainerAnalyticsEventName,
522
+ } from '@grabjs/superapp-sdk';
523
+ // Imports using UMD built (via CDN)
524
+ const {
525
+ ContainerAnalyticsEventState,
526
+ ContainerAnalyticsEventName,
527
+ } = window.SuperAppSDK;
528
+
529
+ // Initialize the container module
530
+ const containerModule = new ContainerModule();
531
+
532
+ // Send analytics event
533
+ const response = await containerModule.sendAnalyticsEvent({
534
+ state: ContainerAnalyticsEventState.HOMEPAGE,
535
+ name: ContainerAnalyticsEventName.DEFAULT,
536
+ });
537
+
538
+ switch (response.status_code) {
539
+ case 200:
540
+ console.log('Analytics event sent successfully');
541
+ break;
542
+ case 400:
543
+ console.log('Invalid analytics event parameters:', response.error);
544
+ break;
545
+ case 501:
546
+ console.log('Not in Grab app:', response.error);
547
+ break;
548
+ default:
549
+ console.log('Unexpected status code:', response);
550
+ }
551
+ ```
552
+
553
+ ***
554
+
555
+ ### setBackgroundColor()
556
+
557
+ > **setBackgroundColor**(`request`: `string`): `Promise`\<[`SetBackgroundColorResponse`](../type-aliases/SetBackgroundColorResponse.md)\>
558
+
559
+ Set the background color of the container header.
560
+
561
+ #### Parameters
562
+
563
+ ##### request
564
+
565
+ `string`
566
+
567
+ The background color to set (hex format, e.g., '#ffffff').
568
+
569
+ #### Returns
570
+
571
+ `Promise`\<[`SetBackgroundColorResponse`](../type-aliases/SetBackgroundColorResponse.md)\>
572
+
573
+ Confirmation that the background color was set.
574
+
575
+ #### Example
576
+
577
+ **Simple usage**
578
+ ```typescript
579
+ // Initialize the container module
580
+ const containerModule = new ContainerModule();
581
+
582
+ // Set background color
583
+ const response = await containerModule.setBackgroundColor('#ffffff');
584
+
585
+ switch (response.status_code) {
586
+ case 200:
587
+ console.log('Background color set successfully');
588
+ break;
589
+ case 400:
590
+ console.log('Could not set background color:', response.error);
591
+ break;
592
+ case 501:
593
+ console.log('Not in Grab app:', response.error);
594
+ break;
595
+ default:
596
+ console.log('Unexpected status code:', response);
597
+ }
598
+ ```
599
+
600
+ ***
601
+
602
+ ### setTitle()
603
+
604
+ > **setTitle**(`request`: `string`): `Promise`\<[`SetTitleResponse`](../type-aliases/SetTitleResponse.md)\>
605
+
606
+ Set the title of the container header.
607
+
608
+ #### Parameters
609
+
610
+ ##### request
611
+
612
+ `string`
613
+
614
+ The title text to display in the header.
615
+
616
+ #### Returns
617
+
618
+ `Promise`\<[`SetTitleResponse`](../type-aliases/SetTitleResponse.md)\>
619
+
620
+ Confirmation that the title was set.
621
+
622
+ #### Example
623
+
624
+ **Simple usage**
625
+ ```typescript
626
+ // Initialize the container module
627
+ const containerModule = new ContainerModule();
628
+
629
+ // Set title
630
+ const response = await containerModule.setTitle('Home');
631
+
632
+ switch (response.status_code) {
633
+ case 200:
634
+ console.log('Title set successfully');
635
+ break;
636
+ case 400:
637
+ console.log('Could not set title:', response.error);
638
+ break;
639
+ case 501:
640
+ console.log('Not in Grab app:', response.error);
641
+ break;
642
+ default:
643
+ console.log('Unexpected status code:', response);
644
+ }
645
+ ```
646
+
647
+ ***
648
+
649
+ ### showBackButton()
650
+
651
+ > **showBackButton**(): `Promise`\<[`ShowBackButtonResponse`](../type-aliases/ShowBackButtonResponse.md)\>
652
+
653
+ Show the back button on the container header.
654
+
655
+ #### Returns
656
+
657
+ `Promise`\<[`ShowBackButtonResponse`](../type-aliases/ShowBackButtonResponse.md)\>
658
+
659
+ Confirmation that the back button is now visible.
660
+
661
+ #### Example
662
+
663
+ **Simple usage**
664
+ ```typescript
665
+ // Initialize the container module
666
+ const containerModule = new ContainerModule();
667
+
668
+ // Show back button
669
+ const response = await containerModule.showBackButton();
670
+
671
+ switch (response.status_code) {
672
+ case 200:
673
+ console.log('Back button shown successfully');
674
+ break;
675
+ case 501:
676
+ console.log('Not in Grab app:', response.error);
677
+ break;
678
+ }
679
+ ```
680
+
681
+ ***
682
+
683
+ ### showLoader()
684
+
685
+ > **showLoader**(): `Promise`\<[`ShowLoaderResponse`](../type-aliases/ShowLoaderResponse.md)\>
686
+
687
+ Show the full-screen loading indicator.
688
+
689
+ #### Returns
690
+
691
+ `Promise`\<[`ShowLoaderResponse`](../type-aliases/ShowLoaderResponse.md)\>
692
+
693
+ Confirmation that the loader is now visible.
694
+
695
+ #### Remarks
696
+
697
+ Remember to call [ContainerModule.hideLoader](#hideloader) when the operation completes.
698
+
699
+ #### Example
700
+
701
+ **Simple usage**
702
+ ```typescript
703
+ // Initialize the container module
704
+ const containerModule = new ContainerModule();
705
+
706
+ // Show loader
707
+ const response = await containerModule.showLoader();
708
+
709
+ switch (response.status_code) {
710
+ case 200:
711
+ console.log('Loader shown successfully');
712
+ break;
713
+ case 501:
714
+ console.log('Not in Grab app:', response.error);
715
+ break;
716
+ }
717
+ ```
718
+
719
+ ***
720
+
721
+ ### showRefreshButton()
722
+
723
+ > **showRefreshButton**(): `Promise`\<[`ShowRefreshButtonResponse`](../type-aliases/ShowRefreshButtonResponse.md)\>
724
+
725
+ Show the refresh button on the container header.
726
+
727
+ #### Returns
728
+
729
+ `Promise`\<[`ShowRefreshButtonResponse`](../type-aliases/ShowRefreshButtonResponse.md)\>
730
+
731
+ Confirmation that the refresh button is now visible.
732
+
733
+ #### Example
734
+
735
+ **Simple usage**
736
+ ```typescript
737
+ // Initialize the container module
738
+ const containerModule = new ContainerModule();
739
+
740
+ // Show refresh button
741
+ const response = await containerModule.showRefreshButton();
742
+
743
+ switch (response.status_code) {
744
+ case 200:
745
+ console.log('Refresh button shown successfully');
746
+ break;
747
+ case 501:
748
+ console.log('Not in Grab app:', response.error);
749
+ break;
750
+ }
751
+ ```