@kryptos_connect/mobile-sdk 0.0.1 → 1.0.2
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/README.md +342 -41
- package/dist/index.d.mts +24 -19
- package/dist/index.d.ts +24 -19
- package/dist/index.js +1239 -930
- package/dist/index.mjs +1261 -946
- package/package.json +2 -2
package/dist/index.mjs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
// src/KryptosConnectButton.tsx
|
|
2
|
-
import
|
|
2
|
+
import React36 from "react";
|
|
3
3
|
import {
|
|
4
|
-
StyleSheet as
|
|
5
|
-
Text as
|
|
6
|
-
TouchableOpacity as
|
|
7
|
-
View as
|
|
4
|
+
StyleSheet as StyleSheet20,
|
|
5
|
+
Text as Text18,
|
|
6
|
+
TouchableOpacity as TouchableOpacity8,
|
|
7
|
+
View as View20
|
|
8
8
|
} from "react-native";
|
|
9
9
|
|
|
10
10
|
// src/assets/LogoIcon.tsx
|
|
@@ -46,6 +46,152 @@ var LogoIcon = ({ size = 36 }) => {
|
|
|
46
46
|
|
|
47
47
|
// src/contexts/KryptosContext.tsx
|
|
48
48
|
import React2 from "react";
|
|
49
|
+
|
|
50
|
+
// src/services/api.ts
|
|
51
|
+
import axios from "axios";
|
|
52
|
+
|
|
53
|
+
// src/config/index.ts
|
|
54
|
+
var getBaseUrl = () => {
|
|
55
|
+
return getGlobalBaseUrl() || "https://connect-api.kryptos.io/";
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
// src/services/api.ts
|
|
59
|
+
var api = axios.create({
|
|
60
|
+
headers: {
|
|
61
|
+
"Content-Type": "application/json"
|
|
62
|
+
}
|
|
63
|
+
});
|
|
64
|
+
api.interceptors.request.use((config) => {
|
|
65
|
+
config.baseURL = getBaseUrl();
|
|
66
|
+
return config;
|
|
67
|
+
});
|
|
68
|
+
var SCOPES = "openid profile offline_access email portfolios:read transactions:read integrations:read tax:read accounting:read reports:read workspace:read users:read";
|
|
69
|
+
async function sendEmailOtp(linkToken, email, clientId) {
|
|
70
|
+
const res = await api.post(
|
|
71
|
+
"/v1/sendEmailOTP",
|
|
72
|
+
{
|
|
73
|
+
email,
|
|
74
|
+
purpose: "login",
|
|
75
|
+
clientId
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
headers: {
|
|
79
|
+
"X-LINK-TOKEN": linkToken
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
);
|
|
83
|
+
return res.data;
|
|
84
|
+
}
|
|
85
|
+
async function loginWithOtp(linkToken, email, code, clientId) {
|
|
86
|
+
const res = await api.post(
|
|
87
|
+
"/v1/loginUserUsingOTP",
|
|
88
|
+
{
|
|
89
|
+
email,
|
|
90
|
+
code,
|
|
91
|
+
clientId,
|
|
92
|
+
purpose: "login"
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
headers: {
|
|
96
|
+
"X-LINK-TOKEN": linkToken
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
);
|
|
100
|
+
return res.data;
|
|
101
|
+
}
|
|
102
|
+
async function createAnonymousUser(linkToken, clientId) {
|
|
103
|
+
const res = await api.post(
|
|
104
|
+
"/link-token/login",
|
|
105
|
+
{ clientId },
|
|
106
|
+
{
|
|
107
|
+
headers: {
|
|
108
|
+
"X-LINK-TOKEN": linkToken
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
);
|
|
112
|
+
return res.data;
|
|
113
|
+
}
|
|
114
|
+
async function addUserIntegration(linkToken, integration) {
|
|
115
|
+
const res = await api.post(
|
|
116
|
+
"/integrations/keys",
|
|
117
|
+
{ keys: [...integration] },
|
|
118
|
+
{
|
|
119
|
+
headers: {
|
|
120
|
+
"X-LINK-TOKEN": linkToken
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
);
|
|
124
|
+
return res.data?.data;
|
|
125
|
+
}
|
|
126
|
+
async function giveUserConsent(linkToken) {
|
|
127
|
+
const res = await api.post(
|
|
128
|
+
"/consent",
|
|
129
|
+
{
|
|
130
|
+
granted_scopes: SCOPES
|
|
131
|
+
},
|
|
132
|
+
{
|
|
133
|
+
headers: {
|
|
134
|
+
"X-LINK-TOKEN": linkToken
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
);
|
|
138
|
+
return res.data?.data;
|
|
139
|
+
}
|
|
140
|
+
async function testCredentials(linkToken, data) {
|
|
141
|
+
const res = await api.post("/integrations/credentials/test", data, {
|
|
142
|
+
headers: {
|
|
143
|
+
"X-LINK-TOKEN": linkToken
|
|
144
|
+
}
|
|
145
|
+
});
|
|
146
|
+
return res.data?.data;
|
|
147
|
+
}
|
|
148
|
+
async function getSupportedProviders(linkToken) {
|
|
149
|
+
const res = await api.get("/integrations/providers", {
|
|
150
|
+
headers: {
|
|
151
|
+
"X-LINK-TOKEN": linkToken
|
|
152
|
+
}
|
|
153
|
+
});
|
|
154
|
+
return res.data?.data;
|
|
155
|
+
}
|
|
156
|
+
async function getUserIntegrations(linkToken) {
|
|
157
|
+
const res = await api.get("/integrations", {
|
|
158
|
+
headers: {
|
|
159
|
+
"X-LINK-TOKEN": linkToken
|
|
160
|
+
}
|
|
161
|
+
});
|
|
162
|
+
return res.data?.data;
|
|
163
|
+
}
|
|
164
|
+
async function getUserUsedChains(linkToken, address) {
|
|
165
|
+
const res = await api.get("/integrations/user-used-chain", {
|
|
166
|
+
headers: {
|
|
167
|
+
"X-LINK-TOKEN": linkToken
|
|
168
|
+
},
|
|
169
|
+
params: {
|
|
170
|
+
id: address
|
|
171
|
+
}
|
|
172
|
+
});
|
|
173
|
+
return res.data?.data?.chains || [];
|
|
174
|
+
}
|
|
175
|
+
async function getClientInfo(linkToken) {
|
|
176
|
+
const res = await api.get("/client", {
|
|
177
|
+
headers: {
|
|
178
|
+
"X-LINK-TOKEN": linkToken
|
|
179
|
+
}
|
|
180
|
+
});
|
|
181
|
+
return res.data?.data;
|
|
182
|
+
}
|
|
183
|
+
async function getUserInfo(linkToken) {
|
|
184
|
+
const res = await api.get("/link-token/session", {
|
|
185
|
+
headers: {
|
|
186
|
+
"X-LINK-TOKEN": linkToken
|
|
187
|
+
}
|
|
188
|
+
});
|
|
189
|
+
return res.data?.data;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
// src/contexts/KryptosContext.tsx
|
|
193
|
+
var globalBaseUrl;
|
|
194
|
+
var getGlobalBaseUrl = () => globalBaseUrl;
|
|
49
195
|
var KryptosContext = React2.createContext(
|
|
50
196
|
void 0
|
|
51
197
|
);
|
|
@@ -57,6 +203,20 @@ var KryptosConnectProvider = ({ children, config }) => {
|
|
|
57
203
|
const [userConsent, setUserConsent] = React2.useState(
|
|
58
204
|
null
|
|
59
205
|
);
|
|
206
|
+
const [isAuthorized, setIsAuthorized] = React2.useState(false);
|
|
207
|
+
const [clientInfo, setClientInfo] = React2.useState(null);
|
|
208
|
+
React2.useEffect(() => {
|
|
209
|
+
globalBaseUrl = config.baseUrl;
|
|
210
|
+
}, [config.baseUrl]);
|
|
211
|
+
React2.useEffect(() => {
|
|
212
|
+
const fetchClientInfo = async () => {
|
|
213
|
+
if (linkToken) {
|
|
214
|
+
const res = await getClientInfo(linkToken);
|
|
215
|
+
setClientInfo(res);
|
|
216
|
+
}
|
|
217
|
+
};
|
|
218
|
+
fetchClientInfo();
|
|
219
|
+
}, [linkToken]);
|
|
60
220
|
return /* @__PURE__ */ React2.createElement(
|
|
61
221
|
KryptosContext.Provider,
|
|
62
222
|
{
|
|
@@ -71,7 +231,10 @@ var KryptosConnectProvider = ({ children, config }) => {
|
|
|
71
231
|
email,
|
|
72
232
|
setEmail,
|
|
73
233
|
userConsent,
|
|
74
|
-
setUserConsent
|
|
234
|
+
setUserConsent,
|
|
235
|
+
clientInfo,
|
|
236
|
+
isAuthorized,
|
|
237
|
+
setIsAuthorized
|
|
75
238
|
}
|
|
76
239
|
},
|
|
77
240
|
children
|
|
@@ -108,6 +271,7 @@ var lightTheme = {
|
|
|
108
271
|
successLight: "#D1FAE5",
|
|
109
272
|
warning: "#F59E0B",
|
|
110
273
|
warningLight: "#FEF3C7",
|
|
274
|
+
warningText: "#92400E",
|
|
111
275
|
overlay: "rgba(0, 0, 0, 0.5)",
|
|
112
276
|
white: "#FFFFFF",
|
|
113
277
|
black: "#000000"
|
|
@@ -187,6 +351,7 @@ var darkTheme = {
|
|
|
187
351
|
successLight: "#065F46",
|
|
188
352
|
warning: "#F59E0B",
|
|
189
353
|
warningLight: "#78350F",
|
|
354
|
+
warningText: "#FEF3C7",
|
|
190
355
|
overlay: "rgba(0, 0, 0, 0.7)",
|
|
191
356
|
white: "#FFFFFF",
|
|
192
357
|
black: "#000000"
|
|
@@ -232,150 +397,14 @@ var useTheme = () => {
|
|
|
232
397
|
return currentTheme;
|
|
233
398
|
};
|
|
234
399
|
|
|
235
|
-
// src/molecules/Auth.tsx
|
|
236
|
-
import React13 from "react";
|
|
237
|
-
import { View as View6, Text as Text6, StyleSheet as StyleSheet6 } from "react-native";
|
|
238
|
-
|
|
239
|
-
// src/assets/LinkIcon.tsx
|
|
240
|
-
import React4 from "react";
|
|
241
|
-
import Svg2, { Path as Path2 } from "react-native-svg";
|
|
242
|
-
var LinkIcon = ({
|
|
243
|
-
size = 20,
|
|
244
|
-
color = "#00C693"
|
|
245
|
-
}) => {
|
|
246
|
-
return /* @__PURE__ */ React4.createElement(Svg2, { width: size, height: size, viewBox: "0 0 24 24", fill: "none" }, /* @__PURE__ */ React4.createElement(
|
|
247
|
-
Path2,
|
|
248
|
-
{
|
|
249
|
-
d: "M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71",
|
|
250
|
-
stroke: color,
|
|
251
|
-
strokeWidth: 2,
|
|
252
|
-
strokeLinecap: "round",
|
|
253
|
-
strokeLinejoin: "round"
|
|
254
|
-
}
|
|
255
|
-
), /* @__PURE__ */ React4.createElement(
|
|
256
|
-
Path2,
|
|
257
|
-
{
|
|
258
|
-
d: "M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71",
|
|
259
|
-
stroke: color,
|
|
260
|
-
strokeWidth: 2,
|
|
261
|
-
strokeLinecap: "round",
|
|
262
|
-
strokeLinejoin: "round"
|
|
263
|
-
}
|
|
264
|
-
));
|
|
265
|
-
};
|
|
266
|
-
|
|
267
|
-
// src/assets/ShieldIcon.tsx
|
|
268
|
-
import React5 from "react";
|
|
269
|
-
import Svg3, { Path as Path3 } from "react-native-svg";
|
|
270
|
-
var ShieldIcon = ({
|
|
271
|
-
size = 20,
|
|
272
|
-
color = "#00C693"
|
|
273
|
-
}) => {
|
|
274
|
-
return /* @__PURE__ */ React5.createElement(Svg3, { width: size, height: size, viewBox: "0 0 24 24", fill: "none" }, /* @__PURE__ */ React5.createElement(
|
|
275
|
-
Path3,
|
|
276
|
-
{
|
|
277
|
-
d: "M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10z",
|
|
278
|
-
stroke: color,
|
|
279
|
-
strokeWidth: 2,
|
|
280
|
-
strokeLinecap: "round",
|
|
281
|
-
strokeLinejoin: "round"
|
|
282
|
-
}
|
|
283
|
-
), /* @__PURE__ */ React5.createElement(
|
|
284
|
-
Path3,
|
|
285
|
-
{
|
|
286
|
-
d: "m9 12 2 2 4-4",
|
|
287
|
-
stroke: color,
|
|
288
|
-
strokeWidth: 2,
|
|
289
|
-
strokeLinecap: "round",
|
|
290
|
-
strokeLinejoin: "round"
|
|
291
|
-
}
|
|
292
|
-
));
|
|
293
|
-
};
|
|
294
|
-
|
|
295
|
-
// src/components/Alert.tsx
|
|
296
|
-
import React6 from "react";
|
|
297
|
-
import { StyleSheet, Text, View } from "react-native";
|
|
298
|
-
var Alert = ({
|
|
299
|
-
variant = "default",
|
|
300
|
-
children,
|
|
301
|
-
style
|
|
302
|
-
}) => {
|
|
303
|
-
const theme = useTheme();
|
|
304
|
-
const getVariantStyles = () => {
|
|
305
|
-
switch (variant) {
|
|
306
|
-
case "destructive":
|
|
307
|
-
return {
|
|
308
|
-
backgroundColor: theme.colors.errorLight,
|
|
309
|
-
borderColor: theme.colors.error
|
|
310
|
-
};
|
|
311
|
-
default:
|
|
312
|
-
return {
|
|
313
|
-
backgroundColor: theme.colors.surface,
|
|
314
|
-
borderColor: theme.colors.border
|
|
315
|
-
};
|
|
316
|
-
}
|
|
317
|
-
};
|
|
318
|
-
return /* @__PURE__ */ React6.createElement(
|
|
319
|
-
View,
|
|
320
|
-
{
|
|
321
|
-
style: [
|
|
322
|
-
styles.alert,
|
|
323
|
-
{
|
|
324
|
-
borderRadius: theme.borderRadius.md,
|
|
325
|
-
padding: theme.spacing.md
|
|
326
|
-
},
|
|
327
|
-
getVariantStyles(),
|
|
328
|
-
style
|
|
329
|
-
]
|
|
330
|
-
},
|
|
331
|
-
children
|
|
332
|
-
);
|
|
333
|
-
};
|
|
334
|
-
var AlertDescription = ({
|
|
335
|
-
children,
|
|
336
|
-
style
|
|
337
|
-
}) => {
|
|
338
|
-
const theme = useTheme();
|
|
339
|
-
return /* @__PURE__ */ React6.createElement(
|
|
340
|
-
Text,
|
|
341
|
-
{
|
|
342
|
-
style: [
|
|
343
|
-
styles.description,
|
|
344
|
-
{
|
|
345
|
-
color: theme.colors.text,
|
|
346
|
-
fontSize: theme.fontSize.md
|
|
347
|
-
},
|
|
348
|
-
style
|
|
349
|
-
]
|
|
350
|
-
},
|
|
351
|
-
children
|
|
352
|
-
);
|
|
353
|
-
};
|
|
354
|
-
var styles = StyleSheet.create({
|
|
355
|
-
alert: {
|
|
356
|
-
borderWidth: 1,
|
|
357
|
-
marginVertical: 12
|
|
358
|
-
// theme.spacing.md - consistent alert spacing
|
|
359
|
-
},
|
|
360
|
-
title: {
|
|
361
|
-
fontWeight: "600",
|
|
362
|
-
marginBottom: 4
|
|
363
|
-
// theme.spacing.xs
|
|
364
|
-
},
|
|
365
|
-
description: {
|
|
366
|
-
lineHeight: 18,
|
|
367
|
-
textAlign: "center"
|
|
368
|
-
}
|
|
369
|
-
});
|
|
370
|
-
|
|
371
400
|
// src/components/Button.tsx
|
|
372
|
-
import
|
|
401
|
+
import React4 from "react";
|
|
373
402
|
import {
|
|
374
403
|
TouchableOpacity,
|
|
375
|
-
Text
|
|
376
|
-
StyleSheet
|
|
404
|
+
Text,
|
|
405
|
+
StyleSheet,
|
|
377
406
|
ActivityIndicator,
|
|
378
|
-
View
|
|
407
|
+
View
|
|
379
408
|
} from "react-native";
|
|
380
409
|
var Button = ({
|
|
381
410
|
variant = "primary",
|
|
@@ -488,35 +517,35 @@ var Button = ({
|
|
|
488
517
|
}
|
|
489
518
|
};
|
|
490
519
|
const sizeStyles = getSizeStyles();
|
|
491
|
-
return /* @__PURE__ */
|
|
520
|
+
return /* @__PURE__ */ React4.createElement(
|
|
492
521
|
TouchableOpacity,
|
|
493
522
|
{
|
|
494
523
|
onPress,
|
|
495
524
|
disabled: disabled || loading,
|
|
496
525
|
activeOpacity: 0.7,
|
|
497
526
|
style: [
|
|
498
|
-
|
|
527
|
+
styles.button,
|
|
499
528
|
getVariantStyles(),
|
|
500
529
|
sizeStyles.button,
|
|
501
|
-
disabled &&
|
|
530
|
+
disabled && styles.disabled,
|
|
502
531
|
style
|
|
503
532
|
]
|
|
504
533
|
},
|
|
505
|
-
loading ? /* @__PURE__ */
|
|
506
|
-
|
|
534
|
+
loading ? /* @__PURE__ */ React4.createElement(ActivityIndicator, { size: "small", color: getTextColor() }) : typeof children === "string" ? /* @__PURE__ */ React4.createElement(
|
|
535
|
+
Text,
|
|
507
536
|
{
|
|
508
537
|
style: [
|
|
509
|
-
|
|
538
|
+
styles.text,
|
|
510
539
|
{ color: getTextColor() },
|
|
511
540
|
sizeStyles.text,
|
|
512
541
|
textStyle
|
|
513
542
|
]
|
|
514
543
|
},
|
|
515
544
|
children
|
|
516
|
-
) : /* @__PURE__ */
|
|
545
|
+
) : /* @__PURE__ */ React4.createElement(View, { style: styles.contentContainer }, children)
|
|
517
546
|
);
|
|
518
547
|
};
|
|
519
|
-
var
|
|
548
|
+
var styles = StyleSheet.create({
|
|
520
549
|
button: {
|
|
521
550
|
flexDirection: "row",
|
|
522
551
|
alignItems: "center",
|
|
@@ -538,12 +567,12 @@ var styles2 = StyleSheet2.create({
|
|
|
538
567
|
});
|
|
539
568
|
|
|
540
569
|
// src/components/Input.tsx
|
|
541
|
-
import
|
|
570
|
+
import React5 from "react";
|
|
542
571
|
import {
|
|
543
|
-
View as
|
|
572
|
+
View as View2,
|
|
544
573
|
TextInput,
|
|
545
|
-
Text as
|
|
546
|
-
StyleSheet as
|
|
574
|
+
Text as Text2,
|
|
575
|
+
StyleSheet as StyleSheet2
|
|
547
576
|
} from "react-native";
|
|
548
577
|
var Input = ({
|
|
549
578
|
label,
|
|
@@ -567,22 +596,22 @@ var Input = ({
|
|
|
567
596
|
return theme.colors.border;
|
|
568
597
|
}
|
|
569
598
|
};
|
|
570
|
-
return /* @__PURE__ */
|
|
571
|
-
|
|
599
|
+
return /* @__PURE__ */ React5.createElement(View2, { style: [styles2.wrapper, containerStyle] }, label && /* @__PURE__ */ React5.createElement(
|
|
600
|
+
Text2,
|
|
572
601
|
{
|
|
573
602
|
style: [
|
|
574
|
-
|
|
603
|
+
styles2.label,
|
|
575
604
|
{ color: theme.colors.text, fontSize: theme.fontSize.sm },
|
|
576
605
|
labelStyle
|
|
577
606
|
]
|
|
578
607
|
},
|
|
579
608
|
label
|
|
580
|
-
), /* @__PURE__ */
|
|
609
|
+
), /* @__PURE__ */ React5.createElement(
|
|
581
610
|
TextInput,
|
|
582
611
|
{
|
|
583
612
|
placeholderTextColor: theme.colors.textTertiary,
|
|
584
613
|
style: [
|
|
585
|
-
|
|
614
|
+
styles2.input,
|
|
586
615
|
{
|
|
587
616
|
backgroundColor: theme.colors.surface,
|
|
588
617
|
borderColor: getBorderColor(),
|
|
@@ -596,20 +625,20 @@ var Input = ({
|
|
|
596
625
|
],
|
|
597
626
|
...props
|
|
598
627
|
}
|
|
599
|
-
), error && /* @__PURE__ */
|
|
600
|
-
|
|
628
|
+
), error && /* @__PURE__ */ React5.createElement(
|
|
629
|
+
Text2,
|
|
601
630
|
{
|
|
602
631
|
style: [
|
|
603
|
-
|
|
632
|
+
styles2.error,
|
|
604
633
|
{ color: theme.colors.error, fontSize: theme.fontSize.sm }
|
|
605
634
|
]
|
|
606
635
|
},
|
|
607
636
|
error
|
|
608
|
-
), helperText && !error && /* @__PURE__ */
|
|
609
|
-
|
|
637
|
+
), helperText && !error && /* @__PURE__ */ React5.createElement(
|
|
638
|
+
Text2,
|
|
610
639
|
{
|
|
611
640
|
style: [
|
|
612
|
-
|
|
641
|
+
styles2.helper,
|
|
613
642
|
{
|
|
614
643
|
color: theme.colors.textSecondary,
|
|
615
644
|
fontSize: theme.fontSize.sm
|
|
@@ -619,7 +648,7 @@ var Input = ({
|
|
|
619
648
|
helperText
|
|
620
649
|
));
|
|
621
650
|
};
|
|
622
|
-
var
|
|
651
|
+
var styles2 = StyleSheet2.create({
|
|
623
652
|
wrapper: {
|
|
624
653
|
marginBottom: 16
|
|
625
654
|
// theme.spacing.lg - consistent form spacing
|
|
@@ -643,29 +672,105 @@ var styles3 = StyleSheet3.create({
|
|
|
643
672
|
}
|
|
644
673
|
});
|
|
645
674
|
|
|
646
|
-
// src/components/
|
|
647
|
-
import
|
|
648
|
-
import {
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
675
|
+
// src/components/Alert.tsx
|
|
676
|
+
import React6 from "react";
|
|
677
|
+
import { StyleSheet as StyleSheet3, Text as Text3, View as View3 } from "react-native";
|
|
678
|
+
var Alert = ({
|
|
679
|
+
variant = "default",
|
|
680
|
+
children,
|
|
681
|
+
style
|
|
682
|
+
}) => {
|
|
683
|
+
const theme = useTheme();
|
|
684
|
+
const getVariantStyles = () => {
|
|
685
|
+
switch (variant) {
|
|
686
|
+
case "destructive":
|
|
687
|
+
return {
|
|
688
|
+
backgroundColor: theme.colors.errorLight,
|
|
689
|
+
borderColor: theme.colors.error
|
|
690
|
+
};
|
|
691
|
+
default:
|
|
692
|
+
return {
|
|
693
|
+
backgroundColor: theme.colors.surface,
|
|
694
|
+
borderColor: theme.colors.border
|
|
695
|
+
};
|
|
696
|
+
}
|
|
697
|
+
};
|
|
698
|
+
return /* @__PURE__ */ React6.createElement(
|
|
699
|
+
View3,
|
|
700
|
+
{
|
|
701
|
+
style: [
|
|
702
|
+
styles3.alert,
|
|
703
|
+
{
|
|
704
|
+
borderRadius: theme.borderRadius.md,
|
|
705
|
+
padding: theme.spacing.md
|
|
706
|
+
},
|
|
707
|
+
getVariantStyles(),
|
|
708
|
+
style
|
|
709
|
+
]
|
|
710
|
+
},
|
|
711
|
+
children
|
|
712
|
+
);
|
|
713
|
+
};
|
|
714
|
+
var AlertDescription = ({
|
|
715
|
+
children,
|
|
716
|
+
style
|
|
717
|
+
}) => {
|
|
718
|
+
const theme = useTheme();
|
|
719
|
+
return /* @__PURE__ */ React6.createElement(
|
|
720
|
+
Text3,
|
|
721
|
+
{
|
|
722
|
+
style: [
|
|
723
|
+
styles3.description,
|
|
724
|
+
{
|
|
725
|
+
color: theme.colors.text,
|
|
726
|
+
fontSize: theme.fontSize.md
|
|
727
|
+
},
|
|
728
|
+
style
|
|
729
|
+
]
|
|
730
|
+
},
|
|
731
|
+
children
|
|
732
|
+
);
|
|
733
|
+
};
|
|
734
|
+
var styles3 = StyleSheet3.create({
|
|
735
|
+
alert: {
|
|
736
|
+
borderWidth: 1,
|
|
737
|
+
marginVertical: 12
|
|
738
|
+
// theme.spacing.md - consistent alert spacing
|
|
739
|
+
},
|
|
740
|
+
title: {
|
|
741
|
+
fontWeight: "600",
|
|
742
|
+
marginBottom: 4
|
|
743
|
+
// theme.spacing.xs
|
|
744
|
+
},
|
|
745
|
+
description: {
|
|
746
|
+
lineHeight: 18,
|
|
747
|
+
textAlign: "center"
|
|
748
|
+
}
|
|
749
|
+
});
|
|
750
|
+
|
|
751
|
+
// src/components/Modal.tsx
|
|
752
|
+
import React8 from "react";
|
|
753
|
+
import {
|
|
754
|
+
Dimensions,
|
|
655
755
|
KeyboardAvoidingView,
|
|
656
756
|
Platform,
|
|
657
|
-
|
|
757
|
+
Modal as RNModal,
|
|
758
|
+
ScrollView,
|
|
759
|
+
StyleSheet as StyleSheet4,
|
|
760
|
+
Text as Text4,
|
|
761
|
+
TouchableOpacity as TouchableOpacity2,
|
|
762
|
+
View as View4
|
|
658
763
|
} from "react-native";
|
|
659
764
|
|
|
660
765
|
// src/assets/CloseIcon.tsx
|
|
661
|
-
import
|
|
662
|
-
import
|
|
766
|
+
import React7 from "react";
|
|
767
|
+
import Svg2, { Path as Path2 } from "react-native-svg";
|
|
663
768
|
var CloseIcon = ({
|
|
664
769
|
size = 20,
|
|
665
770
|
color = "#000"
|
|
666
771
|
}) => {
|
|
667
|
-
return /* @__PURE__ */
|
|
668
|
-
|
|
772
|
+
return /* @__PURE__ */ React7.createElement(Svg2, { width: size, height: size, viewBox: "0 0 20 20", fill: "none" }, /* @__PURE__ */ React7.createElement(
|
|
773
|
+
Path2,
|
|
669
774
|
{
|
|
670
775
|
d: "M15 5L5 15M5 5L15 15",
|
|
671
776
|
stroke: color,
|
|
@@ -709,13 +814,13 @@ var Modal = ({
|
|
|
709
814
|
const handleOverlayPress = () => {
|
|
710
815
|
if (!disableClose && closeOnOverlayClick) onClose();
|
|
711
816
|
};
|
|
712
|
-
return /* @__PURE__ */
|
|
817
|
+
return /* @__PURE__ */ React8.createElement(
|
|
713
818
|
KeyboardAvoidingView,
|
|
714
819
|
{
|
|
715
820
|
behavior: Platform.OS === "ios" ? "padding" : "height",
|
|
716
821
|
style: styles4.keyboardView
|
|
717
822
|
},
|
|
718
|
-
/* @__PURE__ */
|
|
823
|
+
/* @__PURE__ */ React8.createElement(
|
|
719
824
|
RNModal,
|
|
720
825
|
{
|
|
721
826
|
visible: isOpen,
|
|
@@ -724,14 +829,14 @@ var Modal = ({
|
|
|
724
829
|
statusBarTranslucent: true,
|
|
725
830
|
onRequestClose: disableClose ? void 0 : onClose
|
|
726
831
|
},
|
|
727
|
-
/* @__PURE__ */
|
|
832
|
+
/* @__PURE__ */ React8.createElement(
|
|
728
833
|
TouchableOpacity2,
|
|
729
834
|
{
|
|
730
835
|
activeOpacity: 1,
|
|
731
836
|
style: [styles4.overlay, { backgroundColor: theme.colors.overlay }],
|
|
732
837
|
onPress: handleOverlayPress
|
|
733
838
|
},
|
|
734
|
-
/* @__PURE__ */
|
|
839
|
+
/* @__PURE__ */ React8.createElement(
|
|
735
840
|
View4,
|
|
736
841
|
{
|
|
737
842
|
style: [
|
|
@@ -762,7 +867,7 @@ var ModalHeader = ({
|
|
|
762
867
|
style
|
|
763
868
|
}) => {
|
|
764
869
|
const theme = useTheme();
|
|
765
|
-
return /* @__PURE__ */
|
|
870
|
+
return /* @__PURE__ */ React8.createElement(
|
|
766
871
|
View4,
|
|
767
872
|
{
|
|
768
873
|
style: [
|
|
@@ -775,7 +880,7 @@ var ModalHeader = ({
|
|
|
775
880
|
style
|
|
776
881
|
]
|
|
777
882
|
},
|
|
778
|
-
/* @__PURE__ */
|
|
883
|
+
/* @__PURE__ */ React8.createElement(View4, { style: styles4.headerContent }, typeof children === "string" ? /* @__PURE__ */ React8.createElement(
|
|
779
884
|
Text4,
|
|
780
885
|
{
|
|
781
886
|
style: [
|
|
@@ -785,7 +890,7 @@ var ModalHeader = ({
|
|
|
785
890
|
},
|
|
786
891
|
children
|
|
787
892
|
) : children),
|
|
788
|
-
showCloseButton && onClose && /* @__PURE__ */
|
|
893
|
+
showCloseButton && onClose && /* @__PURE__ */ React8.createElement(
|
|
789
894
|
TouchableOpacity2,
|
|
790
895
|
{
|
|
791
896
|
onPress: onClose,
|
|
@@ -795,7 +900,7 @@ var ModalHeader = ({
|
|
|
795
900
|
{ backgroundColor: theme.colors.surface }
|
|
796
901
|
]
|
|
797
902
|
},
|
|
798
|
-
/* @__PURE__ */
|
|
903
|
+
/* @__PURE__ */ React8.createElement(CloseIcon, { color: theme.colors.text, size: 20 })
|
|
799
904
|
)
|
|
800
905
|
);
|
|
801
906
|
};
|
|
@@ -806,7 +911,7 @@ var ModalBody = ({
|
|
|
806
911
|
}) => {
|
|
807
912
|
const theme = useTheme();
|
|
808
913
|
if (scrollable) {
|
|
809
|
-
return /* @__PURE__ */
|
|
914
|
+
return /* @__PURE__ */ React8.createElement(
|
|
810
915
|
ScrollView,
|
|
811
916
|
{
|
|
812
917
|
style: styles4.bodyScroll,
|
|
@@ -821,14 +926,14 @@ var ModalBody = ({
|
|
|
821
926
|
children
|
|
822
927
|
);
|
|
823
928
|
}
|
|
824
|
-
return /* @__PURE__ */
|
|
929
|
+
return /* @__PURE__ */ React8.createElement(View4, { style: [styles4.body, { padding: theme.spacing.lg }, style] }, children);
|
|
825
930
|
};
|
|
826
931
|
var ModalFooter = ({
|
|
827
932
|
children,
|
|
828
933
|
style
|
|
829
934
|
}) => {
|
|
830
935
|
const theme = useTheme();
|
|
831
|
-
return /* @__PURE__ */
|
|
936
|
+
return /* @__PURE__ */ React8.createElement(
|
|
832
937
|
View4,
|
|
833
938
|
{
|
|
834
939
|
style: [
|
|
@@ -901,146 +1006,386 @@ var styles4 = StyleSheet4.create({
|
|
|
901
1006
|
}
|
|
902
1007
|
});
|
|
903
1008
|
|
|
904
|
-
// src/
|
|
905
|
-
import
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
"X-Link-Token": linkToken
|
|
929
|
-
}
|
|
930
|
-
}
|
|
1009
|
+
// src/components/OTP.tsx
|
|
1010
|
+
import React9 from "react";
|
|
1011
|
+
import {
|
|
1012
|
+
View as View5,
|
|
1013
|
+
TextInput as TextInput2,
|
|
1014
|
+
Text as Text5,
|
|
1015
|
+
StyleSheet as StyleSheet5
|
|
1016
|
+
} from "react-native";
|
|
1017
|
+
var OTP = ({
|
|
1018
|
+
length = 6,
|
|
1019
|
+
value = "",
|
|
1020
|
+
onChange,
|
|
1021
|
+
onComplete,
|
|
1022
|
+
error,
|
|
1023
|
+
label,
|
|
1024
|
+
disabled = false,
|
|
1025
|
+
containerStyle,
|
|
1026
|
+
inputStyle,
|
|
1027
|
+
setErrorMessage
|
|
1028
|
+
}) => {
|
|
1029
|
+
const theme = useTheme();
|
|
1030
|
+
const AUTO_SUBMIT_DELAY = 500;
|
|
1031
|
+
const [otp, setOtp] = React9.useState(
|
|
1032
|
+
value.split("").concat(Array(length).fill("")).slice(0, length)
|
|
931
1033
|
);
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
clientId,
|
|
941
|
-
purpose: "login"
|
|
942
|
-
},
|
|
943
|
-
{
|
|
944
|
-
headers: {
|
|
945
|
-
"X-Link-Token": linkToken
|
|
946
|
-
}
|
|
1034
|
+
const inputRefs = React9.useRef([]);
|
|
1035
|
+
React9.useEffect(() => {
|
|
1036
|
+
const isComplete = otp.every((digit) => digit !== "");
|
|
1037
|
+
let timer;
|
|
1038
|
+
if (isComplete && onComplete) {
|
|
1039
|
+
timer = setTimeout(() => {
|
|
1040
|
+
onComplete(otp.join(""));
|
|
1041
|
+
}, AUTO_SUBMIT_DELAY);
|
|
947
1042
|
}
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
}
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
1043
|
+
return () => {
|
|
1044
|
+
if (timer) clearTimeout(timer);
|
|
1045
|
+
};
|
|
1046
|
+
}, [otp, onComplete]);
|
|
1047
|
+
React9.useEffect(() => {
|
|
1048
|
+
setTimeout(() => {
|
|
1049
|
+
inputRefs.current[0]?.focus();
|
|
1050
|
+
}, 100);
|
|
1051
|
+
}, []);
|
|
1052
|
+
const handleChange = React9.useCallback(
|
|
1053
|
+
(index, val) => {
|
|
1054
|
+
if (disabled) return;
|
|
1055
|
+
setErrorMessage("");
|
|
1056
|
+
const numericValue = val.replace(/[^0-9]/g, "");
|
|
1057
|
+
const newValue = numericValue.slice(-1);
|
|
1058
|
+
if (val && !numericValue) {
|
|
1059
|
+
return;
|
|
958
1060
|
}
|
|
959
|
-
|
|
1061
|
+
const newOtp = [...otp];
|
|
1062
|
+
newOtp[index] = newValue;
|
|
1063
|
+
setOtp(newOtp);
|
|
1064
|
+
const otpString = newOtp.join("");
|
|
1065
|
+
onChange?.(otpString);
|
|
1066
|
+
if (newValue && index < length - 1) {
|
|
1067
|
+
inputRefs.current[index + 1]?.focus();
|
|
1068
|
+
}
|
|
1069
|
+
if (otpString.length === length && !otpString.includes("")) {
|
|
1070
|
+
onComplete?.(otpString);
|
|
1071
|
+
}
|
|
1072
|
+
},
|
|
1073
|
+
[otp, length, onChange, onComplete, disabled]
|
|
960
1074
|
);
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
1075
|
+
const handleKeyPress = React9.useCallback(
|
|
1076
|
+
(index, e) => {
|
|
1077
|
+
if (disabled) return;
|
|
1078
|
+
if (e.nativeEvent.key === "Backspace") {
|
|
1079
|
+
if (!otp[index] && index > 0) {
|
|
1080
|
+
inputRefs.current[index - 1]?.focus();
|
|
1081
|
+
} else {
|
|
1082
|
+
const newOtp = [...otp];
|
|
1083
|
+
newOtp[index] = "";
|
|
1084
|
+
setOtp(newOtp);
|
|
1085
|
+
onChange?.(newOtp.join(""));
|
|
1086
|
+
}
|
|
970
1087
|
}
|
|
971
|
-
}
|
|
1088
|
+
},
|
|
1089
|
+
[otp, onChange, disabled]
|
|
972
1090
|
);
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
1091
|
+
const getBorderColor = (index) => {
|
|
1092
|
+
if (error) return theme.colors.error;
|
|
1093
|
+
if (otp[index]) return theme.colors.success;
|
|
1094
|
+
return theme.colors.border;
|
|
1095
|
+
};
|
|
1096
|
+
return /* @__PURE__ */ React9.createElement(View5, { style: [styles5.wrapper, containerStyle] }, label && /* @__PURE__ */ React9.createElement(
|
|
1097
|
+
Text5,
|
|
978
1098
|
{
|
|
979
|
-
|
|
980
|
-
|
|
1099
|
+
style: [
|
|
1100
|
+
styles5.label,
|
|
1101
|
+
{ color: theme.colors.text, fontSize: theme.fontSize.sm }
|
|
1102
|
+
]
|
|
981
1103
|
},
|
|
1104
|
+
label
|
|
1105
|
+
), /* @__PURE__ */ React9.createElement(View5, { style: styles5.container }, Array.from({ length }, (_, index) => /* @__PURE__ */ React9.createElement(
|
|
1106
|
+
TextInput2,
|
|
982
1107
|
{
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
1108
|
+
key: index,
|
|
1109
|
+
ref: (el) => inputRefs.current[index] = el,
|
|
1110
|
+
style: [
|
|
1111
|
+
styles5.input,
|
|
1112
|
+
{
|
|
1113
|
+
backgroundColor: theme.colors.surface,
|
|
1114
|
+
borderColor: getBorderColor(index),
|
|
1115
|
+
color: theme.colors.text,
|
|
1116
|
+
fontSize: theme.fontSize.xxl,
|
|
1117
|
+
borderRadius: theme.borderRadius.md
|
|
1118
|
+
},
|
|
1119
|
+
inputStyle
|
|
1120
|
+
],
|
|
1121
|
+
keyboardType: "numeric",
|
|
1122
|
+
maxLength: 1,
|
|
1123
|
+
value: otp[index] || "",
|
|
1124
|
+
onChangeText: (val) => handleChange(index, val),
|
|
1125
|
+
onKeyPress: (e) => handleKeyPress(index, e),
|
|
1126
|
+
editable: !disabled,
|
|
1127
|
+
selectTextOnFocus: true,
|
|
1128
|
+
caretHidden: true
|
|
994
1129
|
}
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1130
|
+
))), error && /* @__PURE__ */ React9.createElement(
|
|
1131
|
+
Text5,
|
|
1132
|
+
{
|
|
1133
|
+
style: [
|
|
1134
|
+
styles5.error,
|
|
1135
|
+
{ color: theme.colors.error, fontSize: theme.fontSize.sm }
|
|
1136
|
+
]
|
|
1137
|
+
},
|
|
1138
|
+
error
|
|
1139
|
+
));
|
|
1140
|
+
};
|
|
1141
|
+
var styles5 = StyleSheet5.create({
|
|
1142
|
+
wrapper: {
|
|
1143
|
+
marginBottom: 16
|
|
1144
|
+
// theme.spacing.lg
|
|
1145
|
+
},
|
|
1146
|
+
label: {
|
|
1147
|
+
fontWeight: "500",
|
|
1148
|
+
marginBottom: 12,
|
|
1149
|
+
// theme.spacing.md - consistent label spacing
|
|
1150
|
+
textAlign: "center"
|
|
1151
|
+
},
|
|
1152
|
+
container: {
|
|
1153
|
+
flexDirection: "row",
|
|
1154
|
+
justifyContent: "center",
|
|
1155
|
+
gap: 8
|
|
1156
|
+
// theme.spacing.sm
|
|
1157
|
+
},
|
|
1158
|
+
input: {
|
|
1159
|
+
width: 48,
|
|
1160
|
+
height: 56,
|
|
1161
|
+
borderWidth: 1,
|
|
1162
|
+
textAlign: "center",
|
|
1163
|
+
fontWeight: "600"
|
|
1164
|
+
},
|
|
1165
|
+
error: {
|
|
1166
|
+
marginTop: 12,
|
|
1167
|
+
// theme.spacing.md - consistent error spacing
|
|
1168
|
+
textAlign: "center"
|
|
1169
|
+
}
|
|
1170
|
+
});
|
|
1171
|
+
|
|
1172
|
+
// src/components/SkeletonItem.tsx
|
|
1173
|
+
import React10, { useEffect, useRef } from "react";
|
|
1174
|
+
import { Animated, View as View6, StyleSheet as StyleSheet6 } from "react-native";
|
|
1175
|
+
var SkeletonItem = () => {
|
|
1176
|
+
const opacity = useRef(new Animated.Value(0.3)).current;
|
|
1177
|
+
useEffect(() => {
|
|
1178
|
+
Animated.loop(
|
|
1179
|
+
Animated.sequence([
|
|
1180
|
+
Animated.timing(opacity, {
|
|
1181
|
+
toValue: 1,
|
|
1182
|
+
duration: 600,
|
|
1183
|
+
useNativeDriver: true
|
|
1184
|
+
}),
|
|
1185
|
+
Animated.timing(opacity, {
|
|
1186
|
+
toValue: 0.3,
|
|
1187
|
+
duration: 600,
|
|
1188
|
+
useNativeDriver: true
|
|
1189
|
+
})
|
|
1190
|
+
])
|
|
1191
|
+
).start();
|
|
1192
|
+
}, []);
|
|
1193
|
+
return /* @__PURE__ */ React10.createElement(Animated.View, { style: [styles6.row, { opacity }] }, /* @__PURE__ */ React10.createElement(View6, { style: styles6.iconCircle }), /* @__PURE__ */ React10.createElement(View6, { style: styles6.textBlock }, /* @__PURE__ */ React10.createElement(View6, { style: styles6.lineLong }), /* @__PURE__ */ React10.createElement(View6, { style: styles6.lineShort })));
|
|
1194
|
+
};
|
|
1195
|
+
var styles6 = StyleSheet6.create({
|
|
1196
|
+
row: {
|
|
1197
|
+
flexDirection: "row",
|
|
1198
|
+
alignItems: "center",
|
|
1199
|
+
paddingVertical: 16
|
|
1200
|
+
},
|
|
1201
|
+
iconCircle: {
|
|
1202
|
+
width: 45,
|
|
1203
|
+
height: 45,
|
|
1204
|
+
borderRadius: 22.5,
|
|
1205
|
+
backgroundColor: "#E5E5E5"
|
|
1206
|
+
},
|
|
1207
|
+
textBlock: {
|
|
1208
|
+
marginLeft: 12,
|
|
1209
|
+
flex: 1
|
|
1210
|
+
},
|
|
1211
|
+
lineShort: {
|
|
1212
|
+
width: "50%",
|
|
1213
|
+
height: 14,
|
|
1214
|
+
borderRadius: 6,
|
|
1215
|
+
backgroundColor: "#E5E5E5"
|
|
1216
|
+
},
|
|
1217
|
+
lineLong: {
|
|
1218
|
+
marginBottom: 6,
|
|
1219
|
+
width: "100%",
|
|
1220
|
+
height: 14,
|
|
1221
|
+
borderRadius: 6,
|
|
1222
|
+
backgroundColor: "#E5E5E5"
|
|
1223
|
+
}
|
|
1224
|
+
});
|
|
1225
|
+
var SkeletonItem_default = SkeletonItem;
|
|
1226
|
+
|
|
1227
|
+
// src/components/Mode.tsx
|
|
1228
|
+
import React11 from "react";
|
|
1229
|
+
import { View as View7, Text as Text6, StyleSheet as StyleSheet7 } from "react-native";
|
|
1230
|
+
var Mode = () => {
|
|
1231
|
+
const { clientInfo } = useKryptosConnect();
|
|
1232
|
+
const theme = useTheme();
|
|
1233
|
+
if (!clientInfo) return null;
|
|
1234
|
+
if (clientInfo?.project_stage === "production") return null;
|
|
1235
|
+
return /* @__PURE__ */ React11.createElement(View7, { style: [styles7.container, { backgroundColor: theme.colors.warning }] }, /* @__PURE__ */ React11.createElement(Text6, { style: [styles7.text, { color: theme.colors.warningText }] }, "Sandbox Mode"));
|
|
1236
|
+
};
|
|
1237
|
+
var styles7 = StyleSheet7.create({
|
|
1238
|
+
container: {
|
|
1239
|
+
paddingVertical: 4,
|
|
1240
|
+
paddingHorizontal: 8,
|
|
1241
|
+
borderRadius: 8,
|
|
1242
|
+
alignItems: "center",
|
|
1243
|
+
justifyContent: "center"
|
|
1244
|
+
},
|
|
1245
|
+
text: {
|
|
1246
|
+
fontSize: 12,
|
|
1247
|
+
fontWeight: "600"
|
|
1248
|
+
}
|
|
1249
|
+
});
|
|
1250
|
+
|
|
1251
|
+
// src/components/Footer.tsx
|
|
1252
|
+
import React13 from "react";
|
|
1253
|
+
import { View as View9, StyleSheet as StyleSheet9 } from "react-native";
|
|
1254
|
+
|
|
1255
|
+
// src/components/PoweredByKryptos.tsx
|
|
1256
|
+
import React12 from "react";
|
|
1257
|
+
import {
|
|
1258
|
+
Linking,
|
|
1259
|
+
StyleSheet as StyleSheet8,
|
|
1260
|
+
Text as Text7,
|
|
1261
|
+
TouchableOpacity as TouchableOpacity3,
|
|
1262
|
+
View as View8
|
|
1263
|
+
} from "react-native";
|
|
1264
|
+
var PoweredByKryptos = () => {
|
|
1265
|
+
const theme = useTheme();
|
|
1266
|
+
const handlePress = () => {
|
|
1267
|
+
Linking.openURL("https://kryptos.io");
|
|
1268
|
+
};
|
|
1269
|
+
return /* @__PURE__ */ React12.createElement(View8, { style: styles8.container }, /* @__PURE__ */ React12.createElement(Text7, { style: [styles8.text, { color: theme.colors.textSecondary }] }, "Powered by", " "), /* @__PURE__ */ React12.createElement(TouchableOpacity3, { onPress: handlePress, activeOpacity: 0.7 }, /* @__PURE__ */ React12.createElement(LogoIcon, { size: 16 })));
|
|
1270
|
+
};
|
|
1271
|
+
var styles8 = StyleSheet8.create({
|
|
1272
|
+
container: {
|
|
1273
|
+
flexDirection: "row",
|
|
1274
|
+
alignItems: "center"
|
|
1275
|
+
},
|
|
1276
|
+
text: {
|
|
1277
|
+
fontSize: 12,
|
|
1278
|
+
fontWeight: "400"
|
|
1279
|
+
}
|
|
1280
|
+
});
|
|
1281
|
+
|
|
1282
|
+
// src/components/Footer.tsx
|
|
1283
|
+
var Footer = () => {
|
|
1284
|
+
return /* @__PURE__ */ React13.createElement(View9, { style: styles9.container }, /* @__PURE__ */ React13.createElement(PoweredByKryptos, null), /* @__PURE__ */ React13.createElement(View9, { style: styles9.modeWrapper }, /* @__PURE__ */ React13.createElement(Mode, null)));
|
|
1285
|
+
};
|
|
1286
|
+
var styles9 = StyleSheet9.create({
|
|
1287
|
+
container: {
|
|
1288
|
+
width: "100%",
|
|
1289
|
+
paddingVertical: 8,
|
|
1290
|
+
alignItems: "center",
|
|
1291
|
+
justifyContent: "center"
|
|
1292
|
+
},
|
|
1293
|
+
// Anchor Mode to the right side
|
|
1294
|
+
modeWrapper: {
|
|
1295
|
+
position: "absolute",
|
|
1296
|
+
right: 8,
|
|
1297
|
+
top: 4
|
|
1298
|
+
}
|
|
1299
|
+
});
|
|
1300
|
+
|
|
1301
|
+
// src/molecules/Auth.tsx
|
|
1302
|
+
import React19 from "react";
|
|
1303
|
+
import { Linking as Linking2, StyleSheet as StyleSheet11, Text as Text9, View as View11 } from "react-native";
|
|
1304
|
+
|
|
1305
|
+
// src/assets/LinkIcon.tsx
|
|
1306
|
+
import React14 from "react";
|
|
1307
|
+
import Svg3, { Path as Path3 } from "react-native-svg";
|
|
1308
|
+
var LinkIcon = ({
|
|
1309
|
+
size = 20,
|
|
1310
|
+
color = "#00C693"
|
|
1311
|
+
}) => {
|
|
1312
|
+
return /* @__PURE__ */ React14.createElement(Svg3, { width: size, height: size, viewBox: "0 0 24 24", fill: "none" }, /* @__PURE__ */ React14.createElement(
|
|
1313
|
+
Path3,
|
|
1314
|
+
{
|
|
1315
|
+
d: "M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71",
|
|
1316
|
+
stroke: color,
|
|
1317
|
+
strokeWidth: 2,
|
|
1318
|
+
strokeLinecap: "round",
|
|
1319
|
+
strokeLinejoin: "round"
|
|
1002
1320
|
}
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
"
|
|
1321
|
+
), /* @__PURE__ */ React14.createElement(
|
|
1322
|
+
Path3,
|
|
1323
|
+
{
|
|
1324
|
+
d: "M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71",
|
|
1325
|
+
stroke: color,
|
|
1326
|
+
strokeWidth: 2,
|
|
1327
|
+
strokeLinecap: "round",
|
|
1328
|
+
strokeLinejoin: "round"
|
|
1010
1329
|
}
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1330
|
+
));
|
|
1331
|
+
};
|
|
1332
|
+
|
|
1333
|
+
// src/assets/ShieldIcon.tsx
|
|
1334
|
+
import React15 from "react";
|
|
1335
|
+
import Svg4, { Path as Path4 } from "react-native-svg";
|
|
1336
|
+
var ShieldIcon = ({
|
|
1337
|
+
size = 20,
|
|
1338
|
+
color = "#00C693"
|
|
1339
|
+
}) => {
|
|
1340
|
+
return /* @__PURE__ */ React15.createElement(Svg4, { width: size, height: size, viewBox: "0 0 24 24", fill: "none" }, /* @__PURE__ */ React15.createElement(
|
|
1341
|
+
Path4,
|
|
1342
|
+
{
|
|
1343
|
+
d: "M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10z",
|
|
1344
|
+
stroke: color,
|
|
1345
|
+
strokeWidth: 2,
|
|
1346
|
+
strokeLinecap: "round",
|
|
1347
|
+
strokeLinejoin: "round"
|
|
1021
1348
|
}
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1349
|
+
), /* @__PURE__ */ React15.createElement(
|
|
1350
|
+
Path4,
|
|
1351
|
+
{
|
|
1352
|
+
d: "m9 12 2 2 4-4",
|
|
1353
|
+
stroke: color,
|
|
1354
|
+
strokeWidth: 2,
|
|
1355
|
+
strokeLinecap: "round",
|
|
1356
|
+
strokeLinejoin: "round"
|
|
1357
|
+
}
|
|
1358
|
+
));
|
|
1359
|
+
};
|
|
1360
|
+
|
|
1361
|
+
// src/assets/eye.tsx
|
|
1362
|
+
import React16 from "react";
|
|
1363
|
+
import Svg5, { Path as Path5 } from "react-native-svg";
|
|
1364
|
+
var EyeIcon = ({
|
|
1365
|
+
size = 20,
|
|
1366
|
+
color = "#00C693"
|
|
1367
|
+
}) => {
|
|
1368
|
+
return /* @__PURE__ */ React16.createElement(Svg5, { fill: color, width: size, height: size, viewBox: "0 0 0.72 0.72" }, /* @__PURE__ */ React16.createElement(Path5, { d: "M0.658 0.348C0.597 0.207 0.483 0.12 0.36 0.12s-0.237 0.087 -0.298 0.228a0.03 0.03 0 0 0 0 0.024C0.123 0.513 0.237 0.6 0.36 0.6s0.237 -0.087 0.298 -0.228a0.03 0.03 0 0 0 0 -0.024M0.36 0.54c-0.095 0 -0.185 -0.069 -0.237 -0.18C0.175 0.249 0.265 0.18 0.36 0.18s0.185 0.069 0.237 0.18c-0.052 0.111 -0.142 0.18 -0.237 0.18m0 -0.3a0.12 0.12 0 1 0 0.12 0.12 0.12 0.12 0 0 0 -0.12 -0.12m0 0.18a0.06 0.06 0 1 1 0.06 -0.06 0.06 0.06 0 0 1 -0.06 0.06" }));
|
|
1369
|
+
};
|
|
1025
1370
|
|
|
1026
1371
|
// src/molecules/ConnectLogo.tsx
|
|
1027
|
-
import
|
|
1372
|
+
import React18, { isValidElement } from "react";
|
|
1028
1373
|
import {
|
|
1029
1374
|
Image,
|
|
1030
|
-
StyleSheet as
|
|
1031
|
-
Text as
|
|
1032
|
-
View as
|
|
1375
|
+
StyleSheet as StyleSheet10,
|
|
1376
|
+
Text as Text8,
|
|
1377
|
+
View as View10
|
|
1033
1378
|
} from "react-native";
|
|
1034
1379
|
|
|
1035
1380
|
// src/assets/UnplugIcon.tsx
|
|
1036
|
-
import
|
|
1037
|
-
import
|
|
1381
|
+
import React17 from "react";
|
|
1382
|
+
import Svg6, { Path as Path6, Line } from "react-native-svg";
|
|
1038
1383
|
var UnplugIcon = ({
|
|
1039
1384
|
size = 24,
|
|
1040
1385
|
color = "#6B7280"
|
|
1041
1386
|
}) => {
|
|
1042
|
-
return /* @__PURE__ */
|
|
1043
|
-
|
|
1387
|
+
return /* @__PURE__ */ React17.createElement(Svg6, { width: size, height: size, viewBox: "0 0 24 24", fill: "none" }, /* @__PURE__ */ React17.createElement(
|
|
1388
|
+
Path6,
|
|
1044
1389
|
{
|
|
1045
1390
|
d: "m19 5 3-3",
|
|
1046
1391
|
stroke: color,
|
|
@@ -1048,8 +1393,8 @@ var UnplugIcon = ({
|
|
|
1048
1393
|
strokeLinecap: "round",
|
|
1049
1394
|
strokeLinejoin: "round"
|
|
1050
1395
|
}
|
|
1051
|
-
), /* @__PURE__ */
|
|
1052
|
-
|
|
1396
|
+
), /* @__PURE__ */ React17.createElement(
|
|
1397
|
+
Path6,
|
|
1053
1398
|
{
|
|
1054
1399
|
d: "m2 22 3-3",
|
|
1055
1400
|
stroke: color,
|
|
@@ -1057,8 +1402,8 @@ var UnplugIcon = ({
|
|
|
1057
1402
|
strokeLinecap: "round",
|
|
1058
1403
|
strokeLinejoin: "round"
|
|
1059
1404
|
}
|
|
1060
|
-
), /* @__PURE__ */
|
|
1061
|
-
|
|
1405
|
+
), /* @__PURE__ */ React17.createElement(
|
|
1406
|
+
Path6,
|
|
1062
1407
|
{
|
|
1063
1408
|
d: "M6.3 20.3a2.4 2.4 0 0 0 3.4 0L12 18l-6-6-2.3 2.3a2.4 2.4 0 0 0 0 3.4Z",
|
|
1064
1409
|
stroke: color,
|
|
@@ -1066,8 +1411,8 @@ var UnplugIcon = ({
|
|
|
1066
1411
|
strokeLinecap: "round",
|
|
1067
1412
|
strokeLinejoin: "round"
|
|
1068
1413
|
}
|
|
1069
|
-
), /* @__PURE__ */
|
|
1070
|
-
|
|
1414
|
+
), /* @__PURE__ */ React17.createElement(
|
|
1415
|
+
Path6,
|
|
1071
1416
|
{
|
|
1072
1417
|
d: "m18 12-6-6 2.3-2.3a2.4 2.4 0 0 1 3.4 0l2.6 2.6a2.4 2.4 0 0 1 0 3.4Z",
|
|
1073
1418
|
stroke: color,
|
|
@@ -1075,7 +1420,7 @@ var UnplugIcon = ({
|
|
|
1075
1420
|
strokeLinecap: "round",
|
|
1076
1421
|
strokeLinejoin: "round"
|
|
1077
1422
|
}
|
|
1078
|
-
), /* @__PURE__ */
|
|
1423
|
+
), /* @__PURE__ */ React17.createElement(
|
|
1079
1424
|
Line,
|
|
1080
1425
|
{
|
|
1081
1426
|
x1: 7.5,
|
|
@@ -1092,12 +1437,12 @@ var UnplugIcon = ({
|
|
|
1092
1437
|
// src/molecules/ConnectLogo.tsx
|
|
1093
1438
|
var KryptosLogo = () => {
|
|
1094
1439
|
const theme = useTheme();
|
|
1095
|
-
return /* @__PURE__ */
|
|
1096
|
-
|
|
1440
|
+
return /* @__PURE__ */ React18.createElement(
|
|
1441
|
+
View10,
|
|
1097
1442
|
{
|
|
1098
|
-
style: [
|
|
1443
|
+
style: [styles10.logoContainer, { backgroundColor: theme.colors.surface }]
|
|
1099
1444
|
},
|
|
1100
|
-
/* @__PURE__ */
|
|
1445
|
+
/* @__PURE__ */ React18.createElement(LogoIcon, { size: 36 })
|
|
1101
1446
|
);
|
|
1102
1447
|
};
|
|
1103
1448
|
var ConnectLogo = () => {
|
|
@@ -1115,46 +1460,44 @@ var ConnectLogo = () => {
|
|
|
1115
1460
|
if (isValidElement(appLogo)) {
|
|
1116
1461
|
return appLogo;
|
|
1117
1462
|
} else if (typeof appLogo === "string" && isValidUrl(appLogo)) {
|
|
1118
|
-
return /* @__PURE__ */
|
|
1463
|
+
return /* @__PURE__ */ React18.createElement(
|
|
1119
1464
|
Image,
|
|
1120
1465
|
{
|
|
1121
1466
|
source: { uri: appLogo },
|
|
1122
|
-
style:
|
|
1467
|
+
style: styles10.appLogoImage,
|
|
1123
1468
|
resizeMode: "contain"
|
|
1124
1469
|
}
|
|
1125
1470
|
);
|
|
1126
1471
|
} else if (typeof appLogo === "number" || typeof appLogo === "object" && appLogo !== null) {
|
|
1127
|
-
return /* @__PURE__ */
|
|
1472
|
+
return /* @__PURE__ */ React18.createElement(
|
|
1128
1473
|
Image,
|
|
1129
1474
|
{
|
|
1130
1475
|
source: appLogo,
|
|
1131
|
-
style:
|
|
1476
|
+
style: styles10.appLogoImage,
|
|
1132
1477
|
resizeMode: "contain"
|
|
1133
1478
|
}
|
|
1134
1479
|
);
|
|
1135
1480
|
} else if (appName) {
|
|
1136
|
-
return /* @__PURE__ */
|
|
1481
|
+
return /* @__PURE__ */ React18.createElement(Text8, { style: [styles10.appLogoText, { color: theme.colors.text }] }, appName.charAt(0).toUpperCase());
|
|
1137
1482
|
}
|
|
1138
|
-
return /* @__PURE__ */
|
|
1483
|
+
return /* @__PURE__ */ React18.createElement(Text8, { style: [styles10.appLogoText, { color: theme.colors.text }] }, "?");
|
|
1139
1484
|
};
|
|
1140
|
-
return /* @__PURE__ */
|
|
1141
|
-
|
|
1485
|
+
return /* @__PURE__ */ React18.createElement(View10, { style: styles10.container }, /* @__PURE__ */ React18.createElement(KryptosLogo, null), /* @__PURE__ */ React18.createElement(View10, { style: styles10.iconContainer }, /* @__PURE__ */ React18.createElement(UnplugIcon, { size: 24, color: theme.colors.textSecondary })), /* @__PURE__ */ React18.createElement(
|
|
1486
|
+
View10,
|
|
1142
1487
|
{
|
|
1143
1488
|
style: [
|
|
1144
|
-
|
|
1489
|
+
styles10.logoContainer,
|
|
1145
1490
|
{ backgroundColor: theme.colors.surface }
|
|
1146
1491
|
]
|
|
1147
1492
|
},
|
|
1148
1493
|
renderLogo()
|
|
1149
1494
|
));
|
|
1150
1495
|
};
|
|
1151
|
-
var
|
|
1496
|
+
var styles10 = StyleSheet10.create({
|
|
1152
1497
|
container: {
|
|
1153
1498
|
flexDirection: "row",
|
|
1154
1499
|
alignItems: "center",
|
|
1155
1500
|
justifyContent: "center",
|
|
1156
|
-
marginVertical: 24,
|
|
1157
|
-
// theme.spacing.xxl
|
|
1158
1501
|
gap: 12
|
|
1159
1502
|
// theme.spacing.md
|
|
1160
1503
|
},
|
|
@@ -1191,11 +1534,11 @@ var Auth = ({
|
|
|
1191
1534
|
}) => {
|
|
1192
1535
|
const { appName, linkToken, clientId, setUser, setEmail } = useKryptosConnect();
|
|
1193
1536
|
const theme = useTheme();
|
|
1194
|
-
const [isLoading, setIsLoading] =
|
|
1195
|
-
const [errorMessage, setErrorMessage] =
|
|
1196
|
-
const [emailValue, setEmailValue] =
|
|
1197
|
-
const [emailError, setEmailError] =
|
|
1198
|
-
const [loadingType, setLoadingType] =
|
|
1537
|
+
const [isLoading, setIsLoading] = React19.useState(false);
|
|
1538
|
+
const [errorMessage, setErrorMessage] = React19.useState("");
|
|
1539
|
+
const [emailValue, setEmailValue] = React19.useState("");
|
|
1540
|
+
const [emailError, setEmailError] = React19.useState("");
|
|
1541
|
+
const [loadingType, setLoadingType] = React19.useState(null);
|
|
1199
1542
|
const validateEmail = (email) => {
|
|
1200
1543
|
const emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
|
|
1201
1544
|
if (!email) {
|
|
@@ -1257,318 +1600,183 @@ var Auth = ({
|
|
|
1257
1600
|
};
|
|
1258
1601
|
const infoSections = [
|
|
1259
1602
|
{
|
|
1260
|
-
icon: /* @__PURE__ */
|
|
1603
|
+
icon: /* @__PURE__ */ React19.createElement(LinkIcon, { size: 20, color: theme.colors.primary }),
|
|
1261
1604
|
title: "Simple and secure",
|
|
1262
|
-
text: "
|
|
1605
|
+
text: "Link your accounts in just a few clicks"
|
|
1263
1606
|
},
|
|
1264
1607
|
{
|
|
1265
|
-
icon: /* @__PURE__ */
|
|
1608
|
+
icon: /* @__PURE__ */ React19.createElement(ShieldIcon, { size: 20, color: theme.colors.primary }),
|
|
1266
1609
|
title: "Control what you share",
|
|
1267
1610
|
text: "We never share your data without your permission"
|
|
1611
|
+
},
|
|
1612
|
+
{
|
|
1613
|
+
icon: /* @__PURE__ */ React19.createElement(EyeIcon, { size: 20, color: theme.colors.primary }),
|
|
1614
|
+
title: "View Only Access",
|
|
1615
|
+
text: "Kryptos retrieves view-only data and cannot perform any transactions on your behalf."
|
|
1268
1616
|
}
|
|
1269
1617
|
];
|
|
1270
|
-
return /* @__PURE__ */
|
|
1271
|
-
|
|
1618
|
+
return /* @__PURE__ */ React19.createElement(Modal, { isOpen: open, onClose: handleClose, size: "full" }, /* @__PURE__ */ React19.createElement(ModalHeader, { onClose: handleClose }, ""), /* @__PURE__ */ React19.createElement(ModalBody, null, /* @__PURE__ */ React19.createElement(View11, { style: styles11.container }, /* @__PURE__ */ React19.createElement(View11, { style: styles11.header }, /* @__PURE__ */ React19.createElement(Text9, { style: [styles11.title, { color: theme.colors.text }] }, "Link your accounts to", " ", /* @__PURE__ */ React19.createElement(Text9, { style: { fontWeight: "700" } }, appName), " using Kryptos"), /* @__PURE__ */ React19.createElement(ConnectLogo, null), infoSections.map((section, index) => /* @__PURE__ */ React19.createElement(View11, { key: `info-${index}`, style: styles11.infoSection }, /* @__PURE__ */ React19.createElement(View11, { style: styles11.infoIcon }, section.icon), /* @__PURE__ */ React19.createElement(View11, { style: styles11.infoContent }, /* @__PURE__ */ React19.createElement(
|
|
1619
|
+
Text9,
|
|
1620
|
+
{
|
|
1621
|
+
style: [styles11.infoTitle, { color: theme.colors.text }]
|
|
1622
|
+
},
|
|
1623
|
+
section.title
|
|
1624
|
+
), /* @__PURE__ */ React19.createElement(
|
|
1625
|
+
Text9,
|
|
1272
1626
|
{
|
|
1273
1627
|
style: [
|
|
1274
|
-
|
|
1628
|
+
styles11.infoDescription,
|
|
1275
1629
|
{ color: theme.colors.textSecondary }
|
|
1276
1630
|
]
|
|
1277
1631
|
},
|
|
1278
1632
|
section.text
|
|
1279
|
-
)))), errorMessage ? /* @__PURE__ */
|
|
1280
|
-
Input,
|
|
1281
|
-
{
|
|
1282
|
-
placeholder: "Enter email address",
|
|
1283
|
-
value: emailValue,
|
|
1284
|
-
onChangeText: (text) => {
|
|
1285
|
-
setEmailValue(text);
|
|
1286
|
-
if (emailError) validateEmail(text);
|
|
1287
|
-
},
|
|
1288
|
-
error: emailError,
|
|
1289
|
-
keyboardType: "email-address",
|
|
1290
|
-
autoCapitalize: "none",
|
|
1291
|
-
autoCorrect: false
|
|
1292
|
-
}
|
|
1293
|
-
), /* @__PURE__ */ React13.createElement(Alert, { variant: "default" }, /* @__PURE__ */ React13.createElement(AlertDescription, null, "Sign in or create your Kryptos account with your email for quicker access next time.")), /* @__PURE__ */ React13.createElement(
|
|
1633
|
+
)))), errorMessage ? /* @__PURE__ */ React19.createElement(Alert, { variant: "destructive" }, /* @__PURE__ */ React19.createElement(AlertDescription, null, errorMessage)) : null), /* @__PURE__ */ React19.createElement(View11, { style: styles11.footer }, /* @__PURE__ */ React19.createElement(
|
|
1294
1634
|
Button,
|
|
1295
1635
|
{
|
|
1296
1636
|
variant: "outline",
|
|
1297
1637
|
size: "lg",
|
|
1298
|
-
onPress:
|
|
1299
|
-
loading: loadingType === "
|
|
1638
|
+
onPress: handleContinueAsGuest,
|
|
1639
|
+
loading: loadingType === "guest",
|
|
1300
1640
|
disabled: isLoading,
|
|
1301
|
-
style:
|
|
1641
|
+
style: styles11.button
|
|
1302
1642
|
},
|
|
1303
1643
|
"Continue"
|
|
1304
|
-
), /* @__PURE__ */
|
|
1305
|
-
|
|
1306
|
-
{
|
|
1307
|
-
style: {
|
|
1308
|
-
color: theme.colors.primary,
|
|
1309
|
-
textDecorationLine: "underline"
|
|
1310
|
-
}
|
|
1311
|
-
},
|
|
1312
|
-
"Privacy Policy"
|
|
1313
|
-
)), /* @__PURE__ */ React13.createElement(
|
|
1314
|
-
Button,
|
|
1644
|
+
), /* @__PURE__ */ React19.createElement(
|
|
1645
|
+
Text9,
|
|
1315
1646
|
{
|
|
1316
|
-
|
|
1317
|
-
size: "lg",
|
|
1318
|
-
onPress: handleContinueAsGuest,
|
|
1319
|
-
loading: loadingType === "guest",
|
|
1320
|
-
disabled: isLoading,
|
|
1321
|
-
style: styles6.button
|
|
1647
|
+
style: [styles11.footerText, { color: theme.colors.textSecondary }]
|
|
1322
1648
|
},
|
|
1323
|
-
"
|
|
1324
|
-
|
|
1649
|
+
"By continuing, you agree to Kryptos",
|
|
1650
|
+
" ",
|
|
1651
|
+
/* @__PURE__ */ React19.createElement(
|
|
1652
|
+
Text9,
|
|
1653
|
+
{
|
|
1654
|
+
style: {
|
|
1655
|
+
color: theme.colors.primary,
|
|
1656
|
+
textDecorationLine: "underline"
|
|
1657
|
+
},
|
|
1658
|
+
onPress: () => Linking2.openURL("https://kryptos.io/privacy-policy")
|
|
1659
|
+
},
|
|
1660
|
+
"Privacy Policy"
|
|
1661
|
+
),
|
|
1662
|
+
" ",
|
|
1663
|
+
"and",
|
|
1664
|
+
" ",
|
|
1665
|
+
/* @__PURE__ */ React19.createElement(
|
|
1666
|
+
Text9,
|
|
1667
|
+
{
|
|
1668
|
+
style: {
|
|
1669
|
+
color: theme.colors.primary,
|
|
1670
|
+
textDecorationLine: "underline"
|
|
1671
|
+
},
|
|
1672
|
+
onPress: () => Linking2.openURL("https://kryptos.io/terms-of-services")
|
|
1673
|
+
},
|
|
1674
|
+
"Terms of Service"
|
|
1675
|
+
)
|
|
1676
|
+
)))), /* @__PURE__ */ React19.createElement(ModalFooter, { style: { paddingVertical: 0 } }, /* @__PURE__ */ React19.createElement(Footer, null)));
|
|
1325
1677
|
};
|
|
1326
|
-
var
|
|
1678
|
+
var styles11 = StyleSheet11.create({
|
|
1327
1679
|
container: {
|
|
1328
|
-
flex: 1
|
|
1680
|
+
flex: 1,
|
|
1681
|
+
flexDirection: "column",
|
|
1682
|
+
justifyContent: "space-between"
|
|
1683
|
+
},
|
|
1684
|
+
header: {
|
|
1685
|
+
flex: 1,
|
|
1686
|
+
gap: 8
|
|
1687
|
+
},
|
|
1688
|
+
footer: {
|
|
1689
|
+
flex: 1,
|
|
1690
|
+
justifyContent: "flex-end",
|
|
1691
|
+
gap: 8
|
|
1329
1692
|
},
|
|
1330
1693
|
title: {
|
|
1331
1694
|
fontSize: 18,
|
|
1332
1695
|
// theme.fontSize.xl
|
|
1333
|
-
fontWeight: "
|
|
1334
|
-
textAlign: "center"
|
|
1335
|
-
marginBottom: 16
|
|
1336
|
-
// theme.spacing.lg - consistent section spacing
|
|
1696
|
+
fontWeight: "500",
|
|
1697
|
+
textAlign: "center"
|
|
1337
1698
|
},
|
|
1338
1699
|
infoSection: {
|
|
1339
1700
|
flexDirection: "row",
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1701
|
+
alignItems: "flex-start",
|
|
1702
|
+
padding: 8,
|
|
1703
|
+
gap: 12
|
|
1343
1704
|
},
|
|
1344
1705
|
infoIcon: {
|
|
1345
1706
|
width: 32,
|
|
1707
|
+
// theme.spacing.xxxl
|
|
1346
1708
|
height: 32,
|
|
1709
|
+
// theme.spacing.xxxl
|
|
1347
1710
|
borderRadius: 16,
|
|
1348
1711
|
// theme.borderRadius.lg
|
|
1349
1712
|
alignItems: "center",
|
|
1350
|
-
justifyContent: "center"
|
|
1351
|
-
marginRight: 12
|
|
1352
|
-
// theme.spacing.md
|
|
1713
|
+
justifyContent: "center"
|
|
1353
1714
|
},
|
|
1354
1715
|
infoContent: {
|
|
1355
|
-
flex: 1
|
|
1356
|
-
|
|
1357
|
-
infoTitle: {
|
|
1358
|
-
fontSize: 14,
|
|
1359
|
-
// theme.fontSize.md
|
|
1360
|
-
fontWeight: "600",
|
|
1361
|
-
marginBottom: 4
|
|
1362
|
-
// theme.spacing.xs
|
|
1363
|
-
},
|
|
1364
|
-
infoDescription: {
|
|
1365
|
-
fontSize: 13,
|
|
1366
|
-
lineHeight: 18
|
|
1367
|
-
},
|
|
1368
|
-
button: {
|
|
1369
|
-
width: "100%",
|
|
1370
|
-
marginTop: 16
|
|
1371
|
-
// theme.spacing.lg - consistent button spacing
|
|
1372
|
-
},
|
|
1373
|
-
footer: {
|
|
1374
|
-
fontSize: 12,
|
|
1375
|
-
// theme.fontSize.sm
|
|
1376
|
-
textAlign: "center",
|
|
1377
|
-
marginTop: 16
|
|
1378
|
-
// theme.spacing.lg
|
|
1379
|
-
}
|
|
1380
|
-
});
|
|
1381
|
-
|
|
1382
|
-
// src/components/OTP.tsx
|
|
1383
|
-
import React14 from "react";
|
|
1384
|
-
import {
|
|
1385
|
-
View as View7,
|
|
1386
|
-
TextInput as TextInput2,
|
|
1387
|
-
Text as Text7,
|
|
1388
|
-
StyleSheet as StyleSheet7
|
|
1389
|
-
} from "react-native";
|
|
1390
|
-
var OTP = ({
|
|
1391
|
-
length = 6,
|
|
1392
|
-
value = "",
|
|
1393
|
-
onChange,
|
|
1394
|
-
onComplete,
|
|
1395
|
-
error,
|
|
1396
|
-
label,
|
|
1397
|
-
disabled = false,
|
|
1398
|
-
containerStyle,
|
|
1399
|
-
inputStyle,
|
|
1400
|
-
setErrorMessage
|
|
1401
|
-
}) => {
|
|
1402
|
-
const theme = useTheme();
|
|
1403
|
-
const AUTO_SUBMIT_DELAY = 500;
|
|
1404
|
-
const [otp, setOtp] = React14.useState(
|
|
1405
|
-
value.split("").concat(Array(length).fill("")).slice(0, length)
|
|
1406
|
-
);
|
|
1407
|
-
const inputRefs = React14.useRef([]);
|
|
1408
|
-
React14.useEffect(() => {
|
|
1409
|
-
const isComplete = otp.every((digit) => digit !== "");
|
|
1410
|
-
let timer;
|
|
1411
|
-
if (isComplete && onComplete) {
|
|
1412
|
-
timer = setTimeout(() => {
|
|
1413
|
-
onComplete(otp.join(""));
|
|
1414
|
-
}, AUTO_SUBMIT_DELAY);
|
|
1415
|
-
}
|
|
1416
|
-
return () => {
|
|
1417
|
-
if (timer) clearTimeout(timer);
|
|
1418
|
-
};
|
|
1419
|
-
}, [otp, onComplete]);
|
|
1420
|
-
React14.useEffect(() => {
|
|
1421
|
-
setTimeout(() => {
|
|
1422
|
-
inputRefs.current[0]?.focus();
|
|
1423
|
-
}, 100);
|
|
1424
|
-
}, []);
|
|
1425
|
-
const handleChange = React14.useCallback(
|
|
1426
|
-
(index, val) => {
|
|
1427
|
-
if (disabled) return;
|
|
1428
|
-
setErrorMessage("");
|
|
1429
|
-
const numericValue = val.replace(/[^0-9]/g, "");
|
|
1430
|
-
const newValue = numericValue.slice(-1);
|
|
1431
|
-
if (val && !numericValue) {
|
|
1432
|
-
return;
|
|
1433
|
-
}
|
|
1434
|
-
const newOtp = [...otp];
|
|
1435
|
-
newOtp[index] = newValue;
|
|
1436
|
-
setOtp(newOtp);
|
|
1437
|
-
const otpString = newOtp.join("");
|
|
1438
|
-
onChange?.(otpString);
|
|
1439
|
-
if (newValue && index < length - 1) {
|
|
1440
|
-
inputRefs.current[index + 1]?.focus();
|
|
1441
|
-
}
|
|
1442
|
-
if (otpString.length === length && !otpString.includes("")) {
|
|
1443
|
-
onComplete?.(otpString);
|
|
1444
|
-
}
|
|
1445
|
-
},
|
|
1446
|
-
[otp, length, onChange, onComplete, disabled]
|
|
1447
|
-
);
|
|
1448
|
-
const handleKeyPress = React14.useCallback(
|
|
1449
|
-
(index, e) => {
|
|
1450
|
-
if (disabled) return;
|
|
1451
|
-
if (e.nativeEvent.key === "Backspace") {
|
|
1452
|
-
if (!otp[index] && index > 0) {
|
|
1453
|
-
inputRefs.current[index - 1]?.focus();
|
|
1454
|
-
} else {
|
|
1455
|
-
const newOtp = [...otp];
|
|
1456
|
-
newOtp[index] = "";
|
|
1457
|
-
setOtp(newOtp);
|
|
1458
|
-
onChange?.(newOtp.join(""));
|
|
1459
|
-
}
|
|
1460
|
-
}
|
|
1461
|
-
},
|
|
1462
|
-
[otp, onChange, disabled]
|
|
1463
|
-
);
|
|
1464
|
-
const getBorderColor = (index) => {
|
|
1465
|
-
if (error) return theme.colors.error;
|
|
1466
|
-
if (otp[index]) return theme.colors.success;
|
|
1467
|
-
return theme.colors.border;
|
|
1468
|
-
};
|
|
1469
|
-
return /* @__PURE__ */ React14.createElement(View7, { style: [styles7.wrapper, containerStyle] }, label && /* @__PURE__ */ React14.createElement(
|
|
1470
|
-
Text7,
|
|
1471
|
-
{
|
|
1472
|
-
style: [
|
|
1473
|
-
styles7.label,
|
|
1474
|
-
{ color: theme.colors.text, fontSize: theme.fontSize.sm }
|
|
1475
|
-
]
|
|
1476
|
-
},
|
|
1477
|
-
label
|
|
1478
|
-
), /* @__PURE__ */ React14.createElement(View7, { style: styles7.container }, Array.from({ length }, (_, index) => /* @__PURE__ */ React14.createElement(
|
|
1479
|
-
TextInput2,
|
|
1480
|
-
{
|
|
1481
|
-
key: index,
|
|
1482
|
-
ref: (el) => inputRefs.current[index] = el,
|
|
1483
|
-
style: [
|
|
1484
|
-
styles7.input,
|
|
1485
|
-
{
|
|
1486
|
-
backgroundColor: theme.colors.surface,
|
|
1487
|
-
borderColor: getBorderColor(index),
|
|
1488
|
-
color: theme.colors.text,
|
|
1489
|
-
fontSize: theme.fontSize.xxl,
|
|
1490
|
-
borderRadius: theme.borderRadius.md
|
|
1491
|
-
},
|
|
1492
|
-
inputStyle
|
|
1493
|
-
],
|
|
1494
|
-
keyboardType: "numeric",
|
|
1495
|
-
maxLength: 1,
|
|
1496
|
-
value: otp[index] || "",
|
|
1497
|
-
onChangeText: (val) => handleChange(index, val),
|
|
1498
|
-
onKeyPress: (e) => handleKeyPress(index, e),
|
|
1499
|
-
editable: !disabled,
|
|
1500
|
-
selectTextOnFocus: true,
|
|
1501
|
-
caretHidden: true
|
|
1502
|
-
}
|
|
1503
|
-
))), error && /* @__PURE__ */ React14.createElement(
|
|
1504
|
-
Text7,
|
|
1505
|
-
{
|
|
1506
|
-
style: [
|
|
1507
|
-
styles7.error,
|
|
1508
|
-
{ color: theme.colors.error, fontSize: theme.fontSize.sm }
|
|
1509
|
-
]
|
|
1510
|
-
},
|
|
1511
|
-
error
|
|
1512
|
-
));
|
|
1513
|
-
};
|
|
1514
|
-
var styles7 = StyleSheet7.create({
|
|
1515
|
-
wrapper: {
|
|
1516
|
-
marginBottom: 16
|
|
1517
|
-
// theme.spacing.lg
|
|
1518
|
-
},
|
|
1519
|
-
label: {
|
|
1520
|
-
fontWeight: "500",
|
|
1521
|
-
marginBottom: 12,
|
|
1522
|
-
// theme.spacing.md - consistent label spacing
|
|
1523
|
-
textAlign: "center"
|
|
1524
|
-
},
|
|
1525
|
-
container: {
|
|
1526
|
-
flexDirection: "row",
|
|
1527
|
-
justifyContent: "center",
|
|
1528
|
-
gap: 8
|
|
1529
|
-
// theme.spacing.sm
|
|
1716
|
+
flex: 1,
|
|
1717
|
+
gap: 4
|
|
1530
1718
|
},
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
borderWidth: 1,
|
|
1535
|
-
textAlign: "center",
|
|
1719
|
+
infoTitle: {
|
|
1720
|
+
fontSize: 14,
|
|
1721
|
+
// theme.fontSize.md
|
|
1536
1722
|
fontWeight: "600"
|
|
1537
1723
|
},
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
// theme.
|
|
1541
|
-
|
|
1724
|
+
infoDescription: {
|
|
1725
|
+
fontSize: 13,
|
|
1726
|
+
// theme.fontSize.sm + 1
|
|
1727
|
+
lineHeight: 18
|
|
1728
|
+
},
|
|
1729
|
+
button: {
|
|
1730
|
+
width: "100%"
|
|
1731
|
+
},
|
|
1732
|
+
footerText: {
|
|
1733
|
+
fontSize: 12,
|
|
1734
|
+
// theme.fontSize.sm
|
|
1735
|
+
textAlign: "center",
|
|
1736
|
+
padding: 8,
|
|
1737
|
+
maxWidth: "80%",
|
|
1738
|
+
alignSelf: "center"
|
|
1542
1739
|
}
|
|
1543
1740
|
});
|
|
1544
1741
|
|
|
1545
1742
|
// src/molecules/Init.tsx
|
|
1546
|
-
import
|
|
1547
|
-
import { ActivityIndicator as ActivityIndicator2, StyleSheet as
|
|
1743
|
+
import React20 from "react";
|
|
1744
|
+
import { ActivityIndicator as ActivityIndicator2, StyleSheet as StyleSheet12, Text as Text10, View as View12 } from "react-native";
|
|
1548
1745
|
var Init = ({
|
|
1549
1746
|
open,
|
|
1550
1747
|
onSuccess,
|
|
1551
1748
|
onClose,
|
|
1552
1749
|
generateLinkToken
|
|
1553
1750
|
}) => {
|
|
1554
|
-
const {
|
|
1751
|
+
const {
|
|
1752
|
+
setIsInitialized,
|
|
1753
|
+
isInitialized,
|
|
1754
|
+
setLinkToken,
|
|
1755
|
+
setIsAuthorized,
|
|
1756
|
+
setUser
|
|
1757
|
+
} = useKryptosConnect();
|
|
1555
1758
|
const theme = useTheme();
|
|
1556
|
-
const [isFetching, setIsFetching] =
|
|
1557
|
-
const [error, setError] =
|
|
1558
|
-
const fetchLinkToken =
|
|
1759
|
+
const [isFetching, setIsFetching] = React20.useState(false);
|
|
1760
|
+
const [error, setError] = React20.useState(null);
|
|
1761
|
+
const fetchLinkToken = React20.useCallback(async () => {
|
|
1559
1762
|
if (!open) return;
|
|
1560
1763
|
setIsFetching(true);
|
|
1561
1764
|
setError(null);
|
|
1562
1765
|
try {
|
|
1563
1766
|
const linkToken = await generateLinkToken();
|
|
1564
|
-
if (!linkToken) {
|
|
1767
|
+
if (!linkToken || !linkToken?.link_token || linkToken.link_token === "" || linkToken.link_token === null || linkToken.link_token === void 0) {
|
|
1565
1768
|
setIsInitialized(false);
|
|
1566
1769
|
setError("Failed to fetch link token. Please try again.");
|
|
1567
1770
|
return;
|
|
1568
1771
|
}
|
|
1569
|
-
setLinkToken(linkToken);
|
|
1772
|
+
setLinkToken(linkToken.link_token);
|
|
1570
1773
|
setIsInitialized(true);
|
|
1571
|
-
|
|
1774
|
+
setIsAuthorized(linkToken.isAuthorized || false);
|
|
1775
|
+
if (linkToken.isAuthorized) {
|
|
1776
|
+
const userInfo = await getUserInfo(linkToken.link_token);
|
|
1777
|
+
setUser(userInfo);
|
|
1778
|
+
}
|
|
1779
|
+
onSuccess(linkToken.isAuthorized ? { isAuthorized: true } : null);
|
|
1572
1780
|
} catch (err) {
|
|
1573
1781
|
console.error("Failed to fetch link token:", err);
|
|
1574
1782
|
setIsInitialized(false);
|
|
@@ -1576,29 +1784,29 @@ var Init = ({
|
|
|
1576
1784
|
} finally {
|
|
1577
1785
|
setIsFetching(false);
|
|
1578
1786
|
}
|
|
1579
|
-
}, [
|
|
1580
|
-
|
|
1787
|
+
}, []);
|
|
1788
|
+
React20.useEffect(() => {
|
|
1581
1789
|
fetchLinkToken();
|
|
1582
1790
|
}, [fetchLinkToken]);
|
|
1583
|
-
return /* @__PURE__ */
|
|
1791
|
+
return /* @__PURE__ */ React20.createElement(Modal, { isOpen: open, onClose, size: "xs" }, /* @__PURE__ */ React20.createElement(ModalHeader, { onClose }, "Kryptos Connect"), /* @__PURE__ */ React20.createElement(ModalBody, null, /* @__PURE__ */ React20.createElement(View12, { style: styles12.container }, isFetching && /* @__PURE__ */ React20.createElement(React20.Fragment, null, /* @__PURE__ */ React20.createElement(
|
|
1584
1792
|
ActivityIndicator2,
|
|
1585
1793
|
{
|
|
1586
1794
|
size: "large",
|
|
1587
1795
|
color: theme.colors.primary,
|
|
1588
|
-
style:
|
|
1796
|
+
style: styles12.spinner
|
|
1589
1797
|
}
|
|
1590
|
-
), /* @__PURE__ */
|
|
1798
|
+
), /* @__PURE__ */ React20.createElement(Text10, { style: [styles12.message, { color: theme.colors.text }] }, isInitialized ? "Fetching link token..." : "Initializing...")), !isFetching && error && /* @__PURE__ */ React20.createElement(React20.Fragment, null, /* @__PURE__ */ React20.createElement(Alert, { variant: "destructive" }, /* @__PURE__ */ React20.createElement(AlertDescription, null, error)), /* @__PURE__ */ React20.createElement(
|
|
1591
1799
|
Button,
|
|
1592
1800
|
{
|
|
1593
1801
|
variant: "primary",
|
|
1594
1802
|
size: "lg",
|
|
1595
1803
|
onPress: fetchLinkToken,
|
|
1596
|
-
style:
|
|
1804
|
+
style: styles12.retryButton
|
|
1597
1805
|
},
|
|
1598
1806
|
"Retry"
|
|
1599
|
-
)))));
|
|
1807
|
+
)))), /* @__PURE__ */ React20.createElement(ModalFooter, { style: { paddingVertical: 0 } }, /* @__PURE__ */ React20.createElement(Footer, null)));
|
|
1600
1808
|
};
|
|
1601
|
-
var
|
|
1809
|
+
var styles12 = StyleSheet12.create({
|
|
1602
1810
|
container: {
|
|
1603
1811
|
flex: 1,
|
|
1604
1812
|
alignItems: "center",
|
|
@@ -1625,25 +1833,25 @@ var styles8 = StyleSheet8.create({
|
|
|
1625
1833
|
});
|
|
1626
1834
|
|
|
1627
1835
|
// src/molecules/Integration.tsx
|
|
1628
|
-
import
|
|
1836
|
+
import React31 from "react";
|
|
1629
1837
|
import {
|
|
1630
1838
|
FlatList,
|
|
1631
1839
|
Image as Image3,
|
|
1632
|
-
StyleSheet as
|
|
1633
|
-
Text as
|
|
1634
|
-
TouchableOpacity as
|
|
1635
|
-
View as
|
|
1840
|
+
StyleSheet as StyleSheet15,
|
|
1841
|
+
Text as Text13,
|
|
1842
|
+
TouchableOpacity as TouchableOpacity6,
|
|
1843
|
+
View as View15
|
|
1636
1844
|
} from "react-native";
|
|
1637
1845
|
|
|
1638
1846
|
// src/assets/ArrowLeftIcon.tsx
|
|
1639
|
-
import
|
|
1640
|
-
import
|
|
1847
|
+
import React21 from "react";
|
|
1848
|
+
import Svg7, { Path as Path7 } from "react-native-svg";
|
|
1641
1849
|
var ArrowLeftIcon = ({
|
|
1642
1850
|
size = 20,
|
|
1643
1851
|
color = "#000"
|
|
1644
1852
|
}) => {
|
|
1645
|
-
return /* @__PURE__ */
|
|
1646
|
-
|
|
1853
|
+
return /* @__PURE__ */ React21.createElement(Svg7, { width: size, height: size, viewBox: "0 0 24 24", fill: "none" }, /* @__PURE__ */ React21.createElement(
|
|
1854
|
+
Path7,
|
|
1647
1855
|
{
|
|
1648
1856
|
d: "M19 12H5M12 19l-7-7 7-7",
|
|
1649
1857
|
stroke: color,
|
|
@@ -1655,13 +1863,13 @@ var ArrowLeftIcon = ({
|
|
|
1655
1863
|
};
|
|
1656
1864
|
|
|
1657
1865
|
// src/assets/CheckCircleIcon.tsx
|
|
1658
|
-
import
|
|
1659
|
-
import
|
|
1866
|
+
import React22 from "react";
|
|
1867
|
+
import Svg8, { Path as Path8, Circle } from "react-native-svg";
|
|
1660
1868
|
var CheckCircleIcon = ({
|
|
1661
1869
|
size = 20,
|
|
1662
1870
|
color = "#10B981"
|
|
1663
1871
|
}) => {
|
|
1664
|
-
return /* @__PURE__ */
|
|
1872
|
+
return /* @__PURE__ */ React22.createElement(Svg8, { width: size, height: size, viewBox: "0 0 24 24", fill: "none" }, /* @__PURE__ */ React22.createElement(
|
|
1665
1873
|
Circle,
|
|
1666
1874
|
{
|
|
1667
1875
|
cx: 12,
|
|
@@ -1670,8 +1878,8 @@ var CheckCircleIcon = ({
|
|
|
1670
1878
|
stroke: color,
|
|
1671
1879
|
strokeWidth: 2
|
|
1672
1880
|
}
|
|
1673
|
-
), /* @__PURE__ */
|
|
1674
|
-
|
|
1881
|
+
), /* @__PURE__ */ React22.createElement(
|
|
1882
|
+
Path8,
|
|
1675
1883
|
{
|
|
1676
1884
|
d: "m9 12 2 2 4-4",
|
|
1677
1885
|
stroke: color,
|
|
@@ -1683,18 +1891,18 @@ var CheckCircleIcon = ({
|
|
|
1683
1891
|
};
|
|
1684
1892
|
|
|
1685
1893
|
// src/assets/LoaderIcon.tsx
|
|
1686
|
-
import
|
|
1687
|
-
import { Animated, Easing } from "react-native";
|
|
1688
|
-
import
|
|
1689
|
-
var AnimatedSvg =
|
|
1894
|
+
import React23 from "react";
|
|
1895
|
+
import { Animated as Animated2, Easing } from "react-native";
|
|
1896
|
+
import Svg9, { Path as Path9 } from "react-native-svg";
|
|
1897
|
+
var AnimatedSvg = Animated2.createAnimatedComponent(Svg9);
|
|
1690
1898
|
var LoaderIcon = ({
|
|
1691
1899
|
size = 20,
|
|
1692
1900
|
color = "#00C693"
|
|
1693
1901
|
}) => {
|
|
1694
|
-
const rotateAnim =
|
|
1695
|
-
|
|
1696
|
-
|
|
1697
|
-
|
|
1902
|
+
const rotateAnim = React23.useRef(new Animated2.Value(0)).current;
|
|
1903
|
+
React23.useEffect(() => {
|
|
1904
|
+
Animated2.loop(
|
|
1905
|
+
Animated2.timing(rotateAnim, {
|
|
1698
1906
|
toValue: 1,
|
|
1699
1907
|
duration: 1e3,
|
|
1700
1908
|
easing: Easing.linear,
|
|
@@ -1706,7 +1914,7 @@ var LoaderIcon = ({
|
|
|
1706
1914
|
inputRange: [0, 1],
|
|
1707
1915
|
outputRange: ["0deg", "360deg"]
|
|
1708
1916
|
});
|
|
1709
|
-
return /* @__PURE__ */
|
|
1917
|
+
return /* @__PURE__ */ React23.createElement(
|
|
1710
1918
|
AnimatedSvg,
|
|
1711
1919
|
{
|
|
1712
1920
|
width: size,
|
|
@@ -1715,8 +1923,8 @@ var LoaderIcon = ({
|
|
|
1715
1923
|
fill: "none",
|
|
1716
1924
|
style: { transform: [{ rotate: spin }] }
|
|
1717
1925
|
},
|
|
1718
|
-
/* @__PURE__ */
|
|
1719
|
-
|
|
1926
|
+
/* @__PURE__ */ React23.createElement(
|
|
1927
|
+
Path9,
|
|
1720
1928
|
{
|
|
1721
1929
|
d: "M21 12a9 9 0 1 1-6.219-8.56",
|
|
1722
1930
|
stroke: color,
|
|
@@ -1729,10 +1937,10 @@ var LoaderIcon = ({
|
|
|
1729
1937
|
};
|
|
1730
1938
|
|
|
1731
1939
|
// src/assets/SuccessIcon.tsx
|
|
1732
|
-
import
|
|
1733
|
-
import
|
|
1940
|
+
import React24 from "react";
|
|
1941
|
+
import Svg10, { Circle as Circle2, Path as Path10 } from "react-native-svg";
|
|
1734
1942
|
var SuccessIcon = ({ size = 64 }) => {
|
|
1735
|
-
return /* @__PURE__ */
|
|
1943
|
+
return /* @__PURE__ */ React24.createElement(Svg10, { width: size, height: size, viewBox: "0 0 64 64", fill: "none" }, /* @__PURE__ */ React24.createElement(
|
|
1736
1944
|
Circle2,
|
|
1737
1945
|
{
|
|
1738
1946
|
cx: 32,
|
|
@@ -1741,7 +1949,7 @@ var SuccessIcon = ({ size = 64 }) => {
|
|
|
1741
1949
|
fill: "#00C693",
|
|
1742
1950
|
opacity: 0.1
|
|
1743
1951
|
}
|
|
1744
|
-
), /* @__PURE__ */
|
|
1952
|
+
), /* @__PURE__ */ React24.createElement(
|
|
1745
1953
|
Circle2,
|
|
1746
1954
|
{
|
|
1747
1955
|
cx: 32,
|
|
@@ -1749,8 +1957,8 @@ var SuccessIcon = ({ size = 64 }) => {
|
|
|
1749
1957
|
r: 24,
|
|
1750
1958
|
fill: "#00C693"
|
|
1751
1959
|
}
|
|
1752
|
-
), /* @__PURE__ */
|
|
1753
|
-
|
|
1960
|
+
), /* @__PURE__ */ React24.createElement(
|
|
1961
|
+
Path10,
|
|
1754
1962
|
{
|
|
1755
1963
|
d: "M24 32l6 6 12-12",
|
|
1756
1964
|
stroke: "white",
|
|
@@ -1762,10 +1970,10 @@ var SuccessIcon = ({ size = 64 }) => {
|
|
|
1762
1970
|
};
|
|
1763
1971
|
|
|
1764
1972
|
// src/assets/ErrorIcon.tsx
|
|
1765
|
-
import
|
|
1766
|
-
import
|
|
1973
|
+
import React25 from "react";
|
|
1974
|
+
import Svg11, { Circle as Circle3, Path as Path11 } from "react-native-svg";
|
|
1767
1975
|
var ErrorIcon = ({ size = 64 }) => {
|
|
1768
|
-
return /* @__PURE__ */
|
|
1976
|
+
return /* @__PURE__ */ React25.createElement(Svg11, { width: size, height: size, viewBox: "0 0 64 64", fill: "none" }, /* @__PURE__ */ React25.createElement(
|
|
1769
1977
|
Circle3,
|
|
1770
1978
|
{
|
|
1771
1979
|
cx: 32,
|
|
@@ -1774,7 +1982,7 @@ var ErrorIcon = ({ size = 64 }) => {
|
|
|
1774
1982
|
fill: "#EF4444",
|
|
1775
1983
|
opacity: 0.1
|
|
1776
1984
|
}
|
|
1777
|
-
), /* @__PURE__ */
|
|
1985
|
+
), /* @__PURE__ */ React25.createElement(
|
|
1778
1986
|
Circle3,
|
|
1779
1987
|
{
|
|
1780
1988
|
cx: 32,
|
|
@@ -1782,8 +1990,8 @@ var ErrorIcon = ({ size = 64 }) => {
|
|
|
1782
1990
|
r: 24,
|
|
1783
1991
|
fill: "#EF4444"
|
|
1784
1992
|
}
|
|
1785
|
-
), /* @__PURE__ */
|
|
1786
|
-
|
|
1993
|
+
), /* @__PURE__ */ React25.createElement(
|
|
1994
|
+
Path11,
|
|
1787
1995
|
{
|
|
1788
1996
|
d: "M24 24l16 16M40 24l-16 16",
|
|
1789
1997
|
stroke: "white",
|
|
@@ -1795,18 +2003,18 @@ var ErrorIcon = ({ size = 64 }) => {
|
|
|
1795
2003
|
};
|
|
1796
2004
|
|
|
1797
2005
|
// src/assets/SearchIcon.tsx
|
|
1798
|
-
import
|
|
1799
|
-
import
|
|
2006
|
+
import React26 from "react";
|
|
2007
|
+
import Svg12, { Circle as Circle4, Path as Path12 } from "react-native-svg";
|
|
1800
2008
|
|
|
1801
2009
|
// src/assets/PlusIcon.tsx
|
|
1802
|
-
import
|
|
1803
|
-
import
|
|
2010
|
+
import React27 from "react";
|
|
2011
|
+
import Svg13, { Path as Path13 } from "react-native-svg";
|
|
1804
2012
|
var PlusIcon = ({
|
|
1805
2013
|
size = 14,
|
|
1806
2014
|
color = "#6B7280"
|
|
1807
2015
|
}) => {
|
|
1808
|
-
return /* @__PURE__ */
|
|
1809
|
-
|
|
2016
|
+
return /* @__PURE__ */ React27.createElement(Svg13, { width: size, height: size, viewBox: "0 0 14 14", fill: "none" }, /* @__PURE__ */ React27.createElement(
|
|
2017
|
+
Path13,
|
|
1810
2018
|
{
|
|
1811
2019
|
d: "M7 3.5v7M3.5 7h7",
|
|
1812
2020
|
stroke: color,
|
|
@@ -1818,13 +2026,13 @@ var PlusIcon = ({
|
|
|
1818
2026
|
|
|
1819
2027
|
// src/wallet-connect/index.tsx
|
|
1820
2028
|
import { useAccount, useAppKit } from "@reown/appkit-react-native";
|
|
1821
|
-
import
|
|
2029
|
+
import React29, { useState } from "react";
|
|
1822
2030
|
import {
|
|
1823
2031
|
ScrollView as ScrollView2,
|
|
1824
|
-
StyleSheet as
|
|
1825
|
-
Text as
|
|
1826
|
-
TouchableOpacity as
|
|
1827
|
-
View as
|
|
2032
|
+
StyleSheet as StyleSheet13,
|
|
2033
|
+
Text as Text11,
|
|
2034
|
+
TouchableOpacity as TouchableOpacity4,
|
|
2035
|
+
View as View13
|
|
1828
2036
|
} from "react-native";
|
|
1829
2037
|
|
|
1830
2038
|
// src/utils/uuid.ts
|
|
@@ -1837,7 +2045,7 @@ function generateUUID() {
|
|
|
1837
2045
|
}
|
|
1838
2046
|
|
|
1839
2047
|
// src/wallet-connect/wallet-connect.tsx
|
|
1840
|
-
import
|
|
2048
|
+
import React28 from "react";
|
|
1841
2049
|
import { AppKit, AppKitProvider } from "@reown/appkit-react-native";
|
|
1842
2050
|
|
|
1843
2051
|
// src/wallet-connect/AppKitConfig.ts
|
|
@@ -1946,7 +2154,7 @@ var createAppKitInstance = (projectId) => {
|
|
|
1946
2154
|
// src/wallet-connect/wallet-connect.tsx
|
|
1947
2155
|
var WalletConnectWrapper = ({ children }) => {
|
|
1948
2156
|
const { walletConnectProjectId } = useKryptosConnect();
|
|
1949
|
-
const appKit =
|
|
2157
|
+
const appKit = React28.useMemo(() => {
|
|
1950
2158
|
if (!walletConnectProjectId) {
|
|
1951
2159
|
console.warn(
|
|
1952
2160
|
"walletConnectProjectId is missing in KryptosConnectProvider config"
|
|
@@ -1956,9 +2164,9 @@ var WalletConnectWrapper = ({ children }) => {
|
|
|
1956
2164
|
return createAppKitInstance(walletConnectProjectId);
|
|
1957
2165
|
}, [walletConnectProjectId]);
|
|
1958
2166
|
if (!appKit) {
|
|
1959
|
-
return /* @__PURE__ */
|
|
2167
|
+
return /* @__PURE__ */ React28.createElement(React28.Fragment, null, children);
|
|
1960
2168
|
}
|
|
1961
|
-
return /* @__PURE__ */
|
|
2169
|
+
return /* @__PURE__ */ React28.createElement(AppKitProvider, { instance: appKit }, /* @__PURE__ */ React28.createElement(AppKit, null), children);
|
|
1962
2170
|
};
|
|
1963
2171
|
var wallet_connect_default = WalletConnectWrapper;
|
|
1964
2172
|
|
|
@@ -1974,42 +2182,42 @@ var WalletConnectComponent = ({
|
|
|
1974
2182
|
const { walletConnectProjectId } = useKryptosConnect();
|
|
1975
2183
|
const theme = useTheme();
|
|
1976
2184
|
if (!walletConnectProjectId) {
|
|
1977
|
-
return /* @__PURE__ */
|
|
1978
|
-
|
|
2185
|
+
return /* @__PURE__ */ React29.createElement(Modal, { isOpen: modalOpen, onClose: handleClose, size: "full" }, /* @__PURE__ */ React29.createElement(ModalHeader, { onClose: handleClose }, /* @__PURE__ */ React29.createElement(View13, { style: styles13.headerContent }, /* @__PURE__ */ React29.createElement(
|
|
2186
|
+
TouchableOpacity4,
|
|
1979
2187
|
{
|
|
1980
2188
|
onPress: () => {
|
|
1981
2189
|
setAddIntegrationMode(null);
|
|
1982
2190
|
},
|
|
1983
|
-
style:
|
|
2191
|
+
style: styles13.backButton
|
|
1984
2192
|
},
|
|
1985
|
-
/* @__PURE__ */
|
|
1986
|
-
), /* @__PURE__ */
|
|
1987
|
-
|
|
2193
|
+
/* @__PURE__ */ React29.createElement(ArrowLeftIcon, { size: 20, color: theme.colors.text })
|
|
2194
|
+
), /* @__PURE__ */ React29.createElement(Text11, { style: [styles13.headerTitle, { color: theme.colors.text }] }, "Integration"))), /* @__PURE__ */ React29.createElement(ModalBody, { scrollable: false, style: styles13.contentContainer }, /* @__PURE__ */ React29.createElement(View13, { style: styles13.emptyState }, /* @__PURE__ */ React29.createElement(
|
|
2195
|
+
Text11,
|
|
1988
2196
|
{
|
|
1989
|
-
style: [
|
|
2197
|
+
style: [styles13.emptyStateTitle, { color: theme.colors.text }]
|
|
1990
2198
|
},
|
|
1991
2199
|
"WalletConnect is not configured"
|
|
1992
|
-
), /* @__PURE__ */
|
|
1993
|
-
|
|
2200
|
+
), /* @__PURE__ */ React29.createElement(
|
|
2201
|
+
Text11,
|
|
1994
2202
|
{
|
|
1995
2203
|
style: [
|
|
1996
|
-
|
|
2204
|
+
styles13.infoText,
|
|
1997
2205
|
{ color: theme.colors.textSecondary, textAlign: "center" }
|
|
1998
2206
|
]
|
|
1999
2207
|
},
|
|
2000
2208
|
"Please add a walletConnectProjectId to KryptosConnectProvider to enable wallet connections."
|
|
2001
|
-
), /* @__PURE__ */
|
|
2209
|
+
), /* @__PURE__ */ React29.createElement(
|
|
2002
2210
|
Button,
|
|
2003
2211
|
{
|
|
2004
2212
|
variant: "outline",
|
|
2005
2213
|
size: "sm",
|
|
2006
2214
|
onPress: () => setAddIntegrationMode(null),
|
|
2007
|
-
style:
|
|
2215
|
+
style: styles13.emptyStateButton
|
|
2008
2216
|
},
|
|
2009
2217
|
"Go back"
|
|
2010
2218
|
))));
|
|
2011
2219
|
}
|
|
2012
|
-
return /* @__PURE__ */
|
|
2220
|
+
return /* @__PURE__ */ React29.createElement(wallet_connect_default, null, /* @__PURE__ */ React29.createElement(
|
|
2013
2221
|
ConnectButton,
|
|
2014
2222
|
{
|
|
2015
2223
|
integration,
|
|
@@ -2071,7 +2279,7 @@ function ConnectButton({
|
|
|
2071
2279
|
source: integration.id,
|
|
2072
2280
|
credential: {
|
|
2073
2281
|
address,
|
|
2074
|
-
userId: user?.
|
|
2282
|
+
userId: user?.user_id || "0",
|
|
2075
2283
|
projectId: integration.projectId,
|
|
2076
2284
|
apiKey: "0",
|
|
2077
2285
|
secret: "0",
|
|
@@ -2090,7 +2298,7 @@ function ConnectButton({
|
|
|
2090
2298
|
);
|
|
2091
2299
|
results.forEach((result, index) => {
|
|
2092
2300
|
const { chain, walletId, alias } = walletTestsPayload[index];
|
|
2093
|
-
if (result.status === "fulfilled") {
|
|
2301
|
+
if (result.status === "fulfilled" && result.value?.valid) {
|
|
2094
2302
|
const data = {
|
|
2095
2303
|
alias,
|
|
2096
2304
|
exchange: integration.id.toLowerCase(),
|
|
@@ -2101,7 +2309,7 @@ function ConnectButton({
|
|
|
2101
2309
|
logo: integration.logo || null,
|
|
2102
2310
|
startTime: null,
|
|
2103
2311
|
endTime: null,
|
|
2104
|
-
uid: user?.
|
|
2312
|
+
uid: user?.user_id || "",
|
|
2105
2313
|
walletId,
|
|
2106
2314
|
clientMetadata: {
|
|
2107
2315
|
clientId,
|
|
@@ -2115,7 +2323,7 @@ function ConnectButton({
|
|
|
2115
2323
|
default_chain_logo: chain.logo || null,
|
|
2116
2324
|
type: integration.type,
|
|
2117
2325
|
isNftSupported: integration.isEvmWallet || integration.nftSupport || false,
|
|
2118
|
-
chainId: chain.chainId || chain.id,
|
|
2326
|
+
chainId: chain?.community_id || chain.chainId || chain.id,
|
|
2119
2327
|
address
|
|
2120
2328
|
};
|
|
2121
2329
|
integrationsToAdd.push(data);
|
|
@@ -2154,16 +2362,16 @@ function ConnectButton({
|
|
|
2154
2362
|
setChainErrors(newErrors);
|
|
2155
2363
|
}
|
|
2156
2364
|
};
|
|
2157
|
-
return /* @__PURE__ */
|
|
2158
|
-
|
|
2365
|
+
return /* @__PURE__ */ React29.createElement(Modal, { isOpen: modalOpen, onClose: handleClose, size: "full" }, /* @__PURE__ */ React29.createElement(ModalHeader, { onClose: handleClose }, /* @__PURE__ */ React29.createElement(View13, { style: styles13.headerContent }, /* @__PURE__ */ React29.createElement(
|
|
2366
|
+
TouchableOpacity4,
|
|
2159
2367
|
{
|
|
2160
2368
|
onPress: () => {
|
|
2161
2369
|
setAddIntegrationMode(null);
|
|
2162
2370
|
},
|
|
2163
|
-
style:
|
|
2371
|
+
style: styles13.backButton
|
|
2164
2372
|
},
|
|
2165
|
-
/* @__PURE__ */
|
|
2166
|
-
), /* @__PURE__ */
|
|
2373
|
+
/* @__PURE__ */ React29.createElement(ArrowLeftIcon, { size: 20, color: theme.colors.text })
|
|
2374
|
+
), /* @__PURE__ */ React29.createElement(Text11, { style: [styles13.headerTitle, { color: theme.colors.text }] }, "Integration"))), /* @__PURE__ */ React29.createElement(ModalBody, { scrollable: false, style: styles13.contentContainer }, !isConnected ? /* @__PURE__ */ React29.createElement(View13, null, /* @__PURE__ */ React29.createElement(Text11, { style: [styles13.infoText, { color: theme.colors.text }] }, "Connect your wallet to continue"), /* @__PURE__ */ React29.createElement(
|
|
2167
2375
|
Button,
|
|
2168
2376
|
{
|
|
2169
2377
|
variant: "primary",
|
|
@@ -2171,32 +2379,32 @@ function ConnectButton({
|
|
|
2171
2379
|
onPress: () => open({ view: "Connect" })
|
|
2172
2380
|
},
|
|
2173
2381
|
"Connect Wallet"
|
|
2174
|
-
)) : /* @__PURE__ */
|
|
2382
|
+
)) : /* @__PURE__ */ React29.createElement(View13, null, /* @__PURE__ */ React29.createElement(Text11, { style: [styles13.connectedTitle, { color: theme.colors.text }] }, "Wallet Connected"), /* @__PURE__ */ React29.createElement(Text11, { style: [styles13.connectedText, { color: theme.colors.text }] }, "Address: ", address), /* @__PURE__ */ React29.createElement(Text11, { style: [styles13.connectedText, { color: theme.colors.text }] }, "Chain: ", chainId), /* @__PURE__ */ React29.createElement(Button, { variant: "ghost", size: "sm", onPress: () => disconnect() }, "Disconnect Wallet"), userUsedChains.length > 0 && address && /* @__PURE__ */ React29.createElement(View13, { style: styles13.chainSelection }, /* @__PURE__ */ React29.createElement(Text11, { style: [styles13.chainTitle, { color: theme.colors.text }] }, "Select Chains to Add:"), /* @__PURE__ */ React29.createElement(ScrollView2, { contentContainerStyle: styles13.scrollViewContent }, /* @__PURE__ */ React29.createElement(View13, { style: styles13.chainChips }, userUsedChains.map((chain) => {
|
|
2175
2383
|
const isSelected = selectedChains.has(chain.id);
|
|
2176
2384
|
const hasError = chainErrors[chain.id];
|
|
2177
|
-
return /* @__PURE__ */
|
|
2178
|
-
|
|
2385
|
+
return /* @__PURE__ */ React29.createElement(
|
|
2386
|
+
TouchableOpacity4,
|
|
2179
2387
|
{
|
|
2180
2388
|
onPress: () => toggleChainSelection(chain.id),
|
|
2181
|
-
style:
|
|
2389
|
+
style: styles13.chainButton,
|
|
2182
2390
|
key: chain.id
|
|
2183
2391
|
},
|
|
2184
|
-
/* @__PURE__ */
|
|
2185
|
-
|
|
2392
|
+
/* @__PURE__ */ React29.createElement(
|
|
2393
|
+
View13,
|
|
2186
2394
|
{
|
|
2187
2395
|
style: [
|
|
2188
|
-
|
|
2396
|
+
styles13.chainChip,
|
|
2189
2397
|
{
|
|
2190
2398
|
backgroundColor: hasError ? theme.colors.errorLight : isSelected ? theme.colors.primary + "20" : theme.colors.surface,
|
|
2191
2399
|
borderColor: hasError ? theme.colors.error : isSelected ? theme.colors.primary : theme.colors.border
|
|
2192
2400
|
}
|
|
2193
2401
|
]
|
|
2194
2402
|
},
|
|
2195
|
-
/* @__PURE__ */
|
|
2196
|
-
|
|
2403
|
+
/* @__PURE__ */ React29.createElement(
|
|
2404
|
+
Text11,
|
|
2197
2405
|
{
|
|
2198
2406
|
style: [
|
|
2199
|
-
|
|
2407
|
+
styles13.chainName,
|
|
2200
2408
|
{
|
|
2201
2409
|
color: hasError ? theme.colors.error : isSelected ? theme.colors.primary : theme.colors.text
|
|
2202
2410
|
}
|
|
@@ -2204,13 +2412,13 @@ function ConnectButton({
|
|
|
2204
2412
|
},
|
|
2205
2413
|
chain.id
|
|
2206
2414
|
),
|
|
2207
|
-
isSelected ? /* @__PURE__ */
|
|
2415
|
+
isSelected ? /* @__PURE__ */ React29.createElement(
|
|
2208
2416
|
CloseIcon,
|
|
2209
2417
|
{
|
|
2210
2418
|
size: 12,
|
|
2211
2419
|
color: hasError ? theme.colors.error : theme.colors.primary
|
|
2212
2420
|
}
|
|
2213
|
-
) : /* @__PURE__ */
|
|
2421
|
+
) : /* @__PURE__ */ React29.createElement(
|
|
2214
2422
|
PlusIcon,
|
|
2215
2423
|
{
|
|
2216
2424
|
size: 12,
|
|
@@ -2219,11 +2427,11 @@ function ConnectButton({
|
|
|
2219
2427
|
)
|
|
2220
2428
|
)
|
|
2221
2429
|
);
|
|
2222
|
-
}))), Object.keys(chainErrors).length > 0 && /* @__PURE__ */
|
|
2223
|
-
|
|
2430
|
+
}))), Object.keys(chainErrors).length > 0 && /* @__PURE__ */ React29.createElement(View13, { style: styles13.chainErrorsContainer }, /* @__PURE__ */ React29.createElement(
|
|
2431
|
+
Text11,
|
|
2224
2432
|
{
|
|
2225
2433
|
style: [
|
|
2226
|
-
|
|
2434
|
+
styles13.chainErrorsTitle,
|
|
2227
2435
|
{ color: theme.colors.error }
|
|
2228
2436
|
]
|
|
2229
2437
|
},
|
|
@@ -2232,12 +2440,12 @@ function ConnectButton({
|
|
|
2232
2440
|
const chain = userUsedChains.find(
|
|
2233
2441
|
(c) => c.id === chainId2
|
|
2234
2442
|
);
|
|
2235
|
-
return /* @__PURE__ */
|
|
2236
|
-
|
|
2443
|
+
return /* @__PURE__ */ React29.createElement(
|
|
2444
|
+
Text11,
|
|
2237
2445
|
{
|
|
2238
2446
|
key: chainId2,
|
|
2239
2447
|
style: [
|
|
2240
|
-
|
|
2448
|
+
styles13.chainErrorItem,
|
|
2241
2449
|
{ color: theme.colors.error }
|
|
2242
2450
|
]
|
|
2243
2451
|
},
|
|
@@ -2246,7 +2454,7 @@ function ConnectButton({
|
|
|
2246
2454
|
": ",
|
|
2247
2455
|
error
|
|
2248
2456
|
);
|
|
2249
|
-
}))), errorMessage ? /* @__PURE__ */
|
|
2457
|
+
}))), errorMessage ? /* @__PURE__ */ React29.createElement(Alert, { variant: "destructive" }, /* @__PURE__ */ React29.createElement(AlertDescription, null, errorMessage)) : null)), userUsedChains.length > 0 && address && /* @__PURE__ */ React29.createElement(ModalFooter, { style: { paddingVertical: 8 } }, /* @__PURE__ */ React29.createElement(
|
|
2250
2458
|
Button,
|
|
2251
2459
|
{
|
|
2252
2460
|
variant: "outline",
|
|
@@ -2254,12 +2462,12 @@ function ConnectButton({
|
|
|
2254
2462
|
onPress: onSubmitWalletConnect,
|
|
2255
2463
|
loading: isLoading,
|
|
2256
2464
|
disabled: isLoading || !!address && userUsedChains.length > 0 && selectedChains.size === 0,
|
|
2257
|
-
style:
|
|
2465
|
+
style: styles13.button
|
|
2258
2466
|
},
|
|
2259
2467
|
selectedChains.size > 0 ? `Add ${selectedChains.size} Chain${selectedChains.size > 1 ? "s" : ""}` : "Add Integration"
|
|
2260
|
-
)));
|
|
2468
|
+
), /* @__PURE__ */ React29.createElement(Footer, null)));
|
|
2261
2469
|
}
|
|
2262
|
-
var
|
|
2470
|
+
var styles13 = StyleSheet13.create({
|
|
2263
2471
|
connectedTitle: { fontSize: 18, fontWeight: "600", marginBottom: 4 },
|
|
2264
2472
|
connectedText: { fontSize: 14, marginBottom: 4 },
|
|
2265
2473
|
infoText: {
|
|
@@ -2372,14 +2580,14 @@ var styles9 = StyleSheet9.create({
|
|
|
2372
2580
|
});
|
|
2373
2581
|
|
|
2374
2582
|
// src/molecules/IntegrationForm.tsx
|
|
2375
|
-
import
|
|
2583
|
+
import React30 from "react";
|
|
2376
2584
|
import {
|
|
2377
2585
|
Image as Image2,
|
|
2378
2586
|
ScrollView as ScrollView3,
|
|
2379
|
-
StyleSheet as
|
|
2380
|
-
Text as
|
|
2381
|
-
TouchableOpacity as
|
|
2382
|
-
View as
|
|
2587
|
+
StyleSheet as StyleSheet14,
|
|
2588
|
+
Text as Text12,
|
|
2589
|
+
TouchableOpacity as TouchableOpacity5,
|
|
2590
|
+
View as View14
|
|
2383
2591
|
} from "react-native";
|
|
2384
2592
|
var IntegrationForm = ({
|
|
2385
2593
|
metadata,
|
|
@@ -2390,27 +2598,35 @@ var IntegrationForm = ({
|
|
|
2390
2598
|
}) => {
|
|
2391
2599
|
const { clientId, linkToken, user } = useKryptosConnect();
|
|
2392
2600
|
const theme = useTheme();
|
|
2393
|
-
const [isLoading, setIsLoading] =
|
|
2394
|
-
const [
|
|
2395
|
-
const [
|
|
2601
|
+
const [isLoading, setIsLoading] = React30.useState(false);
|
|
2602
|
+
const [isFetchingChains, setIsFetchingChains] = React30.useState(false);
|
|
2603
|
+
const [userUsedChains, setUserUsedChains] = React30.useState([]);
|
|
2604
|
+
const [selectedChains, setSelectedChains] = React30.useState(
|
|
2396
2605
|
/* @__PURE__ */ new Set()
|
|
2397
2606
|
);
|
|
2398
|
-
const [chainErrors, setChainErrors] =
|
|
2607
|
+
const [chainErrors, setChainErrors] = React30.useState(
|
|
2399
2608
|
{}
|
|
2400
2609
|
);
|
|
2401
|
-
const [errorMessage, setErrorMessage] =
|
|
2402
|
-
const [formValues, setFormValues] =
|
|
2610
|
+
const [errorMessage, setErrorMessage] = React30.useState("");
|
|
2611
|
+
const [formValues, setFormValues] = React30.useState({
|
|
2403
2612
|
address: "",
|
|
2404
2613
|
account_name: "",
|
|
2405
2614
|
api_key: "",
|
|
2406
2615
|
secret_key: "",
|
|
2407
2616
|
password: ""
|
|
2408
2617
|
});
|
|
2409
|
-
const [formErrors, setFormErrors] =
|
|
2410
|
-
|
|
2411
|
-
|
|
2412
|
-
|
|
2618
|
+
const [formErrors, setFormErrors] = React30.useState({});
|
|
2619
|
+
React30.useEffect(() => {
|
|
2620
|
+
if (!formValues.address || !formValues.address.trim()) {
|
|
2621
|
+
setUserUsedChains([]);
|
|
2622
|
+
setSelectedChains(/* @__PURE__ */ new Set());
|
|
2623
|
+
setIsFetchingChains(false);
|
|
2624
|
+
return;
|
|
2625
|
+
}
|
|
2626
|
+
const debounceTimer = setTimeout(async () => {
|
|
2627
|
+
if (linkToken && formValues.address && formValues.address.trim() && metadata.isEvmWallet) {
|
|
2413
2628
|
try {
|
|
2629
|
+
setIsFetchingChains(true);
|
|
2414
2630
|
const res = await getUserUsedChains(
|
|
2415
2631
|
linkToken,
|
|
2416
2632
|
formValues.address.trim()
|
|
@@ -2418,18 +2634,22 @@ var IntegrationForm = ({
|
|
|
2418
2634
|
if (res && Array.isArray(res)) {
|
|
2419
2635
|
setUserUsedChains(res);
|
|
2420
2636
|
setSelectedChains(new Set(res.map((chain) => chain.id)));
|
|
2637
|
+
} else {
|
|
2638
|
+
setUserUsedChains([]);
|
|
2639
|
+
setSelectedChains(/* @__PURE__ */ new Set());
|
|
2421
2640
|
}
|
|
2422
2641
|
} catch (error) {
|
|
2423
2642
|
console.error("Failed to fetch user chains:", error);
|
|
2424
2643
|
setUserUsedChains([]);
|
|
2425
2644
|
setSelectedChains(/* @__PURE__ */ new Set());
|
|
2645
|
+
} finally {
|
|
2646
|
+
setIsFetchingChains(false);
|
|
2426
2647
|
}
|
|
2427
|
-
} else {
|
|
2428
|
-
setUserUsedChains([]);
|
|
2429
|
-
setSelectedChains(/* @__PURE__ */ new Set());
|
|
2430
2648
|
}
|
|
2649
|
+
}, 500);
|
|
2650
|
+
return () => {
|
|
2651
|
+
clearTimeout(debounceTimer);
|
|
2431
2652
|
};
|
|
2432
|
-
fetchUserUsedChains();
|
|
2433
2653
|
}, [linkToken, formValues.address]);
|
|
2434
2654
|
const toggleChainSelection = (chainId) => {
|
|
2435
2655
|
const newSelected = new Set(selectedChains);
|
|
@@ -2488,7 +2708,7 @@ var IntegrationForm = ({
|
|
|
2488
2708
|
accountName: formValues.account_name?.trim() || "0",
|
|
2489
2709
|
address: formValues.address?.trim() || "0",
|
|
2490
2710
|
password: formValues.password?.trim() || "0",
|
|
2491
|
-
userId: user?.
|
|
2711
|
+
userId: user?.user_id || "0",
|
|
2492
2712
|
projectId: metadata?.projectId || "0",
|
|
2493
2713
|
privateKey: "0",
|
|
2494
2714
|
alias,
|
|
@@ -2505,7 +2725,7 @@ var IntegrationForm = ({
|
|
|
2505
2725
|
);
|
|
2506
2726
|
results.forEach((result, index) => {
|
|
2507
2727
|
const { chain, walletId, alias } = credentialTestsData[index];
|
|
2508
|
-
if (result.status === "fulfilled" && result.value?.
|
|
2728
|
+
if (result.status === "fulfilled" && result.value?.valid) {
|
|
2509
2729
|
const data = {
|
|
2510
2730
|
alias,
|
|
2511
2731
|
exchange: metadata.id.toLowerCase(),
|
|
@@ -2516,7 +2736,7 @@ var IntegrationForm = ({
|
|
|
2516
2736
|
logo: metadata.logo || null,
|
|
2517
2737
|
startTime: null,
|
|
2518
2738
|
endTime: null,
|
|
2519
|
-
uid: user?.
|
|
2739
|
+
uid: user?.user_id || "",
|
|
2520
2740
|
walletId,
|
|
2521
2741
|
clientMetadata: {
|
|
2522
2742
|
clientId,
|
|
@@ -2530,7 +2750,7 @@ var IntegrationForm = ({
|
|
|
2530
2750
|
default_chain_logo: chain.logo || null,
|
|
2531
2751
|
type: metadata.type,
|
|
2532
2752
|
isNftSupported: metadata.isEvmWallet || metadata.nftSupport || false,
|
|
2533
|
-
chainId: chain
|
|
2753
|
+
chainId: chain?.community_id || "",
|
|
2534
2754
|
address: formValues.address
|
|
2535
2755
|
};
|
|
2536
2756
|
if (formValues.account_name)
|
|
@@ -2567,7 +2787,7 @@ var IntegrationForm = ({
|
|
|
2567
2787
|
accountName: formValues.account_name?.trim() || "0",
|
|
2568
2788
|
address: formValues.address?.trim() || "0",
|
|
2569
2789
|
password: formValues.password?.trim() || "0",
|
|
2570
|
-
userId: user?.
|
|
2790
|
+
userId: user?.user_id || "0",
|
|
2571
2791
|
projectId: metadata?.projectId || "0",
|
|
2572
2792
|
privateKey: "0",
|
|
2573
2793
|
alias,
|
|
@@ -2576,7 +2796,7 @@ var IntegrationForm = ({
|
|
|
2576
2796
|
}
|
|
2577
2797
|
};
|
|
2578
2798
|
const testResult = await testCredentials(linkToken, { ...credential });
|
|
2579
|
-
if (!testResult?.
|
|
2799
|
+
if (!testResult?.valid) {
|
|
2580
2800
|
setErrorMessage(
|
|
2581
2801
|
testResult?.value?.message || "Credentials are invalid"
|
|
2582
2802
|
);
|
|
@@ -2592,7 +2812,7 @@ var IntegrationForm = ({
|
|
|
2592
2812
|
logo: metadata.logo || null,
|
|
2593
2813
|
startTime: null,
|
|
2594
2814
|
endTime: null,
|
|
2595
|
-
uid: user?.
|
|
2815
|
+
uid: user?.user_id || "",
|
|
2596
2816
|
walletId,
|
|
2597
2817
|
clientMetadata: {
|
|
2598
2818
|
clientId,
|
|
@@ -2643,24 +2863,24 @@ var IntegrationForm = ({
|
|
|
2643
2863
|
};
|
|
2644
2864
|
const hasNoFields = !metadata.password && !metadata.secret_key && !metadata.api_key && !metadata.address && !metadata.account_name;
|
|
2645
2865
|
const shouldShowFormFields = metadata.password || metadata.secret_key || metadata.api_key || metadata.address || metadata.account_name;
|
|
2646
|
-
const renderLogo = () => metadata.logo ? /* @__PURE__ */
|
|
2866
|
+
const renderLogo = () => metadata.logo ? /* @__PURE__ */ React30.createElement(
|
|
2647
2867
|
Image2,
|
|
2648
2868
|
{
|
|
2649
2869
|
source: { uri: metadata.logo },
|
|
2650
|
-
style:
|
|
2870
|
+
style: styles14.logo,
|
|
2651
2871
|
resizeMode: "contain"
|
|
2652
2872
|
}
|
|
2653
|
-
) : /* @__PURE__ */
|
|
2654
|
-
|
|
2873
|
+
) : /* @__PURE__ */ React30.createElement(
|
|
2874
|
+
View14,
|
|
2655
2875
|
{
|
|
2656
2876
|
style: [
|
|
2657
|
-
|
|
2877
|
+
styles14.logoPlaceholder,
|
|
2658
2878
|
{ backgroundColor: theme.colors.surface }
|
|
2659
2879
|
]
|
|
2660
2880
|
},
|
|
2661
|
-
/* @__PURE__ */
|
|
2881
|
+
/* @__PURE__ */ React30.createElement(Text12, { style: { color: theme.colors.text } }, metadata.name?.charAt(0) || "?")
|
|
2662
2882
|
);
|
|
2663
|
-
const renderInput = (key, props) => /* @__PURE__ */
|
|
2883
|
+
const renderInput = (key, props) => /* @__PURE__ */ React30.createElement(
|
|
2664
2884
|
Input,
|
|
2665
2885
|
{
|
|
2666
2886
|
placeholder: props.placeholder,
|
|
@@ -2672,33 +2892,33 @@ var IntegrationForm = ({
|
|
|
2672
2892
|
secureTextEntry: props.secureTextEntry
|
|
2673
2893
|
}
|
|
2674
2894
|
);
|
|
2675
|
-
const renderErrorAlert = () => errorMessage ? /* @__PURE__ */
|
|
2676
|
-
const renderChainSelection = () => userUsedChains.length > 0 && formValues.address && /* @__PURE__ */
|
|
2895
|
+
const renderErrorAlert = () => errorMessage ? /* @__PURE__ */ React30.createElement(Alert, { variant: "destructive" }, /* @__PURE__ */ React30.createElement(AlertDescription, null, errorMessage)) : null;
|
|
2896
|
+
const renderChainSelection = () => userUsedChains.length > 0 && formValues.address && /* @__PURE__ */ React30.createElement(View14, { style: styles14.chainSelection }, /* @__PURE__ */ React30.createElement(Text12, { style: [styles14.chainTitle, { color: theme.colors.text }] }, "Select Chains to Add:"), /* @__PURE__ */ React30.createElement(ScrollView3, { contentContainerStyle: styles14.scrollViewContent }, /* @__PURE__ */ React30.createElement(View14, { style: styles14.chainChips }, userUsedChains.map((chain) => {
|
|
2677
2897
|
const isSelected = selectedChains.has(chain.id);
|
|
2678
2898
|
const hasError = chainErrors[chain.id];
|
|
2679
|
-
return /* @__PURE__ */
|
|
2680
|
-
|
|
2899
|
+
return /* @__PURE__ */ React30.createElement(
|
|
2900
|
+
TouchableOpacity5,
|
|
2681
2901
|
{
|
|
2682
2902
|
onPress: () => toggleChainSelection(chain.id),
|
|
2683
|
-
style:
|
|
2903
|
+
style: styles14.chainButton,
|
|
2684
2904
|
key: chain.id
|
|
2685
2905
|
},
|
|
2686
|
-
/* @__PURE__ */
|
|
2687
|
-
|
|
2906
|
+
/* @__PURE__ */ React30.createElement(
|
|
2907
|
+
View14,
|
|
2688
2908
|
{
|
|
2689
2909
|
style: [
|
|
2690
|
-
|
|
2910
|
+
styles14.chainChip,
|
|
2691
2911
|
{
|
|
2692
2912
|
backgroundColor: hasError ? theme.colors.errorLight : isSelected ? theme.colors.primary + "20" : theme.colors.surface,
|
|
2693
2913
|
borderColor: hasError ? theme.colors.error : isSelected ? theme.colors.primary : theme.colors.border
|
|
2694
2914
|
}
|
|
2695
2915
|
]
|
|
2696
2916
|
},
|
|
2697
|
-
/* @__PURE__ */
|
|
2698
|
-
|
|
2917
|
+
/* @__PURE__ */ React30.createElement(
|
|
2918
|
+
Text12,
|
|
2699
2919
|
{
|
|
2700
2920
|
style: [
|
|
2701
|
-
|
|
2921
|
+
styles14.chainName,
|
|
2702
2922
|
{
|
|
2703
2923
|
color: hasError ? theme.colors.error : isSelected ? theme.colors.primary : theme.colors.text
|
|
2704
2924
|
}
|
|
@@ -2706,28 +2926,28 @@ var IntegrationForm = ({
|
|
|
2706
2926
|
},
|
|
2707
2927
|
chain.name
|
|
2708
2928
|
),
|
|
2709
|
-
isSelected ? /* @__PURE__ */
|
|
2929
|
+
isSelected ? /* @__PURE__ */ React30.createElement(
|
|
2710
2930
|
CloseIcon,
|
|
2711
2931
|
{
|
|
2712
2932
|
size: 12,
|
|
2713
2933
|
color: hasError ? theme.colors.error : theme.colors.primary
|
|
2714
2934
|
}
|
|
2715
|
-
) : /* @__PURE__ */
|
|
2935
|
+
) : /* @__PURE__ */ React30.createElement(PlusIcon, { size: 12, color: theme.colors.textSecondary })
|
|
2716
2936
|
)
|
|
2717
2937
|
);
|
|
2718
|
-
}))), Object.keys(chainErrors).length > 0 && /* @__PURE__ */
|
|
2719
|
-
|
|
2938
|
+
}))), Object.keys(chainErrors).length > 0 && /* @__PURE__ */ React30.createElement(View14, { style: styles14.chainErrorsContainer }, /* @__PURE__ */ React30.createElement(
|
|
2939
|
+
Text12,
|
|
2720
2940
|
{
|
|
2721
|
-
style: [
|
|
2941
|
+
style: [styles14.chainErrorsTitle, { color: theme.colors.error }]
|
|
2722
2942
|
},
|
|
2723
2943
|
"Errors:"
|
|
2724
2944
|
), Object.entries(chainErrors).map(([chainId, error]) => {
|
|
2725
2945
|
const chain = userUsedChains.find((c) => c.id === chainId);
|
|
2726
|
-
return /* @__PURE__ */
|
|
2727
|
-
|
|
2946
|
+
return /* @__PURE__ */ React30.createElement(
|
|
2947
|
+
Text12,
|
|
2728
2948
|
{
|
|
2729
2949
|
key: chainId,
|
|
2730
|
-
style: [
|
|
2950
|
+
style: [styles14.chainErrorItem, { color: theme.colors.error }]
|
|
2731
2951
|
},
|
|
2732
2952
|
"\u2022 ",
|
|
2733
2953
|
chain?.name,
|
|
@@ -2735,7 +2955,7 @@ var IntegrationForm = ({
|
|
|
2735
2955
|
error
|
|
2736
2956
|
);
|
|
2737
2957
|
})));
|
|
2738
|
-
const renderFormBlock = () => /* @__PURE__ */
|
|
2958
|
+
const renderFormBlock = () => /* @__PURE__ */ React30.createElement(React30.Fragment, null, /* @__PURE__ */ React30.createElement(View14, { style: styles14.header }, renderLogo(), /* @__PURE__ */ React30.createElement(Text12, { style: [styles14.name, { color: theme.colors.text }] }, metadata.name)), renderErrorAlert(), shouldShowFormFields && /* @__PURE__ */ React30.createElement(React30.Fragment, null, metadata.address && /* @__PURE__ */ React30.createElement(React30.Fragment, null, renderInput("address", {
|
|
2739
2959
|
placeholder: "Enter address",
|
|
2740
2960
|
autoCapitalize: "none",
|
|
2741
2961
|
autoCorrect: false
|
|
@@ -2751,27 +2971,27 @@ var IntegrationForm = ({
|
|
|
2751
2971
|
}), metadata.password && renderInput("password", {
|
|
2752
2972
|
placeholder: "Enter Password",
|
|
2753
2973
|
secureTextEntry: true
|
|
2754
|
-
})), hasNoFields && !metadata?.isWalletConnectSupported && /* @__PURE__ */
|
|
2974
|
+
})), hasNoFields && !metadata?.isWalletConnectSupported && /* @__PURE__ */ React30.createElement(Alert, { variant: "default", style: { marginTop: 12 } }, /* @__PURE__ */ React30.createElement(AlertDescription, null, "This integration is not supported here yet \u2014 try using it through our Kryptos Platform.")));
|
|
2755
2975
|
const addIntegrationLabel = formValues.address && userUsedChains.length > 0 && selectedChains.size > 0 ? `Add ${selectedChains.size} Chain${selectedChains.size !== 1 ? "s" : ""}` : "Add Integration";
|
|
2756
|
-
return /* @__PURE__ */
|
|
2757
|
-
|
|
2976
|
+
return /* @__PURE__ */ React30.createElement(React30.Fragment, null, !metadata?.isWalletConnectSupported ? /* @__PURE__ */ React30.createElement(Modal, { isOpen: open, onClose: handleClose, size: "full" }, /* @__PURE__ */ React30.createElement(ModalHeader, { onClose: handleClose }, /* @__PURE__ */ React30.createElement(View14, { style: styles14.headerContent }, /* @__PURE__ */ React30.createElement(
|
|
2977
|
+
TouchableOpacity5,
|
|
2758
2978
|
{
|
|
2759
2979
|
onPress: () => setAddIntegrationMode(null),
|
|
2760
|
-
style:
|
|
2980
|
+
style: styles14.backButton
|
|
2761
2981
|
},
|
|
2762
|
-
/* @__PURE__ */
|
|
2763
|
-
), /* @__PURE__ */
|
|
2982
|
+
/* @__PURE__ */ React30.createElement(ArrowLeftIcon, { size: 20, color: theme.colors.text })
|
|
2983
|
+
), /* @__PURE__ */ React30.createElement(Text12, { style: [styles14.headerTitle, { color: theme.colors.text }] }, "Integration"))), /* @__PURE__ */ React30.createElement(ModalBody, { scrollable: false, style: styles14.contentContainer }, renderFormBlock()), !hasNoFields && /* @__PURE__ */ React30.createElement(ModalFooter, { style: { paddingVertical: 8 } }, /* @__PURE__ */ React30.createElement(
|
|
2764
2984
|
Button,
|
|
2765
2985
|
{
|
|
2766
2986
|
variant: "outline",
|
|
2767
2987
|
size: "lg",
|
|
2768
2988
|
onPress: handleSubmit,
|
|
2769
2989
|
loading: isLoading,
|
|
2770
|
-
disabled: isLoading || !!formValues.address && userUsedChains.length > 0 && selectedChains.size === 0,
|
|
2771
|
-
style:
|
|
2990
|
+
disabled: isLoading || isFetchingChains || !!formValues.address && userUsedChains.length > 0 && selectedChains.size === 0,
|
|
2991
|
+
style: styles14.button
|
|
2772
2992
|
},
|
|
2773
2993
|
addIntegrationLabel
|
|
2774
|
-
))) : /* @__PURE__ */
|
|
2994
|
+
), /* @__PURE__ */ React30.createElement(Footer, null))) : /* @__PURE__ */ React30.createElement(
|
|
2775
2995
|
WalletConnectComponent,
|
|
2776
2996
|
{
|
|
2777
2997
|
integration: metadata,
|
|
@@ -2783,7 +3003,7 @@ var IntegrationForm = ({
|
|
|
2783
3003
|
}
|
|
2784
3004
|
));
|
|
2785
3005
|
};
|
|
2786
|
-
var
|
|
3006
|
+
var styles14 = StyleSheet14.create({
|
|
2787
3007
|
scrollViewContent: {
|
|
2788
3008
|
flexGrow: 1,
|
|
2789
3009
|
paddingBottom: 100
|
|
@@ -2900,66 +3120,9 @@ var styles10 = StyleSheet10.create({
|
|
|
2900
3120
|
// theme.spacing.xs
|
|
2901
3121
|
},
|
|
2902
3122
|
button: {
|
|
2903
|
-
width: "100%"
|
|
2904
|
-
marginTop: 16
|
|
2905
|
-
// theme.spacing.lg - consistent button spacing
|
|
2906
|
-
}
|
|
2907
|
-
});
|
|
2908
|
-
|
|
2909
|
-
// src/components/SkeletonItem.tsx
|
|
2910
|
-
import React26, { useEffect, useRef } from "react";
|
|
2911
|
-
import { Animated as Animated2, View as View11, StyleSheet as StyleSheet11 } from "react-native";
|
|
2912
|
-
var SkeletonItem = () => {
|
|
2913
|
-
const opacity = useRef(new Animated2.Value(0.3)).current;
|
|
2914
|
-
useEffect(() => {
|
|
2915
|
-
Animated2.loop(
|
|
2916
|
-
Animated2.sequence([
|
|
2917
|
-
Animated2.timing(opacity, {
|
|
2918
|
-
toValue: 1,
|
|
2919
|
-
duration: 600,
|
|
2920
|
-
useNativeDriver: true
|
|
2921
|
-
}),
|
|
2922
|
-
Animated2.timing(opacity, {
|
|
2923
|
-
toValue: 0.3,
|
|
2924
|
-
duration: 600,
|
|
2925
|
-
useNativeDriver: true
|
|
2926
|
-
})
|
|
2927
|
-
])
|
|
2928
|
-
).start();
|
|
2929
|
-
}, []);
|
|
2930
|
-
return /* @__PURE__ */ React26.createElement(Animated2.View, { style: [styles11.row, { opacity }] }, /* @__PURE__ */ React26.createElement(View11, { style: styles11.iconCircle }), /* @__PURE__ */ React26.createElement(View11, { style: styles11.textBlock }, /* @__PURE__ */ React26.createElement(View11, { style: styles11.lineLong }), /* @__PURE__ */ React26.createElement(View11, { style: styles11.lineShort })));
|
|
2931
|
-
};
|
|
2932
|
-
var styles11 = StyleSheet11.create({
|
|
2933
|
-
row: {
|
|
2934
|
-
flexDirection: "row",
|
|
2935
|
-
alignItems: "center",
|
|
2936
|
-
paddingVertical: 16
|
|
2937
|
-
},
|
|
2938
|
-
iconCircle: {
|
|
2939
|
-
width: 45,
|
|
2940
|
-
height: 45,
|
|
2941
|
-
borderRadius: 22.5,
|
|
2942
|
-
backgroundColor: "#E5E5E5"
|
|
2943
|
-
},
|
|
2944
|
-
textBlock: {
|
|
2945
|
-
marginLeft: 12,
|
|
2946
|
-
flex: 1
|
|
2947
|
-
},
|
|
2948
|
-
lineShort: {
|
|
2949
|
-
width: "50%",
|
|
2950
|
-
height: 14,
|
|
2951
|
-
borderRadius: 6,
|
|
2952
|
-
backgroundColor: "#E5E5E5"
|
|
2953
|
-
},
|
|
2954
|
-
lineLong: {
|
|
2955
|
-
marginBottom: 6,
|
|
2956
|
-
width: "100%",
|
|
2957
|
-
height: 14,
|
|
2958
|
-
borderRadius: 6,
|
|
2959
|
-
backgroundColor: "#E5E5E5"
|
|
3123
|
+
width: "100%"
|
|
2960
3124
|
}
|
|
2961
3125
|
});
|
|
2962
|
-
var SkeletonItem_default = SkeletonItem;
|
|
2963
3126
|
|
|
2964
3127
|
// src/molecules/Integration.tsx
|
|
2965
3128
|
var Integration = ({
|
|
@@ -2969,13 +3132,14 @@ var Integration = ({
|
|
|
2969
3132
|
}) => {
|
|
2970
3133
|
const { appName, linkToken } = useKryptosConnect();
|
|
2971
3134
|
const theme = useTheme();
|
|
2972
|
-
const [addIntegrationMode, setAddIntegrationMode] =
|
|
2973
|
-
const [query, setQuery] =
|
|
2974
|
-
const [
|
|
2975
|
-
const [
|
|
2976
|
-
const [
|
|
2977
|
-
const [
|
|
2978
|
-
const [
|
|
3135
|
+
const [addIntegrationMode, setAddIntegrationMode] = React31.useState(null);
|
|
3136
|
+
const [query, setQuery] = React31.useState("");
|
|
3137
|
+
const [activeTab, setActiveTab] = React31.useState("all");
|
|
3138
|
+
const [supportedProviders, setSupportedProviders] = React31.useState([]);
|
|
3139
|
+
const [addedIntegrations, setAddedIntegrations] = React31.useState([]);
|
|
3140
|
+
const [existingIntegrations, setExistingIntegrations] = React31.useState([]);
|
|
3141
|
+
const [isLoading, setIsLoading] = React31.useState(false);
|
|
3142
|
+
const [errorMessage, setErrorMessage] = React31.useState("");
|
|
2979
3143
|
const handleClose = () => {
|
|
2980
3144
|
onClose();
|
|
2981
3145
|
};
|
|
@@ -3006,13 +3170,13 @@ var Integration = ({
|
|
|
3006
3170
|
setIsLoading(false);
|
|
3007
3171
|
}
|
|
3008
3172
|
};
|
|
3009
|
-
|
|
3173
|
+
React31.useEffect(() => {
|
|
3010
3174
|
if (linkToken) {
|
|
3011
3175
|
fetchSupportedProviders();
|
|
3012
3176
|
fetchExistingIntegrations();
|
|
3013
3177
|
}
|
|
3014
3178
|
}, [linkToken]);
|
|
3015
|
-
const isIntegrationAdded =
|
|
3179
|
+
const isIntegrationAdded = React31.useCallback(
|
|
3016
3180
|
(publicName) => {
|
|
3017
3181
|
const integrations = [...addedIntegrations, ...existingIntegrations];
|
|
3018
3182
|
return integrations.some(
|
|
@@ -3021,7 +3185,7 @@ var Integration = ({
|
|
|
3021
3185
|
},
|
|
3022
3186
|
[addedIntegrations, existingIntegrations]
|
|
3023
3187
|
);
|
|
3024
|
-
const getIntegrationCount =
|
|
3188
|
+
const getIntegrationCount = React31.useCallback(
|
|
3025
3189
|
(publicName) => {
|
|
3026
3190
|
const integrations = [...addedIntegrations, ...existingIntegrations];
|
|
3027
3191
|
return integrations.filter(
|
|
@@ -3030,22 +3194,24 @@ var Integration = ({
|
|
|
3030
3194
|
},
|
|
3031
3195
|
[addedIntegrations, existingIntegrations]
|
|
3032
3196
|
);
|
|
3033
|
-
const filteredResults =
|
|
3034
|
-
|
|
3035
|
-
|
|
3036
|
-
|
|
3037
|
-
|
|
3038
|
-
|
|
3197
|
+
const filteredResults = React31.useMemo(() => {
|
|
3198
|
+
let filtered = supportedProviders;
|
|
3199
|
+
if (activeTab !== "all") {
|
|
3200
|
+
filtered = filtered.filter((provider) => provider.type === activeTab);
|
|
3201
|
+
}
|
|
3202
|
+
if (query?.trim()) {
|
|
3203
|
+
const lowerQuery = query.trim().toLowerCase();
|
|
3204
|
+
filtered = filtered.filter((provider) => {
|
|
3205
|
+
return provider.name?.toLowerCase().includes(lowerQuery) || provider.public_name?.toLowerCase().includes(lowerQuery) || provider.id?.toLowerCase().includes(lowerQuery);
|
|
3206
|
+
});
|
|
3039
3207
|
}
|
|
3040
|
-
return [...
|
|
3208
|
+
return [...filtered].sort((a, b) => {
|
|
3041
3209
|
const countA = getIntegrationCount(a.public_name);
|
|
3042
3210
|
const countB = getIntegrationCount(b.public_name);
|
|
3043
|
-
if (countB !== countA)
|
|
3044
|
-
|
|
3045
|
-
}
|
|
3046
|
-
return a.name.localeCompare(b.name);
|
|
3211
|
+
if (countB !== countA) return countB - countA;
|
|
3212
|
+
return (a.name ?? "").localeCompare(b.name ?? "");
|
|
3047
3213
|
});
|
|
3048
|
-
}, [query, supportedProviders, getIntegrationCount]);
|
|
3214
|
+
}, [query, supportedProviders, getIntegrationCount, activeTab]);
|
|
3049
3215
|
const handleAddIntegration = async () => {
|
|
3050
3216
|
try {
|
|
3051
3217
|
setIsLoading(true);
|
|
@@ -3068,11 +3234,11 @@ var Integration = ({
|
|
|
3068
3234
|
setIsLoading(false);
|
|
3069
3235
|
}
|
|
3070
3236
|
};
|
|
3071
|
-
const renderProviderItem = ({ item }) => /* @__PURE__ */
|
|
3072
|
-
|
|
3237
|
+
const renderProviderItem = ({ item }) => /* @__PURE__ */ React31.createElement(
|
|
3238
|
+
TouchableOpacity6,
|
|
3073
3239
|
{
|
|
3074
3240
|
style: [
|
|
3075
|
-
|
|
3241
|
+
styles15.providerItem,
|
|
3076
3242
|
{
|
|
3077
3243
|
backgroundColor: theme.colors.surface,
|
|
3078
3244
|
borderColor: theme.colors.border
|
|
@@ -3081,43 +3247,43 @@ var Integration = ({
|
|
|
3081
3247
|
onPress: () => setAddIntegrationMode(item),
|
|
3082
3248
|
activeOpacity: 0.7
|
|
3083
3249
|
},
|
|
3084
|
-
/* @__PURE__ */
|
|
3250
|
+
/* @__PURE__ */ React31.createElement(View15, { style: styles15.providerInfo }, item?.logo ? /* @__PURE__ */ React31.createElement(
|
|
3085
3251
|
Image3,
|
|
3086
3252
|
{
|
|
3087
3253
|
source: { uri: item?.logo },
|
|
3088
|
-
style:
|
|
3254
|
+
style: styles15.providerLogo,
|
|
3089
3255
|
resizeMode: "contain"
|
|
3090
3256
|
}
|
|
3091
|
-
) : /* @__PURE__ */
|
|
3092
|
-
|
|
3257
|
+
) : /* @__PURE__ */ React31.createElement(
|
|
3258
|
+
View15,
|
|
3093
3259
|
{
|
|
3094
3260
|
style: [
|
|
3095
|
-
|
|
3261
|
+
styles15.providerLogoPlaceholder,
|
|
3096
3262
|
{ backgroundColor: theme.colors.surfaceSecondary }
|
|
3097
3263
|
]
|
|
3098
3264
|
},
|
|
3099
|
-
/* @__PURE__ */
|
|
3100
|
-
), /* @__PURE__ */
|
|
3101
|
-
isIntegrationAdded(item?.public_name) && /* @__PURE__ */
|
|
3102
|
-
|
|
3265
|
+
/* @__PURE__ */ React31.createElement(Text13, { style: { color: theme.colors.text } }, item?.name?.charAt(0) || "?")
|
|
3266
|
+
), /* @__PURE__ */ React31.createElement(Text13, { style: [styles15.providerName, { color: theme.colors.text }] }, item?.name + "\u200B")),
|
|
3267
|
+
isIntegrationAdded(item?.public_name) && /* @__PURE__ */ React31.createElement(View15, { style: styles15.providerStatus }, /* @__PURE__ */ React31.createElement(CheckCircleIcon, { size: 18, color: theme.colors.success }), /* @__PURE__ */ React31.createElement(
|
|
3268
|
+
Text13,
|
|
3103
3269
|
{
|
|
3104
3270
|
style: [
|
|
3105
|
-
|
|
3271
|
+
styles15.providerCount,
|
|
3106
3272
|
{ color: theme.colors.textSecondary }
|
|
3107
3273
|
]
|
|
3108
3274
|
},
|
|
3109
3275
|
getIntegrationCount(item?.public_name)
|
|
3110
3276
|
))
|
|
3111
3277
|
);
|
|
3112
|
-
const renderSkeletonItem = () => /* @__PURE__ */
|
|
3113
|
-
return /* @__PURE__ */
|
|
3114
|
-
|
|
3278
|
+
const renderSkeletonItem = () => /* @__PURE__ */ React31.createElement(SkeletonItem_default, null);
|
|
3279
|
+
return /* @__PURE__ */ React31.createElement(React31.Fragment, null, !addIntegrationMode ? /* @__PURE__ */ React31.createElement(Modal, { isOpen: open, onClose: handleClose, size: "full" }, /* @__PURE__ */ React31.createElement(ModalHeader, { onClose: handleClose }, /* @__PURE__ */ React31.createElement(View15, { style: styles15.headerContent }, addIntegrationMode && /* @__PURE__ */ React31.createElement(
|
|
3280
|
+
TouchableOpacity6,
|
|
3115
3281
|
{
|
|
3116
3282
|
onPress: () => setAddIntegrationMode(null),
|
|
3117
|
-
style:
|
|
3283
|
+
style: styles15.backButton
|
|
3118
3284
|
},
|
|
3119
|
-
/* @__PURE__ */
|
|
3120
|
-
), /* @__PURE__ */
|
|
3285
|
+
/* @__PURE__ */ React31.createElement(ArrowLeftIcon, { size: 20, color: theme.colors.text })
|
|
3286
|
+
), /* @__PURE__ */ React31.createElement(Text13, { style: [styles15.headerTitle, { color: theme.colors.text }] }, "Integration"))), /* @__PURE__ */ React31.createElement(ModalBody, { scrollable: false, style: styles15.noPadding }, /* @__PURE__ */ React31.createElement(View15, { style: styles15.container }, /* @__PURE__ */ React31.createElement(View15, { style: styles15.headerSection }, /* @__PURE__ */ React31.createElement(ConnectLogo, null), /* @__PURE__ */ React31.createElement(Text13, { style: [styles15.title, { color: theme.colors.text }] }, "Select an account to link to ", appName)), /* @__PURE__ */ React31.createElement(
|
|
3121
3287
|
FlatList,
|
|
3122
3288
|
{
|
|
3123
3289
|
data: isLoading ? Array.from({ length: 8 }, (_, i) => ({
|
|
@@ -3128,14 +3294,14 @@ var Integration = ({
|
|
|
3128
3294
|
})) : filteredResults,
|
|
3129
3295
|
keyExtractor: (item, index) => isLoading ? item.id : `provider-${item.id}-${index}`,
|
|
3130
3296
|
renderItem: isLoading ? renderSkeletonItem : renderProviderItem,
|
|
3131
|
-
style:
|
|
3297
|
+
style: styles15.list,
|
|
3132
3298
|
contentContainerStyle: [
|
|
3133
|
-
|
|
3299
|
+
styles15.listContent,
|
|
3134
3300
|
{ paddingHorizontal: theme.spacing.xl }
|
|
3135
3301
|
],
|
|
3136
3302
|
showsVerticalScrollIndicator: false,
|
|
3137
|
-
ListHeaderComponent: /* @__PURE__ */
|
|
3138
|
-
|
|
3303
|
+
ListHeaderComponent: /* @__PURE__ */ React31.createElement(
|
|
3304
|
+
View15,
|
|
3139
3305
|
{
|
|
3140
3306
|
style: {
|
|
3141
3307
|
paddingVertical: theme.spacing.sm + 2,
|
|
@@ -3143,29 +3309,63 @@ var Integration = ({
|
|
|
3143
3309
|
zIndex: 10
|
|
3144
3310
|
}
|
|
3145
3311
|
},
|
|
3146
|
-
/* @__PURE__ */
|
|
3312
|
+
/* @__PURE__ */ React31.createElement(
|
|
3147
3313
|
Input,
|
|
3148
3314
|
{
|
|
3149
3315
|
value: query,
|
|
3150
3316
|
onChangeText: setQuery,
|
|
3151
3317
|
placeholder: "Search Integrations...",
|
|
3152
|
-
containerStyle:
|
|
3318
|
+
containerStyle: styles15.searchInput
|
|
3153
3319
|
}
|
|
3154
|
-
)
|
|
3320
|
+
),
|
|
3321
|
+
/* @__PURE__ */ React31.createElement(View15, { style: styles15.tabsContainer }, [
|
|
3322
|
+
{ label: "All", value: "all" },
|
|
3323
|
+
{ label: "Exchanges", value: "exchange" },
|
|
3324
|
+
{ label: "Blockchains", value: "blockchain" },
|
|
3325
|
+
{ label: "Wallets", value: "wallet" }
|
|
3326
|
+
].map((tab) => /* @__PURE__ */ React31.createElement(
|
|
3327
|
+
TouchableOpacity6,
|
|
3328
|
+
{
|
|
3329
|
+
key: tab.value,
|
|
3330
|
+
style: [
|
|
3331
|
+
styles15.tab,
|
|
3332
|
+
{
|
|
3333
|
+
backgroundColor: activeTab === tab.value ? theme.colors.primary : theme.colors.surface,
|
|
3334
|
+
borderColor: theme.colors.border
|
|
3335
|
+
}
|
|
3336
|
+
],
|
|
3337
|
+
onPress: () => setActiveTab(
|
|
3338
|
+
tab.value
|
|
3339
|
+
),
|
|
3340
|
+
activeOpacity: 0.7
|
|
3341
|
+
},
|
|
3342
|
+
/* @__PURE__ */ React31.createElement(
|
|
3343
|
+
Text13,
|
|
3344
|
+
{
|
|
3345
|
+
style: [
|
|
3346
|
+
styles15.tabText,
|
|
3347
|
+
{
|
|
3348
|
+
color: activeTab === tab.value ? theme.colors.white : theme.colors.text
|
|
3349
|
+
}
|
|
3350
|
+
]
|
|
3351
|
+
},
|
|
3352
|
+
tab.label
|
|
3353
|
+
)
|
|
3354
|
+
)))
|
|
3155
3355
|
),
|
|
3156
3356
|
stickyHeaderIndices: [0],
|
|
3157
|
-
ListEmptyComponent: /* @__PURE__ */
|
|
3158
|
-
|
|
3357
|
+
ListEmptyComponent: /* @__PURE__ */ React31.createElement(View15, { style: styles15.emptyContainer }, !isLoading && /* @__PURE__ */ React31.createElement(
|
|
3358
|
+
Text13,
|
|
3159
3359
|
{
|
|
3160
3360
|
style: [
|
|
3161
|
-
|
|
3361
|
+
styles15.emptyText,
|
|
3162
3362
|
{ color: theme.colors.textSecondary }
|
|
3163
3363
|
]
|
|
3164
3364
|
},
|
|
3165
3365
|
query ? "No search results found" : "No supported integrations found"
|
|
3166
3366
|
))
|
|
3167
3367
|
}
|
|
3168
|
-
), errorMessage && /* @__PURE__ */
|
|
3368
|
+
), errorMessage && /* @__PURE__ */ React31.createElement(View15, { style: styles15.errorContainer }, /* @__PURE__ */ React31.createElement(Alert, { variant: "destructive", style: styles15.errorAlert }, /* @__PURE__ */ React31.createElement(AlertDescription, null, errorMessage))))), /* @__PURE__ */ React31.createElement(ModalFooter, { style: { paddingVertical: 8 } }, /* @__PURE__ */ React31.createElement(
|
|
3169
3369
|
Button,
|
|
3170
3370
|
{
|
|
3171
3371
|
variant: "outline",
|
|
@@ -3173,10 +3373,10 @@ var Integration = ({
|
|
|
3173
3373
|
onPress: handleAddIntegration,
|
|
3174
3374
|
loading: isLoading,
|
|
3175
3375
|
disabled: isLoading,
|
|
3176
|
-
style:
|
|
3376
|
+
style: styles15.continueButton
|
|
3177
3377
|
},
|
|
3178
3378
|
"Continue"
|
|
3179
|
-
))) : /* @__PURE__ */
|
|
3379
|
+
), /* @__PURE__ */ React31.createElement(Footer, null))) : /* @__PURE__ */ React31.createElement(
|
|
3180
3380
|
IntegrationForm,
|
|
3181
3381
|
{
|
|
3182
3382
|
metadata: addIntegrationMode,
|
|
@@ -3190,7 +3390,7 @@ var Integration = ({
|
|
|
3190
3390
|
}
|
|
3191
3391
|
));
|
|
3192
3392
|
};
|
|
3193
|
-
var
|
|
3393
|
+
var styles15 = StyleSheet15.create({
|
|
3194
3394
|
headerContent: {
|
|
3195
3395
|
flexDirection: "row",
|
|
3196
3396
|
alignItems: "center"
|
|
@@ -3213,10 +3413,9 @@ var styles12 = StyleSheet12.create({
|
|
|
3213
3413
|
flex: 1
|
|
3214
3414
|
},
|
|
3215
3415
|
headerSection: {
|
|
3216
|
-
paddingHorizontal: 20
|
|
3217
|
-
// theme.spacing.xl
|
|
3218
|
-
paddingTop: 10
|
|
3416
|
+
paddingHorizontal: 20
|
|
3219
3417
|
// theme.spacing.xl
|
|
3418
|
+
// paddingTop: 10, // theme.spacing.xl
|
|
3220
3419
|
},
|
|
3221
3420
|
title: {
|
|
3222
3421
|
fontSize: 16,
|
|
@@ -3305,25 +3504,47 @@ var styles12 = StyleSheet12.create({
|
|
|
3305
3504
|
errorAlert: {
|
|
3306
3505
|
marginTop: 16
|
|
3307
3506
|
// theme.spacing.lg - consistent alert spacing
|
|
3507
|
+
},
|
|
3508
|
+
tabsContainer: {
|
|
3509
|
+
flexDirection: "row",
|
|
3510
|
+
gap: 4,
|
|
3511
|
+
// theme.spacing.sm
|
|
3512
|
+
flexWrap: "wrap"
|
|
3513
|
+
},
|
|
3514
|
+
tab: {
|
|
3515
|
+
paddingVertical: 8,
|
|
3516
|
+
// theme.spacing.sm
|
|
3517
|
+
paddingHorizontal: 16,
|
|
3518
|
+
// theme.spacing.lg
|
|
3519
|
+
borderRadius: 20,
|
|
3520
|
+
// theme.borderRadius.full / 2
|
|
3521
|
+
borderWidth: 1,
|
|
3522
|
+
alignItems: "center",
|
|
3523
|
+
justifyContent: "center"
|
|
3524
|
+
},
|
|
3525
|
+
tabText: {
|
|
3526
|
+
fontSize: 13,
|
|
3527
|
+
// theme.fontSize.sm
|
|
3528
|
+
fontWeight: "600"
|
|
3308
3529
|
}
|
|
3309
3530
|
});
|
|
3310
3531
|
|
|
3311
3532
|
// src/molecules/OTPVerify.tsx
|
|
3312
|
-
import
|
|
3313
|
-
import { StyleSheet as
|
|
3533
|
+
import React32 from "react";
|
|
3534
|
+
import { StyleSheet as StyleSheet16, Text as Text14, TouchableOpacity as TouchableOpacity7, View as View16 } from "react-native";
|
|
3314
3535
|
var OTPVerify = ({
|
|
3315
3536
|
open,
|
|
3316
3537
|
onSuccess,
|
|
3317
3538
|
onClose
|
|
3318
3539
|
}) => {
|
|
3319
3540
|
const theme = useTheme();
|
|
3320
|
-
const [otp, setOtp] =
|
|
3541
|
+
const [otp, setOtp] = React32.useState("");
|
|
3321
3542
|
const { linkToken, clientId, email, setUser } = useKryptosConnect();
|
|
3322
|
-
const [isLoading, setIsLoading] =
|
|
3323
|
-
const [isResending, setIsResending] =
|
|
3324
|
-
const [resendCooldown, setResendCooldown] =
|
|
3325
|
-
const [errorMessage, setErrorMessage] =
|
|
3326
|
-
const [successMessage, setSuccessMessage] =
|
|
3543
|
+
const [isLoading, setIsLoading] = React32.useState(false);
|
|
3544
|
+
const [isResending, setIsResending] = React32.useState(false);
|
|
3545
|
+
const [resendCooldown, setResendCooldown] = React32.useState(0);
|
|
3546
|
+
const [errorMessage, setErrorMessage] = React32.useState("");
|
|
3547
|
+
const [successMessage, setSuccessMessage] = React32.useState("");
|
|
3327
3548
|
const handleSubmit = async () => {
|
|
3328
3549
|
if (otp.length !== 6) return;
|
|
3329
3550
|
setIsLoading(true);
|
|
@@ -3374,7 +3595,7 @@ var OTPVerify = ({
|
|
|
3374
3595
|
setSuccessMessage("");
|
|
3375
3596
|
setOtp("");
|
|
3376
3597
|
};
|
|
3377
|
-
|
|
3598
|
+
React32.useEffect(() => {
|
|
3378
3599
|
if (resendCooldown > 0) {
|
|
3379
3600
|
const timer = setTimeout(() => {
|
|
3380
3601
|
setResendCooldown(resendCooldown - 1);
|
|
@@ -3383,13 +3604,20 @@ var OTPVerify = ({
|
|
|
3383
3604
|
}
|
|
3384
3605
|
return void 0;
|
|
3385
3606
|
}, [resendCooldown]);
|
|
3386
|
-
return /* @__PURE__ */
|
|
3387
|
-
|
|
3607
|
+
return /* @__PURE__ */ React32.createElement(Modal, { isOpen: open, onClose: handleClose, size: "lg" }, /* @__PURE__ */ React32.createElement(ModalHeader, { onClose: handleClose }, /* @__PURE__ */ React32.createElement(View16, { style: styles16.headerContent }, /* @__PURE__ */ React32.createElement(Text14, { style: [styles16.headerTitle, { color: theme.colors.text }] }, "OTP Verification"))), /* @__PURE__ */ React32.createElement(ModalBody, null, /* @__PURE__ */ React32.createElement(View16, { style: styles16.container }, /* @__PURE__ */ React32.createElement(ConnectLogo, null), /* @__PURE__ */ React32.createElement(View16, { style: styles16.emailInfo }, /* @__PURE__ */ React32.createElement(
|
|
3608
|
+
Text14,
|
|
3388
3609
|
{
|
|
3389
|
-
style: [
|
|
3610
|
+
style: [styles16.infoText, { color: theme.colors.textSecondary }]
|
|
3390
3611
|
},
|
|
3391
3612
|
"We have sent a verification code to"
|
|
3392
|
-
), /* @__PURE__ */
|
|
3613
|
+
), /* @__PURE__ */ React32.createElement(Text14, { style: [styles16.emailText, { color: theme.colors.text }] }, email)), /* @__PURE__ */ React32.createElement(
|
|
3614
|
+
OTP,
|
|
3615
|
+
{
|
|
3616
|
+
onComplete: handleOtpComplete,
|
|
3617
|
+
length: 6,
|
|
3618
|
+
setErrorMessage
|
|
3619
|
+
}
|
|
3620
|
+
), errorMessage ? /* @__PURE__ */ React32.createElement(Alert, { variant: "destructive" }, /* @__PURE__ */ React32.createElement(AlertDescription, null, errorMessage)) : null, successMessage ? /* @__PURE__ */ React32.createElement(Alert, { variant: "default" }, /* @__PURE__ */ React32.createElement(AlertDescription, null, successMessage)) : null, /* @__PURE__ */ React32.createElement(
|
|
3393
3621
|
Button,
|
|
3394
3622
|
{
|
|
3395
3623
|
variant: "outline",
|
|
@@ -3397,44 +3625,44 @@ var OTPVerify = ({
|
|
|
3397
3625
|
onPress: handleSubmit,
|
|
3398
3626
|
loading: isLoading,
|
|
3399
3627
|
disabled: otp.length !== 6 || isLoading,
|
|
3400
|
-
style:
|
|
3628
|
+
style: styles16.button
|
|
3401
3629
|
},
|
|
3402
3630
|
"Continue"
|
|
3403
|
-
), /* @__PURE__ */
|
|
3404
|
-
|
|
3631
|
+
), /* @__PURE__ */ React32.createElement(
|
|
3632
|
+
TouchableOpacity7,
|
|
3405
3633
|
{
|
|
3406
3634
|
onPress: handleResendOtp,
|
|
3407
3635
|
disabled: resendCooldown > 0 || isResending,
|
|
3408
|
-
style:
|
|
3636
|
+
style: styles16.resendContainer
|
|
3409
3637
|
},
|
|
3410
|
-
isResending ? /* @__PURE__ */
|
|
3411
|
-
|
|
3638
|
+
isResending ? /* @__PURE__ */ React32.createElement(View16, { style: styles16.resendLoading }, /* @__PURE__ */ React32.createElement(LoaderIcon, { size: 16, color: theme.colors.primary }), /* @__PURE__ */ React32.createElement(
|
|
3639
|
+
Text14,
|
|
3412
3640
|
{
|
|
3413
|
-
style: [
|
|
3641
|
+
style: [styles16.resendText, { color: theme.colors.primary }]
|
|
3414
3642
|
},
|
|
3415
3643
|
" ",
|
|
3416
3644
|
"Sending..."
|
|
3417
|
-
)) : resendCooldown > 0 ? /* @__PURE__ */
|
|
3418
|
-
|
|
3645
|
+
)) : resendCooldown > 0 ? /* @__PURE__ */ React32.createElement(
|
|
3646
|
+
Text14,
|
|
3419
3647
|
{
|
|
3420
3648
|
style: [
|
|
3421
|
-
|
|
3649
|
+
styles16.resendText,
|
|
3422
3650
|
{ color: theme.colors.textSecondary }
|
|
3423
3651
|
]
|
|
3424
3652
|
},
|
|
3425
3653
|
"Resend OTP in ",
|
|
3426
3654
|
resendCooldown,
|
|
3427
3655
|
"s"
|
|
3428
|
-
) : /* @__PURE__ */
|
|
3429
|
-
|
|
3656
|
+
) : /* @__PURE__ */ React32.createElement(
|
|
3657
|
+
Text14,
|
|
3430
3658
|
{
|
|
3431
|
-
style: [
|
|
3659
|
+
style: [styles16.resendText, { color: theme.colors.primary }]
|
|
3432
3660
|
},
|
|
3433
3661
|
"Resend OTP"
|
|
3434
3662
|
)
|
|
3435
|
-
))));
|
|
3663
|
+
))), /* @__PURE__ */ React32.createElement(ModalFooter, { style: { paddingVertical: 0 } }, /* @__PURE__ */ React32.createElement(Footer, null)));
|
|
3436
3664
|
};
|
|
3437
|
-
var
|
|
3665
|
+
var styles16 = StyleSheet16.create({
|
|
3438
3666
|
headerContent: {
|
|
3439
3667
|
flexDirection: "row",
|
|
3440
3668
|
alignItems: "center"
|
|
@@ -3493,8 +3721,8 @@ var styles13 = StyleSheet13.create({
|
|
|
3493
3721
|
});
|
|
3494
3722
|
|
|
3495
3723
|
// src/molecules/Permissions.tsx
|
|
3496
|
-
import
|
|
3497
|
-
import {
|
|
3724
|
+
import React33 from "react";
|
|
3725
|
+
import { StyleSheet as StyleSheet17, Text as Text15, View as View17 } from "react-native";
|
|
3498
3726
|
var Permissions = ({
|
|
3499
3727
|
open,
|
|
3500
3728
|
onClose,
|
|
@@ -3502,8 +3730,8 @@ var Permissions = ({
|
|
|
3502
3730
|
}) => {
|
|
3503
3731
|
const { appName, linkToken, setUserConsent } = useKryptosConnect();
|
|
3504
3732
|
const theme = useTheme();
|
|
3505
|
-
const [isLoading, setIsLoading] =
|
|
3506
|
-
const [errorMessage, setErrorMessage] =
|
|
3733
|
+
const [isLoading, setIsLoading] = React33.useState(false);
|
|
3734
|
+
const [errorMessage, setErrorMessage] = React33.useState("");
|
|
3507
3735
|
const handleConsentClick = async () => {
|
|
3508
3736
|
try {
|
|
3509
3737
|
setIsLoading(true);
|
|
@@ -3526,42 +3754,42 @@ var Permissions = ({
|
|
|
3526
3754
|
"Access your transaction history and trading activity",
|
|
3527
3755
|
"Keep this data updated and accessible when you're offline"
|
|
3528
3756
|
];
|
|
3529
|
-
return /* @__PURE__ */
|
|
3530
|
-
|
|
3757
|
+
return /* @__PURE__ */ React33.createElement(Modal, { isOpen: open, onClose, size: "xl" }, /* @__PURE__ */ React33.createElement(ModalHeader, { onClose }, "Permissions"), /* @__PURE__ */ React33.createElement(ModalBody, null, /* @__PURE__ */ React33.createElement(View17, { style: styles17.container }, /* @__PURE__ */ React33.createElement(ConnectLogo, null), errorMessage ? /* @__PURE__ */ React33.createElement(Alert, { variant: "destructive" }, /* @__PURE__ */ React33.createElement(AlertDescription, null, errorMessage)) : null, /* @__PURE__ */ React33.createElement(View17, { style: styles17.permissionsList }, /* @__PURE__ */ React33.createElement(
|
|
3758
|
+
Text15,
|
|
3531
3759
|
{
|
|
3532
|
-
style: [
|
|
3760
|
+
style: [styles17.subtitle, { color: theme.colors.textSecondary }]
|
|
3533
3761
|
},
|
|
3534
3762
|
"Allow ",
|
|
3535
3763
|
appName,
|
|
3536
3764
|
" to:"
|
|
3537
|
-
), permissionItems.map((item, index) => /* @__PURE__ */
|
|
3538
|
-
|
|
3765
|
+
), permissionItems.map((item, index) => /* @__PURE__ */ React33.createElement(View17, { key: `permission-${index}`, style: styles17.permissionItem }, /* @__PURE__ */ React33.createElement(Text15, { style: [styles17.bullet, { color: theme.colors.primary }] }, index + 1, "."), /* @__PURE__ */ React33.createElement(
|
|
3766
|
+
Text15,
|
|
3539
3767
|
{
|
|
3540
|
-
style: [
|
|
3768
|
+
style: [styles17.permissionText, { color: theme.colors.text }]
|
|
3541
3769
|
},
|
|
3542
3770
|
item
|
|
3543
|
-
)))), /* @__PURE__ */
|
|
3544
|
-
|
|
3771
|
+
)))), /* @__PURE__ */ React33.createElement(
|
|
3772
|
+
View17,
|
|
3545
3773
|
{
|
|
3546
3774
|
style: [
|
|
3547
|
-
|
|
3775
|
+
styles17.infoBox,
|
|
3548
3776
|
{
|
|
3549
3777
|
backgroundColor: theme.colors.surface,
|
|
3550
3778
|
borderColor: theme.colors.border
|
|
3551
3779
|
}
|
|
3552
3780
|
]
|
|
3553
3781
|
},
|
|
3554
|
-
/* @__PURE__ */
|
|
3555
|
-
|
|
3782
|
+
/* @__PURE__ */ React33.createElement(
|
|
3783
|
+
Text15,
|
|
3556
3784
|
{
|
|
3557
|
-
style: [
|
|
3785
|
+
style: [styles17.infoText, { color: theme.colors.textSecondary }]
|
|
3558
3786
|
},
|
|
3559
3787
|
"By selecting",
|
|
3560
3788
|
" ",
|
|
3561
|
-
/* @__PURE__ */
|
|
3789
|
+
/* @__PURE__ */ React33.createElement(Text15, { style: { fontWeight: "600", color: theme.colors.text } }, "'Allow'"),
|
|
3562
3790
|
", you agree to share this information and keep it updated."
|
|
3563
3791
|
)
|
|
3564
|
-
))), /* @__PURE__ */
|
|
3792
|
+
))), /* @__PURE__ */ React33.createElement(ModalFooter, { style: { paddingVertical: 8 } }, /* @__PURE__ */ React33.createElement(
|
|
3565
3793
|
Button,
|
|
3566
3794
|
{
|
|
3567
3795
|
variant: "outline",
|
|
@@ -3569,12 +3797,12 @@ var Permissions = ({
|
|
|
3569
3797
|
onPress: handleConsentClick,
|
|
3570
3798
|
loading: isLoading,
|
|
3571
3799
|
disabled: isLoading,
|
|
3572
|
-
style:
|
|
3800
|
+
style: styles17.button
|
|
3573
3801
|
},
|
|
3574
3802
|
"Allow"
|
|
3575
|
-
)));
|
|
3803
|
+
), /* @__PURE__ */ React33.createElement(Footer, null)));
|
|
3576
3804
|
};
|
|
3577
|
-
var
|
|
3805
|
+
var styles17 = StyleSheet17.create({
|
|
3578
3806
|
container: {
|
|
3579
3807
|
flex: 1
|
|
3580
3808
|
},
|
|
@@ -3632,8 +3860,8 @@ var styles14 = StyleSheet14.create({
|
|
|
3632
3860
|
});
|
|
3633
3861
|
|
|
3634
3862
|
// src/molecules/StatusModal.tsx
|
|
3635
|
-
import
|
|
3636
|
-
import {
|
|
3863
|
+
import React34 from "react";
|
|
3864
|
+
import { StyleSheet as StyleSheet18, Text as Text16, View as View18 } from "react-native";
|
|
3637
3865
|
var StatusModal = ({
|
|
3638
3866
|
open,
|
|
3639
3867
|
onClose,
|
|
@@ -3650,18 +3878,18 @@ var StatusModal = ({
|
|
|
3650
3878
|
}
|
|
3651
3879
|
onClose();
|
|
3652
3880
|
};
|
|
3653
|
-
return /* @__PURE__ */
|
|
3881
|
+
return /* @__PURE__ */ React34.createElement(Modal, { isOpen: open, onClose: handleClose, size: "sm" }, /* @__PURE__ */ React34.createElement(ModalHeader, { showCloseButton: false, onClose: handleClose }, ""), /* @__PURE__ */ React34.createElement(ModalBody, null, /* @__PURE__ */ React34.createElement(View18, { style: styles18.container }, /* @__PURE__ */ React34.createElement(View18, { style: styles18.iconContainer }, status === "success" ? /* @__PURE__ */ React34.createElement(SuccessIcon, { size: 80 }) : /* @__PURE__ */ React34.createElement(ErrorIcon, { size: 80 })), /* @__PURE__ */ React34.createElement(Text16, { style: [styles18.message, { color: theme.colors.text }] }, status === "success" ? "Connection successful" : "Connection failed"))), /* @__PURE__ */ React34.createElement(ModalFooter, { style: { paddingVertical: 8 } }, /* @__PURE__ */ React34.createElement(
|
|
3654
3882
|
Button,
|
|
3655
3883
|
{
|
|
3656
3884
|
variant: "outline",
|
|
3657
3885
|
size: "lg",
|
|
3658
3886
|
onPress: status === "success" ? onSuccess : onError,
|
|
3659
|
-
style:
|
|
3887
|
+
style: styles18.button
|
|
3660
3888
|
},
|
|
3661
3889
|
status === "success" ? "Continue" : "Try again later"
|
|
3662
|
-
))));
|
|
3890
|
+
), /* @__PURE__ */ React34.createElement(Footer, null)));
|
|
3663
3891
|
};
|
|
3664
|
-
var
|
|
3892
|
+
var styles18 = StyleSheet18.create({
|
|
3665
3893
|
container: {
|
|
3666
3894
|
flex: 1,
|
|
3667
3895
|
alignItems: "center",
|
|
@@ -3685,6 +3913,64 @@ var styles15 = StyleSheet15.create({
|
|
|
3685
3913
|
}
|
|
3686
3914
|
});
|
|
3687
3915
|
|
|
3916
|
+
// src/molecules/EndModal.tsx
|
|
3917
|
+
import React35, { useEffect as useEffect2 } from "react";
|
|
3918
|
+
import { StyleSheet as StyleSheet19, Text as Text17, View as View19 } from "react-native";
|
|
3919
|
+
var EndModal = ({ open, onClose }) => {
|
|
3920
|
+
const theme = useTheme();
|
|
3921
|
+
useEffect2(() => {
|
|
3922
|
+
if (!open) return;
|
|
3923
|
+
const timer = setTimeout(() => {
|
|
3924
|
+
onClose();
|
|
3925
|
+
}, 5e3);
|
|
3926
|
+
return () => clearTimeout(timer);
|
|
3927
|
+
}, []);
|
|
3928
|
+
return /* @__PURE__ */ React35.createElement(Modal, { isOpen: open, onClose, size: "md" }, /* @__PURE__ */ React35.createElement(ModalHeader, { onClose }, ""), /* @__PURE__ */ React35.createElement(ModalBody, null, /* @__PURE__ */ React35.createElement(View19, { style: styles19.container }, /* @__PURE__ */ React35.createElement(
|
|
3929
|
+
View19,
|
|
3930
|
+
{
|
|
3931
|
+
style: [
|
|
3932
|
+
styles19.iconContainer,
|
|
3933
|
+
{ backgroundColor: theme.colors.successLight }
|
|
3934
|
+
]
|
|
3935
|
+
},
|
|
3936
|
+
/* @__PURE__ */ React35.createElement(SuccessIcon, { size: 80 })
|
|
3937
|
+
), /* @__PURE__ */ React35.createElement(Text17, { style: [styles19.message, { color: theme.colors.text }] }, `All set! We're redirecting you back to the app. If it takes longer
|
|
3938
|
+
than expected, tap the button below to continue.`))), /* @__PURE__ */ React35.createElement(ModalFooter, { style: { paddingVertical: 8 } }, /* @__PURE__ */ React35.createElement(
|
|
3939
|
+
Button,
|
|
3940
|
+
{
|
|
3941
|
+
variant: "primary",
|
|
3942
|
+
size: "lg",
|
|
3943
|
+
onPress: onClose,
|
|
3944
|
+
style: styles19.button
|
|
3945
|
+
},
|
|
3946
|
+
"Continue to App"
|
|
3947
|
+
), /* @__PURE__ */ React35.createElement(Footer, null)));
|
|
3948
|
+
};
|
|
3949
|
+
var styles19 = StyleSheet19.create({
|
|
3950
|
+
container: {
|
|
3951
|
+
alignItems: "center",
|
|
3952
|
+
paddingVertical: 20
|
|
3953
|
+
},
|
|
3954
|
+
iconContainer: {
|
|
3955
|
+
width: 80,
|
|
3956
|
+
height: 80,
|
|
3957
|
+
borderRadius: 40,
|
|
3958
|
+
alignItems: "center",
|
|
3959
|
+
justifyContent: "center",
|
|
3960
|
+
marginBottom: 20
|
|
3961
|
+
},
|
|
3962
|
+
message: {
|
|
3963
|
+
fontSize: 14,
|
|
3964
|
+
textAlign: "center",
|
|
3965
|
+
lineHeight: 20,
|
|
3966
|
+
marginBottom: 24,
|
|
3967
|
+
paddingHorizontal: 20
|
|
3968
|
+
},
|
|
3969
|
+
button: {
|
|
3970
|
+
width: "100%"
|
|
3971
|
+
}
|
|
3972
|
+
});
|
|
3973
|
+
|
|
3688
3974
|
// src/KryptosConnectButton.tsx
|
|
3689
3975
|
var KryptosConnectButton = ({
|
|
3690
3976
|
children,
|
|
@@ -3695,14 +3981,14 @@ var KryptosConnectButton = ({
|
|
|
3695
3981
|
textStyle
|
|
3696
3982
|
}) => {
|
|
3697
3983
|
const { theme: themeName } = useKryptosConnect();
|
|
3698
|
-
const [open, setOpen] =
|
|
3984
|
+
const [open, setOpen] = React36.useState(false);
|
|
3699
3985
|
const theme = useTheme();
|
|
3700
|
-
return /* @__PURE__ */
|
|
3701
|
-
|
|
3986
|
+
return /* @__PURE__ */ React36.createElement(React36.Fragment, null, children ? /* @__PURE__ */ React36.createElement(TouchableOpacity8, { onPress: () => setOpen(true), style }, children) : /* @__PURE__ */ React36.createElement(
|
|
3987
|
+
TouchableOpacity8,
|
|
3702
3988
|
{
|
|
3703
3989
|
onPress: () => setOpen(true),
|
|
3704
3990
|
style: [
|
|
3705
|
-
|
|
3991
|
+
styles20.defaultButton,
|
|
3706
3992
|
themeName === "light" ? {
|
|
3707
3993
|
backgroundColor: theme.colors.white,
|
|
3708
3994
|
borderRadius: theme.borderRadius.md,
|
|
@@ -3716,11 +4002,11 @@ var KryptosConnectButton = ({
|
|
|
3716
4002
|
],
|
|
3717
4003
|
activeOpacity: 0.8
|
|
3718
4004
|
},
|
|
3719
|
-
/* @__PURE__ */
|
|
3720
|
-
|
|
4005
|
+
/* @__PURE__ */ React36.createElement(
|
|
4006
|
+
Text18,
|
|
3721
4007
|
{
|
|
3722
4008
|
style: [
|
|
3723
|
-
|
|
4009
|
+
styles20.buttonText,
|
|
3724
4010
|
{
|
|
3725
4011
|
color: themeName === "light" ? theme.colors.primary : theme.colors.white,
|
|
3726
4012
|
fontSize: theme.fontSize.lg
|
|
@@ -3731,8 +4017,8 @@ var KryptosConnectButton = ({
|
|
|
3731
4017
|
"Connect with",
|
|
3732
4018
|
" "
|
|
3733
4019
|
),
|
|
3734
|
-
/* @__PURE__ */
|
|
3735
|
-
), /* @__PURE__ */
|
|
4020
|
+
/* @__PURE__ */ React36.createElement(LogoIcon, { size: 24 })
|
|
4021
|
+
), /* @__PURE__ */ React36.createElement(
|
|
3736
4022
|
KryptosConnectModal,
|
|
3737
4023
|
{
|
|
3738
4024
|
open,
|
|
@@ -3756,9 +4042,11 @@ var KryptosConnectModal = ({
|
|
|
3756
4042
|
setUserConsent,
|
|
3757
4043
|
setUser,
|
|
3758
4044
|
setEmail,
|
|
3759
|
-
setLinkToken
|
|
4045
|
+
setLinkToken,
|
|
4046
|
+
isAuthorized,
|
|
4047
|
+
linkToken
|
|
3760
4048
|
} = useKryptosConnect();
|
|
3761
|
-
const [step, setStep] =
|
|
4049
|
+
const [step, setStep] = React36.useState("INIT" /* INIT */);
|
|
3762
4050
|
const handleClose = () => {
|
|
3763
4051
|
setOpen(false);
|
|
3764
4052
|
setIsInitialized(false);
|
|
@@ -3776,22 +4064,39 @@ var KryptosConnectModal = ({
|
|
|
3776
4064
|
onError?.(userConsent);
|
|
3777
4065
|
handleClose();
|
|
3778
4066
|
};
|
|
4067
|
+
const handleConsentClick = async () => {
|
|
4068
|
+
try {
|
|
4069
|
+
if (isAuthorized) {
|
|
4070
|
+
setStep("END" /* END */);
|
|
4071
|
+
return;
|
|
4072
|
+
}
|
|
4073
|
+
const res = await giveUserConsent(linkToken);
|
|
4074
|
+
setUserConsent(res);
|
|
4075
|
+
setStep("STATUS" /* STATUS */);
|
|
4076
|
+
} catch (error) {
|
|
4077
|
+
console.error(error);
|
|
4078
|
+
}
|
|
4079
|
+
};
|
|
3779
4080
|
const handleAbort = () => {
|
|
3780
4081
|
onError?.(new Error("User closed the modal"));
|
|
3781
4082
|
handleClose();
|
|
3782
4083
|
};
|
|
3783
4084
|
if (!open) return null;
|
|
3784
|
-
return /* @__PURE__ */
|
|
4085
|
+
return /* @__PURE__ */ React36.createElement(View20, { style: styles20.container }, step === "INIT" /* INIT */ && /* @__PURE__ */ React36.createElement(
|
|
3785
4086
|
Init,
|
|
3786
4087
|
{
|
|
3787
4088
|
open,
|
|
3788
4089
|
generateLinkToken,
|
|
3789
|
-
onSuccess: () => {
|
|
3790
|
-
|
|
4090
|
+
onSuccess: (data) => {
|
|
4091
|
+
if (data?.isAuthorized) {
|
|
4092
|
+
setStep("INTEGRATION" /* INTEGRATION */);
|
|
4093
|
+
} else {
|
|
4094
|
+
setStep("AUTH" /* AUTH */);
|
|
4095
|
+
}
|
|
3791
4096
|
},
|
|
3792
4097
|
onClose: handleAbort
|
|
3793
4098
|
}
|
|
3794
|
-
), step === "AUTH" /* AUTH */ && /* @__PURE__ */
|
|
4099
|
+
), step === "AUTH" /* AUTH */ && /* @__PURE__ */ React36.createElement(
|
|
3795
4100
|
Auth,
|
|
3796
4101
|
{
|
|
3797
4102
|
open,
|
|
@@ -3799,28 +4104,28 @@ var KryptosConnectModal = ({
|
|
|
3799
4104
|
onGuestSuccess: () => setStep("INTEGRATION" /* INTEGRATION */),
|
|
3800
4105
|
onClose: handleAbort
|
|
3801
4106
|
}
|
|
3802
|
-
), step === "OTP" /* OTP */ && /* @__PURE__ */
|
|
4107
|
+
), step === "OTP" /* OTP */ && /* @__PURE__ */ React36.createElement(
|
|
3803
4108
|
OTPVerify,
|
|
3804
4109
|
{
|
|
3805
4110
|
open,
|
|
3806
4111
|
onSuccess: () => setStep("INTEGRATION" /* INTEGRATION */),
|
|
3807
4112
|
onClose: handleAbort
|
|
3808
4113
|
}
|
|
3809
|
-
), step === "INTEGRATION" /* INTEGRATION */ && /* @__PURE__ */
|
|
4114
|
+
), step === "INTEGRATION" /* INTEGRATION */ && /* @__PURE__ */ React36.createElement(
|
|
3810
4115
|
Integration,
|
|
3811
4116
|
{
|
|
3812
4117
|
open,
|
|
3813
|
-
onSuccess:
|
|
4118
|
+
onSuccess: handleConsentClick,
|
|
3814
4119
|
onClose: handleAbort
|
|
3815
4120
|
}
|
|
3816
|
-
), step === "PERMISSIONS" /* PERMISSIONS */ && /* @__PURE__ */
|
|
4121
|
+
), step === "PERMISSIONS" /* PERMISSIONS */ && /* @__PURE__ */ React36.createElement(
|
|
3817
4122
|
Permissions,
|
|
3818
4123
|
{
|
|
3819
4124
|
open,
|
|
3820
4125
|
onClose: handleAbort,
|
|
3821
4126
|
onSuccess: () => setStep("STATUS" /* STATUS */)
|
|
3822
4127
|
}
|
|
3823
|
-
), step === "STATUS" /* STATUS */ && /* @__PURE__ */
|
|
4128
|
+
), step === "STATUS" /* STATUS */ && /* @__PURE__ */ React36.createElement(
|
|
3824
4129
|
StatusModal,
|
|
3825
4130
|
{
|
|
3826
4131
|
open,
|
|
@@ -3829,9 +4134,19 @@ var KryptosConnectModal = ({
|
|
|
3829
4134
|
onError: handleError,
|
|
3830
4135
|
status: userConsent?.public_token ? "success" : "error"
|
|
3831
4136
|
}
|
|
4137
|
+
), step === "END" /* END */ && /* @__PURE__ */ React36.createElement(
|
|
4138
|
+
EndModal,
|
|
4139
|
+
{
|
|
4140
|
+
open,
|
|
4141
|
+
onClose: () => {
|
|
4142
|
+
onSuccess?.(userConsent);
|
|
4143
|
+
setStep("INIT" /* INIT */);
|
|
4144
|
+
setOpen(false);
|
|
4145
|
+
}
|
|
4146
|
+
}
|
|
3832
4147
|
));
|
|
3833
4148
|
};
|
|
3834
|
-
var
|
|
4149
|
+
var styles20 = StyleSheet20.create({
|
|
3835
4150
|
defaultButton: {
|
|
3836
4151
|
flexDirection: "row",
|
|
3837
4152
|
alignItems: "center",
|