@getpara/core-sdk 2.0.0-alpha.27 → 2.0.0-alpha.29
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 +29 -10
- package/dist/cjs/constants.js +1 -1
- package/dist/esm/ParaCore.js +29 -10
- package/dist/esm/constants.js +1 -1
- package/dist/types/ParaCore.d.ts +2 -1
- package/dist/types/types/methods.d.ts +2 -2
- package/package.json +3 -3
package/dist/cjs/ParaCore.js
CHANGED
|
@@ -720,14 +720,23 @@ const _ParaCore = class _ParaCore {
|
|
|
720
720
|
throw new Error(`invalid URL type ${type}`);
|
|
721
721
|
}
|
|
722
722
|
}
|
|
723
|
-
|
|
723
|
+
let partner = void 0;
|
|
724
|
+
try {
|
|
725
|
+
partner = yield __privateMethod(this, _ParaCore_instances, assertPartner_fn).call(this);
|
|
726
|
+
} catch (e) {
|
|
727
|
+
if (this.isPartnerOptional) {
|
|
728
|
+
partner = void 0;
|
|
729
|
+
} else {
|
|
730
|
+
throw e;
|
|
731
|
+
}
|
|
732
|
+
}
|
|
724
733
|
const thisDevice = (_a = opts.thisDevice) != null ? _a : {
|
|
725
734
|
encryptionKey: (0, import_utils.getPublicKeyHex)(this.loginEncryptionKeyPair),
|
|
726
735
|
sessionId
|
|
727
736
|
};
|
|
728
737
|
const params = __spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues({
|
|
729
738
|
apiKey: this.ctx.apiKey,
|
|
730
|
-
partnerId: partner.id,
|
|
739
|
+
partnerId: partner == null ? void 0 : partner.id,
|
|
731
740
|
portalFont: ((_b = opts.portalTheme) == null ? void 0 : _b.font) || (partner == null ? void 0 : partner.font) || ((_c = this.portalTheme) == null ? void 0 : _c.font),
|
|
732
741
|
portalBorderRadius: ((_d = opts.portalTheme) == null ? void 0 : _d.borderRadius) || ((_e = this.portalTheme) == null ? void 0 : _e.borderRadius),
|
|
733
742
|
portalThemeMode: ((_f = opts.portalTheme) == null ? void 0 : _f.mode) || (partner == null ? void 0 : partner.themeMode) || ((_g = this.portalTheme) == null ? void 0 : _g.mode),
|
|
@@ -1202,8 +1211,15 @@ const _ParaCore = class _ParaCore {
|
|
|
1202
1211
|
}
|
|
1203
1212
|
getPartnerURL() {
|
|
1204
1213
|
return __async(this, null, function* () {
|
|
1205
|
-
|
|
1206
|
-
|
|
1214
|
+
try {
|
|
1215
|
+
const { portalUrl } = yield __privateMethod(this, _ParaCore_instances, assertPartner_fn).call(this);
|
|
1216
|
+
return portalUrl;
|
|
1217
|
+
} catch (e) {
|
|
1218
|
+
if (this.isPartnerOptional) {
|
|
1219
|
+
return void 0;
|
|
1220
|
+
}
|
|
1221
|
+
throw e;
|
|
1222
|
+
}
|
|
1207
1223
|
});
|
|
1208
1224
|
}
|
|
1209
1225
|
/**
|
|
@@ -1704,7 +1720,7 @@ const _ParaCore = class _ParaCore {
|
|
|
1704
1720
|
return __async(this, null, function* () {
|
|
1705
1721
|
var _l = _k, {
|
|
1706
1722
|
method,
|
|
1707
|
-
|
|
1723
|
+
appScheme,
|
|
1708
1724
|
isCanceled = () => false,
|
|
1709
1725
|
onCancel,
|
|
1710
1726
|
onPoll,
|
|
@@ -1712,7 +1728,7 @@ const _ParaCore = class _ParaCore {
|
|
|
1712
1728
|
isLinkAccount
|
|
1713
1729
|
} = _l, urlOptions = __objRest(_l, [
|
|
1714
1730
|
"method",
|
|
1715
|
-
"
|
|
1731
|
+
"appScheme",
|
|
1716
1732
|
"isCanceled",
|
|
1717
1733
|
"onCancel",
|
|
1718
1734
|
"onPoll",
|
|
@@ -1727,7 +1743,7 @@ const _ParaCore = class _ParaCore {
|
|
|
1727
1743
|
} else {
|
|
1728
1744
|
sessionLookupId = yield __privateMethod(this, _ParaCore_instances, prepareLogin_fn).call(this);
|
|
1729
1745
|
}
|
|
1730
|
-
const oAuthUrl = yield __privateMethod(this, _ParaCore_instances, getOAuthUrl_fn).call(this, { method,
|
|
1746
|
+
const oAuthUrl = yield __privateMethod(this, _ParaCore_instances, getOAuthUrl_fn).call(this, { method, appScheme, sessionLookupId, accountLinkInProgress });
|
|
1731
1747
|
onOAuthUrl(oAuthUrl);
|
|
1732
1748
|
} else {
|
|
1733
1749
|
({ sessionLookupId } = yield this.touchSession());
|
|
@@ -3114,6 +3130,9 @@ setAuthInfo_fn = function(authInfo) {
|
|
|
3114
3130
|
};
|
|
3115
3131
|
getPartner_fn = function(partnerId) {
|
|
3116
3132
|
return __async(this, null, function* () {
|
|
3133
|
+
if (this.isPartnerOptional && !partnerId) {
|
|
3134
|
+
return void 0;
|
|
3135
|
+
}
|
|
3117
3136
|
const res = yield this.ctx.client.getPartner(partnerId);
|
|
3118
3137
|
__privateSet(this, _partner, res.data.partner);
|
|
3119
3138
|
return __privateGet(this, _partner);
|
|
@@ -3142,11 +3161,11 @@ getOAuthUrl_fn = function(_i) {
|
|
|
3142
3161
|
return __async(this, null, function* () {
|
|
3143
3162
|
var _j = _i, {
|
|
3144
3163
|
method,
|
|
3145
|
-
|
|
3164
|
+
appScheme,
|
|
3146
3165
|
accountLinkInProgress
|
|
3147
3166
|
} = _j, params = __objRest(_j, [
|
|
3148
3167
|
"method",
|
|
3149
|
-
"
|
|
3168
|
+
"appScheme",
|
|
3150
3169
|
"accountLinkInProgress"
|
|
3151
3170
|
]);
|
|
3152
3171
|
var _a;
|
|
@@ -3157,7 +3176,7 @@ getOAuthUrl_fn = function(_i) {
|
|
|
3157
3176
|
params: __spreadValues({
|
|
3158
3177
|
apiKey: this.ctx.apiKey,
|
|
3159
3178
|
sessionLookupId,
|
|
3160
|
-
|
|
3179
|
+
appScheme
|
|
3161
3180
|
}, accountLinkInProgress ? {
|
|
3162
3181
|
linkedAccountId: this.accountLinkInProgress.id
|
|
3163
3182
|
} : {})
|
package/dist/cjs/constants.js
CHANGED
|
@@ -40,7 +40,7 @@ __export(constants_exports, {
|
|
|
40
40
|
SHORT_POLLING_INTERVAL_MS: () => SHORT_POLLING_INTERVAL_MS
|
|
41
41
|
});
|
|
42
42
|
module.exports = __toCommonJS(constants_exports);
|
|
43
|
-
const PARA_CORE_VERSION = "2.0.0-alpha.
|
|
43
|
+
const PARA_CORE_VERSION = "2.0.0-alpha.29";
|
|
44
44
|
const PREFIX = "@CAPSULE/";
|
|
45
45
|
const LOCAL_STORAGE_AUTH_INFO = `${PREFIX}authInfo`;
|
|
46
46
|
const LOCAL_STORAGE_EMAIL = `${PREFIX}e-mail`;
|
package/dist/esm/ParaCore.js
CHANGED
|
@@ -686,14 +686,23 @@ const _ParaCore = class _ParaCore {
|
|
|
686
686
|
throw new Error(`invalid URL type ${type}`);
|
|
687
687
|
}
|
|
688
688
|
}
|
|
689
|
-
|
|
689
|
+
let partner = void 0;
|
|
690
|
+
try {
|
|
691
|
+
partner = yield __privateMethod(this, _ParaCore_instances, assertPartner_fn).call(this);
|
|
692
|
+
} catch (e) {
|
|
693
|
+
if (this.isPartnerOptional) {
|
|
694
|
+
partner = void 0;
|
|
695
|
+
} else {
|
|
696
|
+
throw e;
|
|
697
|
+
}
|
|
698
|
+
}
|
|
690
699
|
const thisDevice = (_a = opts.thisDevice) != null ? _a : {
|
|
691
700
|
encryptionKey: getPublicKeyHex(this.loginEncryptionKeyPair),
|
|
692
701
|
sessionId
|
|
693
702
|
};
|
|
694
703
|
const params = __spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues({
|
|
695
704
|
apiKey: this.ctx.apiKey,
|
|
696
|
-
partnerId: partner.id,
|
|
705
|
+
partnerId: partner == null ? void 0 : partner.id,
|
|
697
706
|
portalFont: ((_b = opts.portalTheme) == null ? void 0 : _b.font) || (partner == null ? void 0 : partner.font) || ((_c = this.portalTheme) == null ? void 0 : _c.font),
|
|
698
707
|
portalBorderRadius: ((_d = opts.portalTheme) == null ? void 0 : _d.borderRadius) || ((_e = this.portalTheme) == null ? void 0 : _e.borderRadius),
|
|
699
708
|
portalThemeMode: ((_f = opts.portalTheme) == null ? void 0 : _f.mode) || (partner == null ? void 0 : partner.themeMode) || ((_g = this.portalTheme) == null ? void 0 : _g.mode),
|
|
@@ -1168,8 +1177,15 @@ const _ParaCore = class _ParaCore {
|
|
|
1168
1177
|
}
|
|
1169
1178
|
getPartnerURL() {
|
|
1170
1179
|
return __async(this, null, function* () {
|
|
1171
|
-
|
|
1172
|
-
|
|
1180
|
+
try {
|
|
1181
|
+
const { portalUrl } = yield __privateMethod(this, _ParaCore_instances, assertPartner_fn).call(this);
|
|
1182
|
+
return portalUrl;
|
|
1183
|
+
} catch (e) {
|
|
1184
|
+
if (this.isPartnerOptional) {
|
|
1185
|
+
return void 0;
|
|
1186
|
+
}
|
|
1187
|
+
throw e;
|
|
1188
|
+
}
|
|
1173
1189
|
});
|
|
1174
1190
|
}
|
|
1175
1191
|
/**
|
|
@@ -1670,7 +1686,7 @@ const _ParaCore = class _ParaCore {
|
|
|
1670
1686
|
return __async(this, null, function* () {
|
|
1671
1687
|
var _l = _k, {
|
|
1672
1688
|
method,
|
|
1673
|
-
|
|
1689
|
+
appScheme,
|
|
1674
1690
|
isCanceled = () => false,
|
|
1675
1691
|
onCancel,
|
|
1676
1692
|
onPoll,
|
|
@@ -1678,7 +1694,7 @@ const _ParaCore = class _ParaCore {
|
|
|
1678
1694
|
isLinkAccount
|
|
1679
1695
|
} = _l, urlOptions = __objRest(_l, [
|
|
1680
1696
|
"method",
|
|
1681
|
-
"
|
|
1697
|
+
"appScheme",
|
|
1682
1698
|
"isCanceled",
|
|
1683
1699
|
"onCancel",
|
|
1684
1700
|
"onPoll",
|
|
@@ -1693,7 +1709,7 @@ const _ParaCore = class _ParaCore {
|
|
|
1693
1709
|
} else {
|
|
1694
1710
|
sessionLookupId = yield __privateMethod(this, _ParaCore_instances, prepareLogin_fn).call(this);
|
|
1695
1711
|
}
|
|
1696
|
-
const oAuthUrl = yield __privateMethod(this, _ParaCore_instances, getOAuthUrl_fn).call(this, { method,
|
|
1712
|
+
const oAuthUrl = yield __privateMethod(this, _ParaCore_instances, getOAuthUrl_fn).call(this, { method, appScheme, sessionLookupId, accountLinkInProgress });
|
|
1697
1713
|
onOAuthUrl(oAuthUrl);
|
|
1698
1714
|
} else {
|
|
1699
1715
|
({ sessionLookupId } = yield this.touchSession());
|
|
@@ -3080,6 +3096,9 @@ setAuthInfo_fn = function(authInfo) {
|
|
|
3080
3096
|
};
|
|
3081
3097
|
getPartner_fn = function(partnerId) {
|
|
3082
3098
|
return __async(this, null, function* () {
|
|
3099
|
+
if (this.isPartnerOptional && !partnerId) {
|
|
3100
|
+
return void 0;
|
|
3101
|
+
}
|
|
3083
3102
|
const res = yield this.ctx.client.getPartner(partnerId);
|
|
3084
3103
|
__privateSet(this, _partner, res.data.partner);
|
|
3085
3104
|
return __privateGet(this, _partner);
|
|
@@ -3108,11 +3127,11 @@ getOAuthUrl_fn = function(_i) {
|
|
|
3108
3127
|
return __async(this, null, function* () {
|
|
3109
3128
|
var _j = _i, {
|
|
3110
3129
|
method,
|
|
3111
|
-
|
|
3130
|
+
appScheme,
|
|
3112
3131
|
accountLinkInProgress
|
|
3113
3132
|
} = _j, params = __objRest(_j, [
|
|
3114
3133
|
"method",
|
|
3115
|
-
"
|
|
3134
|
+
"appScheme",
|
|
3116
3135
|
"accountLinkInProgress"
|
|
3117
3136
|
]);
|
|
3118
3137
|
var _a;
|
|
@@ -3123,7 +3142,7 @@ getOAuthUrl_fn = function(_i) {
|
|
|
3123
3142
|
params: __spreadValues({
|
|
3124
3143
|
apiKey: this.ctx.apiKey,
|
|
3125
3144
|
sessionLookupId,
|
|
3126
|
-
|
|
3145
|
+
appScheme
|
|
3127
3146
|
}, accountLinkInProgress ? {
|
|
3128
3147
|
linkedAccountId: this.accountLinkInProgress.id
|
|
3129
3148
|
} : {})
|
package/dist/esm/constants.js
CHANGED
package/dist/types/ParaCore.d.ts
CHANGED
|
@@ -7,6 +7,7 @@ export declare abstract class ParaCore implements CoreInterface {
|
|
|
7
7
|
static version?: string;
|
|
8
8
|
ctx: Ctx;
|
|
9
9
|
protected isNativePasskey: boolean;
|
|
10
|
+
protected isPartnerOptional?: boolean;
|
|
10
11
|
get authInfo(): CoreAuthInfo | undefined;
|
|
11
12
|
get email(): AuthIdentifier<'email'> | undefined;
|
|
12
13
|
get phone(): AuthIdentifier<'phone'> | undefined;
|
|
@@ -308,7 +309,7 @@ export declare abstract class ParaCore implements CoreInterface {
|
|
|
308
309
|
*/
|
|
309
310
|
findWalletByAddress(address: string, filter?: WalletFilters | undefined): any;
|
|
310
311
|
findWallet(idOrAddress?: string, overrideType?: TWalletType, filter?: WalletFilters): Omit<Wallet, 'signer'> | undefined;
|
|
311
|
-
get availableWallets(): Pick<Wallet, 'id' | 'type' | 'name' | 'address' | 'isExternal' | 'externalProviderId'>[];
|
|
312
|
+
get availableWallets(): Pick<Wallet, 'id' | 'type' | 'name' | 'address' | 'isExternal' | 'externalProviderId' | 'isExternalConnectionOnly'>[];
|
|
312
313
|
/**
|
|
313
314
|
* Retrieves all usable wallets with the provided type (`'EVM' | 'COSMOS' | 'SOLANA'`)
|
|
314
315
|
* @param {string} type the wallet type to filter by.
|
|
@@ -98,9 +98,9 @@ export type OAuthUrlParams = {
|
|
|
98
98
|
*/
|
|
99
99
|
method: Exclude<TOAuthMethod, 'TELEGRAM' | 'FARCASTER'>;
|
|
100
100
|
/**
|
|
101
|
-
* The
|
|
101
|
+
* The app scheme to redirect to after OAuth is complete.
|
|
102
102
|
*/
|
|
103
|
-
|
|
103
|
+
appScheme?: string;
|
|
104
104
|
};
|
|
105
105
|
export type OAuthParams = OAuthUrlParams & PollParams & {
|
|
106
106
|
/**
|
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@getpara/core-sdk",
|
|
3
|
-
"version": "2.0.0-alpha.
|
|
3
|
+
"version": "2.0.0-alpha.29",
|
|
4
4
|
"dependencies": {
|
|
5
5
|
"@celo/utils": "^8.0.2",
|
|
6
6
|
"@cosmjs/encoding": "^0.32.4",
|
|
7
7
|
"@ethereumjs/util": "^9.1.0",
|
|
8
|
-
"@getpara/user-management-client": "2.0.0-alpha.
|
|
8
|
+
"@getpara/user-management-client": "2.0.0-alpha.29",
|
|
9
9
|
"@noble/hashes": "^1.5.0",
|
|
10
10
|
"base64url": "^3.0.1",
|
|
11
11
|
"libphonenumber-js": "^1.11.7",
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"dist",
|
|
28
28
|
"package.json"
|
|
29
29
|
],
|
|
30
|
-
"gitHead": "
|
|
30
|
+
"gitHead": "7b90cb5a1a83f9bce9d61bd2baf190c47b58b705",
|
|
31
31
|
"main": "dist/cjs/index.js",
|
|
32
32
|
"module": "dist/esm/index.js",
|
|
33
33
|
"scripts": {
|