@getpara/react-sdk-lite 2.0.0-alpha.53 → 2.0.0-dev.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. package/dist/modal/ParaModal.js +1 -0
  2. package/dist/modal/components/Account/AccountProfileLink.js +3 -3
  3. package/dist/modal/components/AddFunds/AddFunds.js +2 -3
  4. package/dist/modal/components/AddFunds/AddFundsContext.d.ts +5 -5
  5. package/dist/modal/components/AwaitingAccountStep/AwaitingAccountStep.d.ts +1 -0
  6. package/dist/modal/components/{AwaitingIFrameStep/AwaitingIFrameStep.js → AwaitingAccountStep/AwaitingAccountStep.js} +2 -2
  7. package/dist/modal/components/Body/Body.js +37 -88
  8. package/dist/modal/components/Header/hooks/useStepTitle.js +1 -1
  9. package/dist/modal/components/OAuth/FarcasterLink.d.ts +2 -0
  10. package/dist/modal/components/OAuth/FarcasterLink.js +30 -0
  11. package/dist/modal/components/OAuth/FarcasterOAuthStep.d.ts +1 -3
  12. package/dist/modal/components/OAuth/FarcasterOAuthStep.js +47 -26
  13. package/dist/modal/components/OAuth/OAuth.js +2 -2
  14. package/dist/modal/components/OAuth/TelegramOAuthStep.js +2 -1
  15. package/dist/modal/components/common.d.ts +3 -3
  16. package/dist/modal/constants/constants.d.ts +8 -8
  17. package/dist/modal/constants/constants.js +25 -25
  18. package/dist/modal/hooks/useFarcasterLogin.d.ts +9 -0
  19. package/dist/modal/hooks/useFarcasterLogin.js +70 -0
  20. package/dist/modal/hooks/useTelegramLogin.d.ts +4 -3
  21. package/dist/modal/hooks/useTelegramLogin.js +11 -3
  22. package/dist/modal/stores/modal/actions.js +0 -1
  23. package/dist/modal/stores/modal/useModalStore.d.ts +0 -2
  24. package/dist/modal/stores/modal/useModalStore.js +0 -1
  25. package/dist/modal/utils/steps.d.ts +6 -3
  26. package/dist/modal/utils/steps.js +14 -8
  27. package/dist/modal/utils/stringFormatters.d.ts +2 -2
  28. package/dist/provider/ParaProviderMin.js +3 -4
  29. package/dist/provider/actions/index.d.ts +9 -9
  30. package/dist/provider/components/ExternalWalletWrapper.js +0 -5
  31. package/dist/provider/hooks/mutations/useCreatePregenWallet.d.ts +3 -3
  32. package/dist/provider/hooks/mutations/useSignUpOrLogIn.d.ts +3 -3
  33. package/dist/provider/hooks/mutations/useVerifyFarcaster.d.ts +6 -3
  34. package/dist/provider/hooks/mutations/useVerifyNewAccount.d.ts +3 -3
  35. package/dist/provider/hooks/mutations/useVerifyOAuth.d.ts +3 -3
  36. package/dist/provider/hooks/mutations/useVerifyTelegram.d.ts +9 -6
  37. package/dist/provider/providers/AccountLinkProvider.js +1 -1
  38. package/dist/provider/providers/AuthProvider.d.ts +4 -3
  39. package/dist/provider/providers/AuthProvider.js +102 -50
  40. package/dist/provider/providers/ExternalWalletProvider.js +6 -14
  41. package/dist/provider/stores/types.d.ts +2 -2
  42. package/package.json +8 -8
  43. package/dist/modal/components/AwaitingIFrameStep/AwaitingIFrameStep.d.ts +0 -1
  44. package/dist/modal/utils/renderTextWithLinks.d.ts +0 -2
  45. package/dist/modal/utils/renderTextWithLinks.js +0 -34
