@glomopay/react-native-sdk 2.0.1 → 3.0.1

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 (71) hide show
  1. package/CHANGELOG.md +64 -0
  2. package/README.md +261 -314
  3. package/lib/config/base.d.ts +17 -11
  4. package/lib/config/base.d.ts.map +1 -1
  5. package/lib/config/base.js +19 -7
  6. package/lib/config/segment.js +3 -3
  7. package/lib/glomo-checkout.d.ts +8 -0
  8. package/lib/glomo-checkout.d.ts.map +1 -0
  9. package/lib/glomo-checkout.js +69 -0
  10. package/lib/glomo-lrs-checkout.d.ts.map +1 -1
  11. package/lib/glomo-lrs-checkout.js +9 -9
  12. package/lib/glomo-standard-checkout.d.ts +5 -0
  13. package/lib/glomo-standard-checkout.d.ts.map +1 -0
  14. package/lib/glomo-standard-checkout.js +218 -0
  15. package/lib/index.d.ts +5 -4
  16. package/lib/index.d.ts.map +1 -1
  17. package/lib/index.js +7 -5
  18. package/lib/injections/index.d.ts +1 -0
  19. package/lib/injections/index.d.ts.map +1 -1
  20. package/lib/injections/index.js +2 -0
  21. package/lib/injections/webview-flow.injection.d.ts.map +1 -1
  22. package/lib/injections/webview-flow.injection.js +106 -69
  23. package/lib/injections/webview-main.injection.d.ts.map +1 -1
  24. package/lib/injections/webview-main.injection.js +112 -77
  25. package/lib/injections/webview-standard.injection.d.ts +3 -0
  26. package/lib/injections/webview-standard.injection.d.ts.map +1 -0
  27. package/lib/injections/webview-standard.injection.js +214 -0
  28. package/lib/services/order-type-fetcher.d.ts +28 -0
  29. package/lib/services/order-type-fetcher.d.ts.map +1 -0
  30. package/lib/services/order-type-fetcher.js +99 -0
  31. package/lib/types/checkout.d.ts +53 -0
  32. package/lib/types/checkout.d.ts.map +1 -0
  33. package/lib/types/checkout.js +3 -0
  34. package/lib/types/standard-checkout.d.ts +40 -0
  35. package/lib/types/standard-checkout.d.ts.map +1 -0
  36. package/lib/types/standard-checkout.js +3 -0
  37. package/lib/use-glomo-checkout.d.ts +24 -0
  38. package/lib/use-glomo-checkout.d.ts.map +1 -0
  39. package/lib/use-glomo-checkout.js +182 -0
  40. package/lib/use-lrs-checkout.d.ts +9 -4
  41. package/lib/use-lrs-checkout.d.ts.map +1 -1
  42. package/lib/use-lrs-checkout.js +91 -93
  43. package/lib/use-standard-checkout.d.ts +65 -0
  44. package/lib/use-standard-checkout.d.ts.map +1 -0
  45. package/lib/use-standard-checkout.js +832 -0
  46. package/lib/utils/analytics.d.ts +102 -1
  47. package/lib/utils/analytics.d.ts.map +1 -1
  48. package/lib/utils/analytics.js +294 -21
  49. package/lib/utils/device-compliance.js +3 -3
  50. package/lib/utils/validation.d.ts.map +1 -1
  51. package/lib/utils/validation.js +7 -6
  52. package/package.json +3 -2
  53. package/src/config/base.ts +36 -17
  54. package/src/config/segment.ts +3 -3
  55. package/src/glomo-checkout.tsx +73 -0
  56. package/src/glomo-lrs-checkout.tsx +13 -10
  57. package/src/glomo-standard-checkout.tsx +324 -0
  58. package/src/index.ts +13 -7
  59. package/src/injections/index.ts +2 -0
  60. package/src/injections/webview-flow.injection.ts +106 -69
  61. package/src/injections/webview-main.injection.ts +112 -77
  62. package/src/injections/webview-standard.injection.ts +211 -0
  63. package/src/services/order-type-fetcher.ts +86 -0
  64. package/src/types/checkout.ts +65 -0
  65. package/src/types/standard-checkout.ts +49 -0
  66. package/src/use-glomo-checkout.tsx +228 -0
  67. package/src/use-lrs-checkout.tsx +115 -111
  68. package/src/use-standard-checkout.tsx +1185 -0
  69. package/src/utils/analytics.ts +431 -22
  70. package/src/utils/device-compliance.ts +3 -3
  71. package/src/utils/validation.ts +7 -8
@@ -9,6 +9,10 @@
9
9
  * Events are sent immediately via Segment's REST API.
10
10
  * Analytics failures never break the SDK.
11
11
  */
12
+ /**
13
+ * Flow type for checkout
14
+ */
15
+ export type FlowType = "lrs" | "standard" | "unified";
12
16
  /**
13
17
  * Common properties that should be included with every event
14
18
  */
@@ -18,7 +22,11 @@ export interface CommonEventProperties {
18
22
  mockMode?: boolean;
19
23
  orderId?: string;
20
24
  publicKey?: string;
21
- lrsUrl?: string;
25
+ checkoutUrl?: string;
26
+ platform: "react-native";
27
+ deviceOS: "ios" | "android" | string;
28
+ deviceOSVersion: string;
29
+ flowType?: FlowType;
22
30
  timestamp?: string;
23
31
  [key: string]: unknown;
24
32
  }
