@imtbl/sdk 0.22.1 → 0.22.2
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/blockchain_data.js +1 -1
- package/dist/browser/checkout.js +2 -2
- package/dist/checkout_sdk.js +1 -1
- package/dist/checkout_widgets.js +1 -1
- package/dist/immutablex_client.js +1 -1
- package/dist/index.browser.js +7 -7
- package/dist/index.browser.js.map +1 -1
- package/dist/index.cjs +40 -17
- package/dist/index.js +40 -17
- package/dist/passport.js +38 -15
- package/package.json +2 -1
package/dist/index.cjs
CHANGED
|
@@ -3009,7 +3009,7 @@ class MultiRollupApiClients {
|
|
|
3009
3009
|
}
|
|
3010
3010
|
|
|
3011
3011
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
3012
|
-
const defaultHeaders$1 = { 'x-sdk-version': 'ts-immutable-sdk-0.22.
|
|
3012
|
+
const defaultHeaders$1 = { 'x-sdk-version': 'ts-immutable-sdk-0.22.2' };
|
|
3013
3013
|
const createConfig = ({ basePath, headers, }) => {
|
|
3014
3014
|
if (!basePath.trim()) {
|
|
3015
3015
|
throw Error('basePath can not be empty');
|
|
@@ -3069,7 +3069,7 @@ class APIError extends Error {
|
|
|
3069
3069
|
|
|
3070
3070
|
/* eslint-disable implicit-arrow-linebreak */
|
|
3071
3071
|
const defaultHeaders = {
|
|
3072
|
-
sdkVersion: 'ts-immutable-sdk-multi-rollup-api-client-0.22.
|
|
3072
|
+
sdkVersion: 'ts-immutable-sdk-multi-rollup-api-client-0.22.2',
|
|
3073
3073
|
};
|
|
3074
3074
|
/**
|
|
3075
3075
|
* createAPIConfiguration to create a custom Configuration
|
|
@@ -3355,7 +3355,7 @@ const createImmutableXConfiguration = ({ basePath, chainID, coreContractAddress,
|
|
|
3355
3355
|
chainID,
|
|
3356
3356
|
coreContractAddress,
|
|
3357
3357
|
registrationContractAddress,
|
|
3358
|
-
sdkVersion: 'ts-immutable-sdk-0.22.
|
|
3358
|
+
sdkVersion: 'ts-immutable-sdk-0.22.2',
|
|
3359
3359
|
});
|
|
3360
3360
|
/**
|
|
3361
3361
|
* Sets `sdkVersion` at the time of build
|
|
@@ -7925,6 +7925,22 @@ class DeviceCredentialsManager {
|
|
|
7925
7925
|
}
|
|
7926
7926
|
}
|
|
7927
7927
|
|
|
7928
|
+
function isIdTokenExpired(idToken) {
|
|
7929
|
+
if (!idToken) {
|
|
7930
|
+
return false;
|
|
7931
|
+
}
|
|
7932
|
+
const decodedToken = jwt_decode(idToken);
|
|
7933
|
+
const now = Math.floor(Date.now() / 1000);
|
|
7934
|
+
return decodedToken.exp < now;
|
|
7935
|
+
}
|
|
7936
|
+
function isTokenExpired(oidcUser) {
|
|
7937
|
+
const { id_token: idToken, expired } = oidcUser;
|
|
7938
|
+
if (expired) {
|
|
7939
|
+
return true;
|
|
7940
|
+
}
|
|
7941
|
+
return isIdTokenExpired(idToken);
|
|
7942
|
+
}
|
|
7943
|
+
|
|
7928
7944
|
const formUrlEncodedHeader = {
|
|
7929
7945
|
headers: {
|
|
7930
7946
|
'Content-Type': 'application/x-www-form-urlencoded',
|
|
@@ -8202,23 +8218,30 @@ class AuthManager {
|
|
|
8202
8218
|
}, PassportErrorType.LOGOUT_ERROR);
|
|
8203
8219
|
}
|
|
8204
8220
|
async loginSilent() {
|
|
8205
|
-
return withPassportError(async () =>
|
|
8206
|
-
|
|
8207
|
-
|
|
8208
|
-
|
|
8209
|
-
|
|
8210
|
-
|
|
8211
|
-
|
|
8212
|
-
|
|
8213
|
-
|
|
8221
|
+
return withPassportError(async () => this.getUser(), PassportErrorType.SILENT_LOGIN_ERROR);
|
|
8222
|
+
}
|
|
8223
|
+
async getWebUser() {
|
|
8224
|
+
const oidcUser = await this.userManager.getUser();
|
|
8225
|
+
if (!oidcUser) {
|
|
8226
|
+
return null;
|
|
8227
|
+
}
|
|
8228
|
+
const tokenExpired = isTokenExpired(oidcUser);
|
|
8229
|
+
if (!tokenExpired) {
|
|
8214
8230
|
return AuthManager.mapOidcUserToDomainModel(oidcUser);
|
|
8215
|
-
}
|
|
8231
|
+
}
|
|
8232
|
+
if (oidcUser.refresh_token) {
|
|
8233
|
+
const newOidcUser = await this.userManager.signinSilent();
|
|
8234
|
+
if (newOidcUser) {
|
|
8235
|
+
return AuthManager.mapOidcUserToDomainModel(newOidcUser);
|
|
8236
|
+
}
|
|
8237
|
+
}
|
|
8238
|
+
return null;
|
|
8216
8239
|
}
|
|
8217
8240
|
async getUser() {
|
|
8218
8241
|
return withPassportError(async () => {
|
|
8219
|
-
const
|
|
8220
|
-
if (
|
|
8221
|
-
return
|
|
8242
|
+
const user = await this.getWebUser();
|
|
8243
|
+
if (user) {
|
|
8244
|
+
return user;
|
|
8222
8245
|
}
|
|
8223
8246
|
const deviceToken = this.deviceCredentialsManager.getCredentials();
|
|
8224
8247
|
if (deviceToken) {
|
|
@@ -31996,7 +32019,7 @@ var checkout_sdk = /*#__PURE__*/Object.freeze({
|
|
|
31996
32019
|
function $parcel$export(e, n, v, s) {
|
|
31997
32020
|
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
|
|
31998
32021
|
}
|
|
31999
|
-
const $d663162fd5a0853f$export$38a083d9fb5551ca = "0.22.
|
|
32022
|
+
const $d663162fd5a0853f$export$38a083d9fb5551ca = "0.22.2";
|
|
32000
32023
|
const $d663162fd5a0853f$export$83bf90b30cdfd29f = ()=>false;
|
|
32001
32024
|
const $d663162fd5a0853f$export$1169f5475725171b = ()=>$d663162fd5a0853f$export$38a083d9fb5551ca;
|
|
32002
32025
|
|
package/dist/index.js
CHANGED
|
@@ -2987,7 +2987,7 @@ class MultiRollupApiClients {
|
|
|
2987
2987
|
}
|
|
2988
2988
|
|
|
2989
2989
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
2990
|
-
const defaultHeaders$1 = { 'x-sdk-version': 'ts-immutable-sdk-0.22.
|
|
2990
|
+
const defaultHeaders$1 = { 'x-sdk-version': 'ts-immutable-sdk-0.22.2' };
|
|
2991
2991
|
const createConfig = ({ basePath, headers, }) => {
|
|
2992
2992
|
if (!basePath.trim()) {
|
|
2993
2993
|
throw Error('basePath can not be empty');
|
|
@@ -3047,7 +3047,7 @@ class APIError extends Error {
|
|
|
3047
3047
|
|
|
3048
3048
|
/* eslint-disable implicit-arrow-linebreak */
|
|
3049
3049
|
const defaultHeaders = {
|
|
3050
|
-
sdkVersion: 'ts-immutable-sdk-multi-rollup-api-client-0.22.
|
|
3050
|
+
sdkVersion: 'ts-immutable-sdk-multi-rollup-api-client-0.22.2',
|
|
3051
3051
|
};
|
|
3052
3052
|
/**
|
|
3053
3053
|
* createAPIConfiguration to create a custom Configuration
|
|
@@ -3333,7 +3333,7 @@ const createImmutableXConfiguration = ({ basePath, chainID, coreContractAddress,
|
|
|
3333
3333
|
chainID,
|
|
3334
3334
|
coreContractAddress,
|
|
3335
3335
|
registrationContractAddress,
|
|
3336
|
-
sdkVersion: 'ts-immutable-sdk-0.22.
|
|
3336
|
+
sdkVersion: 'ts-immutable-sdk-0.22.2',
|
|
3337
3337
|
});
|
|
3338
3338
|
/**
|
|
3339
3339
|
* Sets `sdkVersion` at the time of build
|
|
@@ -7903,6 +7903,22 @@ class DeviceCredentialsManager {
|
|
|
7903
7903
|
}
|
|
7904
7904
|
}
|
|
7905
7905
|
|
|
7906
|
+
function isIdTokenExpired(idToken) {
|
|
7907
|
+
if (!idToken) {
|
|
7908
|
+
return false;
|
|
7909
|
+
}
|
|
7910
|
+
const decodedToken = jwt_decode(idToken);
|
|
7911
|
+
const now = Math.floor(Date.now() / 1000);
|
|
7912
|
+
return decodedToken.exp < now;
|
|
7913
|
+
}
|
|
7914
|
+
function isTokenExpired(oidcUser) {
|
|
7915
|
+
const { id_token: idToken, expired } = oidcUser;
|
|
7916
|
+
if (expired) {
|
|
7917
|
+
return true;
|
|
7918
|
+
}
|
|
7919
|
+
return isIdTokenExpired(idToken);
|
|
7920
|
+
}
|
|
7921
|
+
|
|
7906
7922
|
const formUrlEncodedHeader = {
|
|
7907
7923
|
headers: {
|
|
7908
7924
|
'Content-Type': 'application/x-www-form-urlencoded',
|
|
@@ -8180,23 +8196,30 @@ class AuthManager {
|
|
|
8180
8196
|
}, PassportErrorType.LOGOUT_ERROR);
|
|
8181
8197
|
}
|
|
8182
8198
|
async loginSilent() {
|
|
8183
|
-
return withPassportError(async () =>
|
|
8184
|
-
|
|
8185
|
-
|
|
8186
|
-
|
|
8187
|
-
|
|
8188
|
-
|
|
8189
|
-
|
|
8190
|
-
|
|
8191
|
-
|
|
8199
|
+
return withPassportError(async () => this.getUser(), PassportErrorType.SILENT_LOGIN_ERROR);
|
|
8200
|
+
}
|
|
8201
|
+
async getWebUser() {
|
|
8202
|
+
const oidcUser = await this.userManager.getUser();
|
|
8203
|
+
if (!oidcUser) {
|
|
8204
|
+
return null;
|
|
8205
|
+
}
|
|
8206
|
+
const tokenExpired = isTokenExpired(oidcUser);
|
|
8207
|
+
if (!tokenExpired) {
|
|
8192
8208
|
return AuthManager.mapOidcUserToDomainModel(oidcUser);
|
|
8193
|
-
}
|
|
8209
|
+
}
|
|
8210
|
+
if (oidcUser.refresh_token) {
|
|
8211
|
+
const newOidcUser = await this.userManager.signinSilent();
|
|
8212
|
+
if (newOidcUser) {
|
|
8213
|
+
return AuthManager.mapOidcUserToDomainModel(newOidcUser);
|
|
8214
|
+
}
|
|
8215
|
+
}
|
|
8216
|
+
return null;
|
|
8194
8217
|
}
|
|
8195
8218
|
async getUser() {
|
|
8196
8219
|
return withPassportError(async () => {
|
|
8197
|
-
const
|
|
8198
|
-
if (
|
|
8199
|
-
return
|
|
8220
|
+
const user = await this.getWebUser();
|
|
8221
|
+
if (user) {
|
|
8222
|
+
return user;
|
|
8200
8223
|
}
|
|
8201
8224
|
const deviceToken = this.deviceCredentialsManager.getCredentials();
|
|
8202
8225
|
if (deviceToken) {
|
|
@@ -31974,7 +31997,7 @@ var checkout_sdk = /*#__PURE__*/Object.freeze({
|
|
|
31974
31997
|
function $parcel$export(e, n, v, s) {
|
|
31975
31998
|
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
|
|
31976
31999
|
}
|
|
31977
|
-
const $d663162fd5a0853f$export$38a083d9fb5551ca = "0.22.
|
|
32000
|
+
const $d663162fd5a0853f$export$38a083d9fb5551ca = "0.22.2";
|
|
31978
32001
|
const $d663162fd5a0853f$export$83bf90b30cdfd29f = ()=>false;
|
|
31979
32002
|
const $d663162fd5a0853f$export$1169f5475725171b = ()=>$d663162fd5a0853f$export$38a083d9fb5551ca;
|
|
31980
32003
|
|
package/dist/passport.js
CHANGED
|
@@ -1785,7 +1785,7 @@ class MultiRollupApiClients {
|
|
|
1785
1785
|
}
|
|
1786
1786
|
|
|
1787
1787
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
1788
|
-
const defaultHeaders = { 'x-sdk-version': 'ts-immutable-sdk-0.22.
|
|
1788
|
+
const defaultHeaders = { 'x-sdk-version': 'ts-immutable-sdk-0.22.2' };
|
|
1789
1789
|
const createConfig = ({ basePath, headers, }) => {
|
|
1790
1790
|
if (!basePath.trim()) {
|
|
1791
1791
|
throw Error('basePath can not be empty');
|
|
@@ -1841,7 +1841,7 @@ const createImmutableXConfiguration = ({ basePath, chainID, coreContractAddress,
|
|
|
1841
1841
|
chainID,
|
|
1842
1842
|
coreContractAddress,
|
|
1843
1843
|
registrationContractAddress,
|
|
1844
|
-
sdkVersion: 'ts-immutable-sdk-0.22.
|
|
1844
|
+
sdkVersion: 'ts-immutable-sdk-0.22.2',
|
|
1845
1845
|
});
|
|
1846
1846
|
/**
|
|
1847
1847
|
* Sets `sdkVersion` at the time of build
|
|
@@ -6394,6 +6394,22 @@ class DeviceCredentialsManager {
|
|
|
6394
6394
|
}
|
|
6395
6395
|
}
|
|
6396
6396
|
|
|
6397
|
+
function isIdTokenExpired(idToken) {
|
|
6398
|
+
if (!idToken) {
|
|
6399
|
+
return false;
|
|
6400
|
+
}
|
|
6401
|
+
const decodedToken = jwt_decode(idToken);
|
|
6402
|
+
const now = Math.floor(Date.now() / 1000);
|
|
6403
|
+
return decodedToken.exp < now;
|
|
6404
|
+
}
|
|
6405
|
+
function isTokenExpired(oidcUser) {
|
|
6406
|
+
const { id_token: idToken, expired } = oidcUser;
|
|
6407
|
+
if (expired) {
|
|
6408
|
+
return true;
|
|
6409
|
+
}
|
|
6410
|
+
return isIdTokenExpired(idToken);
|
|
6411
|
+
}
|
|
6412
|
+
|
|
6397
6413
|
const formUrlEncodedHeader = {
|
|
6398
6414
|
headers: {
|
|
6399
6415
|
'Content-Type': 'application/x-www-form-urlencoded',
|
|
@@ -6671,23 +6687,30 @@ class AuthManager {
|
|
|
6671
6687
|
}, PassportErrorType.LOGOUT_ERROR);
|
|
6672
6688
|
}
|
|
6673
6689
|
async loginSilent() {
|
|
6674
|
-
return withPassportError(async () =>
|
|
6675
|
-
|
|
6676
|
-
|
|
6677
|
-
|
|
6678
|
-
|
|
6679
|
-
|
|
6680
|
-
|
|
6681
|
-
|
|
6682
|
-
|
|
6690
|
+
return withPassportError(async () => this.getUser(), PassportErrorType.SILENT_LOGIN_ERROR);
|
|
6691
|
+
}
|
|
6692
|
+
async getWebUser() {
|
|
6693
|
+
const oidcUser = await this.userManager.getUser();
|
|
6694
|
+
if (!oidcUser) {
|
|
6695
|
+
return null;
|
|
6696
|
+
}
|
|
6697
|
+
const tokenExpired = isTokenExpired(oidcUser);
|
|
6698
|
+
if (!tokenExpired) {
|
|
6683
6699
|
return AuthManager.mapOidcUserToDomainModel(oidcUser);
|
|
6684
|
-
}
|
|
6700
|
+
}
|
|
6701
|
+
if (oidcUser.refresh_token) {
|
|
6702
|
+
const newOidcUser = await this.userManager.signinSilent();
|
|
6703
|
+
if (newOidcUser) {
|
|
6704
|
+
return AuthManager.mapOidcUserToDomainModel(newOidcUser);
|
|
6705
|
+
}
|
|
6706
|
+
}
|
|
6707
|
+
return null;
|
|
6685
6708
|
}
|
|
6686
6709
|
async getUser() {
|
|
6687
6710
|
return withPassportError(async () => {
|
|
6688
|
-
const
|
|
6689
|
-
if (
|
|
6690
|
-
return
|
|
6711
|
+
const user = await this.getWebUser();
|
|
6712
|
+
if (user) {
|
|
6713
|
+
return user;
|
|
6691
6714
|
}
|
|
6692
6715
|
const deviceToken = this.deviceCredentialsManager.getCredentials();
|
|
6693
6716
|
if (deviceToken) {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@imtbl/sdk",
|
|
3
3
|
"description": "Immutable Unified SDK",
|
|
4
|
-
"version": "0.22.
|
|
4
|
+
"version": "0.22.2",
|
|
5
5
|
"author": "Immutable",
|
|
6
6
|
"browser": "./dist/index.browser.js",
|
|
7
7
|
"bugs": "https://github.com/immutable/ts-immutable-sdk/issues",
|
|
@@ -24,6 +24,7 @@
|
|
|
24
24
|
"bn.js": "^5.2.1",
|
|
25
25
|
"enc-utils": "^3.0.0",
|
|
26
26
|
"ethers": "^5.7.2",
|
|
27
|
+
"jwt-decode": "^3.1.2",
|
|
27
28
|
"magic-sdk": "^13.3.1",
|
|
28
29
|
"oidc-client-ts": "^2.2.1"
|
|
29
30
|
},
|