@getpara/react-common 1.7.0 → 2.0.0-dev.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.
- package/dist/classes/ParaInternal.d.ts +3 -10
- package/dist/index.js +4 -48
- package/dist/index.js.br +0 -0
- package/dist/index.js.gz +0 -0
- package/dist/types/externalWalletCommon.d.ts +50 -0
- package/dist/types/index.d.ts +3 -2
- package/dist/utils/index.d.ts +0 -2
- package/package.json +5 -6
- package/dist/package.json +0 -4
- package/dist/utils/formatPhoneNumber.d.ts +0 -1
- package/dist/utils/getExternalWalletDisplayName.d.ts +0 -5
|
@@ -1,21 +1,14 @@
|
|
|
1
1
|
import ParaWeb from '@getpara/web-sdk';
|
|
2
2
|
export declare class ParaInternal extends ParaWeb {
|
|
3
3
|
getSupportedCreateAuthMethods: () => Promise<Set<import("@getpara/web-sdk").AuthMethod>>;
|
|
4
|
-
isUsingExternalWallet: () => boolean;
|
|
5
4
|
getTransmissionKeyShares: ({ isForNewDevice }?: {
|
|
6
5
|
isForNewDevice?: boolean;
|
|
7
6
|
}) => Promise<any>;
|
|
8
|
-
userSetupAfterLogin: () => Promise<
|
|
9
|
-
data: {
|
|
10
|
-
partnerId?: string;
|
|
11
|
-
needsWallet?: boolean;
|
|
12
|
-
sessionLookupId: string;
|
|
13
|
-
};
|
|
14
|
-
}>;
|
|
7
|
+
userSetupAfterLogin: () => Promise<import("@getpara/user-management-client").SessionInfo>;
|
|
15
8
|
setLoginEncryptionKeyPair: (keyPair?: import("node-forge").pki.rsa.KeyPair) => Promise<void>;
|
|
16
|
-
getPortalURL: (
|
|
9
|
+
getPortalURL: () => Promise<string>;
|
|
17
10
|
isProviderModalDisabled: () => boolean;
|
|
18
|
-
supportedAuthMethods: (auth: import("@getpara/user-management-client").Auth) => Promise<Set<import("@getpara/web-sdk").AuthMethod>>;
|
|
11
|
+
supportedAuthMethods: (auth: import("@getpara/user-management-client").Auth<import("@getpara/user-management-client").PrimaryAuthType | "userId">) => Promise<Set<import("@getpara/web-sdk").AuthMethod>>;
|
|
19
12
|
getUserBiometricLocationHints: () => Promise<import("@getpara/user-management-client").BiometricLocationHint[]>;
|
|
20
13
|
exitLoops: () => void;
|
|
21
14
|
exitLogin: () => void;
|
package/dist/index.js
CHANGED
|
@@ -45,7 +45,6 @@ var ParaInternal = class extends ParaWeb {
|
|
|
45
45
|
constructor() {
|
|
46
46
|
super(...arguments);
|
|
47
47
|
this.getSupportedCreateAuthMethods = super.getSupportedCreateAuthMethods;
|
|
48
|
-
this.isUsingExternalWallet = super.isUsingExternalWallet;
|
|
49
48
|
this.getTransmissionKeyShares = super.getTransmissionKeyShares;
|
|
50
49
|
this.userSetupAfterLogin = super.userSetupAfterLogin;
|
|
51
50
|
this.setLoginEncryptionKeyPair = super.setLoginEncryptionKeyPair;
|
|
@@ -384,47 +383,6 @@ var formatBiometricHints = (hints) => {
|
|
|
384
383
|
};
|
|
385
384
|
};
|
|
386
385
|
|
|
387
|
-
// src/utils/formatPhoneNumber.ts
|
|
388
|
-
import parsePhoneNumberFromString from "libphonenumber-js";
|
|
389
|
-
var formatPhoneNumber = (phone, countryCode) => {
|
|
390
|
-
phone = phone.toString();
|
|
391
|
-
countryCode = countryCode == null ? void 0 : countryCode.toString();
|
|
392
|
-
let sanitizedNumber, parsedNumber;
|
|
393
|
-
if (!!countryCode) {
|
|
394
|
-
sanitizedNumber = phone.replace(/\D/g, "");
|
|
395
|
-
if (/^\+\d+$/.test(countryCode)) {
|
|
396
|
-
countryCode = countryCode.slice(1);
|
|
397
|
-
}
|
|
398
|
-
parsedNumber = parsePhoneNumberFromString(sanitizedNumber, { defaultCallingCode: countryCode });
|
|
399
|
-
} else {
|
|
400
|
-
sanitizedNumber = `${phone.startsWith("+") ? "" : "+"}${phone.replace(/[^\d+]/g, "")}`;
|
|
401
|
-
parsedNumber = parsePhoneNumberFromString(sanitizedNumber);
|
|
402
|
-
}
|
|
403
|
-
if (parsedNumber == null ? void 0 : parsedNumber.isValid()) {
|
|
404
|
-
return parsedNumber.formatInternational();
|
|
405
|
-
}
|
|
406
|
-
return null;
|
|
407
|
-
};
|
|
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
|
-
|
|
428
386
|
// src/utils/index.ts
|
|
429
387
|
function getCurrencyCodes({ assetInfo, allowedAssets, defaultOnRampNetwork, defaultOnRampAsset }, {
|
|
430
388
|
provider,
|
|
@@ -1182,8 +1140,9 @@ var DeviceLogo = styled6(CpslIcon3)`
|
|
|
1182
1140
|
// src/components/UserIdentifier.tsx
|
|
1183
1141
|
import { CpslAvatar, CpslIcon as CpslIcon4, CpslText as CpslText5 } from "@getpara/react-components";
|
|
1184
1142
|
import styled7 from "styled-components";
|
|
1143
|
+
import { formatPhoneNumber } from "@getpara/web-sdk";
|
|
1185
1144
|
import { jsx as jsx7, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
1186
|
-
function defaultDisplayName(
|
|
1145
|
+
function defaultDisplayName(authType, identifier) {
|
|
1187
1146
|
switch (authType) {
|
|
1188
1147
|
case "email":
|
|
1189
1148
|
return identifier.toLowerCase();
|
|
@@ -1198,7 +1157,6 @@ function defaultDisplayName({ authType, identifier }) {
|
|
|
1198
1157
|
}
|
|
1199
1158
|
}
|
|
1200
1159
|
var UserIdentifier = ({ identifier, authType, displayName, pfpUrl }) => {
|
|
1201
|
-
const shouldHideAvatar = authType === "externalWallet";
|
|
1202
1160
|
let icon;
|
|
1203
1161
|
switch (authType) {
|
|
1204
1162
|
case "email":
|
|
@@ -1215,8 +1173,8 @@ var UserIdentifier = ({ identifier, authType, displayName, pfpUrl }) => {
|
|
|
1215
1173
|
break;
|
|
1216
1174
|
}
|
|
1217
1175
|
return /* @__PURE__ */ jsxs5(Container4, { children: [
|
|
1218
|
-
|
|
1219
|
-
/* @__PURE__ */ jsx7(IdentifierText, { variant: "bodyS", weight: "medium", children: displayName || defaultDisplayName(
|
|
1176
|
+
/* @__PURE__ */ jsx7(IconContainer, { children: pfpUrl ? /* @__PURE__ */ jsx7(Avatar, { src: pfpUrl, size: "20px" }) : /* @__PURE__ */ jsx7(Icon, { icon, size: authType === "telegram" ? "20px" : "13px" }) }),
|
|
1177
|
+
/* @__PURE__ */ jsx7(IdentifierText, { variant: "bodyS", weight: "medium", children: displayName || defaultDisplayName(authType, identifier) })
|
|
1220
1178
|
] });
|
|
1221
1179
|
};
|
|
1222
1180
|
var Container4 = styled7.div`
|
|
@@ -1268,7 +1226,6 @@ export {
|
|
|
1268
1226
|
TestNetworks,
|
|
1269
1227
|
UserIdentifier,
|
|
1270
1228
|
formatBiometricHints,
|
|
1271
|
-
formatPhoneNumber,
|
|
1272
1229
|
getAssetFromContractAddress,
|
|
1273
1230
|
getBrowserName,
|
|
1274
1231
|
getChainId,
|
|
@@ -1276,7 +1233,6 @@ export {
|
|
|
1276
1233
|
getCurrencyCodes,
|
|
1277
1234
|
getDeviceLogo,
|
|
1278
1235
|
getDeviceModelName,
|
|
1279
|
-
getExternalWalletDisplayName,
|
|
1280
1236
|
getNetworkFromChainId,
|
|
1281
1237
|
getNetworkOrMainNetEquivalent,
|
|
1282
1238
|
getNetworkTestEquivalent,
|
package/dist/index.js.br
CHANGED
|
Binary file
|
package/dist/index.js.gz
CHANGED
|
Binary file
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { WalletType } from '@getpara/web-sdk';
|
|
2
|
+
export type WalletMetadata = {
|
|
3
|
+
id: string;
|
|
4
|
+
name: string;
|
|
5
|
+
iconUrl: string;
|
|
6
|
+
rdns?: string;
|
|
7
|
+
installed?: boolean;
|
|
8
|
+
isExtension?: boolean;
|
|
9
|
+
isMobile?: boolean;
|
|
10
|
+
isWeb?: boolean;
|
|
11
|
+
downloadUrl?: string;
|
|
12
|
+
getQrUri?: () => Promise<string>;
|
|
13
|
+
downloadUrls?: {
|
|
14
|
+
android?: string;
|
|
15
|
+
ios?: string;
|
|
16
|
+
mobile?: string;
|
|
17
|
+
qrCode?: string;
|
|
18
|
+
chrome?: string;
|
|
19
|
+
edge?: string;
|
|
20
|
+
firefox?: string;
|
|
21
|
+
opera?: string;
|
|
22
|
+
safari?: string;
|
|
23
|
+
browserExtension?: string;
|
|
24
|
+
macos?: string;
|
|
25
|
+
windows?: string;
|
|
26
|
+
linux?: string;
|
|
27
|
+
desktop?: string;
|
|
28
|
+
};
|
|
29
|
+
};
|
|
30
|
+
export type CommonWallet = {
|
|
31
|
+
connect: () => Promise<{
|
|
32
|
+
address?: string;
|
|
33
|
+
bufferAddress?: string;
|
|
34
|
+
error?: string;
|
|
35
|
+
userExists: boolean;
|
|
36
|
+
isVerified: boolean;
|
|
37
|
+
}>;
|
|
38
|
+
connectMobile: (isManualWalletConnect?: boolean) => Promise<{
|
|
39
|
+
address?: string;
|
|
40
|
+
bufferAddress?: string;
|
|
41
|
+
error?: string;
|
|
42
|
+
userExists: boolean;
|
|
43
|
+
isVerified: boolean;
|
|
44
|
+
}>;
|
|
45
|
+
type: WalletType;
|
|
46
|
+
} & WalletMetadata;
|
|
47
|
+
export type CommonChain = {
|
|
48
|
+
id: string | number;
|
|
49
|
+
name: string;
|
|
50
|
+
};
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { AuthInfo } from '@getpara/user-management-client';
|
|
2
2
|
import ParaWeb, { type OnRampConfig, type OnRampPurchase } from '@getpara/web-sdk';
|
|
3
|
+
export * from './externalWalletCommon.js';
|
|
3
4
|
export type Props = {
|
|
4
5
|
appName?: string;
|
|
5
6
|
para: ParaWeb;
|
|
@@ -10,7 +11,7 @@ export type Props = {
|
|
|
10
11
|
onRampPurchase: OnRampPurchase;
|
|
11
12
|
setOnRampPurchase?: (_: OnRampPurchase) => void;
|
|
12
13
|
};
|
|
13
|
-
export type ModalAuthInfo =
|
|
14
|
+
export type ModalAuthInfo = AuthInfo & Partial<{
|
|
14
15
|
pfpUrl: string | null;
|
|
15
16
|
displayName: string | null;
|
|
16
17
|
}>;
|
package/dist/utils/index.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@getpara/react-common",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0-dev.0",
|
|
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": "
|
|
15
|
-
"@getpara/web-sdk": "
|
|
14
|
+
"@getpara/react-components": "2.0.0-dev.0",
|
|
15
|
+
"@getpara/web-sdk": "2.0.0-dev.0",
|
|
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",
|
|
@@ -23,8 +23,7 @@
|
|
|
23
23
|
},
|
|
24
24
|
"scripts": {
|
|
25
25
|
"build": "rm -rf dist && yarn typegen && node ./scripts/build.mjs",
|
|
26
|
-
"typegen": "tsc --emitDeclarationOnly"
|
|
27
|
-
"test": "vitest run --coverage"
|
|
26
|
+
"typegen": "tsc --emitDeclarationOnly"
|
|
28
27
|
},
|
|
29
28
|
"devDependencies": {
|
|
30
29
|
"@types/react": "^18.0.31",
|
|
@@ -43,5 +42,5 @@
|
|
|
43
42
|
"resolutions": {
|
|
44
43
|
"styled-components": "^6"
|
|
45
44
|
},
|
|
46
|
-
"gitHead": "
|
|
45
|
+
"gitHead": "f94ef031ef0e1894f5f0800e55f6ca2904641780"
|
|
47
46
|
}
|
package/dist/package.json
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const formatPhoneNumber: (phone: string, countryCode?: string) => string | null;
|