@getpara/react-sdk 1.6.0 → 1.7.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/dist/index.js +1493 -1203
- package/dist/index.js.br +0 -0
- package/dist/index.js.gz +0 -0
- package/dist/modal/components/ExternalWalletVerificationStep/ExternalWalletVerificationStep.d.ts +1 -0
- package/dist/modal/components/ExternalWalletsWrapper/ExternalWalletsWrapper.d.ts +2 -1
- package/dist/modal/components/common.d.ts +4 -0
- package/dist/modal/hooks/useSetLoginURLs.d.ts +8 -0
- package/dist/modal/index.d.ts +1 -0
- package/dist/modal/providers/CosmosExternalWalletContextStub.d.ts +13 -0
- package/dist/modal/providers/EvmExternalWalletContextStub.d.ts +11 -0
- package/dist/modal/providers/ExternalWalletContext.d.ts +15 -1
- package/dist/modal/providers/SolanaExternalWalletContextStub.d.ts +11 -0
- package/dist/modal/stores/externalWalletProvider/useExternalWalletProviderStore.d.ts +2 -0
- package/dist/modal/types/commonTypes.d.ts +12 -2
- package/dist/modal/types/externalWallets.d.ts +2 -0
- package/dist/modal/types/modalProps.d.ts +6 -0
- package/dist/modal/utils/steps.d.ts +2 -0
- package/dist/provider/utils/constants.d.ts +5 -0
- package/package.json +5 -5
package/dist/index.js
CHANGED
|
@@ -30,6 +30,7 @@ var ModalStep = /* @__PURE__ */ ((ModalStep2) => {
|
|
|
30
30
|
ModalStep2["EX_WALLET_MORE"] = "EX_WALLET_MORE";
|
|
31
31
|
ModalStep2["EX_WALLET_SELECTED"] = "EX_WALLET_SELECTED";
|
|
32
32
|
ModalStep2["VERIFICATIONS"] = "VERIFICATIONS";
|
|
33
|
+
ModalStep2["EXTERNAL_WALLET_VERIFICATION"] = "EXTERNAL_WALLET_VERIFICATION";
|
|
33
34
|
ModalStep2["AWAITING_OAUTH"] = "AWAITING_OAUTH";
|
|
34
35
|
ModalStep2["FARCASTER_OAUTH"] = "FARCASTER_OAUTH";
|
|
35
36
|
ModalStep2["BIOMETRIC_CREATION"] = "BIOMETRIC_CREATION";
|
|
@@ -61,6 +62,7 @@ var RESET_TO_AUTH_STEPS = [
|
|
|
61
62
|
"EX_WALLET_MORE" /* EX_WALLET_MORE */,
|
|
62
63
|
"EX_WALLET_SELECTED" /* EX_WALLET_SELECTED */,
|
|
63
64
|
"VERIFICATIONS" /* VERIFICATIONS */,
|
|
65
|
+
"EXTERNAL_WALLET_VERIFICATION" /* EXTERNAL_WALLET_VERIFICATION */,
|
|
64
66
|
"AWAITING_OAUTH" /* AWAITING_OAUTH */,
|
|
65
67
|
"FARCASTER_OAUTH" /* FARCASTER_OAUTH */,
|
|
66
68
|
"TELEGRAM_OAUTH" /* TELEGRAM_OAUTH */,
|
|
@@ -104,6 +106,7 @@ var SignUpPreviousStep = {
|
|
|
104
106
|
["EX_WALLET_MORE" /* EX_WALLET_MORE */]: "AUTH_MAIN" /* AUTH_MAIN */,
|
|
105
107
|
["EX_WALLET_SELECTED" /* EX_WALLET_SELECTED */]: "AUTH_MAIN" /* AUTH_MAIN */,
|
|
106
108
|
["VERIFICATIONS" /* VERIFICATIONS */]: "AUTH_MAIN" /* AUTH_MAIN */,
|
|
109
|
+
["EXTERNAL_WALLET_VERIFICATION" /* EXTERNAL_WALLET_VERIFICATION */]: "AUTH_MAIN" /* AUTH_MAIN */,
|
|
107
110
|
["AWAITING_OAUTH" /* AWAITING_OAUTH */]: "AUTH_MAIN" /* AUTH_MAIN */,
|
|
108
111
|
["TELEGRAM_OAUTH" /* TELEGRAM_OAUTH */]: "AUTH_MAIN" /* AUTH_MAIN */,
|
|
109
112
|
["FARCASTER_OAUTH" /* FARCASTER_OAUTH */]: "AUTH_MAIN" /* AUTH_MAIN */,
|
|
@@ -379,7 +382,7 @@ var DEFAULT_THEME = {
|
|
|
379
382
|
var useThemeStore = create3((set, get) => __spreadValues(__spreadValues({}, DEFAULT_THEME), getActions3(set, get)));
|
|
380
383
|
|
|
381
384
|
// src/modal/components/Body/Body.tsx
|
|
382
|
-
import { styled as
|
|
385
|
+
import { styled as styled28 } from "styled-components";
|
|
383
386
|
import { CpslAlert, CpslIcon as CpslIcon16 } from "@getpara/react-components";
|
|
384
387
|
|
|
385
388
|
// src/modal/components/VerificationCodeStep/VerificationCodeStep.tsx
|
|
@@ -455,6 +458,17 @@ var HeroIcon = styled(CpslIcon)`
|
|
|
455
458
|
--width: 80px;
|
|
456
459
|
--icon-color: var(--cpsl-color-text-primary);
|
|
457
460
|
`;
|
|
461
|
+
var ErrorContainer = styled.div`
|
|
462
|
+
display: flex;
|
|
463
|
+
align-items: center;
|
|
464
|
+
justify-content: center;
|
|
465
|
+
gap: 4px;
|
|
466
|
+
`;
|
|
467
|
+
var ErrorIcon = styled(CpslIcon)`
|
|
468
|
+
--height: 16px;
|
|
469
|
+
--width: 16px;
|
|
470
|
+
--icon-color: var(--cpsl-color-text-error);
|
|
471
|
+
`;
|
|
458
472
|
|
|
459
473
|
// src/modal/components/VerificationCodeStep/VerificationCodeStep.tsx
|
|
460
474
|
import { AuthMethod } from "@getpara/core-sdk";
|
|
@@ -653,175 +667,611 @@ var ClickableText = styled2(InlineText)`
|
|
|
653
667
|
display: inline-block;
|
|
654
668
|
`;
|
|
655
669
|
|
|
656
|
-
// src/modal/components/
|
|
657
|
-
import { CpslButton,
|
|
658
|
-
import { useEffect as
|
|
670
|
+
// src/modal/components/ExternalWalletVerificationStep/ExternalWalletVerificationStep.tsx
|
|
671
|
+
import { CpslButton, CpslSpinner as CpslSpinner2, CpslText as CpslText3 } from "@getpara/react-components";
|
|
672
|
+
import { useEffect as useEffect3, useState as useState3 } from "react";
|
|
673
|
+
import { styled as styled3 } from "styled-components";
|
|
674
|
+
import { AuthMethod as AuthMethod4 } from "@getpara/core-sdk";
|
|
659
675
|
|
|
660
|
-
// src/modal/
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
type,
|
|
665
|
-
current
|
|
666
|
-
}) {
|
|
667
|
-
if (typeof window === "undefined") {
|
|
668
|
-
return;
|
|
669
|
-
}
|
|
670
|
-
current == null ? void 0 : current.close();
|
|
671
|
-
const popUpWidth = 560;
|
|
672
|
-
let popUpHeight;
|
|
673
|
-
switch (type) {
|
|
674
|
-
case "LOGIN_PASSWORD": {
|
|
675
|
-
popUpHeight = 460;
|
|
676
|
-
break;
|
|
677
|
-
}
|
|
678
|
-
case "LOGIN_PASSKEY": {
|
|
679
|
-
popUpHeight = 798;
|
|
680
|
-
break;
|
|
681
|
-
}
|
|
682
|
-
case "CREATE_PASSWORD": {
|
|
683
|
-
popUpHeight = 400;
|
|
684
|
-
break;
|
|
685
|
-
}
|
|
686
|
-
case "CREATE_PASSKEY": {
|
|
687
|
-
popUpHeight = 464;
|
|
688
|
-
break;
|
|
689
|
-
}
|
|
690
|
-
case "TRANSACTION_REVIEW": {
|
|
691
|
-
popUpHeight = 480;
|
|
692
|
-
break;
|
|
693
|
-
}
|
|
694
|
-
case "OAUTH":
|
|
695
|
-
default: {
|
|
696
|
-
popUpHeight = 768;
|
|
697
|
-
break;
|
|
698
|
-
}
|
|
699
|
-
}
|
|
700
|
-
const dualScreenLeft = window.screenLeft !== void 0 ? window.screenLeft : window.screenX;
|
|
701
|
-
const dualScreenTop = window.screenTop !== void 0 ? window.screenTop : window.screenY;
|
|
702
|
-
const width = window.innerWidth ? window.innerWidth : document.documentElement.clientWidth ? document.documentElement.clientWidth : screen.width;
|
|
703
|
-
const height = window.innerHeight ? window.innerHeight : document.documentElement.clientHeight ? document.documentElement.clientHeight : screen.height;
|
|
704
|
-
const left = (width - popUpWidth) / 2 + dualScreenLeft;
|
|
705
|
-
const top = (height - popUpHeight) / 2 + dualScreenTop;
|
|
706
|
-
const windowFeatures = `toolbar=no, menubar=no, width=${popUpWidth},
|
|
707
|
-
height=${popUpHeight}, top=${top}, left=${left}`;
|
|
708
|
-
let popupWindow = window.open(url, target, windowFeatures);
|
|
709
|
-
if (!popupWindow) {
|
|
710
|
-
setTimeout(() => {
|
|
711
|
-
popupWindow = window.open(url, "_blank");
|
|
712
|
-
}, 0);
|
|
713
|
-
}
|
|
714
|
-
return popupWindow;
|
|
715
|
-
}
|
|
676
|
+
// src/modal/providers/ExternalWalletContext.tsx
|
|
677
|
+
import { createContext, useCallback, useContext, useEffect as useEffect2, useMemo, useState as useState2 } from "react";
|
|
678
|
+
import { AuthMethod as AuthMethod3, WalletType, isIOS, isIOSWebview, isMobile, truncateAddress } from "@getpara/web-sdk";
|
|
679
|
+
import { getExternalWalletDisplayName } from "@getpara/react-common";
|
|
716
680
|
|
|
717
|
-
// src/modal/
|
|
718
|
-
import styled3 from "styled-components";
|
|
681
|
+
// src/modal/hooks/useSetLoginURLs.ts
|
|
719
682
|
import { AuthMethod as AuthMethod2, getPublicKeyHex } from "@getpara/web-sdk";
|
|
720
|
-
|
|
721
|
-
import { Fragment as Fragment2, jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
722
|
-
var BiometricLoginStep = () => {
|
|
723
|
-
const refs = useModalStore((state) => state.refs);
|
|
724
|
-
const supportedAuthMethods = useModalStore((state) => state.supportedAuthMethods);
|
|
725
|
-
const passwordUrlForLogin = useModalStore((state) => state.passwordUrlForLogin);
|
|
726
|
-
const webAuthURLForLogin = useModalStore((state) => state.webAuthURLForLogin);
|
|
727
|
-
const setStep = useModalStore((state) => state.setStep);
|
|
728
|
-
const biometricLocationHints = useModalStore((state) => state.biometricLocationHints);
|
|
683
|
+
var useSetLoginURLs = () => {
|
|
729
684
|
const para = useInternalClient();
|
|
730
|
-
const authInfo = useUserInfoStore((state) => state.getAuthInfo());
|
|
731
685
|
const setWebAuthURLForLogin = useModalStore((state) => state.setWebAuthURLForLogin);
|
|
732
|
-
const
|
|
733
|
-
const
|
|
734
|
-
|
|
686
|
+
const setPasswordURLForLogin = useModalStore((state) => state.setPasswordUrlForLogin);
|
|
687
|
+
const setSupportedAuthMethods = useModalStore((state) => state.setSupportedAuthMethods);
|
|
688
|
+
return (_0) => __async(void 0, [_0], function* ({
|
|
689
|
+
supportedAuthMethods,
|
|
690
|
+
authType,
|
|
691
|
+
displayName,
|
|
692
|
+
pfpUrl
|
|
693
|
+
}) {
|
|
694
|
+
setSupportedAuthMethods(supportedAuthMethods);
|
|
695
|
+
const res = yield para.touchSession();
|
|
696
|
+
const webAuthUrlForLogin = (supportedAuthMethods == null ? void 0 : supportedAuthMethods.has(AuthMethod2.PASSKEY)) ? yield para.getWebAuthURLForLogin({
|
|
697
|
+
sessionId: res.data.sessionId,
|
|
698
|
+
loginEncryptionPublicKey: getPublicKeyHex(para.loginEncryptionKeyPair),
|
|
699
|
+
partnerId: res.data.partnerId,
|
|
700
|
+
newDeviceSessionId: res.data.sessionLookupId,
|
|
701
|
+
newDeviceEncryptionKey: getPublicKeyHex(para.loginEncryptionKeyPair),
|
|
702
|
+
authType,
|
|
703
|
+
displayName,
|
|
704
|
+
pfpUrl
|
|
705
|
+
}) : void 0;
|
|
706
|
+
const passwordAuthUrlForLogin = (supportedAuthMethods == null ? void 0 : supportedAuthMethods.has(AuthMethod2.PASSWORD)) ? yield para.getPasswordURLForLogin({
|
|
707
|
+
sessionId: res.data.sessionId,
|
|
708
|
+
loginEncryptionPublicKey: getPublicKeyHex(para.loginEncryptionKeyPair),
|
|
709
|
+
partnerId: res.data.partnerId,
|
|
710
|
+
authType,
|
|
711
|
+
displayName,
|
|
712
|
+
pfpUrl
|
|
713
|
+
}) : void 0;
|
|
714
|
+
setWebAuthURLForLogin(webAuthUrlForLogin);
|
|
715
|
+
setPasswordURLForLogin(passwordAuthUrlForLogin);
|
|
716
|
+
});
|
|
717
|
+
};
|
|
718
|
+
|
|
719
|
+
// src/modal/providers/ExternalWalletContext.tsx
|
|
720
|
+
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
721
|
+
var defaultExternalWallet = {
|
|
722
|
+
wallets: [],
|
|
723
|
+
chains: [],
|
|
724
|
+
chainId: void 0,
|
|
725
|
+
wallet: void 0,
|
|
726
|
+
qrUri: void 0,
|
|
727
|
+
chainIdSwitchingTo: void 0,
|
|
728
|
+
walletDisplayHelpers: {
|
|
729
|
+
showExtension: false,
|
|
730
|
+
showMobile: false,
|
|
731
|
+
isSolanaMobileIOS: false,
|
|
732
|
+
isCosmosMobileWallet: false
|
|
733
|
+
},
|
|
734
|
+
username: void 0,
|
|
735
|
+
avatar: void 0,
|
|
736
|
+
connectExternalWallet: () => {
|
|
737
|
+
},
|
|
738
|
+
disconnectExternalWallet: () => Promise.resolve(),
|
|
739
|
+
switchChain: () => Promise.resolve(),
|
|
740
|
+
setChainIdSwitchingTo: () => {
|
|
741
|
+
},
|
|
742
|
+
verifyWalletSignature: () => Promise.resolve({})
|
|
743
|
+
};
|
|
744
|
+
var ExternalWalletContext = createContext(defaultExternalWallet);
|
|
745
|
+
function ExternalWalletProvider({
|
|
746
|
+
children,
|
|
747
|
+
evmContext,
|
|
748
|
+
solanaContext,
|
|
749
|
+
cosmosContext,
|
|
750
|
+
walletSort,
|
|
751
|
+
externalWalletsWithFullAuth
|
|
752
|
+
}) {
|
|
753
|
+
const {
|
|
754
|
+
wallets: evmWallets,
|
|
755
|
+
disconnect: evmDisconnect,
|
|
756
|
+
chains: evmChains,
|
|
757
|
+
chainId: evmChainId,
|
|
758
|
+
switchChain: evmSwitchChain,
|
|
759
|
+
username: evmUsername,
|
|
760
|
+
avatar: evmAvatar,
|
|
761
|
+
signVerificationMessage: evmSignVerificationMessage
|
|
762
|
+
} = useContext(evmContext);
|
|
763
|
+
const {
|
|
764
|
+
wallets: solanaWallets,
|
|
765
|
+
disconnect: solanaDisconnect,
|
|
766
|
+
signVerificationMessage: solanaSignVerificationMessage
|
|
767
|
+
} = useContext(solanaContext);
|
|
768
|
+
const {
|
|
769
|
+
wallets: cosmosWallets,
|
|
770
|
+
disconnect: cosmosDisconnect,
|
|
771
|
+
chains: cosmosChains,
|
|
772
|
+
chainId: cosmosChainId,
|
|
773
|
+
switchChain: cosmosSwitchChain,
|
|
774
|
+
signVerificationMessage: cosmosSignVerificationMessage
|
|
775
|
+
} = useContext(cosmosContext);
|
|
776
|
+
const setStep = useModalStore((state) => state.setStep);
|
|
777
|
+
const setFlow = useModalStore((state) => state.setFlow);
|
|
735
778
|
const setSupportedAuthMethods = useModalStore((state) => state.setSupportedAuthMethods);
|
|
736
|
-
const
|
|
779
|
+
const setBiometricLocationHints = useModalStore((state) => state.setBiometricLocationHints);
|
|
780
|
+
const setStepDirection = useModalStore((state) => state.setStepDirection);
|
|
781
|
+
const setIsExternalWalletConnecting = useModalStore((state) => state.setIsExternalWalletConnecting);
|
|
782
|
+
const isExternalWalletConnecting = useModalStore((state) => state.isExternalWalletConnecting);
|
|
783
|
+
const setSelectedExternalWalletId = useModalStore((state) => state.setSelectedExternalWalletId);
|
|
784
|
+
const selectedExternalWalletId = useModalStore((state) => state.selectedExternalWalletId);
|
|
785
|
+
const setExternalWalletError = useModalStore((state) => state.setExternalWalletError);
|
|
786
|
+
const setIsUsingMobileConnector = useModalStore((state) => state.setIsUsingMobileConnector);
|
|
787
|
+
const isUsingMobileConnector = useModalStore((state) => state.isUsingMobileConnector);
|
|
788
|
+
const para = useInternalClient();
|
|
789
|
+
const setAuthInfo = useUserInfoStore((state) => state.setAuthInfo);
|
|
790
|
+
const setLoginURLs = useSetLoginURLs();
|
|
791
|
+
const [qrUri, setQrUri] = useState2();
|
|
792
|
+
const [chainIdSwitchingTo, setChainIdSwitchingTo] = useState2();
|
|
793
|
+
const wallets = [...evmWallets, ...solanaWallets, ...cosmosWallets].filter((w) => walletSort.includes(w.id.toUpperCase())).sort(
|
|
794
|
+
(a, b) => walletSort.indexOf(a.id.toUpperCase()) - walletSort.indexOf(b.id.toUpperCase())
|
|
795
|
+
).sort((a, b) => a.installed === b.installed ? 0 : a.installed ? -1 : 1);
|
|
796
|
+
const wallet = useMemo(() => wallets.find((w) => w.id === selectedExternalWalletId), [wallets, selectedExternalWalletId]);
|
|
797
|
+
const updateQrUri = () => __async(this, null, function* () {
|
|
798
|
+
var _a;
|
|
799
|
+
const uri = yield (_a = wallet == null ? void 0 : wallet.getQrUri) == null ? void 0 : _a.call(wallet);
|
|
800
|
+
setQrUri(uri);
|
|
801
|
+
});
|
|
737
802
|
useEffect2(() => {
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
803
|
+
if (wallet) {
|
|
804
|
+
if (!qrUri) {
|
|
805
|
+
updateQrUri();
|
|
806
|
+
}
|
|
807
|
+
} else if (qrUri) {
|
|
808
|
+
setQrUri(void 0);
|
|
809
|
+
}
|
|
810
|
+
}, [wallet]);
|
|
811
|
+
const chains = useMemo(() => {
|
|
812
|
+
var _a;
|
|
813
|
+
const walletType = (_a = Object.values(para.externalWallets || {})[0]) == null ? void 0 : _a.type;
|
|
814
|
+
switch (walletType) {
|
|
815
|
+
case WalletType.COSMOS: {
|
|
816
|
+
return cosmosChains;
|
|
817
|
+
}
|
|
818
|
+
case WalletType.EVM: {
|
|
819
|
+
return evmChains;
|
|
820
|
+
}
|
|
821
|
+
default: {
|
|
822
|
+
return [];
|
|
823
|
+
}
|
|
824
|
+
}
|
|
825
|
+
}, [cosmosChains, evmChains, selectedExternalWalletId]);
|
|
826
|
+
const chainId = useMemo(() => {
|
|
827
|
+
var _a;
|
|
828
|
+
const walletType = (_a = Object.values(para.externalWallets || {})[0]) == null ? void 0 : _a.type;
|
|
829
|
+
switch (walletType) {
|
|
830
|
+
case WalletType.COSMOS: {
|
|
831
|
+
return cosmosChainId;
|
|
832
|
+
}
|
|
833
|
+
case WalletType.EVM: {
|
|
834
|
+
return evmChainId == null ? void 0 : evmChainId.toString();
|
|
835
|
+
}
|
|
836
|
+
default: {
|
|
837
|
+
return void 0;
|
|
838
|
+
}
|
|
839
|
+
}
|
|
840
|
+
}, [cosmosChains, evmChains, selectedExternalWalletId]);
|
|
841
|
+
const switchChain = useCallback(
|
|
842
|
+
(chainId2) => __async(this, null, function* () {
|
|
843
|
+
var _a;
|
|
844
|
+
const walletType = (_a = Object.values(para.externalWallets || {})[0]) == null ? void 0 : _a.type;
|
|
845
|
+
if (walletType) {
|
|
846
|
+
let resp;
|
|
847
|
+
setExternalWalletError();
|
|
848
|
+
setChainIdSwitchingTo(chainId2);
|
|
849
|
+
switch (walletType) {
|
|
850
|
+
case WalletType.COSMOS: {
|
|
851
|
+
setStep("CHAIN_SWITCH" /* CHAIN_SWITCH */);
|
|
852
|
+
resp = yield cosmosSwitchChain(chainId2);
|
|
853
|
+
break;
|
|
854
|
+
}
|
|
855
|
+
case WalletType.EVM: {
|
|
856
|
+
setStep("CHAIN_SWITCH" /* CHAIN_SWITCH */);
|
|
857
|
+
resp = yield evmSwitchChain(parseInt(chainId2));
|
|
858
|
+
break;
|
|
859
|
+
}
|
|
860
|
+
default: {
|
|
861
|
+
break;
|
|
744
862
|
}
|
|
745
|
-
return;
|
|
746
863
|
}
|
|
747
|
-
if (
|
|
748
|
-
|
|
864
|
+
if (resp.error) {
|
|
865
|
+
setExternalWalletError(resp.error);
|
|
866
|
+
} else {
|
|
867
|
+
setChainIdSwitchingTo(void 0);
|
|
868
|
+
setStepDirection(-1);
|
|
869
|
+
setStep("ACCOUNT_MAIN" /* ACCOUNT_MAIN */);
|
|
749
870
|
}
|
|
750
|
-
|
|
751
|
-
|
|
871
|
+
}
|
|
872
|
+
}),
|
|
873
|
+
[evmSwitchChain, cosmosSwitchChain]
|
|
874
|
+
);
|
|
875
|
+
const verifyWalletSignature = useCallback(() => __async(this, null, function* () {
|
|
876
|
+
var _a;
|
|
877
|
+
setExternalWalletError();
|
|
878
|
+
const walletType = (_a = Object.values(para.externalWallets)[0]) == null ? void 0 : _a.type;
|
|
879
|
+
if (walletType) {
|
|
880
|
+
const resp = {
|
|
881
|
+
address: "",
|
|
882
|
+
signature: "",
|
|
883
|
+
cosmosPublicKeyHex: "",
|
|
884
|
+
cosmosSigner: ""
|
|
885
|
+
};
|
|
886
|
+
switch (walletType) {
|
|
887
|
+
case WalletType.COSMOS: {
|
|
888
|
+
const { signature, error, cosmosPublicKeyHex, cosmosSigner, address } = yield cosmosSignVerificationMessage();
|
|
889
|
+
if (error) {
|
|
890
|
+
setExternalWalletError([error]);
|
|
891
|
+
} else if (signature) {
|
|
892
|
+
resp.address = address;
|
|
893
|
+
resp.signature = signature;
|
|
894
|
+
resp.cosmosPublicKeyHex = cosmosPublicKeyHex;
|
|
895
|
+
resp.cosmosSigner = cosmosSigner;
|
|
896
|
+
}
|
|
897
|
+
return resp;
|
|
752
898
|
}
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
}
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
}
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
authType,
|
|
778
|
-
displayName: authInfo.displayName,
|
|
779
|
-
pfpUrl: authInfo.pfpUrl
|
|
780
|
-
}) : void 0;
|
|
781
|
-
const shortWebAuthLoginLink = webAuthUrlForLogin ? yield para.shortenLoginLink(webAuthUrlForLogin) : void 0;
|
|
782
|
-
const shortWebAuthForKnownDeviceLoginLink = _webAuthURLForKnownDeviceLogin ? yield para.shortenLoginLink(_webAuthURLForKnownDeviceLogin) : void 0;
|
|
783
|
-
setWebAuthURLForKnownDeviceLogin(shortWebAuthForKnownDeviceLoginLink);
|
|
784
|
-
setWebAuthURLForLogin(shortWebAuthLoginLink);
|
|
785
|
-
setPasswordUrlForLogin(passwordAuthUrlForLogin);
|
|
786
|
-
});
|
|
899
|
+
case WalletType.EVM: {
|
|
900
|
+
const { signature, error, address } = yield evmSignVerificationMessage();
|
|
901
|
+
if (error) {
|
|
902
|
+
setExternalWalletError([error]);
|
|
903
|
+
} else if (signature && address) {
|
|
904
|
+
resp.address = address;
|
|
905
|
+
resp.signature = signature;
|
|
906
|
+
}
|
|
907
|
+
return resp;
|
|
908
|
+
}
|
|
909
|
+
case WalletType.SOLANA: {
|
|
910
|
+
const { signature, error, address } = yield solanaSignVerificationMessage();
|
|
911
|
+
if (error) {
|
|
912
|
+
setExternalWalletError([error]);
|
|
913
|
+
} else if (signature && address) {
|
|
914
|
+
resp.address = address;
|
|
915
|
+
resp.signature = signature;
|
|
916
|
+
}
|
|
917
|
+
return resp;
|
|
918
|
+
}
|
|
919
|
+
default: {
|
|
920
|
+
break;
|
|
921
|
+
}
|
|
922
|
+
}
|
|
787
923
|
}
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
});
|
|
797
|
-
setStep("AWAITING_BIOMETRIC_LOGIN" /* AWAITING_BIOMETRIC_LOGIN */);
|
|
798
|
-
};
|
|
799
|
-
const handlePasswordClick = () => {
|
|
800
|
-
refs.popupWindow.current = openPopup({
|
|
801
|
-
url: passwordUrlForLogin,
|
|
802
|
-
target: "ParaPassword",
|
|
803
|
-
type: "LOGIN_PASSWORD",
|
|
804
|
-
current: refs.popupWindow.current
|
|
924
|
+
}), [evmSwitchChain, cosmosSwitchChain]);
|
|
925
|
+
const completeFullAuth = (address, type, userExists, isVerified, bufferAddress) => __async(this, null, function* () {
|
|
926
|
+
setAuthInfo({
|
|
927
|
+
displayName: getExternalWalletDisplayName({
|
|
928
|
+
address,
|
|
929
|
+
type
|
|
930
|
+
}),
|
|
931
|
+
externalWalletAddress: bufferAddress != null ? bufferAddress : address
|
|
805
932
|
});
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
933
|
+
if (userExists && isVerified) {
|
|
934
|
+
const supportedAuthMethods = yield para.supportedAuthMethods({
|
|
935
|
+
externalWalletAddress: bufferAddress != null ? bufferAddress : address
|
|
936
|
+
});
|
|
937
|
+
if (!supportedAuthMethods.size) {
|
|
938
|
+
setFlow("signUp");
|
|
939
|
+
setStep("EXTERNAL_WALLET_VERIFICATION" /* EXTERNAL_WALLET_VERIFICATION */);
|
|
940
|
+
return;
|
|
941
|
+
}
|
|
942
|
+
yield para.initiateUserLoginV2({
|
|
943
|
+
externalWalletAddress: bufferAddress != null ? bufferAddress : address
|
|
944
|
+
});
|
|
945
|
+
const biometricLocationHints = supportedAuthMethods.has(AuthMethod3.PASSKEY) ? yield para.getUserBiometricLocationHints() : [];
|
|
946
|
+
yield setLoginURLs({ supportedAuthMethods, authType: "externalWallet" });
|
|
947
|
+
setFlow("login");
|
|
948
|
+
setStep("BIOMETRIC_LOGIN" /* BIOMETRIC_LOGIN */);
|
|
949
|
+
setSupportedAuthMethods(supportedAuthMethods);
|
|
950
|
+
setBiometricLocationHints(biometricLocationHints);
|
|
951
|
+
} else {
|
|
952
|
+
setFlow("signUp");
|
|
953
|
+
setStep("EXTERNAL_WALLET_VERIFICATION" /* EXTERNAL_WALLET_VERIFICATION */);
|
|
954
|
+
}
|
|
955
|
+
});
|
|
956
|
+
const connectExternalWallet = useCallback(
|
|
957
|
+
(wallet2, isMobileConnect, isManualWalletConnect, isResetAfterManualWalletConnect) => __async(this, null, function* () {
|
|
958
|
+
if (isExternalWalletConnecting && isManualWalletConnect) {
|
|
959
|
+
yield evmDisconnect();
|
|
960
|
+
yield solanaDisconnect();
|
|
961
|
+
yield cosmosDisconnect();
|
|
962
|
+
setQrUri(void 0);
|
|
963
|
+
setIsExternalWalletConnecting(false);
|
|
964
|
+
}
|
|
965
|
+
if (isResetAfterManualWalletConnect || isManualWalletConnect || !isExternalWalletConnecting) {
|
|
966
|
+
setExternalWalletError();
|
|
967
|
+
setIsExternalWalletConnecting(true);
|
|
968
|
+
setIsUsingMobileConnector(isMobileConnect);
|
|
969
|
+
const { address, bufferAddress, error, userExists, isVerified } = yield isMobileConnect ? wallet2.connectMobile({ isManualWalletConnect }) : wallet2.connect();
|
|
970
|
+
if (error) {
|
|
971
|
+
setExternalWalletError([error]);
|
|
972
|
+
setIsUsingMobileConnector();
|
|
973
|
+
if (isManualWalletConnect && error === "Connection request rejected") {
|
|
974
|
+
setExternalWalletError();
|
|
975
|
+
yield connectExternalWallet(wallet2, false, false, true);
|
|
976
|
+
yield updateQrUri();
|
|
977
|
+
return;
|
|
978
|
+
}
|
|
979
|
+
} else if (address) {
|
|
980
|
+
if (externalWalletsWithFullAuth == null ? void 0 : externalWalletsWithFullAuth.includes(wallet2.id.toUpperCase())) {
|
|
981
|
+
yield completeFullAuth(address, wallet2.type, userExists, isVerified, bufferAddress);
|
|
982
|
+
} else {
|
|
983
|
+
setStep("LOGIN_DONE" /* LOGIN_DONE */);
|
|
984
|
+
}
|
|
985
|
+
}
|
|
986
|
+
setIsExternalWalletConnecting(false);
|
|
987
|
+
}
|
|
988
|
+
}),
|
|
989
|
+
[isExternalWalletConnecting, externalWalletsWithFullAuth]
|
|
990
|
+
);
|
|
991
|
+
const disconnectExternalWallet = () => __async(this, null, function* () {
|
|
992
|
+
yield para.logout();
|
|
993
|
+
yield evmDisconnect();
|
|
994
|
+
yield cosmosDisconnect();
|
|
995
|
+
setSelectedExternalWalletId();
|
|
996
|
+
yield solanaDisconnect();
|
|
997
|
+
});
|
|
998
|
+
const walletDisplayHelpers = {
|
|
999
|
+
// Show the extension screen if on web and the wallet is an extension and installed or the wallet isn't a mobile wallet
|
|
1000
|
+
// Also show the extension connection if on desktop for a solana wallet (no walletConnect)
|
|
1001
|
+
showExtension: !isMobile() && ((wallet == null ? void 0 : wallet.isExtension) && (wallet == null ? void 0 : wallet.installed) || !(wallet == null ? void 0 : wallet.isMobile) || (wallet == null ? void 0 : wallet.type) === WalletType.SOLANA),
|
|
1002
|
+
// Show the mobile screen if on mobile and the wallet is a mobile wallet or if on desktop and the wallet isn't installed
|
|
1003
|
+
showMobile: isMobile() && (wallet == null ? void 0 : wallet.isMobile) || !isMobile() && !(wallet == null ? void 0 : wallet.installed),
|
|
1004
|
+
isSolanaMobileIOS: isIOS() && isMobile() && !isIOSWebview() && (wallet == null ? void 0 : wallet.type) === WalletType.SOLANA,
|
|
1005
|
+
isCosmosMobileWallet: (wallet == null ? void 0 : wallet.type) === WalletType.COSMOS && isUsingMobileConnector
|
|
1006
|
+
};
|
|
1007
|
+
const username = useMemo(() => {
|
|
1008
|
+
let username2;
|
|
1009
|
+
const storedExternalWallet = Object.values(para.externalWallets || {})[0];
|
|
1010
|
+
if (storedExternalWallet) {
|
|
1011
|
+
const walletType = storedExternalWallet == null ? void 0 : storedExternalWallet.type;
|
|
1012
|
+
switch (walletType) {
|
|
1013
|
+
case WalletType.EVM: {
|
|
1014
|
+
username2 = evmUsername ? evmUsername.startsWith("0x") ? truncateAddress(evmUsername, "EVM") : evmUsername : void 0;
|
|
1015
|
+
break;
|
|
1016
|
+
}
|
|
1017
|
+
default: {
|
|
1018
|
+
username2 = storedExternalWallet.address ? truncateAddress(storedExternalWallet.address, storedExternalWallet.type) : void 0;
|
|
1019
|
+
break;
|
|
1020
|
+
}
|
|
1021
|
+
}
|
|
1022
|
+
}
|
|
1023
|
+
return username2;
|
|
1024
|
+
}, [evmUsername, wallet]);
|
|
1025
|
+
const avatar = useMemo(() => {
|
|
1026
|
+
var _a;
|
|
1027
|
+
const walletType = (_a = Object.values(para.externalWallets || {})[0]) == null ? void 0 : _a.type;
|
|
1028
|
+
if (walletType) {
|
|
1029
|
+
switch (walletType) {
|
|
1030
|
+
case WalletType.EVM: {
|
|
1031
|
+
return evmAvatar;
|
|
1032
|
+
}
|
|
1033
|
+
default: {
|
|
1034
|
+
return void 0;
|
|
1035
|
+
}
|
|
1036
|
+
}
|
|
1037
|
+
}
|
|
1038
|
+
}, [evmAvatar, wallet]);
|
|
1039
|
+
return /* @__PURE__ */ jsx2(
|
|
1040
|
+
ExternalWalletContext.Provider,
|
|
1041
|
+
{
|
|
1042
|
+
value: useMemo(
|
|
1043
|
+
() => ({
|
|
1044
|
+
wallets,
|
|
1045
|
+
chains,
|
|
1046
|
+
chainId,
|
|
1047
|
+
wallet,
|
|
1048
|
+
qrUri,
|
|
1049
|
+
walletDisplayHelpers,
|
|
1050
|
+
chainIdSwitchingTo,
|
|
1051
|
+
username,
|
|
1052
|
+
avatar,
|
|
1053
|
+
connectExternalWallet,
|
|
1054
|
+
disconnectExternalWallet,
|
|
1055
|
+
switchChain,
|
|
1056
|
+
setChainIdSwitchingTo,
|
|
1057
|
+
verifyWalletSignature
|
|
1058
|
+
}),
|
|
1059
|
+
[
|
|
1060
|
+
wallets,
|
|
1061
|
+
chains,
|
|
1062
|
+
chainId,
|
|
1063
|
+
wallet,
|
|
1064
|
+
qrUri,
|
|
1065
|
+
walletDisplayHelpers,
|
|
1066
|
+
chainIdSwitchingTo,
|
|
1067
|
+
username,
|
|
1068
|
+
avatar,
|
|
1069
|
+
disconnectExternalWallet,
|
|
1070
|
+
connectExternalWallet,
|
|
1071
|
+
switchChain,
|
|
1072
|
+
setChainIdSwitchingTo,
|
|
1073
|
+
verifyWalletSignature
|
|
1074
|
+
]
|
|
1075
|
+
),
|
|
1076
|
+
children
|
|
1077
|
+
}
|
|
1078
|
+
);
|
|
1079
|
+
}
|
|
1080
|
+
var useExternalWallets = () => useContext(ExternalWalletContext);
|
|
1081
|
+
|
|
1082
|
+
// src/modal/components/ExternalWalletVerificationStep/ExternalWalletVerificationStep.tsx
|
|
1083
|
+
import { jsx as jsx3, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
1084
|
+
var ExternalWalletVerificationStep = () => {
|
|
1085
|
+
const theme = useThemeStore((state) => state.theme);
|
|
1086
|
+
const authInfo = useUserInfoStore((state) => state.getAuthInfo());
|
|
1087
|
+
const setStep = useModalStore((state) => state.setStep);
|
|
1088
|
+
const setWebAuthURLForCreate = useModalStore((state) => state.setWebAuthURLForCreate);
|
|
1089
|
+
const isIFrameReady = useModalStore((state) => state.isIFrameReady);
|
|
1090
|
+
const setIsIFrameReady = useModalStore((state) => state.setIsIFrameReady);
|
|
1091
|
+
const setIFrameUrl = useModalStore((state) => state.setIFrameUrl);
|
|
1092
|
+
const externalWalletError = useModalStore((state) => state.externalWalletError);
|
|
1093
|
+
const setExternalWalletError = useModalStore((state) => state.setExternalWalletError);
|
|
1094
|
+
const para = useInternalClient();
|
|
1095
|
+
const { verifyWalletSignature } = useExternalWallets();
|
|
1096
|
+
const [shouldRouteToStep, setShouldRouteToStep] = useState3();
|
|
1097
|
+
const [isVerifying, setIsVerifying] = useState3(false);
|
|
1098
|
+
useEffect3(() => {
|
|
1099
|
+
handleVerifyWallet();
|
|
1100
|
+
}, []);
|
|
1101
|
+
useEffect3(() => {
|
|
1102
|
+
if (!!shouldRouteToStep && isIFrameReady) {
|
|
1103
|
+
setTimeout(() => {
|
|
1104
|
+
setStep(shouldRouteToStep);
|
|
1105
|
+
setIsVerifying(false);
|
|
1106
|
+
}, 200);
|
|
1107
|
+
}
|
|
1108
|
+
}, [shouldRouteToStep, isIFrameReady]);
|
|
1109
|
+
const handleVerifyWallet = () => __async(void 0, null, function* () {
|
|
1110
|
+
setIsVerifying(true);
|
|
1111
|
+
try {
|
|
1112
|
+
setIsIFrameReady(false);
|
|
1113
|
+
const supportedCreateAuthMethods = yield para.getSupportedCreateAuthMethods();
|
|
1114
|
+
const walletSignature = yield verifyWalletSignature();
|
|
1115
|
+
if (!walletSignature.signature || !walletSignature.address) {
|
|
1116
|
+
console.error("No signature or address found on the verifyWalletSignature response.");
|
|
1117
|
+
setIsVerifying(false);
|
|
1118
|
+
return;
|
|
1119
|
+
}
|
|
1120
|
+
const url = yield para.verifyExternalWallet({
|
|
1121
|
+
address: walletSignature.address,
|
|
1122
|
+
signedMessage: walletSignature.signature,
|
|
1123
|
+
cosmosPublicKeyHex: walletSignature.cosmosPublicKeyHex,
|
|
1124
|
+
cosmosSigner: walletSignature.cosmosSigner
|
|
1125
|
+
});
|
|
1126
|
+
if (supportedCreateAuthMethods.has(AuthMethod4.PASSWORD) && supportedCreateAuthMethods.has(AuthMethod4.PASSKEY)) {
|
|
1127
|
+
const passwordAuthUrl = yield para.getSetupPasswordURL({ authType: authInfo == null ? void 0 : authInfo.authType, theme });
|
|
1128
|
+
setWebAuthURLForCreate(yield para.shortenLoginLink(url));
|
|
1129
|
+
setIFrameUrl(yield para.shortenLoginLink(passwordAuthUrl));
|
|
1130
|
+
setShouldRouteToStep("BIOMETRIC_CREATION" /* BIOMETRIC_CREATION */);
|
|
1131
|
+
return;
|
|
1132
|
+
} else if (supportedCreateAuthMethods.has(AuthMethod4.PASSWORD)) {
|
|
1133
|
+
const url2 = yield para.getSetupPasswordURL({ authType: authInfo == null ? void 0 : authInfo.authType, theme });
|
|
1134
|
+
setIFrameUrl(yield para.shortenLoginLink(url2));
|
|
1135
|
+
setShouldRouteToStep("PASSWORD_CREATION" /* PASSWORD_CREATION */);
|
|
1136
|
+
return;
|
|
1137
|
+
} else {
|
|
1138
|
+
setWebAuthURLForCreate(yield para.shortenLoginLink(url));
|
|
1139
|
+
setStep("BIOMETRIC_CREATION" /* BIOMETRIC_CREATION */);
|
|
1140
|
+
}
|
|
1141
|
+
} catch (e) {
|
|
1142
|
+
console.error("Error verifying signature:", e);
|
|
1143
|
+
setExternalWalletError(["Signature verification failed."]);
|
|
1144
|
+
setIsVerifying(false);
|
|
1145
|
+
}
|
|
1146
|
+
});
|
|
1147
|
+
return /* @__PURE__ */ jsxs2(StepContainer, { $wide: true, children: [
|
|
1148
|
+
/* @__PURE__ */ jsxs2(InnerStepContainer, { children: [
|
|
1149
|
+
/* @__PURE__ */ jsx3(Heading, { variant: "headingS", weight: "bold", children: "Verify Your Wallet" }),
|
|
1150
|
+
/* @__PURE__ */ jsx3(InlineText2, { variant: "bodyS", color: "secondary", children: "Sign the message with your wallet to complete sign up." }),
|
|
1151
|
+
!!(externalWalletError == null ? void 0 : externalWalletError[0]) && /* @__PURE__ */ jsxs2(ErrorContainer, { children: [
|
|
1152
|
+
/* @__PURE__ */ jsx3(ErrorIcon, { icon: "alertCircle" }),
|
|
1153
|
+
/* @__PURE__ */ jsx3(CpslText3, { weight: "semiBold", color: "error", children: externalWalletError == null ? void 0 : externalWalletError[0] })
|
|
1154
|
+
] })
|
|
1155
|
+
] }),
|
|
1156
|
+
/* @__PURE__ */ jsx3(InnerStepContainer, { children: isVerifying ? /* @__PURE__ */ jsx3(CpslSpinner2, {}) : /* @__PURE__ */ jsx3(CpslButton, { onClick: handleVerifyWallet, children: "Retry" }) })
|
|
1157
|
+
] });
|
|
1158
|
+
};
|
|
1159
|
+
var InlineText2 = styled3(CpslText3)`
|
|
1160
|
+
text-align: center;
|
|
1161
|
+
display: inline-block;
|
|
1162
|
+
`;
|
|
1163
|
+
|
|
1164
|
+
// src/modal/components/BiometricLoginStep/BiometricLoginStep.tsx
|
|
1165
|
+
import { CpslButton as CpslButton2, CpslDivider, CpslIcon as CpslIcon2 } from "@getpara/react-components";
|
|
1166
|
+
import { useMemo as useMemo2 } from "react";
|
|
1167
|
+
|
|
1168
|
+
// src/modal/utils/openPopup.ts
|
|
1169
|
+
function openPopup({
|
|
1170
|
+
url,
|
|
1171
|
+
target,
|
|
1172
|
+
type,
|
|
1173
|
+
current
|
|
1174
|
+
}) {
|
|
1175
|
+
if (typeof window === "undefined") {
|
|
1176
|
+
return;
|
|
1177
|
+
}
|
|
1178
|
+
current == null ? void 0 : current.close();
|
|
1179
|
+
const popUpWidth = 560;
|
|
1180
|
+
let popUpHeight;
|
|
1181
|
+
switch (type) {
|
|
1182
|
+
case "LOGIN_PASSWORD": {
|
|
1183
|
+
popUpHeight = 460;
|
|
1184
|
+
break;
|
|
1185
|
+
}
|
|
1186
|
+
case "LOGIN_PASSKEY": {
|
|
1187
|
+
popUpHeight = 798;
|
|
1188
|
+
break;
|
|
1189
|
+
}
|
|
1190
|
+
case "CREATE_PASSWORD": {
|
|
1191
|
+
popUpHeight = 400;
|
|
1192
|
+
break;
|
|
1193
|
+
}
|
|
1194
|
+
case "CREATE_PASSKEY": {
|
|
1195
|
+
popUpHeight = 464;
|
|
1196
|
+
break;
|
|
1197
|
+
}
|
|
1198
|
+
case "TRANSACTION_REVIEW": {
|
|
1199
|
+
popUpHeight = 480;
|
|
1200
|
+
break;
|
|
1201
|
+
}
|
|
1202
|
+
case "OAUTH":
|
|
1203
|
+
default: {
|
|
1204
|
+
popUpHeight = 768;
|
|
1205
|
+
break;
|
|
1206
|
+
}
|
|
1207
|
+
}
|
|
1208
|
+
const dualScreenLeft = window.screenLeft !== void 0 ? window.screenLeft : window.screenX;
|
|
1209
|
+
const dualScreenTop = window.screenTop !== void 0 ? window.screenTop : window.screenY;
|
|
1210
|
+
const width = window.innerWidth ? window.innerWidth : document.documentElement.clientWidth ? document.documentElement.clientWidth : screen.width;
|
|
1211
|
+
const height = window.innerHeight ? window.innerHeight : document.documentElement.clientHeight ? document.documentElement.clientHeight : screen.height;
|
|
1212
|
+
const left = (width - popUpWidth) / 2 + dualScreenLeft;
|
|
1213
|
+
const top = (height - popUpHeight) / 2 + dualScreenTop;
|
|
1214
|
+
const windowFeatures = `toolbar=no, menubar=no, width=${popUpWidth},
|
|
1215
|
+
height=${popUpHeight}, top=${top}, left=${left}`;
|
|
1216
|
+
let popupWindow = window.open(url, target, windowFeatures);
|
|
1217
|
+
if (!popupWindow) {
|
|
1218
|
+
setTimeout(() => {
|
|
1219
|
+
popupWindow = window.open(url, "_blank");
|
|
1220
|
+
}, 0);
|
|
1221
|
+
}
|
|
1222
|
+
return popupWindow;
|
|
1223
|
+
}
|
|
1224
|
+
|
|
1225
|
+
// src/modal/components/BiometricLoginStep/BiometricLoginStep.tsx
|
|
1226
|
+
import styled4 from "styled-components";
|
|
1227
|
+
import { AuthMethod as AuthMethod5 } from "@getpara/web-sdk";
|
|
1228
|
+
import { formatBiometricHints, KnownDevices, UserIdentifier } from "@getpara/react-common";
|
|
1229
|
+
import { Fragment as Fragment2, jsx as jsx4, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
1230
|
+
var BiometricLoginStep = () => {
|
|
1231
|
+
const refs = useModalStore((state) => state.refs);
|
|
1232
|
+
const supportedAuthMethods = useModalStore((state) => state.supportedAuthMethods);
|
|
1233
|
+
const passwordUrlForLogin = useModalStore((state) => state.passwordUrlForLogin);
|
|
1234
|
+
const webAuthURLForLogin = useModalStore((state) => state.webAuthURLForLogin);
|
|
1235
|
+
const setStep = useModalStore((state) => state.setStep);
|
|
1236
|
+
const biometricLocationHints = useModalStore((state) => state.biometricLocationHints);
|
|
1237
|
+
const authInfo = useUserInfoStore((state) => state.getAuthInfo());
|
|
1238
|
+
const passkeysSupported = useModalStore((state) => state.isPasskeySupported);
|
|
1239
|
+
const formattedHints = useMemo2(() => formatBiometricHints(biometricLocationHints), [biometricLocationHints]);
|
|
1240
|
+
const handlePasskeyClick = () => {
|
|
1241
|
+
refs.popupWindow.current = openPopup({
|
|
1242
|
+
url: webAuthURLForLogin,
|
|
1243
|
+
target: "ParaPasskey",
|
|
1244
|
+
type: "LOGIN_PASSKEY",
|
|
1245
|
+
current: refs.popupWindow.current
|
|
1246
|
+
});
|
|
1247
|
+
setStep("AWAITING_BIOMETRIC_LOGIN" /* AWAITING_BIOMETRIC_LOGIN */);
|
|
1248
|
+
};
|
|
1249
|
+
const handlePasswordClick = () => {
|
|
1250
|
+
refs.popupWindow.current = openPopup({
|
|
1251
|
+
url: passwordUrlForLogin,
|
|
1252
|
+
target: "ParaPassword",
|
|
1253
|
+
type: "LOGIN_PASSWORD",
|
|
1254
|
+
current: refs.popupWindow.current
|
|
1255
|
+
});
|
|
1256
|
+
setStep("AWAITING_PASSWORD_LOGIN" /* AWAITING_PASSWORD_LOGIN */);
|
|
1257
|
+
};
|
|
1258
|
+
function shouldShowWelcomeBack() {
|
|
1259
|
+
return !(biometricLocationHints == null ? void 0 : biometricLocationHints.length) || passkeysSupported && formattedHints.isOnKnownDevice || (supportedAuthMethods == null ? void 0 : supportedAuthMethods.has) && supportedAuthMethods.has(AuthMethod5.PASSWORD);
|
|
1260
|
+
}
|
|
1261
|
+
return /* @__PURE__ */ jsxs3(StepContainer, { $wide: true, children: [
|
|
1262
|
+
/* @__PURE__ */ jsxs3(InnerStepContainer, { children: [
|
|
1263
|
+
shouldShowWelcomeBack() && /* @__PURE__ */ jsx4(Heading, { variant: "headingS", weight: "bold", children: "Welcome back," }),
|
|
1264
|
+
/* @__PURE__ */ jsx4(UserIdentifier, __spreadValues({}, authInfo))
|
|
1265
|
+
] }),
|
|
1266
|
+
/* @__PURE__ */ jsxs3(MainContainer, { children: [
|
|
1267
|
+
(supportedAuthMethods == null ? void 0 : supportedAuthMethods.has) && supportedAuthMethods.has(AuthMethod5.PASSWORD) && passwordUrlForLogin && /* @__PURE__ */ jsx4(PasswordOnly, { handlePasswordClick }),
|
|
1268
|
+
(supportedAuthMethods == null ? void 0 : supportedAuthMethods.has) && supportedAuthMethods.has(AuthMethod5.PASSKEY) && webAuthURLForLogin && /* @__PURE__ */ jsx4(
|
|
1269
|
+
BiometricOnly,
|
|
1270
|
+
{
|
|
1271
|
+
handlePasskeyClick,
|
|
1272
|
+
formattedHints,
|
|
1273
|
+
shortLoginLink: webAuthURLForLogin,
|
|
1274
|
+
passkeysSupported,
|
|
825
1275
|
biometricLocationHints
|
|
826
1276
|
}
|
|
827
1277
|
)
|
|
@@ -829,7 +1279,7 @@ var BiometricLoginStep = () => {
|
|
|
829
1279
|
] });
|
|
830
1280
|
};
|
|
831
1281
|
var PasswordOnly = ({ handlePasswordClick }) => {
|
|
832
|
-
return /* @__PURE__ */
|
|
1282
|
+
return /* @__PURE__ */ jsx4(CpslButton2, { fullWidth: true, onClick: handlePasswordClick, children: "Login" });
|
|
833
1283
|
};
|
|
834
1284
|
var BiometricOnly = ({
|
|
835
1285
|
handlePasskeyClick,
|
|
@@ -839,35 +1289,35 @@ var BiometricOnly = ({
|
|
|
839
1289
|
biometricLocationHints = []
|
|
840
1290
|
}) => {
|
|
841
1291
|
const [hasHints, isOnKnownDevice] = [biometricLocationHints.length > 0, formattedHints.isOnKnownDevice];
|
|
842
|
-
return /* @__PURE__ */
|
|
843
|
-
(hasHints && !isOnKnownDevice || !passkeysSupported) && /* @__PURE__ */
|
|
844
|
-
passkeysSupported && /* @__PURE__ */
|
|
845
|
-
hasHints && !isOnKnownDevice && /* @__PURE__ */
|
|
846
|
-
/* @__PURE__ */
|
|
847
|
-
/* @__PURE__ */
|
|
1292
|
+
return /* @__PURE__ */ jsxs3(Fragment2, { children: [
|
|
1293
|
+
(hasHints && !isOnKnownDevice || !passkeysSupported) && /* @__PURE__ */ jsx4(KnownDevices, { hints: formattedHints, link: shortLoginLink }),
|
|
1294
|
+
passkeysSupported && /* @__PURE__ */ jsxs3(Fragment2, { children: [
|
|
1295
|
+
hasHints && !isOnKnownDevice && /* @__PURE__ */ jsx4(CpslDivider, { children: "or" }),
|
|
1296
|
+
/* @__PURE__ */ jsx4(CpslButton2, { fullWidth: true, onClick: handlePasskeyClick, children: !hasHints || isOnKnownDevice ? /* @__PURE__ */ jsxs3(Fragment2, { children: [
|
|
1297
|
+
/* @__PURE__ */ jsx4(CpslIcon2, { slot: "start", icon: "key" }),
|
|
848
1298
|
"Login with passkey"
|
|
849
1299
|
] }) : "Continue anyway" })
|
|
850
1300
|
] })
|
|
851
1301
|
] });
|
|
852
1302
|
};
|
|
853
|
-
var MainContainer =
|
|
1303
|
+
var MainContainer = styled4(InnerStepContainer)`
|
|
854
1304
|
gap: 16px;
|
|
855
1305
|
`;
|
|
856
1306
|
|
|
857
1307
|
// src/modal/components/Setup2FAStep/Setup2FAStep.tsx
|
|
858
1308
|
import {
|
|
859
|
-
CpslButton as
|
|
1309
|
+
CpslButton as CpslButton3,
|
|
860
1310
|
CpslCodeInput as CpslCodeInput2,
|
|
861
1311
|
CpslDivider as CpslDivider2,
|
|
862
1312
|
CpslIcon as CpslIcon3,
|
|
863
1313
|
CpslQrCode,
|
|
864
|
-
CpslSpinner as
|
|
865
|
-
CpslText as
|
|
1314
|
+
CpslSpinner as CpslSpinner3,
|
|
1315
|
+
CpslText as CpslText4
|
|
866
1316
|
} from "@getpara/react-components";
|
|
867
|
-
import { useEffect as
|
|
868
|
-
import { styled as
|
|
1317
|
+
import { useEffect as useEffect4, useRef as useRef2, useState as useState4 } from "react";
|
|
1318
|
+
import { styled as styled5 } from "styled-components";
|
|
869
1319
|
import { useCopyToClipboard } from "@getpara/react-common";
|
|
870
|
-
import { Fragment as Fragment3, jsx as
|
|
1320
|
+
import { Fragment as Fragment3, jsx as jsx5, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
871
1321
|
var Setup2FAStep = ({ onClose }) => {
|
|
872
1322
|
const isLogin = useModalStore((state) => state.isLogin());
|
|
873
1323
|
const setStep = useModalStore((state) => state.setStep);
|
|
@@ -875,13 +1325,13 @@ var Setup2FAStep = ({ onClose }) => {
|
|
|
875
1325
|
const isVerifying = useModalStore((state) => state.step === "VERIFY_2FA" /* VERIFY_2FA */);
|
|
876
1326
|
const [copied, copy] = useCopyToClipboard();
|
|
877
1327
|
const inputRef = useRef2(null);
|
|
878
|
-
const [qrCodeValue, setQrCodeValue] =
|
|
879
|
-
const [code, setCode] =
|
|
880
|
-
const [codeError, setCodeError] =
|
|
881
|
-
const [isVerifyingCode, setIsVerifyingCode] =
|
|
1328
|
+
const [qrCodeValue, setQrCodeValue] = useState4(null);
|
|
1329
|
+
const [code, setCode] = useState4("");
|
|
1330
|
+
const [codeError, setCodeError] = useState4("");
|
|
1331
|
+
const [isVerifyingCode, setIsVerifyingCode] = useState4(false);
|
|
882
1332
|
const params = qrCodeValue ? new URL(qrCodeValue).searchParams : void 0;
|
|
883
1333
|
const secret = params == null ? void 0 : params.get("secret");
|
|
884
|
-
|
|
1334
|
+
useEffect4(() => {
|
|
885
1335
|
function fetchOtpAuthUrl() {
|
|
886
1336
|
return __async(this, null, function* () {
|
|
887
1337
|
try {
|
|
@@ -894,13 +1344,13 @@ var Setup2FAStep = ({ onClose }) => {
|
|
|
894
1344
|
}
|
|
895
1345
|
fetchOtpAuthUrl();
|
|
896
1346
|
}, []);
|
|
897
|
-
|
|
1347
|
+
useEffect4(() => {
|
|
898
1348
|
setTimeout(() => {
|
|
899
1349
|
var _a, _b, _c;
|
|
900
1350
|
(_c = (_b = (_a = inputRef == null ? void 0 : inputRef.current) == null ? void 0 : _a.shadowRoot.querySelectorAll("input")) == null ? void 0 : _b[0]) == null ? void 0 : _c.focus();
|
|
901
1351
|
}, 10);
|
|
902
1352
|
}, [isVerifying]);
|
|
903
|
-
|
|
1353
|
+
useEffect4(() => {
|
|
904
1354
|
if (code.length === 6) {
|
|
905
1355
|
handleSubmitCode();
|
|
906
1356
|
}
|
|
@@ -938,19 +1388,19 @@ var Setup2FAStep = ({ onClose }) => {
|
|
|
938
1388
|
const handleCopy = () => {
|
|
939
1389
|
copy(secret);
|
|
940
1390
|
};
|
|
941
|
-
return /* @__PURE__ */
|
|
942
|
-
/* @__PURE__ */
|
|
943
|
-
/* @__PURE__ */
|
|
944
|
-
isVerifying && /* @__PURE__ */
|
|
1391
|
+
return /* @__PURE__ */ jsxs4(StepContainer, { children: [
|
|
1392
|
+
/* @__PURE__ */ jsxs4(InnerStepContainer, { children: [
|
|
1393
|
+
/* @__PURE__ */ jsx5(Heading, { variant: "headingS", weight: "bold", children: "Turn on Two-Factor authentication" }),
|
|
1394
|
+
isVerifying && /* @__PURE__ */ jsx5(CpslText4, { variant: "bodyS", color: "secondary", weight: "medium", children: "Please enter the code from your authenticator app." })
|
|
945
1395
|
] }),
|
|
946
|
-
/* @__PURE__ */
|
|
1396
|
+
/* @__PURE__ */ jsx5(InnerStepContainer, { children: isVerifying ? /* @__PURE__ */ jsx5(Fragment3, { children: isVerifyingCode ? /* @__PURE__ */ jsx5(CpslSpinner3, {}) : /* @__PURE__ */ jsx5(
|
|
947
1397
|
"form",
|
|
948
1398
|
{
|
|
949
1399
|
onSubmit: (e) => __async(void 0, null, function* () {
|
|
950
1400
|
e.preventDefault();
|
|
951
1401
|
yield handleSubmitCode();
|
|
952
1402
|
}),
|
|
953
|
-
children: /* @__PURE__ */
|
|
1403
|
+
children: /* @__PURE__ */ jsx5(
|
|
954
1404
|
StyledCodeInput2,
|
|
955
1405
|
{
|
|
956
1406
|
ref: inputRef,
|
|
@@ -964,41 +1414,41 @@ var Setup2FAStep = ({ onClose }) => {
|
|
|
964
1414
|
}
|
|
965
1415
|
)
|
|
966
1416
|
}
|
|
967
|
-
) }) : /* @__PURE__ */
|
|
968
|
-
/* @__PURE__ */
|
|
969
|
-
/* @__PURE__ */
|
|
1417
|
+
) }) : /* @__PURE__ */ jsxs4(Fragment3, { children: [
|
|
1418
|
+
/* @__PURE__ */ jsx5(CpslText4, { variant: "bodyS", color: "secondary", weight: "medium", children: "Scan with your preferred authenticator app." }),
|
|
1419
|
+
/* @__PURE__ */ jsx5(QRContainer, { children: !qrCodeValue ? /* @__PURE__ */ jsx5(CpslSpinner3, { size: 100 }) : /* @__PURE__ */ jsx5(CpslQrCode, { url: qrCodeValue }) })
|
|
970
1420
|
] }) }),
|
|
971
|
-
!isVerifying && /* @__PURE__ */
|
|
972
|
-
/* @__PURE__ */
|
|
973
|
-
/* @__PURE__ */
|
|
974
|
-
/* @__PURE__ */
|
|
975
|
-
/* @__PURE__ */
|
|
976
|
-
/* @__PURE__ */
|
|
1421
|
+
!isVerifying && /* @__PURE__ */ jsxs4(Fragment3, { children: [
|
|
1422
|
+
/* @__PURE__ */ jsx5(InnerStepContainer, { children: /* @__PURE__ */ jsx5(CpslDivider2, { children: "or enter the code manually" }) }),
|
|
1423
|
+
/* @__PURE__ */ jsx5(InnerStepContainer, { children: /* @__PURE__ */ jsx5(FilledDisabledInput, { disabled: true, value: secret, noAutoDisable: true, children: /* @__PURE__ */ jsx5(CpslButton3, { slot: "end", variant: "ghost", onClick: handleCopy, children: /* @__PURE__ */ jsx5(CpslIcon3, { icon: copied ? "check" : "copy" }) }) }) }),
|
|
1424
|
+
/* @__PURE__ */ jsxs4(InnerStepContainer, { children: [
|
|
1425
|
+
/* @__PURE__ */ jsx5(CpslButton3, { fullWidth: true, onClick: handleNext, children: "Continue" }),
|
|
1426
|
+
/* @__PURE__ */ jsx5(SkipButton, { variant: "ghost", onClick: handleSkip, children: "Skip" })
|
|
977
1427
|
] })
|
|
978
1428
|
] })
|
|
979
1429
|
] });
|
|
980
1430
|
};
|
|
981
|
-
var StyledCodeInput2 =
|
|
1431
|
+
var StyledCodeInput2 = styled5(CpslCodeInput2)`
|
|
982
1432
|
align-self: center;
|
|
983
1433
|
`;
|
|
984
|
-
var SkipButton =
|
|
1434
|
+
var SkipButton = styled5(CpslButton3)`
|
|
985
1435
|
margin-top: 8px;
|
|
986
1436
|
text-decoration: underline;
|
|
987
1437
|
`;
|
|
988
1438
|
|
|
989
1439
|
// src/modal/components/LoginDoneStep/LoginDoneStep.tsx
|
|
990
|
-
import { useEffect as
|
|
1440
|
+
import { useEffect as useEffect8 } from "react";
|
|
991
1441
|
|
|
992
1442
|
// src/modal/components/WalletCard/WalletCard.tsx
|
|
993
|
-
import
|
|
994
|
-
import { CpslButton as
|
|
995
|
-
import { truncateAddress } from "@getpara/web-sdk";
|
|
1443
|
+
import styled6 from "styled-components";
|
|
1444
|
+
import { CpslButton as CpslButton4, CpslIdenticon, CpslText as CpslText5 } from "@getpara/react-components";
|
|
1445
|
+
import { truncateAddress as truncateAddress2 } from "@getpara/web-sdk";
|
|
996
1446
|
|
|
997
1447
|
// src/provider/ParaProvider.tsx
|
|
998
|
-
import { useEffect as
|
|
1448
|
+
import { useEffect as useEffect7 } from "react";
|
|
999
1449
|
|
|
1000
1450
|
// src/provider/hooks/utils/useAutoSessionKeepAlive.ts
|
|
1001
|
-
import { useEffect as
|
|
1451
|
+
import { useEffect as useEffect5, useRef as useRef3 } from "react";
|
|
1002
1452
|
|
|
1003
1453
|
// src/provider/hooks/utils/useClient.ts
|
|
1004
1454
|
var useClient = () => {
|
|
@@ -1070,7 +1520,7 @@ var getAccount = (para) => __async(void 0, null, function* () {
|
|
|
1070
1520
|
// src/provider/hooks/queries/useAccount.ts
|
|
1071
1521
|
var ACCOUNT_BASE_KEY = "PARA_ACCOUNT";
|
|
1072
1522
|
var useAccount = () => {
|
|
1073
|
-
const client =
|
|
1523
|
+
const client = useInternalClient();
|
|
1074
1524
|
return useQuery({
|
|
1075
1525
|
queryKey: [ACCOUNT_BASE_KEY, client == null ? void 0 : client.getUserId()],
|
|
1076
1526
|
queryFn: () => __async(void 0, null, function* () {
|
|
@@ -1404,6 +1854,14 @@ var signMessage = (para, args) => __async(void 0, null, function* () {
|
|
|
1404
1854
|
}
|
|
1405
1855
|
});
|
|
1406
1856
|
|
|
1857
|
+
// src/provider/utils/constants.ts
|
|
1858
|
+
import { WalletType as WalletType2 } from "@getpara/web-sdk";
|
|
1859
|
+
var EXTERNAL_WALLET_PACKAGE_BY_TYPE = {
|
|
1860
|
+
[WalletType2.EVM]: "Wagmi",
|
|
1861
|
+
[WalletType2.COSMOS]: "Graz",
|
|
1862
|
+
[WalletType2.SOLANA]: "@solana/wallet-adapter-react"
|
|
1863
|
+
};
|
|
1864
|
+
|
|
1407
1865
|
// src/provider/hooks/mutations/useSignMessage.ts
|
|
1408
1866
|
var useSignMessage = () => {
|
|
1409
1867
|
const client = useClient();
|
|
@@ -1412,6 +1870,11 @@ var useSignMessage = () => {
|
|
|
1412
1870
|
mutationFn: (args) => __async(void 0, null, function* () {
|
|
1413
1871
|
let walletId = args == null ? void 0 : args.walletId;
|
|
1414
1872
|
if (!walletId) {
|
|
1873
|
+
if (wallet.isExternal) {
|
|
1874
|
+
throw Error(
|
|
1875
|
+
`Cannot sign with Capsule using an external wallet. Try using the methods from ${wallet.type ? EXTERNAL_WALLET_PACKAGE_BY_TYPE[wallet.type] : "the external wallet provider package"}.`
|
|
1876
|
+
);
|
|
1877
|
+
}
|
|
1415
1878
|
walletId = wallet == null ? void 0 : wallet.id;
|
|
1416
1879
|
}
|
|
1417
1880
|
if (!walletId) {
|
|
@@ -1452,6 +1915,11 @@ var useSignTransaction = () => {
|
|
|
1452
1915
|
mutationFn: (args) => __async(void 0, null, function* () {
|
|
1453
1916
|
let walletId = args == null ? void 0 : args.walletId;
|
|
1454
1917
|
if (!walletId) {
|
|
1918
|
+
if (wallet.isExternal) {
|
|
1919
|
+
throw Error(
|
|
1920
|
+
`Cannot sign with Capsule using an external wallet. Try using the methods from ${wallet.type ? EXTERNAL_WALLET_PACKAGE_BY_TYPE[wallet.type] : "the external wallet provider package"}.`
|
|
1921
|
+
);
|
|
1922
|
+
}
|
|
1455
1923
|
walletId = wallet == null ? void 0 : wallet.id;
|
|
1456
1924
|
}
|
|
1457
1925
|
if (!walletId) {
|
|
@@ -1475,7 +1943,7 @@ var useAutoSessionKeepAlive = ({ disabled }) => {
|
|
|
1475
1943
|
const { logoutAsync } = useLogout();
|
|
1476
1944
|
const { keepSessionAliveAsync } = useKeepSessionAlive();
|
|
1477
1945
|
const sessionCheckInterval = useRef3(null);
|
|
1478
|
-
|
|
1946
|
+
useEffect5(() => {
|
|
1479
1947
|
if (!client || disabled) {
|
|
1480
1948
|
clearSessionMonitoring();
|
|
1481
1949
|
return;
|
|
@@ -1534,7 +2002,7 @@ var useAutoSessionKeepAlive = ({ disabled }) => {
|
|
|
1534
2002
|
|
|
1535
2003
|
// src/provider/hooks/utils/useEventListeners.ts
|
|
1536
2004
|
import { useQueryClient as useQueryClient5 } from "@tanstack/react-query";
|
|
1537
|
-
import { useEffect as
|
|
2005
|
+
import { useEffect as useEffect6 } from "react";
|
|
1538
2006
|
import {
|
|
1539
2007
|
ParaEvent
|
|
1540
2008
|
} from "@getpara/web-sdk";
|
|
@@ -1604,7 +2072,7 @@ var useEventListeners = ({
|
|
|
1604
2072
|
setSelectedWallet({ id: defaultWallet == null ? void 0 : defaultWallet.id, type: defaultWallet == null ? void 0 : defaultWallet.type });
|
|
1605
2073
|
}
|
|
1606
2074
|
};
|
|
1607
|
-
|
|
2075
|
+
useEffect6(() => {
|
|
1608
2076
|
window.addEventListener(ParaEvent.LOGIN_EVENT, loginListener);
|
|
1609
2077
|
window.addEventListener(ParaEvent.ACCOUNT_SETUP_EVENT, accountSetupListener);
|
|
1610
2078
|
window.addEventListener(ParaEvent.ACCOUNT_CREATION_EVENT, accountCreationListener);
|
|
@@ -1637,7 +2105,7 @@ var ParaProvider = ({ children, paraClientConfig, callbacks, config = DEFAULT_CO
|
|
|
1637
2105
|
useEventListeners(callbacks);
|
|
1638
2106
|
useAutoSessionKeepAlive({ disabled: config.disableAutoSessionKeepAlive });
|
|
1639
2107
|
const setClient = useStore((state) => state.setClient);
|
|
1640
|
-
|
|
2108
|
+
useEffect7(() => {
|
|
1641
2109
|
var _a;
|
|
1642
2110
|
const newClient = (_a = config.paraClientOverride) != null ? _a : new ParaInternal(paraClientConfig.env, paraClientConfig.apiKey, paraClientConfig.opts);
|
|
1643
2111
|
setClient(newClient);
|
|
@@ -1652,24 +2120,25 @@ var getSelectedWalletId = () => vanillaStore.getState().selectedWalletId;
|
|
|
1652
2120
|
var getSelectedWalletType = () => vanillaStore.getState().selectedWalletType;
|
|
1653
2121
|
|
|
1654
2122
|
// src/modal/components/WalletCard/WalletCard.tsx
|
|
1655
|
-
import { jsx as
|
|
2123
|
+
import { jsx as jsx6, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
1656
2124
|
var ExternalWalletCard = ({ address, showAddFunds }) => {
|
|
2125
|
+
var _a;
|
|
1657
2126
|
const para = useInternalClient();
|
|
1658
2127
|
const wallet = para.externalWallets[address];
|
|
1659
2128
|
if (!wallet) {
|
|
1660
2129
|
return null;
|
|
1661
2130
|
}
|
|
1662
|
-
return /* @__PURE__ */
|
|
2131
|
+
return /* @__PURE__ */ jsx6(
|
|
1663
2132
|
SharedWalletCard,
|
|
1664
2133
|
{
|
|
1665
|
-
address:
|
|
2134
|
+
address: (_a = wallet.ensName) != null ? _a : truncateAddress2(wallet.address, wallet.type),
|
|
1666
2135
|
identiconHash: para.getIdenticonHash(wallet.id, wallet.type),
|
|
1667
2136
|
showAddFunds
|
|
1668
2137
|
}
|
|
1669
2138
|
);
|
|
1670
2139
|
};
|
|
1671
2140
|
var WalletCard = ({ id, type, showAddFunds }) => {
|
|
1672
|
-
var _a;
|
|
2141
|
+
var _a, _b;
|
|
1673
2142
|
const para = useInternalClient();
|
|
1674
2143
|
const appName = useThemeStore((state) => state.appName);
|
|
1675
2144
|
const wallet = para.findWallet(id, type);
|
|
@@ -1677,13 +2146,13 @@ var WalletCard = ({ id, type, showAddFunds }) => {
|
|
|
1677
2146
|
return null;
|
|
1678
2147
|
}
|
|
1679
2148
|
const address = para.getDisplayAddress(wallet.id, { addressType: type });
|
|
1680
|
-
return /* @__PURE__ */
|
|
2149
|
+
return /* @__PURE__ */ jsx6(
|
|
1681
2150
|
SharedWalletCard,
|
|
1682
2151
|
{
|
|
1683
2152
|
id: wallet.id,
|
|
1684
2153
|
type: wallet.type,
|
|
1685
|
-
address:
|
|
1686
|
-
name: (
|
|
2154
|
+
address: (_a = wallet.ensName) != null ? _a : truncateAddress2(address, type, { prefix: para.cosmosPrefix }),
|
|
2155
|
+
name: (_b = wallet.name) != null ? _b : `${appName ? `${appName} ` : ""}Wallet`,
|
|
1687
2156
|
identiconHash: para.getIdenticonHash(wallet.id, type),
|
|
1688
2157
|
showAddFunds
|
|
1689
2158
|
}
|
|
@@ -1700,24 +2169,24 @@ var SharedWalletCard = ({ address, name, identiconHash, showAddFunds, id, type }
|
|
|
1700
2169
|
isAddFundsEnabled && setStep(onRampConfig.isBuyEnabled ? "ADD_FUNDS_BUY" /* ADD_FUNDS_BUY */ : "ADD_FUNDS_RECEIVE" /* ADD_FUNDS_RECEIVE */);
|
|
1701
2170
|
}
|
|
1702
2171
|
};
|
|
1703
|
-
return /* @__PURE__ */
|
|
1704
|
-
/* @__PURE__ */
|
|
1705
|
-
/* @__PURE__ */
|
|
1706
|
-
/* @__PURE__ */
|
|
1707
|
-
!!name && /* @__PURE__ */
|
|
1708
|
-
/* @__PURE__ */
|
|
2172
|
+
return /* @__PURE__ */ jsxs5(Container, { children: [
|
|
2173
|
+
/* @__PURE__ */ jsxs5(InnerContainer, { children: [
|
|
2174
|
+
/* @__PURE__ */ jsx6(CpslIdenticon, { size: "48px", hash: identiconHash }),
|
|
2175
|
+
/* @__PURE__ */ jsxs5(WalletNameContainer, { children: [
|
|
2176
|
+
!!name && /* @__PURE__ */ jsx6(Name, { color: "contrast", variant: "bodyL", weight: "semiBold", children: name }),
|
|
2177
|
+
/* @__PURE__ */ jsx6(Name, { color: "secondary", variant: "bodyS", weight: "medium", children: address })
|
|
1709
2178
|
] })
|
|
1710
2179
|
] }),
|
|
1711
|
-
showAddFunds && isAddFundsEnabled && /* @__PURE__ */
|
|
2180
|
+
showAddFunds && isAddFundsEnabled && /* @__PURE__ */ jsx6(AddFundsButton, { onClick: handleAddFundsClick, children: /* @__PURE__ */ jsx6(CpslText5, { variant: "bodyXS", color: "contrast", weight: "medium", children: "Add Funds" }) })
|
|
1712
2181
|
] });
|
|
1713
2182
|
};
|
|
1714
|
-
var WalletCards =
|
|
2183
|
+
var WalletCards = styled6.div`
|
|
1715
2184
|
display: flex;
|
|
1716
2185
|
flex-direction: column;
|
|
1717
2186
|
gap: 8px;
|
|
1718
2187
|
width: 100%;
|
|
1719
2188
|
`;
|
|
1720
|
-
var Container =
|
|
2189
|
+
var Container = styled6.div`
|
|
1721
2190
|
width: 100%;
|
|
1722
2191
|
padding: 24px;
|
|
1723
2192
|
display: flex;
|
|
@@ -1727,14 +2196,14 @@ var Container = styled5.div`
|
|
|
1727
2196
|
background-color: var(--cpsl-color-background-8);
|
|
1728
2197
|
border-radius: 16px;
|
|
1729
2198
|
`;
|
|
1730
|
-
var InnerContainer =
|
|
2199
|
+
var InnerContainer = styled6.div`
|
|
1731
2200
|
display: flex;
|
|
1732
2201
|
justify-content: flex-start;
|
|
1733
2202
|
gap: 8px;
|
|
1734
2203
|
align-items: center;
|
|
1735
2204
|
overflow: hidden;
|
|
1736
2205
|
`;
|
|
1737
|
-
var WalletNameContainer =
|
|
2206
|
+
var WalletNameContainer = styled6.div`
|
|
1738
2207
|
flex: 1;
|
|
1739
2208
|
display: flex;
|
|
1740
2209
|
flex-direction: column;
|
|
@@ -1743,7 +2212,7 @@ var WalletNameContainer = styled5.div`
|
|
|
1743
2212
|
justify-content: center;
|
|
1744
2213
|
overflow: hidden;
|
|
1745
2214
|
`;
|
|
1746
|
-
var Name =
|
|
2215
|
+
var Name = styled6(CpslText5)`
|
|
1747
2216
|
width: 100%;
|
|
1748
2217
|
&::part(text-element) {
|
|
1749
2218
|
line-height: 100%;
|
|
@@ -1752,7 +2221,7 @@ var Name = styled5(CpslText4)`
|
|
|
1752
2221
|
white-space: nowrap;
|
|
1753
2222
|
}
|
|
1754
2223
|
`;
|
|
1755
|
-
var AddFundsButton =
|
|
2224
|
+
var AddFundsButton = styled6(CpslButton4)`
|
|
1756
2225
|
--button-primary-background-color: var(--cpsl-color-card-surface);
|
|
1757
2226
|
--button-primary-hover-background-color: var(--cpsl-color-background-4);
|
|
1758
2227
|
--button-primary-color: var(--cpsl-color-text-contrast);
|
|
@@ -1766,21 +2235,21 @@ var AddFundsButton = styled5(CpslButton3)`
|
|
|
1766
2235
|
`;
|
|
1767
2236
|
|
|
1768
2237
|
// src/modal/components/LoginDoneStep/LoginDoneStep.tsx
|
|
1769
|
-
import { jsx as
|
|
2238
|
+
import { jsx as jsx7, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
1770
2239
|
var LoginDoneStep = ({ onClose }) => {
|
|
1771
2240
|
var _a;
|
|
1772
2241
|
const para = useInternalClient();
|
|
1773
2242
|
const hideWallets = useThemeStore((state) => state.hideWallets);
|
|
1774
|
-
|
|
2243
|
+
useEffect8(() => {
|
|
1775
2244
|
setTimeout(() => {
|
|
1776
2245
|
onClose();
|
|
1777
2246
|
}, 1600);
|
|
1778
2247
|
}, []);
|
|
1779
|
-
return /* @__PURE__ */
|
|
1780
|
-
/* @__PURE__ */
|
|
1781
|
-
/* @__PURE__ */
|
|
1782
|
-
!hideWallets && /* @__PURE__ */
|
|
1783
|
-
return /* @__PURE__ */
|
|
2248
|
+
return /* @__PURE__ */ jsxs6(StepContainer, { children: [
|
|
2249
|
+
/* @__PURE__ */ jsx7(HeroIcon, { icon: "checkCircleFilled" }),
|
|
2250
|
+
/* @__PURE__ */ jsx7(Heading, { variant: "headingS", weight: "bold", children: "Connected" }),
|
|
2251
|
+
!hideWallets && /* @__PURE__ */ jsx7(WalletCards, { children: para.isUsingExternalWallet() ? /* @__PURE__ */ jsx7(ExternalWalletCard, { address: (_a = Object.values(para.externalWallets || {})[0]) == null ? void 0 : _a.address }) : para.currentWalletIdsArray.map(([id, type]) => {
|
|
2252
|
+
return /* @__PURE__ */ jsx7(WalletCard, { id, type }, `${id}-${type}`);
|
|
1784
2253
|
}) })
|
|
1785
2254
|
] });
|
|
1786
2255
|
};
|
|
@@ -1789,23 +2258,23 @@ var LoginDoneStep = ({ onClose }) => {
|
|
|
1789
2258
|
import { EnabledFlow as EnabledFlow2 } from "@getpara/web-sdk";
|
|
1790
2259
|
|
|
1791
2260
|
// src/modal/components/Waiting/Waiting.tsx
|
|
1792
|
-
import { CpslSpinner as
|
|
1793
|
-
import { jsx as
|
|
2261
|
+
import { CpslSpinner as CpslSpinner4, CpslText as CpslText6 } from "@getpara/react-components";
|
|
2262
|
+
import { jsx as jsx8, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
1794
2263
|
var Waiting = ({ heading, subheading }) => {
|
|
1795
|
-
return /* @__PURE__ */
|
|
1796
|
-
/* @__PURE__ */
|
|
1797
|
-
/* @__PURE__ */
|
|
1798
|
-
/* @__PURE__ */
|
|
1799
|
-
/* @__PURE__ */
|
|
2264
|
+
return /* @__PURE__ */ jsxs7(StepContainer, { $wide: true, children: [
|
|
2265
|
+
/* @__PURE__ */ jsx8(SpinnerContainer, { children: /* @__PURE__ */ jsx8(CpslSpinner4, { size: 100 }) }),
|
|
2266
|
+
/* @__PURE__ */ jsxs7(InnerStepContainer, { children: [
|
|
2267
|
+
/* @__PURE__ */ jsx8(Heading, { variant: "headingS", weight: "bold", children: heading }),
|
|
2268
|
+
/* @__PURE__ */ jsx8(CpslText6, { variant: "bodyS", color: "secondary", weight: "medium", children: subheading })
|
|
1800
2269
|
] })
|
|
1801
2270
|
] });
|
|
1802
2271
|
};
|
|
1803
2272
|
|
|
1804
2273
|
// src/modal/components/AwaitingBiometricsStep/AwaitingBiometricsStep.tsx
|
|
1805
|
-
import { jsx as
|
|
2274
|
+
import { jsx as jsx9 } from "react/jsx-runtime";
|
|
1806
2275
|
var AwaitingBiometricsStep = () => {
|
|
1807
2276
|
const isLogin = useModalStore((state) => state.isLogin());
|
|
1808
|
-
return /* @__PURE__ */
|
|
2277
|
+
return /* @__PURE__ */ jsx9(
|
|
1809
2278
|
Waiting,
|
|
1810
2279
|
{
|
|
1811
2280
|
heading: isLogin ? "Waiting for Passkey" : "Creating Passkey",
|
|
@@ -1815,14 +2284,14 @@ var AwaitingBiometricsStep = () => {
|
|
|
1815
2284
|
};
|
|
1816
2285
|
|
|
1817
2286
|
// src/modal/components/AwaitingWalletCreationStep/AwaitingWalletCreationStep.tsx
|
|
1818
|
-
import { CpslIcon as CpslIcon4, CpslInfoBox, CpslText as
|
|
1819
|
-
import { useEffect as
|
|
1820
|
-
import { jsx as
|
|
2287
|
+
import { CpslIcon as CpslIcon4, CpslInfoBox, CpslText as CpslText7 } from "@getpara/react-components";
|
|
2288
|
+
import { useEffect as useEffect9, useRef as useRef4, useState as useState5 } from "react";
|
|
2289
|
+
import { jsx as jsx10, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
1821
2290
|
var AwaitingWalletCreationStep = () => {
|
|
1822
2291
|
const hideWallets = useThemeStore((state) => state.hideWallets);
|
|
1823
|
-
const [showInfoBox, setShowInfoBox] =
|
|
2292
|
+
const [showInfoBox, setShowInfoBox] = useState5(false);
|
|
1824
2293
|
const showInfoBoxTimeout = useRef4();
|
|
1825
|
-
|
|
2294
|
+
useEffect9(() => {
|
|
1826
2295
|
if (typeof window !== "undefined") {
|
|
1827
2296
|
showInfoBoxTimeout.current = window.setTimeout(() => {
|
|
1828
2297
|
setShowInfoBox(true);
|
|
@@ -1830,463 +2299,199 @@ var AwaitingWalletCreationStep = () => {
|
|
|
1830
2299
|
}
|
|
1831
2300
|
return () => clearTimeout(showInfoBoxTimeout.current);
|
|
1832
2301
|
}, []);
|
|
1833
|
-
return /* @__PURE__ */
|
|
1834
|
-
/* @__PURE__ */
|
|
2302
|
+
return /* @__PURE__ */ jsxs8(StepContainer, { $wide: true, children: [
|
|
2303
|
+
/* @__PURE__ */ jsx10(
|
|
1835
2304
|
Waiting,
|
|
1836
2305
|
{
|
|
1837
2306
|
heading: hideWallets ? "Creating Your Account" : "Creating Your Wallet",
|
|
1838
2307
|
subheading: "This should only take a couple of seconds."
|
|
1839
2308
|
}
|
|
1840
2309
|
),
|
|
1841
|
-
showInfoBox && /* @__PURE__ */
|
|
1842
|
-
/* @__PURE__ */
|
|
1843
|
-
/* @__PURE__ */
|
|
1844
|
-
/* @__PURE__ */
|
|
2310
|
+
showInfoBox && /* @__PURE__ */ jsx10(CpslInfoBox, { children: /* @__PURE__ */ jsxs8(InfoBoxContent, { children: [
|
|
2311
|
+
/* @__PURE__ */ jsxs8(InfoBoxHeader, { children: [
|
|
2312
|
+
/* @__PURE__ */ jsx10(CpslIcon4, { icon: "clock" }),
|
|
2313
|
+
/* @__PURE__ */ jsx10(CpslText7, { weight: "medium", children: "Hang on" })
|
|
1845
2314
|
] }),
|
|
1846
|
-
/* @__PURE__ */
|
|
2315
|
+
/* @__PURE__ */ jsxs8(CpslText7, { variant: "bodyS", weight: "medium", color: "secondary", children: [
|
|
1847
2316
|
"Creating your ",
|
|
1848
2317
|
hideWallets ? "account" : "wallet",
|
|
1849
2318
|
" is taking a little longer than expected, but we're working on it!"
|
|
1850
2319
|
] })
|
|
1851
|
-
] }) })
|
|
1852
|
-
] });
|
|
1853
|
-
};
|
|
1854
|
-
|
|
1855
|
-
// src/modal/components/WalletCreationDoneStep/WalletCreationDoneStep.tsx
|
|
1856
|
-
import { CpslButton as
|
|
1857
|
-
import
|
|
1858
|
-
import { Fragment as Fragment4, jsx as
|
|
1859
|
-
var WalletCreationDoneStep = ({ twoFactorAuthEnabled, onClose }) => {
|
|
1860
|
-
const hideWallets = useThemeStore((state) => state.hideWallets);
|
|
1861
|
-
const setStep = useModalStore((state) => state.setStep);
|
|
1862
|
-
const isLogin = useModalStore((state) => state.isLogin());
|
|
1863
|
-
const onRampConfig = useModalStore((state) => state.onRampConfig);
|
|
1864
|
-
const para = useInternalClient();
|
|
1865
|
-
const isOnRampConfigured = (onRampConfig == null ? void 0 : onRampConfig.isBuyEnabled) || (onRampConfig == null ? void 0 : onRampConfig.isReceiveEnabled) || (onRampConfig == null ? void 0 : onRampConfig.isWithdrawEnabled);
|
|
1866
|
-
const handleNext = () => __async(void 0, null, function* () {
|
|
1867
|
-
if (isLogin) {
|
|
1868
|
-
if (!twoFactorAuthEnabled) {
|
|
1869
|
-
setStep("LOGIN_DONE" /* LOGIN_DONE */);
|
|
1870
|
-
return;
|
|
1871
|
-
}
|
|
1872
|
-
const is2FAComplete = yield para.check2FAStatus();
|
|
1873
|
-
setStep(is2FAComplete ? "LOGIN_DONE" /* LOGIN_DONE */ : "SETUP_2FA" /* SETUP_2FA */);
|
|
1874
|
-
} else {
|
|
1875
|
-
if (twoFactorAuthEnabled) {
|
|
1876
|
-
setStep("SETUP_2FA" /* SETUP_2FA */);
|
|
1877
|
-
} else {
|
|
1878
|
-
onClose();
|
|
1879
|
-
}
|
|
1880
|
-
}
|
|
1881
|
-
});
|
|
1882
|
-
return /* @__PURE__ */ jsxs8(StepContainer, { $wide: true, children: [
|
|
1883
|
-
/* @__PURE__ */ jsx9(CardContainer, { children: hideWallets ? /* @__PURE__ */ jsxs8(Fragment4, { children: [
|
|
1884
|
-
/* @__PURE__ */ jsx9(HeroIcon, { icon: "checkCircleFilled" }),
|
|
1885
|
-
/* @__PURE__ */ jsx9(CpslText7, { variant: "bodyM", color: "secondary", weight: "medium", style: { marginTop: "16px" }, children: "Your account has been created." })
|
|
1886
|
-
] }) : /* @__PURE__ */ jsx9(WalletCards, { children: para.currentWalletIdsArray.map(([id, type]) => {
|
|
1887
|
-
return /* @__PURE__ */ jsx9(WalletCard, { id, type, showAddFunds: isOnRampConfigured }, id);
|
|
1888
|
-
}) }) }),
|
|
1889
|
-
/* @__PURE__ */ jsx9(InnerStepContainer, { children: /* @__PURE__ */ jsx9(CpslButton4, { fullWidth: true, onClick: handleNext, children: twoFactorAuthEnabled ? "Continue" : "Done" }) })
|
|
1890
|
-
] });
|
|
1891
|
-
};
|
|
1892
|
-
var CardContainer = styled6(InnerStepContainer)`
|
|
1893
|
-
min-height: 196px;
|
|
1894
|
-
justify-content: center;
|
|
1895
|
-
`;
|
|
1896
|
-
|
|
1897
|
-
// src/modal/components/RecoverySecretStep/RecoverySecretStep.tsx
|
|
1898
|
-
import { CpslButton as CpslButton5, CpslText as CpslText8 } from "@getpara/react-components";
|
|
1899
|
-
import { styled as styled7 } from "styled-components";
|
|
1900
|
-
import { useCopyToClipboard as useCopyToClipboard2 } from "@getpara/react-common";
|
|
1901
|
-
|
|
1902
|
-
// src/modal/utils/getMailtoLink.ts
|
|
1903
|
-
function getMailtoLink(email, recoveryShare) {
|
|
1904
|
-
const emailBody = `Hello,%0D%0DBelow is your Para Recovery Secret. Keep this safe!%0D%0D${recoveryShare}%0D%0DPlease get in touch via support@getpara.com if you have any questions`;
|
|
1905
|
-
const mailText = `mailto:${email}?subject=Para%20Recovery%20Secret&body=${emailBody}`;
|
|
1906
|
-
return mailText;
|
|
1907
|
-
}
|
|
1908
|
-
|
|
1909
|
-
// src/modal/components/RecoverySecretStep/RecoverySecretStep.tsx
|
|
1910
|
-
import { useState as useState5 } from "react";
|
|
1911
|
-
import { Fragment as Fragment5, jsx as jsx10, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
1912
|
-
var SaveRecoverySecret = ({
|
|
1913
|
-
email,
|
|
1914
|
-
value,
|
|
1915
|
-
onComplete
|
|
1916
|
-
}) => {
|
|
1917
|
-
const [isSecretSaved, setIsSecretSaved] = useState5(false);
|
|
1918
|
-
const [isCopied, copy] = useCopyToClipboard2();
|
|
1919
|
-
const onCopy = () => {
|
|
1920
|
-
copy(value);
|
|
1921
|
-
setIsSecretSaved(true);
|
|
1922
|
-
};
|
|
1923
|
-
const onDownload = () => {
|
|
1924
|
-
const element = document.createElement("a");
|
|
1925
|
-
const file = new Blob([value], { type: "text/plain" });
|
|
1926
|
-
element.href = URL.createObjectURL(file);
|
|
1927
|
-
element.download = "recovery.txt";
|
|
1928
|
-
document.body.appendChild(element);
|
|
1929
|
-
element.click();
|
|
1930
|
-
setIsSecretSaved(true);
|
|
1931
|
-
};
|
|
1932
|
-
const onEmail = () => {
|
|
1933
|
-
typeof window !== "undefined" && window.open(getMailtoLink(email, value), "_self");
|
|
1934
|
-
setIsSecretSaved(true);
|
|
1935
|
-
};
|
|
1936
|
-
return /* @__PURE__ */ jsxs9(Fragment5, { children: [
|
|
1937
|
-
/* @__PURE__ */ jsxs9(InnerStepContainer, { children: [
|
|
1938
|
-
/* @__PURE__ */ jsx10(Heading, { variant: "headingXS", weight: "semiBold", children: "Save your Recovery Secret" }),
|
|
1939
|
-
/* @__PURE__ */ jsxs9(ButtonContainer, { children: [
|
|
1940
|
-
/* @__PURE__ */ jsx10(ActionButton, { icon: "download", onClick: onDownload, children: /* @__PURE__ */ jsx10(CpslText8, { variant: "bodyXS", color: "secondary", weight: "medium", children: "Download" }) }),
|
|
1941
|
-
/* @__PURE__ */ jsx10(ActionButton, { icon: isCopied ? "check" : "copy", onClick: onCopy, children: /* @__PURE__ */ jsx10(CpslText8, { variant: "bodyXS", color: "secondary", weight: "medium", children: isCopied ? "Copied!" : "Copy" }) }),
|
|
1942
|
-
/* @__PURE__ */ jsx10(ActionButton, { icon: "send", onClick: onEmail, children: /* @__PURE__ */ jsx10(CpslText8, { variant: "bodyXS", color: "secondary", weight: "medium", children: "Email" }) })
|
|
1943
|
-
] })
|
|
1944
|
-
] }),
|
|
1945
|
-
/* @__PURE__ */ jsx10(InnerStepContainer, { children: /* @__PURE__ */ jsx10(CpslButton5, { fullWidth: true, onClick: onComplete, disabled: !isSecretSaved, children: !isSecretSaved ? "Choose an option above to continue" : "I\u2019ve saved my recovery secret" }) })
|
|
1946
|
-
] });
|
|
1947
|
-
};
|
|
1948
|
-
var RecoverySecretStep = () => {
|
|
1949
|
-
const hideWallets = useThemeStore((state) => state.hideWallets);
|
|
1950
|
-
const setStep = useModalStore((state) => state.setStep);
|
|
1951
|
-
const authInfo = useUserInfoStore((state) => state.getAuthInfo());
|
|
1952
|
-
const recoveryShare = useUserInfoStore((state) => state.recoveryShare);
|
|
1953
|
-
const backupDecryptionKey = JSON.parse(recoveryShare || "{}").backupDecryptionKey;
|
|
1954
|
-
const onComplete = () => __async(void 0, null, function* () {
|
|
1955
|
-
setStep("WALLET_CREATION_DONE" /* WALLET_CREATION_DONE */);
|
|
1956
|
-
});
|
|
1957
|
-
return /* @__PURE__ */ jsxs9(StepContainer, { children: [
|
|
1958
|
-
/* @__PURE__ */ jsxs9(InnerStepContainer, { children: [
|
|
1959
|
-
/* @__PURE__ */ jsx10(Heading, { variant: "headingS", weight: "bold", children: hideWallets ? "Don't lose access" : "Don't lose your wallet" }),
|
|
1960
|
-
/* @__PURE__ */ jsxs9(InlineText2, { variant: "bodyS", color: "secondary", weight: "medium", children: [
|
|
1961
|
-
"Your",
|
|
1962
|
-
" ",
|
|
1963
|
-
/* @__PURE__ */ jsx10(InlineText2, { variant: "bodyS", weight: "medium", children: "Recovery Secret" }),
|
|
1964
|
-
" ",
|
|
1965
|
-
"ensures you will be able to regain access to your ",
|
|
1966
|
-
hideWallets ? "account" : "wallet",
|
|
1967
|
-
" if you lose your Passkey or Password."
|
|
1968
|
-
] })
|
|
1969
|
-
] }),
|
|
1970
|
-
/* @__PURE__ */ jsx10(
|
|
1971
|
-
SaveRecoverySecret,
|
|
1972
|
-
{
|
|
1973
|
-
email: (authInfo == null ? void 0 : authInfo.authType) === "email" ? authInfo.identifier : void 0,
|
|
1974
|
-
value: backupDecryptionKey,
|
|
1975
|
-
onComplete
|
|
1976
|
-
}
|
|
1977
|
-
)
|
|
1978
|
-
] });
|
|
1979
|
-
};
|
|
1980
|
-
var ActionButton = styled7(StyledCpslTileButton)`
|
|
1981
|
-
flex: 1;
|
|
1982
|
-
|
|
1983
|
-
--button-icon-color: var(--cpsl-color-text-primary);
|
|
1984
|
-
`;
|
|
1985
|
-
var ButtonContainer = styled7.div`
|
|
1986
|
-
display: flex;
|
|
1987
|
-
align-items: center;
|
|
1988
|
-
justify-content: center;
|
|
1989
|
-
gap: 8px;
|
|
1990
|
-
width: 100%;
|
|
1991
|
-
`;
|
|
1992
|
-
var InlineText2 = styled7(CpslText8)`
|
|
1993
|
-
text-align: center;
|
|
1994
|
-
display: inline-block;
|
|
1995
|
-
`;
|
|
1996
|
-
|
|
1997
|
-
// src/modal/components/TwoFactorDoneStep/TwoFactorDoneStep.tsx
|
|
1998
|
-
import { CpslButton as CpslButton6, CpslText as CpslText9 } from "@getpara/react-components";
|
|
1999
|
-
import { jsx as jsx11, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
2000
|
-
var TwoFactorDoneStep = ({ onClose }) => {
|
|
2001
|
-
const hideWallets = useThemeStore((state) => state.hideWallets);
|
|
2002
|
-
return /* @__PURE__ */ jsxs10(StepContainer, { children: [
|
|
2003
|
-
/* @__PURE__ */ jsx11(HeroIcon, { icon: "checkCircleFilled" }),
|
|
2004
|
-
/* @__PURE__ */ jsxs10(InnerStepContainer, { children: [
|
|
2005
|
-
/* @__PURE__ */ jsx11(Heading, { variant: "headingXS", weight: "semiBold", children: "Success" }),
|
|
2006
|
-
/* @__PURE__ */ jsxs10(CpslText9, { variant: "bodyS", color: "secondary", weight: "medium", children: [
|
|
2007
|
-
"Your ",
|
|
2008
|
-
hideWallets ? "account" : "wallet",
|
|
2009
|
-
" is now protected by 2FA"
|
|
2010
|
-
] })
|
|
2011
|
-
] }),
|
|
2012
|
-
/* @__PURE__ */ jsx11(CpslButton6, { fullWidth: true, onClick: onClose, children: "Done" })
|
|
2013
|
-
] });
|
|
2014
|
-
};
|
|
2015
|
-
|
|
2016
|
-
// src/modal/components/BiometricCreationStep/BiometricCreationStep.tsx
|
|
2017
|
-
import { CpslButton as CpslButton7, CpslDivider as CpslDivider3, CpslIcon as CpslIcon5, CpslQrCode as CpslQrCode2, CpslSpinner as CpslSpinner4, CpslText as CpslText10 } from "@getpara/react-components";
|
|
2018
|
-
import { useCopyToClipboard as useCopyToClipboard3, UserIdentifier as UserIdentifier2 } from "@getpara/react-common";
|
|
2019
|
-
|
|
2020
|
-
// src/modal/constants/defaults.ts
|
|
2021
|
-
var DEFAULTS = {
|
|
2022
|
-
LOGGIN_POLLING_DELAY_MS: 5e3,
|
|
2023
|
-
POLLING_INTERVAL_MS: 2e3,
|
|
2024
|
-
ANIMATION_DURATION: 0.15
|
|
2025
|
-
};
|
|
2026
|
-
|
|
2027
|
-
// src/modal/providers/ExternalWalletContext.tsx
|
|
2028
|
-
import { createContext, useCallback, useContext, useEffect as useEffect9, useMemo as useMemo2, useState as useState6 } from "react";
|
|
2029
|
-
import { WalletType as WalletType2, isIOS, isIOSWebview, isMobile, truncateAddress as truncateAddress2 } from "@getpara/web-sdk";
|
|
2030
|
-
import { jsx as jsx12 } from "react/jsx-runtime";
|
|
2031
|
-
var defaultExternalWallet = {
|
|
2032
|
-
wallets: [],
|
|
2033
|
-
chains: [],
|
|
2034
|
-
chainId: void 0,
|
|
2035
|
-
wallet: void 0,
|
|
2036
|
-
qrUri: void 0,
|
|
2037
|
-
chainIdSwitchingTo: void 0,
|
|
2038
|
-
walletDisplayHelpers: {
|
|
2039
|
-
showExtension: false,
|
|
2040
|
-
showMobile: false,
|
|
2041
|
-
isSolanaMobileIOS: false,
|
|
2042
|
-
isCosmosMobileWallet: false
|
|
2043
|
-
},
|
|
2044
|
-
username: void 0,
|
|
2045
|
-
avatar: void 0,
|
|
2046
|
-
connectExternalWallet: () => {
|
|
2047
|
-
},
|
|
2048
|
-
disconnectExternalWallet: () => Promise.resolve(),
|
|
2049
|
-
switchChain: () => Promise.resolve(),
|
|
2050
|
-
setChainIdSwitchingTo: () => {
|
|
2051
|
-
}
|
|
2052
|
-
};
|
|
2053
|
-
var ExternalWalletContext = createContext(defaultExternalWallet);
|
|
2054
|
-
function ExternalWalletProvider({
|
|
2055
|
-
children,
|
|
2056
|
-
evmContext,
|
|
2057
|
-
solanaContext,
|
|
2058
|
-
cosmosContext,
|
|
2059
|
-
walletSort
|
|
2060
|
-
}) {
|
|
2061
|
-
const {
|
|
2062
|
-
wallets: evmWallets,
|
|
2063
|
-
disconnect: evmDisconnect,
|
|
2064
|
-
chains: evmChains,
|
|
2065
|
-
chainId: evmChainId,
|
|
2066
|
-
switchChain: evmSwitchChain,
|
|
2067
|
-
username: evmUsername,
|
|
2068
|
-
avatar: evmAvatar
|
|
2069
|
-
} = useContext(evmContext);
|
|
2070
|
-
const { wallets: solanaWallets, disconnect: solanaDisconnect } = useContext(solanaContext);
|
|
2071
|
-
const {
|
|
2072
|
-
wallets: cosmosWallets,
|
|
2073
|
-
disconnect: cosmosDisconnect,
|
|
2074
|
-
chains: cosmosChains,
|
|
2075
|
-
chainId: cosmosChainId,
|
|
2076
|
-
switchChain: cosmosSwitchChain
|
|
2077
|
-
} = useContext(cosmosContext);
|
|
2078
|
-
const setStep = useModalStore((state) => state.setStep);
|
|
2079
|
-
const setStepDirection = useModalStore((state) => state.setStepDirection);
|
|
2080
|
-
const setIsExternalWalletConnecting = useModalStore((state) => state.setIsExternalWalletConnecting);
|
|
2081
|
-
const isExternalWalletConnecting = useModalStore((state) => state.isExternalWalletConnecting);
|
|
2082
|
-
const setSelectedExternalWalletId = useModalStore((state) => state.setSelectedExternalWalletId);
|
|
2083
|
-
const selectedExternalWalletId = useModalStore((state) => state.selectedExternalWalletId);
|
|
2084
|
-
const setExternalWalletError = useModalStore((state) => state.setExternalWalletError);
|
|
2085
|
-
const setIsUsingMobileConnector = useModalStore((state) => state.setIsUsingMobileConnector);
|
|
2086
|
-
const isUsingMobileConnector = useModalStore((state) => state.isUsingMobileConnector);
|
|
2087
|
-
const para = useInternalClient();
|
|
2088
|
-
const [qrUri, setQrUri] = useState6();
|
|
2089
|
-
const [chainIdSwitchingTo, setChainIdSwitchingTo] = useState6();
|
|
2090
|
-
const wallets = [...evmWallets, ...solanaWallets, ...cosmosWallets].filter((w) => walletSort.includes(w.id.toUpperCase())).sort(
|
|
2091
|
-
(a, b) => walletSort.indexOf(a.id.toUpperCase()) - walletSort.indexOf(b.id.toUpperCase())
|
|
2092
|
-
).sort((a, b) => a.installed === b.installed ? 0 : a.installed ? -1 : 1);
|
|
2093
|
-
const wallet = useMemo2(() => wallets.find((w) => w.id === selectedExternalWalletId), [wallets, selectedExternalWalletId]);
|
|
2094
|
-
const updateQrUri = () => __async(this, null, function* () {
|
|
2095
|
-
var _a;
|
|
2096
|
-
const uri = yield (_a = wallet == null ? void 0 : wallet.getQrUri) == null ? void 0 : _a.call(wallet);
|
|
2097
|
-
setQrUri(uri);
|
|
2098
|
-
});
|
|
2099
|
-
useEffect9(() => {
|
|
2100
|
-
if (wallet) {
|
|
2101
|
-
if (!qrUri) {
|
|
2102
|
-
updateQrUri();
|
|
2103
|
-
}
|
|
2104
|
-
} else if (qrUri) {
|
|
2105
|
-
setQrUri(void 0);
|
|
2106
|
-
}
|
|
2107
|
-
}, [wallet]);
|
|
2108
|
-
const chains = useMemo2(() => {
|
|
2109
|
-
var _a;
|
|
2110
|
-
const walletType = (_a = Object.values(para.externalWallets || {})[0]) == null ? void 0 : _a.type;
|
|
2111
|
-
switch (walletType) {
|
|
2112
|
-
case WalletType2.COSMOS: {
|
|
2113
|
-
return cosmosChains;
|
|
2114
|
-
}
|
|
2115
|
-
case WalletType2.EVM: {
|
|
2116
|
-
return evmChains;
|
|
2117
|
-
}
|
|
2118
|
-
default: {
|
|
2119
|
-
return [];
|
|
2120
|
-
}
|
|
2121
|
-
}
|
|
2122
|
-
}, [cosmosChains, evmChains, selectedExternalWalletId]);
|
|
2123
|
-
const chainId = useMemo2(() => {
|
|
2124
|
-
var _a;
|
|
2125
|
-
const walletType = (_a = Object.values(para.externalWallets || {})[0]) == null ? void 0 : _a.type;
|
|
2126
|
-
switch (walletType) {
|
|
2127
|
-
case WalletType2.COSMOS: {
|
|
2128
|
-
return cosmosChainId;
|
|
2129
|
-
}
|
|
2130
|
-
case WalletType2.EVM: {
|
|
2131
|
-
return evmChainId == null ? void 0 : evmChainId.toString();
|
|
2132
|
-
}
|
|
2133
|
-
default: {
|
|
2134
|
-
return void 0;
|
|
2135
|
-
}
|
|
2136
|
-
}
|
|
2137
|
-
}, [cosmosChains, evmChains, selectedExternalWalletId]);
|
|
2138
|
-
const switchChain = useCallback(
|
|
2139
|
-
(chainId2) => __async(this, null, function* () {
|
|
2140
|
-
var _a;
|
|
2141
|
-
const walletType = (_a = Object.values(para.externalWallets || {})[0]) == null ? void 0 : _a.type;
|
|
2142
|
-
if (walletType) {
|
|
2143
|
-
let resp;
|
|
2144
|
-
setExternalWalletError();
|
|
2145
|
-
setChainIdSwitchingTo(chainId2);
|
|
2146
|
-
switch (walletType) {
|
|
2147
|
-
case WalletType2.COSMOS: {
|
|
2148
|
-
setStep("CHAIN_SWITCH" /* CHAIN_SWITCH */);
|
|
2149
|
-
resp = yield cosmosSwitchChain(chainId2);
|
|
2150
|
-
break;
|
|
2151
|
-
}
|
|
2152
|
-
case WalletType2.EVM: {
|
|
2153
|
-
setStep("CHAIN_SWITCH" /* CHAIN_SWITCH */);
|
|
2154
|
-
resp = yield evmSwitchChain(parseInt(chainId2));
|
|
2155
|
-
break;
|
|
2156
|
-
}
|
|
2157
|
-
default: {
|
|
2158
|
-
break;
|
|
2159
|
-
}
|
|
2160
|
-
}
|
|
2161
|
-
if (resp.error) {
|
|
2162
|
-
setExternalWalletError(resp.error);
|
|
2163
|
-
} else {
|
|
2164
|
-
setChainIdSwitchingTo(void 0);
|
|
2165
|
-
setStepDirection(-1);
|
|
2166
|
-
setStep("ACCOUNT_MAIN" /* ACCOUNT_MAIN */);
|
|
2167
|
-
}
|
|
2168
|
-
}
|
|
2169
|
-
}),
|
|
2170
|
-
[evmSwitchChain, cosmosSwitchChain]
|
|
2171
|
-
);
|
|
2172
|
-
const connectExternalWallet = useCallback(
|
|
2173
|
-
(wallet2, isMobileConnect, isManualWalletConnect, isResetAfterManualWalletConnect) => __async(this, null, function* () {
|
|
2174
|
-
if (isExternalWalletConnecting && isManualWalletConnect) {
|
|
2175
|
-
yield evmDisconnect();
|
|
2176
|
-
yield solanaDisconnect();
|
|
2177
|
-
yield cosmosDisconnect();
|
|
2178
|
-
setQrUri(void 0);
|
|
2179
|
-
setIsExternalWalletConnecting(false);
|
|
2180
|
-
}
|
|
2181
|
-
if (isResetAfterManualWalletConnect || isManualWalletConnect || !isExternalWalletConnecting) {
|
|
2182
|
-
setExternalWalletError();
|
|
2183
|
-
setIsExternalWalletConnecting(true);
|
|
2184
|
-
setIsUsingMobileConnector(isMobileConnect);
|
|
2185
|
-
const { address, error } = yield isMobileConnect ? wallet2.connectMobile(isManualWalletConnect) : wallet2.connect();
|
|
2186
|
-
if (error) {
|
|
2187
|
-
setExternalWalletError([error]);
|
|
2188
|
-
setIsUsingMobileConnector();
|
|
2189
|
-
if (isManualWalletConnect && error === "Connection request rejected") {
|
|
2190
|
-
setExternalWalletError();
|
|
2191
|
-
yield connectExternalWallet(wallet2, false, false, true);
|
|
2192
|
-
yield updateQrUri();
|
|
2193
|
-
return;
|
|
2194
|
-
}
|
|
2195
|
-
} else if (address) {
|
|
2196
|
-
setStep("LOGIN_DONE" /* LOGIN_DONE */);
|
|
2197
|
-
}
|
|
2198
|
-
setIsExternalWalletConnecting(false);
|
|
2199
|
-
}
|
|
2200
|
-
}),
|
|
2201
|
-
[isExternalWalletConnecting]
|
|
2202
|
-
);
|
|
2203
|
-
const disconnectExternalWallet = () => __async(this, null, function* () {
|
|
2204
|
-
yield evmDisconnect();
|
|
2205
|
-
yield solanaDisconnect();
|
|
2206
|
-
yield cosmosDisconnect();
|
|
2207
|
-
setSelectedExternalWalletId();
|
|
2208
|
-
});
|
|
2209
|
-
const walletDisplayHelpers = {
|
|
2210
|
-
// Show the extension screen if on web and the wallet is an extension and installed or the wallet isn't a mobile wallet
|
|
2211
|
-
// Also show the extension connection if on desktop for a solana wallet (no walletConnect)
|
|
2212
|
-
showExtension: !isMobile() && ((wallet == null ? void 0 : wallet.isExtension) && (wallet == null ? void 0 : wallet.installed) || !(wallet == null ? void 0 : wallet.isMobile) || (wallet == null ? void 0 : wallet.type) === WalletType2.SOLANA),
|
|
2213
|
-
// Show the mobile screen if on mobile and the wallet is a mobile wallet or if on desktop and the wallet isn't installed
|
|
2214
|
-
showMobile: isMobile() && (wallet == null ? void 0 : wallet.isMobile) || !isMobile() && !(wallet == null ? void 0 : wallet.installed),
|
|
2215
|
-
isSolanaMobileIOS: isIOS() && isMobile() && !isIOSWebview() && (wallet == null ? void 0 : wallet.type) === WalletType2.SOLANA,
|
|
2216
|
-
isCosmosMobileWallet: (wallet == null ? void 0 : wallet.type) === WalletType2.COSMOS && isUsingMobileConnector
|
|
2217
|
-
};
|
|
2218
|
-
const username = useMemo2(() => {
|
|
2219
|
-
let username2;
|
|
2220
|
-
const storedExternalWallet = Object.values(para.externalWallets || {})[0];
|
|
2221
|
-
if (storedExternalWallet) {
|
|
2222
|
-
const walletType = storedExternalWallet == null ? void 0 : storedExternalWallet.type;
|
|
2223
|
-
switch (walletType) {
|
|
2224
|
-
case WalletType2.EVM: {
|
|
2225
|
-
username2 = evmUsername ? evmUsername.startsWith("0x") ? truncateAddress2(evmUsername, "EVM") : evmUsername : void 0;
|
|
2226
|
-
break;
|
|
2227
|
-
}
|
|
2228
|
-
default: {
|
|
2229
|
-
username2 = storedExternalWallet.address ? truncateAddress2(storedExternalWallet.address, storedExternalWallet.type) : void 0;
|
|
2230
|
-
break;
|
|
2231
|
-
}
|
|
2232
|
-
}
|
|
2233
|
-
}
|
|
2234
|
-
return username2;
|
|
2235
|
-
}, [evmUsername, wallet]);
|
|
2236
|
-
const avatar = useMemo2(() => {
|
|
2237
|
-
var _a;
|
|
2238
|
-
const walletType = (_a = Object.values(para.externalWallets || {})[0]) == null ? void 0 : _a.type;
|
|
2239
|
-
if (walletType) {
|
|
2240
|
-
switch (walletType) {
|
|
2241
|
-
case WalletType2.EVM: {
|
|
2242
|
-
return evmAvatar;
|
|
2243
|
-
}
|
|
2244
|
-
default: {
|
|
2245
|
-
return void 0;
|
|
2246
|
-
}
|
|
2247
|
-
}
|
|
2248
|
-
}
|
|
2249
|
-
}, [evmAvatar, wallet]);
|
|
2250
|
-
return /* @__PURE__ */ jsx12(
|
|
2251
|
-
ExternalWalletContext.Provider,
|
|
2252
|
-
{
|
|
2253
|
-
value: useMemo2(
|
|
2254
|
-
() => ({
|
|
2255
|
-
wallets,
|
|
2256
|
-
chains,
|
|
2257
|
-
chainId,
|
|
2258
|
-
wallet,
|
|
2259
|
-
qrUri,
|
|
2260
|
-
walletDisplayHelpers,
|
|
2261
|
-
chainIdSwitchingTo,
|
|
2262
|
-
username,
|
|
2263
|
-
avatar,
|
|
2264
|
-
connectExternalWallet,
|
|
2265
|
-
disconnectExternalWallet,
|
|
2266
|
-
switchChain,
|
|
2267
|
-
setChainIdSwitchingTo
|
|
2268
|
-
}),
|
|
2269
|
-
[
|
|
2270
|
-
wallets,
|
|
2271
|
-
chains,
|
|
2272
|
-
chainId,
|
|
2273
|
-
wallet,
|
|
2274
|
-
qrUri,
|
|
2275
|
-
walletDisplayHelpers,
|
|
2276
|
-
chainIdSwitchingTo,
|
|
2277
|
-
username,
|
|
2278
|
-
avatar,
|
|
2279
|
-
disconnectExternalWallet,
|
|
2280
|
-
connectExternalWallet,
|
|
2281
|
-
switchChain,
|
|
2282
|
-
setChainIdSwitchingTo
|
|
2283
|
-
]
|
|
2284
|
-
),
|
|
2285
|
-
children
|
|
2320
|
+
] }) })
|
|
2321
|
+
] });
|
|
2322
|
+
};
|
|
2323
|
+
|
|
2324
|
+
// src/modal/components/WalletCreationDoneStep/WalletCreationDoneStep.tsx
|
|
2325
|
+
import { CpslButton as CpslButton5, CpslText as CpslText8 } from "@getpara/react-components";
|
|
2326
|
+
import styled7 from "styled-components";
|
|
2327
|
+
import { Fragment as Fragment4, jsx as jsx11, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
2328
|
+
var WalletCreationDoneStep = ({ twoFactorAuthEnabled, onClose }) => {
|
|
2329
|
+
const hideWallets = useThemeStore((state) => state.hideWallets);
|
|
2330
|
+
const setStep = useModalStore((state) => state.setStep);
|
|
2331
|
+
const isLogin = useModalStore((state) => state.isLogin());
|
|
2332
|
+
const onRampConfig = useModalStore((state) => state.onRampConfig);
|
|
2333
|
+
const para = useInternalClient();
|
|
2334
|
+
const isOnRampConfigured = (onRampConfig == null ? void 0 : onRampConfig.isBuyEnabled) || (onRampConfig == null ? void 0 : onRampConfig.isReceiveEnabled) || (onRampConfig == null ? void 0 : onRampConfig.isWithdrawEnabled);
|
|
2335
|
+
const handleNext = () => __async(void 0, null, function* () {
|
|
2336
|
+
if (isLogin) {
|
|
2337
|
+
if (!twoFactorAuthEnabled) {
|
|
2338
|
+
setStep("LOGIN_DONE" /* LOGIN_DONE */);
|
|
2339
|
+
return;
|
|
2340
|
+
}
|
|
2341
|
+
const is2FAComplete = yield para.check2FAStatus();
|
|
2342
|
+
setStep(is2FAComplete ? "LOGIN_DONE" /* LOGIN_DONE */ : "SETUP_2FA" /* SETUP_2FA */);
|
|
2343
|
+
} else {
|
|
2344
|
+
if (twoFactorAuthEnabled) {
|
|
2345
|
+
setStep("SETUP_2FA" /* SETUP_2FA */);
|
|
2346
|
+
} else {
|
|
2347
|
+
onClose();
|
|
2348
|
+
}
|
|
2286
2349
|
}
|
|
2287
|
-
);
|
|
2350
|
+
});
|
|
2351
|
+
return /* @__PURE__ */ jsxs9(StepContainer, { $wide: true, children: [
|
|
2352
|
+
/* @__PURE__ */ jsx11(CardContainer, { children: hideWallets ? /* @__PURE__ */ jsxs9(Fragment4, { children: [
|
|
2353
|
+
/* @__PURE__ */ jsx11(HeroIcon, { icon: "checkCircleFilled" }),
|
|
2354
|
+
/* @__PURE__ */ jsx11(CpslText8, { variant: "bodyM", color: "secondary", weight: "medium", style: { marginTop: "16px" }, children: "Your account has been created." })
|
|
2355
|
+
] }) : /* @__PURE__ */ jsx11(WalletCards, { children: para.currentWalletIdsArray.map(([id, type]) => {
|
|
2356
|
+
return /* @__PURE__ */ jsx11(WalletCard, { id, type, showAddFunds: isOnRampConfigured }, id);
|
|
2357
|
+
}) }) }),
|
|
2358
|
+
/* @__PURE__ */ jsx11(InnerStepContainer, { children: /* @__PURE__ */ jsx11(CpslButton5, { fullWidth: true, onClick: handleNext, children: twoFactorAuthEnabled ? "Continue" : "Done" }) })
|
|
2359
|
+
] });
|
|
2360
|
+
};
|
|
2361
|
+
var CardContainer = styled7(InnerStepContainer)`
|
|
2362
|
+
min-height: 196px;
|
|
2363
|
+
justify-content: center;
|
|
2364
|
+
`;
|
|
2365
|
+
|
|
2366
|
+
// src/modal/components/RecoverySecretStep/RecoverySecretStep.tsx
|
|
2367
|
+
import { CpslButton as CpslButton6, CpslText as CpslText9 } from "@getpara/react-components";
|
|
2368
|
+
import { styled as styled8 } from "styled-components";
|
|
2369
|
+
import { useCopyToClipboard as useCopyToClipboard2 } from "@getpara/react-common";
|
|
2370
|
+
|
|
2371
|
+
// src/modal/utils/getMailtoLink.ts
|
|
2372
|
+
function getMailtoLink(email, recoveryShare) {
|
|
2373
|
+
const emailBody = `Hello,%0D%0DBelow is your Para Recovery Secret. Keep this safe!%0D%0D${recoveryShare}%0D%0DPlease get in touch via support@getpara.com if you have any questions`;
|
|
2374
|
+
const mailText = `mailto:${email}?subject=Para%20Recovery%20Secret&body=${emailBody}`;
|
|
2375
|
+
return mailText;
|
|
2288
2376
|
}
|
|
2289
|
-
|
|
2377
|
+
|
|
2378
|
+
// src/modal/components/RecoverySecretStep/RecoverySecretStep.tsx
|
|
2379
|
+
import { useState as useState6 } from "react";
|
|
2380
|
+
import { Fragment as Fragment5, jsx as jsx12, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
2381
|
+
var SaveRecoverySecret = ({
|
|
2382
|
+
email,
|
|
2383
|
+
value,
|
|
2384
|
+
onComplete
|
|
2385
|
+
}) => {
|
|
2386
|
+
const [isSecretSaved, setIsSecretSaved] = useState6(false);
|
|
2387
|
+
const [isCopied, copy] = useCopyToClipboard2();
|
|
2388
|
+
const onCopy = () => {
|
|
2389
|
+
copy(value);
|
|
2390
|
+
setIsSecretSaved(true);
|
|
2391
|
+
};
|
|
2392
|
+
const onDownload = () => {
|
|
2393
|
+
const element = document.createElement("a");
|
|
2394
|
+
const file = new Blob([value], { type: "text/plain" });
|
|
2395
|
+
element.href = URL.createObjectURL(file);
|
|
2396
|
+
element.download = "recovery.txt";
|
|
2397
|
+
document.body.appendChild(element);
|
|
2398
|
+
element.click();
|
|
2399
|
+
setIsSecretSaved(true);
|
|
2400
|
+
};
|
|
2401
|
+
const onEmail = () => {
|
|
2402
|
+
typeof window !== "undefined" && window.open(getMailtoLink(email, value), "_self");
|
|
2403
|
+
setIsSecretSaved(true);
|
|
2404
|
+
};
|
|
2405
|
+
return /* @__PURE__ */ jsxs10(Fragment5, { children: [
|
|
2406
|
+
/* @__PURE__ */ jsxs10(InnerStepContainer, { children: [
|
|
2407
|
+
/* @__PURE__ */ jsx12(Heading, { variant: "headingXS", weight: "semiBold", children: "Save your Recovery Secret" }),
|
|
2408
|
+
/* @__PURE__ */ jsxs10(ButtonContainer, { children: [
|
|
2409
|
+
/* @__PURE__ */ jsx12(ActionButton, { icon: "download", onClick: onDownload, children: /* @__PURE__ */ jsx12(CpslText9, { variant: "bodyXS", color: "secondary", weight: "medium", children: "Download" }) }),
|
|
2410
|
+
/* @__PURE__ */ jsx12(ActionButton, { icon: isCopied ? "check" : "copy", onClick: onCopy, children: /* @__PURE__ */ jsx12(CpslText9, { variant: "bodyXS", color: "secondary", weight: "medium", children: isCopied ? "Copied!" : "Copy" }) }),
|
|
2411
|
+
/* @__PURE__ */ jsx12(ActionButton, { icon: "send", onClick: onEmail, children: /* @__PURE__ */ jsx12(CpslText9, { variant: "bodyXS", color: "secondary", weight: "medium", children: "Email" }) })
|
|
2412
|
+
] })
|
|
2413
|
+
] }),
|
|
2414
|
+
/* @__PURE__ */ jsx12(InnerStepContainer, { children: /* @__PURE__ */ jsx12(CpslButton6, { fullWidth: true, onClick: onComplete, disabled: !isSecretSaved, children: !isSecretSaved ? "Choose an option above to continue" : "I\u2019ve saved my recovery secret" }) })
|
|
2415
|
+
] });
|
|
2416
|
+
};
|
|
2417
|
+
var RecoverySecretStep = () => {
|
|
2418
|
+
const hideWallets = useThemeStore((state) => state.hideWallets);
|
|
2419
|
+
const setStep = useModalStore((state) => state.setStep);
|
|
2420
|
+
const authInfo = useUserInfoStore((state) => state.getAuthInfo());
|
|
2421
|
+
const recoveryShare = useUserInfoStore((state) => state.recoveryShare);
|
|
2422
|
+
const backupDecryptionKey = JSON.parse(recoveryShare || "{}").backupDecryptionKey;
|
|
2423
|
+
const onComplete = () => __async(void 0, null, function* () {
|
|
2424
|
+
setStep("WALLET_CREATION_DONE" /* WALLET_CREATION_DONE */);
|
|
2425
|
+
});
|
|
2426
|
+
return /* @__PURE__ */ jsxs10(StepContainer, { children: [
|
|
2427
|
+
/* @__PURE__ */ jsxs10(InnerStepContainer, { children: [
|
|
2428
|
+
/* @__PURE__ */ jsx12(Heading, { variant: "headingS", weight: "bold", children: hideWallets ? "Don't lose access" : "Don't lose your wallet" }),
|
|
2429
|
+
/* @__PURE__ */ jsxs10(InlineText3, { variant: "bodyS", color: "secondary", weight: "medium", children: [
|
|
2430
|
+
"Your",
|
|
2431
|
+
" ",
|
|
2432
|
+
/* @__PURE__ */ jsx12(InlineText3, { variant: "bodyS", weight: "medium", children: "Recovery Secret" }),
|
|
2433
|
+
" ",
|
|
2434
|
+
"ensures you will be able to regain access to your ",
|
|
2435
|
+
hideWallets ? "account" : "wallet",
|
|
2436
|
+
" if you lose your Passkey or Password."
|
|
2437
|
+
] })
|
|
2438
|
+
] }),
|
|
2439
|
+
/* @__PURE__ */ jsx12(
|
|
2440
|
+
SaveRecoverySecret,
|
|
2441
|
+
{
|
|
2442
|
+
email: (authInfo == null ? void 0 : authInfo.authType) === "email" ? authInfo.identifier : void 0,
|
|
2443
|
+
value: backupDecryptionKey,
|
|
2444
|
+
onComplete
|
|
2445
|
+
}
|
|
2446
|
+
)
|
|
2447
|
+
] });
|
|
2448
|
+
};
|
|
2449
|
+
var ActionButton = styled8(StyledCpslTileButton)`
|
|
2450
|
+
flex: 1;
|
|
2451
|
+
|
|
2452
|
+
--button-icon-color: var(--cpsl-color-text-primary);
|
|
2453
|
+
`;
|
|
2454
|
+
var ButtonContainer = styled8.div`
|
|
2455
|
+
display: flex;
|
|
2456
|
+
align-items: center;
|
|
2457
|
+
justify-content: center;
|
|
2458
|
+
gap: 8px;
|
|
2459
|
+
width: 100%;
|
|
2460
|
+
`;
|
|
2461
|
+
var InlineText3 = styled8(CpslText9)`
|
|
2462
|
+
text-align: center;
|
|
2463
|
+
display: inline-block;
|
|
2464
|
+
`;
|
|
2465
|
+
|
|
2466
|
+
// src/modal/components/TwoFactorDoneStep/TwoFactorDoneStep.tsx
|
|
2467
|
+
import { CpslButton as CpslButton7, CpslText as CpslText10 } from "@getpara/react-components";
|
|
2468
|
+
import { jsx as jsx13, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
2469
|
+
var TwoFactorDoneStep = ({ onClose }) => {
|
|
2470
|
+
const hideWallets = useThemeStore((state) => state.hideWallets);
|
|
2471
|
+
return /* @__PURE__ */ jsxs11(StepContainer, { children: [
|
|
2472
|
+
/* @__PURE__ */ jsx13(HeroIcon, { icon: "checkCircleFilled" }),
|
|
2473
|
+
/* @__PURE__ */ jsxs11(InnerStepContainer, { children: [
|
|
2474
|
+
/* @__PURE__ */ jsx13(Heading, { variant: "headingXS", weight: "semiBold", children: "Success" }),
|
|
2475
|
+
/* @__PURE__ */ jsxs11(CpslText10, { variant: "bodyS", color: "secondary", weight: "medium", children: [
|
|
2476
|
+
"Your ",
|
|
2477
|
+
hideWallets ? "account" : "wallet",
|
|
2478
|
+
" is now protected by 2FA"
|
|
2479
|
+
] })
|
|
2480
|
+
] }),
|
|
2481
|
+
/* @__PURE__ */ jsx13(CpslButton7, { fullWidth: true, onClick: onClose, children: "Done" })
|
|
2482
|
+
] });
|
|
2483
|
+
};
|
|
2484
|
+
|
|
2485
|
+
// src/modal/components/BiometricCreationStep/BiometricCreationStep.tsx
|
|
2486
|
+
import { CpslButton as CpslButton8, CpslDivider as CpslDivider3, CpslIcon as CpslIcon5, CpslQrCode as CpslQrCode2, CpslSpinner as CpslSpinner5, CpslText as CpslText11 } from "@getpara/react-components";
|
|
2487
|
+
import { useCopyToClipboard as useCopyToClipboard3, UserIdentifier as UserIdentifier2 } from "@getpara/react-common";
|
|
2488
|
+
|
|
2489
|
+
// src/modal/constants/defaults.ts
|
|
2490
|
+
var DEFAULTS = {
|
|
2491
|
+
LOGGIN_POLLING_DELAY_MS: 5e3,
|
|
2492
|
+
POLLING_INTERVAL_MS: 2e3,
|
|
2493
|
+
ANIMATION_DURATION: 0.15
|
|
2494
|
+
};
|
|
2290
2495
|
|
|
2291
2496
|
// src/modal/hooks/useGoBack.ts
|
|
2292
2497
|
var useGoBack = () => {
|
|
@@ -2295,7 +2500,8 @@ var useGoBack = () => {
|
|
|
2295
2500
|
const accountAddFundTab = useModalStore((state) => state.accountAddFundTab);
|
|
2296
2501
|
const decrementStep = useModalStore((state) => state.decrementStep);
|
|
2297
2502
|
const resetState = useModalStore((state) => state.resetState);
|
|
2298
|
-
const { setChainIdSwitchingTo } = useExternalWallets();
|
|
2503
|
+
const { setChainIdSwitchingTo, disconnectExternalWallet } = useExternalWallets();
|
|
2504
|
+
const client = useInternalClient();
|
|
2299
2505
|
const goBack = () => {
|
|
2300
2506
|
if (currentStep === "ADD_FUNDS_AWAITING" /* ADD_FUNDS_AWAITING */) {
|
|
2301
2507
|
setStep(getAddFundsStep(accountAddFundTab));
|
|
@@ -2304,8 +2510,13 @@ var useGoBack = () => {
|
|
|
2304
2510
|
}
|
|
2305
2511
|
switch (currentStep) {
|
|
2306
2512
|
case "AUTH_MAIN" /* AUTH_MAIN */:
|
|
2307
|
-
case "AUTH_MORE" /* AUTH_MORE */:
|
|
2513
|
+
case "AUTH_MORE" /* AUTH_MORE */:
|
|
2514
|
+
case "EX_WALLET_SELECTED" /* EX_WALLET_SELECTED */:
|
|
2515
|
+
case "EXTERNAL_WALLET_VERIFICATION" /* EXTERNAL_WALLET_VERIFICATION */: {
|
|
2308
2516
|
resetState();
|
|
2517
|
+
if (client.isExternalWalletAuth) {
|
|
2518
|
+
disconnectExternalWallet();
|
|
2519
|
+
}
|
|
2309
2520
|
break;
|
|
2310
2521
|
}
|
|
2311
2522
|
case "CHAIN_SWITCH" /* CHAIN_SWITCH */: {
|
|
@@ -2379,9 +2590,11 @@ function useCreateAccount() {
|
|
|
2379
2590
|
}
|
|
2380
2591
|
|
|
2381
2592
|
// src/modal/components/BiometricCreationStep/BiometricCreationStep.tsx
|
|
2382
|
-
import { Fragment as Fragment6, jsx as
|
|
2593
|
+
import { Fragment as Fragment6, jsx as jsx14, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
2383
2594
|
var BiometricCreationStep = () => {
|
|
2384
2595
|
const createAccount = useCreateAccount();
|
|
2596
|
+
const para = useInternalClient();
|
|
2597
|
+
const appName = useThemeStore((state) => state.appName);
|
|
2385
2598
|
const webAuthURLForCreate = useModalStore((state) => state.webAuthURLForCreate);
|
|
2386
2599
|
const iFrameUrl = useModalStore((state) => state.iFrameUrl);
|
|
2387
2600
|
const isPasskeySupported2 = useModalStore((state) => state.isPasskeySupported);
|
|
@@ -2391,28 +2604,28 @@ var BiometricCreationStep = () => {
|
|
|
2391
2604
|
copy(webAuthURLForCreate);
|
|
2392
2605
|
};
|
|
2393
2606
|
const isBoth = !!webAuthURLForCreate && !!iFrameUrl;
|
|
2394
|
-
return /* @__PURE__ */
|
|
2395
|
-
/* @__PURE__ */
|
|
2396
|
-
/* @__PURE__ */
|
|
2397
|
-
/* @__PURE__ */
|
|
2398
|
-
/* @__PURE__ */
|
|
2607
|
+
return /* @__PURE__ */ jsxs12(StepContainer, { $wide: true, children: [
|
|
2608
|
+
/* @__PURE__ */ jsxs12(InnerStepContainer, { children: [
|
|
2609
|
+
/* @__PURE__ */ jsx14(Heading, { variant: "headingS", weight: "bold", children: para.isExternalWalletAuth ? `Finish setup for your${appName ? ` ${appName}` : ""} wallet` : isBoth ? "Secure Your Account" : "Create Passkey" }),
|
|
2610
|
+
/* @__PURE__ */ jsx14(UserIdentifier2, __spreadValues({}, authInfo)),
|
|
2611
|
+
/* @__PURE__ */ jsx14(CpslText11, { variant: "bodyS", color: "secondary", weight: "medium", children: isBoth ? "Choose a password or set up a passkey" : "Your Passkey keeps your account safe." })
|
|
2399
2612
|
] }),
|
|
2400
|
-
/* @__PURE__ */
|
|
2401
|
-
isPasskeySupported2 ? /* @__PURE__ */
|
|
2402
|
-
/* @__PURE__ */
|
|
2613
|
+
/* @__PURE__ */ jsxs12(InnerStepContainer, { children: [
|
|
2614
|
+
isPasskeySupported2 ? /* @__PURE__ */ jsxs12(CpslButton8, { fullWidth: true, onClick: createAccount.withPasskey, children: [
|
|
2615
|
+
/* @__PURE__ */ jsx14(CpslIcon5, { slot: "start", icon: "key" }),
|
|
2403
2616
|
isBoth ? "Create Passkey" : "Create"
|
|
2404
|
-
] }) : /* @__PURE__ */
|
|
2405
|
-
/* @__PURE__ */
|
|
2406
|
-
/* @__PURE__ */
|
|
2407
|
-
/* @__PURE__ */
|
|
2408
|
-
/* @__PURE__ */
|
|
2617
|
+
] }) : /* @__PURE__ */ jsxs12(Fragment6, { children: [
|
|
2618
|
+
/* @__PURE__ */ jsx14(CpslText11, { weight: "semiBold", children: "Scan with your mobile device" }),
|
|
2619
|
+
/* @__PURE__ */ jsx14(QRContainer, { children: !webAuthURLForCreate ? /* @__PURE__ */ jsx14(CpslSpinner5, { size: 100 }) : /* @__PURE__ */ jsx14(CpslQrCode2, { url: webAuthURLForCreate }) }),
|
|
2620
|
+
/* @__PURE__ */ jsxs12(CpslButton8, { size: "small", variant: "ghost", onClick: handleCopy, children: [
|
|
2621
|
+
/* @__PURE__ */ jsx14(CpslIcon5, { slot: "start", icon: isCopied ? "check" : "copy" }),
|
|
2409
2622
|
isCopied ? "Copied" : "Copy Link"
|
|
2410
2623
|
] })
|
|
2411
2624
|
] }),
|
|
2412
|
-
isBoth && /* @__PURE__ */
|
|
2413
|
-
/* @__PURE__ */
|
|
2414
|
-
/* @__PURE__ */
|
|
2415
|
-
/* @__PURE__ */
|
|
2625
|
+
isBoth && /* @__PURE__ */ jsxs12(Fragment6, { children: [
|
|
2626
|
+
/* @__PURE__ */ jsx14(CpslDivider3, { children: "or" }),
|
|
2627
|
+
/* @__PURE__ */ jsxs12(CpslButton8, { fullWidth: true, onClick: createAccount.withPassword, children: [
|
|
2628
|
+
/* @__PURE__ */ jsx14(CpslIcon5, { slot: "start", icon: "passcode" }),
|
|
2416
2629
|
"Choose Password"
|
|
2417
2630
|
] })
|
|
2418
2631
|
] })
|
|
@@ -2421,9 +2634,9 @@ var BiometricCreationStep = () => {
|
|
|
2421
2634
|
};
|
|
2422
2635
|
|
|
2423
2636
|
// src/modal/components/AwaitingOAuthStep/AwaitingOAuthStep.tsx
|
|
2424
|
-
import { jsx as
|
|
2637
|
+
import { jsx as jsx15 } from "react/jsx-runtime";
|
|
2425
2638
|
var AwaitingOAuthStep = () => {
|
|
2426
|
-
return /* @__PURE__ */
|
|
2639
|
+
return /* @__PURE__ */ jsx15(Waiting, { heading: "Complete Login", subheading: "Follow the prompts presented by your browser." });
|
|
2427
2640
|
};
|
|
2428
2641
|
|
|
2429
2642
|
// src/modal/components/AddFunds/AddFunds.tsx
|
|
@@ -2434,18 +2647,18 @@ import {
|
|
|
2434
2647
|
OnRampProvider as OnRampProvider2,
|
|
2435
2648
|
OnRampPurchaseType,
|
|
2436
2649
|
toAssetInfoArray,
|
|
2437
|
-
WalletType as
|
|
2650
|
+
WalletType as WalletType4
|
|
2438
2651
|
} from "@getpara/web-sdk";
|
|
2439
2652
|
import {
|
|
2440
|
-
CpslButton as
|
|
2653
|
+
CpslButton as CpslButton10,
|
|
2441
2654
|
CpslDivider as CpslDivider4,
|
|
2442
2655
|
CpslIcon as CpslIcon7,
|
|
2443
2656
|
CpslIdenticon as CpslIdenticon2,
|
|
2444
2657
|
CpslQrCode as CpslQrCode3,
|
|
2445
|
-
CpslSpinner as
|
|
2658
|
+
CpslSpinner as CpslSpinner7,
|
|
2446
2659
|
CpslTab,
|
|
2447
2660
|
CpslTabs,
|
|
2448
|
-
CpslText as
|
|
2661
|
+
CpslText as CpslText13
|
|
2449
2662
|
} from "@getpara/react-components";
|
|
2450
2663
|
import { useEffect as useEffect10, useMemo as useMemo4 } from "react";
|
|
2451
2664
|
|
|
@@ -2548,10 +2761,10 @@ var BODY_TRANSITION = {
|
|
|
2548
2761
|
};
|
|
2549
2762
|
|
|
2550
2763
|
// src/modal/components/OnRampComponents/OnRampProviderButton.tsx
|
|
2551
|
-
import
|
|
2552
|
-
import { CpslButton as
|
|
2764
|
+
import styled9 from "styled-components";
|
|
2765
|
+
import { CpslButton as CpslButton9, CpslIcon as CpslIcon6, CpslSpinner as CpslSpinner6, CpslText as CpslText12 } from "@getpara/react-components";
|
|
2553
2766
|
import { motion } from "framer-motion";
|
|
2554
|
-
import { jsx as
|
|
2767
|
+
import { jsx as jsx16, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
2555
2768
|
var OnRampProviderButton = ({ config, index, onClick: _onClick }) => {
|
|
2556
2769
|
const [isLoading, setIsLoading] = useState7(false);
|
|
2557
2770
|
const provider = config.providers[index];
|
|
@@ -2562,22 +2775,22 @@ var OnRampProviderButton = ({ config, index, onClick: _onClick }) => {
|
|
|
2562
2775
|
yield _onClick();
|
|
2563
2776
|
setIsLoading(false);
|
|
2564
2777
|
});
|
|
2565
|
-
return /* @__PURE__ */
|
|
2566
|
-
/* @__PURE__ */
|
|
2567
|
-
/* @__PURE__ */
|
|
2568
|
-
/* @__PURE__ */
|
|
2569
|
-
/* @__PURE__ */
|
|
2778
|
+
return /* @__PURE__ */ jsx16(StyledButton, { $gradientColors: backgroundColors, fullWidth: true, onClick, children: /* @__PURE__ */ jsxs13(Container2, { $backgroundColor: backgroundColors[1], children: [
|
|
2779
|
+
/* @__PURE__ */ jsx16(IconContainer, { children: /* @__PURE__ */ jsx16(CpslIcon6, { icon }) }),
|
|
2780
|
+
/* @__PURE__ */ jsxs13(ProviderInfoContainer, { children: [
|
|
2781
|
+
/* @__PURE__ */ jsx16(Text, { variant: "bodyL", weight: "medium", children: name }),
|
|
2782
|
+
/* @__PURE__ */ jsx16(ProviderInfoInnerContainer, { children: /* @__PURE__ */ jsx16(Text, { variant: "bodyXS", weight: "medium", children: feeString }) })
|
|
2570
2783
|
] }),
|
|
2571
|
-
isLoading ? /* @__PURE__ */
|
|
2784
|
+
isLoading ? /* @__PURE__ */ jsx16(CpslSpinner6, { size: 16 }) : /* @__PURE__ */ jsx16(Chevron, { icon: "chevronUp" })
|
|
2572
2785
|
] }) });
|
|
2573
2786
|
};
|
|
2574
|
-
var StyledButton =
|
|
2787
|
+
var StyledButton = styled9(CpslButton9)`
|
|
2575
2788
|
width: 100%;
|
|
2576
2789
|
--button-primary-background-color: ${({ $gradientColors }) => `linear-gradient(90deg, ${$gradientColors[0]} 0%, ${$gradientColors[1]} 100%)`};
|
|
2577
2790
|
--button-primary-hover-background-color: ${({ $gradientColors }) => `linear-gradient(90deg, ${$gradientColors[0]} 0%, ${$gradientColors[0]} 100%)`};
|
|
2578
2791
|
--button-primary-active-background-color: ${({ $gradientColors }) => `linear-gradient(90deg, ${$gradientColors[0]} 0%, ${$gradientColors[0]} 100%)`};
|
|
2579
2792
|
`;
|
|
2580
|
-
var Container2 =
|
|
2793
|
+
var Container2 = styled9(motion.div)`
|
|
2581
2794
|
display: flex;
|
|
2582
2795
|
gap: 8px;
|
|
2583
2796
|
flex: 1;
|
|
@@ -2587,18 +2800,18 @@ var Container2 = styled8(motion.div)`
|
|
|
2587
2800
|
--background-color: ${({ $backgroundColor }) => `${$backgroundColor}`};
|
|
2588
2801
|
}
|
|
2589
2802
|
`;
|
|
2590
|
-
var ProviderInfoContainer =
|
|
2803
|
+
var ProviderInfoContainer = styled9.div`
|
|
2591
2804
|
flex: 1;
|
|
2592
2805
|
display: flex;
|
|
2593
2806
|
flex-direction: column;
|
|
2594
2807
|
align-items: start;
|
|
2595
2808
|
gap: 2px;
|
|
2596
2809
|
`;
|
|
2597
|
-
var ProviderInfoInnerContainer =
|
|
2810
|
+
var ProviderInfoInnerContainer = styled9.div`
|
|
2598
2811
|
display: flex;
|
|
2599
2812
|
gap: 16px;
|
|
2600
2813
|
`;
|
|
2601
|
-
var IconContainer =
|
|
2814
|
+
var IconContainer = styled9.span`
|
|
2602
2815
|
display: flex;
|
|
2603
2816
|
align-items: center;
|
|
2604
2817
|
justify-content: center;
|
|
@@ -2607,12 +2820,12 @@ var IconContainer = styled8.span`
|
|
|
2607
2820
|
height: 48px;
|
|
2608
2821
|
width: 48px;
|
|
2609
2822
|
`;
|
|
2610
|
-
var Text =
|
|
2823
|
+
var Text = styled9(CpslText12)`
|
|
2611
2824
|
&::part(text-element) {
|
|
2612
2825
|
color: #fff;
|
|
2613
2826
|
}
|
|
2614
2827
|
`;
|
|
2615
|
-
var Chevron =
|
|
2828
|
+
var Chevron = styled9(CpslIcon6)`
|
|
2616
2829
|
transform: rotate(90deg);
|
|
2617
2830
|
--icon-color: #fff;
|
|
2618
2831
|
`;
|
|
@@ -2641,17 +2854,17 @@ var formatNetworkList = (networks) => {
|
|
|
2641
2854
|
};
|
|
2642
2855
|
|
|
2643
2856
|
// src/modal/components/AddFunds/AddFunds.tsx
|
|
2644
|
-
import
|
|
2645
|
-
import { Fragment as Fragment7, jsx as
|
|
2857
|
+
import styled10 from "styled-components";
|
|
2858
|
+
import { Fragment as Fragment7, jsx as jsx17, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
2646
2859
|
var TABS = [
|
|
2647
2860
|
[EnabledFlow.BUY, "isBuyEnabled", "creditCard", "Buy"],
|
|
2648
2861
|
[EnabledFlow.RECEIVE, "isReceiveEnabled", "qrCode", "Receive"],
|
|
2649
2862
|
[EnabledFlow.WITHDRAW, "isWithdrawEnabled", "arrowCircleBrokenDownLeft", "Withdraw"]
|
|
2650
2863
|
];
|
|
2651
2864
|
var GENERIC_WALLET = {
|
|
2652
|
-
[
|
|
2653
|
-
[
|
|
2654
|
-
[
|
|
2865
|
+
[WalletType4.EVM]: "Ethereum or EVM-based L2s",
|
|
2866
|
+
[WalletType4.SOLANA]: "Solana",
|
|
2867
|
+
[WalletType4.COSMOS]: "Cosmos"
|
|
2655
2868
|
};
|
|
2656
2869
|
var AddFunds = () => {
|
|
2657
2870
|
const [isCopied, copy] = useCopyToClipboard4();
|
|
@@ -2717,25 +2930,25 @@ var AddFunds = () => {
|
|
|
2717
2930
|
setOnRampPurchase(void 0);
|
|
2718
2931
|
}, []);
|
|
2719
2932
|
if (!onRampConfig || !activeWallet) {
|
|
2720
|
-
return /* @__PURE__ */
|
|
2933
|
+
return /* @__PURE__ */ jsx17(SpinnerContainer2, { children: /* @__PURE__ */ jsx17(CpslSpinner7, {}) });
|
|
2721
2934
|
}
|
|
2722
2935
|
useEffect10(() => {
|
|
2723
2936
|
setOnRampPurchase(void 0);
|
|
2724
2937
|
}, []);
|
|
2725
|
-
return /* @__PURE__ */
|
|
2726
|
-
isMultiFlow && /* @__PURE__ */
|
|
2727
|
-
/* @__PURE__ */
|
|
2938
|
+
return /* @__PURE__ */ jsxs14(StepContainer, { children: [
|
|
2939
|
+
isMultiFlow && /* @__PURE__ */ jsx17(InnerStepContainer, { children: /* @__PURE__ */ jsx17(CpslTabs, { selectedTab: tab, onCpslTabsChanged: onSetTab, children: TABS.map(([tab2, _, icon, title]) => /* @__PURE__ */ jsxs14(CpslTab, { tab: tab2, children: [
|
|
2940
|
+
/* @__PURE__ */ jsx17(CpslIcon7, { slot: "start", icon }),
|
|
2728
2941
|
title
|
|
2729
2942
|
] }, tab2)) }) }),
|
|
2730
|
-
/* @__PURE__ */
|
|
2731
|
-
/* @__PURE__ */
|
|
2732
|
-
/* @__PURE__ */
|
|
2733
|
-
/* @__PURE__ */
|
|
2943
|
+
/* @__PURE__ */ jsx17(Fragment7, { children: [EnabledFlow.BUY, EnabledFlow.WITHDRAW].includes(tab) ? /* @__PURE__ */ jsxs14(Fragment7, { children: [
|
|
2944
|
+
/* @__PURE__ */ jsx17(Heading, { variant: "headingS", weight: "bold", children: "Choose Provider" }),
|
|
2945
|
+
/* @__PURE__ */ jsxs14($InnerStepContainer, { children: [
|
|
2946
|
+
/* @__PURE__ */ jsxs14(NoProviders, { isHidden: Object.values(isProviderAllowed).some((v) => !!v), variant: "bodyM", children: [
|
|
2734
2947
|
"No providers are available for this ",
|
|
2735
2948
|
hideWallets ? "account" : "wallet"
|
|
2736
2949
|
] }),
|
|
2737
|
-
/* @__PURE__ */
|
|
2738
|
-
return isProviderAllowed[id] ? /* @__PURE__ */
|
|
2950
|
+
/* @__PURE__ */ jsx17(AnimatePresence, { children: onRampConfig.providers.map((id, index) => {
|
|
2951
|
+
return isProviderAllowed[id] ? /* @__PURE__ */ jsx17(
|
|
2739
2952
|
motion2.div,
|
|
2740
2953
|
{
|
|
2741
2954
|
style: { width: "100%" },
|
|
@@ -2744,7 +2957,7 @@ var AddFunds = () => {
|
|
|
2744
2957
|
animate: { opacity: 1, transform: "none" },
|
|
2745
2958
|
exit: { opacity: 0, transform: "translateX(-25px)" },
|
|
2746
2959
|
transition: { duration: 0.2 },
|
|
2747
|
-
children: /* @__PURE__ */
|
|
2960
|
+
children: /* @__PURE__ */ jsx17(
|
|
2748
2961
|
OnRampProviderButton,
|
|
2749
2962
|
{
|
|
2750
2963
|
config: onRampConfig,
|
|
@@ -2780,37 +2993,37 @@ var AddFunds = () => {
|
|
|
2780
2993
|
) : null;
|
|
2781
2994
|
}) })
|
|
2782
2995
|
] })
|
|
2783
|
-
] }) : /* @__PURE__ */
|
|
2784
|
-
/* @__PURE__ */
|
|
2785
|
-
/* @__PURE__ */
|
|
2786
|
-
/* @__PURE__ */
|
|
2996
|
+
] }) : /* @__PURE__ */ jsxs14(Fragment7, { children: [
|
|
2997
|
+
/* @__PURE__ */ jsx17(InnerStepContainer, { children: /* @__PURE__ */ jsxs14(FilledDisabledInput, { noAutoDisable: true, readonly: true, placeholder: address, children: [
|
|
2998
|
+
/* @__PURE__ */ jsx17(CpslIdenticon2, { slot: "start", size: "32px", hash: para.getIdenticonHash(activeWallet.id, activeWallet.type) }),
|
|
2999
|
+
/* @__PURE__ */ jsx17(CpslButton10, { slot: "end", variant: "ghost", onClick: onCopy, children: /* @__PURE__ */ jsx17(CpslIcon7, { icon: isCopied ? "check" : "copy" }) })
|
|
2787
3000
|
] }, address) }),
|
|
2788
|
-
!isMobile2() && /* @__PURE__ */
|
|
2789
|
-
/* @__PURE__ */
|
|
2790
|
-
/* @__PURE__ */
|
|
2791
|
-
/* @__PURE__ */
|
|
2792
|
-
/* @__PURE__ */
|
|
3001
|
+
!isMobile2() && /* @__PURE__ */ jsxs14(Fragment7, { children: [
|
|
3002
|
+
/* @__PURE__ */ jsx17(CpslDivider4, { children: "or" }),
|
|
3003
|
+
/* @__PURE__ */ jsxs14(InnerStepContainer, { children: [
|
|
3004
|
+
/* @__PURE__ */ jsx17(QRContainer, { children: !address ? /* @__PURE__ */ jsx17(CpslSpinner7, { size: 100 }) : /* @__PURE__ */ jsx17(CpslQrCode3, { url: address }, address) }),
|
|
3005
|
+
/* @__PURE__ */ jsx17(CpslText13, { weight: "semiBold", color: "secondary", children: "Scan with your crypto wallet" })
|
|
2793
3006
|
] })
|
|
2794
3007
|
] }),
|
|
2795
|
-
/* @__PURE__ */
|
|
2796
|
-
/* @__PURE__ */
|
|
3008
|
+
/* @__PURE__ */ jsxs14(InnerStepContainer, { children: [
|
|
3009
|
+
/* @__PURE__ */ jsxs14(CenteredText, { weight: "semiBold", children: [
|
|
2797
3010
|
!!onRampConfig.allowedAssets && allowedNetworks.length > 0 || hideWallets ? appName != null ? appName : "This App" : "This Wallet",
|
|
2798
3011
|
" ",
|
|
2799
3012
|
"Only Supports:"
|
|
2800
3013
|
] }),
|
|
2801
|
-
/* @__PURE__ */
|
|
3014
|
+
/* @__PURE__ */ jsx17(CenteredText, { weight: "medium", color: "secondary", children: !!onRampConfig.allowedAssets && allowedNetworks.length > 0 ? formatNetworkList(allowedNetworks) : GENERIC_WALLET[activeWallet.type] })
|
|
2802
3015
|
] })
|
|
2803
3016
|
] }) })
|
|
2804
3017
|
] });
|
|
2805
3018
|
};
|
|
2806
|
-
var SpinnerContainer2 =
|
|
3019
|
+
var SpinnerContainer2 = styled10(StepContainer)`
|
|
2807
3020
|
margin: 50% 0;
|
|
2808
3021
|
`;
|
|
2809
|
-
var $InnerStepContainer =
|
|
3022
|
+
var $InnerStepContainer = styled10(InnerStepContainer)`
|
|
2810
3023
|
position: relative;
|
|
2811
3024
|
min-height: 270px;
|
|
2812
3025
|
`;
|
|
2813
|
-
var NoProviders =
|
|
3026
|
+
var NoProviders = styled10(CpslText13)`
|
|
2814
3027
|
width: 100%;
|
|
2815
3028
|
text-align: center;
|
|
2816
3029
|
visibility: ${({ isHidden }) => isHidden ? "hidden" : "visible"};
|
|
@@ -2825,8 +3038,8 @@ var NoProviders = styled9(CpslText12)`
|
|
|
2825
3038
|
import { OnRampProvider as OnRampProvider3 } from "@getpara/web-sdk";
|
|
2826
3039
|
import { lazy, useEffect as useEffect11, useMemo as useMemo5, useState as useState8 } from "react";
|
|
2827
3040
|
import { RampEmbed, StripeEmbed } from "@getpara/react-common";
|
|
2828
|
-
import
|
|
2829
|
-
import { jsx as
|
|
3041
|
+
import styled11 from "styled-components";
|
|
3042
|
+
import { jsx as jsx18 } from "react/jsx-runtime";
|
|
2830
3043
|
var STEPS = {
|
|
2831
3044
|
CANCELLED: "ADD_FUNDS_FAILURE" /* ADD_FUNDS_FAILURE */,
|
|
2832
3045
|
FINISHED: "ADD_FUNDS_SUCCESS" /* ADD_FUNDS_SUCCESS */
|
|
@@ -2861,11 +3074,11 @@ var AddFundsAwaiting = () => {
|
|
|
2861
3074
|
}
|
|
2862
3075
|
switch (onRampPurchase == null ? void 0 : onRampPurchase.provider) {
|
|
2863
3076
|
case OnRampProvider3.STRIPE:
|
|
2864
|
-
return /* @__PURE__ */
|
|
3077
|
+
return /* @__PURE__ */ jsx18(StripeEmbed, __spreadValues({}, props));
|
|
2865
3078
|
case OnRampProvider3.MOONPAY:
|
|
2866
|
-
return !MoonPayEmbed || typeof window === "undefined" ? null : /* @__PURE__ */
|
|
3079
|
+
return !MoonPayEmbed || typeof window === "undefined" ? null : /* @__PURE__ */ jsx18(MoonPayEmbed, __spreadValues({}, props));
|
|
2867
3080
|
case OnRampProvider3.RAMP:
|
|
2868
|
-
return /* @__PURE__ */
|
|
3081
|
+
return /* @__PURE__ */ jsx18(RampEmbed, __spreadValues({ apiKey: onRampConfig.rampApiKey }, props));
|
|
2869
3082
|
}
|
|
2870
3083
|
}, [onRampPurchase == null ? void 0 : onRampPurchase.provider, MoonPayEmbed]);
|
|
2871
3084
|
useEffect11(() => {
|
|
@@ -2877,16 +3090,16 @@ var AddFundsAwaiting = () => {
|
|
|
2877
3090
|
}
|
|
2878
3091
|
return () => clearTimeout(timeoutId);
|
|
2879
3092
|
}, [onRampPurchase == null ? void 0 : onRampPurchase.status]);
|
|
2880
|
-
return /* @__PURE__ */
|
|
3093
|
+
return /* @__PURE__ */ jsx18(Container3, { $wide: true, children: onRampEmbed });
|
|
2881
3094
|
};
|
|
2882
|
-
var Container3 =
|
|
3095
|
+
var Container3 = styled11(StepContainer)`
|
|
2883
3096
|
flex: 1;
|
|
2884
3097
|
`;
|
|
2885
3098
|
|
|
2886
3099
|
// src/modal/components/AddFunds/AddFundsDone.tsx
|
|
2887
3100
|
import { useMemo as useMemo6 } from "react";
|
|
2888
|
-
import { CpslButton as
|
|
2889
|
-
import { jsx as
|
|
3101
|
+
import { CpslButton as CpslButton11, CpslText as CpslText14 } from "@getpara/react-components";
|
|
3102
|
+
import { jsx as jsx19, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
2890
3103
|
var AddFundsDone = ({ isSuccess, onClose }) => {
|
|
2891
3104
|
const hideWallets = useThemeStore((state) => state.hideWallets);
|
|
2892
3105
|
const setStep = useModalStore((state) => state.setStep);
|
|
@@ -2901,14 +3114,14 @@ var AddFundsDone = ({ isSuccess, onClose }) => {
|
|
|
2901
3114
|
const heading = isSuccess ? "Transaction Successful" : "Something Went Wrong";
|
|
2902
3115
|
const text = isSuccess ? `${formatter.format(parseFloat(onRampPurchase == null ? void 0 : onRampPurchase.fiatQuantity))} is now available in your ${hideWallets ? "account" : "wallet"}.` : `No funds were added to your ${hideWallets ? "account" : "wallet"}.`;
|
|
2903
3116
|
const buttonText = isSuccess ? "Done" : "Try Again";
|
|
2904
|
-
return /* @__PURE__ */
|
|
2905
|
-
/* @__PURE__ */
|
|
2906
|
-
/* @__PURE__ */
|
|
2907
|
-
/* @__PURE__ */
|
|
2908
|
-
/* @__PURE__ */
|
|
3117
|
+
return /* @__PURE__ */ jsxs15(StepContainer, { children: [
|
|
3118
|
+
/* @__PURE__ */ jsx19(HeroIcon, { icon: "checkCircleFilled" }),
|
|
3119
|
+
/* @__PURE__ */ jsxs15(InnerStepContainer, { children: [
|
|
3120
|
+
/* @__PURE__ */ jsx19(Heading, { variant: "headingS", weight: "bold", children: heading }),
|
|
3121
|
+
/* @__PURE__ */ jsx19(CpslText14, { variant: "bodyS", color: "secondary", children: text })
|
|
2909
3122
|
] }),
|
|
2910
|
-
/* @__PURE__ */
|
|
2911
|
-
|
|
3123
|
+
/* @__PURE__ */ jsx19(
|
|
3124
|
+
CpslButton11,
|
|
2912
3125
|
{
|
|
2913
3126
|
fullWidth: true,
|
|
2914
3127
|
onClick: () => {
|
|
@@ -2922,9 +3135,9 @@ var AddFundsDone = ({ isSuccess, onClose }) => {
|
|
|
2922
3135
|
|
|
2923
3136
|
// src/modal/components/OAuth/FarcasterOAuthStep.tsx
|
|
2924
3137
|
import { useEffect as useEffect12 } from "react";
|
|
2925
|
-
import { CpslButton as
|
|
2926
|
-
import { AuthMethod as
|
|
2927
|
-
import { Fragment as Fragment8, jsx as
|
|
3138
|
+
import { CpslButton as CpslButton12, CpslIcon as CpslIcon8, CpslQrCode as CpslQrCode4, CpslSpinner as CpslSpinner8, CpslText as CpslText15 } from "@getpara/react-components";
|
|
3139
|
+
import { AuthMethod as AuthMethod6, isMobile as isMobile3 } from "@getpara/web-sdk";
|
|
3140
|
+
import { Fragment as Fragment8, jsx as jsx20, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
2928
3141
|
var FarcasterOAuthStep = () => {
|
|
2929
3142
|
const setAuthInfo = useUserInfoStore((state) => state.setAuthInfo);
|
|
2930
3143
|
const setStep = useModalStore((state) => state.setStep);
|
|
@@ -2932,13 +3145,13 @@ var FarcasterOAuthStep = () => {
|
|
|
2932
3145
|
const setIFrameUrl = useModalStore((state) => state.setIFrameUrl);
|
|
2933
3146
|
const setIsIFrameReady = useModalStore((state) => state.setIsIFrameReady);
|
|
2934
3147
|
const setAuthStepRoute = useModalStore((state) => state.setAuthStepRoute);
|
|
2935
|
-
const setSupportedAuthMethods = useModalStore((state) => state.setSupportedAuthMethods);
|
|
2936
3148
|
const setBiometricLocationHints = useModalStore((state) => state.setBiometricLocationHints);
|
|
2937
3149
|
const para = useInternalClient();
|
|
2938
3150
|
const setFlow = useModalStore((state) => state.setFlow);
|
|
2939
3151
|
const farcasterConnectUri = useModalStore((state) => state.farcasterConnectUri);
|
|
2940
3152
|
const setFarcasterConnectUri = useModalStore((state) => state.setFarcasterConnectUri);
|
|
2941
3153
|
const theme = useThemeStore((state) => state.theme);
|
|
3154
|
+
const setLoginURLs = useSetLoginURLs();
|
|
2942
3155
|
useEffect12(() => {
|
|
2943
3156
|
if (farcasterConnectUri) {
|
|
2944
3157
|
const pollStatus = () => __async(void 0, null, function* () {
|
|
@@ -2947,8 +3160,8 @@ var FarcasterOAuthStep = () => {
|
|
|
2947
3160
|
if (userExists) {
|
|
2948
3161
|
const supportedAuthMethods = yield para.initiateUserLoginV2({ farcasterUsername: username });
|
|
2949
3162
|
if (supportedAuthMethods.size > 0) {
|
|
2950
|
-
|
|
2951
|
-
|
|
3163
|
+
const biometricLocationHints = supportedAuthMethods.has(AuthMethod6.PASSKEY) ? yield para.getUserBiometricLocationHints() : [];
|
|
3164
|
+
yield setLoginURLs({ supportedAuthMethods, authType: "farcaster", displayName: username, pfpUrl });
|
|
2952
3165
|
setFlow("login");
|
|
2953
3166
|
setStep("BIOMETRIC_LOGIN" /* BIOMETRIC_LOGIN */);
|
|
2954
3167
|
setBiometricLocationHints(biometricLocationHints);
|
|
@@ -2958,12 +3171,12 @@ var FarcasterOAuthStep = () => {
|
|
|
2958
3171
|
const supportedCreateAuthMethods = yield para.getSupportedCreateAuthMethods();
|
|
2959
3172
|
setIsIFrameReady(false);
|
|
2960
3173
|
setFlow("signUp");
|
|
2961
|
-
const supportsPasskey = supportedCreateAuthMethods.has(
|
|
3174
|
+
const supportsPasskey = supportedCreateAuthMethods.has(AuthMethod6.PASSKEY);
|
|
2962
3175
|
if (supportsPasskey) {
|
|
2963
3176
|
setWebAuthURLForCreate(yield para.shortenLoginLink(yield para.getSetUpBiometricsURL({ authType: "farcaster" })));
|
|
2964
3177
|
setStep("BIOMETRIC_CREATION" /* BIOMETRIC_CREATION */);
|
|
2965
3178
|
}
|
|
2966
|
-
if (supportedCreateAuthMethods.has(
|
|
3179
|
+
if (supportedCreateAuthMethods.has(AuthMethod6.PASSWORD)) {
|
|
2967
3180
|
setIFrameUrl(yield para.shortenLoginLink(yield para.getSetupPasswordURL({ authType: "farcaster", theme })));
|
|
2968
3181
|
setAuthStepRoute(supportsPasskey ? "BIOMETRIC_CREATION" /* BIOMETRIC_CREATION */ : "PASSWORD_CREATION" /* PASSWORD_CREATION */);
|
|
2969
3182
|
}
|
|
@@ -2975,24 +3188,24 @@ var FarcasterOAuthStep = () => {
|
|
|
2975
3188
|
};
|
|
2976
3189
|
}
|
|
2977
3190
|
}, [farcasterConnectUri]);
|
|
2978
|
-
return /* @__PURE__ */
|
|
2979
|
-
/* @__PURE__ */
|
|
2980
|
-
/* @__PURE__ */
|
|
2981
|
-
/* @__PURE__ */
|
|
3191
|
+
return /* @__PURE__ */ jsx20(StepContainer, { $wide: true, children: isMobile3() ? /* @__PURE__ */ jsxs16(InnerStepContainer, { children: [
|
|
3192
|
+
/* @__PURE__ */ jsx20(CpslText15, { weight: "medium", color: "secondary", children: `Don\u2019t have Farcaster` }),
|
|
3193
|
+
/* @__PURE__ */ jsxs16(CpslButton12, { as: "a", href: "https://link.warpcast.com/download-qr", target: "_blank", variant: "secondary", children: [
|
|
3194
|
+
/* @__PURE__ */ jsx20(CpslIcon8, { slot: "start", icon: "linkExternal" }),
|
|
2982
3195
|
`Get Farcaster`
|
|
2983
3196
|
] })
|
|
2984
|
-
] }) : /* @__PURE__ */
|
|
2985
|
-
/* @__PURE__ */
|
|
2986
|
-
/* @__PURE__ */
|
|
2987
|
-
/* @__PURE__ */
|
|
2988
|
-
/* @__PURE__ */
|
|
3197
|
+
] }) : /* @__PURE__ */ jsxs16(Fragment8, { children: [
|
|
3198
|
+
/* @__PURE__ */ jsx20(Heading, { variant: "headingS", weight: "bold", children: "Sign in using Farcaster" }),
|
|
3199
|
+
/* @__PURE__ */ jsxs16(InnerStepContainer, { children: [
|
|
3200
|
+
/* @__PURE__ */ jsx20(CenteredText, { variant: "bodyS", color: "secondary", weight: "medium", children: "Scan the QR code with your phone's camera to proceed." }),
|
|
3201
|
+
/* @__PURE__ */ jsx20(QRContainer, { children: !farcasterConnectUri ? /* @__PURE__ */ jsx20(CpslSpinner8, { size: 100 }) : /* @__PURE__ */ jsx20(CpslQrCode4, { url: farcasterConnectUri }) })
|
|
2989
3202
|
] })
|
|
2990
3203
|
] }) });
|
|
2991
3204
|
};
|
|
2992
3205
|
var FarcasterOAuthStep_default = FarcasterOAuthStep;
|
|
2993
3206
|
|
|
2994
3207
|
// src/modal/components/Header/Header.tsx
|
|
2995
|
-
import { styled as
|
|
3208
|
+
import { styled as styled12 } from "styled-components";
|
|
2996
3209
|
|
|
2997
3210
|
// src/modal/components/Header/hooks/useStepTitle.ts
|
|
2998
3211
|
import { useMemo as useMemo7 } from "react";
|
|
@@ -3039,12 +3252,12 @@ var useStepTitle = () => {
|
|
|
3039
3252
|
|
|
3040
3253
|
// src/modal/components/Header/Header.tsx
|
|
3041
3254
|
import { AnimatePresence as AnimatePresence2, motion as motion3 } from "framer-motion";
|
|
3042
|
-
import { jsx as
|
|
3255
|
+
import { jsx as jsx21 } from "react/jsx-runtime";
|
|
3043
3256
|
var Header = () => {
|
|
3044
3257
|
const { title } = useStepTitle();
|
|
3045
3258
|
const stepDirection = useModalStore((state) => state.stepDirection);
|
|
3046
3259
|
const currentStep = useModalStore((state) => state.step);
|
|
3047
|
-
return /* @__PURE__ */
|
|
3260
|
+
return /* @__PURE__ */ jsx21(AnimatePresence2, { mode: "popLayout", initial: false, custom: stepDirection, children: /* @__PURE__ */ jsx21(
|
|
3048
3261
|
Container4,
|
|
3049
3262
|
{
|
|
3050
3263
|
custom: stepDirection,
|
|
@@ -3055,12 +3268,12 @@ var Header = () => {
|
|
|
3055
3268
|
transition: BODY_TRANSITION,
|
|
3056
3269
|
slot: "header",
|
|
3057
3270
|
id: "header",
|
|
3058
|
-
children: /* @__PURE__ */
|
|
3271
|
+
children: /* @__PURE__ */ jsx21(CenteredText, { weight: "semiBold", color: "secondary", children: title })
|
|
3059
3272
|
},
|
|
3060
3273
|
["ADD_FUNDS_BUY", "ADD_FUNDS_RECEIVE", "ADD_FUNDS_WITHDRAW"].includes(currentStep) ? "ADD_FUNDS" : currentStep
|
|
3061
3274
|
) });
|
|
3062
3275
|
};
|
|
3063
|
-
var Container4 =
|
|
3276
|
+
var Container4 = styled12(motion3.div)`
|
|
3064
3277
|
position: absolute;
|
|
3065
3278
|
top: 16px;
|
|
3066
3279
|
width: 100%;
|
|
@@ -3073,16 +3286,16 @@ var Container4 = styled11(motion3.div)`
|
|
|
3073
3286
|
`;
|
|
3074
3287
|
|
|
3075
3288
|
// src/modal/components/AuthMainStep/AuthMainStep.tsx
|
|
3076
|
-
import
|
|
3289
|
+
import styled18 from "styled-components";
|
|
3077
3290
|
|
|
3078
3291
|
// src/modal/components/AuthMainStep/AuthMainStepContent.tsx
|
|
3079
3292
|
import { Fragment as Fragment11, useMemo as useMemo9 } from "react";
|
|
3080
|
-
import { CpslButton as
|
|
3081
|
-
import
|
|
3293
|
+
import { CpslButton as CpslButton15, CpslDivider as CpslDivider5, CpslIconGroup } from "@getpara/react-components";
|
|
3294
|
+
import styled17 from "styled-components";
|
|
3082
3295
|
|
|
3083
3296
|
// src/modal/components/ExternalWallets/ExternalWallets.tsx
|
|
3084
|
-
import
|
|
3085
|
-
import { CpslButton as
|
|
3297
|
+
import styled13 from "styled-components";
|
|
3298
|
+
import { CpslButton as CpslButton13, CpslIcon as CpslIcon9, CpslInput as CpslInput2, CpslText as CpslText16 } from "@getpara/react-components";
|
|
3086
3299
|
import { useState as useState9 } from "react";
|
|
3087
3300
|
|
|
3088
3301
|
// src/modal/utils/authLayoutHelpers.ts
|
|
@@ -3090,7 +3303,7 @@ var hasExternalWallet = (authLayout) => authLayout.find((layout) => layout.inclu
|
|
|
3090
3303
|
var hasEmbeddedAuth = (authLayout) => authLayout.find((layout) => layout.includes("AUTH"));
|
|
3091
3304
|
|
|
3092
3305
|
// src/modal/components/ExternalWallets/ExternalWallets.tsx
|
|
3093
|
-
import { Fragment as Fragment9, jsx as
|
|
3306
|
+
import { Fragment as Fragment9, jsx as jsx22, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
3094
3307
|
var HAS_MORE_LENGTH = 3;
|
|
3095
3308
|
var ExternalWallets = () => {
|
|
3096
3309
|
const { wallets, connectExternalWallet } = useExternalWallets();
|
|
@@ -3117,9 +3330,9 @@ var ExternalWallets = () => {
|
|
|
3117
3330
|
connectExternalWallet(wallet, true);
|
|
3118
3331
|
}
|
|
3119
3332
|
};
|
|
3120
|
-
return /* @__PURE__ */
|
|
3121
|
-
showAll && /* @__PURE__ */
|
|
3122
|
-
/* @__PURE__ */
|
|
3333
|
+
return /* @__PURE__ */ jsxs17(Container5, { $maxHeight: showAll, children: [
|
|
3334
|
+
showAll && /* @__PURE__ */ jsxs17(Fragment9, { children: [
|
|
3335
|
+
/* @__PURE__ */ jsx22(SearchInputWrapper, { children: /* @__PURE__ */ jsx22(
|
|
3123
3336
|
SearchInput,
|
|
3124
3337
|
{
|
|
3125
3338
|
placeholder: "Search for your wallet",
|
|
@@ -3128,37 +3341,37 @@ var ExternalWallets = () => {
|
|
|
3128
3341
|
}),
|
|
3129
3342
|
value: search,
|
|
3130
3343
|
style: { width: "100%" },
|
|
3131
|
-
children: /* @__PURE__ */
|
|
3344
|
+
children: /* @__PURE__ */ jsx22(SearchIcon, { slot: "start", icon: "search" })
|
|
3132
3345
|
}
|
|
3133
3346
|
) }),
|
|
3134
|
-
hasEmbeddedAuth(authLayout) && /* @__PURE__ */
|
|
3135
|
-
/* @__PURE__ */
|
|
3136
|
-
/* @__PURE__ */
|
|
3137
|
-
/* @__PURE__ */
|
|
3347
|
+
hasEmbeddedAuth(authLayout) && /* @__PURE__ */ jsx22(CpslButton13, { fullWidth: true, variant: "tertiary", onClick: handleParaClick, children: /* @__PURE__ */ jsxs17(WalletButtonOuterContainer, { children: [
|
|
3348
|
+
/* @__PURE__ */ jsxs17(WalletButtonInnerContainer, { children: [
|
|
3349
|
+
/* @__PURE__ */ jsx22(CpslIcon9, { slot: "start", icon: "paraIcon" }),
|
|
3350
|
+
/* @__PURE__ */ jsx22(CpslText16, { weight: "medium", children: "Para" })
|
|
3138
3351
|
] }),
|
|
3139
|
-
/* @__PURE__ */
|
|
3352
|
+
/* @__PURE__ */ jsx22(Badge, { $show: true, $variant: "installed", children: /* @__PURE__ */ jsx22(CpslText16, { variant: "body2XS", weight: "medium", children: "Available" }) })
|
|
3140
3353
|
] }) })
|
|
3141
3354
|
] }),
|
|
3142
3355
|
walletsToShow.map(
|
|
3143
|
-
(wallet) => showAll ? /* @__PURE__ */
|
|
3144
|
-
/* @__PURE__ */
|
|
3145
|
-
/* @__PURE__ */
|
|
3146
|
-
/* @__PURE__ */
|
|
3356
|
+
(wallet) => showAll ? /* @__PURE__ */ jsx22(CpslButton13, { fullWidth: true, variant: "tertiary", onClick: handleWalletClick(wallet), children: /* @__PURE__ */ jsxs17(WalletButtonOuterContainer, { children: [
|
|
3357
|
+
/* @__PURE__ */ jsxs17(WalletButtonInnerContainer, { children: [
|
|
3358
|
+
/* @__PURE__ */ jsx22(CpslIcon9, { slot: "start", src: wallet.iconUrl }),
|
|
3359
|
+
/* @__PURE__ */ jsx22(CpslText16, { weight: "medium", children: wallet.name })
|
|
3147
3360
|
] }),
|
|
3148
|
-
/* @__PURE__ */
|
|
3149
|
-
] }) }, wallet.id) : /* @__PURE__ */
|
|
3150
|
-
wallet.installed && /* @__PURE__ */
|
|
3151
|
-
/* @__PURE__ */
|
|
3361
|
+
/* @__PURE__ */ jsx22(Badge, { $show: wallet.isMobile || wallet.installed, $variant: wallet.installed ? "installed" : "mobile", children: /* @__PURE__ */ jsx22(CpslText16, { variant: "body2XS", weight: "medium", children: wallet.installed ? "Installed" : "Mobile" }) })
|
|
3362
|
+
] }) }, wallet.id) : /* @__PURE__ */ jsx22(WalletTileButton, { src: wallet.iconUrl, onClick: handleWalletClick(wallet), children: /* @__PURE__ */ jsxs17(TileButtonInnerContainer, { children: [
|
|
3363
|
+
wallet.installed && /* @__PURE__ */ jsx22(InstalledIndicator, {}),
|
|
3364
|
+
/* @__PURE__ */ jsx22(CpslText16, { variant: "bodyXS", color: "secondary", weight: "medium", children: wallet.name })
|
|
3152
3365
|
] }) }, wallet.id)
|
|
3153
3366
|
),
|
|
3154
|
-
showMoreButton && /* @__PURE__ */
|
|
3155
|
-
/* @__PURE__ */
|
|
3367
|
+
showMoreButton && /* @__PURE__ */ jsxs17(CpslButton13, { variant: "tertiary", fullWidth: true, onClick: handleShowAll, children: [
|
|
3368
|
+
/* @__PURE__ */ jsx22(CpslIcon9, { slot: "start", icon: "wallet" }),
|
|
3156
3369
|
"More Wallets"
|
|
3157
3370
|
] }),
|
|
3158
|
-
showAll && /* @__PURE__ */
|
|
3371
|
+
showAll && /* @__PURE__ */ jsx22(BlurContainer, {})
|
|
3159
3372
|
] });
|
|
3160
3373
|
};
|
|
3161
|
-
var Container5 =
|
|
3374
|
+
var Container5 = styled13.div`
|
|
3162
3375
|
position: relative;
|
|
3163
3376
|
display: flex;
|
|
3164
3377
|
justify-content: center;
|
|
@@ -3174,17 +3387,17 @@ var Container5 = styled12.div`
|
|
|
3174
3387
|
-ms-overflow-style: none;
|
|
3175
3388
|
scrollbar-width: none;
|
|
3176
3389
|
`;
|
|
3177
|
-
var WalletTileButton =
|
|
3390
|
+
var WalletTileButton = styled13(StyledCpslTileButton)`
|
|
3178
3391
|
flex: 1;
|
|
3179
3392
|
`;
|
|
3180
|
-
var WalletButtonOuterContainer =
|
|
3393
|
+
var WalletButtonOuterContainer = styled13.div`
|
|
3181
3394
|
width: 100%;
|
|
3182
3395
|
display: flex;
|
|
3183
3396
|
align-items: center;
|
|
3184
3397
|
gap: 8px;
|
|
3185
3398
|
justify-content: space-between;
|
|
3186
3399
|
`;
|
|
3187
|
-
var WalletButtonInnerContainer =
|
|
3400
|
+
var WalletButtonInnerContainer = styled13.div`
|
|
3188
3401
|
display: flex;
|
|
3189
3402
|
align-items: center;
|
|
3190
3403
|
gap: 8px;
|
|
@@ -3198,7 +3411,7 @@ var WalletButtonInnerContainer = styled12.div`
|
|
|
3198
3411
|
}
|
|
3199
3412
|
}
|
|
3200
3413
|
`;
|
|
3201
|
-
var Badge =
|
|
3414
|
+
var Badge = styled13.div`
|
|
3202
3415
|
visibility: ${({ $show }) => $show ? "visible" : "hidden"};
|
|
3203
3416
|
padding: 2px 4px;
|
|
3204
3417
|
border-radius: 4px;
|
|
@@ -3210,21 +3423,21 @@ var Badge = styled12.div`
|
|
|
3210
3423
|
}
|
|
3211
3424
|
}
|
|
3212
3425
|
`;
|
|
3213
|
-
var InstalledIndicator =
|
|
3426
|
+
var InstalledIndicator = styled13.span`
|
|
3214
3427
|
width: 8px;
|
|
3215
3428
|
height: 8px;
|
|
3216
3429
|
border-radius: 100%;
|
|
3217
3430
|
background-color: var(--cpsl-color-utility-green);
|
|
3218
3431
|
`;
|
|
3219
|
-
var TileButtonInnerContainer =
|
|
3432
|
+
var TileButtonInnerContainer = styled13.div`
|
|
3220
3433
|
display: flex;
|
|
3221
3434
|
gap: 4px;
|
|
3222
3435
|
align-items: center;
|
|
3223
3436
|
`;
|
|
3224
|
-
var SearchIcon =
|
|
3437
|
+
var SearchIcon = styled13(CpslIcon9)`
|
|
3225
3438
|
--icon-color: var(--cpsl-color-contrast);
|
|
3226
3439
|
`;
|
|
3227
|
-
var SearchInputWrapper =
|
|
3440
|
+
var SearchInputWrapper = styled13.div`
|
|
3228
3441
|
width: 100%;
|
|
3229
3442
|
background-color: var(--cpsl-color-background-0);
|
|
3230
3443
|
|
|
@@ -3233,12 +3446,12 @@ var SearchInputWrapper = styled12.div`
|
|
|
3233
3446
|
padding-bottom: 4px;
|
|
3234
3447
|
margin-bottom: -4px;
|
|
3235
3448
|
`;
|
|
3236
|
-
var SearchInput =
|
|
3449
|
+
var SearchInput = styled13(CpslInput2)`
|
|
3237
3450
|
width: 100%;
|
|
3238
3451
|
--container-background-color: var(--cpsl-color-background-8);
|
|
3239
3452
|
--input-background-color: var(--cpsl-color-background-8);
|
|
3240
3453
|
`;
|
|
3241
|
-
var BlurContainer =
|
|
3454
|
+
var BlurContainer = styled13.div`
|
|
3242
3455
|
position: sticky;
|
|
3243
3456
|
height: 56px;
|
|
3244
3457
|
width: 100%;
|
|
@@ -3270,11 +3483,11 @@ var oAuthLogos = {
|
|
|
3270
3483
|
|
|
3271
3484
|
// src/modal/components/AuthOptions/AuthOptions.tsx
|
|
3272
3485
|
import { useMemo as useMemo8 } from "react";
|
|
3273
|
-
import
|
|
3486
|
+
import styled16 from "styled-components";
|
|
3274
3487
|
|
|
3275
3488
|
// src/modal/components/OAuth/OAuth.tsx
|
|
3276
|
-
import { AuthMethod as
|
|
3277
|
-
import { styled as
|
|
3489
|
+
import { AuthMethod as AuthMethod7, OAuthMethod } from "@getpara/web-sdk";
|
|
3490
|
+
import { styled as styled14 } from "styled-components";
|
|
3278
3491
|
|
|
3279
3492
|
// src/modal/utils/getTileButtonFlex.ts
|
|
3280
3493
|
var getTileButtonFlex = (index, totalItems) => {
|
|
@@ -3325,7 +3538,7 @@ var routeMobileExternalWallet = (qrUri) => {
|
|
|
3325
3538
|
};
|
|
3326
3539
|
|
|
3327
3540
|
// src/modal/components/OAuth/OAuth.tsx
|
|
3328
|
-
import { jsx as
|
|
3541
|
+
import { jsx as jsx23, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
3329
3542
|
var HAS_MORE_LENGTH2 = 3;
|
|
3330
3543
|
var OAuth = ({ methods }) => {
|
|
3331
3544
|
const goBack = useGoBack();
|
|
@@ -3336,7 +3549,6 @@ var OAuth = ({ methods }) => {
|
|
|
3336
3549
|
const setFlow = useModalStore((state) => state.setFlow);
|
|
3337
3550
|
const setStep = useModalStore((state) => state.setStep);
|
|
3338
3551
|
const setAuthInfo = useUserInfoStore((state) => state.setAuthInfo);
|
|
3339
|
-
const setSupportedAuthMethods = useModalStore((state) => state.setSupportedAuthMethods);
|
|
3340
3552
|
const setBiometricLocationHints = useModalStore((state) => state.setBiometricLocationHints);
|
|
3341
3553
|
const setFarcasterConnectUri = useModalStore((state) => state.setFarcasterConnectUri);
|
|
3342
3554
|
const farcasterConnectUri = useModalStore((state) => state.farcasterConnectUri);
|
|
@@ -3346,6 +3558,7 @@ var OAuth = ({ methods }) => {
|
|
|
3346
3558
|
const setAuthStepRoute = useModalStore((state) => state.setAuthStepRoute);
|
|
3347
3559
|
const setWebAuthURLForCreate = useModalStore((state) => state.setWebAuthURLForCreate);
|
|
3348
3560
|
const theme = useThemeStore((state) => state.theme);
|
|
3561
|
+
const setLoginURLs = useSetLoginURLs();
|
|
3349
3562
|
useEffect13(() => {
|
|
3350
3563
|
const initializeFarcaster = () => __async(void 0, null, function* () {
|
|
3351
3564
|
if (!methods.includes(OAuthMethod.FARCASTER)) {
|
|
@@ -3392,10 +3605,10 @@ var OAuth = ({ methods }) => {
|
|
|
3392
3605
|
if (userExists) {
|
|
3393
3606
|
const supportedAuthMethods = yield para.initiateUserLoginV2({ email });
|
|
3394
3607
|
if (supportedAuthMethods.size > 0) {
|
|
3395
|
-
const biometricLocationHints = supportedAuthMethods.has(
|
|
3608
|
+
const biometricLocationHints = supportedAuthMethods.has(AuthMethod7.PASSKEY) ? yield para.getUserBiometricLocationHints() : [];
|
|
3609
|
+
yield setLoginURLs({ supportedAuthMethods, authType: "email" });
|
|
3396
3610
|
setFlow("login");
|
|
3397
3611
|
setStep("BIOMETRIC_LOGIN" /* BIOMETRIC_LOGIN */);
|
|
3398
|
-
setSupportedAuthMethods(supportedAuthMethods);
|
|
3399
3612
|
setBiometricLocationHints(biometricLocationHints);
|
|
3400
3613
|
return;
|
|
3401
3614
|
}
|
|
@@ -3403,8 +3616,8 @@ var OAuth = ({ methods }) => {
|
|
|
3403
3616
|
const supportedCreateAuthMethods = yield para.getSupportedCreateAuthMethods();
|
|
3404
3617
|
setIsIFrameReady(false);
|
|
3405
3618
|
setFlow("signUp");
|
|
3406
|
-
const supportsPasskey = supportedCreateAuthMethods.has(
|
|
3407
|
-
const supportsPassword = supportedCreateAuthMethods.has(
|
|
3619
|
+
const supportsPasskey = supportedCreateAuthMethods.has(AuthMethod7.PASSKEY);
|
|
3620
|
+
const supportsPassword = supportedCreateAuthMethods.has(AuthMethod7.PASSWORD);
|
|
3408
3621
|
if (supportsPasskey) {
|
|
3409
3622
|
setWebAuthURLForCreate(yield para.shortenLoginLink(yield para.getSetUpBiometricsURL({ authType: "email" })));
|
|
3410
3623
|
if (!supportsPassword) {
|
|
@@ -3422,8 +3635,8 @@ var OAuth = ({ methods }) => {
|
|
|
3422
3635
|
const useBrandedLogos = oAuthLogoVariant === "default";
|
|
3423
3636
|
const useDarkLogos = useBrandedLogos ? isDark : oAuthLogoVariant !== "dark";
|
|
3424
3637
|
const showMoreButton = !showAll && hasMore;
|
|
3425
|
-
return /* @__PURE__ */
|
|
3426
|
-
methodsToShow.map((method, index) => /* @__PURE__ */
|
|
3638
|
+
return /* @__PURE__ */ jsxs18(OAuthContainer, { children: [
|
|
3639
|
+
methodsToShow.map((method, index) => /* @__PURE__ */ jsx23(
|
|
3427
3640
|
OAuthButton,
|
|
3428
3641
|
{
|
|
3429
3642
|
$isDark: useDarkLogos,
|
|
@@ -3434,7 +3647,7 @@ var OAuth = ({ methods }) => {
|
|
|
3434
3647
|
},
|
|
3435
3648
|
method
|
|
3436
3649
|
)),
|
|
3437
|
-
showMoreButton && /* @__PURE__ */
|
|
3650
|
+
showMoreButton && /* @__PURE__ */ jsx23(
|
|
3438
3651
|
OAuthButton,
|
|
3439
3652
|
{
|
|
3440
3653
|
$isDark: useDarkLogos,
|
|
@@ -3446,13 +3659,13 @@ var OAuth = ({ methods }) => {
|
|
|
3446
3659
|
)
|
|
3447
3660
|
] });
|
|
3448
3661
|
};
|
|
3449
|
-
var OAuthContainer =
|
|
3662
|
+
var OAuthContainer = styled14.div`
|
|
3450
3663
|
display: flex;
|
|
3451
3664
|
justify-content: center;
|
|
3452
3665
|
gap: 8px;
|
|
3453
3666
|
flex-wrap: wrap;
|
|
3454
3667
|
`;
|
|
3455
|
-
var OAuthButton =
|
|
3668
|
+
var OAuthButton = styled14(StyledCpslTileButton)`
|
|
3456
3669
|
flex: ${({ $index, $totalItems }) => getTileButtonFlex($index, $totalItems)};
|
|
3457
3670
|
|
|
3458
3671
|
--button-icon-color: ${({ $isDark }) => $isDark ? "white" : "black"};
|
|
@@ -3460,16 +3673,16 @@ var OAuthButton = styled13(StyledCpslTileButton)`
|
|
|
3460
3673
|
|
|
3461
3674
|
// src/modal/components/AuthInput/AuthInput.tsx
|
|
3462
3675
|
import {
|
|
3463
|
-
CpslButton as
|
|
3676
|
+
CpslButton as CpslButton14,
|
|
3464
3677
|
CpslIcon as CpslIcon10,
|
|
3465
3678
|
CpslInput as CpslInput3,
|
|
3466
3679
|
CpslSelect,
|
|
3467
3680
|
CpslSelectItem,
|
|
3468
|
-
CpslSpinner as
|
|
3469
|
-
CpslText as
|
|
3681
|
+
CpslSpinner as CpslSpinner9,
|
|
3682
|
+
CpslText as CpslText17
|
|
3470
3683
|
} from "@getpara/react-components";
|
|
3471
3684
|
import { useRef as useRef5, useState as useState11 } from "react";
|
|
3472
|
-
import
|
|
3685
|
+
import styled15 from "styled-components";
|
|
3473
3686
|
|
|
3474
3687
|
// src/modal/components/AuthInput/countryCodes.tsx
|
|
3475
3688
|
import { getCountries, getCountryCallingCode } from "libphonenumber-js";
|
|
@@ -3790,8 +4003,8 @@ var phoneMasks = {
|
|
|
3790
4003
|
};
|
|
3791
4004
|
|
|
3792
4005
|
// src/modal/components/AuthInput/AuthInput.tsx
|
|
3793
|
-
import { AuthMethod as
|
|
3794
|
-
import { jsx as
|
|
4006
|
+
import { AuthMethod as AuthMethod8 } from "@getpara/web-sdk";
|
|
4007
|
+
import { jsx as jsx24, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
3795
4008
|
var DEFAULT_COUNTRY = { label: "United States", value: "+1", selectedLabel: "US", icon: "US" };
|
|
3796
4009
|
function isCcMatch(countryCode, option) {
|
|
3797
4010
|
return countryCode === "+1" ? option.selectedLabel === "US" : option.value === countryCode;
|
|
@@ -3805,8 +4018,8 @@ var AuthInput = ({ disableEmailLogin, disablePhoneLogin }) => {
|
|
|
3805
4018
|
const authInfo = useUserInfoStore((state) => state.getAuthInfo());
|
|
3806
4019
|
const setFlow = useModalStore((state) => state.setFlow);
|
|
3807
4020
|
const setStep = useModalStore((state) => state.setStep);
|
|
3808
|
-
const setSupportedAuthMethods = useModalStore((state) => state.setSupportedAuthMethods);
|
|
3809
4021
|
const setBiometricLocationHints = useModalStore((state) => state.setBiometricLocationHints);
|
|
4022
|
+
const setLoginURLs = useSetLoginURLs();
|
|
3810
4023
|
const [countryCode, setCountryCode] = useState11(
|
|
3811
4024
|
(authInfo == null ? void 0 : authInfo.authType) === "phone" ? authInfo.auth.countryCode || "+1" : "+1"
|
|
3812
4025
|
);
|
|
@@ -3882,10 +4095,10 @@ var AuthInput = ({ disableEmailLogin, disablePhoneLogin }) => {
|
|
|
3882
4095
|
const userExists = yield para.checkIfUserExists({ email: identifier });
|
|
3883
4096
|
if (userExists) {
|
|
3884
4097
|
const supportedAuthMethods = yield para.initiateUserLoginV2(auth);
|
|
3885
|
-
const biometricLocationHints = supportedAuthMethods.has(
|
|
4098
|
+
const biometricLocationHints = supportedAuthMethods.has(AuthMethod8.PASSKEY) ? yield para.getUserBiometricLocationHints() : [];
|
|
4099
|
+
yield setLoginURLs({ supportedAuthMethods, authType: "email" });
|
|
3886
4100
|
setFlow("login");
|
|
3887
4101
|
setStep("BIOMETRIC_LOGIN" /* BIOMETRIC_LOGIN */);
|
|
3888
|
-
setSupportedAuthMethods(supportedAuthMethods);
|
|
3889
4102
|
setBiometricLocationHints(biometricLocationHints);
|
|
3890
4103
|
return;
|
|
3891
4104
|
}
|
|
@@ -3907,10 +4120,10 @@ var AuthInput = ({ disableEmailLogin, disablePhoneLogin }) => {
|
|
|
3907
4120
|
setAuthInfo(auth);
|
|
3908
4121
|
if (userExists) {
|
|
3909
4122
|
const supportedAuthMethods = yield para.initiateUserLoginV2(auth);
|
|
3910
|
-
const biometricLocationHints = supportedAuthMethods.has(
|
|
4123
|
+
const biometricLocationHints = supportedAuthMethods.has(AuthMethod8.PASSKEY) ? yield para.getUserBiometricLocationHints() : [];
|
|
4124
|
+
yield setLoginURLs({ supportedAuthMethods, authType: "phone" });
|
|
3911
4125
|
setFlow("login");
|
|
3912
4126
|
setStep("BIOMETRIC_LOGIN" /* BIOMETRIC_LOGIN */);
|
|
3913
|
-
setSupportedAuthMethods(supportedAuthMethods);
|
|
3914
4127
|
setBiometricLocationHints(biometricLocationHints);
|
|
3915
4128
|
return;
|
|
3916
4129
|
}
|
|
@@ -3928,14 +4141,14 @@ var AuthInput = ({ disableEmailLogin, disablePhoneLogin }) => {
|
|
|
3928
4141
|
if (disableEmailLogin && disablePhoneLogin) {
|
|
3929
4142
|
return null;
|
|
3930
4143
|
}
|
|
3931
|
-
return /* @__PURE__ */
|
|
4144
|
+
return /* @__PURE__ */ jsx24(
|
|
3932
4145
|
"form",
|
|
3933
4146
|
{
|
|
3934
4147
|
onSubmit: (e) => __async(void 0, null, function* () {
|
|
3935
4148
|
e.preventDefault();
|
|
3936
4149
|
yield handleSubmit();
|
|
3937
4150
|
}),
|
|
3938
|
-
children: /* @__PURE__ */
|
|
4151
|
+
children: /* @__PURE__ */ jsxs19(
|
|
3939
4152
|
StyledInput,
|
|
3940
4153
|
{
|
|
3941
4154
|
ref: inputRef,
|
|
@@ -3957,10 +4170,10 @@ var AuthInput = ({ disableEmailLogin, disablePhoneLogin }) => {
|
|
|
3957
4170
|
disabled: isLoggingIn,
|
|
3958
4171
|
"data-testid": "auth-input",
|
|
3959
4172
|
children: [
|
|
3960
|
-
/* @__PURE__ */
|
|
3961
|
-
!disableEmailLogin && (isUnknown || isEmail) && /* @__PURE__ */
|
|
3962
|
-
!disablePhoneLogin && isUnknown && /* @__PURE__ */
|
|
3963
|
-
isPhone && /* @__PURE__ */
|
|
4173
|
+
/* @__PURE__ */ jsxs19(IconContainer2, { slot: "start", children: [
|
|
4174
|
+
!disableEmailLogin && (isUnknown || isEmail) && /* @__PURE__ */ jsx24(CpslIcon10, { "aria-label": "email", icon: "mail" }),
|
|
4175
|
+
!disablePhoneLogin && isUnknown && /* @__PURE__ */ jsx24(CpslIcon10, { "aria-label": "phone", icon: "phone" }),
|
|
4176
|
+
isPhone && /* @__PURE__ */ jsxs19(
|
|
3964
4177
|
CountryCodeSelect,
|
|
3965
4178
|
{
|
|
3966
4179
|
selectedValue: matchedCountryCode.selectedLabel,
|
|
@@ -3975,19 +4188,19 @@ var AuthInput = ({ disableEmailLogin, disablePhoneLogin }) => {
|
|
|
3975
4188
|
onCpslSearchChange: handleSearchInput,
|
|
3976
4189
|
"data-testid": "country-code-select",
|
|
3977
4190
|
children: [
|
|
3978
|
-
matchedCountryCode && /* @__PURE__ */
|
|
3979
|
-
/* @__PURE__ */
|
|
3980
|
-
/* @__PURE__ */
|
|
4191
|
+
matchedCountryCode && /* @__PURE__ */ jsxs19(SelectedItem, { slot: "selected-item", children: [
|
|
4192
|
+
/* @__PURE__ */ jsx24(CpslText17, { children: matchedCountryCode.selectedLabel }),
|
|
4193
|
+
/* @__PURE__ */ jsx24(CpslText17, { children: matchedCountryCode.value })
|
|
3981
4194
|
] }),
|
|
3982
|
-
filteredCountryCodes.map((cc) => /* @__PURE__ */
|
|
3983
|
-
/* @__PURE__ */
|
|
3984
|
-
/* @__PURE__ */
|
|
4195
|
+
filteredCountryCodes.map((cc) => /* @__PURE__ */ jsxs19(StyledSelectItem, { slot: "items", value: cc.selectedLabel, children: [
|
|
4196
|
+
/* @__PURE__ */ jsx24(CpslText17, { children: cc.label }),
|
|
4197
|
+
/* @__PURE__ */ jsx24(CpslText17, { children: cc.value })
|
|
3985
4198
|
] }, cc.selectedLabel))
|
|
3986
4199
|
]
|
|
3987
4200
|
}
|
|
3988
4201
|
)
|
|
3989
4202
|
] }),
|
|
3990
|
-
identifier && /* @__PURE__ */
|
|
4203
|
+
identifier && /* @__PURE__ */ jsx24(CpslButton14, { slot: "end", size: "small", fullWidth: true, disabled: isLoggingIn, onClick: handleSubmit, children: isLoggingIn ? /* @__PURE__ */ jsx24(CpslSpinner9, { size: 16 }) : /* @__PURE__ */ jsx24(CpslIcon10, { icon: "arrowNarrow" }) })
|
|
3991
4204
|
]
|
|
3992
4205
|
},
|
|
3993
4206
|
"email"
|
|
@@ -3995,7 +4208,7 @@ var AuthInput = ({ disableEmailLogin, disablePhoneLogin }) => {
|
|
|
3995
4208
|
}
|
|
3996
4209
|
);
|
|
3997
4210
|
};
|
|
3998
|
-
var IconContainer2 =
|
|
4211
|
+
var IconContainer2 = styled15.div`
|
|
3999
4212
|
height: 100%;
|
|
4000
4213
|
display: flex;
|
|
4001
4214
|
align-items: center;
|
|
@@ -4007,7 +4220,7 @@ var IconContainer2 = styled14.div`
|
|
|
4007
4220
|
--icon-color: var(--cpsl-color-contrast);
|
|
4008
4221
|
}
|
|
4009
4222
|
`;
|
|
4010
|
-
var CountryCodeSelect =
|
|
4223
|
+
var CountryCodeSelect = styled15(CpslSelect)`
|
|
4011
4224
|
--container-height: 100%;
|
|
4012
4225
|
--container-padding-start: 0px;
|
|
4013
4226
|
--container-padding-end: 0px;
|
|
@@ -4032,47 +4245,47 @@ var CountryCodeSelect = styled14(CpslSelect)`
|
|
|
4032
4245
|
}
|
|
4033
4246
|
}
|
|
4034
4247
|
`;
|
|
4035
|
-
var StyledSelectItem =
|
|
4248
|
+
var StyledSelectItem = styled15(CpslSelectItem)`
|
|
4036
4249
|
&::part(inner-container) {
|
|
4037
4250
|
justify-content: space-between;
|
|
4038
4251
|
}
|
|
4039
4252
|
`;
|
|
4040
|
-
var SelectedItem =
|
|
4253
|
+
var SelectedItem = styled15.div`
|
|
4041
4254
|
display: flex;
|
|
4042
4255
|
gap: 4px;
|
|
4043
4256
|
align-items: center;
|
|
4044
4257
|
`;
|
|
4045
|
-
var StyledInput =
|
|
4258
|
+
var StyledInput = styled15(CpslInput3)`
|
|
4046
4259
|
--container-background-color: var(--cpsl-color-background-8);
|
|
4047
4260
|
--input-background-color: var(--cpsl-color-background-8);
|
|
4048
4261
|
--container-padding-end: 8px;
|
|
4049
4262
|
`;
|
|
4050
4263
|
|
|
4051
4264
|
// src/modal/components/AuthOptions/AuthOptions.tsx
|
|
4052
|
-
import { Fragment as Fragment10, jsx as
|
|
4265
|
+
import { Fragment as Fragment10, jsx as jsx25 } from "react/jsx-runtime";
|
|
4053
4266
|
var AuthOptions = ({ oAuthMethods, disableEmailLogin, disablePhoneLogin }) => {
|
|
4054
4267
|
const { wallets } = useExternalWallets();
|
|
4055
4268
|
const showAllOAuth = useModalStore((state) => state.step === "AUTH_MORE" /* AUTH_MORE */);
|
|
4056
4269
|
const Content = useMemo8(() => {
|
|
4057
4270
|
const Methods = [];
|
|
4058
4271
|
if (!!(oAuthMethods == null ? void 0 : oAuthMethods.length)) {
|
|
4059
|
-
Methods.push(/* @__PURE__ */
|
|
4272
|
+
Methods.push(/* @__PURE__ */ jsx25(OAuth, { methods: oAuthMethods }, "oAuth"));
|
|
4060
4273
|
}
|
|
4061
4274
|
if (!disableEmailLogin || !disablePhoneLogin) {
|
|
4062
|
-
Methods.push(/* @__PURE__ */
|
|
4275
|
+
Methods.push(/* @__PURE__ */ jsx25(AuthInput, { disableEmailLogin, disablePhoneLogin }, "input"));
|
|
4063
4276
|
}
|
|
4064
|
-
return /* @__PURE__ */
|
|
4277
|
+
return /* @__PURE__ */ jsx25(Fragment10, { children: Methods });
|
|
4065
4278
|
}, [showAllOAuth, oAuthMethods, disableEmailLogin, disablePhoneLogin, wallets]);
|
|
4066
|
-
return /* @__PURE__ */
|
|
4279
|
+
return /* @__PURE__ */ jsx25(Container6, { children: Content });
|
|
4067
4280
|
};
|
|
4068
|
-
var Container6 =
|
|
4281
|
+
var Container6 = styled16.div`
|
|
4069
4282
|
display: flex;
|
|
4070
4283
|
flex-direction: column;
|
|
4071
4284
|
gap: 8px;
|
|
4072
4285
|
`;
|
|
4073
4286
|
|
|
4074
4287
|
// src/modal/components/AuthMainStep/AuthMainStepContent.tsx
|
|
4075
|
-
import { Fragment as Fragment12, jsx as
|
|
4288
|
+
import { Fragment as Fragment12, jsx as jsx26, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
4076
4289
|
var AuthMainStepContent = ({ oAuthMethods, disableEmailLogin, disablePhoneLogin }) => {
|
|
4077
4290
|
const { wallets } = useExternalWallets();
|
|
4078
4291
|
const authLayout = useThemeStore((state) => state.authLayout);
|
|
@@ -4093,7 +4306,7 @@ var AuthMainStepContent = ({ oAuthMethods, disableEmailLogin, disablePhoneLogin
|
|
|
4093
4306
|
switch (layout) {
|
|
4094
4307
|
case "AUTH:FULL" /* AUTH_FULL */: {
|
|
4095
4308
|
methods.push([
|
|
4096
|
-
/* @__PURE__ */
|
|
4309
|
+
/* @__PURE__ */ jsx26(
|
|
4097
4310
|
AuthOptions,
|
|
4098
4311
|
{
|
|
4099
4312
|
oAuthMethods,
|
|
@@ -4110,10 +4323,10 @@ var AuthMainStepContent = ({ oAuthMethods, disableEmailLogin, disablePhoneLogin
|
|
|
4110
4323
|
const icons = [];
|
|
4111
4324
|
oAuthMethods == null ? void 0 : oAuthMethods.forEach((method) => icons.push(useBrandedLogos ? brandedOAuthLogos[method] : oAuthLogos[method]));
|
|
4112
4325
|
methods.push([
|
|
4113
|
-
/* @__PURE__ */
|
|
4114
|
-
/* @__PURE__ */
|
|
4326
|
+
/* @__PURE__ */ jsxs20(CondensedButton, { onClick: handleCondensedAuthClick, variant: "tertiary", fullWidth: true, children: [
|
|
4327
|
+
/* @__PURE__ */ jsx26(IconGroupSpacer, { slot: "start", icons: [], $isDark: useDarkLogos }),
|
|
4115
4328
|
"Sign Up or Login",
|
|
4116
|
-
/* @__PURE__ */
|
|
4329
|
+
/* @__PURE__ */ jsx26(StyledIconGroup, { slot: "end", icons: icons.splice(0, 3), $isDark: useDarkLogos })
|
|
4117
4330
|
] }, "authCondensed"),
|
|
4118
4331
|
layout
|
|
4119
4332
|
]);
|
|
@@ -4121,7 +4334,7 @@ var AuthMainStepContent = ({ oAuthMethods, disableEmailLogin, disablePhoneLogin
|
|
|
4121
4334
|
}
|
|
4122
4335
|
case "EXTERNAL:FULL" /* EXTERNAL_FULL */: {
|
|
4123
4336
|
if (!!wallets.length) {
|
|
4124
|
-
methods.push([/* @__PURE__ */
|
|
4337
|
+
methods.push([/* @__PURE__ */ jsx26(ExternalWallets, {}, "externalWallets"), layout]);
|
|
4125
4338
|
}
|
|
4126
4339
|
break;
|
|
4127
4340
|
}
|
|
@@ -4129,10 +4342,10 @@ var AuthMainStepContent = ({ oAuthMethods, disableEmailLogin, disablePhoneLogin
|
|
|
4129
4342
|
const icons = [];
|
|
4130
4343
|
wallets == null ? void 0 : wallets.forEach((wallet) => icons.push(wallet.iconUrl));
|
|
4131
4344
|
methods.push([
|
|
4132
|
-
/* @__PURE__ */
|
|
4133
|
-
/* @__PURE__ */
|
|
4345
|
+
/* @__PURE__ */ jsxs20(CondensedButton, { onClick: handleCondensedExternalClick, variant: "tertiary", fullWidth: true, children: [
|
|
4346
|
+
/* @__PURE__ */ jsx26(IconGroupSpacer, { slot: "start", icons: [], $isDark: useDarkLogos }),
|
|
4134
4347
|
"Connect Wallet",
|
|
4135
|
-
/* @__PURE__ */
|
|
4348
|
+
/* @__PURE__ */ jsx26(StyledIconGroup, { slot: "end", icons: icons.splice(0, 3), $isDark: useDarkLogos })
|
|
4136
4349
|
] }, "authCondensed"),
|
|
4137
4350
|
layout
|
|
4138
4351
|
]);
|
|
@@ -4143,27 +4356,27 @@ var AuthMainStepContent = ({ oAuthMethods, disableEmailLogin, disablePhoneLogin
|
|
|
4143
4356
|
}
|
|
4144
4357
|
}
|
|
4145
4358
|
});
|
|
4146
|
-
return /* @__PURE__ */
|
|
4359
|
+
return /* @__PURE__ */ jsx26(Fragment12, { children: methods.map(([reactNode, key], index) => /* @__PURE__ */ jsxs20(Fragment11, { children: [
|
|
4147
4360
|
reactNode,
|
|
4148
|
-
methods.length > 1 && index < methods.length - 1 && /* @__PURE__ */
|
|
4361
|
+
methods.length > 1 && index < methods.length - 1 && /* @__PURE__ */ jsx26(CpslDivider5, { children: "or" }, "or")
|
|
4149
4362
|
] }, key)) });
|
|
4150
4363
|
}, [oAuthMethods, disableEmailLogin, disablePhoneLogin, wallets, authLayout]);
|
|
4151
|
-
return /* @__PURE__ */
|
|
4364
|
+
return /* @__PURE__ */ jsx26(Container7, { "data-testid": "main-auth-step-content", children: Content });
|
|
4152
4365
|
};
|
|
4153
|
-
var Container7 =
|
|
4366
|
+
var Container7 = styled17.div`
|
|
4154
4367
|
display: flex;
|
|
4155
4368
|
flex-direction: column;
|
|
4156
4369
|
gap: 8px;
|
|
4157
4370
|
`;
|
|
4158
|
-
var StyledIconGroup =
|
|
4371
|
+
var StyledIconGroup = styled17(CpslIconGroup)`
|
|
4159
4372
|
--icon-item-color: ${({ $isDark }) => $isDark ? "white" : "black"};
|
|
4160
4373
|
flex: 1;
|
|
4161
4374
|
justify-content: flex-end;
|
|
4162
4375
|
`;
|
|
4163
|
-
var IconGroupSpacer =
|
|
4376
|
+
var IconGroupSpacer = styled17(StyledIconGroup)`
|
|
4164
4377
|
visibility: hidden;
|
|
4165
4378
|
`;
|
|
4166
|
-
var CondensedButton =
|
|
4379
|
+
var CondensedButton = styled17(CpslButton15)`
|
|
4167
4380
|
--button-justify-content: space-between;
|
|
4168
4381
|
|
|
4169
4382
|
&::part(button-native) {
|
|
@@ -4172,7 +4385,7 @@ var CondensedButton = styled16(CpslButton14)`
|
|
|
4172
4385
|
`;
|
|
4173
4386
|
|
|
4174
4387
|
// src/modal/components/AuthMainStep/AuthMainStep.tsx
|
|
4175
|
-
import { Fragment as Fragment13, jsx as
|
|
4388
|
+
import { Fragment as Fragment13, jsx as jsx27, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
4176
4389
|
var AuthMainStep = ({ oAuthMethods, disableEmailLogin, disablePhoneLogin }) => {
|
|
4177
4390
|
const logo = useThemeStore((state) => state.getLogo());
|
|
4178
4391
|
const appName = useThemeStore((state) => state.appName);
|
|
@@ -4180,10 +4393,10 @@ var AuthMainStep = ({ oAuthMethods, disableEmailLogin, disablePhoneLogin }) => {
|
|
|
4180
4393
|
const embeddedModal = useThemeStore((state) => state.embeddedModal);
|
|
4181
4394
|
const firstLayoutType = authLayout[0].split(":")[0];
|
|
4182
4395
|
const heading = firstLayoutType === "AUTH" ? "Sign Up or Login" : "Connect Wallet";
|
|
4183
|
-
return /* @__PURE__ */
|
|
4184
|
-
logo && /* @__PURE__ */
|
|
4185
|
-
!embeddedModal && /* @__PURE__ */
|
|
4186
|
-
/* @__PURE__ */
|
|
4396
|
+
return /* @__PURE__ */ jsxs21(Fragment13, { children: [
|
|
4397
|
+
logo && /* @__PURE__ */ jsx27(Logo, { src: logo, alt: `${appName ? `${appName} -` : ""}logo` }),
|
|
4398
|
+
!embeddedModal && /* @__PURE__ */ jsx27(CenteredText, { variant: logo ? "bodyM" : "headingS", weight: "semiBold", children: heading }),
|
|
4399
|
+
/* @__PURE__ */ jsx27(
|
|
4187
4400
|
AuthMainStepContent,
|
|
4188
4401
|
{
|
|
4189
4402
|
disableEmailLogin,
|
|
@@ -4193,7 +4406,7 @@ var AuthMainStep = ({ oAuthMethods, disableEmailLogin, disablePhoneLogin }) => {
|
|
|
4193
4406
|
)
|
|
4194
4407
|
] });
|
|
4195
4408
|
};
|
|
4196
|
-
var Logo =
|
|
4409
|
+
var Logo = styled18.img`
|
|
4197
4410
|
height: 100px;
|
|
4198
4411
|
max-width: 260px;
|
|
4199
4412
|
object-fit: contain;
|
|
@@ -4202,16 +4415,15 @@ var Logo = styled17.img`
|
|
|
4202
4415
|
`;
|
|
4203
4416
|
|
|
4204
4417
|
// src/modal/components/Account/Account.tsx
|
|
4205
|
-
import
|
|
4206
|
-
import { CpslButton as
|
|
4418
|
+
import styled19 from "styled-components";
|
|
4419
|
+
import { CpslButton as CpslButton16, CpslIcon as CpslIcon11, CpslSpinner as CpslSpinner10, CpslText as CpslText18 } from "@getpara/react-components";
|
|
4207
4420
|
import { useState as useState12 } from "react";
|
|
4208
|
-
import { Fragment as Fragment14, jsx as
|
|
4421
|
+
import { Fragment as Fragment14, jsx as jsx28, jsxs as jsxs22 } from "react/jsx-runtime";
|
|
4209
4422
|
var Account = ({ onClose }) => {
|
|
4210
4423
|
const onRampConfig = useModalStore((state) => state.onRampConfig);
|
|
4211
4424
|
const setStep = useModalStore((state) => state.setStep);
|
|
4212
4425
|
const hideWallets = useThemeStore((state) => state.hideWallets);
|
|
4213
4426
|
const { disconnectExternalWallet } = useExternalWallets();
|
|
4214
|
-
const para = useInternalClient();
|
|
4215
4427
|
const [isDisconnecting, setIsDisconnecting] = useState12(false);
|
|
4216
4428
|
const isOnRampLoaded = !!onRampConfig;
|
|
4217
4429
|
const handleBuyClick = () => {
|
|
@@ -4225,25 +4437,24 @@ var Account = ({ onClose }) => {
|
|
|
4225
4437
|
};
|
|
4226
4438
|
const handleDisconnectClick = () => __async(void 0, null, function* () {
|
|
4227
4439
|
setIsDisconnecting(true);
|
|
4228
|
-
yield para.logout();
|
|
4229
4440
|
yield disconnectExternalWallet();
|
|
4230
4441
|
onClose();
|
|
4231
4442
|
setStep("AUTH_MAIN" /* AUTH_MAIN */);
|
|
4232
4443
|
setIsDisconnecting(false);
|
|
4233
4444
|
});
|
|
4234
|
-
return /* @__PURE__ */
|
|
4235
|
-
/* @__PURE__ */
|
|
4236
|
-
onRampConfig.isBuyEnabled && /* @__PURE__ */
|
|
4237
|
-
onRampConfig.isReceiveEnabled && /* @__PURE__ */
|
|
4238
|
-
onRampConfig.isWithdrawEnabled && /* @__PURE__ */
|
|
4239
|
-
] }) : /* @__PURE__ */
|
|
4240
|
-
/* @__PURE__ */
|
|
4445
|
+
return /* @__PURE__ */ jsx28(StepContainer, { $wide: true, children: /* @__PURE__ */ jsxs22(InnerStepContainer, { children: [
|
|
4446
|
+
/* @__PURE__ */ jsx28(ButtonContainer2, { children: isOnRampLoaded ? /* @__PURE__ */ jsxs22(Fragment14, { children: [
|
|
4447
|
+
onRampConfig.isBuyEnabled && /* @__PURE__ */ jsx28(OptionButton, { icon: "creditCard", onClick: handleBuyClick, children: /* @__PURE__ */ jsx28(CpslText18, { variant: "bodyXS", color: "secondary", weight: "medium", children: "Buy Crypto" }) }),
|
|
4448
|
+
onRampConfig.isReceiveEnabled && /* @__PURE__ */ jsx28(OptionButton, { icon: "qrCode02", onClick: handleReceiveClick, children: /* @__PURE__ */ jsx28(CpslText18, { variant: "bodyXS", color: "secondary", weight: "medium", children: "Receive" }) }),
|
|
4449
|
+
onRampConfig.isWithdrawEnabled && /* @__PURE__ */ jsx28(OptionButton, { icon: "arrowCircleBrokenDownLeft", onClick: handleSellClick, children: /* @__PURE__ */ jsx28(CpslText18, { variant: "bodyXS", color: "secondary", weight: "medium", children: "Withdraw" }) })
|
|
4450
|
+
] }) : /* @__PURE__ */ jsx28(CpslSpinner10, {}) }),
|
|
4451
|
+
/* @__PURE__ */ jsx28(DisconnectButton, { variant: "destructive", fullWidth: true, onClick: handleDisconnectClick, disabled: isDisconnecting, children: isDisconnecting ? /* @__PURE__ */ jsx28(CpslSpinner10, { size: 16 }) : /* @__PURE__ */ jsxs22(Fragment14, { children: [
|
|
4241
4452
|
hideWallets ? "Logout" : "Disconnect Wallet",
|
|
4242
|
-
/* @__PURE__ */
|
|
4453
|
+
/* @__PURE__ */ jsx28(CpslIcon11, { icon: "logOut", slot: "end" })
|
|
4243
4454
|
] }) })
|
|
4244
4455
|
] }) });
|
|
4245
4456
|
};
|
|
4246
|
-
var ButtonContainer2 =
|
|
4457
|
+
var ButtonContainer2 = styled19.div`
|
|
4247
4458
|
display: flex;
|
|
4248
4459
|
align-items: center;
|
|
4249
4460
|
justify-content: center;
|
|
@@ -4251,22 +4462,22 @@ var ButtonContainer2 = styled18.div`
|
|
|
4251
4462
|
width: 100%;
|
|
4252
4463
|
height: 88px;
|
|
4253
4464
|
`;
|
|
4254
|
-
var OptionButton =
|
|
4465
|
+
var OptionButton = styled19(StyledCpslTileButton)`
|
|
4255
4466
|
flex: 1;
|
|
4256
4467
|
|
|
4257
4468
|
--button-icon-color: var(--cpsl-color-text-primary);
|
|
4258
4469
|
`;
|
|
4259
|
-
var DisconnectButton =
|
|
4470
|
+
var DisconnectButton = styled19(CpslButton16)`
|
|
4260
4471
|
--button-border-width: 0px;
|
|
4261
4472
|
`;
|
|
4262
4473
|
|
|
4263
4474
|
// src/modal/components/ExternalWalletStep/ExternalWalletStep.tsx
|
|
4264
|
-
import { CpslButton as
|
|
4475
|
+
import { CpslButton as CpslButton17, CpslIcon as CpslIcon12, CpslQrCode as CpslQrCode5, CpslSpinner as CpslSpinner11, CpslText as CpslText19 } from "@getpara/react-components";
|
|
4265
4476
|
import { useEffect as useEffect15, useMemo as useMemo10 } from "react";
|
|
4266
|
-
import
|
|
4477
|
+
import styled20 from "styled-components";
|
|
4267
4478
|
import { useCopyToClipboard as useCopyToClipboard5 } from "@getpara/react-common";
|
|
4268
|
-
import { isMobile as isMobile5, isTablet, WalletType as
|
|
4269
|
-
import { Fragment as Fragment15, jsx as
|
|
4479
|
+
import { isMobile as isMobile5, isTablet, WalletType as WalletType5 } from "@getpara/web-sdk";
|
|
4480
|
+
import { Fragment as Fragment15, jsx as jsx29, jsxs as jsxs23 } from "react/jsx-runtime";
|
|
4270
4481
|
var ExternalWalletStep = () => {
|
|
4271
4482
|
const [isCopied, copy] = useCopyToClipboard5();
|
|
4272
4483
|
const externalWalletError = useModalStore((state) => state.externalWalletError);
|
|
@@ -4289,24 +4500,24 @@ var ExternalWalletStep = () => {
|
|
|
4289
4500
|
const isWalletConnect = wallet.id === "walletConnect";
|
|
4290
4501
|
const isMobileWalletConnect = isMobile5() && isWalletConnect;
|
|
4291
4502
|
if (isMobileWalletConnect) {
|
|
4292
|
-
/* @__PURE__ */
|
|
4503
|
+
/* @__PURE__ */ jsx29(InnerStepContainer, { children: /* @__PURE__ */ jsx29(Text2, { weight: "semiBold", children: "Continue in the WalletConnect modal." }) });
|
|
4293
4504
|
}
|
|
4294
4505
|
const { showExtension, showMobile, isSolanaMobileIOS } = walletDisplayHelpers;
|
|
4295
4506
|
if (!showMobile && !showExtension || isSolanaMobileIOS && !wallet.installed) {
|
|
4296
4507
|
const text = isSolanaMobileIOS ? "Solana wallets aren't available on mobile IOS browsers.\n\nPlease continue in the wallet app." : `${wallet.name} isn't supported on mobile devices.
|
|
4297
4508
|
|
|
4298
4509
|
Please choose another wallet or continue on desktop.`;
|
|
4299
|
-
return /* @__PURE__ */
|
|
4510
|
+
return /* @__PURE__ */ jsx29(InnerStepContainer, { children: /* @__PURE__ */ jsx29(Text2, { weight: "semiBold", children: text }) });
|
|
4300
4511
|
}
|
|
4301
4512
|
if (showExtension) {
|
|
4302
4513
|
const isInstalled = wallet.installed;
|
|
4303
|
-
return /* @__PURE__ */
|
|
4304
|
-
isInstalled && !(externalWalletError == null ? void 0 : externalWalletError.length) ? /* @__PURE__ */
|
|
4305
|
-
/* @__PURE__ */
|
|
4306
|
-
/* @__PURE__ */
|
|
4514
|
+
return /* @__PURE__ */ jsxs23(InnerStepContainer, { children: [
|
|
4515
|
+
isInstalled && !(externalWalletError == null ? void 0 : externalWalletError.length) ? /* @__PURE__ */ jsx29(CenteredText, { color: "contrast", weight: "semiBold", children: `Confirm connection request in the ${wallet.name} browser extension.` }) : /* @__PURE__ */ jsxs23(ErrorContainer, { children: [
|
|
4516
|
+
/* @__PURE__ */ jsx29(ErrorIcon, { icon: "alertCircle" }),
|
|
4517
|
+
/* @__PURE__ */ jsx29(CpslText19, { weight: "semiBold", color: "error", children: isInstalled ? externalWalletError == null ? void 0 : externalWalletError[0] : `${wallet.name} not detected` })
|
|
4307
4518
|
] }),
|
|
4308
|
-
/* @__PURE__ */
|
|
4309
|
-
|
|
4519
|
+
/* @__PURE__ */ jsxs23(
|
|
4520
|
+
CpslButton17,
|
|
4310
4521
|
{
|
|
4311
4522
|
as: isInstalled ? "button" : "a",
|
|
4312
4523
|
href: (_a = wallet.downloadUrl) != null ? _a : "",
|
|
@@ -4314,7 +4525,7 @@ Please choose another wallet or continue on desktop.`;
|
|
|
4314
4525
|
variant: "secondary",
|
|
4315
4526
|
onClick: handleTryAgainClick,
|
|
4316
4527
|
children: [
|
|
4317
|
-
/* @__PURE__ */
|
|
4528
|
+
/* @__PURE__ */ jsx29(CpslIcon12, { slot: "start", icon: isInstalled ? "refresh" : "linkExternal" }),
|
|
4318
4529
|
isInstalled ? "Try Again" : `Get ${wallet.name}`
|
|
4319
4530
|
]
|
|
4320
4531
|
}
|
|
@@ -4322,15 +4533,15 @@ Please choose another wallet or continue on desktop.`;
|
|
|
4322
4533
|
] });
|
|
4323
4534
|
}
|
|
4324
4535
|
if (showMobile) {
|
|
4325
|
-
if (wallet.type ===
|
|
4326
|
-
const isInstalled = wallet.type !==
|
|
4327
|
-
return /* @__PURE__ */
|
|
4328
|
-
/* @__PURE__ */
|
|
4329
|
-
wallet.id !== "walletConnect" && /* @__PURE__ */
|
|
4330
|
-
/* @__PURE__ */
|
|
4331
|
-
/* @__PURE__ */
|
|
4536
|
+
if (wallet.type === WalletType5.SOLANA || isMobile5() && !isTablet()) {
|
|
4537
|
+
const isInstalled = wallet.type !== WalletType5.SOLANA || wallet.installed;
|
|
4538
|
+
return /* @__PURE__ */ jsxs23(Fragment15, { children: [
|
|
4539
|
+
/* @__PURE__ */ jsx29(InnerStepContainer, { children: !isInstalled && /* @__PURE__ */ jsx29(CpslText19, { weight: "semiBold", color: "error", children: `${wallet.name} not detected` }) }),
|
|
4540
|
+
wallet.id !== "walletConnect" && /* @__PURE__ */ jsxs23(InnerStepContainer, { children: [
|
|
4541
|
+
/* @__PURE__ */ jsx29(CpslButton17, { onClick: () => routeMobileExternalWallet(qrUri), fullWidth: true, children: "Connect Wallet" }),
|
|
4542
|
+
/* @__PURE__ */ jsx29(Link, { href: (_b = wallet.downloadUrl) != null ? _b : "", target: "_blank", children: /* @__PURE__ */ jsxs23(ExternalButton, { variant: "secondary", children: [
|
|
4332
4543
|
`Get ${wallet.name}`,
|
|
4333
|
-
/* @__PURE__ */
|
|
4544
|
+
/* @__PURE__ */ jsx29(ExternalIcon, { icon: "linkExternal" })
|
|
4334
4545
|
] }) })
|
|
4335
4546
|
] })
|
|
4336
4547
|
] });
|
|
@@ -4338,20 +4549,20 @@ Please choose another wallet or continue on desktop.`;
|
|
|
4338
4549
|
const openWCModal = () => __async(void 0, null, function* () {
|
|
4339
4550
|
yield connectExternalWallet(wallet, true, true);
|
|
4340
4551
|
});
|
|
4341
|
-
const GetWalletButton = /* @__PURE__ */
|
|
4552
|
+
const GetWalletButton = /* @__PURE__ */ jsxs23(ExternalButton, { variant: "secondary", onClick: isWalletConnect ? openWCModal : void 0, children: [
|
|
4342
4553
|
`${isWalletConnect ? "Open" : "Get"} ${wallet.name}`,
|
|
4343
|
-
/* @__PURE__ */
|
|
4554
|
+
/* @__PURE__ */ jsx29(ExternalIcon, { icon: "linkExternal" })
|
|
4344
4555
|
] });
|
|
4345
|
-
return /* @__PURE__ */
|
|
4346
|
-
/* @__PURE__ */
|
|
4347
|
-
/* @__PURE__ */
|
|
4348
|
-
/* @__PURE__ */
|
|
4349
|
-
/* @__PURE__ */
|
|
4350
|
-
/* @__PURE__ */
|
|
4556
|
+
return /* @__PURE__ */ jsxs23(Fragment15, { children: [
|
|
4557
|
+
/* @__PURE__ */ jsxs23(InnerStepContainer, { children: [
|
|
4558
|
+
/* @__PURE__ */ jsx29(CpslText19, { weight: "semiBold", children: "Scan with your mobile device" }),
|
|
4559
|
+
/* @__PURE__ */ jsx29(QRContainer, { children: !qrUri ? /* @__PURE__ */ jsx29(CpslSpinner11, { size: 100 }) : /* @__PURE__ */ jsx29(CpslQrCode5, { url: qrUri, imageSrc: wallet.iconUrl }) }),
|
|
4560
|
+
/* @__PURE__ */ jsxs23(CpslButton17, { size: "small", variant: "ghost", onClick: handleCopy, children: [
|
|
4561
|
+
/* @__PURE__ */ jsx29(CpslIcon12, { slot: "start", icon: isCopied ? "check" : "copy" }),
|
|
4351
4562
|
isCopied ? "Copied" : "Copy Link"
|
|
4352
4563
|
] })
|
|
4353
4564
|
] }),
|
|
4354
|
-
/* @__PURE__ */
|
|
4565
|
+
/* @__PURE__ */ jsx29(InnerStepContainer, { children: isWalletConnect ? /* @__PURE__ */ jsx29(Fragment15, { children: GetWalletButton }) : /* @__PURE__ */ jsx29(Link, { href: (_c = wallet.downloadUrl) != null ? _c : "", target: "_blank", children: GetWalletButton }) })
|
|
4355
4566
|
] });
|
|
4356
4567
|
}
|
|
4357
4568
|
}, [wallet, walletDisplayHelpers, externalWalletError, qrUri]);
|
|
@@ -4363,27 +4574,16 @@ Please choose another wallet or continue on desktop.`;
|
|
|
4363
4574
|
if (!wallet) {
|
|
4364
4575
|
return null;
|
|
4365
4576
|
}
|
|
4366
|
-
return /* @__PURE__ */
|
|
4577
|
+
return /* @__PURE__ */ jsx29(Container8, { children: Content });
|
|
4367
4578
|
};
|
|
4368
|
-
var Container8 =
|
|
4579
|
+
var Container8 = styled20(StepContainer)`
|
|
4369
4580
|
flex: 1;
|
|
4370
4581
|
justify-content: space-between;
|
|
4371
4582
|
`;
|
|
4372
|
-
var
|
|
4373
|
-
display: flex;
|
|
4374
|
-
align-items: center;
|
|
4375
|
-
justify-content: center;
|
|
4376
|
-
gap: 4px;
|
|
4377
|
-
`;
|
|
4378
|
-
var ErrorIcon = styled19(CpslIcon12)`
|
|
4379
|
-
--height: 16px;
|
|
4380
|
-
--width: 16px;
|
|
4381
|
-
--icon-color: var(--cpsl-color-text-error);
|
|
4382
|
-
`;
|
|
4383
|
-
var Text2 = styled19(CenteredText)`
|
|
4583
|
+
var Text2 = styled20(CenteredText)`
|
|
4384
4584
|
white-space: pre-line;
|
|
4385
4585
|
`;
|
|
4386
|
-
var ExternalButton =
|
|
4586
|
+
var ExternalButton = styled20(CpslButton17)`
|
|
4387
4587
|
display: flex;
|
|
4388
4588
|
gap: 8px;
|
|
4389
4589
|
align-items: center;
|
|
@@ -4393,20 +4593,20 @@ var ExternalButton = styled19(CpslButton16)`
|
|
|
4393
4593
|
margin-top: 8px;
|
|
4394
4594
|
text-decoration: none;
|
|
4395
4595
|
`;
|
|
4396
|
-
var ExternalIcon =
|
|
4596
|
+
var ExternalIcon = styled20(CpslIcon12)`
|
|
4397
4597
|
--height: 20px;
|
|
4398
4598
|
--width: 20px;
|
|
4399
4599
|
`;
|
|
4400
|
-
var Link =
|
|
4600
|
+
var Link = styled20.a`
|
|
4401
4601
|
text-decoration: none;
|
|
4402
4602
|
`;
|
|
4403
4603
|
|
|
4404
4604
|
// src/modal/components/Hero/Hero.tsx
|
|
4405
4605
|
import { CpslHero, CpslIcon as CpslIcon13, CpslIdenticon as CpslIdenticon3 } from "@getpara/react-components";
|
|
4406
|
-
import
|
|
4606
|
+
import styled21 from "styled-components";
|
|
4407
4607
|
import { useEffect as useEffect16, useState as useState13 } from "react";
|
|
4408
4608
|
import { isMobile as isMobile6 } from "@getpara/web-sdk";
|
|
4409
|
-
import { Fragment as Fragment16, jsx as
|
|
4609
|
+
import { Fragment as Fragment16, jsx as jsx30, jsxs as jsxs24 } from "react/jsx-runtime";
|
|
4410
4610
|
var getStepConfig = ({
|
|
4411
4611
|
externalWalletError
|
|
4412
4612
|
}) => {
|
|
@@ -4467,16 +4667,16 @@ var Hero = () => {
|
|
|
4467
4667
|
const { showExtension, isCosmosMobileWallet } = walletDisplayHelpers;
|
|
4468
4668
|
const shouldHide = !stepConfig || !isMobile6() && isExternalStep && !showExtension || !isMobile6() && isChainSwitchStep && isCosmosMobileWallet || !isMobile6() && isFarcasterStep;
|
|
4469
4669
|
const { variant, topOffset, spacerHeight, hideFadeOut } = stepConfig != null ? stepConfig : {};
|
|
4470
|
-
return /* @__PURE__ */
|
|
4471
|
-
/* @__PURE__ */
|
|
4472
|
-
(isExternalStep || isChainSwitchStep) && /* @__PURE__ */
|
|
4473
|
-
isFarcasterStep && /* @__PURE__ */
|
|
4474
|
-
isAccountStep && (avatar ? /* @__PURE__ */
|
|
4670
|
+
return /* @__PURE__ */ jsxs24(Fragment16, { children: [
|
|
4671
|
+
/* @__PURE__ */ jsx30(Container9, { $top: -45 + topOffset, children: shouldHide ? null : /* @__PURE__ */ jsxs24(StyledHero, { $isAccount: isAccountStep, hideFadeOut, variant, height: 480, withDefaultTheme: true, children: [
|
|
4672
|
+
(isExternalStep || isChainSwitchStep) && /* @__PURE__ */ jsx30(WalletLogo, { slot: "connectionLeft", src: connector == null ? void 0 : connector.iconUrl }),
|
|
4673
|
+
isFarcasterStep && /* @__PURE__ */ jsx30(WalletLogo, { slot: "connectionLeft", icon: "farcasterBrand" }),
|
|
4674
|
+
isAccountStep && (avatar ? /* @__PURE__ */ jsx30(Avatar, { slot: "image", src: avatar }) : activeWallet ? /* @__PURE__ */ jsx30(IconAvatar, { slot: "image", size: "100%", hash: para.getIdenticonHash(activeWallet.id, activeWallet.type) }) : null)
|
|
4475
4675
|
] }) }),
|
|
4476
|
-
!shouldHide && /* @__PURE__ */
|
|
4676
|
+
!shouldHide && /* @__PURE__ */ jsx30(Spacer, { $height: spacerHeight })
|
|
4477
4677
|
] });
|
|
4478
4678
|
};
|
|
4479
|
-
var Container9 =
|
|
4679
|
+
var Container9 = styled21.div`
|
|
4480
4680
|
display: flex;
|
|
4481
4681
|
position: absolute;
|
|
4482
4682
|
justify-content: center;
|
|
@@ -4485,22 +4685,22 @@ var Container9 = styled20.div`
|
|
|
4485
4685
|
|
|
4486
4686
|
top: ${({ $top }) => `${$top}px`};
|
|
4487
4687
|
`;
|
|
4488
|
-
var Spacer =
|
|
4688
|
+
var Spacer = styled21.div`
|
|
4489
4689
|
height: ${({ $height }) => `${$height}px`};
|
|
4490
4690
|
`;
|
|
4491
|
-
var WalletLogo =
|
|
4691
|
+
var WalletLogo = styled21(CpslIcon13)`
|
|
4492
4692
|
--height: 60px;
|
|
4493
4693
|
--width: 60px;
|
|
4494
4694
|
`;
|
|
4495
|
-
var Avatar =
|
|
4695
|
+
var Avatar = styled21.img`
|
|
4496
4696
|
width: 100%;
|
|
4497
4697
|
height: 100%;
|
|
4498
4698
|
object-fit: contain;
|
|
4499
4699
|
`;
|
|
4500
|
-
var IconAvatar =
|
|
4700
|
+
var IconAvatar = styled21(CpslIdenticon3)`
|
|
4501
4701
|
border-radius: 1000px;
|
|
4502
4702
|
`;
|
|
4503
|
-
var StyledHero =
|
|
4703
|
+
var StyledHero = styled21(CpslHero)`
|
|
4504
4704
|
${({ $isAccount }) => $isAccount && `
|
|
4505
4705
|
--ring-3-size: 560px;
|
|
4506
4706
|
--ring-2-size: 402px;
|
|
@@ -4517,8 +4717,8 @@ var StyledHero = styled20(CpslHero)`
|
|
|
4517
4717
|
// src/modal/components/Body/AnimatedHeightWrapper.tsx
|
|
4518
4718
|
import { motion as motion4 } from "framer-motion";
|
|
4519
4719
|
import { useEffect as useEffect17, useRef as useRef6, useState as useState14 } from "react";
|
|
4520
|
-
import
|
|
4521
|
-
import { jsx as
|
|
4720
|
+
import styled22 from "styled-components";
|
|
4721
|
+
import { jsx as jsx31 } from "react/jsx-runtime";
|
|
4522
4722
|
var AnimatedHeightWrapper = ({ children, className }) => {
|
|
4523
4723
|
const containerRef = useRef6(null);
|
|
4524
4724
|
const [height, setHeight] = useState14("auto");
|
|
@@ -4534,19 +4734,19 @@ var AnimatedHeightWrapper = ({ children, className }) => {
|
|
|
4534
4734
|
};
|
|
4535
4735
|
}
|
|
4536
4736
|
}, []);
|
|
4537
|
-
return /* @__PURE__ */
|
|
4737
|
+
return /* @__PURE__ */ jsx31(Container10, { className, style: { height }, animate: { height }, transition: { duration: 0.2 }, children: /* @__PURE__ */ jsx31("div", { ref: containerRef, children }) });
|
|
4538
4738
|
};
|
|
4539
|
-
var Container10 =
|
|
4739
|
+
var Container10 = styled22(motion4.div)`
|
|
4540
4740
|
overflow: hidden;
|
|
4541
4741
|
`;
|
|
4542
4742
|
|
|
4543
4743
|
// src/modal/components/ChainSwitch/ChainSwitch.tsx
|
|
4544
|
-
import { CpslButton as
|
|
4744
|
+
import { CpslButton as CpslButton18, CpslIcon as CpslIcon14, CpslQrCode as CpslQrCode6, CpslSpinner as CpslSpinner12, CpslText as CpslText20 } from "@getpara/react-components";
|
|
4545
4745
|
import { useEffect as useEffect18, useMemo as useMemo11 } from "react";
|
|
4546
|
-
import
|
|
4746
|
+
import styled23 from "styled-components";
|
|
4547
4747
|
import { useCopyToClipboard as useCopyToClipboard6 } from "@getpara/react-common";
|
|
4548
|
-
import { WalletType as
|
|
4549
|
-
import { Fragment as Fragment17, jsx as
|
|
4748
|
+
import { WalletType as WalletType6 } from "@getpara/web-sdk";
|
|
4749
|
+
import { Fragment as Fragment17, jsx as jsx32, jsxs as jsxs25 } from "react/jsx-runtime";
|
|
4550
4750
|
var ChainSwitch = () => {
|
|
4551
4751
|
const [isCopied, copy] = useCopyToClipboard6();
|
|
4552
4752
|
const externalWalletError = useModalStore((state) => state.externalWalletError);
|
|
@@ -4554,7 +4754,7 @@ var ChainSwitch = () => {
|
|
|
4554
4754
|
const setStepDirection = useModalStore((state) => state.setStepDirection);
|
|
4555
4755
|
const { switchChain, wallet, qrUri, chainIdSwitchingTo, walletDisplayHelpers } = useExternalWallets();
|
|
4556
4756
|
useEffect18(() => {
|
|
4557
|
-
if ((wallet == null ? void 0 : wallet.type) ===
|
|
4757
|
+
if ((wallet == null ? void 0 : wallet.type) === WalletType6.COSMOS) {
|
|
4558
4758
|
routeMobileExternalWallet(qrUri);
|
|
4559
4759
|
}
|
|
4560
4760
|
}, [qrUri, wallet]);
|
|
@@ -4579,25 +4779,25 @@ var ChainSwitch = () => {
|
|
|
4579
4779
|
}
|
|
4580
4780
|
const { isCosmosMobileWallet } = walletDisplayHelpers;
|
|
4581
4781
|
if (isCosmosMobileWallet) {
|
|
4582
|
-
return /* @__PURE__ */
|
|
4583
|
-
/* @__PURE__ */
|
|
4584
|
-
/* @__PURE__ */
|
|
4585
|
-
/* @__PURE__ */
|
|
4586
|
-
/* @__PURE__ */
|
|
4782
|
+
return /* @__PURE__ */ jsx32(Fragment17, { children: /* @__PURE__ */ jsxs25(InnerStepContainer, { children: [
|
|
4783
|
+
/* @__PURE__ */ jsx32(CpslText20, { weight: "semiBold", children: "Scan with your mobile device to switch networks" }),
|
|
4784
|
+
/* @__PURE__ */ jsx32(QRContainer, { children: !qrUri ? /* @__PURE__ */ jsx32(CpslSpinner12, { size: 100 }) : /* @__PURE__ */ jsx32(CpslQrCode6, { url: qrUri, imageSrc: wallet.iconUrl }) }),
|
|
4785
|
+
/* @__PURE__ */ jsxs25(CpslButton18, { size: "small", variant: "ghost", onClick: handleCopy, children: [
|
|
4786
|
+
/* @__PURE__ */ jsx32(CpslIcon14, { slot: "start", icon: isCopied ? "check" : "copy" }),
|
|
4587
4787
|
isCopied ? "Copied" : "Copy Link"
|
|
4588
4788
|
] })
|
|
4589
4789
|
] }) });
|
|
4590
4790
|
}
|
|
4591
|
-
return /* @__PURE__ */
|
|
4592
|
-
!(externalWalletError == null ? void 0 : externalWalletError.length) ? /* @__PURE__ */
|
|
4593
|
-
/* @__PURE__ */
|
|
4594
|
-
/* @__PURE__ */
|
|
4595
|
-
/* @__PURE__ */
|
|
4791
|
+
return /* @__PURE__ */ jsxs25(InnerStepContainer, { children: [
|
|
4792
|
+
!(externalWalletError == null ? void 0 : externalWalletError.length) ? /* @__PURE__ */ jsx32(CenteredText, { color: "contrast", weight: "semiBold", children: `Confirm the request to change networks in your ${wallet.name} wallet.` }) : /* @__PURE__ */ jsxs25(Fragment17, { children: [
|
|
4793
|
+
/* @__PURE__ */ jsxs25(ErrorContainer2, { children: [
|
|
4794
|
+
/* @__PURE__ */ jsx32(ErrorIcon2, { icon: "alertCircle" }),
|
|
4795
|
+
/* @__PURE__ */ jsx32(CenteredText, { weight: "semiBold", color: "error", children: externalWalletError[0] })
|
|
4596
4796
|
] }),
|
|
4597
|
-
externalWalletError[1] && /* @__PURE__ */
|
|
4797
|
+
externalWalletError[1] && /* @__PURE__ */ jsx32(CenteredText, { color: "secondary", weight: "medium", children: externalWalletError[1] })
|
|
4598
4798
|
] }),
|
|
4599
|
-
((_a = externalWalletError == null ? void 0 : externalWalletError[0]) == null ? void 0 : _a.toLowerCase()) !== NETWORK_NOT_SUPPORTED_ERROR && /* @__PURE__ */
|
|
4600
|
-
/* @__PURE__ */
|
|
4799
|
+
((_a = externalWalletError == null ? void 0 : externalWalletError[0]) == null ? void 0 : _a.toLowerCase()) !== NETWORK_NOT_SUPPORTED_ERROR && /* @__PURE__ */ jsxs25(CpslButton18, { variant: "secondary", onClick: handleTryAgainClick, children: [
|
|
4800
|
+
/* @__PURE__ */ jsx32(CpslIcon14, { slot: "start", icon: "refresh" }),
|
|
4601
4801
|
"Try Again"
|
|
4602
4802
|
] })
|
|
4603
4803
|
] });
|
|
@@ -4605,19 +4805,19 @@ var ChainSwitch = () => {
|
|
|
4605
4805
|
if (!wallet) {
|
|
4606
4806
|
return null;
|
|
4607
4807
|
}
|
|
4608
|
-
return /* @__PURE__ */
|
|
4808
|
+
return /* @__PURE__ */ jsx32(Container11, { children: Content });
|
|
4609
4809
|
};
|
|
4610
|
-
var Container11 =
|
|
4810
|
+
var Container11 = styled23(StepContainer)`
|
|
4611
4811
|
flex: 1;
|
|
4612
4812
|
justify-content: space-between;
|
|
4613
4813
|
`;
|
|
4614
|
-
var ErrorContainer2 =
|
|
4814
|
+
var ErrorContainer2 = styled23.div`
|
|
4615
4815
|
display: flex;
|
|
4616
4816
|
align-items: center;
|
|
4617
4817
|
justify-content: center;
|
|
4618
4818
|
gap: 4px;
|
|
4619
4819
|
`;
|
|
4620
|
-
var ErrorIcon2 =
|
|
4820
|
+
var ErrorIcon2 = styled23(CpslIcon14)`
|
|
4621
4821
|
--height: 16px;
|
|
4622
4822
|
--width: 16px;
|
|
4623
4823
|
--icon-color: var(--cpsl-color-text-error);
|
|
@@ -4628,21 +4828,21 @@ import { motion as motion5, AnimatePresence as AnimatePresence3 } from "framer-m
|
|
|
4628
4828
|
|
|
4629
4829
|
// src/modal/components/Controls/Controls.tsx
|
|
4630
4830
|
import { CpslIcon as CpslIcon15 } from "@getpara/react-components";
|
|
4631
|
-
import { styled as
|
|
4831
|
+
import { styled as styled25 } from "styled-components";
|
|
4632
4832
|
|
|
4633
4833
|
// src/modal/components/Controls/Selects.tsx
|
|
4634
|
-
import { CpslIdenticon as CpslIdenticon4, CpslSelect as CpslSelect2, CpslSelectItem as CpslSelectItem2, CpslText as
|
|
4635
|
-
import
|
|
4636
|
-
import { truncateAddress as truncateAddress3, WalletType as
|
|
4834
|
+
import { CpslIdenticon as CpslIdenticon4, CpslSelect as CpslSelect2, CpslSelectItem as CpslSelectItem2, CpslText as CpslText21 } from "@getpara/react-components";
|
|
4835
|
+
import styled24 from "styled-components";
|
|
4836
|
+
import { truncateAddress as truncateAddress3, WalletType as WalletType7 } from "@getpara/web-sdk";
|
|
4637
4837
|
import { useEffect as useEffect19, useRef as useRef7 } from "react";
|
|
4638
|
-
import { jsx as
|
|
4838
|
+
import { jsx as jsx33, jsxs as jsxs26 } from "react/jsx-runtime";
|
|
4639
4839
|
var getValue = (id, type) => {
|
|
4640
4840
|
return id && type ? `${id}~${type}` : void 0;
|
|
4641
4841
|
};
|
|
4642
4842
|
var WALLET_TYPES = {
|
|
4643
|
-
[
|
|
4644
|
-
[
|
|
4645
|
-
[
|
|
4843
|
+
[WalletType7.EVM]: "EVM",
|
|
4844
|
+
[WalletType7.SOLANA]: "Solana",
|
|
4845
|
+
[WalletType7.COSMOS]: "Cosmos"
|
|
4646
4846
|
};
|
|
4647
4847
|
var ChainSelect = () => {
|
|
4648
4848
|
var _a, _b;
|
|
@@ -4658,12 +4858,12 @@ var ChainSelect = () => {
|
|
|
4658
4858
|
const handleChainChange = (chainId2) => __async(void 0, null, function* () {
|
|
4659
4859
|
yield switchChain(chainId2);
|
|
4660
4860
|
});
|
|
4661
|
-
if (!activeWallet || !activeWallet.isExternal || activeWallet.type ===
|
|
4861
|
+
if (!activeWallet || !activeWallet.isExternal || activeWallet.type === WalletType7.SOLANA) {
|
|
4662
4862
|
return null;
|
|
4663
4863
|
}
|
|
4664
4864
|
const chainIdToUse = chainIdSwitchingTo != null ? chainIdSwitchingTo : chainId;
|
|
4665
4865
|
const selectedChainName = (_a = chains.find((c) => c.id.toString() === chainIdToUse)) == null ? void 0 : _a.name;
|
|
4666
|
-
return /* @__PURE__ */
|
|
4866
|
+
return /* @__PURE__ */ jsx33(Container12, { children: /* @__PURE__ */ jsx33(SelectContainer, { ref: containerRef, id: "inputContainer", children: /* @__PURE__ */ jsxs26(
|
|
4667
4867
|
StyledSelect,
|
|
4668
4868
|
{
|
|
4669
4869
|
selectedValue: (_b = chainIdToUse == null ? void 0 : chainIdToUse.toString()) != null ? _b : "",
|
|
@@ -4679,8 +4879,8 @@ var ChainSelect = () => {
|
|
|
4679
4879
|
autoWidth: true,
|
|
4680
4880
|
selectedItemVariant: "bodyXS",
|
|
4681
4881
|
children: [
|
|
4682
|
-
chainIdToUse && /* @__PURE__ */
|
|
4683
|
-
chains == null ? void 0 : chains.map((chain) => /* @__PURE__ */
|
|
4882
|
+
chainIdToUse && /* @__PURE__ */ jsx33(ChainName, { variant: "bodyXS", color: "contrast", slot: "selected-item", children: selectedChainName }),
|
|
4883
|
+
chains == null ? void 0 : chains.map((chain) => /* @__PURE__ */ jsx33(StyledSelectItem2, { slot: "items", value: chain.id.toString(), children: /* @__PURE__ */ jsx33(ChainName, { variant: "bodyXS", color: "contrast", children: chain.name }) }, chain.id))
|
|
4684
4884
|
]
|
|
4685
4885
|
}
|
|
4686
4886
|
) }) });
|
|
@@ -4698,23 +4898,24 @@ function getName(para, {
|
|
|
4698
4898
|
return hideWallets ? "My Account" : name || "My Wallet";
|
|
4699
4899
|
}
|
|
4700
4900
|
var AccountSelect = () => {
|
|
4901
|
+
var _a;
|
|
4701
4902
|
const hideWallets = useThemeStore((state) => state.hideWallets);
|
|
4702
4903
|
const para = useInternalClient();
|
|
4703
4904
|
const containerRef = useRef7(null);
|
|
4704
4905
|
const { dropdownMaxHeight, dropdownWidth, mobileAnchor, resize } = useDropdownPosition(containerRef);
|
|
4705
4906
|
const { setSelectedWallet } = useWalletState();
|
|
4706
4907
|
const activeWallet = useActiveWallet();
|
|
4707
|
-
const ActiveWalletNode = activeWallet ? /* @__PURE__ */
|
|
4708
|
-
/* @__PURE__ */
|
|
4709
|
-
/* @__PURE__ */
|
|
4710
|
-
!hideWallets && /* @__PURE__ */
|
|
4908
|
+
const ActiveWalletNode = activeWallet ? /* @__PURE__ */ jsxs26(FlexRow, { slot: "selected-item", children: [
|
|
4909
|
+
/* @__PURE__ */ jsx33(CpslIdenticon4, { variant: "avatar", size: "14px", hash: para.getIdenticonHash(activeWallet.id, activeWallet.type) }),
|
|
4910
|
+
/* @__PURE__ */ jsx33(WalletName, { variant: "bodyXS", color: "contrast", children: getName(para, __spreadProps(__spreadValues({}, activeWallet), { hideWallets })) }),
|
|
4911
|
+
!hideWallets && /* @__PURE__ */ jsx33(CpslText21, { variant: "bodyXS", color: "secondary", children: (_a = activeWallet.ensName) != null ? _a : para.getDisplayAddress(activeWallet.id, { truncate: true, addressType: activeWallet.type }) })
|
|
4711
4912
|
] }) : null;
|
|
4712
4913
|
useEffect19(() => {
|
|
4713
4914
|
if (dropdownMaxHeight && (activeWallet == null ? void 0 : activeWallet.address)) {
|
|
4714
4915
|
resize();
|
|
4715
4916
|
}
|
|
4716
4917
|
}, [activeWallet, para.availableWallets, dropdownMaxHeight]);
|
|
4717
|
-
return /* @__PURE__ */
|
|
4918
|
+
return /* @__PURE__ */ jsx33(Container12, { children: /* @__PURE__ */ jsx33(SelectContainer, { ref: containerRef, id: "addressInputContainer", children: para.availableWallets.length > 1 ? /* @__PURE__ */ jsxs26(
|
|
4718
4919
|
StyledSelect,
|
|
4719
4920
|
{
|
|
4720
4921
|
selectedValue: getValue(activeWallet == null ? void 0 : activeWallet.id, activeWallet == null ? void 0 : activeWallet.type),
|
|
@@ -4735,11 +4936,11 @@ var AccountSelect = () => {
|
|
|
4735
4936
|
para.availableWallets.map(({ address, name: _name, id, type, isExternal }) => {
|
|
4736
4937
|
const key = getValue(id, type);
|
|
4737
4938
|
const name = _name != null ? _name : getName(para, { type, isExternal, isMenu: true, hideWallets });
|
|
4738
|
-
return /* @__PURE__ */
|
|
4739
|
-
/* @__PURE__ */
|
|
4740
|
-
/* @__PURE__ */
|
|
4741
|
-
name && /* @__PURE__ */
|
|
4742
|
-
!hideWallets && /* @__PURE__ */
|
|
4939
|
+
return /* @__PURE__ */ jsx33(StyledSelectItem2, { slot: "items", value: key, children: /* @__PURE__ */ jsxs26(FlexRow, { children: [
|
|
4940
|
+
/* @__PURE__ */ jsx33(CpslIdenticon4, { size: "40px", hash: para.getIdenticonHash(id, type) }),
|
|
4941
|
+
/* @__PURE__ */ jsxs26(FlexCol, { children: [
|
|
4942
|
+
name && /* @__PURE__ */ jsx33(CpslText21, { variant: "bodyS", color: "contrast", children: name }),
|
|
4943
|
+
!hideWallets && /* @__PURE__ */ jsx33(CpslText21, { variant: "bodyXS", color: "secondary", children: truncateAddress3(address, type, { prefix: para.cosmosPrefix }) })
|
|
4743
4944
|
] })
|
|
4744
4945
|
] }) }, key);
|
|
4745
4946
|
})
|
|
@@ -4747,26 +4948,26 @@ var AccountSelect = () => {
|
|
|
4747
4948
|
}
|
|
4748
4949
|
) : ActiveWalletNode }) });
|
|
4749
4950
|
};
|
|
4750
|
-
var Container12 =
|
|
4951
|
+
var Container12 = styled24.div`
|
|
4751
4952
|
flex: 0;
|
|
4752
4953
|
width: 100%;
|
|
4753
4954
|
display: flex;
|
|
4754
4955
|
justify-content: center;
|
|
4755
4956
|
`;
|
|
4756
|
-
var FlexRow =
|
|
4957
|
+
var FlexRow = styled24.div`
|
|
4757
4958
|
display: flex;
|
|
4758
4959
|
align-items: center;
|
|
4759
4960
|
gap: 8px;
|
|
4760
4961
|
`;
|
|
4761
|
-
var FlexCol =
|
|
4962
|
+
var FlexCol = styled24.div`
|
|
4762
4963
|
display: flex;
|
|
4763
4964
|
flex-direction: column;
|
|
4764
4965
|
align-items: flex-start;
|
|
4765
4966
|
`;
|
|
4766
|
-
var WalletName =
|
|
4967
|
+
var WalletName = styled24(CpslText21)`
|
|
4767
4968
|
white-space: nowrap;
|
|
4768
4969
|
`;
|
|
4769
|
-
var SelectContainer =
|
|
4970
|
+
var SelectContainer = styled24.div`
|
|
4770
4971
|
position: relative;
|
|
4771
4972
|
display: flex;
|
|
4772
4973
|
align-items: center;
|
|
@@ -4775,7 +4976,7 @@ var SelectContainer = styled23.div`
|
|
|
4775
4976
|
background-color: var(--cpsl-color-background-8);
|
|
4776
4977
|
padding: 8px;
|
|
4777
4978
|
`;
|
|
4778
|
-
var ChainName =
|
|
4979
|
+
var ChainName = styled24(CpslText21)`
|
|
4779
4980
|
max-width: 150px;
|
|
4780
4981
|
text-transform: capitalize;
|
|
4781
4982
|
|
|
@@ -4785,7 +4986,7 @@ var ChainName = styled23(CpslText20)`
|
|
|
4785
4986
|
overflow: hidden;
|
|
4786
4987
|
}
|
|
4787
4988
|
`;
|
|
4788
|
-
var StyledSelect =
|
|
4989
|
+
var StyledSelect = styled24(CpslSelect2)`
|
|
4789
4990
|
--container-height: auto;
|
|
4790
4991
|
--container-border-width: 0px;
|
|
4791
4992
|
--container-padding-end: 0px;
|
|
@@ -4820,7 +5021,7 @@ var StyledSelect = styled23(CpslSelect2)`
|
|
|
4820
5021
|
--icon-color: var(--cpsl-color-contrast);
|
|
4821
5022
|
}
|
|
4822
5023
|
`;
|
|
4823
|
-
var StyledSelectItem2 =
|
|
5024
|
+
var StyledSelectItem2 = styled24(CpslSelectItem2)`
|
|
4824
5025
|
--outer-container-padding-start: 4px;
|
|
4825
5026
|
--outer-container-padding-end: 4px;
|
|
4826
5027
|
--outer-container-padding-top: 4px;
|
|
@@ -4829,7 +5030,7 @@ var StyledSelectItem2 = styled23(CpslSelectItem2)`
|
|
|
4829
5030
|
|
|
4830
5031
|
// src/modal/components/Controls/Controls.tsx
|
|
4831
5032
|
import { HeaderButton } from "@getpara/react-common";
|
|
4832
|
-
import { Fragment as Fragment18, jsx as
|
|
5033
|
+
import { Fragment as Fragment18, jsx as jsx34, jsxs as jsxs27 } from "react/jsx-runtime";
|
|
4833
5034
|
var Controls = ({ onClose }) => {
|
|
4834
5035
|
const bareModal = useThemeStore((state) => state.bareModal);
|
|
4835
5036
|
const hasPreviousStep = useModalStore((state) => state.hasPreviousStep());
|
|
@@ -4846,8 +5047,8 @@ var Controls = ({ onClose }) => {
|
|
|
4846
5047
|
const handleBackClick = () => {
|
|
4847
5048
|
goBack();
|
|
4848
5049
|
};
|
|
4849
|
-
return /* @__PURE__ */
|
|
4850
|
-
/* @__PURE__ */
|
|
5050
|
+
return /* @__PURE__ */ jsxs27(Container13, { children: [
|
|
5051
|
+
/* @__PURE__ */ jsx34(
|
|
4851
5052
|
BackButton,
|
|
4852
5053
|
{
|
|
4853
5054
|
variant: "ghost",
|
|
@@ -4855,17 +5056,17 @@ var Controls = ({ onClose }) => {
|
|
|
4855
5056
|
visibility: hasPreviousStep ? "visible" : "hidden"
|
|
4856
5057
|
},
|
|
4857
5058
|
onClick: handleBackClick,
|
|
4858
|
-
children: /* @__PURE__ */
|
|
5059
|
+
children: /* @__PURE__ */ jsx34(CpslIcon15, { icon: "arrow" })
|
|
4859
5060
|
}
|
|
4860
5061
|
),
|
|
4861
|
-
/* @__PURE__ */
|
|
4862
|
-
/* @__PURE__ */
|
|
4863
|
-
/* @__PURE__ */
|
|
5062
|
+
/* @__PURE__ */ jsx34(MiddleContainer, { children: shouldShowSelects && isFullyLoggedIn && /* @__PURE__ */ jsxs27(Fragment18, { children: [
|
|
5063
|
+
/* @__PURE__ */ jsx34(ChainSelect, {}),
|
|
5064
|
+
/* @__PURE__ */ jsx34(AccountSelect, {})
|
|
4864
5065
|
] }) }),
|
|
4865
|
-
/* @__PURE__ */
|
|
5066
|
+
/* @__PURE__ */ jsx34(CloseButton, { bareModal, variant: "ghost", onClick: onClose, children: /* @__PURE__ */ jsx34(CpslIcon15, { icon: "close" }) })
|
|
4866
5067
|
] });
|
|
4867
5068
|
};
|
|
4868
|
-
var Container13 =
|
|
5069
|
+
var Container13 = styled25.div`
|
|
4869
5070
|
position: absolute;
|
|
4870
5071
|
width: 100%;
|
|
4871
5072
|
top: 16px;
|
|
@@ -4876,18 +5077,18 @@ var Container13 = styled24.div`
|
|
|
4876
5077
|
justify-content: space-between;
|
|
4877
5078
|
gap: 8px;
|
|
4878
5079
|
`;
|
|
4879
|
-
var MiddleContainer =
|
|
5080
|
+
var MiddleContainer = styled25.div`
|
|
4880
5081
|
flex: 1;
|
|
4881
5082
|
display: flex;
|
|
4882
5083
|
align-items: center;
|
|
4883
5084
|
justify-content: center;
|
|
4884
5085
|
gap: 4px;
|
|
4885
5086
|
`;
|
|
4886
|
-
var CloseButton =
|
|
5087
|
+
var CloseButton = styled25(HeaderButton)`
|
|
4887
5088
|
transform: rotate(180deg);
|
|
4888
5089
|
visibility: ${({ bareModal }) => bareModal ? "hidden" : "visible"};
|
|
4889
5090
|
`;
|
|
4890
|
-
var BackButton =
|
|
5091
|
+
var BackButton = styled25(HeaderButton)`
|
|
4891
5092
|
transform: rotate(180deg);
|
|
4892
5093
|
`;
|
|
4893
5094
|
|
|
@@ -4895,12 +5096,12 @@ var BackButton = styled24(HeaderButton)`
|
|
|
4895
5096
|
import { useEffect as useEffect21, useState as useState16 } from "react";
|
|
4896
5097
|
|
|
4897
5098
|
// src/modal/components/OAuth/TelegramOAuthStep.tsx
|
|
4898
|
-
import { AuthMethod as
|
|
4899
|
-
import
|
|
5099
|
+
import { AuthMethod as AuthMethod9, OAuthMethod as OAuthMethod2 } from "@getpara/web-sdk";
|
|
5100
|
+
import styled26 from "styled-components";
|
|
4900
5101
|
import { useEffect as useEffect20, useRef as useRef8, useState as useState15 } from "react";
|
|
4901
5102
|
import { HeroSpinner } from "@getpara/react-common";
|
|
4902
|
-
import { CpslSpinner as
|
|
4903
|
-
import { jsx as
|
|
5103
|
+
import { CpslSpinner as CpslSpinner13 } from "@getpara/react-components";
|
|
5104
|
+
import { jsx as jsx35, jsxs as jsxs28 } from "react/jsx-runtime";
|
|
4904
5105
|
function TelegramOAuthStep() {
|
|
4905
5106
|
const iframe = useRef8();
|
|
4906
5107
|
const para = useInternalClient();
|
|
@@ -4908,12 +5109,12 @@ function TelegramOAuthStep() {
|
|
|
4908
5109
|
const setStep = useModalStore((state) => state.setStep);
|
|
4909
5110
|
const setAuthInfo = useUserInfoStore((state) => state.setAuthInfo);
|
|
4910
5111
|
const setBiometricLocationHints = useModalStore((state) => state.setBiometricLocationHints);
|
|
4911
|
-
const setSupportedAuthMethods = useModalStore((state) => state.setSupportedAuthMethods);
|
|
4912
5112
|
const setIFrameUrl = useModalStore((state) => state.setIFrameUrl);
|
|
4913
5113
|
const setIsIFrameReady = useModalStore((state) => state.setIsIFrameReady);
|
|
4914
5114
|
const setAuthStepRoute = useModalStore((state) => state.setAuthStepRoute);
|
|
4915
5115
|
const setWebAuthURLForCreate = useModalStore((state) => state.setWebAuthURLForCreate);
|
|
4916
5116
|
const theme = useThemeStore((state) => state.theme);
|
|
5117
|
+
const setLoginURLs = useSetLoginURLs();
|
|
4917
5118
|
const [url, setUrl] = useState15(void 0);
|
|
4918
5119
|
const [isWaiting, setIsWaiting] = useState15(false);
|
|
4919
5120
|
const [isLoaded, setIsLoaded] = useState15(false);
|
|
@@ -4947,30 +5148,38 @@ function TelegramOAuthStep() {
|
|
|
4947
5148
|
return;
|
|
4948
5149
|
}
|
|
4949
5150
|
const { telegramUserId, isNewUser, supportedAuthMethods, biometricHints } = result;
|
|
5151
|
+
const pfpUrl = authObject.photo_url;
|
|
5152
|
+
const displayName = authObject.username ? `@${authObject.username}` : authObject.first_name ? `${authObject.first_name}${authObject.last_name ? ` ${authObject.last_name}` : ""}` : `Telegram User @${telegramUserId}`;
|
|
4950
5153
|
setAuthInfo({
|
|
4951
5154
|
telegramUserId,
|
|
4952
|
-
pfpUrl
|
|
4953
|
-
displayName
|
|
5155
|
+
pfpUrl,
|
|
5156
|
+
displayName
|
|
4954
5157
|
});
|
|
4955
5158
|
if (isNewUser) {
|
|
4956
5159
|
const supportedCreateAuthMethods = yield para.getSupportedCreateAuthMethods();
|
|
4957
5160
|
setIsIFrameReady(false);
|
|
4958
5161
|
setFlow("signUp");
|
|
4959
|
-
const supportsPasskey = supportedCreateAuthMethods.has(
|
|
5162
|
+
const supportsPasskey = supportedCreateAuthMethods.has(AuthMethod9.PASSKEY);
|
|
4960
5163
|
if (supportsPasskey) {
|
|
4961
5164
|
setWebAuthURLForCreate(
|
|
4962
5165
|
yield para.shortenLoginLink(yield para.getSetUpBiometricsURL({ authType: "telegram" }))
|
|
4963
5166
|
);
|
|
4964
5167
|
setStep("BIOMETRIC_CREATION" /* BIOMETRIC_CREATION */);
|
|
4965
5168
|
}
|
|
4966
|
-
if (supportedCreateAuthMethods.has(
|
|
5169
|
+
if (supportedCreateAuthMethods.has(AuthMethod9.PASSWORD)) {
|
|
4967
5170
|
setIFrameUrl(yield para.shortenLoginLink(yield para.getSetupPasswordURL({ authType: "telegram", theme })));
|
|
4968
5171
|
setAuthStepRoute(supportsPasskey ? "BIOMETRIC_CREATION" /* BIOMETRIC_CREATION */ : "PASSWORD_CREATION" /* PASSWORD_CREATION */);
|
|
4969
5172
|
}
|
|
4970
5173
|
} else {
|
|
4971
5174
|
setFlow("login");
|
|
4972
|
-
|
|
5175
|
+
const supportedAuthMethodsSet = new Set(supportedAuthMethods);
|
|
4973
5176
|
biometricHints && setBiometricLocationHints(biometricHints);
|
|
5177
|
+
yield setLoginURLs({
|
|
5178
|
+
supportedAuthMethods: supportedAuthMethodsSet,
|
|
5179
|
+
authType: "telegram",
|
|
5180
|
+
displayName,
|
|
5181
|
+
pfpUrl
|
|
5182
|
+
});
|
|
4974
5183
|
setStep("BIOMETRIC_LOGIN" /* BIOMETRIC_LOGIN */);
|
|
4975
5184
|
}
|
|
4976
5185
|
}
|
|
@@ -4982,8 +5191,8 @@ function TelegramOAuthStep() {
|
|
|
4982
5191
|
window == null ? void 0 : window.removeEventListener("message", updateState, false);
|
|
4983
5192
|
};
|
|
4984
5193
|
}, []);
|
|
4985
|
-
return /* @__PURE__ */
|
|
4986
|
-
/* @__PURE__ */
|
|
5194
|
+
return /* @__PURE__ */ jsxs28(Container14, { children: [
|
|
5195
|
+
/* @__PURE__ */ jsx35(HeroContainer, { children: /* @__PURE__ */ jsx35(
|
|
4987
5196
|
HeroSpinner,
|
|
4988
5197
|
{
|
|
4989
5198
|
icon: "telegramBrand",
|
|
@@ -4991,18 +5200,18 @@ function TelegramOAuthStep() {
|
|
|
4991
5200
|
text: isWaiting ? "Follow the on-screen prompts." : isError ? "Login Failed" : void 0
|
|
4992
5201
|
}
|
|
4993
5202
|
) }),
|
|
4994
|
-
url && /* @__PURE__ */
|
|
4995
|
-
(!url || !isLoaded) && /* @__PURE__ */
|
|
5203
|
+
url && /* @__PURE__ */ jsx35(IFrame, { ref: iframe, style: { display: isLoaded ? "block" : "none" }, src: url, onLoad: () => setIsLoaded(true) }),
|
|
5204
|
+
(!url || !isLoaded) && /* @__PURE__ */ jsx35(CpslSpinner13, {})
|
|
4996
5205
|
] });
|
|
4997
5206
|
}
|
|
4998
|
-
var Container14 =
|
|
5207
|
+
var Container14 = styled26.div`
|
|
4999
5208
|
display: flex;
|
|
5000
5209
|
flex-direction: column;
|
|
5001
5210
|
align-items: center;
|
|
5002
5211
|
justify-content: center;
|
|
5003
5212
|
width: 100%;
|
|
5004
5213
|
`;
|
|
5005
|
-
var HeroContainer =
|
|
5214
|
+
var HeroContainer = styled26.div`
|
|
5006
5215
|
display: flex;
|
|
5007
5216
|
min-height: 276px;
|
|
5008
5217
|
flex-direction: column;
|
|
@@ -5010,17 +5219,17 @@ var HeroContainer = styled25.div`
|
|
|
5010
5219
|
gap: 16px;
|
|
5011
5220
|
flex: 1;
|
|
5012
5221
|
`;
|
|
5013
|
-
var IFrame =
|
|
5222
|
+
var IFrame = styled26.iframe`
|
|
5014
5223
|
width: 100%;
|
|
5015
5224
|
height: 52px;
|
|
5016
5225
|
border: none;
|
|
5017
5226
|
`;
|
|
5018
5227
|
|
|
5019
5228
|
// src/modal/components/AwaitingPasswordStep/AwaitingPasswordStep.tsx
|
|
5020
|
-
import { jsx as
|
|
5229
|
+
import { jsx as jsx36 } from "react/jsx-runtime";
|
|
5021
5230
|
var AwaitingPasswordStep = () => {
|
|
5022
5231
|
const isLogin = useModalStore((state) => state.isLogin());
|
|
5023
|
-
return /* @__PURE__ */
|
|
5232
|
+
return /* @__PURE__ */ jsx36(
|
|
5024
5233
|
Waiting,
|
|
5025
5234
|
{
|
|
5026
5235
|
heading: isLogin ? "Waiting for Password" : "Creating Password",
|
|
@@ -5030,18 +5239,18 @@ var AwaitingPasswordStep = () => {
|
|
|
5030
5239
|
};
|
|
5031
5240
|
|
|
5032
5241
|
// src/modal/components/IFrameStep/IFrameStep.tsx
|
|
5033
|
-
import
|
|
5242
|
+
import styled27 from "styled-components";
|
|
5034
5243
|
import { SpinnerContainer as SpinnerContainer3 } from "@getpara/react-common";
|
|
5035
|
-
import { CpslSpinner as
|
|
5036
|
-
import { jsx as
|
|
5244
|
+
import { CpslSpinner as CpslSpinner14 } from "@getpara/react-components";
|
|
5245
|
+
import { jsx as jsx37, jsxs as jsxs29 } from "react/jsx-runtime";
|
|
5037
5246
|
var IFrameStep = () => {
|
|
5038
5247
|
const iFrameUrl = useModalStore((state) => state.iFrameUrl);
|
|
5039
5248
|
const setIsReady = useModalStore((state) => state.setIsIFrameReady);
|
|
5040
5249
|
const isReady = useModalStore((state) => state.isIFrameReady);
|
|
5041
5250
|
const currentStep = useModalStore((state) => state.step);
|
|
5042
5251
|
const embeddedModal = useThemeStore((state) => state.embeddedModal);
|
|
5043
|
-
return /* @__PURE__ */
|
|
5044
|
-
/* @__PURE__ */
|
|
5252
|
+
return /* @__PURE__ */ jsxs29(OuterContainer, { $isVisible: IFrameSteps.includes(currentStep), $embeddedModal: embeddedModal, children: [
|
|
5253
|
+
/* @__PURE__ */ jsx37(Container15, { $isReady: isReady, children: /* @__PURE__ */ jsx37(
|
|
5045
5254
|
"iframe",
|
|
5046
5255
|
{
|
|
5047
5256
|
src: iFrameUrl,
|
|
@@ -5050,10 +5259,10 @@ var IFrameStep = () => {
|
|
|
5050
5259
|
}
|
|
5051
5260
|
}
|
|
5052
5261
|
) }),
|
|
5053
|
-
!isReady && /* @__PURE__ */
|
|
5262
|
+
!isReady && /* @__PURE__ */ jsx37(SpinnerContainer3, { style: { width: "100%", height: "100%", flex: 1 }, children: /* @__PURE__ */ jsx37(CpslSpinner14, { size: 100 }) })
|
|
5054
5263
|
] });
|
|
5055
5264
|
};
|
|
5056
|
-
var OuterContainer =
|
|
5265
|
+
var OuterContainer = styled27.div`
|
|
5057
5266
|
height: ${({ $isVisible }) => $isVisible ? "100%" : "0px"};
|
|
5058
5267
|
width: ${({ $isVisible }) => $isVisible ? "100%" : "0px"};
|
|
5059
5268
|
flex: ${({ $isVisible }) => $isVisible ? 1 : "auto"};
|
|
@@ -5066,7 +5275,7 @@ var OuterContainer = styled26.div`
|
|
|
5066
5275
|
padding: ${({ $embeddedModal, $isVisible }) => !$isVisible ? "0px" : $embeddedModal ? "12px 0px 0px" : "72px 16px 0px"};
|
|
5067
5276
|
}
|
|
5068
5277
|
`;
|
|
5069
|
-
var Container15 =
|
|
5278
|
+
var Container15 = styled27.div`
|
|
5070
5279
|
height: 100%;
|
|
5071
5280
|
width: 100%;
|
|
5072
5281
|
display: ${({ $isReady }) => $isReady ? "block" : "none"};
|
|
@@ -5079,7 +5288,7 @@ var Container15 = styled26.div`
|
|
|
5079
5288
|
`;
|
|
5080
5289
|
|
|
5081
5290
|
// src/modal/components/Body/Body.tsx
|
|
5082
|
-
import { Fragment as Fragment19, jsx as
|
|
5291
|
+
import { Fragment as Fragment19, jsx as jsx38, jsxs as jsxs30 } from "react/jsx-runtime";
|
|
5083
5292
|
var MIN_HEIGHT = {
|
|
5084
5293
|
["ADD_FUNDS_AWAITING" /* ADD_FUNDS_AWAITING */]: "680px"
|
|
5085
5294
|
};
|
|
@@ -5102,7 +5311,7 @@ var Body = ({ oAuthMethods, twoFactorAuthEnabled, disableEmailLogin, disablePhon
|
|
|
5102
5311
|
const Content = () => {
|
|
5103
5312
|
switch (currentStep) {
|
|
5104
5313
|
case "AUTH_MAIN" /* AUTH_MAIN */: {
|
|
5105
|
-
return /* @__PURE__ */
|
|
5314
|
+
return /* @__PURE__ */ jsx38(
|
|
5106
5315
|
AuthMainStep,
|
|
5107
5316
|
{
|
|
5108
5317
|
oAuthMethods,
|
|
@@ -5112,10 +5321,10 @@ var Body = ({ oAuthMethods, twoFactorAuthEnabled, disableEmailLogin, disablePhon
|
|
|
5112
5321
|
);
|
|
5113
5322
|
}
|
|
5114
5323
|
case "EX_WALLET_MORE" /* EX_WALLET_MORE */: {
|
|
5115
|
-
return /* @__PURE__ */
|
|
5324
|
+
return /* @__PURE__ */ jsx38(ExternalWallets, {});
|
|
5116
5325
|
}
|
|
5117
5326
|
case "AUTH_MORE" /* AUTH_MORE */: {
|
|
5118
|
-
return /* @__PURE__ */
|
|
5327
|
+
return /* @__PURE__ */ jsx38(
|
|
5119
5328
|
AuthOptions,
|
|
5120
5329
|
{
|
|
5121
5330
|
oAuthMethods,
|
|
@@ -5125,72 +5334,75 @@ var Body = ({ oAuthMethods, twoFactorAuthEnabled, disableEmailLogin, disablePhon
|
|
|
5125
5334
|
);
|
|
5126
5335
|
}
|
|
5127
5336
|
case "VERIFICATIONS" /* VERIFICATIONS */: {
|
|
5128
|
-
return /* @__PURE__ */
|
|
5337
|
+
return /* @__PURE__ */ jsx38(VerificationCodeStep, {});
|
|
5338
|
+
}
|
|
5339
|
+
case "EXTERNAL_WALLET_VERIFICATION" /* EXTERNAL_WALLET_VERIFICATION */: {
|
|
5340
|
+
return /* @__PURE__ */ jsx38(ExternalWalletVerificationStep, {});
|
|
5129
5341
|
}
|
|
5130
5342
|
case "BIOMETRIC_LOGIN" /* BIOMETRIC_LOGIN */: {
|
|
5131
|
-
return /* @__PURE__ */
|
|
5343
|
+
return /* @__PURE__ */ jsx38(BiometricLoginStep, {});
|
|
5132
5344
|
}
|
|
5133
5345
|
case "SETUP_2FA" /* SETUP_2FA */:
|
|
5134
5346
|
case "VERIFY_2FA" /* VERIFY_2FA */: {
|
|
5135
|
-
return /* @__PURE__ */
|
|
5347
|
+
return /* @__PURE__ */ jsx38(Setup2FAStep, { onClose });
|
|
5136
5348
|
}
|
|
5137
5349
|
case "LOGIN_DONE" /* LOGIN_DONE */: {
|
|
5138
|
-
return /* @__PURE__ */
|
|
5350
|
+
return /* @__PURE__ */ jsx38(LoginDoneStep, { onClose });
|
|
5139
5351
|
}
|
|
5140
5352
|
case "AWAITING_BIOMETRIC_LOGIN" /* AWAITING_BIOMETRIC_LOGIN */:
|
|
5141
5353
|
case "AWAITING_BIOMETRIC_CREATION" /* AWAITING_BIOMETRIC_CREATION */: {
|
|
5142
|
-
return /* @__PURE__ */
|
|
5354
|
+
return /* @__PURE__ */ jsx38(AwaitingBiometricsStep, {});
|
|
5143
5355
|
}
|
|
5144
5356
|
case "AWAITING_PASSWORD_LOGIN" /* AWAITING_PASSWORD_LOGIN */:
|
|
5145
5357
|
case "AWAITING_PASSWORD_CREATION" /* AWAITING_PASSWORD_CREATION */: {
|
|
5146
|
-
return /* @__PURE__ */
|
|
5358
|
+
return /* @__PURE__ */ jsx38(AwaitingPasswordStep, {});
|
|
5147
5359
|
}
|
|
5148
5360
|
case "AWAITING_WALLET_CREATION" /* AWAITING_WALLET_CREATION */: {
|
|
5149
|
-
return /* @__PURE__ */
|
|
5361
|
+
return /* @__PURE__ */ jsx38(AwaitingWalletCreationStep, {});
|
|
5150
5362
|
}
|
|
5151
5363
|
case "WALLET_CREATION_DONE" /* WALLET_CREATION_DONE */: {
|
|
5152
|
-
return /* @__PURE__ */
|
|
5364
|
+
return /* @__PURE__ */ jsx38(WalletCreationDoneStep, { twoFactorAuthEnabled, onClose });
|
|
5153
5365
|
}
|
|
5154
5366
|
case "SECRET" /* SECRET */: {
|
|
5155
|
-
return /* @__PURE__ */
|
|
5367
|
+
return /* @__PURE__ */ jsx38(RecoverySecretStep, {});
|
|
5156
5368
|
}
|
|
5157
5369
|
case "TWO_FACTOR_DONE" /* TWO_FACTOR_DONE */: {
|
|
5158
|
-
return /* @__PURE__ */
|
|
5370
|
+
return /* @__PURE__ */ jsx38(TwoFactorDoneStep, { onClose });
|
|
5159
5371
|
}
|
|
5160
5372
|
case "BIOMETRIC_CREATION" /* BIOMETRIC_CREATION */: {
|
|
5161
|
-
return /* @__PURE__ */
|
|
5373
|
+
return /* @__PURE__ */ jsx38(BiometricCreationStep, {});
|
|
5162
5374
|
}
|
|
5163
5375
|
case "AWAITING_OAUTH" /* AWAITING_OAUTH */: {
|
|
5164
|
-
return /* @__PURE__ */
|
|
5376
|
+
return /* @__PURE__ */ jsx38(AwaitingOAuthStep, {});
|
|
5165
5377
|
}
|
|
5166
5378
|
case "FARCASTER_OAUTH" /* FARCASTER_OAUTH */: {
|
|
5167
|
-
return /* @__PURE__ */
|
|
5379
|
+
return /* @__PURE__ */ jsx38(FarcasterOAuthStep_default, {});
|
|
5168
5380
|
}
|
|
5169
5381
|
case "TELEGRAM_OAUTH" /* TELEGRAM_OAUTH */: {
|
|
5170
|
-
return /* @__PURE__ */
|
|
5382
|
+
return /* @__PURE__ */ jsx38(TelegramOAuthStep, {});
|
|
5171
5383
|
}
|
|
5172
5384
|
case "ADD_FUNDS_BUY" /* ADD_FUNDS_BUY */:
|
|
5173
5385
|
case "ADD_FUNDS_RECEIVE" /* ADD_FUNDS_RECEIVE */:
|
|
5174
5386
|
case "ADD_FUNDS_WITHDRAW" /* ADD_FUNDS_WITHDRAW */: {
|
|
5175
|
-
return /* @__PURE__ */
|
|
5387
|
+
return /* @__PURE__ */ jsx38(AddFunds, {});
|
|
5176
5388
|
}
|
|
5177
5389
|
case "ADD_FUNDS_AWAITING" /* ADD_FUNDS_AWAITING */: {
|
|
5178
|
-
return /* @__PURE__ */
|
|
5390
|
+
return /* @__PURE__ */ jsx38(AddFundsAwaiting, {});
|
|
5179
5391
|
}
|
|
5180
5392
|
case "ADD_FUNDS_SUCCESS" /* ADD_FUNDS_SUCCESS */: {
|
|
5181
|
-
return /* @__PURE__ */
|
|
5393
|
+
return /* @__PURE__ */ jsx38(AddFundsDone, { isSuccess: true, onClose });
|
|
5182
5394
|
}
|
|
5183
5395
|
case "ADD_FUNDS_FAILURE" /* ADD_FUNDS_FAILURE */: {
|
|
5184
|
-
return /* @__PURE__ */
|
|
5396
|
+
return /* @__PURE__ */ jsx38(AddFundsDone, { onClose });
|
|
5185
5397
|
}
|
|
5186
5398
|
case "ACCOUNT_MAIN" /* ACCOUNT_MAIN */: {
|
|
5187
|
-
return /* @__PURE__ */
|
|
5399
|
+
return /* @__PURE__ */ jsx38(Account, { onClose });
|
|
5188
5400
|
}
|
|
5189
5401
|
case "EX_WALLET_SELECTED" /* EX_WALLET_SELECTED */: {
|
|
5190
|
-
return /* @__PURE__ */
|
|
5402
|
+
return /* @__PURE__ */ jsx38(ExternalWalletStep, {});
|
|
5191
5403
|
}
|
|
5192
5404
|
case "CHAIN_SWITCH" /* CHAIN_SWITCH */: {
|
|
5193
|
-
return /* @__PURE__ */
|
|
5405
|
+
return /* @__PURE__ */ jsx38(ChainSwitch, {});
|
|
5194
5406
|
}
|
|
5195
5407
|
default: {
|
|
5196
5408
|
if (IFrameSteps.includes(currentStep)) {
|
|
@@ -5219,13 +5431,13 @@ var Body = ({ oAuthMethods, twoFactorAuthEnabled, disableEmailLogin, disablePhon
|
|
|
5219
5431
|
break;
|
|
5220
5432
|
}
|
|
5221
5433
|
}, [currentStep]);
|
|
5222
|
-
return /* @__PURE__ */
|
|
5223
|
-
!embeddedModal && /* @__PURE__ */
|
|
5224
|
-
/* @__PURE__ */
|
|
5225
|
-
/* @__PURE__ */
|
|
5434
|
+
return /* @__PURE__ */ jsxs30(Container16, { slot: "body", "data-testid": "modal-content", children: [
|
|
5435
|
+
!embeddedModal && /* @__PURE__ */ jsxs30(Fragment19, { children: [
|
|
5436
|
+
/* @__PURE__ */ jsx38(Controls, { onClose }),
|
|
5437
|
+
/* @__PURE__ */ jsx38(Header, {})
|
|
5226
5438
|
] }),
|
|
5227
|
-
/* @__PURE__ */
|
|
5228
|
-
/* @__PURE__ */
|
|
5439
|
+
/* @__PURE__ */ jsxs30(AnimatedWrapper, { children: [
|
|
5440
|
+
/* @__PURE__ */ jsx38(
|
|
5229
5441
|
AnimatePresence3,
|
|
5230
5442
|
{
|
|
5231
5443
|
mode: "popLayout",
|
|
@@ -5234,7 +5446,7 @@ var Body = ({ oAuthMethods, twoFactorAuthEnabled, disableEmailLogin, disablePhon
|
|
|
5234
5446
|
setStepDirection(1);
|
|
5235
5447
|
},
|
|
5236
5448
|
custom: stepDirection,
|
|
5237
|
-
children: /* @__PURE__ */
|
|
5449
|
+
children: /* @__PURE__ */ jsxs30(
|
|
5238
5450
|
BodyContainer,
|
|
5239
5451
|
{
|
|
5240
5452
|
custom: stepDirection,
|
|
@@ -5244,8 +5456,8 @@ var Body = ({ oAuthMethods, twoFactorAuthEnabled, disableEmailLogin, disablePhon
|
|
|
5244
5456
|
exit: "exit",
|
|
5245
5457
|
transition: BODY_TRANSITION,
|
|
5246
5458
|
children: [
|
|
5247
|
-
/* @__PURE__ */
|
|
5248
|
-
/* @__PURE__ */
|
|
5459
|
+
/* @__PURE__ */ jsx38(Hero, {}),
|
|
5460
|
+
/* @__PURE__ */ jsxs30(
|
|
5249
5461
|
InnerContainer2,
|
|
5250
5462
|
{
|
|
5251
5463
|
$embeddedModal: embeddedModal,
|
|
@@ -5259,13 +5471,13 @@ var Body = ({ oAuthMethods, twoFactorAuthEnabled, disableEmailLogin, disablePhon
|
|
|
5259
5471
|
"ADD_FUNDS_AWAITING" /* ADD_FUNDS_AWAITING */,
|
|
5260
5472
|
"ADD_FUNDS_FAILURE" /* ADD_FUNDS_FAILURE */,
|
|
5261
5473
|
"ADD_FUNDS_SUCCESS" /* ADD_FUNDS_SUCCESS */
|
|
5262
|
-
].includes(currentStep) && isTestModeAlert && accountAddFundTab !== EnabledFlow2.RECEIVE && /* @__PURE__ */
|
|
5474
|
+
].includes(currentStep) && isTestModeAlert && accountAddFundTab !== EnabledFlow2.RECEIVE && /* @__PURE__ */ jsx38(TestModeAlert, { children: /* @__PURE__ */ jsxs30("div", { style: { fontSize: "14px" }, children: [
|
|
5263
5475
|
"This Para Modal is configured to run on-ramp services in ",
|
|
5264
|
-
/* @__PURE__ */
|
|
5476
|
+
/* @__PURE__ */ jsx38("b", { children: "test mode" }),
|
|
5265
5477
|
" only, for development purposes. If you are a user of ",
|
|
5266
5478
|
appName,
|
|
5267
5479
|
", please contact support.",
|
|
5268
|
-
/* @__PURE__ */
|
|
5480
|
+
/* @__PURE__ */ jsx38(CloseButton2, { onClick: () => setIsTestModeAlert(false), children: /* @__PURE__ */ jsx38(CloseX, { icon: "x" }) })
|
|
5269
5481
|
] }) })
|
|
5270
5482
|
]
|
|
5271
5483
|
}
|
|
@@ -5276,24 +5488,24 @@ var Body = ({ oAuthMethods, twoFactorAuthEnabled, disableEmailLogin, disablePhon
|
|
|
5276
5488
|
)
|
|
5277
5489
|
}
|
|
5278
5490
|
),
|
|
5279
|
-
/* @__PURE__ */
|
|
5491
|
+
/* @__PURE__ */ jsx38(IFrameStep, {})
|
|
5280
5492
|
] })
|
|
5281
5493
|
] });
|
|
5282
5494
|
};
|
|
5283
|
-
var Container16 =
|
|
5495
|
+
var Container16 = styled28.div`
|
|
5284
5496
|
position: relative;
|
|
5285
5497
|
`;
|
|
5286
|
-
var AnimatedWrapper =
|
|
5498
|
+
var AnimatedWrapper = styled28(AnimatedHeightWrapper)`
|
|
5287
5499
|
margin-top: -16px;
|
|
5288
5500
|
`;
|
|
5289
|
-
var BodyContainer =
|
|
5501
|
+
var BodyContainer = styled28(motion5.div)`
|
|
5290
5502
|
position: relative;
|
|
5291
5503
|
display: flex;
|
|
5292
5504
|
flex-direction: column;
|
|
5293
5505
|
gap: 24px;
|
|
5294
5506
|
will-change: auto !important;
|
|
5295
5507
|
`;
|
|
5296
|
-
var InnerContainer2 =
|
|
5508
|
+
var InnerContainer2 = styled28.div`
|
|
5297
5509
|
z-index: 1;
|
|
5298
5510
|
flex: 1;
|
|
5299
5511
|
display: flex;
|
|
@@ -5324,7 +5536,7 @@ var InnerContainer2 = styled27.div`
|
|
|
5324
5536
|
padding: 72px 16px 0px;
|
|
5325
5537
|
}
|
|
5326
5538
|
`;
|
|
5327
|
-
var TestModeAlert =
|
|
5539
|
+
var TestModeAlert = styled28(CpslAlert)`
|
|
5328
5540
|
--container-padding-end: 40px;
|
|
5329
5541
|
position: absolute;
|
|
5330
5542
|
bottom: 16px;
|
|
@@ -5332,7 +5544,7 @@ var TestModeAlert = styled27(CpslAlert)`
|
|
|
5332
5544
|
right: 16px;
|
|
5333
5545
|
z-index: 1000;
|
|
5334
5546
|
`;
|
|
5335
|
-
var CloseButton2 =
|
|
5547
|
+
var CloseButton2 = styled28.button`
|
|
5336
5548
|
background-color: transparent;
|
|
5337
5549
|
border: none;
|
|
5338
5550
|
padding: 4px;
|
|
@@ -5341,97 +5553,100 @@ var CloseButton2 = styled27.button`
|
|
|
5341
5553
|
top: 0;
|
|
5342
5554
|
right: 0;
|
|
5343
5555
|
`;
|
|
5344
|
-
var CloseX =
|
|
5556
|
+
var CloseX = styled28(CpslIcon16)`
|
|
5345
5557
|
--icon-color: var(--cpsl-color-foreground-0);
|
|
5346
5558
|
`;
|
|
5347
5559
|
|
|
5348
5560
|
// src/modal/components/Footer/Footer.tsx
|
|
5349
|
-
import { styled as
|
|
5350
|
-
import { CpslButton as
|
|
5561
|
+
import { styled as styled29 } from "styled-components";
|
|
5562
|
+
import { CpslButton as CpslButton19, CpslIcon as CpslIcon17, CpslText as CpslText22 } from "@getpara/react-components";
|
|
5351
5563
|
import { useMemo as useMemo12 } from "react";
|
|
5352
|
-
import { Fragment as Fragment20, jsx as
|
|
5564
|
+
import { Fragment as Fragment20, jsx as jsx39, jsxs as jsxs31 } from "react/jsx-runtime";
|
|
5353
5565
|
var Footer = () => {
|
|
5354
5566
|
const isAccount = useModalStore((state) => state.isAccount());
|
|
5355
5567
|
const currentStep = useModalStore((state) => state.step);
|
|
5356
5568
|
const showFooter = isAccount || getStepHasFooter(currentStep);
|
|
5357
5569
|
const Content = useMemo12(() => {
|
|
5358
5570
|
if (isAccount) {
|
|
5359
|
-
return /* @__PURE__ */
|
|
5360
|
-
/* @__PURE__ */
|
|
5571
|
+
return /* @__PURE__ */ jsxs31(ConnectContainer, { children: [
|
|
5572
|
+
/* @__PURE__ */ jsxs31(ConnectText, { variant: "bodyS", color: "secondary", weight: "medium", children: [
|
|
5361
5573
|
"Access all your wallet\u2019s features at",
|
|
5362
5574
|
" ",
|
|
5363
|
-
/* @__PURE__ */
|
|
5575
|
+
/* @__PURE__ */ jsx39("a", { href: PARA_CONNECT, target: "blank", children: /* @__PURE__ */ jsx39(ClickableText2, { variant: "bodyS", weight: "medium", children: "Para Connect" }) })
|
|
5364
5576
|
] }),
|
|
5365
|
-
/* @__PURE__ */
|
|
5577
|
+
/* @__PURE__ */ jsx39(CpslButton19, { as: "a", href: PARA_CONNECT, target: "blank", variant: "ghost", children: /* @__PURE__ */ jsx39(RightChevron, { icon: "chevronUp" }) })
|
|
5366
5578
|
] });
|
|
5367
5579
|
}
|
|
5368
|
-
return /* @__PURE__ */
|
|
5369
|
-
/* @__PURE__ */
|
|
5580
|
+
return /* @__PURE__ */ jsxs31(Fragment20, { children: [
|
|
5581
|
+
/* @__PURE__ */ jsxs31(InlineText4, { variant: "body2XS", color: "secondary", weight: "medium", children: [
|
|
5370
5582
|
"By logging in you agree to our",
|
|
5371
5583
|
" ",
|
|
5372
|
-
/* @__PURE__ */
|
|
5584
|
+
/* @__PURE__ */ jsx39("a", { href: PARA_TERMS_AND_CONDITIONS, target: "blank", children: /* @__PURE__ */ jsx39(ClickableText2, { variant: "body2XS", weight: "medium", children: "Terms & Conditions" }) })
|
|
5373
5585
|
] }),
|
|
5374
|
-
/* @__PURE__ */
|
|
5375
|
-
/* @__PURE__ */
|
|
5376
|
-
/* @__PURE__ */
|
|
5586
|
+
/* @__PURE__ */ jsxs31(PoweredByContainer, { children: [
|
|
5587
|
+
/* @__PURE__ */ jsx39(InlineText4, { variant: "bodyS", color: "secondary", weight: "medium", children: "Powered by" }),
|
|
5588
|
+
/* @__PURE__ */ jsx39(ParaLogo, { icon: "para" })
|
|
5377
5589
|
] })
|
|
5378
5590
|
] });
|
|
5379
5591
|
}, [isAccount]);
|
|
5380
5592
|
if (!showFooter) {
|
|
5381
5593
|
return null;
|
|
5382
5594
|
}
|
|
5383
|
-
return /* @__PURE__ */
|
|
5595
|
+
return /* @__PURE__ */ jsx39(FooterContainer, { slot: "footer", children: /* @__PURE__ */ jsx39(FooterContentContainer, { children: Content }) });
|
|
5384
5596
|
};
|
|
5385
|
-
var FooterContainer =
|
|
5597
|
+
var FooterContainer = styled29.div`
|
|
5386
5598
|
display: flex;
|
|
5387
5599
|
flex-direction: column;
|
|
5388
5600
|
align-items: center;
|
|
5389
5601
|
gap: 16px;
|
|
5390
5602
|
padding: 8px 0px;
|
|
5391
5603
|
`;
|
|
5392
|
-
var FooterContentContainer =
|
|
5604
|
+
var FooterContentContainer = styled29.div`
|
|
5393
5605
|
display: flex;
|
|
5394
5606
|
flex-direction: column;
|
|
5395
5607
|
align-items: center;
|
|
5396
5608
|
gap: 8px;
|
|
5397
5609
|
`;
|
|
5398
|
-
var PoweredByContainer =
|
|
5610
|
+
var PoweredByContainer = styled29.div`
|
|
5399
5611
|
display: flex;
|
|
5400
5612
|
gap: 5px;
|
|
5401
5613
|
align-items: center;
|
|
5402
5614
|
justify-content: center;
|
|
5403
5615
|
`;
|
|
5404
|
-
var ConnectContainer =
|
|
5616
|
+
var ConnectContainer = styled29.div`
|
|
5405
5617
|
display: flex;
|
|
5406
5618
|
gap: 8px;
|
|
5407
5619
|
align-items: center;
|
|
5408
5620
|
justify-content: center;
|
|
5409
5621
|
`;
|
|
5410
|
-
var RightChevron =
|
|
5622
|
+
var RightChevron = styled29(CpslIcon17)`
|
|
5411
5623
|
transform: rotate(90deg);
|
|
5412
5624
|
|
|
5413
5625
|
/* --icon-color: var(--cpsl-color-text-tertiary); */
|
|
5414
5626
|
--height: 24px;
|
|
5415
5627
|
--width: 24px;
|
|
5416
5628
|
`;
|
|
5417
|
-
var
|
|
5629
|
+
var InlineText4 = styled29(CpslText22)`
|
|
5418
5630
|
text-align: center;
|
|
5419
5631
|
display: inline-block;
|
|
5420
5632
|
`;
|
|
5421
|
-
var ConnectText =
|
|
5633
|
+
var ConnectText = styled29(InlineText4)`
|
|
5422
5634
|
line-height: 20px;
|
|
5423
5635
|
`;
|
|
5424
|
-
var ClickableText2 =
|
|
5636
|
+
var ClickableText2 = styled29(InlineText4)`
|
|
5425
5637
|
cursor: pointer;
|
|
5426
5638
|
display: inline-block;
|
|
5427
5639
|
`;
|
|
5428
|
-
var ParaLogo =
|
|
5640
|
+
var ParaLogo = styled29(CpslIcon17)`
|
|
5429
5641
|
display: inline-block;
|
|
5430
5642
|
--icon-color: var(--cpsl-color-text-secondary);
|
|
5431
5643
|
--width: 49px;
|
|
5432
5644
|
--height: auto;
|
|
5433
5645
|
`;
|
|
5434
5646
|
|
|
5647
|
+
// src/modal/hooks/useEmbeddedExternalConnection.ts
|
|
5648
|
+
import { WalletType as WalletType8 } from "@getpara/web-sdk";
|
|
5649
|
+
|
|
5435
5650
|
// src/modal/stores/externalWalletProvider/useExternalWalletProviderStore.ts
|
|
5436
5651
|
import { create as create4 } from "zustand";
|
|
5437
5652
|
|
|
@@ -5451,12 +5666,15 @@ var DEFAULT_EX_WALLET_PROVIDER_STATE = {
|
|
|
5451
5666
|
CosmosProvider: void 0,
|
|
5452
5667
|
cosmosContext: void 0,
|
|
5453
5668
|
connectParaEvmWallet: void 0,
|
|
5454
|
-
connectParaCosmosWallet: void 0
|
|
5669
|
+
connectParaCosmosWallet: void 0,
|
|
5670
|
+
fullAuthWallets: []
|
|
5455
5671
|
};
|
|
5456
5672
|
var useExternalWalletProviderStore = create4((set) => __spreadValues(__spreadValues({}, DEFAULT_EX_WALLET_PROVIDER_STATE), getActions4(set)));
|
|
5457
5673
|
|
|
5458
5674
|
// src/modal/hooks/useEmbeddedExternalConnection.ts
|
|
5459
5675
|
var useEmbeddedExternalConnection = () => {
|
|
5676
|
+
const client = useInternalClient();
|
|
5677
|
+
const { setSelectedWallet } = useWalletState();
|
|
5460
5678
|
const connectParaEvmWallet = useExternalWalletProviderStore((state) => state.connectParaEvmWallet);
|
|
5461
5679
|
const EvmProvider = useExternalWalletProviderStore((state) => state.EvmProvider);
|
|
5462
5680
|
const evmContext = useExternalWalletProviderStore((state) => state.evmContext);
|
|
@@ -5469,6 +5687,11 @@ var useEmbeddedExternalConnection = () => {
|
|
|
5469
5687
|
const { error } = yield connectParaEvmWallet();
|
|
5470
5688
|
if (error) {
|
|
5471
5689
|
console.warn("Failed to connect Para EVM wallet to Wagmi:", error);
|
|
5690
|
+
} else {
|
|
5691
|
+
const wallet = client.findWallet(void 0, void 0, { type: [WalletType8.EVM] });
|
|
5692
|
+
if (wallet) {
|
|
5693
|
+
setSelectedWallet({ id: wallet.id, type: WalletType8.EVM });
|
|
5694
|
+
}
|
|
5472
5695
|
}
|
|
5473
5696
|
} catch (err) {
|
|
5474
5697
|
console.warn("Error calling connectParaEvmWallet:", err);
|
|
@@ -5479,6 +5702,11 @@ var useEmbeddedExternalConnection = () => {
|
|
|
5479
5702
|
const { error } = yield connectParaCosmosWallet();
|
|
5480
5703
|
if (error) {
|
|
5481
5704
|
console.warn("Failed to connect Para Cosmos wallet to Graz:", error);
|
|
5705
|
+
} else {
|
|
5706
|
+
const wallet = client.findWallet(void 0, void 0, { type: [WalletType8.COSMOS] });
|
|
5707
|
+
if (wallet) {
|
|
5708
|
+
setSelectedWallet({ id: wallet.id, type: WalletType8.COSMOS });
|
|
5709
|
+
}
|
|
5482
5710
|
}
|
|
5483
5711
|
} catch (err) {
|
|
5484
5712
|
console.warn("Error calling connectParaCosmosWallet:", err);
|
|
@@ -5490,7 +5718,7 @@ var useEmbeddedExternalConnection = () => {
|
|
|
5490
5718
|
|
|
5491
5719
|
// src/modal/components/ModalContent/ModalContent.tsx
|
|
5492
5720
|
import { formatBiometricHints as formatBiometricHints2 } from "@getpara/react-common";
|
|
5493
|
-
import { Fragment as Fragment21, jsx as
|
|
5721
|
+
import { Fragment as Fragment21, jsx as jsx40, jsxs as jsxs32 } from "react/jsx-runtime";
|
|
5494
5722
|
function isRampConfig(config) {
|
|
5495
5723
|
return "hostApiKey" in config;
|
|
5496
5724
|
}
|
|
@@ -5552,6 +5780,7 @@ var ModalContent = forwardRef(
|
|
|
5552
5780
|
const formattedHints = useMemo13(() => formatBiometricHints2(biometricLocationHints), [biometricLocationHints]);
|
|
5553
5781
|
const passkeysSupported = useModalStore((state) => state.isPasskeySupported);
|
|
5554
5782
|
const [hasHints, isOnKnownDevice] = [(biometricLocationHints == null ? void 0 : biometricLocationHints.length) > 0, (_a = formattedHints == null ? void 0 : formattedHints.isOnKnownDevice) != null ? _a : false];
|
|
5783
|
+
const { disconnectExternalWallet } = useExternalWallets();
|
|
5555
5784
|
const [walletCreationInProgress, setWalletCreationInProgress] = useState17(false);
|
|
5556
5785
|
const connectEmbeddedToExternalConnectors = useEmbeddedExternalConnection();
|
|
5557
5786
|
useEffect22(() => {
|
|
@@ -5637,6 +5866,7 @@ var ModalContent = forwardRef(
|
|
|
5637
5866
|
walletIds = created.walletIds;
|
|
5638
5867
|
}
|
|
5639
5868
|
yield para.setCurrentWalletIds(walletIds);
|
|
5869
|
+
yield connectEmbeddedToExternalConnectors();
|
|
5640
5870
|
if (recoverySecretStepEnabled) {
|
|
5641
5871
|
setRecoveryShare(recoverySecret);
|
|
5642
5872
|
}
|
|
@@ -5692,6 +5922,9 @@ var ModalContent = forwardRef(
|
|
|
5692
5922
|
}, [currentStep, webAuthURLForLogin, passwordUrlForLogin]);
|
|
5693
5923
|
const handleClose = () => {
|
|
5694
5924
|
onClose();
|
|
5925
|
+
if (currentStep === "EXTERNAL_WALLET_VERIFICATION" /* EXTERNAL_WALLET_VERIFICATION */ && para.isExternalWalletAuth) {
|
|
5926
|
+
disconnectExternalWallet();
|
|
5927
|
+
}
|
|
5695
5928
|
};
|
|
5696
5929
|
useEffect22(() => {
|
|
5697
5930
|
var _a2, _b, _c;
|
|
@@ -5752,14 +5985,20 @@ var ModalContent = forwardRef(
|
|
|
5752
5985
|
}
|
|
5753
5986
|
}, [onRampTestMode]);
|
|
5754
5987
|
useEffect22(() => {
|
|
5988
|
+
const init = () => __async(void 0, null, function* () {
|
|
5989
|
+
if (!(yield para.isFullyLoggedIn())) {
|
|
5990
|
+
yield disconnectExternalWallet();
|
|
5991
|
+
}
|
|
5992
|
+
});
|
|
5993
|
+
init();
|
|
5755
5994
|
return () => {
|
|
5756
5995
|
var _a2;
|
|
5757
5996
|
window.clearTimeout((_a2 = refs.poll.current) == null ? void 0 : _a2.timeout);
|
|
5758
5997
|
para.exitLoops();
|
|
5759
5998
|
};
|
|
5760
5999
|
}, []);
|
|
5761
|
-
return /* @__PURE__ */
|
|
5762
|
-
/* @__PURE__ */
|
|
6000
|
+
return /* @__PURE__ */ jsxs32(Fragment21, { children: [
|
|
6001
|
+
/* @__PURE__ */ jsx40(
|
|
5763
6002
|
Body,
|
|
5764
6003
|
{
|
|
5765
6004
|
oAuthMethods,
|
|
@@ -5769,7 +6008,7 @@ var ModalContent = forwardRef(
|
|
|
5769
6008
|
onClose: handleClose
|
|
5770
6009
|
}
|
|
5771
6010
|
),
|
|
5772
|
-
/* @__PURE__ */
|
|
6011
|
+
/* @__PURE__ */ jsx40(Footer, {})
|
|
5773
6012
|
] });
|
|
5774
6013
|
}
|
|
5775
6014
|
);
|
|
@@ -5783,7 +6022,7 @@ import { useEffect as useEffect23, useState as useState18 } from "react";
|
|
|
5783
6022
|
|
|
5784
6023
|
// src/modal/providers/EvmExternalWalletContextStub.tsx
|
|
5785
6024
|
import { createContext as createContext2, useMemo as useMemo14 } from "react";
|
|
5786
|
-
import { jsx as
|
|
6025
|
+
import { jsx as jsx41 } from "react/jsx-runtime";
|
|
5787
6026
|
var defaultEvmExternalWallet = {
|
|
5788
6027
|
wallets: [],
|
|
5789
6028
|
chains: [],
|
|
@@ -5791,7 +6030,9 @@ var defaultEvmExternalWallet = {
|
|
|
5791
6030
|
username: void 0,
|
|
5792
6031
|
avatar: void 0,
|
|
5793
6032
|
disconnect: () => Promise.resolve(),
|
|
5794
|
-
switchChain: () => Promise.resolve({})
|
|
6033
|
+
switchChain: () => Promise.resolve({}),
|
|
6034
|
+
signMessage: () => Promise.resolve({}),
|
|
6035
|
+
signVerificationMessage: () => Promise.resolve({})
|
|
5795
6036
|
};
|
|
5796
6037
|
var EvmExternalWalletContext = createContext2(defaultEvmExternalWallet);
|
|
5797
6038
|
function EvmExternalWalletProvider({ children }) {
|
|
@@ -5802,12 +6043,24 @@ function EvmExternalWalletProvider({ children }) {
|
|
|
5802
6043
|
const avatar = void 0;
|
|
5803
6044
|
const disconnect = () => Promise.resolve();
|
|
5804
6045
|
const switchChain = () => Promise.resolve({});
|
|
5805
|
-
|
|
6046
|
+
const signMessage2 = () => Promise.resolve({});
|
|
6047
|
+
const signVerificationMessage = () => Promise.resolve({});
|
|
6048
|
+
return /* @__PURE__ */ jsx41(
|
|
5806
6049
|
EvmExternalWalletContext.Provider,
|
|
5807
6050
|
{
|
|
5808
6051
|
value: useMemo14(
|
|
5809
|
-
() => ({
|
|
5810
|
-
|
|
6052
|
+
() => ({
|
|
6053
|
+
wallets,
|
|
6054
|
+
chains,
|
|
6055
|
+
chainId,
|
|
6056
|
+
username,
|
|
6057
|
+
avatar,
|
|
6058
|
+
disconnect,
|
|
6059
|
+
switchChain,
|
|
6060
|
+
signMessage: signMessage2,
|
|
6061
|
+
signVerificationMessage
|
|
6062
|
+
}),
|
|
6063
|
+
[wallets, chains, chainId, username, avatar, disconnect, switchChain, signMessage2, signVerificationMessage]
|
|
5811
6064
|
),
|
|
5812
6065
|
children
|
|
5813
6066
|
}
|
|
@@ -5821,6 +6074,7 @@ var EvmWallet = /* @__PURE__ */ ((EvmWallet2) => {
|
|
|
5821
6074
|
EvmWallet2["COINBASE"] = "COINBASE";
|
|
5822
6075
|
EvmWallet2["WALLETCONNECT"] = "WALLETCONNECT";
|
|
5823
6076
|
EvmWallet2["ZERION"] = "ZERION";
|
|
6077
|
+
EvmWallet2["SAFE"] = "SAFE";
|
|
5824
6078
|
EvmWallet2["RABBY"] = "RABBY";
|
|
5825
6079
|
return EvmWallet2;
|
|
5826
6080
|
})(EvmWallet || {});
|
|
@@ -5839,27 +6093,42 @@ var ExternalWallet = __spreadValues(__spreadValues(__spreadValues({}, EvmWallet)
|
|
|
5839
6093
|
|
|
5840
6094
|
// src/modal/providers/SolanaExternalWalletContextStub.tsx
|
|
5841
6095
|
import { createContext as createContext3, useMemo as useMemo15 } from "react";
|
|
5842
|
-
import { jsx as
|
|
6096
|
+
import { jsx as jsx42 } from "react/jsx-runtime";
|
|
5843
6097
|
var defaultSolanaExternalWallet = {
|
|
5844
6098
|
wallets: [],
|
|
5845
|
-
disconnect: () => Promise.resolve()
|
|
6099
|
+
disconnect: () => Promise.resolve(),
|
|
6100
|
+
signMessage: () => Promise.resolve({}),
|
|
6101
|
+
signVerificationMessage: () => Promise.resolve({})
|
|
5846
6102
|
};
|
|
5847
6103
|
var SolanaExternalWalletContext = createContext3(defaultSolanaExternalWallet);
|
|
5848
6104
|
function SolanaExternalWalletProvider({ children }) {
|
|
5849
6105
|
const wallets = [];
|
|
5850
6106
|
const disconnect = () => Promise.resolve();
|
|
5851
|
-
|
|
6107
|
+
const signMessage2 = () => Promise.resolve({});
|
|
6108
|
+
const signVerificationMessage = () => Promise.resolve({});
|
|
6109
|
+
return /* @__PURE__ */ jsx42(
|
|
6110
|
+
SolanaExternalWalletContext.Provider,
|
|
6111
|
+
{
|
|
6112
|
+
value: useMemo15(
|
|
6113
|
+
() => ({ wallets, disconnect, signMessage: signMessage2, signVerificationMessage }),
|
|
6114
|
+
[wallets, disconnect, signMessage2, signVerificationMessage]
|
|
6115
|
+
),
|
|
6116
|
+
children
|
|
6117
|
+
}
|
|
6118
|
+
);
|
|
5852
6119
|
}
|
|
5853
6120
|
|
|
5854
6121
|
// src/modal/providers/CosmosExternalWalletContextStub.tsx
|
|
5855
6122
|
import { createContext as createContext4, useMemo as useMemo16 } from "react";
|
|
5856
|
-
import { jsx as
|
|
6123
|
+
import { jsx as jsx43 } from "react/jsx-runtime";
|
|
5857
6124
|
var defaultCosmosExternalWallet = {
|
|
5858
6125
|
wallets: [],
|
|
5859
6126
|
chains: [],
|
|
5860
6127
|
chainId: void 0,
|
|
5861
6128
|
disconnect: () => Promise.resolve(),
|
|
5862
|
-
switchChain: () => Promise.resolve({})
|
|
6129
|
+
switchChain: () => Promise.resolve({}),
|
|
6130
|
+
signMessage: () => Promise.resolve({}),
|
|
6131
|
+
signVerificationMessage: () => Promise.resolve({})
|
|
5863
6132
|
};
|
|
5864
6133
|
var CosmosExternalWalletContext = createContext4(defaultCosmosExternalWallet);
|
|
5865
6134
|
function CosmosExternalWalletProvider({ children }) {
|
|
@@ -5868,12 +6137,14 @@ function CosmosExternalWalletProvider({ children }) {
|
|
|
5868
6137
|
const chainId = void 0;
|
|
5869
6138
|
const disconnect = () => Promise.resolve();
|
|
5870
6139
|
const switchChain = () => Promise.resolve({});
|
|
5871
|
-
|
|
6140
|
+
const signMessage2 = () => Promise.resolve({});
|
|
6141
|
+
const signVerificationMessage = () => Promise.resolve({});
|
|
6142
|
+
return /* @__PURE__ */ jsx43(
|
|
5872
6143
|
CosmosExternalWalletContext.Provider,
|
|
5873
6144
|
{
|
|
5874
6145
|
value: useMemo16(
|
|
5875
|
-
() => ({ wallets, chains, chainId, disconnect, switchChain }),
|
|
5876
|
-
[wallets, chains, chainId, disconnect, switchChain]
|
|
6146
|
+
() => ({ wallets, chains, chainId, disconnect, switchChain, signMessage: signMessage2, signVerificationMessage }),
|
|
6147
|
+
[wallets, chains, chainId, disconnect, switchChain, signMessage2, signVerificationMessage]
|
|
5877
6148
|
),
|
|
5878
6149
|
children
|
|
5879
6150
|
}
|
|
@@ -5881,8 +6152,8 @@ function CosmosExternalWalletProvider({ children }) {
|
|
|
5881
6152
|
}
|
|
5882
6153
|
|
|
5883
6154
|
// src/modal/components/ExternalWalletsWrapper/ExternalWalletsWrapper.tsx
|
|
5884
|
-
import { jsx as
|
|
5885
|
-
var ExternalWalletsWrapper = ({ children, wallets }) => {
|
|
6155
|
+
import { jsx as jsx44 } from "react/jsx-runtime";
|
|
6156
|
+
var ExternalWalletsWrapper = ({ children, wallets, externalWalletsWithFullAuth }) => {
|
|
5886
6157
|
const para = useInternalClient();
|
|
5887
6158
|
const resetModalState = useModalStore((state) => state.resetState);
|
|
5888
6159
|
const resetUserInfoState = useUserInfoStore((state) => state.resetState);
|
|
@@ -5968,47 +6239,55 @@ var ExternalWalletsWrapper = ({ children, wallets }) => {
|
|
|
5968
6239
|
if (!para || !EvmProvider || !SolanaProvider || !CosmosProvider) {
|
|
5969
6240
|
return null;
|
|
5970
6241
|
}
|
|
5971
|
-
return /* @__PURE__ */
|
|
6242
|
+
return /* @__PURE__ */ jsx44(EvmProvider, { para, onSwitchWallet: handleSwitchWallet, children: /* @__PURE__ */ jsx44(SolanaProvider, { para, onSwitchWallet: handleSwitchWallet, children: /* @__PURE__ */ jsx44(CosmosProvider, { para, onSwitchWallet: handleSwitchWallet, children: /* @__PURE__ */ jsx44(
|
|
5972
6243
|
ExternalWalletProvider,
|
|
5973
6244
|
{
|
|
5974
6245
|
evmContext,
|
|
5975
6246
|
solanaContext,
|
|
5976
6247
|
cosmosContext,
|
|
5977
6248
|
walletSort: wallets,
|
|
6249
|
+
externalWalletsWithFullAuth,
|
|
5978
6250
|
children
|
|
5979
6251
|
}
|
|
5980
6252
|
) }) }) });
|
|
5981
6253
|
};
|
|
5982
6254
|
|
|
5983
6255
|
// src/modal/ParaModal.tsx
|
|
5984
|
-
import
|
|
5985
|
-
import {
|
|
6256
|
+
import styled30 from "styled-components";
|
|
6257
|
+
import { getExternalWalletDisplayName as getExternalWalletDisplayName2 } from "@getpara/react-common";
|
|
6258
|
+
import { jsx as jsx45 } from "react/jsx-runtime";
|
|
5986
6259
|
defineCustomElements();
|
|
5987
|
-
var ParaModal = forwardRef2(
|
|
5988
|
-
|
|
5989
|
-
|
|
5990
|
-
|
|
5991
|
-
|
|
5992
|
-
|
|
5993
|
-
|
|
5994
|
-
|
|
5995
|
-
|
|
5996
|
-
|
|
5997
|
-
|
|
5998
|
-
|
|
5999
|
-
|
|
6000
|
-
|
|
6001
|
-
|
|
6002
|
-
|
|
6003
|
-
|
|
6004
|
-
|
|
6260
|
+
var ParaModal = forwardRef2(
|
|
6261
|
+
(_a, ref) => {
|
|
6262
|
+
var _b = _a, { para, isOpen, externalWalletsWithParaAuth } = _b, rest = __objRest(_b, ["para", "isOpen", "externalWalletsWithParaAuth"]);
|
|
6263
|
+
const [isInitialized, setIsInitialized] = useState19(false);
|
|
6264
|
+
const setClient = useStore((state) => state.setClient);
|
|
6265
|
+
const client = useStore((state) => state.client);
|
|
6266
|
+
const { closeModal, openModal } = useModal();
|
|
6267
|
+
const updateExternalWalletProviderState = useExternalWalletProviderStore((state) => state.updateState);
|
|
6268
|
+
useEffect24(() => {
|
|
6269
|
+
updateExternalWalletProviderState({ fullAuthWallets: externalWalletsWithParaAuth });
|
|
6270
|
+
}, [externalWalletsWithParaAuth]);
|
|
6271
|
+
useEffect24(() => {
|
|
6272
|
+
if (!client) {
|
|
6273
|
+
setClient(para);
|
|
6274
|
+
}
|
|
6275
|
+
setIsInitialized(true);
|
|
6276
|
+
}, []);
|
|
6277
|
+
useEffect24(() => {
|
|
6278
|
+
if (!isOpen) {
|
|
6279
|
+
closeModal();
|
|
6280
|
+
}
|
|
6281
|
+
if (isOpen) {
|
|
6282
|
+
openModal();
|
|
6283
|
+
}
|
|
6284
|
+
}, [isOpen]);
|
|
6285
|
+
if (!isInitialized) {
|
|
6286
|
+
return null;
|
|
6005
6287
|
}
|
|
6006
|
-
|
|
6007
|
-
if (!isInitialized) {
|
|
6008
|
-
return null;
|
|
6288
|
+
return /* @__PURE__ */ jsx45(ParaModalInner, __spreadValues({ ref, para, externalWalletsWithParaAuth }, rest));
|
|
6009
6289
|
}
|
|
6010
|
-
|
|
6011
|
-
});
|
|
6290
|
+
);
|
|
6012
6291
|
var ParaModalInner = forwardRef2(
|
|
6013
6292
|
(_a, ref) => {
|
|
6014
6293
|
var _b = _a, {
|
|
@@ -6026,7 +6305,8 @@ var ParaModalInner = forwardRef2(
|
|
|
6026
6305
|
embeddedModal,
|
|
6027
6306
|
onModalStepChange,
|
|
6028
6307
|
hideWallets = false,
|
|
6029
|
-
onClose
|
|
6308
|
+
onClose,
|
|
6309
|
+
externalWalletsWithParaAuth
|
|
6030
6310
|
} = _b, rest = __objRest(_b, [
|
|
6031
6311
|
"theme",
|
|
6032
6312
|
"appName",
|
|
@@ -6042,7 +6322,8 @@ var ParaModalInner = forwardRef2(
|
|
|
6042
6322
|
"embeddedModal",
|
|
6043
6323
|
"onModalStepChange",
|
|
6044
6324
|
"hideWallets",
|
|
6045
|
-
"onClose"
|
|
6325
|
+
"onClose",
|
|
6326
|
+
"externalWalletsWithParaAuth"
|
|
6046
6327
|
]);
|
|
6047
6328
|
const modalContentRef = useRef9(null);
|
|
6048
6329
|
const updateThemeState = useThemeStore((state) => state.updateState);
|
|
@@ -6063,7 +6344,6 @@ var ParaModalInner = forwardRef2(
|
|
|
6063
6344
|
const resetModalState = useModalStore((state) => state.resetState);
|
|
6064
6345
|
const resetUserInfoState = useUserInfoStore((state) => state.resetState);
|
|
6065
6346
|
const setRecoveryShare = useUserInfoStore((state) => state.setRecoveryShare);
|
|
6066
|
-
const { disconnectExternalWallet } = useExternalWallets();
|
|
6067
6347
|
const { isOpen, closeModal } = useModal();
|
|
6068
6348
|
const para = useInternalClient();
|
|
6069
6349
|
const { selectedWallet, setSelectedWallet } = useWalletState();
|
|
@@ -6105,7 +6385,6 @@ var ParaModalInner = forwardRef2(
|
|
|
6105
6385
|
setWebAuthURLForCreate();
|
|
6106
6386
|
setBiometricLocationHints();
|
|
6107
6387
|
}
|
|
6108
|
-
yield disconnectExternalWallet();
|
|
6109
6388
|
setSelectedWallet({ id: void 0, type: void 0 });
|
|
6110
6389
|
setIsFullyLoggedIn(false);
|
|
6111
6390
|
}
|
|
@@ -6128,6 +6407,17 @@ var ParaModalInner = forwardRef2(
|
|
|
6128
6407
|
setStep("TELEGRAM_OAUTH" /* TELEGRAM_OAUTH */);
|
|
6129
6408
|
}
|
|
6130
6409
|
break;
|
|
6410
|
+
case para.isExternalWalletAuth:
|
|
6411
|
+
const externalWallets2 = Object.values(para.externalWallets);
|
|
6412
|
+
const externalWalletWithFullAuth = externalWallets2.find((w) => w.isExternalWithParaAuth);
|
|
6413
|
+
setAuthInfo({
|
|
6414
|
+
displayName: getExternalWalletDisplayName2({
|
|
6415
|
+
address: externalWalletWithFullAuth.address,
|
|
6416
|
+
type: externalWalletWithFullAuth.type
|
|
6417
|
+
}),
|
|
6418
|
+
externalWalletAddress: externalWalletWithFullAuth.address
|
|
6419
|
+
});
|
|
6420
|
+
break;
|
|
6131
6421
|
}
|
|
6132
6422
|
setIsInit(true);
|
|
6133
6423
|
});
|
|
@@ -6256,7 +6546,7 @@ var ParaModalInner = forwardRef2(
|
|
|
6256
6546
|
}
|
|
6257
6547
|
return null;
|
|
6258
6548
|
}
|
|
6259
|
-
return /* @__PURE__ */
|
|
6549
|
+
return /* @__PURE__ */ jsx45(ExternalWalletsWrapper, { wallets: externalWallets, externalWalletsWithFullAuth: externalWalletsWithParaAuth, children: /* @__PURE__ */ jsx45(
|
|
6260
6550
|
StyledAuthModal,
|
|
6261
6551
|
{
|
|
6262
6552
|
enterTransitionDuration: DEFAULTS.ANIMATION_DURATION,
|
|
@@ -6269,7 +6559,7 @@ var ParaModalInner = forwardRef2(
|
|
|
6269
6559
|
className,
|
|
6270
6560
|
"data-testid": "modal",
|
|
6271
6561
|
$embeddedModal: embeddedModal,
|
|
6272
|
-
children: isModalMounted && (isInit && embeddedModal || !embeddedModal) && /* @__PURE__ */
|
|
6562
|
+
children: isModalMounted && (isInit && embeddedModal || !embeddedModal) && /* @__PURE__ */ jsx45(
|
|
6273
6563
|
ModalContent,
|
|
6274
6564
|
__spreadValues({
|
|
6275
6565
|
oAuthMethods,
|
|
@@ -6282,7 +6572,7 @@ var ParaModalInner = forwardRef2(
|
|
|
6282
6572
|
) });
|
|
6283
6573
|
}
|
|
6284
6574
|
);
|
|
6285
|
-
var StyledAuthModal =
|
|
6575
|
+
var StyledAuthModal = styled30(CpslAuthModal)`
|
|
6286
6576
|
${({ $embeddedModal }) => $embeddedModal && `
|
|
6287
6577
|
&::part(modal-body-card) {
|
|
6288
6578
|
--card-box-shadow: none;
|