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

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 (102) 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 +63 -0
  7. package/dist/modal/components/Account/AccountProfile.d.ts +4 -1
  8. package/dist/modal/components/Account/AccountProfile.js +108 -21
  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/ExternalWalletStep/ExternalWalletStep.js +17 -12
  28. package/dist/modal/components/ExternalWalletVerificationStep/ExternalWalletVerificationStep.js +1 -1
  29. package/dist/modal/components/Footer/Footer.js +26 -57
  30. package/dist/modal/components/Header/Header.js +46 -8
  31. package/dist/modal/components/Header/hooks/useStepTitle.d.ts +4 -0
  32. package/dist/modal/components/Header/hooks/useStepTitle.js +48 -15
  33. package/dist/modal/components/IFrameStep/IFrameStep.js +22 -10
  34. package/dist/modal/components/LoginDoneStep/LoginDoneStep.js +16 -10
  35. package/dist/modal/components/ModalContent/ModalContent.d.ts +4 -3
  36. package/dist/modal/components/ModalContent/ModalContent.js +5 -1
  37. package/dist/modal/components/OAuth/FarcasterOAuthStep.js +1 -1
  38. package/dist/modal/components/OAuth/OAuth.js +1 -1
  39. package/dist/modal/components/RecoverySecretStep/RecoverySecretStep.js +2 -2
  40. package/dist/modal/components/Setup2FAStep/Setup2FAStep.js +3 -3
  41. package/dist/modal/components/TwoFactorDoneStep/TwoFactorDoneStep.js +1 -1
  42. package/dist/modal/components/VerificationCodeStep/VerificationCodeStep.js +1 -1
  43. package/dist/modal/components/Waiting/Waiting.js +1 -1
  44. package/dist/modal/components/WalletCard/WalletCard.d.ts +6 -3
  45. package/dist/modal/components/WalletCard/WalletCard.js +41 -15
  46. package/dist/modal/components/WalletSelect/WalletSelect.d.ts +11 -0
  47. package/dist/modal/components/WalletSelect/WalletSelect.js +153 -0
  48. package/dist/modal/components/common.d.ts +9 -4
  49. package/dist/modal/components/common.js +57 -13
  50. package/dist/modal/constants/constants.d.ts +7 -12
  51. package/dist/modal/constants/constants.js +7 -1
  52. package/dist/modal/constants/oAuthLogos.d.ts +2 -6
  53. package/dist/modal/constants/oAuthLogos.js +42 -40
  54. package/dist/modal/hooks/useGoBack.js +9 -0
  55. package/dist/modal/types/commonTypes.d.ts +8 -0
  56. package/dist/modal/utils/getWalletDisplayName.js +3 -6
  57. package/dist/modal/utils/icons.d.ts +5 -0
  58. package/dist/modal/utils/icons.js +17 -0
  59. package/dist/provider/ParaProvider.js +24 -129
  60. package/dist/provider/ParaProviderMin.d.ts +4 -0
  61. package/dist/provider/ParaProviderMin.js +140 -0
  62. package/dist/provider/components/CosmosWalletWrapper.d.ts +1 -1
  63. package/dist/provider/components/EvmWalletWrapper.d.ts +1 -1
  64. package/dist/provider/components/ExternalWalletWrapper.js +3 -36
  65. package/dist/provider/components/SolanaWalletWrapper.d.ts +1 -1
  66. package/dist/provider/hooks/mutations/useCreateWallet.d.ts +3 -3
  67. package/dist/provider/hooks/mutations/useCreateWallet.js +1 -1
  68. package/dist/provider/hooks/mutations/useCreateWalletPerType.d.ts +3 -3
  69. package/dist/provider/hooks/mutations/useCreateWalletPerType.js +1 -1
  70. package/dist/provider/hooks/mutations/useIssueJwt.d.ts +3 -3
  71. package/dist/provider/hooks/mutations/useIssueJwt.js +1 -1
  72. package/dist/provider/hooks/mutations/useResendVerificationCode.d.ts +6 -6
  73. package/dist/provider/hooks/mutations/useResendVerificationCode.js +1 -1
  74. package/dist/provider/hooks/mutations/useVerifyExternalWallet.d.ts +6 -0
  75. package/dist/provider/hooks/mutations/useVerifyFarcaster.d.ts +3 -3
  76. package/dist/provider/hooks/mutations/useVerifyFarcaster.js +1 -1
  77. package/dist/provider/hooks/mutations/useVerifyNewAccount.d.ts +6 -0
  78. package/dist/provider/hooks/mutations/useWaitForLogin.d.ts +3 -3
  79. package/dist/provider/hooks/mutations/useWaitForLogin.js +1 -1
  80. package/dist/provider/hooks/mutations/useWaitForSignup.d.ts +3 -3
  81. package/dist/provider/hooks/mutations/useWaitForSignup.js +1 -1
  82. package/dist/provider/hooks/mutations/useWaitForWalletCreation.d.ts +3 -3
  83. package/dist/provider/hooks/mutations/useWaitForWalletCreation.js +1 -1
  84. package/dist/provider/index.d.ts +1 -0
  85. package/dist/provider/index.js +3 -1
  86. package/dist/provider/providers/AuthProvider.js +23 -13
  87. package/dist/provider/providers/CosmosExternalWalletProvider.d.ts +1 -1
  88. package/dist/provider/providers/CosmosExternalWalletProvider.js +3 -0
  89. package/dist/provider/providers/EvmExternalWalletProvider.d.ts +1 -1
  90. package/dist/provider/providers/EvmExternalWalletProvider.js +3 -0
  91. package/dist/provider/providers/ExternalWalletProvider.js +1 -1
  92. package/dist/provider/providers/SolanaExternalWalletProvider.d.ts +1 -1
  93. package/dist/provider/providers/SolanaExternalWalletProvider.js +3 -0
  94. package/dist/provider/stores/slices/modal.js +16 -12
  95. package/dist/provider/utils/constants.d.ts +5 -0
  96. package/dist/provider/utils/constants.js +64 -1
  97. package/dist/public/PPMori-Regular.woff2 +0 -0
  98. package/dist/public/PPMori-SemiBold.woff2 +0 -0
  99. package/package.json +8 -8
  100. package/dist/modal/components/Controls/Selects.js +0 -173
  101. package/dist/provider/utils/externalWalletDefaults.d.ts +0 -6
  102. package/dist/provider/utils/externalWalletDefaults.js +0 -33
