@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
package/CHANGELOG.md ADDED
@@ -0,0 +1,79 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## [3.1.0] - 2026-06-08
9
+
10
+ ### Added
11
+
12
+ - **Subscriptions checkout support** - new `subscriptionId` prop on `GlomoCheckout`. When provided, the SDK bypasses order type detection and renders the subscriptions checkout flow directly. No API call is made - the inner checkout component mounts immediately. The `detecting_order_type` status is not emitted for subscription flows.
13
+ - **Mutual exclusion validation** - `GlomoCheckout` validates that exactly one of `orderId` or `subscriptionId` is provided. If both or neither are set, `onSdkError` fires with a clear message and `start()` returns `false`.
14
+
15
+ ### Changed
16
+
17
+ - **`orderId` is now optional** on `GlomoCheckoutProps` - required only when `subscriptionId` is absent.
18
+
19
+ ### Deprecated
20
+
21
+ - **`useGlomoCheckout` hook** - use the `GlomoCheckout` component with a ref instead. The hook does not provide reactive state - `getStatus()` returns a point-in-time snapshot. Will be removed in a future major version.
22
+
23
+ ## [3.0.1] - 2026-06-02
24
+
25
+ ### Added
26
+
27
+ - **`onPayViaBankBankConnectionSuccessful` callback** - fires when a bank connection is successfully established during the pay via bank flow. Provides `GlomoPayViaBankConnectionPayload` (`bankIdentifier`, `cooldownPeriodInMinutes`, `bankName`, `bankImageSrc`, `bankImageAlt`). This is informational only and does not change the checkout status.
28
+ - **`GlomoPayViaBankConnectionPayload` type** - new exported type for the bank connection callback payload.
29
+
30
+ ### Fixed
31
+
32
+ - Repeat `start()` calls with the same orderId no longer fail silently due to cached API responses.
33
+ - Checkout dismissal now fully resets internal state, preventing stale UI on re-open.
34
+
35
+ ## [3.0.0] - 2026-06-01
36
+
37
+ ### Breaking Changes
38
+
39
+ - **New unified component**: `GlomoLrsCheckout` has been replaced by `GlomoCheckout`. The new component automatically detects the order type (LRS or Standard) and renders the appropriate checkout flow.
40
+ - **`start()` is now async**: Returns `Promise<boolean>` instead of `boolean`. Update call sites to `await`:
41
+ ```tsx
42
+ const started = await checkoutRef.current?.start();
43
+ ```
44
+ - **Renamed exports**:
45
+ | v2 | v3 |
46
+ | ------------------------- | ------------------------ |
47
+ | `GlomoLrsCheckout` | `GlomoCheckout` |
48
+ | `GlomoLrsCheckoutRef` | `GlomoCheckoutRef` |
49
+ | `GlomoLrsCheckoutProps` | `GlomoCheckoutProps` |
50
+ | `GlomoLrsCheckoutPayload` | `GlomoCheckoutPayload` |
51
+ | `GlomoLrsServer` | `GlomoServer` |
52
+ | `LrsCheckoutStatus` | `CheckoutStatus` |
53
+ | `useLrsCheckout` | `useGlomoCheckout` |
54
+ - **Removed exports**: v2 LRS-specific names are no longer available.
55
+
56
+ ### Added
57
+
58
+ - **Standard checkout support** - cards, bank transfers, pay via bank, and camera-based bank authentication flows, all through the same `GlomoCheckout` component. No integration changes needed - the order type is detected automatically.
59
+ - **`onBankTransferSubmitted` callback** - fires when the user submits bank transfer details in a standard checkout flow. Provides `GlomoBankTransferPayload` (`orderId`, `senderAccountNumber`, `transactionReference`).
60
+ - **`onPayViaBankCompleted` callback** - fires when the pay via bank journey completes. Provides `{ status: string }`.
61
+ - **`onUserRefusedCameraPermissions` callback** - fires when the user denies camera access during bank authentication (Android only). The checkout is dismissed automatically.
62
+ - **`detecting_order_type` checkout status** - returned by `getStatus()` while the SDK determines the order type.
63
+ - **`bank_transfer_submitted` checkout status** - indicates a bank transfer has been submitted and is awaiting confirmation.
64
+ - **`pay_via_bank_completed` checkout status** - indicates the pay via bank flow has completed.
65
+ - **`GlomoBankTransferPayload` type** - new exported type for the bank transfer callback payload.
66
+ - **`useGlomoCheckout` hook** - for advanced integration patterns needing direct access to order type detection state.
67
+
68
+ ### Platform Configuration (New)
69
+
70
+ Checkout flows with camera-based bank authentication require native permissions:
71
+
72
+ - **Android** (`AndroidManifest.xml`): `<uses-permission android:name="android.permission.CAMERA" />`
73
+ - **iOS** (`Info.plist`): `NSCameraUsageDescription` key
74
+
75
+ These are only required for flows that use camera-based bank authentication.
76
+
77
+ ## [2.0.2]
78
+
79
+ Last v2 release.
package/MIGRATION.md ADDED
@@ -0,0 +1,50 @@
1
+ # Migration Guide
2
+
3
+ ## v2 to v3
4
+
5
+ v3 replaces the LRS-only `GlomoLrsCheckout` with a unified `GlomoCheckout` that auto-detects order type.
6
+
7
+ ### Renamed Exports
8
+
9
+ | v2 | v3 |
10
+ | -------------------------- | ------------------------- |
11
+ | `GlomoLrsCheckout` | `GlomoCheckout` |
12
+ | `GlomoLrsCheckoutRef` | `GlomoCheckoutRef` |
13
+ | `GlomoLrsCheckoutProps` | `GlomoCheckoutProps` |
14
+ | `GlomoLrsCheckoutPayload` | `GlomoCheckoutPayload` |
15
+ | `GlomoLrsServer` | `GlomoServer` |
16
+
17
+ ### Breaking Changes
18
+
19
+ - **`start()` is now async**: Returns `Promise<boolean>` instead of `boolean`. Update call sites to `await ref.current?.start()`.
20
+ - **New statuses**: `bank_transfer_submitted` and `pay_via_bank_completed` are new additions to `CheckoutStatus`.
21
+ - **New callbacks**: `onBankTransferSubmitted`, `onPayViaBankCompleted`, and `onUserRefusedCameraPermissions` are available.
22
+
23
+ ### Before / After
24
+
25
+ **v2:**
26
+ ```tsx
27
+ import { GlomoLrsCheckout, type GlomoLrsCheckoutRef } from "@glomopay/react-native-sdk";
28
+
29
+ const ref = useRef<GlomoLrsCheckoutRef>(null);
30
+ const started = ref.current?.start(); // boolean
31
+ ```
32
+
33
+ **v3:**
34
+ ```tsx
35
+ import { GlomoCheckout, type GlomoCheckoutRef } from "@glomopay/react-native-sdk";
36
+
37
+ const ref = useRef<GlomoCheckoutRef>(null);
38
+ const started = await ref.current?.start(); // Promise<boolean>
39
+ ```
40
+
41
+ ### Platform Configuration (New in v3)
42
+
43
+ Checkout flows with camera-based bank authentication require native permissions:
44
+
45
+ - **Android** (`AndroidManifest.xml`): `<uses-permission android:name="android.permission.CAMERA" />`
46
+ - **iOS** (`Info.plist`): `NSCameraUsageDescription` key
47
+
48
+ These are only required for flows that use camera-based bank authentication.
49
+
50
+ For the full changelog, see CHANGELOG.md included in this package.