@getpara/react-sdk 1.2.0 → 1.3.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/MoonPayEmbed-GAWXP6V7.js +2 -0
  2. package/dist/MoonPayEmbed-GAWXP6V7.js.br +0 -0
  3. package/dist/MoonPayEmbed-GAWXP6V7.js.gz +0 -0
  4. package/dist/index.js +675 -5
  5. package/dist/index.js.br +0 -0
  6. package/dist/index.js.gz +0 -0
  7. package/package.json +8 -7
  8. package/dist/modal/ParaModal.js +0 -281
  9. package/dist/modal/components/Account/Account.js +0 -60
  10. package/dist/modal/components/AddFunds/AddFunds.js +0 -147
  11. package/dist/modal/components/AddFunds/AddFundsAwaiting.js +0 -65
  12. package/dist/modal/components/AddFunds/AddFundsDone.js +0 -26
  13. package/dist/modal/components/AddFunds/MoonPayEmbed.js +0 -2
  14. package/dist/modal/components/AddFunds/index.js +0 -3
  15. package/dist/modal/components/AuthInput/AuthInput.js +0 -221
  16. package/dist/modal/components/AuthInput/countryCodes.js +0 -40
  17. package/dist/modal/components/AuthInput/hooks/useDropdownPosition.js +0 -23
  18. package/dist/modal/components/AuthInput/phoneMasks.js +0 -247
  19. package/dist/modal/components/AuthMainStep/AuthMainStep.js +0 -21
  20. package/dist/modal/components/AuthMainStep/AuthMainStepContent.js +0 -89
  21. package/dist/modal/components/AuthOptions/AuthOptions.js +0 -28
  22. package/dist/modal/components/AwaitingBiometricsStep/AwaitingBiometricsStep.js +0 -7
  23. package/dist/modal/components/AwaitingOAuthStep/AwaitingOAuthStep.js +0 -5
  24. package/dist/modal/components/AwaitingPasswordStep/AwaitingPasswordStep.js +0 -7
  25. package/dist/modal/components/AwaitingWalletCreationStep/AwaitingWalletCreationStep.js +0 -18
  26. package/dist/modal/components/BiometricCreationStep/BiometricCreationStep.js +0 -17
  27. package/dist/modal/components/BiometricLoginStep/BiometricLoginStep.js +0 -131
  28. package/dist/modal/components/Body/AnimatedHeightWrapper.js +0 -26
  29. package/dist/modal/components/Body/Body.js +0 -232
  30. package/dist/modal/components/ChainSwitch/ChainSwitch.js +0 -77
  31. package/dist/modal/components/ChainSwitch/config.js +0 -11
  32. package/dist/modal/components/Controls/Controls.js +0 -54
  33. package/dist/modal/components/Controls/Selects.js +0 -159
  34. package/dist/modal/components/ExternalWalletStep/ExternalWalletStep.js +0 -116
  35. package/dist/modal/components/ExternalWalletStep/config.js +0 -11
  36. package/dist/modal/components/ExternalWallets/ExternalWallets.js +0 -142
  37. package/dist/modal/components/ExternalWalletsWrapper/ExternalWalletsWrapper.js +0 -119
  38. package/dist/modal/components/Footer/Footer.js +0 -71
  39. package/dist/modal/components/Header/Header.js +0 -24
  40. package/dist/modal/components/Header/hooks/useStepTitle.js +0 -42
  41. package/dist/modal/components/Hero/Hero.js +0 -119
  42. package/dist/modal/components/IFrameStep/IFrameStep.js +0 -41
  43. package/dist/modal/components/LoginDoneStep/LoginDoneStep.js +0 -19
  44. package/dist/modal/components/ModalContent/ModalContent.js +0 -282
  45. package/dist/modal/components/OAuth/FarcasterOAuthStep.js +0 -81
  46. package/dist/modal/components/OAuth/OAuth.js +0 -125
  47. package/dist/modal/components/OAuth/TelegramOAuthStep.js +0 -133
  48. package/dist/modal/components/OnRampComponents/AddingFunds.js +0 -10
  49. package/dist/modal/components/OnRampComponents/OnRampProviderButton.js +0 -72
  50. package/dist/modal/components/RecoverySecretStep/RecoverySecretStep.js +0 -67
  51. package/dist/modal/components/Setup2FAStep/Setup2FAStep.js +0 -105
  52. package/dist/modal/components/StripeComponents/StripeComponents.js +0 -78
  53. package/dist/modal/components/TwoFactorDoneStep/TwoFactorDoneStep.js +0 -8
  54. package/dist/modal/components/VerificationCodeStep/VerificationCodeStep.js +0 -135
  55. package/dist/modal/components/Waiting/Waiting.js +0 -6
  56. package/dist/modal/components/WalletCard/PartnerIcon.js +0 -29
  57. package/dist/modal/components/WalletCard/WalletCard.js +0 -93
  58. package/dist/modal/components/WalletCreationDoneStep/WalletCreationDoneStep.js +0 -50
  59. package/dist/modal/components/common.js +0 -67
  60. package/dist/modal/components/index.js +0 -1
  61. package/dist/modal/constants/constants.js +0 -93
  62. package/dist/modal/constants/defaults.js +0 -5
  63. package/dist/modal/constants/oAuthLogos.js +0 -18
  64. package/dist/modal/hooks/useActiveWallet.js +0 -11
  65. package/dist/modal/hooks/useEmbeddedExternalConnection.js +0 -46
  66. package/dist/modal/hooks/useGoBack.js +0 -34
  67. package/dist/modal/index.js +0 -9
  68. package/dist/modal/providers/CosmosExternalWalletContextStub.js +0 -18
  69. package/dist/modal/providers/EvmExternalWalletContextStub.js +0 -22
  70. package/dist/modal/providers/ExternalWalletContext.js +0 -253
  71. package/dist/modal/providers/SolanaExternalWalletContextStub.js +0 -12
  72. package/dist/modal/stores/externalWalletProvider/actions.js +0 -5
  73. package/dist/modal/stores/externalWalletProvider/useExternalWalletProviderStore.js +0 -13
  74. package/dist/modal/stores/index.js +0 -3
  75. package/dist/modal/stores/modal/actions.js +0 -64
  76. package/dist/modal/stores/modal/useModalStore.js +0 -41
  77. package/dist/modal/stores/para/actions.js +0 -5
  78. package/dist/modal/stores/para/useParaStore.js +0 -3
  79. package/dist/modal/stores/theme/actions.js +0 -24
  80. package/dist/modal/stores/theme/useThemeStore.js +0 -14
  81. package/dist/modal/stores/userInfo/actions.js +0 -34
  82. package/dist/modal/stores/userInfo/useUserInfoStore.js +0 -9
  83. package/dist/modal/types/commonTypes.js +0 -1
  84. package/dist/modal/types/externalWallets.js +0 -21
  85. package/dist/modal/types/modalProps.js +0 -7
  86. package/dist/modal/utils/authLayoutHelpers.js +0 -2
  87. package/dist/modal/utils/getMailtoLink.js +0 -5
  88. package/dist/modal/utils/getTileButtonFlex.js +0 -15
  89. package/dist/modal/utils/isPasskeySupported.js +0 -10
  90. package/dist/modal/utils/openPopup.js +0 -55
  91. package/dist/modal/utils/routeMobileExternalWallet.js +0 -35
  92. package/dist/modal/utils/steps.js +0 -215
  93. package/dist/modal/utils/stringFormatters.js +0 -12
  94. package/dist/modal/utils/validateOnRampConfig.js +0 -26
  95. package/dist/provider/ParaProvider.js +0 -17
  96. package/dist/provider/actions/checkIfUserExists.js +0 -26
  97. package/dist/provider/actions/createUser.js +0 -30
  98. package/dist/provider/actions/getAccount.js +0 -24
  99. package/dist/provider/actions/getWallet.js +0 -16
  100. package/dist/provider/actions/initiateLogin.js +0 -23
  101. package/dist/provider/actions/keepSessionAlive.js +0 -23
  102. package/dist/provider/actions/logout.js +0 -20
  103. package/dist/provider/actions/signMessage.js +0 -23
  104. package/dist/provider/actions/signTransaction.js +0 -23
  105. package/dist/provider/actions/waitForAccountCreation.js +0 -24
  106. package/dist/provider/actions/waitForLoginAndSetup.js +0 -27
  107. package/dist/provider/actions/waitForPasskeyAndCreateWallet.js +0 -24
  108. package/dist/provider/hooks/index.js +0 -3
  109. package/dist/provider/hooks/mutations/index.js +0 -10
  110. package/dist/provider/hooks/mutations/useCheckIfUserExists.js +0 -23
  111. package/dist/provider/hooks/mutations/useCreateUser.js +0 -23
  112. package/dist/provider/hooks/mutations/useInitiateLogin.js +0 -23
  113. package/dist/provider/hooks/mutations/useKeepSessionAlive.js +0 -23
  114. package/dist/provider/hooks/mutations/useLogout.js +0 -33
  115. package/dist/provider/hooks/mutations/useSignMessage.js +0 -33
  116. package/dist/provider/hooks/mutations/useSignTransaction.js +0 -33
  117. package/dist/provider/hooks/mutations/useWaitForAccountCreation.js +0 -30
  118. package/dist/provider/hooks/mutations/useWaitForLoginAndSetup.js +0 -30
  119. package/dist/provider/hooks/mutations/useWaitForPasskeyAndCreateWallet.js +0 -30
  120. package/dist/provider/hooks/queries/index.js +0 -2
  121. package/dist/provider/hooks/queries/useAccount.js +0 -23
  122. package/dist/provider/hooks/queries/useWallet.js +0 -24
  123. package/dist/provider/hooks/utils/index.js +0 -3
  124. package/dist/provider/hooks/utils/useAutoSessionKeepAlive.js +0 -79
  125. package/dist/provider/hooks/utils/useClient.js +0 -8
  126. package/dist/provider/hooks/utils/useEventListeners.js +0 -87
  127. package/dist/provider/hooks/utils/useInternalClient.js +0 -9
  128. package/dist/provider/hooks/utils/useModal.js +0 -15
  129. package/dist/provider/hooks/utils/useWalletState.js +0 -33
  130. package/dist/provider/index.js +0 -3
  131. package/dist/provider/stores/getters.js +0 -5
  132. package/dist/provider/stores/slices/client.js +0 -4
  133. package/dist/provider/stores/slices/index.js +0 -3
  134. package/dist/provider/stores/slices/modal.js +0 -4
  135. package/dist/provider/stores/slices/wallet.js +0 -6
  136. package/dist/provider/stores/types.js +0 -1
  137. package/dist/provider/stores/useStore.js +0 -14
  138. package/dist/provider/types/provider.js +0 -1
  139. package/dist/provider/types/query.js +0 -1
  140. package/dist/provider/types/utils.js +0 -1
  141. package/dist/provider/utils/renameMutations.js +0 -19
  142. /package/dist/{modal/css → css}/modal.css +0 -0
  143. /package/dist/{modal/public → public}/Inter-VariableFont_slnt,wght.ttf +0 -0
