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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (143) hide show
  1. package/dist/index.js +6 -6367
  2. package/dist/modal/ParaModal.js +337 -0
  3. package/dist/modal/components/Account/Account.js +69 -0
  4. package/dist/modal/components/AddFunds/AddFunds.js +220 -0
  5. package/dist/modal/components/AddFunds/AddFundsAwaiting.js +72 -0
  6. package/dist/modal/components/AddFunds/AddFundsDone.js +43 -0
  7. package/dist/{MoonPayEmbed-Q2HP2BFI.js → modal/components/AddFunds/MoonPayEmbed.js} +1 -3
  8. package/dist/modal/components/AddFunds/index.js +4 -0
  9. package/dist/modal/components/AuthInput/AuthInput.js +283 -0
  10. package/dist/modal/components/AuthInput/countryCodes.js +42 -0
  11. package/dist/modal/components/AuthInput/hooks/useDropdownPosition.js +33 -0
  12. package/dist/modal/components/AuthInput/phoneMasks.js +253 -0
  13. package/dist/modal/components/AuthMainStep/AuthMainStep.js +37 -0
  14. package/dist/modal/components/AuthMainStep/AuthMainStepContent.js +113 -0
  15. package/dist/modal/components/AuthOptions/AuthOptions.js +33 -0
  16. package/dist/modal/components/AwaitingBiometricsStep/AwaitingBiometricsStep.js +18 -0
  17. package/dist/modal/components/AwaitingOAuthStep/AwaitingOAuthStep.js +10 -0
  18. package/dist/modal/components/AwaitingPasswordStep/AwaitingPasswordStep.js +18 -0
  19. package/dist/modal/components/AwaitingWalletCreationStep/AwaitingWalletCreationStep.js +44 -0
  20. package/dist/modal/components/BiometricCreationStep/BiometricCreationStep.js +52 -0
  21. package/dist/modal/components/BiometricLoginStep/BiometricLoginStep.js +93 -0
  22. package/dist/modal/components/Body/AnimatedHeightWrapper.js +29 -0
  23. package/dist/modal/components/Body/Body.js +304 -0
  24. package/dist/modal/components/ChainSwitch/ChainSwitch.js +94 -0
  25. package/dist/modal/components/ChainSwitch/config.js +17 -0
  26. package/dist/modal/components/Controls/Controls.js +74 -0
  27. package/dist/modal/components/Controls/Selects.js +213 -0
  28. package/dist/modal/components/ExternalWalletStep/ExternalWalletStep.js +151 -0
  29. package/dist/modal/components/ExternalWalletStep/config.js +17 -0
  30. package/dist/modal/components/ExternalWallets/ExternalWallets.js +172 -0
  31. package/dist/modal/components/ExternalWalletsWrapper/ExternalWalletsWrapper.js +123 -0
  32. package/dist/modal/components/Footer/Footer.js +93 -0
  33. package/dist/modal/components/Header/Header.js +43 -0
  34. package/dist/modal/components/Header/hooks/useStepTitle.js +50 -0
  35. package/dist/modal/components/Hero/Hero.js +122 -0
  36. package/dist/modal/components/IFrameStep/IFrameStep.js +55 -0
  37. package/dist/modal/components/LoginDoneStep/LoginDoneStep.js +28 -0
  38. package/dist/modal/components/ModalContent/ModalContent.js +310 -0
  39. package/dist/modal/components/OAuth/FarcasterOAuthStep.js +81 -0
  40. package/dist/modal/components/OAuth/OAuth.js +153 -0
  41. package/dist/modal/components/OAuth/TelegramOAuthStep.js +139 -0
  42. package/dist/modal/components/OnRampComponents/AddingFunds.js +23 -0
  43. package/dist/modal/components/OnRampComponents/OnRampProviderButton.js +77 -0
  44. package/dist/modal/components/RecoverySecretStep/RecoverySecretStep.js +101 -0
  45. package/dist/modal/components/Setup2FAStep/Setup2FAStep.js +141 -0
  46. package/dist/modal/components/StripeComponents/StripeComponents.js +88 -0
  47. package/dist/modal/components/TwoFactorDoneStep/TwoFactorDoneStep.js +24 -0
  48. package/dist/modal/components/VerificationCodeStep/VerificationCodeStep.js +159 -0
  49. package/dist/modal/components/Waiting/Waiting.js +17 -0
  50. package/dist/modal/components/WalletCard/PartnerIcon.js +34 -0
  51. package/dist/modal/components/WalletCard/WalletCard.js +127 -0
  52. package/dist/modal/components/WalletCreationDoneStep/WalletCreationDoneStep.js +52 -0
  53. package/dist/modal/components/common.js +83 -0
  54. package/dist/modal/components/index.js +2 -0
  55. package/dist/modal/constants/constants.js +111 -0
  56. package/dist/modal/constants/defaults.js +10 -0
  57. package/dist/modal/constants/oAuthLogos.js +24 -0
  58. package/dist/modal/hooks/useActiveWallet.js +15 -0
  59. package/dist/modal/hooks/useCreateAccount.js +72 -0
  60. package/dist/modal/hooks/useEmbeddedExternalConnection.js +39 -0
  61. package/dist/modal/hooks/useGoBack.js +35 -0
  62. package/dist/modal/hooks/useSetLoginURLs.d.ts +8 -0
  63. package/dist/modal/hooks/useSetLoginURLs.js +45 -0
  64. package/dist/modal/index.js +32 -0
  65. package/dist/modal/providers/CosmosExternalWalletContextStub.js +34 -0
  66. package/dist/modal/providers/EvmExternalWalletContextStub.js +38 -0
  67. package/dist/modal/providers/ExternalWalletContext.js +275 -0
  68. package/dist/modal/providers/SolanaExternalWalletContextStub.js +19 -0
  69. package/dist/modal/stores/externalWalletProvider/actions.js +10 -0
  70. package/dist/modal/stores/externalWalletProvider/useExternalWalletProviderStore.js +20 -0
  71. package/dist/modal/stores/index.js +4 -0
  72. package/dist/modal/stores/modal/actions.js +70 -0
  73. package/dist/modal/stores/modal/useModalStore.js +65 -0
  74. package/dist/modal/stores/theme/actions.js +28 -0
  75. package/dist/modal/stores/theme/useThemeStore.js +21 -0
  76. package/dist/modal/stores/userInfo/actions.js +30 -0
  77. package/dist/modal/stores/userInfo/useUserInfoStore.js +17 -0
  78. package/dist/modal/types/commonTypes.js +1 -0
  79. package/dist/modal/types/externalWallets.js +31 -0
  80. package/dist/modal/types/modalProps.js +12 -0
  81. package/dist/modal/utils/authLayoutHelpers.js +8 -0
  82. package/dist/modal/utils/getMailtoLink.js +10 -0
  83. package/dist/modal/utils/getTileButtonFlex.js +20 -0
  84. package/dist/modal/utils/openPopup.js +60 -0
  85. package/dist/modal/utils/routeMobileExternalWallet.js +31 -0
  86. package/dist/modal/utils/steps.js +228 -0
  87. package/dist/modal/utils/stringFormatters.js +14 -0
  88. package/dist/modal/utils/validateOnRampConfig.js +32 -0
  89. package/dist/package.json +4 -0
  90. package/dist/provider/ParaProvider.js +22 -0
  91. package/dist/provider/actions/checkIfUserExists.js +21 -0
  92. package/dist/provider/actions/createUser.js +26 -0
  93. package/dist/provider/actions/getAccount.js +22 -0
  94. package/dist/provider/actions/getWallet.js +14 -0
  95. package/dist/provider/actions/initiateLogin.js +20 -0
  96. package/dist/provider/actions/keepSessionAlive.js +20 -0
  97. package/dist/provider/actions/logout.js +17 -0
  98. package/dist/provider/actions/signMessage.js +20 -0
  99. package/dist/provider/actions/signTransaction.js +20 -0
  100. package/dist/provider/actions/waitForAccountCreation.js +21 -0
  101. package/dist/provider/actions/waitForLoginAndSetup.js +24 -0
  102. package/dist/provider/actions/waitForPasskeyAndCreateWallet.js +21 -0
  103. package/dist/provider/hooks/index.js +4 -0
  104. package/dist/provider/hooks/mutations/index.js +24 -0
  105. package/dist/provider/hooks/mutations/useCheckIfUserExists.js +23 -0
  106. package/dist/provider/hooks/mutations/useCreateUser.js +20 -0
  107. package/dist/provider/hooks/mutations/useInitiateLogin.js +23 -0
  108. package/dist/provider/hooks/mutations/useKeepSessionAlive.js +20 -0
  109. package/dist/provider/hooks/mutations/useLogout.js +30 -0
  110. package/dist/provider/hooks/mutations/useSignMessage.js +33 -0
  111. package/dist/provider/hooks/mutations/useSignTransaction.js +33 -0
  112. package/dist/provider/hooks/mutations/useWaitForAccountCreation.js +30 -0
  113. package/dist/provider/hooks/mutations/useWaitForLoginAndSetup.js +30 -0
  114. package/dist/provider/hooks/mutations/useWaitForPasskeyAndCreateWallet.js +30 -0
  115. package/dist/provider/hooks/queries/index.js +8 -0
  116. package/dist/provider/hooks/queries/useAccount.js +21 -0
  117. package/dist/provider/hooks/queries/useWallet.js +22 -0
  118. package/dist/provider/hooks/utils/index.js +10 -0
  119. package/dist/provider/hooks/utils/useAutoSessionKeepAlive.js +74 -0
  120. package/dist/provider/hooks/utils/useClient.js +10 -0
  121. package/dist/provider/hooks/utils/useEventListeners.js +105 -0
  122. package/dist/provider/hooks/utils/useInternalClient.js +10 -0
  123. package/dist/provider/hooks/utils/useModal.js +17 -0
  124. package/dist/provider/hooks/utils/useWalletState.js +33 -0
  125. package/dist/provider/index.js +8 -0
  126. package/dist/provider/stores/getters.js +13 -0
  127. package/dist/provider/stores/slices/client.js +9 -0
  128. package/dist/provider/stores/slices/index.js +4 -0
  129. package/dist/provider/stores/slices/modal.js +9 -0
  130. package/dist/provider/stores/slices/wallet.js +11 -0
  131. package/dist/provider/stores/types.js +1 -0
  132. package/dist/provider/stores/useStore.js +27 -0
  133. package/dist/provider/types/provider.js +1 -0
  134. package/dist/provider/types/query.js +1 -0
  135. package/dist/provider/types/utils.js +1 -0
  136. package/dist/provider/utils/renameMutations.js +16 -0
  137. package/package.json +5 -5
  138. package/dist/MoonPayEmbed-Q2HP2BFI.js.br +0 -0
  139. package/dist/MoonPayEmbed-Q2HP2BFI.js.gz +0 -0
  140. package/dist/chunk-MMUBH76A.js.br +0 -0
  141. package/dist/chunk-MMUBH76A.js.gz +0 -0
  142. package/dist/index.js.br +0 -0
  143. package/dist/index.js.gz +0 -0
