@getpara/react-sdk-lite 2.0.0-alpha.39 → 2.0.0-alpha.41

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 (104) hide show
  1. package/dist/css/modal.css +14 -1
  2. package/dist/modal/ParaModal.js +29 -6
  3. package/dist/modal/components/Account/Account.d.ts +1 -5
  4. package/dist/modal/components/Account/Account.js +53 -71
  5. package/dist/modal/components/Account/AccountHeader.d.ts +3 -0
  6. package/dist/modal/components/Account/AccountHeader.js +64 -0
  7. package/dist/modal/components/Account/AccountProfile.d.ts +4 -1
  8. package/dist/modal/components/Account/AccountProfile.js +114 -27
  9. package/dist/modal/components/AddFunds/AddFunds.js +11 -6
  10. package/dist/modal/components/AddFunds/AddFundsAsset.js +5 -32
  11. package/dist/modal/components/AddFunds/AddFundsDone.js +1 -1
  12. package/dist/modal/components/AddFunds/AddFundsProvider.js +1 -1
  13. package/dist/modal/components/AddFunds/AddFundsReceive.js +8 -53
  14. package/dist/modal/components/AuthMainStep/AuthMainStep.js +3 -5
  15. package/dist/modal/components/AuthMainStep/AuthMainStepContent.js +4 -3
  16. package/dist/modal/components/AwaitingPasswordStep/AwaitingPasswordStep.js +4 -1
  17. package/dist/modal/components/BiometricCreationStep/BiometricCreationStep.js +7 -5
  18. package/dist/modal/components/BiometricLoginStep/BiometricLoginStep.js +4 -4
  19. package/dist/modal/components/Body/AnimatedHeightWrapper.d.ts +1 -0
  20. package/dist/modal/components/Body/AnimatedHeightWrapper.js +2 -2
  21. package/dist/modal/components/Body/Body.d.ts +3 -1
  22. package/dist/modal/components/Body/Body.js +40 -47
  23. package/dist/modal/components/ChainSwitch/ChainSwitch.js +13 -21
  24. package/dist/modal/components/Controls/{Selects.d.ts → ChainSelect.d.ts} +0 -1
  25. package/dist/modal/components/Controls/ChainSelect.js +88 -0
  26. package/dist/modal/components/Controls/Controls.js +10 -20
  27. package/dist/modal/components/ExternalWalletNetworkSelectStep/ExternalWalletNetworkSelectStep.js +1 -1
  28. package/dist/modal/components/ExternalWalletStep/ExternalWalletStep.js +17 -12
  29. package/dist/modal/components/ExternalWalletVerificationStep/ExternalWalletVerificationStep.js +1 -1
  30. package/dist/modal/components/Footer/Footer.js +26 -57
  31. package/dist/modal/components/Header/Header.js +46 -8
  32. package/dist/modal/components/Header/hooks/useStepTitle.d.ts +4 -0
  33. package/dist/modal/components/Header/hooks/useStepTitle.js +48 -15
  34. package/dist/modal/components/IFrameStep/IFrameStep.js +22 -10
  35. package/dist/modal/components/LoginDoneStep/LoginDoneStep.js +16 -10
  36. package/dist/modal/components/ModalContent/ModalContent.d.ts +4 -3
  37. package/dist/modal/components/ModalContent/ModalContent.js +5 -1
  38. package/dist/modal/components/OAuth/FarcasterOAuthStep.js +1 -1
  39. package/dist/modal/components/OAuth/OAuth.js +1 -1
  40. package/dist/modal/components/RecoverySecretStep/RecoverySecretStep.js +2 -2
  41. package/dist/modal/components/Setup2FAStep/Setup2FAStep.js +3 -3
  42. package/dist/modal/components/TwoFactorDoneStep/TwoFactorDoneStep.js +1 -1
  43. package/dist/modal/components/VerificationCodeStep/VerificationCodeStep.js +1 -1
  44. package/dist/modal/components/Waiting/Waiting.js +1 -1
  45. package/dist/modal/components/WalletCard/WalletCard.d.ts +6 -3
  46. package/dist/modal/components/WalletCard/WalletCard.js +41 -15
  47. package/dist/modal/components/WalletSelect/WalletSelect.d.ts +11 -0
  48. package/dist/modal/components/WalletSelect/WalletSelect.js +153 -0
  49. package/dist/modal/components/common.d.ts +9 -4
  50. package/dist/modal/components/common.js +67 -13
  51. package/dist/modal/constants/constants.d.ts +7 -12
  52. package/dist/modal/constants/constants.js +7 -1
  53. package/dist/modal/constants/oAuthLogos.d.ts +2 -6
  54. package/dist/modal/constants/oAuthLogos.js +45 -43
  55. package/dist/modal/hooks/useGoBack.js +9 -0
  56. package/dist/modal/types/commonTypes.d.ts +9 -0
  57. package/dist/modal/utils/getWalletDisplayName.js +3 -6
  58. package/dist/modal/utils/icons.d.ts +5 -0
  59. package/dist/modal/utils/icons.js +17 -0
  60. package/dist/provider/ParaProvider.js +24 -129
  61. package/dist/provider/ParaProviderMin.d.ts +4 -0
  62. package/dist/provider/ParaProviderMin.js +140 -0
  63. package/dist/provider/components/CosmosWalletWrapper.d.ts +1 -1
  64. package/dist/provider/components/EvmWalletWrapper.d.ts +1 -1
  65. package/dist/provider/components/ExternalWalletWrapper.js +3 -36
  66. package/dist/provider/components/SolanaWalletWrapper.d.ts +1 -1
  67. package/dist/provider/hooks/mutations/useCreateWallet.d.ts +3 -3
  68. package/dist/provider/hooks/mutations/useCreateWallet.js +1 -1
  69. package/dist/provider/hooks/mutations/useCreateWalletPerType.d.ts +3 -3
  70. package/dist/provider/hooks/mutations/useCreateWalletPerType.js +1 -1
  71. package/dist/provider/hooks/mutations/useIssueJwt.d.ts +3 -3
  72. package/dist/provider/hooks/mutations/useIssueJwt.js +1 -1
  73. package/dist/provider/hooks/mutations/useResendVerificationCode.d.ts +6 -6
  74. package/dist/provider/hooks/mutations/useResendVerificationCode.js +1 -1
  75. package/dist/provider/hooks/mutations/useVerifyExternalWallet.d.ts +4 -42
  76. package/dist/provider/hooks/mutations/useVerifyFarcaster.d.ts +3 -3
  77. package/dist/provider/hooks/mutations/useVerifyFarcaster.js +1 -1
  78. package/dist/provider/hooks/mutations/useVerifyNewAccount.d.ts +6 -0
  79. package/dist/provider/hooks/mutations/useWaitForLogin.d.ts +3 -3
  80. package/dist/provider/hooks/mutations/useWaitForLogin.js +1 -1
  81. package/dist/provider/hooks/mutations/useWaitForSignup.d.ts +3 -3
  82. package/dist/provider/hooks/mutations/useWaitForSignup.js +1 -1
  83. package/dist/provider/hooks/mutations/useWaitForWalletCreation.d.ts +3 -3
  84. package/dist/provider/hooks/mutations/useWaitForWalletCreation.js +1 -1
  85. package/dist/provider/index.d.ts +1 -0
  86. package/dist/provider/index.js +3 -1
  87. package/dist/provider/providers/AccountLinkProvider.js +8 -4
  88. package/dist/provider/providers/AuthProvider.js +28 -14
  89. package/dist/provider/providers/CosmosExternalWalletProvider.d.ts +1 -1
  90. package/dist/provider/providers/CosmosExternalWalletProvider.js +3 -0
  91. package/dist/provider/providers/EvmExternalWalletProvider.d.ts +1 -1
  92. package/dist/provider/providers/EvmExternalWalletProvider.js +3 -0
  93. package/dist/provider/providers/ExternalWalletProvider.js +1 -1
  94. package/dist/provider/providers/SolanaExternalWalletProvider.d.ts +1 -1
  95. package/dist/provider/providers/SolanaExternalWalletProvider.js +3 -0
  96. package/dist/provider/stores/slices/modal.js +16 -12
  97. package/dist/provider/utils/constants.d.ts +5 -0
  98. package/dist/provider/utils/constants.js +64 -1
  99. package/dist/public/PPMori-Regular.woff2 +0 -0
  100. package/dist/public/PPMori-SemiBold.woff2 +0 -0
  101. package/package.json +8 -8
  102. package/dist/modal/components/Controls/Selects.js +0 -173
  103. package/dist/provider/utils/externalWalletDefaults.d.ts +0 -6
  104. package/dist/provider/utils/externalWalletDefaults.js +0 -33
