@crossmint/client-sdk-react-native-ui 0.13.29 → 0.13.32

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 (297) hide show
  1. package/dist/chunk-2D2RJCVX.js +1 -0
  2. package/dist/chunk-2PX34LDU.js +1 -0
  3. package/dist/chunk-33A67NJB.js +1 -0
  4. package/dist/chunk-3QSVHCEH.mjs +2 -0
  5. package/dist/chunk-4K5AKIUY.mjs +1 -0
  6. package/dist/chunk-5CLFJLE4.mjs +0 -0
  7. package/dist/chunk-72MMCJ2E.js +1 -0
  8. package/dist/chunk-77GXCNDP.js +1 -0
  9. package/dist/chunk-7USVT6EZ.mjs +1 -0
  10. package/dist/chunk-AJMHVVST.js +1 -0
  11. package/dist/chunk-C62HRWJA.js +1 -0
  12. package/dist/chunk-D4347S2W.mjs +1 -0
  13. package/dist/chunk-D5QADN6Z.mjs +1 -0
  14. package/dist/chunk-DC5HCBPK.js +1 -0
  15. package/dist/chunk-DGDGCUWI.js +1 -0
  16. package/dist/chunk-DKQZSNOO.js +1 -0
  17. package/dist/chunk-DRF2SEV2.mjs +1 -0
  18. package/dist/chunk-DZIX4GTA.mjs +1 -0
  19. package/dist/chunk-EEGS6YBT.mjs +1 -0
  20. package/dist/chunk-EF2YTIUF.mjs +1 -0
  21. package/dist/chunk-EF5KYLDO.js +1 -0
  22. package/dist/chunk-EI5LOD4Y.js +1 -0
  23. package/dist/chunk-F7VXWATP.js +1 -0
  24. package/dist/chunk-FFQ6EQCL.mjs +1 -0
  25. package/dist/chunk-FX23A4BR.mjs +1 -0
  26. package/dist/chunk-GP5U5576.js +1 -0
  27. package/dist/chunk-I3QSTPTV.mjs +0 -0
  28. package/dist/chunk-I4D3YJW2.js +1 -0
  29. package/dist/chunk-IUDQDPIN.mjs +1 -0
  30. package/dist/chunk-J42HASCI.js +1 -0
  31. package/dist/chunk-J477SX6P.mjs +1 -0
  32. package/dist/chunk-J7Q2R6UH.mjs +0 -0
  33. package/dist/chunk-K36KMDCG.js +1 -0
  34. package/dist/chunk-KBGJNOSB.js +1 -0
  35. package/dist/chunk-LK3AO6AY.mjs +1 -0
  36. package/dist/chunk-LOFHVHXQ.js +1 -0
  37. package/dist/chunk-MB7H3PBJ.mjs +0 -0
  38. package/dist/chunk-MKCQJOIO.js +1 -0
  39. package/dist/chunk-MVVSGLQL.js +2 -0
  40. package/dist/chunk-OCOGB3KT.mjs +1 -0
  41. package/dist/chunk-PCJMDUSI.mjs +1 -0
  42. package/dist/chunk-PSSAAY7D.mjs +1 -0
  43. package/dist/chunk-RRFC7QEE.js +1 -0
  44. package/dist/chunk-SHTETN4C.js +1 -0
  45. package/dist/chunk-TIQGKXQA.mjs +0 -0
  46. package/dist/chunk-TUC3RZ6L.mjs +1 -0
  47. package/dist/chunk-UA34B5QB.js +1 -0
  48. package/dist/chunk-UBHIBMTA.mjs +0 -0
  49. package/dist/chunk-VACQTZRT.js +1 -0
  50. package/dist/chunk-VQE67ZFF.js +1 -0
  51. package/dist/chunk-XNDIT72O.mjs +2 -0
  52. package/dist/chunk-YJORUMPB.js +2 -0
  53. package/dist/chunk-YLJDAK2S.mjs +1 -0
  54. package/dist/chunk-YQEWHOQ7.js +1 -0
  55. package/dist/chunk-ZCKUSOGC.mjs +1 -0
  56. package/dist/chunk-ZI3GTSDG.mjs +1 -0
  57. package/dist/components/embed/index.js +1 -16
  58. package/dist/components/embed/index.mjs +1 -16
  59. package/dist/components/embed/v3/CrossmintEmbeddedCheckoutV3.js +1 -14
  60. package/dist/components/embed/v3/CrossmintEmbeddedCheckoutV3.mjs +1 -14
  61. package/dist/components/embed/v3/EmbeddedCheckoutV3WebView.js +1 -13
  62. package/dist/components/embed/v3/EmbeddedCheckoutV3WebView.mjs +1 -13
  63. package/dist/components/embed/v3/crypto/PayerConnectionHandler.js +1 -8
  64. package/dist/components/embed/v3/crypto/PayerConnectionHandler.mjs +1 -8
  65. package/dist/components/embed/v3/index.js +1 -15
  66. package/dist/components/embed/v3/index.mjs +1 -15
  67. package/dist/components/index.js +1 -34
  68. package/dist/components/index.mjs +1 -34
  69. package/dist/components/signers/BaseCodeInput.js +1 -9
  70. package/dist/components/signers/BaseCodeInput.mjs +1 -9
  71. package/dist/components/signers/BaseConfirmation.js +1 -9
  72. package/dist/components/signers/BaseConfirmation.mjs +1 -9
  73. package/dist/components/signers/EmailSignersDialog.js +1 -11
  74. package/dist/components/signers/EmailSignersDialog.mjs +1 -11
  75. package/dist/components/signers/PhoneSignersDialog.js +1 -11
  76. package/dist/components/signers/PhoneSignersDialog.mjs +1 -11
  77. package/dist/components/signers/index.js +1 -16
  78. package/dist/components/signers/index.mjs +1 -16
  79. package/dist/components/wallets/ExportPrivateKeyButton.js +1 -8
  80. package/dist/components/wallets/ExportPrivateKeyButton.mjs +1 -8
  81. package/dist/components/wallets/index.js +1 -9
  82. package/dist/components/wallets/index.mjs +1 -9
  83. package/dist/hooks/index.js +1 -26
  84. package/dist/hooks/index.mjs +1 -26
  85. package/dist/hooks/useAuth.js +1 -14
  86. package/dist/hooks/useAuth.mjs +1 -14
  87. package/dist/hooks/useCrossmintCheckout.js +1 -11
  88. package/dist/hooks/useCrossmintCheckout.mjs +1 -11
  89. package/dist/hooks/useWalletEmailSigner.js +1 -8
  90. package/dist/hooks/useWalletEmailSigner.mjs +1 -8
  91. package/dist/index.js +1 -79
  92. package/dist/index.mjs +1 -79
  93. package/dist/logger/init.js +1 -9
  94. package/dist/logger/init.mjs +1 -9
  95. package/dist/plugin/mods/addQueryToAndroidManifest.js +1 -8
  96. package/dist/plugin/mods/addQueryToAndroidManifest.mjs +1 -8
  97. package/dist/plugin/withGooglePay.js +1 -57
  98. package/dist/plugin/withGooglePay.mjs +1 -57
  99. package/dist/providers/CrossmintAuthProvider.js +1 -14
  100. package/dist/providers/CrossmintAuthProvider.mjs +1 -14
  101. package/dist/providers/CrossmintProvider.js +1 -12
  102. package/dist/providers/CrossmintProvider.mjs +1 -12
  103. package/dist/providers/CrossmintWalletProvider.js +1 -16
  104. package/dist/providers/CrossmintWalletProvider.mjs +1 -16
  105. package/dist/providers/index.js +1 -28
  106. package/dist/providers/index.mjs +1 -28
  107. package/dist/styles/index.js +1 -8
  108. package/dist/styles/index.mjs +1 -8
  109. package/dist/styles/theme.js +1 -8
  110. package/dist/styles/theme.mjs +1 -8
  111. package/dist/types/auth.js +1 -1
  112. package/dist/types/auth.mjs +0 -1
  113. package/dist/utils/SecureStorage.js +1 -8
  114. package/dist/utils/SecureStorage.mjs +1 -8
  115. package/dist/utils/createCrossmintApiClient.js +1 -9
  116. package/dist/utils/createCrossmintApiClient.mjs +1 -9
  117. package/dist/utils/embed/userAgent.js +1 -12
  118. package/dist/utils/embed/userAgent.mjs +1 -12
  119. package/dist/utils/eventEmitter.js +1 -8
  120. package/dist/utils/eventEmitter.mjs +1 -8
  121. package/package.json +1 -1
  122. package/dist/chunk-24MMQ2R4.js +0 -15
  123. package/dist/chunk-24MMQ2R4.js.map +0 -1
  124. package/dist/chunk-2DNOAXOE.mjs +0 -8
  125. package/dist/chunk-2DNOAXOE.mjs.map +0 -1
  126. package/dist/chunk-2TEAOLM6.mjs +0 -149
  127. package/dist/chunk-2TEAOLM6.mjs.map +0 -1
  128. package/dist/chunk-34OVOZB2.mjs +0 -111
  129. package/dist/chunk-34OVOZB2.mjs.map +0 -1
  130. package/dist/chunk-3AWDWMZ2.mjs +0 -18
  131. package/dist/chunk-3AWDWMZ2.mjs.map +0 -1
  132. package/dist/chunk-3PJ6FXFT.mjs +0 -1
  133. package/dist/chunk-3PJ6FXFT.mjs.map +0 -1
  134. package/dist/chunk-3SFSPJXM.mjs +0 -55
  135. package/dist/chunk-3SFSPJXM.mjs.map +0 -1
  136. package/dist/chunk-4AJTICKY.mjs +0 -44
  137. package/dist/chunk-4AJTICKY.mjs.map +0 -1
  138. package/dist/chunk-4HKXTAVR.js +0 -14
  139. package/dist/chunk-4HKXTAVR.js.map +0 -1
  140. package/dist/chunk-4V7NDO5X.mjs +0 -157
  141. package/dist/chunk-4V7NDO5X.mjs.map +0 -1
  142. package/dist/chunk-4WJIXD7U.mjs +0 -14
  143. package/dist/chunk-4WJIXD7U.mjs.map +0 -1
  144. package/dist/chunk-5V6ONJWT.mjs +0 -61
  145. package/dist/chunk-5V6ONJWT.mjs.map +0 -1
  146. package/dist/chunk-5ZBDQUNG.js +0 -1
  147. package/dist/chunk-5ZBDQUNG.js.map +0 -1
  148. package/dist/chunk-6S5SEVGS.js +0 -17
  149. package/dist/chunk-6S5SEVGS.js.map +0 -1
  150. package/dist/chunk-6Z74KC25.mjs +0 -1
  151. package/dist/chunk-6Z74KC25.mjs.map +0 -1
  152. package/dist/chunk-7SPIOD4K.mjs +0 -66
  153. package/dist/chunk-7SPIOD4K.mjs.map +0 -1
  154. package/dist/chunk-ALMDA3KN.mjs +0 -199
  155. package/dist/chunk-ALMDA3KN.mjs.map +0 -1
  156. package/dist/chunk-BE4HT2U7.mjs +0 -1
  157. package/dist/chunk-BE4HT2U7.mjs.map +0 -1
  158. package/dist/chunk-BTH5QRIT.js +0 -149
  159. package/dist/chunk-BTH5QRIT.js.map +0 -1
  160. package/dist/chunk-BUB4U2GE.js +0 -44
  161. package/dist/chunk-BUB4U2GE.js.map +0 -1
  162. package/dist/chunk-BUTZZ7JB.js +0 -36
  163. package/dist/chunk-BUTZZ7JB.js.map +0 -1
  164. package/dist/chunk-CFHHVHNZ.mjs +0 -157
  165. package/dist/chunk-CFHHVHNZ.mjs.map +0 -1
  166. package/dist/chunk-CV6RWU2T.js +0 -50
  167. package/dist/chunk-CV6RWU2T.js.map +0 -1
  168. package/dist/chunk-DD2MVD6A.mjs +0 -36
  169. package/dist/chunk-DD2MVD6A.mjs.map +0 -1
  170. package/dist/chunk-EKXEDMRD.mjs +0 -71
  171. package/dist/chunk-EKXEDMRD.mjs.map +0 -1
  172. package/dist/chunk-FCDPEDXH.mjs +0 -148
  173. package/dist/chunk-FCDPEDXH.mjs.map +0 -1
  174. package/dist/chunk-FQID5LOL.js +0 -22
  175. package/dist/chunk-FQID5LOL.js.map +0 -1
  176. package/dist/chunk-FRD6HEIM.mjs +0 -22
  177. package/dist/chunk-FRD6HEIM.mjs.map +0 -1
  178. package/dist/chunk-GYBEEYGB.mjs +0 -1
  179. package/dist/chunk-GYBEEYGB.mjs.map +0 -1
  180. package/dist/chunk-HELXBZ7D.js +0 -18
  181. package/dist/chunk-HELXBZ7D.js.map +0 -1
  182. package/dist/chunk-IBQK5B7B.js +0 -71
  183. package/dist/chunk-IBQK5B7B.js.map +0 -1
  184. package/dist/chunk-IHZNXV5S.js +0 -1
  185. package/dist/chunk-IHZNXV5S.js.map +0 -1
  186. package/dist/chunk-IMME6ZBV.js +0 -61
  187. package/dist/chunk-IMME6ZBV.js.map +0 -1
  188. package/dist/chunk-J2MDWDV6.mjs +0 -1
  189. package/dist/chunk-J2MDWDV6.mjs.map +0 -1
  190. package/dist/chunk-KK4SQ7WF.js +0 -1
  191. package/dist/chunk-KK4SQ7WF.js.map +0 -1
  192. package/dist/chunk-KOUCOMBE.js +0 -148
  193. package/dist/chunk-KOUCOMBE.js.map +0 -1
  194. package/dist/chunk-MMVER6VO.js +0 -1
  195. package/dist/chunk-MMVER6VO.js.map +0 -1
  196. package/dist/chunk-MVLQR6RI.js +0 -199
  197. package/dist/chunk-MVLQR6RI.js.map +0 -1
  198. package/dist/chunk-NBWATZY4.js +0 -157
  199. package/dist/chunk-NBWATZY4.js.map +0 -1
  200. package/dist/chunk-OTRMAWWU.js +0 -55
  201. package/dist/chunk-OTRMAWWU.js.map +0 -1
  202. package/dist/chunk-P35PHJU5.mjs +0 -17
  203. package/dist/chunk-P35PHJU5.mjs.map +0 -1
  204. package/dist/chunk-PUTC7LI4.mjs +0 -348
  205. package/dist/chunk-PUTC7LI4.mjs.map +0 -1
  206. package/dist/chunk-Q2Y5CZT4.js +0 -157
  207. package/dist/chunk-Q2Y5CZT4.js.map +0 -1
  208. package/dist/chunk-Q7YPX4RJ.js +0 -66
  209. package/dist/chunk-Q7YPX4RJ.js.map +0 -1
  210. package/dist/chunk-R47XMJ32.js +0 -1
  211. package/dist/chunk-R47XMJ32.js.map +0 -1
  212. package/dist/chunk-RSCBYS6I.mjs +0 -15
  213. package/dist/chunk-RSCBYS6I.mjs.map +0 -1
  214. package/dist/chunk-RTLOANMR.mjs +0 -50
  215. package/dist/chunk-RTLOANMR.mjs.map +0 -1
  216. package/dist/chunk-S3OC5AT3.mjs +0 -24
  217. package/dist/chunk-S3OC5AT3.mjs.map +0 -1
  218. package/dist/chunk-SHSENRY7.js +0 -24
  219. package/dist/chunk-SHSENRY7.js.map +0 -1
  220. package/dist/chunk-TNPZITVL.mjs +0 -1
  221. package/dist/chunk-TNPZITVL.mjs.map +0 -1
  222. package/dist/chunk-UNIFCVYR.js +0 -348
  223. package/dist/chunk-UNIFCVYR.js.map +0 -1
  224. package/dist/chunk-VCF2YXCO.js +0 -208
  225. package/dist/chunk-VCF2YXCO.js.map +0 -1
  226. package/dist/chunk-XNVZRSGL.js +0 -111
  227. package/dist/chunk-XNVZRSGL.js.map +0 -1
  228. package/dist/chunk-XUGJXLWC.js +0 -8
  229. package/dist/chunk-XUGJXLWC.js.map +0 -1
  230. package/dist/chunk-XXJ7LQ44.js +0 -1
  231. package/dist/chunk-XXJ7LQ44.js.map +0 -1
  232. package/dist/chunk-Z7Y7COJM.mjs +0 -208
  233. package/dist/chunk-Z7Y7COJM.mjs.map +0 -1
  234. package/dist/components/embed/index.js.map +0 -1
  235. package/dist/components/embed/index.mjs.map +0 -1
  236. package/dist/components/embed/v3/CrossmintEmbeddedCheckoutV3.js.map +0 -1
  237. package/dist/components/embed/v3/CrossmintEmbeddedCheckoutV3.mjs.map +0 -1
  238. package/dist/components/embed/v3/EmbeddedCheckoutV3WebView.js.map +0 -1
  239. package/dist/components/embed/v3/EmbeddedCheckoutV3WebView.mjs.map +0 -1
  240. package/dist/components/embed/v3/crypto/PayerConnectionHandler.js.map +0 -1
  241. package/dist/components/embed/v3/crypto/PayerConnectionHandler.mjs.map +0 -1
  242. package/dist/components/embed/v3/index.js.map +0 -1
  243. package/dist/components/embed/v3/index.mjs.map +0 -1
  244. package/dist/components/index.js.map +0 -1
  245. package/dist/components/index.mjs.map +0 -1
  246. package/dist/components/signers/BaseCodeInput.js.map +0 -1
  247. package/dist/components/signers/BaseCodeInput.mjs.map +0 -1
  248. package/dist/components/signers/BaseConfirmation.js.map +0 -1
  249. package/dist/components/signers/BaseConfirmation.mjs.map +0 -1
  250. package/dist/components/signers/EmailSignersDialog.js.map +0 -1
  251. package/dist/components/signers/EmailSignersDialog.mjs.map +0 -1
  252. package/dist/components/signers/PhoneSignersDialog.js.map +0 -1
  253. package/dist/components/signers/PhoneSignersDialog.mjs.map +0 -1
  254. package/dist/components/signers/index.js.map +0 -1
  255. package/dist/components/signers/index.mjs.map +0 -1
  256. package/dist/components/wallets/ExportPrivateKeyButton.js.map +0 -1
  257. package/dist/components/wallets/ExportPrivateKeyButton.mjs.map +0 -1
  258. package/dist/components/wallets/index.js.map +0 -1
  259. package/dist/components/wallets/index.mjs.map +0 -1
  260. package/dist/hooks/index.js.map +0 -1
  261. package/dist/hooks/index.mjs.map +0 -1
  262. package/dist/hooks/useAuth.js.map +0 -1
  263. package/dist/hooks/useAuth.mjs.map +0 -1
  264. package/dist/hooks/useCrossmintCheckout.js.map +0 -1
  265. package/dist/hooks/useCrossmintCheckout.mjs.map +0 -1
  266. package/dist/hooks/useWalletEmailSigner.js.map +0 -1
  267. package/dist/hooks/useWalletEmailSigner.mjs.map +0 -1
  268. package/dist/index.js.map +0 -1
  269. package/dist/index.mjs.map +0 -1
  270. package/dist/logger/init.js.map +0 -1
  271. package/dist/logger/init.mjs.map +0 -1
  272. package/dist/plugin/mods/addQueryToAndroidManifest.js.map +0 -1
  273. package/dist/plugin/mods/addQueryToAndroidManifest.mjs.map +0 -1
  274. package/dist/plugin/withGooglePay.js.map +0 -1
  275. package/dist/plugin/withGooglePay.mjs.map +0 -1
  276. package/dist/providers/CrossmintAuthProvider.js.map +0 -1
  277. package/dist/providers/CrossmintAuthProvider.mjs.map +0 -1
  278. package/dist/providers/CrossmintProvider.js.map +0 -1
  279. package/dist/providers/CrossmintProvider.mjs.map +0 -1
  280. package/dist/providers/CrossmintWalletProvider.js.map +0 -1
  281. package/dist/providers/CrossmintWalletProvider.mjs.map +0 -1
  282. package/dist/providers/index.js.map +0 -1
  283. package/dist/providers/index.mjs.map +0 -1
  284. package/dist/styles/index.js.map +0 -1
  285. package/dist/styles/index.mjs.map +0 -1
  286. package/dist/styles/theme.js.map +0 -1
  287. package/dist/styles/theme.mjs.map +0 -1
  288. package/dist/types/auth.js.map +0 -1
  289. package/dist/types/auth.mjs.map +0 -1
  290. package/dist/utils/SecureStorage.js.map +0 -1
  291. package/dist/utils/SecureStorage.mjs.map +0 -1
  292. package/dist/utils/createCrossmintApiClient.js.map +0 -1
  293. package/dist/utils/createCrossmintApiClient.mjs.map +0 -1
  294. package/dist/utils/embed/userAgent.js.map +0 -1
  295. package/dist/utils/embed/userAgent.mjs.map +0 -1
  296. package/dist/utils/eventEmitter.js.map +0 -1
  297. package/dist/utils/eventEmitter.mjs.map +0 -1
