@crossmint/client-sdk-react-native-ui 0.13.33 → 0.13.34
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.
- package/dist/chunk-24MMQ2R4.js +15 -0
- package/dist/chunk-24MMQ2R4.js.map +1 -0
- package/dist/chunk-2DNOAXOE.mjs +8 -0
- package/dist/chunk-2DNOAXOE.mjs.map +1 -0
- package/dist/chunk-2TEAOLM6.mjs +149 -0
- package/dist/chunk-2TEAOLM6.mjs.map +1 -0
- package/dist/chunk-2YRJHM46.mjs +50 -0
- package/dist/chunk-2YRJHM46.mjs.map +1 -0
- package/dist/chunk-34OVOZB2.mjs +111 -0
- package/dist/chunk-34OVOZB2.mjs.map +1 -0
- package/dist/chunk-3AWDWMZ2.mjs +18 -0
- package/dist/chunk-3AWDWMZ2.mjs.map +1 -0
- package/dist/chunk-3MWGBZ5O.js +348 -0
- package/dist/chunk-3MWGBZ5O.js.map +1 -0
- package/dist/chunk-3PJ6FXFT.mjs +1 -0
- package/dist/chunk-3PJ6FXFT.mjs.map +1 -0
- package/dist/chunk-3SFSPJXM.mjs +55 -0
- package/dist/chunk-3SFSPJXM.mjs.map +1 -0
- package/dist/chunk-4AJTICKY.mjs +44 -0
- package/dist/chunk-4AJTICKY.mjs.map +1 -0
- package/dist/chunk-4HKXTAVR.js +14 -0
- package/dist/chunk-4HKXTAVR.js.map +1 -0
- package/dist/chunk-4NTIGHRE.js +148 -0
- package/dist/chunk-4NTIGHRE.js.map +1 -0
- package/dist/chunk-4V7NDO5X.mjs +157 -0
- package/dist/chunk-4V7NDO5X.mjs.map +1 -0
- package/dist/chunk-4WJIXD7U.mjs +14 -0
- package/dist/chunk-4WJIXD7U.mjs.map +1 -0
- package/dist/chunk-5ZBDQUNG.js +1 -0
- package/dist/chunk-5ZBDQUNG.js.map +1 -0
- package/dist/chunk-6W2GOMYU.js +22 -0
- package/dist/chunk-6W2GOMYU.js.map +1 -0
- package/dist/chunk-6Z74KC25.mjs +1 -0
- package/dist/chunk-6Z74KC25.mjs.map +1 -0
- package/dist/chunk-7SPIOD4K.mjs +66 -0
- package/dist/chunk-7SPIOD4K.mjs.map +1 -0
- package/dist/chunk-ALMDA3KN.mjs +199 -0
- package/dist/chunk-ALMDA3KN.mjs.map +1 -0
- package/dist/chunk-BE4HT2U7.mjs +1 -0
- package/dist/chunk-BE4HT2U7.mjs.map +1 -0
- package/dist/chunk-BTH5QRIT.js +149 -0
- package/dist/chunk-BTH5QRIT.js.map +1 -0
- package/dist/chunk-BUB4U2GE.js +44 -0
- package/dist/chunk-BUB4U2GE.js.map +1 -0
- package/dist/chunk-BUTZZ7JB.js +36 -0
- package/dist/chunk-BUTZZ7JB.js.map +1 -0
- package/dist/chunk-CFHHVHNZ.mjs +157 -0
- package/dist/chunk-CFHHVHNZ.mjs.map +1 -0
- package/dist/chunk-DD2MVD6A.mjs +36 -0
- package/dist/chunk-DD2MVD6A.mjs.map +1 -0
- package/dist/chunk-EKXEDMRD.mjs +71 -0
- package/dist/chunk-EKXEDMRD.mjs.map +1 -0
- package/dist/chunk-GYBEEYGB.mjs +1 -0
- package/dist/chunk-GYBEEYGB.mjs.map +1 -0
- package/dist/chunk-HELXBZ7D.js +18 -0
- package/dist/chunk-HELXBZ7D.js.map +1 -0
- package/dist/chunk-IBQK5B7B.js +71 -0
- package/dist/chunk-IBQK5B7B.js.map +1 -0
- package/dist/chunk-IHZNXV5S.js +1 -0
- package/dist/chunk-IHZNXV5S.js.map +1 -0
- package/dist/chunk-J2MDWDV6.mjs +1 -0
- package/dist/chunk-J2MDWDV6.mjs.map +1 -0
- package/dist/chunk-KK4SQ7WF.js +1 -0
- package/dist/chunk-KK4SQ7WF.js.map +1 -0
- package/dist/chunk-LMXGU2XA.js +50 -0
- package/dist/chunk-LMXGU2XA.js.map +1 -0
- package/dist/chunk-LWQ5CJC4.mjs +22 -0
- package/dist/chunk-LWQ5CJC4.mjs.map +1 -0
- package/dist/chunk-MMVER6VO.js +1 -0
- package/dist/chunk-MMVER6VO.js.map +1 -0
- package/dist/chunk-MVLQR6RI.js +199 -0
- package/dist/chunk-MVLQR6RI.js.map +1 -0
- package/dist/chunk-NBWATZY4.js +157 -0
- package/dist/chunk-NBWATZY4.js.map +1 -0
- package/dist/chunk-NSSAF6CV.mjs +348 -0
- package/dist/chunk-NSSAF6CV.mjs.map +1 -0
- package/dist/chunk-OLVGVQEA.js +24 -0
- package/dist/chunk-OLVGVQEA.js.map +1 -0
- package/dist/chunk-OTRMAWWU.js +55 -0
- package/dist/chunk-OTRMAWWU.js.map +1 -0
- package/dist/chunk-Q2Y5CZT4.js +157 -0
- package/dist/chunk-Q2Y5CZT4.js.map +1 -0
- package/dist/chunk-Q7YPX4RJ.js +66 -0
- package/dist/chunk-Q7YPX4RJ.js.map +1 -0
- package/dist/chunk-R2M3HW3E.mjs +61 -0
- package/dist/chunk-R2M3HW3E.mjs.map +1 -0
- package/dist/chunk-R3ZW4OCR.js +61 -0
- package/dist/chunk-R3ZW4OCR.js.map +1 -0
- package/dist/chunk-R47XMJ32.js +1 -0
- package/dist/chunk-R47XMJ32.js.map +1 -0
- package/dist/chunk-R5GF6WFB.mjs +148 -0
- package/dist/chunk-R5GF6WFB.mjs.map +1 -0
- package/dist/chunk-RSCBYS6I.mjs +15 -0
- package/dist/chunk-RSCBYS6I.mjs.map +1 -0
- package/dist/chunk-TNPZITVL.mjs +1 -0
- package/dist/chunk-TNPZITVL.mjs.map +1 -0
- package/dist/chunk-U74INGIF.js +17 -0
- package/dist/chunk-U74INGIF.js.map +1 -0
- package/dist/chunk-V2PIS2OC.mjs +17 -0
- package/dist/chunk-V2PIS2OC.mjs.map +1 -0
- package/dist/chunk-VCF2YXCO.js +208 -0
- package/dist/chunk-VCF2YXCO.js.map +1 -0
- package/dist/chunk-XNVZRSGL.js +111 -0
- package/dist/chunk-XNVZRSGL.js.map +1 -0
- package/dist/chunk-XUGJXLWC.js +8 -0
- package/dist/chunk-XUGJXLWC.js.map +1 -0
- package/dist/chunk-XXJ7LQ44.js +1 -0
- package/dist/chunk-XXJ7LQ44.js.map +1 -0
- package/dist/chunk-YAVGI5BZ.mjs +24 -0
- package/dist/chunk-YAVGI5BZ.mjs.map +1 -0
- package/dist/chunk-Z7Y7COJM.mjs +208 -0
- package/dist/chunk-Z7Y7COJM.mjs.map +1 -0
- package/dist/components/embed/index.js +16 -1
- package/dist/components/embed/index.js.map +1 -0
- package/dist/components/embed/index.mjs +16 -1
- package/dist/components/embed/index.mjs.map +1 -0
- package/dist/components/embed/v3/CrossmintEmbeddedCheckoutV3.js +14 -1
- package/dist/components/embed/v3/CrossmintEmbeddedCheckoutV3.js.map +1 -0
- package/dist/components/embed/v3/CrossmintEmbeddedCheckoutV3.mjs +14 -1
- package/dist/components/embed/v3/CrossmintEmbeddedCheckoutV3.mjs.map +1 -0
- package/dist/components/embed/v3/EmbeddedCheckoutV3WebView.js +13 -1
- package/dist/components/embed/v3/EmbeddedCheckoutV3WebView.js.map +1 -0
- package/dist/components/embed/v3/EmbeddedCheckoutV3WebView.mjs +13 -1
- package/dist/components/embed/v3/EmbeddedCheckoutV3WebView.mjs.map +1 -0
- package/dist/components/embed/v3/crypto/PayerConnectionHandler.js +8 -1
- package/dist/components/embed/v3/crypto/PayerConnectionHandler.js.map +1 -0
- package/dist/components/embed/v3/crypto/PayerConnectionHandler.mjs +8 -1
- package/dist/components/embed/v3/crypto/PayerConnectionHandler.mjs.map +1 -0
- package/dist/components/embed/v3/index.js +15 -1
- package/dist/components/embed/v3/index.js.map +1 -0
- package/dist/components/embed/v3/index.mjs +15 -1
- package/dist/components/embed/v3/index.mjs.map +1 -0
- package/dist/components/index.js +34 -1
- package/dist/components/index.js.map +1 -0
- package/dist/components/index.mjs +34 -1
- package/dist/components/index.mjs.map +1 -0
- package/dist/components/signers/BaseCodeInput.js +9 -1
- package/dist/components/signers/BaseCodeInput.js.map +1 -0
- package/dist/components/signers/BaseCodeInput.mjs +9 -1
- package/dist/components/signers/BaseCodeInput.mjs.map +1 -0
- package/dist/components/signers/BaseConfirmation.js +9 -1
- package/dist/components/signers/BaseConfirmation.js.map +1 -0
- package/dist/components/signers/BaseConfirmation.mjs +9 -1
- package/dist/components/signers/BaseConfirmation.mjs.map +1 -0
- package/dist/components/signers/EmailSignersDialog.js +11 -1
- package/dist/components/signers/EmailSignersDialog.js.map +1 -0
- package/dist/components/signers/EmailSignersDialog.mjs +11 -1
- package/dist/components/signers/EmailSignersDialog.mjs.map +1 -0
- package/dist/components/signers/PhoneSignersDialog.js +11 -1
- package/dist/components/signers/PhoneSignersDialog.js.map +1 -0
- package/dist/components/signers/PhoneSignersDialog.mjs +11 -1
- package/dist/components/signers/PhoneSignersDialog.mjs.map +1 -0
- package/dist/components/signers/index.js +16 -1
- package/dist/components/signers/index.js.map +1 -0
- package/dist/components/signers/index.mjs +16 -1
- package/dist/components/signers/index.mjs.map +1 -0
- package/dist/components/wallets/ExportPrivateKeyButton.js +8 -1
- package/dist/components/wallets/ExportPrivateKeyButton.js.map +1 -0
- package/dist/components/wallets/ExportPrivateKeyButton.mjs +8 -1
- package/dist/components/wallets/ExportPrivateKeyButton.mjs.map +1 -0
- package/dist/components/wallets/index.js +9 -1
- package/dist/components/wallets/index.js.map +1 -0
- package/dist/components/wallets/index.mjs +9 -1
- package/dist/components/wallets/index.mjs.map +1 -0
- package/dist/hooks/index.js +26 -1
- package/dist/hooks/index.js.map +1 -0
- package/dist/hooks/index.mjs +26 -1
- package/dist/hooks/index.mjs.map +1 -0
- package/dist/hooks/useAuth.js +14 -1
- package/dist/hooks/useAuth.js.map +1 -0
- package/dist/hooks/useAuth.mjs +14 -1
- package/dist/hooks/useAuth.mjs.map +1 -0
- package/dist/hooks/useCrossmintCheckout.js +11 -1
- package/dist/hooks/useCrossmintCheckout.js.map +1 -0
- package/dist/hooks/useCrossmintCheckout.mjs +11 -1
- package/dist/hooks/useCrossmintCheckout.mjs.map +1 -0
- package/dist/hooks/useWalletEmailSigner.js +8 -1
- package/dist/hooks/useWalletEmailSigner.js.map +1 -0
- package/dist/hooks/useWalletEmailSigner.mjs +8 -1
- package/dist/hooks/useWalletEmailSigner.mjs.map +1 -0
- package/dist/index.js +79 -1
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +79 -1
- package/dist/index.mjs.map +1 -0
- package/dist/logger/init.js +9 -1
- package/dist/logger/init.js.map +1 -0
- package/dist/logger/init.mjs +9 -1
- package/dist/logger/init.mjs.map +1 -0
- package/dist/plugin/mods/addQueryToAndroidManifest.js +8 -1
- package/dist/plugin/mods/addQueryToAndroidManifest.js.map +1 -0
- package/dist/plugin/mods/addQueryToAndroidManifest.mjs +8 -1
- package/dist/plugin/mods/addQueryToAndroidManifest.mjs.map +1 -0
- package/dist/plugin/withGooglePay.js +57 -1
- package/dist/plugin/withGooglePay.js.map +1 -0
- package/dist/plugin/withGooglePay.mjs +57 -1
- package/dist/plugin/withGooglePay.mjs.map +1 -0
- package/dist/providers/CrossmintAuthProvider.js +14 -1
- package/dist/providers/CrossmintAuthProvider.js.map +1 -0
- package/dist/providers/CrossmintAuthProvider.mjs +14 -1
- package/dist/providers/CrossmintAuthProvider.mjs.map +1 -0
- package/dist/providers/CrossmintProvider.js +12 -1
- package/dist/providers/CrossmintProvider.js.map +1 -0
- package/dist/providers/CrossmintProvider.mjs +12 -1
- package/dist/providers/CrossmintProvider.mjs.map +1 -0
- package/dist/providers/CrossmintWalletProvider.js +16 -1
- package/dist/providers/CrossmintWalletProvider.js.map +1 -0
- package/dist/providers/CrossmintWalletProvider.mjs +16 -1
- package/dist/providers/CrossmintWalletProvider.mjs.map +1 -0
- package/dist/providers/index.js +28 -1
- package/dist/providers/index.js.map +1 -0
- package/dist/providers/index.mjs +28 -1
- package/dist/providers/index.mjs.map +1 -0
- package/dist/styles/index.js +8 -1
- package/dist/styles/index.js.map +1 -0
- package/dist/styles/index.mjs +8 -1
- package/dist/styles/index.mjs.map +1 -0
- package/dist/styles/theme.js +8 -1
- package/dist/styles/theme.js.map +1 -0
- package/dist/styles/theme.mjs +8 -1
- package/dist/styles/theme.mjs.map +1 -0
- package/dist/types/auth.js +1 -1
- package/dist/types/auth.js.map +1 -0
- package/dist/types/auth.mjs +1 -0
- package/dist/types/auth.mjs.map +1 -0
- package/dist/utils/SecureStorage.js +8 -1
- package/dist/utils/SecureStorage.js.map +1 -0
- package/dist/utils/SecureStorage.mjs +8 -1
- package/dist/utils/SecureStorage.mjs.map +1 -0
- package/dist/utils/createCrossmintApiClient.js +9 -1
- package/dist/utils/createCrossmintApiClient.js.map +1 -0
- package/dist/utils/createCrossmintApiClient.mjs +9 -1
- package/dist/utils/createCrossmintApiClient.mjs.map +1 -0
- package/dist/utils/embed/userAgent.js +12 -1
- package/dist/utils/embed/userAgent.js.map +1 -0
- package/dist/utils/embed/userAgent.mjs +12 -1
- package/dist/utils/embed/userAgent.mjs.map +1 -0
- package/dist/utils/eventEmitter.js +8 -1
- package/dist/utils/eventEmitter.js.map +1 -0
- package/dist/utils/eventEmitter.mjs +8 -1
- package/dist/utils/eventEmitter.mjs.map +1 -0
- package/package.json +5 -5
|
@@ -0,0 +1,199 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
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":";;;;;;;;AAAA,SAAS,gBAAgC;AACzC,SAAS,MAAM,MAAM,WAAW,kBAAkB,YAAY,yBAAyB;AAoK/E,SACI,KADJ;AAhJD,SAAS,cAAc;AAAA,EAC1B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,YAAY;AAAA,EACZ,eAAe;AAAA,EACf,eAAe;AAAA,EACf,kBAAkB;AACtB,GAAuB;AAjCvB;AAkCI,QAAM,CAAC,SAAS,UAAU,IAAI,SAAS,EAAE;AACzC,QAAM,CAAC,WAAW,YAAY,IAAI,SAAS,KAAK;AAChD,QAAM,CAAC,OAAO,QAAQ,IAAI,SAAwB,IAAI;AACtD,QAAM,CAAC,gBAAgB,iBAAiB,IAAI,SAAS,CAAC;AAEtD,QAAM,kBAAkB,MAAY;AAChC,QAAI,QAAQ,WAAW,GAAG;AACtB;AAAA,IACJ;AAEA,iBAAa,IAAI;AACjB,aAAS,IAAI;AACb,QAAI;AACA,YAAM,YAAY,OAAO;AACzB,iBAAW,EAAE;AAAA,IACjB,SAASA,QAAO;AACZ,cAAQ,MAAM,wBAAwBA,MAAK;AAC3C,eAAS,iCAAiC;AAAA,IAC9C,UAAE;AACE,mBAAa,KAAK;AAAA,IACtB;AAAA,EACJ;AAEA,QAAM,mBAAmB,MAAY;AACjC,QAAI,iBAAiB,KAAK,CAAC,cAAc;AACrC;AAAA,IACJ;AAEA,iBAAa,IAAI;AACjB,aAAS,IAAI;AACb,QAAI;AACA,YAAM,aAAa;AACnB,wBAAkB,EAAE;AACpB,YAAM,QAAQ,YAAY,MAAM;AAC5B,0BAAkB,CAAC,SAAS;AACxB,cAAI,QAAQ,GAAG;AACX,0BAAc,KAAK;AACnB,mBAAO;AAAA,UACX;AACA,iBAAO,OAAO;AAAA,QA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;AAAA,QACX,WAAW;AAAA;AAAA,IACf;AAAA,IAEC,SAAS,oBAAC,QAAK,OAAO,cAAc,WAAY,iBAAM;AAAA,IAEvD,oBAAC,QAAK,OAAO,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"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=chunk-BE4HT2U7.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -0,0 +1,149 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
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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ACG,OAAO,CAAC,cAAc,QAAQ,cAAc,eAAe;AAAA,UAC3D,SAAS;AAAA,UACT,UAAU;AAAA,UAEV,8BAAC,QAAK,OAAO,CAAC,cAAc,YAAY,cAAc,mBAAmB,GAAG,oBAAM;AAAA;AAAA,MACtF;AAAA,MAEA;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"]}
|
|
@@ -0,0 +1,44 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
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"]}
|
|
@@ -0,0 +1,36 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
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"]}
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
import {
|
|
2
|
+
BaseCodeInput
|
|
3
|
+
} from "./chunk-ALMDA3KN.mjs";
|
|
4
|
+
import {
|
|
5
|
+
BaseConfirmation
|
|
6
|
+
} from "./chunk-2TEAOLM6.mjs";
|
|
7
|
+
import {
|
|
8
|
+
theme
|
|
9
|
+
} from "./chunk-3AWDWMZ2.mjs";
|
|
10
|
+
|
|
11
|
+
// src/components/signers/EmailSignersDialog.tsx
|
|
12
|
+
import { View, Modal, StyleSheet, Dimensions, TouchableOpacity, Text } from "react-native";
|
|
13
|
+
import { MailCheckIcon, MailIcon, X } from "lucide-react-native";
|
|
14
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
15
|
+
var { width: screenWidth } = Dimensions.get("window");
|
|
16
|
+
function EmailSignersDialog({
|
|
17
|
+
email,
|
|
18
|
+
open,
|
|
19
|
+
setOpen,
|
|
20
|
+
step,
|
|
21
|
+
onSubmitOTP,
|
|
22
|
+
onResendOTPCode,
|
|
23
|
+
onSubmitEmail,
|
|
24
|
+
rejectRef,
|
|
25
|
+
appearance
|
|
26
|
+
}) {
|
|
27
|
+
var _a, _b, _c, _d, _e, _f;
|
|
28
|
+
function handleOnCancel() {
|
|
29
|
+
var _a2;
|
|
30
|
+
if (open) {
|
|
31
|
+
(_a2 = rejectRef.current) == null ? void 0 : _a2.call(rejectRef, new Error());
|
|
32
|
+
setOpen(false);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
const dynamicStyles = StyleSheet.create({
|
|
36
|
+
centeredView: {
|
|
37
|
+
flex: 1,
|
|
38
|
+
backgroundColor: "rgba(0, 0, 0, 0.5)",
|
|
39
|
+
justifyContent: "center",
|
|
40
|
+
alignItems: "center",
|
|
41
|
+
padding: 16
|
|
42
|
+
},
|
|
43
|
+
modalView: {
|
|
44
|
+
backgroundColor: ((_a = appearance == null ? void 0 : appearance.colors) == null ? void 0 : _a.background) || theme["cm-background-primary"],
|
|
45
|
+
borderRadius: (appearance == null ? void 0 : appearance.borderRadius) || 12,
|
|
46
|
+
padding: 32,
|
|
47
|
+
alignItems: "center",
|
|
48
|
+
width: Math.min(screenWidth - 32, 400),
|
|
49
|
+
maxHeight: "80%",
|
|
50
|
+
position: "relative",
|
|
51
|
+
shadowColor: "#000",
|
|
52
|
+
shadowOffset: {
|
|
53
|
+
width: 0,
|
|
54
|
+
height: 2
|
|
55
|
+
},
|
|
56
|
+
shadowOpacity: 0.25,
|
|
57
|
+
shadowRadius: 4,
|
|
58
|
+
elevation: 5
|
|
59
|
+
},
|
|
60
|
+
closeButton: {
|
|
61
|
+
position: "absolute",
|
|
62
|
+
top: 16,
|
|
63
|
+
right: 16,
|
|
64
|
+
width: 32,
|
|
65
|
+
height: 32,
|
|
66
|
+
borderRadius: 6,
|
|
67
|
+
backgroundColor: ((_b = appearance == null ? void 0 : appearance.colors) == null ? void 0 : _b.inputBackground) || theme["cm-muted-primary"],
|
|
68
|
+
alignItems: "center",
|
|
69
|
+
justifyContent: "center",
|
|
70
|
+
zIndex: 1
|
|
71
|
+
}
|
|
72
|
+
});
|
|
73
|
+
if (!open) {
|
|
74
|
+
return null;
|
|
75
|
+
}
|
|
76
|
+
return /* @__PURE__ */ jsx(
|
|
77
|
+
Modal,
|
|
78
|
+
{
|
|
79
|
+
visible: open,
|
|
80
|
+
transparent: true,
|
|
81
|
+
animationType: "fade",
|
|
82
|
+
onRequestClose: handleOnCancel,
|
|
83
|
+
statusBarTranslucent: true,
|
|
84
|
+
children: /* @__PURE__ */ jsx(View, { style: dynamicStyles.centeredView, children: /* @__PURE__ */ jsxs(View, { style: dynamicStyles.modalView, children: [
|
|
85
|
+
/* @__PURE__ */ jsx(
|
|
86
|
+
TouchableOpacity,
|
|
87
|
+
{
|
|
88
|
+
style: dynamicStyles.closeButton,
|
|
89
|
+
onPress: handleOnCancel,
|
|
90
|
+
hitSlop: { top: 10, bottom: 10, left: 10, right: 10 },
|
|
91
|
+
children: /* @__PURE__ */ jsx(X, { size: 16, color: ((_c = appearance == null ? void 0 : appearance.colors) == null ? void 0 : _c.textSecondary) || theme["cm-text-secondary"] })
|
|
92
|
+
}
|
|
93
|
+
),
|
|
94
|
+
step === "initial" ? /* @__PURE__ */ jsx(
|
|
95
|
+
BaseConfirmation,
|
|
96
|
+
{
|
|
97
|
+
contactInfo: email != null ? email : "",
|
|
98
|
+
contactType: "email",
|
|
99
|
+
icon: /* @__PURE__ */ jsx(
|
|
100
|
+
MailIcon,
|
|
101
|
+
{
|
|
102
|
+
size: 22,
|
|
103
|
+
color: ((_d = appearance == null ? void 0 : appearance.colors) == null ? void 0 : _d.textPrimary) || theme["cm-text-primary"]
|
|
104
|
+
}
|
|
105
|
+
),
|
|
106
|
+
onConfirm: onSubmitEmail,
|
|
107
|
+
onCancel: handleOnCancel,
|
|
108
|
+
appearance
|
|
109
|
+
}
|
|
110
|
+
) : /* @__PURE__ */ jsx(
|
|
111
|
+
BaseCodeInput,
|
|
112
|
+
{
|
|
113
|
+
contactInfo: email != null ? email : "",
|
|
114
|
+
contactType: "email",
|
|
115
|
+
icon: /* @__PURE__ */ jsx(
|
|
116
|
+
View,
|
|
117
|
+
{
|
|
118
|
+
style: {
|
|
119
|
+
backgroundColor: ((_e = appearance == null ? void 0 : appearance.colors) == null ? void 0 : _e.accent) || theme["cm-accent"],
|
|
120
|
+
borderRadius: 999,
|
|
121
|
+
padding: 12
|
|
122
|
+
},
|
|
123
|
+
children: /* @__PURE__ */ jsx(
|
|
124
|
+
MailCheckIcon,
|
|
125
|
+
{
|
|
126
|
+
size: 22,
|
|
127
|
+
color: ((_f = appearance == null ? void 0 : appearance.colors) == null ? void 0 : _f.background) || theme["cm-background-primary"]
|
|
128
|
+
}
|
|
129
|
+
)
|
|
130
|
+
}
|
|
131
|
+
),
|
|
132
|
+
title: "Check your email",
|
|
133
|
+
description: /* @__PURE__ */ jsxs(Text, { children: [
|
|
134
|
+
"A temporary login code has been sent to",
|
|
135
|
+
" ",
|
|
136
|
+
/* @__PURE__ */ jsx(Text, { style: { fontWeight: "bold" }, children: email })
|
|
137
|
+
] }),
|
|
138
|
+
helpText: `Can't find the email? Check spam folder.
|
|
139
|
+
Some emails may take several minutes to arrive.`,
|
|
140
|
+
onSubmitOTP,
|
|
141
|
+
onResendCode: onResendOTPCode,
|
|
142
|
+
appearance,
|
|
143
|
+
otpLength: 9,
|
|
144
|
+
keyboardType: "default",
|
|
145
|
+
autoComplete: "one-time-code",
|
|
146
|
+
textContentType: "oneTimeCode"
|
|
147
|
+
}
|
|
148
|
+
)
|
|
149
|
+
] }) })
|
|
150
|
+
}
|
|
151
|
+
);
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
export {
|
|
155
|
+
EmailSignersDialog
|
|
156
|
+
};
|
|
157
|
+
//# sourceMappingURL=chunk-CFHHVHNZ.mjs.map
|