@getpara/react-sdk 2.0.0-alpha.3 → 2.0.0-alpha.6
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/cli/cli.mjs +1 -6
- package/dist/index.js +11 -6499
- package/dist/modal/ParaModal.js +262 -0
- package/dist/modal/components/Account/Account.js +139 -0
- package/dist/modal/components/AddFunds/AddFunds.d.ts +0 -2
- package/dist/modal/components/AddFunds/AddFunds.js +69 -0
- package/dist/modal/components/AddFunds/AddFundsAsset.d.ts +1 -0
- package/dist/modal/components/AddFunds/AddFundsAsset.js +125 -0
- package/dist/modal/components/AddFunds/AddFundsAwaiting.js +78 -0
- package/dist/modal/components/AddFunds/AddFundsContext.d.ts +31 -0
- package/dist/modal/components/AddFunds/AddFundsContext.js +160 -0
- package/dist/modal/components/AddFunds/AddFundsDone.js +49 -0
- package/dist/modal/components/AddFunds/AddFundsProvider.d.ts +1 -0
- package/dist/modal/components/AddFunds/AddFundsProvider.js +109 -0
- package/dist/modal/components/AddFunds/AddFundsReceive.d.ts +1 -0
- package/dist/modal/components/AddFunds/AddFundsReceive.js +83 -0
- package/dist/modal/components/AddFunds/AddFundsSettings.d.ts +1 -0
- package/dist/modal/components/AddFunds/AddFundsSettings.js +237 -0
- package/dist/{MoonPayEmbed-Q2HP2BFI.js → modal/components/AddFunds/MoonPayEmbed.js} +1 -3
- package/dist/modal/components/AddFunds/common.d.ts +19 -0
- package/dist/modal/components/AddFunds/common.js +24 -0
- package/dist/modal/components/AddFunds/index.js +4 -0
- package/dist/modal/components/AuthInput/AuthInput.js +262 -0
- package/dist/modal/components/AuthInput/hooks/useDropdownPosition.js +33 -0
- package/dist/modal/components/AuthInput/phoneMasks.js +253 -0
- package/dist/modal/components/AuthMainStep/AuthMainStep.d.ts +4 -3
- package/dist/modal/components/AuthMainStep/AuthMainStep.js +50 -0
- package/dist/modal/components/AuthMainStep/AuthMainStepContent.d.ts +4 -3
- package/dist/modal/components/AuthMainStep/AuthMainStepContent.js +157 -0
- package/dist/modal/components/AuthOptions/AuthOptions.d.ts +4 -3
- package/dist/modal/components/AuthOptions/AuthOptions.js +67 -0
- package/dist/modal/components/AwaitingBiometricsStep/AwaitingBiometricsStep.js +18 -0
- package/dist/modal/components/AwaitingOAuthStep/AwaitingOAuthStep.js +10 -0
- package/dist/modal/components/AwaitingPasswordStep/AwaitingPasswordStep.js +18 -0
- package/dist/modal/components/AwaitingWalletCreationStep/AwaitingWalletCreationStep.d.ts +5 -1
- package/dist/modal/components/AwaitingWalletCreationStep/AwaitingWalletCreationStep.js +49 -0
- package/dist/modal/components/BiometricCreationStep/BiometricCreationStep.js +63 -0
- package/dist/modal/components/BiometricLoginStep/BiometricLoginStep.js +55 -0
- package/dist/modal/components/Body/AnimatedHeightWrapper.js +29 -0
- package/dist/modal/components/Body/Body.d.ts +4 -3
- package/dist/modal/components/Body/Body.js +327 -0
- package/dist/modal/components/ChainSwitch/ChainSwitch.js +95 -0
- package/dist/modal/components/ChainSwitch/config.js +17 -0
- package/dist/modal/components/Controls/Controls.js +77 -0
- package/dist/modal/components/Controls/Selects.js +189 -0
- package/dist/modal/components/ExternalWalletStep/ExternalWalletStep.js +144 -0
- package/dist/modal/components/ExternalWalletStep/config.js +17 -0
- package/dist/modal/components/ExternalWalletVerificationStep/ExternalWalletVerificationStep.js +34 -0
- package/dist/modal/components/ExternalWallets/ExternalWallets.js +173 -0
- package/dist/modal/components/Footer/Footer.js +95 -0
- package/dist/modal/components/Header/Header.js +43 -0
- package/dist/modal/components/Header/hooks/useStepTitle.js +54 -0
- package/dist/modal/components/Hero/Hero.js +116 -0
- package/dist/modal/components/IFrameStep/IFrameStep.js +59 -0
- package/dist/modal/components/LoginDoneStep/LoginDoneStep.js +31 -0
- package/dist/modal/components/ModalContent/ModalContent.js +95 -0
- package/dist/modal/components/OAuth/FarcasterOAuthStep.js +27 -0
- package/dist/modal/components/OAuth/OAuth.d.ts +2 -2
- package/dist/modal/components/OAuth/OAuth.js +79 -0
- package/dist/modal/components/OAuth/TelegramOAuthStep.js +90 -0
- package/dist/modal/components/OnRampComponents/AddingFunds.js +23 -0
- package/dist/modal/components/OnRampComponents/OnRampProviderButton.js +77 -0
- package/dist/modal/components/RecoverySecretStep/RecoverySecretStep.js +107 -0
- package/dist/modal/components/Setup2FAStep/Setup2FAStep.js +132 -0
- package/dist/modal/components/StripeComponents/StripeComponents.js +88 -0
- package/dist/modal/components/TwoFactorDoneStep/TwoFactorDoneStep.js +27 -0
- package/dist/modal/components/VerificationCodeStep/VerificationCodeStep.js +143 -0
- package/dist/modal/components/Waiting/Waiting.js +17 -0
- package/dist/modal/components/WalletCard/PartnerIcon.js +34 -0
- package/dist/modal/components/WalletCard/WalletCard.d.ts +3 -3
- package/dist/modal/components/WalletCard/WalletCard.js +128 -0
- package/dist/modal/components/WalletCreationDoneStep/WalletCreationDoneStep.js +73 -0
- package/dist/modal/components/common.d.ts +32 -13
- package/dist/modal/components/common.js +175 -0
- package/dist/modal/components/index.js +2 -0
- package/dist/modal/constants/constants.d.ts +9 -2
- package/dist/modal/constants/constants.js +138 -0
- package/dist/modal/constants/defaults.js +10 -0
- package/dist/modal/constants/oAuthLogos.d.ts +3 -3
- package/dist/modal/constants/oAuthLogos.js +24 -0
- package/dist/modal/hooks/useGoBack.js +43 -0
- package/dist/modal/index.d.ts +1 -2
- package/dist/modal/index.js +29 -0
- package/dist/modal/stores/index.js +2 -0
- package/dist/modal/stores/modal/actions.js +133 -0
- package/dist/modal/stores/modal/useModalStore.d.ts +12 -4
- package/dist/modal/stores/modal/useModalStore.js +68 -0
- package/dist/modal/types/commonTypes.d.ts +0 -47
- package/dist/modal/types/commonTypes.js +1 -0
- package/dist/modal/types/externalWallets.d.ts +2 -0
- package/dist/modal/types/externalWallets.js +32 -0
- package/dist/modal/types/modalProps.d.ts +10 -2
- package/dist/modal/types/modalProps.js +12 -0
- package/dist/modal/utils/authInputHelpers.d.ts +7 -0
- package/dist/modal/utils/authInputHelpers.js +38 -0
- package/dist/modal/utils/authLayoutHelpers.js +8 -0
- package/dist/modal/utils/countryCodes.js +45 -0
- package/dist/modal/utils/getMailtoLink.js +10 -0
- package/dist/modal/utils/getTileButtonFlex.js +20 -0
- package/dist/modal/utils/isPasskeySupported.js +15 -0
- package/dist/modal/utils/openPopup.js +60 -0
- package/dist/modal/utils/routeMobileExternalWallet.js +31 -0
- package/dist/modal/utils/steps.d.ts +6 -0
- package/dist/modal/utils/steps.js +247 -0
- package/dist/modal/utils/stringFormatters.d.ts +1 -0
- package/dist/modal/utils/stringFormatters.js +19 -0
- package/dist/modal/utils/validateOnRampConfig.js +32 -0
- package/dist/package.json +6 -0
- package/dist/provider/ParaProvider.js +83 -0
- package/dist/provider/actions/getAccount.d.ts +8 -1
- package/dist/provider/actions/getAccount.js +51 -0
- package/dist/provider/actions/getWallet.d.ts +2 -2
- package/dist/provider/actions/getWallet.js +14 -0
- package/dist/provider/actions/index.d.ts +2 -0
- package/dist/provider/actions/index.js +59 -0
- package/dist/provider/actions/utils.js +15 -0
- package/dist/provider/components/CosmosWalletWrapper.js +34 -0
- package/dist/provider/components/EvmWalletWrapper.js +34 -0
- package/dist/provider/components/ExternalWalletWrapper.js +139 -0
- package/dist/provider/components/SolanaWalletWrapper.js +36 -0
- package/dist/provider/external/getParaCosmosConnector.js +22 -0
- package/dist/provider/external/getParaEvmConnector.js +22 -0
- package/dist/provider/external/getParaSolanaConnector.js +22 -0
- package/dist/provider/external/stubs/CosmosExternalWalletContextStub.js +18 -0
- package/dist/provider/external/stubs/EvmExternalWalletContextStub.js +21 -0
- package/dist/provider/external/stubs/SolanaExternalWalletContextStub.js +14 -0
- package/dist/provider/hooks/index.js +4 -0
- package/dist/provider/hooks/mutations/index.d.ts +1 -0
- package/dist/provider/hooks/mutations/index.js +61 -0
- package/dist/provider/hooks/mutations/utils.js +22 -0
- package/dist/provider/hooks/queries/index.d.ts +1 -0
- package/dist/provider/hooks/queries/index.js +10 -0
- package/dist/provider/hooks/queries/useAccount.js +21 -0
- package/dist/provider/hooks/queries/useWallet.js +22 -0
- package/dist/provider/hooks/queries/useWalletBalance.d.ts +6 -0
- package/dist/provider/hooks/queries/useWalletBalance.js +55 -0
- package/dist/provider/hooks/utils/index.js +10 -0
- package/dist/provider/hooks/utils/useAutoSessionKeepAlive.js +74 -0
- package/dist/provider/hooks/utils/useClient.js +10 -0
- package/dist/provider/hooks/utils/useEventListeners.d.ts +1 -1
- package/dist/provider/hooks/utils/useEventListeners.js +147 -0
- package/dist/provider/hooks/utils/useInternalClient.js +10 -0
- package/dist/provider/hooks/utils/useModal.js +17 -0
- package/dist/provider/hooks/utils/useWalletState.d.ts +3 -3
- package/dist/provider/hooks/utils/useWalletState.js +48 -0
- package/dist/provider/index.js +9 -0
- package/dist/provider/providers/AuthProvider.d.ts +10 -6
- package/dist/provider/providers/AuthProvider.js +498 -0
- package/dist/provider/providers/CosmosExternalWalletProvider.js +66 -0
- package/dist/provider/providers/EvmExternalWalletProvider.js +74 -0
- package/dist/provider/providers/ExternalWalletProvider.d.ts +5 -2
- package/dist/provider/providers/ExternalWalletProvider.js +428 -0
- package/dist/provider/providers/SolanaExternalWalletProvider.js +66 -0
- package/dist/provider/stores/getters.d.ts +1 -1
- package/dist/provider/stores/getters.js +13 -0
- package/dist/provider/stores/setters.js +7 -0
- package/dist/provider/stores/slices/client.js +9 -0
- package/dist/provider/stores/slices/config.js +9 -0
- package/dist/provider/stores/slices/externalWallets.js +40 -0
- package/dist/provider/stores/slices/index.js +5 -0
- package/dist/provider/stores/slices/modal.js +16 -0
- package/dist/provider/stores/slices/wallet.js +13 -0
- package/dist/provider/stores/types.d.ts +7 -4
- package/dist/provider/stores/types.js +1 -0
- package/dist/provider/stores/useStore.js +28 -0
- package/dist/provider/types/externalWalletProviders.d.ts +2 -2
- package/dist/provider/types/externalWalletProviders.js +1 -0
- package/dist/provider/types/provider.d.ts +9 -3
- package/dist/provider/types/provider.js +1 -0
- package/dist/provider/types/query.js +1 -0
- package/dist/provider/types/utils.js +1 -0
- package/dist/provider/utils/constants.d.ts +5 -0
- package/dist/provider/utils/constants.js +10 -0
- package/dist/provider/utils/paraConfigTypeGuards.js +13 -0
- package/dist/provider/utils/renameMutations.js +18 -0
- package/package.json +18 -16
- package/dist/MoonPayEmbed-Q2HP2BFI.js.br +0 -0
- package/dist/MoonPayEmbed-Q2HP2BFI.js.gz +0 -0
- package/dist/chunk-MMUBH76A.js.br +0 -0
- package/dist/chunk-MMUBH76A.js.gz +0 -0
- package/dist/index.js.br +0 -0
- package/dist/index.js.gz +0 -0
- /package/dist/modal/{components/AuthInput → utils}/countryCodes.d.ts +0 -0
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { IconType } from '@getpara/react-components';
|
|
2
|
-
import {
|
|
2
|
+
import { TOAuthMethod } from '@getpara/web-sdk';
|
|
3
3
|
export declare const brandedOAuthLogos: {
|
|
4
|
-
[key in
|
|
4
|
+
[key in TOAuthMethod]: IconType;
|
|
5
5
|
};
|
|
6
6
|
export declare const oAuthLogos: {
|
|
7
|
-
[key in
|
|
7
|
+
[key in TOAuthMethod]: IconType;
|
|
8
8
|
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import "../../chunk-MMUBH76A.js";
|
|
3
|
+
const brandedOAuthLogos = {
|
|
4
|
+
GOOGLE: "googleBrand",
|
|
5
|
+
TWITTER: "twitter",
|
|
6
|
+
APPLE: "apple",
|
|
7
|
+
DISCORD: "discordBrand",
|
|
8
|
+
FACEBOOK: "facebookBrand",
|
|
9
|
+
FARCASTER: "farcasterBrand",
|
|
10
|
+
TELEGRAM: "telegramBrand"
|
|
11
|
+
};
|
|
12
|
+
const oAuthLogos = {
|
|
13
|
+
GOOGLE: "google",
|
|
14
|
+
TWITTER: "twitter",
|
|
15
|
+
APPLE: "apple",
|
|
16
|
+
DISCORD: "discord",
|
|
17
|
+
FACEBOOK: "facebook",
|
|
18
|
+
FARCASTER: "farcaster",
|
|
19
|
+
TELEGRAM: "telegram"
|
|
20
|
+
};
|
|
21
|
+
export {
|
|
22
|
+
brandedOAuthLogos,
|
|
23
|
+
oAuthLogos
|
|
24
|
+
};
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import "../../chunk-MMUBH76A.js";
|
|
3
|
+
import { useInternalClient } from "../../provider/hooks/utils/useInternalClient.js";
|
|
4
|
+
import { useExternalWallets } from "../../provider/providers/ExternalWalletProvider.js";
|
|
5
|
+
import { useModalStore } from "../stores/index.js";
|
|
6
|
+
import { getAddFundsStep, ModalStep } from "../utils/steps.js";
|
|
7
|
+
const useGoBack = () => {
|
|
8
|
+
const currentStep = useModalStore((state) => state.step);
|
|
9
|
+
const refs = useModalStore((state) => state.refs);
|
|
10
|
+
const setStep = useModalStore((state) => state.setStep);
|
|
11
|
+
const accountAddFundTab = useModalStore((state) => state.accountAddFundTab);
|
|
12
|
+
const decrementStep = useModalStore((state) => state.decrementStep);
|
|
13
|
+
const resetState = useModalStore((state) => state.resetState);
|
|
14
|
+
const { setChainIdSwitchingTo, disconnectExternalWallet } = useExternalWallets();
|
|
15
|
+
const para = useInternalClient();
|
|
16
|
+
const goBack = () => {
|
|
17
|
+
if (accountAddFundTab && currentStep === ModalStep.ADD_FUNDS_AWAITING) {
|
|
18
|
+
setStep(getAddFundsStep(accountAddFundTab));
|
|
19
|
+
} else {
|
|
20
|
+
decrementStep();
|
|
21
|
+
}
|
|
22
|
+
switch (refs.currentStep.current) {
|
|
23
|
+
case ModalStep.AUTH_MAIN:
|
|
24
|
+
case ModalStep.AUTH_MORE:
|
|
25
|
+
case ModalStep.EX_WALLET_SELECTED:
|
|
26
|
+
case ModalStep.EXTERNAL_WALLET_VERIFICATION: {
|
|
27
|
+
resetState();
|
|
28
|
+
if (para.isExternalWalletAuth) {
|
|
29
|
+
disconnectExternalWallet();
|
|
30
|
+
}
|
|
31
|
+
break;
|
|
32
|
+
}
|
|
33
|
+
case ModalStep.CHAIN_SWITCH: {
|
|
34
|
+
setChainIdSwitchingTo();
|
|
35
|
+
break;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
return goBack;
|
|
40
|
+
};
|
|
41
|
+
export {
|
|
42
|
+
useGoBack
|
|
43
|
+
};
|
package/dist/modal/index.d.ts
CHANGED
|
@@ -3,7 +3,6 @@ export type { ParaModalProps, ParaModalHandle, ParaModalTheme } from './types/mo
|
|
|
3
3
|
export { ModalStep, type ModalStepProp } from './utils/steps.js';
|
|
4
4
|
export { AuthLayout } from './types/modalProps.js';
|
|
5
5
|
export * from './utils/openPopup.js';
|
|
6
|
-
export { ON_RAMP_PROVIDERS, ON_RAMP_ASSETS, NETWORKS, getAssetIcon,
|
|
6
|
+
export { ON_RAMP_PROVIDERS, ON_RAMP_ASSETS, NETWORKS, getAssetIcon, getAssetCode, getNetworkIcon, getNetworkName, } from './constants/constants.js';
|
|
7
7
|
export { SaveRecoverySecret } from './components/RecoverySecretStep/RecoverySecretStep.js';
|
|
8
8
|
export * from './utils/validateOnRampConfig.js';
|
|
9
|
-
export * from './types/externalWallets.js';
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import "../chunk-MMUBH76A.js";
|
|
3
|
+
export * from "./ParaModal.js";
|
|
4
|
+
import { ModalStep } from "./utils/steps.js";
|
|
5
|
+
import { AuthLayout } from "./types/modalProps.js";
|
|
6
|
+
export * from "./utils/openPopup.js";
|
|
7
|
+
import {
|
|
8
|
+
ON_RAMP_PROVIDERS,
|
|
9
|
+
ON_RAMP_ASSETS,
|
|
10
|
+
NETWORKS,
|
|
11
|
+
getAssetIcon,
|
|
12
|
+
getAssetCode,
|
|
13
|
+
getNetworkIcon,
|
|
14
|
+
getNetworkName
|
|
15
|
+
} from "./constants/constants.js";
|
|
16
|
+
import { SaveRecoverySecret } from "./components/RecoverySecretStep/RecoverySecretStep.js";
|
|
17
|
+
export * from "./utils/validateOnRampConfig.js";
|
|
18
|
+
export {
|
|
19
|
+
AuthLayout,
|
|
20
|
+
ModalStep,
|
|
21
|
+
NETWORKS,
|
|
22
|
+
ON_RAMP_ASSETS,
|
|
23
|
+
ON_RAMP_PROVIDERS,
|
|
24
|
+
SaveRecoverySecret,
|
|
25
|
+
getAssetCode,
|
|
26
|
+
getAssetIcon,
|
|
27
|
+
getNetworkIcon,
|
|
28
|
+
getNetworkName
|
|
29
|
+
};
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import {
|
|
3
|
+
__spreadValues
|
|
4
|
+
} from "../../../chunk-MMUBH76A.js";
|
|
5
|
+
import { DEFAULT_MODAL_STATE } from "./useModalStore.js";
|
|
6
|
+
import {
|
|
7
|
+
AccountPreviousStep,
|
|
8
|
+
GuestPreviousStep,
|
|
9
|
+
LoginPreviousStep,
|
|
10
|
+
ModalStep,
|
|
11
|
+
SignUpPreviousStep
|
|
12
|
+
} from "../../utils/steps.js";
|
|
13
|
+
function getPreviousStep(flow, step) {
|
|
14
|
+
return flow === "account" ? AccountPreviousStep[step] : flow === "login" ? LoginPreviousStep[step] : flow === "guest" ? GuestPreviousStep[step] : SignUpPreviousStep[step];
|
|
15
|
+
}
|
|
16
|
+
const getActions = (set, get) => ({
|
|
17
|
+
resetState: () => set(DEFAULT_MODAL_STATE),
|
|
18
|
+
setOnModalStepChange: (onModalStepChange) => set({ onModalStepChange }),
|
|
19
|
+
setRecoveryShare: (recoveryShare) => set({ recoveryShare }),
|
|
20
|
+
setStep: (step) => {
|
|
21
|
+
const onModalStepChange = get().onModalStepChange;
|
|
22
|
+
const previousStep = get().step;
|
|
23
|
+
set({ step });
|
|
24
|
+
onModalStepChange == null ? void 0 : onModalStepChange({ previousStep, currentStep: step, canGoBack: get().hasPreviousStep() });
|
|
25
|
+
},
|
|
26
|
+
decrementStep: () => {
|
|
27
|
+
var _a;
|
|
28
|
+
const currentStep = get().step;
|
|
29
|
+
const onRampStep = get().onRampStep;
|
|
30
|
+
const flow = get().flow;
|
|
31
|
+
if ([ModalStep.ADD_FUNDS_BUY, ModalStep.ADD_FUNDS_WITHDRAW].includes(currentStep) && onRampStep > 0) {
|
|
32
|
+
set({ onRampStep: onRampStep - 1 });
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
if (!flow) {
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
const onModalStepChange = get().onModalStepChange;
|
|
39
|
+
const signupState = get().getSignupState();
|
|
40
|
+
const iFrameUrl = get().iFrameUrl;
|
|
41
|
+
const refs = get().refs;
|
|
42
|
+
let prevStep = getPreviousStep(flow, currentStep);
|
|
43
|
+
if (currentStep === ModalStep.PASSWORD_CREATION && iFrameUrl && !(signupState == null ? void 0 : signupState.passkeyUrl)) {
|
|
44
|
+
prevStep = ModalStep.AUTH_MAIN;
|
|
45
|
+
}
|
|
46
|
+
if (currentStep === ModalStep.EX_WALLET_SELECTED) {
|
|
47
|
+
set({ selectedExternalWalletId: void 0, isExternalWalletConnecting: false, externalWalletError: void 0 });
|
|
48
|
+
}
|
|
49
|
+
if (prevStep) {
|
|
50
|
+
set(__spreadValues({
|
|
51
|
+
authStepRoute: void 0,
|
|
52
|
+
step: prevStep,
|
|
53
|
+
stepDirection: -1
|
|
54
|
+
}, prevStep === ModalStep.AUTH_MAIN && { flow: void 0 }));
|
|
55
|
+
onModalStepChange == null ? void 0 : onModalStepChange({ previousStep: currentStep, currentStep: prevStep, canGoBack: get().hasPreviousStep() });
|
|
56
|
+
}
|
|
57
|
+
(_a = refs.popupWindow.current) == null ? void 0 : _a.close();
|
|
58
|
+
refs.popupWindow.current = null;
|
|
59
|
+
},
|
|
60
|
+
hasPreviousStep: () => {
|
|
61
|
+
const flow = get().flow;
|
|
62
|
+
const currentStep = get().step;
|
|
63
|
+
const onRampStep = get().onRampStep;
|
|
64
|
+
if ([ModalStep.ADD_FUNDS_BUY, ModalStep.ADD_FUNDS_WITHDRAW].includes(currentStep) && onRampStep > 0) {
|
|
65
|
+
return true;
|
|
66
|
+
}
|
|
67
|
+
return !!flow && !!getPreviousStep(flow, currentStep);
|
|
68
|
+
},
|
|
69
|
+
setFlow: (flow) => set({ flow }),
|
|
70
|
+
isLogin: () => get().flow === "login",
|
|
71
|
+
isAccount: () => get().flow === "account",
|
|
72
|
+
setAuthState: (authState) => {
|
|
73
|
+
let flow = get().flow, newFlow;
|
|
74
|
+
switch (authState == null ? void 0 : authState.stage) {
|
|
75
|
+
case "login":
|
|
76
|
+
newFlow = "login";
|
|
77
|
+
break;
|
|
78
|
+
case "signup":
|
|
79
|
+
case "verify":
|
|
80
|
+
newFlow = flow === "guest" ? "guest" : "signup";
|
|
81
|
+
break;
|
|
82
|
+
default:
|
|
83
|
+
break;
|
|
84
|
+
}
|
|
85
|
+
set(__spreadValues({ authState }, newFlow ? { flow: newFlow } : {}));
|
|
86
|
+
},
|
|
87
|
+
getVerifyState: () => {
|
|
88
|
+
const authState = get().authState;
|
|
89
|
+
return (authState == null ? void 0 : authState.stage) === "verify" ? authState : void 0;
|
|
90
|
+
},
|
|
91
|
+
getLoginState: () => {
|
|
92
|
+
const authState = get().authState;
|
|
93
|
+
return (authState == null ? void 0 : authState.stage) === "login" ? authState : void 0;
|
|
94
|
+
},
|
|
95
|
+
getSignupState: () => {
|
|
96
|
+
const authState = get().authState;
|
|
97
|
+
return (authState == null ? void 0 : authState.stage) === "signup" ? authState : void 0;
|
|
98
|
+
},
|
|
99
|
+
setOnRampPurchase: (onRampPurchase) => set((state) => ({ onRampPurchase: __spreadValues(__spreadValues({}, state.onRampPurchase || {}), onRampPurchase) })),
|
|
100
|
+
setOnRampConfig: (onRampConfig) => set({ onRampConfig }),
|
|
101
|
+
setOnRampStep: (onRampStep) => set({ onRampStep }),
|
|
102
|
+
setIsFullyLoggedIn: (isFullyLoggedIn) => set({ isFullyLoggedIn }),
|
|
103
|
+
setAccountAddFundTab: (accountAddFundTab) => set({ accountAddFundTab }),
|
|
104
|
+
setGuestAddFundsTab: (guestAddFundsTab) => set({ guestAddFundsTab }),
|
|
105
|
+
setSelectedExternalWalletId: (selectedExternalWalletId) => set({ selectedExternalWalletId }),
|
|
106
|
+
setIsExternalWalletConnecting: (isExternalWalletConnecting) => set({ isExternalWalletConnecting }),
|
|
107
|
+
setExternalWalletError: (externalWalletError) => set({ externalWalletError }),
|
|
108
|
+
setIsUsingMobileConnector: (isUsingMobileConnector) => set({ isUsingMobileConnector }),
|
|
109
|
+
setStepDirection: (stepDirection) => set({ stepDirection }),
|
|
110
|
+
setFarcasterConnectUri: (farcasterConnectUri) => set({ farcasterConnectUri }),
|
|
111
|
+
setTwoFactorStatus: (twoFactorStatus) => set({ twoFactorStatus }),
|
|
112
|
+
setIFrameUrl: (iFrameUrl) => set({ iFrameUrl }),
|
|
113
|
+
setIsIFrameReady: (isIFrameReady) => set({ isIFrameReady }),
|
|
114
|
+
setAuthLayout: (authLayout) => {
|
|
115
|
+
const types = [];
|
|
116
|
+
const uniqueLayouts = [];
|
|
117
|
+
authLayout.map((layout) => {
|
|
118
|
+
const type = layout.split(":")[0];
|
|
119
|
+
if (!types.includes(type)) {
|
|
120
|
+
uniqueLayouts.push(layout);
|
|
121
|
+
types.push(type);
|
|
122
|
+
} else {
|
|
123
|
+
console.warn(`${layout} is a duplicate ${type} layout type. Please remove the duplicate type from your config.`);
|
|
124
|
+
}
|
|
125
|
+
});
|
|
126
|
+
set({ authLayout: uniqueLayouts });
|
|
127
|
+
},
|
|
128
|
+
setAuthStepRoute: (authStepRoute) => set({ authStepRoute }),
|
|
129
|
+
setIsPasskeySupported: (isPasskeySupported) => set({ isPasskeySupported })
|
|
130
|
+
});
|
|
131
|
+
export {
|
|
132
|
+
getActions
|
|
133
|
+
};
|
|
@@ -1,12 +1,16 @@
|
|
|
1
1
|
import { ModalStep } from '../../utils/steps.js';
|
|
2
|
-
import { OnRampConfig as OnRampConfigBase, OnRampPurchase,
|
|
3
|
-
import { Tab as AddFundsTabType } from '../../components/AddFunds/
|
|
2
|
+
import { OnRampConfig as OnRampConfigBase, OnRampPurchase, TWalletType } from '@getpara/web-sdk';
|
|
3
|
+
import { Tab as AddFundsTabType } from '../../components/AddFunds/AddFundsContext.js';
|
|
4
4
|
import { AuthStateLogin, AuthStateSignup, AuthState, AuthStateVerify } from '@getpara/core-sdk';
|
|
5
5
|
import { TAuthLayout } from '../../types/modalProps.js';
|
|
6
6
|
import { MutableRefObject } from 'react';
|
|
7
7
|
import { Setup2faResponse } from '@getpara/user-management-client';
|
|
8
|
-
type Flow = AuthStateSignup['stage'] | AuthStateLogin['stage'] | 'account';
|
|
9
|
-
type ActiveWallet = [string | undefined,
|
|
8
|
+
export type Flow = AuthStateSignup['stage'] | AuthStateLogin['stage'] | 'account' | 'guest';
|
|
9
|
+
type ActiveWallet = [string | undefined, TWalletType | undefined];
|
|
10
|
+
export declare enum OnRampStep {
|
|
11
|
+
SETTINGS = 0,
|
|
12
|
+
PROVIDER = 1
|
|
13
|
+
}
|
|
10
14
|
export type OnRampConfig = OnRampConfigBase & {
|
|
11
15
|
testMode?: boolean;
|
|
12
16
|
};
|
|
@@ -24,8 +28,10 @@ interface ModalState {
|
|
|
24
28
|
onModalStepChange?: (value: OnModalStepChangeValue) => void | undefined;
|
|
25
29
|
onRampConfig: OnRampConfig | undefined;
|
|
26
30
|
onRampPurchase: Partial<OnRampPurchase> | undefined;
|
|
31
|
+
onRampStep: OnRampStep;
|
|
27
32
|
isFullyLoggedIn: boolean;
|
|
28
33
|
accountAddFundTab?: AddFundsTabType;
|
|
34
|
+
guestAddFundsTab?: AddFundsTabType;
|
|
29
35
|
selectedExternalWalletId?: string;
|
|
30
36
|
isUsingMobileConnector?: boolean;
|
|
31
37
|
isExternalWalletConnecting?: boolean;
|
|
@@ -51,6 +57,7 @@ export interface ModalActions {
|
|
|
51
57
|
resetState: () => void;
|
|
52
58
|
setRecoveryShare: (recoveryShare: string | null) => void;
|
|
53
59
|
setStep: (step: ModalStep) => void;
|
|
60
|
+
setGuestAddFundsTab: (tab?: AddFundsTabType | undefined) => void;
|
|
54
61
|
decrementStep: () => void;
|
|
55
62
|
hasPreviousStep: () => boolean;
|
|
56
63
|
setFlow: (flow?: Flow) => void;
|
|
@@ -63,6 +70,7 @@ export interface ModalActions {
|
|
|
63
70
|
setOnModalStepChange: (fn?: (value: OnModalStepChangeValue) => void) => void;
|
|
64
71
|
setOnRampConfig: (_: OnRampConfig | undefined) => void;
|
|
65
72
|
setOnRampPurchase: (_: Partial<OnRampPurchase> | undefined) => void;
|
|
73
|
+
setOnRampStep: (_: OnRampStep) => void;
|
|
66
74
|
setIsFullyLoggedIn: (isFullyLoggedIn: boolean) => void;
|
|
67
75
|
setAccountAddFundTab: (accountAddFundTab?: AddFundsTabType) => void;
|
|
68
76
|
setSelectedExternalWalletId: (id?: string) => void;
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import {
|
|
3
|
+
__spreadValues
|
|
4
|
+
} from "../../../chunk-MMUBH76A.js";
|
|
5
|
+
import { create } from "zustand";
|
|
6
|
+
import { persist, createJSONStorage } from "zustand/middleware";
|
|
7
|
+
import { ModalStep } from "../../utils/steps.js";
|
|
8
|
+
import { getActions } from "./actions.js";
|
|
9
|
+
import { AuthLayout } from "../../types/modalProps.js";
|
|
10
|
+
import { createRef } from "react";
|
|
11
|
+
var OnRampStep = /* @__PURE__ */ ((OnRampStep2) => {
|
|
12
|
+
OnRampStep2[OnRampStep2["SETTINGS"] = 0] = "SETTINGS";
|
|
13
|
+
OnRampStep2[OnRampStep2["PROVIDER"] = 1] = "PROVIDER";
|
|
14
|
+
return OnRampStep2;
|
|
15
|
+
})(OnRampStep || {});
|
|
16
|
+
const DEFAULT_MODAL_STATE = {
|
|
17
|
+
recoveryShare: null,
|
|
18
|
+
flow: void 0,
|
|
19
|
+
stepDirection: 1,
|
|
20
|
+
authState: void 0,
|
|
21
|
+
onModalStepChange: void 0,
|
|
22
|
+
onRampPurchase: void 0,
|
|
23
|
+
onRampStep: 0 /* SETTINGS */,
|
|
24
|
+
isFullyLoggedIn: false,
|
|
25
|
+
accountAddFundTab: void 0,
|
|
26
|
+
guestAddFundsTab: void 0,
|
|
27
|
+
isExternalWalletConnecting: false,
|
|
28
|
+
externalWalletError: void 0,
|
|
29
|
+
activeWallet: [void 0, void 0],
|
|
30
|
+
farcasterConnectUri: void 0,
|
|
31
|
+
twoFactorStatus: void 0,
|
|
32
|
+
iFrameUrl: void 0,
|
|
33
|
+
isIFrameReady: void 0,
|
|
34
|
+
authLayout: [AuthLayout.AUTH_FULL, AuthLayout.EXTERNAL_FULL],
|
|
35
|
+
authStepRoute: void 0,
|
|
36
|
+
refs: {
|
|
37
|
+
popupWindow: createRef(),
|
|
38
|
+
poll: createRef(),
|
|
39
|
+
currentStep: createRef()
|
|
40
|
+
},
|
|
41
|
+
isPasskeySupported: true
|
|
42
|
+
};
|
|
43
|
+
const useModalStore = create()(
|
|
44
|
+
persist(
|
|
45
|
+
(set, get) => __spreadValues(__spreadValues({
|
|
46
|
+
step: ModalStep.AUTH_MAIN,
|
|
47
|
+
onRampConfig: void 0
|
|
48
|
+
}, DEFAULT_MODAL_STATE), getActions(set, get)),
|
|
49
|
+
{
|
|
50
|
+
version: 1,
|
|
51
|
+
name: "@PARA/modalState",
|
|
52
|
+
storage: createJSONStorage(() => localStorage),
|
|
53
|
+
partialize: (state) => ({
|
|
54
|
+
step: state.step,
|
|
55
|
+
authState: state.authState,
|
|
56
|
+
onRampPurchase: state.onRampPurchase,
|
|
57
|
+
selectedExternalWalletId: state.selectedExternalWalletId,
|
|
58
|
+
isUsingMobileConnector: state.isUsingMobileConnector,
|
|
59
|
+
isPasskeySupported: state.isPasskeySupported
|
|
60
|
+
})
|
|
61
|
+
}
|
|
62
|
+
)
|
|
63
|
+
);
|
|
64
|
+
export {
|
|
65
|
+
DEFAULT_MODAL_STATE,
|
|
66
|
+
OnRampStep,
|
|
67
|
+
useModalStore
|
|
68
|
+
};
|
|
@@ -1,51 +1,4 @@
|
|
|
1
1
|
import { IconType } from '@getpara/react-components';
|
|
2
|
-
import { AuthStateLogin, AuthStateVerify, WalletType } from '@getpara/web-sdk';
|
|
3
|
-
export type WalletMetadata = {
|
|
4
|
-
id: string;
|
|
5
|
-
name: string;
|
|
6
|
-
iconUrl: string;
|
|
7
|
-
installed?: boolean;
|
|
8
|
-
isExtension?: boolean;
|
|
9
|
-
isMobile?: boolean;
|
|
10
|
-
isWeb?: boolean;
|
|
11
|
-
downloadUrl?: string;
|
|
12
|
-
getQrUri?: () => Promise<string>;
|
|
13
|
-
downloadUrls?: {
|
|
14
|
-
android?: string;
|
|
15
|
-
ios?: string;
|
|
16
|
-
mobile?: string;
|
|
17
|
-
qrCode?: string;
|
|
18
|
-
chrome?: string;
|
|
19
|
-
edge?: string;
|
|
20
|
-
firefox?: string;
|
|
21
|
-
opera?: string;
|
|
22
|
-
safari?: string;
|
|
23
|
-
browserExtension?: string;
|
|
24
|
-
macos?: string;
|
|
25
|
-
windows?: string;
|
|
26
|
-
linux?: string;
|
|
27
|
-
desktop?: string;
|
|
28
|
-
};
|
|
29
|
-
};
|
|
30
|
-
export type CommonWallet = {
|
|
31
|
-
connect: () => Promise<{
|
|
32
|
-
address?: string;
|
|
33
|
-
bufferAddress?: string;
|
|
34
|
-
error?: string;
|
|
35
|
-
authState?: AuthStateVerify | AuthStateLogin;
|
|
36
|
-
}>;
|
|
37
|
-
connectMobile: (isManualWalletConnect?: boolean) => Promise<{
|
|
38
|
-
address?: string;
|
|
39
|
-
bufferAddress?: string;
|
|
40
|
-
error?: string;
|
|
41
|
-
authState?: AuthStateVerify | AuthStateLogin;
|
|
42
|
-
}>;
|
|
43
|
-
type: WalletType;
|
|
44
|
-
} & WalletMetadata;
|
|
45
|
-
export type CommonChain = {
|
|
46
|
-
id: string | number;
|
|
47
|
-
name: string;
|
|
48
|
-
};
|
|
49
2
|
export type Tab<T> = {
|
|
50
3
|
label: string;
|
|
51
4
|
value: T;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";
|
|
@@ -4,6 +4,7 @@ export declare enum EvmWallet {
|
|
|
4
4
|
COINBASE = "COINBASE",
|
|
5
5
|
WALLETCONNECT = "WALLETCONNECT",
|
|
6
6
|
ZERION = "ZERION",
|
|
7
|
+
SAFE = "SAFE",
|
|
7
8
|
RABBY = "RABBY"
|
|
8
9
|
}
|
|
9
10
|
export declare enum SolanaWallet {
|
|
@@ -26,6 +27,7 @@ export declare const ExternalWallet: {
|
|
|
26
27
|
COINBASE: EvmWallet.COINBASE;
|
|
27
28
|
WALLETCONNECT: EvmWallet.WALLETCONNECT;
|
|
28
29
|
ZERION: EvmWallet.ZERION;
|
|
30
|
+
SAFE: EvmWallet.SAFE;
|
|
29
31
|
RABBY: EvmWallet.RABBY;
|
|
30
32
|
};
|
|
31
33
|
export type TExternalWallet = keyof typeof ExternalWallet;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import {
|
|
3
|
+
__spreadValues
|
|
4
|
+
} from "../../chunk-MMUBH76A.js";
|
|
5
|
+
var EvmWallet = /* @__PURE__ */ ((EvmWallet2) => {
|
|
6
|
+
EvmWallet2["METAMASK"] = "METAMASK";
|
|
7
|
+
EvmWallet2["RAINBOW"] = "RAINBOW";
|
|
8
|
+
EvmWallet2["COINBASE"] = "COINBASE";
|
|
9
|
+
EvmWallet2["WALLETCONNECT"] = "WALLETCONNECT";
|
|
10
|
+
EvmWallet2["ZERION"] = "ZERION";
|
|
11
|
+
EvmWallet2["SAFE"] = "SAFE";
|
|
12
|
+
EvmWallet2["RABBY"] = "RABBY";
|
|
13
|
+
return EvmWallet2;
|
|
14
|
+
})(EvmWallet || {});
|
|
15
|
+
var SolanaWallet = /* @__PURE__ */ ((SolanaWallet2) => {
|
|
16
|
+
SolanaWallet2["PHANTOM"] = "PHANTOM";
|
|
17
|
+
SolanaWallet2["GLOW"] = "GLOW";
|
|
18
|
+
SolanaWallet2["BACKPACK"] = "BACKPACK";
|
|
19
|
+
return SolanaWallet2;
|
|
20
|
+
})(SolanaWallet || {});
|
|
21
|
+
var CosmosWallet = /* @__PURE__ */ ((CosmosWallet2) => {
|
|
22
|
+
CosmosWallet2["KEPLR"] = "KEPLR";
|
|
23
|
+
CosmosWallet2["LEAP"] = "LEAP";
|
|
24
|
+
return CosmosWallet2;
|
|
25
|
+
})(CosmosWallet || {});
|
|
26
|
+
const ExternalWallet = __spreadValues(__spreadValues(__spreadValues({}, EvmWallet), SolanaWallet), CosmosWallet);
|
|
27
|
+
export {
|
|
28
|
+
CosmosWallet,
|
|
29
|
+
EvmWallet,
|
|
30
|
+
ExternalWallet,
|
|
31
|
+
SolanaWallet
|
|
32
|
+
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import ParaWeb, { CurrentWalletIds,
|
|
1
|
+
import ParaWeb, { CurrentWalletIds, TOAuthMethod } from '@getpara/web-sdk';
|
|
2
2
|
import { Theme } from '@getpara/react-components';
|
|
3
3
|
import { OnModalStepChangeValue } from '../stores/index.js';
|
|
4
4
|
import { ModalStep, ModalStepProp } from '../utils/steps.js';
|
|
@@ -54,7 +54,7 @@ export interface ParaModalProps {
|
|
|
54
54
|
* Which OAuth methods (if any) to show.
|
|
55
55
|
* Defaults to `true`.
|
|
56
56
|
*/
|
|
57
|
-
oAuthMethods?:
|
|
57
|
+
oAuthMethods?: TOAuthMethod[];
|
|
58
58
|
/**
|
|
59
59
|
* Whether or not to allow for email login. If true, only OAuth login will be available.
|
|
60
60
|
* Defaults to `false`.
|
|
@@ -100,6 +100,10 @@ export interface ParaModalProps {
|
|
|
100
100
|
* Default to [AuthLayout.AUTH_FULL, AuthLayout.EXTERNAL_FULL]
|
|
101
101
|
*/
|
|
102
102
|
authLayout?: TAuthLayout[];
|
|
103
|
+
/**
|
|
104
|
+
* Default email or phone number (formatted like: +15555555555) to pre-populate the input field.
|
|
105
|
+
*/
|
|
106
|
+
defaultAuthIdentifier?: string;
|
|
103
107
|
/**
|
|
104
108
|
* Called when the modal step changes
|
|
105
109
|
*/
|
|
@@ -108,6 +112,10 @@ export interface ParaModalProps {
|
|
|
108
112
|
* Called when the modal is closed
|
|
109
113
|
*/
|
|
110
114
|
onClose?: () => void;
|
|
115
|
+
/**
|
|
116
|
+
* Whether to enable guest login. A guest user will be provisioned embedded wallets that they will then claim upon signing up through your app.
|
|
117
|
+
*/
|
|
118
|
+
isGuestModeEnabled?: boolean;
|
|
111
119
|
loginTransitionOverride?: (para: ParaWeb) => Promise<void>;
|
|
112
120
|
createWalletOverride?: (para: ParaWeb) => Promise<{
|
|
113
121
|
recoverySecret?: string;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import "../../chunk-MMUBH76A.js";
|
|
3
|
+
var AuthLayout = /* @__PURE__ */ ((AuthLayout2) => {
|
|
4
|
+
AuthLayout2["AUTH_FULL"] = "AUTH:FULL";
|
|
5
|
+
AuthLayout2["AUTH_CONDENSED"] = "AUTH:CONDENSED";
|
|
6
|
+
AuthLayout2["EXTERNAL_FULL"] = "EXTERNAL:FULL";
|
|
7
|
+
AuthLayout2["EXTERNAL_CONDENSED"] = "EXTERNAL:CONDENSED";
|
|
8
|
+
return AuthLayout2;
|
|
9
|
+
})(AuthLayout || {});
|
|
10
|
+
export {
|
|
11
|
+
AuthLayout
|
|
12
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import countryCodes from './countryCodes.js';
|
|
2
|
+
export declare function isCcMatch(countryCode: string, option: (typeof countryCodes)[number]): boolean;
|
|
3
|
+
export declare function validateAuth(identifier: string, countryCode?: string, type?: 'email' | 'phone'): {
|
|
4
|
+
email: string;
|
|
5
|
+
} | {
|
|
6
|
+
phone: import("@getpara/user-management-client").AuthIdentifier<"phone">;
|
|
7
|
+
};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import "../../chunk-MMUBH76A.js";
|
|
3
|
+
import { EMAIL_REGEX } from "../constants/constants.js";
|
|
4
|
+
import { formatPhoneNumber } from "@getpara/web-sdk";
|
|
5
|
+
function isCcMatch(countryCode, option) {
|
|
6
|
+
return countryCode === "+1" ? option.selectedLabel === "US" : option.value === countryCode;
|
|
7
|
+
}
|
|
8
|
+
function validateAuth(identifier, countryCode, type) {
|
|
9
|
+
const isEmail = type === "email";
|
|
10
|
+
const isPhone = type === "phone";
|
|
11
|
+
let auth;
|
|
12
|
+
switch (true) {
|
|
13
|
+
case isEmail:
|
|
14
|
+
if (!EMAIL_REGEX.test(identifier)) {
|
|
15
|
+
throw new Error("Please enter a valid email!");
|
|
16
|
+
}
|
|
17
|
+
auth = { email: identifier };
|
|
18
|
+
break;
|
|
19
|
+
case isPhone:
|
|
20
|
+
if (countryCode === "+1" && identifier.slice(3, 6) === "555") {
|
|
21
|
+
auth = { phone: `${countryCode}${identifier}` };
|
|
22
|
+
break;
|
|
23
|
+
}
|
|
24
|
+
const validatedPhone = formatPhoneNumber(identifier, countryCode);
|
|
25
|
+
if (!validatedPhone) {
|
|
26
|
+
throw new Error("Please enter a valid phone number!");
|
|
27
|
+
}
|
|
28
|
+
auth = { phone: validatedPhone };
|
|
29
|
+
break;
|
|
30
|
+
default:
|
|
31
|
+
throw new Error("Please enter a valid email or phone number!");
|
|
32
|
+
}
|
|
33
|
+
return auth;
|
|
34
|
+
}
|
|
35
|
+
export {
|
|
36
|
+
isCcMatch,
|
|
37
|
+
validateAuth
|
|
38
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import "../../chunk-MMUBH76A.js";
|
|
3
|
+
const hasExternalWallet = (authLayout) => authLayout.find((layout) => layout.includes("EXTERNAL"));
|
|
4
|
+
const hasEmbeddedAuth = (authLayout) => authLayout.find((layout) => layout.includes("AUTH"));
|
|
5
|
+
export {
|
|
6
|
+
hasEmbeddedAuth,
|
|
7
|
+
hasExternalWallet
|
|
8
|
+
};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import "../../chunk-MMUBH76A.js";
|
|
3
|
+
import { getCountries, getCountryCallingCode } from "libphonenumber-js";
|
|
4
|
+
const excludedCountries = [
|
|
5
|
+
"AC",
|
|
6
|
+
"CG",
|
|
7
|
+
"CI",
|
|
8
|
+
"CV",
|
|
9
|
+
"GF",
|
|
10
|
+
"GP",
|
|
11
|
+
"MF",
|
|
12
|
+
"NC",
|
|
13
|
+
"PM",
|
|
14
|
+
"RE",
|
|
15
|
+
"SD",
|
|
16
|
+
"SH",
|
|
17
|
+
"SJ",
|
|
18
|
+
"TA",
|
|
19
|
+
"VA",
|
|
20
|
+
"WF",
|
|
21
|
+
"XK",
|
|
22
|
+
"YT"
|
|
23
|
+
];
|
|
24
|
+
const generateCountryCodes = () => {
|
|
25
|
+
const countries = getCountries();
|
|
26
|
+
const countryList = countries.filter((country) => !excludedCountries.includes(country)).map((country) => {
|
|
27
|
+
const countryCode = getCountryCallingCode(country);
|
|
28
|
+
const countryName = new Intl.DisplayNames(["en"], { type: "region" }).of(country);
|
|
29
|
+
return {
|
|
30
|
+
label: countryName != null ? countryName : "",
|
|
31
|
+
value: `+${countryCode}`,
|
|
32
|
+
selectedLabel: country,
|
|
33
|
+
icon: country
|
|
34
|
+
};
|
|
35
|
+
}).sort((a, b) => {
|
|
36
|
+
var _a, _b;
|
|
37
|
+
return ((_a = a.label) != null ? _a : "").localeCompare((_b = b.label) != null ? _b : "");
|
|
38
|
+
});
|
|
39
|
+
return countryList;
|
|
40
|
+
};
|
|
41
|
+
const countryCodes = generateCountryCodes();
|
|
42
|
+
var countryCodes_default = countryCodes;
|
|
43
|
+
export {
|
|
44
|
+
countryCodes_default as default
|
|
45
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import "../../chunk-MMUBH76A.js";
|
|
3
|
+
function getMailtoLink(email, recoveryShare) {
|
|
4
|
+
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`;
|
|
5
|
+
const mailText = `mailto:${email}?subject=Para%20Recovery%20Secret&body=${emailBody}`;
|
|
6
|
+
return mailText;
|
|
7
|
+
}
|
|
8
|
+
export {
|
|
9
|
+
getMailtoLink
|
|
10
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import "../../chunk-MMUBH76A.js";
|
|
3
|
+
const getTileButtonFlex = (index, totalItems) => {
|
|
4
|
+
const gapOffset = 8 - 8 * 0.333;
|
|
5
|
+
if (totalItems < 2) {
|
|
6
|
+
return "1 1 auto";
|
|
7
|
+
}
|
|
8
|
+
if (totalItems % 3 === 0) {
|
|
9
|
+
return `0 0 calc(33.333333% - ${gapOffset}px)`;
|
|
10
|
+
}
|
|
11
|
+
if (totalItems % 3 === 1) {
|
|
12
|
+
return index < 4 ? "0 0 calc(50% - 4px)" : `0 0 calc(33.333333% - ${gapOffset}px)`;
|
|
13
|
+
}
|
|
14
|
+
if (totalItems % 3 === 2) {
|
|
15
|
+
return index < 2 ? "0 0 calc(50% - 4px)" : `0 0 calc(33.333333% - ${gapOffset}px)`;
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
export {
|
|
19
|
+
getTileButtonFlex
|
|
20
|
+
};
|