@swichpay/react-native 0.0.0-stage → 1.0.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 (277) hide show
  1. package/CHANGELOG.md +32 -0
  2. package/LICENSE +21 -0
  3. package/README.md +82 -2
  4. package/docs/checkouts.md +98 -0
  5. package/docs/getting-started.md +140 -0
  6. package/docs/going-live.md +45 -0
  7. package/docs/own-screen.md +81 -0
  8. package/docs/results-and-errors.md +75 -0
  9. package/docs/server.md +163 -0
  10. package/docs/troubleshooting.md +57 -0
  11. package/lib/commonjs/HostedCheckout.js +115 -0
  12. package/lib/commonjs/checkout-webview.js +85 -0
  13. package/lib/commonjs/checkouts/PaymentSheet.js +1317 -0
  14. package/lib/commonjs/checkouts/direct.js +671 -0
  15. package/lib/commonjs/context.js +64 -0
  16. package/lib/commonjs/core/api/direct-payment-api.js +425 -0
  17. package/lib/commonjs/core/api/discount-api.js +19 -0
  18. package/lib/commonjs/core/api/gateway-api.js +366 -0
  19. package/lib/commonjs/core/api/payments-api.js +79 -0
  20. package/lib/commonjs/core/api/repositories.js +5 -0
  21. package/lib/commonjs/core/assets/images.js +12 -0
  22. package/lib/commonjs/core/assets/method-logos.js +19 -0
  23. package/lib/commonjs/core/assets/pwa-images.js +13 -0
  24. package/lib/commonjs/core/browser/clipboard.js +30 -0
  25. package/lib/commonjs/core/browser/dom.js +71 -0
  26. package/lib/commonjs/core/browser/hosted-checkout.js +107 -0
  27. package/lib/commonjs/core/browser/index.js +119 -0
  28. package/lib/commonjs/core/browser/qr.js +109 -0
  29. package/lib/commonjs/core/browser/three-ds.js +151 -0
  30. package/lib/commonjs/core/client.js +344 -0
  31. package/lib/commonjs/core/config.js +132 -0
  32. package/lib/commonjs/core/environment.js +34 -0
  33. package/lib/commonjs/core/errors.js +138 -0
  34. package/lib/commonjs/core/events.js +57 -0
  35. package/lib/commonjs/core/flows/controller.js +106 -0
  36. package/lib/commonjs/core/flows/countdown.js +41 -0
  37. package/lib/commonjs/core/flows/direct-bank-transfer.js +236 -0
  38. package/lib/commonjs/core/flows/direct-card.js +354 -0
  39. package/lib/commonjs/core/flows/direct-ewallet.js +124 -0
  40. package/lib/commonjs/core/flows/direct-one-bill.js +172 -0
  41. package/lib/commonjs/core/flows/direct-qr.js +109 -0
  42. package/lib/commonjs/core/flows/direct-rtp.js +302 -0
  43. package/lib/commonjs/core/flows/discount-lookup.js +80 -0
  44. package/lib/commonjs/core/flows/headless.js +94 -0
  45. package/lib/commonjs/core/flows/payment-sheet.js +1321 -0
  46. package/lib/commonjs/core/flows/services.js +31 -0
  47. package/lib/commonjs/core/flows/shared.js +90 -0
  48. package/lib/commonjs/core/http/api-client.js +208 -0
  49. package/lib/commonjs/core/http/endpoints.js +61 -0
  50. package/lib/commonjs/core/http/token-manager.js +46 -0
  51. package/lib/commonjs/core/http/transport.js +134 -0
  52. package/lib/commonjs/core/index.js +688 -0
  53. package/lib/commonjs/core/models/category.js +113 -0
  54. package/lib/commonjs/core/models/discount.js +51 -0
  55. package/lib/commonjs/core/models/payment.js +95 -0
  56. package/lib/commonjs/core/models/session.js +131 -0
  57. package/lib/commonjs/core/server/index.js +64 -0
  58. package/lib/commonjs/core/server/node.js +60 -0
  59. package/lib/commonjs/core/server/proxy.js +194 -0
  60. package/lib/commonjs/core/server/verify.js +122 -0
  61. package/lib/commonjs/core/swichpay.js +72 -0
  62. package/lib/commonjs/core/utils/crypto.js +78 -0
  63. package/lib/commonjs/core/utils/formatters.js +68 -0
  64. package/lib/commonjs/core/utils/json.js +110 -0
  65. package/lib/commonjs/core/utils/log.js +75 -0
  66. package/lib/commonjs/core/utils/runtime.js +34 -0
  67. package/lib/commonjs/core/utils/validators.js +59 -0
  68. package/lib/commonjs/hooks.js +77 -0
  69. package/lib/commonjs/index.js +203 -0
  70. package/lib/commonjs/package.json +1 -0
  71. package/lib/commonjs/polyfills.js +3 -0
  72. package/lib/commonjs/presenter.js +61 -0
  73. package/lib/commonjs/provider.js +192 -0
  74. package/lib/commonjs/swichpay.js +192 -0
  75. package/lib/commonjs/theme.js +54 -0
  76. package/lib/commonjs/ui.js +1142 -0
  77. package/lib/commonjs/webviews.js +279 -0
  78. package/lib/module/HostedCheckout.js +111 -0
  79. package/lib/module/checkout-webview.js +83 -0
  80. package/lib/module/checkouts/PaymentSheet.js +1313 -0
  81. package/lib/module/checkouts/direct.js +661 -0
  82. package/lib/module/context.js +58 -0
  83. package/lib/module/core/api/direct-payment-api.js +413 -0
  84. package/lib/module/core/api/discount-api.js +14 -0
  85. package/lib/module/core/api/gateway-api.js +358 -0
  86. package/lib/module/core/api/payments-api.js +73 -0
  87. package/lib/module/core/api/repositories.js +3 -0
  88. package/lib/module/core/assets/images.js +8 -0
  89. package/lib/module/core/assets/method-logos.js +15 -0
  90. package/lib/module/core/assets/pwa-images.js +9 -0
  91. package/lib/module/core/browser/clipboard.js +27 -0
  92. package/lib/module/core/browser/dom.js +63 -0
  93. package/lib/module/core/browser/hosted-checkout.js +102 -0
  94. package/lib/module/core/browser/index.js +12 -0
  95. package/lib/module/core/browser/qr.js +100 -0
  96. package/lib/module/core/browser/three-ds.js +145 -0
  97. package/lib/module/core/client.js +338 -0
  98. package/lib/module/core/config.js +128 -0
  99. package/lib/module/core/environment.js +29 -0
  100. package/lib/module/core/errors.js +125 -0
  101. package/lib/module/core/events.js +51 -0
  102. package/lib/module/core/flows/controller.js +101 -0
  103. package/lib/module/core/flows/countdown.js +36 -0
  104. package/lib/module/core/flows/direct-bank-transfer.js +231 -0
  105. package/lib/module/core/flows/direct-card.js +349 -0
  106. package/lib/module/core/flows/direct-ewallet.js +119 -0
  107. package/lib/module/core/flows/direct-one-bill.js +167 -0
  108. package/lib/module/core/flows/direct-qr.js +104 -0
  109. package/lib/module/core/flows/direct-rtp.js +297 -0
  110. package/lib/module/core/flows/discount-lookup.js +75 -0
  111. package/lib/module/core/flows/headless.js +90 -0
  112. package/lib/module/core/flows/payment-sheet.js +1315 -0
  113. package/lib/module/core/flows/services.js +27 -0
  114. package/lib/module/core/flows/shared.js +78 -0
  115. package/lib/module/core/http/api-client.js +203 -0
  116. package/lib/module/core/http/endpoints.js +57 -0
  117. package/lib/module/core/http/token-manager.js +41 -0
  118. package/lib/module/core/http/transport.js +126 -0
  119. package/lib/module/core/index.js +52 -0
  120. package/lib/module/core/models/category.js +104 -0
  121. package/lib/module/core/models/discount.js +46 -0
  122. package/lib/module/core/models/payment.js +89 -0
  123. package/lib/module/core/models/session.js +120 -0
  124. package/lib/module/core/server/index.js +11 -0
  125. package/lib/module/core/server/node.js +56 -0
  126. package/lib/module/core/server/proxy.js +191 -0
  127. package/lib/module/core/server/verify.js +115 -0
  128. package/lib/module/core/swichpay.js +68 -0
  129. package/lib/module/core/utils/crypto.js +72 -0
  130. package/lib/module/core/utils/formatters.js +56 -0
  131. package/lib/module/core/utils/json.js +94 -0
  132. package/lib/module/core/utils/log.js +67 -0
  133. package/lib/module/core/utils/runtime.js +28 -0
  134. package/lib/module/core/utils/validators.js +54 -0
  135. package/lib/module/hooks.js +72 -0
  136. package/lib/module/index.js +36 -0
  137. package/lib/module/polyfills.js +4 -0
  138. package/lib/module/presenter.js +58 -0
  139. package/lib/module/provider.js +188 -0
  140. package/lib/module/swichpay.js +187 -0
  141. package/lib/module/theme.js +50 -0
  142. package/lib/module/ui.js +1116 -0
  143. package/lib/module/webviews.js +272 -0
  144. package/lib/typescript/commonjs/HostedCheckout.d.ts +17 -0
  145. package/lib/typescript/commonjs/checkout-webview.d.ts +14 -0
  146. package/lib/typescript/commonjs/checkouts/PaymentSheet.d.ts +14 -0
  147. package/lib/typescript/commonjs/checkouts/direct.d.ts +18 -0
  148. package/lib/typescript/commonjs/context.d.ts +20 -0
  149. package/lib/typescript/commonjs/core/api/direct-payment-api.d.ts +103 -0
  150. package/lib/typescript/commonjs/core/api/discount-api.d.ts +10 -0
  151. package/lib/typescript/commonjs/core/api/gateway-api.d.ts +150 -0
  152. package/lib/typescript/commonjs/core/api/payments-api.d.ts +22 -0
  153. package/lib/typescript/commonjs/core/api/repositories.d.ts +86 -0
  154. package/lib/typescript/commonjs/core/assets/images.d.ts +5 -0
  155. package/lib/typescript/commonjs/core/assets/method-logos.d.ts +12 -0
  156. package/lib/typescript/commonjs/core/assets/pwa-images.d.ts +7 -0
  157. package/lib/typescript/commonjs/core/browser/clipboard.d.ts +3 -0
  158. package/lib/typescript/commonjs/core/browser/dom.d.ts +11 -0
  159. package/lib/typescript/commonjs/core/browser/hosted-checkout.d.ts +27 -0
  160. package/lib/typescript/commonjs/core/browser/index.d.ts +11 -0
  161. package/lib/typescript/commonjs/core/browser/qr.d.ts +18 -0
  162. package/lib/typescript/commonjs/core/browser/three-ds.d.ts +45 -0
  163. package/lib/typescript/commonjs/core/client.d.ts +181 -0
  164. package/lib/typescript/commonjs/core/config.d.ts +86 -0
  165. package/lib/typescript/commonjs/core/environment.d.ts +22 -0
  166. package/lib/typescript/commonjs/core/errors.d.ts +78 -0
  167. package/lib/typescript/commonjs/core/events.d.ts +19 -0
  168. package/lib/typescript/commonjs/core/flows/controller.d.ts +41 -0
  169. package/lib/typescript/commonjs/core/flows/countdown.d.ts +15 -0
  170. package/lib/typescript/commonjs/core/flows/direct-bank-transfer.d.ts +49 -0
  171. package/lib/typescript/commonjs/core/flows/direct-card.d.ts +94 -0
  172. package/lib/typescript/commonjs/core/flows/direct-ewallet.d.ts +39 -0
  173. package/lib/typescript/commonjs/core/flows/direct-one-bill.d.ts +38 -0
  174. package/lib/typescript/commonjs/core/flows/direct-qr.d.ts +25 -0
  175. package/lib/typescript/commonjs/core/flows/direct-rtp.d.ts +72 -0
  176. package/lib/typescript/commonjs/core/flows/discount-lookup.d.ts +37 -0
  177. package/lib/typescript/commonjs/core/flows/headless.d.ts +38 -0
  178. package/lib/typescript/commonjs/core/flows/payment-sheet.d.ts +263 -0
  179. package/lib/typescript/commonjs/core/flows/services.d.ts +22 -0
  180. package/lib/typescript/commonjs/core/flows/shared.d.ts +40 -0
  181. package/lib/typescript/commonjs/core/http/api-client.d.ts +37 -0
  182. package/lib/typescript/commonjs/core/http/endpoints.d.ts +39 -0
  183. package/lib/typescript/commonjs/core/http/token-manager.d.ts +19 -0
  184. package/lib/typescript/commonjs/core/http/transport.d.ts +37 -0
  185. package/lib/typescript/commonjs/core/index.d.ts +42 -0
  186. package/lib/typescript/commonjs/core/models/category.d.ts +35 -0
  187. package/lib/typescript/commonjs/core/models/discount.d.ts +41 -0
  188. package/lib/typescript/commonjs/core/models/payment.d.ts +104 -0
  189. package/lib/typescript/commonjs/core/models/session.d.ts +87 -0
  190. package/lib/typescript/commonjs/core/server/index.d.ts +10 -0
  191. package/lib/typescript/commonjs/core/server/node.d.ts +19 -0
  192. package/lib/typescript/commonjs/core/server/proxy.d.ts +30 -0
  193. package/lib/typescript/commonjs/core/server/verify.d.ts +61 -0
  194. package/lib/typescript/commonjs/core/swichpay.d.ts +40 -0
  195. package/lib/typescript/commonjs/core/utils/crypto.d.ts +19 -0
  196. package/lib/typescript/commonjs/core/utils/formatters.d.ts +19 -0
  197. package/lib/typescript/commonjs/core/utils/json.d.ts +27 -0
  198. package/lib/typescript/commonjs/core/utils/log.d.ts +15 -0
  199. package/lib/typescript/commonjs/core/utils/runtime.d.ts +12 -0
  200. package/lib/typescript/commonjs/core/utils/validators.d.ts +23 -0
  201. package/lib/typescript/commonjs/hooks.d.ts +21 -0
  202. package/lib/typescript/commonjs/index.d.ts +26 -0
  203. package/lib/typescript/commonjs/package.json +1 -0
  204. package/lib/typescript/commonjs/polyfills.d.ts +2 -0
  205. package/lib/typescript/commonjs/presenter.d.ts +25 -0
  206. package/lib/typescript/commonjs/provider.d.ts +22 -0
  207. package/lib/typescript/commonjs/swichpay.d.ts +125 -0
  208. package/lib/typescript/commonjs/theme.d.ts +52 -0
  209. package/lib/typescript/commonjs/ui.d.ts +583 -0
  210. package/lib/typescript/commonjs/webviews.d.ts +40 -0
  211. package/lib/typescript/module/HostedCheckout.d.ts +17 -0
  212. package/lib/typescript/module/checkout-webview.d.ts +14 -0
  213. package/lib/typescript/module/checkouts/PaymentSheet.d.ts +14 -0
  214. package/lib/typescript/module/checkouts/direct.d.ts +18 -0
  215. package/lib/typescript/module/context.d.ts +20 -0
  216. package/lib/typescript/module/core/api/direct-payment-api.d.ts +103 -0
  217. package/lib/typescript/module/core/api/discount-api.d.ts +10 -0
  218. package/lib/typescript/module/core/api/gateway-api.d.ts +150 -0
  219. package/lib/typescript/module/core/api/payments-api.d.ts +22 -0
  220. package/lib/typescript/module/core/api/repositories.d.ts +86 -0
  221. package/lib/typescript/module/core/assets/images.d.ts +5 -0
  222. package/lib/typescript/module/core/assets/method-logos.d.ts +12 -0
  223. package/lib/typescript/module/core/assets/pwa-images.d.ts +7 -0
  224. package/lib/typescript/module/core/browser/clipboard.d.ts +3 -0
  225. package/lib/typescript/module/core/browser/dom.d.ts +11 -0
  226. package/lib/typescript/module/core/browser/hosted-checkout.d.ts +27 -0
  227. package/lib/typescript/module/core/browser/index.d.ts +11 -0
  228. package/lib/typescript/module/core/browser/qr.d.ts +18 -0
  229. package/lib/typescript/module/core/browser/three-ds.d.ts +45 -0
  230. package/lib/typescript/module/core/client.d.ts +181 -0
  231. package/lib/typescript/module/core/config.d.ts +86 -0
  232. package/lib/typescript/module/core/environment.d.ts +22 -0
  233. package/lib/typescript/module/core/errors.d.ts +78 -0
  234. package/lib/typescript/module/core/events.d.ts +19 -0
  235. package/lib/typescript/module/core/flows/controller.d.ts +41 -0
  236. package/lib/typescript/module/core/flows/countdown.d.ts +15 -0
  237. package/lib/typescript/module/core/flows/direct-bank-transfer.d.ts +49 -0
  238. package/lib/typescript/module/core/flows/direct-card.d.ts +94 -0
  239. package/lib/typescript/module/core/flows/direct-ewallet.d.ts +39 -0
  240. package/lib/typescript/module/core/flows/direct-one-bill.d.ts +38 -0
  241. package/lib/typescript/module/core/flows/direct-qr.d.ts +25 -0
  242. package/lib/typescript/module/core/flows/direct-rtp.d.ts +72 -0
  243. package/lib/typescript/module/core/flows/discount-lookup.d.ts +37 -0
  244. package/lib/typescript/module/core/flows/headless.d.ts +38 -0
  245. package/lib/typescript/module/core/flows/payment-sheet.d.ts +263 -0
  246. package/lib/typescript/module/core/flows/services.d.ts +22 -0
  247. package/lib/typescript/module/core/flows/shared.d.ts +40 -0
  248. package/lib/typescript/module/core/http/api-client.d.ts +37 -0
  249. package/lib/typescript/module/core/http/endpoints.d.ts +39 -0
  250. package/lib/typescript/module/core/http/token-manager.d.ts +19 -0
  251. package/lib/typescript/module/core/http/transport.d.ts +37 -0
  252. package/lib/typescript/module/core/index.d.ts +42 -0
  253. package/lib/typescript/module/core/models/category.d.ts +35 -0
  254. package/lib/typescript/module/core/models/discount.d.ts +41 -0
  255. package/lib/typescript/module/core/models/payment.d.ts +104 -0
  256. package/lib/typescript/module/core/models/session.d.ts +87 -0
  257. package/lib/typescript/module/core/server/index.d.ts +10 -0
  258. package/lib/typescript/module/core/server/node.d.ts +19 -0
  259. package/lib/typescript/module/core/server/proxy.d.ts +30 -0
  260. package/lib/typescript/module/core/server/verify.d.ts +61 -0
  261. package/lib/typescript/module/core/swichpay.d.ts +40 -0
  262. package/lib/typescript/module/core/utils/crypto.d.ts +19 -0
  263. package/lib/typescript/module/core/utils/formatters.d.ts +19 -0
  264. package/lib/typescript/module/core/utils/json.d.ts +27 -0
  265. package/lib/typescript/module/core/utils/log.d.ts +15 -0
  266. package/lib/typescript/module/core/utils/runtime.d.ts +12 -0
  267. package/lib/typescript/module/core/utils/validators.d.ts +23 -0
  268. package/lib/typescript/module/hooks.d.ts +21 -0
  269. package/lib/typescript/module/index.d.ts +26 -0
  270. package/lib/typescript/module/polyfills.d.ts +2 -0
  271. package/lib/typescript/module/presenter.d.ts +25 -0
  272. package/lib/typescript/module/provider.d.ts +22 -0
  273. package/lib/typescript/module/swichpay.d.ts +125 -0
  274. package/lib/typescript/module/theme.d.ts +52 -0
  275. package/lib/typescript/module/ui.d.ts +583 -0
  276. package/lib/typescript/module/webviews.d.ts +40 -0
  277. package/package.json +129 -4
