@getpara/react-sdk 1.6.1-dev.0 → 1.7.1

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 (155) hide show
  1. package/dist/{modal/components/AddFunds/MoonPayEmbed.js → MoonPayEmbed-Q2HP2BFI.js} +3 -1
  2. package/dist/MoonPayEmbed-Q2HP2BFI.js.br +0 -0
  3. package/dist/MoonPayEmbed-Q2HP2BFI.js.gz +0 -0
  4. package/dist/chunk-MMUBH76A.js.br +0 -0
  5. package/dist/chunk-MMUBH76A.js.gz +0 -0
  6. package/dist/index.js +6659 -6
  7. package/dist/index.js.br +0 -0
  8. package/dist/index.js.gz +0 -0
  9. package/dist/modal/components/ExternalWalletVerificationStep/ExternalWalletVerificationStep.d.ts +1 -0
  10. package/dist/modal/components/ExternalWalletsWrapper/ExternalWalletsWrapper.d.ts +2 -1
  11. package/dist/modal/components/common.d.ts +4 -0
  12. package/dist/modal/index.d.ts +1 -0
  13. package/dist/modal/providers/CosmosExternalWalletContextStub.d.ts +13 -0
  14. package/dist/modal/providers/EvmExternalWalletContextStub.d.ts +11 -0
  15. package/dist/modal/providers/ExternalWalletContext.d.ts +15 -1
  16. package/dist/modal/providers/SolanaExternalWalletContextStub.d.ts +11 -0
  17. package/dist/modal/stores/externalWalletProvider/useExternalWalletProviderStore.d.ts +2 -0
  18. package/dist/modal/types/commonTypes.d.ts +12 -2
  19. package/dist/modal/types/externalWallets.d.ts +2 -0
  20. package/dist/modal/types/modalProps.d.ts +6 -0
  21. package/dist/modal/utils/steps.d.ts +2 -0
  22. package/dist/provider/utils/constants.d.ts +5 -0
  23. package/package.json +5 -5
  24. package/dist/modal/ParaModal.js +0 -337
  25. package/dist/modal/components/Account/Account.js +0 -69
  26. package/dist/modal/components/AddFunds/AddFunds.js +0 -220
  27. package/dist/modal/components/AddFunds/AddFundsAwaiting.js +0 -72
  28. package/dist/modal/components/AddFunds/AddFundsDone.js +0 -43
  29. package/dist/modal/components/AddFunds/index.js +0 -4
  30. package/dist/modal/components/AuthInput/AuthInput.js +0 -283
  31. package/dist/modal/components/AuthInput/countryCodes.js +0 -42
  32. package/dist/modal/components/AuthInput/hooks/useDropdownPosition.js +0 -33
  33. package/dist/modal/components/AuthInput/phoneMasks.js +0 -253
  34. package/dist/modal/components/AuthMainStep/AuthMainStep.js +0 -37
  35. package/dist/modal/components/AuthMainStep/AuthMainStepContent.js +0 -113
  36. package/dist/modal/components/AuthOptions/AuthOptions.js +0 -33
  37. package/dist/modal/components/AwaitingBiometricsStep/AwaitingBiometricsStep.js +0 -18
  38. package/dist/modal/components/AwaitingOAuthStep/AwaitingOAuthStep.js +0 -10
  39. package/dist/modal/components/AwaitingPasswordStep/AwaitingPasswordStep.js +0 -18
  40. package/dist/modal/components/AwaitingWalletCreationStep/AwaitingWalletCreationStep.js +0 -44
  41. package/dist/modal/components/BiometricCreationStep/BiometricCreationStep.js +0 -52
  42. package/dist/modal/components/BiometricLoginStep/BiometricLoginStep.js +0 -93
  43. package/dist/modal/components/Body/AnimatedHeightWrapper.js +0 -29
  44. package/dist/modal/components/Body/Body.js +0 -304
  45. package/dist/modal/components/ChainSwitch/ChainSwitch.js +0 -94
  46. package/dist/modal/components/ChainSwitch/config.js +0 -17
  47. package/dist/modal/components/Controls/Controls.js +0 -74
  48. package/dist/modal/components/Controls/Selects.js +0 -213
  49. package/dist/modal/components/ExternalWalletStep/ExternalWalletStep.js +0 -151
  50. package/dist/modal/components/ExternalWalletStep/config.js +0 -17
  51. package/dist/modal/components/ExternalWallets/ExternalWallets.js +0 -172
  52. package/dist/modal/components/ExternalWalletsWrapper/ExternalWalletsWrapper.js +0 -123
  53. package/dist/modal/components/Footer/Footer.js +0 -93
  54. package/dist/modal/components/Header/Header.js +0 -43
  55. package/dist/modal/components/Header/hooks/useStepTitle.js +0 -50
  56. package/dist/modal/components/Hero/Hero.js +0 -122
  57. package/dist/modal/components/IFrameStep/IFrameStep.js +0 -55
  58. package/dist/modal/components/LoginDoneStep/LoginDoneStep.js +0 -28
  59. package/dist/modal/components/ModalContent/ModalContent.js +0 -310
  60. package/dist/modal/components/OAuth/FarcasterOAuthStep.js +0 -81
  61. package/dist/modal/components/OAuth/OAuth.js +0 -153
  62. package/dist/modal/components/OAuth/TelegramOAuthStep.js +0 -139
  63. package/dist/modal/components/OnRampComponents/AddingFunds.js +0 -23
  64. package/dist/modal/components/OnRampComponents/OnRampProviderButton.js +0 -77
  65. package/dist/modal/components/RecoverySecretStep/RecoverySecretStep.js +0 -101
  66. package/dist/modal/components/Setup2FAStep/Setup2FAStep.js +0 -141
  67. package/dist/modal/components/StripeComponents/StripeComponents.js +0 -88
  68. package/dist/modal/components/TwoFactorDoneStep/TwoFactorDoneStep.js +0 -24
  69. package/dist/modal/components/VerificationCodeStep/VerificationCodeStep.js +0 -159
  70. package/dist/modal/components/Waiting/Waiting.js +0 -17
  71. package/dist/modal/components/WalletCard/PartnerIcon.js +0 -34
  72. package/dist/modal/components/WalletCard/WalletCard.js +0 -127
  73. package/dist/modal/components/WalletCreationDoneStep/WalletCreationDoneStep.js +0 -52
  74. package/dist/modal/components/common.js +0 -83
  75. package/dist/modal/components/index.js +0 -2
  76. package/dist/modal/constants/constants.js +0 -111
  77. package/dist/modal/constants/defaults.js +0 -10
  78. package/dist/modal/constants/oAuthLogos.js +0 -24
  79. package/dist/modal/hooks/useActiveWallet.js +0 -15
  80. package/dist/modal/hooks/useCreateAccount.js +0 -72
  81. package/dist/modal/hooks/useEmbeddedExternalConnection.js +0 -39
  82. package/dist/modal/hooks/useGoBack.js +0 -35
  83. package/dist/modal/hooks/useSetLoginURLs.js +0 -45
  84. package/dist/modal/index.js +0 -32
  85. package/dist/modal/providers/CosmosExternalWalletContextStub.js +0 -34
  86. package/dist/modal/providers/EvmExternalWalletContextStub.js +0 -38
  87. package/dist/modal/providers/ExternalWalletContext.js +0 -275
  88. package/dist/modal/providers/SolanaExternalWalletContextStub.js +0 -19
  89. package/dist/modal/stores/externalWalletProvider/actions.js +0 -10
  90. package/dist/modal/stores/externalWalletProvider/useExternalWalletProviderStore.js +0 -20
  91. package/dist/modal/stores/index.js +0 -4
  92. package/dist/modal/stores/modal/actions.js +0 -70
  93. package/dist/modal/stores/modal/useModalStore.js +0 -65
  94. package/dist/modal/stores/theme/actions.js +0 -28
  95. package/dist/modal/stores/theme/useThemeStore.js +0 -21
  96. package/dist/modal/stores/userInfo/actions.js +0 -30
  97. package/dist/modal/stores/userInfo/useUserInfoStore.js +0 -17
  98. package/dist/modal/types/commonTypes.js +0 -1
  99. package/dist/modal/types/externalWallets.js +0 -31
  100. package/dist/modal/types/modalProps.js +0 -12
  101. package/dist/modal/utils/authLayoutHelpers.js +0 -8
  102. package/dist/modal/utils/getMailtoLink.js +0 -10
  103. package/dist/modal/utils/getTileButtonFlex.js +0 -20
  104. package/dist/modal/utils/openPopup.js +0 -60
  105. package/dist/modal/utils/routeMobileExternalWallet.js +0 -31
  106. package/dist/modal/utils/steps.js +0 -228
  107. package/dist/modal/utils/stringFormatters.js +0 -14
  108. package/dist/modal/utils/validateOnRampConfig.js +0 -32
  109. package/dist/provider/ParaProvider.js +0 -22
  110. package/dist/provider/actions/checkIfUserExists.js +0 -21
  111. package/dist/provider/actions/createUser.js +0 -26
  112. package/dist/provider/actions/getAccount.js +0 -22
  113. package/dist/provider/actions/getWallet.js +0 -14
  114. package/dist/provider/actions/initiateLogin.js +0 -20
  115. package/dist/provider/actions/keepSessionAlive.js +0 -20
  116. package/dist/provider/actions/logout.js +0 -17
  117. package/dist/provider/actions/signMessage.js +0 -20
  118. package/dist/provider/actions/signTransaction.js +0 -20
  119. package/dist/provider/actions/waitForAccountCreation.js +0 -21
  120. package/dist/provider/actions/waitForLoginAndSetup.js +0 -24
  121. package/dist/provider/actions/waitForPasskeyAndCreateWallet.js +0 -21
  122. package/dist/provider/hooks/index.js +0 -4
  123. package/dist/provider/hooks/mutations/index.js +0 -24
  124. package/dist/provider/hooks/mutations/useCheckIfUserExists.js +0 -23
  125. package/dist/provider/hooks/mutations/useCreateUser.js +0 -20
  126. package/dist/provider/hooks/mutations/useInitiateLogin.js +0 -23
  127. package/dist/provider/hooks/mutations/useKeepSessionAlive.js +0 -20
  128. package/dist/provider/hooks/mutations/useLogout.js +0 -30
  129. package/dist/provider/hooks/mutations/useSignMessage.js +0 -33
  130. package/dist/provider/hooks/mutations/useSignTransaction.js +0 -33
  131. package/dist/provider/hooks/mutations/useWaitForAccountCreation.js +0 -30
  132. package/dist/provider/hooks/mutations/useWaitForLoginAndSetup.js +0 -30
  133. package/dist/provider/hooks/mutations/useWaitForPasskeyAndCreateWallet.js +0 -30
  134. package/dist/provider/hooks/queries/index.js +0 -8
  135. package/dist/provider/hooks/queries/useAccount.js +0 -21
  136. package/dist/provider/hooks/queries/useWallet.js +0 -22
  137. package/dist/provider/hooks/utils/index.js +0 -10
  138. package/dist/provider/hooks/utils/useAutoSessionKeepAlive.js +0 -74
  139. package/dist/provider/hooks/utils/useClient.js +0 -10
  140. package/dist/provider/hooks/utils/useEventListeners.js +0 -105
  141. package/dist/provider/hooks/utils/useInternalClient.js +0 -10
  142. package/dist/provider/hooks/utils/useModal.js +0 -17
  143. package/dist/provider/hooks/utils/useWalletState.js +0 -33
  144. package/dist/provider/index.js +0 -8
  145. package/dist/provider/stores/getters.js +0 -13
  146. package/dist/provider/stores/slices/client.js +0 -9
  147. package/dist/provider/stores/slices/index.js +0 -4
  148. package/dist/provider/stores/slices/modal.js +0 -9
  149. package/dist/provider/stores/slices/wallet.js +0 -11
  150. package/dist/provider/stores/types.js +0 -1
  151. package/dist/provider/stores/useStore.js +0 -27
  152. package/dist/provider/types/provider.js +0 -1
  153. package/dist/provider/types/query.js +0 -1
  154. package/dist/provider/types/utils.js +0 -1
  155. package/dist/provider/utils/renameMutations.js +0 -16
