@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
@@ -13,7 +13,6 @@
13
13
  */
14
14
  function getJailMonkey(): { isJailBroken: () => boolean } | null {
15
15
  try {
16
- // eslint-disable-next-line @typescript-eslint/no-require-imports
17
16
  const JailMonkey = require("jail-monkey");
18
17
  if (JailMonkey && typeof JailMonkey.isJailBroken === "function") {
19
18
  return JailMonkey;
@@ -39,7 +38,7 @@ export function checkDeviceCompliance(devMode: boolean = false): boolean | null
39
38
  if (!JailMonkey) {
40
39
  if (devMode) {
41
40
  console.log(
42
- "[GlomoPay RN SDK] jail-monkey not available. Device compliance check skipped. " +
41
+ "[Glomo-RN-SDK] jail-monkey not available. Device compliance check skipped. " +
43
42
  "Install jail-monkey for enhanced security compliance."
44
43
  );
45
44
  }
@@ -52,14 +51,14 @@ export function checkDeviceCompliance(devMode: boolean = false): boolean | null
52
51
  const isCompromised = JailMonkey.isJailBroken();
53
52
  if (devMode) {
54
53
  console.log(
55
- `[GlomoPay RN SDK] Device compliance check: ${isCompromised ? "FAILED (device compromised)" : "PASSED"}`
54
+ `[Glomo-RN-SDK] Device compliance check: ${isCompromised ? "FAILED (device compromised)" : "PASSED"}`
56
55
  );
57
56
  }
58
57
  return isCompromised;
59
58
  } catch (error) {
60
59
  if (devMode) {
61
60
  const errorMessage = error instanceof Error ? error.message : String(error);
62
- console.error("[GlomoPay RN SDK] Error checking device compliance:", errorMessage);
61
+ console.error("[Glomo-RN-SDK] Error checking device compliance:", errorMessage);
63
62
  }
64
63
  // On error, allowing checkout to proceed (fail open strategy)
65
64
  return null;
@@ -60,14 +60,13 @@ export function isValidPaymentPayload(payload: unknown): payload is {
60
60
  return false;
61
61
  }
62
62
  const p = payload as Record<string, unknown>;
63
- return (
64
- typeof p.orderId === "string" &&
65
- p.orderId.length > 0 &&
66
- typeof p.paymentId === "string" &&
67
- p.paymentId.length > 0 &&
68
- typeof p.signature === "string" &&
69
- p.signature.length > 0
70
- );
63
+ /**
64
+ * Accept payloads where orderId, paymentId, and signature are strings.
65
+ * Empty strings are allowed because some flows (e.g. open banking / pay via bank)
66
+ * send payment.success with empty fields when the payment completes on the
67
+ * bank's side before the checkout backend has resolved ids.
68
+ */
69
+ return typeof p.orderId === "string" && typeof p.paymentId === "string" && typeof p.signature === "string";
71
70
  }
72
71
 
73
72
  /**