@getpara/react-sdk 1.2.0 → 1.3.1-dev.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (205) hide show
  1. package/dist/cli/cli.mjs +43 -0
  2. package/dist/index.js +6428 -5
  3. package/dist/index.js.br +0 -0
  4. package/dist/index.js.gz +0 -0
  5. package/dist/modal/components/AuthInput/AuthInput.d.ts +1 -1
  6. package/dist/modal/components/AuthInput/hooks/useDropdownPosition.d.ts +4 -4
  7. package/dist/modal/components/ChainSwitch/ChainSwitch.d.ts +1 -1
  8. package/dist/modal/components/Controls/Selects.d.ts +1 -1
  9. package/dist/modal/components/ExternalWalletStep/ExternalWalletStep.d.ts +1 -1
  10. package/dist/modal/components/Footer/Footer.d.ts +1 -1
  11. package/dist/modal/components/WalletCard/WalletCard.d.ts +2 -2
  12. package/dist/modal/components/common.d.ts +2 -2
  13. package/dist/modal/index.d.ts +0 -1
  14. package/dist/modal/stores/index.d.ts +0 -1
  15. package/dist/modal/stores/modal/useModalStore.d.ts +6 -3
  16. package/dist/modal/types/modalProps.d.ts +1 -27
  17. package/dist/modal/utils/authLayoutHelpers.d.ts +2 -2
  18. package/dist/modal/utils/getTileButtonFlex.d.ts +1 -1
  19. package/dist/modal/utils/openPopup.d.ts +1 -1
  20. package/dist/provider/ParaProvider.d.ts +3 -1
  21. package/dist/provider/actions/checkIfUserExists.d.ts +2 -7
  22. package/dist/provider/actions/createUser.d.ts +2 -10
  23. package/dist/provider/actions/getAccount.d.ts +9 -6
  24. package/dist/provider/actions/getWallet.d.ts +1 -1
  25. package/dist/provider/actions/logout.d.ts +4 -1
  26. package/dist/provider/actions/waitForLoginAndSetup.d.ts +1 -1
  27. package/dist/provider/components/CosmosWalletWrapper.d.ts +12 -0
  28. package/dist/provider/components/EvmWalletWrapper.d.ts +12 -0
  29. package/dist/provider/components/ExternalWalletWrapper.d.ts +8 -0
  30. package/dist/provider/components/SolanaWalletWrapper.d.ts +9 -0
  31. package/dist/provider/external/getParaCosmosConnector.d.ts +7 -0
  32. package/dist/provider/external/getParaEvmConnector.d.ts +7 -0
  33. package/dist/provider/external/getParaSolanaConnector.d.ts +7 -0
  34. package/dist/provider/external/stubs/CosmosExternalWalletContextStub.d.ts +10 -0
  35. package/dist/provider/external/stubs/EvmExternalWalletContextStub.d.ts +3 -0
  36. package/dist/provider/external/stubs/SolanaExternalWalletContextStub.d.ts +6 -0
  37. package/dist/provider/hooks/mutations/useLogout.d.ts +3 -2
  38. package/dist/provider/hooks/queries/useAccount.d.ts +4 -3
  39. package/dist/provider/hooks/queries/useWallet.d.ts +1 -1
  40. package/dist/provider/hooks/utils/useClient.d.ts +1 -1
  41. package/dist/provider/hooks/utils/useWalletState.d.ts +2 -2
  42. package/dist/provider/index.d.ts +1 -0
  43. package/dist/provider/providers/CosmosExternalWalletProvider.d.ts +7 -0
  44. package/dist/provider/providers/EvmExternalWalletProvider.d.ts +7 -0
  45. package/dist/{modal/providers/ExternalWalletContext.d.ts → provider/providers/ExternalWalletProvider.d.ts} +20 -29
  46. package/dist/provider/providers/SolanaExternalWalletProvider.d.ts +7 -0
  47. package/dist/provider/stores/getters.d.ts +3 -3
  48. package/dist/provider/stores/setters.d.ts +1 -0
  49. package/dist/provider/stores/slices/config.d.ts +3 -0
  50. package/dist/provider/stores/slices/externalWallets.d.ts +3 -0
  51. package/dist/provider/stores/slices/index.d.ts +1 -0
  52. package/dist/provider/stores/types.d.ts +43 -1
  53. package/dist/provider/types/externalWalletProviders.d.ts +12 -0
  54. package/dist/provider/types/provider.d.ts +115 -16
  55. package/dist/provider/types/utils.d.ts +1 -0
  56. package/dist/provider/utils/paraConfigTypeGuards.d.ts +7 -0
  57. package/package.json +33 -9
  58. package/dist/modal/ParaModal.js +0 -281
  59. package/dist/modal/components/Account/Account.js +0 -60
  60. package/dist/modal/components/AddFunds/AddFunds.js +0 -147
  61. package/dist/modal/components/AddFunds/AddFundsAwaiting.js +0 -65
  62. package/dist/modal/components/AddFunds/AddFundsDone.js +0 -26
  63. package/dist/modal/components/AddFunds/MoonPayEmbed.js +0 -2
  64. package/dist/modal/components/AddFunds/index.js +0 -3
  65. package/dist/modal/components/AuthInput/AuthInput.js +0 -221
  66. package/dist/modal/components/AuthInput/countryCodes.js +0 -40
  67. package/dist/modal/components/AuthInput/hooks/useDropdownPosition.js +0 -23
  68. package/dist/modal/components/AuthInput/phoneMasks.js +0 -247
  69. package/dist/modal/components/AuthMainStep/AuthMainStep.js +0 -21
  70. package/dist/modal/components/AuthMainStep/AuthMainStepContent.js +0 -89
  71. package/dist/modal/components/AuthOptions/AuthOptions.js +0 -28
  72. package/dist/modal/components/AwaitingBiometricsStep/AwaitingBiometricsStep.js +0 -7
  73. package/dist/modal/components/AwaitingOAuthStep/AwaitingOAuthStep.js +0 -5
  74. package/dist/modal/components/AwaitingPasswordStep/AwaitingPasswordStep.js +0 -7
  75. package/dist/modal/components/AwaitingWalletCreationStep/AwaitingWalletCreationStep.js +0 -18
  76. package/dist/modal/components/BiometricCreationStep/BiometricCreationStep.js +0 -17
  77. package/dist/modal/components/BiometricLoginStep/BiometricLoginStep.js +0 -131
  78. package/dist/modal/components/Body/AnimatedHeightWrapper.js +0 -26
  79. package/dist/modal/components/Body/Body.js +0 -232
  80. package/dist/modal/components/ChainSwitch/ChainSwitch.js +0 -77
  81. package/dist/modal/components/ChainSwitch/config.js +0 -11
  82. package/dist/modal/components/Controls/Controls.js +0 -54
  83. package/dist/modal/components/Controls/Selects.js +0 -159
  84. package/dist/modal/components/ExternalWalletStep/ExternalWalletStep.js +0 -116
  85. package/dist/modal/components/ExternalWalletStep/config.js +0 -11
  86. package/dist/modal/components/ExternalWallets/ExternalWallets.js +0 -142
  87. package/dist/modal/components/ExternalWalletsWrapper/ExternalWalletsWrapper.d.ts +0 -7
  88. package/dist/modal/components/ExternalWalletsWrapper/ExternalWalletsWrapper.js +0 -119
  89. package/dist/modal/components/Footer/Footer.js +0 -71
  90. package/dist/modal/components/Header/Header.js +0 -24
  91. package/dist/modal/components/Header/hooks/useStepTitle.js +0 -42
  92. package/dist/modal/components/Hero/Hero.js +0 -119
  93. package/dist/modal/components/IFrameStep/IFrameStep.js +0 -41
  94. package/dist/modal/components/LoginDoneStep/LoginDoneStep.js +0 -19
  95. package/dist/modal/components/ModalContent/ModalContent.js +0 -282
  96. package/dist/modal/components/OAuth/FarcasterOAuthStep.js +0 -81
  97. package/dist/modal/components/OAuth/OAuth.js +0 -125
  98. package/dist/modal/components/OAuth/TelegramOAuthStep.js +0 -133
  99. package/dist/modal/components/OnRampComponents/AddingFunds.js +0 -10
  100. package/dist/modal/components/OnRampComponents/OnRampProviderButton.js +0 -72
  101. package/dist/modal/components/RecoverySecretStep/RecoverySecretStep.js +0 -67
  102. package/dist/modal/components/Setup2FAStep/Setup2FAStep.js +0 -105
  103. package/dist/modal/components/StripeComponents/StripeComponents.js +0 -78
  104. package/dist/modal/components/TwoFactorDoneStep/TwoFactorDoneStep.js +0 -8
  105. package/dist/modal/components/VerificationCodeStep/VerificationCodeStep.js +0 -135
  106. package/dist/modal/components/Waiting/Waiting.js +0 -6
  107. package/dist/modal/components/WalletCard/PartnerIcon.js +0 -29
  108. package/dist/modal/components/WalletCard/WalletCard.js +0 -93
  109. package/dist/modal/components/WalletCreationDoneStep/WalletCreationDoneStep.js +0 -50
  110. package/dist/modal/components/common.js +0 -67
  111. package/dist/modal/components/index.js +0 -1
  112. package/dist/modal/constants/constants.js +0 -93
  113. package/dist/modal/constants/defaults.js +0 -5
  114. package/dist/modal/constants/oAuthLogos.js +0 -18
  115. package/dist/modal/hooks/useActiveWallet.d.ts +0 -1
  116. package/dist/modal/hooks/useActiveWallet.js +0 -11
  117. package/dist/modal/hooks/useEmbeddedExternalConnection.d.ts +0 -1
  118. package/dist/modal/hooks/useEmbeddedExternalConnection.js +0 -46
  119. package/dist/modal/hooks/useGoBack.js +0 -34
  120. package/dist/modal/index.js +0 -9
  121. package/dist/modal/providers/CosmosExternalWalletContextStub.d.ts +0 -29
  122. package/dist/modal/providers/CosmosExternalWalletContextStub.js +0 -18
  123. package/dist/modal/providers/EvmExternalWalletContextStub.d.ts +0 -33
  124. package/dist/modal/providers/EvmExternalWalletContextStub.js +0 -22
  125. package/dist/modal/providers/ExternalWalletContext.js +0 -253
  126. package/dist/modal/providers/SolanaExternalWalletContextStub.d.ts +0 -21
  127. package/dist/modal/providers/SolanaExternalWalletContextStub.js +0 -12
  128. package/dist/modal/stores/externalWalletProvider/actions.d.ts +0 -3
  129. package/dist/modal/stores/externalWalletProvider/actions.js +0 -5
  130. package/dist/modal/stores/externalWalletProvider/useExternalWalletProviderStore.d.ts +0 -20
  131. package/dist/modal/stores/externalWalletProvider/useExternalWalletProviderStore.js +0 -13
  132. package/dist/modal/stores/index.js +0 -3
  133. package/dist/modal/stores/modal/actions.js +0 -64
  134. package/dist/modal/stores/modal/useModalStore.js +0 -41
  135. package/dist/modal/stores/para/actions.d.ts +0 -3
  136. package/dist/modal/stores/para/actions.js +0 -5
  137. package/dist/modal/stores/para/useParaStore.d.ts +0 -10
  138. package/dist/modal/stores/para/useParaStore.js +0 -3
  139. package/dist/modal/stores/theme/actions.d.ts +0 -3
  140. package/dist/modal/stores/theme/actions.js +0 -24
  141. package/dist/modal/stores/theme/useThemeStore.d.ts +0 -20
  142. package/dist/modal/stores/theme/useThemeStore.js +0 -14
  143. package/dist/modal/stores/userInfo/actions.js +0 -34
  144. package/dist/modal/stores/userInfo/useUserInfoStore.js +0 -9
  145. package/dist/modal/types/commonTypes.js +0 -1
  146. package/dist/modal/types/externalWallets.js +0 -21
  147. package/dist/modal/types/modalProps.js +0 -7
  148. package/dist/modal/utils/authLayoutHelpers.js +0 -2
  149. package/dist/modal/utils/getMailtoLink.js +0 -5
  150. package/dist/modal/utils/getTileButtonFlex.js +0 -15
  151. package/dist/modal/utils/isPasskeySupported.js +0 -10
  152. package/dist/modal/utils/openPopup.js +0 -55
  153. package/dist/modal/utils/routeMobileExternalWallet.js +0 -35
  154. package/dist/modal/utils/steps.js +0 -215
  155. package/dist/modal/utils/stringFormatters.js +0 -12
  156. package/dist/modal/utils/validateOnRampConfig.js +0 -26
  157. package/dist/provider/ParaProvider.js +0 -17
  158. package/dist/provider/actions/checkIfUserExists.js +0 -26
  159. package/dist/provider/actions/createUser.js +0 -30
  160. package/dist/provider/actions/getAccount.js +0 -24
  161. package/dist/provider/actions/getWallet.js +0 -16
  162. package/dist/provider/actions/initiateLogin.js +0 -23
  163. package/dist/provider/actions/keepSessionAlive.js +0 -23
  164. package/dist/provider/actions/logout.js +0 -20
  165. package/dist/provider/actions/signMessage.js +0 -23
  166. package/dist/provider/actions/signTransaction.js +0 -23
  167. package/dist/provider/actions/waitForAccountCreation.js +0 -24
  168. package/dist/provider/actions/waitForLoginAndSetup.js +0 -27
  169. package/dist/provider/actions/waitForPasskeyAndCreateWallet.js +0 -24
  170. package/dist/provider/hooks/index.js +0 -3
  171. package/dist/provider/hooks/mutations/index.js +0 -10
  172. package/dist/provider/hooks/mutations/useCheckIfUserExists.js +0 -23
  173. package/dist/provider/hooks/mutations/useCreateUser.js +0 -23
  174. package/dist/provider/hooks/mutations/useInitiateLogin.js +0 -23
  175. package/dist/provider/hooks/mutations/useKeepSessionAlive.js +0 -23
  176. package/dist/provider/hooks/mutations/useLogout.js +0 -33
  177. package/dist/provider/hooks/mutations/useSignMessage.js +0 -33
  178. package/dist/provider/hooks/mutations/useSignTransaction.js +0 -33
  179. package/dist/provider/hooks/mutations/useWaitForAccountCreation.js +0 -30
  180. package/dist/provider/hooks/mutations/useWaitForLoginAndSetup.js +0 -30
  181. package/dist/provider/hooks/mutations/useWaitForPasskeyAndCreateWallet.js +0 -30
  182. package/dist/provider/hooks/queries/index.js +0 -2
  183. package/dist/provider/hooks/queries/useAccount.js +0 -23
  184. package/dist/provider/hooks/queries/useWallet.js +0 -24
  185. package/dist/provider/hooks/utils/index.js +0 -3
  186. package/dist/provider/hooks/utils/useAutoSessionKeepAlive.js +0 -79
  187. package/dist/provider/hooks/utils/useClient.js +0 -8
  188. package/dist/provider/hooks/utils/useEventListeners.js +0 -87
  189. package/dist/provider/hooks/utils/useInternalClient.js +0 -9
  190. package/dist/provider/hooks/utils/useModal.js +0 -15
  191. package/dist/provider/hooks/utils/useWalletState.js +0 -33
  192. package/dist/provider/index.js +0 -3
  193. package/dist/provider/stores/getters.js +0 -5
  194. package/dist/provider/stores/slices/client.js +0 -4
  195. package/dist/provider/stores/slices/index.js +0 -3
  196. package/dist/provider/stores/slices/modal.js +0 -4
  197. package/dist/provider/stores/slices/wallet.js +0 -6
  198. package/dist/provider/stores/types.js +0 -1
  199. package/dist/provider/stores/useStore.js +0 -14
  200. package/dist/provider/types/provider.js +0 -1
  201. package/dist/provider/types/query.js +0 -1
  202. package/dist/provider/types/utils.js +0 -1
  203. package/dist/provider/utils/renameMutations.js +0 -19
  204. /package/dist/{modal/css → css}/modal.css +0 -0
  205. /package/dist/{modal/public → public}/Inter-VariableFont_slnt,wght.ttf +0 -0
