@getpara/react-sdk-lite 2.0.0 → 2.1.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.
@@ -44,7 +44,7 @@ const AccountHeader = ({ withBalance = false } = {}) => {
44
44
  src
45
45
  }
46
46
  ),
47
- connectionType === "both" ? /* @__PURE__ */ jsx(AccountWalletSelect, {}) : /* @__PURE__ */ jsx(CpslText, { variant: "headingXS", weight: "semiBold", color: "contrast", children: name }),
47
+ connectionType === "both" ? /* @__PURE__ */ jsx(AccountWalletSelect, {}) : /* @__PURE__ */ jsx(StyledName, { variant: "headingXS", weight: "semiBold", color: "contrast", children: name }),
48
48
  withBalance && typeof totalBalance === "string" && totalBalance !== "" && /* @__PURE__ */ jsx(CpslText, { variant: "bodyM", weight: "medium", style: { visibility: profileBalance ? "visible" : "hidden" }, children: totalBalance })
49
49
  ] });
50
50
  };
@@ -55,6 +55,9 @@ const AccountContainer = safeStyled.div`
55
55
  gap: 8px;
56
56
  align-items: center;
57
57
  `;
58
+ const StyledName = safeStyled(CpslText)`
59
+ text-align: center;
60
+ `;
58
61
  export {
59
62
  AccountHeader
60
63
  };
@@ -1,5 +1,8 @@
1
1
  "use client";
2
- import "../../../chunk-MMUBH76A.js";
2
+ import {
3
+ __spreadProps,
4
+ __spreadValues
5
+ } from "../../../chunk-MMUBH76A.js";
3
6
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
4
7
  import { useMemo } from "react";
5
8
  import { ACCOUNT_TYPES, safeStyled, useCopyToClipboard, WalletTypeIcon } from "@getpara/react-common";
