@getpara/react-sdk 2.0.0-alpha.3 → 2.0.0-alpha.6

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 (183) hide show
  1. package/dist/cli/cli.mjs +1 -6
  2. package/dist/index.js +11 -6499
  3. package/dist/modal/ParaModal.js +262 -0
  4. package/dist/modal/components/Account/Account.js +139 -0
  5. package/dist/modal/components/AddFunds/AddFunds.d.ts +0 -2
  6. package/dist/modal/components/AddFunds/AddFunds.js +69 -0
  7. package/dist/modal/components/AddFunds/AddFundsAsset.d.ts +1 -0
  8. package/dist/modal/components/AddFunds/AddFundsAsset.js +125 -0
  9. package/dist/modal/components/AddFunds/AddFundsAwaiting.js +78 -0
  10. package/dist/modal/components/AddFunds/AddFundsContext.d.ts +31 -0
  11. package/dist/modal/components/AddFunds/AddFundsContext.js +160 -0
  12. package/dist/modal/components/AddFunds/AddFundsDone.js +49 -0
  13. package/dist/modal/components/AddFunds/AddFundsProvider.d.ts +1 -0
  14. package/dist/modal/components/AddFunds/AddFundsProvider.js +109 -0
  15. package/dist/modal/components/AddFunds/AddFundsReceive.d.ts +1 -0
  16. package/dist/modal/components/AddFunds/AddFundsReceive.js +83 -0
  17. package/dist/modal/components/AddFunds/AddFundsSettings.d.ts +1 -0
  18. package/dist/modal/components/AddFunds/AddFundsSettings.js +237 -0
  19. package/dist/{MoonPayEmbed-Q2HP2BFI.js → modal/components/AddFunds/MoonPayEmbed.js} +1 -3
  20. package/dist/modal/components/AddFunds/common.d.ts +19 -0
  21. package/dist/modal/components/AddFunds/common.js +24 -0
  22. package/dist/modal/components/AddFunds/index.js +4 -0
  23. package/dist/modal/components/AuthInput/AuthInput.js +262 -0
  24. package/dist/modal/components/AuthInput/hooks/useDropdownPosition.js +33 -0
  25. package/dist/modal/components/AuthInput/phoneMasks.js +253 -0
  26. package/dist/modal/components/AuthMainStep/AuthMainStep.d.ts +4 -3
  27. package/dist/modal/components/AuthMainStep/AuthMainStep.js +50 -0
  28. package/dist/modal/components/AuthMainStep/AuthMainStepContent.d.ts +4 -3
  29. package/dist/modal/components/AuthMainStep/AuthMainStepContent.js +157 -0
  30. package/dist/modal/components/AuthOptions/AuthOptions.d.ts +4 -3
  31. package/dist/modal/components/AuthOptions/AuthOptions.js +67 -0
  32. package/dist/modal/components/AwaitingBiometricsStep/AwaitingBiometricsStep.js +18 -0
  33. package/dist/modal/components/AwaitingOAuthStep/AwaitingOAuthStep.js +10 -0
  34. package/dist/modal/components/AwaitingPasswordStep/AwaitingPasswordStep.js +18 -0
  35. package/dist/modal/components/AwaitingWalletCreationStep/AwaitingWalletCreationStep.d.ts +5 -1
  36. package/dist/modal/components/AwaitingWalletCreationStep/AwaitingWalletCreationStep.js +49 -0
  37. package/dist/modal/components/BiometricCreationStep/BiometricCreationStep.js +63 -0
  38. package/dist/modal/components/BiometricLoginStep/BiometricLoginStep.js +55 -0
  39. package/dist/modal/components/Body/AnimatedHeightWrapper.js +29 -0
  40. package/dist/modal/components/Body/Body.d.ts +4 -3
  41. package/dist/modal/components/Body/Body.js +327 -0
  42. package/dist/modal/components/ChainSwitch/ChainSwitch.js +95 -0
  43. package/dist/modal/components/ChainSwitch/config.js +17 -0
  44. package/dist/modal/components/Controls/Controls.js +77 -0
  45. package/dist/modal/components/Controls/Selects.js +189 -0
  46. package/dist/modal/components/ExternalWalletStep/ExternalWalletStep.js +144 -0
  47. package/dist/modal/components/ExternalWalletStep/config.js +17 -0
  48. package/dist/modal/components/ExternalWalletVerificationStep/ExternalWalletVerificationStep.js +34 -0
  49. package/dist/modal/components/ExternalWallets/ExternalWallets.js +173 -0
  50. package/dist/modal/components/Footer/Footer.js +95 -0
  51. package/dist/modal/components/Header/Header.js +43 -0
  52. package/dist/modal/components/Header/hooks/useStepTitle.js +54 -0
  53. package/dist/modal/components/Hero/Hero.js +116 -0
  54. package/dist/modal/components/IFrameStep/IFrameStep.js +59 -0
  55. package/dist/modal/components/LoginDoneStep/LoginDoneStep.js +31 -0
  56. package/dist/modal/components/ModalContent/ModalContent.js +95 -0
  57. package/dist/modal/components/OAuth/FarcasterOAuthStep.js +27 -0
  58. package/dist/modal/components/OAuth/OAuth.d.ts +2 -2
  59. package/dist/modal/components/OAuth/OAuth.js +79 -0
  60. package/dist/modal/components/OAuth/TelegramOAuthStep.js +90 -0
  61. package/dist/modal/components/OnRampComponents/AddingFunds.js +23 -0
  62. package/dist/modal/components/OnRampComponents/OnRampProviderButton.js +77 -0
  63. package/dist/modal/components/RecoverySecretStep/RecoverySecretStep.js +107 -0
  64. package/dist/modal/components/Setup2FAStep/Setup2FAStep.js +132 -0
  65. package/dist/modal/components/StripeComponents/StripeComponents.js +88 -0
  66. package/dist/modal/components/TwoFactorDoneStep/TwoFactorDoneStep.js +27 -0
  67. package/dist/modal/components/VerificationCodeStep/VerificationCodeStep.js +143 -0
  68. package/dist/modal/components/Waiting/Waiting.js +17 -0
  69. package/dist/modal/components/WalletCard/PartnerIcon.js +34 -0
  70. package/dist/modal/components/WalletCard/WalletCard.d.ts +3 -3
  71. package/dist/modal/components/WalletCard/WalletCard.js +128 -0
  72. package/dist/modal/components/WalletCreationDoneStep/WalletCreationDoneStep.js +73 -0
  73. package/dist/modal/components/common.d.ts +32 -13
  74. package/dist/modal/components/common.js +175 -0
  75. package/dist/modal/components/index.js +2 -0
  76. package/dist/modal/constants/constants.d.ts +9 -2
  77. package/dist/modal/constants/constants.js +138 -0
  78. package/dist/modal/constants/defaults.js +10 -0
  79. package/dist/modal/constants/oAuthLogos.d.ts +3 -3
  80. package/dist/modal/constants/oAuthLogos.js +24 -0
  81. package/dist/modal/hooks/useGoBack.js +43 -0
  82. package/dist/modal/index.d.ts +1 -2
  83. package/dist/modal/index.js +29 -0
  84. package/dist/modal/stores/index.js +2 -0
  85. package/dist/modal/stores/modal/actions.js +133 -0
  86. package/dist/modal/stores/modal/useModalStore.d.ts +12 -4
  87. package/dist/modal/stores/modal/useModalStore.js +68 -0
  88. package/dist/modal/types/commonTypes.d.ts +0 -47
  89. package/dist/modal/types/commonTypes.js +1 -0
  90. package/dist/modal/types/externalWallets.d.ts +2 -0
  91. package/dist/modal/types/externalWallets.js +32 -0
  92. package/dist/modal/types/modalProps.d.ts +10 -2
  93. package/dist/modal/types/modalProps.js +12 -0
  94. package/dist/modal/utils/authInputHelpers.d.ts +7 -0
  95. package/dist/modal/utils/authInputHelpers.js +38 -0
  96. package/dist/modal/utils/authLayoutHelpers.js +8 -0
  97. package/dist/modal/utils/countryCodes.js +45 -0
  98. package/dist/modal/utils/getMailtoLink.js +10 -0
  99. package/dist/modal/utils/getTileButtonFlex.js +20 -0
  100. package/dist/modal/utils/isPasskeySupported.js +15 -0
  101. package/dist/modal/utils/openPopup.js +60 -0
  102. package/dist/modal/utils/routeMobileExternalWallet.js +31 -0
  103. package/dist/modal/utils/steps.d.ts +6 -0
  104. package/dist/modal/utils/steps.js +247 -0
  105. package/dist/modal/utils/stringFormatters.d.ts +1 -0
  106. package/dist/modal/utils/stringFormatters.js +19 -0
  107. package/dist/modal/utils/validateOnRampConfig.js +32 -0
  108. package/dist/package.json +6 -0
  109. package/dist/provider/ParaProvider.js +83 -0
  110. package/dist/provider/actions/getAccount.d.ts +8 -1
  111. package/dist/provider/actions/getAccount.js +51 -0
  112. package/dist/provider/actions/getWallet.d.ts +2 -2
  113. package/dist/provider/actions/getWallet.js +14 -0
  114. package/dist/provider/actions/index.d.ts +2 -0
  115. package/dist/provider/actions/index.js +59 -0
  116. package/dist/provider/actions/utils.js +15 -0
  117. package/dist/provider/components/CosmosWalletWrapper.js +34 -0
  118. package/dist/provider/components/EvmWalletWrapper.js +34 -0
  119. package/dist/provider/components/ExternalWalletWrapper.js +139 -0
  120. package/dist/provider/components/SolanaWalletWrapper.js +36 -0
  121. package/dist/provider/external/getParaCosmosConnector.js +22 -0
  122. package/dist/provider/external/getParaEvmConnector.js +22 -0
  123. package/dist/provider/external/getParaSolanaConnector.js +22 -0
  124. package/dist/provider/external/stubs/CosmosExternalWalletContextStub.js +18 -0
  125. package/dist/provider/external/stubs/EvmExternalWalletContextStub.js +21 -0
  126. package/dist/provider/external/stubs/SolanaExternalWalletContextStub.js +14 -0
  127. package/dist/provider/hooks/index.js +4 -0
  128. package/dist/provider/hooks/mutations/index.d.ts +1 -0
  129. package/dist/provider/hooks/mutations/index.js +61 -0
  130. package/dist/provider/hooks/mutations/utils.js +22 -0
  131. package/dist/provider/hooks/queries/index.d.ts +1 -0
  132. package/dist/provider/hooks/queries/index.js +10 -0
  133. package/dist/provider/hooks/queries/useAccount.js +21 -0
  134. package/dist/provider/hooks/queries/useWallet.js +22 -0
  135. package/dist/provider/hooks/queries/useWalletBalance.d.ts +6 -0
  136. package/dist/provider/hooks/queries/useWalletBalance.js +55 -0
  137. package/dist/provider/hooks/utils/index.js +10 -0
  138. package/dist/provider/hooks/utils/useAutoSessionKeepAlive.js +74 -0
  139. package/dist/provider/hooks/utils/useClient.js +10 -0
  140. package/dist/provider/hooks/utils/useEventListeners.d.ts +1 -1
  141. package/dist/provider/hooks/utils/useEventListeners.js +147 -0
  142. package/dist/provider/hooks/utils/useInternalClient.js +10 -0
  143. package/dist/provider/hooks/utils/useModal.js +17 -0
  144. package/dist/provider/hooks/utils/useWalletState.d.ts +3 -3
  145. package/dist/provider/hooks/utils/useWalletState.js +48 -0
  146. package/dist/provider/index.js +9 -0
  147. package/dist/provider/providers/AuthProvider.d.ts +10 -6
  148. package/dist/provider/providers/AuthProvider.js +498 -0
  149. package/dist/provider/providers/CosmosExternalWalletProvider.js +66 -0
  150. package/dist/provider/providers/EvmExternalWalletProvider.js +74 -0
  151. package/dist/provider/providers/ExternalWalletProvider.d.ts +5 -2
  152. package/dist/provider/providers/ExternalWalletProvider.js +428 -0
  153. package/dist/provider/providers/SolanaExternalWalletProvider.js +66 -0
  154. package/dist/provider/stores/getters.d.ts +1 -1
  155. package/dist/provider/stores/getters.js +13 -0
  156. package/dist/provider/stores/setters.js +7 -0
  157. package/dist/provider/stores/slices/client.js +9 -0
  158. package/dist/provider/stores/slices/config.js +9 -0
  159. package/dist/provider/stores/slices/externalWallets.js +40 -0
  160. package/dist/provider/stores/slices/index.js +5 -0
  161. package/dist/provider/stores/slices/modal.js +16 -0
  162. package/dist/provider/stores/slices/wallet.js +13 -0
  163. package/dist/provider/stores/types.d.ts +7 -4
  164. package/dist/provider/stores/types.js +1 -0
  165. package/dist/provider/stores/useStore.js +28 -0
  166. package/dist/provider/types/externalWalletProviders.d.ts +2 -2
  167. package/dist/provider/types/externalWalletProviders.js +1 -0
  168. package/dist/provider/types/provider.d.ts +9 -3
  169. package/dist/provider/types/provider.js +1 -0
  170. package/dist/provider/types/query.js +1 -0
  171. package/dist/provider/types/utils.js +1 -0
  172. package/dist/provider/utils/constants.d.ts +5 -0
  173. package/dist/provider/utils/constants.js +10 -0
  174. package/dist/provider/utils/paraConfigTypeGuards.js +13 -0
  175. package/dist/provider/utils/renameMutations.js +18 -0
  176. package/package.json +18 -16
  177. package/dist/MoonPayEmbed-Q2HP2BFI.js.br +0 -0
  178. package/dist/MoonPayEmbed-Q2HP2BFI.js.gz +0 -0
  179. package/dist/chunk-MMUBH76A.js.br +0 -0
  180. package/dist/chunk-MMUBH76A.js.gz +0 -0
  181. package/dist/index.js.br +0 -0
  182. package/dist/index.js.gz +0 -0
  183. /package/dist/modal/{components/AuthInput → utils}/countryCodes.d.ts +0 -0