@@ -1,21 +0,0 @@
1
- import { ReactNode } from 'react';
2
- import { CommonWallet } from '../types/commonTypes.js';
3
- import ParaWeb from '@getpara/web-sdk';
4
- export declare const defaultSolanaExternalWallet: {
5
- wallets: any[];
6
- disconnect: () => Promise<void>;
7
- };
8
- export type SolanaExternalWalletContextType = {
9
- wallets: CommonWallet[];
10
- disconnect: () => Promise<void>;
11
- };
12
- export declare const SolanaExternalWalletContext: import("react").Context<SolanaExternalWalletContextType>;
13
- export interface SolanaExternalWalletProviderProps {
14
- children: ReactNode;
15
- para: ParaWeb;
16
- onSwitchWallet: (args: {
17
- address?: string;
18
- error?: string;
19
- }) => void;
20
- }
21
- export declare function SolanaExternalWalletProvider({ children }: SolanaExternalWalletProviderProps): import("react/jsx-runtime").JSX.Element;
@@ -1,12 +0,0 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { createContext, useMemo } from 'react';
3
- export const defaultSolanaExternalWallet = {
4
- wallets: [],
5
- disconnect: () => Promise.resolve(),
6
- };
7
- export const SolanaExternalWalletContext = createContext(defaultSolanaExternalWallet);
8
- export function SolanaExternalWalletProvider({ children }) {
9
- const wallets = [];
10
- const disconnect = () => Promise.resolve();
11
- return (_jsx(SolanaExternalWalletContext.Provider, { value: useMemo(() => ({ wallets, disconnect }), [wallets, disconnect]), children: children }));
12
- }
@@ -1,3 +0,0 @@
1
- import { StoreApi } from 'zustand';
2
- import { ExternalWalletProviderActions, ExternalWalletProviderStore } from './useExternalWalletProviderStore.js';
3
- export declare const getActions: (set: StoreApi<ExternalWalletProviderStore>["setState"]) => ExternalWalletProviderActions;
@@ -1,5 +0,0 @@
1
- export const getActions = (set) => ({
2
- updateState: state => {
3
- set(state);
4
- },
5
- });
@@ -1,20 +0,0 @@
1
- import { EvmExternalWalletContextType, EvmExternalWalletProvider } from '../../providers/EvmExternalWalletContextStub.js';
2
- import { Context } from 'react';
3
- import { SolanaExternalWalletContextType, SolanaExternalWalletProvider } from '../../providers/SolanaExternalWalletContextStub.js';
4
- import { CosmosExternalWalletContextType, CosmosExternalWalletProvider } from '../../providers/CosmosExternalWalletContextStub.js';
5
- interface ExternalWalletProviderState {
6
- EvmProvider?: typeof EvmExternalWalletProvider;
7
- evmContext?: Context<EvmExternalWalletContextType>;
8
- SolanaProvider?: typeof SolanaExternalWalletProvider;
9
- solanaContext?: Context<SolanaExternalWalletContextType>;
10
- CosmosProvider?: typeof CosmosExternalWalletProvider;
11
- cosmosContext?: Context<CosmosExternalWalletContextType>;
12
- connectParaEvmWallet?: () => Promise<any>;
13
- connectParaCosmosWallet?: () => Promise<any>;
14
- }
15
- export interface ExternalWalletProviderActions {
16
- updateState: (state: Partial<ExternalWalletProviderState>) => void;
17
- }
18
- export type ExternalWalletProviderStore = ExternalWalletProviderState & ExternalWalletProviderActions;
19
- export declare const useExternalWalletProviderStore: import("zustand").UseBoundStore<import("zustand").StoreApi<ExternalWalletProviderStore>>;
20
- export {};
@@ -1,13 +0,0 @@
1
- import { create } from 'zustand';
2
- import { getActions } from './actions.js';
3
- const DEFAULT_EX_WALLET_PROVIDER_STATE = {
4
- EvmProvider: undefined,
5
- evmContext: undefined,
6
- SolanaProvider: undefined,
7
- solanaContext: undefined,
8
- CosmosProvider: undefined,
9
- cosmosContext: undefined,
10
- connectParaEvmWallet: undefined,
11
- connectParaCosmosWallet: undefined,
12
- };
13
- export const useExternalWalletProviderStore = create(set => (Object.assign(Object.assign({}, DEFAULT_EX_WALLET_PROVIDER_STATE), getActions(set))));
@@ -1,3 +0,0 @@
1
- export * from './modal/useModalStore.js';
2
- export * from './userInfo/useUserInfoStore.js';
3
- export * from './theme/useThemeStore.js';
@@ -1,64 +0,0 @@
1
- import { DEFAULT_MODAL_STATE } from './useModalStore.js';
2
- import { AccountPreviousStep, LoginPreviousStep, ModalStep, SignUpPreviousStep } from '../../utils/steps.js';
3
- export const getActions = (set, get) => ({
4
- resetState: () => set(DEFAULT_MODAL_STATE),
5
- setOnModalStepChange: onModalStepChange => set({ onModalStepChange }),
6
- setStep: step => {
7
- const onModalStepChange = get().onModalStepChange;
8
- const previousStep = get().step;
9
- set({ step });
10
- onModalStepChange === null || onModalStepChange === void 0 ? void 0 : onModalStepChange({ previousStep, currentStep: step, canGoBack: get().hasPreviousStep() });
11
- },
12
- decrementStep: () => {
13
- const onModalStepChange = get().onModalStepChange;
14
- const isLogin = get().flow === 'login';
15
- const isAccount = get().flow === 'account';
16
- const currentStep = get().step;
17
- const webAuthURLForCreate = get().webAuthURLForCreate;
18
- const iFrameUrl = get().iFrameUrl;
19
- let prevStep = (isAccount ? AccountPreviousStep : isLogin ? LoginPreviousStep : SignUpPreviousStep)[currentStep];
20
- if (currentStep === ModalStep.PASSWORD_CREATION && iFrameUrl && !webAuthURLForCreate) {
21
- prevStep = ModalStep.AUTH_MAIN;
22
- }
23
- if (currentStep === ModalStep.EX_WALLET_SELECTED) {
24
- set({ selectedExternalWalletId: undefined, isExternalWalletConnecting: false, externalWalletError: undefined });
25
- }
26
- if (prevStep) {
27
- set({ step: prevStep, stepDirection: -1 });
28
- onModalStepChange === null || onModalStepChange === void 0 ? void 0 : onModalStepChange({ previousStep: currentStep, currentStep: prevStep, canGoBack: get().hasPreviousStep() });
29
- }
30
- },
31
- hasPreviousStep: () => {
32
- const isLogin = get().flow === 'login';
33
- const isAccount = get().flow === 'account';
34
- const currentStep = get().step;
35
- return !!(isAccount
36
- ? AccountPreviousStep[currentStep]
37
- : isLogin
38
- ? LoginPreviousStep[currentStep]
39
- : SignUpPreviousStep[currentStep]);
40
- },
41
- setPopupWindow: popupWindow => {
42
- set({ popupWindow });
43
- },
44
- setFlow: flow => set({ flow }),
45
- isLogin: () => get().flow === 'login',
46
- isAccount: () => get().flow === 'account',
47
- setWebAuthURLForLogin: url => set({ webAuthURLForLogin: url }),
48
- setWebAuthURLForCreate: url => set({ webAuthURLForCreate: url }),
49
- setPasswordUrlForLogin: url => set({ passwordUrlForLogin: url }),
50
- setSupportedAuthMethods: supportedAuthMethods => set({ supportedAuthMethods }),
51
- setOnRampPurchase: onRampPurchase => set(state => ({ onRampPurchase: Object.assign(Object.assign({}, (state.onRampPurchase || {})), onRampPurchase) })),
52
- setOnRampConfig: onRampConfig => set({ onRampConfig }),
53
- setIsFullyLoggedIn: isFullyLoggedIn => set({ isFullyLoggedIn }),
54
- setAccountAddFundTab: accountAddFundTab => set({ accountAddFundTab }),
55
- setSelectedExternalWalletId: selectedExternalWalletId => set({ selectedExternalWalletId }),
56
- setIsExternalWalletConnecting: isExternalWalletConnecting => set({ isExternalWalletConnecting }),
57
- setExternalWalletError: externalWalletError => set({ externalWalletError }),
58
- setIsUsingMobileConnector: isUsingMobileConnector => set({ isUsingMobileConnector }),
59
- setStepDirection: stepDirection => set({ stepDirection }),
60
- setFarcasterConnectUri: farcasterConnectUri => set({ farcasterConnectUri }),
61
- setBiometricLocationHints: biometricLocationHints => set({ biometricLocationHints }),
62
- setIFrameUrl: iFrameUrl => set({ iFrameUrl }),
63
- setIsIFrameReady: isIFrameReady => set({ isIFrameReady }),
64
- });
@@ -1,41 +0,0 @@
1
- import { create } from 'zustand';
2
- import { persist, createJSONStorage } from 'zustand/middleware';
3
- import { ModalStep } from '../../utils/steps.js';
4
- import { getActions } from './actions.js';
5
- // Omitting step from default here since it's set dynamically when the modal opens and closes
6
- export const DEFAULT_MODAL_STATE = {
7
- flow: undefined,
8
- stepDirection: 1,
9
- webAuthURLForLogin: undefined,
10
- webAuthURLForCreate: undefined,
11
- passwordUrlForLogin: undefined,
12
- supportedAuthMethods: new Set(),
13
- onModalStepChange: undefined,
14
- onRampPurchase: undefined,
15
- popupWindow: undefined,
16
- isFullyLoggedIn: false,
17
- accountAddFundTab: undefined,
18
- isExternalWalletConnecting: false,
19
- externalWalletError: undefined,
20
- activeWallet: [undefined, undefined],
21
- farcasterConnectUri: undefined,
22
- biometricLocationHints: undefined,
23
- iFrameUrl: undefined,
24
- isIFrameReady: undefined,
25
- };
26
- export const useModalStore = create()(persist((set, get) => (Object.assign(Object.assign({ step: ModalStep.AUTH_MAIN, onRampConfig: undefined, activeWallet: undefined }, DEFAULT_MODAL_STATE), getActions(set, get))), {
27
- version: 1,
28
- name: '@CAPSULE/modalState',
29
- storage: createJSONStorage(() => sessionStorage),
30
- partialize: state => ({
31
- step: state.step,
32
- webAuthURLForLogin: state.webAuthURLForLogin,
33
- webAuthURLForCreate: state.webAuthURLForCreate,
34
- passwordUrlForLogin: state.passwordUrlForLogin,
35
- biometricLocationHints: state.biometricLocationHints,
36
- onRampPurchase: state.onRampPurchase,
37
- selectedExternalWalletId: state.selectedExternalWalletId,
38
- isUsingMobileConnector: state.isUsingMobileConnector,
39
- supportedAuthMethods: state.supportedAuthMethods,
40
- }),
41
- }));
@@ -1,3 +0,0 @@
1
- import { StoreApi } from 'zustand';
2
- import { ParaActions, ParaStore } from './useParaStore.js';
3
- export declare const getActions: (set: StoreApi<ParaStore>["setState"]) => ParaActions;
@@ -1,5 +0,0 @@
1
- export const getActions = (set) => ({
2
- setPara: para => {
3
- set({ para: para });
4
- },
5
- });
@@ -1,10 +0,0 @@
1
- import { ParaInternal } from '@getpara/react-common';
2
- interface ParaState {
3
- para: ParaInternal | undefined;
4
- }
5
- export interface ParaActions {
6
- setPara: (para: ParaInternal) => void;
7
- }
8
- export type ParaStore = ParaState & ParaActions;
9
- export declare const useParaStore: import("zustand").UseBoundStore<import("zustand").StoreApi<ParaStore>>;
10
- export {};
@@ -1,3 +0,0 @@
1
- import { create } from 'zustand';
2
- import { getActions } from './actions.js';
3
- export const useParaStore = create(set => (Object.assign({ para: undefined }, getActions(set))));
@@ -1,3 +0,0 @@
1
- import { StoreApi } from 'zustand';
2
- import { ThemeActions, ThemeStore } from './useThemeStore.js';
3
- export declare const getActions: (set: StoreApi<ThemeStore>["setState"], get: StoreApi<ThemeStore>["getState"]) => ThemeActions;
@@ -1,24 +0,0 @@
1
- export const getActions = (set, get) => ({
2
- updateState: state => {
3
- set(state);
4
- },
5
- getLogo: () => {
6
- var _a;
7
- return (_a = get().logo) !== null && _a !== void 0 ? _a : undefined;
8
- },
9
- setAuthLayout: authLayout => {
10
- const types = [];
11
- const uniqueLayouts = [];
12
- authLayout.map(layout => {
13
- const type = layout.split(':')[0];
14
- if (!types.includes(type)) {
15
- uniqueLayouts.push(layout);
16
- types.push(type);
17
- }
18
- else {
19
- console.warn(`${layout} is a duplicate ${type} layout type. Please remove the duplicate type from your config.`);
20
- }
21
- });
22
- set({ authLayout: uniqueLayouts });
23
- },
24
- });
@@ -1,20 +0,0 @@
1
- import { ParaModalTheme, OAuthLogoVariantType, TAuthLayout } from '../../types/modalProps.js';
2
- interface ThemeState {
3
- isDark?: boolean;
4
- logo?: string;
5
- appName?: string;
6
- bareModal?: boolean;
7
- embeddedModal?: boolean;
8
- oAuthLogoVariant?: OAuthLogoVariantType;
9
- authLayout?: TAuthLayout[];
10
- theme?: ParaModalTheme;
11
- hideWallets?: boolean;
12
- }
13
- export interface ThemeActions {
14
- updateState: (state: Partial<ThemeState>) => void;
15
- getLogo: () => string | undefined;
16
- setAuthLayout: (authLayout: TAuthLayout[]) => void;
17
- }
18
- export type ThemeStore = ThemeState & ThemeActions;
19
- export declare const useThemeStore: import("zustand").UseBoundStore<import("zustand").StoreApi<ThemeStore>>;
20
- export {};
@@ -1,14 +0,0 @@
1
- import { create } from 'zustand';
2
- import { getActions } from './actions.js';
3
- import { AuthLayout } from '../../types/modalProps.js';
4
- const DEFAULT_THEME = {
5
- isDark: false,
6
- logo: undefined,
7
- appName: undefined,
8
- bareModal: false,
9
- embeddedModal: false,
10
- oAuthLogoVariant: undefined,
11
- authLayout: [AuthLayout.AUTH_FULL, AuthLayout.EXTERNAL_FULL],
12
- hideWallets: false,
13
- };
14
- export const useThemeStore = create((set, get) => (Object.assign(Object.assign({}, DEFAULT_THEME), getActions(set, get))));
@@ -1,34 +0,0 @@
1
- var __rest = (this && this.__rest) || function (s, e) {
2
- var t = {};
3
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
4
- t[p] = s[p];
5
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
6
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
7
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
8
- t[p[i]] = s[p[i]];
9
- }
10
- return t;
11
- };
12
- import { DEFAULT_USER_INFO_STATE } from './useUserInfoStore.js';
13
- import { extractAuthInfo } from '@getpara/user-management-client';
14
- export const getActions = (set, get) => ({
15
- resetState: () => {
16
- set(DEFAULT_USER_INFO_STATE);
17
- },
18
- setAuthInfo: (_a) => {
19
- var { pfpUrl, displayName } = _a, auth = __rest(_a, ["pfpUrl", "displayName"]);
20
- set({ auth, pfpUrl: pfpUrl || null, displayName: displayName || null });
21
- },
22
- getAuthInfo: () => {
23
- try {
24
- return get().auth
25
- ? Object.assign(Object.assign({}, extractAuthInfo(get().auth, { isRequired: true })), { pfpUrl: get().pfpUrl, displayName: get().displayName }) : null;
26
- }
27
- catch (e) {
28
- return null;
29
- }
30
- },
31
- setRecoveryShare: recoveryShare => {
32
- set({ recoveryShare });
33
- },
34
- });
@@ -1,9 +0,0 @@
1
- import { create } from 'zustand';
2
- import { getActions } from './actions.js';
3
- export const DEFAULT_USER_INFO_STATE = {
4
- auth: null,
5
- recoveryShare: null,
6
- pfpUrl: null,
7
- displayName: null,
8
- };
9
- export const useUserInfoStore = create((set, get) => (Object.assign(Object.assign({}, DEFAULT_USER_INFO_STATE), getActions(set, get))));
@@ -1 +0,0 @@
1
- export {};
@@ -1,21 +0,0 @@
1
- export var EvmWallet;
2
- (function (EvmWallet) {
3
- EvmWallet["METAMASK"] = "METAMASK";
4
- EvmWallet["RAINBOW"] = "RAINBOW";
5
- EvmWallet["COINBASE"] = "COINBASE";
6
- EvmWallet["WALLETCONNECT"] = "WALLETCONNECT";
7
- EvmWallet["ZERION"] = "ZERION";
8
- EvmWallet["RABBY"] = "RABBY";
9
- })(EvmWallet || (EvmWallet = {}));
10
- export var SolanaWallet;
11
- (function (SolanaWallet) {
12
- SolanaWallet["PHANTOM"] = "PHANTOM";
13
- SolanaWallet["GLOW"] = "GLOW";
14
- SolanaWallet["BACKPACK"] = "BACKPACK";
15
- })(SolanaWallet || (SolanaWallet = {}));
16
- export var CosmosWallet;
17
- (function (CosmosWallet) {
18
- CosmosWallet["KEPLR"] = "KEPLR";
19
- CosmosWallet["LEAP"] = "LEAP";
20
- })(CosmosWallet || (CosmosWallet = {}));
21
- export const ExternalWallet = Object.assign(Object.assign(Object.assign({}, EvmWallet), SolanaWallet), CosmosWallet);
@@ -1,7 +0,0 @@
1
- export var AuthLayout;
2
- (function (AuthLayout) {
3
- AuthLayout["AUTH_FULL"] = "AUTH:FULL";
4
- AuthLayout["AUTH_CONDENSED"] = "AUTH:CONDENSED";
5
- AuthLayout["EXTERNAL_FULL"] = "EXTERNAL:FULL";
6
- AuthLayout["EXTERNAL_CONDENSED"] = "EXTERNAL:CONDENSED";
7
- })(AuthLayout || (AuthLayout = {}));
@@ -1,2 +0,0 @@
1
- export const hasExternalWallet = (authLayout) => authLayout.find(layout => layout.includes('EXTERNAL'));
2
- export const hasEmbeddedAuth = (authLayout) => authLayout.find(layout => layout.includes('AUTH'));
@@ -1,5 +0,0 @@
1
- export function getMailtoLink(email, recoveryShare) {
2
- const emailBody = `Hello,%0D%0DBelow is your Para Recovery Secret. Keep this safe!%0D%0D${recoveryShare}%0D%0DPlease get in touch via support@getpara.com if you have any questions`;
3
- const mailText = `mailto:${email}?subject=Para%20Recovery%20Secret&body=${emailBody}`;
4
- return mailText;
5
- }
@@ -1,15 +0,0 @@
1
- export const getTileButtonFlex = (index, totalItems) => {
2
- const gapOffset = 8 - 8 * 0.333;
3
- if (totalItems < 2) {
4
- return '1 1 auto';
5
- }
6
- if (totalItems % 3 === 0) {
7
- return `0 0 calc(33.333333% - ${gapOffset}px)`;
8
- }
9
- if (totalItems % 3 === 1) {
10
- return index < 4 ? '0 0 calc(50% - 4px)' : `0 0 calc(33.333333% - ${gapOffset}px)`;
11
- }
12
- if (totalItems % 3 === 2) {
13
- return index < 2 ? '0 0 calc(50% - 4px)' : `0 0 calc(33.333333% - ${gapOffset}px)`;
14
- }
15
- };
@@ -1,10 +0,0 @@
1
- import { detect } from 'detect-browser';
2
- export const isPasskeySupported = () => {
3
- const browser = detect();
4
- switch (browser.os) {
5
- case 'linux':
6
- case 'Chrome OS':
7
- return false;
8
- }
9
- return true;
10
- };
@@ -1,55 +0,0 @@
1
- export function openPopup(popupUrl, target, type) {
2
- const popUpWidth = 560;
3
- let popUpHeight;
4
- switch (type) {
5
- case 'LOGIN_PASSWORD': {
6
- popUpHeight = 460;
7
- break;
8
- }
9
- case 'LOGIN_PASSKEY': {
10
- popUpHeight = 798;
11
- break;
12
- }
13
- case 'CREATE_PASSWORD': {
14
- popUpHeight = 400;
15
- break;
16
- }
17
- case 'CREATE_PASSKEY': {
18
- popUpHeight = 464;
19
- break;
20
- }
21
- case 'TRANSACTION_REVIEW': {
22
- popUpHeight = 480;
23
- break;
24
- }
25
- case 'OAUTH':
26
- default: {
27
- popUpHeight = 768;
28
- break;
29
- }
30
- }
31
- // Fixes position when using multiple monitors
32
- const dualScreenLeft = window.screenLeft !== undefined ? window.screenLeft : window.screenX;
33
- const dualScreenTop = window.screenTop !== undefined ? window.screenTop : window.screenY;
34
- const width = window.innerWidth
35
- ? window.innerWidth
36
- : document.documentElement.clientWidth
37
- ? document.documentElement.clientWidth
38
- : screen.width;
39
- const height = window.innerHeight
40
- ? window.innerHeight
41
- : document.documentElement.clientHeight
42
- ? document.documentElement.clientHeight
43
- : screen.height;
44
- const left = (width - popUpWidth) / 2 + dualScreenLeft;
45
- const top = (height - popUpHeight) / 2 + dualScreenTop;
46
- const windowFeatures = `toolbar=no, menubar=no, width=${popUpWidth},
47
- height=${popUpHeight}, top=${top}, left=${left}`;
48
- let popupWindow = window.open(popupUrl, target, windowFeatures);
49
- if (!popupWindow) {
50
- setTimeout(() => {
51
- popupWindow = window.open(popupUrl, '_blank');
52
- }, 0);
53
- }
54
- return popupWindow;
55
- }
@@ -1,35 +0,0 @@
1
- import { isAndroid, isMobile, isTelegram } from '@getpara/web-sdk';
2
- export const routeMobileExternalWallet = (qrUri) => {
3
- if (isMobile()) {
4
- if (!qrUri)
5
- return;
6
- if (!isTelegram() && qrUri.startsWith('http')) {
7
- // Workaround for https://github.com/rainbow-me/rainbowkit/issues/524.
8
- // Using 'window.open' causes issues on iOS in non-Safari browsers and
9
- // WebViews where a blank tab is left behind after connecting.
10
- // This is especially bad in some WebView scenarios (e.g. following a
11
- // link from Twitter) where the user doesn't have any mechanism for
12
- // closing the blank tab.
13
- // For whatever reason, links with a target of "_blank" don't suffer
14
- // from this problem, and programmatically clicking a detached link
15
- // element with the same attributes also avoids the issue.
16
- const link = document.createElement('a');
17
- link.href = qrUri;
18
- link.target = '_blank';
19
- link.rel = 'noreferrer noopener';
20
- link.click();
21
- }
22
- else {
23
- if (isTelegram()) {
24
- let href = qrUri;
25
- if (isAndroid()) {
26
- href = encodeURI(qrUri);
27
- }
28
- window.open(href, '_blank', 'noreferrer noopener');
29
- }
30
- else {
31
- window.location.href = qrUri;
32
- }
33
- }
34
- }
35
- };