@glomopay/react-native-sdk 2.0.2 → 3.1.0

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 (80) hide show
  1. package/CHANGELOG.md +79 -0
  2. package/MIGRATION.md +50 -0
  3. package/README.md +348 -316
  4. package/lib/config/base.d.ts +17 -11
  5. package/lib/config/base.d.ts.map +1 -1
  6. package/lib/config/base.js +19 -7
  7. package/lib/config/segment.js +3 -3
  8. package/lib/glomo-checkout.d.ts +8 -0
  9. package/lib/glomo-checkout.d.ts.map +1 -0
  10. package/lib/glomo-checkout.js +106 -0
  11. package/lib/glomo-lrs-checkout.js +9 -9
  12. package/lib/glomo-standard-checkout.d.ts +25 -0
  13. package/lib/glomo-standard-checkout.d.ts.map +1 -0
  14. package/lib/glomo-standard-checkout.js +229 -0
  15. package/lib/glomo-subscriptions-checkout.d.ts +8 -0
  16. package/lib/glomo-subscriptions-checkout.d.ts.map +1 -0
  17. package/lib/glomo-subscriptions-checkout.js +85 -0
  18. package/lib/index.d.ts +5 -4
  19. package/lib/index.d.ts.map +1 -1
  20. package/lib/index.js +7 -5
  21. package/lib/injections/index.d.ts +1 -0
  22. package/lib/injections/index.d.ts.map +1 -1
  23. package/lib/injections/index.js +2 -0
  24. package/lib/injections/webview-flow.injection.d.ts.map +1 -1
  25. package/lib/injections/webview-flow.injection.js +106 -69
  26. package/lib/injections/webview-main.injection.d.ts.map +1 -1
  27. package/lib/injections/webview-main.injection.js +112 -77
  28. package/lib/injections/webview-standard.injection.d.ts +3 -0
  29. package/lib/injections/webview-standard.injection.d.ts.map +1 -0
  30. package/lib/injections/webview-standard.injection.js +214 -0
  31. package/lib/services/order-type-fetcher.d.ts +28 -0
  32. package/lib/services/order-type-fetcher.d.ts.map +1 -0
  33. package/lib/services/order-type-fetcher.js +99 -0
  34. package/lib/types/checkout.d.ts +65 -0
  35. package/lib/types/checkout.d.ts.map +1 -0
  36. package/lib/types/checkout.js +3 -0
  37. package/lib/types/standard-checkout.d.ts +40 -0
  38. package/lib/types/standard-checkout.d.ts.map +1 -0
  39. package/lib/types/standard-checkout.js +3 -0
  40. package/lib/types/subscriptions-checkout.d.ts +29 -0
  41. package/lib/types/subscriptions-checkout.d.ts.map +1 -0
  42. package/lib/types/subscriptions-checkout.js +3 -0
  43. package/lib/use-glomo-checkout.d.ts +54 -0
  44. package/lib/use-glomo-checkout.d.ts.map +1 -0
  45. package/lib/use-glomo-checkout.js +261 -0
  46. package/lib/use-lrs-checkout.d.ts +9 -4
  47. package/lib/use-lrs-checkout.d.ts.map +1 -1
  48. package/lib/use-lrs-checkout.js +76 -93
  49. package/lib/use-standard-checkout.d.ts +74 -0
  50. package/lib/use-standard-checkout.d.ts.map +1 -0
  51. package/lib/use-standard-checkout.js +849 -0
  52. package/lib/utils/analytics.d.ts +188 -2
  53. package/lib/utils/analytics.d.ts.map +1 -1
  54. package/lib/utils/analytics.js +636 -22
  55. package/lib/utils/device-compliance.d.ts.map +1 -1
  56. package/lib/utils/device-compliance.js +3 -4
  57. package/lib/utils/validation.d.ts.map +1 -1
  58. package/lib/utils/validation.js +7 -6
  59. package/package.json +17 -5
  60. package/src/config/base.ts +36 -17
  61. package/src/config/segment.ts +3 -3
  62. package/src/glomo-checkout.tsx +147 -0
  63. package/src/glomo-lrs-checkout.tsx +9 -9
  64. package/src/glomo-standard-checkout.tsx +353 -0
  65. package/src/glomo-subscriptions-checkout.tsx +83 -0
  66. package/src/index.ts +13 -7
  67. package/src/injections/index.ts +2 -0
  68. package/src/injections/webview-flow.injection.ts +106 -69
  69. package/src/injections/webview-main.injection.ts +112 -77
  70. package/src/injections/webview-standard.injection.ts +211 -0
  71. package/src/services/order-type-fetcher.ts +86 -0
  72. package/src/types/checkout.ts +72 -0
  73. package/src/types/standard-checkout.ts +49 -0
  74. package/src/types/subscriptions-checkout.ts +31 -0
  75. package/src/use-glomo-checkout.tsx +369 -0
  76. package/src/use-lrs-checkout.tsx +91 -111
  77. package/src/use-standard-checkout.tsx +1203 -0
  78. package/src/utils/analytics.ts +908 -34
  79. package/src/utils/device-compliance.ts +3 -4
  80. package/src/utils/validation.ts +7 -8
