@dynamic-labs/sdk-react-core 0.17.6 → 0.17.8
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/CHANGELOG.md +14 -0
- package/package.cjs +1 -1
- package/package.js +1 -1
- package/package.json +8 -8
- package/src/lib/utils/functions/getAuthToken/getAuthToken.cjs +15 -6
- package/src/lib/utils/functions/getAuthToken/getAuthToken.d.ts +1 -1
- package/src/lib/utils/functions/getAuthToken/getAuthToken.js +15 -6
- package/src/lib/utils/hooks/authenticationHooks/useEmailVerificationRequest/useEmailVerificationRequest.cjs +1 -1
- package/src/lib/utils/hooks/authenticationHooks/useEmailVerificationRequest/useEmailVerificationRequest.js +1 -1
- package/src/lib/utils/hooks/useVerifyWallet/useVerifyWallet.cjs +2 -2
- package/src/lib/utils/hooks/useVerifyWallet/useVerifyWallet.js +2 -2
- package/src/polyfills.cjs +1 -2
- package/src/polyfills.js +1 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,4 +1,18 @@
|
|
|
1
1
|
|
|
2
|
+
### [0.17.8](https://github.com/dynamic-labs/DynamicAuth/compare/v0.17.7...v0.17.8) (2023-06-20)
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
### Bug Fixes
|
|
6
|
+
|
|
7
|
+
* remove process variable declaration ([#2390](https://github.com/dynamic-labs/DynamicAuth/issues/2390)) ([41cfba3](https://github.com/dynamic-labs/DynamicAuth/commit/41cfba321513a76b01a6f2b6130b8568cf5afac7))
|
|
8
|
+
|
|
9
|
+
### [0.17.7](https://github.com/dynamic-labs/DynamicAuth/compare/v0.17.6...v0.17.7) (2023-06-16)
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
### Bug Fixes
|
|
13
|
+
|
|
14
|
+
* **local-storage:** load auth token when stringified ([#2368](https://github.com/dynamic-labs/DynamicAuth/issues/2368)) ([#2370](https://github.com/dynamic-labs/DynamicAuth/issues/2370)) ([01e37a4](https://github.com/dynamic-labs/DynamicAuth/commit/01e37a41b659a39942de5d9c2e852b69fb9ef1f9))
|
|
15
|
+
|
|
2
16
|
### [0.17.6](https://github.com/dynamic-labs/DynamicAuth/compare/v0.17.5...v0.17.6) (2023-06-16)
|
|
3
17
|
|
|
4
18
|
|
package/package.cjs
CHANGED
package/package.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dynamic-labs/sdk-react-core",
|
|
3
|
-
"version": "0.17.
|
|
3
|
+
"version": "0.17.8",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "https://github.com/dynamic-labs/DynamicAuth.git",
|
|
@@ -16,13 +16,13 @@
|
|
|
16
16
|
"formik": "2.2.9",
|
|
17
17
|
"qrcode": "1.5.1",
|
|
18
18
|
"ethers": "5.7.2",
|
|
19
|
-
"@dynamic-labs/logger": "0.17.
|
|
20
|
-
"@dynamic-labs/multi-wallet": "0.17.
|
|
21
|
-
"@dynamic-labs/rpc-providers": "0.17.
|
|
22
|
-
"@dynamic-labs/types": "0.17.
|
|
23
|
-
"@dynamic-labs/utils": "0.17.
|
|
24
|
-
"@dynamic-labs/wallet-book": "0.17.
|
|
25
|
-
"@dynamic-labs/wallet-connector-core": "0.17.
|
|
19
|
+
"@dynamic-labs/logger": "0.17.8",
|
|
20
|
+
"@dynamic-labs/multi-wallet": "0.17.8",
|
|
21
|
+
"@dynamic-labs/rpc-providers": "0.17.8",
|
|
22
|
+
"@dynamic-labs/types": "0.17.8",
|
|
23
|
+
"@dynamic-labs/utils": "0.17.8",
|
|
24
|
+
"@dynamic-labs/wallet-book": "0.17.8",
|
|
25
|
+
"@dynamic-labs/wallet-connector-core": "0.17.8"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
28
|
"semver": "7.3.8"
|
|
@@ -2,30 +2,39 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var localStorage = require('../../constants/localStorage.cjs');
|
|
6
|
-
require('../../constants/colors.cjs');
|
|
7
5
|
var helpers = require('../../../context/DynamicContext/helpers.cjs');
|
|
8
6
|
require('@dynamic-labs/sdk-api');
|
|
9
|
-
require('../../../shared/logger.cjs');
|
|
10
|
-
var
|
|
11
|
-
require('../../../config/LSSuffix.cjs');
|
|
7
|
+
var logger = require('../../../shared/logger.cjs');
|
|
8
|
+
var getDynamicLSKey = require('../../../shared/utils/functions/storage/getDynamicLSKey.cjs');
|
|
12
9
|
require('@dynamic-labs/iconic');
|
|
13
10
|
require('@dynamic-labs/wallet-connector-core');
|
|
14
11
|
require('react/jsx-runtime');
|
|
15
12
|
require('../../../context/ViewContext/ViewContext.cjs');
|
|
16
13
|
require('react');
|
|
17
14
|
require('@dynamic-labs/utils');
|
|
15
|
+
var localStorage = require('../../constants/localStorage.cjs');
|
|
16
|
+
require('../../constants/colors.cjs');
|
|
18
17
|
require('ethers');
|
|
19
18
|
require('../../../shared/consts/index.cjs');
|
|
20
19
|
|
|
21
20
|
const getAuthToken = () => {
|
|
21
|
+
var _a, _b;
|
|
22
22
|
if (typeof window === 'undefined') {
|
|
23
23
|
return undefined;
|
|
24
24
|
}
|
|
25
|
-
|
|
25
|
+
let token = (_a = window.localStorage.getItem(getDynamicLSKey.getDynamicLSKey(localStorage.AUTH_TOKEN))) !== null && _a !== void 0 ? _a : undefined;
|
|
26
26
|
if (!token) {
|
|
27
27
|
return undefined;
|
|
28
28
|
}
|
|
29
|
+
try {
|
|
30
|
+
const parsedToken = (_b = JSON.parse(token)) !== null && _b !== void 0 ? _b : undefined;
|
|
31
|
+
if (parsedToken) {
|
|
32
|
+
token = parsedToken;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
catch (err) {
|
|
36
|
+
logger.logger.error(err);
|
|
37
|
+
}
|
|
29
38
|
if (helpers.isAuthTokenExpired(token)) {
|
|
30
39
|
return undefined;
|
|
31
40
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const getAuthToken: () =>
|
|
1
|
+
export declare const getAuthToken: () => string | undefined;
|
|
@@ -1,27 +1,36 @@
|
|
|
1
|
-
import { AUTH_TOKEN } from '../../constants/localStorage.js';
|
|
2
|
-
import '../../constants/colors.js';
|
|
3
1
|
import { isAuthTokenExpired } from '../../../context/DynamicContext/helpers.js';
|
|
4
2
|
import '@dynamic-labs/sdk-api';
|
|
5
|
-
import '../../../shared/logger.js';
|
|
6
|
-
import {
|
|
7
|
-
import '../../../config/LSSuffix.js';
|
|
3
|
+
import { logger } from '../../../shared/logger.js';
|
|
4
|
+
import { getDynamicLSKey } from '../../../shared/utils/functions/storage/getDynamicLSKey.js';
|
|
8
5
|
import '@dynamic-labs/iconic';
|
|
9
6
|
import '@dynamic-labs/wallet-connector-core';
|
|
10
7
|
import 'react/jsx-runtime';
|
|
11
8
|
import '../../../context/ViewContext/ViewContext.js';
|
|
12
9
|
import 'react';
|
|
13
10
|
import '@dynamic-labs/utils';
|
|
11
|
+
import { AUTH_TOKEN } from '../../constants/localStorage.js';
|
|
12
|
+
import '../../constants/colors.js';
|
|
14
13
|
import 'ethers';
|
|
15
14
|
import '../../../shared/consts/index.js';
|
|
16
15
|
|
|
17
16
|
const getAuthToken = () => {
|
|
17
|
+
var _a, _b;
|
|
18
18
|
if (typeof window === 'undefined') {
|
|
19
19
|
return undefined;
|
|
20
20
|
}
|
|
21
|
-
|
|
21
|
+
let token = (_a = window.localStorage.getItem(getDynamicLSKey(AUTH_TOKEN))) !== null && _a !== void 0 ? _a : undefined;
|
|
22
22
|
if (!token) {
|
|
23
23
|
return undefined;
|
|
24
24
|
}
|
|
25
|
+
try {
|
|
26
|
+
const parsedToken = (_b = JSON.parse(token)) !== null && _b !== void 0 ? _b : undefined;
|
|
27
|
+
if (parsedToken) {
|
|
28
|
+
token = parsedToken;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
catch (err) {
|
|
32
|
+
logger.error(err);
|
|
33
|
+
}
|
|
25
34
|
if (isAuthTokenExpired(token)) {
|
|
26
35
|
return undefined;
|
|
27
36
|
}
|
|
@@ -9,7 +9,6 @@ var api = require('../../../../data/api.cjs');
|
|
|
9
9
|
var index = require('../../../functions/storeAuthToken/index.cjs');
|
|
10
10
|
require('@dynamic-labs/multi-wallet');
|
|
11
11
|
require('@dynamic-labs/utils');
|
|
12
|
-
require('../../../constants/colors.cjs');
|
|
13
12
|
require('@dynamic-labs/sdk-api');
|
|
14
13
|
require('../../../../shared/logger.cjs');
|
|
15
14
|
require('../../../../config/LSSuffix.cjs');
|
|
@@ -17,6 +16,7 @@ require('@dynamic-labs/iconic');
|
|
|
17
16
|
require('@dynamic-labs/wallet-connector-core');
|
|
18
17
|
require('react/jsx-runtime');
|
|
19
18
|
require('../../../../context/ViewContext/ViewContext.cjs');
|
|
19
|
+
require('../../../constants/colors.cjs');
|
|
20
20
|
require('ethers');
|
|
21
21
|
require('../../../../shared/consts/index.cjs');
|
|
22
22
|
var useUpdateUserProfileByJWTCallback = require('../../useUpdateUserProfileByJWTCallback/useUpdateUserProfileByJWTCallback.cjs');
|
|
@@ -5,7 +5,6 @@ import { verifyEmail } from '../../../../data/api.js';
|
|
|
5
5
|
import { storeAuthToken } from '../../../functions/storeAuthToken/index.js';
|
|
6
6
|
import '@dynamic-labs/multi-wallet';
|
|
7
7
|
import '@dynamic-labs/utils';
|
|
8
|
-
import '../../../constants/colors.js';
|
|
9
8
|
import '@dynamic-labs/sdk-api';
|
|
10
9
|
import '../../../../shared/logger.js';
|
|
11
10
|
import '../../../../config/LSSuffix.js';
|
|
@@ -13,6 +12,7 @@ import '@dynamic-labs/iconic';
|
|
|
13
12
|
import '@dynamic-labs/wallet-connector-core';
|
|
14
13
|
import 'react/jsx-runtime';
|
|
15
14
|
import '../../../../context/ViewContext/ViewContext.js';
|
|
15
|
+
import '../../../constants/colors.js';
|
|
16
16
|
import 'ethers';
|
|
17
17
|
import '../../../../shared/consts/index.js';
|
|
18
18
|
import { useUpdateUserProfileByJWTCallback } from '../../useUpdateUserProfileByJWTCallback/useUpdateUserProfileByJWTCallback.js';
|
|
@@ -8,8 +8,6 @@ var utils = require('@dynamic-labs/utils');
|
|
|
8
8
|
var api = require('../../../data/api.cjs');
|
|
9
9
|
var index = require('../../functions/storeAuthToken/index.cjs');
|
|
10
10
|
require('@dynamic-labs/multi-wallet');
|
|
11
|
-
var localStorage = require('../../constants/localStorage.cjs');
|
|
12
|
-
require('../../constants/colors.cjs');
|
|
13
11
|
var decodeJwt = require('../../../shared/utils/functions/decodeJwt/decodeJwt.cjs');
|
|
14
12
|
var logger = require('../../../shared/logger.cjs');
|
|
15
13
|
require('../../../config/LSSuffix.cjs');
|
|
@@ -18,6 +16,8 @@ require('@dynamic-labs/iconic');
|
|
|
18
16
|
require('react/jsx-runtime');
|
|
19
17
|
var ViewContext = require('../../../context/ViewContext/ViewContext.cjs');
|
|
20
18
|
require('react');
|
|
19
|
+
var localStorage = require('../../constants/localStorage.cjs');
|
|
20
|
+
require('../../constants/colors.cjs');
|
|
21
21
|
require('ethers');
|
|
22
22
|
require('../../../shared/consts/index.cjs');
|
|
23
23
|
var getVerifyArgs = require('../../functions/getVerifyArgs/getVerifyArgs.cjs');
|
|
@@ -4,8 +4,6 @@ import { DynamicError, WalletUsedError, ChainalysisError, NoAccessError } from '
|
|
|
4
4
|
import { verifyWallet, linkWallet } from '../../../data/api.js';
|
|
5
5
|
import { storeAuthToken } from '../../functions/storeAuthToken/index.js';
|
|
6
6
|
import '@dynamic-labs/multi-wallet';
|
|
7
|
-
import { LAST_USED_WALLET } from '../../constants/localStorage.js';
|
|
8
|
-
import '../../constants/colors.js';
|
|
9
7
|
import { decodeJwt } from '../../../shared/utils/functions/decodeJwt/decodeJwt.js';
|
|
10
8
|
import { logger } from '../../../shared/logger.js';
|
|
11
9
|
import '../../../config/LSSuffix.js';
|
|
@@ -14,6 +12,8 @@ import '@dynamic-labs/iconic';
|
|
|
14
12
|
import 'react/jsx-runtime';
|
|
15
13
|
import { useViewContext } from '../../../context/ViewContext/ViewContext.js';
|
|
16
14
|
import 'react';
|
|
15
|
+
import { LAST_USED_WALLET } from '../../constants/localStorage.js';
|
|
16
|
+
import '../../constants/colors.js';
|
|
17
17
|
import 'ethers';
|
|
18
18
|
import '../../../shared/consts/index.js';
|
|
19
19
|
import { getVerifyArgs } from '../../functions/getVerifyArgs/getVerifyArgs.js';
|
package/src/polyfills.cjs
CHANGED
|
@@ -2,10 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
var process$1 = require('./shim/process.cjs');
|
|
4
4
|
|
|
5
|
-
let process;
|
|
6
5
|
if (typeof window !== 'undefined') {
|
|
7
6
|
window.global = globalThis;
|
|
8
|
-
if (!window.process &&
|
|
7
|
+
if (!window.process && typeof process === 'undefined') {
|
|
9
8
|
Object.assign(window, { process: process$1.process });
|
|
10
9
|
}
|
|
11
10
|
}
|
package/src/polyfills.js
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { process as process$1 } from './shim/process.js';
|
|
2
2
|
|
|
3
|
-
let process;
|
|
4
3
|
if (typeof window !== 'undefined') {
|
|
5
4
|
window.global = globalThis;
|
|
6
|
-
if (!window.process &&
|
|
5
|
+
if (!window.process && typeof process === 'undefined') {
|
|
7
6
|
Object.assign(window, { process: process$1 });
|
|
8
7
|
}
|
|
9
8
|
}
|