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

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 (143) hide show
  1. package/dist/index.js +6 -6367
  2. package/dist/modal/ParaModal.js +337 -0
  3. package/dist/modal/components/Account/Account.js +69 -0
  4. package/dist/modal/components/AddFunds/AddFunds.js +220 -0
  5. package/dist/modal/components/AddFunds/AddFundsAwaiting.js +72 -0
  6. package/dist/modal/components/AddFunds/AddFundsDone.js +43 -0
  7. package/dist/{MoonPayEmbed-Q2HP2BFI.js → modal/components/AddFunds/MoonPayEmbed.js} +1 -3
  8. package/dist/modal/components/AddFunds/index.js +4 -0
  9. package/dist/modal/components/AuthInput/AuthInput.js +283 -0
  10. package/dist/modal/components/AuthInput/countryCodes.js +42 -0
  11. package/dist/modal/components/AuthInput/hooks/useDropdownPosition.js +33 -0
  12. package/dist/modal/components/AuthInput/phoneMasks.js +253 -0
  13. package/dist/modal/components/AuthMainStep/AuthMainStep.js +37 -0
  14. package/dist/modal/components/AuthMainStep/AuthMainStepContent.js +113 -0
  15. package/dist/modal/components/AuthOptions/AuthOptions.js +33 -0
  16. package/dist/modal/components/AwaitingBiometricsStep/AwaitingBiometricsStep.js +18 -0
  17. package/dist/modal/components/AwaitingOAuthStep/AwaitingOAuthStep.js +10 -0
  18. package/dist/modal/components/AwaitingPasswordStep/AwaitingPasswordStep.js +18 -0
  19. package/dist/modal/components/AwaitingWalletCreationStep/AwaitingWalletCreationStep.js +44 -0
  20. package/dist/modal/components/BiometricCreationStep/BiometricCreationStep.js +52 -0
  21. package/dist/modal/components/BiometricLoginStep/BiometricLoginStep.js +93 -0
  22. package/dist/modal/components/Body/AnimatedHeightWrapper.js +29 -0
  23. package/dist/modal/components/Body/Body.js +304 -0
  24. package/dist/modal/components/ChainSwitch/ChainSwitch.js +94 -0
  25. package/dist/modal/components/ChainSwitch/config.js +17 -0
  26. package/dist/modal/components/Controls/Controls.js +74 -0
  27. package/dist/modal/components/Controls/Selects.js +213 -0
  28. package/dist/modal/components/ExternalWalletStep/ExternalWalletStep.js +151 -0
  29. package/dist/modal/components/ExternalWalletStep/config.js +17 -0
  30. package/dist/modal/components/ExternalWallets/ExternalWallets.js +172 -0
  31. package/dist/modal/components/ExternalWalletsWrapper/ExternalWalletsWrapper.js +123 -0
  32. package/dist/modal/components/Footer/Footer.js +93 -0
  33. package/dist/modal/components/Header/Header.js +43 -0
  34. package/dist/modal/components/Header/hooks/useStepTitle.js +50 -0
  35. package/dist/modal/components/Hero/Hero.js +122 -0
  36. package/dist/modal/components/IFrameStep/IFrameStep.js +55 -0
  37. package/dist/modal/components/LoginDoneStep/LoginDoneStep.js +28 -0
  38. package/dist/modal/components/ModalContent/ModalContent.js +310 -0
  39. package/dist/modal/components/OAuth/FarcasterOAuthStep.js +81 -0
  40. package/dist/modal/components/OAuth/OAuth.js +153 -0
  41. package/dist/modal/components/OAuth/TelegramOAuthStep.js +139 -0
  42. package/dist/modal/components/OnRampComponents/AddingFunds.js +23 -0
  43. package/dist/modal/components/OnRampComponents/OnRampProviderButton.js +77 -0
  44. package/dist/modal/components/RecoverySecretStep/RecoverySecretStep.js +101 -0
  45. package/dist/modal/components/Setup2FAStep/Setup2FAStep.js +141 -0
  46. package/dist/modal/components/StripeComponents/StripeComponents.js +88 -0
  47. package/dist/modal/components/TwoFactorDoneStep/TwoFactorDoneStep.js +24 -0
  48. package/dist/modal/components/VerificationCodeStep/VerificationCodeStep.js +159 -0
  49. package/dist/modal/components/Waiting/Waiting.js +17 -0
  50. package/dist/modal/components/WalletCard/PartnerIcon.js +34 -0
  51. package/dist/modal/components/WalletCard/WalletCard.js +127 -0
  52. package/dist/modal/components/WalletCreationDoneStep/WalletCreationDoneStep.js +52 -0
  53. package/dist/modal/components/common.js +83 -0
  54. package/dist/modal/components/index.js +2 -0
  55. package/dist/modal/constants/constants.js +111 -0
  56. package/dist/modal/constants/defaults.js +10 -0
  57. package/dist/modal/constants/oAuthLogos.js +24 -0
  58. package/dist/modal/hooks/useActiveWallet.js +15 -0
  59. package/dist/modal/hooks/useCreateAccount.js +72 -0
  60. package/dist/modal/hooks/useEmbeddedExternalConnection.js +39 -0
  61. package/dist/modal/hooks/useGoBack.js +35 -0
  62. package/dist/modal/hooks/useSetLoginURLs.d.ts +8 -0
  63. package/dist/modal/hooks/useSetLoginURLs.js +45 -0
  64. package/dist/modal/index.js +32 -0
  65. package/dist/modal/providers/CosmosExternalWalletContextStub.js +34 -0
  66. package/dist/modal/providers/EvmExternalWalletContextStub.js +38 -0
  67. package/dist/modal/providers/ExternalWalletContext.js +275 -0
  68. package/dist/modal/providers/SolanaExternalWalletContextStub.js +19 -0
  69. package/dist/modal/stores/externalWalletProvider/actions.js +10 -0
  70. package/dist/modal/stores/externalWalletProvider/useExternalWalletProviderStore.js +20 -0
  71. package/dist/modal/stores/index.js +4 -0
  72. package/dist/modal/stores/modal/actions.js +70 -0
  73. package/dist/modal/stores/modal/useModalStore.js +65 -0
  74. package/dist/modal/stores/theme/actions.js +28 -0
  75. package/dist/modal/stores/theme/useThemeStore.js +21 -0
  76. package/dist/modal/stores/userInfo/actions.js +30 -0
  77. package/dist/modal/stores/userInfo/useUserInfoStore.js +17 -0
  78. package/dist/modal/types/commonTypes.js +1 -0
  79. package/dist/modal/types/externalWallets.js +31 -0
  80. package/dist/modal/types/modalProps.js +12 -0
  81. package/dist/modal/utils/authLayoutHelpers.js +8 -0
  82. package/dist/modal/utils/getMailtoLink.js +10 -0
  83. package/dist/modal/utils/getTileButtonFlex.js +20 -0
  84. package/dist/modal/utils/openPopup.js +60 -0
  85. package/dist/modal/utils/routeMobileExternalWallet.js +31 -0
  86. package/dist/modal/utils/steps.js +228 -0
  87. package/dist/modal/utils/stringFormatters.js +14 -0
  88. package/dist/modal/utils/validateOnRampConfig.js +32 -0
  89. package/dist/package.json +4 -0
  90. package/dist/provider/ParaProvider.js +22 -0
  91. package/dist/provider/actions/checkIfUserExists.js +21 -0
  92. package/dist/provider/actions/createUser.js +26 -0
  93. package/dist/provider/actions/getAccount.js +22 -0
  94. package/dist/provider/actions/getWallet.js +14 -0
  95. package/dist/provider/actions/initiateLogin.js +20 -0
  96. package/dist/provider/actions/keepSessionAlive.js +20 -0
  97. package/dist/provider/actions/logout.js +17 -0
  98. package/dist/provider/actions/signMessage.js +20 -0
  99. package/dist/provider/actions/signTransaction.js +20 -0
  100. package/dist/provider/actions/waitForAccountCreation.js +21 -0
  101. package/dist/provider/actions/waitForLoginAndSetup.js +24 -0
  102. package/dist/provider/actions/waitForPasskeyAndCreateWallet.js +21 -0
  103. package/dist/provider/hooks/index.js +4 -0
  104. package/dist/provider/hooks/mutations/index.js +24 -0
  105. package/dist/provider/hooks/mutations/useCheckIfUserExists.js +23 -0
  106. package/dist/provider/hooks/mutations/useCreateUser.js +20 -0
  107. package/dist/provider/hooks/mutations/useInitiateLogin.js +23 -0
  108. package/dist/provider/hooks/mutations/useKeepSessionAlive.js +20 -0
  109. package/dist/provider/hooks/mutations/useLogout.js +30 -0
  110. package/dist/provider/hooks/mutations/useSignMessage.js +33 -0
  111. package/dist/provider/hooks/mutations/useSignTransaction.js +33 -0
  112. package/dist/provider/hooks/mutations/useWaitForAccountCreation.js +30 -0
  113. package/dist/provider/hooks/mutations/useWaitForLoginAndSetup.js +30 -0
  114. package/dist/provider/hooks/mutations/useWaitForPasskeyAndCreateWallet.js +30 -0
  115. package/dist/provider/hooks/queries/index.js +8 -0
  116. package/dist/provider/hooks/queries/useAccount.js +21 -0
  117. package/dist/provider/hooks/queries/useWallet.js +22 -0
  118. package/dist/provider/hooks/utils/index.js +10 -0
  119. package/dist/provider/hooks/utils/useAutoSessionKeepAlive.js +74 -0
  120. package/dist/provider/hooks/utils/useClient.js +10 -0
  121. package/dist/provider/hooks/utils/useEventListeners.js +105 -0
  122. package/dist/provider/hooks/utils/useInternalClient.js +10 -0
  123. package/dist/provider/hooks/utils/useModal.js +17 -0
  124. package/dist/provider/hooks/utils/useWalletState.js +33 -0
  125. package/dist/provider/index.js +8 -0
  126. package/dist/provider/stores/getters.js +13 -0
  127. package/dist/provider/stores/slices/client.js +9 -0
  128. package/dist/provider/stores/slices/index.js +4 -0
  129. package/dist/provider/stores/slices/modal.js +9 -0
  130. package/dist/provider/stores/slices/wallet.js +11 -0
  131. package/dist/provider/stores/types.js +1 -0
  132. package/dist/provider/stores/useStore.js +27 -0
  133. package/dist/provider/types/provider.js +1 -0
  134. package/dist/provider/types/query.js +1 -0
  135. package/dist/provider/types/utils.js +1 -0
  136. package/dist/provider/utils/renameMutations.js +16 -0
  137. package/package.json +5 -5
  138. package/dist/MoonPayEmbed-Q2HP2BFI.js.br +0 -0
  139. package/dist/MoonPayEmbed-Q2HP2BFI.js.gz +0 -0
  140. package/dist/chunk-MMUBH76A.js.br +0 -0
  141. package/dist/chunk-MMUBH76A.js.gz +0 -0
  142. package/dist/index.js.br +0 -0
  143. package/dist/index.js.gz +0 -0
