@dynamic-labs/sdk-react-core 0.17.8 → 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 CHANGED
@@ -1,4 +1,19 @@
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
+
9
+ ### [0.17.9](https://github.com/dynamic-labs/DynamicAuth/compare/v0.17.8...v0.17.9) (2023-06-21)
10
+
11
+
12
+ ### Bug Fixes
13
+
14
+ * **balance:** normalize matic addresses to show balance ([#2385](https://github.com/dynamic-labs/DynamicAuth/issues/2385)) ([#2398](https://github.com/dynamic-labs/DynamicAuth/issues/2398)) ([8afd0a7](https://github.com/dynamic-labs/DynamicAuth/commit/8afd0a7773c962ece4b6fbb6988587a45c4b64d7))
15
+ * **wagmi-connector:** use private custom rpc if available ([#2380](https://github.com/dynamic-labs/DynamicAuth/issues/2380)) ([#2397](https://github.com/dynamic-labs/DynamicAuth/issues/2397)) ([0bf1d17](https://github.com/dynamic-labs/DynamicAuth/commit/0bf1d17705b097d25c75af25e27252a28c593ff9))
16
+
2
17
  ### [0.17.8](https://github.com/dynamic-labs/DynamicAuth/compare/v0.17.7...v0.17.8) (2023-06-20)
3
18
 
4
19
 
package/package.cjs CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var version = "0.17.8";
5
+ var version = "0.17.10";
6
6
  var dependencies = {
7
7
  "react-focus-lock": "2.9.2",
8
8
  "@dynamic-labs/iconic": "0.1.23",
package/package.js CHANGED
@@ -1,4 +1,4 @@
1
- var version = "0.17.8";
1
+ var version = "0.17.10";
2
2
  var dependencies = {
3
3
  "react-focus-lock": "2.9.2",
4
4
  "@dynamic-labs/iconic": "0.1.23",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dynamic-labs/sdk-react-core",
3
- "version": "0.17.8",
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.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"
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 { AUTH_TOKEN, AUTH_USER, AUTH_MODE } from '../../utils/constants/localStorage.js';
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
- var getFromLS = require('../../shared/utils/functions/storage/getFromLS.cjs');
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(getFromLS.getFromLS(localStorage.AUTH_TOKEN));
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 { getFromLS } from '../../shared/utils/functions/storage/getFromLS.js';
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(getFromLS(AUTH_TOKEN));
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;
@@ -34,6 +34,7 @@ const getAuthToken = () => {
34
34
  }
35
35
  catch (err) {
36
36
  logger.logger.error(err);
37
+ return token;
37
38
  }
38
39
  if (helpers.isAuthTokenExpired(token)) {
39
40
  return undefined;
@@ -30,6 +30,7 @@ const getAuthToken = () => {
30
30
  }
31
31
  catch (err) {
32
32
  logger.error(err);
33
+ return token;
33
34
  }
34
35
  if (isAuthTokenExpired(token)) {
35
36
  return undefined;