@@ -168,6 +168,7 @@ const ParaModal = forwardRef((props, ref) => {
168
168
  yield disconnectExternalWallet();
169
169
  setSelectedWallet({ id: void 0, type: void 0 });
170
170
  }
171
+ yield para.logout();
171
172
  if (shouldAutoLogin) {
172
173
  if (defaultAuthIdentifier && ((_a2 = para.authInfo) == null ? void 0 : _a2.identifier) !== defaultAuthIdentifier) {
173
174
  const number = parsePhoneNumberFromString(defaultAuthIdentifier);
@@ -9,7 +9,7 @@ import { useEffect, useMemo } from "react";
9
9
  import { HeroAccountTypeIcon, HeroSuccessIcon } from "../common.js";
10
10
  import { VerificationCode } from "../VerificationCodeStep/VerificationCodeStep.js";
11
11
  import { extractAuthInfo } from "@getpara/user-management-client";
12
- import { FarcasterConnectQR } from "../OAuth/FarcasterOAuthStep.js";
12
+ import { FarcasterLink } from "../OAuth/FarcasterLink.js";
13
13
  import { useTelegramLogin } from "../../hooks/useTelegramLogin.js";
14
14
  import { TelegramIFrame } from "../OAuth/TelegramOAuthStep.js";
15
15
  import { AuthInput } from "../AuthInput/AuthInput.js";
@@ -35,7 +35,7 @@ function AccountProfileLink() {
35
35
  isLoaded,
36
36
  setIsLoaded
37
37
  } = useTelegramLogin(
38
- isTelegram ? { isActive: isTelegram, status: linkAccountStatus, onSubmit: verifyTelegramLink } : { isActive: false }
38
+ isTelegram ? { isActive: isTelegram, status: linkAccountStatus, onSubmit: verifyTelegramLink, isLinking: true } : { isActive: false, isLinking: true }
39
39
  ), status = (accountLinkInProgress == null ? void 0 : accountLinkInProgress.isComplete) ? "success" : isTelegram ? telegramStatus : linkAccountStatus, commonWallet = useMemo(() => {
40
40
  const wallet = wallets.find(
41
41
  (w) => [w.name, w.internalId, w.id].includes(externalWalletProvider != null ? externalWalletProvider : "") && w.type === externalWalletType
@@ -140,7 +140,7 @@ function AccountProfileLink() {
140
140
  break;
141
141
  // Farcaster Connect QR
142
142
  case (accountLinkType === "FARCASTER" && status !== "success"):
143
- lower2 = /* @__PURE__ */ jsx(FarcasterConnectQR, {});
143
+ lower2 = /* @__PURE__ */ jsx(FarcasterLink, {});
144
144
  break;
145
145
  // OAuth, External Wallet, Telegram
146
146
  default:
@@ -17,7 +17,6 @@ import { AnimatePresence } from "framer-motion";
17
17
  import { AddFundsSettings } from "./AddFundsSettings.js";
18
18
  import { WalletSelectOld } from "../WalletSelectOld/WalletSelectOld.js";
19
19
  const AddFunds = () => {
20
- var _a;
21
20
  const step = useModalStore((state) => state.step);
22
21
  const onRampConfig = useModalStore((state) => state.onRampConfig);
23
22
  const onRampStep = useModalStore((state) => state.onRampStep);
@@ -30,7 +29,7 @@ const AddFunds = () => {
30
29
  const tabs = TABS.filter(
31
30
  ([enabledFlow, key]) => !!(onRampConfig == null ? void 0 : onRampConfig[key]) && (!isGuestMode || enabledFlow === EnabledFlow.RECEIVE)
32
31
  );
33
- const tab = storedTab != null ? storedTab : (_a = tabs[0]) == null ? void 0 : _a[0];
32
+ const tab = storedTab != null ? storedTab : tabs[0][0];
34
33
  const isMultiFlow = (tab === EnabledFlow.BUY || tab === EnabledFlow.RECEIVE) && (onRampConfig == null ? void 0 : onRampConfig.isBuyEnabled) && (onRampConfig == null ? void 0 : onRampConfig.isReceiveEnabled);
35
34
  const onSetTab = (event) => {
36
35
  setModalStep(getAddFundsStep(event.detail.tab));
@@ -53,7 +52,7 @@ const AddFunds = () => {
53
52
  useEffect(() => {
54
53
  setOnRampPurchase(void 0);
55
54
  }, []);
56
- if (!onRampConfig || !activeWallet || !tab) {
55
+ if (!onRampConfig || !activeWallet) {
57
56
  return /* @__PURE__ */ jsx(SpinnerContainer, { children: /* @__PURE__ */ jsx(CpslSpinner, {}) });
58
57
  }
59
58
  return /* @__PURE__ */ jsxs(StepContainer, { children: [
@@ -1,6 +1,6 @@
1
1
  import { Dispatch, PropsWithChildren, ReactNode, SetStateAction } from 'react';
2
2
  import { useWallet } from '../../../provider/hooks/index.js';
3
- import { EnabledFlow, TNetwork, TOnRampAsset, OnRampConfig, OnRampProvider } from '@getpara/web-sdk';
3
+ import { EnabledFlow, Network, OnRampAsset, OnRampConfig, OnRampProvider } from '@getpara/web-sdk';
4
4
  import { IconType } from '@getpara/react-components';
5
5
  export type Tab = EnabledFlow;
6
6
  export declare const TABS: [
@@ -10,14 +10,14 @@ export declare const TABS: [
10
10
  ReactNode
11
11
  ][];
12
12
  type Value = {
13
- network: TNetwork | undefined;
13
+ network: Network | undefined;
14
14
  setNetwork: Dispatch<SetStateAction<Value['network']>>;
15
- asset: TOnRampAsset | undefined;
15
+ asset: OnRampAsset | undefined;
16
16
  setAsset: Dispatch<SetStateAction<Value['asset']>>;
17
17
  fiatQuantity: string | undefined;
18
18
  setFiatQuantity: Dispatch<SetStateAction<Value['fiatQuantity']>>;
19
- networks: TNetwork[];
20
- assets: TOnRampAsset[];
19
+ networks: Network[];
20
+ assets: OnRampAsset[];
21
21
  isProviderAllowed: Partial<Record<OnRampProvider, boolean>>;
22
22
  tab: Tab;
23
23
  activeWallet: ReturnType<typeof useWallet>['data'];
@@ -0,0 +1 @@
1
+ export declare const AwaitingAccountStep: () => import("react/jsx-runtime").JSX.Element;
@@ -3,10 +3,10 @@ import "../../../chunk-MMUBH76A.js";
3
3
  import { jsx } from "react/jsx-runtime";
4
4
  import { useModalStore } from "../../stores/index.js";
5
5
  import { Waiting } from "../Waiting/Waiting.js";
6
- const AwaitingIFrameStep = () => {
6
+ const AwaitingAccountStep = () => {
7
7
  const isLogin = useModalStore((state) => state.isLogin());
8
8
  return /* @__PURE__ */ jsx(Waiting, { heading: isLogin ? "Logging you in..." : "Creating your account..." });
9
9
  };
10
10
  export {
11
- AwaitingIFrameStep
11
+ AwaitingAccountStep
12
12
  };
@@ -18,7 +18,7 @@ import { TwoFactorDoneStep } from "../TwoFactorDoneStep/TwoFactorDoneStep.js";
18
18
  import { BiometricCreationStep } from "../BiometricCreationStep/BiometricCreationStep.js";
19
19
  import { AwaitingOAuthStep } from "../AwaitingOAuthStep/AwaitingOAuthStep.js";
20
20
  import { AddFundsAwaiting, AddFundsDone, AddFunds } from "../AddFunds/index.js";
21
- import FarcasterOAuthStep from "../OAuth/FarcasterOAuthStep.js";
21
+ import { FarcasterOAuthStep } from "../OAuth/FarcasterOAuthStep.js";
22
22
  import { Header } from "../Header/Header.js";
23
23
  import { AuthMainStep } from "../AuthMainStep/AuthMainStep.js";
24
24
  import { BODY_MOTION_VARIANTS, BODY_TRANSITION, MOBILE_SIZE } from "../../constants/constants.js";
@@ -42,9 +42,8 @@ import { AccountProfileLinkOptions } from "../Account/AccountProfileLinkOptions.
42
42
  import { AccountProfileLink } from "../Account/AccountProfileLink.js";
43
43
  import { AccountProfileUnlink } from "../Account/AccountProfileUnlink.js";
44
44
  import { ExternalWalletNetworkSelectStep } from "../ExternalWalletNetworkSelectStep/ExternalWalletNetworkSelectStep.js";
45
- import { AwaitingIFrameStep } from "../AwaitingIFrameStep/AwaitingIFrameStep.js";
45
+ import { AwaitingAccountStep } from "../AwaitingAccountStep/AwaitingAccountStep.js";
46
46
  import { Footer } from "../Footer/Footer.js";
47
- import { renderTextWithLinks } from "../../utils/renderTextWithLinks.js";
48
47
  const MIN_HEIGHT = {
49
48
  [ModalStep.ADD_FUNDS_AWAITING]: "680px"
50
49
  };
@@ -67,8 +66,6 @@ const Body = ({
67
66
  const setStepDirection = useModalStore((state) => state.setStepDirection);
68
67
  const accountAddFundTab = useModalStore((state) => state.accountAddFundTab);
69
68
  const setAccountAddFundTab = useModalStore((state) => state.setAccountAddFundTab);
70
- const modalError = useModalStore((state) => state.modalError);
71
- const setModalError = useModalStore((state) => state.setModalError);
72
69
  const embeddedModal = useStore((state) => {
73
70
  var _a;
74
71
  return (_a = state.modalConfig) == null ? void 0 : _a.embeddedModal;
@@ -192,8 +189,8 @@ const Body = ({
192
189
  case ModalStep.EX_WALLET_NETWORK_SELECT: {
193
190
  return /* @__PURE__ */ jsx(ExternalWalletNetworkSelectStep, {});
194
191
  }
195
- case ModalStep.AWAITING_IFRAME: {
196
- return /* @__PURE__ */ jsx(AwaitingIFrameStep, {});
192
+ case ModalStep.AWAITING_ACCOUNT: {
193
+ return /* @__PURE__ */ jsx(AwaitingAccountStep, {});
197
194
  }
198
195
  default: {
199
196
  if (IFrameSteps.includes(currentStep)) {
@@ -237,7 +234,7 @@ const Body = ({
237
234
  setStepDirection(1);
238
235
  },
239
236
  custom: stepDirection,
240
- children: /* @__PURE__ */ jsxs(
237
+ children: /* @__PURE__ */ jsx(
241
238
  BodyContainer,
242
239
  {
243
240
  custom: stepDirection,
@@ -246,38 +243,32 @@ const Body = ({
246
243
  animate: "center",
247
244
  exit: "exit",
248
245
  transition: BODY_TRANSITION,
249
- children: [
250
- /* @__PURE__ */ jsxs(
251
- InnerContainer,
252
- {
253
- $embeddedModal: !!embeddedModal,
254
- $step: currentStep,
255
- $isIFrameStep: IFrameSteps.includes(currentStep),
256
- children: [
257
- /* @__PURE__ */ jsx(NetworkSpeedBanner, { fontSize: "12px", iconSize: "16px" }),
258
- Content(),
259
- (onRampConfig == null ? void 0 : onRampConfig.testMode) && [
260
- ModalStep.ADD_FUNDS_BUY,
261
- ModalStep.ADD_FUNDS_WITHDRAW,
262
- ModalStep.ADD_FUNDS_AWAITING,
263
- ModalStep.ADD_FUNDS_FAILURE,
264
- ModalStep.ADD_FUNDS_SUCCESS
265
- ].includes(currentStep) && isTestModeAlert && accountAddFundTab !== EnabledFlow.RECEIVE && /* @__PURE__ */ jsx(TestModeAlert, { children: /* @__PURE__ */ jsxs("div", { style: { fontSize: "14px" }, children: [
266
- "This Para Modal is configured to run on-ramp services in ",
267
- /* @__PURE__ */ jsx("b", { children: "test mode" }),
268
- " only, for development purposes. If you are a user of ",
269
- appName,
270
- ", please contact support.",
271
- /* @__PURE__ */ jsx(CloseButton, { onClick: () => setIsTestModeAlert(false), children: /* @__PURE__ */ jsx(CloseX, { icon: "x" }) })
272
- ] }) })
273
- ]
274
- }
275
- ),
276
- modalError && /* @__PURE__ */ jsx(ModalErrorAlert, { children: /* @__PURE__ */ jsxs(ErrorContent, { children: [
277
- /* @__PURE__ */ jsx(ErrorCloseButton, { onClick: () => setModalError(void 0), children: /* @__PURE__ */ jsx(ErrorCloseIcon, { icon: "x" }) }),
278
- /* @__PURE__ */ jsx(ErrorText, { children: renderTextWithLinks(modalError) })
279
- ] }) })
280
- ]
246
+ children: /* @__PURE__ */ jsxs(
247
+ InnerContainer,
248
+ {
249
+ $embeddedModal: !!embeddedModal,
250
+ $step: currentStep,
251
+ $isIFrameStep: IFrameSteps.includes(currentStep),
252
+ children: [
253
+ /* @__PURE__ */ jsx(NetworkSpeedBanner, { fontSize: "12px", iconSize: "16px" }),
254
+ Content(),
255
+ (onRampConfig == null ? void 0 : onRampConfig.testMode) && [
256
+ ModalStep.ADD_FUNDS_BUY,
257
+ ModalStep.ADD_FUNDS_WITHDRAW,
258
+ ModalStep.ADD_FUNDS_AWAITING,
259
+ ModalStep.ADD_FUNDS_FAILURE,
260
+ ModalStep.ADD_FUNDS_SUCCESS
261
+ ].includes(currentStep) && isTestModeAlert && accountAddFundTab !== EnabledFlow.RECEIVE && /* @__PURE__ */ jsx(TestModeAlert, { children: /* @__PURE__ */ jsxs("div", { style: { fontSize: "14px" }, children: [
262
+ "This Para Modal is configured to run on-ramp services in ",
263
+ /* @__PURE__ */ jsx("b", { children: "test mode" }),
264
+ " only, for development purposes. If you are a user of ",
265
+ appName,
266
+ ", please contact support.",
267
+ /* @__PURE__ */ jsx(CloseButton, { onClick: () => setIsTestModeAlert(false), children: /* @__PURE__ */ jsx(CloseX, { icon: "x" }) })
268
+ ] }) })
269
+ ]
270
+ }
271
+ )
281
272
  },
282
273
  ["ADD_FUNDS_BUY", "ADD_FUNDS_RECEIVE", "ADD_FUNDS_WITHDRAW"].includes(currentStep) ? "ADD_FUNDS" : currentStep
283
274
  )
@@ -300,7 +291,7 @@ const BodyContainer = safeStyled(motion.div)`
300
291
  position: relative;
301
292
  display: flex;
302
293
  flex-direction: column;
303
- gap: 12px;
294
+ gap: 24px;
304
295
  will-change: auto !important;
305
296
  `;
306
297
  const InnerContainer = safeStyled.div`
@@ -339,59 +330,17 @@ const TestModeAlert = safeStyled(CpslAlert)`
339
330
  right: 16px;
340
331
  z-index: 1000;
341
332
  `;
342
- const ModalErrorAlert = safeStyled.div`
343
- background: #fffcec;
344
- border: 2px solid var(--cpsl-color-utility-yellow);
345
- border-radius: 4px;
346
- padding: 8px 8px;
347
- `;
348
- const ErrorContent = safeStyled.div`
349
- display: flex;
350
- align-items: flex-start;
351
- gap: 8px;
352
- position: relative;
353
- `;
354
- const ErrorText = safeStyled.div`
355
- flex: 1;
356
- font-size: 14px;
357
- line-height: 1.4;
358
- color: var(--cpsl-color-black);
359
- font-weight: 400;
360
- `;
361
- const ErrorCloseButton = safeStyled.button`
362
- background-color: transparent;
363
- border: none;
364
- padding: 0;
365
- cursor: pointer;
366
- flex-shrink: 0;
367
- display: flex;
368
- align-items: center;
369
- justify-content: center;
370
- width: 20px;
371
- height: 20px;
372
- margin-top: 1px;
373
- `;
374
- const ErrorCloseIcon = safeStyled(CpslIcon)`
375
- --icon-color: var(--cpsl-color-utility-yellow);
376
- --height: 20px;
377
- --width: 20px;
378
- `;
379
333
  const CloseButton = safeStyled.button`
380
334
  background-color: transparent;
381
335
  border: none;
382
- padding: 0;
336
+ padding: 4px;
383
337
  cursor: pointer;
384
- flex-shrink: 0;
385
- display: flex;
386
- align-items: center;
387
- justify-content: center;
388
- width: 20px;
389
- height: 20px;
338
+ position: absolute;
339
+ top: 0;
340
+ right: 0;
390
341
  `;
391
342
  const CloseX = safeStyled(CpslIcon)`
392
- --icon-color: var(--cpsl-color-utility-yellow-dark, #92400e);
393
- --height: 18px;
394
- --width: 18px;
343
+ --icon-color: var(--cpsl-color-foreground-0);
395
344
  `;
396
345
  export {
397
346
  Body
@@ -69,7 +69,7 @@ const useStepTitle = () => {
69
69
  [ModalStep.ACCOUNT_PROFILE_LIST]: "Link Account",
70
70
  [ModalStep.ACCOUNT_PROFILE_ADD]: "Link Account",
71
71
  [ModalStep.ACCOUNT_PROFILE_REMOVE]: "Unlink Account",
72
- [ModalStep.AWAITING_IFRAME]: isLogin ? "Login" : "Sign Up"
72
+ [ModalStep.AWAITING_ACCOUNT]: isLogin ? "Login" : "Sign Up"
73
73
  }),
74
74
  [isLogin, chainId, hideWallets, authStepTitle]
75
75
  );
@@ -0,0 +1,2 @@
1
+ export declare function FarcasterConnectQR(): import("react/jsx-runtime").JSX.Element;
2
+ export declare const FarcasterLink: () => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,30 @@
1
+ "use client";
2
+ import "../../../chunk-MMUBH76A.js";
3
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
4
+ import { CpslButton, CpslIcon, CpslQrCode, CpslSpinner, CpslText } from "@getpara/react-components";
5
+ import { CenteredText, Heading, InnerStepContainer, QRContainer, StepContainer } from "../common.js";
6
+ import { useModalStore } from "../../stores/index.js";
7
+ import { isMobile } from "@getpara/web-sdk";
8
+ function FarcasterConnectQR() {
9
+ const farcasterConnectUri = useModalStore((state) => state.farcasterConnectUri);
10
+ return /* @__PURE__ */ jsx(Fragment, { children: isMobile() ? /* @__PURE__ */ jsxs(InnerStepContainer, { children: [
11
+ /* @__PURE__ */ jsx(CpslText, { weight: "medium", color: "secondary", children: `Don\u2019t have Farcaster` }),
12
+ /* @__PURE__ */ jsxs(CpslButton, { as: "a", href: "https://link.warpcast.com/download-qr", target: "_blank", variant: "secondary", children: [
13
+ /* @__PURE__ */ jsx(CpslIcon, { slot: "start", icon: "linkExternal" }),
14
+ `Get Farcaster`
15
+ ] })
16
+ ] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
17
+ /* @__PURE__ */ jsx(Heading, { children: "Sign in using Farcaster" }),
18
+ /* @__PURE__ */ jsxs(InnerStepContainer, { children: [
19
+ /* @__PURE__ */ jsx(CenteredText, { variant: "bodyS", color: "secondary", weight: "medium", children: "Scan the QR code with your phone's camera to proceed." }),
20
+ /* @__PURE__ */ jsx(QRContainer, { children: !farcasterConnectUri ? /* @__PURE__ */ jsx(CpslSpinner, { size: 100 }) : /* @__PURE__ */ jsx(CpslQrCode, { url: farcasterConnectUri }) })
21
+ ] })
22
+ ] }) });
23
+ }
24
+ const FarcasterLink = () => {
25
+ return /* @__PURE__ */ jsx(StepContainer, { $wide: true, children: /* @__PURE__ */ jsx(FarcasterConnectQR, {}) });
26
+ };
27
+ export {
28
+ FarcasterConnectQR,
29
+ FarcasterLink
30
+ };
@@ -1,3 +1 @@
1
- export declare function FarcasterConnectQR(): import("react/jsx-runtime").JSX.Element;
2
- declare const FarcasterOAuthStep: () => import("react/jsx-runtime").JSX.Element;
3
- export default FarcasterOAuthStep;
1
+ export declare function FarcasterOAuthStep(): import("react/jsx-runtime").JSX.Element;
@@ -1,31 +1,52 @@
1
1
  "use client";
2
2
  import "../../../chunk-MMUBH76A.js";
3
- import { Fragment, jsx, jsxs } from "react/jsx-runtime";
4
- import { CpslButton, CpslIcon, CpslQrCode, CpslSpinner, CpslText } from "@getpara/react-components";
5
- import { CenteredText, Heading, InnerStepContainer, QRContainer, StepContainer } from "../common.js";
6
- import { useModalStore } from "../../stores/index.js";
7
- import { isMobile } from "@getpara/web-sdk";
8
- function FarcasterConnectQR() {
9
- const farcasterConnectUri = useModalStore((state) => state.farcasterConnectUri);
10
- return /* @__PURE__ */ jsx(Fragment, { children: isMobile() ? /* @__PURE__ */ jsxs(InnerStepContainer, { children: [
11
- /* @__PURE__ */ jsx(CpslText, { weight: "medium", color: "secondary", children: `Don\u2019t have Farcaster` }),
12
- /* @__PURE__ */ jsxs(CpslButton, { as: "a", href: "https://link.warpcast.com/download-qr", target: "_blank", variant: "secondary", children: [
13
- /* @__PURE__ */ jsx(CpslIcon, { slot: "start", icon: "linkExternal" }),
14
- `Get Farcaster`
15
- ] })
16
- ] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
17
- /* @__PURE__ */ jsx(Heading, { children: "Sign in using Farcaster" }),
18
- /* @__PURE__ */ jsxs(InnerStepContainer, { children: [
19
- /* @__PURE__ */ jsx(CenteredText, { variant: "bodyS", color: "secondary", weight: "medium", children: "Scan the QR code with your phone's camera to proceed." }),
20
- /* @__PURE__ */ jsx(QRContainer, { children: !farcasterConnectUri ? /* @__PURE__ */ jsx(CpslSpinner, { size: 100 }) : /* @__PURE__ */ jsx(CpslQrCode, { url: farcasterConnectUri }) })
21
- ] })
22
- ] }) });
3
+ import { jsx, jsxs } from "react/jsx-runtime";
4
+ import { CpslSpinner } from "@getpara/react-components";
5
+ import { useFarcasterLogin } from "../../hooks/useFarcasterLogin.js";
6
+ import { safeStyled } from "@getpara/react-common";
7
+ import { useEffect, useState } from "react";
8
+ import { getPortalBaseURL } from "@getpara/web-sdk";
9
+ import { useInternalClient } from "../../../provider/hooks/utils/useInternalClient.js";
10
+ function FarcasterOAuthStep() {
11
+ const { url, isLoaded, setIsLoaded } = useFarcasterLogin({
12
+ isActive: true
13
+ });
14
+ const para = useInternalClient();
15
+ const [height, setHeight] = useState(0);
16
+ useEffect(() => {
17
+ const handleMessage = (event) => {
18
+ if (!url) {
19
+ return;
20
+ }
21
+ const portalBase = getPortalBaseURL(para.ctx);
22
+ if (!event.origin.startsWith(portalBase)) {
23
+ return;
24
+ }
25
+ if (event.data) {
26
+ if (event.data.type === "HEIGHT") {
27
+ setHeight(event.data.height);
28
+ }
29
+ }
30
+ };
31
+ window.addEventListener("message", handleMessage);
32
+ return () => window.removeEventListener("message", handleMessage);
33
+ }, [url]);
34
+ return /* @__PURE__ */ jsxs(Container, { children: [
35
+ url && /* @__PURE__ */ jsx(IFrame, { style: { display: isLoaded ? "block" : "none", height }, src: url, onLoad: () => setIsLoaded(true) }),
36
+ (!url || !isLoaded) && /* @__PURE__ */ jsx(CpslSpinner, {})
37
+ ] });
23
38
  }
24
- const FarcasterOAuthStep = () => {
25
- return /* @__PURE__ */ jsx(StepContainer, { $wide: true, children: /* @__PURE__ */ jsx(FarcasterConnectQR, {}) });
26
- };
27
- var FarcasterOAuthStep_default = FarcasterOAuthStep;
39
+ const Container = safeStyled.div`
40
+ display: flex;
41
+ flex-direction: column;
42
+ align-items: center;
43
+ justify-content: center;
44
+ width: 100%;
45
+ `;
46
+ const IFrame = safeStyled.iframe`
47
+ width: 100%;
48
+ border: none;
49
+ `;
28
50
  export {
29
- FarcasterConnectQR,
30
- FarcasterOAuthStep_default as default
51
+ FarcasterOAuthStep
31
52
  };
@@ -16,7 +16,7 @@ const OAuth = ({ methods }) => {
16
16
  const isDark = useStore((state) => state.isDarkTheme);
17
17
  const setStep = useModalStore((state) => state.setStep);
18
18
  const showAll = useModalStore((state) => state.step === ModalStep.AUTH_MORE || state.step === ModalStep.AUTH_GUEST_SIGNUP);
19
- const { verifyFarcaster, verifyOAuth } = useAuthActions();
19
+ const { verifyOAuth } = useAuthActions();
20
20
  const hasMore = methods.length > HAS_MORE_LENGTH;
21
21
  const methodsToShow = showAll || !hasMore ? methods : methods.slice(0, HAS_MORE_LENGTH - 1);
22
22
  const handleShowAll = () => {
@@ -25,7 +25,7 @@ const OAuth = ({ methods }) => {
25
25
  const handleMethodClick = (method) => () => __async(void 0, null, function* () {
26
26
  switch (method) {
27
27
  case "FARCASTER":
28
- verifyFarcaster();
28
+ setStep(ModalStep.FARCASTER_OAUTH);
29
29
  break;
30
30
  case "TELEGRAM":
31
31
  setStep(ModalStep.TELEGRAM_OAUTH);
@@ -13,7 +13,8 @@ function TelegramOAuthStep() {
13
13
  const { url, status, isLoaded, setIsLoaded } = useTelegramLogin({
14
14
  isActive: true,
15
15
  status: verifyTelegramStatus,
16
- onSubmit: verifyTelegram
16
+ onSubmit: verifyTelegram,
17
+ isLinking: false
17
18
  });
18
19
  const isError = status === "error", isPending = status === "pending";
19
20
  return /* @__PURE__ */ jsxs(Container, { children: [
@@ -1,5 +1,5 @@
1
1
  import { CpslIcon, CpslInput, CpslText, CpslTileButton } from '@getpara/react-components';
2
- import { TExternalWallet, TLinkedAccountType, TNetwork, TOnRampAsset, TWalletType } from '@getpara/web-sdk';
2
+ import { Network, OnRampAsset, TExternalWallet, TLinkedAccountType, TWalletType } from '@getpara/web-sdk';
3
3
  import { ComponentProps, PropsWithChildren } from 'react';
4
4
  export declare const SpinnerContainer: import("styled-components/dist/types.js").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
5
5
  export declare const QRContainer: import("styled-components/dist/types.js").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
@@ -30,11 +30,11 @@ export declare const HeaderSelectItem: import("styled-components/dist/types.js")
30
30
  }, never>> & string & Omit<import("react").ForwardRefExoticComponent<Omit<any, "ref"> & import("react").RefAttributes<any>>, keyof import("react").Component<any, {}, any>>;
31
31
  export declare const HeaderSelectContainer: import("styled-components/dist/types.js").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
32
32
  export declare function AssetIcon({ asset, size }: {
33
- asset: TOnRampAsset;
33
+ asset: OnRampAsset;
34
34
  size?: string;
35
35
  }): import("react/jsx-runtime").JSX.Element;
36
36
  export declare function NetworkIcon({ network, size }: {
37
- network?: TNetwork;
37
+ network?: Network;
38
38
  size?: string;
39
39
  }): import("react/jsx-runtime").JSX.Element;
40
40
  export declare function WalletTypeIcon({ className, walletType, externalWallet, ...props }: {
@@ -1,4 +1,4 @@
1
- import { TNetwork, TOnRampAsset, OnRampMethod, OnRampProvider, TWalletType } from '@getpara/core-sdk';
1
+ import { Network, OnRampAsset, OnRampMethod, OnRampProvider, TWalletType } from '@getpara/core-sdk';
2
2
  import { IconType } from '@getpara/react-components';
3
3
  import { Transition, Variants } from 'framer-motion';
4
4
  import { DisplayMetadata } from '@getpara/react-common';
@@ -11,21 +11,21 @@ export type OnRampProviderConfig = DisplayMetadata & {
11
11
  backgroundColors: string[];
12
12
  };
13
13
  export declare const ON_RAMP_PROVIDERS: Record<OnRampProvider, OnRampProviderConfig>;
14
- type Networks = Record<TNetwork, DisplayMetadata>;
14
+ type Networks = Record<Network, DisplayMetadata>;
15
15
  export declare const WALLET_TYPES_METADATA: Record<TWalletType, DisplayMetadata>;
16
16
  export declare const NETWORKS: Networks;
17
- export declare const ON_RAMP_ASSETS: Record<TOnRampAsset, {
17
+ export declare const ON_RAMP_ASSETS: Record<OnRampAsset, {
18
18
  name: string;
19
19
  code: string;
20
20
  icon: IconType;
21
21
  isCircular?: boolean;
22
22
  isDark?: boolean;
23
23
  }>;
24
- export declare function getNetworkName(str: TNetwork | string): string;
25
- export declare function getNetworkIcon(str: TNetwork | string): IconType;
26
- export declare function getAssetCode(str: TOnRampAsset | string): string;
27
- export declare function getAssetName(str: TOnRampAsset | string): string;
28
- export declare function getAssetIcon(str: TOnRampAsset | string): "key" | "phone" | "farcaster" | "telegram" | "discord" | "x" | "search" | "wallet" | "cosmos" | "solana" | "para" | "walletConnect" | "close" | "copy" | "safe" | "stripeBrand" | "alertCircle" | "alertTriangle" | "alignVerticalCenter" | "angelListBrand" | "angelList" | "appleBrand" | "apple" | "arbitrumBrand" | "arrowCircleBrokenDownLeft" | "arrowCircleDownFilled" | "arrowCircleDown" | "arrowNarrow" | "arrow" | "asterisk" | "backpack" | "backupKit" | "bank" | "baseBrand" | "beraBrand" | "brush" | "celoBrand" | "checkCircleFilled" | "checkCircle" | "checkSquare" | "check" | "chevronDown" | "chevronRight" | "chevronSelectorVertical" | "chevronUp" | "clock" | "clubhouseBrand" | "clubhouse" | "code" | "coinbase" | "copy07" | "cosmosCircle" | "cosmostation" | "creditCard02" | "creditCard" | "cube03" | "cubeOutline" | "cube" | "currencyDollar" | "decentBrand" | "decent" | "dell" | "discordBrand" | "dot" | "dotsSquare" | "dots" | "downloadCloud" | "download" | "dribbbleBrand" | "dribbble" | "earth" | "edit02" | "emptyCircle" | "ethCircle" | "ethereum" | "eyeOff" | "eye" | "facebookBrand" | "facebook" | "farcasterBrand" | "figmaBrand" | "figma" | "file" | "folder" | "githubBrand" | "github" | "globe" | "glow" | "googleBrand" | "google" | "gridDots" | "haha" | "helpCircle" | "heroAlertCircle" | "heroCheckmarkCapsule" | "heroCheckmark" | "heroEmail" | "heroExternalConnection" | "heroLock" | "heroPasskey" | "heroPhone" | "heroPlusCircleCapsule" | "heroPlusCircle" | "heroWallet" | "home" | "hp" | "image" | "infoCircle" | "instagramBrand" | "instagram" | "keplr" | "laptop" | "leap" | "lenovo" | "lg" | "lightning01" | "lightning" | "linkExternal" | "linkedinBrand" | "linkedin" | "lockKeyholeCircle" | "logOut" | "mail" | "menu" | "metamask" | "monitor" | "moonpayBrand" | "moreLoginOptions" | "motorola" | "nobleBrand" | "okx" | "optimismBrand" | "paraArrow" | "paraBlackBg" | "paraBrand" | "paraIconBrand" | "paraIconQr" | "paraIcon" | "paraLogo" | "paraRingsDark" | "paraRings" | "passcode" | "phantom" | "pintrestBrand" | "pintrest" | "plusCircle" | "plus" | "polygonBrand" | "polygon" | "puzzlePiece" | "qrCode02" | "qrCode" | "rabby" | "rainbow" | "rampNetworkBrand" | "rampNetwork" | "redditBrand" | "reddit" | "refresh" | "samsung" | "send" | "settings" | "share" | "shield" | "signalBrand" | "signal" | "sliders" | "snapchatBrand" | "snapchat" | "solanaCircle" | "solflare" | "spacingHeight" | "star04Filled" | "star05" | "stars01Filled" | "stars02" | "stars" | "stopSquare" | "telegramBrand" | "tetherBrand" | "tikTokBrand" | "tikTok" | "trash" | "tumblrBrand" | "tumblr" | "twitterBrand" | "twitter" | "usdcBrand" | "user01" | "userCircle" | "userPlus" | "user" | "valora" | "wallet02" | "youtubeBrand" | "youtube" | "zerion" | "AD" | "AE" | "AF" | "AG" | "AI" | "AL" | "AM" | "AO" | "AR" | "AS" | "AT" | "AU" | "AW" | "AX" | "AZ" | "BA" | "BB" | "BD" | "BE" | "BF" | "BG" | "BH" | "BI" | "BJ" | "BL" | "BM" | "BN" | "BO" | "BQ" | "BQ2" | "BQ3" | "BR" | "BS" | "BT" | "BW" | "BY" | "BZ" | "CA" | "CC" | "CD" | "CD2" | "CF" | "CH" | "CK" | "CL" | "CM" | "CN" | "CO" | "CR" | "CU" | "CW" | "CX" | "CY" | "CZ" | "DE" | "DJ" | "DK" | "DM" | "DO" | "DS" | "DZ" | "EC" | "EE" | "EG" | "EH" | "ER" | "ES" | "ET" | "FI" | "FJ" | "FK" | "FM" | "FO" | "FR" | "GA" | "GB2" | "GB" | "GD" | "GE" | "GG" | "GH" | "GI" | "GL" | "GM" | "GN" | "GQ" | "GR" | "GT" | "GU" | "GW" | "GY" | "HK" | "HN" | "HR" | "HT" | "HU" | "ID" | "IE" | "IL" | "IM" | "IN" | "IO" | "IQ" | "IR" | "IS" | "IT" | "JE" | "JM" | "JO" | "JP" | "KE" | "KG" | "KH" | "KI" | "KM" | "KN" | "KP" | "KR" | "KW" | "KY" | "KZ" | "LA" | "LB" | "LC" | "LI" | "LK" | "LR" | "LS" | "LT" | "LU" | "LV" | "LY" | "MA" | "MC" | "MD" | "ME" | "MG" | "MH" | "MK" | "ML" | "MM" | "MN" | "MO" | "MP" | "MQ" | "MR" | "MS" | "MT" | "MU" | "MV" | "MW" | "MX" | "MY" | "MZ" | "NA" | "NE" | "NF" | "NG" | "NI" | "NL" | "NO" | "NP" | "NR" | "NU" | "NZ" | "OM" | "PA" | "PE" | "PF" | "PG" | "PH" | "PK" | "PL" | "PN" | "PR" | "PS" | "PT" | "PW" | "PY" | "QA" | "RO" | "RS" | "RU" | "RW" | "SA" | "SB" | "SC" | "SE" | "SG" | "SI" | "SK" | "SL" | "SM" | "SN" | "SO" | "SR" | "SS" | "ST" | "SV" | "SX" | "SY" | "SZ" | "TC" | "TD" | "TG" | "TH" | "TJ" | "TK" | "TL" | "TM" | "TN" | "TO" | "TR" | "TT" | "TV" | "TW" | "TZ" | "UA" | "UG" | "US" | "UY" | "UZ" | "VC" | "VE" | "VG" | "VI" | "VN" | "VU" | "WS" | "YE" | "ZA" | "ZM" | "ZW";
24
+ export declare function getNetworkName(str: Network | string): string;
25
+ export declare function getNetworkIcon(str: Network | string): IconType;
26
+ export declare function getAssetCode(str: OnRampAsset | string): string;
27
+ export declare function getAssetName(str: OnRampAsset | string): string;
28
+ export declare function getAssetIcon(str: OnRampAsset | string): "key" | "phone" | "farcaster" | "telegram" | "discord" | "x" | "search" | "wallet" | "cosmos" | "solana" | "para" | "walletConnect" | "close" | "copy" | "safe" | "stripeBrand" | "alertCircle" | "alertTriangle" | "alignVerticalCenter" | "angelListBrand" | "angelList" | "appleBrand" | "apple" | "arbitrumBrand" | "arrowCircleBrokenDownLeft" | "arrowCircleDownFilled" | "arrowCircleDown" | "arrowNarrow" | "arrow" | "asterisk" | "backpack" | "backupKit" | "bank" | "baseBrand" | "beraBrand" | "brush" | "celoBrand" | "checkCircleFilled" | "checkCircle" | "checkSquare" | "check" | "chevronDown" | "chevronRight" | "chevronSelectorVertical" | "chevronUp" | "clock" | "clubhouseBrand" | "clubhouse" | "code" | "coinbase" | "copy07" | "cosmosCircle" | "cosmostation" | "creditCard02" | "creditCard" | "cube03" | "cubeOutline" | "cube" | "currencyDollar" | "decentBrand" | "decent" | "dell" | "discordBrand" | "dot" | "dotsSquare" | "dots" | "downloadCloud" | "download" | "dribbbleBrand" | "dribbble" | "earth" | "edit02" | "emptyCircle" | "ethCircle" | "ethereum" | "eyeOff" | "eye" | "facebookBrand" | "facebook" | "farcasterBrand" | "figmaBrand" | "figma" | "file" | "folder" | "githubBrand" | "github" | "globe" | "glow" | "googleBrand" | "google" | "gridDots" | "haha" | "helpCircle" | "heroAlertCircle" | "heroCheckmarkCapsule" | "heroCheckmark" | "heroEmail" | "heroExternalConnection" | "heroLock" | "heroPasskey" | "heroPhone" | "heroPlusCircleCapsule" | "heroPlusCircle" | "heroWallet" | "home" | "hp" | "image" | "infoCircle" | "instagramBrand" | "instagram" | "keplr" | "laptop" | "leap" | "lenovo" | "lg" | "lightning01" | "lightning" | "linkExternal" | "linkedinBrand" | "linkedin" | "lockKeyholeCircle" | "logOut" | "mail" | "menu" | "metamask" | "monitor" | "moonpayBrand" | "moreLoginOptions" | "motorola" | "nobleBrand" | "okx" | "optimismBrand" | "paraArrow" | "paraBlackBg" | "paraBrand" | "paraIconBrand" | "paraIconQr" | "paraIcon" | "paraLogo" | "paraRingsDark" | "paraRings" | "passcode" | "phantom" | "pintrestBrand" | "pintrest" | "plusCircle" | "plus" | "polygonBrand" | "polygon" | "puzzlePiece" | "qrCode02" | "qrCode" | "rabby" | "rainbow" | "rampNetworkBrand" | "rampNetwork" | "redditBrand" | "reddit" | "refresh" | "samsung" | "send" | "settings" | "share" | "shield" | "signalBrand" | "signal" | "sliders" | "snapchatBrand" | "snapchat" | "solanaCircle" | "solflare" | "spacingHeight" | "star04Filled" | "star05" | "stars01Filled" | "stars02" | "stars" | "stopSquare" | "telegramBrand" | "tetherBrand" | "tikTokBrand" | "tikTok" | "trash" | "tumblrBrand" | "tumblr" | "twitterBrand" | "twitter" | "usdcBrand" | "user01" | "userCircle" | "userPlus" | "user" | "valora" | "wallet02" | "youtubeBrand" | "youtube" | "zerion" | "AD" | "AE" | "AF" | "AG" | "AI" | "AL" | "AM" | "AO" | "AR" | "AS" | "AT" | "AU" | "AW" | "AX" | "AZ" | "BA" | "BB" | "BD" | "BE" | "BF" | "BG" | "BH" | "BI" | "BJ" | "BL" | "BM" | "BN" | "BO" | "BQ" | "BQ2" | "BQ3" | "BR" | "BS" | "BT" | "BW" | "BY" | "BZ" | "CA" | "CC" | "CD" | "CD2" | "CF" | "CH" | "CK" | "CL" | "CM" | "CN" | "CO" | "CR" | "CU" | "CW" | "CX" | "CY" | "CZ" | "DE" | "DJ" | "DK" | "DM" | "DO" | "DS" | "DZ" | "EC" | "EE" | "EG" | "EH" | "ER" | "ES" | "ET" | "FI" | "FJ" | "FK" | "FM" | "FO" | "FR" | "GA" | "GB2" | "GB" | "GD" | "GE" | "GG" | "GH" | "GI" | "GL" | "GM" | "GN" | "GQ" | "GR" | "GT" | "GU" | "GW" | "GY" | "HK" | "HN" | "HR" | "HT" | "HU" | "ID" | "IE" | "IL" | "IM" | "IN" | "IO" | "IQ" | "IR" | "IS" | "IT" | "JE" | "JM" | "JO" | "JP" | "KE" | "KG" | "KH" | "KI" | "KM" | "KN" | "KP" | "KR" | "KW" | "KY" | "KZ" | "LA" | "LB" | "LC" | "LI" | "LK" | "LR" | "LS" | "LT" | "LU" | "LV" | "LY" | "MA" | "MC" | "MD" | "ME" | "MG" | "MH" | "MK" | "ML" | "MM" | "MN" | "MO" | "MP" | "MQ" | "MR" | "MS" | "MT" | "MU" | "MV" | "MW" | "MX" | "MY" | "MZ" | "NA" | "NE" | "NF" | "NG" | "NI" | "NL" | "NO" | "NP" | "NR" | "NU" | "NZ" | "OM" | "PA" | "PE" | "PF" | "PG" | "PH" | "PK" | "PL" | "PN" | "PR" | "PS" | "PT" | "PW" | "PY" | "QA" | "RO" | "RS" | "RU" | "RW" | "SA" | "SB" | "SC" | "SE" | "SG" | "SI" | "SK" | "SL" | "SM" | "SN" | "SO" | "SR" | "SS" | "ST" | "SV" | "SX" | "SY" | "SZ" | "TC" | "TD" | "TG" | "TH" | "TJ" | "TK" | "TL" | "TM" | "TN" | "TO" | "TR" | "TT" | "TV" | "TW" | "TZ" | "UA" | "UG" | "US" | "UY" | "UZ" | "VC" | "VE" | "VG" | "VI" | "VN" | "VU" | "WS" | "YE" | "ZA" | "ZM" | "ZW";
29
29
  export declare const MOBILE_SIZE = 480;
30
30
  export declare const NETWORK_NOT_SUPPORTED_ERROR = "network not supported";
31
31
  export declare const EMAIL_REGEX: RegExp;