@dynamic-labs/sdk-react-core 2.2.0-alpha.3 → 2.2.0-alpha.4
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 +8 -0
- package/package.cjs +1 -1
- package/package.js +1 -1
- package/package.json +13 -13
- package/src/lib/context/DynamicContext/hooks/useHandleLogout/useHandleLogout.cjs +4 -1
- package/src/lib/context/DynamicContext/hooks/useHandleLogout/useHandleLogout.js +4 -1
- package/src/lib/store/utils/storeAuthTokenAndUser/storeAuthTokenAndUser.cjs +8 -1
- package/src/lib/store/utils/storeAuthTokenAndUser/storeAuthTokenAndUser.js +8 -1
- package/src/lib/utils/constants/index.d.ts +1 -1
- package/src/lib/utils/constants/values.cjs +2 -0
- package/src/lib/utils/constants/values.d.ts +1 -0
- package/src/lib/utils/constants/values.js +2 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,4 +1,12 @@
|
|
|
1
1
|
|
|
2
|
+
## [2.2.0-alpha.4](https://github.com/dynamic-labs/DynamicAuth/compare/v2.2.0-alpha.3...v2.2.0-alpha.4) (2024-06-06)
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
### Bug Fixes
|
|
6
|
+
|
|
7
|
+
* btc getBalance should use ordinal address if payment not available ([#5882](https://github.com/dynamic-labs/DynamicAuth/issues/5882)) ([803a055](https://github.com/dynamic-labs/DynamicAuth/commit/803a05518ae9d2353d50f51b29047dff01136710))
|
|
8
|
+
* connect prompt when switching to xverse ([#5888](https://github.com/dynamic-labs/DynamicAuth/issues/5888)) ([181a7c4](https://github.com/dynamic-labs/DynamicAuth/commit/181a7c4af8217dab7ed2776d56ec2e3725a0ee6a))
|
|
9
|
+
|
|
2
10
|
## [2.2.0-alpha.3](https://github.com/dynamic-labs/DynamicAuth/compare/v2.2.0-alpha.2...v2.2.0-alpha.3) (2024-06-05)
|
|
3
11
|
|
|
4
12
|
|
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": "2.2.0-alpha.
|
|
3
|
+
"version": "2.2.0-alpha.4",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+https://github.com/dynamic-labs/dynamic-auth.git",
|
|
@@ -17,18 +17,18 @@
|
|
|
17
17
|
"react-i18next": "13.5.0",
|
|
18
18
|
"yup": "0.32.11",
|
|
19
19
|
"react-international-phone": "4.2.5",
|
|
20
|
-
"@dynamic-labs/iconic": "2.2.0-alpha.
|
|
21
|
-
"@dynamic-labs/logger": "2.2.0-alpha.
|
|
22
|
-
"@dynamic-labs/multi-wallet": "2.2.0-alpha.
|
|
23
|
-
"@dynamic-labs/rpc-provider-ethereum": "2.2.0-alpha.
|
|
24
|
-
"@dynamic-labs/rpc-provider-solana": "2.2.0-alpha.
|
|
25
|
-
"@dynamic-labs/rpc-providers": "2.2.0-alpha.
|
|
26
|
-
"@dynamic-labs/store": "2.2.0-alpha.
|
|
27
|
-
"@dynamic-labs/types": "2.2.0-alpha.
|
|
28
|
-
"@dynamic-labs/utils": "2.2.0-alpha.
|
|
29
|
-
"@dynamic-labs/viem-utils": "2.2.0-alpha.
|
|
30
|
-
"@dynamic-labs/wallet-book": "2.2.0-alpha.
|
|
31
|
-
"@dynamic-labs/wallet-connector-core": "2.2.0-alpha.
|
|
20
|
+
"@dynamic-labs/iconic": "2.2.0-alpha.4",
|
|
21
|
+
"@dynamic-labs/logger": "2.2.0-alpha.4",
|
|
22
|
+
"@dynamic-labs/multi-wallet": "2.2.0-alpha.4",
|
|
23
|
+
"@dynamic-labs/rpc-provider-ethereum": "2.2.0-alpha.4",
|
|
24
|
+
"@dynamic-labs/rpc-provider-solana": "2.2.0-alpha.4",
|
|
25
|
+
"@dynamic-labs/rpc-providers": "2.2.0-alpha.4",
|
|
26
|
+
"@dynamic-labs/store": "2.2.0-alpha.4",
|
|
27
|
+
"@dynamic-labs/types": "2.2.0-alpha.4",
|
|
28
|
+
"@dynamic-labs/utils": "2.2.0-alpha.4",
|
|
29
|
+
"@dynamic-labs/viem-utils": "2.2.0-alpha.4",
|
|
30
|
+
"@dynamic-labs/wallet-book": "2.2.0-alpha.4",
|
|
31
|
+
"@dynamic-labs/wallet-connector-core": "2.2.0-alpha.4",
|
|
32
32
|
"eventemitter3": "5.0.1"
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
@@ -15,7 +15,7 @@ require('../../../ViewContext/ViewContext.cjs');
|
|
|
15
15
|
require('@dynamic-labs/wallet-book');
|
|
16
16
|
var localStorage$1 = require('../../../../utils/constants/localStorage.cjs');
|
|
17
17
|
require('../../../../utils/constants/colors.cjs');
|
|
18
|
-
require('../../../../utils/constants/values.cjs');
|
|
18
|
+
var values = require('../../../../utils/constants/values.cjs');
|
|
19
19
|
var localStorage = require('../../../../shared/utils/classes/storage/localStorage.cjs');
|
|
20
20
|
require('../../../../shared/consts/index.cjs');
|
|
21
21
|
require('../../../../config/ApiEndpoint.cjs');
|
|
@@ -97,6 +97,9 @@ const useHandleLogout = (params) => {
|
|
|
97
97
|
p.setShowBridgeWidget(false);
|
|
98
98
|
p.resetLoginWithEmail();
|
|
99
99
|
if (p.user) {
|
|
100
|
+
// this deletes the auth cookie, if it exists
|
|
101
|
+
// if the cookie doesn't exist, this sets a new cookie which would expire immediately
|
|
102
|
+
document.cookie = `${values.DYNAMIC_AUTH_COOKIE_NAME}=; Max-Age=-99999999; path=/; SameSite=Lax`;
|
|
100
103
|
// do not await this async call - just fire and forget
|
|
101
104
|
session.revokeSession({
|
|
102
105
|
environmentId: p.environmentId,
|
|
@@ -11,7 +11,7 @@ import '../../../ViewContext/ViewContext.js';
|
|
|
11
11
|
import '@dynamic-labs/wallet-book';
|
|
12
12
|
import { AUTH_TOKEN, AUTH_MIN_TOKEN, WALLET_PICKER_SEARCH_KEY, PHANTOM_SIGNATURE_STATE } from '../../../../utils/constants/localStorage.js';
|
|
13
13
|
import '../../../../utils/constants/colors.js';
|
|
14
|
-
import '../../../../utils/constants/values.js';
|
|
14
|
+
import { DYNAMIC_AUTH_COOKIE_NAME } from '../../../../utils/constants/values.js';
|
|
15
15
|
import { LocalStorage } from '../../../../shared/utils/classes/storage/localStorage.js';
|
|
16
16
|
import '../../../../shared/consts/index.js';
|
|
17
17
|
import '../../../../config/ApiEndpoint.js';
|
|
@@ -93,6 +93,9 @@ const useHandleLogout = (params) => {
|
|
|
93
93
|
p.setShowBridgeWidget(false);
|
|
94
94
|
p.resetLoginWithEmail();
|
|
95
95
|
if (p.user) {
|
|
96
|
+
// this deletes the auth cookie, if it exists
|
|
97
|
+
// if the cookie doesn't exist, this sets a new cookie which would expire immediately
|
|
98
|
+
document.cookie = `${DYNAMIC_AUTH_COOKIE_NAME}=; Max-Age=-99999999; path=/; SameSite=Lax`;
|
|
96
99
|
// do not await this async call - just fire and forget
|
|
97
100
|
revokeSession({
|
|
98
101
|
environmentId: p.environmentId,
|
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
6
6
|
require('@dynamic-labs/wallet-connector-core');
|
|
7
7
|
var createUserProfile = require('../../../utils/functions/createUserProfile/createUserProfile.cjs');
|
|
8
8
|
require('@dynamic-labs/sdk-api-core');
|
|
9
|
-
require('../../../utils/constants/values.cjs');
|
|
9
|
+
var values = require('../../../utils/constants/values.cjs');
|
|
10
10
|
require('@dynamic-labs/utils');
|
|
11
11
|
require('../../../../../_virtual/_tslib.cjs');
|
|
12
12
|
require('@dynamic-labs/multi-wallet');
|
|
@@ -26,6 +26,7 @@ require('viem/chains');
|
|
|
26
26
|
require('../../../config/ApiEndpoint.cjs');
|
|
27
27
|
var userActions = require('../../actions/userActions/userActions.cjs');
|
|
28
28
|
require('../../../locale/locale.cjs');
|
|
29
|
+
var isCookieEnabled = require('../../../utils/functions/isCookieEnabled/isCookieEnabled.cjs');
|
|
29
30
|
var storeExpiresAt = require('../../../utils/functions/storeExpiresAt/storeExpiresAt.cjs');
|
|
30
31
|
|
|
31
32
|
const storeAuthTokenAndUser = ({ user, jwt, minifiedJwt, expiresAt, }) => {
|
|
@@ -33,6 +34,12 @@ const storeAuthTokenAndUser = ({ user, jwt, minifiedJwt, expiresAt, }) => {
|
|
|
33
34
|
storeExpiresAt.storeExpiresAt(expiresAt);
|
|
34
35
|
if (jwt && minifiedJwt) {
|
|
35
36
|
index.storeAuthToken(jwt, minifiedJwt);
|
|
37
|
+
if (isCookieEnabled.isCookieEnabled()) {
|
|
38
|
+
// if cookie is enabled, but the backend returns a JWT, then use JS to store the cookie
|
|
39
|
+
const expireDate = new Date(expiresAt * 1000).toUTCString();
|
|
40
|
+
const authCookie = `${values.DYNAMIC_AUTH_COOKIE_NAME}=${minifiedJwt}; expires=${expireDate}; path=/; SameSite=Lax`;
|
|
41
|
+
document.cookie = authCookie;
|
|
42
|
+
}
|
|
36
43
|
}
|
|
37
44
|
const userProfile = createUserProfile.createUserProfileFromSdkUser(user);
|
|
38
45
|
userActions.setUser(userProfile);
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import '@dynamic-labs/wallet-connector-core';
|
|
3
3
|
import { createUserProfileFromSdkUser } from '../../../utils/functions/createUserProfile/createUserProfile.js';
|
|
4
4
|
import '@dynamic-labs/sdk-api-core';
|
|
5
|
-
import '../../../utils/constants/values.js';
|
|
5
|
+
import { DYNAMIC_AUTH_COOKIE_NAME } from '../../../utils/constants/values.js';
|
|
6
6
|
import '@dynamic-labs/utils';
|
|
7
7
|
import '../../../../../_virtual/_tslib.js';
|
|
8
8
|
import '@dynamic-labs/multi-wallet';
|
|
@@ -22,6 +22,7 @@ import 'viem/chains';
|
|
|
22
22
|
import '../../../config/ApiEndpoint.js';
|
|
23
23
|
import { setUser } from '../../actions/userActions/userActions.js';
|
|
24
24
|
import '../../../locale/locale.js';
|
|
25
|
+
import { isCookieEnabled } from '../../../utils/functions/isCookieEnabled/isCookieEnabled.js';
|
|
25
26
|
import { storeExpiresAt } from '../../../utils/functions/storeExpiresAt/storeExpiresAt.js';
|
|
26
27
|
|
|
27
28
|
const storeAuthTokenAndUser = ({ user, jwt, minifiedJwt, expiresAt, }) => {
|
|
@@ -29,6 +30,12 @@ const storeAuthTokenAndUser = ({ user, jwt, minifiedJwt, expiresAt, }) => {
|
|
|
29
30
|
storeExpiresAt(expiresAt);
|
|
30
31
|
if (jwt && minifiedJwt) {
|
|
31
32
|
storeAuthToken(jwt, minifiedJwt);
|
|
33
|
+
if (isCookieEnabled()) {
|
|
34
|
+
// if cookie is enabled, but the backend returns a JWT, then use JS to store the cookie
|
|
35
|
+
const expireDate = new Date(expiresAt * 1000).toUTCString();
|
|
36
|
+
const authCookie = `${DYNAMIC_AUTH_COOKIE_NAME}=${minifiedJwt}; expires=${expireDate}; path=/; SameSite=Lax`;
|
|
37
|
+
document.cookie = authCookie;
|
|
38
|
+
}
|
|
32
39
|
}
|
|
33
40
|
const userProfile = createUserProfileFromSdkUser(user);
|
|
34
41
|
setUser(userProfile);
|
|
@@ -2,5 +2,5 @@ export { AUTH_TOKEN, AUTH_MIN_TOKEN, STORE_STORAGE_KEY, LAST_USED_WALLET, NETWOR
|
|
|
2
2
|
export { BASE_LIGHT_1, BASE_LIGHT_2, BASE_LIGHT_3, BASE_LIGHT_4, BASE_LIGHT_5, BASE_DARK_5, TEXT_LIGHT_PRIMARY, TEXT_LIGHT_SECONDARY, TEXT_LIGHT_TERTIARY, TEXT_LIGHT_LINK, CONNECTION_LIGHT_GREEN, CONNECTION_LIGHT_ORANGE, ERROR_LIGHT_1, ERROR_LIGHT_2, OVERLAY_LIGHT, HOVER_LIGHT, LOADING_ANIMATION_GRADIENT_LIGHT, BASE_DARK_1, BASE_DARK_2, BASE_DARK_3, BASE_DARK_4, DYNAMIC_CONNECT_BUTTON_BACKGROUND, DYNAMIC_CONNECT_BUTTON_BORDER, DYNAMIC_CONNECT_BUTTON_COLOR, TEXT_DARK_PRIMARY, TEXT_DARK_SECONDARY, TEXT_DARK_TERTIARY, TEXT_DARK_LINK, BRAND_HOVER, BRAND_PRIMARY, BRAND_SECONDARY, CONNECTION_DARK_GREEN, CONNECTION_DARK_ORANGE, ERROR_DARK_1, ERROR_DARK_2, OVERLAY_DARK, HOVER_DARK, LOADING_ANIMATION_GRADIENT_DARK, SHADOW_DOWN_1, SHADOW_DOWN_2, SHADOW_DOWN_3, SHADOW_UP_1, BRAND_HOVER_COLOR, BRAND_PRIMARY_COLOR, BRAND_SECONDARY_COLOR, } from './colors';
|
|
3
3
|
export { BORDER_SQUARE, BORDER_ROUNDED, BORDER_RADIUS } from './theme';
|
|
4
4
|
export { TITLE, BODY_NORMAL, BODY_SMALL, BODY_MINI, BUTTON_PRIMARY, BUTTON_SECONDARY, NUMBERS_BIG, NUMBERS_MEDIUM, } from './typography';
|
|
5
|
-
export { DEFAULT_NUMBER_OF_WALLETS_TO_SHOW } from './values';
|
|
5
|
+
export { DEFAULT_NUMBER_OF_WALLETS_TO_SHOW, DYNAMIC_AUTH_COOKIE_NAME, } from './values';
|
|
6
6
|
export * from './fields';
|
|
@@ -28,7 +28,9 @@ const VerifiedCredentialNameToChainEnum = {
|
|
|
28
28
|
solana: sdkApiCore.ChainEnum.Sol,
|
|
29
29
|
starknet: sdkApiCore.ChainEnum.Stark,
|
|
30
30
|
};
|
|
31
|
+
const DYNAMIC_AUTH_COOKIE_NAME = 'DYNAMIC_JWT_TOKEN';
|
|
31
32
|
|
|
32
33
|
exports.ChainEnumToVerifiedCredentialName = ChainEnumToVerifiedCredentialName;
|
|
33
34
|
exports.DEFAULT_NUMBER_OF_WALLETS_TO_SHOW = DEFAULT_NUMBER_OF_WALLETS_TO_SHOW;
|
|
35
|
+
exports.DYNAMIC_AUTH_COOKIE_NAME = DYNAMIC_AUTH_COOKIE_NAME;
|
|
34
36
|
exports.VerifiedCredentialNameToChainEnum = VerifiedCredentialNameToChainEnum;
|
|
@@ -24,5 +24,6 @@ const VerifiedCredentialNameToChainEnum = {
|
|
|
24
24
|
solana: ChainEnum.Sol,
|
|
25
25
|
starknet: ChainEnum.Stark,
|
|
26
26
|
};
|
|
27
|
+
const DYNAMIC_AUTH_COOKIE_NAME = 'DYNAMIC_JWT_TOKEN';
|
|
27
28
|
|
|
28
|
-
export { ChainEnumToVerifiedCredentialName, DEFAULT_NUMBER_OF_WALLETS_TO_SHOW, VerifiedCredentialNameToChainEnum };
|
|
29
|
+
export { ChainEnumToVerifiedCredentialName, DEFAULT_NUMBER_OF_WALLETS_TO_SHOW, DYNAMIC_AUTH_COOKIE_NAME, VerifiedCredentialNameToChainEnum };
|