@getpara/core-sdk 2.0.0-alpha.5 → 2.0.0-alpha.6
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/cjs/ParaCore.js
CHANGED
|
@@ -722,7 +722,12 @@ const _ParaCore = class _ParaCore {
|
|
|
722
722
|
portalTextColor: this.portalTextColor,
|
|
723
723
|
portalPrimaryButtonTextColor: this.portalPrimaryButtonTextColor,
|
|
724
724
|
isForNewDevice: opts.isForNewDevice ? opts.isForNewDevice.toString() : void 0
|
|
725
|
-
}, isCreate || isLogin ?
|
|
725
|
+
}, isCreate || isLogin ? __spreadProps(__spreadValues({
|
|
726
|
+
authInfo: JSON.stringify(this.authInfo)
|
|
727
|
+
}, (0, import_user_management_client.isPhone)(this.authInfo.auth) ? (0, import_utils2.splitPhoneNumber)(this.authInfo.auth.phone) : this.authInfo.auth), {
|
|
728
|
+
pfpUrl: this.authInfo.pfpUrl,
|
|
729
|
+
displayName: this.authInfo.displayName
|
|
730
|
+
}) : {}), isOnRamp ? { sessionId } : {}), isLogin ? __spreadProps(__spreadValues({
|
|
726
731
|
sessionId: thisDevice.sessionId,
|
|
727
732
|
encryptionKey: thisDevice.encryptionKey
|
|
728
733
|
}, opts.newDevice ? {
|
package/dist/cjs/constants.js
CHANGED
|
@@ -39,7 +39,7 @@ __export(constants_exports, {
|
|
|
39
39
|
SHORT_POLLING_INTERVAL_MS: () => SHORT_POLLING_INTERVAL_MS
|
|
40
40
|
});
|
|
41
41
|
module.exports = __toCommonJS(constants_exports);
|
|
42
|
-
const PARA_CORE_VERSION = "2.0.0-alpha.
|
|
42
|
+
const PARA_CORE_VERSION = "2.0.0-alpha.6";
|
|
43
43
|
const PREFIX = "@CAPSULE/";
|
|
44
44
|
const LOCAL_STORAGE_AUTH_INFO = `${PREFIX}authInfo`;
|
|
45
45
|
const LOCAL_STORAGE_EMAIL = `${PREFIX}e-mail`;
|
package/dist/cjs/utils/phone.js
CHANGED
|
@@ -28,7 +28,8 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
28
28
|
var phone_exports = {};
|
|
29
29
|
__export(phone_exports, {
|
|
30
30
|
displayPhoneNumber: () => displayPhoneNumber,
|
|
31
|
-
formatPhoneNumber: () => formatPhoneNumber
|
|
31
|
+
formatPhoneNumber: () => formatPhoneNumber,
|
|
32
|
+
splitPhoneNumber: () => splitPhoneNumber
|
|
32
33
|
});
|
|
33
34
|
module.exports = __toCommonJS(phone_exports);
|
|
34
35
|
var import_libphonenumber_js = __toESM(require("libphonenumber-js"));
|
|
@@ -54,8 +55,19 @@ function formatPhoneNumber(phone, countryCode, { forDisplay = false } = {}) {
|
|
|
54
55
|
function displayPhoneNumber(phone, countryCode) {
|
|
55
56
|
return formatPhoneNumber(phone, countryCode, { forDisplay: true });
|
|
56
57
|
}
|
|
58
|
+
function splitPhoneNumber(phone) {
|
|
59
|
+
const parsedNumber = (0, import_libphonenumber_js.default)(phone);
|
|
60
|
+
if (parsedNumber == null ? void 0 : parsedNumber.isValid()) {
|
|
61
|
+
return {
|
|
62
|
+
phone: parsedNumber.nationalNumber.replace(/\D/g, ""),
|
|
63
|
+
countryCode: `+${parsedNumber.countryCallingCode}`
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
throw new Error("Invalid phone number");
|
|
67
|
+
}
|
|
57
68
|
// Annotate the CommonJS export names for ESM import in node:
|
|
58
69
|
0 && (module.exports = {
|
|
59
70
|
displayPhoneNumber,
|
|
60
|
-
formatPhoneNumber
|
|
71
|
+
formatPhoneNumber,
|
|
72
|
+
splitPhoneNumber
|
|
61
73
|
});
|
package/dist/esm/ParaCore.js
CHANGED
|
@@ -68,7 +68,8 @@ import {
|
|
|
68
68
|
truncateAddress,
|
|
69
69
|
WalletSchemeTypeMap,
|
|
70
70
|
shortenUrl,
|
|
71
|
-
isServerAuthState
|
|
71
|
+
isServerAuthState,
|
|
72
|
+
splitPhoneNumber
|
|
72
73
|
} from "./utils/index.js";
|
|
73
74
|
import { TransactionReviewDenied, TransactionReviewTimeout } from "./errors.js";
|
|
74
75
|
import * as constants from "./constants.js";
|
|
@@ -684,7 +685,12 @@ const _ParaCore = class _ParaCore {
|
|
|
684
685
|
portalTextColor: this.portalTextColor,
|
|
685
686
|
portalPrimaryButtonTextColor: this.portalPrimaryButtonTextColor,
|
|
686
687
|
isForNewDevice: opts.isForNewDevice ? opts.isForNewDevice.toString() : void 0
|
|
687
|
-
}, isCreate || isLogin ?
|
|
688
|
+
}, isCreate || isLogin ? __spreadProps(__spreadValues({
|
|
689
|
+
authInfo: JSON.stringify(this.authInfo)
|
|
690
|
+
}, isPhone(this.authInfo.auth) ? splitPhoneNumber(this.authInfo.auth.phone) : this.authInfo.auth), {
|
|
691
|
+
pfpUrl: this.authInfo.pfpUrl,
|
|
692
|
+
displayName: this.authInfo.displayName
|
|
693
|
+
}) : {}), isOnRamp ? { sessionId } : {}), isLogin ? __spreadProps(__spreadValues({
|
|
688
694
|
sessionId: thisDevice.sessionId,
|
|
689
695
|
encryptionKey: thisDevice.encryptionKey
|
|
690
696
|
}, opts.newDevice ? {
|
package/dist/esm/constants.js
CHANGED
package/dist/esm/utils/phone.js
CHANGED
|
@@ -22,7 +22,18 @@ function formatPhoneNumber(phone, countryCode, { forDisplay = false } = {}) {
|
|
|
22
22
|
function displayPhoneNumber(phone, countryCode) {
|
|
23
23
|
return formatPhoneNumber(phone, countryCode, { forDisplay: true });
|
|
24
24
|
}
|
|
25
|
+
function splitPhoneNumber(phone) {
|
|
26
|
+
const parsedNumber = parsePhoneNumberFromString(phone);
|
|
27
|
+
if (parsedNumber == null ? void 0 : parsedNumber.isValid()) {
|
|
28
|
+
return {
|
|
29
|
+
phone: parsedNumber.nationalNumber.replace(/\D/g, ""),
|
|
30
|
+
countryCode: `+${parsedNumber.countryCallingCode}`
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
throw new Error("Invalid phone number");
|
|
34
|
+
}
|
|
25
35
|
export {
|
|
26
36
|
displayPhoneNumber,
|
|
27
|
-
formatPhoneNumber
|
|
37
|
+
formatPhoneNumber,
|
|
38
|
+
splitPhoneNumber
|
|
28
39
|
};
|
|
@@ -5,3 +5,7 @@ export declare function formatPhoneNumber(phone: string, countryCode: string | u
|
|
|
5
5
|
forDisplay: true;
|
|
6
6
|
}): string | null;
|
|
7
7
|
export declare function displayPhoneNumber(phone: string, countryCode?: string): string;
|
|
8
|
+
export declare function splitPhoneNumber(phone: `+${number}`): {
|
|
9
|
+
phone: string;
|
|
10
|
+
countryCode: string;
|
|
11
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@getpara/core-sdk",
|
|
3
|
-
"version": "2.0.0-alpha.
|
|
3
|
+
"version": "2.0.0-alpha.6",
|
|
4
4
|
"main": "dist/cjs/index.js",
|
|
5
5
|
"module": "dist/esm/index.js",
|
|
6
6
|
"types": "dist/types/index.d.ts",
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
"@celo/utils": "^8.0.2",
|
|
11
11
|
"@cosmjs/encoding": "^0.32.4",
|
|
12
12
|
"@ethereumjs/util": "^9.1.0",
|
|
13
|
-
"@getpara/user-management-client": "2.0.0-alpha.
|
|
13
|
+
"@getpara/user-management-client": "2.0.0-alpha.6",
|
|
14
14
|
"@noble/hashes": "^1.5.0",
|
|
15
15
|
"base64url": "^3.0.1",
|
|
16
16
|
"libphonenumber-js": "1.11.2",
|
|
@@ -41,5 +41,5 @@
|
|
|
41
41
|
"require": "./dist/cjs/index.js"
|
|
42
42
|
}
|
|
43
43
|
},
|
|
44
|
-
"gitHead": "
|
|
44
|
+
"gitHead": "d3b01a8fb475c2af9bf255800bc10d05e011b2eb"
|
|
45
45
|
}
|