@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,157 @@
1
+ "use client";
2
+ import "../../../chunk-MMUBH76A.js";
3
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
4
+ import { Fragment as Fragment2, useMemo } from "react";
5
+ import { CpslButton, CpslDivider, CpslIconGroup } from "@getpara/react-components";
6
+ import styled from "styled-components";
7
+ import { ExternalWallets } from "../ExternalWallets/ExternalWallets.js";
8
+ import { useModalStore } from "../../stores/index.js";
9
+ import { ModalStep } from "../../utils/steps.js";
10
+ import { AuthLayout } from "../../types/modalProps.js";
11
+ import { brandedOAuthLogos, oAuthLogos } from "../../constants/oAuthLogos.js";
12
+ import { AuthOptions } from "../AuthOptions/AuthOptions.js";
13
+ import { useExternalWallets } from "../../../provider/providers/ExternalWalletProvider.js";
14
+ import { useStore } from "../../../provider/stores/useStore.js";
15
+ import { useAuthActions } from "../../../provider/providers/AuthProvider.js";
16
+ import { useAccount } from "../../../provider/index.js";
17
+ const AuthMainStepContent = ({
18
+ oAuthMethods,
19
+ disableEmailLogin,
20
+ disablePhoneLogin,
21
+ isGuestModeEnabled = false
22
+ }) => {
23
+ const { wallets } = useExternalWallets();
24
+ const { createGuestWallets } = useAuthActions();
25
+ const { data: account } = useAccount();
26
+ const authLayout = useModalStore((state) => state.authLayout);
27
+ const setStep = useModalStore((state) => state.setStep);
28
+ const oAuthLogoVariant = useStore((state) => state.oAuthLogoVariant);
29
+ const isDark = useStore((state) => {
30
+ var _a, _b;
31
+ return ((_b = (_a = state.modalConfig) == null ? void 0 : _a.theme) == null ? void 0 : _b.mode) === "dark";
32
+ });
33
+ const isGuestMode = (account == null ? void 0 : account.isConnected) && account.isGuestMode;
34
+ const useBrandedLogos = oAuthLogoVariant === "default";
35
+ const useDarkLogos = useBrandedLogos ? isDark : oAuthLogoVariant !== "dark";
36
+ const handleCondensedAuthClick = () => {
37
+ setStep(ModalStep.AUTH_MORE);
38
+ };
39
+ const handleCondensedExternalClick = () => {
40
+ setStep(ModalStep.EX_WALLET_MORE);
41
+ };
42
+ const Content = useMemo(() => {
43
+ const methods = [];
44
+ authLayout == null ? void 0 : authLayout.forEach((layout) => {
45
+ switch (layout) {
46
+ case AuthLayout.AUTH_FULL: {
47
+ methods.push([
48
+ /* @__PURE__ */ jsx(
49
+ AuthOptions,
50
+ {
51
+ oAuthMethods,
52
+ disableEmailLogin,
53
+ disablePhoneLogin,
54
+ isGuestModeEnabled
55
+ },
56
+ "authFull"
57
+ ),
58
+ layout
59
+ ]);
60
+ break;
61
+ }
62
+ case AuthLayout.AUTH_CONDENSED: {
63
+ const icons = [];
64
+ oAuthMethods == null ? void 0 : oAuthMethods.forEach((method) => icons.push(useBrandedLogos ? brandedOAuthLogos[method] : oAuthLogos[method]));
65
+ methods.push([
66
+ /* @__PURE__ */ jsxs(CondensedButton, { onClick: handleCondensedAuthClick, variant: "tertiary", fullWidth: true, children: [
67
+ /* @__PURE__ */ jsx(IconGroupSpacer, { slot: "start", icons: [], $isDark: useDarkLogos }),
68
+ "Sign Up or Login",
69
+ /* @__PURE__ */ jsx(StyledIconGroup, { slot: "end", icons: icons.splice(0, 3), $isDark: useDarkLogos })
70
+ ] }, "authCondensed"),
71
+ layout
72
+ ]);
73
+ break;
74
+ }
75
+ case AuthLayout.EXTERNAL_FULL: {
76
+ if (!!wallets.length) {
77
+ methods.push([/* @__PURE__ */ jsx(ExternalWallets, {}, "externalWallets"), layout]);
78
+ }
79
+ break;
80
+ }
81
+ case AuthLayout.EXTERNAL_CONDENSED: {
82
+ const icons = [];
83
+ wallets == null ? void 0 : wallets.forEach((wallet) => icons.push(wallet.iconUrl));
84
+ methods.push([
85
+ /* @__PURE__ */ jsxs(CondensedButton, { onClick: handleCondensedExternalClick, variant: "tertiary", fullWidth: true, children: [
86
+ /* @__PURE__ */ jsx(IconGroupSpacer, { slot: "start", icons: [], $isDark: useDarkLogos }),
87
+ "Connect Wallet",
88
+ /* @__PURE__ */ jsx(StyledIconGroup, { slot: "end", icons: icons.splice(0, 3), $isDark: useDarkLogos })
89
+ ] }, "authCondensed"),
90
+ layout
91
+ ]);
92
+ break;
93
+ }
94
+ default: {
95
+ break;
96
+ }
97
+ }
98
+ });
99
+ return /* @__PURE__ */ jsx(Fragment, { children: methods.map(([reactNode, key], index) => /* @__PURE__ */ jsxs(Fragment2, { children: [
100
+ reactNode,
101
+ methods.length > 1 && index < methods.length - 1 && /* @__PURE__ */ jsx(CpslDivider, { children: "or" }, "or")
102
+ ] }, key)) });
103
+ }, [oAuthMethods, disableEmailLogin, disablePhoneLogin, isGuestModeEnabled, wallets, authLayout]);
104
+ return /* @__PURE__ */ jsxs(Container, { "data-testid": "main-auth-step-content", children: [
105
+ Content,
106
+ isGuestModeEnabled && !isGuestMode && /* @__PURE__ */ jsx(
107
+ GuestMode,
108
+ {
109
+ href: "#",
110
+ isDark,
111
+ onClick: (e) => {
112
+ e.preventDefault();
113
+ createGuestWallets();
114
+ },
115
+ children: "Continue as Guest"
116
+ }
117
+ )
118
+ ] });
119
+ };
120
+ const Container = styled.div`
121
+ display: flex;
122
+ flex-direction: column;
123
+ gap: 8px;
124
+ `;
125
+ const StyledIconGroup = styled(CpslIconGroup)`
126
+ --icon-item-color: ${({ $isDark }) => $isDark ? "white" : "black"};
127
+ flex: 1;
128
+ justify-content: flex-end;
129
+ `;
130
+ const IconGroupSpacer = styled(StyledIconGroup)`
131
+ visibility: hidden;
132
+ `;
133
+ const CondensedButton = styled(CpslButton)`
134
+ --button-justify-content: space-between;
135
+
136
+ &::part(button-native) {
137
+ max-height: 50px;
138
+ }
139
+ `;
140
+ const GuestMode = styled.a`
141
+ display: flex;
142
+ justify-content: center;
143
+ align-items: center;
144
+ width: 100%;
145
+ height: 50px;
146
+ color: ${({ isDark }) => isDark ? "white" : "black"};
147
+ text-decoration: underline;
148
+ font-size: 16px;
149
+ font-weight: 500;
150
+
151
+ &:hover {
152
+ text-decoration: underline;
153
+ }
154
+ `;
155
+ export {
156
+ AuthMainStepContent
157
+ };
@@ -1,8 +1,9 @@
1
- import { OAuthMethod } from '@getpara/web-sdk';
1
+ import { TOAuthMethod } from '@getpara/web-sdk';
2
2
  interface AuthOptionsProps {
3
- oAuthMethods?: OAuthMethod[];
3
+ oAuthMethods?: TOAuthMethod[];
4
4
  disableEmailLogin: boolean;
5
5
  disablePhoneLogin: boolean;
6
+ isGuestModeEnabled: boolean;
6
7
  }
