@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,1142 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.BrandBadge = BrandBadge;
7
+ exports.Button = Button;
8
+ exports.Checkbox = Checkbox;
9
+ exports.Chip = Chip;
10
+ exports.ConfirmDialog = ConfirmDialog;
11
+ exports.DeclinedScreen = DeclinedScreen;
12
+ exports.ErrorBanner = ErrorBanner;
13
+ exports.ErrorScreen = ErrorScreen;
14
+ exports.Note = Note;
15
+ exports.OrderSummary = OrderSummary;
16
+ exports.PendingApproval = PendingApproval;
17
+ exports.QrCode = QrCode;
18
+ exports.Radio = Radio;
19
+ exports.RetryBlocked = RetryBlocked;
20
+ exports.Screen = Screen;
21
+ exports.Segmented = Segmented;
22
+ exports.SelectField = SelectField;
23
+ exports.SheetHeader = SheetHeader;
24
+ exports.Spinner = Spinner;
25
+ exports.StatusScreen = StatusScreen;
26
+ exports.SuccessView = SuccessView;
27
+ exports.TextField = TextField;
28
+ exports.Toast = Toast;
29
+ exports.styles = void 0;
30
+ var _react = require("react");
31
+ var _reactNative = require("react-native");
32
+ var _qr = require("./core/browser/qr.js");
33
+ var _index = require("./core/index.js");
34
+ var _theme = require("./theme.js");
35
+ var _jsxRuntime = require("react/jsx-runtime");
36
+ // ── Layout ─────────────────────────────────────────────────────────────────
37
+
38
+ /** Scrollable screen body used by every checkout. */
39
+ function Screen(props) {
40
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.ScrollView, {
41
+ style: styles.screen,
42
+ contentContainerStyle: [styles.screenContent, props.style],
43
+ keyboardShouldPersistTaps: "handled",
44
+ children: props.children
45
+ });
46
+ }
47
+ function SheetHeader(props) {
48
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
49
+ style: styles.header,
50
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
51
+ style: styles.headerTitle,
52
+ accessibilityRole: "header",
53
+ children: props.title
54
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Pressable, {
55
+ accessibilityRole: "button",
56
+ accessibilityLabel: "Close",
57
+ disabled: props.closeDisabled,
58
+ onPress: props.onClose,
59
+ hitSlop: 12,
60
+ style: ({
61
+ pressed
62
+ }) => [styles.close, (pressed || props.closeDisabled) && {
63
+ opacity: 0.4
64
+ }],
65
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
66
+ style: styles.closeText,
67
+ children: "\xD7"
68
+ })
69
+ })]
70
+ });
71
+ }
72
+ function OrderSummary(props) {
73
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
74
+ style: styles.summary,
75
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
76
+ style: styles.summaryItem,
77
+ numberOfLines: 2,
78
+ children: props.item
79
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
80
+ style: styles.summaryAmount,
81
+ children: props.amount
82
+ })]
83
+ });
84
+ }
85
+
86
+ // ── Text ───────────────────────────────────────────────────────────────────
87
+
88
+ function Note(props) {
89
+ const color = props.tone === 'danger' ? _theme.colors.danger : props.tone === 'success' ? _theme.colors.success : _theme.colors.muted;
90
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
91
+ style: [styles.note, {
92
+ color
93
+ }],
94
+ children: props.children
95
+ });
96
+ }
97
+ function ErrorBanner(props) {
98
+ if (!props.message) return null;
99
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
100
+ style: styles.banner,
101
+ accessibilityRole: "alert",
102
+ accessibilityLiveRegion: "polite",
103
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
104
+ style: styles.bannerText,
105
+ children: props.message
106
+ })
107
+ });
108
+ }
109
+
110
+ // ── Controls ───────────────────────────────────────────────────────────────
111
+
112
+ function Spinner(props) {
113
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.ActivityIndicator, {
114
+ accessibilityLabel: props.label,
115
+ size: props.large ? 'large' : 'small',
116
+ color: props.dark ? _theme.colors.blue : '#fff'
117
+ });
118
+ }
119
+ function Button(props) {
120
+ const variant = props.variant ?? 'primary';
121
+ const disabled = props.disabled || props.loading;
122
+ const container = variant === 'primary' ? styles.btnPrimary : variant === 'danger' ? styles.btnDanger : variant === 'outline' ? styles.btnOutline : styles.btnGhost;
123
+ const textColor = variant === 'primary' || variant === 'danger' ? '#fff' : _theme.colors.blue;
124
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Pressable, {
125
+ testID: props.testID,
126
+ accessibilityRole: "button",
127
+ accessibilityState: {
128
+ disabled: !!disabled,
129
+ busy: !!props.loading
130
+ },
131
+ disabled: disabled,
132
+ onPress: props.onPress,
133
+ style: ({
134
+ pressed
135
+ }) => [styles.btn, container, (pressed || disabled) && {
136
+ opacity: disabled ? 0.55 : 0.85
137
+ }, props.style],
138
+ children: props.loading ? /*#__PURE__*/(0, _jsxRuntime.jsx)(Spinner, {
139
+ label: "Processing",
140
+ dark: variant === 'ghost' || variant === 'outline'
141
+ }) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
142
+ style: [styles.btnText, {
143
+ color: textColor
144
+ }],
145
+ children: props.children
146
+ })
147
+ });
148
+ }
149
+ function TextField(props) {
150
+ const {
151
+ label,
152
+ required = true,
153
+ error,
154
+ value,
155
+ onValueChange,
156
+ suffix,
157
+ labelExtra,
158
+ keyboardType,
159
+ style,
160
+ ...rest
161
+ } = props;
162
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
163
+ style: styles.field,
164
+ children: [label ? /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
165
+ style: styles.labelRow,
166
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.Text, {
167
+ style: styles.label,
168
+ children: [label, required ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
169
+ style: {
170
+ color: _theme.colors.danger
171
+ },
172
+ children: " *"
173
+ }) : null]
174
+ }), labelExtra]
175
+ }) : null, /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
176
+ style: [styles.inputWrap, !!error && {
177
+ borderColor: _theme.colors.danger
178
+ }, rest.editable === false && {
179
+ backgroundColor: _theme.colors.surfaceAlt
180
+ }],
181
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.TextInput, {
182
+ ...rest,
183
+ accessibilityLabel: rest.accessibilityLabel ?? label,
184
+ value: value,
185
+ onChangeText: onValueChange,
186
+ keyboardType: keyboardType,
187
+ placeholderTextColor: _theme.colors.faint,
188
+ style: [styles.input, style]
189
+ }), suffix ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
190
+ style: styles.suffix,
191
+ children: suffix
192
+ }) : null]
193
+ }), error ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
194
+ style: styles.errorText,
195
+ children: error
196
+ }) : null]
197
+ });
198
+ }
199
+
200
+ /** Lists longer than this get a search box in the picker. */
201
+ const SEARCH_THRESHOLD = 8;
202
+
203
+ /**
204
+ * A dropdown: a field showing the current choice that opens a bottom-sheet picker (with search
205
+ * for long lists such as banks). The native replacement for `<select>`.
206
+ */
207
+ function SelectField(props) {
208
+ const [open, setOpen] = (0, _react.useState)(false);
209
+ const [query, setQuery] = (0, _react.useState)('');
210
+ const selected = props.options.find(o => o.value === props.value) ?? null;
211
+ const empty = props.options.length === 0;
212
+ const visible = (0, _react.useMemo)(() => {
213
+ const q = query.trim().toLowerCase();
214
+ return q ? props.options.filter(o => o.label.toLowerCase().includes(q)) : props.options;
215
+ }, [props.options, query]);
216
+ const close = () => {
217
+ setOpen(false);
218
+ setQuery('');
219
+ };
220
+ const choose = value => {
221
+ props.onValueChange(value);
222
+ close();
223
+ };
224
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
225
+ style: styles.field,
226
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.Text, {
227
+ style: styles.label,
228
+ children: [props.label, /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
229
+ style: {
230
+ color: _theme.colors.danger
231
+ },
232
+ children: " *"
233
+ })]
234
+ }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.Pressable, {
235
+ accessibilityRole: "button",
236
+ accessibilityLabel: props.label,
237
+ accessibilityValue: {
238
+ text: selected?.label ?? props.placeholder
239
+ },
240
+ accessibilityState: {
241
+ disabled: !!props.disabled || empty,
242
+ expanded: open
243
+ },
244
+ disabled: props.disabled || empty,
245
+ onPress: () => setOpen(true),
246
+ style: [styles.inputWrap, styles.select, !!props.error && {
247
+ borderColor: _theme.colors.danger
248
+ }, (props.disabled || empty) && {
249
+ backgroundColor: _theme.colors.surfaceAlt
250
+ }],
251
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
252
+ numberOfLines: 1,
253
+ style: [styles.selectText, !selected && {
254
+ color: _theme.colors.faint
255
+ }],
256
+ children: selected?.label ?? props.placeholder
257
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
258
+ style: styles.chevron
259
+ })]
260
+ }), props.error ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
261
+ style: styles.errorText,
262
+ children: props.error
263
+ }) : null, /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Modal, {
264
+ visible: open,
265
+ transparent: true,
266
+ animationType: "slide",
267
+ onRequestClose: close,
268
+ statusBarTranslucent: true,
269
+ children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
270
+ style: styles.pickerBackdrop,
271
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Pressable, {
272
+ style: _theme.FILL,
273
+ accessibilityLabel: "Close",
274
+ onPress: close
275
+ }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
276
+ style: styles.pickerSheet,
277
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
278
+ style: styles.pickerHandle
279
+ }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
280
+ style: styles.pickerHeader,
281
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
282
+ style: styles.pickerTitle,
283
+ children: props.label
284
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Pressable, {
285
+ accessibilityRole: "button",
286
+ accessibilityLabel: "Close",
287
+ hitSlop: 12,
288
+ onPress: close,
289
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
290
+ style: styles.pickerClose,
291
+ children: "Done"
292
+ })
293
+ })]
294
+ }), props.options.length > SEARCH_THRESHOLD ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
295
+ style: [styles.inputWrap, styles.pickerSearch],
296
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.TextInput, {
297
+ value: query,
298
+ onChangeText: setQuery,
299
+ placeholder: `Search ${props.label.toLowerCase()}`,
300
+ placeholderTextColor: _theme.colors.faint,
301
+ autoCorrect: false,
302
+ accessibilityLabel: `Search ${props.label.toLowerCase()}`,
303
+ style: styles.input
304
+ })
305
+ }) : null, /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.ScrollView, {
306
+ keyboardShouldPersistTaps: "handled",
307
+ style: styles.pickerList,
308
+ accessibilityRole: "list",
309
+ children: [visible.map(option => {
310
+ const on = option.value === props.value;
311
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.Pressable, {
312
+ accessibilityRole: "radio",
313
+ accessibilityState: {
314
+ checked: on
315
+ },
316
+ onPress: () => choose(option.value),
317
+ style: ({
318
+ pressed
319
+ }) => [styles.pickerRow, pressed && {
320
+ backgroundColor: _theme.colors.surfaceAlt
321
+ }],
322
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
323
+ style: [styles.pickerRowText, on && {
324
+ color: _theme.colors.blue,
325
+ fontWeight: '600'
326
+ }],
327
+ children: option.label
328
+ }), on ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
329
+ style: styles.pickerCheck,
330
+ children: "\u2713"
331
+ }) : null]
332
+ }, option.value);
333
+ }), visible.length === 0 ? /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.Text, {
334
+ style: styles.pickerEmpty,
335
+ children: ["No matches for \u201C", query.trim(), "\u201D"]
336
+ }) : null]
337
+ })]
338
+ })]
339
+ })
340
+ })]
341
+ });
342
+ }
343
+ function Chip(props) {
344
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Pressable, {
345
+ accessibilityRole: "radio",
346
+ accessibilityState: {
347
+ checked: props.selected,
348
+ disabled: !!props.disabled
349
+ },
350
+ disabled: props.disabled,
351
+ onPress: props.onPress,
352
+ style: [styles.chip, props.selected && styles.chipOn, props.disabled && {
353
+ opacity: 0.5
354
+ }],
355
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
356
+ style: [styles.chipText, props.selected && {
357
+ color: '#fff'
358
+ }],
359
+ children: props.label
360
+ })
361
+ });
362
+ }
363
+ function Segmented(props) {
364
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
365
+ style: styles.segmented,
366
+ accessibilityRole: "radiogroup",
367
+ accessibilityLabel: props.label,
368
+ children: props.options.map(option => {
369
+ const on = props.value === option.value;
370
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Pressable, {
371
+ accessibilityRole: "radio",
372
+ accessibilityState: {
373
+ checked: on,
374
+ disabled: !!props.disabled
375
+ },
376
+ disabled: props.disabled,
377
+ onPress: () => props.onChange(option.value),
378
+ style: [styles.segment, on && styles.segmentOn],
379
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
380
+ style: [styles.segmentText, on && {
381
+ color: _theme.colors.text,
382
+ fontWeight: '700'
383
+ }],
384
+ children: option.label
385
+ })
386
+ }, option.value);
387
+ })
388
+ });
389
+ }
390
+ function Radio(props) {
391
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.Pressable, {
392
+ accessibilityRole: "radio",
393
+ accessibilityState: {
394
+ checked: props.checked,
395
+ disabled: !!props.disabled
396
+ },
397
+ disabled: props.disabled,
398
+ onPress: props.onSelect,
399
+ style: [styles.radio, props.checked && {
400
+ borderColor: _theme.colors.text
401
+ }, props.disabled && !props.checked && {
402
+ opacity: 0.5
403
+ }],
404
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
405
+ style: [styles.radioDot, props.checked && styles.radioDotOn]
406
+ }), props.logoUrl ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Image, {
407
+ source: {
408
+ uri: props.logoUrl
409
+ },
410
+ style: styles.radioLogo,
411
+ resizeMode: "contain"
412
+ }) : null, /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
413
+ style: styles.radioLabel,
414
+ children: props.label
415
+ }), props.children]
416
+ });
417
+ }
418
+ function Checkbox(props) {
419
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.Pressable, {
420
+ accessibilityRole: "checkbox",
421
+ accessibilityState: {
422
+ checked: props.checked,
423
+ disabled: !!props.disabled
424
+ },
425
+ disabled: props.disabled,
426
+ onPress: () => props.onChange(!props.checked),
427
+ style: styles.checkboxRow,
428
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
429
+ style: [styles.checkbox, props.checked && {
430
+ backgroundColor: _theme.colors.blue,
431
+ borderColor: _theme.colors.blue
432
+ }],
433
+ children: props.checked ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
434
+ style: {
435
+ color: '#fff',
436
+ fontSize: 12,
437
+ fontWeight: '700'
438
+ },
439
+ children: "\u2713"
440
+ }) : null
441
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
442
+ style: styles.checkboxLabel,
443
+ children: props.label
444
+ })]
445
+ });
446
+ }
447
+
448
+ // ── Screens ────────────────────────────────────────────────────────────────
449
+
450
+ function PendingApproval(props) {
451
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
452
+ style: styles.pending,
453
+ accessibilityRole: "progressbar",
454
+ accessibilityLiveRegion: "polite",
455
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(Spinner, {
456
+ dark: true,
457
+ large: true,
458
+ label: "Waiting for approval"
459
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
460
+ style: styles.pendingTitle,
461
+ children: _index.PENDING_APPROVAL_TITLE
462
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
463
+ style: styles.pendingText,
464
+ children: props.message
465
+ })]
466
+ });
467
+ }
468
+
469
+ /** Replaces the pay button once an attempt used up the transaction id. */
470
+ function RetryBlocked(props) {
471
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
472
+ style: {
473
+ gap: _theme.space.md
474
+ },
475
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(Note, {
476
+ children: _index.RETRY_BLOCKED_MESSAGE
477
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(Button, {
478
+ onPress: props.onClose,
479
+ children: "CLOSE"
480
+ })]
481
+ });
482
+ }
483
+ function StatusScreen(props) {
484
+ const tone = props.tone ?? 'failed';
485
+ const iconBg = tone === 'success' ? _theme.colors.success : tone === 'pending' ? _theme.colors.blue : _theme.colors.danger;
486
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
487
+ style: styles.status,
488
+ accessibilityRole: "alert",
489
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
490
+ style: [styles.statusIcon, {
491
+ backgroundColor: iconBg
492
+ }],
493
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
494
+ style: styles.statusIconText,
495
+ children: props.icon ?? '✕'
496
+ })
497
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
498
+ style: styles.statusTitle,
499
+ children: props.title
500
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
501
+ style: styles.statusText,
502
+ children: props.text
503
+ }), props.note ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
504
+ style: styles.statusNote,
505
+ children: props.note
506
+ }) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
507
+ style: {
508
+ height: 12
509
+ }
510
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(Button, {
511
+ onPress: props.onButton,
512
+ style: {
513
+ alignSelf: 'stretch'
514
+ },
515
+ children: props.buttonLabel
516
+ })]
517
+ });
518
+ }
519
+ function DeclinedScreen(props) {
520
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(StatusScreen, {
521
+ title: "Payment declined",
522
+ text: props.message || 'Your payment was declined.',
523
+ note: props.retryable ? 'Close this and start a new payment with a different card.' : `Please contact support.\n${_index.SUPPORT_PHONE}`,
524
+ buttonLabel: "Close",
525
+ onButton: props.onClose
526
+ });
527
+ }
528
+ function ErrorScreen(props) {
529
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(StatusScreen, {
530
+ title: "Something went wrong",
531
+ text: "An unexpected error occurred.",
532
+ note: `If this persists, contact support.\n${_index.SUPPORT_PHONE}`,
533
+ buttonLabel: "Close",
534
+ onButton: props.onClose
535
+ });
536
+ }
537
+ function SuccessView() {
538
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
539
+ style: styles.status,
540
+ accessibilityRole: "alert",
541
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
542
+ style: [styles.statusIcon, {
543
+ backgroundColor: _theme.colors.success
544
+ }],
545
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
546
+ style: styles.statusIconText,
547
+ children: "\u2713"
548
+ })
549
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
550
+ style: styles.statusTitle,
551
+ children: "Payment Successful"
552
+ })]
553
+ });
554
+ }
555
+ function BrandBadge(props) {
556
+ const logo = props.brand === 'visa' ? props.logos?.Visa : props.brand === 'mastercard' ? props.logos?.Mastercard : undefined;
557
+ if (logo) return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Image, {
558
+ source: {
559
+ uri: logo
560
+ },
561
+ style: {
562
+ width: 36,
563
+ height: 20
564
+ },
565
+ resizeMode: "contain",
566
+ accessibilityLabel: props.brand
567
+ });
568
+ if (props.brand === 'visa') return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
569
+ style: [styles.brand, {
570
+ color: '#1a1f71'
571
+ }],
572
+ children: "VISA"
573
+ });
574
+ if (props.brand === 'amex') return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
575
+ style: [styles.brand, {
576
+ color: '#2e77bb'
577
+ }],
578
+ children: "AMEX"
579
+ });
580
+ if (props.brand === 'mastercard') {
581
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
582
+ style: {
583
+ flexDirection: 'row'
584
+ },
585
+ accessibilityLabel: "Mastercard",
586
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
587
+ style: [styles.mcDot, {
588
+ backgroundColor: '#eb001b'
589
+ }]
590
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
591
+ style: [styles.mcDot, {
592
+ backgroundColor: '#f79e1b',
593
+ marginLeft: -6,
594
+ opacity: 0.9
595
+ }]
596
+ })]
597
+ });
598
+ }
599
+ return null;
600
+ }
601
+ function ConfirmDialog(props) {
602
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
603
+ style: styles.dialogOverlay,
604
+ accessibilityViewIsModal: true,
605
+ children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
606
+ style: styles.dialog,
607
+ accessibilityRole: "alert",
608
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
609
+ style: styles.dialogIcon,
610
+ children: props.icon ?? '⎋'
611
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
612
+ style: styles.dialogTitle,
613
+ children: props.title
614
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
615
+ style: styles.dialogText,
616
+ children: props.text
617
+ }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
618
+ style: styles.btnRow,
619
+ children: [props.onCancel ? /*#__PURE__*/(0, _jsxRuntime.jsx)(Button, {
620
+ variant: "outline",
621
+ onPress: props.onCancel,
622
+ style: {
623
+ flex: 1
624
+ },
625
+ children: props.cancelLabel ?? 'Cancel'
626
+ }) : null, /*#__PURE__*/(0, _jsxRuntime.jsx)(Button, {
627
+ variant: "danger",
628
+ onPress: props.onConfirm,
629
+ style: {
630
+ flex: 1
631
+ },
632
+ children: props.confirmLabel
633
+ })]
634
+ })]
635
+ })
636
+ });
637
+ }
638
+ function Toast(props) {
639
+ if (!props.message) return null;
640
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
641
+ style: styles.toast,
642
+ accessibilityLiveRegion: "polite",
643
+ pointerEvents: "none",
644
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
645
+ style: styles.toastText,
646
+ children: props.message
647
+ })
648
+ });
649
+ }
650
+
651
+ /** A QR code drawn with Views (no SVG dependency); dark modules are merged into row runs. */
652
+ function QrCode(props) {
653
+ const size = props.size ?? 220;
654
+ const rows = (0, _react.useMemo)(() => {
655
+ const matrix = (0, _qr.encodeQr)(props.value);
656
+ const out = [];
657
+ for (let r = 0; r < matrix.size; r++) {
658
+ const runs = [];
659
+ let start = -1;
660
+ for (let c = 0; c <= matrix.size; c++) {
661
+ const dark = c < matrix.size && matrix.isDark(r, c);
662
+ if (dark && start < 0) start = c;
663
+ if (!dark && start >= 0) {
664
+ runs.push({
665
+ x: start,
666
+ w: c - start
667
+ });
668
+ start = -1;
669
+ }
670
+ }
671
+ out.push({
672
+ y: r,
673
+ runs
674
+ });
675
+ }
676
+ return {
677
+ modules: matrix.size,
678
+ out
679
+ };
680
+ }, [props.value]);
681
+ const quiet = 4;
682
+ const cell = size / (rows.modules + quiet * 2);
683
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
684
+ style: {
685
+ width: size,
686
+ height: size,
687
+ backgroundColor: '#fff',
688
+ alignSelf: 'center'
689
+ },
690
+ accessibilityRole: "image",
691
+ accessibilityLabel: "Payment QR code",
692
+ children: rows.out.map(row => row.runs.map(run => /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
693
+ style: {
694
+ position: 'absolute',
695
+ backgroundColor: '#000',
696
+ left: (run.x + quiet) * cell,
697
+ top: (row.y + quiet) * cell,
698
+ width: run.w * cell + 0.5,
699
+ height: cell + 0.5
700
+ }
701
+ }, `${row.y}-${run.x}`)))
702
+ });
703
+ }
704
+ const styles = exports.styles = _reactNative.StyleSheet.create({
705
+ screen: {
706
+ flexGrow: 1,
707
+ flexShrink: 1,
708
+ backgroundColor: _theme.colors.surface
709
+ },
710
+ screenContent: {
711
+ padding: _theme.space.lg,
712
+ gap: _theme.space.md,
713
+ paddingBottom: _theme.space.xl * 2
714
+ },
715
+ header: {
716
+ flexDirection: 'row',
717
+ alignItems: 'center',
718
+ justifyContent: 'space-between',
719
+ paddingHorizontal: _theme.space.lg,
720
+ paddingVertical: _theme.space.md,
721
+ borderBottomWidth: _reactNative.StyleSheet.hairlineWidth,
722
+ borderBottomColor: _theme.colors.border,
723
+ backgroundColor: _theme.colors.surface
724
+ },
725
+ headerTitle: {
726
+ fontSize: _theme.font.lg,
727
+ fontWeight: '700',
728
+ color: _theme.colors.text,
729
+ flex: 1
730
+ },
731
+ close: {
732
+ width: 32,
733
+ height: 32,
734
+ borderRadius: 16,
735
+ alignItems: 'center',
736
+ justifyContent: 'center',
737
+ backgroundColor: _theme.colors.surfaceAlt
738
+ },
739
+ closeText: {
740
+ fontSize: 22,
741
+ lineHeight: 24,
742
+ color: _theme.colors.text
743
+ },
744
+ summary: {
745
+ flexDirection: 'row',
746
+ justifyContent: 'space-between',
747
+ alignItems: 'center',
748
+ gap: _theme.space.md,
749
+ padding: _theme.space.md,
750
+ borderRadius: _theme.radius.md,
751
+ backgroundColor: _theme.colors.surfaceAlt
752
+ },
753
+ summaryItem: {
754
+ flex: 1,
755
+ color: _theme.colors.muted,
756
+ fontSize: _theme.font.md
757
+ },
758
+ summaryAmount: {
759
+ color: _theme.colors.text,
760
+ fontSize: _theme.font.lg,
761
+ fontWeight: '700'
762
+ },
763
+ note: {
764
+ fontSize: _theme.font.sm + 1,
765
+ lineHeight: 18
766
+ },
767
+ banner: {
768
+ padding: _theme.space.md,
769
+ borderRadius: _theme.radius.sm,
770
+ backgroundColor: _theme.colors.dangerBg,
771
+ borderWidth: 1,
772
+ borderColor: _theme.colors.dangerBorder
773
+ },
774
+ bannerText: {
775
+ color: _theme.colors.danger,
776
+ fontSize: _theme.font.sm + 1
777
+ },
778
+ btn: {
779
+ minHeight: 48,
780
+ borderRadius: _theme.radius.md,
781
+ alignItems: 'center',
782
+ justifyContent: 'center',
783
+ paddingHorizontal: _theme.space.lg
784
+ },
785
+ btnPrimary: {
786
+ backgroundColor: _theme.colors.blue
787
+ },
788
+ btnDanger: {
789
+ backgroundColor: _theme.colors.danger
790
+ },
791
+ btnOutline: {
792
+ borderWidth: 1,
793
+ borderColor: _theme.colors.blue,
794
+ backgroundColor: _theme.colors.surface
795
+ },
796
+ btnGhost: {
797
+ backgroundColor: 'transparent'
798
+ },
799
+ btnText: {
800
+ fontSize: _theme.font.md + 1,
801
+ fontWeight: '700'
802
+ },
803
+ btnRow: {
804
+ flexDirection: 'row',
805
+ gap: _theme.space.sm,
806
+ alignSelf: 'stretch'
807
+ },
808
+ field: {
809
+ gap: 6
810
+ },
811
+ labelRow: {
812
+ flexDirection: 'row',
813
+ alignItems: 'center',
814
+ justifyContent: 'space-between'
815
+ },
816
+ label: {
817
+ fontSize: _theme.font.sm + 1,
818
+ color: _theme.colors.text,
819
+ fontWeight: '600'
820
+ },
821
+ inputWrap: {
822
+ flexDirection: 'row',
823
+ alignItems: 'center',
824
+ borderWidth: 1,
825
+ borderColor: _theme.colors.fieldBorder,
826
+ borderRadius: _theme.radius.sm,
827
+ backgroundColor: _theme.colors.surface,
828
+ paddingHorizontal: _theme.space.md
829
+ },
830
+ input: {
831
+ flex: 1,
832
+ minHeight: 46,
833
+ fontSize: _theme.font.md + 1,
834
+ color: _theme.colors.text,
835
+ paddingVertical: _theme.space.sm
836
+ },
837
+ suffix: {
838
+ marginLeft: _theme.space.sm
839
+ },
840
+ errorText: {
841
+ color: _theme.colors.danger,
842
+ fontSize: _theme.font.sm
843
+ },
844
+ select: {
845
+ minHeight: 48,
846
+ justifyContent: 'space-between'
847
+ },
848
+ selectText: {
849
+ flex: 1,
850
+ fontSize: _theme.font.md + 1,
851
+ color: _theme.colors.text,
852
+ paddingVertical: _theme.space.sm
853
+ },
854
+ // A CSS-style chevron: two borders of a rotated square, no icon font needed.
855
+ chevron: {
856
+ width: 8,
857
+ height: 8,
858
+ borderRightWidth: 2,
859
+ borderBottomWidth: 2,
860
+ borderColor: _theme.colors.muted,
861
+ transform: [{
862
+ rotate: '45deg'
863
+ }],
864
+ marginLeft: _theme.space.sm,
865
+ marginTop: -4
866
+ },
867
+ pickerBackdrop: {
868
+ flex: 1,
869
+ justifyContent: 'flex-end',
870
+ backgroundColor: _theme.colors.overlay
871
+ },
872
+ pickerSheet: {
873
+ maxHeight: '75%',
874
+ backgroundColor: _theme.colors.surface,
875
+ borderTopLeftRadius: _theme.radius.lg,
876
+ borderTopRightRadius: _theme.radius.lg,
877
+ paddingBottom: _theme.space.xl + _theme.space.sm
878
+ },
879
+ pickerHandle: {
880
+ alignSelf: 'center',
881
+ width: 40,
882
+ height: 4,
883
+ borderRadius: 2,
884
+ backgroundColor: _theme.colors.border,
885
+ marginTop: _theme.space.sm
886
+ },
887
+ pickerHeader: {
888
+ flexDirection: 'row',
889
+ alignItems: 'center',
890
+ justifyContent: 'space-between',
891
+ paddingHorizontal: _theme.space.lg,
892
+ paddingVertical: _theme.space.md
893
+ },
894
+ pickerTitle: {
895
+ fontSize: _theme.font.lg,
896
+ fontWeight: '700',
897
+ color: _theme.colors.text
898
+ },
899
+ pickerClose: {
900
+ fontSize: _theme.font.md + 1,
901
+ fontWeight: '600',
902
+ color: _theme.colors.blue
903
+ },
904
+ pickerSearch: {
905
+ marginHorizontal: _theme.space.lg,
906
+ marginBottom: _theme.space.sm,
907
+ borderColor: _theme.colors.border
908
+ },
909
+ pickerList: {
910
+ flexGrow: 0
911
+ },
912
+ pickerRow: {
913
+ flexDirection: 'row',
914
+ alignItems: 'center',
915
+ justifyContent: 'space-between',
916
+ minHeight: 52,
917
+ paddingHorizontal: _theme.space.lg,
918
+ borderBottomWidth: _reactNative.StyleSheet.hairlineWidth,
919
+ borderBottomColor: _theme.colors.border
920
+ },
921
+ pickerRowText: {
922
+ flex: 1,
923
+ fontSize: _theme.font.md + 1,
924
+ color: _theme.colors.text
925
+ },
926
+ pickerCheck: {
927
+ fontSize: _theme.font.lg,
928
+ color: _theme.colors.blue,
929
+ fontWeight: '700',
930
+ marginLeft: _theme.space.sm
931
+ },
932
+ pickerEmpty: {
933
+ padding: _theme.space.lg,
934
+ color: _theme.colors.faint,
935
+ textAlign: 'center'
936
+ },
937
+ chips: {
938
+ flexDirection: 'row',
939
+ flexWrap: 'wrap',
940
+ gap: _theme.space.sm
941
+ },
942
+ chip: {
943
+ paddingHorizontal: _theme.space.md,
944
+ paddingVertical: _theme.space.sm,
945
+ borderRadius: _theme.radius.pill,
946
+ borderWidth: 1,
947
+ borderColor: _theme.colors.border,
948
+ backgroundColor: _theme.colors.surface
949
+ },
950
+ chipOn: {
951
+ backgroundColor: _theme.colors.blue,
952
+ borderColor: _theme.colors.blue
953
+ },
954
+ chipText: {
955
+ fontSize: _theme.font.sm + 1,
956
+ color: _theme.colors.text,
957
+ fontWeight: '500'
958
+ },
959
+ segmented: {
960
+ flexDirection: 'row',
961
+ backgroundColor: _theme.colors.surfaceAlt,
962
+ borderRadius: _theme.radius.md,
963
+ padding: 3
964
+ },
965
+ segment: {
966
+ flex: 1,
967
+ paddingVertical: _theme.space.sm,
968
+ alignItems: 'center',
969
+ borderRadius: _theme.radius.sm + 2
970
+ },
971
+ segmentOn: {
972
+ backgroundColor: _theme.colors.surface,
973
+ shadowColor: '#000',
974
+ shadowOpacity: 0.08,
975
+ shadowRadius: 3,
976
+ shadowOffset: {
977
+ width: 0,
978
+ height: 1
979
+ },
980
+ elevation: 1
981
+ },
982
+ segmentText: {
983
+ fontSize: _theme.font.sm + 1,
984
+ color: _theme.colors.muted
985
+ },
986
+ radio: {
987
+ flexDirection: 'row',
988
+ alignItems: 'center',
989
+ gap: _theme.space.md,
990
+ padding: _theme.space.md,
991
+ borderRadius: _theme.radius.md,
992
+ borderWidth: 1,
993
+ borderColor: _theme.colors.border,
994
+ backgroundColor: _theme.colors.surface
995
+ },
996
+ radioDot: {
997
+ width: 18,
998
+ height: 18,
999
+ borderRadius: 9,
1000
+ borderWidth: 1.5,
1001
+ borderColor: _theme.colors.faint
1002
+ },
1003
+ radioDotOn: {
1004
+ borderWidth: 5,
1005
+ borderColor: _theme.colors.text
1006
+ },
1007
+ radioLogo: {
1008
+ width: 28,
1009
+ height: 20
1010
+ },
1011
+ radioLabel: {
1012
+ flex: 1,
1013
+ fontSize: _theme.font.md,
1014
+ color: _theme.colors.text,
1015
+ fontWeight: '600'
1016
+ },
1017
+ checkboxRow: {
1018
+ flexDirection: 'row',
1019
+ alignItems: 'center',
1020
+ gap: _theme.space.sm
1021
+ },
1022
+ checkbox: {
1023
+ width: 20,
1024
+ height: 20,
1025
+ borderRadius: 4,
1026
+ borderWidth: 1.5,
1027
+ borderColor: _theme.colors.fieldBorder,
1028
+ alignItems: 'center',
1029
+ justifyContent: 'center'
1030
+ },
1031
+ checkboxLabel: {
1032
+ fontSize: _theme.font.md,
1033
+ color: _theme.colors.text
1034
+ },
1035
+ pending: {
1036
+ alignItems: 'center',
1037
+ gap: _theme.space.md,
1038
+ paddingVertical: _theme.space.xl
1039
+ },
1040
+ pendingTitle: {
1041
+ fontSize: _theme.font.lg,
1042
+ fontWeight: '700',
1043
+ color: _theme.colors.text,
1044
+ textAlign: 'center'
1045
+ },
1046
+ pendingText: {
1047
+ fontSize: _theme.font.md,
1048
+ color: _theme.colors.muted,
1049
+ textAlign: 'center'
1050
+ },
1051
+ status: {
1052
+ alignItems: 'center',
1053
+ gap: _theme.space.md,
1054
+ paddingVertical: _theme.space.xl,
1055
+ paddingHorizontal: _theme.space.lg
1056
+ },
1057
+ statusIcon: {
1058
+ width: 64,
1059
+ height: 64,
1060
+ borderRadius: 32,
1061
+ alignItems: 'center',
1062
+ justifyContent: 'center'
1063
+ },
1064
+ statusIconText: {
1065
+ color: '#fff',
1066
+ fontSize: 30,
1067
+ fontWeight: '700'
1068
+ },
1069
+ statusTitle: {
1070
+ fontSize: _theme.font.xl,
1071
+ fontWeight: '700',
1072
+ color: _theme.colors.text,
1073
+ textAlign: 'center'
1074
+ },
1075
+ statusText: {
1076
+ fontSize: _theme.font.md,
1077
+ color: _theme.colors.muted,
1078
+ textAlign: 'center'
1079
+ },
1080
+ statusNote: {
1081
+ fontSize: _theme.font.sm + 1,
1082
+ color: _theme.colors.faint,
1083
+ textAlign: 'center'
1084
+ },
1085
+ brand: {
1086
+ fontSize: _theme.font.md,
1087
+ fontWeight: '900',
1088
+ fontStyle: 'italic'
1089
+ },
1090
+ mcDot: {
1091
+ width: 16,
1092
+ height: 16,
1093
+ borderRadius: 8
1094
+ },
1095
+ dialogOverlay: {
1096
+ ..._theme.FILL,
1097
+ backgroundColor: _theme.colors.overlay,
1098
+ alignItems: 'center',
1099
+ justifyContent: 'center',
1100
+ padding: _theme.space.xl,
1101
+ zIndex: 20
1102
+ },
1103
+ dialog: {
1104
+ width: '100%',
1105
+ maxWidth: 360,
1106
+ backgroundColor: _theme.colors.surface,
1107
+ borderRadius: _theme.radius.lg,
1108
+ padding: _theme.space.xl,
1109
+ alignItems: 'center',
1110
+ gap: _theme.space.sm
1111
+ },
1112
+ dialogIcon: {
1113
+ fontSize: 28
1114
+ },
1115
+ dialogTitle: {
1116
+ fontSize: _theme.font.lg,
1117
+ fontWeight: '700',
1118
+ color: _theme.colors.text,
1119
+ textAlign: 'center'
1120
+ },
1121
+ dialogText: {
1122
+ fontSize: _theme.font.md,
1123
+ color: _theme.colors.muted,
1124
+ textAlign: 'center',
1125
+ marginBottom: _theme.space.sm
1126
+ },
1127
+ toast: {
1128
+ position: 'absolute',
1129
+ left: _theme.space.lg,
1130
+ right: _theme.space.lg,
1131
+ bottom: _theme.space.xl,
1132
+ backgroundColor: _theme.colors.dark,
1133
+ borderRadius: _theme.radius.md,
1134
+ padding: _theme.space.md,
1135
+ zIndex: 30
1136
+ },
1137
+ toastText: {
1138
+ color: '#fff',
1139
+ textAlign: 'center',
1140
+ fontSize: _theme.font.md
1141
+ }
1142
+ });