@getpara/react-sdk-lite 2.0.0-alpha.52 → 2.0.0-alpha.54
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 +0 -0
- package/dist/modal/ParaModal.js +5 -5
- package/dist/modal/components/Account/Account.js +4 -3
- package/dist/modal/components/Account/AccountHeader.js +10 -16
- package/dist/modal/components/Account/AccountProfile.js +33 -4
- package/dist/modal/components/Account/AccountProfileLink.js +3 -3
- package/dist/modal/components/AddFunds/AddFundsAsset.js +5 -2
- package/dist/modal/components/AddFunds/AddFundsContext.d.ts +5 -5
- package/dist/modal/components/AwaitingAccountStep/AwaitingAccountStep.d.ts +1 -0
- package/dist/modal/components/AwaitingAccountStep/AwaitingAccountStep.js +20 -0
- package/dist/modal/components/Body/Body.js +88 -37
- package/dist/modal/components/Header/hooks/useStepTitle.js +2 -1
- package/dist/modal/components/OAuth/FarcasterLink.d.ts +2 -0
- package/dist/modal/components/OAuth/FarcasterLink.js +30 -0
- package/dist/modal/components/OAuth/FarcasterOAuthStep.d.ts +1 -3
- package/dist/modal/components/OAuth/FarcasterOAuthStep.js +47 -26
- package/dist/modal/components/OAuth/OAuth.js +2 -2
- package/dist/modal/components/OAuth/TelegramOAuthStep.js +35 -19
- package/dist/modal/components/common.d.ts +3 -3
- package/dist/modal/constants/constants.d.ts +8 -8
- package/dist/modal/constants/constants.js +25 -25
- package/dist/modal/hooks/useFarcasterLogin.d.ts +9 -0
- package/dist/modal/hooks/useFarcasterLogin.js +70 -0
- package/dist/modal/hooks/useTelegramLogin.d.ts +4 -3
- package/dist/modal/hooks/useTelegramLogin.js +11 -3
- package/dist/modal/stores/modal/actions.js +1 -0
- package/dist/modal/stores/modal/useModalStore.d.ts +2 -0
- package/dist/modal/stores/modal/useModalStore.js +1 -0
- package/dist/modal/types/modalProps.d.ts +5 -1
- package/dist/modal/utils/renderTextWithLinks.d.ts +2 -0
- package/dist/modal/utils/renderTextWithLinks.js +34 -0
- package/dist/modal/utils/steps.d.ts +6 -3
- package/dist/modal/utils/steps.js +14 -8
- package/dist/modal/utils/stringFormatters.d.ts +2 -3
- package/dist/modal/utils/stringFormatters.js +0 -5
- package/dist/provider/ParaProviderMin.js +6 -2
- package/dist/provider/actions/index.d.ts +9 -9
- package/dist/provider/components/ExternalWalletWrapper.js +5 -0
- package/dist/provider/hooks/mutations/useCreatePregenWallet.d.ts +3 -3
- package/dist/provider/hooks/mutations/useSignUpOrLogIn.d.ts +3 -3
- package/dist/provider/hooks/mutations/useVerifyFarcaster.d.ts +6 -3
- package/dist/provider/hooks/mutations/useVerifyNewAccount.d.ts +3 -3
- package/dist/provider/hooks/mutations/useVerifyOAuth.d.ts +3 -3
- package/dist/provider/hooks/mutations/useVerifyTelegram.d.ts +9 -6
- package/dist/provider/hooks/queries/index.d.ts +1 -0
- package/dist/provider/hooks/queries/index.js +2 -0
- package/dist/provider/hooks/queries/useLinkedAccounts.js +4 -2
- package/dist/provider/hooks/queries/useProfileBalance.d.ts +25 -0
- package/dist/provider/hooks/queries/useProfileBalance.js +60 -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/useEventListeners.js +11 -1
- package/dist/provider/hooks/utils/useModal.js +3 -3
- package/dist/provider/providers/AssetsProvider.d.ts +14 -0
- package/dist/provider/providers/AssetsProvider.js +68 -0
- package/dist/provider/providers/AuthProvider.d.ts +6 -4
- package/dist/provider/providers/AuthProvider.js +120 -52
- package/dist/provider/stores/slices/modal.js +4 -1
- package/dist/provider/stores/types.d.ts +4 -1
- package/package.json +8 -8
- package/dist/modal/components/AwaitingIFrameStep/AwaitingIFrameStep.d.ts +0 -1
- package/dist/modal/components/AwaitingIFrameStep/AwaitingIFrameStep.js +0 -12
|
@@ -1,31 +1,52 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import "../../../chunk-MMUBH76A.js";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
3
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
|
+
import { CpslSpinner } from "@getpara/react-components";
|
|
5
|
+
import { useFarcasterLogin } from "../../hooks/useFarcasterLogin.js";
|
|
6
|
+
import { safeStyled } from "@getpara/react-common";
|
|
7
|
+
import { useEffect, useState } from "react";
|
|
8
|
+
import { getPortalBaseURL } from "@getpara/web-sdk";
|
|
9
|
+
import { useInternalClient } from "../../../provider/hooks/utils/useInternalClient.js";
|
|
10
|
+
function FarcasterOAuthStep() {
|
|
11
|
+
const { url, isLoaded, setIsLoaded } = useFarcasterLogin({
|
|
12
|
+
isActive: true
|
|
13
|
+
});
|
|
14
|
+
const para = useInternalClient();
|
|
15
|
+
const [height, setHeight] = useState(0);
|
|
16
|
+
useEffect(() => {
|
|
17
|
+
const handleMessage = (event) => {
|
|
18
|
+
if (!url) {
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
const portalBase = getPortalBaseURL(para.ctx);
|
|
22
|
+
if (!event.origin.startsWith(portalBase)) {
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
if (event.data) {
|
|
26
|
+
if (event.data.type === "HEIGHT") {
|
|
27
|
+
setHeight(event.data.height);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
window.addEventListener("message", handleMessage);
|
|
32
|
+
return () => window.removeEventListener("message", handleMessage);
|
|
33
|
+
}, [url]);
|
|
34
|
+
return /* @__PURE__ */ jsxs(Container, { children: [
|
|
35
|
+
url && /* @__PURE__ */ jsx(IFrame, { style: { display: isLoaded ? "block" : "none", height }, src: url, onLoad: () => setIsLoaded(true) }),
|
|
36
|
+
(!url || !isLoaded) && /* @__PURE__ */ jsx(CpslSpinner, {})
|
|
37
|
+
] });
|
|
23
38
|
}
|
|
24
|
-
const
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
39
|
+
const Container = safeStyled.div`
|
|
40
|
+
display: flex;
|
|
41
|
+
flex-direction: column;
|
|
42
|
+
align-items: center;
|
|
43
|
+
justify-content: center;
|
|
44
|
+
width: 100%;
|
|
45
|
+
`;
|
|
46
|
+
const IFrame = safeStyled.iframe`
|
|
47
|
+
width: 100%;
|
|
48
|
+
border: none;
|
|
49
|
+
`;
|
|
28
50
|
export {
|
|
29
|
-
|
|
30
|
-
FarcasterOAuthStep_default as default
|
|
51
|
+
FarcasterOAuthStep
|
|
31
52
|
};
|
|
@@ -16,7 +16,7 @@ const OAuth = ({ methods }) => {
|
|
|
16
16
|
const isDark = useStore((state) => state.isDarkTheme);
|
|
17
17
|
const setStep = useModalStore((state) => state.setStep);
|
|
18
18
|
const showAll = useModalStore((state) => state.step === ModalStep.AUTH_MORE || state.step === ModalStep.AUTH_GUEST_SIGNUP);
|
|
19
|
-
const {
|
|
19
|
+
const { verifyOAuth } = useAuthActions();
|
|
20
20
|
const hasMore = methods.length > HAS_MORE_LENGTH;
|
|
21
21
|
const methodsToShow = showAll || !hasMore ? methods : methods.slice(0, HAS_MORE_LENGTH - 1);
|
|
22
22
|
const handleShowAll = () => {
|
|
@@ -25,7 +25,7 @@ const OAuth = ({ methods }) => {
|
|
|
25
25
|
const handleMethodClick = (method) => () => __async(void 0, null, function* () {
|
|
26
26
|
switch (method) {
|
|
27
27
|
case "FARCASTER":
|
|
28
|
-
|
|
28
|
+
setStep(ModalStep.FARCASTER_OAUTH);
|
|
29
29
|
break;
|
|
30
30
|
case "TELEGRAM":
|
|
31
31
|
setStep(ModalStep.TELEGRAM_OAUTH);
|
|
@@ -2,30 +2,53 @@
|
|
|
2
2
|
import "../../../chunk-MMUBH76A.js";
|
|
3
3
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
4
|
import { safeStyled } from "@getpara/react-common";
|
|
5
|
-
import { HeroSpinner } from "@getpara/react-common";
|
|
6
5
|
import { CpslSpinner } from "@getpara/react-components";
|
|
7
6
|
import { useTelegramLogin } from "../../hooks/useTelegramLogin.js";
|
|
7
|
+
import { useEffect, useState } from "react";
|
|
8
8
|
import { useAuthActions } from "../../../provider/providers/AuthProvider.js";
|
|
9
|
-
import { AccountTypeIcon } from "../common.js";
|
|
10
9
|
import { useModalStore } from "../../stores/index.js";
|
|
10
|
+
import { getPortalBaseURL } from "@getpara/web-sdk";
|
|
11
|
+
import { useInternalClient } from "../../../provider/hooks/utils/useInternalClient.js";
|
|
11
12
|
function TelegramOAuthStep() {
|
|
12
13
|
const { verifyTelegramStatus, verifyTelegram } = useAuthActions();
|
|
13
|
-
const { url,
|
|
14
|
+
const { url, isLoaded, setIsLoaded } = useTelegramLogin({
|
|
14
15
|
isActive: true,
|
|
15
16
|
status: verifyTelegramStatus,
|
|
16
|
-
onSubmit: verifyTelegram
|
|
17
|
+
onSubmit: verifyTelegram,
|
|
18
|
+
isLinking: false
|
|
17
19
|
});
|
|
18
|
-
const
|
|
20
|
+
const refs = useModalStore((state) => state.refs);
|
|
21
|
+
const para = useInternalClient();
|
|
22
|
+
const [height, setHeight] = useState(0);
|
|
23
|
+
useEffect(() => {
|
|
24
|
+
const handleMessage = (event) => {
|
|
25
|
+
if (!url) {
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
const portalBase = getPortalBaseURL(para.ctx, true);
|
|
29
|
+
if (!event.origin.startsWith(portalBase)) {
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
if (event.data) {
|
|
33
|
+
if (event.data.type === "HEIGHT") {
|
|
34
|
+
setHeight(event.data.height);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
window.addEventListener("message", handleMessage);
|
|
39
|
+
return () => window.removeEventListener("message", handleMessage);
|
|
40
|
+
}, [url]);
|
|
19
41
|
return /* @__PURE__ */ jsxs(Container, { children: [
|
|
20
|
-
|
|
21
|
-
|
|
42
|
+
url && /* @__PURE__ */ jsx(
|
|
43
|
+
IFrame,
|
|
22
44
|
{
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
45
|
+
ref: refs.telegramIFrame,
|
|
46
|
+
style: { display: isLoaded ? "block" : "none", height },
|
|
47
|
+
src: url,
|
|
48
|
+
onLoad: () => setIsLoaded(true)
|
|
26
49
|
}
|
|
27
|
-
)
|
|
28
|
-
/* @__PURE__ */ jsx(
|
|
50
|
+
),
|
|
51
|
+
(!url || !isLoaded) && /* @__PURE__ */ jsx(CpslSpinner, {})
|
|
29
52
|
] });
|
|
30
53
|
}
|
|
31
54
|
function TelegramIFrame({
|
|
@@ -56,13 +79,6 @@ const Container = safeStyled.div`
|
|
|
56
79
|
justify-content: center;
|
|
57
80
|
width: 100%;
|
|
58
81
|
`;
|
|
59
|
-
const HeroContainer = safeStyled.div`
|
|
60
|
-
display: flex;
|
|
61
|
-
flex-direction: column;
|
|
62
|
-
align-items: center;
|
|
63
|
-
gap: 16px;
|
|
64
|
-
flex: 1;
|
|
65
|
-
`;
|
|
66
82
|
const IFrame = safeStyled.iframe`
|
|
67
83
|
width: 100%;
|
|
68
84
|
height: 52px;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { CpslIcon, CpslInput, CpslText, CpslTileButton } from '@getpara/react-components';
|
|
2
|
-
import {
|
|
2
|
+
import { TExternalWallet, TLinkedAccountType, TNetwork, TOnRampAsset, TWalletType } 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;
|
|
@@ -30,11 +30,11 @@ 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
40
|
export declare function WalletTypeIcon({ className, walletType, externalWallet, ...props }: {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { TNetwork, TOnRampAsset, OnRampMethod, OnRampProvider, TWalletType } from '@getpara/core-sdk';
|
|
2
2
|
import { IconType } from '@getpara/react-components';
|
|
3
3
|
import { Transition, Variants } from 'framer-motion';
|
|
4
4
|
import { DisplayMetadata } from '@getpara/react-common';
|
|
@@ -11,21 +11,21 @@ export type OnRampProviderConfig = DisplayMetadata & {
|
|
|
11
11
|
backgroundColors: string[];
|
|
12
12
|
};
|
|
13
13
|
export declare const ON_RAMP_PROVIDERS: Record<OnRampProvider, OnRampProviderConfig>;
|
|
14
|
-
type Networks = Record<
|
|
14
|
+
type Networks = Record<TNetwork, DisplayMetadata>;
|
|
15
15
|
export declare const WALLET_TYPES_METADATA: Record<TWalletType, DisplayMetadata>;
|
|
16
16
|
export declare const NETWORKS: Networks;
|
|
17
|
-
export declare const ON_RAMP_ASSETS: Record<
|
|
17
|
+
export declare const ON_RAMP_ASSETS: Record<TOnRampAsset, {
|
|
18
18
|
name: string;
|
|
19
19
|
code: string;
|
|
20
20
|
icon: IconType;
|
|
21
21
|
isCircular?: boolean;
|
|
22
22
|
isDark?: boolean;
|
|
23
23
|
}>;
|
|
24
|
-
export declare function getNetworkName(str:
|
|
25
|
-
export declare function getNetworkIcon(str:
|
|
26
|
-
export declare function getAssetCode(str:
|
|
27
|
-
export declare function getAssetName(str:
|
|
28
|
-
export declare function getAssetIcon(str:
|
|
24
|
+
export declare function getNetworkName(str: TNetwork | string): string;
|
|
25
|
+
export declare function getNetworkIcon(str: TNetwork | string): IconType;
|
|
26
|
+
export declare function getAssetCode(str: TOnRampAsset | string): string;
|
|
27
|
+
export declare function getAssetName(str: TOnRampAsset | string): string;
|
|
28
|
+
export declare function getAssetIcon(str: TOnRampAsset | string): "key" | "phone" | "farcaster" | "telegram" | "discord" | "x" | "search" | "wallet" | "cosmos" | "solana" | "para" | "walletConnect" | "close" | "copy" | "safe" | "stripeBrand" | "alertCircle" | "alertTriangle" | "alignVerticalCenter" | "angelListBrand" | "angelList" | "appleBrand" | "apple" | "arbitrumBrand" | "arrowCircleBrokenDownLeft" | "arrowCircleDownFilled" | "arrowCircleDown" | "arrowNarrow" | "arrow" | "asterisk" | "backpack" | "backupKit" | "bank" | "baseBrand" | "beraBrand" | "brush" | "celoBrand" | "checkCircleFilled" | "checkCircle" | "checkSquare" | "check" | "chevronDown" | "chevronRight" | "chevronSelectorVertical" | "chevronUp" | "clock" | "clubhouseBrand" | "clubhouse" | "code" | "coinbase" | "copy07" | "cosmosCircle" | "cosmostation" | "creditCard02" | "creditCard" | "cube03" | "cubeOutline" | "cube" | "currencyDollar" | "decentBrand" | "decent" | "dell" | "discordBrand" | "dot" | "dotsSquare" | "dots" | "downloadCloud" | "download" | "dribbbleBrand" | "dribbble" | "earth" | "edit02" | "emptyCircle" | "ethCircle" | "ethereum" | "eyeOff" | "eye" | "facebookBrand" | "facebook" | "farcasterBrand" | "figmaBrand" | "figma" | "file" | "folder" | "githubBrand" | "github" | "globe" | "glow" | "googleBrand" | "google" | "gridDots" | "haha" | "helpCircle" | "heroAlertCircle" | "heroCheckmarkCapsule" | "heroCheckmark" | "heroEmail" | "heroExternalConnection" | "heroLock" | "heroPasskey" | "heroPhone" | "heroPlusCircleCapsule" | "heroPlusCircle" | "heroWallet" | "home" | "hp" | "image" | "infoCircle" | "instagramBrand" | "instagram" | "keplr" | "laptop" | "leap" | "lenovo" | "lg" | "lightning01" | "lightning" | "linkExternal" | "linkedinBrand" | "linkedin" | "lockKeyholeCircle" | "logOut" | "mail" | "menu" | "metamask" | "monitor" | "moonpayBrand" | "moreLoginOptions" | "motorola" | "nobleBrand" | "okx" | "optimismBrand" | "paraArrow" | "paraBlackBg" | "paraBrand" | "paraIconBrand" | "paraIconQr" | "paraIcon" | "paraLogo" | "paraRingsDark" | "paraRings" | "passcode" | "phantom" | "pintrestBrand" | "pintrest" | "plusCircle" | "plus" | "polygonBrand" | "polygon" | "puzzlePiece" | "qrCode02" | "qrCode" | "rabby" | "rainbow" | "rampNetworkBrand" | "rampNetwork" | "redditBrand" | "reddit" | "refresh" | "samsung" | "send" | "settings" | "share" | "shield" | "signalBrand" | "signal" | "sliders" | "snapchatBrand" | "snapchat" | "solanaCircle" | "solflare" | "spacingHeight" | "star04Filled" | "star05" | "stars01Filled" | "stars02" | "stars" | "stopSquare" | "telegramBrand" | "tetherBrand" | "tikTokBrand" | "tikTok" | "trash" | "tumblrBrand" | "tumblr" | "twitterBrand" | "twitter" | "usdcBrand" | "user01" | "userCircle" | "userPlus" | "user" | "valora" | "wallet02" | "youtubeBrand" | "youtube" | "zerion" | "AD" | "AE" | "AF" | "AG" | "AI" | "AL" | "AM" | "AO" | "AR" | "AS" | "AT" | "AU" | "AW" | "AX" | "AZ" | "BA" | "BB" | "BD" | "BE" | "BF" | "BG" | "BH" | "BI" | "BJ" | "BL" | "BM" | "BN" | "BO" | "BQ" | "BQ2" | "BQ3" | "BR" | "BS" | "BT" | "BW" | "BY" | "BZ" | "CA" | "CC" | "CD" | "CD2" | "CF" | "CH" | "CK" | "CL" | "CM" | "CN" | "CO" | "CR" | "CU" | "CW" | "CX" | "CY" | "CZ" | "DE" | "DJ" | "DK" | "DM" | "DO" | "DS" | "DZ" | "EC" | "EE" | "EG" | "EH" | "ER" | "ES" | "ET" | "FI" | "FJ" | "FK" | "FM" | "FO" | "FR" | "GA" | "GB2" | "GB" | "GD" | "GE" | "GG" | "GH" | "GI" | "GL" | "GM" | "GN" | "GQ" | "GR" | "GT" | "GU" | "GW" | "GY" | "HK" | "HN" | "HR" | "HT" | "HU" | "ID" | "IE" | "IL" | "IM" | "IN" | "IO" | "IQ" | "IR" | "IS" | "IT" | "JE" | "JM" | "JO" | "JP" | "KE" | "KG" | "KH" | "KI" | "KM" | "KN" | "KP" | "KR" | "KW" | "KY" | "KZ" | "LA" | "LB" | "LC" | "LI" | "LK" | "LR" | "LS" | "LT" | "LU" | "LV" | "LY" | "MA" | "MC" | "MD" | "ME" | "MG" | "MH" | "MK" | "ML" | "MM" | "MN" | "MO" | "MP" | "MQ" | "MR" | "MS" | "MT" | "MU" | "MV" | "MW" | "MX" | "MY" | "MZ" | "NA" | "NE" | "NF" | "NG" | "NI" | "NL" | "NO" | "NP" | "NR" | "NU" | "NZ" | "OM" | "PA" | "PE" | "PF" | "PG" | "PH" | "PK" | "PL" | "PN" | "PR" | "PS" | "PT" | "PW" | "PY" | "QA" | "RO" | "RS" | "RU" | "RW" | "SA" | "SB" | "SC" | "SE" | "SG" | "SI" | "SK" | "SL" | "SM" | "SN" | "SO" | "SR" | "SS" | "ST" | "SV" | "SX" | "SY" | "SZ" | "TC" | "TD" | "TG" | "TH" | "TJ" | "TK" | "TL" | "TM" | "TN" | "TO" | "TR" | "TT" | "TV" | "TW" | "TZ" | "UA" | "UG" | "US" | "UY" | "UZ" | "VC" | "VE" | "VG" | "VI" | "VN" | "VU" | "WS" | "YE" | "ZA" | "ZM" | "ZW";
|
|
29
29
|
export declare const MOBILE_SIZE = 480;
|
|
30
30
|
export declare const NETWORK_NOT_SUPPORTED_ERROR = "network not supported";
|
|
31
31
|
export declare const EMAIL_REGEX: RegExp;
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
__spreadProps,
|
|
4
4
|
__spreadValues
|
|
5
5
|
} from "../../chunk-MMUBH76A.js";
|
|
6
|
-
import {
|
|
6
|
+
import { OnRampMethod, OnRampProvider } from "@getpara/core-sdk";
|
|
7
7
|
const PARA_CONNECT = "https://connect.getpara.com/";
|
|
8
8
|
const PARA_TERMS_AND_CONDITIONS = "https://getpara.com/terms";
|
|
9
9
|
const ON_RAMP_PROVIDERS = {
|
|
@@ -48,35 +48,35 @@ const WALLET_TYPES_METADATA = {
|
|
|
48
48
|
COSMOS: { name: "Cosmos", icon: "cosmos", isCircular: true, isDark: true }
|
|
49
49
|
};
|
|
50
50
|
const NETWORKS = Object.entries({
|
|
51
|
-
[
|
|
52
|
-
[
|
|
53
|
-
[
|
|
54
|
-
[
|
|
55
|
-
[
|
|
56
|
-
[
|
|
57
|
-
[
|
|
58
|
-
[
|
|
59
|
-
[
|
|
60
|
-
[
|
|
61
|
-
[
|
|
62
|
-
[
|
|
51
|
+
["ETHEREUM"]: { name: "Ethereum", icon: "ethereum" },
|
|
52
|
+
["SEPOLIA"]: { name: "Sepolia", icon: "ethereum" },
|
|
53
|
+
["ARBITRUM"]: { name: "Arbitrum", icon: "arbitrumBrand" },
|
|
54
|
+
["BASE"]: { name: "Base", icon: "baseBrand" },
|
|
55
|
+
["OPTIMISM"]: { name: "Optimism", icon: "optimismBrand" },
|
|
56
|
+
["POLYGON"]: { name: "Polygon", icon: "polygonBrand" },
|
|
57
|
+
["SOLANA"]: { name: "Solana", icon: "solana" },
|
|
58
|
+
["COSMOS"]: { name: "Cosmos", icon: "cosmos" },
|
|
59
|
+
["CELO"]: { name: "Celo", icon: "celoBrand" },
|
|
60
|
+
["SOLANA_DEVNET"]: { name: "Solana Devnet", icon: "solana" },
|
|
61
|
+
["NOBLE"]: { name: "Noble", icon: "nobleBrand" },
|
|
62
|
+
["BERACHAIN"]: { name: "Berachain", icon: "beraBrand" }
|
|
63
63
|
}).reduce((acc, [key, entry]) => {
|
|
64
64
|
return __spreadProps(__spreadValues({}, acc), {
|
|
65
65
|
[key]: __spreadValues(__spreadValues({}, entry), ICON_TYPES[entry.icon])
|
|
66
66
|
});
|
|
67
67
|
}, {});
|
|
68
68
|
const ON_RAMP_ASSETS = Object.entries({
|
|
69
|
-
[
|
|
70
|
-
[
|
|
71
|
-
[
|
|
72
|
-
[
|
|
73
|
-
[
|
|
74
|
-
[
|
|
75
|
-
[
|
|
76
|
-
[
|
|
77
|
-
[
|
|
78
|
-
[
|
|
79
|
-
[
|
|
69
|
+
["ETHEREUM"]: { name: "Ethereum", code: "ETH", icon: "ethereum" },
|
|
70
|
+
["USDC"]: { name: "USD Coin", code: "USDC", icon: "usdcBrand" },
|
|
71
|
+
["POLYGON"]: { name: "Polygon", code: "POL", icon: "polygonBrand" },
|
|
72
|
+
["SOLANA"]: { name: "Solana", code: "SOL", icon: "solana" },
|
|
73
|
+
["ATOM"]: { name: "Atom", code: "ATOM", icon: "cosmos" },
|
|
74
|
+
["CELO"]: { name: "Celo", code: "CELO", icon: "celoBrand" },
|
|
75
|
+
["TETHER"]: { name: "Tether", code: "USDT", icon: "tetherBrand" },
|
|
76
|
+
["CUSD"]: { name: "Celo Dollar", code: "CUSD", icon: "celoBrand" },
|
|
77
|
+
["CEUR"]: { name: "Celo Euro", code: "CEUR", icon: "celoBrand" },
|
|
78
|
+
["CREAL"]: { name: "Celo Real", code: "CREAL", icon: "celoBrand" },
|
|
79
|
+
["BERA"]: { name: "Berachain", code: "BERA", icon: "beraBrand" }
|
|
80
80
|
}).reduce((acc, [key, entry]) => {
|
|
81
81
|
return __spreadProps(__spreadValues({}, acc), {
|
|
82
82
|
[key]: __spreadValues(__spreadValues({}, entry), ICON_TYPES[entry.icon])
|
|
@@ -126,7 +126,7 @@ const BODY_MOTION_VARIANTS = {
|
|
|
126
126
|
const BODY_TRANSITION = {
|
|
127
127
|
duration: 0.2
|
|
128
128
|
};
|
|
129
|
-
const SDK_VERSION = "2.0.0-alpha.
|
|
129
|
+
const SDK_VERSION = "2.0.0-alpha.54";
|
|
130
130
|
export {
|
|
131
131
|
BODY_MOTION_VARIANTS,
|
|
132
132
|
BODY_TRANSITION,
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { MutationStatus } from '@tanstack/react-query';
|
|
2
|
+
export declare const useFarcasterLogin: ({ isActive, }?: {
|
|
3
|
+
isActive?: boolean;
|
|
4
|
+
}) => {
|
|
5
|
+
url: string | undefined;
|
|
6
|
+
isLoaded: boolean;
|
|
7
|
+
setIsLoaded: import("react").Dispatch<import("react").SetStateAction<boolean>>;
|
|
8
|
+
status: MutationStatus;
|
|
9
|
+
};
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import {
|
|
3
|
+
__async
|
|
4
|
+
} from "../../chunk-MMUBH76A.js";
|
|
5
|
+
import { useEffect, useState } from "react";
|
|
6
|
+
import { useInternalClient } from "../../provider/hooks/utils/useInternalClient.js";
|
|
7
|
+
import { useModalStore } from "../stores/index.js";
|
|
8
|
+
import { useAuthActions } from "../../provider/providers/AuthProvider.js";
|
|
9
|
+
const useFarcasterLogin = ({
|
|
10
|
+
isActive = false
|
|
11
|
+
} = {}) => {
|
|
12
|
+
const para = useInternalClient();
|
|
13
|
+
const refs = useModalStore((state) => state.refs);
|
|
14
|
+
const { verifyFarcasterStatus, verifyFarcaster } = useAuthActions();
|
|
15
|
+
const [url, setUrl] = useState();
|
|
16
|
+
const [isLoaded, setIsLoaded] = useState(false);
|
|
17
|
+
const [msgStatus, setMsgStatus] = useState("idle");
|
|
18
|
+
const status = msgStatus === "success" ? verifyFarcasterStatus : msgStatus;
|
|
19
|
+
useEffect(() => {
|
|
20
|
+
const setup = () => __async(void 0, null, function* () {
|
|
21
|
+
if (!url) {
|
|
22
|
+
yield para.logout();
|
|
23
|
+
yield para.touchSession(true);
|
|
24
|
+
para.constructPortalUrl("loginFarcaster").then(setUrl);
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
if (isActive) {
|
|
28
|
+
setup();
|
|
29
|
+
}
|
|
30
|
+
}, [isActive, url]);
|
|
31
|
+
useEffect(() => {
|
|
32
|
+
const updateState = (event) => __async(void 0, null, function* () {
|
|
33
|
+
var _a, _b;
|
|
34
|
+
switch (event.data.type) {
|
|
35
|
+
case "FARCASTER_LOGIN":
|
|
36
|
+
setMsgStatus("pending");
|
|
37
|
+
break;
|
|
38
|
+
case "FARCASTER_FAILED":
|
|
39
|
+
setMsgStatus("error");
|
|
40
|
+
break;
|
|
41
|
+
case "FARCASTER_SUCCESS":
|
|
42
|
+
setMsgStatus("success");
|
|
43
|
+
if (!!event.data.payload) {
|
|
44
|
+
const authObject = event.data.payload;
|
|
45
|
+
try {
|
|
46
|
+
yield verifyFarcaster(authObject);
|
|
47
|
+
} catch (e) {
|
|
48
|
+
(_b = (_a = refs.telegramIFrame.current) == null ? void 0 : _a.contentWindow) == null ? void 0 : _b.postMessage({ type: "FARCASTER_RETRY" }, "*");
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
break;
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
if (isActive) {
|
|
55
|
+
window == null ? void 0 : window.addEventListener("message", updateState, false);
|
|
56
|
+
}
|
|
57
|
+
return () => {
|
|
58
|
+
window == null ? void 0 : window.removeEventListener("message", updateState, false);
|
|
59
|
+
};
|
|
60
|
+
}, [isActive]);
|
|
61
|
+
return {
|
|
62
|
+
url,
|
|
63
|
+
isLoaded,
|
|
64
|
+
setIsLoaded,
|
|
65
|
+
status
|
|
66
|
+
};
|
|
67
|
+
};
|
|
68
|
+
export {
|
|
69
|
+
useFarcasterLogin
|
|
70
|
+
};
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import { TelegramAuthResponse } from '@getpara/user-management-client';
|
|
1
|
+
import { TelegramAuthResponse, VerifyThirdPartyAuth } from '@getpara/user-management-client';
|
|
2
2
|
import { MutationStatus } from '@tanstack/react-query';
|
|
3
|
-
export declare const useTelegramLogin: ({ isActive, onSubmit, status: propsStatus, }?: {
|
|
3
|
+
export declare const useTelegramLogin: ({ isActive, onSubmit, status: propsStatus, isLinking, }?: {
|
|
4
4
|
isActive?: boolean;
|
|
5
|
-
onSubmit?: (_: TelegramAuthResponse) => void;
|
|
5
|
+
onSubmit?: (_: VerifyThirdPartyAuth | TelegramAuthResponse) => void;
|
|
6
6
|
status?: MutationStatus;
|
|
7
|
+
isLinking?: boolean;
|
|
7
8
|
}) => {
|
|
8
9
|
url: string | undefined;
|
|
9
10
|
isLoaded: boolean;
|
|
@@ -8,7 +8,8 @@ import { useModalStore } from "../stores/index.js";
|
|
|
8
8
|
const useTelegramLogin = ({
|
|
9
9
|
isActive = false,
|
|
10
10
|
onSubmit,
|
|
11
|
-
status: propsStatus
|
|
11
|
+
status: propsStatus,
|
|
12
|
+
isLinking
|
|
12
13
|
} = {}) => {
|
|
13
14
|
const para = useInternalClient();
|
|
14
15
|
const refs = useModalStore((state) => state.refs);
|
|
@@ -17,10 +18,17 @@ const useTelegramLogin = ({
|
|
|
17
18
|
const [msgStatus, setMsgStatus] = useState("idle");
|
|
18
19
|
const status = msgStatus === "success" ? propsStatus : msgStatus;
|
|
19
20
|
useEffect(() => {
|
|
20
|
-
|
|
21
|
+
const setup = () => __async(void 0, null, function* () {
|
|
21
22
|
if (!url) {
|
|
22
|
-
|
|
23
|
+
if (!isLinking) {
|
|
24
|
+
yield para.logout();
|
|
25
|
+
yield para.touchSession(true);
|
|
26
|
+
}
|
|
27
|
+
para.constructPortalUrl(!isLinking ? "telegramLoginVerify" : "telegramLogin").then(setUrl);
|
|
23
28
|
}
|
|
29
|
+
});
|
|
30
|
+
if (isActive) {
|
|
31
|
+
setup();
|
|
24
32
|
}
|
|
25
33
|
}, [isActive, url]);
|
|
26
34
|
useEffect(() => {
|
|
@@ -110,6 +110,7 @@ const getActions = (set, get) => ({
|
|
|
110
110
|
setSelectedExternalWallet: (selectedExternalWallet) => set({ selectedExternalWallet }),
|
|
111
111
|
setIsExternalWalletConnecting: (isExternalWalletConnecting) => set({ isExternalWalletConnecting }),
|
|
112
112
|
setExternalWalletError: (externalWalletError) => set({ externalWalletError }),
|
|
113
|
+
setModalError: (modalError) => set({ modalError }),
|
|
113
114
|
setIsUsingMobileConnector: (isUsingMobileConnector) => set({ isUsingMobileConnector }),
|
|
114
115
|
setStepDirection: (stepDirection) => set({ stepDirection }),
|
|
115
116
|
setFarcasterConnectUri: (farcasterConnectUri) => set({ farcasterConnectUri }),
|
|
@@ -37,6 +37,7 @@ interface ModalState {
|
|
|
37
37
|
isUsingMobileConnector?: boolean;
|
|
38
38
|
isExternalWalletConnecting?: boolean;
|
|
39
39
|
externalWalletError?: string[];
|
|
40
|
+
modalError?: string;
|
|
40
41
|
activeWallet: ActiveWallet | undefined;
|
|
41
42
|
farcasterConnectUri: string | undefined;
|
|
42
43
|
twoFactorStatus: Setup2faResponse | undefined;
|
|
@@ -85,6 +86,7 @@ export interface ModalActions {
|
|
|
85
86
|
setIsUsingMobileConnector: (isUsingMobileConnector?: boolean) => void;
|
|
86
87
|
setIsExternalWalletConnecting: (isExternalWalletConnecting: boolean) => void;
|
|
87
88
|
setExternalWalletError: (externalWalletError?: string[]) => void;
|
|
89
|
+
setModalError: (modalError?: string) => void;
|
|
88
90
|
setStepDirection: (stepDirection: 1 | -1) => void;
|
|
89
91
|
setFarcasterConnectUri: (_: string | undefined) => void;
|
|
90
92
|
setTwoFactorStatus: (twoFactorStatus?: Setup2faResponse) => void;
|
|
@@ -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
|
}
|
|
@@ -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
|
+
};
|
|
@@ -39,7 +39,8 @@ export declare enum ModalStep {
|
|
|
39
39
|
ACCOUNT_PROFILE_ADD = "ACCOUNT_PROFILE_ADD",
|
|
40
40
|
ACCOUNT_PROFILE_LIST = "ACCOUNT_PROFILE_LIST",
|
|
41
41
|
ACCOUNT_PROFILE_REMOVE = "ACCOUNT_PROFILE_REMOVE",
|
|
42
|
-
|
|
42
|
+
AWAITING_ACCOUNT = "AWAITING_ACCOUNT",
|
|
43
|
+
OTP = "OTP"
|
|
43
44
|
}
|
|
44
45
|
export type ModalStepPropU = keyof typeof ModalStep | ModalStep;
|
|
45
46
|
export type ModalStepPropL = Lowercase<ModalStepPropU>;
|
|
@@ -91,7 +92,8 @@ declare enum SignUpModalStep {
|
|
|
91
92
|
ADD_FUNDS_AWAITING = "ADD_FUNDS_AWAITING",
|
|
92
93
|
ADD_FUNDS_SUCCESS = "ADD_FUNDS_SUCCESS",
|
|
93
94
|
ADD_FUNDS_FAILURE = "ADD_FUNDS_FAILURE",
|
|
94
|
-
|
|
95
|
+
AWAITING_ACCOUNT = "AWAITING_ACCOUNT",
|
|
96
|
+
OTP = "OTP"
|
|
95
97
|
}
|
|
96
98
|
export declare const SignUpPreviousStep: {
|
|
97
99
|
[key in SignUpModalStep]: ModalStep | undefined;
|
|
@@ -125,7 +127,8 @@ declare enum LoginModalStep {
|
|
|
125
127
|
ADD_FUNDS_AWAITING = "ADD_FUNDS_AWAITING",
|
|
126
128
|
ADD_FUNDS_SUCCESS = "ADD_FUNDS_SUCCESS",
|
|
127
129
|
ADD_FUNDS_FAILURE = "ADD_FUNDS_FAILURE",
|
|
128
|
-
|
|
130
|
+
AWAITING_ACCOUNT = "AWAITING_ACCOUNT",
|
|
131
|
+
OTP = "OTP"
|
|
129
132
|
}
|
|
130
133
|
export declare const LoginPreviousStep: {
|
|
131
134
|
[key in LoginModalStep]: ModalStep | undefined;
|