@@ -0,0 +1,127 @@
1
+ "use client";
2
+ import "../../../chunk-MMUBH76A.js";
3
+ import { jsx, jsxs } from "react/jsx-runtime";
4
+ import styled from "styled-components";
5
+ import { useModalStore, useThemeStore } from "../../stores/index.js";
6
+ import { CpslButton, CpslIdenticon, CpslText } from "@getpara/react-components";
7
+ import { truncateAddress } from "@getpara/web-sdk";
8
+ import { ModalStep } from "../../utils/steps.js";
9
+ import { useWalletState } from "../../../provider/index.js";
10
+ import { useInternalClient } from "../../../provider/hooks/utils/useInternalClient.js";
11
+ const ExternalWalletCard = ({ address, showAddFunds }) => {
12
+ var _a;
13
+ const para = useInternalClient();
14
+ const wallet = para.externalWallets[address];
15
+ if (!wallet) {
16
+ return null;
17
+ }
18
+ return /* @__PURE__ */ jsx(
19
+ SharedWalletCard,
20
+ {
21
+ address: (_a = wallet.ensName) != null ? _a : truncateAddress(wallet.address, wallet.type),
22
+ identiconHash: para.getIdenticonHash(wallet.id, wallet.type),
23
+ showAddFunds
24
+ }
25
+ );
26
+ };
27
+ const WalletCard = ({ id, type, showAddFunds }) => {
28
+ var _a, _b;
29
+ const para = useInternalClient();
30
+ const appName = useThemeStore((state) => state.appName);
31
+ const wallet = para.findWallet(id, type);
32
+ if (!wallet) {
33
+ return null;
34
+ }
35
+ const address = para.getDisplayAddress(wallet.id, { addressType: type });
36
+ return /* @__PURE__ */ jsx(
37
+ SharedWalletCard,
38
+ {
39
+ id: wallet.id,
40
+ type: wallet.type,
41
+ address: (_a = wallet.ensName) != null ? _a : truncateAddress(address, type, { prefix: para.cosmosPrefix }),
42
+ name: (_b = wallet.name) != null ? _b : `${appName ? `${appName} ` : ""}Wallet`,
43
+ identiconHash: para.getIdenticonHash(wallet.id, type),
44
+ showAddFunds
45
+ }
46
+ );
47
+ };
48
+ const SharedWalletCard = ({ address, name, identiconHash, showAddFunds, id, type }) => {
49
+ const onRampConfig = useModalStore((state) => state.onRampConfig);
50
+ const { setSelectedWallet } = useWalletState();
51
+ const setStep = useModalStore((state) => state.setStep);
52
+ const isAddFundsEnabled = onRampConfig.isBuyEnabled || onRampConfig.isReceiveEnabled;
53
+ const handleAddFundsClick = () => {
54
+ if (id && type) {
55
+ setSelectedWallet({ id, type });
56
+ isAddFundsEnabled && setStep(onRampConfig.isBuyEnabled ? ModalStep.ADD_FUNDS_BUY : ModalStep.ADD_FUNDS_RECEIVE);
57
+ }
58
+ };
59
+ return /* @__PURE__ */ jsxs(Container, { children: [
60
+ /* @__PURE__ */ jsxs(InnerContainer, { children: [
61
+ /* @__PURE__ */ jsx(CpslIdenticon, { size: "48px", hash: identiconHash }),
62
+ /* @__PURE__ */ jsxs(WalletNameContainer, { children: [
63
+ !!name && /* @__PURE__ */ jsx(Name, { color: "contrast", variant: "bodyL", weight: "semiBold", children: name }),
64
+ /* @__PURE__ */ jsx(Name, { color: "secondary", variant: "bodyS", weight: "medium", children: address })
65
+ ] })
66
+ ] }),
67
+ showAddFunds && isAddFundsEnabled && /* @__PURE__ */ jsx(AddFundsButton, { onClick: handleAddFundsClick, children: /* @__PURE__ */ jsx(CpslText, { variant: "bodyXS", color: "contrast", weight: "medium", children: "Add Funds" }) })
68
+ ] });
69
+ };
70
+ const WalletCards = styled.div`
71
+ display: flex;
72
+ flex-direction: column;
73
+ gap: 8px;
74
+ width: 100%;
75
+ `;
76
+ const Container = styled.div`
77
+ width: 100%;
78
+ padding: 24px;
79
+ display: flex;
80
+ justify-content: space-between;
81
+ align-items: center;
82
+ gap: 16px;
83
+ background-color: var(--cpsl-color-background-8);
84
+ border-radius: 16px;
85
+ `;
86
+ const InnerContainer = styled.div`
87
+ display: flex;
88
+ justify-content: flex-start;
89
+ gap: 8px;
90
+ align-items: center;
91
+ overflow: hidden;
92
+ `;
93
+ const WalletNameContainer = styled.div`
94
+ flex: 1;
95
+ display: flex;
96
+ flex-direction: column;
97
+ gap: 4px;
98
+ align-items: flex-start;
99
+ justify-content: center;
100
+ overflow: hidden;
101
+ `;
102
+ const Name = styled(CpslText)`
103
+ width: 100%;
104
+ &::part(text-element) {
105
+ line-height: 100%;
106
+ text-overflow: ellipsis;
107
+ overflow: hidden;
108
+ white-space: nowrap;
109
+ }
110
+ `;
111
+ const AddFundsButton = styled(CpslButton)`
112
+ --button-primary-background-color: var(--cpsl-color-card-surface);
113
+ --button-primary-hover-background-color: var(--cpsl-color-background-4);
114
+ --button-primary-color: var(--cpsl-color-text-contrast);
115
+ --button-primary-hover-color: var(--cpsl-color-text-contrast);
116
+ --button-primary-active-color: var(--cpsl-color-text-contrast);
117
+ --button-padding-start: 8px;
118
+ --button-padding-end: 8px;
119
+ --button-padding-top: 8px;
120
+ --button-padding-bottom: 8px;
121
+ --button-border-radius: 8px;
122
+ `;
123
+ export {
124
+ ExternalWalletCard,
125
+ WalletCard,
126
+ WalletCards
127
+ };
@@ -0,0 +1,52 @@
1
+ "use client";
2
+ import {
3
+ __async
4
+ } from "../../../chunk-MMUBH76A.js";
5
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
6
+ import { CpslButton, CpslText } from "@getpara/react-components";
7
+ import { StepContainer, InnerStepContainer, HeroIcon } from "../common.js";
8
+ import { useModalStore, useThemeStore } from "../../stores/index.js";
9
+ import { ModalStep } from "../../utils/steps.js";
10
+ import { WalletCard, WalletCards } from "../WalletCard/WalletCard.js";
11
+ import styled from "styled-components";
12
+ import { useInternalClient } from "../../../provider/hooks/utils/useInternalClient.js";
13
+ const WalletCreationDoneStep = ({ twoFactorAuthEnabled, onClose }) => {
14
+ const hideWallets = useThemeStore((state) => state.hideWallets);
15
+ const setStep = useModalStore((state) => state.setStep);
16
+ const isLogin = useModalStore((state) => state.isLogin());
17
+ const onRampConfig = useModalStore((state) => state.onRampConfig);
18
+ const para = useInternalClient();
19
+ const isOnRampConfigured = (onRampConfig == null ? void 0 : onRampConfig.isBuyEnabled) || (onRampConfig == null ? void 0 : onRampConfig.isReceiveEnabled) || (onRampConfig == null ? void 0 : onRampConfig.isWithdrawEnabled);
20
+ const handleNext = () => __async(void 0, null, function* () {
21
+ if (isLogin) {
22
+ if (!twoFactorAuthEnabled) {
23
+ setStep(ModalStep.LOGIN_DONE);
24
+ return;
25
+ }
26
+ const is2FAComplete = yield para.check2FAStatus();
27
+ setStep(is2FAComplete ? ModalStep.LOGIN_DONE : ModalStep.SETUP_2FA);
28
+ } else {
29
+ if (twoFactorAuthEnabled) {
30
+ setStep(ModalStep.SETUP_2FA);
31
+ } else {
32
+ onClose();
33
+ }
34
+ }
35
+ });
36
+ return /* @__PURE__ */ jsxs(StepContainer, { $wide: true, children: [
37
+ /* @__PURE__ */ jsx(CardContainer, { children: hideWallets ? /* @__PURE__ */ jsxs(Fragment, { children: [
38
+ /* @__PURE__ */ jsx(HeroIcon, { icon: "checkCircleFilled" }),
39
+ /* @__PURE__ */ jsx(CpslText, { variant: "bodyM", color: "secondary", weight: "medium", style: { marginTop: "16px" }, children: "Your account has been created." })
40
+ ] }) : /* @__PURE__ */ jsx(WalletCards, { children: para.currentWalletIdsArray.map(([id, type]) => {
41
+ return /* @__PURE__ */ jsx(WalletCard, { id, type, showAddFunds: isOnRampConfigured }, id);
42
+ }) }) }),
43
+ /* @__PURE__ */ jsx(InnerStepContainer, { children: /* @__PURE__ */ jsx(CpslButton, { fullWidth: true, onClick: handleNext, children: twoFactorAuthEnabled ? "Continue" : "Done" }) })
44
+ ] });
45
+ };
46
+ const CardContainer = styled(InnerStepContainer)`
47
+ min-height: 196px;
48
+ justify-content: center;
49
+ `;
50
+ export {
51
+ WalletCreationDoneStep
52
+ };
@@ -0,0 +1,83 @@
1
+ "use client";
2
+ import "../../chunk-MMUBH76A.js";
3
+ import { CpslIcon, CpslInput, CpslText, CpslTileButton } from "@getpara/react-components";
4
+ import { styled } from "styled-components";
5
+ const SpinnerContainer = styled.div`
6
+ display: flex;
7
+ align-items: center;
8
+ justify-content: center;
9
+ `;
10
+ const QRContainer = styled.div`
11
+ display: flex;
12
+ justify-content: center;
13
+ align-items: center;
14
+ width: 286px;
15
+ height: 286px;
16
+ `;
17
+ const InfoBoxContent = styled.div`
18
+ display: flex;
19
+ flex-direction: column;
20
+ gap: 8px;
21
+ `;
22
+ const InfoBoxHeader = styled.div`
23
+ display: flex;
24
+ align-items: center;
25
+ gap: 4px;
26
+
27
+ cpsl-icon {
28
+ --height: 20px;
29
+ --width: 20px;
30
+ }
31
+ `;
32
+ const FilledDisabledInput = styled(CpslInput)`
33
+ --container-border-color: var(--cpsl-color-input-border-placeholder);
34
+ --container-background-color: var(--cpsl-color-background-0);
35
+ --input-background-color: transparent;
36
+ --input-font-weight: 500;
37
+ --input-color: var(--cpsl-color-text-secondary);
38
+ `;
39
+ const FullWidthFilledDisabledInput = styled(FilledDisabledInput)`
40
+ width: 100%;
41
+ `;
42
+ const CenteredText = styled(CpslText)`
43
+ width: 100%;
44
+ text-align: center;
45
+ `;
46
+ const InnerStepContainer = styled.div`
47
+ width: 100%;
48
+ height: 100%;
49
+ align-self: center;
50
+ display: flex;
51
+ flex-direction: column;
52
+ align-items: center;
53
+ gap: 8px;
54
+ `;
55
+ const StepContainer = styled(InnerStepContainer)`
56
+ gap: ${({ $wide }) => $wide ? "32px" : "24px"};
57
+ `;
58
+ const Heading = styled(CenteredText)``;
59
+ const StyledCpslTileButton = styled(CpslTileButton)`
60
+ --button-width: 100%;
61
+ --button-height: 87px;
62
+ --button-icon-height: 32px;
63
+ --button-icon-width: 32px;
64
+ `;
65
+ const HeroIcon = styled(CpslIcon)`
66
+ --height: 80px;
67
+ --width: 80px;
68
+ --icon-color: var(--cpsl-color-text-primary);
69
+ `;
70
+ export {
71
+ CenteredText,
72
+ FilledDisabledInput,
73
+ FullWidthFilledDisabledInput,
74
+ Heading,
75
+ HeroIcon,
76
+ InfoBoxContent,
77
+ InfoBoxHeader,
78
+ InnerStepContainer,
79
+ QRContainer,
80
+ SpinnerContainer,
81
+ StepContainer,
82
+ StyledCpslTileButton
83
+ };
@@ -0,0 +1,2 @@
1
+ "use client";
2
+ export * from "./ModalContent/ModalContent.js";
@@ -0,0 +1,111 @@
1
+ "use client";
2
+ import "../../chunk-MMUBH76A.js";
3
+ import { Network, OnRampAsset, OnRampMethod, OnRampProvider } from "@getpara/core-sdk";
4
+ const PARA_CONNECT = "https://connect.getpara.com/";
5
+ const PARA_TERMS_AND_CONDITIONS = "https://getpara.com/terms";
6
+ const ON_RAMP_PROVIDERS = {
7
+ [OnRampProvider.STRIPE]: {
8
+ name: "Stripe",
9
+ feeLower: 0.99,
10
+ feeUpper: 4.49,
11
+ methods: [OnRampMethod.ACH, OnRampMethod.DEBIT, OnRampMethod.CREDIT],
12
+ icon: "stripeBrand",
13
+ backgroundColors: ["#6772E5", "#808AF4"]
14
+ },
15
+ [OnRampProvider.RAMP]: {
16
+ name: "Ramp",
17
+ feeLower: 0.99,
18
+ feeUpper: 4.49,
19
+ methods: [OnRampMethod.ACH, OnRampMethod.DEBIT, OnRampMethod.CREDIT],
20
+ icon: "rampNetworkBrand",
21
+ backgroundColors: ["#21BF73", "#3AE492"]
22
+ },
23
+ [OnRampProvider.MOONPAY]: {
24
+ name: "MoonPay",
25
+ feeLower: 1,
26
+ feeUpper: 4.5,
27
+ methods: [OnRampMethod.ACH, OnRampMethod.DEBIT, OnRampMethod.CREDIT],
28
+ icon: "moonpayBrand",
29
+ backgroundColors: ["#7715F5", "#9647fd"]
30
+ }
31
+ };
32
+ const NETWORKS = {
33
+ [Network.ETHEREUM]: { name: "Ethereum", icon: "ethereum" },
34
+ [Network.SEPOLIA]: { name: "Sepolia", icon: "ethereum" },
35
+ [Network.ARBITRUM]: { name: "Arbitrum", icon: "arbitrumBrand" },
36
+ [Network.BASE]: { name: "Base", icon: "baseBrand" },
37
+ [Network.OPTIMISM]: { name: "Optimism", icon: "optimismBrand" },
38
+ [Network.POLYGON]: { name: "Polygon", icon: "polygonBrand" },
39
+ [Network.SOLANA]: { name: "Solana", icon: "solana" },
40
+ [Network.COSMOS]: { name: "Cosmos", icon: "cosmos" },
41
+ [Network.CELO]: { name: "Celo", icon: "celoBrand" },
42
+ [Network.NOBLE]: { name: "Noble", icon: "nobleBrand" }
43
+ };
44
+ const ON_RAMP_ASSETS = {
45
+ [OnRampAsset.ETHEREUM]: { name: "Ethereum", code: "ETH", icon: "ethereum" },
46
+ [OnRampAsset.USDC]: { name: "USDC", code: "USDC", icon: "usdcBrand" },
47
+ [OnRampAsset.POLYGON]: { name: "Polygon", code: "MATIC", icon: "polygonBrand" },
48
+ [OnRampAsset.SOLANA]: { name: "Solana", code: "SOL", icon: "solana" },
49
+ [OnRampAsset.ATOM]: { name: "Atom", code: "ATOM", icon: "cosmos" },
50
+ [OnRampAsset.CELO]: { name: "Celo", code: "CELO", icon: "celoBrand" },
51
+ [OnRampAsset.TETHER]: { name: "Tether", code: "USDT", icon: "tetherBrand" },
52
+ [OnRampAsset.CUSD]: { name: "Celo Dollar", code: "CUSD", icon: "celoBrand" },
53
+ [OnRampAsset.CEUR]: { name: "Celo Euro", code: "CEUR", icon: "celoBrand" },
54
+ [OnRampAsset.CREAL]: { name: "Celo Real", code: "CREAL", icon: "celoBrand" }
55
+ };
56
+ function getNetworkName(str) {
57
+ var _a, _b;
58
+ return (_b = (_a = NETWORKS[str]) == null ? void 0 : _a.name) != null ? _b : `${str[0]}${str.slice(1).toLowerCase()}`;
59
+ }
60
+ function getNetworkIcon(str) {
61
+ var _a, _b;
62
+ return (_b = (_a = NETWORKS[str]) == null ? void 0 : _a.icon) != null ? _b : "globe";
63
+ }
64
+ function getAssetName(str) {
65
+ var _a, _b;
66
+ return (_b = (_a = ON_RAMP_ASSETS[str]) == null ? void 0 : _a.code) != null ? _b : str;
67
+ }
68
+ function getAssetIcon(str) {
69
+ var _a, _b;
70
+ return (_b = (_a = ON_RAMP_ASSETS[str]) == null ? void 0 : _a.icon) != null ? _b : "emptyCircle";
71
+ }
72
+ const MOBILE_SIZE = 480;
73
+ const NETWORK_NOT_SUPPORTED_ERROR = "network not supported";
74
+ 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,}))$/;
75
+ const BODY_MOTION_VARIANTS = {
76
+ enter: (direction) => {
77
+ return {
78
+ scale: direction > 0 ? 0.9 : 1.1,
79
+ opacity: 0
80
+ };
81
+ },
82
+ center: {
83
+ scale: 1,
84
+ opacity: 1
85
+ },
86
+ exit: (direction) => {
87
+ return {
88
+ scale: direction < 0 ? 0.9 : 1.1,
89
+ opacity: 0
90
+ };
91
+ }
92
+ };
93
+ const BODY_TRANSITION = {
94
+ duration: 0.2
95
+ };
96
+ export {
97
+ BODY_MOTION_VARIANTS,
98
+ BODY_TRANSITION,
99
+ EMAIL_REGEX,
100
+ MOBILE_SIZE,
101
+ NETWORKS,
102
+ NETWORK_NOT_SUPPORTED_ERROR,
103
+ ON_RAMP_ASSETS,
104
+ ON_RAMP_PROVIDERS,
105
+ PARA_CONNECT,
106
+ PARA_TERMS_AND_CONDITIONS,
107
+ getAssetIcon,
108
+ getAssetName,
109
+ getNetworkIcon,
110
+ getNetworkName
111
+ };
@@ -0,0 +1,10 @@
1
+ "use client";
2
+ import "../../chunk-MMUBH76A.js";
3
+ const DEFAULTS = {
4
+ LOGGIN_POLLING_DELAY_MS: 5e3,
5
+ POLLING_INTERVAL_MS: 2e3,
6
+ ANIMATION_DURATION: 0.15
7
+ };
8
+ export {
9
+ DEFAULTS
10
+ };
@@ -0,0 +1,24 @@
1
+ "use client";
2
+ import "../../chunk-MMUBH76A.js";
3
+ const brandedOAuthLogos = {
4
+ GOOGLE: "googleBrand",
5
+ TWITTER: "twitter",
6
+ APPLE: "apple",
7
+ DISCORD: "discordBrand",
8
+ FACEBOOK: "facebookBrand",
9
+ FARCASTER: "farcasterBrand",
10
+ TELEGRAM: "telegramBrand"
11
+ };
12
+ const oAuthLogos = {
13
+ GOOGLE: "google",
14
+ TWITTER: "twitter",
15
+ APPLE: "apple",
16
+ DISCORD: "discord",
17
+ FACEBOOK: "facebook",
18
+ FARCASTER: "farcaster",
19
+ TELEGRAM: "telegram"
20
+ };
21
+ export {
22
+ brandedOAuthLogos,
23
+ oAuthLogos
24
+ };
@@ -0,0 +1,15 @@
1
+ "use client";
2
+ import "../../chunk-MMUBH76A.js";
3
+ import { useMemo } from "react";
4
+ import { useWalletState } from "../../provider/index.js";
5
+ import { useInternalClient } from "../../provider/hooks/utils/useInternalClient.js";
6
+ function useActiveWallet() {
7
+ const client = useInternalClient();
8
+ const { selectedWallet } = useWalletState();
9
+ return useMemo(() => {
10
+ return client.findWallet(selectedWallet.id, selectedWallet.type, { forbidPregen: true });
11
+ }, [client, selectedWallet]);
12
+ }
13
+ export {
14
+ useActiveWallet
15
+ };
@@ -0,0 +1,72 @@
1
+ "use client";
2
+ import {
3
+ __async
4
+ } from "../../chunk-MMUBH76A.js";
5
+ import { useInternalClient } from "../../provider/hooks/utils/useInternalClient.js";
6
+ import { DEFAULTS } from "../constants/defaults.js";
7
+ import { useModalStore } from "../stores/index.js";
8
+ import { openPopup } from "../utils/openPopup.js";
9
+ import { ModalStep } from "../utils/steps.js";
10
+ import { useGoBack } from "./useGoBack.js";
11
+ function useCreateAccount() {
12
+ const para = useInternalClient();
13
+ const goBack = useGoBack();
14
+ const refs = useModalStore((state) => state.refs);
15
+ const setStep = useModalStore((state) => state.setStep);
16
+ const webAuthURLForCreate = useModalStore((state) => state.webAuthURLForCreate);
17
+ const setWebAuthURLForCreate = useModalStore((state) => state.setWebAuthURLForCreate);
18
+ const setIFrameUrl = useModalStore((state) => state.setIFrameUrl);
19
+ const awaitWalletCreationTransition = () => __async(this, null, function* () {
20
+ var _a;
21
+ const isComplete = yield para.waitForAccountCreation({ popupWindow: refs.popupWindow.current });
22
+ window.clearTimeout((_a = refs.poll.current) == null ? void 0 : _a.timeout);
23
+ refs.poll.current = void 0;
24
+ refs.popupWindow.current = void 0;
25
+ if (isComplete) {
26
+ setWebAuthURLForCreate("");
27
+ setIFrameUrl("");
28
+ setStep(ModalStep.AWAITING_WALLET_CREATION);
29
+ } else if (refs.currentStep.current === ModalStep.AWAITING_BIOMETRIC_CREATION) {
30
+ goBack();
31
+ }
32
+ });
33
+ return {
34
+ withPasskey: () => {
35
+ var _a, _b;
36
+ if (((_a = refs.poll.current) == null ? void 0 : _a.action) === "createPasskey") {
37
+ return;
38
+ }
39
+ clearTimeout((_b = refs.poll.current) == null ? void 0 : _b.timeout);
40
+ refs.popupWindow.current = openPopup({
41
+ url: webAuthURLForCreate,
42
+ target: "ParaPasskey",
43
+ type: "CREATE_PASSKEY",
44
+ current: refs.popupWindow.current
45
+ });
46
+ refs.poll.current = {
47
+ action: "createPasskey",
48
+ timeout: window.setTimeout(awaitWalletCreationTransition, DEFAULTS.POLLING_INTERVAL_MS)
49
+ };
50
+ if (refs.currentStep.current !== ModalStep.AWAITING_BIOMETRIC_CREATION) {
51
+ setStep(ModalStep.AWAITING_BIOMETRIC_CREATION);
52
+ }
53
+ },
54
+ withPassword: () => {
55
+ var _a, _b;
56
+ if (((_a = refs.poll.current) == null ? void 0 : _a.action) === "createPassword") {
57
+ return;
58
+ }
59
+ clearTimeout((_b = refs.poll.current) == null ? void 0 : _b.timeout);
60
+ refs.poll.current = {
61
+ action: "createPassword",
62
+ timeout: window.setTimeout(awaitWalletCreationTransition, DEFAULTS.POLLING_INTERVAL_MS)
63
+ };
64
+ if (refs.currentStep.current !== ModalStep.PASSWORD_CREATION) {
65
+ setStep(ModalStep.PASSWORD_CREATION);
66
+ }
67
+ }
68
+ };
69
+ }
70
+ export {
71
+ useCreateAccount
72
+ };
@@ -0,0 +1,39 @@
1
+ "use client";
2
+ import {
3
+ __async
4
+ } from "../../chunk-MMUBH76A.js";
5
+ import { useExternalWalletProviderStore } from "../stores/externalWalletProvider/useExternalWalletProviderStore.js";
6
+ const useEmbeddedExternalConnection = () => {
7
+ const connectParaEvmWallet = useExternalWalletProviderStore((state) => state.connectParaEvmWallet);
8
+ const EvmProvider = useExternalWalletProviderStore((state) => state.EvmProvider);
9
+ const evmContext = useExternalWalletProviderStore((state) => state.evmContext);
10
+ const connectParaCosmosWallet = useExternalWalletProviderStore((state) => state.connectParaCosmosWallet);
11
+ const CosmosProvider = useExternalWalletProviderStore((state) => state.CosmosProvider);
12
+ const cosmosContext = useExternalWalletProviderStore((state) => state.cosmosContext);
13
+ const connectEmbeddedToExternalConnectors = () => __async(void 0, null, function* () {
14
+ if (evmContext && EvmProvider && connectParaEvmWallet) {
15
+ try {
16
+ const { error } = yield connectParaEvmWallet();
17
+ if (error) {
18
+ console.warn("Failed to connect Para EVM wallet to Wagmi:", error);
19
+ }
20
+ } catch (err) {
21
+ console.warn("Error calling connectParaEvmWallet:", err);
22
+ }
23
+ }
24
+ if (cosmosContext && CosmosProvider && connectParaCosmosWallet) {
25
+ try {
26
+ const { error } = yield connectParaCosmosWallet();
27
+ if (error) {
28
+ console.warn("Failed to connect Para Cosmos wallet to Graz:", error);
29
+ }
30
+ } catch (err) {
31
+ console.warn("Error calling connectParaCosmosWallet:", err);
32
+ }
33
+ }
34
+ });
35
+ return connectEmbeddedToExternalConnectors;
36
+ };
37
+ export {
38
+ useEmbeddedExternalConnection
39
+ };
@@ -0,0 +1,35 @@
1
+ "use client";
2
+ import "../../chunk-MMUBH76A.js";
3
+ import { useExternalWallets } from "../providers/ExternalWalletContext.js";
4
+ import { useModalStore } from "../stores/index.js";
5
+ import { getAddFundsStep, ModalStep } from "../utils/steps.js";
6
+ const useGoBack = () => {
7
+ const currentStep = useModalStore((state) => state.step);
8
+ const setStep = useModalStore((state) => state.setStep);
9
+ const accountAddFundTab = useModalStore((state) => state.accountAddFundTab);
10
+ const decrementStep = useModalStore((state) => state.decrementStep);
11
+ const resetState = useModalStore((state) => state.resetState);
12
+ const { setChainIdSwitchingTo } = useExternalWallets();
13
+ const goBack = () => {
14
+ if (currentStep === ModalStep.ADD_FUNDS_AWAITING) {
15
+ setStep(getAddFundsStep(accountAddFundTab));
16
+ } else {
17
+ decrementStep();
18
+ }
19
+ switch (currentStep) {
20
+ case ModalStep.AUTH_MAIN:
21
+ case ModalStep.AUTH_MORE: {
22
+ resetState();
23
+ break;
24
+ }
25
+ case ModalStep.CHAIN_SWITCH: {
26
+ setChainIdSwitchingTo();
27
+ break;
28
+ }
29
+ }
30
+ };
31
+ return goBack;
32
+ };
33
+ export {
34
+ useGoBack
35
+ };
@@ -0,0 +1,8 @@
1
+ import { AuthType } from '@getpara/user-management-client';
2
+ import { AuthMethod } from '@getpara/web-sdk';
3
+ export declare const useSetLoginURLs: () => ({ supportedAuthMethods, authType, displayName, pfpUrl, }: {
4
+ supportedAuthMethods: Set<AuthMethod>;
5
+ authType: AuthType;
6
+ displayName?: string;
7
+ pfpUrl?: string;
8
+ }) => Promise<void>;
@@ -0,0 +1,45 @@
1
+ "use client";
2
+ import {
3
+ __async
4
+ } from "../../chunk-MMUBH76A.js";
5
+ import { AuthMethod, getPublicKeyHex } from "@getpara/web-sdk";
6
+ import { useModalStore } from "../stores/index.js";
7
+ import { useInternalClient } from "../../provider/hooks/utils/useInternalClient.js";
8
+ const useSetLoginURLs = () => {
9
+ const para = useInternalClient();
10
+ const setWebAuthURLForLogin = useModalStore((state) => state.setWebAuthURLForLogin);
11
+ const setPasswordURLForLogin = useModalStore((state) => state.setPasswordUrlForLogin);
12
+ const setSupportedAuthMethods = useModalStore((state) => state.setSupportedAuthMethods);
13
+ return (_0) => __async(void 0, [_0], function* ({
14
+ supportedAuthMethods,
15
+ authType,
16
+ displayName,
17
+ pfpUrl
18
+ }) {
19
+ setSupportedAuthMethods(supportedAuthMethods);
20
+ const res = yield para.touchSession();
21
+ const webAuthUrlForLogin = (supportedAuthMethods == null ? void 0 : supportedAuthMethods.has(AuthMethod.PASSKEY)) ? yield para.getWebAuthURLForLogin({
22
+ sessionId: res.data.sessionId,
23
+ loginEncryptionPublicKey: getPublicKeyHex(para.loginEncryptionKeyPair),
24
+ partnerId: res.data.partnerId,
25
+ newDeviceSessionId: res.data.sessionLookupId,
26
+ newDeviceEncryptionKey: getPublicKeyHex(para.loginEncryptionKeyPair),
27
+ authType,
28
+ displayName,
29
+ pfpUrl
30
+ }) : void 0;
31
+ const passwordAuthUrlForLogin = (supportedAuthMethods == null ? void 0 : supportedAuthMethods.has(AuthMethod.PASSWORD)) ? yield para.getPasswordURLForLogin({
32
+ sessionId: res.data.sessionId,
33
+ loginEncryptionPublicKey: getPublicKeyHex(para.loginEncryptionKeyPair),
34
+ partnerId: res.data.partnerId,
35
+ authType,
36
+ displayName,
37
+ pfpUrl
38
+ }) : void 0;
39
+ setWebAuthURLForLogin(webAuthUrlForLogin);
40
+ setPasswordURLForLogin(passwordAuthUrlForLogin);
41
+ });
42
+ };
43
+ export {
44
+ useSetLoginURLs
45
+ };
@@ -0,0 +1,32 @@
1
+ "use client";
2
+ import "../chunk-MMUBH76A.js";
3
+ export * from "./ParaModal.js";
4
+ import { ModalStep } from "./utils/steps.js";
5
+ import { AuthLayout } from "./types/modalProps.js";
6
+ export * from "./utils/openPopup.js";
7
+ import {
8
+ ON_RAMP_PROVIDERS,
9
+ ON_RAMP_ASSETS,
10
+ NETWORKS,
11
+ getAssetIcon,
12
+ getAssetName,
13
+ getNetworkIcon,
14
+ getNetworkName
15
+ } from "./constants/constants.js";
16
+ import { SaveRecoverySecret } from "./components/RecoverySecretStep/RecoverySecretStep.js";
17
+ export * from "./utils/validateOnRampConfig.js";
18
+ export * from "./types/externalWallets.js";
19
+ import { useExternalWalletProviderStore } from "./stores/externalWalletProvider/useExternalWalletProviderStore.js";
20
+ export {
21
+ AuthLayout,
22
+ ModalStep,
23
+ NETWORKS,
24
+ ON_RAMP_ASSETS,
25
+ ON_RAMP_PROVIDERS,
26
+ SaveRecoverySecret,
27
+ getAssetIcon,
28
+ getAssetName,
29
+ getNetworkIcon,
30
+ getNetworkName,
31
+ useExternalWalletProviderStore
32
+ };