@getpara/react-sdk-lite 2.8.0 → 2.9.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 (40) hide show
  1. package/dist/modal/ParaModal.js +1 -1
  2. package/dist/modal/components/Account/Account.js +17 -7
  3. package/dist/modal/components/Account/AccountProfile.js +30 -9
  4. package/dist/modal/components/Account/AccountSend/AccountSendForm.js +7 -1
  5. package/dist/modal/components/Account/AccountWallet.js +2 -0
  6. package/dist/modal/components/AddFunds/AddFunds.js +1 -4
  7. package/dist/modal/components/AddFunds/AddFundsAsset.js +25 -88
  8. package/dist/modal/components/AddFunds/AddFundsContext.d.ts +6 -2
  9. package/dist/modal/components/AddFunds/AddFundsContext.js +97 -15
  10. package/dist/modal/components/AddFunds/AddFundsNetwork.d.ts +1 -0
  11. package/dist/modal/components/AddFunds/AddFundsNetwork.js +31 -0
  12. package/dist/modal/components/AddFunds/AddFundsProvider.js +50 -65
  13. package/dist/modal/components/AddFunds/AddFundsReceive.js +4 -1
  14. package/dist/modal/components/AddFunds/AddFundsSettings.js +126 -143
  15. package/dist/modal/components/AuthInput/AuthInput.js +12 -1
  16. package/dist/modal/components/AuthMainStep/AuthMainStepContent.js +32 -11
  17. package/dist/modal/components/BiometricCreationStep/BiometricCreationStep.js +17 -8
  18. package/dist/modal/components/BiometricLoginStep/BiometricLoginStep.js +25 -9
  19. package/dist/modal/components/Body/Body.js +3 -51
  20. package/dist/modal/components/ExternalWalletStep/ExternalWalletStep.js +25 -8
  21. package/dist/modal/components/ExternalWallets/ExternalWallets.js +33 -13
  22. package/dist/modal/components/IFrameStep/IFrameStep.js +1 -1
  23. package/dist/modal/components/OAuth/OAuth.js +5 -3
  24. package/dist/modal/components/OnRampComponents/OnRampProviderButton.js +15 -24
  25. package/dist/modal/components/QuantityInput.js +62 -9
  26. package/dist/modal/components/RecoverySecretStep/RecoverySecretStep.js +4 -4
  27. package/dist/modal/components/SearchableButtonList.d.ts +2 -1
  28. package/dist/modal/components/SearchableButtonList.js +3 -1
  29. package/dist/modal/components/Setup2FAStep/Setup2FAStep.js +6 -5
  30. package/dist/modal/components/VerificationCodeStep/VerificationCodeStep.js +4 -2
  31. package/dist/modal/components/WalletCreationDoneStep/WalletCreationDoneStep.js +2 -2
  32. package/dist/modal/components/common.d.ts +1 -1
  33. package/dist/modal/stores/modal/actions.js +2 -1
  34. package/dist/modal/stores/modal/useModalStore.d.ts +2 -0
  35. package/dist/modal/stores/modal/useModalStore.js +2 -1
  36. package/dist/modal/utils/validatePortalOrigin.js +6 -0
  37. package/dist/provider/ParaProviderMin.js +3 -0
  38. package/package.json +8 -8
  39. package/dist/modal/components/AddFunds/common.d.ts +0 -5
  40. package/dist/modal/components/AddFunds/common.js +0 -17
@@ -113,13 +113,14 @@ const VerificationCode = ({ authInfo, onResend, onSubmit, status, error }) => {
113
113
  errorText: codeError || "",
114
114
  onKeyDown: (e) => __async(void 0, null, function* () {
115
115
  return e.key === "Enter" && (yield handleSubmitCode());
116
- })
116
+ }),
117
+ "data-testid": "para-otp-input"
117
118
  }
118
119
  )
119
120
  }
120
121
  ),