@@ -0,0 +1,43 @@
1
+ "use client";
2
+ import "../../../chunk-MMUBH76A.js";
3
+ import { jsx } from "react/jsx-runtime";
4
+ import { styled } from "styled-components";
5
+ import { useStepTitle } from "./hooks/useStepTitle.js";
6
+ import { CenteredText } from "../common.js";
7
+ import { AnimatePresence, motion } from "framer-motion";
8
+ import { useModalStore } from "../../stores/index.js";
9
+ import { BODY_MOTION_VARIANTS, BODY_TRANSITION } from "../../constants/constants.js";
10
+ const Header = () => {
11
+ const { title } = useStepTitle();
12
+ const stepDirection = useModalStore((state) => state.stepDirection);
13
+ const currentStep = useModalStore((state) => state.step);
14
+ return /* @__PURE__ */ jsx(AnimatePresence, { mode: "popLayout", initial: false, custom: stepDirection, children: /* @__PURE__ */ jsx(
15
+ Container,
16
+ {
17
+ custom: stepDirection,
18
+ variants: BODY_MOTION_VARIANTS,
19
+ initial: "enter",
20
+ animate: "center",
21
+ exit: "exit",
22
+ transition: BODY_TRANSITION,
23
+ slot: "header",
24
+ id: "header",
25
+ children: /* @__PURE__ */ jsx(CenteredText, { weight: "semiBold", color: "secondary", children: title })
26
+ },
27
+ ["ADD_FUNDS_BUY", "ADD_FUNDS_RECEIVE", "ADD_FUNDS_WITHDRAW"].includes(currentStep) ? "ADD_FUNDS" : currentStep
28
+ ) });
29
+ };
30
+ const Container = styled(motion.div)`
31
+ position: absolute;
32
+ top: 16px;
33
+ width: 100%;
34
+ z-index: 2;
35
+ display: flex;
36
+ align-items: center;
37
+ justify-content: space-between;
38
+ gap: 8px;
39
+ flex-wrap: wrap;
40
+ `;
41
+ export {
42
+ Header
43
+ };
@@ -0,0 +1,54 @@
1
+ "use client";
2
+ import "../../../../chunk-MMUBH76A.js";
3
+ import { useMemo } from "react";
4
+ import { useModalStore } from "../../../stores/modal/useModalStore.js";
5
+ import { ModalStep } from "../../../utils/steps.js";
6
+ import { useExternalWallets } from "../../../../provider/providers/ExternalWalletProvider.js";
7
+ import { useStore } from "../../../../provider/stores/useStore.js";
8
+ const useStepTitle = () => {
9
+ const hideWallets = useStore((state) => {
10
+ var _a;
11
+ return (_a = state.modalConfig) == null ? void 0 : _a.hideWallets;
12
+ });
13
+ const isLogin = useModalStore((state) => state.isLogin());
14
+ const currentStep = useModalStore((state) => state.step);
15
+ const { chainId } = useExternalWallets();
16
+ const titles = useMemo(
17
+ () => ({
18
+ [ModalStep.AUTH_MAIN]: "",
19
+ [ModalStep.AUTH_MORE]: "Sign Up or Log In",
20
+ [ModalStep.AUTH_GUEST_SIGNUP]: "Complete Account Setup",
21
+ [ModalStep.EX_WALLET_MORE]: "Connect Wallet",
22
+ [ModalStep.VERIFICATIONS]: "Sign Up",
23
+ [ModalStep.AWAITING_OAUTH]: isLogin ? "Login" : "Sign Up",
24
+ [ModalStep.FARCASTER_OAUTH]: isLogin ? "Login" : "Sign Up",
25
+ [ModalStep.BIOMETRIC_CREATION]: "Sign Up",
26
+ [ModalStep.PASSWORD_CREATION]: "Sign Up",
27
+ [ModalStep.AWAITING_BIOMETRIC_CREATION]: "Sign Up",
28
+ [ModalStep.AWAITING_WALLET_CREATION]: isLogin ? "Login" : "Sign Up",
29
+ [ModalStep.AWAITING_PASSWORD_CREATION]: "Sign Up",
30
+ [ModalStep.WALLET_CREATION_DONE]: hideWallets ? "Account Created" : "Wallet Created",
31
+ [ModalStep.SECRET]: isLogin ? "Login" : "Sign Up",
32
+ [ModalStep.BIOMETRIC_LOGIN]: "Login",
33
+ [ModalStep.AWAITING_PASSWORD_LOGIN]: "Login",
34
+ [ModalStep.AWAITING_BIOMETRIC_LOGIN]: "Login",
35
+ [ModalStep.LOGIN_DONE]: "",
36
+ [ModalStep.SETUP_2FA]: "2FA",
37
+ [ModalStep.VERIFY_2FA]: "2FA",
38
+ [ModalStep.TWO_FACTOR_DONE]: "2FA",
39
+ [ModalStep.ADD_FUNDS_BUY]: "",
40
+ [ModalStep.ADD_FUNDS_RECEIVE]: "",
41
+ [ModalStep.ADD_FUNDS_WITHDRAW]: "",
42
+ [ModalStep.ADD_FUNDS_AWAITING]: "",
43
+ [ModalStep.ADD_FUNDS_SUCCESS]: "",
44
+ [ModalStep.ADD_FUNDS_FAILURE]: "",
45
+ [ModalStep.ACCOUNT_MAIN]: "",
46
+ [ModalStep.CHAIN_SWITCH]: ""
47
+ }),
48
+ [isLogin, chainId, hideWallets]
49
+ );
50
+ return { title: titles[currentStep] };
51
+ };
52
+ export {
53
+ useStepTitle
54
+ };
@@ -0,0 +1,116 @@
1
+ "use client";
2
+ import "../../../chunk-MMUBH76A.js";
3
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
4
+ import { CpslHero, CpslIcon, CpslIdenticon } from "@getpara/react-components";
5
+ import styled from "styled-components";
6
+ import { ModalStep } from "../../utils/steps.js";
7
+ import { useModalStore } from "../../stores/index.js";
8
+ import { NETWORK_NOT_SUPPORTED_ERROR } from "../../constants/constants.js";
9
+ import { useEffect, useState } from "react";
10
+ import { isMobile } from "@getpara/web-sdk";
11
+ import { useInternalClient } from "../../../provider/hooks/utils/useInternalClient.js";
12
+ import { useExternalWallets } from "../../../provider/providers/ExternalWalletProvider.js";
13
+ import { useWallet } from "../../../provider/index.js";
14
+ const getStepConfig = ({
15
+ externalWalletError
16
+ }) => {
17
+ var _a;
18
+ return {
19
+ [ModalStep.EX_WALLET_SELECTED]: {
20
+ variant: "externalWalletConnection",
21
+ topOffset: 40,
22
+ spacerHeight: 158,
23
+ hideFadeOut: true
24
+ },
25
+ [ModalStep.CHAIN_SWITCH]: {
26
+ variant: ((_a = externalWalletError == null ? void 0 : externalWalletError[0]) == null ? void 0 : _a.toLowerCase()) === NETWORK_NOT_SUPPORTED_ERROR ? "failed" : "externalWalletConnection",
27
+ topOffset: 20,
28
+ spacerHeight: 158,
29
+ hideFadeOut: true
30
+ },
31
+ [ModalStep.FARCASTER_OAUTH]: {
32
+ variant: "externalWalletConnection",
33
+ topOffset: 40,
34
+ spacerHeight: 158,
35
+ hideFadeOut: true
36
+ }
37
+ };
38
+ };
39
+ const Hero = () => {
40
+ const para = useInternalClient();
41
+ const { wallet: connector, walletDisplayHelpers, avatar } = useExternalWallets();
42
+ const step = useModalStore((state) => state.step);
43
+ const externalWalletError = useModalStore((state) => state.externalWalletError);
44
+ const { data: activeWallet } = useWallet();
45
+ const [currentStep, setCurrentStep] = useState(step);
46
+ const stepConfig = getStepConfig({
47
+ externalWalletError
48
+ })[currentStep];
49
+ useEffect(() => {
50
+ const prevStepConfig = getStepConfig({
51
+ externalWalletError
52
+ })[currentStep];
53
+ const newStepConfig = getStepConfig({
54
+ externalWalletError
55
+ })[step];
56
+ const delay = newStepConfig && prevStepConfig ? 0 : newStepConfig && !prevStepConfig ? 0 : 200;
57
+ setTimeout(() => {
58
+ setCurrentStep(step);
59
+ }, delay);
60
+ }, [step]);
61
+ const isExternalStep = currentStep === ModalStep.EX_WALLET_SELECTED;
62
+ const isChainSwitchStep = currentStep === ModalStep.CHAIN_SWITCH;
63
+ const isAccountStep = currentStep === ModalStep.ACCOUNT_MAIN;
64
+ const isFarcasterStep = currentStep === ModalStep.FARCASTER_OAUTH;
65
+ const { showExtension, isCosmosMobileWallet } = walletDisplayHelpers;
66
+ const shouldHide = !stepConfig || !isMobile() && isExternalStep && !showExtension || !isMobile() && isChainSwitchStep && isCosmosMobileWallet || !isMobile() && isFarcasterStep;
67
+ const { variant, topOffset, spacerHeight, hideFadeOut } = stepConfig != null ? stepConfig : {};
68
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
69
+ /* @__PURE__ */ jsx(Container, { $top: -45 + (topOffset != null ? topOffset : 0), children: shouldHide ? null : /* @__PURE__ */ jsxs(StyledHero, { $isAccount: isAccountStep, hideFadeOut, variant, height: 480, withDefaultTheme: true, children: [
70
+ (isExternalStep || isChainSwitchStep) && /* @__PURE__ */ jsx(WalletLogo, { slot: "connectionLeft", src: connector == null ? void 0 : connector.iconUrl }),
71
+ isFarcasterStep && /* @__PURE__ */ jsx(WalletLogo, { slot: "connectionLeft", icon: "farcasterBrand" }),
72
+ isAccountStep && (avatar ? /* @__PURE__ */ jsx(Avatar, { slot: "image", src: avatar }) : activeWallet ? /* @__PURE__ */ jsx(IconAvatar, { slot: "image", size: "100%", hash: para.getIdenticonHash(activeWallet.id, activeWallet.type) }) : null)
73
+ ] }) }),
74
+ !shouldHide && /* @__PURE__ */ jsx(Spacer, { $height: spacerHeight != null ? spacerHeight : 0 })
75
+ ] });
76
+ };
77
+ const Container = styled.div`
78
+ display: flex;
79
+ position: absolute;
80
+ justify-content: center;
81
+ align-items: center;
82
+ width: 100%;
83
+
84
+ top: ${({ $top }) => `${$top}px`};
85
+ `;
86
+ const Spacer = styled.div`
87
+ height: ${({ $height }) => `${$height}px`};
88
+ `;
89
+ const WalletLogo = styled(CpslIcon)`
90
+ --height: 60px;
91
+ --width: 60px;
92
+ `;
93
+ const Avatar = styled.img`
94
+ width: 100%;
95
+ height: 100%;
96
+ object-fit: contain;
97
+ `;
98
+ const IconAvatar = styled(CpslIdenticon)`
99
+ border-radius: 1000px;
100
+ `;
101
+ const StyledHero = styled(CpslHero)`
102
+ ${({ $isAccount }) => $isAccount && `
103
+ --ring-3-size: 560px;
104
+ --ring-2-size: 402px;
105
+ --ring-1-size: 228px;
106
+ --ring-0-size: 104px;
107
+
108
+ --default-theme-ring-3-opacity: 0.02;
109
+ --default-theme-ring-2-opacity: 0.04;
110
+ --default-theme-ring-1-opacity: 0.06;
111
+ --default-theme-ring-0-opacity: 0.1;
112
+ `}
113
+ `;
114
+ export {
115
+ Hero
116
+ };
@@ -0,0 +1,59 @@
1
+ "use client";
2
+ import "../../../chunk-MMUBH76A.js";
3
+ import { jsx, jsxs } from "react/jsx-runtime";
4
+ import { useModalStore } from "../../stores/index.js";
5
+ import { IFrameSteps } from "../../utils/steps.js";
6
+ import styled from "styled-components";
7
+ import { SpinnerContainer } from "@getpara/react-common";
8
+ import { CpslSpinner } from "@getpara/react-components";
9
+ import { MOBILE_SIZE } from "../../constants/constants.js";
10
+ import { useStore } from "../../../provider/stores/useStore.js";
11
+ const IFrameStep = () => {
12
+ const iFrameUrl = useModalStore((state) => state.iFrameUrl);
13
+ const setIsReady = useModalStore((state) => state.setIsIFrameReady);
14
+ const isReady = useModalStore((state) => state.isIFrameReady);
15
+ const currentStep = useModalStore((state) => state.step);
16
+ const embeddedModal = useStore((state) => {
17
+ var _a;
18
+ return (_a = state.modalConfig) == null ? void 0 : _a.embeddedModal;
19
+ });
20
+ return /* @__PURE__ */ jsxs(OuterContainer, { $isVisible: IFrameSteps.includes(currentStep), $embeddedModal: !!embeddedModal, children: [
21
+ /* @__PURE__ */ jsx(Container, { $isReady: !!isReady, children: /* @__PURE__ */ jsx(
22
+ "iframe",
23
+ {
24
+ src: iFrameUrl,
25
+ onLoad: () => {
26
+ setIsReady(true);
27
+ }
28
+ }
29
+ ) }),
30
+ !isReady && /* @__PURE__ */ jsx(SpinnerContainer, { style: { width: "100%", height: "100%", flex: 1 }, children: /* @__PURE__ */ jsx(CpslSpinner, { size: 100 }) })
31
+ ] });
32
+ };
33
+ const OuterContainer = styled.div`
34
+ height: ${({ $isVisible }) => $isVisible ? "100%" : "0px"};
35
+ width: ${({ $isVisible }) => $isVisible ? "100%" : "0px"};
36
+ flex: ${({ $isVisible }) => $isVisible ? 1 : "auto"};
37
+ padding: ${({ $embeddedModal, $isVisible }) => !$isVisible ? "0px" : $embeddedModal ? "12px 0px 0px" : "72px 72px 32px"};
38
+ display: flex;
39
+ align-items: center;
40
+ justify-content: center;
41
+
42
+ @media (max-width: ${MOBILE_SIZE}px) {
43
+ padding: ${({ $embeddedModal, $isVisible }) => !$isVisible ? "0px" : $embeddedModal ? "12px 0px 0px" : "72px 16px 0px"};
44
+ }
45
+ `;
46
+ const Container = styled.div`
47
+ height: 100%;
48
+ width: 100%;
49
+ display: ${({ $isReady }) => $isReady ? "block" : "none"};
50
+
51
+ & > iframe {
52
+ height: 360px;
53
+ width: 100%;
54
+ border: none;
55
+ }
56
+ `;
57
+ export {
58
+ IFrameStep
59
+ };
@@ -0,0 +1,31 @@
1
+ "use client";
2
+ import "../../../chunk-MMUBH76A.js";
3
+ import { jsx, jsxs } from "react/jsx-runtime";
4
+ import { useEffect } from "react";
5
+ import { Heading, HeroIcon, StepContainer } from "../common.js";
6
+ import { ExternalWalletCard, WalletCard, WalletCards } from "../WalletCard/WalletCard.js";
7
+ import { useInternalClient } from "../../../provider/hooks/utils/useInternalClient.js";
8
+ import { useStore } from "../../../provider/stores/useStore.js";
9
+ const LoginDoneStep = ({ onClose }) => {
10
+ var _a, _b;
11
+ const para = useInternalClient();
12
+ const hideWallets = useStore((state) => {
13
+ var _a2;
14
+ return (_a2 = state.modalConfig) == null ? void 0 : _a2.hideWallets;
15
+ });
16
+ useEffect(() => {
17
+ setTimeout(() => {
18
+ onClose();
19
+ }, 1600);
20
+ }, []);
21
+ return /* @__PURE__ */ jsxs(StepContainer, { children: [
22
+ /* @__PURE__ */ jsx(HeroIcon, { icon: "checkCircleFilled" }),
23
+ /* @__PURE__ */ jsx(Heading, { variant: "headingS", weight: "bold", children: "Connected" }),
24
+ !hideWallets && /* @__PURE__ */ jsx(WalletCards, { children: para.externalWalletConnectionType === "CONNECTION_ONLY" ? /* @__PURE__ */ jsx(ExternalWalletCard, { address: (_b = (_a = Object.values(para.externalWallets || {})[0]) == null ? void 0 : _a.address) != null ? _b : "" }) : para.currentWalletIdsArray.map(([id, type]) => {
25
+ return /* @__PURE__ */ jsx(WalletCard, { id, type }, `${id}-${type}`);
26
+ }) })
27
+ ] });
28
+ };
29
+ export {
30
+ LoginDoneStep
31
+ };
@@ -0,0 +1,95 @@
1
+ "use client";
2
+ import {
3
+ __async,
4
+ __spreadProps,
5
+ __spreadValues
6
+ } from "../../../chunk-MMUBH76A.js";
7
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
8
+ import { forwardRef, useEffect, useImperativeHandle } from "react";
9
+ import { EnabledFlow } from "@getpara/web-sdk";
10
+ import { useModalStore } from "../../stores/index.js";
11
+ import { ModalStep } from "../../utils/steps.js";
12
+ import { Body } from "../Body/Body.js";
13
+ import { Footer } from "../Footer/Footer.js";
14
+ import { useInternalClient } from "../../../provider/hooks/utils/useInternalClient.js";
15
+ import { useExternalWallets } from "../../../provider/providers/ExternalWalletProvider.js";
16
+ const ModalContent = forwardRef(
17
+ ({
18
+ twoFactorAuthEnabled = false,
19
+ oAuthMethods,
20
+ disableEmailLogin,
21
+ disablePhoneLogin,
22
+ isGuestModeEnabled = false,
23
+ onClose,
24
+ onRampTestMode
25
+ }, ref) => {
26
+ const para = useInternalClient();
27
+ const refs = useModalStore((state) => state.refs);
28
+ const onRampConfig = useModalStore((state) => state.onRampConfig);
29
+ const setOnRampConfig = useModalStore((state) => state.setOnRampConfig);
30
+ const accountAddFundTab = useModalStore((state) => state.accountAddFundTab);
31
+ const setAccountAddFundTab = useModalStore((state) => state.setAccountAddFundTab);
32
+ const { disconnectExternalWallet } = useExternalWallets();
33
+ useImperativeHandle(ref, () => {
34
+ return {
35
+ handleModalClose() {
36
+ handleClose();
37
+ }
38
+ };
39
+ }, []);
40
+ const handleClose = () => {
41
+ onClose == null ? void 0 : onClose();
42
+ if (refs.currentStep.current === ModalStep.EXTERNAL_WALLET_VERIFICATION && para.isExternalWalletAuth) {
43
+ disconnectExternalWallet();
44
+ }
45
+ };
46
+ useEffect(() => {
47
+ if (!onRampConfig) {
48
+ para.ctx.client.getOnRampConfig().then((res) => {
49
+ let newOnRampConfig;
50
+ newOnRampConfig = __spreadProps(__spreadValues({}, res), { testMode: onRampTestMode });
51
+ setOnRampConfig(newOnRampConfig);
52
+ if (!accountAddFundTab) {
53
+ setAccountAddFundTab(
54
+ newOnRampConfig.isBuyEnabled ? EnabledFlow.BUY : newOnRampConfig.isReceiveEnabled ? EnabledFlow.RECEIVE : newOnRampConfig.isWithdrawEnabled ? EnabledFlow.WITHDRAW : void 0
55
+ );
56
+ }
57
+ }).catch();
58
+ }
59
+ }, []);
60
+ useEffect(() => {
61
+ if (!!onRampConfig) {
62
+ setOnRampConfig(__spreadProps(__spreadValues({}, onRampConfig), { testMode: onRampTestMode }));
63
+ }
64
+ }, [onRampTestMode]);
65
+ useEffect(() => {
66
+ const init = () => __async(void 0, null, function* () {
67
+ if (!(yield para.isFullyLoggedIn())) {
68
+ yield disconnectExternalWallet();
69
+ }
70
+ });
71
+ init();
72
+ return () => {
73
+ var _a;
74
+ window.clearTimeout((_a = refs.poll.current) == null ? void 0 : _a.timeout);
75
+ };
76
+ }, []);
77
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
78
+ /* @__PURE__ */ jsx(
79
+ Body,
80
+ {
81
+ oAuthMethods,
82
+ twoFactorAuthEnabled,
83
+ disableEmailLogin: !!disableEmailLogin,
84
+ disablePhoneLogin: !!disablePhoneLogin,
85
+ isGuestModeEnabled,
86
+ onClose: handleClose
87
+ }
88
+ ),
89
+ /* @__PURE__ */ jsx(Footer, {})
90
+ ] });
91
+ }
92
+ );
93
+ export {
94
+ ModalContent
95
+ };
@@ -0,0 +1,27 @@
1
+ "use client";
2
+ import "../../../chunk-MMUBH76A.js";
3
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
4
+ import { CpslButton, CpslIcon, CpslQrCode, CpslSpinner, CpslText } from "@getpara/react-components";
5
+ import { CenteredText, Heading, InnerStepContainer, QRContainer, StepContainer } from "../common.js";
6
+ import { useModalStore } from "../../stores/index.js";
7
+ import { isMobile } from "@getpara/web-sdk";
8
+ const FarcasterOAuthStep = () => {
9
+ const farcasterConnectUri = useModalStore((state) => state.farcasterConnectUri);
10
+ return /* @__PURE__ */ jsx(StepContainer, { $wide: true, children: isMobile() ? /* @__PURE__ */ jsxs(InnerStepContainer, { children: [
11
+ /* @__PURE__ */ jsx(CpslText, { weight: "medium", color: "secondary", children: `Don\u2019t have Farcaster` }),
12
+ /* @__PURE__ */ jsxs(CpslButton, { as: "a", href: "https://link.warpcast.com/download-qr", target: "_blank", variant: "secondary", children: [
13
+ /* @__PURE__ */ jsx(CpslIcon, { slot: "start", icon: "linkExternal" }),
14
+ `Get Farcaster`
15
+ ] })
16
+ ] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
17
+ /* @__PURE__ */ jsx(Heading, { variant: "headingS", weight: "bold", children: "Sign in using Farcaster" }),
18
+ /* @__PURE__ */ jsxs(InnerStepContainer, { children: [
19
+ /* @__PURE__ */ jsx(CenteredText, { variant: "bodyS", color: "secondary", weight: "medium", children: "Scan the QR code with your phone's camera to proceed." }),
20
+ /* @__PURE__ */ jsx(QRContainer, { children: !farcasterConnectUri ? /* @__PURE__ */ jsx(CpslSpinner, { size: 100 }) : /* @__PURE__ */ jsx(CpslQrCode, { url: farcasterConnectUri }) })
21
+ ] })
22
+ ] }) });
23
+ };
24
+ var FarcasterOAuthStep_default = FarcasterOAuthStep;
25
+ export {
26
+ FarcasterOAuthStep_default as default
27
+ };
@@ -1,6 +1,6 @@
1
- import { OAuthMethod } from '@getpara/web-sdk';
1
+ import { TOAuthMethod } from '@getpara/web-sdk';
2
2
  interface OAuthProps {
3
- methods: OAuthMethod[];
3
+ methods: TOAuthMethod[];
4
4
  }
