@dynamic-labs/sdk-react-core 2.5.2 → 2.6.0
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 +2 -2
- package/package.js +2 -2
- package/package.json +14 -14
- package/src/lib/components/UserProfile/parts/UserProfileSocialAccount/UserProfileSocialAccount.cjs +1 -1
- package/src/lib/components/UserProfile/parts/UserProfileSocialAccount/UserProfileSocialAccount.js +1 -1
- package/src/lib/context/DynamicContext/DynamicContext.cjs +2 -0
- package/src/lib/context/DynamicContext/DynamicContext.d.ts +2 -0
- package/src/lib/context/DynamicContext/DynamicContext.js +2 -0
- package/src/lib/context/DynamicContext/types/SocialSettings.d.ts +7 -0
- package/src/lib/context/DynamicContext/types/index.d.ts +2 -0
- package/src/lib/context/SocialRedirectContext/SocialRedirectContext.cjs +4 -0
- package/src/lib/context/SocialRedirectContext/SocialRedirectContext.js +4 -0
- package/src/lib/context/SocialRedirectContext/hooks/useRedirectSocialHandler/index.d.ts +1 -0
- package/src/lib/context/SocialRedirectContext/hooks/useRedirectSocialHandler/useRedirectSocialHandler.cjs +150 -0
- package/src/lib/context/SocialRedirectContext/hooks/useRedirectSocialHandler/useRedirectSocialHandler.d.ts +7 -0
- package/src/lib/context/SocialRedirectContext/hooks/useRedirectSocialHandler/useRedirectSocialHandler.js +146 -0
- package/src/lib/data/api/embeddedWallets/embeddedWallets.cjs +1 -1
- package/src/lib/data/api/embeddedWallets/embeddedWallets.js +1 -1
- package/src/lib/data/api/oauth/oauth.cjs +13 -0
- package/src/lib/data/api/oauth/oauth.d.ts +2 -1
- package/src/lib/data/api/oauth/oauth.js +13 -1
- package/src/lib/shared/utils/hooks/index.d.ts +1 -0
- package/src/lib/shared/utils/hooks/useEffectOnceCondition/index.d.ts +1 -0
- package/src/lib/shared/utils/hooks/useEffectOnceCondition/useEffectOnceCondition.cjs +26 -0
- package/src/lib/shared/utils/hooks/useEffectOnceCondition/useEffectOnceCondition.d.ts +7 -0
- package/src/lib/shared/utils/hooks/useEffectOnceCondition/useEffectOnceCondition.js +22 -0
- package/src/lib/styles/index.shadow.cjs +1 -1
- package/src/lib/styles/index.shadow.js +1 -1
- package/src/lib/utils/functions/index.d.ts +1 -0
- package/src/lib/utils/functions/socialStorage/index.d.ts +1 -0
- package/src/lib/utils/functions/socialStorage/socialStorage.cjs +36 -0
- package/src/lib/utils/functions/socialStorage/socialStorage.d.ts +17 -0
- package/src/lib/utils/functions/socialStorage/socialStorage.js +29 -0
- package/src/lib/utils/hooks/useSocialAuth/apple/connectWithAppleId.cjs +26 -0
- package/src/lib/utils/hooks/useSocialAuth/apple/connectWithAppleId.d.ts +7 -0
- package/src/lib/utils/hooks/useSocialAuth/apple/connectWithAppleId.js +22 -0
- package/src/lib/utils/hooks/useSocialAuth/apple/loadAppleId.cjs +34 -0
- package/src/lib/utils/hooks/useSocialAuth/apple/loadAppleId.d.ts +1 -0
- package/src/lib/utils/hooks/useSocialAuth/apple/loadAppleId.js +30 -0
- package/src/lib/utils/hooks/useSocialAuth/index.d.ts +1 -1
- package/src/lib/utils/hooks/useSocialAuth/useSocialAuth.cjs +85 -27
- package/src/lib/utils/hooks/useSocialAuth/useSocialAuth.d.ts +9 -1
- package/src/lib/utils/hooks/useSocialAuth/useSocialAuth.js +90 -32
- package/src/lib/widgets/DynamicEmbeddedWidget/DynamicEmbeddedAuthFlow/DynamicEmbeddedAuthFlow.cjs +1 -2
- package/src/lib/widgets/DynamicEmbeddedWidget/DynamicEmbeddedAuthFlow/DynamicEmbeddedAuthFlow.js +1 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,4 +1,18 @@
|
|
|
1
1
|
|
|
2
|
+
## [2.6.0](https://github.com/dynamic-labs/DynamicAuth/compare/v2.5.3...v2.6.0) (2024-09-03)
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
### Features
|
|
6
|
+
|
|
7
|
+
* adds social redirect option and improve apple id login ([#6717](https://github.com/dynamic-labs/DynamicAuth/issues/6717)) ([500e70c](https://github.com/dynamic-labs/DynamicAuth/commit/500e70cb446b75a6264b566c7adc7cd9a0c89264))
|
|
8
|
+
|
|
9
|
+
### [2.5.3](https://github.com/dynamic-labs/DynamicAuth/compare/v2.5.2...v2.5.3) (2024-09-02)
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
### Bug Fixes
|
|
13
|
+
|
|
14
|
+
* override viem chain data with evmNetworks override data ([#6780](https://github.com/dynamic-labs/DynamicAuth/issues/6780)) ([197f1b9](https://github.com/dynamic-labs/DynamicAuth/commit/197f1b91e7d8ab2687b1463cd9817f1e13884dec))
|
|
15
|
+
|
|
2
16
|
### [2.5.2](https://github.com/dynamic-labs/DynamicAuth/compare/v2.5.1...v2.5.2) (2024-08-30)
|
|
3
17
|
|
|
4
18
|
|
package/package.cjs
CHANGED
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
|
|
4
4
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
5
|
|
|
6
|
-
var version = "2.
|
|
6
|
+
var version = "2.6.0";
|
|
7
7
|
var dependencies = {
|
|
8
|
-
"@dynamic-labs/sdk-api-core": "0.0.
|
|
8
|
+
"@dynamic-labs/sdk-api-core": "0.0.510",
|
|
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
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dynamic-labs/sdk-react-core",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.6.0",
|
|
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.510",
|
|
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.
|
|
21
|
-
"@dynamic-labs/logger": "2.
|
|
22
|
-
"@dynamic-labs/multi-wallet": "2.
|
|
23
|
-
"@dynamic-labs/rpc-provider-ethereum": "2.
|
|
24
|
-
"@dynamic-labs/rpc-provider-solana": "2.
|
|
25
|
-
"@dynamic-labs/rpc-providers": "2.
|
|
26
|
-
"@dynamic-labs/store": "2.
|
|
27
|
-
"@dynamic-labs/types": "2.
|
|
28
|
-
"@dynamic-labs/utils": "2.
|
|
29
|
-
"@dynamic-labs/viem-utils": "2.
|
|
30
|
-
"@dynamic-labs/wallet-book": "2.
|
|
31
|
-
"@dynamic-labs/wallet-connector-core": "2.
|
|
20
|
+
"@dynamic-labs/iconic": "2.6.0",
|
|
21
|
+
"@dynamic-labs/logger": "2.6.0",
|
|
22
|
+
"@dynamic-labs/multi-wallet": "2.6.0",
|
|
23
|
+
"@dynamic-labs/rpc-provider-ethereum": "2.6.0",
|
|
24
|
+
"@dynamic-labs/rpc-provider-solana": "2.6.0",
|
|
25
|
+
"@dynamic-labs/rpc-providers": "2.6.0",
|
|
26
|
+
"@dynamic-labs/store": "2.6.0",
|
|
27
|
+
"@dynamic-labs/types": "2.6.0",
|
|
28
|
+
"@dynamic-labs/utils": "2.6.0",
|
|
29
|
+
"@dynamic-labs/viem-utils": "2.6.0",
|
|
30
|
+
"@dynamic-labs/wallet-book": "2.6.0",
|
|
31
|
+
"@dynamic-labs/wallet-connector-core": "2.6.0",
|
|
32
32
|
"eventemitter3": "5.0.1"
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
package/src/lib/components/UserProfile/parts/UserProfileSocialAccount/UserProfileSocialAccount.cjs
CHANGED
|
@@ -108,7 +108,7 @@ const UserProfileSocialAccount = ({ provider, }) => {
|
|
|
108
108
|
}, startSlot:
|
|
109
109
|
// eslint-disable-next-line react/jsx-wrap-multilines
|
|
110
110
|
jsxRuntime.jsx(Icon.Icon, { color: 'text-tertiary', size: 'small', children: isProviderLinked ? jsxRuntime.jsx(unlink.ReactComponent, {}) : jsxRuntime.jsx(add.ReactComponent, {}) }), children: isProviderLinked ? null : 'Connect' }));
|
|
111
|
-
return (jsxRuntime.jsxs("div", { className: 'user-profile-social-account', "data-testid": `social-account-${provider}`, children: [jsxRuntime.jsx("div", { className: 'user-profile-social-account__icon', children: isProviderLinked ? (jsxRuntime.jsx(ConnectedAccountAvatar.ConnectedAccountAvatar, { provider: provider, avatarUrl: connectedAccountInfo === null || connectedAccountInfo === void 0 ? void 0 : connectedAccountInfo.avatar })) : (jsxRuntime.jsx(iconic.SocialIcon, { name: provider, variant: iconThemeVariant })) }), jsxRuntime.jsx(
|
|
111
|
+
return (jsxRuntime.jsxs("div", { className: 'user-profile-social-account', "data-testid": `social-account-${provider}`, children: [jsxRuntime.jsx("div", { className: 'user-profile-social-account__icon', children: isProviderLinked ? (jsxRuntime.jsx(ConnectedAccountAvatar.ConnectedAccountAvatar, { provider: provider, avatarUrl: connectedAccountInfo === null || connectedAccountInfo === void 0 ? void 0 : connectedAccountInfo.avatar })) : (jsxRuntime.jsx(iconic.SocialIcon, { name: provider, variant: iconThemeVariant })) }), jsxRuntime.jsx(Typography.Typography, { weight: 'medium', variant: 'body_normal', color: 'primary', truncate: true, className: 'user-profile-social-account__label', children: (_a = connectedAccountInfo === null || connectedAccountInfo === void 0 ? void 0 : connectedAccountInfo.publicIdentifier) !== null && _a !== void 0 ? _a : providerLabel.providerLabel(getSocialSignInProviderForProviderEnum.getSocialSignInProviderForProviderEnum(provider)) }), !isActiveCredential ? renderButton() : null] }));
|
|
112
112
|
};
|
|
113
113
|
|
|
114
114
|
exports.UserProfileSocialAccount = UserProfileSocialAccount;
|
package/src/lib/components/UserProfile/parts/UserProfileSocialAccount/UserProfileSocialAccount.js
CHANGED
|
@@ -104,7 +104,7 @@ const UserProfileSocialAccount = ({ provider, }) => {
|
|
|
104
104
|
}, startSlot:
|
|
105
105
|
// eslint-disable-next-line react/jsx-wrap-multilines
|
|
106
106
|
jsx(Icon, { color: 'text-tertiary', size: 'small', children: isProviderLinked ? jsx(SvgUnlink, {}) : jsx(SvgAdd, {}) }), children: isProviderLinked ? null : 'Connect' }));
|
|
107
|
-
return (jsxs("div", { className: 'user-profile-social-account', "data-testid": `social-account-${provider}`, children: [jsx("div", { className: 'user-profile-social-account__icon', children: isProviderLinked ? (jsx(ConnectedAccountAvatar, { provider: provider, avatarUrl: connectedAccountInfo === null || connectedAccountInfo === void 0 ? void 0 : connectedAccountInfo.avatar })) : (jsx(SocialIcon, { name: provider, variant: iconThemeVariant })) }), jsx(
|
|
107
|
+
return (jsxs("div", { className: 'user-profile-social-account', "data-testid": `social-account-${provider}`, children: [jsx("div", { className: 'user-profile-social-account__icon', children: isProviderLinked ? (jsx(ConnectedAccountAvatar, { provider: provider, avatarUrl: connectedAccountInfo === null || connectedAccountInfo === void 0 ? void 0 : connectedAccountInfo.avatar })) : (jsx(SocialIcon, { name: provider, variant: iconThemeVariant })) }), jsx(Typography, { weight: 'medium', variant: 'body_normal', color: 'primary', truncate: true, className: 'user-profile-social-account__label', children: (_a = connectedAccountInfo === null || connectedAccountInfo === void 0 ? void 0 : connectedAccountInfo.publicIdentifier) !== null && _a !== void 0 ? _a : providerLabel(getSocialSignInProviderForProviderEnum(provider)) }), !isActiveCredential ? renderButton() : null] }));
|
|
108
108
|
};
|
|
109
109
|
|
|
110
110
|
export { UserProfileSocialAccount };
|
|
@@ -565,6 +565,7 @@ const InnerDynamicContextProvider = ({ children, theme, settings: settings$1, lo
|
|
|
565
565
|
socialMediaLinkText,
|
|
566
566
|
socialMediaUrl,
|
|
567
567
|
socialProvidersFilter,
|
|
568
|
+
socialSettings: settings$1.social,
|
|
568
569
|
tabsItems,
|
|
569
570
|
termsOfServiceUrl,
|
|
570
571
|
theme,
|
|
@@ -646,6 +647,7 @@ const InnerDynamicContextProvider = ({ children, theme, settings: settings$1, lo
|
|
|
646
647
|
removeConnectedWalletsInfo,
|
|
647
648
|
rpcProviders,
|
|
648
649
|
sdkHasLoaded,
|
|
650
|
+
settings$1.social,
|
|
649
651
|
secondaryWallets,
|
|
650
652
|
selectedTabIndex,
|
|
651
653
|
selectedTabSettings,
|
|
@@ -9,6 +9,7 @@ import { DynamicHandlers } from '../../shared/types/dynamicHandlers';
|
|
|
9
9
|
import { SocialNetworkIconType } from '../../utils/functions/getSocialNetworkIcon';
|
|
10
10
|
import { ThemeData, ThemeSetting } from '../ThemeContext';
|
|
11
11
|
import { ChainsToConnect, IDynamicContext, NetworkValidationMode, SettingsOverrides } from './types';
|
|
12
|
+
import { SocialSettings } from './types/SocialSettings';
|
|
12
13
|
export declare const PUBLIC_PROJECT_LIVE_ENVIRONMENT_ID = "2762a57b-faa4-41ce-9f16-abff9300e2c9";
|
|
13
14
|
export interface DynamicContextProps {
|
|
14
15
|
children: ReactNode;
|
|
@@ -41,6 +42,7 @@ export interface DynamicContextProps {
|
|
|
41
42
|
enableConnectOnlyFallback?: boolean;
|
|
42
43
|
enableVisitTrackingOnConnectOnly?: boolean;
|
|
43
44
|
environmentId: string;
|
|
45
|
+
social?: SocialSettings;
|
|
44
46
|
/**
|
|
45
47
|
* @deprecated Use events instead
|
|
46
48
|
*/
|
|
@@ -561,6 +561,7 @@ const InnerDynamicContextProvider = ({ children, theme, settings, locale, enable
|
|
|
561
561
|
socialMediaLinkText,
|
|
562
562
|
socialMediaUrl,
|
|
563
563
|
socialProvidersFilter,
|
|
564
|
+
socialSettings: settings.social,
|
|
564
565
|
tabsItems,
|
|
565
566
|
termsOfServiceUrl,
|
|
566
567
|
theme,
|
|
@@ -642,6 +643,7 @@ const InnerDynamicContextProvider = ({ children, theme, settings, locale, enable
|
|
|
642
643
|
removeConnectedWalletsInfo,
|
|
643
644
|
rpcProviders,
|
|
644
645
|
sdkHasLoaded,
|
|
646
|
+
settings.social,
|
|
645
647
|
secondaryWallets,
|
|
646
648
|
selectedTabIndex,
|
|
647
649
|
selectedTabSettings,
|
|
@@ -14,6 +14,7 @@ import { ThemeData, ThemeSetting } from '../../ThemeContext';
|
|
|
14
14
|
import { DisplayOrder, SetDisplayOrderPriority, SetShowAuthFlow } from '../hooks';
|
|
15
15
|
import { SetCallbackType } from '../useCustomerCallbacks';
|
|
16
16
|
import { SetUserAction } from '../../../store';
|
|
17
|
+
import { SocialSettings } from './SocialSettings';
|
|
17
18
|
export type ChainsToConnect = {
|
|
18
19
|
chain: Chain;
|
|
19
20
|
chainId?: number;
|
|
@@ -67,6 +68,7 @@ export interface IDynamicContext {
|
|
|
67
68
|
accessDeniedMessagePrimary?: string;
|
|
68
69
|
accessDeniedMessageSecondary?: string;
|
|
69
70
|
accountSwitchState: AccountSwitchState;
|
|
71
|
+
socialSettings?: SocialSettings;
|
|
70
72
|
appLogoUrl?: string;
|
|
71
73
|
appName?: string;
|
|
72
74
|
defaultPhoneInputIso2?: CountryIso2;
|
|
@@ -80,6 +80,7 @@ require('../PasskeyContext/PasskeyContext.cjs');
|
|
|
80
80
|
require('../../widgets/DynamicWidget/components/DynamicWidgetHeader/DynamicWidgetHeader.cjs');
|
|
81
81
|
require('../../views/TransactionConfirmationView/helpers/transactionErrorMessage.cjs');
|
|
82
82
|
require('../../widgets/DynamicWidget/views/ManagePasskeysWidgetView/PasskeyCard/PasskeyCard.cjs');
|
|
83
|
+
var useRedirectSocialHandler = require('./hooks/useRedirectSocialHandler/useRedirectSocialHandler.cjs');
|
|
83
84
|
|
|
84
85
|
const SocialRedirectContext = React.createContext(undefined);
|
|
85
86
|
const SocialRedirectContextProvider = ({ children, }) => {
|
|
@@ -252,6 +253,9 @@ const SocialRedirectContextProvider = ({ children, }) => {
|
|
|
252
253
|
primaryWallet === null || primaryWallet === void 0 ? void 0 : primaryWallet.id,
|
|
253
254
|
getCaptchaToken,
|
|
254
255
|
]);
|
|
256
|
+
useRedirectSocialHandler.useRedirectSocialHandler({
|
|
257
|
+
setSocialProvider,
|
|
258
|
+
});
|
|
255
259
|
return (jsxRuntime.jsx(SocialRedirectContext.Provider, { value: {
|
|
256
260
|
enabledSocialProviders,
|
|
257
261
|
redirectStatus,
|
|
@@ -76,6 +76,7 @@ import '../PasskeyContext/PasskeyContext.js';
|
|
|
76
76
|
import '../../widgets/DynamicWidget/components/DynamicWidgetHeader/DynamicWidgetHeader.js';
|
|
77
77
|
import '../../views/TransactionConfirmationView/helpers/transactionErrorMessage.js';
|
|
78
78
|
import '../../widgets/DynamicWidget/views/ManagePasskeysWidgetView/PasskeyCard/PasskeyCard.js';
|
|
79
|
+
import { useRedirectSocialHandler } from './hooks/useRedirectSocialHandler/useRedirectSocialHandler.js';
|
|
79
80
|
|
|
80
81
|
const SocialRedirectContext = createContext(undefined);
|
|
81
82
|
const SocialRedirectContextProvider = ({ children, }) => {
|
|
@@ -248,6 +249,9 @@ const SocialRedirectContextProvider = ({ children, }) => {
|
|
|
248
249
|
primaryWallet === null || primaryWallet === void 0 ? void 0 : primaryWallet.id,
|
|
249
250
|
getCaptchaToken,
|
|
250
251
|
]);
|
|
252
|
+
useRedirectSocialHandler({
|
|
253
|
+
setSocialProvider,
|
|
254
|
+
});
|
|
251
255
|
return (jsx(SocialRedirectContext.Provider, { value: {
|
|
252
256
|
enabledSocialProviders,
|
|
253
257
|
redirectStatus,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { useRedirectSocialHandler } from './useRedirectSocialHandler';
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
|
+
|
|
6
|
+
var _tslib = require('../../../../../../_virtual/_tslib.cjs');
|
|
7
|
+
var React = require('react');
|
|
8
|
+
require('@dynamic-labs/sdk-api-core');
|
|
9
|
+
require('../../../../shared/logger.cjs');
|
|
10
|
+
require('@dynamic-labs/iconic');
|
|
11
|
+
require('@dynamic-labs/wallet-connector-core');
|
|
12
|
+
require('react/jsx-runtime');
|
|
13
|
+
var ViewContext = require('../../../ViewContext/ViewContext.cjs');
|
|
14
|
+
require('@dynamic-labs/wallet-book');
|
|
15
|
+
var isSSR = require('../../../../shared/utils/functions/isSSR/isSSR.cjs');
|
|
16
|
+
require('../../../../utils/constants/colors.cjs');
|
|
17
|
+
require('../../../../utils/constants/values.cjs');
|
|
18
|
+
require('../../../../shared/utils/classes/storage/localStorage.cjs');
|
|
19
|
+
var useEffectOnce = require('../../../../shared/utils/hooks/useEffectOnce/useEffectOnce.cjs');
|
|
20
|
+
require('@dynamic-labs/logger');
|
|
21
|
+
require('@dynamic-labs/utils');
|
|
22
|
+
var useEffectOnceCondition = require('../../../../shared/utils/hooks/useEffectOnceCondition/useEffectOnceCondition.cjs');
|
|
23
|
+
require('../../../../shared/consts/index.cjs');
|
|
24
|
+
require('../../../DynamicContext/DynamicContext.cjs');
|
|
25
|
+
require('../../../../events/dynamicEvents.cjs');
|
|
26
|
+
require('../../../CaptchaContext/CaptchaContext.cjs');
|
|
27
|
+
require('../../../ErrorContext/ErrorContext.cjs');
|
|
28
|
+
require('@dynamic-labs/multi-wallet');
|
|
29
|
+
require('react-international-phone');
|
|
30
|
+
var getSocialSignInProviderForProviderEnum = require('../../../../utils/functions/getSocialSignInProviderForProviderEnum/getSocialSignInProviderForProviderEnum.cjs');
|
|
31
|
+
require('viem');
|
|
32
|
+
require('viem/chains');
|
|
33
|
+
require('../../../../config/ApiEndpoint.cjs');
|
|
34
|
+
require('@dynamic-labs/store');
|
|
35
|
+
require('../../../../locale/locale.cjs');
|
|
36
|
+
var socialStorage = require('../../../../utils/functions/socialStorage/socialStorage.cjs');
|
|
37
|
+
require('../../../AccessDeniedContext/AccessDeniedContext.cjs');
|
|
38
|
+
require('../../../AccountExistsContext/AccountExistsContext.cjs');
|
|
39
|
+
require('../../../UserWalletsContext/UserWalletsContext.cjs');
|
|
40
|
+
require('../../../VerificationContext/VerificationContext.cjs');
|
|
41
|
+
require('react-dom');
|
|
42
|
+
require('../../../WalletContext/WalletContext.cjs');
|
|
43
|
+
require('../../../ThemeContext/ThemeContext.cjs');
|
|
44
|
+
require('../../../../utils/hooks/useUserUpdateRequest/useUpdateUser/userFieldsSchema.cjs');
|
|
45
|
+
require('@dynamic-labs/types');
|
|
46
|
+
var useSocialAuth = require('../../../../utils/hooks/useSocialAuth/useSocialAuth.cjs');
|
|
47
|
+
require('yup');
|
|
48
|
+
require('../../../MockContext/MockContext.cjs');
|
|
49
|
+
require('../../../../views/CollectUserDataView/useFields.cjs');
|
|
50
|
+
require('../../../FieldsStateContext/FieldsStateContext.cjs');
|
|
51
|
+
require('../../../UserFieldEditorContext/UserFieldEditorContext.cjs');
|
|
52
|
+
require('@dynamic-labs/rpc-providers');
|
|
53
|
+
require('react-i18next');
|
|
54
|
+
require('../../../../components/Accordion/components/AccordionItem/AccordionItem.cjs');
|
|
55
|
+
require('../../../../components/Alert/Alert.cjs');
|
|
56
|
+
require('../../../../components/ShadowDOM/ShadowDOM.cjs');
|
|
57
|
+
require('../../../../components/IconButton/IconButton.cjs');
|
|
58
|
+
require('../../../../components/InlineWidget/InlineWidget.cjs');
|
|
59
|
+
require('../../../../components/Input/Input.cjs');
|
|
60
|
+
require('../../../../components/IsBrowser/IsBrowser.cjs');
|
|
61
|
+
require('../../../../components/MenuList/Dropdown/Dropdown.cjs');
|
|
62
|
+
require('../../../../components/Transition/ZoomTransition/ZoomTransition.cjs');
|
|
63
|
+
require('../../../../components/Transition/SlideInUpTransition/SlideInUpTransition.cjs');
|
|
64
|
+
require('../../../../components/Transition/OpacityTransition/OpacityTransition.cjs');
|
|
65
|
+
require('../../../../components/OverlayCard/OverlayCardTarget/OverlayCardTarget.cjs');
|
|
66
|
+
require('../../../../components/PasskeyCreatedSuccessBanner/PasskeyCreatedSuccessBanner.cjs');
|
|
67
|
+
require('../../../../components/Popper/Popper/Popper.cjs');
|
|
68
|
+
require('../../../../components/Popper/PopperContext/PopperContext.cjs');
|
|
69
|
+
require('react-focus-lock');
|
|
70
|
+
require('qrcode');
|
|
71
|
+
require('formik');
|
|
72
|
+
require('../../../../views/WalletList/WalletList.cjs');
|
|
73
|
+
require('../../SocialRedirectContext.cjs');
|
|
74
|
+
require('../../../../widgets/DynamicBridgeWidget/views/WalletsView/components/SecondaryWallets/SecondaryWallets.cjs');
|
|
75
|
+
require('@hcaptcha/react-hcaptcha');
|
|
76
|
+
require('../../../LoadingContext/LoadingContext.cjs');
|
|
77
|
+
var DynamicWidgetContext = require('../../../../widgets/DynamicWidget/context/DynamicWidgetContext.cjs');
|
|
78
|
+
require('../../../FooterAnimationContext/index.cjs');
|
|
79
|
+
require('../../../WalletGroupContext/WalletGroupContext.cjs');
|
|
80
|
+
require('../../../MfaSettingsContext/MfaSettingsContext.cjs');
|
|
81
|
+
require('../../../IpConfigurationContext/IpConfigurationContext.cjs');
|
|
82
|
+
require('../../../PasskeyContext/PasskeyContext.cjs');
|
|
83
|
+
require('../../../../widgets/DynamicWidget/components/DynamicWidgetHeader/DynamicWidgetHeader.cjs');
|
|
84
|
+
require('../../../../views/TransactionConfirmationView/helpers/transactionErrorMessage.cjs');
|
|
85
|
+
require('../../../../widgets/DynamicWidget/views/ManagePasskeysWidgetView/PasskeyCard/PasskeyCard.cjs');
|
|
86
|
+
var useInternalDynamicContext = require('../../../DynamicContext/useDynamicContext/useInternalDynamicContext.cjs');
|
|
87
|
+
|
|
88
|
+
const useRedirectSocialHandler = ({ setSocialProvider, }) => {
|
|
89
|
+
const { setView } = ViewContext.useViewContext();
|
|
90
|
+
const { setDynamicWidgetView } = DynamicWidgetContext.useWidgetContext();
|
|
91
|
+
const [socialStorageItem, setSocialStorageItem] = React.useState(null);
|
|
92
|
+
const { sdkHasLoaded, user, setShowAuthFlow, isRenderingEmbeddedAuthFlow, setShowDynamicUserProfile, } = useInternalDynamicContext.useInternalDynamicContext();
|
|
93
|
+
const { completeConnection } = useSocialAuth.useSocialAuth({
|
|
94
|
+
sessionTimeout: 10000,
|
|
95
|
+
});
|
|
96
|
+
const updateInterfaceStateForSignIn = React.useCallback((socialStorageItem) => {
|
|
97
|
+
const socialSignInProvider = getSocialSignInProviderForProviderEnum.getSocialSignInProviderForProviderEnum(socialStorageItem.provider);
|
|
98
|
+
setSocialProvider(socialSignInProvider);
|
|
99
|
+
setView('social-redirect-view');
|
|
100
|
+
// Only open the auth flow when the embedded widget is not rendered
|
|
101
|
+
if (!isRenderingEmbeddedAuthFlow.current) {
|
|
102
|
+
setShowAuthFlow(true);
|
|
103
|
+
}
|
|
104
|
+
}, [setSocialProvider, setView, isRenderingEmbeddedAuthFlow, setShowAuthFlow]);
|
|
105
|
+
const updateInterfaceStateForLink = React.useCallback(() => {
|
|
106
|
+
setDynamicWidgetView('profile');
|
|
107
|
+
setShowDynamicUserProfile(true);
|
|
108
|
+
}, [setDynamicWidgetView, setShowDynamicUserProfile]);
|
|
109
|
+
useEffectOnce.useEffectOnce(() => {
|
|
110
|
+
// Do not run on server side
|
|
111
|
+
if (isSSR.isSSR())
|
|
112
|
+
return;
|
|
113
|
+
const url = new URL(window.location.href);
|
|
114
|
+
const dynamicOauthState = url.searchParams.get('dynamicOauthState');
|
|
115
|
+
const dynamicOauthCode = url.searchParams.get('dynamicOauthCode');
|
|
116
|
+
if (!dynamicOauthState || !dynamicOauthCode) {
|
|
117
|
+
return;
|
|
118
|
+
}
|
|
119
|
+
const socialStorageItem = socialStorage.searchSocialStorageByState(dynamicOauthState);
|
|
120
|
+
if (!socialStorageItem)
|
|
121
|
+
return;
|
|
122
|
+
// we got back the dynamicOauthCode from the oauth provider, set it here so we can use it to sign in
|
|
123
|
+
socialStorageItem.code = dynamicOauthCode;
|
|
124
|
+
setSocialStorageItem(socialStorageItem);
|
|
125
|
+
// Clear the state from local storage
|
|
126
|
+
socialStorage.deleteSocialStorage(socialStorageItem.provider);
|
|
127
|
+
});
|
|
128
|
+
useEffectOnceCondition.useEffectOnceCondition(() => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
129
|
+
if (!socialStorageItem)
|
|
130
|
+
return;
|
|
131
|
+
const authMode = user ? 'link' : 'signin';
|
|
132
|
+
// Update UI to reflect the original state
|
|
133
|
+
if (authMode === 'signin') {
|
|
134
|
+
updateInterfaceStateForSignIn(socialStorageItem);
|
|
135
|
+
}
|
|
136
|
+
else if (authMode === 'link') {
|
|
137
|
+
updateInterfaceStateForLink();
|
|
138
|
+
}
|
|
139
|
+
yield completeConnection({
|
|
140
|
+
authCode: socialStorageItem.code,
|
|
141
|
+
authMode,
|
|
142
|
+
captchaToken: socialStorageItem.captchaToken,
|
|
143
|
+
provider: socialStorageItem.provider,
|
|
144
|
+
state: socialStorageItem.state,
|
|
145
|
+
verifier: socialStorageItem.codeVerifier,
|
|
146
|
+
});
|
|
147
|
+
}), Boolean(socialStorageItem) && sdkHasLoaded);
|
|
148
|
+
};
|
|
149
|
+
|
|
150
|
+
exports.useRedirectSocialHandler = useRedirectSocialHandler;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Dispatch, SetStateAction } from 'react';
|
|
2
|
+
import { SocialSignInProviderEnum } from '@dynamic-labs/sdk-api-core';
|
|
3
|
+
type UseRedirectSocialHandlerProps = {
|
|
4
|
+
setSocialProvider: Dispatch<SetStateAction<SocialSignInProviderEnum | undefined>>;
|
|
5
|
+
};
|
|
6
|
+
export declare const useRedirectSocialHandler: ({ setSocialProvider, }: UseRedirectSocialHandlerProps) => void;
|
|
7
|
+
export {};
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
import { __awaiter } from '../../../../../../_virtual/_tslib.js';
|
|
3
|
+
import { useState, useCallback } from 'react';
|
|
4
|
+
import '@dynamic-labs/sdk-api-core';
|
|
5
|
+
import '../../../../shared/logger.js';
|
|
6
|
+
import '@dynamic-labs/iconic';
|
|
7
|
+
import '@dynamic-labs/wallet-connector-core';
|
|
8
|
+
import 'react/jsx-runtime';
|
|
9
|
+
import { useViewContext } from '../../../ViewContext/ViewContext.js';
|
|
10
|
+
import '@dynamic-labs/wallet-book';
|
|
11
|
+
import { isSSR } from '../../../../shared/utils/functions/isSSR/isSSR.js';
|
|
12
|
+
import '../../../../utils/constants/colors.js';
|
|
13
|
+
import '../../../../utils/constants/values.js';
|
|
14
|
+
import '../../../../shared/utils/classes/storage/localStorage.js';
|
|
15
|
+
import { useEffectOnce } from '../../../../shared/utils/hooks/useEffectOnce/useEffectOnce.js';
|
|
16
|
+
import '@dynamic-labs/logger';
|
|
17
|
+
import '@dynamic-labs/utils';
|
|
18
|
+
import { useEffectOnceCondition } from '../../../../shared/utils/hooks/useEffectOnceCondition/useEffectOnceCondition.js';
|
|
19
|
+
import '../../../../shared/consts/index.js';
|
|
20
|
+
import '../../../DynamicContext/DynamicContext.js';
|
|
21
|
+
import '../../../../events/dynamicEvents.js';
|
|
22
|
+
import '../../../CaptchaContext/CaptchaContext.js';
|
|
23
|
+
import '../../../ErrorContext/ErrorContext.js';
|
|
24
|
+
import '@dynamic-labs/multi-wallet';
|
|
25
|
+
import 'react-international-phone';
|
|
26
|
+
import { getSocialSignInProviderForProviderEnum } from '../../../../utils/functions/getSocialSignInProviderForProviderEnum/getSocialSignInProviderForProviderEnum.js';
|
|
27
|
+
import 'viem';
|
|
28
|
+
import 'viem/chains';
|
|
29
|
+
import '../../../../config/ApiEndpoint.js';
|
|
30
|
+
import '@dynamic-labs/store';
|
|
31
|
+
import '../../../../locale/locale.js';
|
|
32
|
+
import { searchSocialStorageByState, deleteSocialStorage } from '../../../../utils/functions/socialStorage/socialStorage.js';
|
|
33
|
+
import '../../../AccessDeniedContext/AccessDeniedContext.js';
|
|
34
|
+
import '../../../AccountExistsContext/AccountExistsContext.js';
|
|
35
|
+
import '../../../UserWalletsContext/UserWalletsContext.js';
|
|
36
|
+
import '../../../VerificationContext/VerificationContext.js';
|
|
37
|
+
import 'react-dom';
|
|
38
|
+
import '../../../WalletContext/WalletContext.js';
|
|
39
|
+
import '../../../ThemeContext/ThemeContext.js';
|
|
40
|
+
import '../../../../utils/hooks/useUserUpdateRequest/useUpdateUser/userFieldsSchema.js';
|
|
41
|
+
import '@dynamic-labs/types';
|
|
42
|
+
import { useSocialAuth } from '../../../../utils/hooks/useSocialAuth/useSocialAuth.js';
|
|
43
|
+
import 'yup';
|
|
44
|
+
import '../../../MockContext/MockContext.js';
|
|
45
|
+
import '../../../../views/CollectUserDataView/useFields.js';
|
|
46
|
+
import '../../../FieldsStateContext/FieldsStateContext.js';
|
|
47
|
+
import '../../../UserFieldEditorContext/UserFieldEditorContext.js';
|
|
48
|
+
import '@dynamic-labs/rpc-providers';
|
|
49
|
+
import 'react-i18next';
|
|
50
|
+
import '../../../../components/Accordion/components/AccordionItem/AccordionItem.js';
|
|
51
|
+
import '../../../../components/Alert/Alert.js';
|
|
52
|
+
import '../../../../components/ShadowDOM/ShadowDOM.js';
|
|
53
|
+
import '../../../../components/IconButton/IconButton.js';
|
|
54
|
+
import '../../../../components/InlineWidget/InlineWidget.js';
|
|
55
|
+
import '../../../../components/Input/Input.js';
|
|
56
|
+
import '../../../../components/IsBrowser/IsBrowser.js';
|
|
57
|
+
import '../../../../components/MenuList/Dropdown/Dropdown.js';
|
|
58
|
+
import '../../../../components/Transition/ZoomTransition/ZoomTransition.js';
|
|
59
|
+
import '../../../../components/Transition/SlideInUpTransition/SlideInUpTransition.js';
|
|
60
|
+
import '../../../../components/Transition/OpacityTransition/OpacityTransition.js';
|
|
61
|
+
import '../../../../components/OverlayCard/OverlayCardTarget/OverlayCardTarget.js';
|
|
62
|
+
import '../../../../components/PasskeyCreatedSuccessBanner/PasskeyCreatedSuccessBanner.js';
|
|
63
|
+
import '../../../../components/Popper/Popper/Popper.js';
|
|
64
|
+
import '../../../../components/Popper/PopperContext/PopperContext.js';
|
|
65
|
+
import 'react-focus-lock';
|
|
66
|
+
import 'qrcode';
|
|
67
|
+
import 'formik';
|
|
68
|
+
import '../../../../views/WalletList/WalletList.js';
|
|
69
|
+
import '../../SocialRedirectContext.js';
|
|
70
|
+
import '../../../../widgets/DynamicBridgeWidget/views/WalletsView/components/SecondaryWallets/SecondaryWallets.js';
|
|
71
|
+
import '@hcaptcha/react-hcaptcha';
|
|
72
|
+
import '../../../LoadingContext/LoadingContext.js';
|
|
73
|
+
import { useWidgetContext } from '../../../../widgets/DynamicWidget/context/DynamicWidgetContext.js';
|
|
74
|
+
import '../../../FooterAnimationContext/index.js';
|
|
75
|
+
import '../../../WalletGroupContext/WalletGroupContext.js';
|
|
76
|
+
import '../../../MfaSettingsContext/MfaSettingsContext.js';
|
|
77
|
+
import '../../../IpConfigurationContext/IpConfigurationContext.js';
|
|
78
|
+
import '../../../PasskeyContext/PasskeyContext.js';
|
|
79
|
+
import '../../../../widgets/DynamicWidget/components/DynamicWidgetHeader/DynamicWidgetHeader.js';
|
|
80
|
+
import '../../../../views/TransactionConfirmationView/helpers/transactionErrorMessage.js';
|
|
81
|
+
import '../../../../widgets/DynamicWidget/views/ManagePasskeysWidgetView/PasskeyCard/PasskeyCard.js';
|
|
82
|
+
import { useInternalDynamicContext } from '../../../DynamicContext/useDynamicContext/useInternalDynamicContext.js';
|
|
83
|
+
|
|
84
|
+
const useRedirectSocialHandler = ({ setSocialProvider, }) => {
|
|
85
|
+
const { setView } = useViewContext();
|
|
86
|
+
const { setDynamicWidgetView } = useWidgetContext();
|
|
87
|
+
const [socialStorageItem, setSocialStorageItem] = useState(null);
|
|
88
|
+
const { sdkHasLoaded, user, setShowAuthFlow, isRenderingEmbeddedAuthFlow, setShowDynamicUserProfile, } = useInternalDynamicContext();
|
|
89
|
+
const { completeConnection } = useSocialAuth({
|
|
90
|
+
sessionTimeout: 10000,
|
|
91
|
+
});
|
|
92
|
+
const updateInterfaceStateForSignIn = useCallback((socialStorageItem) => {
|
|
93
|
+
const socialSignInProvider = getSocialSignInProviderForProviderEnum(socialStorageItem.provider);
|
|
94
|
+
setSocialProvider(socialSignInProvider);
|
|
95
|
+
setView('social-redirect-view');
|
|
96
|
+
// Only open the auth flow when the embedded widget is not rendered
|
|
97
|
+
if (!isRenderingEmbeddedAuthFlow.current) {
|
|
98
|
+
setShowAuthFlow(true);
|
|
99
|
+
}
|
|
100
|
+
}, [setSocialProvider, setView, isRenderingEmbeddedAuthFlow, setShowAuthFlow]);
|
|
101
|
+
const updateInterfaceStateForLink = useCallback(() => {
|
|
102
|
+
setDynamicWidgetView('profile');
|
|
103
|
+
setShowDynamicUserProfile(true);
|
|
104
|
+
}, [setDynamicWidgetView, setShowDynamicUserProfile]);
|
|
105
|
+
useEffectOnce(() => {
|
|
106
|
+
// Do not run on server side
|
|
107
|
+
if (isSSR())
|
|
108
|
+
return;
|
|
109
|
+
const url = new URL(window.location.href);
|
|
110
|
+
const dynamicOauthState = url.searchParams.get('dynamicOauthState');
|
|
111
|
+
const dynamicOauthCode = url.searchParams.get('dynamicOauthCode');
|
|
112
|
+
if (!dynamicOauthState || !dynamicOauthCode) {
|
|
113
|
+
return;
|
|
114
|
+
}
|
|
115
|
+
const socialStorageItem = searchSocialStorageByState(dynamicOauthState);
|
|
116
|
+
if (!socialStorageItem)
|
|
117
|
+
return;
|
|
118
|
+
// we got back the dynamicOauthCode from the oauth provider, set it here so we can use it to sign in
|
|
119
|
+
socialStorageItem.code = dynamicOauthCode;
|
|
120
|
+
setSocialStorageItem(socialStorageItem);
|
|
121
|
+
// Clear the state from local storage
|
|
122
|
+
deleteSocialStorage(socialStorageItem.provider);
|
|
123
|
+
});
|
|
124
|
+
useEffectOnceCondition(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
125
|
+
if (!socialStorageItem)
|
|
126
|
+
return;
|
|
127
|
+
const authMode = user ? 'link' : 'signin';
|
|
128
|
+
// Update UI to reflect the original state
|
|
129
|
+
if (authMode === 'signin') {
|
|
130
|
+
updateInterfaceStateForSignIn(socialStorageItem);
|
|
131
|
+
}
|
|
132
|
+
else if (authMode === 'link') {
|
|
133
|
+
updateInterfaceStateForLink();
|
|
134
|
+
}
|
|
135
|
+
yield completeConnection({
|
|
136
|
+
authCode: socialStorageItem.code,
|
|
137
|
+
authMode,
|
|
138
|
+
captchaToken: socialStorageItem.captchaToken,
|
|
139
|
+
provider: socialStorageItem.provider,
|
|
140
|
+
state: socialStorageItem.state,
|
|
141
|
+
verifier: socialStorageItem.codeVerifier,
|
|
142
|
+
});
|
|
143
|
+
}), Boolean(socialStorageItem) && sdkHasLoaded);
|
|
144
|
+
};
|
|
145
|
+
|
|
146
|
+
export { useRedirectSocialHandler };
|
|
@@ -24,7 +24,7 @@ var storeAuthTokenAndUser = require('../../../store/utils/storeAuthTokenAndUser/
|
|
|
24
24
|
const createTurnkeyEmbeddedWallet = (_a) => _tslib.__awaiter(void 0, [_a], void 0, function* ({ attestation, challenge, environmentId, chains = [sdkApiCore.ChainEnum.Evm], passkeyAlias, }) {
|
|
25
25
|
const embeddedWallets = [
|
|
26
26
|
{
|
|
27
|
-
chains,
|
|
27
|
+
chains: chains,
|
|
28
28
|
embeddedWalletProvider: sdkApiCore.EmbeddedWalletProviderEnum.Turnkeyhd,
|
|
29
29
|
isAuthenticatorAttached: false,
|
|
30
30
|
passkeyAlias,
|
|
@@ -20,7 +20,7 @@ import { storeAuthTokenAndUser } from '../../../store/utils/storeAuthTokenAndUse
|
|
|
20
20
|
const createTurnkeyEmbeddedWallet = (_a) => __awaiter(void 0, [_a], void 0, function* ({ attestation, challenge, environmentId, chains = [ChainEnum.Evm], passkeyAlias, }) {
|
|
21
21
|
const embeddedWallets = [
|
|
22
22
|
{
|
|
23
|
-
chains,
|
|
23
|
+
chains: chains,
|
|
24
24
|
embeddedWalletProvider: EmbeddedWalletProviderEnum.Turnkeyhd,
|
|
25
25
|
isAuthenticatorAttached: false,
|
|
26
26
|
passkeyAlias,
|
|
@@ -21,6 +21,18 @@ require('../../../shared/consts/index.cjs');
|
|
|
21
21
|
var api = require('../api.cjs');
|
|
22
22
|
var storeAuthTokenAndUser = require('../../../store/utils/storeAuthTokenAndUser/storeAuthTokenAndUser.cjs');
|
|
23
23
|
|
|
24
|
+
const initAuth = (environmentId, providerType, oauthInitAuthRequest) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
25
|
+
try {
|
|
26
|
+
yield api.sdkApi().initAuth({
|
|
27
|
+
environmentId,
|
|
28
|
+
oauthInitAuthRequest,
|
|
29
|
+
providerType,
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
catch (e) {
|
|
33
|
+
logger.logger.error(e);
|
|
34
|
+
}
|
|
35
|
+
});
|
|
24
36
|
const verifyOAuth = (environmentId_1, providerType_1, _a) => _tslib.__awaiter(void 0, [environmentId_1, providerType_1, _a], void 0, function* (environmentId, providerType, { code, codeVerifier, state }) {
|
|
25
37
|
const oauthRequest = {
|
|
26
38
|
code,
|
|
@@ -134,6 +146,7 @@ const farcasterVerify = (farcasterVerifyRequest) => _tslib.__awaiter(void 0, voi
|
|
|
134
146
|
|
|
135
147
|
exports.farcasterSignIn = farcasterSignIn;
|
|
136
148
|
exports.farcasterVerify = farcasterVerify;
|
|
149
|
+
exports.initAuth = initAuth;
|
|
137
150
|
exports.signInOAuth = signInOAuth;
|
|
138
151
|
exports.unlinkOAuth = unlinkOAuth;
|
|
139
152
|
exports.verifyOAuth = verifyOAuth;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { FarcasterSignInRequest, OauthRequest, OauthResultRequest, OauthResultResponse, ProviderEnum, FarcasterVerifyRequest } from '@dynamic-labs/sdk-api-core';
|
|
1
|
+
import { FarcasterSignInRequest, OauthRequest, OauthResultRequest, OauthResultResponse, ProviderEnum, FarcasterVerifyRequest, OauthInitAuthRequest } 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
|
+
export declare const initAuth: (environmentId: string, providerType: ProviderEnum, oauthInitAuthRequest: OauthInitAuthRequest) => Promise<void>;
|
|
4
5
|
export declare const verifyOAuth: (environmentId: string, providerType: ProviderEnum, { code, codeVerifier, state }: OauthRequest) => Promise<UserProfile | undefined>;
|
|
5
6
|
export declare const unlinkOAuth: ({ environmentId, primaryWalletId, verifiedCrentialId, }: {
|
|
6
7
|
environmentId: string;
|
|
@@ -17,6 +17,18 @@ import '../../../shared/consts/index.js';
|
|
|
17
17
|
import { sdkApi } from '../api.js';
|
|
18
18
|
import { storeAuthTokenAndUser } from '../../../store/utils/storeAuthTokenAndUser/storeAuthTokenAndUser.js';
|
|
19
19
|
|
|
20
|
+
const initAuth = (environmentId, providerType, oauthInitAuthRequest) => __awaiter(void 0, void 0, void 0, function* () {
|
|
21
|
+
try {
|
|
22
|
+
yield sdkApi().initAuth({
|
|
23
|
+
environmentId,
|
|
24
|
+
oauthInitAuthRequest,
|
|
25
|
+
providerType,
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
catch (e) {
|
|
29
|
+
logger.error(e);
|
|
30
|
+
}
|
|
31
|
+
});
|
|
20
32
|
const verifyOAuth = (environmentId_1, providerType_1, _a) => __awaiter(void 0, [environmentId_1, providerType_1, _a], void 0, function* (environmentId, providerType, { code, codeVerifier, state }) {
|
|
21
33
|
const oauthRequest = {
|
|
22
34
|
code,
|
|
@@ -128,4 +140,4 @@ const farcasterVerify = (farcasterVerifyRequest) => __awaiter(void 0, void 0, vo
|
|
|
128
140
|
}
|
|
129
141
|
});
|
|
130
142
|
|
|
131
|
-
export { farcasterSignIn, farcasterVerify, signInOAuth, unlinkOAuth, verifyOAuth };
|
|
143
|
+
export { farcasterSignIn, farcasterVerify, initAuth, signInOAuth, unlinkOAuth, verifyOAuth };
|
|
@@ -7,3 +7,4 @@ export { useOnClickOutside } from './useOnClickOutside';
|
|
|
7
7
|
export { usePreventPageScroll } from './usePreventPageScroll';
|
|
8
8
|
export { useThrottle } from './useThrottle';
|
|
9
9
|
export { usePrefetch } from './usePrefetch';
|
|
10
|
+
export { useEffectOnceCondition } from './useEffectOnceCondition';
|