@getpara/react-common 2.0.0-alpha.42 → 2.0.0-alpha.43
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/components/UserIdentifier.d.ts +3 -1
- package/dist/components/UserIdentifier.js +6 -5
- package/dist/constants/oAuthLogos.d.ts +12 -0
- package/dist/constants/oAuthLogos.js +160 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/types/commonTypes.d.ts +15 -0
- package/dist/types/commonTypes.js +1 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/index.js +1 -0
- package/dist/utils/getExternalWalletDisplayName.d.ts +3 -1
- package/dist/utils/getExternalWalletDisplayName.js +6 -14
- package/dist/utils/getExternalWalletIcon.d.ts +5 -0
- package/dist/utils/getExternalWalletIcon.js +17 -0
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/index.js +1 -0
- package/package.json +4 -4
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { IconType } from '@getpara/react-components';
|
|
2
2
|
import { CoreAuthInfo } from '@getpara/web-sdk';
|
|
3
|
-
export declare function getAuthDisplay(authInfo: CoreAuthInfo
|
|
3
|
+
export declare function getAuthDisplay(authInfo: CoreAuthInfo, { withAddress }?: {
|
|
4
|
+
withAddress?: boolean;
|
|
5
|
+
}): {
|
|
4
6
|
name: string | null;
|
|
5
7
|
icon?: IconType;
|
|
6
8
|
src?: string;
|
|
@@ -5,8 +5,9 @@ import {
|
|
|
5
5
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
6
|
import { CpslAvatar, CpslIcon, CpslText } from "@getpara/react-components";
|
|
7
7
|
import { displayPhoneNumber, truncateAddress } from "@getpara/web-sdk";
|
|
8
|
-
import { getExternalWalletDisplayName, safeStyled } from "../utils/index.js";
|
|
9
|
-
function getAuthDisplay(authInfo) {
|
|
8
|
+
import { getExternalWalletDisplayName, getExternalWalletIcon, safeStyled } from "../utils/index.js";
|
|
9
|
+
function getAuthDisplay(authInfo, { withAddress = false } = {}) {
|
|
10
|
+
var _a;
|
|
10
11
|
const { authType, displayName, identifier, pfpUrl, externalWallet } = authInfo;
|
|
11
12
|
switch (authType) {
|
|
12
13
|
case "email":
|
|
@@ -21,8 +22,8 @@ function getAuthDisplay(authInfo) {
|
|
|
21
22
|
}, pfpUrl ? { src: pfpUrl } : { icon: "telegramBrand" });
|
|
22
23
|
case "externalWallet":
|
|
23
24
|
return {
|
|
24
|
-
name: externalWallet ? getExternalWalletDisplayName(externalWallet) : truncateAddress(identifier, "EVM"),
|
|
25
|
-
icon: "
|
|
25
|
+
name: externalWallet ? getExternalWalletDisplayName(externalWallet, { withAddress }) : truncateAddress(identifier, "EVM"),
|
|
26
|
+
icon: (_a = getExternalWalletIcon(externalWallet == null ? void 0 : externalWallet.providerId)) != null ? _a : "wallet02"
|
|
26
27
|
};
|
|
27
28
|
default:
|
|
28
29
|
return { name: null, icon: null };
|
|
@@ -33,7 +34,7 @@ const UserIdentifier = ({ authInfo }) => {
|
|
|
33
34
|
return null;
|
|
34
35
|
}
|
|
35
36
|
const { authType } = authInfo;
|
|
36
|
-
const { name, icon, src } = getAuthDisplay(authInfo);
|
|
37
|
+
const { name, icon, src } = getAuthDisplay(authInfo, { withAddress: true });
|
|
37
38
|
return /* @__PURE__ */ jsxs(Container, { children: [
|
|
38
39
|
/* @__PURE__ */ jsx(IconContainer, { children: src ? /* @__PURE__ */ jsx(Avatar, { src, size: "20px", variant: "round" }) : /* @__PURE__ */ jsx(Icon, { icon, size: authType === "telegram" ? "20px" : "13px" }) }),
|
|
39
40
|
/* @__PURE__ */ jsx(IdentifierText, { variant: "bodyS", weight: "medium", children: name })
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { IconType } from '@getpara/react-components';
|
|
2
|
+
import { TLinkedAccountType } from '@getpara/web-sdk';
|
|
3
|
+
import { DisplayMetadata } from '../types/commonTypes.js';
|
|
4
|
+
export declare const ACCOUNT_TYPES: {
|
|
5
|
+
[key in TLinkedAccountType | string]: DisplayMetadata & {
|
|
6
|
+
isExternalWallet?: boolean;
|
|
7
|
+
};
|
|
8
|
+
};
|
|
9
|
+
export declare function getAccountTypeName(type: TLinkedAccountType | string | undefined, { inline }?: {
|
|
10
|
+
inline?: boolean;
|
|
11
|
+
}): string | undefined;
|
|
12
|
+
export declare function getAccountTypeLogo(type: TLinkedAccountType | undefined): IconType | undefined;
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import "../chunk-GOCCUU3Z.js";
|
|
3
|
+
const ACCOUNT_TYPES = {
|
|
4
|
+
"EMAIL": {
|
|
5
|
+
icon: "mail",
|
|
6
|
+
name: "Email",
|
|
7
|
+
inlineText: "email address",
|
|
8
|
+
isPlain: true
|
|
9
|
+
},
|
|
10
|
+
"PHONE": {
|
|
11
|
+
icon: "phone",
|
|
12
|
+
name: "Phone",
|
|
13
|
+
inlineText: "phone number",
|
|
14
|
+
isPlain: true
|
|
15
|
+
},
|
|
16
|
+
"EXTERNAL_WALLET": {
|
|
17
|
+
icon: "wallet",
|
|
18
|
+
name: "External Wallet",
|
|
19
|
+
inlineText: "external wallet",
|
|
20
|
+
isPlain: true
|
|
21
|
+
},
|
|
22
|
+
"GOOGLE": {
|
|
23
|
+
icon: "google",
|
|
24
|
+
iconBranded: "googleBrand",
|
|
25
|
+
name: "Google"
|
|
26
|
+
},
|
|
27
|
+
"TWITTER": {
|
|
28
|
+
icon: "twitter",
|
|
29
|
+
// Not using branded here to ensure the icon looks correct in dark mode
|
|
30
|
+
iconBranded: "twitter",
|
|
31
|
+
name: "X / Twitter",
|
|
32
|
+
inlineText: "X account",
|
|
33
|
+
isDark: true
|
|
34
|
+
},
|
|
35
|
+
"APPLE": {
|
|
36
|
+
icon: "apple",
|
|
37
|
+
// Not using branded here to ensure the icon looks correct in dark mode
|
|
38
|
+
iconBranded: "apple",
|
|
39
|
+
name: "Apple",
|
|
40
|
+
isDark: true
|
|
41
|
+
},
|
|
42
|
+
"DISCORD": {
|
|
43
|
+
icon: "discord",
|
|
44
|
+
iconBranded: "discordBrand",
|
|
45
|
+
name: "Discord"
|
|
46
|
+
},
|
|
47
|
+
"FACEBOOK": {
|
|
48
|
+
icon: "facebook",
|
|
49
|
+
iconBranded: "facebookBrand",
|
|
50
|
+
name: "Facebook"
|
|
51
|
+
},
|
|
52
|
+
"FARCASTER": {
|
|
53
|
+
icon: "farcaster",
|
|
54
|
+
iconBranded: "farcasterBrand",
|
|
55
|
+
name: "Farcaster"
|
|
56
|
+
},
|
|
57
|
+
"TELEGRAM": {
|
|
58
|
+
icon: "telegram",
|
|
59
|
+
iconBranded: "telegramBrand",
|
|
60
|
+
name: "Telegram"
|
|
61
|
+
},
|
|
62
|
+
"MetaMask": {
|
|
63
|
+
icon: "metamask",
|
|
64
|
+
name: "MetaMask",
|
|
65
|
+
isExternalWallet: true
|
|
66
|
+
},
|
|
67
|
+
"Rainbow": {
|
|
68
|
+
icon: "rainbow",
|
|
69
|
+
name: "Rainbow",
|
|
70
|
+
isExternalWallet: true
|
|
71
|
+
},
|
|
72
|
+
"Coinbase Wallet": {
|
|
73
|
+
icon: "coinbase",
|
|
74
|
+
name: "Coinbase Wallet",
|
|
75
|
+
isExternalWallet: true
|
|
76
|
+
},
|
|
77
|
+
"WalletConnect": {
|
|
78
|
+
icon: "walletConnect",
|
|
79
|
+
name: "WalletConnect",
|
|
80
|
+
isExternalWallet: true
|
|
81
|
+
},
|
|
82
|
+
"Zerion": {
|
|
83
|
+
icon: "zerion",
|
|
84
|
+
name: "Zerion",
|
|
85
|
+
isExternalWallet: true
|
|
86
|
+
},
|
|
87
|
+
"Safe": {
|
|
88
|
+
icon: "safe",
|
|
89
|
+
name: "Safe",
|
|
90
|
+
isExternalWallet: true
|
|
91
|
+
},
|
|
92
|
+
"Rabby": {
|
|
93
|
+
icon: "rabby",
|
|
94
|
+
name: "Rabby",
|
|
95
|
+
isExternalWallet: true
|
|
96
|
+
},
|
|
97
|
+
"OKX Wallet": {
|
|
98
|
+
icon: "okx",
|
|
99
|
+
name: "OKX Wallet",
|
|
100
|
+
isExternalWallet: true
|
|
101
|
+
},
|
|
102
|
+
"Phantom": {
|
|
103
|
+
icon: "phantom",
|
|
104
|
+
name: "Phantom",
|
|
105
|
+
isExternalWallet: true
|
|
106
|
+
},
|
|
107
|
+
"Glow": {
|
|
108
|
+
icon: "glow",
|
|
109
|
+
name: "Glow",
|
|
110
|
+
isExternalWallet: true
|
|
111
|
+
},
|
|
112
|
+
"Backpack": {
|
|
113
|
+
icon: "backpack",
|
|
114
|
+
name: "Backpack",
|
|
115
|
+
isExternalWallet: true
|
|
116
|
+
},
|
|
117
|
+
"Keplr": {
|
|
118
|
+
icon: "keplr",
|
|
119
|
+
name: "Keplr",
|
|
120
|
+
isExternalWallet: true
|
|
121
|
+
},
|
|
122
|
+
"Leap": {
|
|
123
|
+
icon: "leap",
|
|
124
|
+
name: "Leap",
|
|
125
|
+
isExternalWallet: true
|
|
126
|
+
},
|
|
127
|
+
"HaHa": {
|
|
128
|
+
icon: "haha",
|
|
129
|
+
name: "HaHa",
|
|
130
|
+
isExternalWallet: true
|
|
131
|
+
},
|
|
132
|
+
"Cosmostation": {
|
|
133
|
+
icon: "cosmostation",
|
|
134
|
+
name: "Cosmostation",
|
|
135
|
+
isExternalWallet: true
|
|
136
|
+
},
|
|
137
|
+
"Solflare": {
|
|
138
|
+
icon: "solflare",
|
|
139
|
+
name: "Solflare",
|
|
140
|
+
isExternalWallet: true
|
|
141
|
+
},
|
|
142
|
+
"Valora": {
|
|
143
|
+
icon: "valora",
|
|
144
|
+
name: "Valora",
|
|
145
|
+
isExternalWallet: true
|
|
146
|
+
}
|
|
147
|
+
};
|
|
148
|
+
function getAccountTypeName(type, { inline = false } = {}) {
|
|
149
|
+
var _a;
|
|
150
|
+
const data = type ? ACCOUNT_TYPES[type] : void 0;
|
|
151
|
+
return data ? inline ? (_a = data.inlineText) != null ? _a : `${data.name} ${data.isExternalWallet ? "wallet" : "account"}` : data.name : void 0;
|
|
152
|
+
}
|
|
153
|
+
function getAccountTypeLogo(type) {
|
|
154
|
+
return type ? ACCOUNT_TYPES[type].iconBranded || ACCOUNT_TYPES[type].icon : void 0;
|
|
155
|
+
}
|
|
156
|
+
export {
|
|
157
|
+
ACCOUNT_TYPES,
|
|
158
|
+
getAccountTypeLogo,
|
|
159
|
+
getAccountTypeName
|
|
160
|
+
};
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { IconType } from '@getpara/react-components';
|
|
2
|
+
export type Tab<T> = {
|
|
3
|
+
label: string;
|
|
4
|
+
value: T;
|
|
5
|
+
icon: IconType;
|
|
6
|
+
};
|
|
7
|
+
export type DisplayMetadata = {
|
|
8
|
+
name: string;
|
|
9
|
+
inlineText?: string;
|
|
10
|
+
icon: IconType;
|
|
11
|
+
iconBranded?: IconType;
|
|
12
|
+
isDark?: boolean;
|
|
13
|
+
isCircular?: boolean;
|
|
14
|
+
isPlain?: boolean;
|
|
15
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { AuthInfo, OnRampPurchaseUpdateParams } from '@getpara/user-management-client';
|
|
2
2
|
import { OfframpDepositRequest, type OnRampConfig, type OnRampPurchase } from '@getpara/web-sdk';
|
|
3
3
|
export * from './externalWalletCommon.js';
|
|
4
|
+
export * from './commonTypes.js';
|
|
4
5
|
export type OnRampProps = {
|
|
5
6
|
appName?: string;
|
|
6
7
|
email?: string;
|
package/dist/types/index.js
CHANGED
|
@@ -1,2 +1,4 @@
|
|
|
1
1
|
import { ExternalWalletInfo } from '@getpara/user-management-client';
|
|
2
|
-
export declare const getExternalWalletDisplayName: ({ address, type, addressBech32 }: ExternalWalletInfo
|
|
2
|
+
export declare const getExternalWalletDisplayName: ({ address, type, providerId, addressBech32 }: ExternalWalletInfo, { withAddress }?: {
|
|
3
|
+
withAddress?: boolean;
|
|
4
|
+
}) => string;
|
|
@@ -1,21 +1,13 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import "../chunk-GOCCUU3Z.js";
|
|
3
3
|
import { truncateAddress } from "@getpara/web-sdk";
|
|
4
|
-
const getExternalWalletDisplayName = ({ address, type, addressBech32 }) => {
|
|
4
|
+
const getExternalWalletDisplayName = ({ address, type, providerId, addressBech32 }, { withAddress = false } = {}) => {
|
|
5
5
|
const walletType = type;
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
case "SOLANA":
|
|
12
|
-
walletTypeDisplay = "Solana";
|
|
13
|
-
break;
|
|
14
|
-
case "COSMOS":
|
|
15
|
-
walletTypeDisplay = "Cosmos";
|
|
16
|
-
break;
|
|
17
|
-
}
|
|
18
|
-
return `${walletTypeDisplay} ${truncateAddress(addressBech32 != null ? addressBech32 : address, walletType)}`;
|
|
6
|
+
return `${providerId != null ? providerId : {
|
|
7
|
+
EVM: "EVM",
|
|
8
|
+
SOLANA: "Solana",
|
|
9
|
+
COSMOS: "Cosmos"
|
|
10
|
+
}[type]}${withAddress ? ` ${truncateAddress(addressBech32 != null ? addressBech32 : address, walletType)}` : ""}`;
|
|
19
11
|
};
|
|
20
12
|
export {
|
|
21
13
|
getExternalWalletDisplayName
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import "../chunk-GOCCUU3Z.js";
|
|
3
|
+
import { ACCOUNT_TYPES } from "../constants/oAuthLogos.js";
|
|
4
|
+
function getExternalWalletIcon(internalId, { branded = false } = {}) {
|
|
5
|
+
var _a;
|
|
6
|
+
if (!internalId) {
|
|
7
|
+
return "wallet02";
|
|
8
|
+
}
|
|
9
|
+
const data = (_a = ACCOUNT_TYPES) == null ? void 0 : _a[internalId];
|
|
10
|
+
if (!data) {
|
|
11
|
+
return "wallet02";
|
|
12
|
+
}
|
|
13
|
+
return branded ? data.iconBranded || data.icon : data.icon;
|
|
14
|
+
}
|
|
15
|
+
export {
|
|
16
|
+
getExternalWalletIcon
|
|
17
|
+
};
|
package/dist/utils/index.d.ts
CHANGED
package/dist/utils/index.js
CHANGED
|
@@ -107,6 +107,7 @@ export * from "./getDeviceModelName.js";
|
|
|
107
107
|
export * from "./getBrowserName.js";
|
|
108
108
|
export * from "./formatBiometricHints.js";
|
|
109
109
|
export * from "./getExternalWalletDisplayName.js";
|
|
110
|
+
export * from "./getExternalWalletIcon.js";
|
|
110
111
|
export * from "./safeStyled.js";
|
|
111
112
|
export {
|
|
112
113
|
NetworkAssetAddresses,
|
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@getpara/react-common",
|
|
3
|
-
"version": "2.0.0-alpha.
|
|
3
|
+
"version": "2.0.0-alpha.43",
|
|
4
4
|
"dependencies": {
|
|
5
|
-
"@getpara/react-components": "2.0.0-alpha.
|
|
6
|
-
"@getpara/web-sdk": "2.0.0-alpha.
|
|
5
|
+
"@getpara/react-components": "2.0.0-alpha.43",
|
|
6
|
+
"@getpara/web-sdk": "2.0.0-alpha.43",
|
|
7
7
|
"@moonpay/moonpay-react": "^1.8.3",
|
|
8
8
|
"@ramp-network/ramp-instant-sdk": "^4.0.5",
|
|
9
9
|
"libphonenumber-js": "^1.11.7",
|
|
@@ -40,5 +40,5 @@
|
|
|
40
40
|
],
|
|
41
41
|
"type": "module",
|
|
42
42
|
"types": "dist/index.d.ts",
|
|
43
|
-
"gitHead": "
|
|
43
|
+
"gitHead": "6c4b7915c54f51ca0d4abb5c947e5997508669d1"
|
|
44
44
|
}
|