@dynamic-labs/sdk-react-core 2.2.0-alpha.2 → 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 +20 -0
- package/package.cjs +2 -2
- package/package.js +2 -2
- package/package.json +14 -14
- 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/data/api/oauth/oauth.cjs +14 -0
- package/src/lib/data/api/oauth/oauth.d.ts +2 -1
- package/src/lib/data/api/oauth/oauth.js +15 -2
- 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/src/lib/utils/hooks/useSocialAuth/useSocialAuth.cjs +13 -1
- package/src/lib/utils/hooks/useSocialAuth/useSocialAuth.js +14 -2
- package/src/lib/views/CollectUserDataView/UserDataFields/UserPhoneField/UserPhoneField.cjs +5 -3
- package/src/lib/views/CollectUserDataView/UserDataFields/UserPhoneField/UserPhoneField.js +5 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,4 +1,24 @@
|
|
|
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
|
+
|
|
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)
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
### Features
|
|
14
|
+
|
|
15
|
+
* farcaster linking ([#5869](https://github.com/dynamic-labs/DynamicAuth/issues/5869)) ([191d1d2](https://github.com/dynamic-labs/DynamicAuth/commit/191d1d29e436e7d453d533c9c330ac5cef2e2a1c))
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
### Bug Fixes
|
|
19
|
+
|
|
20
|
+
* phone number in kyc step ([#5875](https://github.com/dynamic-labs/DynamicAuth/issues/5875)) ([d73f3b1](https://github.com/dynamic-labs/DynamicAuth/commit/d73f3b158e794727e7bed5d558a43d937951ce56))
|
|
21
|
+
|
|
2
22
|
## [2.2.0-alpha.2](https://github.com/dynamic-labs/DynamicAuth/compare/v2.2.0-alpha.1...v2.2.0-alpha.2) (2024-06-05)
|
|
3
23
|
|
|
4
24
|
|
package/package.cjs
CHANGED
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
|
|
4
4
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
5
|
|
|
6
|
-
var version = "2.2.0-alpha.
|
|
6
|
+
var version = "2.2.0-alpha.4";
|
|
7
7
|
var dependencies = {
|
|
8
|
-
"@dynamic-labs/sdk-api-core": "0.0.
|
|
8
|
+
"@dynamic-labs/sdk-api-core": "0.0.460",
|
|
9
9
|
"@hcaptcha/react-hcaptcha": "1.4.4",
|
|
10
10
|
"country-list": "2.3.0",
|
|
11
11
|
formik: "2.2.9",
|
package/package.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use client'
|
|
2
|
-
var version = "2.2.0-alpha.
|
|
2
|
+
var version = "2.2.0-alpha.4";
|
|
3
3
|
var dependencies = {
|
|
4
|
-
"@dynamic-labs/sdk-api-core": "0.0.
|
|
4
|
+
"@dynamic-labs/sdk-api-core": "0.0.460",
|
|
5
5
|
"@hcaptcha/react-hcaptcha": "1.4.4",
|
|
6
6
|
"country-list": "2.3.0",
|
|
7
7
|
formik: "2.2.9",
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
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",
|
|
7
7
|
"directory": "packages/sdk-react-core"
|
|
8
8
|
},
|
|
9
9
|
"dependencies": {
|
|
10
|
-
"@dynamic-labs/sdk-api-core": "0.0.
|
|
10
|
+
"@dynamic-labs/sdk-api-core": "0.0.460",
|
|
11
11
|
"@hcaptcha/react-hcaptcha": "1.4.4",
|
|
12
12
|
"country-list": "2.3.0",
|
|
13
13
|
"formik": "2.2.9",
|
|
@@ -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,
|
|
@@ -134,8 +134,22 @@ const farcasterSignIn = (environmentId, farcasterSignInRequest) => _tslib.__awai
|
|
|
134
134
|
return undefined;
|
|
135
135
|
}
|
|
136
136
|
});
|
|
137
|
+
const farcasterVerify = (farcasterVerifyRequest) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
138
|
+
try {
|
|
139
|
+
const response = yield api.sdkApi().farcasterVerify(farcasterVerifyRequest);
|
|
140
|
+
const user = storeAuthTokenAndUser.storeAuthTokenAndUser(response);
|
|
141
|
+
return user;
|
|
142
|
+
}
|
|
143
|
+
catch (e) {
|
|
144
|
+
if (e.status === 422) {
|
|
145
|
+
throw new utils.SocialAccountAlreadyExistsError();
|
|
146
|
+
}
|
|
147
|
+
return undefined;
|
|
148
|
+
}
|
|
149
|
+
});
|
|
137
150
|
|
|
138
151
|
exports.farcasterSignIn = farcasterSignIn;
|
|
152
|
+
exports.farcasterVerify = farcasterVerify;
|
|
139
153
|
exports.getOAuthResult = getOAuthResult;
|
|
140
154
|
exports.signInOAuth = signInOAuth;
|
|
141
155
|
exports.unlinkOAuth = unlinkOAuth;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { FarcasterSignInRequest, OauthRequest, OauthResultRequest, OauthResultResponse, ProviderEnum } from '@dynamic-labs/sdk-api-core';
|
|
1
|
+
import { FarcasterSignInRequest, OauthRequest, OauthResultRequest, OauthResultResponse, ProviderEnum, FarcasterVerifyRequest } from '@dynamic-labs/sdk-api-core';
|
|
2
2
|
import { UserProfile } from '../../../..';
|
|
3
3
|
export declare const getOauthLoginUrl: (environmentId: string, providerType: ProviderEnum) => Promise<string | undefined>;
|
|
4
4
|
export declare const verifyOAuth: (environmentId: string, providerType: ProviderEnum, { code, codeVerifier, state }: OauthRequest) => Promise<UserProfile | undefined>;
|
|
@@ -10,3 +10,4 @@ export declare const unlinkOAuth: ({ environmentId, primaryWalletId, verifiedCre
|
|
|
10
10
|
export declare const signInOAuth: (environmentId: string, providerType: ProviderEnum, { code, codeVerifier, state, captchaToken }: OauthRequest) => Promise<UserProfile | undefined>;
|
|
11
11
|
export declare const getOAuthResult: (environmentId: string, providerType: ProviderEnum, { state }: OauthResultRequest) => Promise<OauthResultResponse | undefined>;
|
|
12
12
|
export declare const farcasterSignIn: (environmentId: string, farcasterSignInRequest: FarcasterSignInRequest) => Promise<UserProfile | undefined>;
|
|
13
|
+
export declare const farcasterVerify: (farcasterVerifyRequest: FarcasterVerifyRequest) => Promise<UserProfile | undefined>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use client'
|
|
2
2
|
import { __awaiter } from '../../../../../_virtual/_tslib.js';
|
|
3
|
-
import { GateBlockedError, NoAccessError, AccountExistsError
|
|
3
|
+
import { SocialAccountAlreadyExistsError, GateBlockedError, NoAccessError, AccountExistsError } from '@dynamic-labs/utils';
|
|
4
4
|
import '@dynamic-labs/sdk-api-core';
|
|
5
5
|
import { logger } from '../../../shared/logger.js';
|
|
6
6
|
import '@dynamic-labs/iconic';
|
|
@@ -130,5 +130,18 @@ const farcasterSignIn = (environmentId, farcasterSignInRequest) => __awaiter(voi
|
|
|
130
130
|
return undefined;
|
|
131
131
|
}
|
|
132
132
|
});
|
|
133
|
+
const farcasterVerify = (farcasterVerifyRequest) => __awaiter(void 0, void 0, void 0, function* () {
|
|
134
|
+
try {
|
|
135
|
+
const response = yield sdkApi().farcasterVerify(farcasterVerifyRequest);
|
|
136
|
+
const user = storeAuthTokenAndUser(response);
|
|
137
|
+
return user;
|
|
138
|
+
}
|
|
139
|
+
catch (e) {
|
|
140
|
+
if (e.status === 422) {
|
|
141
|
+
throw new SocialAccountAlreadyExistsError();
|
|
142
|
+
}
|
|
143
|
+
return undefined;
|
|
144
|
+
}
|
|
145
|
+
});
|
|
133
146
|
|
|
134
|
-
export { farcasterSignIn, getOAuthResult, signInOAuth, unlinkOAuth, verifyOAuth };
|
|
147
|
+
export { farcasterSignIn, farcasterVerify, getOAuthResult, signInOAuth, unlinkOAuth, verifyOAuth };
|
|
@@ -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 };
|
|
@@ -419,7 +419,19 @@ const useSocialAuth = ({ sessionTimeout, onSettled, onError, onFarcasterUrl, })
|
|
|
419
419
|
yield signInAccount(sdkApiCore.ProviderEnum.Farcaster, apiCall);
|
|
420
420
|
}
|
|
421
421
|
else {
|
|
422
|
-
|
|
422
|
+
const apiCall = () => oauth.farcasterVerify({
|
|
423
|
+
environmentId,
|
|
424
|
+
farcasterSignInRequest: {
|
|
425
|
+
address,
|
|
426
|
+
captchaToken,
|
|
427
|
+
domain,
|
|
428
|
+
message,
|
|
429
|
+
nonce,
|
|
430
|
+
signature,
|
|
431
|
+
},
|
|
432
|
+
});
|
|
433
|
+
yield linkAccount(sdkApiCore.ProviderEnum.Farcaster, apiCall);
|
|
434
|
+
setShowAuthFlow(false, { clearErrors: false });
|
|
423
435
|
}
|
|
424
436
|
setIsProcessing(false);
|
|
425
437
|
});
|
|
@@ -30,7 +30,7 @@ import 'viem';
|
|
|
30
30
|
import 'viem/chains';
|
|
31
31
|
import '../../../config/ApiEndpoint.js';
|
|
32
32
|
import '@dynamic-labs/store';
|
|
33
|
-
import { getOAuthResult, signInOAuth, farcasterSignIn,
|
|
33
|
+
import { getOAuthResult, signInOAuth, verifyOAuth, farcasterSignIn, farcasterVerify } from '../../../data/api/oauth/oauth.js';
|
|
34
34
|
import '../../../locale/locale.js';
|
|
35
35
|
import '../../../context/AccessDeniedContext/AccessDeniedContext.js';
|
|
36
36
|
import '../../../context/AccountExistsContext/AccountExistsContext.js';
|
|
@@ -415,7 +415,19 @@ const useSocialAuth = ({ sessionTimeout, onSettled, onError, onFarcasterUrl, })
|
|
|
415
415
|
yield signInAccount(ProviderEnum.Farcaster, apiCall);
|
|
416
416
|
}
|
|
417
417
|
else {
|
|
418
|
-
|
|
418
|
+
const apiCall = () => farcasterVerify({
|
|
419
|
+
environmentId,
|
|
420
|
+
farcasterSignInRequest: {
|
|
421
|
+
address,
|
|
422
|
+
captchaToken,
|
|
423
|
+
domain,
|
|
424
|
+
message,
|
|
425
|
+
nonce,
|
|
426
|
+
signature,
|
|
427
|
+
},
|
|
428
|
+
});
|
|
429
|
+
yield linkAccount(ProviderEnum.Farcaster, apiCall);
|
|
430
|
+
setShowAuthFlow(false, { clearErrors: false });
|
|
419
431
|
}
|
|
420
432
|
setIsProcessing(false);
|
|
421
433
|
});
|
|
@@ -33,6 +33,7 @@ require('../../../../config/ApiEndpoint.cjs');
|
|
|
33
33
|
require('@dynamic-labs/store');
|
|
34
34
|
require('../../../../locale/locale.cjs');
|
|
35
35
|
var getSupportedCountriesForVerificationFromProjectSettings = require('../../../../utils/functions/getSupportedCountriesForVerificationFromProjectSettings/getSupportedCountriesForVerificationFromProjectSettings.cjs');
|
|
36
|
+
var getDefaultCountriesIfEmpty = require('../../../../utils/functions/getDefaultCountriesIfEmpty/getDefaultCountriesIfEmpty.cjs');
|
|
36
37
|
require('../../../../context/AccessDeniedContext/AccessDeniedContext.cjs');
|
|
37
38
|
require('../../../../context/AccountExistsContext/AccountExistsContext.cjs');
|
|
38
39
|
require('../../../../context/UserWalletsContext/UserWalletsContext.cjs');
|
|
@@ -92,9 +93,10 @@ const UserPhoneField = ({ onChange, value: phone, onBlur, disabled, label, requi
|
|
|
92
93
|
target: { name, value: newPhone },
|
|
93
94
|
});
|
|
94
95
|
};
|
|
95
|
-
const countries = React.useMemo(() =>
|
|
96
|
-
|
|
97
|
-
|
|
96
|
+
const countries = React.useMemo(() => {
|
|
97
|
+
const enabledCountries = getSupportedCountriesForVerificationFromProjectSettings.getSupportedCountriesForVerificationFromProjectSettings(projectSettings);
|
|
98
|
+
return getCustomCountries.getCustomCountries(verify ? getDefaultCountriesIfEmpty.getDefaultCountriesIfEmpty(enabledCountries) : undefined);
|
|
99
|
+
}, [verify, projectSettings]);
|
|
98
100
|
return (jsxRuntime.jsx(PhoneNumberField.PhoneNumberField, { countries: countries, initialPhone: phone, disabled: disabled, onUpdate: handleUpdate, onBlur: onBlur, label: label, appendRight: !disabled && !required ? (jsxRuntime.jsx(Typography.Typography, { variant: 'body_small', color: 'secondary', className: 'user-phone-field__optional-label', children: "Optional" })) : undefined, error: error }));
|
|
99
101
|
};
|
|
100
102
|
|
|
@@ -29,6 +29,7 @@ import '../../../../config/ApiEndpoint.js';
|
|
|
29
29
|
import '@dynamic-labs/store';
|
|
30
30
|
import '../../../../locale/locale.js';
|
|
31
31
|
import { getSupportedCountriesForVerificationFromProjectSettings } from '../../../../utils/functions/getSupportedCountriesForVerificationFromProjectSettings/getSupportedCountriesForVerificationFromProjectSettings.js';
|
|
32
|
+
import { getDefaultCountriesIfEmpty } from '../../../../utils/functions/getDefaultCountriesIfEmpty/getDefaultCountriesIfEmpty.js';
|
|
32
33
|
import '../../../../context/AccessDeniedContext/AccessDeniedContext.js';
|
|
33
34
|
import '../../../../context/AccountExistsContext/AccountExistsContext.js';
|
|
34
35
|
import '../../../../context/UserWalletsContext/UserWalletsContext.js';
|
|
@@ -88,9 +89,10 @@ const UserPhoneField = ({ onChange, value: phone, onBlur, disabled, label, requi
|
|
|
88
89
|
target: { name, value: newPhone },
|
|
89
90
|
});
|
|
90
91
|
};
|
|
91
|
-
const countries = useMemo(() =>
|
|
92
|
-
|
|
93
|
-
|
|
92
|
+
const countries = useMemo(() => {
|
|
93
|
+
const enabledCountries = getSupportedCountriesForVerificationFromProjectSettings(projectSettings);
|
|
94
|
+
return getCustomCountries(verify ? getDefaultCountriesIfEmpty(enabledCountries) : undefined);
|
|
95
|
+
}, [verify, projectSettings]);
|
|
94
96
|
return (jsx(PhoneNumberField, { countries: countries, initialPhone: phone, disabled: disabled, onUpdate: handleUpdate, onBlur: onBlur, label: label, appendRight: !disabled && !required ? (jsx(Typography, { variant: 'body_small', color: 'secondary', className: 'user-phone-field__optional-label', children: "Optional" })) : undefined, error: error }));
|
|
95
97
|
};
|
|
96
98
|
|