@@ -0,0 +1,88 @@
1
+ "use client";
2
+ import {
3
+ __async
4
+ } from "../../../chunk-MMUBH76A.js";
5
+ import { jsx, jsxs } from "react/jsx-runtime";
6
+ import { CpslText } from "@getpara/react-components";
7
+ import { getNetworkFromChainId, safeStyled } from "@getpara/react-common";
8
+ import { useEffect, useRef } from "react";
9
+ import { useDropdownPosition } from "../AuthInput/hooks/useDropdownPosition.js";
10
+ import { useWallet } from "../../../provider/index.js";
11
+ import { HeaderSelect, HeaderSelectContainer, HeaderSelectItem, NetworkIcon } from "../common.js";
12
+ import { useExternalWallets } from "../../../provider/providers/ExternalWalletProvider.js";
13
+ import { getNetworkName } from "../../constants/constants.js";
14
+ const Chain = ({ chainId, slot, isLarge = false }) => {
15
+ const network = getNetworkFromChainId(chainId);
16
+ const name = getNetworkName(network);
17
+ return /* @__PURE__ */ jsxs(
18
+ "div",
19
+ {
20
+ slot,
21
+ style: { display: "flex", alignItems: "center", gap: "4px", padding: isLarge ? "0px" : "4px 0 4px 8px" },
22
+ children: [
23
+ /* @__PURE__ */ jsx(NetworkIcon, { network, size: isLarge ? "24px" : "16px" }),
24
+ /* @__PURE__ */ jsx(ChainName, { variant: isLarge ? "bodyS" : "bodyXS", color: "contrast", children: name })
25
+ ]
26
+ }
27
+ );
28
+ };
29
+ const ChainSelect = () => {
30
+ var _a;
31
+ const containerRef = useRef(null);
32
+ const { dropdownMaxHeight, dropdownWidth, mobileAnchor, resize } = useDropdownPosition(containerRef);
33
+ const { data: activeWallet } = useWallet();
34
+ const { switchChain, chainId, chains, chainIdSwitchingTo } = useExternalWallets();
35
+ useEffect(() => {
36
+ if (dropdownMaxHeight && chainId) {
37
+ resize();
38
+ }
39
+ }, [chainId, chainIdSwitchingTo, dropdownMaxHeight]);
40
+ const handleChainChange = (chainId2) => __async(void 0, null, function* () {
41
+ yield switchChain(chainId2);
42
+ });
43
+ if (!activeWallet || !activeWallet.isExternal || activeWallet.type === "SOLANA") {
44
+ return null;
45
+ }
46
+ const chainIdToUse = chainIdSwitchingTo != null ? chainIdSwitchingTo : chainId;
47
+ return /* @__PURE__ */ jsx(Container, { children: /* @__PURE__ */ jsx(HeaderSelectContainer, { ref: containerRef, id: "inputContainer", children: /* @__PURE__ */ jsxs(
48
+ HeaderSelect,
49
+ {
50
+ selectedValue: (_a = chainIdToUse == null ? void 0 : chainIdToUse.toString()) != null ? _a : "",
51
+ onCpslSelectValueChange: (e) => {
52
+ handleChainChange(e.detail);
53
+ },
54
+ showFormattedSelectedItem: true,
55
+ placeholder: "Choose chain...",
56
+ anchorElId: "inputContainer",
57
+ dropdownMaxHeight,
58
+ $width: dropdownWidth != null ? dropdownWidth : 0,
59
+ $top: (mobileAnchor != null ? mobileAnchor : 0) + 16 + 1,
60
+ autoWidth: true,
61
+ alignCenter: true,
62
+ selectedItemVariant: "bodyXS",
63
+ children: [
64
+ chainIdToUse && /* @__PURE__ */ jsx(Chain, { slot: "selected-item", chainId: chainIdToUse }),
65
+ chains == null ? void 0 : chains.map((chain) => /* @__PURE__ */ jsx(HeaderSelectItem, { slot: "items", value: chain.id.toString(), children: /* @__PURE__ */ jsx(Chain, { isLarge: true, chainId: chain.id.toString() }) }, chain.id))
66
+ ]
67
+ }
68
+ ) }) });
69
+ };
70
+ const Container = safeStyled.div`
71
+ flex: 0;
72
+ width: 100%;
73
+ display: flex;
74
+ justify-content: center;
75
+ `;
76
+ const ChainName = safeStyled(CpslText)`
77
+ max-width: 150px;
78
+ text-transform: capitalize;
79
+
80
+ &::part(text-element) {
81
+ white-space: nowrap;
82
+ text-overflow: ellipsis;
83
+ overflow: hidden;
84
+ }
85
+ `;
86
+ export {
87
+ ChainSelect
88
+ };
@@ -5,27 +5,18 @@ import { CpslIcon } from "@getpara/react-components";
5
5
  import { safeStyled } from "@getpara/react-common";
