@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.
Files changed (62) hide show
  1. package/dist/cli/cli.mjs +0 -0
  2. package/dist/modal/ParaModal.js +5 -5
  3. package/dist/modal/components/Account/Account.js +4 -3
  4. package/dist/modal/components/Account/AccountHeader.js +10 -16
  5. package/dist/modal/components/Account/AccountProfile.js +33 -4
  6. package/dist/modal/components/Account/AccountProfileLink.js +3 -3
  7. package/dist/modal/components/AddFunds/AddFundsAsset.js +5 -2
  8. package/dist/modal/components/AddFunds/AddFundsContext.d.ts +5 -5
  9. package/dist/modal/components/AwaitingAccountStep/AwaitingAccountStep.d.ts +1 -0
  10. package/dist/modal/components/AwaitingAccountStep/AwaitingAccountStep.js +20 -0
  11. package/dist/modal/components/Body/Body.js +88 -37
  12. package/dist/modal/components/Header/hooks/useStepTitle.js +2 -1
  13. package/dist/modal/components/OAuth/FarcasterLink.d.ts +2 -0
  14. package/dist/modal/components/OAuth/FarcasterLink.js +30 -0
  15. package/dist/modal/components/OAuth/FarcasterOAuthStep.d.ts +1 -3
  16. package/dist/modal/components/OAuth/FarcasterOAuthStep.js +47 -26
  17. package/dist/modal/components/OAuth/OAuth.js +2 -2
  18. package/dist/modal/components/OAuth/TelegramOAuthStep.js +35 -19
  19. package/dist/modal/components/common.d.ts +3 -3
  20. package/dist/modal/constants/constants.d.ts +8 -8
  21. package/dist/modal/constants/constants.js +25 -25
  22. package/dist/modal/hooks/useFarcasterLogin.d.ts +9 -0
  23. package/dist/modal/hooks/useFarcasterLogin.js +70 -0
  24. package/dist/modal/hooks/useTelegramLogin.d.ts +4 -3
  25. package/dist/modal/hooks/useTelegramLogin.js +11 -3
  26. package/dist/modal/stores/modal/actions.js +1 -0
  27. package/dist/modal/stores/modal/useModalStore.d.ts +2 -0
  28. package/dist/modal/stores/modal/useModalStore.js +1 -0
  29. package/dist/modal/types/modalProps.d.ts +5 -1
  30. package/dist/modal/utils/renderTextWithLinks.d.ts +2 -0
  31. package/dist/modal/utils/renderTextWithLinks.js +34 -0
  32. package/dist/modal/utils/steps.d.ts +6 -3
  33. package/dist/modal/utils/steps.js +14 -8
  34. package/dist/modal/utils/stringFormatters.d.ts +2 -3
  35. package/dist/modal/utils/stringFormatters.js +0 -5
  36. package/dist/provider/ParaProviderMin.js +6 -2
  37. package/dist/provider/actions/index.d.ts +9 -9
  38. package/dist/provider/components/ExternalWalletWrapper.js +5 -0
  39. package/dist/provider/hooks/mutations/useCreatePregenWallet.d.ts +3 -3
  40. package/dist/provider/hooks/mutations/useSignUpOrLogIn.d.ts +3 -3
  41. package/dist/provider/hooks/mutations/useVerifyFarcaster.d.ts +6 -3
  42. package/dist/provider/hooks/mutations/useVerifyNewAccount.d.ts +3 -3
  43. package/dist/provider/hooks/mutations/useVerifyOAuth.d.ts +3 -3
  44. package/dist/provider/hooks/mutations/useVerifyTelegram.d.ts +9 -6
  45. package/dist/provider/hooks/queries/index.d.ts +1 -0
  46. package/dist/provider/hooks/queries/index.js +2 -0
  47. package/dist/provider/hooks/queries/useLinkedAccounts.js +4 -2
  48. package/dist/provider/hooks/queries/useProfileBalance.d.ts +25 -0
  49. package/dist/provider/hooks/queries/useProfileBalance.js +60 -0
  50. package/dist/provider/hooks/utils/useAssetInfo.d.ts +3 -0
  51. package/dist/provider/hooks/utils/useAssetInfo.js +21 -0
  52. package/dist/provider/hooks/utils/useEventListeners.js +11 -1
  53. package/dist/provider/hooks/utils/useModal.js +3 -3
  54. package/dist/provider/providers/AssetsProvider.d.ts +14 -0
  55. package/dist/provider/providers/AssetsProvider.js +68 -0
  56. package/dist/provider/providers/AuthProvider.d.ts +6 -4
  57. package/dist/provider/providers/AuthProvider.js +120 -52
  58. package/dist/provider/stores/slices/modal.js +4 -1
  59. package/dist/provider/stores/types.d.ts +4 -1
  60. package/package.json +8 -8
  61. package/dist/modal/components/AwaitingIFrameStep/AwaitingIFrameStep.d.ts +0 -1
  62. package/dist/modal/components/AwaitingIFrameStep/AwaitingIFrameStep.js +0 -12
package/dist/cli/cli.mjs CHANGED
File without changes
@@ -27,9 +27,9 @@ import { SDK_VERSION } from "./constants/constants.js";
27
27
  defineCustomElements();
