@kryptos_connect/mobile-sdk 0.0.0 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/index.d.mts +8 -2
- package/dist/index.d.ts +8 -2
- package/dist/index.js +218 -240
- package/dist/index.mjs +217 -239
- package/package.json +7 -7
package/dist/index.mjs
CHANGED
|
@@ -233,8 +233,8 @@ var useTheme = () => {
|
|
|
233
233
|
};
|
|
234
234
|
|
|
235
235
|
// src/molecules/Auth.tsx
|
|
236
|
-
import
|
|
237
|
-
import { View as
|
|
236
|
+
import React12 from "react";
|
|
237
|
+
import { View as View5, Text as Text5, StyleSheet as StyleSheet5 } from "react-native";
|
|
238
238
|
|
|
239
239
|
// src/assets/LinkIcon.tsx
|
|
240
240
|
import React4 from "react";
|
|
@@ -537,120 +537,14 @@ var styles2 = StyleSheet2.create({
|
|
|
537
537
|
}
|
|
538
538
|
});
|
|
539
539
|
|
|
540
|
-
// src/components/Input.tsx
|
|
541
|
-
import React8 from "react";
|
|
542
|
-
import {
|
|
543
|
-
View as View3,
|
|
544
|
-
TextInput,
|
|
545
|
-
Text as Text3,
|
|
546
|
-
StyleSheet as StyleSheet3
|
|
547
|
-
} from "react-native";
|
|
548
|
-
var Input = ({
|
|
549
|
-
label,
|
|
550
|
-
error,
|
|
551
|
-
helperText,
|
|
552
|
-
status = "default",
|
|
553
|
-
containerStyle,
|
|
554
|
-
inputStyle,
|
|
555
|
-
labelStyle,
|
|
556
|
-
...props
|
|
557
|
-
}) => {
|
|
558
|
-
const theme = useTheme();
|
|
559
|
-
const inputStatus = error ? "error" : status;
|
|
560
|
-
const getBorderColor = () => {
|
|
561
|
-
switch (inputStatus) {
|
|
562
|
-
case "error":
|
|
563
|
-
return theme.colors.error;
|
|
564
|
-
case "success":
|
|
565
|
-
return theme.colors.success;
|
|
566
|
-
default:
|
|
567
|
-
return theme.colors.border;
|
|
568
|
-
}
|
|
569
|
-
};
|
|
570
|
-
return /* @__PURE__ */ React8.createElement(View3, { style: [styles3.wrapper, containerStyle] }, label && /* @__PURE__ */ React8.createElement(
|
|
571
|
-
Text3,
|
|
572
|
-
{
|
|
573
|
-
style: [
|
|
574
|
-
styles3.label,
|
|
575
|
-
{ color: theme.colors.text, fontSize: theme.fontSize.sm },
|
|
576
|
-
labelStyle
|
|
577
|
-
]
|
|
578
|
-
},
|
|
579
|
-
label
|
|
580
|
-
), /* @__PURE__ */ React8.createElement(
|
|
581
|
-
TextInput,
|
|
582
|
-
{
|
|
583
|
-
placeholderTextColor: theme.colors.textTertiary,
|
|
584
|
-
style: [
|
|
585
|
-
styles3.input,
|
|
586
|
-
{
|
|
587
|
-
backgroundColor: theme.colors.surface,
|
|
588
|
-
borderColor: getBorderColor(),
|
|
589
|
-
color: theme.colors.text,
|
|
590
|
-
fontSize: theme.fontSize.md,
|
|
591
|
-
borderRadius: theme.borderRadius.md,
|
|
592
|
-
paddingHorizontal: theme.spacing.lg,
|
|
593
|
-
paddingVertical: theme.spacing.md
|
|
594
|
-
},
|
|
595
|
-
inputStyle
|
|
596
|
-
],
|
|
597
|
-
...props
|
|
598
|
-
}
|
|
599
|
-
), error && /* @__PURE__ */ React8.createElement(
|
|
600
|
-
Text3,
|
|
601
|
-
{
|
|
602
|
-
style: [
|
|
603
|
-
styles3.error,
|
|
604
|
-
{ color: theme.colors.error, fontSize: theme.fontSize.sm }
|
|
605
|
-
]
|
|
606
|
-
},
|
|
607
|
-
error
|
|
608
|
-
), helperText && !error && /* @__PURE__ */ React8.createElement(
|
|
609
|
-
Text3,
|
|
610
|
-
{
|
|
611
|
-
style: [
|
|
612
|
-
styles3.helper,
|
|
613
|
-
{
|
|
614
|
-
color: theme.colors.textSecondary,
|
|
615
|
-
fontSize: theme.fontSize.sm
|
|
616
|
-
}
|
|
617
|
-
]
|
|
618
|
-
},
|
|
619
|
-
helperText
|
|
620
|
-
));
|
|
621
|
-
};
|
|
622
|
-
var styles3 = StyleSheet3.create({
|
|
623
|
-
wrapper: {
|
|
624
|
-
marginBottom: 16
|
|
625
|
-
// theme.spacing.lg - consistent form spacing
|
|
626
|
-
},
|
|
627
|
-
label: {
|
|
628
|
-
fontWeight: "500",
|
|
629
|
-
marginBottom: 8
|
|
630
|
-
// theme.spacing.sm
|
|
631
|
-
},
|
|
632
|
-
input: {
|
|
633
|
-
borderWidth: 1,
|
|
634
|
-
minHeight: 48
|
|
635
|
-
},
|
|
636
|
-
error: {
|
|
637
|
-
marginTop: 4
|
|
638
|
-
// theme.spacing.xs
|
|
639
|
-
},
|
|
640
|
-
helper: {
|
|
641
|
-
marginTop: 4
|
|
642
|
-
// theme.spacing.xs
|
|
643
|
-
}
|
|
644
|
-
});
|
|
645
|
-
|
|
646
540
|
// src/components/Modal.tsx
|
|
647
|
-
import
|
|
541
|
+
import React9 from "react";
|
|
648
542
|
import {
|
|
649
543
|
Modal as RNModal,
|
|
650
|
-
View as
|
|
651
|
-
Text as
|
|
544
|
+
View as View3,
|
|
545
|
+
Text as Text3,
|
|
652
546
|
TouchableOpacity as TouchableOpacity2,
|
|
653
|
-
StyleSheet as
|
|
547
|
+
StyleSheet as StyleSheet3,
|
|
654
548
|
ScrollView,
|
|
655
549
|
KeyboardAvoidingView,
|
|
656
550
|
Platform,
|
|
@@ -658,13 +552,13 @@ import {
|
|
|
658
552
|
} from "react-native";
|
|
659
553
|
|
|
660
554
|
// src/assets/CloseIcon.tsx
|
|
661
|
-
import
|
|
555
|
+
import React8 from "react";
|
|
662
556
|
import Svg4, { Path as Path4 } from "react-native-svg";
|
|
663
557
|
var CloseIcon = ({
|
|
664
558
|
size = 20,
|
|
665
559
|
color = "#000"
|
|
666
560
|
}) => {
|
|
667
|
-
return /* @__PURE__ */
|
|
561
|
+
return /* @__PURE__ */ React8.createElement(Svg4, { width: size, height: size, viewBox: "0 0 20 20", fill: "none" }, /* @__PURE__ */ React8.createElement(
|
|
668
562
|
Path4,
|
|
669
563
|
{
|
|
670
564
|
d: "M15 5L5 15M5 5L15 15",
|
|
@@ -709,13 +603,13 @@ var Modal = ({
|
|
|
709
603
|
const handleOverlayPress = () => {
|
|
710
604
|
if (!disableClose && closeOnOverlayClick) onClose();
|
|
711
605
|
};
|
|
712
|
-
return /* @__PURE__ */
|
|
606
|
+
return /* @__PURE__ */ React9.createElement(
|
|
713
607
|
KeyboardAvoidingView,
|
|
714
608
|
{
|
|
715
609
|
behavior: Platform.OS === "ios" ? "padding" : "height",
|
|
716
|
-
style:
|
|
610
|
+
style: styles3.keyboardView
|
|
717
611
|
},
|
|
718
|
-
/* @__PURE__ */
|
|
612
|
+
/* @__PURE__ */ React9.createElement(
|
|
719
613
|
RNModal,
|
|
720
614
|
{
|
|
721
615
|
visible: isOpen,
|
|
@@ -724,18 +618,18 @@ var Modal = ({
|
|
|
724
618
|
statusBarTranslucent: true,
|
|
725
619
|
onRequestClose: disableClose ? void 0 : onClose
|
|
726
620
|
},
|
|
727
|
-
/* @__PURE__ */
|
|
621
|
+
/* @__PURE__ */ React9.createElement(
|
|
728
622
|
TouchableOpacity2,
|
|
729
623
|
{
|
|
730
624
|
activeOpacity: 1,
|
|
731
|
-
style: [
|
|
625
|
+
style: [styles3.overlay, { backgroundColor: theme.colors.overlay }],
|
|
732
626
|
onPress: handleOverlayPress
|
|
733
627
|
},
|
|
734
|
-
/* @__PURE__ */
|
|
735
|
-
|
|
628
|
+
/* @__PURE__ */ React9.createElement(
|
|
629
|
+
View3,
|
|
736
630
|
{
|
|
737
631
|
style: [
|
|
738
|
-
|
|
632
|
+
styles3.container,
|
|
739
633
|
{
|
|
740
634
|
backgroundColor: theme.colors.background,
|
|
741
635
|
borderTopLeftRadius: theme.borderRadius.xl,
|
|
@@ -762,11 +656,11 @@ var ModalHeader = ({
|
|
|
762
656
|
style
|
|
763
657
|
}) => {
|
|
764
658
|
const theme = useTheme();
|
|
765
|
-
return /* @__PURE__ */
|
|
766
|
-
|
|
659
|
+
return /* @__PURE__ */ React9.createElement(
|
|
660
|
+
View3,
|
|
767
661
|
{
|
|
768
662
|
style: [
|
|
769
|
-
|
|
663
|
+
styles3.header,
|
|
770
664
|
{
|
|
771
665
|
borderBottomColor: theme.colors.border,
|
|
772
666
|
paddingHorizontal: theme.spacing.lg,
|
|
@@ -775,27 +669,27 @@ var ModalHeader = ({
|
|
|
775
669
|
style
|
|
776
670
|
]
|
|
777
671
|
},
|
|
778
|
-
/* @__PURE__ */
|
|
779
|
-
|
|
672
|
+
/* @__PURE__ */ React9.createElement(View3, { style: styles3.headerContent }, typeof children === "string" ? /* @__PURE__ */ React9.createElement(
|
|
673
|
+
Text3,
|
|
780
674
|
{
|
|
781
675
|
style: [
|
|
782
|
-
|
|
676
|
+
styles3.title,
|
|
783
677
|
{ color: theme.colors.text, fontSize: theme.fontSize.lg }
|
|
784
678
|
]
|
|
785
679
|
},
|
|
786
680
|
children
|
|
787
681
|
) : children),
|
|
788
|
-
showCloseButton && onClose && /* @__PURE__ */
|
|
682
|
+
showCloseButton && onClose && /* @__PURE__ */ React9.createElement(
|
|
789
683
|
TouchableOpacity2,
|
|
790
684
|
{
|
|
791
685
|
onPress: onClose,
|
|
792
686
|
hitSlop: { top: 10, bottom: 10, left: 10, right: 10 },
|
|
793
687
|
style: [
|
|
794
|
-
|
|
688
|
+
styles3.closeButton,
|
|
795
689
|
{ backgroundColor: theme.colors.surface }
|
|
796
690
|
]
|
|
797
691
|
},
|
|
798
|
-
/* @__PURE__ */
|
|
692
|
+
/* @__PURE__ */ React9.createElement(CloseIcon, { color: theme.colors.text, size: 20 })
|
|
799
693
|
)
|
|
800
694
|
);
|
|
801
695
|
};
|
|
@@ -806,12 +700,12 @@ var ModalBody = ({
|
|
|
806
700
|
}) => {
|
|
807
701
|
const theme = useTheme();
|
|
808
702
|
if (scrollable) {
|
|
809
|
-
return /* @__PURE__ */
|
|
703
|
+
return /* @__PURE__ */ React9.createElement(
|
|
810
704
|
ScrollView,
|
|
811
705
|
{
|
|
812
|
-
style:
|
|
706
|
+
style: styles3.bodyScroll,
|
|
813
707
|
contentContainerStyle: [
|
|
814
|
-
|
|
708
|
+
styles3.bodyContent,
|
|
815
709
|
{ padding: theme.spacing.lg },
|
|
816
710
|
style
|
|
817
711
|
],
|
|
@@ -821,18 +715,18 @@ var ModalBody = ({
|
|
|
821
715
|
children
|
|
822
716
|
);
|
|
823
717
|
}
|
|
824
|
-
return /* @__PURE__ */
|
|
718
|
+
return /* @__PURE__ */ React9.createElement(View3, { style: [styles3.body, { padding: theme.spacing.lg }, style] }, children);
|
|
825
719
|
};
|
|
826
720
|
var ModalFooter = ({
|
|
827
721
|
children,
|
|
828
722
|
style
|
|
829
723
|
}) => {
|
|
830
724
|
const theme = useTheme();
|
|
831
|
-
return /* @__PURE__ */
|
|
832
|
-
|
|
725
|
+
return /* @__PURE__ */ React9.createElement(
|
|
726
|
+
View3,
|
|
833
727
|
{
|
|
834
728
|
style: [
|
|
835
|
-
|
|
729
|
+
styles3.footer,
|
|
836
730
|
{
|
|
837
731
|
borderTopColor: theme.colors.border,
|
|
838
732
|
paddingHorizontal: theme.spacing.lg,
|
|
@@ -844,7 +738,7 @@ var ModalFooter = ({
|
|
|
844
738
|
children
|
|
845
739
|
);
|
|
846
740
|
};
|
|
847
|
-
var
|
|
741
|
+
var styles3 = StyleSheet3.create({
|
|
848
742
|
keyboardView: {
|
|
849
743
|
flex: 1
|
|
850
744
|
},
|
|
@@ -905,7 +799,7 @@ var styles4 = StyleSheet4.create({
|
|
|
905
799
|
import axios from "axios";
|
|
906
800
|
|
|
907
801
|
// src/config/index.ts
|
|
908
|
-
var BASE_URL = "https://connect-dev.kryptos.io/
|
|
802
|
+
var BASE_URL = "https://connect-api-dev.kryptos.io/";
|
|
909
803
|
|
|
910
804
|
// src/services/api.ts
|
|
911
805
|
var api = axios.create({
|
|
@@ -914,7 +808,7 @@ var api = axios.create({
|
|
|
914
808
|
"Content-Type": "application/json"
|
|
915
809
|
}
|
|
916
810
|
});
|
|
917
|
-
var SCOPES = "openid offline_access
|
|
811
|
+
var SCOPES = "openid profile offline_access email portfolios:read transactions:read integrations:read tax:read accounting:read reports:read workspace:read users:read";
|
|
918
812
|
async function sendEmailOtp(linkToken, email, clientId) {
|
|
919
813
|
const res = await api.post(
|
|
920
814
|
"/v1/sendEmailOTP",
|
|
@@ -925,7 +819,7 @@ async function sendEmailOtp(linkToken, email, clientId) {
|
|
|
925
819
|
},
|
|
926
820
|
{
|
|
927
821
|
headers: {
|
|
928
|
-
"X-
|
|
822
|
+
"X-LINK-TOKEN": linkToken
|
|
929
823
|
}
|
|
930
824
|
}
|
|
931
825
|
);
|
|
@@ -942,7 +836,7 @@ async function loginWithOtp(linkToken, email, code, clientId) {
|
|
|
942
836
|
},
|
|
943
837
|
{
|
|
944
838
|
headers: {
|
|
945
|
-
"X-
|
|
839
|
+
"X-LINK-TOKEN": linkToken
|
|
946
840
|
}
|
|
947
841
|
}
|
|
948
842
|
);
|
|
@@ -950,11 +844,11 @@ async function loginWithOtp(linkToken, email, code, clientId) {
|
|
|
950
844
|
}
|
|
951
845
|
async function createAnonymousUser(linkToken, clientId) {
|
|
952
846
|
const res = await api.post(
|
|
953
|
-
"/
|
|
847
|
+
"/link-token/login",
|
|
954
848
|
{ clientId },
|
|
955
849
|
{
|
|
956
850
|
headers: {
|
|
957
|
-
"X-
|
|
851
|
+
"X-LINK-TOKEN": linkToken
|
|
958
852
|
}
|
|
959
853
|
}
|
|
960
854
|
);
|
|
@@ -962,84 +856,83 @@ async function createAnonymousUser(linkToken, clientId) {
|
|
|
962
856
|
}
|
|
963
857
|
async function addUserIntegration(linkToken, integration) {
|
|
964
858
|
const res = await api.post(
|
|
965
|
-
"/
|
|
966
|
-
{
|
|
859
|
+
"/integrations/keys",
|
|
860
|
+
{ keys: [...integration] },
|
|
967
861
|
{
|
|
968
862
|
headers: {
|
|
969
|
-
"X-
|
|
863
|
+
"X-LINK-TOKEN": linkToken
|
|
970
864
|
}
|
|
971
865
|
}
|
|
972
866
|
);
|
|
973
|
-
return res.data;
|
|
867
|
+
return res.data?.data;
|
|
974
868
|
}
|
|
975
869
|
async function giveUserConsent(linkToken) {
|
|
976
870
|
const res = await api.post(
|
|
977
|
-
"/
|
|
871
|
+
"/consent",
|
|
978
872
|
{
|
|
979
|
-
granted_scopes: SCOPES
|
|
980
|
-
user_consent: true
|
|
873
|
+
granted_scopes: SCOPES
|
|
981
874
|
},
|
|
982
875
|
{
|
|
983
876
|
headers: {
|
|
984
|
-
"X-
|
|
877
|
+
"X-LINK-TOKEN": linkToken
|
|
985
878
|
}
|
|
986
879
|
}
|
|
987
880
|
);
|
|
988
|
-
return res.data;
|
|
881
|
+
return res.data?.data;
|
|
989
882
|
}
|
|
990
883
|
async function testCredentials(linkToken, data) {
|
|
991
|
-
const res = await api.post("/
|
|
884
|
+
const res = await api.post("/integrations/credentials/test", data, {
|
|
992
885
|
headers: {
|
|
993
|
-
"X-
|
|
886
|
+
"X-LINK-TOKEN": linkToken
|
|
994
887
|
}
|
|
995
888
|
});
|
|
996
|
-
return res.data;
|
|
889
|
+
return res.data?.data;
|
|
997
890
|
}
|
|
998
891
|
async function getSupportedProviders(linkToken) {
|
|
999
|
-
const res = await api.get("/
|
|
892
|
+
const res = await api.get("/integrations/providers", {
|
|
1000
893
|
headers: {
|
|
1001
|
-
"X-
|
|
894
|
+
"X-LINK-TOKEN": linkToken
|
|
1002
895
|
}
|
|
1003
896
|
});
|
|
1004
|
-
return res.data;
|
|
897
|
+
return res.data?.data;
|
|
1005
898
|
}
|
|
1006
899
|
async function getUserIntegrations(linkToken) {
|
|
1007
|
-
const res = await api.get("/
|
|
900
|
+
const res = await api.get("/integrations", {
|
|
1008
901
|
headers: {
|
|
1009
|
-
"X-
|
|
902
|
+
"X-LINK-TOKEN": linkToken
|
|
1010
903
|
}
|
|
1011
904
|
});
|
|
1012
|
-
return res.data;
|
|
905
|
+
return res.data?.data;
|
|
1013
906
|
}
|
|
1014
907
|
async function getUserUsedChains(linkToken, address) {
|
|
1015
|
-
const res = await api.get("/
|
|
908
|
+
const res = await api.get("/integrations/user-used-chain", {
|
|
1016
909
|
headers: {
|
|
1017
|
-
"X-
|
|
910
|
+
"X-LINK-TOKEN": linkToken
|
|
1018
911
|
},
|
|
1019
912
|
params: {
|
|
1020
913
|
id: address
|
|
1021
914
|
}
|
|
1022
915
|
});
|
|
1023
|
-
return res.data;
|
|
916
|
+
return res.data?.data?.chains || [];
|
|
1024
917
|
}
|
|
1025
918
|
|
|
1026
919
|
// src/molecules/ConnectLogo.tsx
|
|
1027
|
-
import
|
|
920
|
+
import React11, { isValidElement } from "react";
|
|
1028
921
|
import {
|
|
1029
922
|
Image,
|
|
1030
|
-
StyleSheet as
|
|
1031
|
-
Text as
|
|
1032
|
-
View as
|
|
923
|
+
StyleSheet as StyleSheet4,
|
|
924
|
+
Text as Text4,
|
|
925
|
+
View as View4
|
|
1033
926
|
} from "react-native";
|
|
1034
927
|
|
|
1035
928
|
// src/assets/UnplugIcon.tsx
|
|
1036
|
-
import
|
|
929
|
+
import React10 from "react";
|
|
1037
930
|
import Svg5, { Path as Path5, Line } from "react-native-svg";
|
|
1038
931
|
var UnplugIcon = ({
|
|
1039
932
|
size = 24,
|
|
1040
933
|
color = "#6B7280"
|
|
1041
934
|
}) => {
|
|
1042
|
-
return /* @__PURE__ */
|
|
935
|
+
return /* @__PURE__ */ React10.createElement(Svg5, { width: size, height: size, viewBox: "0 0 24 24", fill: "none" }, /* @__PURE__ */ React10.createElement(
|
|
1043
936
|
Path5,
|
|
1044
937
|
{
|
|
1045
938
|
d: "m19 5 3-3",
|
|
@@ -1048,7 +941,7 @@ var UnplugIcon = ({
|
|
|
1048
941
|
strokeLinecap: "round",
|
|
1049
942
|
strokeLinejoin: "round"
|
|
1050
943
|
}
|
|
1051
|
-
), /* @__PURE__ */
|
|
944
|
+
), /* @__PURE__ */ React10.createElement(
|
|
1052
945
|
Path5,
|
|
1053
946
|
{
|
|
1054
947
|
d: "m2 22 3-3",
|
|
@@ -1057,7 +950,7 @@ var UnplugIcon = ({
|
|
|
1057
950
|
strokeLinecap: "round",
|
|
1058
951
|
strokeLinejoin: "round"
|
|
1059
952
|
}
|
|
1060
|
-
), /* @__PURE__ */
|
|
953
|
+
), /* @__PURE__ */ React10.createElement(
|
|
1061
954
|
Path5,
|
|
1062
955
|
{
|
|
1063
956
|
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",
|
|
@@ -1066,7 +959,7 @@ var UnplugIcon = ({
|
|
|
1066
959
|
strokeLinecap: "round",
|
|
1067
960
|
strokeLinejoin: "round"
|
|
1068
961
|
}
|
|
1069
|
-
), /* @__PURE__ */
|
|
962
|
+
), /* @__PURE__ */ React10.createElement(
|
|
1070
963
|
Path5,
|
|
1071
964
|
{
|
|
1072
965
|
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",
|
|
@@ -1075,7 +968,7 @@ var UnplugIcon = ({
|
|
|
1075
968
|
strokeLinecap: "round",
|
|
1076
969
|
strokeLinejoin: "round"
|
|
1077
970
|
}
|
|
1078
|
-
), /* @__PURE__ */
|
|
971
|
+
), /* @__PURE__ */ React10.createElement(
|
|
1079
972
|
Line,
|
|
1080
973
|
{
|
|
1081
974
|
x1: 7.5,
|
|
@@ -1092,12 +985,12 @@ var UnplugIcon = ({
|
|
|
1092
985
|
// src/molecules/ConnectLogo.tsx
|
|
1093
986
|
var KryptosLogo = () => {
|
|
1094
987
|
const theme = useTheme();
|
|
1095
|
-
return /* @__PURE__ */
|
|
1096
|
-
|
|
988
|
+
return /* @__PURE__ */ React11.createElement(
|
|
989
|
+
View4,
|
|
1097
990
|
{
|
|
1098
|
-
style: [
|
|
991
|
+
style: [styles4.logoContainer, { backgroundColor: theme.colors.surface }]
|
|
1099
992
|
},
|
|
1100
|
-
/* @__PURE__ */
|
|
993
|
+
/* @__PURE__ */ React11.createElement(LogoIcon, { size: 36 })
|
|
1101
994
|
);
|
|
1102
995
|
};
|
|
1103
996
|
var ConnectLogo = () => {
|
|
@@ -1115,40 +1008,40 @@ var ConnectLogo = () => {
|
|
|
1115
1008
|
if (isValidElement(appLogo)) {
|
|
1116
1009
|
return appLogo;
|
|
1117
1010
|
} else if (typeof appLogo === "string" && isValidUrl(appLogo)) {
|
|
1118
|
-
return /* @__PURE__ */
|
|
1011
|
+
return /* @__PURE__ */ React11.createElement(
|
|
1119
1012
|
Image,
|
|
1120
1013
|
{
|
|
1121
1014
|
source: { uri: appLogo },
|
|
1122
|
-
style:
|
|
1015
|
+
style: styles4.appLogoImage,
|
|
1123
1016
|
resizeMode: "contain"
|
|
1124
1017
|
}
|
|
1125
1018
|
);
|
|
1126
1019
|
} else if (typeof appLogo === "number" || typeof appLogo === "object" && appLogo !== null) {
|
|
1127
|
-
return /* @__PURE__ */
|
|
1020
|
+
return /* @__PURE__ */ React11.createElement(
|
|
1128
1021
|
Image,
|
|
1129
1022
|
{
|
|
1130
1023
|
source: appLogo,
|
|
1131
|
-
style:
|
|
1024
|
+
style: styles4.appLogoImage,
|
|
1132
1025
|
resizeMode: "contain"
|
|
1133
1026
|
}
|
|
1134
1027
|
);
|
|
1135
1028
|
} else if (appName) {
|
|
1136
|
-
return /* @__PURE__ */
|
|
1029
|
+
return /* @__PURE__ */ React11.createElement(Text4, { style: [styles4.appLogoText, { color: theme.colors.text }] }, appName.charAt(0).toUpperCase());
|
|
1137
1030
|
}
|
|
1138
|
-
return /* @__PURE__ */
|
|
1031
|
+
return /* @__PURE__ */ React11.createElement(Text4, { style: [styles4.appLogoText, { color: theme.colors.text }] }, "?");
|
|
1139
1032
|
};
|
|
1140
|
-
return /* @__PURE__ */
|
|
1141
|
-
|
|
1033
|
+
return /* @__PURE__ */ React11.createElement(View4, { style: styles4.container }, /* @__PURE__ */ React11.createElement(KryptosLogo, null), /* @__PURE__ */ React11.createElement(View4, { style: styles4.iconContainer }, /* @__PURE__ */ React11.createElement(UnplugIcon, { size: 24, color: theme.colors.textSecondary })), /* @__PURE__ */ React11.createElement(
|
|
1034
|
+
View4,
|
|
1142
1035
|
{
|
|
1143
1036
|
style: [
|
|
1144
|
-
|
|
1037
|
+
styles4.logoContainer,
|
|
1145
1038
|
{ backgroundColor: theme.colors.surface }
|
|
1146
1039
|
]
|
|
1147
1040
|
},
|
|
1148
1041
|
renderLogo()
|
|
1149
1042
|
));
|
|
1150
1043
|
};
|
|
1151
|
-
var
|
|
1044
|
+
var styles4 = StyleSheet4.create({
|
|
1152
1045
|
container: {
|
|
1153
1046
|
flexDirection: "row",
|
|
1154
1047
|
alignItems: "center",
|
|
@@ -1191,11 +1084,11 @@ var Auth = ({
|
|
|
1191
1084
|
}) => {
|
|
1192
1085
|
const { appName, linkToken, clientId, setUser, setEmail } = useKryptosConnect();
|
|
1193
1086
|
const theme = useTheme();
|
|
1194
|
-
const [isLoading, setIsLoading] =
|
|
1195
|
-
const [errorMessage, setErrorMessage] =
|
|
1196
|
-
const [emailValue, setEmailValue] =
|
|
1197
|
-
const [emailError, setEmailError] =
|
|
1198
|
-
const [loadingType, setLoadingType] =
|
|
1087
|
+
const [isLoading, setIsLoading] = React12.useState(false);
|
|
1088
|
+
const [errorMessage, setErrorMessage] = React12.useState("");
|
|
1089
|
+
const [emailValue, setEmailValue] = React12.useState("");
|
|
1090
|
+
const [emailError, setEmailError] = React12.useState("");
|
|
1091
|
+
const [loadingType, setLoadingType] = React12.useState(null);
|
|
1199
1092
|
const validateEmail = (email) => {
|
|
1200
1093
|
const emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
|
|
1201
1094
|
if (!email) {
|
|
@@ -1257,52 +1150,27 @@ var Auth = ({
|
|
|
1257
1150
|
};
|
|
1258
1151
|
const infoSections = [
|
|
1259
1152
|
{
|
|
1260
|
-
icon: /* @__PURE__ */
|
|
1153
|
+
icon: /* @__PURE__ */ React12.createElement(LinkIcon, { size: 20, color: theme.colors.primary }),
|
|
1261
1154
|
title: "Simple and secure",
|
|
1262
1155
|
text: "Connect your Web3 accounts with Kryptos in just a few clicks"
|
|
1263
1156
|
},
|
|
1264
1157
|
{
|
|
1265
|
-
icon: /* @__PURE__ */
|
|
1158
|
+
icon: /* @__PURE__ */ React12.createElement(ShieldIcon, { size: 20, color: theme.colors.primary }),
|
|
1266
1159
|
title: "Control what you share",
|
|
1267
1160
|
text: "We never share your data without your permission"
|
|
1268
1161
|
}
|
|
1269
1162
|
];
|
|
1270
|
-
return /* @__PURE__ */
|
|
1271
|
-
|
|
1163
|
+
return /* @__PURE__ */ React12.createElement(Modal, { isOpen: open, onClose: handleClose, size: "full" }, /* @__PURE__ */ React12.createElement(ModalHeader, { onClose: handleClose }, ""), /* @__PURE__ */ React12.createElement(ModalBody, null, /* @__PURE__ */ React12.createElement(View5, { style: styles5.container }, /* @__PURE__ */ React12.createElement(Text5, { style: [styles5.title, { color: theme.colors.text }] }, "Connect ", appName, " to your Kryptos account"), /* @__PURE__ */ React12.createElement(ConnectLogo, null), infoSections.map((section, index) => /* @__PURE__ */ React12.createElement(View5, { key: `info-${index}`, style: styles5.infoSection }, /* @__PURE__ */ React12.createElement(View5, { style: styles5.infoIcon }, section.icon), /* @__PURE__ */ React12.createElement(View5, { style: styles5.infoContent }, /* @__PURE__ */ React12.createElement(Text5, { style: [styles5.infoTitle, { color: theme.colors.text }] }, section.title), /* @__PURE__ */ React12.createElement(
|
|
1164
|
+
Text5,
|
|
1272
1165
|
{
|
|
1273
1166
|
style: [
|
|
1274
|
-
|
|
1167
|
+
styles5.infoDescription,
|
|
1275
1168
|
{ color: theme.colors.textSecondary }
|
|
1276
1169
|
]
|
|
1277
1170
|
},
|
|
1278
1171
|
section.text
|
|
1279
|
-
)))), errorMessage ? /* @__PURE__ */
|
|
1280
|
-
|
|
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(
|
|
1294
|
-
Button,
|
|
1295
|
-
{
|
|
1296
|
-
variant: "outline",
|
|
1297
|
-
size: "lg",
|
|
1298
|
-
onPress: handleEmailSubmit,
|
|
1299
|
-
loading: loadingType === "email",
|
|
1300
|
-
disabled: isLoading,
|
|
1301
|
-
style: styles6.button
|
|
1302
|
-
},
|
|
1303
|
-
"Continue"
|
|
1304
|
-
), /* @__PURE__ */ React13.createElement(Text6, { style: [styles6.footer, { color: theme.colors.textSecondary }] }, "By continuing, you agree to Kryptos", " ", /* @__PURE__ */ React13.createElement(
|
|
1305
|
-
Text6,
|
|
1172
|
+
)))), errorMessage ? /* @__PURE__ */ React12.createElement(Alert, { variant: "destructive" }, /* @__PURE__ */ React12.createElement(AlertDescription, null, errorMessage)) : null, /* @__PURE__ */ React12.createElement(Text5, { style: [styles5.footer, { color: theme.colors.textSecondary }] }, "By continuing, you agree to Kryptos", " ", /* @__PURE__ */ React12.createElement(
|
|
1173
|
+
Text5,
|
|
1306
1174
|
{
|
|
1307
1175
|
style: {
|
|
1308
1176
|
color: theme.colors.primary,
|
|
@@ -1310,20 +1178,20 @@ var Auth = ({
|
|
|
1310
1178
|
}
|
|
1311
1179
|
},
|
|
1312
1180
|
"Privacy Policy"
|
|
1313
|
-
)), /* @__PURE__ */
|
|
1181
|
+
)), /* @__PURE__ */ React12.createElement(
|
|
1314
1182
|
Button,
|
|
1315
1183
|
{
|
|
1316
|
-
variant: "
|
|
1184
|
+
variant: "outline",
|
|
1317
1185
|
size: "lg",
|
|
1318
1186
|
onPress: handleContinueAsGuest,
|
|
1319
1187
|
loading: loadingType === "guest",
|
|
1320
1188
|
disabled: isLoading,
|
|
1321
|
-
style:
|
|
1189
|
+
style: styles5.button
|
|
1322
1190
|
},
|
|
1323
1191
|
"Continue as guest"
|
|
1324
1192
|
))));
|
|
1325
1193
|
};
|
|
1326
|
-
var
|
|
1194
|
+
var styles5 = StyleSheet5.create({
|
|
1327
1195
|
container: {
|
|
1328
1196
|
flex: 1
|
|
1329
1197
|
},
|
|
@@ -1379,6 +1247,112 @@ var styles6 = StyleSheet6.create({
|
|
|
1379
1247
|
}
|
|
1380
1248
|
});
|
|
1381
1249
|
|
|
1250
|
+
// src/components/Input.tsx
|
|
1251
|
+
import React13 from "react";
|
|
1252
|
+
import {
|
|
1253
|
+
View as View6,
|
|
1254
|
+
TextInput,
|
|
1255
|
+
Text as Text6,
|
|
1256
|
+
StyleSheet as StyleSheet6
|
|
1257
|
+
} from "react-native";
|
|
1258
|
+
var Input = ({
|
|
1259
|
+
label,
|
|
1260
|
+
error,
|
|
1261
|
+
helperText,
|
|
1262
|
+
status = "default",
|
|
1263
|
+
containerStyle,
|
|
1264
|
+
inputStyle,
|
|
1265
|
+
labelStyle,
|
|
1266
|
+
...props
|
|
1267
|
+
}) => {
|
|
1268
|
+
const theme = useTheme();
|
|
1269
|
+
const inputStatus = error ? "error" : status;
|
|
1270
|
+
const getBorderColor = () => {
|
|
1271
|
+
switch (inputStatus) {
|
|
1272
|
+
case "error":
|
|
1273
|
+
return theme.colors.error;
|
|
1274
|
+
case "success":
|
|
1275
|
+
return theme.colors.success;
|
|
1276
|
+
default:
|
|
1277
|
+
return theme.colors.border;
|
|
1278
|
+
}
|
|
1279
|
+
};
|
|
1280
|
+
return /* @__PURE__ */ React13.createElement(View6, { style: [styles6.wrapper, containerStyle] }, label && /* @__PURE__ */ React13.createElement(
|
|
1281
|
+
Text6,
|
|
1282
|
+
{
|
|
1283
|
+
style: [
|
|
1284
|
+
styles6.label,
|
|
1285
|
+
{ color: theme.colors.text, fontSize: theme.fontSize.sm },
|
|
1286
|
+
labelStyle
|
|
1287
|
+
]
|
|
1288
|
+
},
|
|
1289
|
+
label
|
|
1290
|
+
), /* @__PURE__ */ React13.createElement(
|
|
1291
|
+
TextInput,
|
|
1292
|
+
{
|
|
1293
|
+
placeholderTextColor: theme.colors.textTertiary,
|
|
1294
|
+
style: [
|
|
1295
|
+
styles6.input,
|
|
1296
|
+
{
|
|
1297
|
+
backgroundColor: theme.colors.surface,
|
|
1298
|
+
borderColor: getBorderColor(),
|
|
1299
|
+
color: theme.colors.text,
|
|
1300
|
+
fontSize: theme.fontSize.md,
|
|
1301
|
+
borderRadius: theme.borderRadius.md,
|
|
1302
|
+
paddingHorizontal: theme.spacing.lg,
|
|
1303
|
+
paddingVertical: theme.spacing.md
|
|
1304
|
+
},
|
|
1305
|
+
inputStyle
|
|
1306
|
+
],
|
|
1307
|
+
...props
|
|
1308
|
+
}
|
|
1309
|
+
), error && /* @__PURE__ */ React13.createElement(
|
|
1310
|
+
Text6,
|
|
1311
|
+
{
|
|
1312
|
+
style: [
|
|
1313
|
+
styles6.error,
|
|
1314
|
+
{ color: theme.colors.error, fontSize: theme.fontSize.sm }
|
|
1315
|
+
]
|
|
1316
|
+
},
|
|
1317
|
+
error
|
|
1318
|
+
), helperText && !error && /* @__PURE__ */ React13.createElement(
|
|
1319
|
+
Text6,
|
|
1320
|
+
{
|
|
1321
|
+
style: [
|
|
1322
|
+
styles6.helper,
|
|
1323
|
+
{
|
|
1324
|
+
color: theme.colors.textSecondary,
|
|
1325
|
+
fontSize: theme.fontSize.sm
|
|
1326
|
+
}
|
|
1327
|
+
]
|
|
1328
|
+
},
|
|
1329
|
+
helperText
|
|
1330
|
+
));
|
|
1331
|
+
};
|
|
1332
|
+
var styles6 = StyleSheet6.create({
|
|
1333
|
+
wrapper: {
|
|
1334
|
+
marginBottom: 16
|
|
1335
|
+
// theme.spacing.lg - consistent form spacing
|
|
1336
|
+
},
|
|
1337
|
+
label: {
|
|
1338
|
+
fontWeight: "500",
|
|
1339
|
+
marginBottom: 8
|
|
1340
|
+
// theme.spacing.sm
|
|
1341
|
+
},
|
|
1342
|
+
input: {
|
|
1343
|
+
borderWidth: 1,
|
|
1344
|
+
minHeight: 48
|
|
1345
|
+
},
|
|
1346
|
+
error: {
|
|
1347
|
+
marginTop: 4
|
|
1348
|
+
// theme.spacing.xs
|
|
1349
|
+
},
|
|
1350
|
+
helper: {
|
|
1351
|
+
marginTop: 4
|
|
1352
|
+
// theme.spacing.xs
|
|
1353
|
+
}
|
|
1354
|
+
});
|
|
1355
|
+
|
|
1382
1356
|
// src/components/OTP.tsx
|
|
1383
1357
|
import React14 from "react";
|
|
1384
1358
|
import {
|
|
@@ -1561,14 +1535,14 @@ var Init = ({
|
|
|
1561
1535
|
setError(null);
|
|
1562
1536
|
try {
|
|
1563
1537
|
const linkToken = await generateLinkToken();
|
|
1564
|
-
if (!linkToken) {
|
|
1538
|
+
if (!linkToken || !linkToken?.link_token || linkToken.link_token === "" || linkToken.link_token === null || linkToken.link_token === void 0) {
|
|
1565
1539
|
setIsInitialized(false);
|
|
1566
1540
|
setError("Failed to fetch link token. Please try again.");
|
|
1567
1541
|
return;
|
|
1568
1542
|
}
|
|
1569
|
-
setLinkToken(linkToken);
|
|
1543
|
+
setLinkToken(linkToken.link_token);
|
|
1570
1544
|
setIsInitialized(true);
|
|
1571
|
-
onSuccess();
|
|
1545
|
+
onSuccess(linkToken.isAuthorized ? { isAuthorized: true } : null);
|
|
1572
1546
|
} catch (err) {
|
|
1573
1547
|
console.error("Failed to fetch link token:", err);
|
|
1574
1548
|
setIsInitialized(false);
|
|
@@ -2090,7 +2064,7 @@ function ConnectButton({
|
|
|
2090
2064
|
);
|
|
2091
2065
|
results.forEach((result, index) => {
|
|
2092
2066
|
const { chain, walletId, alias } = walletTestsPayload[index];
|
|
2093
|
-
if (result.status === "fulfilled") {
|
|
2067
|
+
if (result.status === "fulfilled" && result.value?.valid) {
|
|
2094
2068
|
const data = {
|
|
2095
2069
|
alias,
|
|
2096
2070
|
exchange: integration.id.toLowerCase(),
|
|
@@ -2505,7 +2479,7 @@ var IntegrationForm = ({
|
|
|
2505
2479
|
);
|
|
2506
2480
|
results.forEach((result, index) => {
|
|
2507
2481
|
const { chain, walletId, alias } = credentialTestsData[index];
|
|
2508
|
-
if (result.status === "fulfilled" && result.value?.
|
|
2482
|
+
if (result.status === "fulfilled" && result.value?.valid) {
|
|
2509
2483
|
const data = {
|
|
2510
2484
|
alias,
|
|
2511
2485
|
exchange: metadata.id.toLowerCase(),
|
|
@@ -2576,7 +2550,7 @@ var IntegrationForm = ({
|
|
|
2576
2550
|
}
|
|
2577
2551
|
};
|
|
2578
2552
|
const testResult = await testCredentials(linkToken, { ...credential });
|
|
2579
|
-
if (!testResult?.value?.
|
|
2553
|
+
if (!testResult?.value?.valid) {
|
|
2580
2554
|
setErrorMessage(
|
|
2581
2555
|
testResult?.value?.message || "Credentials are invalid"
|
|
2582
2556
|
);
|
|
@@ -3786,8 +3760,12 @@ var KryptosConnectModal = ({
|
|
|
3786
3760
|
{
|
|
3787
3761
|
open,
|
|
3788
3762
|
generateLinkToken,
|
|
3789
|
-
onSuccess: () => {
|
|
3790
|
-
|
|
3763
|
+
onSuccess: (data) => {
|
|
3764
|
+
if (data?.isAuthorized) {
|
|
3765
|
+
setStep("INTEGRATION" /* INTEGRATION */);
|
|
3766
|
+
} else {
|
|
3767
|
+
setStep("AUTH" /* AUTH */);
|
|
3768
|
+
}
|
|
3791
3769
|
},
|
|
3792
3770
|
onClose: handleAbort
|
|
3793
3771
|
}
|