@@ -1,304 +0,0 @@
1
- "use client";
2
- import "../../../chunk-MMUBH76A.js";
3
- import { Fragment, jsx, jsxs } from "react/jsx-runtime";
4
- import { styled } from "styled-components";
5
- import { IFrameSteps, ModalStep } from "../../utils/steps.js";
6
- import { CpslAlert, CpslIcon } from "@getpara/react-components";
7
- import { VerificationCodeStep } from "../VerificationCodeStep/VerificationCodeStep.js";
8
- import { useModalStore, useThemeStore } from "../../stores/index.js";
9
- import { BiometricLoginStep } from "../BiometricLoginStep/BiometricLoginStep.js";
10
- import { Setup2FAStep } from "../Setup2FAStep/Setup2FAStep.js";
11
- import { LoginDoneStep } from "../LoginDoneStep/LoginDoneStep.js";
12
- import { EnabledFlow } from "@getpara/web-sdk";
13
- import { AwaitingBiometricsStep } from "../AwaitingBiometricsStep/AwaitingBiometricsStep.js";
14
- import { AwaitingWalletCreationStep } from "../AwaitingWalletCreationStep/AwaitingWalletCreationStep.js";
15
- import { WalletCreationDoneStep } from "../WalletCreationDoneStep/WalletCreationDoneStep.js";
16
- import { RecoverySecretStep } from "../RecoverySecretStep/RecoverySecretStep.js";
17
- import { TwoFactorDoneStep } from "../TwoFactorDoneStep/TwoFactorDoneStep.js";
18
- import { BiometricCreationStep } from "../BiometricCreationStep/BiometricCreationStep.js";
19
- import { AwaitingOAuthStep } from "../AwaitingOAuthStep/AwaitingOAuthStep.js";
20
- import { AddFundsAwaiting, AddFundsDone, AddFunds } from "../AddFunds/index.js";
21
- import FarcasterOAuthStep from "../OAuth/FarcasterOAuthStep.js";
22
- import { Header } from "../Header/Header.js";
23
- import { AuthMainStep } from "../AuthMainStep/AuthMainStep.js";
24
- import { BODY_MOTION_VARIANTS, BODY_TRANSITION, MOBILE_SIZE } from "../../constants/constants.js";
25
- import { Account } from "../Account/Account.js";
26
- import { AuthOptions } from "../AuthOptions/AuthOptions.js";
27
- import { ExternalWallets } from "../ExternalWallets/ExternalWallets.js";
28
- import { ExternalWalletStep } from "../ExternalWalletStep/ExternalWalletStep.js";
29
- import { Hero } from "../Hero/Hero.js";
30
- import { AnimatedHeightWrapper } from "./AnimatedHeightWrapper.js";
31
- import { ChainSwitch } from "../ChainSwitch/ChainSwitch.js";
32
- import { motion, AnimatePresence } from "framer-motion";
33
- import { Controls } from "../Controls/Controls.js";
34
- import { useEffect, useState } from "react";
35
- import { TelegramOAuthStep } from "../OAuth/TelegramOAuthStep.js";
36
- import { AwaitingPasswordStep } from "../AwaitingPasswordStep/AwaitingPasswordStep.js";
37
- import { IFrameStep } from "../IFrameStep/IFrameStep.js";
38
- const MIN_HEIGHT = {
39
- [ModalStep.ADD_FUNDS_AWAITING]: "680px"
40
- };
41
- const PADDING_TOP = {
42
- [ModalStep.TELEGRAM_OAUTH]: "36px"
43
- };
44
- const PADDING_BOTTOM = {
45
- [ModalStep.TELEGRAM_OAUTH]: "16px"
46
- };
47
- const Body = ({ oAuthMethods, twoFactorAuthEnabled, disableEmailLogin, disablePhoneLogin, onClose }) => {
48
- const currentStep = useModalStore((state) => state.step);
49
- const onRampConfig = useModalStore((state) => state.onRampConfig);
50
- const stepDirection = useModalStore((state) => state.stepDirection);
51
- const setStepDirection = useModalStore((state) => state.setStepDirection);
52
- const accountAddFundTab = useModalStore((state) => state.accountAddFundTab);
53
- const setAccountAddFundTab = useModalStore((state) => state.setAccountAddFundTab);
54
- const appName = useThemeStore((state) => state.appName);
55
- const embeddedModal = useThemeStore((state) => state.embeddedModal);
56
- const [isTestModeAlert, setIsTestModeAlert] = useState(onRampConfig == null ? void 0 : onRampConfig.testMode);
57
- const Content = () => {
58
- switch (currentStep) {
59
- case ModalStep.AUTH_MAIN: {
60
- return /* @__PURE__ */ jsx(
61
- AuthMainStep,
62
- {
63
- oAuthMethods,
64
- disableEmailLogin,
65
- disablePhoneLogin
66
- }
67
- );
68
- }
69
- case ModalStep.EX_WALLET_MORE: {
70
- return /* @__PURE__ */ jsx(ExternalWallets, {});
71
- }
72
- case ModalStep.AUTH_MORE: {
73
- return /* @__PURE__ */ jsx(
74
- AuthOptions,
75
- {
76
- oAuthMethods,
77
- disableEmailLogin,
78
- disablePhoneLogin
79
- }
80
- );
81
- }
82
- case ModalStep.VERIFICATIONS: {
83
- return /* @__PURE__ */ jsx(VerificationCodeStep, {});
84
- }
85
- case ModalStep.BIOMETRIC_LOGIN: {
86
- return /* @__PURE__ */ jsx(BiometricLoginStep, {});
87
- }
88
- case ModalStep.SETUP_2FA:
89
- case ModalStep.VERIFY_2FA: {
90
- return /* @__PURE__ */ jsx(Setup2FAStep, { onClose });
91
- }
92
- case ModalStep.LOGIN_DONE: {
93
- return /* @__PURE__ */ jsx(LoginDoneStep, { onClose });
94
- }
95
- case ModalStep.AWAITING_BIOMETRIC_LOGIN:
96
- case ModalStep.AWAITING_BIOMETRIC_CREATION: {
97
- return /* @__PURE__ */ jsx(AwaitingBiometricsStep, {});
98
- }
99
- case ModalStep.AWAITING_PASSWORD_LOGIN:
100
- case ModalStep.AWAITING_PASSWORD_CREATION: {
101
- return /* @__PURE__ */ jsx(AwaitingPasswordStep, {});
102
- }
103
- case ModalStep.AWAITING_WALLET_CREATION: {
104
- return /* @__PURE__ */ jsx(AwaitingWalletCreationStep, {});
105
- }
106
- case ModalStep.WALLET_CREATION_DONE: {
107
- return /* @__PURE__ */ jsx(WalletCreationDoneStep, { twoFactorAuthEnabled, onClose });
108
- }
109
- case ModalStep.SECRET: {
110
- return /* @__PURE__ */ jsx(RecoverySecretStep, {});
111
- }
112
- case ModalStep.TWO_FACTOR_DONE: {
113
- return /* @__PURE__ */ jsx(TwoFactorDoneStep, { onClose });
114
- }
115
- case ModalStep.BIOMETRIC_CREATION: {
116
- return /* @__PURE__ */ jsx(BiometricCreationStep, {});
117
- }
118
- case ModalStep.AWAITING_OAUTH: {
119
- return /* @__PURE__ */ jsx(AwaitingOAuthStep, {});
120
- }
121
- case ModalStep.FARCASTER_OAUTH: {
122
- return /* @__PURE__ */ jsx(FarcasterOAuthStep, {});
123
- }
124
- case ModalStep.TELEGRAM_OAUTH: {
125
- return /* @__PURE__ */ jsx(TelegramOAuthStep, {});
126
- }
127
- case ModalStep.ADD_FUNDS_BUY:
128
- case ModalStep.ADD_FUNDS_RECEIVE:
129
- case ModalStep.ADD_FUNDS_WITHDRAW: {
130
- return /* @__PURE__ */ jsx(AddFunds, {});
131
- }
132
- case ModalStep.ADD_FUNDS_AWAITING: {
133
- return /* @__PURE__ */ jsx(AddFundsAwaiting, {});
134
- }
135
- case ModalStep.ADD_FUNDS_SUCCESS: {
136
- return /* @__PURE__ */ jsx(AddFundsDone, { isSuccess: true, onClose });
137
- }
138
- case ModalStep.ADD_FUNDS_FAILURE: {
139
- return /* @__PURE__ */ jsx(AddFundsDone, { onClose });
140
- }
141
- case ModalStep.ACCOUNT_MAIN: {
142
- return /* @__PURE__ */ jsx(Account, { onClose });
143
- }
144
- case ModalStep.EX_WALLET_SELECTED: {
145
- return /* @__PURE__ */ jsx(ExternalWalletStep, {});
146
- }
147
- case ModalStep.CHAIN_SWITCH: {
148
- return /* @__PURE__ */ jsx(ChainSwitch, {});
149
- }
150
- default: {
151
- if (IFrameSteps.includes(currentStep)) {
152
- return null;
153
- }
154
- }
155
- }
156
- };
157
- useEffect(() => {
158
- if (!isTestModeAlert && (onRampConfig == null ? void 0 : onRampConfig.testMode)) {
159
- setIsTestModeAlert(true);
160
- }
161
- }, [onRampConfig == null ? void 0 : onRampConfig.testMode]);
162
- useEffect(() => {
163
- switch (currentStep) {
164
- case ModalStep.ADD_FUNDS_BUY:
165
- setAccountAddFundTab(EnabledFlow.BUY);
166
- break;
167
- case ModalStep.ADD_FUNDS_RECEIVE:
168
- setAccountAddFundTab(EnabledFlow.RECEIVE);
169
- break;
170
- case ModalStep.ADD_FUNDS_WITHDRAW:
171
- setAccountAddFundTab(EnabledFlow.WITHDRAW);
172
- break;
173
- default:
174
- break;
175
- }
176
- }, [currentStep]);
177
- return /* @__PURE__ */ jsxs(Container, { slot: "body", "data-testid": "modal-content", children: [
178
- !embeddedModal && /* @__PURE__ */ jsxs(Fragment, { children: [
179
- /* @__PURE__ */ jsx(Controls, { onClose }),
180
- /* @__PURE__ */ jsx(Header, {})
181
- ] }),
182
- /* @__PURE__ */ jsxs(AnimatedWrapper, { children: [
183
- /* @__PURE__ */ jsx(
184
- AnimatePresence,
185
- {
186
- mode: "popLayout",
187
- initial: false,
188
- onExitComplete: () => {
189
- setStepDirection(1);
190
- },
191
- custom: stepDirection,
192
- children: /* @__PURE__ */ jsxs(
193
- BodyContainer,
194
- {
195
- custom: stepDirection,
196
- variants: BODY_MOTION_VARIANTS,
197
- initial: "enter",
198
- animate: "center",
199
- exit: "exit",
200
- transition: BODY_TRANSITION,
201
- children: [
202
- /* @__PURE__ */ jsx(Hero, {}),
203
- /* @__PURE__ */ jsxs(
204
- InnerContainer,
205
- {
206
- $embeddedModal: embeddedModal,
207
- $step: currentStep,
208
- $isIFrameStep: IFrameSteps.includes(currentStep),
209
- children: [
210
- Content(),
211
- (onRampConfig == null ? void 0 : onRampConfig.testMode) && [
212
- ModalStep.ADD_FUNDS_BUY,
213
- ModalStep.ADD_FUNDS_WITHDRAW,
214
- ModalStep.ADD_FUNDS_AWAITING,
215
- ModalStep.ADD_FUNDS_FAILURE,
216
- ModalStep.ADD_FUNDS_SUCCESS
217
- ].includes(currentStep) && isTestModeAlert && accountAddFundTab !== EnabledFlow.RECEIVE && /* @__PURE__ */ jsx(TestModeAlert, { children: /* @__PURE__ */ jsxs("div", { style: { fontSize: "14px" }, children: [
218
- "This Para Modal is configured to run on-ramp services in ",
219
- /* @__PURE__ */ jsx("b", { children: "test mode" }),
220
- " only, for development purposes. If you are a user of ",
221
- appName,
222
- ", please contact support.",
223
- /* @__PURE__ */ jsx(CloseButton, { onClick: () => setIsTestModeAlert(false), children: /* @__PURE__ */ jsx(CloseX, { icon: "x" }) })
224
- ] }) })
225
- ]
226
- }
227
- )
228
- ]
229
- },
230
- ["ADD_FUNDS_BUY", "ADD_FUNDS_RECEIVE", "ADD_FUNDS_WITHDRAW"].includes(currentStep) ? "ADD_FUNDS" : currentStep
231
- )
232
- }
233
- ),
234
- /* @__PURE__ */ jsx(IFrameStep, {})
235
- ] })
236
- ] });
237
- };
238
- const Container = styled.div`
239
- position: relative;
240
- `;
241
- const AnimatedWrapper = styled(AnimatedHeightWrapper)`
242
- margin-top: -16px;
243
- `;
244
- const BodyContainer = styled(motion.div)`
245
- position: relative;
246
- display: flex;
247
- flex-direction: column;
248
- gap: 24px;
249
- will-change: auto !important;
250
- `;
251
- const InnerContainer = styled.div`
252
- z-index: 1;
253
- flex: 1;
254
- display: flex;
255
- flex-direction: column;
256
- justify-content: flex-start;
257
- gap: 24px;
258
- padding: ${({ $embeddedModal, $step, $isIFrameStep }) => {
259
- var _a, _b;
260
- return $isIFrameStep ? "0px" : $embeddedModal ? "12px 0px 0px" : `${(_a = PADDING_TOP[$step]) != null ? _a : "72px"} 72px ${(_b = PADDING_BOTTOM[$step]) != null ? _b : "32px"}`;
261
- }};
262
- min-height: ${({ $step }) => {
263
- var _a;
264
- return (_a = MIN_HEIGHT[$step]) != null ? _a : "auto";
265
- }};
266
- height: ${({ $step }) => {
267
- var _a;
268
- return (_a = MIN_HEIGHT[$step]) != null ? _a : "auto";
269
- }};
270
-
271
- @media (max-width: ${MOBILE_SIZE}px) {
272
- padding: ${({ $embeddedModal, $step, $isIFrameStep }) => {
273
- var _a;
274
- return $isIFrameStep ? "0px" : $embeddedModal ? "12px 0px 0px" : `${(_a = PADDING_TOP[$step]) != null ? _a : "72px"} 16px 0px`;
275
- }};
276
- }
277
-
278
- cpsl-auth-modal.force-mobile-media & {
279
- padding: 72px 16px 0px;
280
- }
281
- `;
282
- const TestModeAlert = styled(CpslAlert)`
283
- --container-padding-end: 40px;
284
- position: absolute;
285
- bottom: 16px;
286
- left: 16px;
287
- right: 16px;
288
- z-index: 1000;
289
- `;
290
- const CloseButton = styled.button`
291
- background-color: transparent;
292
- border: none;
293
- padding: 4px;
294
- cursor: pointer;
295
- position: absolute;
296
- top: 0;
297
- right: 0;
298
- `;
299
- const CloseX = styled(CpslIcon)`
300
- --icon-color: var(--cpsl-color-foreground-0);
301
- `;
302
- export {
303
- Body
304
- };
@@ -1,94 +0,0 @@
1
- "use client";
2
- import {
3
- __async
4
- } from "../../../chunk-MMUBH76A.js";
5
- import { Fragment, jsx, jsxs } from "react/jsx-runtime";
6
- import { CpslButton, CpslIcon, CpslQrCode, CpslSpinner, CpslText } from "@getpara/react-components";
7
- import { CenteredText, InnerStepContainer, QRContainer, StepContainer } from "../common.js";
8
- import { useEffect, useMemo } from "react";
9
- import { useModalStore } from "../../stores/index.js";
10
- import styled from "styled-components";
11
- import { useExternalWallets } from "../../providers/ExternalWalletContext.js";
12
- import { useCopyToClipboard } from "@getpara/react-common";
13
- import { ModalStep } from "../../utils/steps.js";
14
- import { routeMobileExternalWallet } from "../../utils/routeMobileExternalWallet.js";
15
- import { NETWORK_NOT_SUPPORTED_ERROR } from "../../constants/constants.js";
16
- import { WalletType } from "@getpara/web-sdk";
17
- const ChainSwitch = () => {
18
- const [isCopied, copy] = useCopyToClipboard();
19
- const externalWalletError = useModalStore((state) => state.externalWalletError);
20
- const setStep = useModalStore((state) => state.setStep);
21
- const setStepDirection = useModalStore((state) => state.setStepDirection);
22
- const { switchChain, wallet, qrUri, chainIdSwitchingTo, walletDisplayHelpers } = useExternalWallets();
23
- useEffect(() => {
24
- if ((wallet == null ? void 0 : wallet.type) === WalletType.COSMOS) {
25
- routeMobileExternalWallet(qrUri);
26
- }
27
- }, [qrUri, wallet]);
28
- useEffect(() => {
29
- if (!wallet) {
30
- setStepDirection(-1);
31
- setStep(ModalStep.ACCOUNT_MAIN);
32
- }
33
- }, [wallet]);
34
- const handleTryAgainClick = () => __async(void 0, null, function* () {
35
- if (chainIdSwitchingTo) {
36
- yield switchChain(chainIdSwitchingTo);
37
- }
38
- });
39
- const handleCopy = () => {
40
- copy(qrUri);
41
- };
42
- const Content = useMemo(() => {
43
- var _a;
44
- if (!wallet) {
45
- return null;
46
- }
47
- const { isCosmosMobileWallet } = walletDisplayHelpers;
48
- if (isCosmosMobileWallet) {
49
- return /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsxs(InnerStepContainer, { children: [
50
- /* @__PURE__ */ jsx(CpslText, { weight: "semiBold", children: "Scan with your mobile device to switch networks" }),
51
- /* @__PURE__ */ jsx(QRContainer, { children: !qrUri ? /* @__PURE__ */ jsx(CpslSpinner, { size: 100 }) : /* @__PURE__ */ jsx(CpslQrCode, { url: qrUri, imageSrc: wallet.iconUrl }) }),
52
- /* @__PURE__ */ jsxs(CpslButton, { size: "small", variant: "ghost", onClick: handleCopy, children: [
53
- /* @__PURE__ */ jsx(CpslIcon, { slot: "start", icon: isCopied ? "check" : "copy" }),
54
- isCopied ? "Copied" : "Copy Link"
55
- ] })
56
- ] }) });
57
- }
58
- return /* @__PURE__ */ jsxs(InnerStepContainer, { children: [
59
- !(externalWalletError == null ? void 0 : externalWalletError.length) ? /* @__PURE__ */ jsx(CenteredText, { color: "contrast", weight: "semiBold", children: `Confirm the request to change networks in your ${wallet.name} wallet.` }) : /* @__PURE__ */ jsxs(Fragment, { children: [
60
- /* @__PURE__ */ jsxs(ErrorContainer, { children: [
61
- /* @__PURE__ */ jsx(ErrorIcon, { icon: "alertCircle" }),
62
- /* @__PURE__ */ jsx(CenteredText, { weight: "semiBold", color: "error", children: externalWalletError[0] })
63
- ] }),
64
- externalWalletError[1] && /* @__PURE__ */ jsx(CenteredText, { color: "secondary", weight: "medium", children: externalWalletError[1] })
65
- ] }),
66
- ((_a = externalWalletError == null ? void 0 : externalWalletError[0]) == null ? void 0 : _a.toLowerCase()) !== NETWORK_NOT_SUPPORTED_ERROR && /* @__PURE__ */ jsxs(CpslButton, { variant: "secondary", onClick: handleTryAgainClick, children: [
67
- /* @__PURE__ */ jsx(CpslIcon, { slot: "start", icon: "refresh" }),
68
- "Try Again"
69
- ] })
70
- ] });
71
- }, [wallet, walletDisplayHelpers, externalWalletError, qrUri]);
72
- if (!wallet) {
73
- return null;
74
- }
75
- return /* @__PURE__ */ jsx(Container, { children: Content });
76
- };
77
- const Container = styled(StepContainer)`
78
- flex: 1;
79
- justify-content: space-between;
80
- `;
81
- const ErrorContainer = styled.div`
82
- display: flex;
83
- align-items: center;
84
- justify-content: center;
85
- gap: 4px;
86
- `;
87
- const ErrorIcon = styled(CpslIcon)`
88
- --height: 16px;
89
- --width: 16px;
90
- --icon-color: var(--cpsl-color-text-error);
91
- `;
92
- export {
93
- ChainSwitch
94
- };
@@ -1,17 +0,0 @@
1
- "use client";
2
- import "../../../chunk-MMUBH76A.js";
3
- var TabValue = /* @__PURE__ */ ((TabValue2) => {
4
- TabValue2["extension"] = "extension";
5
- TabValue2["mobile"] = "mobile";
6
- TabValue2["web"] = "web";
7
- return TabValue2;
8
- })(TabValue || {});
9
- const TABS = {
10
- extension: { label: "Extension", value: "extension" /* extension */, icon: "puzzlePiece" },
11
- mobile: { label: "Mobile", value: "mobile" /* mobile */, icon: "phone" },
12
- web: { label: "Web", value: "web" /* web */, icon: "globe" }
13
- };
14
- export {
15
- TABS,
16
- TabValue
17
- };
@@ -1,74 +0,0 @@
1
- "use client";
2
- import "../../../chunk-MMUBH76A.js";
3
- import { Fragment, jsx, jsxs } from "react/jsx-runtime";
4
- import { CpslIcon } from "@getpara/react-components";
5
- import { styled } from "styled-components";
6
- import { useModalStore } from "../../stores/index.js";
7
- import { useThemeStore } from "../../stores/theme/useThemeStore.js";
8
- import { useGoBack } from "../../hooks/useGoBack.js";
9
- import { AccountSelect, ChainSelect } from "./Selects.js";
10
- import { ModalStep } from "../../utils/steps.js";
11
- import { HeaderButton } from "@getpara/react-common";
12
- const Controls = ({ onClose }) => {
13
- const bareModal = useThemeStore((state) => state.bareModal);
14
- const hasPreviousStep = useModalStore((state) => state.hasPreviousStep());
15
- const step = useModalStore((state) => state.step);
16
- const isFullyLoggedIn = useModalStore((state) => state.isFullyLoggedIn);
17
- const goBack = useGoBack();
18
- const shouldShowSelects = [
19
- ModalStep.ACCOUNT_MAIN,
20
- ModalStep.CHAIN_SWITCH,
21
- ModalStep.ADD_FUNDS_BUY,
22
- ModalStep.ADD_FUNDS_RECEIVE,
23
- ModalStep.ADD_FUNDS_WITHDRAW
24
- ].includes(step);
25
- const handleBackClick = () => {
26
- goBack();
27
- };
28
- return /* @__PURE__ */ jsxs(Container, { children: [
29
- /* @__PURE__ */ jsx(
30
- BackButton,
31
- {
32
- variant: "ghost",
33
- style: {
34
- visibility: hasPreviousStep ? "visible" : "hidden"
35
- },
36
- onClick: handleBackClick,
37
- children: /* @__PURE__ */ jsx(CpslIcon, { icon: "arrow" })
38
- }
39
- ),
40
- /* @__PURE__ */ jsx(MiddleContainer, { children: shouldShowSelects && isFullyLoggedIn && /* @__PURE__ */ jsxs(Fragment, { children: [
41
- /* @__PURE__ */ jsx(ChainSelect, {}),
42
- /* @__PURE__ */ jsx(AccountSelect, {})
43
- ] }) }),
44
- /* @__PURE__ */ jsx(CloseButton, { bareModal, variant: "ghost", onClick: onClose, children: /* @__PURE__ */ jsx(CpslIcon, { icon: "close" }) })
45
- ] });
46
- };
47
- const Container = styled.div`
48
- position: absolute;
49
- width: 100%;
50
- top: 16px;
51
-
52
- z-index: 3;
53
- display: flex;
54
- align-items: center;
55
- justify-content: space-between;
56
- gap: 8px;
57
- `;
58
- const MiddleContainer = styled.div`
59
- flex: 1;
60
- display: flex;
61
- align-items: center;
62
- justify-content: center;
63
- gap: 4px;
64
- `;
65
- const CloseButton = styled(HeaderButton)`
66
- transform: rotate(180deg);
67
- visibility: ${({ bareModal }) => bareModal ? "hidden" : "visible"};
68
- `;
69
- const BackButton = styled(HeaderButton)`
70
- transform: rotate(180deg);
71
- `;
72
- export {
73
- Controls
74
- };