@@ -0,0 +1,849 @@
1
+ "use strict";
2
+ /** Main SDK hook for the GlomoPay Standard Checkout flow */
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.useStandardCheckout = useStandardCheckout;
5
+ const react_1 = require("react");
6
+ const react_native_1 = require("react-native");
7
+ const index_1 = require("./injections/index");
8
+ const segment_1 = require("./config/segment");
9
+ const base_1 = require("./config/base");
10
+ const validation_1 = require("./utils/validation");
11
+ const device_compliance_1 = require("./utils/device-compliance");
12
+ const analytics_1 = require("./utils/analytics");
13
+ /** The main SDK hook for the GlomoPay Standard Checkout flow */
14
+ function useStandardCheckout({ server, publicKey, orderId, onPaymentSuccess, onPaymentFailure, onConnectionError, onPaymentTerminate, onSdkError, onBankTransferSubmitted, onPayViaBankCompleted, onPayViaBankBankConnectionSuccessful, onUserRefusedCameraPermissions, devMode = false, }, mockMode, internalOptions) {
15
+ var _a;
16
+ // Resolving analytics trackers - defaults to standard, subscription flow overrides
17
+ const trackers = (_a = internalOptions === null || internalOptions === void 0 ? void 0 : internalOptions.analyticsTrackers) !== null && _a !== void 0 ? _a : analytics_1.standardCheckoutTrackers;
18
+ // Refs for the WebViews
19
+ const mainWebViewRef = (0, react_1.useRef)(null);
20
+ const flowWebViewRef = (0, react_1.useRef)(null);
21
+ // Deduplication guard - prevents firing onPayViaBankCompleted twice when both main and flow WebViews emit the event
22
+ const payViaBankCompletedHandledRef = (0, react_1.useRef)(false);
23
+ // Resolving checkout URL from the selected SDK server
24
+ const serverConfig = (0, react_1.useMemo)(() => (0, base_1.resolveServerConfig)(server), [server]);
25
+ const baseCheckoutUrl = serverConfig.baseUrl.standardCheckout;
26
+ /**
27
+ * The main checkout URL for the standard flow
28
+ */
29
+ const checkoutUrl = (0, react_1.useMemo)(() => {
30
+ try {
31
+ // Building the query string manually since URLSearchParams is not fully supported in React Native
32
+ const baseParams = [`orderId=${encodeURIComponent(orderId)}`];
33
+ const mode = mockMode ? "mock" : "live";
34
+ const params = baseParams.concat(`mode=${encodeURIComponent(mode)}`, `publicKey=${encodeURIComponent(publicKey)}`);
35
+ const queryString = params.join("&");
36
+ // Handling base URL with or without existing query parameters
37
+ const separator = baseCheckoutUrl.includes("?") ? "&" : "?";
38
+ const finalUrl = `${baseCheckoutUrl}${separator}${queryString}`;
39
+ // Validating the final URL
40
+ if (!(0, validation_1.isValidUrl)(finalUrl)) {
41
+ if (devMode) {
42
+ console.error("[Glomo-RN-SDK Standard] Generated invalid checkout URL:", finalUrl);
43
+ }
44
+ return "";
45
+ }
46
+ if (devMode) {
47
+ console.log("[Glomo-RN-SDK Standard] Checkout URL:", finalUrl);
48
+ }
49
+ return finalUrl;
50
+ }
51
+ catch (error) {
52
+ if (devMode) {
53
+ console.error("[Glomo-RN-SDK Standard] Error building checkout URL:", error);
54
+ }
55
+ return "";
56
+ }
57
+ }, [baseCheckoutUrl, orderId, publicKey, mockMode, devMode]);
58
+ // Checkout status state
59
+ const [status, setStatus] = (0, react_1.useState)("ready");
60
+ // Visibility state for the main checkout modal
61
+ const [showCheckout, setShowCheckout] = (0, react_1.useState)(false);
62
+ const [showFlowWebView, setShowFlowWebView] = (0, react_1.useState)(false);
63
+ const [flowWebViewUrl, setFlowWebViewUrl] = (0, react_1.useState)("");
64
+ (0, react_1.useEffect)(() => {
65
+ if (devMode) {
66
+ console.log(`[Glomo-RN-SDK Standard] State snapshot: status=${status}, showCheckout=${showCheckout}, showFlowWebView=${showFlowWebView}, flowWebViewUrl=${flowWebViewUrl || "<empty>"}`);
67
+ }
68
+ }, [devMode, status, showCheckout, showFlowWebView, flowWebViewUrl]);
69
+ // Handler for the WebView errors
70
+ const handleError = (0, react_1.useCallback)((syntheticEvent) => {
71
+ try {
72
+ const { nativeEvent } = syntheticEvent;
73
+ // Now checking for connection errors
74
+ // iOS: NSURLErrorDomain errors
75
+ const isIOSConnectionError = (nativeEvent === null || nativeEvent === void 0 ? void 0 : nativeEvent.domain) === "NSURLErrorDomain" &&
76
+ ((nativeEvent === null || nativeEvent === void 0 ? void 0 : nativeEvent.code) === -1004 || // Could not connect to the server
77
+ (nativeEvent === null || nativeEvent === void 0 ? void 0 : nativeEvent.code) === -1009 || // The Internet connection appears to be offline
78
+ (nativeEvent === null || nativeEvent === void 0 ? void 0 : nativeEvent.code) === -1001 || // The request timed out
79
+ (nativeEvent === null || nativeEvent === void 0 ? void 0 : nativeEvent.code) === -1003); // Cannot find host
80
+ // Android: Network errors
81
+ const description = (nativeEvent === null || nativeEvent === void 0 ? void 0 : nativeEvent.description) || "";
82
+ const isAndroidConnectionError = typeof description === "string" &&
83
+ (description.includes("ERR_EMPTY_RESPONSE") || // Server unreachable
84
+ description.includes("ERR_CONNECTION_REFUSED") || // Connection refused
85
+ description.includes("ERR_NAME_NOT_RESOLVED") || // DNS resolution failed
86
+ description.includes("ERR_INTERNET_DISCONNECTED") || // No internet
87
+ description.includes("ERR_CONNECTION_TIMED_OUT") || // Connection timeout
88
+ description.includes("ERR_NETWORK_CHANGED")); // Network changed
89
+ if (isIOSConnectionError || isAndroidConnectionError) {
90
+ if (devMode) {
91
+ console.error("[Glomo-RN-SDK Standard] Connection error:", nativeEvent);
92
+ }
93
+ // Closing the checkout modal
94
+ setShowCheckout(false);
95
+ setShowFlowWebView(false);
96
+ setFlowWebViewUrl("");
97
+ // Calling onConnectionError callback if provided
98
+ (0, validation_1.safeCallback)(onConnectionError, [nativeEvent], "onConnectionError", devMode);
99
+ // Tracking connection error
100
+ trackers.trackConnectionError(orderId, nativeEvent === null || nativeEvent === void 0 ? void 0 : nativeEvent.code, publicKey, devMode, mockMode, checkoutUrl);
101
+ }
102
+ else {
103
+ if (devMode) {
104
+ console.error("[Glomo-RN-SDK Standard] WebView error:", nativeEvent);
105
+ }
106
+ }
107
+ }
108
+ catch (error) {
109
+ if (devMode) {
110
+ console.error("[Glomo-RN-SDK Standard] Error in handleError:", error);
111
+ }
112
+ }
113
+ }, [devMode, onConnectionError, checkoutUrl, orderId, publicKey, mockMode, trackers]);
114
+ // Handler for the WebView HTTP errors
115
+ const handleHttpError = (0, react_1.useCallback)((syntheticEvent) => {
116
+ try {
117
+ const { nativeEvent } = syntheticEvent;
118
+ if (devMode) {
119
+ console.error("[Glomo-RN-SDK Standard] WebView HTTP error:", nativeEvent);
120
+ }
121
+ }
122
+ catch (error) {
123
+ if (devMode) {
124
+ console.error("[Glomo-RN-SDK Standard] Error in handleHttpError:", error);
125
+ }
126
+ }
127
+ }, [devMode]);
128
+ /**
129
+ * Handler for the main WebView messages.
130
+ * The main WebView hosts the checkout page. Messages arrive as JSON strings from the injected
131
+ * JavaScript bridge and include console logs, window.open/close interceptions, and payment
132
+ * lifecycle events (success, failure, terminate, bank transfer, pay via bank).
133
+ */
134
+ const handleMainWebViewMessage = (0, react_1.useCallback)((event) => {
135
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
136
+ try {
137
+ // Extracting and validating the raw message data from the WebView event
138
+ const data = (_a = event.nativeEvent) === null || _a === void 0 ? void 0 : _a.data;
139
+ if (!data || typeof data !== "string") {
140
+ if (devMode) {
141
+ console.warn("[Glomo-RN-SDK Standard] Invalid message data from MainWebView");
142
+ }
143
+ // Tracking invalid message received
144
+ trackers.trackInvalidMessageReceived("main", data, checkoutUrl, orderId, publicKey, devMode, mockMode, checkoutUrl);
145
+ return;
146
+ }
147
+ const message = JSON.parse(data);
148
+ if (devMode) {
149
+ console.log("[Glomo-RN-SDK Standard] MainWebView Message received:", message.type, message);
150
+ }
151
+ // Forwarding console messages from the injected script to the React Native console
152
+ if (message.type === "console") {
153
+ if (devMode) {
154
+ const level = message.level || "log";
155
+ console.log(`[Glomo-RN-SDK Standard] [WebView ${level.toUpperCase()}]`, message.message);
156
+ }
157
+ return;
158
+ }
159
+ // Intercepting window.open calls - opening the target URL in the flow WebView overlay
160
+ if (message.type === "window.open") {
161
+ const url = message.url;
162
+ if (url && typeof url === "string" && (0, validation_1.isValidUrl)(url)) {
163
+ if (devMode) {
164
+ console.log(`[Glomo-RN-SDK Standard] window.open called from MainWebView: ${url}`);
165
+ }
166
+ setFlowWebViewUrl(url);
167
+ setShowFlowWebView(true);
168
+ // Tracking window.open interception
169
+ trackers.trackWindowOpen("main", url, orderId, publicKey, devMode, mockMode, checkoutUrl);
170
+ }
171
+ else {
172
+ if (devMode) {
173
+ console.log("[Glomo-RN-SDK Standard] Invalid URL in window.open from MainWebView:", url, typeof url === "undefined" ? "undefined" : "");
174
+ }
175
+ }
176
+ return;
177
+ }
178
+ // Intercepting window.close calls - closing the flow WebView overlay
179
+ if (message.type === "window.close") {
180
+ if (devMode) {
181
+ console.log("[Glomo-RN-SDK Standard] Child window close requested from MainWebView");
182
+ }
183
+ setShowFlowWebView(false);
184
+ setFlowWebViewUrl("");
185
+ // Tracking window.close interception
186
+ trackers.trackWindowClose("main", orderId, publicKey, devMode, mockMode, checkoutUrl);
187
+ return;
188
+ }
189
+ // Handling merchant JS callbacks on flow completion (payment events, lifecycle events)
190
+ if (message.type === "message" && message.message) {
191
+ const messageData = message.message;
192
+ const messageType = messageData === null || messageData === void 0 ? void 0 : messageData.type;
193
+ // Handling payment success - closing checkout and notifying the merchant
194
+ if (messageType === "payment.success" || messageType === "payment.complete") {
195
+ const paymentMessage = messageData;
196
+ const payload = paymentMessage === null || paymentMessage === void 0 ? void 0 : paymentMessage.payload;
197
+ if ((0, validation_1.isValidPaymentPayload)(payload)) {
198
+ if (devMode) {
199
+ console.log("[Glomo-RN-SDK Standard] Payment successful via merchant callback!");
200
+ }
201
+ setShowCheckout(false);
202
+ setShowFlowWebView(false);
203
+ setFlowWebViewUrl("");
204
+ setStatus("payment_successful");
205
+ (0, validation_1.safeCallback)(onPaymentSuccess, [payload], "onPaymentSuccess", devMode);
206
+ // Tracking payment success callback
207
+ trackers.trackPaymentSuccess(payload.orderId, payload.paymentId, publicKey, devMode, mockMode, checkoutUrl);
208
+ }
209
+ else {
210
+ if (devMode) {
211
+ console.error("[Glomo-RN-SDK Standard] Invalid payment success payload:", payload);
212
+ }
213
+ }
214
+ return;
215
+ }
216
+ // Handling payment failure - closing checkout and notifying the merchant
217
+ if (messageType === "payment.failure" || messageType === "payment.error") {
218
+ const paymentMessage = messageData;
219
+ const payload = paymentMessage === null || paymentMessage === void 0 ? void 0 : paymentMessage.payload;
220
+ if ((0, validation_1.isValidPaymentPayload)(payload)) {
221
+ if (devMode) {
222
+ console.error("[Glomo-RN-SDK Standard] Payment failed via merchant callback");
223
+ }
224
+ setShowCheckout(false);
225
+ setShowFlowWebView(false);
226
+ setFlowWebViewUrl("");
227
+ setStatus("payment_failed");
228
+ (0, validation_1.safeCallback)(onPaymentFailure, [payload], "onPaymentFailure", devMode);
229
+ // Tracking payment failure callback
230
+ trackers.trackPaymentFailure(payload.orderId, payload.paymentId, publicKey, devMode, mockMode, checkoutUrl);
231
+ }
232
+ else {
233
+ if (devMode) {
234
+ console.error("[Glomo-RN-SDK Standard] Invalid payment failure payload:", payload);
235
+ }
236
+ }
237
+ return;
238
+ }
239
+ // Handling bank transfer submission - user has submitted transfer details
240
+ if (messageType === "payment.bank_transfer_submitted") {
241
+ const payload = messageData === null || messageData === void 0 ? void 0 : messageData.payload;
242
+ if (devMode) {
243
+ console.log("[Glomo-RN-SDK Standard] Bank transfer submitted:", payload);
244
+ }
245
+ setShowCheckout(false);
246
+ setShowFlowWebView(false);
247
+ setFlowWebViewUrl("");
248
+ setStatus("bank_transfer_submitted");
249
+ (0, validation_1.safeCallback)(onBankTransferSubmitted, [
250
+ {
251
+ orderId: (_b = payload === null || payload === void 0 ? void 0 : payload.orderId) !== null && _b !== void 0 ? _b : "",
252
+ senderAccountNumber: (_c = payload === null || payload === void 0 ? void 0 : payload.senderAccountNumber) !== null && _c !== void 0 ? _c : "",
253
+ transactionReference: (_d = payload === null || payload === void 0 ? void 0 : payload.transactionReference) !== null && _d !== void 0 ? _d : "",
254
+ },
255
+ ], "onBankTransferSubmitted", devMode);
256
+ trackers.trackBankTransferSubmitted(orderId, publicKey, devMode, mockMode, checkoutUrl);
257
+ return;
258
+ }
259
+ // Handling pay via bank - bank connection successful event (informational, no status change)
260
+ if (messageType === "pay_via_bank.bank.connection_successful") {
261
+ const payload = messageData === null || messageData === void 0 ? void 0 : messageData.payload;
262
+ if (devMode) {
263
+ console.log("[Glomo-RN-SDK Standard] Pay via bank - bank connection successful:", payload);
264
+ }
265
+ (0, validation_1.safeCallback)(onPayViaBankBankConnectionSuccessful, [
266
+ {
267
+ bankIdentifier: (_e = payload === null || payload === void 0 ? void 0 : payload.bankIdentifier) !== null && _e !== void 0 ? _e : "",
268
+ cooldownPeriodInMinutes: (_f = payload === null || payload === void 0 ? void 0 : payload.cooldownPeriodInMinutes) !== null && _f !== void 0 ? _f : 0,
269
+ bankName: (_g = payload === null || payload === void 0 ? void 0 : payload.bankName) !== null && _g !== void 0 ? _g : "",
270
+ bankImageSrc: (_h = payload === null || payload === void 0 ? void 0 : payload.bankImageSrc) !== null && _h !== void 0 ? _h : "",
271
+ bankImageAlt: (_j = payload === null || payload === void 0 ? void 0 : payload.bankImageAlt) !== null && _j !== void 0 ? _j : "",
272
+ },
273
+ ], "onPayViaBankBankConnectionSuccessful", devMode);
274
+ trackers.trackPayViaBankBankConnectionSuccessful(orderId, publicKey, (_k = payload === null || payload === void 0 ? void 0 : payload.bankIdentifier) !== null && _k !== void 0 ? _k : "", devMode, mockMode, checkoutUrl);
275
+ return;
276
+ }
277
+ /**
278
+ * Handling the generic glomoCheckoutJourneyTerminate event.
279
+ * This event is fired by the checkout page when the pay via bank (lean/open finance)
280
+ * flow completes. The deduplication ref prevents firing the callback twice when both
281
+ * main and flow WebViews emit this event.
282
+ */
283
+ if (messageType === "glomoCheckoutJourneyTerminate") {
284
+ // Deduplication - both main and flow WebViews can emit this event
285
+ if (payViaBankCompletedHandledRef.current) {
286
+ if (devMode) {
287
+ console.log("[Glomo-RN-SDK Standard] Pay via bank completed already handled, ignoring duplicate");
288
+ }
289
+ return;
290
+ }
291
+ payViaBankCompletedHandledRef.current = true;
292
+ const payload = messageData === null || messageData === void 0 ? void 0 : messageData.payload;
293
+ if (devMode) {
294
+ console.log("[Glomo-RN-SDK Standard] Pay via bank completed via MainWebView:", payload);
295
+ }
296
+ setShowFlowWebView(false);
297
+ setShowCheckout(false);
298
+ setFlowWebViewUrl("");
299
+ setStatus("pay_via_bank_completed");
300
+ (0, validation_1.safeCallback)(onPayViaBankCompleted, [{ status: (_l = payload === null || payload === void 0 ? void 0 : payload.status) !== null && _l !== void 0 ? _l : "unknown" }], "onPayViaBankCompleted", devMode);
301
+ trackers.trackPayViaBankCompleted(orderId, publicKey, (_m = payload === null || payload === void 0 ? void 0 : payload.status) !== null && _m !== void 0 ? _m : "unknown", devMode, mockMode, checkoutUrl);
302
+ return;
303
+ }
304
+ // Handling checkout.closed events
305
+ if (messageType === "checkout.closed") {
306
+ if (devMode) {
307
+ console.log("[Glomo-RN-SDK Standard] Checkout closed event received");
308
+ }
309
+ setShowCheckout(false);
310
+ setShowFlowWebView(false);
311
+ setFlowWebViewUrl("");
312
+ (0, validation_1.safeCallback)(onPaymentTerminate, [], "onPaymentTerminate", devMode);
313
+ // Tracking payment terminate callback
314
+ trackers.trackPaymentTerminate(orderId, "checkout_closed", publicKey, devMode, mockMode, checkoutUrl);
315
+ return;
316
+ }
317
+ }
318
+ }
319
+ catch (error) {
320
+ if (devMode) {
321
+ console.error("[Glomo-RN-SDK Standard] Error parsing MainWebView message:", error);
322
+ }
323
+ }
324
+ }, [
325
+ onPaymentSuccess,
326
+ onPaymentFailure,
327
+ onPaymentTerminate,
328
+ onBankTransferSubmitted,
329
+ onPayViaBankCompleted,
330
+ onPayViaBankBankConnectionSuccessful,
331
+ devMode,
332
+ mockMode,
333
+ orderId,
334
+ publicKey,
335
+ checkoutUrl,
336
+ trackers,
337
+ ]);
338
+ /**
339
+ * Handler for the flow WebView messages.
340
+ * The flow WebView hosts child pages opened via window.open (e.g. 3DS, bank redirects).
341
+ * Message structure mirrors the main WebView handler but operates on the overlay WebView.
342
+ */
343
+ const handleFlowWebViewMessage = (0, react_1.useCallback)((event) => {
344
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
345
+ try {
346
+ // Extracting and validating the raw message data from the flow WebView event
347
+ const data = (_a = event.nativeEvent) === null || _a === void 0 ? void 0 : _a.data;
348
+ if (!data || typeof data !== "string") {
349
+ if (devMode) {
350
+ console.warn("[Glomo-RN-SDK Standard] Invalid message data from FlowWebView");
351
+ }
352
+ // Tracking invalid message received
353
+ trackers.trackInvalidMessageReceived("flow", data, flowWebViewUrl, orderId, publicKey, devMode, mockMode, checkoutUrl);
354
+ return;
355
+ }
356
+ const message = JSON.parse(data);
357
+ if (devMode) {
358
+ console.log("[Glomo-RN-SDK Standard] FlowWebView Message received:", message.type, message);
359
+ }
360
+ // Forwarding console messages from the flow WebView's injected script
361
+ if (message.type === "console") {
362
+ if (devMode) {
363
+ console.log(`[Glomo-RN-SDK Standard] [Flow] ${message.message}`);
364
+ }
365
+ return;
366
+ }
367
+ // Intercepting window.open calls from the flow WebView - navigating within the same overlay
368
+ if (message.type === "window.open") {
369
+ const url = message.url;
370
+ if (url && typeof url === "string" && (0, validation_1.isValidUrl)(url)) {
371
+ if (devMode) {
372
+ console.log(`[Glomo-RN-SDK Standard] window.open called from FlowWebView: ${url}`);
373
+ }
374
+ setFlowWebViewUrl(url);
375
+ // Tracking window.open interception
376
+ trackers.trackWindowOpen("flow", url, orderId, publicKey, devMode, mockMode, checkoutUrl);
377
+ }
378
+ else {
379
+ if (devMode) {
380
+ console.log("[Glomo-RN-SDK Standard] Invalid URL in window.open from FlowWebView:", url, typeof url === "undefined" ? "undefined" : "");
381
+ }
382
+ }
383
+ return;
384
+ }
385
+ // Intercepting window.close calls from the flow WebView - closing the overlay
386
+ if (message.type === "window.close") {
387
+ if (devMode) {
388
+ console.log("[Glomo-RN-SDK Standard] FlowWebView close requested");
389
+ }
390
+ setShowFlowWebView(false);
391
+ setFlowWebViewUrl("");
392
+ // Tracking window.close interception
393
+ trackers.trackWindowClose("flow", orderId, publicKey, devMode, mockMode, checkoutUrl);
394
+ return;
395
+ }
396
+ // Handling merchant JS callbacks from the flow WebView (payment events, lifecycle events)
397
+ if (message.type === "message" && message.message) {
398
+ const messageData = message.message;
399
+ const messageType = messageData === null || messageData === void 0 ? void 0 : messageData.type;
400
+ // Handling payment success from the flow WebView
401
+ if (messageType === "payment.success" || messageType === "payment.complete") {
402
+ const paymentMessage = messageData;
403
+ const payload = paymentMessage === null || paymentMessage === void 0 ? void 0 : paymentMessage.payload;
404
+ if ((0, validation_1.isValidPaymentPayload)(payload)) {
405
+ if (devMode) {
406
+ console.log("[Glomo-RN-SDK Standard] Payment successful via FlowWebView callback!");
407
+ }
408
+ setShowFlowWebView(false);
409
+ setShowCheckout(false);
410
+ setFlowWebViewUrl("");
411
+ setStatus("payment_successful");
412
+ (0, validation_1.safeCallback)(onPaymentSuccess, [payload], "onPaymentSuccess", devMode);
413
+ // Tracking payment success callback
414
+ trackers.trackPaymentSuccess(payload.orderId, payload.paymentId, publicKey, devMode, mockMode, checkoutUrl);
415
+ }
416
+ else {
417
+ if (devMode) {
418
+ console.error("[Glomo-RN-SDK Standard] Invalid payment success payload from FlowWebView:", payload);
419
+ }
420
+ }
421
+ return;
422
+ }
423
+ // Handling payment failure from the flow WebView
424
+ if (messageType === "payment.failure" || messageType === "payment.error") {
425
+ const paymentMessage = messageData;
426
+ const payload = paymentMessage === null || paymentMessage === void 0 ? void 0 : paymentMessage.payload;
427
+ if ((0, validation_1.isValidPaymentPayload)(payload)) {
428
+ if (devMode) {
429
+ console.error("[Glomo-RN-SDK Standard] Payment failed via FlowWebView callback");
430
+ }
431
+ setShowFlowWebView(false);
432
+ setShowCheckout(false);
433
+ setFlowWebViewUrl("");
434
+ setStatus("payment_failed");
435
+ (0, validation_1.safeCallback)(onPaymentFailure, [payload], "onPaymentFailure", devMode);
436
+ // Tracking payment failure callback
437
+ trackers.trackPaymentFailure(payload.orderId, payload.paymentId, publicKey, devMode, mockMode, checkoutUrl);
438
+ }
439
+ else {
440
+ if (devMode) {
441
+ console.error("[Glomo-RN-SDK Standard] Invalid payment failure payload from FlowWebView:", payload);
442
+ }
443
+ }
444
+ return;
445
+ }
446
+ // Handling pay via bank - bank connection successful event from the flow WebView
447
+ if (messageType === "pay_via_bank.bank.connection_successful") {
448
+ const payload = messageData === null || messageData === void 0 ? void 0 : messageData.payload;
449
+ if (devMode) {
450
+ console.log("[Glomo-RN-SDK Standard] Pay via bank - bank connection successful via FlowWebView:", payload);
451
+ }
452
+ (0, validation_1.safeCallback)(onPayViaBankBankConnectionSuccessful, [
453
+ {
454
+ bankIdentifier: (_b = payload === null || payload === void 0 ? void 0 : payload.bankIdentifier) !== null && _b !== void 0 ? _b : "",
455
+ cooldownPeriodInMinutes: (_c = payload === null || payload === void 0 ? void 0 : payload.cooldownPeriodInMinutes) !== null && _c !== void 0 ? _c : 0,
456
+ bankName: (_d = payload === null || payload === void 0 ? void 0 : payload.bankName) !== null && _d !== void 0 ? _d : "",
457
+ bankImageSrc: (_e = payload === null || payload === void 0 ? void 0 : payload.bankImageSrc) !== null && _e !== void 0 ? _e : "",
458
+ bankImageAlt: (_f = payload === null || payload === void 0 ? void 0 : payload.bankImageAlt) !== null && _f !== void 0 ? _f : "",
459
+ },
460
+ ], "onPayViaBankBankConnectionSuccessful", devMode);
461
+ trackers.trackPayViaBankBankConnectionSuccessful(orderId, publicKey, (_g = payload === null || payload === void 0 ? void 0 : payload.bankIdentifier) !== null && _g !== void 0 ? _g : "", devMode, mockMode, checkoutUrl);
462
+ return;
463
+ }
464
+ // Handling glomoCheckoutJourneyTerminate from the flow WebView (pay via bank completion)
465
+ if (messageType === "glomoCheckoutJourneyTerminate") {
466
+ // Deduplication - both main and flow WebViews can emit this event
467
+ if (payViaBankCompletedHandledRef.current) {
468
+ if (devMode) {
469
+ console.log("[Glomo-RN-SDK Standard] Pay via bank completed already handled, ignoring duplicate");
470
+ }
471
+ return;
472
+ }
473
+ payViaBankCompletedHandledRef.current = true;
474
+ const payload = messageData === null || messageData === void 0 ? void 0 : messageData.payload;
475
+ if (devMode) {
476
+ console.log("[Glomo-RN-SDK Standard] Pay via bank completed via FlowWebView:", payload);
477
+ }
478
+ setShowFlowWebView(false);
479
+ setShowCheckout(false);
480
+ setFlowWebViewUrl("");
481
+ setStatus("pay_via_bank_completed");
482
+ (0, validation_1.safeCallback)(onPayViaBankCompleted, [{ status: (_h = payload === null || payload === void 0 ? void 0 : payload.status) !== null && _h !== void 0 ? _h : "unknown" }], "onPayViaBankCompleted", devMode);
483
+ trackers.trackPayViaBankCompleted(orderId, publicKey, (_j = payload === null || payload === void 0 ? void 0 : payload.status) !== null && _j !== void 0 ? _j : "unknown", devMode, mockMode, checkoutUrl);
484
+ return;
485
+ }
486
+ }
487
+ }
488
+ catch (error) {
489
+ if (devMode) {
490
+ console.error("[Glomo-RN-SDK Standard] Error parsing FlowWebView message:", error);
491
+ }
492
+ }
493
+ }, [
494
+ onPaymentSuccess,
495
+ onPaymentFailure,
496
+ onPayViaBankCompleted,
497
+ onPayViaBankBankConnectionSuccessful,
498
+ devMode,
499
+ mockMode,
500
+ orderId,
501
+ publicKey,
502
+ flowWebViewUrl,
503
+ checkoutUrl,
504
+ trackers,
505
+ ]);
506
+ // Handler for the navigation state changes
507
+ const handleNavigationStateChange = (0, react_1.useCallback)((navState) => {
508
+ if (devMode) {
509
+ console.log("[Glomo-RN-SDK Standard] Navigation state:", navState);
510
+ }
511
+ }, [devMode]);
512
+ // Handler for the modal back button press events
513
+ const handleModalBackButton = (0, react_1.useCallback)(() => {
514
+ try {
515
+ if (devMode) {
516
+ console.log("[Glomo-RN-SDK Standard] Modal dismissed/back button pressed");
517
+ }
518
+ if (showFlowWebView) {
519
+ setShowFlowWebView(false);
520
+ setFlowWebViewUrl("");
521
+ }
522
+ setShowCheckout(false);
523
+ if (status === "payment_in_progress") {
524
+ if (devMode) {
525
+ console.log("[Glomo-RN-SDK Standard] In progress payment cancelled");
526
+ }
527
+ setStatus("payment_cancelled");
528
+ }
529
+ else {
530
+ if (devMode) {
531
+ console.log("[Glomo-RN-SDK Standard] Ignoring checkout status update for: " + status);
532
+ }
533
+ }
534
+ (0, validation_1.safeCallback)(onPaymentTerminate, [], "onPaymentTerminate", devMode);
535
+ // Tracking payment terminate callback (user dismiss/back button)
536
+ const terminateSource = react_native_1.Platform.OS === "ios" ? "user_dismiss" : "back_button";
537
+ trackers.trackPaymentTerminate(orderId, terminateSource, publicKey, devMode, mockMode, checkoutUrl);
538
+ }
539
+ catch (error) {
540
+ if (devMode) {
541
+ console.error("[Glomo-RN-SDK Standard] Error in handleModalBackButton:", error);
542
+ }
543
+ }
544
+ }, [showFlowWebView, devMode, onPaymentTerminate, status, orderId, publicKey, mockMode, checkoutUrl, trackers]);
545
+ /** Closes the flow WebView and returns to the main checkout */
546
+ const handleFlowBack = (0, react_1.useCallback)(() => {
547
+ if (devMode) {
548
+ console.log("[Glomo-RN-SDK Standard] Flow WebView back button pressed");
549
+ }
550
+ setShowFlowWebView(false);
551
+ setFlowWebViewUrl("");
552
+ trackers.trackWindowClose("flow", orderId, publicKey, devMode, mockMode, checkoutUrl);
553
+ }, [devMode, orderId, publicKey, mockMode, checkoutUrl, trackers]);
554
+ /**
555
+ * Handler for WebView permission requests (e.g. camera access for bank authentication).
556
+ * On Android, prompts the user for camera permission via PermissionsAndroid.
557
+ * On iOS, grants camera access automatically (iOS handles its own permission prompt).
558
+ * Non-camera permissions are denied by default.
559
+ */
560
+ const handlePermissionRequest = (0, react_1.useCallback)(async (request) => {
561
+ try {
562
+ const { resources } = request.nativeEvent;
563
+ // Checking if the requested permission is camera-related
564
+ const isCameraPermissionRequest = resources.some((resource) => resource === "camera" || resource.toLowerCase().includes("camera"));
565
+ if (!isCameraPermissionRequest) {
566
+ if (devMode) {
567
+ console.log("[Glomo-RN-SDK Standard] Non-camera permission requested, denying:", resources);
568
+ }
569
+ request.deny();
570
+ return;
571
+ }
572
+ if (devMode) {
573
+ console.log("[Glomo-RN-SDK Standard] Camera permission requested by webpage");
574
+ }
575
+ if (react_native_1.Platform.OS === "android") {
576
+ try {
577
+ const granted = await react_native_1.PermissionsAndroid.request(react_native_1.PermissionsAndroid.PERMISSIONS.CAMERA, {
578
+ title: "Camera Permission",
579
+ message: "This app needs camera access for identity verification during checkout",
580
+ buttonNeutral: "Ask Me Later",
581
+ buttonNegative: "Cancel",
582
+ buttonPositive: "OK",
583
+ });
584
+ if (granted === react_native_1.PermissionsAndroid.RESULTS.GRANTED) {
585
+ if (devMode) {
586
+ console.log("[Glomo-RN-SDK Standard] Camera permission granted");
587
+ }
588
+ request.grant(resources);
589
+ }
590
+ else {
591
+ if (devMode) {
592
+ console.log("[Glomo-RN-SDK Standard] Camera permission denied by user");
593
+ }
594
+ setShowCheckout(false);
595
+ if (status === "payment_in_progress") {
596
+ setStatus("payment_cancelled");
597
+ }
598
+ (0, validation_1.safeCallback)(onUserRefusedCameraPermissions, [], "onUserRefusedCameraPermissions", devMode);
599
+ request.deny();
600
+ }
601
+ }
602
+ catch (err) {
603
+ if (devMode) {
604
+ console.error("[Glomo-RN-SDK Standard] Error requesting camera permission:", err);
605
+ }
606
+ setShowCheckout(false);
607
+ if (status === "payment_in_progress") {
608
+ setStatus("payment_cancelled");
609
+ }
610
+ (0, validation_1.safeCallback)(onUserRefusedCameraPermissions, [], "onUserRefusedCameraPermissions", devMode);
611
+ request.deny();
612
+ }
613
+ }
614
+ else if (react_native_1.Platform.OS === "ios") {
615
+ if (devMode) {
616
+ console.log("[Glomo-RN-SDK Standard] Granting camera permission request on iOS");
617
+ }
618
+ request.grant(resources);
619
+ }
620
+ else {
621
+ if (devMode) {
622
+ console.warn("[Glomo-RN-SDK Standard] Unsupported platform for camera permissions");
623
+ }
624
+ request.deny();
625
+ }
626
+ }
627
+ catch (error) {
628
+ if (devMode) {
629
+ console.error("[Glomo-RN-SDK Standard] Error in handlePermissionRequest:", error);
630
+ }
631
+ request.deny();
632
+ }
633
+ }, [devMode, status, onUserRefusedCameraPermissions]);
634
+ /**
635
+ * Initiator method for the Standard Checkout flow.
636
+ * Using a ref, the standard flow can be started by calling this method.
637
+ * Example:
638
+ * const checkoutRef = useRef<GlomoStandardCheckoutRef>(null);
639
+ * checkoutRef.current?.start();
640
+ *
641
+ * The standard checkout can only be started if
642
+ * - The status is "ready", "payment_cancelled", or "payment_failed"
643
+ * - The status is NOT "payment_successful"
644
+ * - Input validation passes
645
+ */
646
+ const start = (0, react_1.useCallback)(() => {
647
+ /**
648
+ * Checking device security compliance (if peerDependencies are available)
649
+ * A null value indicates that recommended security dependencies were not installed and compliance checks will be skipped in this case
650
+ */
651
+ const deviceComplianceCheck = (0, device_compliance_1.checkDeviceCompliance)(devMode);
652
+ const jailbreakDetectionLibraryInstalled = (0, device_compliance_1.isComplianceCheckAvailable)();
653
+ const jailbreakDetectionInfo = {
654
+ jailbreakDetectionLibraryInstalled,
655
+ jailbreakDetected: deviceComplianceCheck,
656
+ };
657
+ if (devMode) {
658
+ console.log(`[Glomo-RN-SDK Standard] Attempting to start checkout of ${checkoutUrl} from status: ${status}`);
659
+ }
660
+ // Tracking start attempt with current status
661
+ trackers.trackStartAttempt(status, orderId, publicKey, devMode, mockMode, checkoutUrl, jailbreakDetectionInfo);
662
+ if (deviceComplianceCheck === true) {
663
+ // Device detected as compromised
664
+ if (devMode) {
665
+ console.error("[Glomo-RN-SDK Standard] Cannot start checkout. Device is rooted or jailbroken.");
666
+ }
667
+ const errors = [
668
+ {
669
+ type: "device_forbidden",
670
+ message: "Standard checkout is not allowed on rooted or jailbroken devices.",
671
+ },
672
+ ];
673
+ (0, validation_1.safeCallback)(onSdkError, [errors], "onSdkError", devMode);
674
+ // Tracking start() failure
675
+ trackers.trackStartFailure("device_forbidden", orderId, publicKey, devMode, mockMode, checkoutUrl, jailbreakDetectionInfo);
676
+ setShowCheckout(false);
677
+ return false;
678
+ }
679
+ else if (deviceComplianceCheck === null) {
680
+ // This warning was intentionally not gated behind a devMode check to ensure merchants are aware of the strong recommendation to install jail-monkey for enhanced security compliance.
681
+ console.warn("[Glomo-RN-SDK Standard] Device security library not installed - the SDK won't be able to automatically detect rooted/jailbroken devices. It is HIGHLY recommended to install jail-monkey as per the README, and prevent standard checkouts from compromised devices.");
682
+ }
683
+ // Enforcing devMode requirement for development servers
684
+ const resolvedServer = server || "prod";
685
+ if (!devMode && resolvedServer !== "prod") {
686
+ const errors = [
687
+ {
688
+ type: "validation_error",
689
+ message: "Development servers can only be used when devMode is enabled.",
690
+ },
691
+ ];
692
+ (0, validation_1.safeCallback)(onSdkError, [errors], "onSdkError", devMode);
693
+ trackers.trackSdkError(errors, orderId, publicKey, devMode, mockMode, checkoutUrl);
694
+ trackers.trackStartFailure("validation_error", orderId, publicKey, devMode, mockMode, checkoutUrl, jailbreakDetectionInfo);
695
+ setShowCheckout(false);
696
+ return false;
697
+ }
698
+ // Checking validation errors with detailed field-level messages
699
+ const errors = [];
700
+ if (!(0, validation_1.isValidPublicKey)(publicKey)) {
701
+ const error = {
702
+ type: "validation_error",
703
+ message: "Invalid publicKey: must start with 'live_', 'mock_', or 'test_' and be a valid string",
704
+ field: "publicKey",
705
+ };
706
+ errors.push(error);
707
+ }
708
+ if (!(internalOptions === null || internalOptions === void 0 ? void 0 : internalOptions._skipOrderIdValidation) && !(0, validation_1.isValidOrderId)(orderId)) {
709
+ const error = {
710
+ type: "validation_error",
711
+ message: "Invalid orderId: must start with 'order_' and be a valid string",
712
+ field: "orderId",
713
+ };
714
+ errors.push(error);
715
+ }
716
+ if (!(0, validation_1.isValidUrl)(checkoutUrl)) {
717
+ const error = !(0, validation_1.isValidUrl)(baseCheckoutUrl)
718
+ ? {
719
+ type: "validation_error",
720
+ message: "Invalid baseCheckoutUrl: must be a valid HTTP or HTTPS URL",
721
+ field: "baseCheckoutUrl",
722
+ }
723
+ : {
724
+ type: "validation_error",
725
+ message: "Invalid checkoutUrl: must be a valid HTTP or HTTPS URL",
726
+ field: "generatedCheckoutUrl",
727
+ };
728
+ errors.push(error);
729
+ }
730
+ if (errors.length > 0) {
731
+ if (devMode) {
732
+ console.error(`[Glomo-RN-SDK Standard] Cannot start checkout. Validation failed.`);
733
+ }
734
+ (0, validation_1.safeCallback)(onSdkError, [errors], "onSdkError", devMode);
735
+ // Tracking start() failure
736
+ trackers.trackSdkError(errors, orderId, publicKey, devMode, mockMode, checkoutUrl);
737
+ trackers.trackStartFailure("validation_error", orderId, publicKey, devMode, mockMode, checkoutUrl, jailbreakDetectionInfo);
738
+ setShowCheckout(false);
739
+ return false;
740
+ }
741
+ if (status === "payment_successful") {
742
+ if (devMode) {
743
+ console.log(`[Glomo-RN-SDK Standard] Cannot start checkout. Current status: ${status}. Payment already successful.`);
744
+ }
745
+ // Tracking start() failure
746
+ trackers.trackStartFailure("payment_successful", orderId, publicKey, devMode, mockMode, checkoutUrl, jailbreakDetectionInfo);
747
+ setShowCheckout(false);
748
+ return false;
749
+ }
750
+ if (status !== "ready" &&
751
+ status !== "payment_cancelled" &&
752
+ status !== "payment_failed" &&
753
+ status !== "payment_in_progress" &&
754
+ status !== "bank_transfer_submitted" &&
755
+ status !== "pay_via_bank_completed") {
756
+ if (devMode) {
757
+ console.log(`[Glomo-RN-SDK Standard] Cannot start checkout. Unknown status: ${status}.`);
758
+ }
759
+ // Tracking start() failure
760
+ trackers.trackStartFailure("invalid_status", orderId, publicKey, devMode, mockMode, checkoutUrl, jailbreakDetectionInfo);
761
+ setShowCheckout(false);
762
+ return false;
763
+ }
764
+ if (!checkoutUrl) {
765
+ if (devMode) {
766
+ console.error("[Glomo-RN-SDK Standard] Cannot start checkout. Invalid checkout URL.");
767
+ }
768
+ // Tracking start() failure
769
+ trackers.trackStartFailure("invalid_url", orderId, publicKey, devMode, mockMode, checkoutUrl, jailbreakDetectionInfo);
770
+ setShowCheckout(false);
771
+ return false;
772
+ }
773
+ if (devMode) {
774
+ console.log("[Glomo-RN-SDK Standard] Starting checkout from previous state: " + status);
775
+ }
776
+ // Resetting any stale state from a previous checkout attempt before starting a new one
777
+ setShowFlowWebView(false);
778
+ setFlowWebViewUrl("");
779
+ payViaBankCompletedHandledRef.current = false;
780
+ setStatus("payment_in_progress");
781
+ // Tracking successful start
782
+ trackers.trackStartSuccess(orderId, publicKey, devMode, mockMode, checkoutUrl, jailbreakDetectionInfo);
783
+ // Opening the checkout modal
784
+ setShowCheckout(true);
785
+ return true;
786
+ }, [
787
+ devMode,
788
+ status,
789
+ publicKey,
790
+ orderId,
791
+ baseCheckoutUrl,
792
+ checkoutUrl,
793
+ mockMode,
794
+ onSdkError,
795
+ server,
796
+ trackers,
797
+ internalOptions,
798
+ ]);
799
+ // Initializing Segment analytics
800
+ (0, react_1.useEffect)(() => {
801
+ (0, segment_1.initializeSegment)(devMode);
802
+ }, [devMode]);
803
+ // Resetting checkout flow if orderId or publicKey are changed
804
+ (0, react_1.useEffect)(() => {
805
+ if (orderId && publicKey) {
806
+ // Only resetting the checkout flow if the current status is that of a terminal state
807
+ if (status === "payment_successful" ||
808
+ status === "payment_failed" ||
809
+ status === "payment_cancelled" ||
810
+ status === "bank_transfer_submitted" ||
811
+ status === "pay_via_bank_completed") {
812
+ if (devMode) {
813
+ console.log(`[Glomo-RN-SDK Standard] Resetting checkout status ${status} for new orderId ${orderId} and publicKey ${publicKey}`);
814
+ }
815
+ setStatus("ready");
816
+ }
817
+ }
818
+ }, [orderId, publicKey, status, devMode]);
819
+ // Cleaning up on unmount
820
+ (0, react_1.useEffect)(() => {
821
+ return () => {
822
+ // Cleaning up - resetting state on unmount
823
+ setStatus("ready");
824
+ setShowCheckout(false);
825
+ setShowFlowWebView(false);
826
+ setFlowWebViewUrl("");
827
+ };
828
+ }, []);
829
+ return {
830
+ start,
831
+ status,
832
+ showCheckout,
833
+ flowWebViewUrl,
834
+ showFlowWebView,
835
+ checkoutUrl,
836
+ mainWebViewRef,
837
+ flowWebViewRef,
838
+ handleMainWebViewMessage,
839
+ handleFlowWebViewMessage,
840
+ handleError,
841
+ handleHttpError,
842
+ handlePermissionRequest,
843
+ handleNavigationStateChange,
844
+ handleModalBackButton,
845
+ handleFlowBack,
846
+ injectedMain: index_1.InjectionScripts.standard,
847
+ injectedFlow: index_1.InjectionScripts.flow,
848
+ };
849
+ }