@@ -1,135 +0,0 @@
1
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
- return new (P || (P = Promise))(function (resolve, reject) {
4
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
- step((generator = generator.apply(thisArg, _arguments || [])).next());
8
- });
9
- };
10
- import { jsxs as _jsxs, jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
11
- import { CpslCodeInput, CpslSpinner, CpslText } from '@getpara/react-components';
12
- import { useEffect, useRef, useState } from 'react';
13
- import { styled } from 'styled-components';
14
- import { ModalStep } from '../../utils/steps.js';
15
- import { useModalStore, useThemeStore, useUserInfoStore } from '../../stores/index.js';
16
- import { Heading, InnerStepContainer, StepContainer } from '../common.js';
17
- import { AuthMethod } from '@getpara/core-sdk';
18
- import { useInternalClient } from '../../../provider/hooks/utils/useInternalClient.js';
19
- export const VerificationCodeStep = () => {
20
- const theme = useThemeStore(state => state.theme);
21
- const authInfo = useUserInfoStore(state => state.getAuthInfo());
22
- const setStep = useModalStore(state => state.setStep);
23
- const setWebAuthURLForCreate = useModalStore(state => state.setWebAuthURLForCreate);
24
- const setIFrameUrl = useModalStore(state => state.setIFrameUrl);
25
- const setIsIFrameReady = useModalStore(state => state.setIsIFrameReady);
26
- const isIFrameReady = useModalStore(state => state.isIFrameReady);
27
- const para = useInternalClient();
28
- const inputRef = useRef(null);
29
- const [code, setCode] = useState('');
30
- const [codeError, setCodeError] = useState('');
31
- const [resendStatus, setResendStatus] = useState('Resend.');
32
- const [resendDisabled, setResendDisabled] = useState(false);
33
- const [isVerifying, setIsVerifying] = useState(false);
34
- const [shouldRouteToStep, setShouldRouteToStep] = useState();
35
- const isEmail = (authInfo === null || authInfo === void 0 ? void 0 : authInfo.authType) === 'email';
36
- useEffect(() => {
37
- // Using a small timeout here to ensure the input is mounted before attempting focus
38
- setTimeout(() => {
39
- var _a, _b;
40
- (_b = (_a = inputRef.current.shadowRoot.querySelectorAll('input')) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.focus();
41
- }, 10);
42
- }, []);
43
- useEffect(() => {
44
- if (!!shouldRouteToStep && isIFrameReady) {
45
- // Using a small timeout here to fully ensure the iframe is loaded before triggering any animation
46
- setTimeout(() => {
47
- setStep(shouldRouteToStep);
48
- setIsVerifying(false);
49
- }, 200);
50
- }
51
- }, [shouldRouteToStep, isIFrameReady]);
52
- useEffect(() => {
53
- if (code.length === 6) {
54
- handleSubmitCode();
55
- }
56
- }, [code]);
57
- const handleResendClick = () => __awaiter(void 0, void 0, void 0, function* () {
58
- if (!resendDisabled) {
59
- setResendStatus('Resent!');
60
- setResendDisabled(true);
61
- isEmail ? yield para.resendVerificationCode() : yield para.resendVerificationCodeByPhone();
62
- setTimeout(() => {
63
- setResendStatus('Resend.');
64
- setResendDisabled(false);
65
- }, 3000);
66
- }
67
- });
68
- const handleCodeInput = (e) => {
69
- if (codeError) {
70
- setCodeError('');
71
- }
72
- setCode(e.detail.value.trim());
73
- };
74
- const handleSubmitCode = () => __awaiter(void 0, void 0, void 0, function* () {
75
- setIsVerifying(true);
76
- if (code.length === 6 && /^\d+$/.test(code)) {
77
- try {
78
- const supportedCreateAuthMethods = yield para.getSupportedCreateAuthMethods();
79
- if (supportedCreateAuthMethods.has(AuthMethod.PASSWORD) && supportedCreateAuthMethods.has(AuthMethod.PASSKEY)) {
80
- setIsIFrameReady(false);
81
- const webAuthUrl = isEmail
82
- ? yield para.verifyEmail({ verificationCode: code })
83
- : yield para.verifyPhone({ verificationCode: code });
84
- const passwordAuthUrl = yield para.getSetupPasswordURL({ authType: authInfo === null || authInfo === void 0 ? void 0 : authInfo.authType, theme });
85
- setWebAuthURLForCreate(yield para.shortenLoginLink(webAuthUrl));
86
- setIFrameUrl(yield para.shortenLoginLink(passwordAuthUrl));
87
- setShouldRouteToStep(ModalStep.BIOMETRIC_CREATION);
88
- return;
89
- }
90
- else if (supportedCreateAuthMethods.has(AuthMethod.PASSWORD)) {
91
- setIsIFrameReady(false);
92
- isEmail ? yield para.verifyEmail({ verificationCode: code }) : yield para.verifyPhone({ verificationCode: code });
93
- const url = yield para.getSetupPasswordURL({ authType: authInfo === null || authInfo === void 0 ? void 0 : authInfo.authType, theme });
94
- setIFrameUrl(yield para.shortenLoginLink(url));
95
- setShouldRouteToStep(ModalStep.PASSWORD_CREATION);
96
- return;
97
- }
98
- else {
99
- const url = isEmail
100
- ? yield para.verifyEmail({ verificationCode: code })
101
- : yield para.verifyPhone({ verificationCode: code });
102
- setWebAuthURLForCreate(yield para.shortenLoginLink(url));
103
- setStep(ModalStep.BIOMETRIC_CREATION);
104
- }
105
- }
106
- catch (e) {
107
- if (e.message.includes('429')) {
108
- setCodeError('Too many incorrect attempts. Please try again in 10 minutes.');
109
- }
110
- else {
111
- setCodeError('Incorrect code.');
112
- }
113
- }
114
- }
115
- else {
116
- setCodeError('Incorrect code.');
117
- }
118
- setIsVerifying(false);
119
- });
120
- return (_jsxs(StepContainer, { "$wide": true, children: [_jsxs(InnerStepContainer, { children: [_jsxs(Heading, { variant: "headingS", weight: "bold", children: ["Verify ", isEmail ? 'Email' : 'Phone Number'] }), _jsxs(InlineText, { variant: "bodyS", color: "secondary", children: ["Please enter the code we sent to ", _jsx(InlineText, { variant: "bodyS", children: authInfo.identifier })] })] }), _jsx(InnerStepContainer, { children: isVerifying ? (_jsx(CpslSpinner, {})) : (_jsxs(_Fragment, { children: [_jsx("form", { onSubmit: (e) => __awaiter(void 0, void 0, void 0, function* () {
121
- e.preventDefault();
122
- yield handleSubmitCode();
123
- }), children: _jsx(StyledCodeInput, { ref: inputRef, length: 6, type: "number", code: code, onCpslInput: handleCodeInput, errorText: codeError, onKeyDown: (e) => __awaiter(void 0, void 0, void 0, function* () { return e.key === 'Enter' && (yield handleSubmitCode()); }) }) }), _jsxs(InlineText, { variant: "bodyS", color: "secondary", children: ["Didn\u2019t receive a code?", ' ', _jsx(ClickableText, { variant: "bodyS", style: { cursor: resendDisabled ? 'default' : 'pointer' }, onClick: handleResendClick, children: resendStatus })] })] })) })] }));
124
- };
125
- const StyledCodeInput = styled(CpslCodeInput) `
126
- align-self: center;
127
- `;
128
- const InlineText = styled(CpslText) `
129
- text-align: center;
130
- display: inline-block;
131
- `;
132
- const ClickableText = styled(InlineText) `
133
- cursor: pointer;
134
- display: inline-block;
135
- `;
@@ -1,6 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { CpslSpinner, CpslText } from '@getpara/react-components';
3
- import { Heading, SpinnerContainer, StepContainer, InnerStepContainer } from '../common.js';
4
- export const Waiting = ({ heading, subheading }) => {
5
- return (_jsxs(StepContainer, { "$wide": true, children: [_jsx(SpinnerContainer, { children: _jsx(CpslSpinner, { size: 100 }) }), _jsxs(InnerStepContainer, { children: [_jsx(Heading, { variant: "headingS", weight: "bold", children: heading }), _jsx(CpslText, { variant: "bodyS", color: "secondary", weight: "medium", children: subheading })] })] }));
6
- };
@@ -1,29 +0,0 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import styled from 'styled-components';
3
- import { CpslIcon, CpslText } from '@getpara/react-components';
4
- export const PartnerIcon = ({ partner }) => {
5
- const { logoUrl, displayName, backgroundColor, foregroundColor } = partner;
6
- if (logoUrl) {
7
- return _jsx(Icon, { src: logoUrl });
8
- }
9
- return (_jsx(Container, { "$backgroundColor": backgroundColor, children: _jsx(Text, { variant: "bodyXS", "$color": foregroundColor, children: displayName[0] }) }));
10
- };
11
- const Container = styled.div `
12
- width: 14px;
13
- height: 14px;
14
- display: flex;
15
- align-items: center;
16
- justify-content: center;
17
- background-color: ${({ $backgroundColor }) => `${$backgroundColor !== null && $backgroundColor !== void 0 ? $backgroundColor : 'var(--cpsl-color-contrast)'}`};
18
- border-radius: 100%;
19
- `;
20
- const Text = styled(CpslText) `
21
- &::part(text-element) {
22
- line-height: 100%;
23
- color: ${({ $color }) => `${$color !== null && $color !== void 0 ? $color : 'var(--cpsl-color-foreground-0)'}`};
24
- }
25
- `;
26
- const Icon = styled(CpslIcon) `
27
- --height: 14px;
28
- --width: 14px;
29
- `;
@@ -1,93 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import styled from 'styled-components';
3
- import { useModalStore, useThemeStore } from '../../stores/index.js';
4
- import { CpslButton, CpslIdenticon, CpslText } from '@getpara/react-components';
5
- import { truncateAddress } from '@getpara/web-sdk';
6
- import { ModalStep } from '../../utils/steps.js';
7
- import { useWalletState } from '../../../provider/index.js';
8
- import { useInternalClient } from '../../../provider/hooks/utils/useInternalClient.js';
9
- export const ExternalWalletCard = ({ address, showAddFunds }) => {
10
- const para = useInternalClient();
11
- const wallet = para.externalWallets[address];
12
- if (!wallet) {
13
- return null;
14
- }
15
- return (_jsx(SharedWalletCard, { address: truncateAddress(wallet.address, wallet.type), identiconHash: para.getIdenticonHash(wallet.id, wallet.type), showAddFunds: showAddFunds }));
16
- };
17
- export const WalletCard = ({ id, type, showAddFunds }) => {
18
- var _a;
19
- const para = useInternalClient();
20
- const appName = useThemeStore(state => state.appName);
21
- const wallet = para.findWallet(id, type);
22
- if (!wallet) {
23
- return null;
24
- }
25
- const address = para.getDisplayAddress(wallet.id, { addressType: type });
26
- return (_jsx(SharedWalletCard, { id: wallet.id, type: wallet.type, address: truncateAddress(address, type, { prefix: para.cosmosPrefix }), name: (_a = wallet.name) !== null && _a !== void 0 ? _a : `${appName ? `${appName} ` : ''}Wallet`, identiconHash: para.getIdenticonHash(wallet.id, type), showAddFunds: showAddFunds }));
27
- };
28
- const SharedWalletCard = ({ address, name, identiconHash, showAddFunds, id, type }) => {
29
- const onRampConfig = useModalStore(state => state.onRampConfig);
30
- const { setSelectedWallet } = useWalletState();
31
- const setStep = useModalStore(state => state.setStep);
32
- const isAddFundsEnabled = onRampConfig.isBuyEnabled || onRampConfig.isReceiveEnabled;
33
- const handleAddFundsClick = () => {
34
- if (id && type) {
35
- setSelectedWallet({ id, type });
36
- isAddFundsEnabled && setStep(onRampConfig.isBuyEnabled ? ModalStep.ADD_FUNDS_BUY : ModalStep.ADD_FUNDS_RECEIVE);
37
- }
38
- };
39
- return (_jsxs(Container, { children: [_jsxs(InnerContainer, { children: [_jsx(CpslIdenticon, { size: "48px", hash: identiconHash }), _jsxs(WalletNameContainer, { children: [!!name && (_jsx(Name, { color: "contrast", variant: "bodyL", weight: "semiBold", children: name })), _jsx(Name, { color: "secondary", variant: "bodyS", weight: "medium", children: address })] })] }), showAddFunds && isAddFundsEnabled && (_jsx(AddFundsButton, { onClick: handleAddFundsClick, children: _jsx(CpslText, { variant: "bodyXS", color: "contrast", weight: "medium", children: "Add Funds" }) }))] }));
40
- };
41
- export const WalletCards = styled.div `
42
- display: flex;
43
- flex-direction: column;
44
- gap: 8px;
45
- width: 100%;
46
- `;
47
- const Container = styled.div `
48
- width: 100%;
49
- padding: 24px;
50
- display: flex;
51
- justify-content: space-between;
52
- align-items: center;
53
- gap: 16px;
54
- background-color: var(--cpsl-color-background-8);
55
- border-radius: 16px;
56
- `;
57
- const InnerContainer = styled.div `
58
- display: flex;
59
- justify-content: flex-start;
60
- gap: 4px;
61
- align-items: center;
62
- overflow: hidden;
63
- `;
64
- const WalletNameContainer = styled.div `
65
- flex: 1;
66
- display: flex;
67
- flex-direction: column;
68
- gap: 4px;
69
- align-items: flex-start;
70
- justify-content: center;
71
- overflow: hidden;
72
- `;
73
- const Name = styled(CpslText) `
74
- width: 100%;
75
- &::part(text-element) {
76
- line-height: 100%;
77
- text-overflow: ellipsis;
78
- overflow: hidden;
79
- white-space: nowrap;
80
- }
81
- `;
82
- const AddFundsButton = styled(CpslButton) `
83
- --button-primary-background-color: var(--cpsl-color-card-surface);
84
- --button-primary-hover-background-color: var(--cpsl-color-background-4);
85
- --button-primary-color: var(--cpsl-color-text-contrast);
86
- --button-primary-hover-color: var(--cpsl-color-text-contrast);
87
- --button-primary-active-color: var(--cpsl-color-text-contrast);
88
- --button-padding-start: 8px;
89
- --button-padding-end: 8px;
90
- --button-padding-top: 8px;
91
- --button-padding-bottom: 8px;
92
- --button-border-radius: 8px;
93
- `;
@@ -1,50 +0,0 @@
1
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
- return new (P || (P = Promise))(function (resolve, reject) {
4
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
- step((generator = generator.apply(thisArg, _arguments || [])).next());
8
- });
9
- };
10
- import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
11
- import { CpslButton, CpslText } from '@getpara/react-components';
12
- import { StepContainer, InnerStepContainer, HeroIcon } from '../common.js';
13
- import { useModalStore, useThemeStore } from '../../stores/index.js';
14
- import { ModalStep } from '../../utils/steps.js';
15
- import { WalletCard, WalletCards } from '../WalletCard/WalletCard.js';
16
- import styled from 'styled-components';
17
- import { useInternalClient } from '../../../provider/hooks/utils/useInternalClient.js';
18
- export const WalletCreationDoneStep = ({ twoFactorAuthEnabled, onClose }) => {
19
- const hideWallets = useThemeStore(state => state.hideWallets);
20
- const setStep = useModalStore(state => state.setStep);
21
- const isLogin = useModalStore(state => state.isLogin());
22
- const onRampConfig = useModalStore(state => state.onRampConfig);
23
- const para = useInternalClient();
24
- const isOnRampConfigured = (onRampConfig === null || onRampConfig === void 0 ? void 0 : onRampConfig.isBuyEnabled) || (onRampConfig === null || onRampConfig === void 0 ? void 0 : onRampConfig.isReceiveEnabled) || (onRampConfig === null || onRampConfig === void 0 ? void 0 : onRampConfig.isWithdrawEnabled);
25
- const handleNext = () => __awaiter(void 0, void 0, void 0, function* () {
26
- if (isLogin) {
27
- if (!twoFactorAuthEnabled) {
28
- setStep(ModalStep.LOGIN_DONE);
29
- return;
30
- }
31
- const is2FAComplete = yield para.check2FAStatus();
32
- setStep(is2FAComplete ? ModalStep.LOGIN_DONE : ModalStep.SETUP_2FA);
33
- }
34
- else {
35
- if (twoFactorAuthEnabled) {
36
- setStep(ModalStep.SETUP_2FA);
37
- }
38
- else {
39
- onClose();
40
- }
41
- }
42
- });
43
- return (_jsxs(StepContainer, { "$wide": true, children: [_jsx(CardContainer, { children: hideWallets ? (_jsxs(_Fragment, { children: [_jsx(HeroIcon, { icon: "checkCircleFilled" }), _jsx(CpslText, { variant: "bodyM", color: "secondary", weight: "medium", style: { marginTop: '16px' }, children: "Your account has been created." })] })) : (_jsx(WalletCards, { children: para.currentWalletIdsArray.map(([id, type]) => {
44
- return _jsx(WalletCard, { id: id, type: type, showAddFunds: isOnRampConfigured }, id);
45
- }) })) }), _jsx(InnerStepContainer, { children: _jsx(CpslButton, { fullWidth: true, onClick: handleNext, children: twoFactorAuthEnabled ? 'Continue' : 'Done' }) })] }));
46
- };
47
- const CardContainer = styled(InnerStepContainer) `
48
- min-height: 196px;
49
- justify-content: center;
50
- `;
@@ -1,67 +0,0 @@
1
- import { CpslIcon, CpslInput, CpslText, CpslTileButton } from '@getpara/react-components';
2
- import { styled } from 'styled-components';
3
- export const SpinnerContainer = styled.div `
4
- display: flex;
5
- align-items: center;
6
- justify-content: center;
7
- `;
8
- export const QRContainer = styled.div `
9
- display: flex;
10
- justify-content: center;
11
- align-items: center;
12
- width: 286px;
13
- height: 286px;
14
- `;
15
- export const InfoBoxContent = styled.div `
16
- display: flex;
17
- flex-direction: column;
18
- gap: 8px;
19
- `;
20
- export const InfoBoxHeader = styled.div `
21
- display: flex;
22
- align-items: center;
23
- gap: 4px;
24
-
25
- cpsl-icon {
26
- --height: 20px;
27
- --width: 20px;
28
- }
29
- `;
30
- export const FilledDisabledInput = styled(CpslInput) `
31
- --container-border-color: var(--cpsl-color-input-border-placeholder);
32
- --container-background-color: var(--cpsl-color-background-0);
33
- --input-background-color: transparent;
34
- --input-font-weight: 500;
35
- --input-color: var(--cpsl-color-text-secondary);
36
- `;
37
- export const FullWidthFilledDisabledInput = styled(FilledDisabledInput) `
38
- width: 100%;
39
- `;
40
- export const CenteredText = styled(CpslText) `
41
- width: 100%;
42
- text-align: center;
43
- `;
44
- export const InnerStepContainer = styled.div `
45
- width: 100%;
46
- height: 100%;
47
- align-self: center;
48
- display: flex;
49
- flex-direction: column;
50
- align-items: center;
51
- gap: 8px;
52
- `;
53
- export const StepContainer = styled(InnerStepContainer) `
54
- gap: ${({ $wide }) => ($wide ? '32px' : '24px')};
55
- `;
56
- export const Heading = styled(CenteredText) ``;
57
- export const StyledCpslTileButton = styled(CpslTileButton) `
58
- --button-width: 100%;
59
- --button-height: 87px;
60
- --button-icon-height: 32px;
61
- --button-icon-width: 32px;
62
- `;
63
- export const HeroIcon = styled(CpslIcon) `
64
- --height: 80px;
65
- --width: 80px;
66
- --icon-color: var(--cpsl-color-text-primary);
67
- `;
@@ -1 +0,0 @@
1
- export * from './ModalContent/ModalContent.js';
@@ -1,93 +0,0 @@
1
- import { Network, OnRampAsset, OnRampMethod, OnRampProvider } from '@getpara/core-sdk';
2
- export const PARA_CONNECT = 'https://connect.getpara.com/';
3
- export const PARA_TERMS_AND_CONDITIONS = 'https://getpara.com/terms';
4
- export const ON_RAMP_PROVIDERS = {
5
- [OnRampProvider.STRIPE]: {
6
- name: 'Stripe',
7
- feeLower: 0.99,
8
- feeUpper: 4.49,
9
- methods: [OnRampMethod.ACH, OnRampMethod.DEBIT, OnRampMethod.CREDIT],
10
- icon: 'stripeBrand',
11
- backgroundColors: ['#6772E5', '#808AF4'],
12
- },
13
- [OnRampProvider.RAMP]: {
14
- name: 'Ramp',
15
- feeLower: 0.99,
16
- feeUpper: 4.49,
17
- methods: [OnRampMethod.ACH, OnRampMethod.DEBIT, OnRampMethod.CREDIT],
18
- icon: 'rampNetworkBrand',
19
- backgroundColors: ['#21BF73', '#3AE492'],
20
- },
21
- [OnRampProvider.MOONPAY]: {
22
- name: 'MoonPay',
23
- feeLower: 1.0,
24
- feeUpper: 4.5,
25
- methods: [OnRampMethod.ACH, OnRampMethod.DEBIT, OnRampMethod.CREDIT],
26
- icon: 'moonpayBrand',
27
- backgroundColors: ['#7715F5', '#9647fd'],
28
- },
29
- };
30
- export const NETWORKS = {
31
- [Network.ETHEREUM]: { name: 'Ethereum', icon: 'ethereum' },
32
- [Network.SEPOLIA]: { name: 'Sepolia', icon: 'ethereum' },
33
- [Network.ARBITRUM]: { name: 'Arbitrum', icon: 'arbitrumBrand' },
34
- [Network.BASE]: { name: 'Base', icon: 'baseBrand' },
35
- [Network.OPTIMISM]: { name: 'Optimism', icon: 'optimismBrand' },
36
- [Network.POLYGON]: { name: 'Polygon', icon: 'polygonBrand' },
37
- [Network.SOLANA]: { name: 'Solana', icon: 'solana' },
38
- [Network.COSMOS]: { name: 'Cosmos', icon: 'cosmos' },
39
- [Network.CELO]: { name: 'Celo', icon: 'celoBrand' },
40
- [Network.NOBLE]: { name: 'Noble', icon: 'nobleBrand' },
41
- };
42
- export const ON_RAMP_ASSETS = {
43
- [OnRampAsset.ETHEREUM]: { name: 'Ethereum', code: 'ETH', icon: 'ethereum' },
44
- [OnRampAsset.USDC]: { name: 'USDC', code: 'USDC', icon: 'usdcBrand' },
45
- [OnRampAsset.POLYGON]: { name: 'Polygon', code: 'MATIC', icon: 'polygonBrand' },
46
- [OnRampAsset.SOLANA]: { name: 'Solana', code: 'SOL', icon: 'solana' },
47
- [OnRampAsset.ATOM]: { name: 'Atom', code: 'ATOM', icon: 'cosmos' },
48
- [OnRampAsset.CELO]: { name: 'Celo', code: 'CELO', icon: 'celoBrand' },
49
- [OnRampAsset.TETHER]: { name: 'Tether', code: 'USDT', icon: 'tetherBrand' },
50
- [OnRampAsset.CUSD]: { name: 'Celo Dollar', code: 'CUSD', icon: 'celoBrand' },
51
- [OnRampAsset.CEUR]: { name: 'Celo Euro', code: 'CEUR', icon: 'celoBrand' },
52
- [OnRampAsset.CREAL]: { name: 'Celo Real', code: 'CREAL', icon: 'celoBrand' },
53
- };
54
- export function getNetworkName(str) {
55
- var _a, _b;
56
- return (_b = (_a = NETWORKS[str]) === null || _a === void 0 ? void 0 : _a.name) !== null && _b !== void 0 ? _b : `${str[0]}${str.slice(1).toLowerCase()}`;
57
- }
58
- export function getNetworkIcon(str) {
59
- var _a, _b;
60
- return (_b = (_a = NETWORKS[str]) === null || _a === void 0 ? void 0 : _a.icon) !== null && _b !== void 0 ? _b : 'globe';
61
- }
62
- export function getAssetName(str) {
63
- var _a, _b;
64
- return (_b = (_a = ON_RAMP_ASSETS[str]) === null || _a === void 0 ? void 0 : _a.code) !== null && _b !== void 0 ? _b : str;
65
- }
66
- export function getAssetIcon(str) {
67
- var _a, _b;
68
- return (_b = (_a = ON_RAMP_ASSETS[str]) === null || _a === void 0 ? void 0 : _a.icon) !== null && _b !== void 0 ? _b : 'emptyCircle';
69
- }
70
- export const MOBILE_SIZE = 480;
71
- export const NETWORK_NOT_SUPPORTED_ERROR = 'network not supported';
72
- export const EMAIL_REGEX = /^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|.(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
73
- export const BODY_MOTION_VARIANTS = {
74
- enter: (direction) => {
75
- return {
76
- scale: direction > 0 ? 0.9 : 1.1,
77
- opacity: 0,
78
- };
79
- },
80
- center: {
81
- scale: 1,
82
- opacity: 1,
83
- },
84
- exit: (direction) => {
85
- return {
86
- scale: direction < 0 ? 0.9 : 1.1,
87
- opacity: 0,
88
- };
89
- },
90
- };
91
- export const BODY_TRANSITION = {
92
- duration: 0.2,
93
- };
@@ -1,5 +0,0 @@
1
- export const DEFAULTS = {
2
- LOGGIN_POLLING_DELAY_MS: 5000,
3
- POLLING_INTERVAL_MS: 2000,
4
- ANIMATION_DURATION: 0.15,
5
- };
@@ -1,18 +0,0 @@
1
- export const brandedOAuthLogos = {
2
- GOOGLE: 'googleBrand',
3
- TWITTER: 'twitter',
4
- APPLE: 'apple',
5
- DISCORD: 'discordBrand',
6
- FACEBOOK: 'facebookBrand',
7
- FARCASTER: 'farcasterBrand',
8
- TELEGRAM: 'telegramBrand',
9
- };
10
- export const oAuthLogos = {
11
- GOOGLE: 'google',
12
- TWITTER: 'twitter',
13
- APPLE: 'apple',
14
- DISCORD: 'discord',
15
- FACEBOOK: 'facebook',
16
- FARCASTER: 'farcaster',
17
- TELEGRAM: 'telegram',
18
- };
@@ -1,11 +0,0 @@
1
- import { useMemo } from 'react';
2
- import { useWalletState } from '../../provider/index.js';
3
- import { useInternalClient } from '../../provider/hooks/utils/useInternalClient.js';
4
- // TODO: remove this hook in favor of the useAccount hook once we force the use of the ParaProvider
5
- export function useActiveWallet() {
6
- const client = useInternalClient();
7
- const { selectedWallet } = useWalletState();
8
- return useMemo(() => {
9
- return client.findWallet(selectedWallet.id, selectedWallet.type, { forbidPregen: true });
10
- }, [client, selectedWallet]);
11
- }
@@ -1,46 +0,0 @@
1
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
- return new (P || (P = Promise))(function (resolve, reject) {
4
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
- step((generator = generator.apply(thisArg, _arguments || [])).next());
8
- });
9
- };
10
- import { useExternalWalletProviderStore } from '../stores/externalWalletProvider/useExternalWalletProviderStore.js';
11
- export const useEmbeddedExternalConnection = () => {
12
- // Get the connectParaEvmWallet action if available. This is used to trigger Para as an active connection when the user logs in using a non external wallet method.
13
- const connectParaEvmWallet = useExternalWalletProviderStore(state => state.connectParaEvmWallet);
14
- const EvmProvider = useExternalWalletProviderStore(state => state.EvmProvider);
15
- const evmContext = useExternalWalletProviderStore(state => state.evmContext);
16
- const connectParaCosmosWallet = useExternalWalletProviderStore(state => state.connectParaCosmosWallet);
17
- const CosmosProvider = useExternalWalletProviderStore(state => state.CosmosProvider);
18
- const cosmosContext = useExternalWalletProviderStore(state => state.cosmosContext);
19
- const connectEmbeddedToExternalConnectors = () => __awaiter(void 0, void 0, void 0, function* () {
20
- // If we're in the ParaEvmProvider context call the connect method to trigger Para as an active connection
21
- if (evmContext && EvmProvider && connectParaEvmWallet) {
22
- try {
23
- const { error } = yield connectParaEvmWallet();
24
- if (error) {
25
- console.warn('Failed to connect Para EVM wallet to Wagmi:', error);
26
- }
27
- }
28
- catch (err) {
29
- console.warn('Error calling connectParaEvmWallet:', err);
30
- }
31
- }
32
- // If we're in the ParaCosmosProvider context call the connect method to trigger Para as an active connection
33
- if (cosmosContext && CosmosProvider && connectParaCosmosWallet) {
34
- try {
35
- const { error } = yield connectParaCosmosWallet();
36
- if (error) {
37
- console.warn('Failed to connect Para Cosmos wallet to Graz:', error);
38
- }
39
- }
40
- catch (err) {
41
- console.warn('Error calling connectParaCosmosWallet:', err);
42
- }
43
- }
44
- });
45
- return connectEmbeddedToExternalConnectors;
46
- };
@@ -1,34 +0,0 @@
1
- import { useExternalWallets } from '../providers/ExternalWalletContext.js';
2
- import { useModalStore } from '../stores/index.js';
3
- import { getAddFundsStep, ModalStep } from '../utils/steps.js';
4
- export const useGoBack = () => {
5
- const currentStep = useModalStore(state => state.step);
6
- const setStep = useModalStore(state => state.setStep);
7
- const accountAddFundTab = useModalStore(state => state.accountAddFundTab);
8
- const decrementStep = useModalStore(state => state.decrementStep);
9
- const resetState = useModalStore(state => state.resetState);
10
- const { setChainIdSwitchingTo } = useExternalWallets();
11
- const goBack = () => {
12
- if (currentStep === ModalStep.ADD_FUNDS_AWAITING) {
13
- setStep(getAddFundsStep(accountAddFundTab));
14
- }
15
- else {
16
- decrementStep();
17
- }
18
- switch (currentStep) {
19
- case ModalStep.VERIFY_2FA:
20
- case ModalStep.BIOMETRIC_CREATION:
21
- case ModalStep.BIOMETRIC_LOGIN: {
22
- resetState();
23
- break;
24
- }
25
- }
26
- switch (currentStep) {
27
- case ModalStep.CHAIN_SWITCH: {
28
- setChainIdSwitchingTo();
29
- break;
30
- }
31
- }
32
- };
33
- return goBack;
34
- };
@@ -1,9 +0,0 @@
1
- export * from './ParaModal.js';
2
- export { ModalStep } from './utils/steps.js';
3
- export { AuthLayout } from './types/modalProps.js';
4
- export * from './utils/openPopup.js';
5
- export { ON_RAMP_PROVIDERS, ON_RAMP_ASSETS, NETWORKS, getAssetIcon, getAssetName, getNetworkIcon, getNetworkName, } from './constants/constants.js';
6
- export { SaveRecoverySecret } from './components/RecoverySecretStep/RecoverySecretStep.js';
7
- export * from './utils/validateOnRampConfig.js';
8
- export * from './types/externalWallets.js';
9
- export { useExternalWalletProviderStore } from './stores/externalWalletProvider/useExternalWalletProviderStore.js';
@@ -1,18 +0,0 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { createContext, useMemo } from 'react';
3
- export const defaultCosmosExternalWallet = {
4
- wallets: [],
5
- chains: [],
6
- chainId: undefined,
7
- disconnect: () => Promise.resolve(),
8
- switchChain: () => Promise.resolve({}),
9
- };
10
- export const CosmosExternalWalletContext = createContext(defaultCosmosExternalWallet);
11
- export function CosmosExternalWalletProvider({ children }) {
12
- const wallets = [];
13
- const chains = [];
14
- const chainId = undefined;
15
- const disconnect = () => Promise.resolve();
16
- const switchChain = () => Promise.resolve({});
17
- return (_jsx(CosmosExternalWalletContext.Provider, { value: useMemo(() => ({ wallets, chains, chainId, disconnect, switchChain }), [wallets, chains, chainId, disconnect, switchChain]), children: children }));
18
- }
@@ -1,22 +0,0 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { createContext, useMemo } from 'react';
3
- export const defaultEvmExternalWallet = {
4
- wallets: [],
5
- chains: [],
6
- chainId: undefined,
7
- username: undefined,
8
- avatar: undefined,
9
- disconnect: () => Promise.resolve(),
10
- switchChain: () => Promise.resolve({}),
11
- };
12
- export const EvmExternalWalletContext = createContext(defaultEvmExternalWallet);
13
- export function EvmExternalWalletProvider({ children }) {
14
- const wallets = [];
15
- const chains = [];
16
- const chainId = undefined;
17
- const username = undefined;
18
- const avatar = undefined;
19
- const disconnect = () => Promise.resolve();
20
- const switchChain = () => Promise.resolve({});
21
- return (_jsx(EvmExternalWalletContext.Provider, { value: useMemo(() => ({ wallets, chains, chainId, username, avatar, disconnect, switchChain }), [wallets, chains, chainId, username, avatar, disconnect, switchChain]), children: children }));
22
- }