7
- export declare const AuthOptions: ({ oAuthMethods, disableEmailLogin, disablePhoneLogin }: AuthOptionsProps) => import("react/jsx-runtime").JSX.Element;
8
+ export declare const AuthOptions: ({ oAuthMethods, disableEmailLogin, disablePhoneLogin, isGuestModeEnabled, }: AuthOptionsProps) => import("react/jsx-runtime").JSX.Element;
8
9
  export {};
@@ -0,0 +1,67 @@
1
+ "use client";
2
+ import "../../../chunk-MMUBH76A.js";
3
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
4
+ import { useEffect, useMemo } from "react";
5
+ import styled from "styled-components";
6
+ import { OAuth } from "../OAuth/OAuth.js";
7
+ import { AuthInput } from "../AuthInput/AuthInput.js";
8
+ import { useExternalWallets } from "../../../provider/providers/ExternalWalletProvider.js";
9
+ import { useModalStore } from "../../stores/index.js";
10
+ import { CpslIcon } from "@getpara/react-components";
11
+ import { useStore } from "../../../provider/stores/useStore.js";
12
+ const AuthOptions = ({
13
+ oAuthMethods,
14
+ disableEmailLogin,
15
+ disablePhoneLogin,
16
+ isGuestModeEnabled = false
17
+ }) => {
18
+ const { wallets } = useExternalWallets();
19
+ const isDark = useStore((state) => {
20
+ var _a, _b;
21
+ return ((_b = (_a = state.modalConfig) == null ? void 0 : _a.theme) == null ? void 0 : _b.mode) === "dark";
22
+ });
23
+ const guestAddFundsTab = useModalStore((state) => state.guestAddFundsTab);
24
+ const setGuestAddFundsTab = useModalStore((state) => state.setGuestAddFundsTab);
25
+ const Content = useMemo(() => {
26
+ const Methods = [];
27
+ if (!!(oAuthMethods == null ? void 0 : oAuthMethods.length)) {
28
+ Methods.push(/* @__PURE__ */ jsx(OAuth, { methods: oAuthMethods }, "oAuth"));
29
+ }
30
+ if (!disableEmailLogin || !disablePhoneLogin) {
31
+ Methods.push(/* @__PURE__ */ jsx(AuthInput, { disableEmailLogin, disablePhoneLogin }, "input"));
32
+ }
33
+ return /* @__PURE__ */ jsx(Fragment, { children: Methods });
34
+ }, [oAuthMethods, disableEmailLogin, disablePhoneLogin, isGuestModeEnabled, wallets]);
35
+ useEffect(() => {
36
+ return () => {
37
+ setGuestAddFundsTab();
38
+ };
39
+ }, []);
40
+ return /* @__PURE__ */ jsxs(Container, { children: [
41
+ guestAddFundsTab && /* @__PURE__ */ jsxs(CompleteAccountSetup, { isDark, children: [
42
+ /* @__PURE__ */ jsx(CpslIcon, { icon: "stars02", size: "16px" }),
43
+ "Complete account setup to",
44
+ " ",
45
+ guestAddFundsTab === "BUY" ? "buy assets" : guestAddFundsTab === "WITHDRAW" ? "sell assets" : "continue",
46
+ "."
47
+ ] }),
48
+ Content
49
+ ] });
50
+ };
51
+ const Container = styled.div`
52
+ display: flex;
53
+ flex-direction: column;
54
+ gap: 8px;
55
+ `;
56
+ const CompleteAccountSetup = styled.div`
57
+ display: flex;
58
+ align-items: center;
59
+ justify-content: center;
60
+ gap: 4px;
61
+ color: ${({ isDark }) => isDark ? "white" : "black"};
62
+ font-weight: 500;
63
+ font-size: 14px;
64
+ `;
65
+ export {
66
+ AuthOptions
67
+ };
@@ -0,0 +1,18 @@
1
+ "use client";
2
+ import "../../../chunk-MMUBH76A.js";
3
+ import { jsx } from "react/jsx-runtime";
4
+ import { useModalStore } from "../../stores/index.js";
5
+ import { Waiting } from "../Waiting/Waiting.js";
6
+ const AwaitingBiometricsStep = () => {
7
+ const isLogin = useModalStore((state) => state.isLogin());
8
+ return /* @__PURE__ */ jsx(
9
+ Waiting,
10
+ {
11
+ heading: isLogin ? "Waiting for Passkey" : "Creating Passkey",
12
+ subheading: "Follow the prompts presented by your browser."
13
+ }
14
+ );
15
+ };
16
+ export {
17
+ AwaitingBiometricsStep
18
+ };
@@ -0,0 +1,10 @@
1
+ "use client";
2
+ import "../../../chunk-MMUBH76A.js";
3
+ import { jsx } from "react/jsx-runtime";
4
+ import { Waiting } from "../Waiting/Waiting.js";
5
+ const AwaitingOAuthStep = () => {
6
+ return /* @__PURE__ */ jsx(Waiting, { heading: "Complete Login", subheading: "Follow the prompts presented by your browser." });
7
+ };
8
+ export {
9
+ AwaitingOAuthStep
10
+ };
@@ -0,0 +1,18 @@
1
+ "use client";
2
+ import "../../../chunk-MMUBH76A.js";
3
+ import { jsx } from "react/jsx-runtime";
4
+ import { useModalStore } from "../../stores/index.js";
5
+ import { Waiting } from "../Waiting/Waiting.js";
6
+ const AwaitingPasswordStep = () => {
7
+ const isLogin = useModalStore((state) => state.isLogin());
8
+ return /* @__PURE__ */ jsx(
9
+ Waiting,
10
+ {
11
+ heading: isLogin ? "Waiting for Password" : "Creating Password",
12
+ subheading: "Follow the prompts presented by your browser."
13
+ }
14
+ );
15
+ };
16
+ export {
17
+ AwaitingPasswordStep
18
+ };
@@ -1 +1,5 @@
1
- export declare const AwaitingWalletCreationStep: () => import("react/jsx-runtime").JSX.Element;
1
+ type Props = {
2
+ isGuestMode?: boolean;
3
+ };
4
+ export declare const AwaitingWalletCreationStep: ({ isGuestMode }: Props) => import("react/jsx-runtime").JSX.Element;
5
+ export {};
@@ -0,0 +1,49 @@
1
+ "use client";
2
+ import "../../../chunk-MMUBH76A.js";
3
+ import { jsx, jsxs } from "react/jsx-runtime";
4
+ import { CpslIcon, CpslInfoBox, CpslText } from "@getpara/react-components";
5
+ import { InfoBoxContent, InfoBoxHeader, StepContainer } from "../common.js";
6
+ import { useEffect, useRef, useState } from "react";
7
+ import { Waiting } from "../Waiting/Waiting.js";
8
+ import { useStore } from "../../../provider/stores/useStore.js";
9
+ import { useAccount } from "../../../provider/index.js";
10
+ const AwaitingWalletCreationStep = ({ isGuestMode = false }) => {
11
+ const hideWallets = useStore((state) => {
12
+ var _a;
13
+ return (_a = state.modalConfig) == null ? void 0 : _a.hideWallets;
14
+ });
15
+ const [showInfoBox, setShowInfoBox] = useState(false);
16
+ const showInfoBoxTimeout = useRef();
17
+ const { data: account } = useAccount();
18
+ useEffect(() => {
19
+ if (typeof window !== "undefined") {
20
+ showInfoBoxTimeout.current = window.setTimeout(() => {
21
+ setShowInfoBox(true);
22
+ }, 4e3);
23
+ }
24
+ return () => clearTimeout(showInfoBoxTimeout.current);
25
+ }, []);
26
+ return /* @__PURE__ */ jsxs(StepContainer, { $wide: true, children: [
27
+ /* @__PURE__ */ jsx(
28
+ Waiting,
29
+ {
30
+ heading: isGuestMode ? "Creating Guest Account" : (account == null ? void 0 : account.isGuestMode) ? hideWallets ? "Linking Guest Account" : "Linking Guest Wallet" : hideWallets ? "Creating Your Account" : "Creating Your Wallet",
31
+ subheading: "This should only take a couple of seconds."
32
+ }
33
+ ),
34
+ showInfoBox && /* @__PURE__ */ jsx(CpslInfoBox, { children: /* @__PURE__ */ jsxs(InfoBoxContent, { children: [
35
+ /* @__PURE__ */ jsxs(InfoBoxHeader, { children: [
36
+ /* @__PURE__ */ jsx(CpslIcon, { icon: "clock" }),
37
+ /* @__PURE__ */ jsx(CpslText, { weight: "medium", children: "Hang on" })
38
+ ] }),
39
+ /* @__PURE__ */ jsxs(CpslText, { variant: "bodyS", weight: "medium", color: "secondary", children: [
40
+ "Creating your ",
41
+ hideWallets ? "account" : "wallet",
42
+ " is taking a little longer than expected, but we're working on it!"
43
+ ] })
44
+ ] }) })
45
+ ] });
46
+ };
47
+ export {
48
+ AwaitingWalletCreationStep
49
+ };
@@ -0,0 +1,63 @@
1
+ "use client";
2
+ import "../../../chunk-MMUBH76A.js";
3
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
4
+ import { CpslButton, CpslDivider, CpslIcon, CpslQrCode, CpslSpinner, CpslText } from "@getpara/react-components";
5
+ import { useModalStore } from "../../stores/index.js";
6
+ import { InnerStepContainer, StepContainer, Heading, QRContainer } from "../common.js";
7
+ import { useCopyToClipboard, UserIdentifier } from "@getpara/react-common";
8
+ import { useInternalClient } from "../../../provider/hooks/utils/useInternalClient.js";
9
+ import { useAuthActions } from "../../../provider/providers/AuthProvider.js";
10
+ import { AuthMethod } from "@getpara/web-sdk";
11
+ import { useStore } from "../../../provider/stores/useStore.js";
12
+ const BiometricCreationStep = () => {
13
+ const para = useInternalClient();
14
+ const authInfo = para.authInfo;
15
+ const appName = useStore((state) => state.appName);
16
+ const { presentSignupUi } = useAuthActions();
17
+ const signupState = useModalStore((state) => state.getSignupState());
18
+ const authStepRoute = useModalStore((state) => state.authStepRoute);
19
+ const isPasskeySupported = useModalStore((state) => state.isPasskeySupported);
20
+ const [isCopied, copy] = useCopyToClipboard();
21
+ const handleCopy = () => {
22
+ if (signupState == null ? void 0 : signupState.passkeyUrl) {
23
+ copy(signupState.passkeyUrl);
24
+ }
25
+ };
26
+ const onClick = (method) => () => {
27
+ presentSignupUi(method, signupState);
28
+ };
29
+ const isBoth = !!(signupState == null ? void 0 : signupState.passkeyUrl) && !!(signupState == null ? void 0 : signupState.passwordUrl);
30
+ if (!signupState) {
31
+ return null;
32
+ }
33
+ return /* @__PURE__ */ jsxs(StepContainer, { $wide: true, children: [
34
+ /* @__PURE__ */ jsxs(InnerStepContainer, { children: [
35
+ /* @__PURE__ */ jsx(Heading, { variant: "headingS", weight: "bold", children: para.isExternalWalletAuth ? `Finish setup for your${appName ? ` ${appName}` : ""} wallet` : isBoth ? "Secure Your Account" : "Create Passkey" }),
36
+ /* @__PURE__ */ jsx(UserIdentifier, { authInfo }),
37
+ /* @__PURE__ */ jsx(CpslText, { variant: "bodyS", color: "secondary", weight: "medium", children: isBoth ? "Choose a password or set up a passkey" : "Your Passkey keeps your account safe." })
38
+ ] }),
39
+ /* @__PURE__ */ jsxs(InnerStepContainer, { children: [
40
+ isPasskeySupported ? /* @__PURE__ */ jsxs(CpslButton, { fullWidth: true, onClick: onClick(AuthMethod.PASSKEY), children: [
41
+ /* @__PURE__ */ jsx(CpslIcon, { slot: "start", icon: "key" }),
42
+ isBoth ? "Create Passkey" : "Create"
43
+ ] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
44
+ /* @__PURE__ */ jsx(CpslText, { weight: "semiBold", children: "Scan with your mobile device" }),
45
+ /* @__PURE__ */ jsx(QRContainer, { children: !(signupState == null ? void 0 : signupState.passkeyUrl) ? /* @__PURE__ */ jsx(CpslSpinner, { size: 100 }) : /* @__PURE__ */ jsx(CpslQrCode, { url: signupState.passkeyUrl }) }),
46
+ /* @__PURE__ */ jsxs(CpslButton, { size: "small", variant: "ghost", onClick: handleCopy, children: [
47
+ /* @__PURE__ */ jsx(CpslIcon, { slot: "start", icon: isCopied ? "check" : "copy" }),
48
+ isCopied ? "Copied" : "Copy Link"
49
+ ] })
50
+ ] }),
51
+ isBoth && /* @__PURE__ */ jsxs(Fragment, { children: [
52
+ /* @__PURE__ */ jsx(CpslDivider, { children: "or" }),
53
+ /* @__PURE__ */ jsxs(CpslButton, { fullWidth: true, onClick: onClick(AuthMethod.PASSWORD), disabled: !!authStepRoute, children: [
54
+ /* @__PURE__ */ jsx(CpslIcon, { slot: "start", icon: "passcode" }),
55
+ "Choose Password"
56
+ ] })
57
+ ] })
58
+ ] })
59
+ ] });
60
+ };
61
+ export {
62
+ BiometricCreationStep
63
+ };
@@ -0,0 +1,55 @@
1
+ "use client";
2
+ import "../../../chunk-MMUBH76A.js";
3
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
4
+ import { CpslButton, CpslDivider, CpslIcon } from "@getpara/react-components";
5
+ import { useModalStore } from "../../stores/index.js";
6
+ import { Heading, StepContainer, InnerStepContainer } from "../common.js";
7
+ import styled from "styled-components";
8
+ import { AuthMethod } from "@getpara/web-sdk";
9
+ import { KnownDevices, UserIdentifier } from "@getpara/react-common";
10
+ import { useInternalClient } from "../../../provider/hooks/utils/useInternalClient.js";
11
+ import { useAuthActions } from "../../../provider/providers/AuthProvider.js";
12
+ const BiometricLoginStep = () => {
13
+ var _a;
14
+ const loginState = useModalStore((state) => state.getLoginState());
15
+ const para = useInternalClient();
16
+ const { biometricHints, presentLoginUi } = useAuthActions();
17
+ const isPasskeySupported = useModalStore((state) => state.isPasskeySupported);
18
+ const [isPasskey, isPassword, hasHints, isPasskeyOnKnownDevice] = [
19
+ !!(loginState == null ? void 0 : loginState.passkeyUrl),
20
+ !!(loginState == null ? void 0 : loginState.passwordUrl),
21
+ (_a = loginState == null ? void 0 : loginState.biometricHints) == null ? void 0 : _a.length,
22
+ isPasskeySupported && !!(biometricHints == null ? void 0 : biometricHints.isOnKnownDevice)
23
+ ];
24
+ const knownDeviceLink = loginState == null ? void 0 : loginState.passkeyKnownDeviceUrl;
25
+ const isPasskeyUnavailable = hasHints && !(biometricHints == null ? void 0 : biometricHints.isOnKnownDevice) || !isPasskeySupported;
26
+ const displayWelcomeBack = hasHints || isPasskeyOnKnownDevice || isPassword;
27
+ if (!loginState) {
28
+ return null;
29
+ }
30
+ return /* @__PURE__ */ jsxs(StepContainer, { $wide: true, children: [
31
+ /* @__PURE__ */ jsxs(InnerStepContainer, { children: [
32
+ displayWelcomeBack && /* @__PURE__ */ jsx(Heading, { variant: "headingS", weight: "bold", children: "Welcome back," }),
33
+ /* @__PURE__ */ jsx(UserIdentifier, { authInfo: para.authInfo })
34
+ ] }),
35
+ /* @__PURE__ */ jsxs(MainContainer, { children: [
36
+ isPassword && /* @__PURE__ */ jsx(CpslButton, { fullWidth: true, onClick: () => presentLoginUi(AuthMethod.PASSWORD, loginState), children: "Login" }),
37
+ isPasskey && !!knownDeviceLink && /* @__PURE__ */ jsxs(Fragment, { children: [
38
+ isPasskeyUnavailable && !!biometricHints && /* @__PURE__ */ jsx(KnownDevices, { hints: biometricHints, link: knownDeviceLink }),
39
+ isPasskeySupported && /* @__PURE__ */ jsxs(Fragment, { children: [
40
+ isPasskeyUnavailable && /* @__PURE__ */ jsx(CpslDivider, { children: "or" }),
41
+ /* @__PURE__ */ jsx(CpslButton, { fullWidth: true, onClick: () => presentLoginUi(AuthMethod.PASSKEY, loginState), children: isPasskeyUnavailable ? "Continue anyway" : /* @__PURE__ */ jsxs(Fragment, { children: [
42
+ /* @__PURE__ */ jsx(CpslIcon, { slot: "start", icon: "key" }),
43
+ "Login with passkey"
44
+ ] }) })
45
+ ] })
46
+ ] })
47
+ ] })
48
+ ] });
49
+ };
50
+ const MainContainer = styled(InnerStepContainer)`
51
+ gap: 16px;
52
+ `;
53
+ export {
54
+ BiometricLoginStep
55
+ };
@@ -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
+ };
@@ -1,10 +1,11 @@
1
- import { OAuthMethod } from '@getpara/web-sdk';
1
+ import { TOAuthMethod } from '@getpara/web-sdk';
2
2
  interface BodyProps {
3
- oAuthMethods?: OAuthMethod[];
3
+ oAuthMethods?: TOAuthMethod[];
4
4
  twoFactorAuthEnabled?: boolean;
5
5
  disableEmailLogin: boolean;
6
6
  disablePhoneLogin: boolean;
7
+ isGuestModeEnabled?: boolean;
7
8
  onClose: () => void;
8
9
  }
9
- export declare const Body: ({ oAuthMethods, twoFactorAuthEnabled, disableEmailLogin, disablePhoneLogin, onClose }: BodyProps) => import("react/jsx-runtime").JSX.Element;
10
+ export declare const Body: ({ oAuthMethods, twoFactorAuthEnabled, disableEmailLogin, disablePhoneLogin, isGuestModeEnabled, onClose, }: BodyProps) => import("react/jsx-runtime").JSX.Element;
10
11
  export {};