@@ -0,0 +1,29 @@
1
+ "use client";
2
+ import "../../../chunk-MMUBH76A.js";
3
+ import { jsx } from "react/jsx-runtime";
4
+ import { motion } from "framer-motion";
5
+ import { useEffect, useRef, useState } from "react";
6
+ import styled from "styled-components";
7
+ const AnimatedHeightWrapper = ({ children, className }) => {
8
+ const containerRef = useRef(null);
9
+ const [height, setHeight] = useState("auto");
10
+ useEffect(() => {
11
+ if (containerRef.current) {
12
+ const resizeObserver = new ResizeObserver((entries) => {
13
+ const observedHeight = entries[0].contentRect.height;
14
+ setHeight(observedHeight);
15
+ });
16
+ resizeObserver.observe(containerRef.current);
17
+ return () => {
18
+ resizeObserver.disconnect();
19
+ };
20
+ }
21
+ }, []);
22
+ return /* @__PURE__ */ jsx(Container, { className, style: { height }, animate: { height }, transition: { duration: 0.2 }, children: /* @__PURE__ */ jsx("div", { ref: containerRef, children }) });
23
+ };
24
+ const Container = styled(motion.div)`
25
+ overflow: hidden;
26
+ `;
27
+ export {
28
+ AnimatedHeightWrapper
29
+ };
@@ -0,0 +1,304 @@
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
+ };
@@ -0,0 +1,94 @@
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
+ };
@@ -0,0 +1,17 @@
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
+ };
@@ -0,0 +1,74 @@
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
+ };