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