@getpara/react-common 1.6.0 → 1.7.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -406,6 +406,25 @@ var formatPhoneNumber = (phone, countryCode) => {
406
406
  return null;
407
407
  };
408
408
 
409
+ // src/utils/getExternalWalletDisplayName.ts
410
+ import { truncateAddress, WalletType as WalletType2 } from "@getpara/web-sdk";
411
+ var getExternalWalletDisplayName = ({ address, type }) => {
412
+ const walletType = type;
413
+ let walletTypeDisplay;
414
+ switch (walletType) {
415
+ case WalletType2.EVM:
416
+ walletTypeDisplay = "EVM";
417
+ break;
418
+ case WalletType2.SOLANA:
419
+ walletTypeDisplay = "Solana";
420
+ break;
421
+ case WalletType2.COSMOS:
422
+ walletTypeDisplay = "Cosmos";
423
+ break;
424
+ }
425
+ return `${walletTypeDisplay} ${truncateAddress(address, walletType)}`;
426
+ };
427
+
409
428
  // src/utils/index.ts
410
429
  function getCurrencyCodes({ assetInfo, allowedAssets, defaultOnRampNetwork, defaultOnRampAsset }, {
411
430
  provider,
@@ -1164,7 +1183,7 @@ var DeviceLogo = styled6(CpslIcon3)`
1164
1183
  import { CpslAvatar, CpslIcon as CpslIcon4, CpslText as CpslText5 } from "@getpara/react-components";
1165
1184
  import styled7 from "styled-components";
1166
1185
  import { jsx as jsx7, jsxs as jsxs5 } from "react/jsx-runtime";
1167
- function defaultDisplayName(authType, identifier) {
1186
+ function defaultDisplayName({ authType, identifier }) {
1168
1187
  switch (authType) {
1169
1188
  case "email":
1170
1189
  return identifier.toLowerCase();
@@ -1179,6 +1198,7 @@ function defaultDisplayName(authType, identifier) {
1179
1198
  }
1180
1199
  }
1181
1200
  var UserIdentifier = ({ identifier, authType, displayName, pfpUrl }) => {
1201
+ const shouldHideAvatar = authType === "externalWallet";
1182
1202
  let icon;
1183
1203
  switch (authType) {
1184
1204
  case "email":
@@ -1195,8 +1215,8 @@ var UserIdentifier = ({ identifier, authType, displayName, pfpUrl }) => {
1195
1215
  break;
1196
1216
  }
1197
1217
  return /* @__PURE__ */ jsxs5(Container4, { children: [
1198
- /* @__PURE__ */ jsx7(IconContainer, { children: pfpUrl ? /* @__PURE__ */ jsx7(Avatar, { src: pfpUrl, size: "20px" }) : /* @__PURE__ */ jsx7(Icon, { icon, size: authType === "telegram" ? "20px" : "13px" }) }),
1199
- /* @__PURE__ */ jsx7(IdentifierText, { variant: "bodyS", weight: "medium", children: displayName || defaultDisplayName(authType, identifier) })
1218
+ !shouldHideAvatar && /* @__PURE__ */ jsx7(IconContainer, { children: pfpUrl ? /* @__PURE__ */ jsx7(Avatar, { src: pfpUrl, size: "20px" }) : /* @__PURE__ */ jsx7(Icon, { icon, size: authType === "telegram" ? "20px" : "13px" }) }),
1219
+ /* @__PURE__ */ jsx7(IdentifierText, { variant: "bodyS", weight: "medium", children: displayName || defaultDisplayName({ authType, identifier }) })
1200
1220
  ] });
1201
1221
  };
1202
1222
  var Container4 = styled7.div`
@@ -1256,6 +1276,7 @@ export {
1256
1276
  getCurrencyCodes,
1257
1277
  getDeviceLogo,
1258
1278
  getDeviceModelName,
1279
+ getExternalWalletDisplayName,
1259
1280
  getNetworkFromChainId,
1260
1281
  getNetworkOrMainNetEquivalent,
1261
1282
  getNetworkTestEquivalent,
package/dist/index.js.br CHANGED
Binary file
package/dist/index.js.gz CHANGED
Binary file
@@ -0,0 +1,5 @@
1
+ import { WalletType } from '@getpara/web-sdk';
2
+ export declare const getExternalWalletDisplayName: ({ address, type }: {
3
+ address: string;
4
+ type: WalletType;
5
+ }) => string;
@@ -33,3 +33,4 @@ export * from './getDeviceModelName.js';
33
33
  export * from './getBrowserName.js';
34
34
  export * from './formatBiometricHints.js';
35
35
  export * from './formatPhoneNumber.js';
36
+ export * from './getExternalWalletDisplayName.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@getpara/react-common",
3
- "version": "1.6.0",
3
+ "version": "1.7.1",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -11,8 +11,8 @@
11
11
  "*.css"
12
12
  ],
13
13
  "dependencies": {
14
- "@getpara/react-components": "1.6.0",
15
- "@getpara/web-sdk": "1.6.0",
14
+ "@getpara/react-components": "1.7.1",
15
+ "@getpara/web-sdk": "1.7.1",
16
16
  "@moonpay/moonpay-react": "^1.8.3",
17
17
  "@ramp-network/ramp-instant-sdk": "^4.0.5",
18
18
  "@stripe/crypto": "^0.0.4",
@@ -43,5 +43,5 @@
43
43
  "resolutions": {
44
44
  "styled-components": "^6"
45
45
  },
46
- "gitHead": "2dd6c8ea893d72d693804e5c5b0856d2ea6c3a7a"
46
+ "gitHead": "767395af96d4a724946a092de760e9137a73369a"
47
47
  }