6
6
  import { useModalStore } from "../../stores/index.js";
7
7
  import { useGoBack } from "../../hooks/useGoBack.js";
8
- import { AccountSelect, ChainSelect } from "./Selects.js";
9
- import { ModalStep } from "../../utils/steps.js";
8
+ import { ChainSelect } from "./ChainSelect.js";
10
9
  import { HeaderButton } from "@getpara/react-common";
11
10
  import { useStore } from "../../../provider/stores/useStore.js";
12
- import { useAccount } from "../../../provider/index.js";
11
+ import { useStepTitle } from "../Header/hooks/useStepTitle.js";
13
12
  const Controls = ({ onClose }) => {
14
13
  const bareModal = useStore((state) => {
15
14
  var _a;
16
15
  return (_a = state.modalConfig) == null ? void 0 : _a.bareModal;
17
16
  });
18
17
  const hasPreviousStep = useModalStore((state) => state.hasPreviousStep());
19
- const step = useModalStore((state) => state.step);
20
18
  const goBack = useGoBack();
21
- const { isConnected } = useAccount();
22
- const shouldShowSelects = [
23
- ModalStep.ACCOUNT_MAIN,
24
- ModalStep.CHAIN_SWITCH,
25
- ModalStep.ADD_FUNDS_BUY,
26
- ModalStep.ADD_FUNDS_RECEIVE,
27
- ModalStep.ADD_FUNDS_WITHDRAW
28
- ].includes(step);
19
+ const { isControls } = useStepTitle();
29
20
  const handleBackClick = () => {
30
21
  goBack();
31
22
  };
@@ -41,27 +32,26 @@ const Controls = ({ onClose }) => {
41
32
  children: /* @__PURE__ */ jsx(CpslIcon, { icon: "arrow" })
42
33
  }
43
34
  ),
44
- /* @__PURE__ */ jsx(MiddleContainer, { children: shouldShowSelects && isConnected && /* @__PURE__ */ jsxs(Fragment, { children: [
45
- /* @__PURE__ */ jsx(ChainSelect, {}),
46
- /* @__PURE__ */ jsx(AccountSelect, {})
47
- ] }) }),
35
+ /* @__PURE__ */ jsx(MiddleContainer, { children: isControls && /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(ChainSelect, {}) }) }),
48
36
  /* @__PURE__ */ jsx(CloseButton, { bareModal, variant: "ghost", onClick: onClose, children: /* @__PURE__ */ jsx(CpslIcon, { icon: "close" }) })
49
37
  ] });
50
38
  };
51
39
  const Container = safeStyled.div`
52
40
  position: absolute;
53
- width: 100%;
54
- top: 16px;
55
-
41
+ height: 24px;
42
+ top: 0;
43
+ left: -24px;
44
+ right: -24px;
45
+ margin: 0 16px;
56
46
  z-index: 3;
57
47
  display: flex;
58
48
  align-items: center;
59
49
  justify-content: space-between;
60
- gap: 8px;
61
50
  `;