@@ -0,0 +1,583 @@
1
+ import { type ReactNode } from 'react';
2
+ import { type KeyboardTypeOptions, type StyleProp, type TextInputProps, type ViewStyle } from 'react-native';
3
+ import { type CardBrand } from './core/index.js';
4
+ /** Scrollable screen body used by every checkout. */
5
+ export declare function Screen(props: {
6
+ children: ReactNode;
7
+ style?: StyleProp<ViewStyle>;
8
+ }): import("react").JSX.Element;
9
+ export declare function SheetHeader(props: {
10
+ title: string;
11
+ onClose: () => void;
12
+ closeDisabled?: boolean;
13
+ }): import("react").JSX.Element;
14
+ export declare function OrderSummary(props: {
15
+ item: string;
16
+ amount: string;
17
+ }): import("react").JSX.Element;
18
+ export declare function Note(props: {
19
+ children: ReactNode;
20
+ tone?: 'muted' | 'danger' | 'success';
21
+ }): import("react").JSX.Element;
22
+ export declare function ErrorBanner(props: {
23
+ message: string | null | undefined;
24
+ }): import("react").JSX.Element | null;
25
+ export declare function Spinner(props: {
26
+ dark?: boolean;
27
+ large?: boolean;
28
+ label?: string;
29
+ }): import("react").JSX.Element;
30
+ export declare function Button(props: {
31
+ children: ReactNode;
32
+ onPress: () => void;
33
+ loading?: boolean;
34
+ disabled?: boolean;
35
+ variant?: 'primary' | 'ghost' | 'outline' | 'danger';
36
+ style?: StyleProp<ViewStyle>;
37
+ testID?: string;
38
+ }): import("react").JSX.Element;
39
+ export declare function TextField(props: {
40
+ label?: string;
41
+ required?: boolean;
42
+ error?: string;
43
+ value: string;
44
+ onValueChange: (value: string) => void;
45
+ suffix?: ReactNode;
46
+ labelExtra?: ReactNode;
47
+ keyboardType?: KeyboardTypeOptions;
48
+ } & Omit<TextInputProps, 'value' | 'onChangeText' | 'keyboardType'>): import("react").JSX.Element;
49
+ /**
50
+ * A dropdown: a field showing the current choice that opens a bottom-sheet picker (with search
51
+ * for long lists such as banks). The native replacement for `<select>`.
52
+ */
53
+ export declare function SelectField<T extends string>(props: {
54
+ label: string;
55
+ placeholder: string;
56
+ value: T | null;
57
+ options: readonly {
58
+ value: T;
59
+ label: string;
60
+ }[];
61
+ error?: string;
62
+ disabled?: boolean;
63
+ onValueChange: (value: T | null) => void;
64
+ }): import("react").JSX.Element;
65
+ export declare function Chip(props: {
66
+ label: string;
67
+ selected: boolean;
68
+ disabled?: boolean;
69
+ onPress: () => void;
70
+ }): import("react").JSX.Element;
71
+ export declare function Segmented<T extends string>(props: {
72
+ label: string;
73
+ value: T;
74
+ options: readonly {
75
+ value: T;
76
+ label: string;
77
+ }[];
78
+ disabled?: boolean;
79
+ onChange: (value: T) => void;
80
+ }): import("react").JSX.Element;
81
+ export declare function Radio(props: {
82
+ label: string;
83
+ checked: boolean;
84
+ disabled?: boolean;
85
+ logoUrl?: string | null;
86
+ onSelect: () => void;
87
+ children?: ReactNode;
88
+ }): import("react").JSX.Element;
89
+ export declare function Checkbox(props: {
90
+ label: string;
91
+ checked: boolean;
92
+ disabled?: boolean;
93
+ onChange: (checked: boolean) => void;
94
+ }): import("react").JSX.Element;
95
+ export declare function PendingApproval(props: {
96
+ message: string;
97
+ }): import("react").JSX.Element;
98
+ /** Replaces the pay button once an attempt used up the transaction id. */
99
+ export declare function RetryBlocked(props: {
100
+ onClose: () => void;
101
+ }): import("react").JSX.Element;
102
+ export declare function StatusScreen(props: {
103
+ icon?: string;
104
+ title: string;
105
+ text: string;
106
+ note?: string;
107
+ buttonLabel: string;
108
+ onButton: () => void;
109
+ tone?: 'success' | 'failed' | 'pending';
110
+ }): import("react").JSX.Element;
111
+ export declare function DeclinedScreen(props: {
112
+ retryable: boolean;
113
+ message?: string | null;
114
+ onClose: () => void;
115
+ }): import("react").JSX.Element;
116
+ export declare function ErrorScreen(props: {
117
+ onClose: () => void;
118
+ }): import("react").JSX.Element;
119
+ export declare function SuccessView(): import("react").JSX.Element;
120
+ export declare function BrandBadge(props: {
121
+ brand: CardBrand;
122
+ logos?: Record<string, string>;
123
+ }): import("react").JSX.Element | null;
124
+ export declare function ConfirmDialog(props: {
125
+ title: string;
126
+ text: string;
127
+ icon?: string;
128
+ cancelLabel?: string;
129
+ confirmLabel: string;
130
+ onCancel?: () => void;
131
+ onConfirm: () => void;
132
+ }): import("react").JSX.Element;
133
+ export declare function Toast(props: {
134
+ message: string | null;
135
+ }): import("react").JSX.Element | null;
136
+ /** A QR code drawn with Views (no SVG dependency); dark modules are merged into row runs. */
137
+ export declare function QrCode(props: {
138
+ value: string;
139
+ size?: number;
140
+ }): import("react").JSX.Element;
141
+ export declare const styles: Readonly<{
142
+ screen: {
143
+ flexGrow: number;
144
+ flexShrink: number;
145
+ backgroundColor: "#ffffff";
146
+ };
147
+ screenContent: {
148
+ padding: 16;
149
+ gap: 12;
150
+ paddingBottom: number;
151
+ };
152
+ header: {
153
+ flexDirection: "row";
154
+ alignItems: "center";
155
+ justifyContent: "space-between";
156
+ paddingHorizontal: 16;
157
+ paddingVertical: 12;
158
+ borderBottomWidth: number;
159
+ borderBottomColor: "#d1d5db";
160
+ backgroundColor: "#ffffff";
161
+ };
162
+ headerTitle: {
163
+ fontSize: 16;
164
+ fontWeight: "700";
165
+ color: "#111827";
166
+ flex: number;
167
+ };
168
+ close: {
169
+ width: number;
170
+ height: number;
171
+ borderRadius: number;
172
+ alignItems: "center";
173
+ justifyContent: "center";
174
+ backgroundColor: "#f3f4f6";
175
+ };
176
+ closeText: {
177
+ fontSize: number;
178
+ lineHeight: number;
179
+ color: "#111827";
180
+ };
181
+ summary: {
182
+ flexDirection: "row";
183
+ justifyContent: "space-between";
184
+ alignItems: "center";
185
+ gap: 12;
186
+ padding: 12;
187
+ borderRadius: 10;
188
+ backgroundColor: "#f3f4f6";
189
+ };
190
+ summaryItem: {
191
+ flex: number;
192
+ color: "#4b5563";
193
+ fontSize: 14;
194
+ };
195
+ summaryAmount: {
196
+ color: "#111827";
197
+ fontSize: 16;
198
+ fontWeight: "700";
199
+ };
200
+ note: {
201
+ fontSize: number;
202
+ lineHeight: number;
203
+ };
204
+ banner: {
205
+ padding: 12;
206
+ borderRadius: 6;
207
+ backgroundColor: "#fef2f2";
208
+ borderWidth: number;
209
+ borderColor: "#fecaca";
210
+ };
211
+ bannerText: {
212
+ color: "#dc2626";
213
+ fontSize: number;
214
+ };
215
+ btn: {
216
+ minHeight: number;
217
+ borderRadius: 10;
218
+ alignItems: "center";
219
+ justifyContent: "center";
220
+ paddingHorizontal: 16;
221
+ };
222
+ btnPrimary: {
223
+ backgroundColor: "#2563eb";
224
+ };
225
+ btnDanger: {
226
+ backgroundColor: "#dc2626";
227
+ };
228
+ btnOutline: {
229
+ borderWidth: number;
230
+ borderColor: "#2563eb";
231
+ backgroundColor: "#ffffff";
232
+ };
233
+ btnGhost: {
234
+ backgroundColor: string;
235
+ };
236
+ btnText: {
237
+ fontSize: number;
238
+ fontWeight: "700";
239
+ };
240
+ btnRow: {
241
+ flexDirection: "row";
242
+ gap: 8;
243
+ alignSelf: "stretch";
244
+ };
245
+ field: {
246
+ gap: number;
247
+ };
248
+ labelRow: {
249
+ flexDirection: "row";
250
+ alignItems: "center";
251
+ justifyContent: "space-between";
252
+ };
253
+ label: {
254
+ fontSize: number;
255
+ color: "#111827";
256
+ fontWeight: "600";
257
+ };
258
+ inputWrap: {
259
+ flexDirection: "row";
260
+ alignItems: "center";
261
+ borderWidth: number;
262
+ borderColor: "#6b7280";
263
+ borderRadius: 6;
264
+ backgroundColor: "#ffffff";
265
+ paddingHorizontal: 12;
266
+ };
267
+ input: {
268
+ flex: number;
269
+ minHeight: number;
270
+ fontSize: number;
271
+ color: "#111827";
272
+ paddingVertical: 8;
273
+ };
274
+ suffix: {
275
+ marginLeft: 8;
276
+ };
277
+ errorText: {
278
+ color: "#dc2626";
279
+ fontSize: 12;
280
+ };
281
+ select: {
282
+ minHeight: number;
283
+ justifyContent: "space-between";
284
+ };
285
+ selectText: {
286
+ flex: number;
287
+ fontSize: number;
288
+ color: "#111827";
289
+ paddingVertical: 8;
290
+ };
291
+ chevron: {
292
+ width: number;
293
+ height: number;
294
+ borderRightWidth: number;
295
+ borderBottomWidth: number;
296
+ borderColor: "#4b5563";
297
+ transform: {
298
+ rotate: string;
299
+ }[];
300
+ marginLeft: 8;
301
+ marginTop: number;
302
+ };
303
+ pickerBackdrop: {
304
+ flex: number;
305
+ justifyContent: "flex-end";
306
+ backgroundColor: "rgba(17, 24, 39, 0.5)";
307
+ };
308
+ pickerSheet: {
309
+ maxHeight: string;
310
+ backgroundColor: "#ffffff";
311
+ borderTopLeftRadius: 16;
312
+ borderTopRightRadius: 16;
313
+ paddingBottom: number;
314
+ };
315
+ pickerHandle: {
316
+ alignSelf: "center";
317
+ width: number;
318
+ height: number;
319
+ borderRadius: number;
320
+ backgroundColor: "#d1d5db";
321
+ marginTop: 8;
322
+ };
323
+ pickerHeader: {
324
+ flexDirection: "row";
325
+ alignItems: "center";
326
+ justifyContent: "space-between";
327
+ paddingHorizontal: 16;
328
+ paddingVertical: 12;
329
+ };
330
+ pickerTitle: {
331
+ fontSize: 16;
332
+ fontWeight: "700";
333
+ color: "#111827";
334
+ };
335
+ pickerClose: {
336
+ fontSize: number;
337
+ fontWeight: "600";
338
+ color: "#2563eb";
339
+ };
340
+ pickerSearch: {
341
+ marginHorizontal: 16;
342
+ marginBottom: 8;
343
+ borderColor: "#d1d5db";
344
+ };
345
+ pickerList: {
346
+ flexGrow: number;
347
+ };
348
+ pickerRow: {
349
+ flexDirection: "row";
350
+ alignItems: "center";
351
+ justifyContent: "space-between";
352
+ minHeight: number;
353
+ paddingHorizontal: 16;
354
+ borderBottomWidth: number;
355
+ borderBottomColor: "#d1d5db";
356
+ };
357
+ pickerRowText: {
358
+ flex: number;
359
+ fontSize: number;
360
+ color: "#111827";
361
+ };
362
+ pickerCheck: {
363
+ fontSize: 16;
364
+ color: "#2563eb";
365
+ fontWeight: "700";
366
+ marginLeft: 8;
367
+ };
368
+ pickerEmpty: {
369
+ padding: 16;
370
+ color: "#6b7280";
371
+ textAlign: "center";
372
+ };
373
+ chips: {
374
+ flexDirection: "row";
375
+ flexWrap: "wrap";
376
+ gap: 8;
377
+ };
378
+ chip: {
379
+ paddingHorizontal: 12;
380
+ paddingVertical: 8;
381
+ borderRadius: 999;
382
+ borderWidth: number;
383
+ borderColor: "#d1d5db";
384
+ backgroundColor: "#ffffff";
385
+ };
386
+ chipOn: {
387
+ backgroundColor: "#2563eb";
388
+ borderColor: "#2563eb";
389
+ };
390
+ chipText: {
391
+ fontSize: number;
392
+ color: "#111827";
393
+ fontWeight: "500";
394
+ };
395
+ segmented: {
396
+ flexDirection: "row";
397
+ backgroundColor: "#f3f4f6";
398
+ borderRadius: 10;
399
+ padding: number;
400
+ };
401
+ segment: {
402
+ flex: number;
403
+ paddingVertical: 8;
404
+ alignItems: "center";
405
+ borderRadius: number;
406
+ };
407
+ segmentOn: {
408
+ backgroundColor: "#ffffff";
409
+ shadowColor: string;
410
+ shadowOpacity: number;
411
+ shadowRadius: number;
412
+ shadowOffset: {
413
+ width: number;
414
+ height: number;
415
+ };
416
+ elevation: number;
417
+ };
418
+ segmentText: {
419
+ fontSize: number;
420
+ color: "#4b5563";
421
+ };
422
+ radio: {
423
+ flexDirection: "row";
424
+ alignItems: "center";
425
+ gap: 12;
426
+ padding: 12;
427
+ borderRadius: 10;
428
+ borderWidth: number;
429
+ borderColor: "#d1d5db";
430
+ backgroundColor: "#ffffff";
431
+ };
432
+ radioDot: {
433
+ width: number;
434
+ height: number;
435
+ borderRadius: number;
436
+ borderWidth: number;
437
+ borderColor: "#6b7280";
438
+ };
439
+ radioDotOn: {
440
+ borderWidth: number;
441
+ borderColor: "#111827";
442
+ };
443
+ radioLogo: {
444
+ width: number;
445
+ height: number;
446
+ };
447
+ radioLabel: {
448
+ flex: number;
449
+ fontSize: 14;
450
+ color: "#111827";
451
+ fontWeight: "600";
452
+ };
453
+ checkboxRow: {
454
+ flexDirection: "row";
455
+ alignItems: "center";
456
+ gap: 8;
457
+ };
458
+ checkbox: {
459
+ width: number;
460
+ height: number;
461
+ borderRadius: number;
462
+ borderWidth: number;
463
+ borderColor: "#6b7280";
464
+ alignItems: "center";
465
+ justifyContent: "center";
466
+ };
467
+ checkboxLabel: {
468
+ fontSize: 14;
469
+ color: "#111827";
470
+ };
471
+ pending: {
472
+ alignItems: "center";
473
+ gap: 12;
474
+ paddingVertical: 24;
475
+ };
476
+ pendingTitle: {
477
+ fontSize: 16;
478
+ fontWeight: "700";
479
+ color: "#111827";
480
+ textAlign: "center";
481
+ };
482
+ pendingText: {
483
+ fontSize: 14;
484
+ color: "#4b5563";
485
+ textAlign: "center";
486
+ };
487
+ status: {
488
+ alignItems: "center";
489
+ gap: 12;
490
+ paddingVertical: 24;
491
+ paddingHorizontal: 16;
492
+ };
493
+ statusIcon: {
494
+ width: number;
495
+ height: number;
496
+ borderRadius: number;
497
+ alignItems: "center";
498
+ justifyContent: "center";
499
+ };
500
+ statusIconText: {
501
+ color: string;
502
+ fontSize: number;
503
+ fontWeight: "700";
504
+ };
505
+ statusTitle: {
506
+ fontSize: 20;
507
+ fontWeight: "700";
508
+ color: "#111827";
509
+ textAlign: "center";
510
+ };
511
+ statusText: {
512
+ fontSize: 14;
513
+ color: "#4b5563";
514
+ textAlign: "center";
515
+ };
516
+ statusNote: {
517
+ fontSize: number;
518
+ color: "#6b7280";
519
+ textAlign: "center";
520
+ };
521
+ brand: {
522
+ fontSize: 14;
523
+ fontWeight: "900";
524
+ fontStyle: "italic";
525
+ };
526
+ mcDot: {
527
+ width: number;
528
+ height: number;
529
+ borderRadius: number;
530
+ };
531
+ dialogOverlay: {
532
+ backgroundColor: "rgba(17, 24, 39, 0.5)";
533
+ alignItems: "center";
534
+ justifyContent: "center";
535
+ padding: 24;
536
+ zIndex: number;
537
+ position: "absolute";
538
+ left: 0;
539
+ right: 0;
540
+ top: 0;
541
+ bottom: 0;
542
+ };
543
+ dialog: {
544
+ width: string;
545
+ maxWidth: number;
546
+ backgroundColor: "#ffffff";
547
+ borderRadius: 16;
548
+ padding: 24;
549
+ alignItems: "center";
550
+ gap: 8;
551
+ };
552
+ dialogIcon: {
553
+ fontSize: number;
554
+ };
555
+ dialogTitle: {
556
+ fontSize: 16;
557
+ fontWeight: "700";
558
+ color: "#111827";
559
+ textAlign: "center";
560
+ };
561
+ dialogText: {
562
+ fontSize: 14;
563
+ color: "#4b5563";
564
+ textAlign: "center";
565
+ marginBottom: 8;
566
+ };
567
+ toast: {
568
+ position: "absolute";
569
+ left: 16;
570
+ right: 16;
571
+ bottom: 24;
572
+ backgroundColor: "#111827";
573
+ borderRadius: 10;
574
+ padding: 12;
575
+ zIndex: number;
576
+ };
577
+ toastText: {
578
+ color: string;
579
+ textAlign: "center";
580
+ fontSize: 14;
581
+ };
582
+ }>;
583
+ //# sourceMappingURL=ui.d.ts.map
@@ -0,0 +1,40 @@
1
+ import { type WebViewMessageEvent } from 'react-native-webview';
2
+ import type { StepUpChallenge } from './core/index.js';
3
+ /** `http://` - a page that would load without TLS. */
4
+ export declare function isPlainHttp(url: string): boolean;
5
+ /**
6
+ * A page that POSTs `fields` to `action` inside an iframe and forwards every `message` event to
7
+ * React Native as `{ origin, fromFrame, data }` - the same signals the web SDK reads from
8
+ * `window` (the 3-D Secure pages talk to `window.parent`, which is this wrapper).
9
+ */
10
+ export declare function postFormPage(action: string, fields: Record<string, string>, visible: boolean): string;
11
+ export interface ForwardedMessage {
12
+ origin: string;
13
+ fromFrame: boolean;
14
+ data: unknown;
15
+ }
16
+ export declare function parseForwarded(event: WebViewMessageEvent): ForwardedMessage | null;
17
+ /**
18
+ * `FlowServices.runDeviceDataCollection` for React Native: renders Cardinal's collection page in
19
+ * a hidden WebView (inside `<SwichPayProvider>`) and resolves `true` on `profile.complete`,
20
+ * `false` after `timeoutMs` (hidden WebView).
21
+ */
22
+ export declare function runDeviceDataCollectionNative(input: {
23
+ url: string;
24
+ formFields: Record<string, string>;
25
+ timeoutMs: number;
26
+ }): Promise<boolean>;
27
+ /** Mounted once by `<SwichPayProvider>`; runs queued device-data collections off-screen. */
28
+ export declare function DeviceDataCollectionHost(): import("react").JSX.Element | null;
29
+ /**
30
+ * The issuer's 3-D Secure challenge. Completes on the challenge frame's first message, on a
31
+ * SwichPay `TRANSACTION_COMPLETE`, on a navigation to a completion URL, or on the manual
32
+ * "I've completed verification" button.
33
+ */
34
+ export declare function StepUpView(props: {
35
+ challenge: StepUpChallenge;
36
+ isCompletionUrl: (url: URL) => boolean;
37
+ onComplete: (eventData: string) => void;
38
+ height?: number;
39
+ }): import("react").JSX.Element;
40
+ //# sourceMappingURL=webviews.d.ts.map
@@ -0,0 +1,17 @@
1
+ import { type PaymentCategory, type PaymentDetails, type PaymentResult } from './core/index.js';
2
+ export interface HostedCheckoutProps {
3
+ details: PaymentDetails;
4
+ categories?: readonly PaymentCategory[];
5
+ /** A URL from `client.createHostedCheckoutUrl` - skips creating one. */
6
+ url?: string;
7
+ onFinish: (result: PaymentResult | null) => void;
8
+ /** Called when the session URL can't be created. */
9
+ onError?: (error: unknown) => void;
10
+ }
11
+ /**
12
+ * SwichPay's hosted checkout page: resolves from the redirect
13
+ * to `successRedirectUrl` / `failedRedirectUrl` or from the page's
14
+ * `redirecttocustomer` / `closewindow` messages. Close resolves `null`.
15
+ */
16
+ export declare function HostedCheckout(props: HostedCheckoutProps): import("react").JSX.Element;
17
+ //# sourceMappingURL=HostedCheckout.d.ts.map
@@ -0,0 +1,14 @@
1
+ /**
2
+ * A full-screen SwichPay page. `onNavigate` sees every top-level navigation first and returns
3
+ * `true` to stop it (a redirect URL that ends the checkout - it is never loaded, so it can be any
4
+ * URL, even one that doesn't exist). `onPageMessage` receives the page's `postMessage`s.
5
+ */
6
+ export declare function CheckoutWebView(props: {
7
+ url: string;
8
+ onNavigate?: (url: string) => boolean;
9
+ onPageMessage?: (origin: string, data: unknown) => void;
10
+ testID?: string;
11
+ /** Allow plain-HTTP pages (sandbox with a local backend). Off: only https:// pages load. */
12
+ allowInsecure?: boolean;
13
+ }): import("react").JSX.Element;
14
+ //# sourceMappingURL=checkout-webview.d.ts.map
@@ -0,0 +1,14 @@
1
+ import { PaymentCategory, type FlowServices, type PaymentDetails, type PaymentResult, type PaymentSheetControllerOptions } from '../core/index.js';
2
+ export interface PaymentSheetProps {
3
+ details: PaymentDetails;
4
+ /** Restricts which of the merchant's enabled categories are shown. */
5
+ categories?: readonly PaymentCategory[];
6
+ /** `null` = dismissed or startup failure. */
7
+ onFinish: (result: PaymentResult | null) => void;
8
+ services?: Partial<FlowServices>;
9
+ /** Timing overrides (tests). */
10
+ timing?: PaymentSheetControllerOptions['timing'];
11
+ }
12
+ /** The built-in payment sheet. */
13
+ export declare function PaymentSheet(props: PaymentSheetProps): import("react").JSX.Element;
14
+ //# sourceMappingURL=PaymentSheet.d.ts.map
@@ -0,0 +1,18 @@
1
+ import { type FlowServices, type PaymentDetails, type PaymentResult } from '../core/index.js';
2
+ export interface CheckoutProps {
3
+ details: PaymentDetails;
4
+ /** Called once with the outcome; `null` means dismissed without a result. */
5
+ onFinish: (result: PaymentResult | null) => void;
6
+ /** Replace side effects (tests, custom share/clipboard). */
7
+ services?: Partial<FlowServices>;
8
+ }
9
+ export declare function EwalletCheckout(props: CheckoutProps): import("react").JSX.Element;
10
+ export declare function BankTransferCheckout(props: CheckoutProps): import("react").JSX.Element;
11
+ export declare function CardCheckout(props: CheckoutProps & {
12
+ allowSaveCard?: boolean;
13
+ }): import("react").JSX.Element;
14
+ export declare function OneBillCheckout(props: CheckoutProps): import("react").JSX.Element;
15
+ export declare function QrCheckout(props: CheckoutProps): import("react").JSX.Element;
16
+ export declare function RtpNowCheckout(props: CheckoutProps): import("react").JSX.Element;
17
+ export declare function RtpEwalletCheckout(props: CheckoutProps): import("react").JSX.Element;
18
+ //# sourceMappingURL=direct.d.ts.map