@@ -27,7 +30,8 @@ const AccountProfileEntry = ({
27
30
  accessory,
28
31
  style,
29
32
  className,
30
- onSelect
33
+ onSelect,
34
+ dataTestId
31
35
  }) => {
32
36
  const [isCopied, copy] = useCopyToClipboard();
33
37
  const Copy = copyString ? /* @__PURE__ */ jsx(
@@ -43,7 +47,7 @@ const AccountProfileEntry = ({
43
47
  children: /* @__PURE__ */ jsx(CopyIcon, { id: "ignore-click", slot: "start", isCopied, icon: isCopied ? "check" : "copy" })
44
48
  }
45
49
  ) : null;
46
- return /* @__PURE__ */ jsxs(EntryContainer, { onClick: onSelect, className, style, children: [
50
+ return /* @__PURE__ */ jsxs(EntryContainer, { onClick: onSelect, className, style, "data-testid": dataTestId, children: [
47
51
  icon,
48
52
  /* @__PURE__ */ jsx(EntryDisplayName, { variant: "bodyM", color: "contrast", children: text }),
49
53
  /* @__PURE__ */ jsx(EntryFlex, { children: textSecondary ? /* @__PURE__ */ jsxs(Fragment, { children: [
@@ -109,12 +113,13 @@ const WalletEntry = ({
109
113
  textSecondary: withAddressShort ? wallet.addressShort : void 0,
110
114
  textTertiary: balance,
111
115
  copyString: wallet.address,
112
- style,
116
+ style: __spreadProps(__spreadValues({}, style || {}), { zIndex: 2 }),
113
117
  className,
114
118
  onSelect: isSelectable ? () => {
115
119
  setProfileWallet(wallet);
116
120
  setStep(ModalStep.ACCOUNT_WALLET);
117
- } : void 0
121
+ } : void 0,
122
+ dataTestId: `wallet-entry-${wallet.type}-${wallet.address}`
118
123
  },
119
124
  wallet.address
120
125
  );
@@ -176,13 +181,16 @@ const AccountLinkEntry = ({
176
181
  identifier
177
182
  );
178
183
  };
179
- const EntryContainer = safeStyled.div`
184
+ const EntryContainer = safeStyled.button`
180
185
  overflow: hidden;
181
186
  position: relative;
182
187
  width: 100%;
183
188
  display: flex;
184
189
  gap: 8px;
185
190
  align-items: center;
191
+ background: transparent;
192
+ border: none;
193
+ padding: 0;
186
194
  ${({ onClick }) => onClick ? "cursor: pointer;" : ""}
187
195
  `;
188
196
  const EntryDisplayName = safeStyled(CpslText)``;
@@ -84,6 +84,7 @@ const AccountWallet = () => {
84
84
  variant: "destructive",
85
85
  fullWidth: true,
86
86
  onClick: () => exportPrivateKey({ walletId: profileWallet.id, shouldOpenPopup: true }),
87
+ "data-testid": "export-private-key-button",
87
88
  children: [
88
89
  /* @__PURE__ */ jsx(CpslIcon, { icon: "key", slot: "start" }),
89
90
  "Export private key"
@@ -29,11 +29,12 @@ const Controls = ({ onClose }) => {
29
29
  visibility: hasPreviousStep ? "visible" : "hidden"
30
30
  },
31
31
  onClick: handleBackClick,
32
+ "data-testid": "modal-back-button",
32
33
  children: /* @__PURE__ */ jsx(CpslIcon, { icon: "arrow" })
33
34
  }
34
35
  ),
35
36
  /* @__PURE__ */ jsx(MiddleContainer, { children: isControls && /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(ChainSelect, {}) }) }),
36
- /* @__PURE__ */ jsx(CloseButton, { bareModal, variant: "ghost", onClick: onClose, children: /* @__PURE__ */ jsx(CpslIcon, { icon: "close" }) })
37
+ /* @__PURE__ */ jsx(CloseButton, { bareModal, variant: "ghost", onClick: onClose, "data-testid": "modal-close-button", children: /* @__PURE__ */ jsx(CpslIcon, { icon: "close" }) })
37
38
  ] });
38
39
  };
39
40
  const Container = safeStyled.div`
@@ -4,7 +4,8 @@ import { getPortalBaseURL } from "@getpara/web-sdk";
4
4
  const validatePortalOrigin = (event, paraCtx) => {
5
5
  const portalBase = getPortalBaseURL(paraCtx);
6
6
  const portalLocalBase = getPortalBaseURL(paraCtx, true);
7
- if (event.origin !== portalBase && event.origin !== portalLocalBase) {
7
+ const normalizedOrigin = event.origin.replace("usecapsule", "getpara");
8
+ if (normalizedOrigin !== portalBase && normalizedOrigin !== portalLocalBase) {
8
9
  return false;
9
10
  }
10
11
  return true;
@@ -4,11 +4,11 @@ import {
4
4
  } from "../../../chunk-MMUBH76A.js";
5
5
  import { useMutation, useQueryClient } from "@tanstack/react-query";
6
6
  import { useClient } from "../utils/index.js";
7
- import { getPortalBaseURL } from "@getpara/web-sdk";
8
7
  import { renameMutations } from "../../utils/renameMutations.js";
9
8
  import { addCredential } from "../../actions/index.js";
10
9
  import { openPopup as openPopupFn } from "../../../modal/index.js";
11
10
  import { ACCOUNT_BASE_KEY } from "../queries/useAccount.js";
11
+ import { validatePortalOrigin } from "../../../modal/utils/validatePortalOrigin.js";
12
12
  const ADD_CREDENTIAL_KEY = "ADD_CREDENTIAL";
13
13
  const useAddAuthMethod = ({ openPopup } = { openPopup: true }) => {
14
14
  const para = useClient();
@@ -23,9 +23,7 @@ const useAddAuthMethod = ({ openPopup } = { openPopup: true }) => {
23
23
  if (typeof window !== "undefined" && para) {
24
24
  const handleMessage = (event) => {
25
25
  var _a;
26
- const portalBase = getPortalBaseURL(para.ctx);
27
- const portalLocalBase = getPortalBaseURL(para.ctx, true);
28
- if (!event.origin.startsWith(portalBase) && !event.origin.startsWith(portalLocalBase)) {
26
+ if (!validatePortalOrigin(event, para.ctx)) {
29
27
  return;
30
28
  }
31
29
  if (((_a = event.data) == null ? void 0 : _a.type) === "CLOSE_WINDOW") {
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "@getpara/react-sdk-lite",
3
- "version": "2.0.0",
3
+ "version": "2.1.0",
4
4
  "bin": {
5
5
  "setup-para": "dist/cli/cli.mjs"
6
6
  },
7
7
  "dependencies": {
8
- "@getpara/react-common": "2.0.0",
9
- "@getpara/react-components": "2.0.0",
10
- "@getpara/web-sdk": "2.0.0",
8
+ "@getpara/react-common": "2.1.0",
9
+ "@getpara/react-components": "2.1.0",
10
+ "@getpara/web-sdk": "2.1.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.0.0",
20
- "@getpara/evm-wallet-connectors": "2.0.0",
21
- "@getpara/solana-wallet-connectors": "2.0.0",
19
+ "@getpara/cosmos-wallet-connectors": "2.1.0",
20
+ "@getpara/evm-wallet-connectors": "2.1.0",
21
+ "@getpara/solana-wallet-connectors": "2.1.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": "a64b6aa9b3c481a2d955022f621e495fb55e549e",
41
+ "gitHead": "3ae7f836324a3a2a8a57156e16304aeaf0d37b42",
42
42
  "main": "dist/index.js",
43
43
  "peerDependencies": {
44
44
  "@tanstack/react-query": ">=5.0.0",