@@ -163,6 +171,17 @@ export declare function trackConnectionError(orderId: string, errorCode: number
163
171
  * @param source - Where the carousel event originated
164
172
  */
165
173
  export declare function trackEducationStepsShown(orderId: string, publicKey: string, devMode?: boolean, mockMode?: boolean, lrsUrl?: string, source?: string): void;
174
+ /**
175
+ * Tracks when the education carousel URL is invalid and the carousel cannot be shown
176
+ *
177
+ * @param orderId - The order ID
178
+ * @param publicKey - The public key of the merchant
179
+ * @param devMode - Whether dev mode is enabled
180
+ * @param mockMode - Whether mock mode is enabled
181
+ * @param lrsUrl - The LRS checkout URL
182
+ * @param reason - Why the carousel failed to show
183
+ */
184
+ export declare function trackEducationStepsFailedToShow(orderId: string, publicKey: string, devMode?: boolean, mockMode?: boolean, lrsUrl?: string, reason?: string): void;
166
185
  /**
167
186
  * Tracks when onSdkError callback is invoked
168
187
  *
@@ -174,6 +193,88 @@ export declare function trackEducationStepsShown(orderId: string, publicKey: str
174
193
  * @param lrsUrl - The LRS checkout URL
175
194
  */
176
195
  export declare function trackSdkError(errors: Array<SdkError>, orderId?: string, publicKey?: string, devMode?: boolean, mockMode?: boolean, lrsUrl?: string): void;
196
+ /**
197
+ * Tracks when the standard checkout start() method has been called successfully
198
+ */
199
+ export declare function trackStandardStartSuccess(orderId: string, publicKey: string, devMode?: boolean, mockMode?: boolean, standardUrl?: string, jailbreakDetectionInfo?: {
200
+ jailbreakDetectionLibraryInstalled: boolean;
201
+ jailbreakDetected: boolean | null;
202
+ }): void;
203
+ /**
204
+ * Tracks when the standard checkout start() method is called (attempted)
205
+ */
206
+ export declare function trackStandardStartAttempt(status: string, orderId: string, publicKey: string, devMode?: boolean, mockMode?: boolean, standardUrl?: string, jailbreakDetectionInfo?: {
207
+ jailbreakDetectionLibraryInstalled: boolean;
208
+ jailbreakDetected: boolean | null;
209
+ }): void;
210
+ /**
211
+ * Tracks when the standard checkout start() method fails
212
+ */
213
+ export declare function trackStandardStartFailure(reason: "device_forbidden" | "validation_error" | "payment_successful" | "invalid_status" | "invalid_url", orderId?: string, publicKey?: string, devMode?: boolean, mockMode?: boolean, standardUrl?: string, jailbreakDetectionInfo?: {
214
+ jailbreakDetectionLibraryInstalled: boolean;
215
+ jailbreakDetected: boolean | null;
216
+ }): void;
217
+ /**
218
+ * Tracks when window.open is intercepted from the standard checkout WebView
219
+ */
220
+ export declare function trackStandardWindowOpen(source: "main" | "flow", url: string, orderId: string, publicKey: string, devMode?: boolean, mockMode?: boolean, standardUrl?: string): void;
221
+ /**
222
+ * Tracks when window.close is intercepted from the standard checkout WebView
223
+ */
224
+ export declare function trackStandardWindowClose(source: "main" | "flow", orderId: string, publicKey: string, devMode?: boolean, mockMode?: boolean, standardUrl?: string): void;
225
+ /**
226
+ * Tracks when invalid message data is received from a standard checkout WebView
227
+ */
228
+ export declare function trackStandardInvalidMessageReceived(webviewType: "main" | "flow", data: unknown, url: string | undefined, orderId: string, publicKey: string, devMode?: boolean, mockMode?: boolean, standardUrl?: string): void;
229
+ /**
230
+ * Tracks when standard checkout onPaymentSuccess callback is invoked
231
+ */
232
+ export declare function trackStandardPaymentSuccess(orderId: string, paymentId: string, publicKey: string, devMode?: boolean, mockMode?: boolean, standardUrl?: string): void;
233
+ /**
234
+ * Tracks when standard checkout onPaymentFailure callback is invoked
235
+ */
236
+ export declare function trackStandardPaymentFailure(orderId: string, paymentId: string, publicKey: string, devMode?: boolean, mockMode?: boolean, standardUrl?: string): void;
237
+ /**
238
+ * Tracks when standard checkout onPaymentTerminate callback is invoked
239
+ */
240
+ export declare function trackStandardPaymentTerminate(orderId: string, source: "user_dismiss" | "back_button" | "checkout_closed", publicKey: string, devMode?: boolean, mockMode?: boolean, standardUrl?: string): void;
241
+ /**
242
+ * Tracks when standard checkout onConnectionError callback is invoked
243
+ */
244
+ export declare function trackStandardConnectionError(orderId: string, errorCode: number | undefined, publicKey: string, devMode?: boolean, mockMode?: boolean, standardUrl?: string): void;
245
+ /**
246
+ * Tracks when standard checkout onSdkError callback is invoked
247
+ */
248
+ export declare function trackStandardSdkError(errors: Array<SdkError>, orderId?: string, publicKey?: string, devMode?: boolean, mockMode?: boolean, standardUrl?: string): void;
249
+ export declare function trackStandardBankTransferSubmitted(orderId: string, publicKey: string, devMode?: boolean, mockMode?: boolean, standardUrl?: string): void;
250
+ export declare function trackStandardPayViaBankCompleted(orderId: string, publicKey: string, status: string, devMode?: boolean, mockMode?: boolean, standardUrl?: string): void;
251
+ export declare function trackStandardPayViaBankBankConnectionSuccessful(orderId: string, publicKey: string, bankIdentifier: string, devMode?: boolean, mockMode?: boolean, standardUrl?: string): void;
252
+ /**
253
+ * Tracks when order type detection starts
254
+ *
255
+ * @param orderId - The order ID
256
+ * @param publicKey - The public key of the merchant
257
+ * @param devMode - Whether dev mode is enabled
258
+ */
259
+ export declare function trackOrderTypeDetectionStarted(orderId: string, publicKey: string, devMode?: boolean): void;
260
+ /**
261
+ * Tracks when order type detection resolves successfully
262
+ *
263
+ * @param orderId - The order ID
264
+ * @param publicKey - The public key of the merchant
265
+ * @param resolvedType - The resolved order type ("lrs" or "standard")
266
+ * @param devMode - Whether dev mode is enabled
267
+ */
268
+ export declare function trackOrderTypeDetectionResolved(orderId: string, publicKey: string, resolvedType: "lrs" | "standard", devMode?: boolean): void;
269
+ /**
270
+ * Tracks when order type detection fails
271
+ *
272
+ * @param orderId - The order ID
273
+ * @param publicKey - The public key of the merchant
274
+ * @param error - The error message
275
+ * @param devMode - Whether dev mode is enabled
276
+ */
277
+ export declare function trackOrderTypeDetectionFailed(orderId: string, publicKey: string, error: string, devMode?: boolean): void;
177
278
  /**
178
279
  * Helper to check if analytics is enabled and log accordingly
179
280
  * To be used for debugging merchant integration issues
@@ -1 +1 @@
1
- {"version":3,"file":"analytics.d.ts","sourceRoot":"","sources":["../../src/utils/analytics.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAIH;;GAEG;AACH,MAAM,WAAW,qBAAqB;IAClC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CAC1B;AAED,4BAA4B;AAC5B,MAAM,WAAW,QAAQ;IACrB,IAAI,EAAE,kBAAkB,GAAG,kBAAkB,CAAC;IAC9C,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,WAAW,GAAG,SAAS,GAAG,iBAAiB,GAAG,sBAAsB,CAAC;CAChF;AAuHD;;;;;;;;;GASG;AACH,wBAAgB,iBAAiB,CAC7B,OAAO,EAAE,MAAM,EACf,SAAS,EAAE,MAAM,EACjB,OAAO,GAAE,OAAe,EACxB,QAAQ,GAAE,OAAe,EACzB,MAAM,CAAC,EAAE,MAAM,EACf,sBAAsB,CAAC,EAAE;IACrB,kCAAkC,EAAE,OAAO,CAAC;IAC5C,iBAAiB,EAAE,OAAO,GAAG,IAAI,CAAC;CACrC,GACF,IAAI,CAcN;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,iBAAiB,CAC7B,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,MAAM,EACf,SAAS,EAAE,MAAM,EACjB,OAAO,GAAE,OAAe,EACxB,QAAQ,GAAE,OAAe,EACzB,MAAM,CAAC,EAAE,MAAM,EACf,sBAAsB,CAAC,EAAE;IACrB,kCAAkC,EAAE,OAAO,CAAC;IAC5C,iBAAiB,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E,MAAM,EACd,OAAO,GAAE,OAAe,EACxB,QAAQ,GAAE,OAAe,EACzB,WAAW,CAAC,EAAE,MAAM,GACrB,IAAI,CAMN;AAED,wBAAgB,+CAA+C,CAC3D,OAAO,EAAE,MAAM,EACf,SAAS,EAAE,MAAM,EACjB,cAAc,EAAE,MAAM,EACtB,OAAO,GAAE,OAAe,EACxB,QAAQ,GAAE,OAAe,EACzB,WAAW,CAAC,EAAE,MAAM,GACrB,IAAI,CAMN;AAMD;;;;;;GAMG;AACH,wBAAgB,8BAA8B,CAAC,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,OAAO,GAAE,OAAe,GAAG,IAAI,CASjH;AAED;;;;;;;GAOG;AACH,wBAAgB,+BAA+B,CAC3C,OAAO,EAAE,MAAM,EACf,SAAS,EAAE,MAAM,EACjB,YAAY,EAAE,KAAK,GAAG,UAAU,EAChC,OAAO,GAAE,OAAe,GACzB,IAAI,CAUN;AAED;;;;;;;GAOG;AACH,wBAAgB,6BAA6B,CACzC,OAAO,EAAE,MAAM,EACf,SAAS,EAAE,MAAM,EACjB,KAAK,EAAE,MAAM,EACb,OAAO,GAAE,OAAe,GACzB,IAAI,CAUN;AAED;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,GAAE,OAAe,GAAG,OAAO,CAYtE"}
@@ -22,8 +22,27 @@ exports.trackPaymentFailure = trackPaymentFailure;
22
22
  exports.trackPaymentTerminate = trackPaymentTerminate;
23
23
  exports.trackConnectionError = trackConnectionError;
24
24
  exports.trackEducationStepsShown = trackEducationStepsShown;
25
+ exports.trackEducationStepsFailedToShow = trackEducationStepsFailedToShow;
25
26
  exports.trackSdkError = trackSdkError;
27
+ exports.trackStandardStartSuccess = trackStandardStartSuccess;
28
+ exports.trackStandardStartAttempt = trackStandardStartAttempt;
29
+ exports.trackStandardStartFailure = trackStandardStartFailure;
30
+ exports.trackStandardWindowOpen = trackStandardWindowOpen;
31
+ exports.trackStandardWindowClose = trackStandardWindowClose;
32
+ exports.trackStandardInvalidMessageReceived = trackStandardInvalidMessageReceived;
33
+ exports.trackStandardPaymentSuccess = trackStandardPaymentSuccess;
34
+ exports.trackStandardPaymentFailure = trackStandardPaymentFailure;
35
+ exports.trackStandardPaymentTerminate = trackStandardPaymentTerminate;
36
+ exports.trackStandardConnectionError = trackStandardConnectionError;
37
+ exports.trackStandardSdkError = trackStandardSdkError;
38
+ exports.trackStandardBankTransferSubmitted = trackStandardBankTransferSubmitted;
39
+ exports.trackStandardPayViaBankCompleted = trackStandardPayViaBankCompleted;
40
+ exports.trackStandardPayViaBankBankConnectionSuccessful = trackStandardPayViaBankBankConnectionSuccessful;
41
+ exports.trackOrderTypeDetectionStarted = trackOrderTypeDetectionStarted;
42
+ exports.trackOrderTypeDetectionResolved = trackOrderTypeDetectionResolved;
43
+ exports.trackOrderTypeDetectionFailed = trackOrderTypeDetectionFailed;
26
44
  exports.checkAnalyticsStatus = checkAnalyticsStatus;
45
+ const react_native_1 = require("react-native");
27
46
  const segment_1 = require("../config/segment");
28
47
  /**
29
48
  * Gets the SDK version from package.json
@@ -50,18 +69,23 @@ function getSdkVersion() {
50
69
  * @param publicKey - The public key of the merchant
51
70
  * @param devMode - Whether dev mode is enabled
52
71
  * @param mockMode - Whether mock mode is enabled
53
- * @param lrsUrl - The LRS checkout URL
72
+ * @param checkoutUrl - The checkout URL
73
+ * @param flowType - The flow type
54
74
  * @returns Common properties object
55
75
  */
56
- function buildCommonProperties(orderId, publicKey, devMode = false, mockMode = false, lrsUrl) {
76
+ function buildCommonProperties(orderId, publicKey, devMode = false, mockMode = false, checkoutUrl, flowType) {
57
77
  return {
58
78
  orderId,
59
79
  publicKey,
60
- lrsUrl,
80
+ checkoutUrl,
61
81
  devMode,
62
82
  mockMode,
83
+ platform: "react-native",
84
+ deviceOS: react_native_1.Platform.OS,
85
+ deviceOSVersion: String(react_native_1.Platform.Version),
63
86
  sdkVersion: getSdkVersion(),
64
87
  timestamp: new Date().toISOString(),
88
+ ...(flowType && { flowType }),
65
89
  };
66
90
  }
67
91
  /**
@@ -78,7 +102,7 @@ async function trackEvent(eventName, properties = {}, devMode = false) {
78
102
  // Returning early if GlomoPay Segment is not available
79
103
  if (!(0, segment_1.isSegmentAvailable)()) {
80
104
  if (devMode) {
81
- console.log(`[GlomoPay RN SDK] Segment not available. Event "${eventName}" not tracked.`, properties);
105
+ console.log(`[Glomo-RN-SDK] Segment not available. Event "${eventName}" not tracked.`, properties);
82
106
  }
83
107
  return;
84
108
  }
@@ -88,7 +112,7 @@ async function trackEvent(eventName, properties = {}, devMode = false) {
88
112
  // Double-checking if the client exists (TypeScript safety)
89
113
  if (!client || !anonymousId) {
90
114
  if (devMode) {
91
- console.log(`[GlomoPay RN SDK] Segment client is null. Event "${eventName}" not tracked.`);
115
+ console.log(`[Glomo-RN-SDK] Segment client is null. Event "${eventName}" not tracked.`);
92
116
  }
93
117
  return;
94
118
  }
@@ -114,13 +138,13 @@ async function trackEvent(eventName, properties = {}, devMode = false) {
114
138
  // Sending event via REST API
115
139
  await client.post("/track", payload);
116
140
  if (devMode) {
117
- console.log(`[GlomoPay RN SDK] Tracked event: ${eventName}`, eventProperties);
141
+ console.log(`[Glomo-RN-SDK] Tracked event: ${eventName}`, eventProperties);
118
142
  }
119
143
  }
120
144
  catch (error) {
121
145
  if (devMode) {
122
146
  const errorMessage = error instanceof Error ? error.message : String(error);
123
- console.error(`[GlomoPay RN SDK] Error tracking event ${eventName}:`, errorMessage);
147
+ console.error(`[Glomo-RN-SDK] Error tracking event ${eventName}:`, errorMessage);
124
148
  }
125
149
  // Silently failing - GlomoPay analytics should never break the SDK
126
150
  }
@@ -146,7 +170,7 @@ function trackStartSuccess(orderId, publicKey, devMode = false, mockMode = false
146
170
  // Async tracking to avoid blocking the main thread
147
171
  trackEvent("LRS Checkout Started", properties, devMode).catch((error) => {
148
172
  if (devMode) {
149
- console.error(`[GlomoPay RN SDK] Event tracking error on start() success:`, error);
173
+ console.error(`[Glomo-RN-SDK] Event tracking error on start() success:`, error);
150
174
  }
151
175
  });
152
176
  }
@@ -173,7 +197,7 @@ function trackStartAttempt(status, orderId, publicKey, devMode = false, mockMode
173
197
  // Async tracking to avoid blocking the main thread
174
198
  trackEvent("LRS Checkout Start Attempted", properties, devMode).catch((error) => {
175
199
  if (devMode) {
176
- console.error(`[GlomoPay RN SDK] Event tracking error on start() attempt:`, error);
200
+ console.error(`[Glomo-RN-SDK] Event tracking error on start() attempt:`, error);
177
201
  }
178
202
  });
179
203
  }
@@ -200,7 +224,7 @@ function trackStartFailure(reason, orderId, publicKey, devMode = false, mockMode
200
224
  // Async tracking to avoid blocking the main thread
201
225
  trackEvent("LRS Checkout Start Failed", properties, devMode).catch((error) => {
202
226
  if (devMode) {
203
- console.error(`[GlomoPay RN SDK] Event tracking error on start() failure:`, error);
227
+ console.error(`[Glomo-RN-SDK] Event tracking error on start() failure:`, error);
204
228
  }
205
229
  });
206
230
  }
@@ -224,7 +248,7 @@ function trackWindowOpen(source, url, orderId, publicKey, devMode = false, mockM
224
248
  // Async tracking to avoid blocking the main thread
225
249
  trackEvent("LRS Checkout Window Open", properties, devMode).catch((error) => {
226
250
  if (devMode) {
227
- console.error(`[GlomoPay RN SDK] Event tracking error on window.open:`, error);
251
+ console.error(`[Glomo-RN-SDK] Event tracking error on window.open:`, error);
228
252
  }
229
253
  });
230
254
  }
@@ -246,7 +270,7 @@ function trackWindowClose(source, orderId, publicKey, devMode = false, mockMode
246
270
  // Async tracking to avoid blocking the main thread
247
271
  trackEvent("LRS Checkout Window Close", properties, devMode).catch((error) => {
248
272
  if (devMode) {
249
- console.error(`[GlomoPay RN SDK] Event tracking error on window.close:`, error);
273
+ console.error(`[Glomo-RN-SDK] Event tracking error on window.close:`, error);
250
274
  }
251
275
  });
252
276
  }
@@ -295,7 +319,7 @@ function trackInvalidMessageReceived(webviewType, data, url, orderId, publicKey,
295
319
  // Async tracking to avoid blocking the main thread
296
320
  trackEvent("LRS Checkout Invalid Message Received", properties, devMode).catch((error) => {
297
321
  if (devMode) {
298
- console.error(`[GlomoPay RN SDK] Event tracking error for invalid message received event:`, error);
322
+ console.error(`[Glomo-RN-SDK] Event tracking error for invalid message received event:`, error);
299
323
  }
300
324
  });
301
325
  }
@@ -317,7 +341,7 @@ function trackPaymentSuccess(orderId, paymentId, publicKey, devMode = false, moc
317
341
  // Async tracking to avoid blocking the main thread
318
342
  trackEvent("LRS Payment Success", properties, devMode).catch((error) => {
319
343
  if (devMode) {
320
- console.error(`[GlomoPay RN SDK] Event tracking error on payment success callback:`, error);
344
+ console.error(`[Glomo-RN-SDK] Event tracking error on payment success callback:`, error);
321
345
  }
322
346
  });
323
347
  }
@@ -339,7 +363,7 @@ function trackPaymentFailure(orderId, paymentId, publicKey, devMode = false, moc
339
363
  // Async tracking to avoid blocking the main thread
340
364
  trackEvent("LRS Payment Failure", properties, devMode).catch((error) => {
341
365
  if (devMode) {
342
- console.error(`[GlomoPay RN SDK] Event tracking error on payment failure callback:`, error);
366
+ console.error(`[Glomo-RN-SDK] Event tracking error on payment failure callback:`, error);
343
367
  }
344
368
  });
345
369
  }
@@ -361,7 +385,7 @@ function trackPaymentTerminate(orderId, source, publicKey, devMode = false, mock
361
385
  // Async tracking to avoid blocking the main thread
362
386
  trackEvent("LRS Payment Terminated", properties, devMode).catch((error) => {
363
387
  if (devMode) {
364
- console.error(`[GlomoPay RN SDK] Event tracking error on payment terminate callback:`, error);
388
+ console.error(`[Glomo-RN-SDK] Event tracking error on payment terminate callback:`, error);
365
389
  }
366
390
  });
367
391
  }
@@ -383,7 +407,7 @@ function trackConnectionError(orderId, errorCode, publicKey, devMode = false, mo
383
407
  // Async tracking to avoid blocking the main thread
384
408
  trackEvent("LRS Connection Error", properties, devMode).catch((error) => {
385
409
  if (devMode) {
386
- console.error(`[GlomoPay RN SDK] Event tracking error on connection error callback:`, error);
410
+ console.error(`[Glomo-RN-SDK] Event tracking error on connection error callback:`, error);
387
411
  }
388
412
  });
389
413
  }
@@ -404,7 +428,28 @@ function trackEducationStepsShown(orderId, publicKey, devMode = false, mockMode
404
428
  };
405
429
  trackEvent("LRS Has Education Steps", properties, devMode).catch((error) => {
406
430
  if (devMode) {
407
- console.error(`[GlomoPay RN SDK] Event tracking error on education steps shown event:`, error);
431
+ console.error(`[Glomo-RN-SDK] Event tracking error on education steps shown event:`, error);
432
+ }
433
+ });
434
+ }
435
+ /**
436
+ * Tracks when the education carousel URL is invalid and the carousel cannot be shown
437
+ *
438
+ * @param orderId - The order ID
439
+ * @param publicKey - The public key of the merchant
440
+ * @param devMode - Whether dev mode is enabled
441
+ * @param mockMode - Whether mock mode is enabled
442
+ * @param lrsUrl - The LRS checkout URL
443
+ * @param reason - Why the carousel failed to show
444
+ */
445
+ function trackEducationStepsFailedToShow(orderId, publicKey, devMode = false, mockMode = false, lrsUrl, reason) {
446
+ const properties = {
447
+ ...buildCommonProperties(orderId, publicKey, devMode, mockMode, lrsUrl),
448
+ ...(reason && { reason }),
449
+ };
450
+ trackEvent("LRS Education Steps Failed To Show", properties, devMode).catch((error) => {
451
+ if (devMode) {
452
+ console.error(`[Glomo-RN-SDK] Event tracking error on education steps failed to show event:`, error);
408
453
  }
409
454
  });
410
455
  }
@@ -427,7 +472,235 @@ function trackSdkError(errors, orderId, publicKey, devMode = false, mockMode = f
427
472
  // Async tracking to avoid blocking the main thread
428
473
  trackEvent("LRS SDK Error", properties, devMode).catch((error) => {
429
474
  if (devMode) {
430
- console.error(`[GlomoPay RN SDK] Event tracking error on SDK error callback:`, error);
475
+ console.error(`[Glomo-RN-SDK] Event tracking error on SDK error callback:`, error);
476
+ }
477
+ });
478
+ }
479
+ // ---------------------------------------------------------------------------
480
+ // Standard Checkout Trackers
481
+ // ---------------------------------------------------------------------------
482
+ /**
483
+ * Tracks when the standard checkout start() method has been called successfully
484
+ */
485
+ function trackStandardStartSuccess(orderId, publicKey, devMode = false, mockMode = false, standardUrl, jailbreakDetectionInfo) {
486
+ const properties = {
487
+ ...buildCommonProperties(orderId, publicKey, devMode, mockMode, standardUrl, "standard"),
488
+ ...(jailbreakDetectionInfo && {
489
+ jailbreakDetectionLibraryInstalled: jailbreakDetectionInfo.jailbreakDetectionLibraryInstalled,
490
+ jailbreakDetected: jailbreakDetectionInfo.jailbreakDetected,
491
+ }),
492
+ };
493
+ trackEvent("Standard Checkout Started", properties, devMode).catch(() => { });
494
+ }
495
+ /**
496
+ * Tracks when the standard checkout start() method is called (attempted)
497
+ */
498
+ function trackStandardStartAttempt(status, orderId, publicKey, devMode = false, mockMode = false, standardUrl, jailbreakDetectionInfo) {
499
+ const properties = {
500
+ ...buildCommonProperties(orderId, publicKey, devMode, mockMode, standardUrl, "standard"),
501
+ status,
502
+ ...(jailbreakDetectionInfo && {
503
+ jailbreakDetectionLibraryInstalled: jailbreakDetectionInfo.jailbreakDetectionLibraryInstalled,
504
+ jailbreakDetected: jailbreakDetectionInfo.jailbreakDetected,
505
+ }),
506
+ };
507
+ trackEvent("Standard Checkout Start Attempted", properties, devMode).catch(() => { });
508
+ }
509
+ /**
510
+ * Tracks when the standard checkout start() method fails
511
+ */
512
+ function trackStandardStartFailure(reason, orderId, publicKey, devMode = false, mockMode = false, standardUrl, jailbreakDetectionInfo) {
513
+ const properties = {
514
+ ...buildCommonProperties(orderId, publicKey, devMode, mockMode, standardUrl, "standard"),
515
+ failureReason: reason,
516
+ ...(jailbreakDetectionInfo && {
517
+ jailbreakDetectionLibraryInstalled: jailbreakDetectionInfo.jailbreakDetectionLibraryInstalled,
518
+ jailbreakDetected: jailbreakDetectionInfo.jailbreakDetected,
519
+ }),
520
+ };
521
+ trackEvent("Standard Checkout Start Failed", properties, devMode).catch(() => { });
522
+ }
523
+ /**
524
+ * Tracks when window.open is intercepted from the standard checkout WebView
525
+ */
526
+ function trackStandardWindowOpen(source, url, orderId, publicKey, devMode = false, mockMode = false, standardUrl) {
527
+ const properties = {
528
+ ...buildCommonProperties(orderId, publicKey, devMode, mockMode, standardUrl, "standard"),
529
+ source,
530
+ url,
531
+ };
532
+ trackEvent("Standard Checkout Window Open", properties, devMode).catch(() => { });
533
+ }
534
+ /**
535
+ * Tracks when window.close is intercepted from the standard checkout WebView
536
+ */
537
+ function trackStandardWindowClose(source, orderId, publicKey, devMode = false, mockMode = false, standardUrl) {
538
+ const properties = {
539
+ ...buildCommonProperties(orderId, publicKey, devMode, mockMode, standardUrl, "standard"),
540
+ source,
541
+ };
542
+ trackEvent("Standard Checkout Window Close", properties, devMode).catch(() => { });
543
+ }
544
+ /**
545
+ * Tracks when invalid message data is received from a standard checkout WebView
546
+ */
547
+ function trackStandardInvalidMessageReceived(webviewType, data, url, orderId, publicKey, devMode = false, mockMode = false, standardUrl) {
548
+ let dataString;
549
+ try {
550
+ if (data === null) {
551
+ dataString = "null";
552
+ }
553
+ else if (data === undefined) {
554
+ dataString = "undefined";
555
+ }
556
+ else if (typeof data === "string") {
557
+ dataString = data;
558
+ }
559
+ else if (typeof data === "object") {
560
+ dataString = JSON.stringify(data);
561
+ }
562
+ else {
563
+ dataString = String(data);
564
+ }
565
+ }
566
+ catch (_a) {
567
+ dataString = "[unable to stringify]";
568
+ }
569
+ const properties = {
570
+ ...buildCommonProperties(orderId, publicKey, devMode, mockMode, standardUrl, "standard"),
571
+ webviewType,
572
+ data: dataString,
573
+ dataType: data === null ? "null" : typeof data,
574
+ ...(url && { url }),
575
+ };
576
+ trackEvent("Standard Checkout Invalid Message Received", properties, devMode).catch(() => { });
577
+ }
578
+ /**
579
+ * Tracks when standard checkout onPaymentSuccess callback is invoked
580
+ */
581
+ function trackStandardPaymentSuccess(orderId, paymentId, publicKey, devMode = false, mockMode = false, standardUrl) {
582
+ const properties = {
583
+ ...buildCommonProperties(orderId, publicKey, devMode, mockMode, standardUrl, "standard"),
584
+ paymentId,
585
+ };
586
+ trackEvent("Standard Payment Success", properties, devMode).catch(() => { });
587
+ }
588
+ /**
589
+ * Tracks when standard checkout onPaymentFailure callback is invoked
590
+ */
591
+ function trackStandardPaymentFailure(orderId, paymentId, publicKey, devMode = false, mockMode = false, standardUrl) {
592
+ const properties = {
593
+ ...buildCommonProperties(orderId, publicKey, devMode, mockMode, standardUrl, "standard"),
594
+ paymentId,
595
+ };
596
+ trackEvent("Standard Payment Failure", properties, devMode).catch(() => { });
597
+ }
598
+ /**
599
+ * Tracks when standard checkout onPaymentTerminate callback is invoked
600
+ */
601
+ function trackStandardPaymentTerminate(orderId, source, publicKey, devMode = false, mockMode = false, standardUrl) {
602
+ const properties = {
603
+ ...buildCommonProperties(orderId, publicKey, devMode, mockMode, standardUrl, "standard"),
604
+ terminationSource: source,
605
+ };
606
+ trackEvent("Standard Payment Terminated", properties, devMode).catch(() => { });
607
+ }
608
+ /**
609
+ * Tracks when standard checkout onConnectionError callback is invoked
610
+ */
611
+ function trackStandardConnectionError(orderId, errorCode, publicKey, devMode = false, mockMode = false, standardUrl) {
612
+ const properties = {
613
+ ...buildCommonProperties(orderId, publicKey, devMode, mockMode, standardUrl, "standard"),
614
+ ...(errorCode !== undefined && { errorCode }),
615
+ };
616
+ trackEvent("Standard Connection Error", properties, devMode).catch(() => { });
617
+ }
618
+ /**
619
+ * Tracks when standard checkout onSdkError callback is invoked
620
+ */
621
+ function trackStandardSdkError(errors, orderId, publicKey, devMode = false, mockMode = false, standardUrl) {
622
+ const properties = {
623
+ ...buildCommonProperties(orderId, publicKey, devMode, mockMode, standardUrl, "standard"),
624
+ errors,
625
+ errorCount: errors.length,
626
+ };
627
+ trackEvent("Standard SDK Error", properties, devMode).catch(() => { });
628
+ }
629
+ function trackStandardBankTransferSubmitted(orderId, publicKey, devMode = false, mockMode = false, standardUrl) {
630
+ const properties = {
631
+ ...buildCommonProperties(orderId, publicKey, devMode, mockMode, standardUrl, "standard"),
632
+ };
633
+ trackEvent("Standard Bank Transfer Submitted", properties, devMode).catch(() => { });
634
+ }
635
+ function trackStandardPayViaBankCompleted(orderId, publicKey, status, devMode = false, mockMode = false, standardUrl) {
636
+ const properties = {
637
+ ...buildCommonProperties(orderId, publicKey, devMode, mockMode, standardUrl, "standard"),
638
+ payViaBankStatus: status,
639
+ };
640
+ trackEvent("Standard Pay Via Bank Completed", properties, devMode).catch(() => { });
641
+ }
642
+ function trackStandardPayViaBankBankConnectionSuccessful(orderId, publicKey, bankIdentifier, devMode = false, mockMode = false, standardUrl) {
643
+ const properties = {
644
+ ...buildCommonProperties(orderId, publicKey, devMode, mockMode, standardUrl, "standard"),
645
+ bankIdentifier,
646
+ };
647
+ trackEvent("Standard Pay Via Bank Bank Connection Successful", properties, devMode).catch(() => { });
648
+ }
649
+ // ---------------------------------------------------------------------------
650
+ // Order Type Detection Trackers (Unified Flow)
651
+ // ---------------------------------------------------------------------------
652
+ /**
653
+ * Tracks when order type detection starts
654
+ *
655
+ * @param orderId - The order ID
656
+ * @param publicKey - The public key of the merchant
657
+ * @param devMode - Whether dev mode is enabled
658
+ */
659
+ function trackOrderTypeDetectionStarted(orderId, publicKey, devMode = false) {
660
+ const properties = {
661
+ ...buildCommonProperties(orderId, publicKey, devMode, false, undefined, "unified"),
662
+ };
663
+ trackEvent("Order Type Detection Started", properties, devMode).catch((error) => {
664
+ if (devMode) {
665
+ console.error(`[Glomo-RN-SDK] Event tracking error on order type detection started:`, error);
666
+ }
667
+ });
668
+ }
669
+ /**
670
+ * Tracks when order type detection resolves successfully
671
+ *
672
+ * @param orderId - The order ID
673
+ * @param publicKey - The public key of the merchant
674
+ * @param resolvedType - The resolved order type ("lrs" or "standard")
675
+ * @param devMode - Whether dev mode is enabled
676
+ */
677
+ function trackOrderTypeDetectionResolved(orderId, publicKey, resolvedType, devMode = false) {
678
+ const eventName = resolvedType === "lrs" ? "Order Type Resolved LRS" : "Order Type Resolved Standard";
679
+ const properties = {
680
+ ...buildCommonProperties(orderId, publicKey, devMode, false, undefined, "unified"),
681
+ };
682
+ trackEvent(eventName, properties, devMode).catch((error) => {
683
+ if (devMode) {
684
+ console.error(`[Glomo-RN-SDK] Event tracking error on order type detection resolved:`, error);
685
+ }
686
+ });
687
+ }
688
+ /**
689
+ * Tracks when order type detection fails
690
+ *
691
+ * @param orderId - The order ID
692
+ * @param publicKey - The public key of the merchant
693
+ * @param error - The error message
694
+ * @param devMode - Whether dev mode is enabled
695
+ */
696
+ function trackOrderTypeDetectionFailed(orderId, publicKey, error, devMode = false) {
697
+ const properties = {
698
+ ...buildCommonProperties(orderId, publicKey, devMode, false, undefined, "unified"),
699
+ error,
700
+ };
701
+ trackEvent("Order Type Detection Failed", properties, devMode).catch((trackError) => {
702
+ if (devMode) {
703
+ console.error(`[Glomo-RN-SDK] Event tracking error on order type detection failed:`, trackError);
431
704
  }
432
705
  });
433
706
  }
@@ -442,10 +715,10 @@ function checkAnalyticsStatus(devMode = false) {
442
715
  const available = (0, segment_1.isSegmentAvailable)();
443
716
  if (devMode) {
444
717
  if (available) {
445
- console.log("[GlomoPay RN SDK] Analytics: ENABLED");
718
+ console.log("[Glomo-RN-SDK] Analytics: ENABLED");
446
719
  }
447
720
  else {
448
- console.log("[GlomoPay RN SDK] Analytics: DISABLED");
721
+ console.log("[Glomo-RN-SDK] Analytics: DISABLED");
449
722
  }
450
723
  }
451
724
  return available;
@@ -40,7 +40,7 @@ function checkDeviceCompliance(devMode = false) {
40
40
  const JailMonkey = getJailMonkey();
41
41
  if (!JailMonkey) {
42
42
  if (devMode) {
43
- console.log("[GlomoPay RN SDK] jail-monkey not available. Device compliance check skipped. " +
43
+ console.log("[Glomo-RN-SDK] jail-monkey not available. Device compliance check skipped. " +
44
44
  "Install jail-monkey for enhanced security compliance.");
45
45
  }
46
46
  // Check unavailable - allowing checkout to proceed
@@ -49,14 +49,14 @@ function checkDeviceCompliance(devMode = false) {
49
49
  try {
50
50
  const isCompromised = JailMonkey.isJailBroken();
51
51
  if (devMode) {
52
- console.log(`[GlomoPay RN SDK] Device compliance check: ${isCompromised ? "FAILED (device compromised)" : "PASSED"}`);
52
+ console.log(`[Glomo-RN-SDK] Device compliance check: ${isCompromised ? "FAILED (device compromised)" : "PASSED"}`);
53
53
  }
54
54
  return isCompromised;
55
55
  }
56
56
  catch (error) {
57
57
  if (devMode) {
58
58
  const errorMessage = error instanceof Error ? error.message : String(error);
59
- console.error("[GlomoPay RN SDK] Error checking device compliance:", errorMessage);
59
+ console.error("[Glomo-RN-SDK] Error checking device compliance:", errorMessage);
60
60
  }
61
61
  // On error, allowing checkout to proceed (fail open strategy)
62
62
  return null;
@@ -1 +1 @@
1
- {"version":3,"file":"validation.d.ts","sourceRoot":"","sources":["../../src/utils/validation.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAU3D;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAOvD;AAED;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAM/C;AAED;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,IAAI;IAChE,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;CACrB,CAaA;AAED;;;;;;;GAOG;AACH,wBAAgB,YAAY,CAAC,CAAC,SAAS,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,IAAI,EAC3D,QAAQ,EAAE,CAAC,GAAG,SAAS,EACvB,IAAI,EAAE,UAAU,CAAC,CAAC,CAAC,EACnB,YAAY,EAAE,MAAM,EACpB,OAAO,GAAE,OAAe,GACzB,IAAI,CAWN"}
1
+ {"version":3,"file":"validation.d.ts","sourceRoot":"","sources":["../../src/utils/validation.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAU3D;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAOvD;AAED;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAM/C;AAED;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,IAAI;IAChE,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;CACrB,CAYA;AAED;;;;;;;GAOG;AACH,wBAAgB,YAAY,CAAC,CAAC,SAAS,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,IAAI,EAC3D,QAAQ,EAAE,CAAC,GAAG,SAAS,EACvB,IAAI,EAAE,UAAU,CAAC,CAAC,CAAC,EACnB,YAAY,EAAE,MAAM,EACpB,OAAO,GAAE,OAAe,GACzB,IAAI,CAWN"}
@@ -54,12 +54,13 @@ function isValidPaymentPayload(payload) {
54
54
  return false;
55
55
  }
56
56
  const p = payload;
57
- return (typeof p.orderId === "string" &&
58
- p.orderId.length > 0 &&
59
- typeof p.paymentId === "string" &&
60
- p.paymentId.length > 0 &&
61
- typeof p.signature === "string" &&
62
- p.signature.length > 0);
57
+ /**
58
+ * Accept payloads where orderId, paymentId, and signature are strings.
59
+ * Empty strings are allowed because some flows (e.g. open banking / pay via bank)
60
+ * send payment.success with empty fields when the payment completes on the
61
+ * bank's side before the checkout backend has resolved ids.
62
+ */
63
+ return typeof p.orderId === "string" && typeof p.paymentId === "string" && typeof p.signature === "string";
63
64
  }
64
65
  /**
65
66
  * Safely executes a callback with error handling