@dynamic-labs/sdk-react-core 0.17.9 → 0.17.10
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 +7 -0
- package/package.cjs +1 -1
- package/package.js +1 -1
- package/package.json +8 -8
- package/src/lib/context/DynamicContext/DynamicContext.cjs +5 -0
- package/src/lib/context/DynamicContext/DynamicContext.js +6 -1
- package/src/lib/context/DynamicContext/helpers.cjs +3 -4
- package/src/lib/context/DynamicContext/helpers.js +3 -4
- package/src/lib/utils/functions/getAuthToken/getAuthToken.cjs +1 -0
- package/src/lib/utils/functions/getAuthToken/getAuthToken.js +1 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,4 +1,11 @@
|
|
|
1
1
|
|
|
2
|
+
### [0.17.10](https://github.com/dynamic-labs/DynamicAuth/compare/v0.17.9...v0.17.10) (2023-06-23)
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
### Bug Fixes
|
|
6
|
+
|
|
7
|
+
* use getAuthTokenValue in initExpirationTime ([#2425](https://github.com/dynamic-labs/DynamicAuth/issues/2425)) ([b7e23df](https://github.com/dynamic-labs/DynamicAuth/commit/b7e23df15eb2c40213900ec61d55860ec7aa43f0)), closes [#2423](https://github.com/dynamic-labs/DynamicAuth/issues/2423) [#2422](https://github.com/dynamic-labs/DynamicAuth/issues/2422)
|
|
8
|
+
|
|
2
9
|
### [0.17.9](https://github.com/dynamic-labs/DynamicAuth/compare/v0.17.8...v0.17.9) (2023-06-21)
|
|
3
10
|
|
|
4
11
|
|
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.10",
|
|
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.10",
|
|
20
|
+
"@dynamic-labs/multi-wallet": "0.17.10",
|
|
21
|
+
"@dynamic-labs/rpc-providers": "0.17.10",
|
|
22
|
+
"@dynamic-labs/types": "0.17.10",
|
|
23
|
+
"@dynamic-labs/utils": "0.17.10",
|
|
24
|
+
"@dynamic-labs/wallet-book": "0.17.10",
|
|
25
|
+
"@dynamic-labs/wallet-connector-core": "0.17.10"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
28
|
"semver": "7.3.8"
|
|
@@ -95,6 +95,11 @@ const DynamicContextProvider = ({ settings: { accessDeniedMessagePrimary, access
|
|
|
95
95
|
ApiEndpoint.setBaseUrl((_a = process.env.DYNAMIC_API_BASE_URL) !== null && _a !== void 0 ? _a : apiBaseUrl);
|
|
96
96
|
LSSuffix.setSuffix(localStorageSuffix);
|
|
97
97
|
const isAuthenticated = Boolean(getAuthToken.getAuthToken());
|
|
98
|
+
// HOTFIX - NEED TO BE REVISITED
|
|
99
|
+
// if there's user but not auth_token, remove user
|
|
100
|
+
if (!isAuthenticated) {
|
|
101
|
+
removeFromLS.removeFromLS(localStorage.AUTH_USER);
|
|
102
|
+
}
|
|
98
103
|
const [onboardingOnlyJwt, setOnboardingOnlyJwt] = React.useState(undefined);
|
|
99
104
|
const [showAuthFlow, setShowAuthFlow] = React.useState(false);
|
|
100
105
|
// Allows clients to control widget flow without need to click on AccountControl
|
|
@@ -3,7 +3,7 @@ import { jsx, jsxs } from 'react/jsx-runtime';
|
|
|
3
3
|
import { createContext, useState, useCallback, useEffect, useMemo } from 'react';
|
|
4
4
|
import { logger as logger$1 } from '@dynamic-labs/wallet-connector-core';
|
|
5
5
|
import { ICONIC_SPRITE_URL } from '@dynamic-labs/iconic';
|
|
6
|
-
import {
|
|
6
|
+
import { AUTH_USER, AUTH_TOKEN, AUTH_MODE } from '../../utils/constants/localStorage.js';
|
|
7
7
|
import '../../utils/constants/colors.js';
|
|
8
8
|
import { DEFAULT_NUMBER_OF_WALLETS_TO_SHOW } from '../../utils/constants/values.js';
|
|
9
9
|
import { decodeJwt } from '../../shared/utils/functions/decodeJwt/decodeJwt.js';
|
|
@@ -91,6 +91,11 @@ const DynamicContextProvider = ({ settings: { accessDeniedMessagePrimary, access
|
|
|
91
91
|
ApiEndpoint.setBaseUrl((_a = process.env.DYNAMIC_API_BASE_URL) !== null && _a !== void 0 ? _a : apiBaseUrl);
|
|
92
92
|
LSSuffix.setSuffix(localStorageSuffix);
|
|
93
93
|
const isAuthenticated = Boolean(getAuthToken());
|
|
94
|
+
// HOTFIX - NEED TO BE REVISITED
|
|
95
|
+
// if there's user but not auth_token, remove user
|
|
96
|
+
if (!isAuthenticated) {
|
|
97
|
+
removeFromLS(AUTH_USER);
|
|
98
|
+
}
|
|
94
99
|
const [onboardingOnlyJwt, setOnboardingOnlyJwt] = useState(undefined);
|
|
95
100
|
const [showAuthFlow, setShowAuthFlow] = useState(false);
|
|
96
101
|
// Allows clients to control widget flow without need to click on AccountControl
|
|
@@ -3,18 +3,17 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
var decodeJwt = require('../../shared/utils/functions/decodeJwt/decodeJwt.cjs');
|
|
6
|
-
|
|
6
|
+
require('../../shared/logger.cjs');
|
|
7
7
|
require('../../config/LSSuffix.cjs');
|
|
8
8
|
require('@dynamic-labs/iconic');
|
|
9
9
|
require('@dynamic-labs/wallet-connector-core');
|
|
10
10
|
require('react/jsx-runtime');
|
|
11
11
|
require('../ViewContext/ViewContext.cjs');
|
|
12
12
|
require('react');
|
|
13
|
-
require('../../shared/logger.cjs');
|
|
14
13
|
require('@dynamic-labs/utils');
|
|
15
|
-
var localStorage = require('../../utils/constants/localStorage.cjs');
|
|
16
14
|
require('../../utils/constants/colors.cjs');
|
|
17
15
|
require('ethers');
|
|
16
|
+
var getAuthToken = require('../../utils/functions/getAuthToken/getAuthToken.cjs');
|
|
18
17
|
|
|
19
18
|
let logoutTimer;
|
|
20
19
|
const isAuthTokenExpired = (token) => {
|
|
@@ -33,7 +32,7 @@ const isAuthTokenExpired = (token) => {
|
|
|
33
32
|
return false;
|
|
34
33
|
};
|
|
35
34
|
const initExpirationTime = (logout) => {
|
|
36
|
-
const decodedJwt = decodeJwt.decodeJwt(
|
|
35
|
+
const decodedJwt = decodeJwt.decodeJwt(getAuthToken.getAuthToken());
|
|
37
36
|
if (!decodedJwt)
|
|
38
37
|
return clearTimeout(logoutTimer);
|
|
39
38
|
const tokenExp = decodedJwt === null || decodedJwt === void 0 ? void 0 : decodedJwt.exp;
|
|
@@ -1,16 +1,15 @@
|
|
|
1
1
|
import { decodeJwt } from '../../shared/utils/functions/decodeJwt/decodeJwt.js';
|
|
2
|
-
import
|
|
2
|
+
import '../../shared/logger.js';
|
|
3
3
|
import '../../config/LSSuffix.js';
|
|
4
4
|
import '@dynamic-labs/iconic';
|
|
5
5
|
import '@dynamic-labs/wallet-connector-core';
|
|
6
6
|
import 'react/jsx-runtime';
|
|
7
7
|
import '../ViewContext/ViewContext.js';
|
|
8
8
|
import 'react';
|
|
9
|
-
import '../../shared/logger.js';
|
|
10
9
|
import '@dynamic-labs/utils';
|
|
11
|
-
import { AUTH_TOKEN } from '../../utils/constants/localStorage.js';
|
|
12
10
|
import '../../utils/constants/colors.js';
|
|
13
11
|
import 'ethers';
|
|
12
|
+
import { getAuthToken } from '../../utils/functions/getAuthToken/getAuthToken.js';
|
|
14
13
|
|
|
15
14
|
let logoutTimer;
|
|
16
15
|
const isAuthTokenExpired = (token) => {
|
|
@@ -29,7 +28,7 @@ const isAuthTokenExpired = (token) => {
|
|
|
29
28
|
return false;
|
|
30
29
|
};
|
|
31
30
|
const initExpirationTime = (logout) => {
|
|
32
|
-
const decodedJwt = decodeJwt(
|
|
31
|
+
const decodedJwt = decodeJwt(getAuthToken());
|
|
33
32
|
if (!decodedJwt)
|
|
34
33
|
return clearTimeout(logoutTimer);
|
|
35
34
|
const tokenExp = decodedJwt === null || decodedJwt === void 0 ? void 0 : decodedJwt.exp;
|