62
51
  const MiddleContainer = safeStyled.div`
63
52
  flex: 1;
64
53
  display: flex;
54
+ width: 100%;
65
55
  align-items: center;
66
56
  justify-content: center;
67
57
  gap: 4px;
@@ -24,7 +24,7 @@ const ExternalWalletNetworkSelectStep = () => {
24
24
  const firstWallet = availableWallets[0];
25
25
  const handleWalletClick = (wallet) => () => {
26
26
  if (accountLinkInProgress) {
27
- linkAccount({ externalWallet: { provider: wallet.id } });
27
+ linkAccount({ externalWallet: { provider: wallet.id, type: wallet.type } });
28
28
  return;
29
29
  }
30
30
  setSelectedExternalWallet({ id: wallet.id, type: wallet.type });
@@ -4,10 +4,10 @@ import {
4
4
  } from "../../../chunk-MMUBH76A.js";
5
5
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
6
6
  import { CpslButton, CpslIcon, CpslQrCode, CpslSpinner, CpslText } from "@getpara/react-components";
7
- import { CenteredText, ErrorContainer, ErrorIcon, InnerStepContainer, QRContainer, StepContainer } from "../common.js";
7
+ import { CenteredText, HeroAccountTypeIcon, InnerStepContainer, QRContainer, StepContainer } from "../common.js";
8
8
  import { useEffect, useMemo, useState } from "react";
9
9
  import { useModalStore } from "../../stores/index.js";
10
- import { safeStyled } from "@getpara/react-common";
10
+ import { HeroSpinner, safeStyled } from "@getpara/react-common";
11
11
  import { useCopyToClipboard } from "@getpara/react-common";
12
12
  import { ModalStep } from "../../utils/steps.js";
13
13
  import { isMobile, isTablet } from "@getpara/web-sdk";
@@ -24,7 +24,7 @@ const ExternalWalletMobileConnect = ({
24
24
  const [isCopied, copy] = useCopyToClipboard();
25
25
  const appName = useStore((state) => state.appName);
26
26
  const [qrUri, setQrUri] = useState(isSelfFetching ? void 0 : propsQrUri);
27
- const isWalletConnect = wallet.id === "walletConnect";
27
+ const isWalletConnect = wallet.id === "WalletConnect";
28
28
  const handleCopy = () => {
29
29
  if (qrUri) {
30
30
  copy(qrUri);
@@ -46,7 +46,7 @@ const ExternalWalletMobileConnect = ({
46
46
  if (wallet.type === "SOLANA" || isMobile() && !isTablet()) {
47
47
  return /* @__PURE__ */ jsxs(Fragment, { children: [
48
48
  wallet.type === "SOLANA" && qrUri && /* @__PURE__ */ jsx(InnerStepContainer, { children: /* @__PURE__ */ jsx(CpslText, { weight: "semiBold", color: "error", children: `Continue in the ${wallet.name} mobile app.` }) }),
49
- wallet.id !== "walletConnect" && /* @__PURE__ */ jsxs(InnerStepContainer, { children: [
49
+ wallet.id !== "WalletConnect" && /* @__PURE__ */ jsxs(InnerStepContainer, { children: [
50
50
  wallet.type === "SOLANA" && qrUri && !wallet.hasIosSafariExtension || wallet.type !== "SOLANA" ? /* @__PURE__ */ jsx(CpslButton, { onClick: () => routeMobileExternalWallet(qrUri), fullWidth: true, children: "Connect Wallet" }) : /* @__PURE__ */ jsx(Text, { weight: "semiBold", children: wallet.hasIosSafariExtension ? `Please install and use the ${wallet.name} extension for iOS Safari.` : `Please navigate to ${appName} in the ${wallet.name} wallet.` }),
51
51
  !wallet.hasIosSafariExtension && /* @__PURE__ */ jsx(Link, { href: (_a = wallet.downloadUrl) != null ? _a : "", target: "_blank", children: /* @__PURE__ */ jsxs(ExternalButton, { variant: "secondary", children: [
52
52
  `Get ${wallet.name}`,
@@ -55,7 +55,7 @@ const ExternalWalletMobileConnect = ({
55
55
  ] })
56
56
  ] });
57
57
  }
58
- const GetWalletButton = /* @__PURE__ */ jsxs(ExternalButton, { variant: "secondary", onClick: isWalletConnect ? onConnectWc : void 0, children: [
58
+ const GetWalletButton = /* @__PURE__ */ jsxs(ExternalButton, { variant: "secondary", onClick: isWalletConnect ? () => onConnectWc(wallet) : void 0, children: [
59
59
  `${isWalletConnect ? "Open" : "Get"} ${wallet.name}`,
60
60
  /* @__PURE__ */ jsx(ExternalIcon, { icon: "linkExternal" })
61
61
  ] });
@@ -88,7 +88,7 @@ const ExternalWalletStep = () => {
88
88
  if (!wallet) {
89
89
  return null;
90
90
  }
91
- const isWalletConnect = wallet.id === "walletConnect";
91
+ const isWalletConnect = wallet.id === "WalletConnect";
92
92
  const isMobileWalletConnect = isMobile() && isWalletConnect;
93
93
  if (isMobileWalletConnect) {
94
94
  /* @__PURE__ */ jsx(InnerStepContainer, { children: /* @__PURE__ */ jsx(Text, { weight: "semiBold", children: "Continue in the WalletConnect modal." }) });
@@ -101,12 +101,17 @@ Please choose another wallet or continue on desktop.` }) });
101
101
  }