@@ -1,66 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __defProps = Object.defineProperties;
3
- var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
4
- var __getOwnPropSymbols = Object.getOwnPropertySymbols;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __propIsEnum = Object.prototype.propertyIsEnumerable;
7
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8
- var __spreadValues = (a, b) => {
9
- for (var prop in b || (b = {}))
10
- if (__hasOwnProp.call(b, prop))
11
- __defNormalProp(a, prop, b[prop]);
12
- if (__getOwnPropSymbols)
13
- for (var prop of __getOwnPropSymbols(b)) {
14
- if (__propIsEnum.call(b, prop))
15
- __defNormalProp(a, prop, b[prop]);
16
- }
17
- return a;
18
- };
19
- var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
20
- var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
21
- get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
22
- }) : x)(function(x) {
23
- if (typeof require !== "undefined") return require.apply(this, arguments);
24
- throw Error('Dynamic require of "' + x + '" is not supported');
25
- });
26
- var __objRest = (source, exclude) => {
27
- var target = {};
28
- for (var prop in source)
29
- if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
30
- target[prop] = source[prop];
31
- if (source != null && __getOwnPropSymbols)
32
- for (var prop of __getOwnPropSymbols(source)) {
33
- if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
34
- target[prop] = source[prop];
35
- }
36
- return target;
37
- };
38
- var __async = (__this, __arguments, generator) => {
39
- return new Promise((resolve, reject) => {
40
- var fulfilled = (value) => {
41
- try {
42
- step(generator.next(value));
43
- } catch (e) {
44
- reject(e);
45
- }
46
- };
47
- var rejected = (value) => {
48
- try {
49
- step(generator.throw(value));
50
- } catch (e) {
51
- reject(e);
52
- }
53
- };
54
- var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
55
- step((generator = generator.apply(__this, __arguments)).next());
56
- });
57
- };
58
-
59
- export {
60
- __spreadValues,
61
- __spreadProps,
62
- __require,
63
- __objRest,
64
- __async
65
- };
66
- //# sourceMappingURL=chunk-7SPIOD4K.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -1,199 +0,0 @@
1
- import {
2
- theme
3
- } from "./chunk-3AWDWMZ2.mjs";
4
- import {
5
- __async
6
- } from "./chunk-7SPIOD4K.mjs";
7
-
8
- // src/components/signers/BaseCodeInput.tsx
9
- import { useState } from "react";
10
- import { View, Text, TextInput, TouchableOpacity, StyleSheet, ActivityIndicator } from "react-native";
11
- import { jsx, jsxs } from "react/jsx-runtime";
12
- function BaseCodeInput({
13
- icon,
14
- title,
15
- description,
16
- helpText,
17
- onSubmitOTP,
18
- onResendCode,
19
- appearance,
20
- otpLength = 9,
21
- keyboardType = "default",
22
- autoComplete = "one-time-code",
23
- textContentType = "oneTimeCode"
24
- }) {
25
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m;
26
- const [otpCode, setOtpCode] = useState("");
27
- const [isLoading, setIsLoading] = useState(false);
28
- const [error, setError] = useState(null);
29
- const [resendCooldown, setResendCooldown] = useState(0);
30
- const handleSubmitOTP = () => __async(this, null, function* () {
31
- if (otpCode.length === 0) {
32
- return;
33
- }
34
- setIsLoading(true);
35
- setError(null);
36
- try {
37
- yield onSubmitOTP(otpCode);
38
- setOtpCode("");
39
- } catch (error2) {
40
- console.error("Failed to verify OTP", error2);
41
- setError("Invalid code. Please try again.");
42
- } finally {
43
- setIsLoading(false);
44
- }
45
- });
46
- const handleResendCode = () => __async(this, null, function* () {
47
- if (resendCooldown > 0 || !onResendCode) {
48
- return;
49
- }
50
- setIsLoading(true);
51
- setError(null);
52
- try {
53
- yield onResendCode();
54
- setResendCooldown(60);
55
- const timer = setInterval(() => {
56
- setResendCooldown((prev) => {
57
- if (prev <= 1) {
58
- clearInterval(timer);
59
- return 0;
60
- }
61
- return prev - 1;
62
- });
63
- }, 1e3);
64
- } catch (error2) {
65
- console.error("Failed to resend OTP", error2);
66
- setError("Failed to resend code. Please try again.");
67
- } finally {
68
- setIsLoading(false);
69
- }
70
- });
71
- const dynamicStyles = StyleSheet.create({
72
- container: {
73
- width: "100%"
74
- },
75
- iconContainer: {
76
- alignItems: "center",
77
- marginBottom: 8
78
- },
79
- title: {
80
- fontSize: 18,
81
- fontWeight: "600",
82
- color: ((_a = appearance == null ? void 0 : appearance.colors) == null ? void 0 : _a.textPrimary) || theme["cm-text-primary"],
83
- textAlign: "center",
84
- marginBottom: 8,
85
- marginTop: 16
86
- },
87
- description: {
88
- fontSize: 14,
89
- color: ((_b = appearance == null ? void 0 : appearance.colors) == null ? void 0 : _b.textSecondary) || theme["cm-text-secondary"],
90
- textAlign: "center",
91
- marginBottom: 24,
92
- lineHeight: 20
93
- },
94
- otpInput: {
95
- borderWidth: 1,
96
- borderColor: error ? ((_c = appearance == null ? void 0 : appearance.colors) == null ? void 0 : _c.danger) || theme["cm-danger"] : ((_d = appearance == null ? void 0 : appearance.colors) == null ? void 0 : _d.border) || theme["cm-border"],
97
- borderRadius: (appearance == null ? void 0 : appearance.borderRadius) || 12,
98
- backgroundColor: ((_e = appearance == null ? void 0 : appearance.colors) == null ? void 0 : _e.inputBackground) || theme["cm-muted-primary"],
99
- padding: 16,
100
- fontSize: 16,
101
- color: ((_f = appearance == null ? void 0 : appearance.colors) == null ? void 0 : _f.textPrimary) || theme["cm-text-primary"],
102
- marginBottom: 16,
103
- textAlign: "center"
104
- },
105
- errorText: {
106
- fontSize: 14,
107
- color: ((_g = appearance == null ? void 0 : appearance.colors) == null ? void 0 : _g.danger) || theme["cm-danger"],
108
- textAlign: "center",
109
- marginBottom: 16
110
- },
111
- helpText: {
112
- fontSize: 12,
113
- color: ((_h = appearance == null ? void 0 : appearance.colors) == null ? void 0 : _h.textSecondary) || theme["cm-text-secondary"],
114
- textAlign: "center",
115
- marginBottom: 16,
116
- lineHeight: 16
117
- },
118
- submitButton: {
119
- backgroundColor: ((_i = appearance == null ? void 0 : appearance.colors) == null ? void 0 : _i.accent) || theme["cm-accent"],
120
- paddingVertical: 16,
121
- paddingHorizontal: 32,
122
- borderRadius: (appearance == null ? void 0 : appearance.borderRadius) || 12,
123
- alignItems: "center",
124
- marginBottom: 16
125
- },
126
- submitButtonDisabled: {
127
- opacity: 0.6
128
- },
129
- submitButtonText: {
130
- fontSize: 16,
131
- fontWeight: "500",
132
- color: ((_j = appearance == null ? void 0 : appearance.colors) == null ? void 0 : _j.background) || theme["cm-background-primary"]
133
- },
134
- resendButton: {
135
- alignSelf: "center",
136
- paddingVertical: 12,
137
- paddingHorizontal: 16
138
- },
139
- resendButtonText: {
140
- fontSize: 14,
141
- color: ((_k = appearance == null ? void 0 : appearance.colors) == null ? void 0 : _k.accent) || theme["cm-accent"],
142
- textAlign: "center"
143
- },
144
- resendButtonDisabled: {
145
- opacity: 0.6
146
- }
147
- });
148
- return /* @__PURE__ */ jsxs(View, { style: dynamicStyles.container, children: [
149
- /* @__PURE__ */ jsx(View, { style: dynamicStyles.iconContainer, children: icon }),
150
- /* @__PURE__ */ jsx(Text, { style: dynamicStyles.title, children: title }),
151
- /* @__PURE__ */ jsx(Text, { style: dynamicStyles.description, children: description }),
152
- /* @__PURE__ */ jsx(
153
- TextInput,
154
- {
155
- style: dynamicStyles.otpInput,
156
- placeholder: "Enter code",
157
- placeholderTextColor: ((_l = appearance == null ? void 0 : appearance.colors) == null ? void 0 : _l.textSecondary) || theme["cm-text-secondary"],
158
- value: otpCode,
159
- onChangeText: (text) => {
160
- setOtpCode(text);
161
- setError(null);
162
- },
163
- keyboardType,
164
- autoComplete,
165
- textContentType,
166
- editable: !isLoading,
167
- maxLength: otpLength
168
- }
169
- ),
170
- error && /* @__PURE__ */ jsx(Text, { style: dynamicStyles.errorText, children: error }),
171
- /* @__PURE__ */ jsx(Text, { style: dynamicStyles.helpText, children: helpText }),
172
- /* @__PURE__ */ jsx(
173
- TouchableOpacity,
174
- {
175
- style: [
176
- dynamicStyles.submitButton,
177
- (otpCode.length === 0 || isLoading) && dynamicStyles.submitButtonDisabled
178
- ],
179
- onPress: handleSubmitOTP,
180
- disabled: otpCode.length === 0 || isLoading,
181
- children: isLoading ? /* @__PURE__ */ jsx(ActivityIndicator, { color: ((_m = appearance == null ? void 0 : appearance.colors) == null ? void 0 : _m.background) || theme["cm-background-primary"] }) : /* @__PURE__ */ jsx(Text, { style: dynamicStyles.submitButtonText, children: "Submit" })
182
- }
183
- ),
184
- onResendCode && /* @__PURE__ */ jsx(
185
- TouchableOpacity,
186
- {
187
- style: [dynamicStyles.resendButton, resendCooldown > 0 && dynamicStyles.resendButtonDisabled],
188
- onPress: handleResendCode,
189
- disabled: resendCooldown > 0 || isLoading,
190
- children: /* @__PURE__ */ jsx(Text, { style: dynamicStyles.resendButtonText, children: resendCooldown > 0 ? `Re-send code in ${resendCooldown}s` : "Re-send code" })
191
- }
192
- )
193
- ] });
194
- }
195
-
196
- export {
197
- BaseCodeInput
198
- };
199
- //# sourceMappingURL=chunk-ALMDA3KN.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/components/signers/BaseCodeInput.tsx"],"sourcesContent":["import { useState, type ReactNode } from \"react\";\nimport { View, Text, TextInput, TouchableOpacity, StyleSheet, ActivityIndicator } from \"react-native\";\nimport type { UIConfig } from \"@crossmint/common-sdk-base\";\nimport { theme } from \"../../styles/theme\";\n\ninterface BaseCodeInputProps {\n contactInfo: string;\n contactType: \"email\" | \"phone\";\n icon: ReactNode;\n title: string;\n description: string | ReactNode;\n helpText: string;\n onSubmitOTP: (token: string) => Promise<void>;\n onResendCode?: () => Promise<void>;\n appearance?: UIConfig;\n otpLength?: number;\n keyboardType?: \"default\" | \"number-pad\";\n autoComplete?: \"one-time-code\" | \"sms-otp\";\n textContentType?: \"oneTimeCode\";\n}\n\nexport function BaseCodeInput({\n icon,\n title,\n description,\n helpText,\n onSubmitOTP,\n onResendCode,\n appearance,\n otpLength = 9,\n keyboardType = \"default\",\n autoComplete = \"one-time-code\",\n textContentType = \"oneTimeCode\",\n}: BaseCodeInputProps) {\n const [otpCode, setOtpCode] = useState(\"\");\n const [isLoading, setIsLoading] = useState(false);\n const [error, setError] = useState<string | null>(null);\n const [resendCooldown, setResendCooldown] = useState(0);\n\n const handleSubmitOTP = async () => {\n if (otpCode.length === 0) {\n return;\n }\n\n setIsLoading(true);\n setError(null);\n try {\n await onSubmitOTP(otpCode);\n setOtpCode(\"\");\n } catch (error) {\n console.error(\"Failed to verify OTP\", error);\n setError(\"Invalid code. Please try again.\");\n } finally {\n setIsLoading(false);\n }\n };\n\n const handleResendCode = async () => {\n if (resendCooldown > 0 || !onResendCode) {\n return;\n }\n\n setIsLoading(true);\n setError(null);\n try {\n await onResendCode();\n setResendCooldown(60);\n const timer = setInterval(() => {\n setResendCooldown((prev) => {\n if (prev <= 1) {\n clearInterval(timer);\n return 0;\n }\n return prev - 1;\n });\n }, 1000);\n } catch (error) {\n console.error(\"Failed to resend OTP\", error);\n setError(\"Failed to resend code. Please try again.\");\n } finally {\n setIsLoading(false);\n }\n };\n\n const dynamicStyles = StyleSheet.create({\n container: {\n width: \"100%\",\n },\n iconContainer: {\n alignItems: \"center\",\n marginBottom: 8,\n },\n title: {\n fontSize: 18,\n fontWeight: \"600\",\n color: appearance?.colors?.textPrimary || theme[\"cm-text-primary\"],\n textAlign: \"center\",\n marginBottom: 8,\n marginTop: 16,\n },\n description: {\n fontSize: 14,\n color: appearance?.colors?.textSecondary || theme[\"cm-text-secondary\"],\n textAlign: \"center\",\n marginBottom: 24,\n lineHeight: 20,\n },\n otpInput: {\n borderWidth: 1,\n borderColor: error\n ? appearance?.colors?.danger || theme[\"cm-danger\"]\n : appearance?.colors?.border || theme[\"cm-border\"],\n borderRadius: appearance?.borderRadius || 12,\n backgroundColor: appearance?.colors?.inputBackground || theme[\"cm-muted-primary\"],\n padding: 16,\n fontSize: 16,\n color: appearance?.colors?.textPrimary || theme[\"cm-text-primary\"],\n marginBottom: 16,\n textAlign: \"center\",\n },\n errorText: {\n fontSize: 14,\n color: appearance?.colors?.danger || theme[\"cm-danger\"],\n textAlign: \"center\",\n marginBottom: 16,\n },\n helpText: {\n fontSize: 12,\n color: appearance?.colors?.textSecondary || theme[\"cm-text-secondary\"],\n textAlign: \"center\",\n marginBottom: 16,\n lineHeight: 16,\n },\n submitButton: {\n backgroundColor: appearance?.colors?.accent || theme[\"cm-accent\"],\n paddingVertical: 16,\n paddingHorizontal: 32,\n borderRadius: appearance?.borderRadius || 12,\n alignItems: \"center\",\n marginBottom: 16,\n },\n submitButtonDisabled: {\n opacity: 0.6,\n },\n submitButtonText: {\n fontSize: 16,\n fontWeight: \"500\",\n color: appearance?.colors?.background || theme[\"cm-background-primary\"],\n },\n resendButton: {\n alignSelf: \"center\",\n paddingVertical: 12,\n paddingHorizontal: 16,\n },\n resendButtonText: {\n fontSize: 14,\n color: appearance?.colors?.accent || theme[\"cm-accent\"],\n textAlign: \"center\",\n },\n resendButtonDisabled: {\n opacity: 0.6,\n },\n });\n\n return (\n <View style={dynamicStyles.container}>\n <View style={dynamicStyles.iconContainer}>{icon}</View>\n\n <Text style={dynamicStyles.title}>{title}</Text>\n <Text style={dynamicStyles.description}>{description}</Text>\n\n <TextInput\n style={dynamicStyles.otpInput}\n placeholder=\"Enter code\"\n placeholderTextColor={appearance?.colors?.textSecondary || theme[\"cm-text-secondary\"]}\n value={otpCode}\n onChangeText={(text) => {\n setOtpCode(text);\n setError(null);\n }}\n keyboardType={keyboardType}\n autoComplete={autoComplete}\n textContentType={textContentType}\n editable={!isLoading}\n maxLength={otpLength}\n />\n\n {error && <Text style={dynamicStyles.errorText}>{error}</Text>}\n\n <Text style={dynamicStyles.helpText}>{helpText}</Text>\n\n <TouchableOpacity\n style={[\n dynamicStyles.submitButton,\n (otpCode.length === 0 || isLoading) && dynamicStyles.submitButtonDisabled,\n ]}\n onPress={handleSubmitOTP}\n disabled={otpCode.length === 0 || isLoading}\n >\n {isLoading ? (\n <ActivityIndicator color={appearance?.colors?.background || theme[\"cm-background-primary\"]} />\n ) : (\n <Text style={dynamicStyles.submitButtonText}>Submit</Text>\n )}\n </TouchableOpacity>\n\n {onResendCode && (\n <TouchableOpacity\n style={[dynamicStyles.resendButton, resendCooldown > 0 && dynamicStyles.resendButtonDisabled]}\n onPress={handleResendCode}\n disabled={resendCooldown > 0 || isLoading}\n >\n <Text style={dynamicStyles.resendButtonText}>\n {resendCooldown > 0 ? `Re-send code in ${resendCooldown}s` : \"Re-send code\"}\n </Text>\n </TouchableOpacity>\n )}\n </View>\n );\n}\n"],"mappings":";;;;;;;;A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AAO,cAAc,UAAW,oBAAS;AAAA,IAE/C;AAAA,MAAC;AAAA;AAAA,QACG,OAAO;AAAA,UACH,cAAc;AAAA,WACb,QAAQ,WAAW,KAAK,cAAc,cAAc;AAAA,QACzD;AAAA,QACA,SAAS;AAAA,QACT,UAAU,QAAQ,WAAW,KAAK;AAAA,QAEjC,sBACG,oBAAC,qBAAkB,SAAO,8CAAY,WAAZ,mBAAoB,eAAc,MAAM,uBAAuB,GAAG,IAE5F,oBAAC,QAAK,OAAO,cAAc,kBAAkB,oBAAM;AAAA;AAAA,IAE3D;AAAA,IAEC,gBACG;AAAA,MAAC;AAAA;AAAA,QACG,OAAO,CAAC,cAAc,cAAc,iBAAiB,KAAK,cAAc,oBAAoB;AAAA,QAC5F,SAAS;AAAA,QACT,UAAU,iBAAiB,KAAK;AAAA,QAEhC,8BAAC,QAAK,OAAO,cAAc,kBACtB,2BAAiB,IAAI,mBAAmB,cAAc,MAAM,gBACjE;AAAA;AAAA,IACJ;AAAA,KAER;AAER;","names":["error"]}
@@ -1 +0,0 @@
1
- //# sourceMappingURL=chunk-BE4HT2U7.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -1,149 +0,0 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
-
3
- var _chunkHELXBZ7Djs = require('./chunk-HELXBZ7D.js');
4
-
5
-
6
- var _chunkQ7YPX4RJjs = require('./chunk-Q7YPX4RJ.js');
7
-
8
- // src/components/signers/BaseConfirmation.tsx
9
- var _react = require('react');
10
- var _reactnative = require('react-native');
11
- var _jsxruntime = require('react/jsx-runtime');
12
- function BaseConfirmation({
13
- contactInfo,
14
- contactType,
15
- icon,
16
- onConfirm,
17
- onCancel,
18
- appearance
19
- }) {
20
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
21
- const [isLoading, setIsLoading] = _react.useState.call(void 0, false);
22
- const [error, setError] = _react.useState.call(void 0, null);
23
- const handleConfirm = () => _chunkQ7YPX4RJjs.__async.call(void 0, this, null, function* () {
24
- setIsLoading(true);
25
- setError(null);
26
- try {
27
- yield onConfirm();
28
- } catch (error2) {
29
- console.error(`Failed to send ${contactType} code`, error2);
30
- setError(`Failed to send ${contactType === "email" ? "email" : "SMS"}. Please try again.`);
31
- } finally {
32
- setIsLoading(false);
33
- }
34
- });
35
- const dynamicStyles = _reactnative.StyleSheet.create({
36
- container: {
37
- width: "100%"
38
- },
39
- title: {
40
- fontSize: 24,
41
- fontWeight: "600",
42
- color: ((_a = appearance == null ? void 0 : appearance.colors) == null ? void 0 : _a.textPrimary) || _chunkHELXBZ7Djs.theme["cm-text-primary"],
43
- textAlign: "center",
44
- marginBottom: 8
45
- },
46
- description: {
47
- fontSize: 16,
48
- color: ((_b = appearance == null ? void 0 : appearance.colors) == null ? void 0 : _b.textSecondary) || _chunkHELXBZ7Djs.theme["cm-text-secondary"],
49
- textAlign: "center",
50
- marginBottom: 24,
51
- lineHeight: 22
52
- },
53
- contactContainer: {
54
- borderWidth: 1,
55
- borderColor: ((_c = appearance == null ? void 0 : appearance.colors) == null ? void 0 : _c.border) || _chunkHELXBZ7Djs.theme["cm-border"],
56
- borderRadius: (appearance == null ? void 0 : appearance.borderRadius) || 12,
57
- padding: 16,
58
- marginBottom: 24,
59
- flexDirection: "row",
60
- alignItems: "center"
61
- },
62
- contactText: {
63
- fontSize: 16,
64
- color: ((_d = appearance == null ? void 0 : appearance.colors) == null ? void 0 : _d.textPrimary) || _chunkHELXBZ7Djs.theme["cm-text-primary"],
65
- marginLeft: 12,
66
- flex: 1
67
- },
68
- errorText: {
69
- fontSize: 14,
70
- color: ((_e = appearance == null ? void 0 : appearance.colors) == null ? void 0 : _e.danger) || _chunkHELXBZ7Djs.theme["cm-danger"],
71
- textAlign: "center",
72
- marginBottom: 16
73
- },
74
- buttonContainer: {
75
- flexDirection: "row",
76
- gap: 12
77
- },
78
- button: {
79
- flex: 1,
80
- paddingVertical: 16,
81
- paddingHorizontal: 24,
82
- borderRadius: 999,
83
- alignItems: "center",
84
- justifyContent: "center",
85
- minHeight: 52
86
- },
87
- primaryButton: {
88
- backgroundColor: ((_f = appearance == null ? void 0 : appearance.colors) == null ? void 0 : _f.accent) || _chunkHELXBZ7Djs.theme["cm-accent"]
89
- },
90
- secondaryButton: {
91
- backgroundColor: "transparent",
92
- borderWidth: 1,
93
- borderColor: ((_g = appearance == null ? void 0 : appearance.colors) == null ? void 0 : _g.border) || _chunkHELXBZ7Djs.theme["cm-border"]
94
- },
95
- disabledButton: {
96
- opacity: 0.6
97
- },
98
- buttonText: {
99
- fontSize: 16,
100
- fontWeight: "500",
101
- color: ((_h = appearance == null ? void 0 : appearance.colors) == null ? void 0 : _h.background) || _chunkHELXBZ7Djs.theme["cm-background-primary"]
102
- },
103
- secondaryButtonText: {
104
- color: ((_i = appearance == null ? void 0 : appearance.colors) == null ? void 0 : _i.textPrimary) || _chunkHELXBZ7Djs.theme["cm-text-primary"]
105
- }
106
- });
107
- return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _reactnative.View, { style: dynamicStyles.container, children: [
108
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _reactnative.Text, { style: dynamicStyles.title, children: "Confirm it's you" }),
109
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _reactnative.Text, { style: dynamicStyles.description, children: [
110
- "You're using this wallet for the first time on this device. Click 'Send code' to get a one-time verification code",
111
- contactType === "phone" ? " via SMS" : "",
112
- "."
113
- ] }),
114
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _reactnative.View, { style: dynamicStyles.contactContainer, children: [
115
- icon,
116
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _reactnative.Text, { style: dynamicStyles.contactText, children: contactInfo })
117
- ] }),
118
- error && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _reactnative.Text, { style: dynamicStyles.errorText, children: error }),
119
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _reactnative.View, { style: dynamicStyles.buttonContainer, children: [
120
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
121
- _reactnative.TouchableOpacity,
122
- {
123
- style: [dynamicStyles.button, dynamicStyles.secondaryButton],
124
- onPress: onCancel,
125
- disabled: isLoading,
126
- children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _reactnative.Text, { style: [dynamicStyles.buttonText, dynamicStyles.secondaryButtonText], children: "Cancel" })
127
- }
128
- ),
129
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
130
- _reactnative.TouchableOpacity,
131
- {
132
- style: [
133
- dynamicStyles.button,
134
- dynamicStyles.primaryButton,
135
- isLoading && dynamicStyles.disabledButton
136
- ],
137
- onPress: handleConfirm,
138
- disabled: isLoading,
139
- children: isLoading ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _reactnative.ActivityIndicator, { color: ((_j = appearance == null ? void 0 : appearance.colors) == null ? void 0 : _j.background) || _chunkHELXBZ7Djs.theme["cm-background-primary"] }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _reactnative.Text, { style: dynamicStyles.buttonText, children: "Send code" })
140
- }
141
- )
142
- ] })
143
- ] });
144
- }
145
-
146
-
147
-
148
- exports.BaseConfirmation = BaseConfirmation;
149
- //# sourceMappingURL=chunk-BTH5QRIT.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/components/signers/BaseConfirmation.tsx"],"names":["error"],"mappings":";;;;;;;;AAAA,SAAS,gBAAgC;AACzC,SAAS,MAAM,MAAM,kBAAkB,YAAY,yBAAyB;AAgHhE,cACA,YADA;AAnGL,SAAS,iBAAiB;AAAA,EAC7B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACJ,GAA0B;AArB1B;AAsBI,QAAM,CAAC,WAAW,YAAY,IAAI,SAAS,KAAK;AAChD,QAAM,CAAC,OAAO,QAAQ,IAAI,SAAwB,IAAI;AAEtD,QAAM,gBAAgB,MAAY;AAC9B,iBAAa,IAAI;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EA;AAAA,QAAC;AAAA;AAAA,UACG,OAAO;AAAA,YACH,cAAc;AAAA,YACd,cAAc;AAAA,YACd,aAAa,cAAc;AAAA,UAC/B;AAAA,UACA,SAAS;AAAA,UACT,UAAU;AAAA,UAET,sBACG,oBAAC,qBAAkB,SAAO,8CAAY,WAAZ,mBAAoB,eAAc,MAAM,uBAAuB,GAAG,IAE5F,oBAAC,QAAK,OAAO,cAAc,YAAY,uBAAS;AAAA;AAAA,MAExD;AAAA,OACJ;AAAA,KACJ;AAER","sourcesContent":["import { useState, type ReactNode } from \"react\";\nimport { View, Text, TouchableOpacity, StyleSheet, ActivityIndicator } from \"react-native\";\nimport type { UIConfig } from \"@crossmint/common-sdk-base\";\nimport { theme } from \"../../styles/theme\";\n\ninterface BaseConfirmationProps {\n contactInfo: string;\n contactType: \"email\" | \"phone\";\n icon: ReactNode;\n onConfirm: () => Promise<void>;\n onCancel?: () => void;\n appearance?: UIConfig;\n}\n\nexport function BaseConfirmation({\n contactInfo,\n contactType,\n icon,\n onConfirm,\n onCancel,\n appearance,\n}: BaseConfirmationProps) {\n const [isLoading, setIsLoading] = useState(false);\n const [error, setError] = useState<string | null>(null);\n\n const handleConfirm = async () => {\n setIsLoading(true);\n setError(null);\n try {\n await onConfirm();\n } catch (error) {\n console.error(`Failed to send ${contactType} code`, error);\n setError(`Failed to send ${contactType === \"email\" ? \"email\" : \"SMS\"}. Please try again.`);\n } finally {\n setIsLoading(false);\n }\n };\n\n const dynamicStyles = StyleSheet.create({\n container: {\n width: \"100%\",\n },\n title: {\n fontSize: 24,\n fontWeight: \"600\",\n color: appearance?.colors?.textPrimary || theme[\"cm-text-primary\"],\n textAlign: \"center\",\n marginBottom: 8,\n },\n description: {\n fontSize: 16,\n color: appearance?.colors?.textSecondary || theme[\"cm-text-secondary\"],\n textAlign: \"center\",\n marginBottom: 24,\n lineHeight: 22,\n },\n contactContainer: {\n borderWidth: 1,\n borderColor: appearance?.colors?.border || theme[\"cm-border\"],\n borderRadius: appearance?.borderRadius || 12,\n padding: 16,\n marginBottom: 24,\n flexDirection: \"row\",\n alignItems: \"center\",\n },\n contactText: {\n fontSize: 16,\n color: appearance?.colors?.textPrimary || theme[\"cm-text-primary\"],\n marginLeft: 12,\n flex: 1,\n },\n errorText: {\n fontSize: 14,\n color: appearance?.colors?.danger || theme[\"cm-danger\"],\n textAlign: \"center\",\n marginBottom: 16,\n },\n buttonContainer: {\n flexDirection: \"row\",\n gap: 12,\n },\n button: {\n flex: 1,\n paddingVertical: 16,\n paddingHorizontal: 24,\n borderRadius: 999,\n alignItems: \"center\",\n justifyContent: \"center\",\n minHeight: 52,\n },\n primaryButton: {\n backgroundColor: appearance?.colors?.accent || theme[\"cm-accent\"],\n },\n secondaryButton: {\n backgroundColor: \"transparent\",\n borderWidth: 1,\n borderColor: appearance?.colors?.border || theme[\"cm-border\"],\n },\n disabledButton: {\n opacity: 0.6,\n },\n buttonText: {\n fontSize: 16,\n fontWeight: \"500\",\n color: appearance?.colors?.background || theme[\"cm-background-primary\"],\n },\n secondaryButtonText: {\n color: appearance?.colors?.textPrimary || theme[\"cm-text-primary\"],\n },\n });\n\n return (\n <View style={dynamicStyles.container}>\n <Text style={dynamicStyles.title}>Confirm it's you</Text>\n <Text style={dynamicStyles.description}>\n You're using this wallet for the first time on this device. Click 'Send code' to get a one-time\n verification code{contactType === \"phone\" ? \" via SMS\" : \"\"}.\n </Text>\n\n <View style={dynamicStyles.contactContainer}>\n {icon}\n <Text style={dynamicStyles.contactText}>{contactInfo}</Text>\n </View>\n\n {error && <Text style={dynamicStyles.errorText}>{error}</Text>}\n\n <View style={dynamicStyles.buttonContainer}>\n <TouchableOpacity\n style={[dynamicStyles.button, dynamicStyles.secondaryButton]}\n onPress={onCancel}\n disabled={isLoading}\n >\n <Text style={[dynamicStyles.buttonText, dynamicStyles.secondaryButtonText]}>Cancel</Text>\n </TouchableOpacity>\n\n <TouchableOpacity\n style={[\n dynamicStyles.button,\n dynamicStyles.primaryButton,\n isLoading && dynamicStyles.disabledButton,\n ]}\n onPress={handleConfirm}\n disabled={isLoading}\n >\n {isLoading ? (\n <ActivityIndicator color={appearance?.colors?.background || theme[\"cm-background-primary\"]} />\n ) : (\n <Text style={dynamicStyles.buttonText}>Send code</Text>\n )}\n </TouchableOpacity>\n </View>\n </View>\n );\n}\n"]}
@@ -1,44 +0,0 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
-
3
- var _chunkQ7YPX4RJjs = require('./chunk-Q7YPX4RJ.js');
4
-
5
- // src/components/embed/v3/crypto/PayerConnectionHandler.tsx
6
- var _react = require('react');
7
- function PayerConnectionHandler({
8
- payer,
9
- webViewClient
10
- }) {
11
- _react.useEffect.call(void 0, () => {
12
- if (webViewClient == null) {
13
- return;
14
- }
15
- const signTransactionListener = webViewClient.on(
16
- "crypto:send-transaction",
17
- (_0) => _chunkQ7YPX4RJjs.__async.call(void 0, this, [_0], function* ({ chain, serializedTransaction }) {
18
- try {
19
- yield payer.handleChainSwitch(chain);
20
- const tx = yield payer.handleSignAndSendTransaction(serializedTransaction);
21
- if (tx.success) {
22
- webViewClient.send("crypto:send-transaction:success", { txId: tx.txId });
23
- } else {
24
- webViewClient.send("crypto:send-transaction:failed", { error: tx.errorMessage });
25
- }
26
- } catch (error) {
27
- console.error("[PayerConnectionHandler] Failed to send transaction", error);
28
- webViewClient.send("crypto:send-transaction:failed", {
29
- error: error.message || "An unknown error occurred"
30
- });
31
- }
32
- })
33
- );
34
- return () => {
35
- webViewClient.off(signTransactionListener);
36
- };
37
- }, [webViewClient]);
38
- return null;
39
- }
40
-
41
-
42
-
43
- exports.PayerConnectionHandler = PayerConnectionHandler;
44
- //# sourceMappingURL=chunk-BUB4U2GE.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/components/embed/v3/crypto/PayerConnectionHandler.tsx"],"names":[],"mappings":";;;;;AAAA,SAAS,iBAAiB;AAMnB,SAAS,uBAAuB;AAAA,EACnC;AAAA,EACA;AACJ,GAMG;AACC,YAAU,MAAM;AACZ,QAAI,iBAAiB,MAAM;AACvB;AAAA,IACJ;AAEA,UAAM,0BAA0B,cAAc;AAAA,MAC1C;AAAA,MACA,CAAO,OAAqC,eAArC,KAAqC,WAArC,EAAE,OAAO,sBAAsB,GAAM;AACxC,YAAI;AACA,gBAAM,MAAM,kBAAkB,KAAkC;AAChE,gBAAM,KAAK,MAAM,MAAM,6BAA6B,qBAAqB;AACzE,cAAI,GAAG,SAAS;AACZ,0BAAc,KAAK,mCAAmC,EAAE,MAAM,GAAG,KAAK,CAAC;AAAA,UAC3E,OAAO;AACH,0BAAc,KAAK,kCAAkC,EAAE,OAAO,GAAG,aAAa,CAAC;AAAA,UACnF;AAAA,QACJ,SAAS,OAAO;AACZ,kBAAQ,MAAM,uDAAuD,KAAK;AAC1E,wBAAc,KAAK,kCAAkC;AAAA,YACjD,OAAQ,MAAgB,WAAW;AAAA,UACvC,CAAC;AAAA,QACL;AAAA,MACJ;AAAA,IACJ;AAEA,WAAO,MAAM;AACT,oBAAc,IAAI,uBAAuB;AAAA,IAC7C;AAAA,EACJ,GAAG,CAAC,aAAa,CAAC;AAElB,SAAO;AACX","sourcesContent":["import { useEffect } from \"react\";\nimport type { EmbeddedCheckoutPayer } from \"@crossmint/client-sdk-base\";\nimport type { PayerSupportedBlockchains } from \"@crossmint/common-sdk-base\";\nimport type { WebViewParent } from \"@crossmint/client-sdk-rn-window\";\nimport type { embeddedCheckoutV3IncomingEvents, embeddedCheckoutV3OutgoingEvents } from \"@crossmint/client-sdk-base\";\n\nexport function PayerConnectionHandler({\n payer,\n webViewClient,\n}: {\n payer: EmbeddedCheckoutPayer;\n webViewClient: WebViewParent<\n typeof embeddedCheckoutV3IncomingEvents,\n typeof embeddedCheckoutV3OutgoingEvents\n > | null;\n}) {\n useEffect(() => {\n if (webViewClient == null) {\n return;\n }\n\n const signTransactionListener = webViewClient.on(\n \"crypto:send-transaction\",\n async ({ chain, serializedTransaction }) => {\n try {\n await payer.handleChainSwitch(chain as PayerSupportedBlockchains);\n const tx = await payer.handleSignAndSendTransaction(serializedTransaction);\n if (tx.success) {\n webViewClient.send(\"crypto:send-transaction:success\", { txId: tx.txId });\n } else {\n webViewClient.send(\"crypto:send-transaction:failed\", { error: tx.errorMessage });\n }\n } catch (error) {\n console.error(\"[PayerConnectionHandler] Failed to send transaction\", error);\n webViewClient.send(\"crypto:send-transaction:failed\", {\n error: (error as Error).message || \"An unknown error occurred\",\n });\n }\n }\n );\n\n return () => {\n webViewClient.off(signTransactionListener);\n };\n }, [webViewClient]);\n\n return null;\n}\n"]}
@@ -1,36 +0,0 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
-
3
- var _chunkXUGJXLWCjs = require('./chunk-XUGJXLWC.js');
4
-
5
- // src/hooks/useCrossmintCheckout.tsx
6
- var _react = require('react');
7
- var _jsxruntime = require('react/jsx-runtime');
8
- var CrossmintCheckoutContext = _react.createContext.call(void 0, void 0);
9
- function CrossmintCheckoutProvider({ children }) {
10
- const [order, setOrder] = _react.useState.call(void 0, void 0);
11
- const [orderClientSecret, setOrderClientSecret] = _react.useState.call(void 0, void 0);
12
- _react.useEffect.call(void 0, () => {
13
- const handleOrderUpdated = (data) => {
14
- setOrder(data.order);
15
- setOrderClientSecret(data.orderClientSecret);
16
- };
17
- _chunkXUGJXLWCjs.localEventEmitter.on("order:updated", handleOrderUpdated);
18
- return () => {
19
- _chunkXUGJXLWCjs.localEventEmitter.off("order:updated", handleOrderUpdated);
20
- };
21
- }, []);
22
- return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, CrossmintCheckoutContext.Provider, { value: { order, orderClientSecret }, children });
23
- }
24
- function useCrossmintCheckout() {
25
- const context = _react.useContext.call(void 0, CrossmintCheckoutContext);
26
- if (!context) {
27
- throw new Error("useCrossmintCheckout must be used within a CrossmintCheckoutProvider");
28
- }
29
- return context;
30
- }
31
-
32
-
33
-
34
-
35
- exports.CrossmintCheckoutProvider = CrossmintCheckoutProvider; exports.useCrossmintCheckout = useCrossmintCheckout;
36
- //# sourceMappingURL=chunk-BUTZZ7JB.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/hooks/useCrossmintCheckout.tsx"],"names":[],"mappings":";;;;;AAAA,SAAS,eAA+B,YAAY,WAAW,gBAAgB;AA6BvE;AApBR,IAAM,2BAA2B,cAAoD,MAAS;AAEvF,SAAS,0BAA0B,EAAE,SAAS,GAA4B;AAC7E,QAAM,CAAC,OAAO,QAAQ,IAAI,SAA4B,MAAS;AAC/D,QAAM,CAAC,mBAAmB,oBAAoB,IAAI,SAA6B,MAAS;AAExF,YAAU,MAAM;AACZ,UAAM,qBAAqB,CAAC,SAAmD;AAC3E,eAAS,KAAK,KAAK;AACnB,2BAAqB,KAAK,iBAAiB;AAAA,IAC/C;AAEA,sBAAkB,GAAG,iBAAiB,kBAAkB;AAExD,WAAO,MAAM;AACT,wBAAkB,IAAI,iBAAiB,kBAAkB;AAAA,IAC7D;AAAA,EACJ,GAAG,CAAC,CAAC;AAEL,SACI,oBAAC,yBAAyB,UAAzB,EAAkC,OAAO,EAAE,OAAO,kBAAkB,GAChE,UACL;AAER;AAEO,SAAS,uBAAuB;AACnC,QAAM,UAAU,WAAW,wBAAwB;AACnD,MAAI,CAAC,SAAS;AACV,UAAM,IAAI,MAAM,sEAAsE;AAAA,EAC1F;AACA,SAAO;AACX","sourcesContent":["import { createContext, type ReactNode, useContext, useEffect, useState } from \"react\";\nimport type { Order } from \"@crossmint/client-sdk-base\";\nimport { localEventEmitter, type LocalEventEmitterEvents } from \"@/utils/eventEmitter\";\n\nexport interface CrossmintCheckoutContext {\n order?: Order;\n orderClientSecret?: string;\n}\n\nconst CrossmintCheckoutContext = createContext<CrossmintCheckoutContext | undefined>(undefined);\n\nexport function CrossmintCheckoutProvider({ children }: { children: ReactNode }) {\n const [order, setOrder] = useState<Order | undefined>(undefined);\n const [orderClientSecret, setOrderClientSecret] = useState<string | undefined>(undefined);\n\n useEffect(() => {\n const handleOrderUpdated = (data: LocalEventEmitterEvents[\"order:updated\"]) => {\n setOrder(data.order);\n setOrderClientSecret(data.orderClientSecret);\n };\n\n localEventEmitter.on(\"order:updated\", handleOrderUpdated);\n\n return () => {\n localEventEmitter.off(\"order:updated\", handleOrderUpdated);\n };\n }, []);\n\n return (\n <CrossmintCheckoutContext.Provider value={{ order, orderClientSecret }}>\n {children}\n </CrossmintCheckoutContext.Provider>\n );\n}\n\nexport function useCrossmintCheckout() {\n const context = useContext(CrossmintCheckoutContext);\n if (!context) {\n throw new Error(\"useCrossmintCheckout must be used within a CrossmintCheckoutProvider\");\n }\n return context;\n}\n"]}