121
122
  /* @__PURE__ */ jsxs(InlineText, { variant: "bodyS", color: "secondary", children: [
122
- "Didn\u2019t receive a code?",
123
+ "Didn't receive a code?",
123
124
  " ",
124
125
  /* @__PURE__ */ jsx(
125
126
  ClickableText,
@@ -127,6 +128,7 @@ const VerificationCode = ({ authInfo, onResend, onSubmit, status, error }) => {
127
128
  variant: "bodyS",
128
129
  style: { cursor: resendDisabled ? "default" : "pointer" },
129
130
  onClick: handleResendClick,
131
+ "data-testid": "para-otp-resend",
130
132
  children: resendDisabled ? "Resent!" : "Resend."
131
133
  }
132
134
  )
@@ -68,10 +68,10 @@ const WalletCreationDoneStep = ({ twoFactorAuthEnabled, onClose }) => {
68
68
  /* @__PURE__ */ jsx(CardContainer, { children: hideWallets ? /* @__PURE__ */ jsxs(Fragment, { children: [
69
69
  /* @__PURE__ */ jsx(HeroIcon, { icon: "checkCircleFilled" }),
70
70
  /* @__PURE__ */ jsx(CpslText, { variant: "bodyM", color: "secondary", weight: "medium", style: { marginTop: "16px" }, children: "Your account has been created." })
71
- ] }) : /* @__PURE__ */ jsx(WalletCards, { children: para.currentWalletIdsArray.map(([id, type]) => {
71
+ ] }) : /* @__PURE__ */ jsx(WalletCards, { "data-testid": "para-wallet-card", children: para.currentWalletIdsArray.map(([id, type]) => {
72
72
  return /* @__PURE__ */ jsx(WalletCard, { id, type, showAddFunds: isOnRampConfigured }, id);
73
73
  }) }) }),
74
- /* @__PURE__ */ jsx(InnerStepContainer, { children: /* @__PURE__ */ jsx(CpslButton, { fullWidth: true, onClick: handleNext, disabled: isWaiting, children: twoFactorAuthEnabled ? "Continue" : "Done" }) })
74
+ /* @__PURE__ */ jsx(InnerStepContainer, { children: /* @__PURE__ */ jsx(CpslButton, { fullWidth: true, onClick: handleNext, disabled: isWaiting, "data-testid": "para-done-button", children: twoFactorAuthEnabled ? "Continue" : "Done" }) })
75
75
  ] });
76
76
  };
77
77
  const CardContainer = safeStyled(InnerStepContainer)`
@@ -10,7 +10,7 @@ export declare const FullWidthFilledDisabledInput: typeof CpslInput;
10
10
  export declare const CenteredText: typeof CpslText;
11
11
  export declare const InnerStepContainer: import("styled-components/dist/types.js").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
12
12
  export declare const StepContainer: import("styled-components/dist/types.js").IStyledComponentBase<"web", import("styled-components/dist/types.js").Substitute<Omit<import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>, "ref"> & {
13
- ref?: import("react").RefObject<HTMLDivElement> | ((instance: HTMLDivElement | null) => void | import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | null | undefined;
13
+ ref?: ((instance: HTMLDivElement | null) => void | import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | import("react").RefObject<HTMLDivElement> | null | undefined;
14
14
  }, {
15
15
  $wide?: boolean;
16
16
  }>> & string;
@@ -139,7 +139,8 @@ const getActions = (set, get) => ({
139
139
  setIsPasskeySupported: (isPasskeySupported) => set({ isPasskeySupported }),
140
140
  setAccountLinkOptions: (accountLinkOptions) => set({ accountLinkOptions }),
141
141
  setProfileWallet: (profileWallet) => set({ profileWallet }),
142
- setSendTx: (sendTx) => set({ sendTx })
142
+ setSendTx: (sendTx) => set({ sendTx }),
143
+ setIsTestModeAlertDismissed: (isTestModeAlertDismissed) => set({ isTestModeAlertDismissed })
143
144
  });
144
145
  export {
145
146
  getActions
@@ -62,6 +62,7 @@ interface ModalState {
62
62
  accountLinkOptions: SupportedAccountLinks;
63
63
  profileWallet?: AvailableWallet;
64
64
  sendTx: BroadcastTransactionResult | null;
65
+ isTestModeAlertDismissed: boolean;
65
66
  }
66
67
  export interface ModalActions {
67
68
  resetState: () => void;
@@ -102,6 +103,7 @@ export interface ModalActions {
102
103
  setAccountLinkOptions: (_: SupportedAccountLinks) => void;
103
104
  setProfileWallet: (_?: AvailableWallet) => void;
104
105
  setSendTx: (_: BroadcastTransactionResult | null) => void;
106
+ setIsTestModeAlertDismissed: (_: boolean) => void;
105
107
  }
106
108
  export type ModalStore = ModalState & ModalActions;
107
109
  export declare const DEFAULT_MODAL_STATE: Omit<ModalState, 'step' | 'onRampConfig'>;
@@ -50,7 +50,8 @@ const DEFAULT_MODAL_STATE = {
50
50
  isPasskeySupported: true,
51
51
  accountLinkOptions: [...LINKED_ACCOUNT_TYPES],
52
52
  profileWallet: void 0,
53
- sendTx: null
53
+ sendTx: null,
54
+ isTestModeAlertDismissed: false
54
55
  };
55
56
  const useModalStore = create()(
56
57
  persist(
@@ -5,6 +5,12 @@ const validatePortalOrigin = (event, paraCtx) => {
5
5
  const portalBase = getPortalBaseURL(paraCtx);
6
6
  const portalLocalBase = getPortalBaseURL(paraCtx, true);
7
7
  const normalizedOrigin = event.origin.replace("usecapsule", "getpara");
8
+ if (paraCtx.portalUrlOverride) {
9
+ const allowedPatterns = [/^https:\/\/\d+-portal\.preview\.sandbox\.getpara\.com$/, /^https?:\/\/localhost:\d+$/];
10
+ const overrideOrigin = new URL(paraCtx.portalUrlOverride).origin;
11
+ const isAllowed = allowedPatterns.some((pattern) => pattern.test(overrideOrigin));
12
+ if (isAllowed && normalizedOrigin === overrideOrigin) return true;
13
+ }
8
14
  if (normalizedOrigin !== portalBase && normalizedOrigin !== portalLocalBase) {
9
15
  return false;
10
16
  }
@@ -101,6 +101,9 @@ const ParaProviderMin = forwardRef(({ children, paraClientConfig, callbacks, con
101
101
  }
102
102
  const newClient = isParaWeb(paraClientConfig) ? paraClientConfig : paraClientConfig.env ? new ParaWeb(paraClientConfig.env, paraClientConfig.apiKey, paraClientConfig.opts) : new ParaWeb(paraClientConfig.apiKey, paraClientConfig.opts);
103
103
  newClient.setModalError = setModalError;
104
+ if (typeof globalThis !== "undefined" && globalThis.__PARA_PORTAL_URL_OVERRIDE__) {
105
+ newClient.ctx.portalUrlOverride = globalThis.__PARA_PORTAL_URL_OVERRIDE__;
106
+ }
104
107
  newClient.portalTheme = paraModalConfig == null ? void 0 : paraModalConfig.theme;
105
108
  if (newClient.isReady) {
106
109
  setIsClientReady(true);
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "@getpara/react-sdk-lite",
3
- "version": "2.8.0",
3
+ "version": "2.9.0",
4
4
  "bin": {
5
5
  "setup-para": "dist/cli/cli.mjs"
6
6
  },
7
7
  "dependencies": {
8
- "@getpara/react-common": "2.8.0",
9
- "@getpara/react-components": "2.8.0",
10
- "@getpara/web-sdk": "2.8.0",
8
+ "@getpara/react-common": "2.9.0",
9
+ "@getpara/react-components": "2.9.0",
10
+ "@getpara/web-sdk": "2.9.0",
11
11
  "date-fns": "^3.6.0",
12
12
  "framer-motion": "^11.3.31",
13
13
  "libphonenumber-js": "^1.11.7",
@@ -16,9 +16,9 @@
16
16
  "zustand-sync-tabs": "^0.2.2"
17
17
  },
18
18
  "devDependencies": {
19
- "@getpara/cosmos-wallet-connectors": "2.8.0",
20
- "@getpara/evm-wallet-connectors": "2.8.0",
21
- "@getpara/solana-wallet-connectors": "2.8.0",
19
+ "@getpara/cosmos-wallet-connectors": "2.9.0",
20
+ "@getpara/evm-wallet-connectors": "2.9.0",
21
+ "@getpara/solana-wallet-connectors": "2.9.0",
22
22
  "@tanstack/react-query": "^5.74.0",
23
23
  "@testing-library/dom": "^10.4.0",
24
24
  "@testing-library/react": "^16.3.0",
@@ -38,7 +38,7 @@
38
38
  "package.json",
39
39
  "styles.css"
40
40
  ],
41
- "gitHead": "44d3bdc9a075861613210bd0817a03ab67deed4e",
41
+ "gitHead": "672cc943bc57cbeced8e79127c52a4fab0af4aed",
42
42
  "main": "dist/index.js",
43
43
  "peerDependencies": {
44
44
  "@tanstack/react-query": ">=5.0.0",
@@ -1,5 +0,0 @@
1
- export declare const NoProviders: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<Omit<Omit<any, "ref"> & import("react").RefAttributes<any>, "ref"> & {
2
- ref?: ((instance: any) => void | import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | import("react").RefObject<any> | null | undefined;
3
- }, {
4
- isHidden?: boolean;
5
- }>> & string & Omit<import("react").ForwardRefExoticComponent<Omit<any, "ref"> & import("react").RefAttributes<any>>, keyof import("react").Component<any, {}, any>>;
@@ -1,17 +0,0 @@
1
- "use client";
2
- import "../../../chunk-MMUBH76A.js";
3
- import { CpslText } from "@getpara/react-components";
4
- import { safeStyled } from "@getpara/react-common";
5
- const NoProviders = safeStyled(CpslText)`
6
- width: 100%;
7
- text-align: center;
8
- visibility: ${({ isHidden }) => isHidden ? "hidden" : "visible"};
9
- position: absolute;
10
- top: 0;
11
- left: 0;
12
- right: 0;
13
- transition: visibility 0.2s;
14
- `;
15
- export {
16
- NoProviders
17
- };