@@ -5,9 +5,22 @@
5
5
  src: url('../public/Inter-VariableFont_slnt,wght.ttf') format('truetype');
6
6
  }
7
7
 
8
+ @font-face {
9
+ font-family: 'PP Mori';
10
+ src: url('../public/PPMori-Regular.woff2') format('woff2');
11
+ font-weight: 500;
12
+ }
13
+
14
+ @font-face {
15
+ font-family: 'PP Mori';
16
+ src: url('../public/PPMori-SemiBold.woff2') format('woff2');
17
+ font-weight: 600;
18
+ }
19
+
8
20
  html {
9
21
  --cpsl-default-font: 'Inter', sans-serif;
10
22
  -webkit-overflow-scrolling: touch;
11
23
 
12
- --wcm-z-index: 11000 !important;
24
+ --wcm-z-index: 99999 !important;
25
+ --w3m-z-index: 99999 !important;
13
26
  }
@@ -49,10 +49,11 @@ const ParaModal = forwardRef((props, ref) => {
49
49
  const setAuthStepRoute = useModalStore((state) => state.setAuthStepRoute);
50
50
  const { signUpOrLogIn, isCreateGuestWalletsPending } = useAuthActions();
51
51
  const { isReady, isFarcasterMiniApp } = useParaStatus();
52
- const { isLoading: isAccountLoading, isConnected } = useAccount();
52
+ const { isLoading: isAccountLoading, isConnected, embedded } = useAccount();
53
53
  const setIFrameUrl = useModalStore((state) => state.setIFrameUrl);
54
54
  const setIsIFrameReady = useModalStore((state) => state.setIsIFrameReady);
55
55
  const [isModalMounted, setIsModalMounted] = useState(false);
56
+ const [isDisconnecting, setIsDisconnecting] = useState(false);
56
57
  const externalWallets = useStore((state) => state.externalWallets);
57
58
  const providerProps = useStore((state) => state.providerProps);
58
59
  const setAccountLinkOptions = useModalStore((state) => state.setAccountLinkOptions);
@@ -191,11 +192,13 @@ const ParaModal = forwardRef((props, ref) => {
191
192
  initModal(isOpen);
192
193
  isInitialized.current = true;
193
194
  }
194
- if (isReady && !isOpen && isInitialized.current) {
195
- initModal();
196
- isInitialized.current = false;
195
+ if (!bareModal && isReady && !isOpen && isInitialized.current) {
196
+ setTimeout(() => {
197
+ initModal();
198
+ isInitialized.current = false;
199
+ }, 250);
197
200
  }
198
- }, [isReady, isOpen, isAccountLoading]);
201
+ }, [bareModal, isReady, isOpen, isAccountLoading]);
199
202
  useEffect(() => {
200
203
  let _authLayout = authLayout;
201
204
  if (!(externalWallets == null ? void 0 : externalWallets.length) && hasExternalWallet(authLayout)) {
@@ -231,6 +234,24 @@ const ParaModal = forwardRef((props, ref) => {
231
234
  closeModal();
232
235
  onClose == null ? void 0 : onClose();
233
236
  };
237
+ const handleDisconnect = () => __async(void 0, null, function* () {
238
+ setIsDisconnecting(true);
239
+ handleClose();
240
+ const reset = () => __async(void 0, null, function* () {
241
+ yield para.logout({ clearPregenWallets: embedded == null ? void 0 : embedded.isGuestMode });
242
+ yield disconnectExternalWallet();
243
+ setStep(ModalStep.AUTH_MAIN);
244
+ setFlow(void 0);
245
+ setIsDisconnecting(false);
246
+ });
247
+ if (bareModal) {
248
+ reset();
249
+ return;
250
+ }
251
+ setTimeout(() => {
252
+ reset();
253
+ }, 250);
254
+ });
234
255
  const handleModalEntering = () => {
235
256
  setIsModalMounted(true);
236
257
  };
@@ -285,7 +306,9 @@ const ParaModal = forwardRef((props, ref) => {
285
306
  disableEmailLogin,
286
307
  disablePhoneLogin,
287
308
  isGuestModeEnabled,
288
- onClose: handleClose
309
+ onClose: handleClose,
310
+ onDisconnect: handleDisconnect,
311
+ isDisconnecting
289
312
  }, rest)
290
313
  )
291
314
  }
@@ -1,5 +1 @@
1
- interface AccountProps {
2
- onClose: () => void;
3
- }
4
- export declare const Account: ({ onClose }: AccountProps) => import("react/jsx-runtime").JSX.Element;
5
- export {};
1
+ export declare const Account: () => import("react/jsx-runtime").JSX.Element;
@@ -1,37 +1,26 @@
1
1
  "use client";
2
- import {
3
- __async
4
- } from "../../../chunk-MMUBH76A.js";
2
+ import "../../../chunk-MMUBH76A.js";
5
3
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
6
4
  import { safeStyled } from "@getpara/react-common";
7
- import { InnerStepContainer, StepContainer, StyledCpslTileButton } from "../common.js";
8
- import { CpslButton, CpslIcon, CpslSpinner, CpslText } from "@getpara/react-components";
5
+ import { InnerStepContainer, StepContainer } from "../common.js";
6
+ import { CpslButton, CpslIcon, CpslSpinner, CpslText, CpslTileButton } from "@getpara/react-components";
9
7
  import { OnRampStep, useModalStore } from "../../stores/index.js";
10
- import { useEffect, useState } from "react";
8
+ import { useEffect } from "react";
11
9
  import { ModalStep } from "../../utils/steps.js";
12
10
  import { useInternalClient } from "../../../provider/hooks/utils/useInternalClient.js";
13
- import { useExternalWallets } from "../../../provider/providers/ExternalWalletProvider.js";
14
- import { useStore } from "../../../provider/stores/useStore.js";
15
- import { formatBalanceString } from "../../utils/stringFormatters.js";
16
11
  import { useAccount, useWalletBalance } from "../../../provider/index.js";
17
12
  import { EnabledFlow } from "@getpara/web-sdk";
18
13
  import { useAccountLinking } from "../../../provider/providers/AccountLinkProvider.js";
19
- const Account = ({ onClose }) => {
14
+ import { AccountHeader } from "./AccountHeader.js";
15
+ const Account = () => {
20
16
  const onRampConfig = useModalStore((state) => state.onRampConfig);
21
17
  const setStep = useModalStore((state) => state.setStep);
22
- const setFlow = useModalStore((state) => state.setFlow);
23
18
  const setGuestAddFundsTab = useModalStore((state) => state.setGuestAddFundsTab);
24
19
  const setOnRampStep = useModalStore((state) => state.setOnRampStep);
25
- const hideWallets = useStore((state) => {
26
- var _a;
27
- return (_a = state.modalConfig) == null ? void 0 : _a.hideWallets;
28
- });
29
- const { disconnectExternalWallet } = useExternalWallets();
30
20
  const para = useInternalClient();
31
21
  const { embedded } = useAccount();
32
- const { data: balance, isLoading: isBalanceLoading } = useWalletBalance();
22
+ const { data: balance } = useWalletBalance();
33
23
  const { isEnabled } = useAccountLinking();
34
- const [isDisconnecting, setIsDisconnecting] = useState(false);
35
24
  const isGuestMode = embedded.isConnected && embedded.isGuestMode;
36
25
  const cantBuyAndWithdraw = (para.externalWalletConnectionType === "CONNECTION_ONLY" || para.externalWalletConnectionType === "VERIFICATION") && !para.userId;
37
26
  const isOnRampLoaded = !!onRampConfig;
@@ -60,49 +49,38 @@ const Account = ({ onClose }) => {
60
49
  const handleProfileClick = () => {
61
50
  setStep(ModalStep.ACCOUNT_PROFILE);
62
51
  };
63
- const handleDisconnectClick = () => __async(void 0, null, function* () {
64
- setIsDisconnecting(true);
65
- yield para.logout();
66
- yield disconnectExternalWallet();
67
- onClose();
68
- setStep(ModalStep.AUTH_MAIN);
69
- setFlow(void 0);
70
- setIsDisconnecting(false);
71
- });
72
52
  useEffect(() => {
73
53
  setGuestAddFundsTab();
74
54
  }, []);
75
- return /* @__PURE__ */ jsx(StepContainer, { $wide: true, children: /* @__PURE__ */ jsxs(InnerStepContainer, { children: [
76
- isBalanceLoading ? /* @__PURE__ */ jsx(BalanceContainer, { children: /* @__PURE__ */ jsx(CpslSpinner, { size: 39 }) }) : balance !== void 0 && balance !== null && /* @__PURE__ */ jsx(BalanceContainer, { children: /* @__PURE__ */ jsx(CpslText, { variant: "headingS", weight: "medium", children: formatBalanceString(balance) }) }),
77
- isGuestMode && /* @__PURE__ */ jsxs(Fragment, { children: [
78
- balance && parseFloat(balance) > 0 && /* @__PURE__ */ jsxs(Alert, { children: [
79
- /* @__PURE__ */ jsx(CpslIcon, { icon: "alertTriangle", size: "24px", style: { color: "var(--cpsl-color-utility-yellow)" } }),
80
- "You've funded this account - complete account setup to maintain access."
55
+ return /* @__PURE__ */ jsx(StepContainer, { $wide: true, children: /* @__PURE__ */ jsxs($InnerStepContainer, { children: [
56
+ /* @__PURE__ */ jsx(AccountHeader, { withBalance: true }),
57
+ /* @__PURE__ */ jsxs(LowerContainer, { children: [
58
+ isGuestMode && /* @__PURE__ */ jsxs(Fragment, { children: [
59
+ balance && parseFloat(balance) > 0 && /* @__PURE__ */ jsxs(Alert, { children: [
60
+ /* @__PURE__ */ jsx(CpslIcon, { icon: "alertTriangle", size: "24px", style: { color: "var(--cpsl-color-utility-yellow)" } }),
61
+ "You've funded this account - complete account setup to maintain access."
62
+ ] }),
63
+ /* @__PURE__ */ jsxs(
64
+ CpslButton,
65
+ {
66
+ fullWidth: true,
67
+ variant: "primary",
68
+ onClick: () => {
69
+ setStep(ModalStep.AUTH_GUEST_SIGNUP);
70
+ },
71
+ children: [
72
+ /* @__PURE__ */ jsx(CpslIcon, { icon: "stars02" }),
73
+ "Complete Account Setup"
74
+ ]
75
+ }
76
+ )
81
77
  ] }),
82
- /* @__PURE__ */ jsxs(
83
- CpslButton,
84
- {
85
- fullWidth: true,
86
- variant: "primary",
87
- onClick: () => {
88
- setStep(ModalStep.AUTH_GUEST_SIGNUP);
89
- },
90
- children: [
91
- /* @__PURE__ */ jsx(CpslIcon, { icon: "stars02" }),
92
- "Complete Account Setup"
93
- ]
94
- }
95
- )
96
- ] }),
97
- /* @__PURE__ */ jsx(ButtonContainer, { children: isOnRampLoaded ? /* @__PURE__ */ jsxs(Fragment, { children: [
98
- onRampConfig.isBuyEnabled && !cantBuyAndWithdraw && /* @__PURE__ */ jsx(OptionButton, { icon: "creditCard", onClick: handleBuyClick, children: /* @__PURE__ */ jsx(CpslText, { variant: "bodyXS", color: "secondary", weight: "medium", children: "Receive" }) }),
99
- onRampConfig.isWithdrawEnabled && !cantBuyAndWithdraw && /* @__PURE__ */ jsx(OptionButton, { icon: "arrowCircleBrokenDownLeft", onClick: handleSellClick, children: /* @__PURE__ */ jsx(CpslText, { variant: "bodyXS", color: "secondary", weight: "medium", children: "Withdraw" }) }),
100
- /* @__PURE__ */ jsx(OptionButton, { icon: "user", onClick: handleProfileClick, children: /* @__PURE__ */ jsx(CpslText, { variant: "bodyXS", color: "secondary", weight: "medium", children: isEnabled ? "Profile" : "Settings" }) })
101
- ] }) : /* @__PURE__ */ jsx(CpslSpinner, {}) }),
102
- !isGuestMode && /* @__PURE__ */ jsx(DisconnectButton, { variant: "destructive", fullWidth: true, onClick: handleDisconnectClick, disabled: isDisconnecting, children: isDisconnecting ? /* @__PURE__ */ jsx(CpslSpinner, { size: 16 }) : /* @__PURE__ */ jsxs(Fragment, { children: [
103
- hideWallets ? "Logout" : "Disconnect Wallet",
104
- /* @__PURE__ */ jsx(CpslIcon, { icon: "logOut", slot: "end" })
105
- ] }) })
78
+ /* @__PURE__ */ jsx(ButtonContainer, { children: isOnRampLoaded ? /* @__PURE__ */ jsxs(Fragment, { children: [
79
+ onRampConfig.isBuyEnabled && !cantBuyAndWithdraw && /* @__PURE__ */ jsx(OptionButton, { icon: "plusCircle", onClick: handleBuyClick, children: /* @__PURE__ */ jsx(CpslText, { variant: "bodyXS", color: "secondary", weight: "medium", children: "Add Funds" }) }),
80
+ onRampConfig.isWithdrawEnabled && !cantBuyAndWithdraw && /* @__PURE__ */ jsx(OptionButton, { icon: "arrowCircleDown", onClick: handleSellClick, children: /* @__PURE__ */ jsx(CpslText, { variant: "bodyXS", color: "secondary", weight: "medium", children: "Withdraw" }) }),
81
+ /* @__PURE__ */ jsx(OptionButton, { icon: "user01", onClick: handleProfileClick, children: /* @__PURE__ */ jsx(CpslText, { variant: "bodyXS", color: "secondary", weight: "medium", children: isEnabled ? "Profile" : "Settings" }) })
82
+ ] }) : /* @__PURE__ */ jsx(CpslSpinner, {}) })
83
+ ] })
106
84
  ] }) });
107
85
  };
108
86
  const ButtonContainer = safeStyled.div`
@@ -111,23 +89,21 @@ const ButtonContainer = safeStyled.div`
111
89
  justify-content: center;
112
90
  gap: 8px;
113
91
  width: 100%;
114
- height: 88px;
115
92
  `;
116
- const OptionButton = safeStyled(StyledCpslTileButton)`
93
+ const OptionButton = safeStyled(CpslTileButton)`
94
+ --button-gap: 4px;
95
+ --button-width: 100%;
96
+ --button-icon-height: 24px;
97
+ --button-icon-width: 24px;
98
+ --button-padding-top: 12px;
99
+ --button-padding-bottom: 12px;
100
+ --button-icon-color: var(--cpsl-color-text-contrast);
101
+ --button-height: auto;
117
102
  flex: 1;
118
-
119
- --button-icon-color: var(--cpsl-color-text-primary);
120
- `;
121
- const DisconnectButton = safeStyled(CpslButton)`
122
- --button-border-width: 0px;
123
- `;
124
- const BalanceContainer = safeStyled.div`
125
- display: flex;
126
- justify-content: center;
127
- align-items: center;
128
- padding-top: 8px;
129
- padding-bottom: 24px;
130
103
  `;
104
+ const $InnerStepContainer = safeStyled(InnerStepContainer)`
105
+ gap: 24px;
106
+ `;
131
107
  const Alert = safeStyled.div`
132
108
  --icon-color: var(--cpsl-color-utility-yellow);
133
109
  --icon-stroke-color: var(--cpsl-color-utility-yellow);
@@ -143,6 +119,12 @@ const Alert = safeStyled.div`
143
119
  background: var(--cpsl-color-utility-yellow-light);
144
120
  font-size: 14px;
145
121
  `;
122
+ const LowerContainer = safeStyled.div`
123
+ display: flex;
124
+ flex-direction: column;
125
+ gap: 8px;
126
+ width: 100%;
127
+ `;
146
128
  export {
147
129
  Account
148
130
  };
@@ -0,0 +1,3 @@
1
+ export declare const AccountHeader: ({ withBalance }?: {
2
+ withBalance?: boolean;
3
+ }) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,63 @@
1
+ "use client";
2
+ import "../../../chunk-MMUBH76A.js";
3
+ import { jsx, jsxs } from "react/jsx-runtime";
4
+ import { safeStyled } from "@getpara/react-common";
5
+ import { formatBalanceString } from "../../utils/stringFormatters.js";
6
+ import { CpslIcon, CpslText } from "@getpara/react-components";
7
+ import { useMemo } from "react";
8
+ import { truncateAddress } from "@getpara/web-sdk";
9
+ import { useInternalClient } from "../../../provider/hooks/utils/useInternalClient.js";
10
+ import { getExternalWalletIcon } from "../../utils/icons.js";
11
+ import { useWalletBalance } from "../../../provider/index.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
+ const AccountHeader = ({ withBalance = false } = {}) => {
17
+ const para = useInternalClient();
18
+ const { name, icon, src } = useMemo(() => {
19
+ var _a;
20
+ let name2, icon2, src2;
21
+ switch (true) {
22
+ case Object.keys(para == null ? void 0 : para.externalWallets).length > 0:
23
+ {
24
+ const wallet = Object.values(para.externalWallets)[0];
25
+ name2 = (_a = wallet.ensName) != null ? _a : truncateAddress(wallet.address, wallet.type, { prefix: para.cosmosPrefix });
26
+ src2 = wallet.ensAvatar;
27
+ icon2 = getExternalWalletIcon(wallet.externalProviderId);
28
+ }
29
+ break;
30
+ default:
31
+ name2 = `${para.partnerName} Wallet`;
32
+ src2 = para.partnerLogo;
33
+ icon2 = "wallet02";
34
+ break;
35
+ }
36
+ return { name: name2, icon: icon2, src: src2 };
37
+ }, [para.partnerName, para.partnerLogo, para.externalWallets]);
38
+ return /* @__PURE__ */ jsxs(AccountContainer, { children: [
39
+ /* @__PURE__ */ jsx(
40
+ CpslIcon,
41
+ {
42
+ size: "48px",
43
+ inset: "8px",
44
+ border: "1px solid var(--cpsl-color-background-8)",
45
+ radius: "theme",
46
+ icon,
47
+ src
48
+ }
49
+ ),
50
+ /* @__PURE__ */ jsx(CpslText, { variant: "headingXS", weight: "semiBold", color: "contrast", children: name }),
51
+ withBalance && /* @__PURE__ */ jsx(Balance, {})
52
+ ] });
53
+ };
54
+ const AccountContainer = safeStyled.div`
55
+ width: 100%;
56
+ display: flex;
57
+ flex-direction: column;
58
+ gap: 8px;
59
+ align-items: center;
60
+ `;
61
+ export {
62
+ AccountHeader
63
+ };
@@ -1 +1,4 @@
1
- export declare const AccountProfile: () => import("react/jsx-runtime").JSX.Element | null;
1
+ export declare const AccountProfile: ({ isDisconnecting, onDisconnect, }: {
2
+ isDisconnecting: boolean;
3
+ onDisconnect: () => void;
4
+ }) => import("react/jsx-runtime").JSX.Element | null;
@@ -4,8 +4,8 @@ import {
4
4
  __spreadValues
5
5
  } from "../../../chunk-MMUBH76A.js";
6
6
  import { jsx, jsxs } from "react/jsx-runtime";
7
- import { AccountTypeIcon, GradientScroll, StepContainer } from "../common.js";
8
- import { CpslButton, CpslIcon, CpslIdenticon, CpslText } from "@getpara/react-components";
7
+ import { AccountTypeIcon, GradientScroll, StepContainer, WalletTypeIcon } from "../common.js";
8
+ import { CpslButton, CpslIcon, CpslText } from "@getpara/react-components";
9
9
  import { useClient } from "../../../provider/index.js";
10
10
  import { useLinkedAccounts } from "../../../provider/hooks/index.js";
11
11
  import { getWalletDisplayName } from "../../utils/getWalletDisplayName.js";
@@ -14,6 +14,8 @@ import { useAccountLinking } from "../../../provider/providers/AccountLinkProvid
14
14
  import { safeStyled, useCopyToClipboard } from "@getpara/react-common";
15
15
  import { useExternalWallets } from "../../../provider/providers/ExternalWalletProvider.js";
16
16
  import { ACCOUNT_TYPES } from "../../constants/oAuthLogos.js";
17
+ import { useStore } from "../../../provider/stores/useStore.js";
18
+ import { AccountHeader } from "./AccountHeader.js";
17
19
  const Entry = ({
18
20
  identifier,
19
21
  icon,
@@ -45,23 +47,52 @@ const Entry = ({
45
47
  onUnlink && /* @__PURE__ */ jsx(EntryUnlink, { href: "#", onClick: onUnlink, children: "Unlink" })
46
48
  ] }, address != null ? address : identifier);
47
49
  };
48
- const AccountProfile = () => {
50
+ const AccountProfile = ({
51
+ isDisconnecting,
52
+ onDisconnect
53
+ }) => {
49
54
  var _a, _b, _c, _d, _e, _f;
50
55
  const para = useClient();
51
56
  const { data: linkedAccounts } = useLinkedAccounts();
52
57
  const { wallets } = useExternalWallets();
53
58
  const { isEnabled, linkAccount, unlinkAccount } = useAccountLinking();
59
+ const hideWallets = useStore((state) => {
60
+ var _a2;
61
+ return (_a2 = state.modalConfig) == null ? void 0 : _a2.hideWallets;
62
+ });
54
63
  if (!para) {
55
64
  return null;
56
65
  }
57
66
  const externalWallet = (_a = para.authInfo) == null ? void 0 : _a.externalWallet;
58
- return /* @__PURE__ */ jsxs(StepContainer, { $wide: true, children: [
67
+ return /* @__PURE__ */ jsxs(StepContainer, { children: [
68
+ /* @__PURE__ */ jsx(AccountHeader, {}),
69
+ /* @__PURE__ */ jsxs(ParaConnect, { target: "_blank", href: "https://connect.getpara.com", rel: "noreferrer noopener", children: [
70
+ /* @__PURE__ */ jsx(ParaIcon, { icon: "paraIconBrand", size: "40px", inset: "8px", background: "white" }),
71
+ /* @__PURE__ */ jsxs("div", { children: [
72
+ "Do even more with your wallet",
73
+ /* @__PURE__ */ jsx("br", {}),
74
+ "at ",
75
+ /* @__PURE__ */ jsx("span", { style: { fontWeight: "600" }, children: "Para Connect" })
76
+ ] }),
77
+ /* @__PURE__ */ jsxs(Dots, { children: [
78
+ new Array(6).fill(0).map((_, index) => /* @__PURE__ */ jsx(DotsIcon, { index, icon: "dotsSquare", size: "27.5px" }, index)),
79
+ /* @__PURE__ */ jsx(ParaArrow, { icon: "paraArrow", size: "31px", color: "white" })
80
+ ] })
81
+ ] }),
59
82
  /* @__PURE__ */ jsxs(Section, { children: [
60
83
  /* @__PURE__ */ jsx(Title, { variant: "bodyS", color: "secondary", children: "Connected Wallets" }),
61
84
  /* @__PURE__ */ jsx(Content, { children: externalWallet ? /* @__PURE__ */ jsx(
62
85
  Entry,
63
86
  {
64
- icon: /* @__PURE__ */ jsx(AccountTypeIcon, { accountType: externalWallet.providerId, size: "24px" }),
87
+ icon: /* @__PURE__ */ jsx(
88
+ WalletTypeIcon,
89
+ {
90
+ walletType: externalWallet.type,
91
+ externalWallet: externalWallet.providerId,
92
+ size: "24px",
93
+ inset: "0"
94
+ }
95
+ ),
65
96
  name: (_c = (_b = externalWallet.ensName) != null ? _b : externalWallet.provider) != null ? _c : "",
66
97
  address: (_d = externalWallet.addressBech32) != null ? _d : externalWallet.address,
67
98
  addressShort: truncateAddress((_e = externalWallet.addressBech32) != null ? _e : externalWallet.address, externalWallet.type, {
@@ -69,19 +100,16 @@ const AccountProfile = () => {
69
100
  })
70
101
  },
71
102
  externalWallet.address
72
- ) : (_f = para == null ? void 0 : para.availableWallets) == null ? void 0 : _f.map((wallet) => {
73
- var _a2;
74
- return /* @__PURE__ */ jsx(
75
- Entry,
76
- {
77
- icon: wallet.isExternal ? /* @__PURE__ */ jsx(AccountTypeIcon, { accountType: (_a2 = wallet.externalProviderId) != null ? _a2 : "EXTERNAL_WALLET", size: "24px" }) : /* @__PURE__ */ jsx(CpslIdenticon, { hash: para.getIdenticonHash(wallet.id, wallet.type), size: "24px", arcWidth: "40%" }),
78
- name: getWalletDisplayName(para, wallet),
79
- address: wallet.address,
80
- addressShort: truncateAddress(wallet.address, wallet.type)
81
- },
82
- wallet.address
83
- );
84
- }) })
103
+ ) : (_f = para == null ? void 0 : para.availableWallets) == null ? void 0 : _f.map((wallet) => /* @__PURE__ */ jsx(
104
+ Entry,
105
+ {
106
+ icon: /* @__PURE__ */ jsx(WalletTypeIcon, { walletType: wallet.type, externalWallet: wallet.externalProviderId, size: "24px" }),
107
+ name: getWalletDisplayName(para, wallet),
108
+ address: wallet.address,
109
+ addressShort: truncateAddress(wallet.address, wallet.type)
110
+ },
111
+ wallet.address
112
+ )) })
85
113
  ] }),
86
114
  isEnabled && /* @__PURE__ */ jsxs(Section, { children: [
87
115
  /* @__PURE__ */ jsx(Title, { variant: "bodyS", color: "secondary", children: "Linked Accounts" }),
@@ -129,6 +157,10 @@ const AccountProfile = () => {
129
157
  "Link an account"
130
158
  ] })
131
159
  ] })
160
+ ] }),
161
+ /* @__PURE__ */ jsxs(DisconnectButton, { variant: "destructive", fullWidth: true, onClick: onDisconnect, disabled: isDisconnecting, children: [
162
+ hideWallets ? "Logout" : "Disconnect Wallet",
163
+ /* @__PURE__ */ jsx(CpslIcon, { icon: "logOut", slot: "end" })
132
164
  ] })
133
165
  ] });
134
166
  };
@@ -137,11 +169,15 @@ const Section = safeStyled.div`
137
169
  flex-direction: column;
138
170
  align-items: flex-start;
139
171
  justify-content: center;
140
- gap: 16px;
172
+ gap: 8px;
141
173
  width: 100%;
142
174
  `;
143
- const Content = safeStyled(Section)``;
144
- const Title = safeStyled(CpslText)``;
175
+ const Content = safeStyled(Section)`
176
+ gap: 12px;
177
+ `;
178
+ const Title = safeStyled(CpslText)`
179
+ font-weight: 600;
180
+ `;
145
181
  const EntryContainer = safeStyled.div`
146
182
  overflow: hidden;
147
183
  position: relative;
@@ -181,6 +217,57 @@ const EntryUnlink = safeStyled.a`
181
217
  text-decoration: underline;
182
218
  }
183
219
  `;
220
+ const DisconnectButton = safeStyled(CpslButton)`
221
+ --button-border-width: 0px;
222
+ --button-destructive-hover-background-color: rgba(255, 0, 0, 0.2);
223
+ --button-destructive-active-background-color: rgba(255, 0, 0, 0.1);
224
+
225
+ `;
226
+ const ParaConnect = safeStyled.a`
227
+ position: relative;
228
+ box-sizing: border-box;
229
+ width: 100%;
230
+ text-decoration: none;
231
+ color: white !important;
232
+ font-family: 'PP Mori', sans-serif;
233
+ font-weight: 500;
234
+ font-size: 15px;
235
+ padding: 16px;
236
+ height: 69px;
237
+ display: flex;
238
+ align-items: center;
239
+ justify-content: flex-start;
240
+ gap: 8px;
241
+ border-radius: 8px;
242
+ border: 1px solid #FF4E00;
243
+ background: #FF4E00;
244
+ box-shadow: 0 2px 2px 0 rgba(0, 0, 0, 0.05), 0 0 20px 8px rgba(251, 188, 4, 0.20) inset;
245
+
246
+ &:hover, &:active {
247
+ background: #FF6A2B;
248
+ border: 1px solid #FF6A2B;
249
+ }
250
+
251
+ `;
252
+ const ParaIcon = safeStyled(CpslIcon)`
253
+ --border-radius: 4px;
254
+ `;
255
+ const Dots = safeStyled.div`
256
+ width: 75px;
257
+ position: absolute;
258
+ right: 14px;
259
+ top: 7px;
260
+ `;
261
+ const DotsIcon = safeStyled(CpslIcon)`
262
+ position: absolute;
263
+ left: ${({ index }) => `${index % 3 * 27.5}px`};
264
+ top: ${({ index }) => `${Math.floor(index / 3) * 27.5}px`};
265
+ `;
266
+ const ParaArrow = safeStyled(CpslIcon)`
267
+ position: absolute;
268
+ top: 12px;
269
+ right: 4px;
270
+ `;
184
271
  export {
185
272
  AccountProfile
186
273
  };
@@ -7,7 +7,7 @@ import { CpslIcon, CpslSpinner, CpslTab, CpslTabs } from "@getpara/react-compone
7
7
  import { OnRampStep } from "../../stores/index.js";
8
8
  import { useModalStore } from "../../stores/modal/useModalStore.js";
9
9
  import { useEffect, useMemo } from "react";
10
- import { getAddFundsStep } from "../../utils/steps.js";
10
+ import { getAddFundsStep, ModalStep } from "../../utils/steps.js";
11
11
  import { safeStyled } from "@getpara/react-common";
12
12
  import { useAccount, useWallet } from "../../../provider/index.js";
13
13
  import { AddFundsProvider } from "./AddFundsProvider.js";
@@ -15,7 +15,9 @@ import { AddFundsReceive } from "./AddFundsReceive.js";
15
15
  import { AddFundsContextProvider, TABS } from "./AddFundsContext.js";
16
16
  import { AnimatePresence } from "framer-motion";
17
17
  import { AddFundsSettings } from "./AddFundsSettings.js";
18
+ import { WalletSelect } from "../WalletSelect/WalletSelect.js";
18
19
  const AddFunds = () => {
20
+ const step = useModalStore((state) => state.step);
19
21
  const onRampConfig = useModalStore((state) => state.onRampConfig);
20
22
  const onRampStep = useModalStore((state) => state.onRampStep);
21
23
  const storedTab = useModalStore((state) => state.accountAddFundTab);
@@ -28,7 +30,7 @@ const AddFunds = () => {
28
30
  ([enabledFlow, key]) => !!(onRampConfig == null ? void 0 : onRampConfig[key]) && (!isGuestMode || enabledFlow === EnabledFlow.RECEIVE)
29
31
  );
30
32
  const tab = storedTab != null ? storedTab : tabs[0][0];
31
- const isMultiFlow = tabs.length > 1;
33
+ const isMultiFlow = (tab === EnabledFlow.BUY || tab === EnabledFlow.RECEIVE) && tabs.length > 1;
32
34
  const onSetTab = (event) => {
33
35
  setModalStep(getAddFundsStep(event.detail.tab));
34
36
  };
@@ -54,10 +56,13 @@ const AddFunds = () => {
54
56
  return /* @__PURE__ */ jsx(SpinnerContainer, { children: /* @__PURE__ */ jsx(CpslSpinner, {}) });
55
57
  }
56
58
  return /* @__PURE__ */ jsxs(StepContainer, { children: [
57
- isMultiFlow && /* @__PURE__ */ jsx(InnerStepContainer, { children: /* @__PURE__ */ jsx(CpslTabs, { selectedTab: tab, onCpslTabsChanged: onSetTab, children: TABS.map(([tab2, _, icon, title]) => /* @__PURE__ */ jsxs(CpslTab, { tab: tab2, children: [
58
- /* @__PURE__ */ jsx(CpslIcon, { slot: "start", icon }),
59
- title
60
- ] }, tab2)) }) }),
59
+ isMultiFlow && /* @__PURE__ */ jsx(InnerStepContainer, { children: /* @__PURE__ */ jsx(CpslTabs, { selectedTab: tab, onCpslTabsChanged: onSetTab, children: TABS.filter(([enabledFlow]) => enabledFlow === EnabledFlow.BUY || enabledFlow === EnabledFlow.WITHDRAW).map(
60
+ ([tab2, _, icon, title]) => /* @__PURE__ */ jsxs(CpslTab, { tab: tab2, children: [
61
+ /* @__PURE__ */ jsx(CpslIcon, { slot: "start", icon }),
62
+ title
63
+ ] }, tab2)
64
+ ) }) }),
65
+ (step === ModalStep.ADD_FUNDS_RECEIVE || (embedded == null ? void 0 : embedded.wallets) && embedded.wallets.length > 1) && /* @__PURE__ */ jsx(WalletSelect, {}),
61
66
  /* @__PURE__ */ jsx(AnimatePresence, { mode: "wait", children: /* @__PURE__ */ jsx(AddFundsContextProvider, { "data-testid": "add-funds", tab, children: Content }) })
62
67
  ] });
63
68
  };