102
102
  if (showExtension) {
103
103
  const isInstalled = wallet.installed;
104
+ const isError = !isInstalled || (externalWalletError == null ? void 0 : externalWalletError.length);
104
105
  return /* @__PURE__ */ jsxs(InnerStepContainer, { children: [
105
- isInstalled && !(externalWalletError == null ? void 0 : externalWalletError.length) ? /* @__PURE__ */ jsx(CenteredText, { color: "contrast", weight: "semiBold", children: `Confirm connection request in the ${wallet.name} browser extension.` }) : /* @__PURE__ */ jsxs(ErrorContainer, { children: [
106
- /* @__PURE__ */ jsx(ErrorIcon, { icon: "alertCircle" }),
107
- /* @__PURE__ */ jsx(CpslText, { weight: "semiBold", color: "error", children: isInstalled ? externalWalletError == null ? void 0 : externalWalletError[0] : `${wallet.name} not detected` })
108
- ] }),
109
- /* @__PURE__ */ jsxs(
106
+ /* @__PURE__ */ jsx(
107
+ HeroSpinner,
108
+ {
109
+ icon: /* @__PURE__ */ jsx(HeroAccountTypeIcon, { accountType: wallet.internalId, src: wallet ? wallet.iconUrl : void 0 }),
110
+ status: isError ? "error" : "pending",
111
+ text: isError ? isInstalled ? externalWalletError == null ? void 0 : externalWalletError[0] : `${wallet.name} not detected` : `Confirm connection request in the ${wallet.name} browser extension.`
112
+ }
113
+ ),
114
+ isError && /* @__PURE__ */ jsxs(
110
115
  CpslButton,
111
116
  {
112
117
  as: isInstalled ? "button" : "a",
@@ -115,7 +120,7 @@ Please choose another wallet or continue on desktop.` }) });
115
120
  variant: "secondary",
116
121
  onClick: handleTryAgainClick,
117
122
  children: [
118
- /* @__PURE__ */ jsx(CpslIcon, { slot: "start", icon: isInstalled ? "refresh" : "linkExternal" }),
123
+ /* @__PURE__ */ jsx(CpslIcon, { fullWidth: true, slot: "start", icon: isInstalled ? "refresh" : "linkExternal" }),
119
124
  isInstalled ? "Try Again" : `Get ${wallet.name}`
120
125
  ]
121
126
  }
@@ -20,7 +20,7 @@ const ExternalWalletVerificationStep = () => {
20
20
  }, []);
21
21
  return /* @__PURE__ */ jsxs(StepContainer, { $wide: true, children: [
22
22
  /* @__PURE__ */ jsxs(InnerStepContainer, { children: [
23
- /* @__PURE__ */ jsx(Heading, { variant: "headingS", weight: "bold", children: "Verify Your Wallet" }),
23
+ /* @__PURE__ */ jsx(Heading, { children: "Verify Your Wallet" }),
24
24
  /* @__PURE__ */ jsx(InlineText, { variant: "bodyS", color: "secondary", children: "Sign the message with your wallet to complete sign up." }),
25
25
  !!(externalWalletError == null ? void 0 : externalWalletError[0]) && /* @__PURE__ */ jsxs(ErrorContainer, { children: [
26
26
  /* @__PURE__ */ jsx(ErrorIcon, { icon: "alertCircle" }),
@@ -1,58 +1,40 @@
1
1
  "use client";
2
2
  import "../../../chunk-MMUBH76A.js";
3
- import { Fragment, jsx, jsxs } from "react/jsx-runtime";
3
+ import { jsx, jsxs } from "react/jsx-runtime";
4
4
  import { safeStyled } from "@getpara/react-common";
5
- import { CpslButton, CpslIcon, CpslText } from "@getpara/react-components";
5
+ import { CpslIcon, CpslText } from "@getpara/react-components";
6
+ import { PARA_TERMS_AND_CONDITIONS } from "../../constants/constants.js";
6
7
  import { useModalStore } from "../../stores/index.js";
7
- import { PARA_CONNECT, PARA_TERMS_AND_CONDITIONS } from "../../constants/constants.js";
8
- import { useMemo } from "react";
9
- import { getStepHasFooter } from "../../utils/steps.js";
8
+ import { ModalStep } from "../../utils/steps.js";
10
9
  import { useAccount } from "../../../provider/index.js";
11
10
  const Footer = () => {
12
- const { embedded } = useAccount();
11
+ const { isConnected } = useAccount();
13
12
  const currentStep = useModalStore((state) => state.step);
14
- const accountFooter = (embedded == null ? void 0 : embedded.isConnected) && !embedded.isGuestMode;
15
- const showFooter = accountFooter || getStepHasFooter(currentStep);
16
- const Content = useMemo(() => {
17
- if (accountFooter) {
18
- return /* @__PURE__ */ jsxs(ConnectContainer, { children: [
19
- /* @__PURE__ */ jsxs(ConnectText, { variant: "bodyS", color: "secondary", weight: "medium", children: [
20
- "Access all your wallet\u2019s features at",
21
- " ",
22
- /* @__PURE__ */ jsx("a", { href: PARA_CONNECT, target: "blank", children: /* @__PURE__ */ jsx(ClickableText, { variant: "bodyS", weight: "medium", children: "Para Connect" }) })
23
- ] }),
24
- /* @__PURE__ */ jsx(CpslButton, { as: "a", href: PARA_CONNECT, target: "blank", variant: "ghost", children: /* @__PURE__ */ jsx(RightChevron, { icon: "chevronUp" }) })
25
- ] });
26
- }
27
- return /* @__PURE__ */ jsxs(Fragment, { children: [
28
- /* @__PURE__ */ jsxs(InlineText, { variant: "body2XS", color: "secondary", weight: "medium", children: [
29
- "By logging in you agree to our",
30
- " ",
31
- /* @__PURE__ */ jsx("a", { href: PARA_TERMS_AND_CONDITIONS, target: "blank", children: /* @__PURE__ */ jsx(ClickableText, { variant: "body2XS", weight: "medium", children: "Terms & Conditions" }) })
32
- ] }),
33
- /* @__PURE__ */ jsxs(PoweredByContainer, { children: [
34
- /* @__PURE__ */ jsx(InlineText, { variant: "bodyS", color: "secondary", weight: "medium", children: "Powered by" }),
35
- /* @__PURE__ */ jsx(ParaLogo, { icon: "para" })
36
- ] })
37
- ] });
38
- }, [embedded]);
13
+ const showFooter = !isConnected && [
14
+ ModalStep.AUTH_MAIN,
15
+ ModalStep.AUTH_MORE,
16
+ ModalStep.EX_WALLET_NETWORK_SELECT,
17
+ ModalStep.EX_WALLET_MORE,
18
+ ModalStep.EX_WALLET_SELECTED
19
+ ].includes(currentStep);
39
20
  if (!showFooter) {
40
21
  return null;
41
22
  }
42
- return /* @__PURE__ */ jsx(FooterContainer, { slot: "footer", children: /* @__PURE__ */ jsx(FooterContentContainer, { children: Content }) });
23
+ return /* @__PURE__ */ jsxs(FooterContainer, { children: [
24
+ /* @__PURE__ */ jsxs(InlineText, { variant: "body2XS", color: "secondary", weight: "medium", children: [
25
+ "By logging in you agree to our",
26
+ " ",
27
+ /* @__PURE__ */ jsx("a", { href: PARA_TERMS_AND_CONDITIONS, target: "blank", children: /* @__PURE__ */ jsx(ClickableText, { variant: "body2XS", weight: "medium", children: "Terms & Conditions" }) })
28
+ ] }),
29
+ /* @__PURE__ */ jsx(PoweredByContainer, { children: /* @__PURE__ */ jsx(ParaLogo, { icon: "para" }) })
30
+ ] });
43
31
  };
44
32
  const FooterContainer = safeStyled.div`
45
- display: flex;
46
- flex-direction: column;
47
- align-items: center;
48
- gap: 16px;
49
- padding: 8px 0px;
50
- `;
51
- const FooterContentContainer = safeStyled.div`
52
33
  display: flex;
53
34
  flex-direction: column;
54
35
  align-items: center;
55
36
  gap: 8px;
37
+ margin-top: 16px;
56
38
  `;
57
39
  const PoweredByContainer = safeStyled.div`
58
40
  display: flex;
@@ -60,34 +42,21 @@ const PoweredByContainer = safeStyled.div`
60
42
  align-items: center;
61
43
  justify-content: center;
62
44
  `;
63
- const ConnectContainer = safeStyled.div`
64
- display: flex;
65
- gap: 8px;
66
- align-items: center;
67
- justify-content: center;
68
- `;
69
- const RightChevron = safeStyled(CpslIcon)`
70
- transform: rotate(90deg);
71
-
72
- /* --icon-color: var(--cpsl-color-text-tertiary); */
73
- --height: 24px;
74
- --width: 24px;
75
- `;
76
45
  const InlineText = safeStyled(CpslText)`
77
46
  text-align: center;
78
47
  display: inline-block;
79
48
  `;
80
- const ConnectText = safeStyled(InlineText)`
81
- line-height: 20px;
82
- `;
83
49
  const ClickableText = safeStyled(InlineText)`
84
50
  cursor: pointer;
85
51
  display: inline-block;
52
+
53
+ &:hover {
54
+ text-decoration: underline;}
86
55
  `;
87
56
  const ParaLogo = safeStyled(CpslIcon)`
88
57
  display: inline-block;
89
- --icon-color: var(--cpsl-color-text-secondary);
90
- --width: 49px;
58
+ --icon-color: var(--cpsl-color-text-contrast);
59
+ --width: 46px;
91
60
  --height: auto;
92
61
  `;
93
62
  export {
@@ -1,19 +1,45 @@
1
1
  "use client";
2
2
  import "../../../chunk-MMUBH76A.js";
3
- import { jsx } from "react/jsx-runtime";
4
- import { safeStyled } from "@getpara/react-common";
3
+ import { jsx, jsxs } from "react/jsx-runtime";
4
+ import { getAuthDisplay, safeStyled } from "@getpara/react-common";
5
5
  import { useStepTitle } from "./hooks/useStepTitle.js";
6
6
  import { CenteredText } from "../common.js";
7
7
  import { AnimatePresence, motion } from "framer-motion";
8
8
  import { useModalStore } from "../../stores/index.js";
9
9
  import { BODY_MOTION_VARIANTS, BODY_TRANSITION } from "../../constants/constants.js";
10
+ import { useAccount } from "../../../provider/index.js";
11
+ import { useInternalClient } from "../../../provider/hooks/utils/useInternalClient.js";
12
+ import { CpslIcon, CpslText } from "@getpara/react-components";
13
+ import { ModalStep } from "../../utils/steps.js";
14
+ import { useMemo } from "react";
15
+ const StepTitle = () => {
16
+ const para = useInternalClient();
17
+ const currentStep = useModalStore((state) => state.step);
18
+ const { title, isTitleDisplayed } = useStepTitle();
19
+ const { isConnected, connectionType } = useAccount();
20
+ const content = useMemo(() => {
21
+ if (!isTitleDisplayed) {
22
+ return null;
23
+ }
24
+ if ((para == null ? void 0 : para.authInfo) && connectionType !== "external" && currentStep === ModalStep.ACCOUNT_MAIN) {
25
+ const { name, icon, src } = getAuthDisplay(para.authInfo);
26
+ return /* @__PURE__ */ jsxs(AuthDisplay, { children: [
27
+ /* @__PURE__ */ jsx(CpslIcon, { src, icon, size: "14px", rounded: !!src }),
28
+ /* @__PURE__ */ jsx(CpslText, { variant: "bodyXS", color: "contrast", weight: "medium", children: name })
29
+ ] });
30
+ }
31
+ return /* @__PURE__ */ jsx(CenteredText, { weight: "semiBold", color: "secondary", children: title });
32
+ }, [isTitleDisplayed, para, currentStep, isConnected, connectionType, title]);
33
+ return /* @__PURE__ */ jsx("div", { style: { height: "100%", width: "100%" }, children: content });
34
+ };
10
35
  const Header = () => {
11
- const { title } = useStepTitle();
36
+ const { isControls } = useStepTitle();
12
37
  const stepDirection = useModalStore((state) => state.stepDirection);
13
38
  const currentStep = useModalStore((state) => state.step);
14
39
  return /* @__PURE__ */ jsx(AnimatePresence, { mode: "popLayout", initial: false, custom: stepDirection, children: /* @__PURE__ */ jsx(
15
40
  Container,
16
41
  {
42
+ isVisible: !isControls,
17
43
  custom: stepDirection,
18
44
  variants: BODY_MOTION_VARIANTS,
19
45
  initial: "enter",
@@ -22,21 +48,33 @@ const Header = () => {
22
48
  transition: BODY_TRANSITION,
23
49
  slot: "header",
24
50
  id: "header",
25
- children: /* @__PURE__ */ jsx(CenteredText, { weight: "semiBold", color: "secondary", children: title })
51
+ children: /* @__PURE__ */ jsx(StepTitle, {})
26
52
  },
27
53
  ["ADD_FUNDS_BUY", "ADD_FUNDS_RECEIVE", "ADD_FUNDS_WITHDRAW"].includes(currentStep) ? "ADD_FUNDS" : currentStep
28
54
  ) });
29
55
  };
30
56
  const Container = safeStyled(motion.div)`
31
- position: absolute;
32
- top: 16px;
33
- width: 100%;
34
- z-index: 2;
57
+ margin: 0 16px;
58
+ z-index: 4;
35
59
  display: flex;
36
60
  align-items: center;
37
61
  justify-content: space-between;
38
62
  gap: 8px;
39
63
  flex-wrap: wrap;
64
+ height: 24px;
65
+ visibility: ${({ isVisible }) => isVisible ? "visible" : "hidden"};
66
+ `;
67
+ const AuthDisplay = safeStyled.div`
68
+ display: flex;
69
+ align-items: center;
70
+ justify-content: center;
71
+ gap: 4px;
72
+ width: 100%;
73
+ height: 100%;
74
+
75
+ cpsl-icon {
76
+ --icon-color: var(--cpsl-color-text-contrast);
77
+ }
40
78
  `;
41
79
  export {
42
80
  Header
@@ -1,3 +1,7 @@
1
+ export declare const signUpOrLogInTitle = "Sign Up or Login";
2
+ export declare const connectWalletTitle = "Connect Wallet";
1
3
  export declare const useStepTitle: () => {
2
4
  title: any;
5
+ isTitleDisplayed: boolean;
6
+ isControls: boolean;
3
7
  };
@@ -6,24 +6,42 @@ import { ModalStep } from "../../../utils/steps.js";
6
6
  import { useExternalWallets } from "../../../../provider/providers/ExternalWalletProvider.js";
7
7
  import { useStore } from "../../../../provider/stores/useStore.js";
8
8
  import { useAccountLinking } from "../../../../provider/providers/AccountLinkProvider.js";
9
+ import { useAccount } from "../../../../provider/index.js";
10
+ const signUpOrLogInTitle = "Sign Up or Login";
11
+ const connectWalletTitle = "Connect Wallet";
9
12
  const useStepTitle = () => {
13
+ var _a, _b;
14
+ const logo = useStore((state) => {
15
+ var _a2;
16
+ return (_a2 = state.modalConfig) == null ? void 0 : _a2.logo;
17
+ });
10
18
  const hideWallets = useStore((state) => {
11
- var _a;
12
- return (_a = state.modalConfig) == null ? void 0 : _a.hideWallets;
19
+ var _a2;
20
+ return (_a2 = state.modalConfig) == null ? void 0 : _a2.hideWallets;
13
21
  });
14
22
  const isLogin = useModalStore((state) => state.isLogin());
15
23
  const currentStep = useModalStore((state) => state.step);
24
+ const authLayout = useModalStore((state) => state.authLayout) || [];
25
+ const { connectionType } = useAccount();
26
+ const [isAuthFirst, isAuthCondensed, isExternalFirst, isExternalCondensed, isBothCondensed] = [
27
+ (_a = authLayout[0]) == null ? void 0 : _a.includes("AUTH"),
28
+ authLayout.includes("AUTH:CONDENSED"),
29
+ (_b = authLayout[0]) == null ? void 0 : _b.includes("EXTERNAL"),
30
+ authLayout.includes("EXTERNAL:CONDENSED"),
31
+ authLayout.includes("AUTH:CONDENSED") && authLayout.includes("EXTERNAL:CONDENSED")
32
+ ];
33
+ const authStepTitle = isBothCondensed ? null : isAuthFirst && !isAuthCondensed ? signUpOrLogInTitle : isExternalFirst && !isExternalCondensed ? connectWalletTitle : "";
16
34
  const { chainId } = useExternalWallets();
17
35
  const { isEnabled: isAccountLinkingEnabled } = useAccountLinking();
18
36
  const titles = useMemo(
19
37
  () => ({
20
- [ModalStep.AUTH_MAIN]: "",
21
- [ModalStep.AUTH_MORE]: "Sign Up or Log In",
38
+ [ModalStep.AUTH_MAIN]: authStepTitle,
39
+ [ModalStep.AUTH_MORE]: signUpOrLogInTitle,
22
40
  [ModalStep.AUTH_GUEST_SIGNUP]: "Complete Account Setup",
23
- [ModalStep.EX_WALLET_MORE]: "Connect Wallet",
41
+ [ModalStep.EX_WALLET_MORE]: connectWalletTitle,
24
42
  [ModalStep.VERIFICATIONS]: "Sign Up",
25
- [ModalStep.AWAITING_OAUTH]: isLogin ? "Login" : "Sign Up",
26
- [ModalStep.FARCASTER_OAUTH]: isLogin ? "Login" : "Sign Up",
43
+ [ModalStep.AWAITING_OAUTH]: signUpOrLogInTitle,
44
+ [ModalStep.FARCASTER_OAUTH]: signUpOrLogInTitle,
27
45
  [ModalStep.BIOMETRIC_CREATION]: "Sign Up",
28
46
  [ModalStep.PASSWORD_CREATION]: "Sign Up",
29
47
  [ModalStep.AWAITING_BIOMETRIC_CREATION]: "Sign Up",
@@ -39,12 +57,12 @@ const useStepTitle = () => {
39
57
  [ModalStep.SETUP_2FA]: "2FA",
40
58
  [ModalStep.VERIFY_2FA]: "2FA",
41
59
  [ModalStep.TWO_FACTOR_DONE]: "2FA",
42
- [ModalStep.ADD_FUNDS_BUY]: "",
43
- [ModalStep.ADD_FUNDS_RECEIVE]: "",
44
- [ModalStep.ADD_FUNDS_WITHDRAW]: "",
45
- [ModalStep.ADD_FUNDS_AWAITING]: "",
46
- [ModalStep.ADD_FUNDS_SUCCESS]: "",
47
- [ModalStep.ADD_FUNDS_FAILURE]: "",
60
+ [ModalStep.ADD_FUNDS_BUY]: "Add Funds",
61
+ [ModalStep.ADD_FUNDS_RECEIVE]: "Add Funds",
62
+ [ModalStep.ADD_FUNDS_WITHDRAW]: "Withdraw",
63
+ [ModalStep.ADD_FUNDS_AWAITING]: "Add Funds",
64
+ [ModalStep.ADD_FUNDS_SUCCESS]: "Add Funds",
65
+ [ModalStep.ADD_FUNDS_FAILURE]: "Add Funds",
48
66
  [ModalStep.ACCOUNT_MAIN]: "",
49
67
  [ModalStep.CHAIN_SWITCH]: "",
50
68
  [ModalStep.ACCOUNT_PROFILE]: isAccountLinkingEnabled ? "Profile" : "Settings",
@@ -53,10 +71,25 @@ const useStepTitle = () => {
53
71
  [ModalStep.ACCOUNT_PROFILE_REMOVE]: "Unlink Account",
54
72
  [ModalStep.AWAITING_IFRAME]: isLogin ? "Login" : "Sign Up"
55
73
  }),
56
- [isLogin, chainId, hideWallets]
74
+ [isLogin, chainId, hideWallets, authStepTitle]
57
75
  );
58
- return { title: titles[currentStep] };
76
+ const title = useMemo(() => {
77
+ var _a2;
78
+ if (((_a2 = titles[currentStep]) == null ? void 0 : _a2.length) > 0) {
79
+ return titles[currentStep];
80
+ }
81
+ return null;
82
+ }, [currentStep, titles]);
83
+ const isControls = useMemo(() => {
84
+ return connectionType === "external" && [ModalStep.ACCOUNT_MAIN, ModalStep.CHAIN_SWITCH].includes(currentStep);
85
+ }, [connectionType, currentStep]);
86
+ const isTitleDisplayed = useMemo(() => {
87
+ return !isControls && (currentStep !== ModalStep.AUTH_MAIN || !logo);
88
+ }, [isControls, currentStep, logo]);
89
+ return { title, isTitleDisplayed, isControls };
59
90
  };
60
91
  export {
92
+ connectWalletTitle,
93
+ signUpOrLogInTitle,
61
94
  useStepTitle
62
95
  };
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
  import "../../../chunk-MMUBH76A.js";
3
3
  import { jsx, jsxs } from "react/jsx-runtime";
4
- import { useEffect } from "react";
4
+ import { useEffect, useState } from "react";
5
5
  import { useModalStore } from "../../stores/index.js";
6
6
  import { IFrameSteps } from "../../utils/steps.js";
7
7
  import { safeStyled } from "@getpara/react-common";
@@ -21,30 +21,42 @@ const IFrameStep = () => {
21
21
  return (_a = state.modalConfig) == null ? void 0 : _a.embeddedModal;
22
22
  });
23
23
  const para = useInternalClient();
24
+ const [height, setHeight] = useState(0);
25
+ useEffect(() => {
26
+ if (!IFrameSteps.includes(currentStep)) {
27
+ setHeight(0);
28
+ }
29
+ }, [currentStep]);
24
30
  useEffect(() => {
25
31
  const handleMessage = (event) => {
32
+ if (!iFrameUrl) {
33
+ return;
34
+ }
26
35
  const portalBase = getPortalBaseURL(para.ctx);
27
36
  if (!event.origin.startsWith(portalBase)) {
28
37
  return;
29
38
  }
30
- if (event.data && event.data.type === "LOADED") {
31
- setIsReady(true);
39
+ if (event.data) {
40
+ if (event.data.type === "HEIGHT") {
41
+ setHeight(event.data.height);
42
+ setIsReady(true);
43
+ }
32
44
  }
33
45
  };
34
46
  window.addEventListener("message", handleMessage);
35
47
  return () => window.removeEventListener("message", handleMessage);
36
- }, [setIsReady]);
37
- return /* @__PURE__ */ jsxs(OuterContainer, { $isVisible: IFrameSteps.includes(currentStep), $embeddedModal: !!embeddedModal, children: [
38
- /* @__PURE__ */ jsx(Container, { $isReady: !!isReady, children: /* @__PURE__ */ jsx("iframe", { src: iFrameUrl }) }),
48
+ }, [setIsReady, iFrameUrl]);
49
+ return /* @__PURE__ */ jsxs(OuterContainer, { $isVisible: IFrameSteps.includes(currentStep), $embeddedModal: !!embeddedModal, $isReady: !!isReady, children: [
50
+ /* @__PURE__ */ jsx(Container, { $isReady: !!isReady, $height: height, children: /* @__PURE__ */ jsx("iframe", { src: iFrameUrl }) }),
39
51
  !isReady && /* @__PURE__ */ jsx(SpinnerContainer, { style: { width: "100%", height: "100%", flex: 1, position: "absolute" }, children: /* @__PURE__ */ jsx(CpslSpinner, { size: 100 }) })
40
52
  ] });
41
53
  };
42
54
  const OuterContainer = safeStyled.div`
43
55
  position: relative;
44
- height: ${({ $isVisible }) => $isVisible ? "528px" : "0px"};
56
+ height: ${({ $isVisible, $isReady }) => $isVisible ? $isReady ? "auto" : "200px" : "0px"};
45
57
  width: ${({ $isVisible }) => $isVisible ? "100%" : "0px"};
46
58
  flex: ${({ $isVisible }) => $isVisible ? 1 : "auto"};
47
- padding: ${({ $embeddedModal, $isVisible }) => !$isVisible ? "0px" : $embeddedModal ? "12px 0px 0px" : "72px 72px 32px"};
59
+ padding: 0px;
48
60
  display: flex;
49
61
  align-items: center;
50
62
  justify-content: center;
@@ -54,12 +66,12 @@ const OuterContainer = safeStyled.div`
54
66
  }
55
67
  `;
56
68
  const Container = safeStyled.div`
57
- height: 360px;
69
+ height: ${({ $height }) => $height}px;
58
70
  width: 100%;
59
71
  opacity: ${({ $isReady }) => $isReady ? 1 : 0};
60
72
 
61
73
  & > iframe {
62
- height: 360px;
74
+ height: ${({ $height }) => $height}px;
63
75
  width: 100%;
64
76
  border: none;
65
77
  background: transparent;