@getpara/core-sdk 2.0.0-alpha.5 → 2.0.0-alpha.7

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.
@@ -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 ? { authInfo: JSON.stringify(this.authInfo) } : {}), isOnRamp ? { sessionId } : {}), isLogin ? __spreadProps(__spreadValues({
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 ? {
@@ -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.3";
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/index.js CHANGED
@@ -34,6 +34,7 @@ __export(src_exports, {
34
34
  NON_ED25519: () => import_user_management_client.NON_ED25519,
35
35
  Network: () => import_user_management_client.Network,
36
36
  OAUTH_METHODS: () => import_user_management_client.OAUTH_METHODS,
37
+ OAuthMethod: () => import_user_management_client.OAuthMethod,
37
38
  OnRampAsset: () => import_user_management_client.OnRampAsset,
38
39
  OnRampMethod: () => import_types.OnRampMethod,
39
40
  OnRampProvider: () => import_user_management_client.OnRampProvider,
@@ -46,6 +47,8 @@ __export(src_exports, {
46
47
  STORAGE_PREFIX: () => import_constants.PREFIX,
47
48
  WALLET_SCHEMES: () => import_user_management_client.WALLET_SCHEMES,
48
49
  WALLET_TYPES: () => import_user_management_client.WALLET_TYPES,
50
+ WalletScheme: () => import_user_management_client.WalletScheme,
51
+ WalletType: () => import_user_management_client.WalletType,
49
52
  constructUrl: () => import_utils.constructUrl,
50
53
  decryptPrivateKey: () => import_utils2.decryptPrivateKey,
51
54
  decryptPrivateKeyAndDecryptShare: () => import_utils2.decryptPrivateKeyAndDecryptShare,
@@ -113,6 +116,7 @@ var src_default = import_ParaCore.ParaCore;
113
116
  NON_ED25519,
114
117
  Network,
115
118
  OAUTH_METHODS,
119
+ OAuthMethod,
116
120
  OnRampAsset,
117
121
  OnRampMethod,
118
122
  OnRampProvider,
@@ -125,6 +129,8 @@ var src_default = import_ParaCore.ParaCore;
125
129
  STORAGE_PREFIX,
126
130
  WALLET_SCHEMES,
127
131
  WALLET_TYPES,
132
+ WalletScheme,
133
+ WalletType,
128
134
  constructUrl,
129
135
  decryptPrivateKey,
130
136
  decryptPrivateKeyAndDecryptShare,
@@ -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
  });
@@ -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 ? { authInfo: JSON.stringify(this.authInfo) } : {}), isOnRamp ? { sessionId } : {}), isLogin ? __spreadProps(__spreadValues({
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 ? {
@@ -1,5 +1,5 @@
1
1
  import "./chunk-7B52C2XE.js";
2
- const PARA_CORE_VERSION = "2.0.0-alpha.3";
2
+ const PARA_CORE_VERSION = "2.0.0-alpha.6";
3
3
  const PREFIX = "@CAPSULE/";
4
4
  const LOCAL_STORAGE_AUTH_INFO = `${PREFIX}authInfo`;
5
5
  const LOCAL_STORAGE_EMAIL = `${PREFIX}e-mail`;
package/dist/esm/index.js CHANGED
@@ -4,10 +4,13 @@ import {
4
4
  AuthMethod,
5
5
  EmailTheme,
6
6
  Network,
7
+ WalletType,
8
+ WalletScheme,
7
9
  OnRampAsset,
8
10
  OnRampPurchaseType,
9
11
  OnRampProvider,
10
12
  OnRampPurchaseStatus,
13
+ OAuthMethod,
11
14
  NON_ED25519,
12
15
  PREGEN_IDENTIFIER_TYPES,
13
16
  WALLET_TYPES,
@@ -65,6 +68,7 @@ export {
65
68
  NON_ED25519,
66
69
  Network,
67
70
  OAUTH_METHODS,
71
+ OAuthMethod,
68
72
  OnRampAsset,
69
73
  OnRampMethod,
70
74
  OnRampProvider,
@@ -77,6 +81,8 @@ export {
77
81
  PREFIX as STORAGE_PREFIX,
78
82
  WALLET_SCHEMES,
79
83
  WALLET_TYPES,
84
+ WalletScheme,
85
+ WalletType,
80
86
  constructUrl,
81
87
  decryptPrivateKey,
82
88
  decryptPrivateKeyAndDecryptShare,
@@ -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
  };
@@ -1,5 +1,5 @@
1
1
  import { ParaCore } from './ParaCore.js';
2
- export { type AuthInfo, type PrimaryAuthInfo, type VerifiedAuthInfo, AuthMethod, type AuthExtras, type CurrentWalletIds, EmailTheme, type PartnerEntity, type WalletEntity, Network, type TWalletType, type TWalletScheme, OnRampAsset, OnRampPurchaseType, OnRampProvider, OnRampPurchaseStatus, type OnRampConfig, type OnRampAllowedAssets, type OnRampPurchase, type TOAuthMethod, type SupportedWalletTypes, type TPregenIdentifierType, type PregenIds, NON_ED25519, PREGEN_IDENTIFIER_TYPES, WALLET_TYPES, WALLET_SCHEMES, OAUTH_METHODS, } from '@getpara/user-management-client';
2
+ export { type AuthInfo, type PrimaryAuthInfo, type VerifiedAuthInfo, AuthMethod, type AuthExtras, type CurrentWalletIds, EmailTheme, type PartnerEntity, type WalletEntity, Network, WalletType, type TWalletType, WalletScheme, type TWalletScheme, OnRampAsset, OnRampPurchaseType, OnRampProvider, OnRampPurchaseStatus, type OnRampConfig, type OnRampAllowedAssets, type OnRampPurchase, OAuthMethod, type TOAuthMethod, type SupportedWalletTypes, type TPregenIdentifierType, type PregenIds, NON_ED25519, PREGEN_IDENTIFIER_TYPES, WALLET_TYPES, WALLET_SCHEMES, OAUTH_METHODS, } from '@getpara/user-management-client';
3
3
  export { OnRampMethod, PopupType, PregenIdentifierType, RecoveryStatus, type AuthStateSignup, type AuthStateVerify, type AuthStateLogin, type AuthState, type OAuthResponse, type CoreAuthInfo, type ProviderAssetInfo, type SignatureRes, type FullSignatureRes, type SuccessfulSignatureRes, type DeniedSignatureRes, type DeniedSignatureResWithUrl, type OnRampAssetInfo, type Theme, type Wallet, type GetWalletBalanceParams, } from './types/index.js';
4
4
  export * from './types/coreApi.js';
5
5
  export * from './types/events.js';
@@ -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.5",
3
+ "version": "2.0.0-alpha.7",
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.5",
13
+ "@getpara/user-management-client": "2.0.0-alpha.7",
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": "3ecfca088f24489f2e8fa5493d0f4459b08880e1"
44
+ "gitHead": "0a6b297b70c7f9b7b93381944e3f5314252ad6a5"
45
45
  }