@getpara/react-sdk-lite 2.0.0-dev.7 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli/cli.mjs +26 -1
- package/dist/modal/ParaModal.js +16 -10
- package/dist/modal/components/Account/Account.js +42 -4
- package/dist/modal/components/Account/AccountHeader.js +10 -16
- package/dist/modal/components/Account/AccountProfile.d.ts +1 -1
- package/dist/modal/components/Account/AccountProfile.js +82 -210
- package/dist/modal/components/Account/AccountProfileEntry.d.ts +12 -0
- package/dist/modal/components/Account/AccountProfileEntry.js +220 -0
- package/dist/modal/components/Account/AccountProfileLinkOptions.js +15 -4
- package/dist/modal/components/Account/AccountSend/AccountSendAsset.d.ts +1 -0
- package/dist/modal/components/Account/AccountSend/AccountSendAsset.js +94 -0
- package/dist/modal/components/Account/AccountSend/AccountSendForm.d.ts +1 -0
- package/dist/modal/components/Account/AccountSend/AccountSendForm.js +343 -0
- package/dist/modal/components/Account/AccountSend/AccountSendNetwork.d.ts +1 -0
- package/dist/modal/components/Account/AccountSend/AccountSendNetwork.js +53 -0
- package/dist/modal/components/Account/AccountSend/AccountSendNoAssets.d.ts +1 -0
- package/dist/modal/components/Account/AccountSend/AccountSendNoAssets.js +56 -0
- package/dist/modal/components/Account/AccountSend/AssetNetwork.d.ts +5 -0
- package/dist/modal/components/Account/AccountSend/AssetNetwork.js +36 -0
- package/dist/modal/components/Account/AccountSend/context.d.ts +38 -0
- package/dist/modal/components/Account/AccountSend/context.js +418 -0
- package/dist/modal/components/Account/AccountSend/index.d.ts +4 -0
- package/dist/modal/components/Account/AccountSend/index.js +67 -0
- package/dist/modal/components/Account/AccountWallet.d.ts +1 -0
- package/dist/modal/components/Account/AccountWallet.js +133 -0
- package/dist/modal/components/{WalletSelect/WalletSelect.d.ts → Account/AccountWalletSelect.d.ts} +1 -1
- package/dist/modal/components/{WalletSelect/WalletSelect.js → Account/AccountWalletSelect.js} +20 -6
- package/dist/modal/components/AddFunds/AddFunds.js +3 -2
- package/dist/modal/components/AddFunds/AddFundsAsset.js +7 -6
- package/dist/modal/components/AddFunds/AddFundsContext.d.ts +5 -5
- package/dist/modal/components/AddFunds/AddFundsProvider.js +1 -2
- package/dist/modal/components/AddFunds/AddFundsSettings.js +13 -54
- package/dist/modal/components/AddFunds/common.d.ts +0 -14
- package/dist/modal/components/AddFunds/common.js +1 -8
- package/dist/modal/components/AuthInput/AuthInput.js +2 -2
- package/dist/modal/components/AwaitingAccountStep/AwaitingAccountStep.js +3 -2
- package/dist/modal/components/AwaitingWalletCreationStep/AwaitingWalletCreationStep.js +8 -33
- package/dist/modal/components/BiometricLoginStep/BiometricLoginStep.js +5 -2
- package/dist/modal/components/Body/Body.js +81 -48
- package/dist/modal/components/ChainSwitch/ChainSwitch.js +8 -5
- package/dist/modal/components/Controls/ChainSelect.js +1 -2
- package/dist/modal/components/Controls/Controls.js +1 -0
- package/dist/modal/components/ExternalWalletNetworkSelectStep/ExternalWalletNetworkSelectStep.d.ts +5 -1
- package/dist/modal/components/ExternalWalletNetworkSelectStep/ExternalWalletNetworkSelectStep.js +48 -19
- package/dist/modal/components/ExternalWalletStep/ExternalWalletStep.d.ts +5 -2
- package/dist/modal/components/ExternalWalletStep/ExternalWalletStep.js +63 -33
- package/dist/modal/components/ExternalWallets/ExternalWallets.d.ts +3 -1
- package/dist/modal/components/ExternalWallets/ExternalWallets.js +22 -12
- package/dist/modal/components/Footer/Footer.js +4 -5
- package/dist/modal/components/Header/Header.js +1 -2
- package/dist/modal/components/Header/hooks/useStepTitle.js +53 -38
- package/dist/modal/components/Hero/Hero.js +5 -3
- package/dist/modal/components/IFrameStep/IFrameStep.js +13 -12
- package/dist/modal/components/LoginDoneStep/LoginDoneStep.js +4 -1
- package/dist/modal/components/OAuth/FarcasterOAuthStep.js +6 -5
- package/dist/modal/components/OAuth/TelegramOAuthStep.js +6 -5
- package/dist/modal/components/OnRampComponents/AddingFunds.js +1 -1
- package/dist/modal/components/OnRampComponents/OnRampProviderButton.js +1 -2
- package/dist/modal/components/QuantityInput.d.ts +9 -0
- package/dist/modal/components/QuantityInput.js +91 -0
- package/dist/modal/components/SearchableButtonList.d.ts +34 -0
- package/dist/modal/components/SearchableButtonList.js +223 -0
- package/dist/modal/components/Setup2FAStep/Setup2FAStep.js +4 -1
- package/dist/modal/components/SwitchWalletsStep/SwitchWalletsStep.d.ts +1 -0
- package/dist/modal/components/SwitchWalletsStep/SwitchWalletsStep.js +10 -0
- package/dist/modal/components/VerificationCodeStep/VerificationCodeStep.js +13 -2
- package/dist/modal/components/Waiting/Waiting.d.ts +1 -1
- package/dist/modal/components/Waiting/Waiting.js +7 -2
- package/dist/modal/components/WalletCard/WalletCard.js +2 -3
- package/dist/modal/components/WalletSelectOld/WalletSelectOld.d.ts +7 -1
- package/dist/modal/components/WalletSelectOld/WalletSelectOld.js +33 -12
- package/dist/modal/components/common.d.ts +8 -10
- package/dist/modal/components/common.js +16 -36
- package/dist/modal/hooks/index.d.ts +4 -0
- package/dist/modal/hooks/index.js +5 -0
- package/dist/modal/hooks/useDebounce.d.ts +4 -0
- package/dist/modal/hooks/useDebounce.js +16 -0
- package/dist/modal/hooks/useFarcasterLogin.js +8 -1
- package/dist/modal/hooks/useTelegramLogin.js +4 -0
- package/dist/modal/index.d.ts +1 -1
- package/dist/modal/index.js +1 -1
- package/dist/modal/stores/modal/actions.js +9 -2
- package/dist/modal/stores/modal/useModalStore.d.ts +9 -1
- package/dist/modal/stores/modal/useModalStore.js +6 -2
- package/dist/modal/types/modalProps.d.ts +5 -1
- package/dist/modal/utils/authInputHelpers.js +1 -1
- package/dist/modal/utils/countryCodes.js +50 -1
- package/dist/modal/utils/getWalletDisplayName.js +1 -1
- package/dist/modal/utils/openPopup.d.ts +1 -1
- package/dist/modal/utils/openPopup.js +6 -2
- package/dist/modal/utils/renderTextWithLinks.d.ts +2 -0
- package/dist/modal/utils/renderTextWithLinks.js +34 -0
- package/dist/modal/utils/steps.d.ts +24 -3
- package/dist/modal/utils/steps.js +51 -5
- package/dist/modal/utils/stringFormatters.d.ts +2 -3
- package/dist/modal/utils/stringFormatters.js +11 -7
- package/dist/modal/utils/validatePortalOrigin.d.ts +2 -0
- package/dist/modal/utils/validatePortalOrigin.js +14 -0
- package/dist/provider/ParaProviderMin.js +13 -5
- package/dist/provider/actions/getEmbeddedAccount.d.ts +3 -2
- package/dist/provider/actions/getEmbeddedAccount.js +13 -4
- package/dist/provider/actions/index.d.ts +11 -9
- package/dist/provider/actions/index.js +4 -0
- package/dist/provider/components/CosmosWalletWrapper.js +3 -3
- package/dist/provider/components/EvmWalletWrapper.js +3 -3
- package/dist/provider/components/ExternalWalletWrapper.js +7 -1
- package/dist/provider/external/stubs/CosmosExternalWalletContextStub.js +3 -1
- package/dist/provider/external/stubs/EvmExternalWalletContextStub.js +3 -1
- package/dist/provider/external/stubs/SolanaExternalWalletContextStub.js +3 -1
- package/dist/provider/hooks/mutations/index.d.ts +2 -0
- package/dist/provider/hooks/mutations/index.js +4 -0
- package/dist/provider/hooks/mutations/useAddAuthMethod.d.ts +42 -0
- package/dist/provider/hooks/mutations/useAddAuthMethod.js +59 -0
- package/dist/provider/hooks/mutations/useClaimPregenWallets.d.ts +2 -2
- package/dist/provider/hooks/mutations/useCreateGuestWallets.d.ts +2 -2
- package/dist/provider/hooks/mutations/useCreatePregenWallet.d.ts +5 -5
- package/dist/provider/hooks/mutations/useCreatePregenWalletPerType.d.ts +2 -2
- package/dist/provider/hooks/mutations/useCreateWallet.d.ts +2 -2
- package/dist/provider/hooks/mutations/useCreateWalletPerType.d.ts +2 -2
- package/dist/provider/hooks/mutations/useEnable2fa.d.ts +2 -2
- package/dist/provider/hooks/mutations/useExportPrivateKey.d.ts +15 -0
- package/dist/provider/hooks/mutations/useExportPrivateKey.js +32 -0
- package/dist/provider/hooks/mutations/useHasPregenWallet.d.ts +2 -2
- package/dist/provider/hooks/mutations/useIssueJwt.d.ts +2 -2
- package/dist/provider/hooks/mutations/useKeepSessionAlive.d.ts +2 -2
- package/dist/provider/hooks/mutations/useLoginExternalWallet.d.ts +8 -2
- package/dist/provider/hooks/mutations/useLogout.d.ts +2 -2
- package/dist/provider/hooks/mutations/useResendVerificationCode.d.ts +2 -2
- package/dist/provider/hooks/mutations/useSetup2fa.d.ts +2 -2
- package/dist/provider/hooks/mutations/useSignMessage.d.ts +2 -2
- package/dist/provider/hooks/mutations/useSignTransaction.d.ts +2 -2
- package/dist/provider/hooks/mutations/useSignUpOrLogIn.d.ts +2 -2
- package/dist/provider/hooks/mutations/useSwitchWallets.d.ts +57 -0
- package/dist/provider/hooks/mutations/useSwitchWallets.js +30 -0
- package/dist/provider/hooks/mutations/useUpdatePregenWalletIdentifier.d.ts +2 -2
- package/dist/provider/hooks/mutations/useVerify2fa.d.ts +2 -2
- package/dist/provider/hooks/mutations/useVerifyExternalWallet.d.ts +18 -27
- package/dist/provider/hooks/mutations/useVerifyFarcaster.d.ts +5 -5
- package/dist/provider/hooks/mutations/useVerifyNewAccount.d.ts +14 -11
- package/dist/provider/hooks/mutations/useVerifyOAuth.d.ts +2 -2
- package/dist/provider/hooks/mutations/useVerifyTelegram.d.ts +5 -5
- package/dist/provider/hooks/mutations/useWaitForLogin.d.ts +2 -2
- package/dist/provider/hooks/mutations/useWaitForSignup.d.ts +2 -2
- package/dist/provider/hooks/mutations/useWaitForWalletCreation.d.ts +2 -2
- package/dist/provider/hooks/queries/index.d.ts +1 -0
- package/dist/provider/hooks/queries/index.js +2 -0
- package/dist/provider/hooks/queries/useAccount.js +58 -24
- package/dist/provider/hooks/queries/useLinkedAccounts.js +4 -2
- package/dist/provider/hooks/queries/useProfileBalance.d.ts +29 -0
- package/dist/provider/hooks/queries/useProfileBalance.js +65 -0
- package/dist/provider/hooks/utils/useAssetInfo.d.ts +3 -0
- package/dist/provider/hooks/utils/useAssetInfo.js +21 -0
- package/dist/provider/hooks/utils/useAutoSessionKeepAlive.js +1 -1
- package/dist/provider/hooks/utils/useEventListeners.js +22 -5
- package/dist/provider/hooks/utils/useModal.js +3 -3
- package/dist/provider/hooks/utils/useWalletState.d.ts +2 -1
- package/dist/provider/hooks/utils/useWalletState.js +2 -1
- package/dist/provider/providers/AccountLinkProvider.js +18 -11
- package/dist/provider/providers/AssetsProvider.d.ts +14 -0
- package/dist/provider/providers/AssetsProvider.js +68 -0
- package/dist/provider/providers/AuthProvider.d.ts +4 -0
- package/dist/provider/providers/AuthProvider.js +187 -43
- package/dist/provider/providers/ExternalWalletProvider.d.ts +19 -5
- package/dist/provider/providers/ExternalWalletProvider.js +363 -44
- package/dist/provider/stores/getters.d.ts +2 -2
- package/dist/provider/stores/slices/modal.js +4 -1
- package/dist/provider/stores/types.d.ts +6 -3
- package/package.json +8 -8
- package/dist/modal/constants/constants.d.ts +0 -35
- package/dist/modal/constants/constants.js +0 -148
- package/dist/modal/utils/routeMobileExternalWallet.d.ts +0 -1
- package/dist/modal/utils/routeMobileExternalWallet.js +0 -31
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import "../../../chunk-MMUBH76A.js";
|
|
3
3
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
|
-
import { useEffect, useRef } from "react";
|
|
4
|
+
import { useEffect, useMemo, useRef } from "react";
|
|
5
5
|
import { useInternalClient } from "../../../provider/hooks/utils/useInternalClient.js";
|
|
6
6
|
import { useDropdownPosition } from "../AuthInput/hooks/useDropdownPosition.js";
|
|
7
|
-
import { safeStyled, useCopyToClipboard } from "@getpara/react-common";
|
|
7
|
+
import { MOBILE_SIZE, safeStyled, useCopyToClipboard, WalletTypeIcon as WalletTypeIconBase } from "@getpara/react-common";
|
|
8
8
|
import { useAccount, useWallet, useWalletState } from "../../../provider/index.js";
|
|
9
9
|
import { CpslButton, CpslIcon, CpslSelect, CpslSelectItem, CpslText } from "@getpara/react-components";
|
|
10
|
-
import * as common from "../common.js";
|
|
11
10
|
const getValue = (id, type) => {
|
|
12
11
|
return id && type ? `${id}~${type}` : void 0;
|
|
13
12
|
};
|
|
@@ -46,13 +45,21 @@ const Wallet = ({
|
|
|
46
45
|
)
|
|
47
46
|
] });
|
|
48
47
|
};
|
|
49
|
-
const WalletSelectOld = (
|
|
48
|
+
const WalletSelectOld = ({
|
|
49
|
+
style,
|
|
50
|
+
noTitle,
|
|
51
|
+
types,
|
|
52
|
+
isEmbeddedOnly
|
|
53
|
+
}) => {
|
|
50
54
|
const containerRef = useRef(null);
|
|
51
55
|
const { dropdownMaxHeight, dropdownWidth, mobileAnchor, resize } = useDropdownPosition(containerRef);
|
|
52
56
|
const { setSelectedWallet } = useWalletState();
|
|
53
57
|
const { data: activeWallet } = useWallet();
|
|
54
58
|
const { embedded } = useAccount();
|
|
55
|
-
const availableWallets =
|
|
59
|
+
const availableWallets = useMemo(() => {
|
|
60
|
+
var _a;
|
|
61
|
+
return (_a = embedded == null ? void 0 : embedded.wallets) == null ? void 0 : _a.filter((wallet) => !isEmbeddedOnly || !wallet.isExternal);
|
|
62
|
+
}, [embedded, isEmbeddedOnly]);
|
|
56
63
|
const isMultiWallet = availableWallets && availableWallets.length > 1;
|
|
57
64
|
const ActiveWalletNode = activeWallet ? /* @__PURE__ */ jsx(Wallet, { withCopy: true, wallet: activeWallet, slot: "selected-item", withIcon: true }) : null;
|
|
58
65
|
useEffect(() => {
|
|
@@ -60,9 +67,9 @@ const WalletSelectOld = () => {
|
|
|
60
67
|
resize();
|
|
61
68
|
}
|
|
62
69
|
}, [activeWallet, availableWallets, dropdownMaxHeight]);
|
|
63
|
-
return /* @__PURE__ */ jsxs(Container, { children: [
|
|
64
|
-
isMultiWallet && /* @__PURE__ */ jsx(CpslText, { variant: "bodyM", color: "secondary", weight: "semiBold", children: "Select Wallet" }),
|
|
65
|
-
/* @__PURE__ */ jsx(SelectContainer, { ref: containerRef, id: "
|
|
70
|
+
return /* @__PURE__ */ jsxs(Container, { style, children: [
|
|
71
|
+
isMultiWallet && !noTitle && /* @__PURE__ */ jsx(CpslText, { variant: "bodyM", color: "secondary", weight: "semiBold", children: "Select Wallet" }),
|
|
72
|
+
/* @__PURE__ */ jsx(SelectContainer, { ref: containerRef, id: "addressInputContainerOld", style: { width: "100%" }, children: /* @__PURE__ */ jsxs(
|
|
66
73
|
Select,
|
|
67
74
|
{
|
|
68
75
|
selectedValue: getValue(activeWallet == null ? void 0 : activeWallet.id, activeWallet == null ? void 0 : activeWallet.type),
|
|
@@ -72,16 +79,17 @@ const WalletSelectOld = () => {
|
|
|
72
79
|
},
|
|
73
80
|
showFormattedSelectedItem: true,
|
|
74
81
|
placeholder: "Choose wallet...",
|
|
75
|
-
anchorElId: "
|
|
82
|
+
anchorElId: "addressInputContainerOld",
|
|
76
83
|
dropdownMaxHeight,
|
|
77
84
|
$width: dropdownWidth != null ? dropdownWidth : 0,
|
|
78
|
-
$top: (mobileAnchor != null ? mobileAnchor : 0) +
|
|
85
|
+
$top: (mobileAnchor != null ? mobileAnchor : 0) + 220 + 1,
|
|
79
86
|
selectedItemVariant: "bodyXS",
|
|
80
87
|
icon: isMultiWallet ? "chevronUp" : null,
|
|
81
88
|
disabled: !isMultiWallet,
|
|
89
|
+
style: { width: "100%" },
|
|
82
90
|
children: [
|
|
83
91
|
activeWallet && ActiveWalletNode,
|
|
84
|
-
(availableWallets || []).map((wallet) => {
|
|
92
|
+
(availableWallets || []).filter((wallet) => !types || !wallet.type || types.includes(wallet.type)).map((wallet) => {
|
|
85
93
|
const key = getValue(wallet.id, wallet.type);
|
|
86
94
|
return /* @__PURE__ */ jsx(SelectItem, { slot: "items", value: key, children: /* @__PURE__ */ jsx(Wallet, { wallet, withIcon: true }) }, key);
|
|
87
95
|
})
|
|
@@ -115,7 +123,20 @@ const Select = safeStyled(CpslSelect)`
|
|
|
115
123
|
|
|
116
124
|
&::part(dropdown) {
|
|
117
125
|
min-width: ${({ $width }) => `${$width - 2}px`};
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
&::part(popover) {
|
|
129
|
+
/* Have to adjust the top of the popover here since we're using a transform on the modal which causes fixed position items to not be relative to the viewport */
|
|
130
|
+
@media (max-width: ${MOBILE_SIZE}px) {
|
|
131
|
+
top: ${({ $top }) => $top ? `${$top}px` : "0px"};
|
|
132
|
+
bottom: 16px;
|
|
133
|
+
}
|
|
134
|
+
cpsl-auth-modal.force-mobile-media & {
|
|
135
|
+
top: ${({ $top }) => $top ? `${$top}px` : "0px"};
|
|
136
|
+
bottom: 16px;
|
|
137
|
+
}
|
|
118
138
|
}
|
|
139
|
+
|
|
119
140
|
|
|
120
141
|
&::part(icon) {
|
|
121
142
|
--icon-color: var(--cpsl-color-text-primary);
|
|
@@ -139,7 +160,7 @@ const SelectContainer = safeStyled.div`
|
|
|
139
160
|
border-radius: var(--cpsl-border-radius-tile-button);
|
|
140
161
|
background-color: var(--cpsl-color-background-4);
|
|
141
162
|
`;
|
|
142
|
-
const WalletTypeIcon = safeStyled(
|
|
163
|
+
const WalletTypeIcon = safeStyled(WalletTypeIconBase)`
|
|
143
164
|
--border: 1px solid var(--cpsl-color-background-8);
|
|
144
165
|
--background: var(--cpsl-color-background-0);
|
|
145
166
|
--border-radius: 4px;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { CpslInput, CpslText, CpslTileButton } from '@getpara/react-components';
|
|
2
|
+
import { TLinkedAccountType, TNetwork, TOnRampAsset } from '@getpara/web-sdk';
|
|
3
3
|
import { ComponentProps, PropsWithChildren } from 'react';
|
|
4
4
|
export declare const SpinnerContainer: import("styled-components/dist/types.js").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
5
5
|
export declare const QRContainer: import("styled-components/dist/types.js").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
@@ -10,7 +10,7 @@ export declare const FullWidthFilledDisabledInput: typeof CpslInput;
|
|
|
10
10
|
export declare const CenteredText: typeof CpslText;
|
|
11
11
|
export declare const InnerStepContainer: import("styled-components/dist/types.js").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
12
12
|
export declare const StepContainer: import("styled-components/dist/types.js").IStyledComponentBase<"web", import("styled-components/dist/types.js").Substitute<Omit<import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>, "ref"> & {
|
|
13
|
-
ref?: ((instance: HTMLDivElement | null) => void | import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) |
|
|
13
|
+
ref?: import("react").RefObject<HTMLDivElement> | ((instance: HTMLDivElement | null) => void | import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | null | undefined;
|
|
14
14
|
}, {
|
|
15
15
|
$wide?: boolean;
|
|
16
16
|
}>> & string;
|
|
@@ -30,18 +30,13 @@ export declare const HeaderSelectItem: import("styled-components/dist/types.js")
|
|
|
30
30
|
}, never>> & string & Omit<import("react").ForwardRefExoticComponent<Omit<any, "ref"> & import("react").RefAttributes<any>>, keyof import("react").Component<any, {}, any>>;
|
|
31
31
|
export declare const HeaderSelectContainer: import("styled-components/dist/types.js").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
32
32
|
export declare function AssetIcon({ asset, size }: {
|
|
33
|
-
asset:
|
|
33
|
+
asset: TOnRampAsset;
|
|
34
34
|
size?: string;
|
|
35
35
|
}): import("react/jsx-runtime").JSX.Element;
|
|
36
36
|
export declare function NetworkIcon({ network, size }: {
|
|
37
|
-
network?:
|
|
37
|
+
network?: TNetwork;
|
|
38
38
|
size?: string;
|
|
39
39
|
}): import("react/jsx-runtime").JSX.Element;
|
|
40
|
-
export declare function WalletTypeIcon({ className, walletType, externalWallet, ...props }: {
|
|
41
|
-
className?: string;
|
|
42
|
-
walletType: TWalletType;
|
|
43
|
-
externalWallet?: TExternalWallet | string;
|
|
44
|
-
} & Parameters<typeof CpslIcon>[0]): import("react/jsx-runtime").JSX.Element;
|
|
45
40
|
export declare const ErrorContainer: import("styled-components/dist/types.js").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
46
41
|
export declare const ErrorIcon: import("styled-components/dist/types.js").IStyledComponentBase<"web", import("styled-components").FastOmit<Omit<Omit<any, "ref"> & import("react").RefAttributes<any>, "ref"> & {
|
|
47
42
|
ref?: ((instance: any) => void | import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | import("react").RefObject<any> | null | undefined;
|
|
@@ -64,3 +59,6 @@ export declare function GradientScroll({ height, gap, children }: PropsWithChild
|
|
|
64
59
|
export declare const HeroGenericIcon: ({ accountType }: {
|
|
65
60
|
accountType: "EMAIL" | "PHONE";
|
|
66
61
|
}) => import("react/jsx-runtime").JSX.Element;
|
|
62
|
+
export * from './SearchableButtonList.js';
|
|
63
|
+
export * from './QuantityInput.js';
|
|
64
|
+
export { AnimatedHeightWrapper } from './Body/AnimatedHeightWrapper.js';
|
|
@@ -6,8 +6,7 @@ import {
|
|
|
6
6
|
} from "../../chunk-MMUBH76A.js";
|
|
7
7
|
import { jsx } from "react/jsx-runtime";
|
|
8
8
|
import { CpslIcon, CpslInput, CpslSelect, CpslSelectItem, CpslText, CpslTileButton } from "@getpara/react-components";
|
|
9
|
-
import { ACCOUNT_TYPES, safeStyled } from "@getpara/react-common";
|
|
10
|
-
import { MOBILE_SIZE, NETWORKS, ON_RAMP_ASSETS, WALLET_TYPES_METADATA } from "../constants/constants.js";
|
|
9
|
+
import { ACCOUNT_TYPES, safeStyled, MOBILE_SIZE, NETWORKS, ON_RAMP_ASSETS } from "@getpara/react-common";
|
|
11
10
|
import { useStore } from "../../provider/stores/useStore.js";
|
|
12
11
|
import { useEffect, useRef, useState } from "react";
|
|
13
12
|
const SpinnerContainer = safeStyled.div`
|
|
@@ -167,37 +166,6 @@ function NetworkIcon({ network, size }) {
|
|
|
167
166
|
}
|
|
168
167
|
);
|
|
169
168
|
}
|
|
170
|
-
function WalletTypeIcon(_c) {
|
|
171
|
-
var _d = _c, {
|
|
172
|
-
className,
|
|
173
|
-
walletType,
|
|
174
|
-
externalWallet
|
|
175
|
-
} = _d, props = __objRest(_d, [
|
|
176
|
-
"className",
|
|
177
|
-
"walletType",
|
|
178
|
-
"externalWallet"
|
|
179
|
-
]);
|
|
180
|
-
var _a;
|
|
181
|
-
const isDark = useStore((state) => {
|
|
182
|
-
var _a2, _b;
|
|
183
|
-
return ((_b = (_a2 = state.modalConfig) == null ? void 0 : _a2.theme) == null ? void 0 : _b.mode) === "dark";
|
|
184
|
-
});
|
|
185
|
-
const data = (externalWallet ? ACCOUNT_TYPES[externalWallet] : WALLET_TYPES_METADATA[walletType]) || {
|
|
186
|
-
icon: "wallet02",
|
|
187
|
-
isDark: true
|
|
188
|
-
};
|
|
189
|
-
props.size;
|
|
190
|
-
return /* @__PURE__ */ jsx(
|
|
191
|
-
CpslIcon,
|
|
192
|
-
__spreadProps(__spreadValues({
|
|
193
|
-
className,
|
|
194
|
-
icon: data.icon,
|
|
195
|
-
invert: isDark && data.isDark
|
|
196
|
-
}, props), {
|
|
197
|
-
inset: (_a = props.inset) != null ? _a : "10%"
|
|
198
|
-
})
|
|
199
|
-
);
|
|
200
|
-
}
|
|
201
169
|
const ErrorContainer = safeStyled.div`
|
|
202
170
|
display: flex;
|
|
203
171
|
align-items: center;
|
|
@@ -249,7 +217,7 @@ function GradientScroll({ height, gap, children }) {
|
|
|
249
217
|
const onScroll = () => {
|
|
250
218
|
if (ref.current) {
|
|
251
219
|
const { scrollTop, scrollHeight, clientHeight } = ref.current;
|
|
252
|
-
if (
|
|
220
|
+
if (scrollHeight <= clientHeight) {
|
|
253
221
|
setIsNotAtTop(false);
|
|
254
222
|
setIsNotAtBottom(false);
|
|
255
223
|
} else {
|
|
@@ -260,6 +228,15 @@ function GradientScroll({ height, gap, children }) {
|
|
|
260
228
|
};
|
|
261
229
|
useEffect(() => {
|
|
262
230
|
onScroll();
|
|
231
|
+
const resizeObserver = new ResizeObserver(() => {
|
|
232
|
+
onScroll();
|
|
233
|
+
});
|
|
234
|
+
if (ref.current) {
|
|
235
|
+
resizeObserver.observe(ref.current);
|
|
236
|
+
}
|
|
237
|
+
return () => {
|
|
238
|
+
resizeObserver.disconnect();
|
|
239
|
+
};
|
|
263
240
|
}, []);
|
|
264
241
|
return /* @__PURE__ */ jsx(
|
|
265
242
|
GradientScrollContainer,
|
|
@@ -299,8 +276,12 @@ const Avatar = safeStyled.div`
|
|
|
299
276
|
justify-content: center;
|
|
300
277
|
background-color: var(--cpsl-color-background-8);
|
|
301
278
|
`;
|
|
279
|
+
export * from "./SearchableButtonList.js";
|
|
280
|
+
export * from "./QuantityInput.js";
|
|
281
|
+
import { AnimatedHeightWrapper } from "./Body/AnimatedHeightWrapper.js";
|
|
302
282
|
export {
|
|
303
283
|
AccountTypeIcon,
|
|
284
|
+
AnimatedHeightWrapper,
|
|
304
285
|
AssetIcon,
|
|
305
286
|
CenteredText,
|
|
306
287
|
ErrorContainer,
|
|
@@ -323,6 +304,5 @@ export {
|
|
|
323
304
|
QRContainer,
|
|
324
305
|
SpinnerContainer,
|
|
325
306
|
StepContainer,
|
|
326
|
-
StyledCpslTileButton
|
|
327
|
-
WalletTypeIcon
|
|
307
|
+
StyledCpslTileButton
|
|
328
308
|
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import "../../chunk-MMUBH76A.js";
|
|
3
|
+
import { useEffect, useState } from "react";
|
|
4
|
+
function useDebounce(value, delay = 500) {
|
|
5
|
+
const [debouncedValue, setDebouncedValue] = useState(value);
|
|
6
|
+
useEffect(() => {
|
|
7
|
+
const timer = window.setTimeout(() => {
|
|
8
|
+
setDebouncedValue(value);
|
|
9
|
+
}, delay);
|
|
10
|
+
return () => window.clearTimeout(timer);
|
|
11
|
+
}, [value, delay]);
|
|
12
|
+
return debouncedValue;
|
|
13
|
+
}
|
|
14
|
+
export {
|
|
15
|
+
useDebounce
|
|
16
|
+
};
|
|
@@ -6,6 +6,7 @@ import { useEffect, useState } from "react";
|
|
|
6
6
|
import { useInternalClient } from "../../provider/hooks/utils/useInternalClient.js";
|
|
7
7
|
import { useModalStore } from "../stores/index.js";
|
|
8
8
|
import { useAuthActions } from "../../provider/providers/AuthProvider.js";
|
|
9
|
+
import { validatePortalOrigin } from "../utils/validatePortalOrigin.js";
|
|
9
10
|
const useFarcasterLogin = ({
|
|
10
11
|
isActive = false
|
|
11
12
|
} = {}) => {
|
|
@@ -29,8 +30,12 @@ const useFarcasterLogin = ({
|
|
|
29
30
|
}
|
|
30
31
|
}, [isActive, url]);
|
|
31
32
|
useEffect(() => {
|
|
33
|
+
if (typeof window === "undefined") return;
|
|
32
34
|
const updateState = (event) => __async(void 0, null, function* () {
|
|
33
35
|
var _a, _b;
|
|
36
|
+
if (!validatePortalOrigin(event, para.ctx)) {
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
34
39
|
switch (event.data.type) {
|
|
35
40
|
case "FARCASTER_LOGIN":
|
|
36
41
|
setMsgStatus("pending");
|
|
@@ -55,7 +60,9 @@ const useFarcasterLogin = ({
|
|
|
55
60
|
window == null ? void 0 : window.addEventListener("message", updateState, false);
|
|
56
61
|
}
|
|
57
62
|
return () => {
|
|
58
|
-
|
|
63
|
+
if (typeof window !== "undefined") {
|
|
64
|
+
window.removeEventListener("message", updateState, false);
|
|
65
|
+
}
|
|
59
66
|
};
|
|
60
67
|
}, [isActive]);
|
|
61
68
|
return {
|
|
@@ -5,6 +5,7 @@ import {
|
|
|
5
5
|
import { useEffect, useState } from "react";
|
|
6
6
|
import { useInternalClient } from "../../provider/hooks/utils/useInternalClient.js";
|
|
7
7
|
import { useModalStore } from "../stores/index.js";
|
|
8
|
+
import { validatePortalOrigin } from "../utils/validatePortalOrigin.js";
|
|
8
9
|
const useTelegramLogin = ({
|
|
9
10
|
isActive = false,
|
|
10
11
|
onSubmit,
|
|
@@ -34,6 +35,9 @@ const useTelegramLogin = ({
|
|
|
34
35
|
useEffect(() => {
|
|
35
36
|
const updateState = (event) => __async(void 0, null, function* () {
|
|
36
37
|
var _a, _b;
|
|
38
|
+
if (!validatePortalOrigin(event, para.ctx)) {
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
37
41
|
switch (event.data.type) {
|
|
38
42
|
case "TELEGRAM_LOGIN":
|
|
39
43
|
setMsgStatus("pending");
|
package/dist/modal/index.d.ts
CHANGED
|
@@ -3,6 +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, getAssetCode, getNetworkIcon, getNetworkName, } from '
|
|
6
|
+
export { ON_RAMP_PROVIDERS, ON_RAMP_ASSETS, NETWORKS, getAssetIcon, getAssetCode, getNetworkIcon, getNetworkName, } from '@getpara/react-common';
|
|
7
7
|
export { SaveRecoverySecret } from './components/RecoverySecretStep/RecoverySecretStep.js';
|
|
8
8
|
export * from './utils/validateOnRampConfig.js';
|
package/dist/modal/index.js
CHANGED
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
getAssetCode,
|
|
13
13
|
getNetworkIcon,
|
|
14
14
|
getNetworkName
|
|
15
|
-
} from "
|
|
15
|
+
} from "@getpara/react-common";
|
|
16
16
|
import { SaveRecoverySecret } from "./components/RecoverySecretStep/RecoverySecretStep.js";
|
|
17
17
|
export * from "./utils/validateOnRampConfig.js";
|
|
18
18
|
export {
|
|
@@ -22,6 +22,7 @@ const getActions = (set, get) => ({
|
|
|
22
22
|
const previousStep = get().step;
|
|
23
23
|
const refs = get().refs;
|
|
24
24
|
set({ step });
|
|
25
|
+
refs.currentStep.current = step;
|
|
25
26
|
onModalStepChange == null ? void 0 : onModalStepChange({ previousStep, currentStep: step, canGoBack: get().hasPreviousStep() });
|
|
26
27
|
if (step === ModalStep.ACCOUNT_MAIN) {
|
|
27
28
|
refs.wasSignedIn.current = true;
|
|
@@ -57,6 +58,7 @@ const getActions = (set, get) => ({
|
|
|
57
58
|
step: prevStep,
|
|
58
59
|
stepDirection: -1
|
|
59
60
|
}, prevStep === ModalStep.AUTH_MAIN && { flow: void 0 }));
|
|
61
|
+
refs.currentStep.current = prevStep;
|
|
60
62
|
onModalStepChange == null ? void 0 : onModalStepChange({ previousStep: currentStep, currentStep: prevStep, canGoBack: get().hasPreviousStep() });
|
|
61
63
|
}
|
|
62
64
|
(_a = refs.popupWindow.current) == null ? void 0 : _a.close();
|
|
@@ -71,7 +73,9 @@ const getActions = (set, get) => ({
|
|
|
71
73
|
}
|
|
72
74
|
return !!getPreviousStep(flow, currentStep);
|
|
73
75
|
},
|
|
74
|
-
setFlow: (flow) =>
|
|
76
|
+
setFlow: (flow) => {
|
|
77
|
+
set({ flow });
|
|
78
|
+
},
|
|
75
79
|
isLogin: () => get().flow === "login",
|
|
76
80
|
isAccount: () => get().flow === "account",
|
|
77
81
|
setAuthState: (authState) => {
|
|
@@ -110,6 +114,7 @@ const getActions = (set, get) => ({
|
|
|
110
114
|
setSelectedExternalWallet: (selectedExternalWallet) => set({ selectedExternalWallet }),
|
|
111
115
|
setIsExternalWalletConnecting: (isExternalWalletConnecting) => set({ isExternalWalletConnecting }),
|
|
112
116
|
setExternalWalletError: (externalWalletError) => set({ externalWalletError }),
|
|
117
|
+
setModalError: (modalError) => set({ modalError }),
|
|
113
118
|
setIsUsingMobileConnector: (isUsingMobileConnector) => set({ isUsingMobileConnector }),
|
|
114
119
|
setStepDirection: (stepDirection) => set({ stepDirection }),
|
|
115
120
|
setFarcasterConnectUri: (farcasterConnectUri) => set({ farcasterConnectUri }),
|
|
@@ -132,7 +137,9 @@ const getActions = (set, get) => ({
|
|
|
132
137
|
},
|
|
133
138
|
setAuthStepRoute: (authStepRoute) => set({ authStepRoute }),
|
|
134
139
|
setIsPasskeySupported: (isPasskeySupported) => set({ isPasskeySupported }),
|
|
135
|
-
setAccountLinkOptions: (accountLinkOptions) => set({ accountLinkOptions })
|
|
140
|
+
setAccountLinkOptions: (accountLinkOptions) => set({ accountLinkOptions }),
|
|
141
|
+
setProfileWallet: (profileWallet) => set({ profileWallet }),
|
|
142
|
+
setSendTx: (sendTx) => set({ sendTx })
|
|
136
143
|
});
|
|
137
144
|
export {
|
|
138
145
|
getActions
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import { AvailableWallet } from '@getpara/core-sdk';
|
|
1
2
|
import { ModalStep } from '../../utils/steps.js';
|
|
2
|
-
import { AuthStateLogin, AuthStateSignup, AuthState, AuthStateVerify, OnRampConfig as OnRampConfigBase, OnRampPurchase, TWalletType, Setup2faResponse, SupportedAccountLinks } from '@getpara/web-sdk';
|
|
3
|
+
import { AuthStateLogin, AuthStateSignup, AuthState, AuthStateVerify, OnRampConfig as OnRampConfigBase, OnRampPurchase, TWalletType, Setup2faResponse, SupportedAccountLinks, BroadcastTransactionResult } from '@getpara/web-sdk';
|
|
3
4
|
import { Tab as AddFundsTabType } from '../../components/AddFunds/AddFundsContext.js';
|
|
4
5
|
import { TAuthLayout } from '../../types/modalProps.js';
|
|
5
6
|
import { MutableRefObject } from 'react';
|
|
@@ -37,6 +38,7 @@ interface ModalState {
|
|
|
37
38
|
isUsingMobileConnector?: boolean;
|
|
38
39
|
isExternalWalletConnecting?: boolean;
|
|
39
40
|
externalWalletError?: string[];
|
|
41
|
+
modalError?: string;
|
|
40
42
|
activeWallet: ActiveWallet | undefined;
|
|
41
43
|
farcasterConnectUri: string | undefined;
|
|
42
44
|
twoFactorStatus: Setup2faResponse | undefined;
|
|
@@ -54,9 +56,12 @@ interface ModalState {
|
|
|
54
56
|
telegramIFrame: MutableRefObject<HTMLIFrameElement | null>;
|
|
55
57
|
wasSignedIn: MutableRefObject<boolean | null>;
|
|
56
58
|
initialFarcasterConnected: MutableRefObject<boolean | null>;
|
|
59
|
+
iFrame: MutableRefObject<HTMLIFrameElement | null>;
|
|
57
60
|
};
|
|
58
61
|
isPasskeySupported: boolean;
|
|
59
62
|
accountLinkOptions: SupportedAccountLinks;
|
|
63
|
+
profileWallet?: AvailableWallet;
|
|
64
|
+
sendTx?: BroadcastTransactionResult;
|
|
60
65
|
}
|
|
61
66
|
export interface ModalActions {
|
|
62
67
|
resetState: () => void;
|
|
@@ -85,6 +90,7 @@ export interface ModalActions {
|
|
|
85
90
|
setIsUsingMobileConnector: (isUsingMobileConnector?: boolean) => void;
|
|
86
91
|
setIsExternalWalletConnecting: (isExternalWalletConnecting: boolean) => void;
|
|
87
92
|
setExternalWalletError: (externalWalletError?: string[]) => void;
|
|
93
|
+
setModalError: (modalError?: string) => void;
|
|
88
94
|
setStepDirection: (stepDirection: 1 | -1) => void;
|
|
89
95
|
setFarcasterConnectUri: (_: string | undefined) => void;
|
|
90
96
|
setTwoFactorStatus: (twoFactorStatus?: Setup2faResponse) => void;
|
|
@@ -94,6 +100,8 @@ export interface ModalActions {
|
|
|
94
100
|
setAuthStepRoute: (_?: ModalStep) => void;
|
|
95
101
|
setIsPasskeySupported: (_: boolean) => void;
|
|
96
102
|
setAccountLinkOptions: (_: SupportedAccountLinks) => void;
|
|
103
|
+
setProfileWallet: (_?: AvailableWallet) => void;
|
|
104
|
+
setSendTx: (_?: BroadcastTransactionResult) => void;
|
|
97
105
|
}
|
|
98
106
|
export type ModalStore = ModalState & ModalActions;
|
|
99
107
|
export declare const DEFAULT_MODAL_STATE: Omit<ModalState, 'step' | 'onRampConfig'>;
|
|
@@ -30,6 +30,7 @@ const DEFAULT_MODAL_STATE = {
|
|
|
30
30
|
guestAddFundsTab: void 0,
|
|
31
31
|
isExternalWalletConnecting: false,
|
|
32
32
|
externalWalletError: void 0,
|
|
33
|
+
modalError: void 0,
|
|
33
34
|
activeWallet: [void 0, void 0],
|
|
34
35
|
farcasterConnectUri: void 0,
|
|
35
36
|
twoFactorStatus: void 0,
|
|
@@ -43,10 +44,13 @@ const DEFAULT_MODAL_STATE = {
|
|
|
43
44
|
currentStep: createRef(),
|
|
44
45
|
telegramIFrame: createRef(),
|
|
45
46
|
wasSignedIn: createRef(),
|
|
46
|
-
initialFarcasterConnected: createRef()
|
|
47
|
+
initialFarcasterConnected: createRef(),
|
|
48
|
+
iFrame: createRef()
|
|
47
49
|
},
|
|
48
50
|
isPasskeySupported: true,
|
|
49
|
-
accountLinkOptions: [...LINKED_ACCOUNT_TYPES]
|
|
51
|
+
accountLinkOptions: [...LINKED_ACCOUNT_TYPES],
|
|
52
|
+
profileWallet: void 0,
|
|
53
|
+
sendTx: void 0
|
|
50
54
|
};
|
|
51
55
|
const useModalStore = create()(
|
|
52
56
|
persist(
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import ParaWeb, { CurrentWalletIds, SupportedAccountLinks, TOAuthMethod } from '@getpara/web-sdk';
|
|
1
|
+
import ParaWeb, { BalancesConfig, CurrentWalletIds, SupportedAccountLinks, 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';
|
|
@@ -126,4 +126,8 @@ export interface ParaModalProps {
|
|
|
126
126
|
* If not provided, will default to your Developer Portal configuration or to all available account types.
|
|
127
127
|
*/
|
|
128
128
|
supportedAccountLinks?: SupportedAccountLinks;
|
|
129
|
+
/**
|
|
130
|
+
* Configuration for the profile balances displayed in the Para Modal.
|
|
131
|
+
*/
|
|
132
|
+
balances?: BalancesConfig;
|
|
129
133
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import "../../chunk-MMUBH76A.js";
|
|
3
|
-
import { EMAIL_REGEX } from "
|
|
3
|
+
import { EMAIL_REGEX } from "@getpara/react-common";
|
|
4
4
|
import { formatPhoneNumber } from "@getpara/web-sdk";
|
|
5
5
|
function isCcMatch(countryCode, option) {
|
|
6
6
|
return countryCode === "+1" ? option.selectedLabel === "US" : option.value === countryCode;
|
|
@@ -3,23 +3,72 @@ import "../../chunk-MMUBH76A.js";
|
|
|
3
3
|
import { getCountries, getCountryCallingCode } from "libphonenumber-js";
|
|
4
4
|
const excludedCountries = [
|
|
5
5
|
"AC",
|
|
6
|
+
"AF",
|
|
7
|
+
"AO",
|
|
8
|
+
"AZ",
|
|
9
|
+
"BI",
|
|
10
|
+
"BD",
|
|
11
|
+
"BO",
|
|
6
12
|
"CG",
|
|
7
13
|
"CI",
|
|
8
14
|
"CV",
|
|
15
|
+
"DZ",
|
|
16
|
+
"ER",
|
|
17
|
+
"EG",
|
|
18
|
+
"ET",
|
|
19
|
+
"GE",
|
|
9
20
|
"GF",
|
|
21
|
+
"GG",
|
|
22
|
+
"GH",
|
|
10
23
|
"GP",
|
|
24
|
+
"ID",
|
|
25
|
+
"IQ",
|
|
26
|
+
"JE",
|
|
27
|
+
"JO",
|
|
28
|
+
"KG",
|
|
29
|
+
"KH",
|
|
30
|
+
"KM",
|
|
31
|
+
"KW",
|
|
32
|
+
"KZ",
|
|
33
|
+
"LA",
|
|
34
|
+
"LB",
|
|
35
|
+
"LK",
|
|
36
|
+
"LS",
|
|
37
|
+
"LY",
|
|
38
|
+
"MA",
|
|
11
39
|
"MF",
|
|
40
|
+
"MG",
|
|
41
|
+
"MM",
|
|
42
|
+
"MR",
|
|
43
|
+
"MZ",
|
|
12
44
|
"NC",
|
|
45
|
+
"NG",
|
|
46
|
+
"NP",
|
|
47
|
+
"OM",
|
|
48
|
+
"PK",
|
|
13
49
|
"PM",
|
|
50
|
+
"PS",
|
|
14
51
|
"RE",
|
|
52
|
+
"RU",
|
|
53
|
+
"RW",
|
|
15
54
|
"SD",
|
|
16
55
|
"SH",
|
|
17
56
|
"SJ",
|
|
57
|
+
"SS",
|
|
18
58
|
"TA",
|
|
59
|
+
"TJ",
|
|
60
|
+
"TM",
|
|
61
|
+
"TN",
|
|
62
|
+
"UG",
|
|
63
|
+
"UZ",
|
|
19
64
|
"VA",
|
|
65
|
+
"VN",
|
|
20
66
|
"WF",
|
|
21
67
|
"XK",
|
|
22
|
-
"
|
|
68
|
+
"YE",
|
|
69
|
+
"YT",
|
|
70
|
+
"ZM",
|
|
71
|
+
"ZW"
|
|
23
72
|
];
|
|
24
73
|
const generateCountryCodes = () => {
|
|
25
74
|
const countries = getCountries();
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export declare function openPopup({ url, target, type, current, }: {
|
|
2
2
|
url: string;
|
|
3
3
|
target: string;
|
|
4
|
-
type: 'OAUTH' | 'LOGIN_PASSKEY' | 'CREATE_PASSKEY' | 'TRANSACTION_REVIEW' | 'CREATE_PASSWORD' | 'LOGIN_PASSWORD';
|
|
4
|
+
type: 'OAUTH' | 'LOGIN_PASSKEY' | 'CREATE_PASSKEY' | 'TRANSACTION_REVIEW' | 'CREATE_PASSWORD' | 'LOGIN_PASSWORD' | 'SWITCH_WALLETS' | 'ADD_CREDENTIAL' | 'LOGIN_EXTERNAL_WALLET';
|
|
5
5
|
current?: Window | null;
|
|
6
6
|
}): Window | null;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import "../../chunk-MMUBH76A.js";
|
|
3
|
+
import { isMobile } from "@getpara/web-sdk";
|
|
3
4
|
function openPopup({
|
|
4
5
|
url,
|
|
5
6
|
target,
|
|
@@ -17,7 +18,8 @@ function openPopup({
|
|
|
17
18
|
popUpHeight = 798;
|
|
18
19
|
break;
|
|
19
20
|
}
|
|
20
|
-
case "LOGIN_PASSKEY":
|
|
21
|
+
case "LOGIN_PASSKEY":
|
|
22
|
+
case "SWITCH_WALLETS": {
|
|
21
23
|
popUpHeight = 798;
|
|
22
24
|
break;
|
|
23
25
|
}
|
|
@@ -34,6 +36,8 @@ function openPopup({
|
|
|
34
36
|
break;
|
|
35
37
|
}
|
|
36
38
|
case "OAUTH":
|
|
39
|
+
case "ADD_CREDENTIAL":
|
|
40
|
+
case "LOGIN_EXTERNAL_WALLET":
|
|
37
41
|
default: {
|
|
38
42
|
popUpHeight = 768;
|
|
39
43
|
break;
|
|
@@ -47,7 +51,7 @@ function openPopup({
|
|
|
47
51
|
const top = (height - popUpHeight) / 2 + dualScreenTop;
|
|
48
52
|
const windowFeatures = `toolbar=no, menubar=no, width=${popUpWidth},
|
|
49
53
|
height=${popUpHeight}, top=${top}, left=${left}`;
|
|
50
|
-
let popupWindow = window.open(url, target, windowFeatures);
|
|
54
|
+
let popupWindow = window.open(url, isMobile() ? "_blank" : target, windowFeatures);
|
|
51
55
|
if (!popupWindow) {
|
|
52
56
|
setTimeout(() => {
|
|
53
57
|
popupWindow = window.open(url, "_blank");
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import "../../chunk-MMUBH76A.js";
|
|
3
|
+
import { jsx } from "react/jsx-runtime";
|
|
4
|
+
import { Fragment } from "react";
|
|
5
|
+
const renderTextWithLinks = (text) => {
|
|
6
|
+
if (!text) return [/* @__PURE__ */ jsx(Fragment, { children: "" }, 0)];
|
|
7
|
+
const linkStyle = { color: "inherit", textDecoration: "underline", fontWeight: "500" };
|
|
8
|
+
const combinedRegex = /(\[([^\]]+)\]\((https?:\/\/[^)]+)\))|(https?:\/\/[^\s]+)/g;
|
|
9
|
+
const parts = [];
|
|
10
|
+
let lastIndex = 0;
|
|
11
|
+
let match;
|
|
12
|
+
while ((match = combinedRegex.exec(text)) !== null) {
|
|
13
|
+
if (match.index > lastIndex) {
|
|
14
|
+
parts.push(/* @__PURE__ */ jsx(Fragment, { children: text.slice(lastIndex, match.index) }, parts.length));
|
|
15
|
+
}
|
|
16
|
+
if (match[1]) {
|
|
17
|
+
parts.push(
|
|
18
|
+
/* @__PURE__ */ jsx("a", { href: match[3], target: "_blank", rel: "noopener noreferrer", style: linkStyle, children: match[2] }, parts.length)
|
|
19
|
+
);
|
|
20
|
+
} else if (match[4]) {
|
|
21
|
+
parts.push(
|
|
22
|
+
/* @__PURE__ */ jsx("a", { href: match[4], target: "_blank", rel: "noopener noreferrer", style: linkStyle, children: match[4] }, parts.length)
|
|
23
|
+
);
|
|
24
|
+
}
|
|
25
|
+
lastIndex = match.index + match[0].length;
|
|
26
|
+
}
|
|
27
|
+
if (lastIndex < text.length) {
|
|
28
|
+
parts.push(/* @__PURE__ */ jsx(Fragment, { children: text.slice(lastIndex) }, parts.length));
|
|
29
|
+
}
|
|
30
|
+
return parts.length ? parts : [/* @__PURE__ */ jsx(Fragment, { children: text }, 0)];
|
|
31
|
+
};
|
|
32
|
+
export {
|
|
33
|
+
renderTextWithLinks
|
|
34
|
+
};
|