28
28
  const ParaModal = forwardRef((props, ref) => {
29
29
  const storedModalConfig = useStore((state) => state.modalConfig);
30
- const openedToStep = useStore((state) => state.openedToStep);
30
+ const refs = useStore((state) => state.refs);
31
31
  const modalContentRef = useRef(null);
32
- const refs = useModalStore((state) => state.refs);
32
+ const modalRefs = useModalStore((state) => state.refs);
33
33
  const flow = useModalStore((state) => state.flow);
34
34
  const currentStep = useModalStore((state) => state.step);
35
35
  const setAuthState = useModalStore((state) => state.setAuthState);
@@ -153,7 +153,7 @@ const ParaModal = forwardRef((props, ref) => {
153
153
  break;
154
154
  case isAccount:
155
155
  setFlow("account");
156
- if (!openedToStep.current) {
156
+ if (!refs.openedToStep.current) {
157
157
  setStep(ModalStep.ACCOUNT_MAIN);
158
158
  }
159
159
  break;
@@ -223,7 +223,7 @@ const ParaModal = forwardRef((props, ref) => {
223
223
  updateSelectedWallet();
224
224
  }, [para]);
225
225
  useEffect(() => {
226
- if (bareModal && !isAccountLoading && !isConnected && !["signup", "login"].includes(flow != null ? flow : "") && refs.currentStep.current !== ModalStep.AUTH_MAIN) {
226
+ if (bareModal && !isAccountLoading && !isConnected && !["signup", "login"].includes(flow != null ? flow : "") && modalRefs.currentStep.current !== ModalStep.AUTH_MAIN) {
227
227
  setStep(ModalStep.AUTH_MAIN);
228
228
  }
229
229
  }, [bareModal, flow, isConnected, isAccountLoading]);
@@ -256,7 +256,7 @@ const ParaModal = forwardRef((props, ref) => {
256
256
  setIsModalMounted(true);
257
257
  };
258
258
  const handleModalExited = () => __async(void 0, null, function* () {
259
- openedToStep.current = null;
259
+ refs.openedToStep.current = null;
260
260
  setIsModalMounted(false);
261
261
  if (RESET_TO_AUTH_STEPS.includes(currentStep)) {
262
262
  resetModalState();
@@ -8,9 +8,10 @@ import { OnRampStep, useModalStore } from "../../stores/index.js";
8
8
  import { useEffect } from "react";
9
9
  import { ModalStep } from "../../utils/steps.js";
10
10
  import { useInternalClient } from "../../../provider/hooks/utils/useInternalClient.js";
11
- import { useAccount, useWalletBalance } from "../../../provider/index.js";
11
+ import { useAccount } from "../../../provider/index.js";
12
12
  import { EnabledFlow } from "@getpara/web-sdk";
13
13
  import { useAccountLinking } from "../../../provider/providers/AccountLinkProvider.js";
14
+ import { useAssets } from "../../../provider/providers/AssetsProvider.js";
14
15
  import { AccountHeader } from "./AccountHeader.js";
15
16
  const Account = () => {
16
17
  const onRampConfig = useModalStore((state) => state.onRampConfig);
@@ -19,8 +20,8 @@ const Account = () => {
19
20
  const setOnRampStep = useModalStore((state) => state.setOnRampStep);
20
21
  const para = useInternalClient();
21
22
  const { embedded } = useAccount();
22
- const { data: balance } = useWalletBalance();
23
23
  const { isEnabled } = useAccountLinking();
24
+ const { profileBalance } = useAssets();
24
25
  const isGuestMode = embedded.isConnected && embedded.isGuestMode;
25
26
  const cantBuyAndWithdraw = (para.externalWalletConnectionType === "CONNECTION_ONLY" || para.externalWalletConnectionType === "VERIFICATION") && !para.userId;
26
27
  const isOnRampLoaded = !!onRampConfig;
@@ -56,7 +57,7 @@ const Account = () => {
56
57
  /* @__PURE__ */ jsx(AccountHeader, { withBalance: true }),
57
58
  /* @__PURE__ */ jsxs(LowerContainer, { children: [
58
59
  isGuestMode && /* @__PURE__ */ jsxs(Fragment, { children: [
59
- balance && parseFloat(balance) > 0 && /* @__PURE__ */ jsxs(Alert, { children: [
60
+ profileBalance && profileBalance.value && profileBalance.value.value > 0 && /* @__PURE__ */ jsxs(Alert, { children: [
60
61
  /* @__PURE__ */ jsx(CpslIcon, { icon: "alertTriangle", size: "24px", style: { color: "var(--cpsl-color-utility-yellow)" } }),
61
62
  "You've funded this account - complete account setup to maintain access."
62
63
  ] }),
@@ -2,32 +2,26 @@
2
2
  import "../../../chunk-MMUBH76A.js";
3
3
  import { jsx, jsxs } from "react/jsx-runtime";
4
4
  import { getExternalWalletIcon, safeStyled } from "@getpara/react-common";
5
- import { formatBalanceString } from "../../utils/stringFormatters.js";
6
5
  import { CpslIcon, CpslText } from "@getpara/react-components";
7
6
  import { useMemo } from "react";
8
7
  import { truncateAddress } from "@getpara/web-sdk";
9
8
  import { useInternalClient } from "../../../provider/hooks/utils/useInternalClient.js";
10
- import { useAccount, useWallet, useWalletBalance } from "../../../provider/index.js";
9
+ import { useAssets } from "../../../provider/providers/AssetsProvider.js";
10
+ import { useAccount } from "../../../provider/index.js";
11
11
  import { WalletSelect } from "../WalletSelect/WalletSelect.js";
12
- const Balance = () => {
13
- const { data: balance } = useWalletBalance();
14
- return /* @__PURE__ */ jsx(CpslText, { variant: "bodyM", weight: "medium", style: { visibility: !!balance ? "visible" : "hidden" }, children: balance ? formatBalanceString(balance) : "0" });
15
- };
16
12
  const AccountHeader = ({ withBalance = false } = {}) => {
17
13
  const para = useInternalClient();
18
14
  const { connectionType } = useAccount();
19
- const { data: activeWallet } = useWallet();
15
+ const { profileBalance, totalBalance } = useAssets();
16
+ const externalWallet = Object.keys(para == null ? void 0 : para.externalWallets).length > 0 ? Object.values(para.externalWallets)[0] : void 0;
20
17
  const { name, icon, src } = useMemo(() => {
21
18
  var _a;
22
19
  let name2, icon2, src2;
23
20
  switch (true) {
24
- case (activeWallet == null ? void 0 : activeWallet.isExternal):
25
- {
26
- const wallet = Object.values(para.externalWallets)[0];
27
- name2 = (_a = wallet.ensName) != null ? _a : truncateAddress(wallet.address, wallet.type, { prefix: para.cosmosPrefix });
28
- src2 = wallet.ensAvatar;
29
- icon2 = getExternalWalletIcon(wallet.externalProviderId);
30
- }
21
+ case !!externalWallet:
22
+ name2 = (_a = externalWallet.ensName) != null ? _a : truncateAddress(externalWallet.address, externalWallet.type, { prefix: para.cosmosPrefix });
23
+ src2 = externalWallet.ensAvatar;
24
+ icon2 = getExternalWalletIcon(externalWallet.externalProviderId);
31
25
  break;
32
26
  default:
33
27
  name2 = `${para.partnerName} Wallet`;
@@ -36,7 +30,7 @@ const AccountHeader = ({ withBalance = false } = {}) => {
36
30
  break;
37
31
  }
38
32
  return { name: name2, icon: icon2, src: src2 };
39
- }, [activeWallet, para.partnerName, para.partnerLogo, para.externalWallets]);
33
+ }, [para.partnerName, para.partnerLogo, externalWallet]);
40
34
  return /* @__PURE__ */ jsxs(AccountContainer, { children: [
41
35
  /* @__PURE__ */ jsx(
42
36
  CpslIcon,
@@ -51,7 +45,7 @@ const AccountHeader = ({ withBalance = false } = {}) => {
51
45
  }
52
46
  ),
53
47
  connectionType === "both" ? /* @__PURE__ */ jsx(WalletSelect, {}) : /* @__PURE__ */ jsx(CpslText, { variant: "headingXS", weight: "semiBold", color: "contrast", children: name }),
54
- withBalance && /* @__PURE__ */ jsx(Balance, {})
48
+ withBalance && typeof totalBalance === "string" && totalBalance !== "" && /* @__PURE__ */ jsx(CpslText, { variant: "bodyM", weight: "medium", style: { visibility: profileBalance ? "visible" : "hidden" }, children: totalBalance })
55
49
  ] });
56
50
  };
57
51
  const AccountContainer = safeStyled.div`
@@ -9,21 +9,47 @@ import { CpslButton, CpslIcon, CpslText } from "@getpara/react-components";
9
9
  import { useAccount, useClient } from "../../../provider/index.js";
10
10
  import { useLinkedAccounts } from "../../../provider/hooks/index.js";
11
11
  import { getWalletDisplayName } from "../../utils/getWalletDisplayName.js";
12
- import { truncateAddress } from "@getpara/web-sdk";
12
+ import {
13
+ formatAssetQuantity,
14
+ formatCurrency,
15
+ truncateAddress
16
+ } from "@getpara/web-sdk";
13
17
  import { useAccountLinking } from "../../../provider/providers/AccountLinkProvider.js";
18
+ import { useMemo } from "react";
14
19
  import { ACCOUNT_TYPES, safeStyled, useCopyToClipboard } from "@getpara/react-common";
15
20
  import { useExternalWallets } from "../../../provider/providers/ExternalWalletProvider.js";
16
21
  import { useStore } from "../../../provider/stores/useStore.js";
17
22
  import { AccountHeader } from "./AccountHeader.js";
23
+ import { useAssets } from "../../../provider/providers/AssetsProvider.js";
18
24
  const Entry = ({
19
25
  identifier,
20
26
  icon,
21
27
  name,
22
28
  address,
23
29
  addressShort,
30
+ balance: walletBalance,
24
31
  onUnlink
25
32
  }) => {
33
+ const balancesConfig = useStore((state) => {
34
+ var _a;
35
+ return (_a = state.modalConfig) == null ? void 0 : _a.balances;
36
+ });
26
37
  const [isCopied, copy] = useCopyToClipboard();
38
+ const balance = useMemo(() => {
39
+ var _a;
40
+ switch (true) {
41
+ case !balancesConfig:
42
+ case (balancesConfig == null ? void 0 : balancesConfig.displayType) === "AGGREGATED":
43
+ return formatCurrency(walletBalance == null ? void 0 : walletBalance.value);
44
+ default:
45
+ return formatAssetQuantity({
46
+ quantity: (_a = walletBalance == null ? void 0 : walletBalance.assets.find(
47
+ ({ metadata }) => !!metadata && metadata.symbol === balancesConfig.asset.symbol
48
+ )) == null ? void 0 : _a.quantity,
49
+ symbol: balancesConfig.asset.symbol
50
+ });
51
+ }
52
+ }, [balancesConfig, walletBalance]);
27
53
  return /* @__PURE__ */ jsxs(EntryContainer, { children: [
28
54
  icon,
29
55
  /* @__PURE__ */ jsx(EntryDisplayName, { variant: "bodyM", color: "contrast", children: name }),
@@ -43,6 +69,7 @@ const Entry = ({
43
69
  }
44
70
  )
45
71
  ] }) : null }),
72
+ typeof balance === "string" && balance !== "" && /* @__PURE__ */ jsx(CpslText, { variant: "bodyM", color: "contrast", children: balance }),
46
73
  onUnlink && /* @__PURE__ */ jsx(EntryUnlink, { href: "#", onClick: onUnlink, children: "Unlink" })
47
74
  ] }, address != null ? address : identifier);
48
75
  };
@@ -60,13 +87,14 @@ const AccountProfile = ({
60
87
  var _a2;
61
88
  return (_a2 = state.modalConfig) == null ? void 0 : _a2.hideWallets;
62
89
  });
90
+ const { profileBalance } = useAssets();
63
91
  if (!para) {
64
92
  return null;
65
93
  }
66
94
  const externalWallet = (_a = para.authInfo) == null ? void 0 : _a.externalWallet;
67
95
  return /* @__PURE__ */ jsxs(StepContainer, { children: [
68
- /* @__PURE__ */ jsx(AccountHeader, {}),
69
- /* @__PURE__ */ jsxs(ParaConnect, { target: "_blank", href: "https://connect.getpara.com", rel: "noreferrer noopener", children: [
96
+ /* @__PURE__ */ jsx(AccountHeader, { withBalance: true }),
97
+ connectionType !== "external" && /* @__PURE__ */ jsxs(ParaConnect, { target: "_blank", href: "https://connect.getpara.com", rel: "noreferrer noopener", children: [
70
98
  /* @__PURE__ */ jsx(ParaIcon, { icon: "paraIconBrand", size: "40px", inset: "8px", background: "white" }),
71
99
  /* @__PURE__ */ jsxs("div", { children: [
72
100
  "Do even more with your wallet",
@@ -106,7 +134,8 @@ const AccountProfile = ({
106
134
  icon: /* @__PURE__ */ jsx(WalletTypeIcon, { walletType: wallet.type, externalWallet: wallet.externalProviderId, size: "24px" }),
107
135
  name: getWalletDisplayName(para, wallet),
108
136
  address: wallet.address,
109
- addressShort: truncateAddress(wallet.address, wallet.type)
137
+ addressShort: truncateAddress(wallet.address, wallet.type),
138
+ balance: profileBalance == null ? void 0 : profileBalance.wallets.find((w) => w.address === wallet.address)
110
139
  },
111
140
  wallet.address
112
141
  )) })
@@ -9,7 +9,7 @@ import { useEffect, useMemo } from "react";
9
9
  import { HeroAccountTypeIcon, HeroSuccessIcon } from "../common.js";
10
10
  import { VerificationCode } from "../VerificationCodeStep/VerificationCodeStep.js";
11
11
  import { extractAuthInfo } from "@getpara/user-management-client";
12
- import { FarcasterConnectQR } from "../OAuth/FarcasterOAuthStep.js";
12
+ import { FarcasterLink } from "../OAuth/FarcasterLink.js";
13
13
  import { useTelegramLogin } from "../../hooks/useTelegramLogin.js";
14
14
  import { TelegramIFrame } from "../OAuth/TelegramOAuthStep.js";
15
15
  import { AuthInput } from "../AuthInput/AuthInput.js";
@@ -35,7 +35,7 @@ function AccountProfileLink() {
35
35
  isLoaded,
36
36
  setIsLoaded
37
37
  } = useTelegramLogin(
38
- isTelegram ? { isActive: isTelegram, status: linkAccountStatus, onSubmit: verifyTelegramLink } : { isActive: false }
38
+ isTelegram ? { isActive: isTelegram, status: linkAccountStatus, onSubmit: verifyTelegramLink, isLinking: true } : { isActive: false, isLinking: true }
39
39
  ), status = (accountLinkInProgress == null ? void 0 : accountLinkInProgress.isComplete) ? "success" : isTelegram ? telegramStatus : linkAccountStatus, commonWallet = useMemo(() => {
40
40
  const wallet = wallets.find(
41
41
  (w) => [w.name, w.internalId, w.id].includes(externalWalletProvider != null ? externalWalletProvider : "") && w.type === externalWalletType
@@ -140,7 +140,7 @@ function AccountProfileLink() {
140
140
  break;
141
141
  // Farcaster Connect QR
142
142
  case (accountLinkType === "FARCASTER" && status !== "success"):
143
- lower2 = /* @__PURE__ */ jsx(FarcasterConnectQR, {});
143
+ lower2 = /* @__PURE__ */ jsx(FarcasterLink, {});
144
144
  break;
145
145
  // OAuth, External Wallet, Telegram
146
146
  default:
@@ -6,7 +6,7 @@ import {
6
6
  } from "../../../chunk-MMUBH76A.js";
7
7
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
8
8
  import * as comp from "@getpara/react-components";
9
- import { getOnRampNetworks } from "@getpara/web-sdk";
9
+ import { formatCurrency, getOnRampNetworks } from "@getpara/web-sdk";
10
10
  import { safeStyled } from "@getpara/react-common";
11
11
  import { getAssetCode, getAssetName, ON_RAMP_ASSETS } from "../../constants/constants.js";
12
12
  import { useModalStore } from "../../stores/index.js";
@@ -16,10 +16,12 @@ import { useWallet } from "../../../provider/hooks/queries/useWallet.js";
16
16
  import { AssetIcon, GradientScroll } from "../common.js";
17
17
  import { AnimatePresence, motion } from "framer-motion";
18
18
  import { contentMotionProps } from "./common.js";
19
+ import { useAssets } from "../../../provider/providers/AssetsProvider.js";
19
20
  function AddFundsAsset() {
20
21
  const onRampConfig = useModalStore((state) => state.onRampConfig);
21
22
  const { assets, setAsset, network, setNetwork } = useAddFunds();
22
23
  const { data: activeWallet } = useWallet();
24
+ const { assetMetadata } = useAssets();
23
25
  const [searchStr, setSearchStr] = useState("");
24
26
  const onSelect = (_asset) => __async(this, null, function* () {
25
27
  yield setAsset(_asset);
@@ -59,7 +61,8 @@ function AddFundsAsset() {
59
61
  /* @__PURE__ */ jsxs(Info, { children: [
60
62
  /* @__PURE__ */ jsx(Code, { color: "contrast", variant: "bodyL", children: ON_RAMP_ASSETS[asset].code }),
61
63
  /* @__PURE__ */ jsx(Name, { color: "contrast", variant: "bodyS", children: ON_RAMP_ASSETS[asset].name })
62
- ] })
64
+ ] }),
65
+ (assetMetadata == null ? void 0 : assetMetadata[asset]) && /* @__PURE__ */ jsx(comp.CpslText, { variant: "bodyM", children: formatCurrency(assetMetadata[asset].price) })
63
66
  ] }, asset)
64
67
  },
65
68
  asset
@@ -1,6 +1,6 @@
1
1
  import { Dispatch, PropsWithChildren, ReactNode, SetStateAction } from 'react';
2
2
  import { useWallet } from '../../../provider/hooks/index.js';
3
- import { EnabledFlow, Network, OnRampAsset, OnRampConfig, OnRampProvider } from '@getpara/web-sdk';
3
+ import { EnabledFlow, TNetwork, TOnRampAsset, OnRampConfig, OnRampProvider } from '@getpara/web-sdk';
4
4
  import { IconType } from '@getpara/react-components';
5
5
  export type Tab = EnabledFlow;
6
6
  export declare const TABS: [
@@ -10,14 +10,14 @@ export declare const TABS: [
10
10
  ReactNode
11
11
  ][];
12
12
  type Value = {
13
- network: Network | undefined;
13
+ network: TNetwork | undefined;
14
14
  setNetwork: Dispatch<SetStateAction<Value['network']>>;
15
- asset: OnRampAsset | undefined;
15
+ asset: TOnRampAsset | undefined;
16
16
  setAsset: Dispatch<SetStateAction<Value['asset']>>;
17
17
  fiatQuantity: string | undefined;
18
18
  setFiatQuantity: Dispatch<SetStateAction<Value['fiatQuantity']>>;
19
- networks: Network[];
20
- assets: OnRampAsset[];
19
+ networks: TNetwork[];
20
+ assets: TOnRampAsset[];
21
21
  isProviderAllowed: Partial<Record<OnRampProvider, boolean>>;
22
22
  tab: Tab;
23
23
  activeWallet: ReturnType<typeof useWallet>['data'];
@@ -0,0 +1 @@
1
+ export declare const AwaitingAccountStep: () => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,20 @@
1
+ "use client";
2
+ import "../../../chunk-MMUBH76A.js";
3
+ import { jsx } from "react/jsx-runtime";
4
+ import { useModalStore } from "../../stores/index.js";
5
+ import { Waiting } from "../Waiting/Waiting.js";
6
+ const AwaitingAccountStep = () => {
7
+ const isLogin = useModalStore((state) => state.isLogin());
8
+ const verifyState = useModalStore((state) => state.getVerifyState());
9
+ const isSLOPopup = !!(verifyState == null ? void 0 : verifyState.isWalletSelectionNeeded);
10
+ return /* @__PURE__ */ jsx(
11
+ Waiting,
12
+ {
13
+ heading: isLogin ? "Logging you in..." : "Creating your account...",
14
+ subheading: isSLOPopup ? "Follow the prompts presented by your browser." : void 0
15
+ }
16
+ );
17
+ };
18
+ export {
19
+ AwaitingAccountStep
20
+ };
@@ -18,7 +18,7 @@ import { TwoFactorDoneStep } from "../TwoFactorDoneStep/TwoFactorDoneStep.js";
18
18
  import { BiometricCreationStep } from "../BiometricCreationStep/BiometricCreationStep.js";
19
19
  import { AwaitingOAuthStep } from "../AwaitingOAuthStep/AwaitingOAuthStep.js";
20
20
  import { AddFundsAwaiting, AddFundsDone, AddFunds } from "../AddFunds/index.js";
21
- import FarcasterOAuthStep from "../OAuth/FarcasterOAuthStep.js";
21
+ import { FarcasterOAuthStep } from "../OAuth/FarcasterOAuthStep.js";
22
22
  import { Header } from "../Header/Header.js";
23
23
  import { AuthMainStep } from "../AuthMainStep/AuthMainStep.js";
24
24
  import { BODY_MOTION_VARIANTS, BODY_TRANSITION, MOBILE_SIZE } from "../../constants/constants.js";
@@ -42,8 +42,9 @@ import { AccountProfileLinkOptions } from "../Account/AccountProfileLinkOptions.
42
42
  import { AccountProfileLink } from "../Account/AccountProfileLink.js";
43
43
  import { AccountProfileUnlink } from "../Account/AccountProfileUnlink.js";
44
44
  import { ExternalWalletNetworkSelectStep } from "../ExternalWalletNetworkSelectStep/ExternalWalletNetworkSelectStep.js";
45
- import { AwaitingIFrameStep } from "../AwaitingIFrameStep/AwaitingIFrameStep.js";
45
+ import { AwaitingAccountStep } from "../AwaitingAccountStep/AwaitingAccountStep.js";
46
46
  import { Footer } from "../Footer/Footer.js";
47
+ import { renderTextWithLinks } from "../../utils/renderTextWithLinks.js";
47
48
  const MIN_HEIGHT = {
48
49
  [ModalStep.ADD_FUNDS_AWAITING]: "680px"
49
50
  };
@@ -66,6 +67,8 @@ const Body = ({
66
67
  const setStepDirection = useModalStore((state) => state.setStepDirection);
67
68
  const accountAddFundTab = useModalStore((state) => state.accountAddFundTab);
68
69
  const setAccountAddFundTab = useModalStore((state) => state.setAccountAddFundTab);
70
+ const modalError = useModalStore((state) => state.modalError);
71
+ const setModalError = useModalStore((state) => state.setModalError);
69
72
  const embeddedModal = useStore((state) => {
70
73
  var _a;
71
74
  return (_a = state.modalConfig) == null ? void 0 : _a.embeddedModal;
@@ -189,8 +192,8 @@ const Body = ({
189
192
  case ModalStep.EX_WALLET_NETWORK_SELECT: {
190
193
  return /* @__PURE__ */ jsx(ExternalWalletNetworkSelectStep, {});
191
194
  }
192
- case ModalStep.AWAITING_IFRAME: {
193
- return /* @__PURE__ */ jsx(AwaitingIFrameStep, {});
195
+ case ModalStep.AWAITING_ACCOUNT: {
196
+ return /* @__PURE__ */ jsx(AwaitingAccountStep, {});
194
197
  }
195
198
  default: {
196
199
  if (IFrameSteps.includes(currentStep)) {
@@ -234,7 +237,7 @@ const Body = ({
234
237
  setStepDirection(1);
235
238
  },
236
239
  custom: stepDirection,
237
- children: /* @__PURE__ */ jsx(
240
+ children: /* @__PURE__ */ jsxs(
238
241
  BodyContainer,
239
242
  {
240
243
  custom: stepDirection,
@@ -243,32 +246,38 @@ const Body = ({
243
246
  animate: "center",
244
247
  exit: "exit",
245
248
  transition: BODY_TRANSITION,
246
- children: /* @__PURE__ */ jsxs(
247
- InnerContainer,
248
- {
249
- $embeddedModal: !!embeddedModal,
250
- $step: currentStep,
251
- $isIFrameStep: IFrameSteps.includes(currentStep),
252
- children: [
253
- /* @__PURE__ */ jsx(NetworkSpeedBanner, { fontSize: "12px", iconSize: "16px" }),
254
- Content(),
255
- (onRampConfig == null ? void 0 : onRampConfig.testMode) && [
256
- ModalStep.ADD_FUNDS_BUY,
257
- ModalStep.ADD_FUNDS_WITHDRAW,
258
- ModalStep.ADD_FUNDS_AWAITING,
259
- ModalStep.ADD_FUNDS_FAILURE,
260
- ModalStep.ADD_FUNDS_SUCCESS
261
- ].includes(currentStep) && isTestModeAlert && accountAddFundTab !== EnabledFlow.RECEIVE && /* @__PURE__ */ jsx(TestModeAlert, { children: /* @__PURE__ */ jsxs("div", { style: { fontSize: "14px" }, children: [
262
- "This Para Modal is configured to run on-ramp services in ",
263
- /* @__PURE__ */ jsx("b", { children: "test mode" }),
264
- " only, for development purposes. If you are a user of ",
265
- appName,
266
- ", please contact support.",
267
- /* @__PURE__ */ jsx(CloseButton, { onClick: () => setIsTestModeAlert(false), children: /* @__PURE__ */ jsx(CloseX, { icon: "x" }) })
268
- ] }) })
269
- ]
270
- }
271
- )
249
+ children: [
250
+ /* @__PURE__ */ jsxs(
251
+ InnerContainer,
252
+ {
253
+ $embeddedModal: !!embeddedModal,
254
+ $step: currentStep,
255
+ $isIFrameStep: IFrameSteps.includes(currentStep),
256
+ children: [
257
+ /* @__PURE__ */ jsx(NetworkSpeedBanner, { fontSize: "12px", iconSize: "16px" }),
258
+ Content(),
259
+ (onRampConfig == null ? void 0 : onRampConfig.testMode) && [
260
+ ModalStep.ADD_FUNDS_BUY,
261
+ ModalStep.ADD_FUNDS_WITHDRAW,
262
+ ModalStep.ADD_FUNDS_AWAITING,
263
+ ModalStep.ADD_FUNDS_FAILURE,
264
+ ModalStep.ADD_FUNDS_SUCCESS
265
+ ].includes(currentStep) && isTestModeAlert && accountAddFundTab !== EnabledFlow.RECEIVE && /* @__PURE__ */ jsx(TestModeAlert, { children: /* @__PURE__ */ jsxs("div", { style: { fontSize: "14px" }, children: [
266
+ "This Para Modal is configured to run on-ramp services in ",
267
+ /* @__PURE__ */ jsx("b", { children: "test mode" }),
268
+ " only, for development purposes. If you are a user of ",
269
+ appName,
270
+ ", please contact support.",
271
+ /* @__PURE__ */ jsx(CloseButton, { onClick: () => setIsTestModeAlert(false), children: /* @__PURE__ */ jsx(CloseX, { icon: "x" }) })
272
+ ] }) })
273
+ ]
274
+ }
275
+ ),
276
+ modalError && /* @__PURE__ */ jsx(ModalErrorAlert, { children: /* @__PURE__ */ jsxs(ErrorContent, { children: [
277
+ /* @__PURE__ */ jsx(ErrorCloseButton, { onClick: () => setModalError(void 0), children: /* @__PURE__ */ jsx(ErrorCloseIcon, { icon: "x" }) }),
278
+ /* @__PURE__ */ jsx(ErrorText, { children: renderTextWithLinks(modalError) })
279
+ ] }) })
280
+ ]
272
281
  },
273
282
  ["ADD_FUNDS_BUY", "ADD_FUNDS_RECEIVE", "ADD_FUNDS_WITHDRAW"].includes(currentStep) ? "ADD_FUNDS" : currentStep
274
283
  )
@@ -291,7 +300,7 @@ const BodyContainer = safeStyled(motion.div)`
291
300
  position: relative;
292
301
  display: flex;
293
302
  flex-direction: column;
294
- gap: 24px;
303
+ gap: 12px;
295
304
  will-change: auto !important;
296
305
  `;
297
306
  const InnerContainer = safeStyled.div`
@@ -330,17 +339,59 @@ const TestModeAlert = safeStyled(CpslAlert)`
330
339
  right: 16px;
331
340
  z-index: 1000;
332
341
  `;
342
+ const ModalErrorAlert = safeStyled.div`
343
+ background: #fffcec;
344
+ border: 2px solid var(--cpsl-color-utility-yellow);
345
+ border-radius: 4px;
346
+ padding: 8px 8px;
347
+ `;
348
+ const ErrorContent = safeStyled.div`
349
+ display: flex;
350
+ align-items: flex-start;
351
+ gap: 8px;
352
+ position: relative;
353
+ `;
354
+ const ErrorText = safeStyled.div`
355
+ flex: 1;
356
+ font-size: 14px;
357
+ line-height: 1.4;
358
+ color: var(--cpsl-color-black);
359
+ font-weight: 400;
360
+ `;
361
+ const ErrorCloseButton = safeStyled.button`
362
+ background-color: transparent;
363
+ border: none;
364
+ padding: 0;
365
+ cursor: pointer;
366
+ flex-shrink: 0;
367
+ display: flex;
368
+ align-items: center;
369
+ justify-content: center;
370
+ width: 20px;
371
+ height: 20px;
372
+ margin-top: 1px;
373
+ `;
374
+ const ErrorCloseIcon = safeStyled(CpslIcon)`
375
+ --icon-color: var(--cpsl-color-utility-yellow);
376
+ --height: 20px;
377
+ --width: 20px;
378
+ `;
333
379
  const CloseButton = safeStyled.button`
334
380
  background-color: transparent;
335
381
  border: none;
336
- padding: 4px;
382
+ padding: 0;
337
383
  cursor: pointer;
338
- position: absolute;
339
- top: 0;
340
- right: 0;
384
+ flex-shrink: 0;
385
+ display: flex;
386
+ align-items: center;
387
+ justify-content: center;
388
+ width: 20px;
389
+ height: 20px;
341
390
  `;
342
391
  const CloseX = safeStyled(CpslIcon)`
343
- --icon-color: var(--cpsl-color-foreground-0);
392
+ --icon-color: var(--cpsl-color-utility-yellow-dark, #92400e);
393
+ --height: 18px;
394
+ --width: 18px;
344
395
  `;
345
396
  export {
346
397
  Body
@@ -42,6 +42,7 @@ const useStepTitle = () => {
42
42
  [ModalStep.VERIFICATIONS]: "Sign Up",
43
43
  [ModalStep.AWAITING_OAUTH]: signUpOrLogInTitle,
44
44
  [ModalStep.FARCASTER_OAUTH]: signUpOrLogInTitle,
45
+ [ModalStep.TELEGRAM_OAUTH]: signUpOrLogInTitle,
45
46
  [ModalStep.BIOMETRIC_CREATION]: "Sign Up",
46
47
  [ModalStep.PASSWORD_CREATION]: "Sign Up",
47
48
  [ModalStep.AWAITING_BIOMETRIC_CREATION]: "Sign Up",
@@ -69,7 +70,7 @@ const useStepTitle = () => {
69
70
  [ModalStep.ACCOUNT_PROFILE_LIST]: "Link Account",
70
71
  [ModalStep.ACCOUNT_PROFILE_ADD]: "Link Account",
71
72
  [ModalStep.ACCOUNT_PROFILE_REMOVE]: "Unlink Account",
72
- [ModalStep.AWAITING_IFRAME]: isLogin ? "Login" : "Sign Up"
73
+ [ModalStep.AWAITING_ACCOUNT]: isLogin ? "Login" : "Sign Up"
73
74
  }),
74
75
  [isLogin, chainId, hideWallets, authStepTitle]
75
76
  );
@@ -0,0 +1,2 @@
1
+ export declare function FarcasterConnectQR(): import("react/jsx-runtime").JSX.Element;
2
+ export declare const FarcasterLink: () => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,30 @@
1
+ "use client";
2
+ import "../../../chunk-MMUBH76A.js";
3
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
4
+ import { CpslButton, CpslIcon, CpslQrCode, CpslSpinner, CpslText } from "@getpara/react-components";
5
+ import { CenteredText, Heading, InnerStepContainer, QRContainer, StepContainer } from "../common.js";
6
+ import { useModalStore } from "../../stores/index.js";
7
+ import { isMobile } from "@getpara/web-sdk";
8
+ function FarcasterConnectQR() {
9
+ const farcasterConnectUri = useModalStore((state) => state.farcasterConnectUri);
10
+ return /* @__PURE__ */ jsx(Fragment, { children: isMobile() ? /* @__PURE__ */ jsxs(InnerStepContainer, { children: [
11
+ /* @__PURE__ */ jsx(CpslText, { weight: "medium", color: "secondary", children: `Don\u2019t have Farcaster` }),
12
+ /* @__PURE__ */ jsxs(CpslButton, { as: "a", href: "https://link.warpcast.com/download-qr", target: "_blank", variant: "secondary", children: [
13
+ /* @__PURE__ */ jsx(CpslIcon, { slot: "start", icon: "linkExternal" }),
14
+ `Get Farcaster`
15
+ ] })
16
+ ] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
17
+ /* @__PURE__ */ jsx(Heading, { children: "Sign in using Farcaster" }),
18
+ /* @__PURE__ */ jsxs(InnerStepContainer, { children: [
19
+ /* @__PURE__ */ jsx(CenteredText, { variant: "bodyS", color: "secondary", weight: "medium", children: "Scan the QR code with your phone's camera to proceed." }),
20
+ /* @__PURE__ */ jsx(QRContainer, { children: !farcasterConnectUri ? /* @__PURE__ */ jsx(CpslSpinner, { size: 100 }) : /* @__PURE__ */ jsx(CpslQrCode, { url: farcasterConnectUri }) })
21
+ ] })
22
+ ] }) });
23
+ }
24
+ const FarcasterLink = () => {
25
+ return /* @__PURE__ */ jsx(StepContainer, { $wide: true, children: /* @__PURE__ */ jsx(FarcasterConnectQR, {}) });
26
+ };
27
+ export {
28
+ FarcasterConnectQR,
29
+ FarcasterLink
30
+ };
@@ -1,3 +1 @@
1
- export declare function FarcasterConnectQR(): import("react/jsx-runtime").JSX.Element;
2
- declare const FarcasterOAuthStep: () => import("react/jsx-runtime").JSX.Element;
3
- export default FarcasterOAuthStep;
1
+ export declare function FarcasterOAuthStep(): import("react/jsx-runtime").JSX.Element;