5
5
  export declare const OAuth: ({ methods }: OAuthProps) => import("react/jsx-runtime").JSX.Element;
6
6
  export {};
@@ -0,0 +1,79 @@
1
+ "use client";
2
+ import {
3
+ __async
4
+ } from "../../../chunk-MMUBH76A.js";
5
+ import { jsx, jsxs } from "react/jsx-runtime";
6
+ import { styled } from "styled-components";
7
+ import { useModalStore } from "../../stores/index.js";
8
+ import { ModalStep } from "../../utils/steps.js";
9
+ import { getTileButtonFlex } from "../../utils/getTileButtonFlex.js";
10
+ import { StyledCpslTileButton } from "../common.js";
11
+ import { brandedOAuthLogos, oAuthLogos } from "../../constants/oAuthLogos.js";
12
+ import { useStore } from "../../../provider/stores/useStore.js";
13
+ import { useAuthActions } from "../../../provider/providers/AuthProvider.js";
14
+ const HAS_MORE_LENGTH = 3;
15
+ const OAuth = ({ methods }) => {
16
+ const oAuthLogoVariant = useStore((state) => state.oAuthLogoVariant);
17
+ const isDark = useStore((state) => state.isDarkTheme);
18
+ const setStep = useModalStore((state) => state.setStep);
19
+ const showAll = useModalStore((state) => state.step === ModalStep.AUTH_MORE || state.step === ModalStep.AUTH_GUEST_SIGNUP);
20
+ const { verifyFarcaster, verifyOAuth } = useAuthActions();
21
+ const hasMore = methods.length > HAS_MORE_LENGTH;
22
+ const methodsToShow = showAll || !hasMore ? methods : methods.slice(0, HAS_MORE_LENGTH - 1);
23
+ const handleShowAll = () => {
24
+ setStep(ModalStep.AUTH_MORE);
25
+ };
26
+ const handleMethodClick = (method) => () => __async(void 0, null, function* () {
27
+ switch (method) {
28
+ case "FARCASTER":
29
+ verifyFarcaster();
30
+ break;
31
+ case "TELEGRAM":
32
+ setStep(ModalStep.TELEGRAM_OAUTH);
33
+ break;
34
+ default:
35
+ verifyOAuth(method);
36
+ break;
37
+ }
38
+ });
39
+ const useBrandedLogos = oAuthLogoVariant === "default";
40
+ const useDarkLogos = useBrandedLogos ? isDark : oAuthLogoVariant !== "dark";
41
+ const showMoreButton = !showAll && hasMore;
42
+ return /* @__PURE__ */ jsxs(OAuthContainer, { children: [
43
+ methodsToShow.map((method, index) => /* @__PURE__ */ jsx(
44
+ OAuthButton,
45
+ {
46
+ $isDark: useDarkLogos,
47
+ icon: useBrandedLogos ? brandedOAuthLogos[method] : oAuthLogos[method],
48
+ onClick: handleMethodClick(method),
49
+ $index: index,
50
+ $totalItems: showMoreButton ? HAS_MORE_LENGTH : methodsToShow.length
51
+ },
52
+ method
53
+ )),
54
+ showMoreButton && /* @__PURE__ */ jsx(
55
+ OAuthButton,
56
+ {
57
+ $isDark: useDarkLogos,
58
+ icon: "moreLoginOptions",
59
+ onClick: handleShowAll,
60
+ $index: HAS_MORE_LENGTH - 1,
61
+ $totalItems: HAS_MORE_LENGTH
62
+ }
63
+ )
64
+ ] });
65
+ };
66
+ const OAuthContainer = styled.div`
67
+ display: flex;
68
+ justify-content: center;
69
+ gap: 8px;
70
+ flex-wrap: wrap;
71
+ `;
72
+ const OAuthButton = styled(StyledCpslTileButton)`
73
+ flex: ${({ $index, $totalItems }) => getTileButtonFlex($index, $totalItems)};
74
+
75
+ --button-icon-color: ${({ $isDark }) => $isDark ? "white" : "black"};
76
+ `;
77
+ export {
78
+ OAuth
79
+ };
@@ -0,0 +1,90 @@
1
+ "use client";
2
+ import {
3
+ __async
4
+ } from "../../../chunk-MMUBH76A.js";
5
+ import { jsx, jsxs } from "react/jsx-runtime";
6
+ import { constructUrl, getPortalBaseURL } from "@getpara/web-sdk";
7
+ import styled from "styled-components";
8
+ import { useEffect, useRef, useState } from "react";
9
+ import { HeroSpinner } from "@getpara/react-common";
10
+ import { CpslSpinner } from "@getpara/react-components";
11
+ import { useInternalClient } from "../../../provider/hooks/utils/useInternalClient.js";
12
+ import { useAuthActions } from "../../../provider/providers/AuthProvider.js";
13
+ function TelegramOAuthStep() {
14
+ const iframe = useRef();
15
+ const para = useInternalClient();
16
+ const { verifyTelegram } = useAuthActions();
17
+ const [url, setUrl] = useState();
18
+ const [isWaiting, setIsWaiting] = useState(false);
19
+ const [isLoaded, setIsLoaded] = useState(false);
20
+ const [isError, setIsError] = useState(false);
21
+ useEffect(() => {
22
+ if (!url) {
23
+ setUrl(
24
+ constructUrl({
25
+ base: getPortalBaseURL(para.ctx, true),
26
+ path: "/auth/telegram"
27
+ })
28
+ );
29
+ }
30
+ }, [url]);
31
+ useEffect(() => {
32
+ const updateState = (event) => __async(this, null, function* () {
33
+ switch (event.data.type) {
34
+ case "TELEGRAM_LOGIN":
35
+ setIsWaiting(true);
36
+ setIsError(false);
37
+ break;
38
+ case "TELEGRAM_FAILED":
39
+ setIsWaiting(false);
40
+ setIsError(true);
41
+ break;
42
+ case "TELEGRAM_SUCCESS":
43
+ if (!!event.data.payload) {
44
+ const authObject = event.data.payload;
45
+ verifyTelegram(authObject);
46
+ }
47
+ break;
48
+ }
49
+ });
50
+ window == null ? void 0 : window.addEventListener("message", updateState, false);
51
+ return () => {
52
+ window == null ? void 0 : window.removeEventListener("message", updateState, false);
53
+ };
54
+ }, []);
55
+ return /* @__PURE__ */ jsxs(Container, { children: [
56
+ /* @__PURE__ */ jsx(HeroContainer, { children: /* @__PURE__ */ jsx(
57
+ HeroSpinner,
58
+ {
59
+ icon: "telegramBrand",
60
+ status: isWaiting ? "loading" : isError ? "error" : "inactive",
61
+ text: isWaiting ? "Follow the on-screen prompts." : isError ? "Login Failed" : void 0
62
+ }
63
+ ) }),
64
+ url && /* @__PURE__ */ jsx(IFrame, { ref: iframe, style: { display: isLoaded ? "block" : "none" }, src: url, onLoad: () => setIsLoaded(true) }),
65
+ (!url || !isLoaded) && /* @__PURE__ */ jsx(CpslSpinner, {})
66
+ ] });
67
+ }
68
+ const Container = styled.div`
69
+ display: flex;
70
+ flex-direction: column;
71
+ align-items: center;
72
+ justify-content: center;
73
+ width: 100%;
74
+ `;
75
+ const HeroContainer = styled.div`
76
+ display: flex;
77
+ min-height: 276px;
78
+ flex-direction: column;
79
+ align-items: center;
80
+ gap: 16px;
81
+ flex: 1;
82
+ `;
83
+ const IFrame = styled.iframe`
84
+ width: 100%;
85
+ height: 52px;
86
+ border: none;
87
+ `;
88
+ export {
89
+ TelegramOAuthStep
90
+ };
@@ -0,0 +1,23 @@
1
+ "use client";
2
+ import "../../../chunk-MMUBH76A.js";
3
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
4
+ import { OnRampPurchaseStatus } from "@getpara/web-sdk";
5
+ import { SpinnerContainer } from "../common.js";
6
+ import { ON_RAMP_PROVIDERS } from "../../constants/constants.js";
7
+ import { useModalStore } from "../../stores/index.js";
8
+ import { CpslSpinner, CpslText } from "@getpara/react-components";
9
+ const AddingFunds = () => {
10
+ const onRampPurchase = useModalStore((state) => state.onRampPurchase);
11
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
12
+ /* @__PURE__ */ jsx(SpinnerContainer, { children: /* @__PURE__ */ jsx(CpslSpinner, { size: 100 }) }),
13
+ /* @__PURE__ */ jsxs(CpslText, { children: [
14
+ "Follow the prompts presented by",
15
+ " ",
16
+ OnRampPurchaseStatus && (onRampPurchase == null ? void 0 : onRampPurchase.provider) ? ON_RAMP_PROVIDERS[onRampPurchase.provider].name : "the provider",
17
+ "."
18
+ ] })
19
+ ] });
20
+ };
21
+ export {
22
+ AddingFunds
23
+ };