@dynamic-labs/sdk-react-core 2.1.0-alpha.27 → 2.1.0-alpha.28
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 +12 -0
- package/package.cjs +1 -1
- package/package.js +1 -1
- package/package.json +13 -13
- package/src/lib/components/{SyncEmbeddedWalletAuthFlow/SyncEmbeddedWalletAuthFlow.cjs → SyncAuthFlow/SyncAuthFlow.cjs} +12 -65
- package/src/lib/components/SyncAuthFlow/SyncAuthFlow.d.ts +1 -0
- package/src/lib/components/{SyncEmbeddedWalletAuthFlow/SyncEmbeddedWalletAuthFlow.js → SyncAuthFlow/SyncAuthFlow.js} +12 -65
- package/src/lib/components/SyncAuthFlow/index.d.ts +1 -0
- package/src/lib/components/index.d.ts +1 -1
- package/src/lib/context/DynamicContext/DynamicContext.cjs +11 -5
- package/src/lib/context/DynamicContext/DynamicContext.js +11 -5
- package/src/lib/context/DynamicContext/types/index.d.ts +3 -0
- package/src/lib/data/api/embeddedWallets/embeddedWallets.cjs +1 -0
- package/src/lib/data/api/embeddedWallets/embeddedWallets.js +1 -0
- package/src/lib/utils/functions/createUserProfile/createUserProfile.cjs +0 -28
- package/src/lib/utils/functions/createUserProfile/createUserProfile.js +1 -28
- package/src/lib/utils/functions/index.d.ts +0 -1
- package/src/lib/utils/hooks/index.d.ts +1 -0
- package/src/lib/utils/hooks/useDynamicLayoutData/useDynamicLayoutData.cjs +0 -16
- package/src/lib/utils/hooks/useDynamicLayoutData/useDynamicLayoutData.js +0 -16
- package/src/lib/utils/hooks/useEmbeddedWalletPassword/useEmbeddedWalletPassword.cjs +2 -10
- package/src/lib/utils/hooks/useEmbeddedWalletPassword/useEmbeddedWalletPassword.js +2 -10
- package/src/lib/utils/hooks/useSocialAuth/useSocialAuth.cjs +2 -2
- package/src/lib/utils/hooks/useSocialAuth/useSocialAuth.js +2 -2
- package/src/lib/utils/hooks/useSyncEmbeddedWalletFlow/index.d.ts +1 -0
- package/src/lib/utils/hooks/useSyncEmbeddedWalletFlow/useSyncEmbeddedWalletFlow.cjs +139 -0
- package/src/lib/utils/hooks/useSyncEmbeddedWalletFlow/useSyncEmbeddedWalletFlow.d.ts +1 -0
- package/src/lib/utils/hooks/useSyncEmbeddedWalletFlow/useSyncEmbeddedWalletFlow.js +135 -0
- package/src/lib/utils/hooks/useWalletsConnectionState/index.d.ts +1 -0
- package/src/lib/widgets/DynamicEmbeddedWidget/DynamicEmbeddedWidget.cjs +85 -3
- package/src/lib/widgets/DynamicEmbeddedWidget/DynamicEmbeddedWidget.js +85 -3
- package/src/lib/widgets/DynamicWidget/DynamicWidget.cjs +7 -1
- package/src/lib/widgets/DynamicWidget/DynamicWidget.js +8 -2
- package/src/lib/components/SyncEmbeddedWalletAuthFlow/SyncEmbeddedWalletAuthFlow.d.ts +0 -1
- package/src/lib/components/SyncEmbeddedWalletAuthFlow/index.d.ts +0 -1
- package/src/lib/utils/functions/updateJWTAndCreateUserProfile/index.d.ts +0 -1
- package/src/lib/utils/functions/updateJWTAndCreateUserProfile/updateJWTAndCreateUserProfile.cjs +0 -20
- package/src/lib/utils/functions/updateJWTAndCreateUserProfile/updateJWTAndCreateUserProfile.d.ts +0 -1
- package/src/lib/utils/functions/updateJWTAndCreateUserProfile/updateJWTAndCreateUserProfile.js +0 -16
- package/src/lib/utils/hooks/useCreateUserProfileByJWTCallback/index.d.ts +0 -1
- package/src/lib/utils/hooks/useCreateUserProfileByJWTCallback/useCreateUserProfileByJWTCallback.d.ts +0 -3
|
@@ -84,7 +84,7 @@ var DynamicNav = require('./components/DynamicNav/DynamicNav.cjs');
|
|
|
84
84
|
var DynamicUserProfile = require('./components/DynamicUserProfile/DynamicUserProfile.cjs');
|
|
85
85
|
|
|
86
86
|
const DynamicWidget = ({ buttonContainerClassName = '', buttonClassName = '', innerButtonComponent, variant = 'modal', }) => {
|
|
87
|
-
const { showAuthFlow, setShowDynamicUserProfile } = useInternalDynamicContext.useInternalDynamicContext();
|
|
87
|
+
const { showAuthFlow, setShowDynamicUserProfile, setDynamicWidgetHasLoaded } = useInternalDynamicContext.useInternalDynamicContext();
|
|
88
88
|
const { widgetRef, inlineControlsRef } = DynamicWidgetContext.useWidgetContext();
|
|
89
89
|
const { t } = reactI18next.useTranslation();
|
|
90
90
|
if (!innerButtonComponent) {
|
|
@@ -101,6 +101,12 @@ const DynamicWidget = ({ buttonContainerClassName = '', buttonClassName = '', in
|
|
|
101
101
|
}, [inlineControlsRef, variant, showAuthFlow, setShowDynamicUserProfile]);
|
|
102
102
|
index.useOnClickOutside(widgetRef, closeOnOutsideClick);
|
|
103
103
|
const showDynamicConnectButton = !useIsLoggedIn.useIsLoggedIn();
|
|
104
|
+
React.useEffect(() => {
|
|
105
|
+
setDynamicWidgetHasLoaded(true);
|
|
106
|
+
return () => {
|
|
107
|
+
setDynamicWidgetHasLoaded(false);
|
|
108
|
+
};
|
|
109
|
+
}, [setDynamicWidgetHasLoaded]);
|
|
104
110
|
return (jsxRuntime.jsx(ShadowDOM.ShadowDOM, { className: 'dynamic-widget__container', id: 'dynamic-widget', children: showDynamicConnectButton ? (jsxRuntime.jsx(DynamicConnectButton.DynamicConnectButton, { buttonContainerClassName: buttonContainerClassName, buttonClassName: buttonClassName, copykey: 'dyn_widget.connect', children: innerButtonComponent })) : (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(DynamicNav.DynamicNav, {}), jsxRuntime.jsx(DynamicUserProfile.DynamicUserProfile, { variant: variant })] })) }));
|
|
105
111
|
};
|
|
106
112
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use client'
|
|
2
2
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
3
|
-
import { useCallback } from 'react';
|
|
3
|
+
import { useCallback, useEffect } from 'react';
|
|
4
4
|
import { useTranslation } from 'react-i18next';
|
|
5
5
|
import '../../events/dynamicEvents.js';
|
|
6
6
|
import '../../../../_virtual/_tslib.js';
|
|
@@ -80,7 +80,7 @@ import { DynamicNav } from './components/DynamicNav/DynamicNav.js';
|
|
|
80
80
|
import { DynamicUserProfile } from './components/DynamicUserProfile/DynamicUserProfile.js';
|
|
81
81
|
|
|
82
82
|
const DynamicWidget = ({ buttonContainerClassName = '', buttonClassName = '', innerButtonComponent, variant = 'modal', }) => {
|
|
83
|
-
const { showAuthFlow, setShowDynamicUserProfile } = useInternalDynamicContext();
|
|
83
|
+
const { showAuthFlow, setShowDynamicUserProfile, setDynamicWidgetHasLoaded } = useInternalDynamicContext();
|
|
84
84
|
const { widgetRef, inlineControlsRef } = useWidgetContext();
|
|
85
85
|
const { t } = useTranslation();
|
|
86
86
|
if (!innerButtonComponent) {
|
|
@@ -97,6 +97,12 @@ const DynamicWidget = ({ buttonContainerClassName = '', buttonClassName = '', in
|
|
|
97
97
|
}, [inlineControlsRef, variant, showAuthFlow, setShowDynamicUserProfile]);
|
|
98
98
|
useOnClickOutside(widgetRef, closeOnOutsideClick);
|
|
99
99
|
const showDynamicConnectButton = !useIsLoggedIn();
|
|
100
|
+
useEffect(() => {
|
|
101
|
+
setDynamicWidgetHasLoaded(true);
|
|
102
|
+
return () => {
|
|
103
|
+
setDynamicWidgetHasLoaded(false);
|
|
104
|
+
};
|
|
105
|
+
}, [setDynamicWidgetHasLoaded]);
|
|
100
106
|
return (jsx(ShadowDOM, { className: 'dynamic-widget__container', id: 'dynamic-widget', children: showDynamicConnectButton ? (jsx(DynamicConnectButton, { buttonContainerClassName: buttonContainerClassName, buttonClassName: buttonClassName, copykey: 'dyn_widget.connect', children: innerButtonComponent })) : (jsxs(Fragment, { children: [jsx(DynamicNav, {}), jsx(DynamicUserProfile, { variant: variant })] })) }));
|
|
101
107
|
};
|
|
102
108
|
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const SyncEmbeddedWalletAuthFlow: () => null;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { SyncEmbeddedWalletAuthFlow } from './SyncEmbeddedWalletAuthFlow';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { updateJWTAndCreateUserProfile } from './updateJWTAndCreateUserProfile';
|
package/src/lib/utils/functions/updateJWTAndCreateUserProfile/updateJWTAndCreateUserProfile.cjs
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
'use client'
|
|
2
|
-
'use strict';
|
|
3
|
-
|
|
4
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
|
-
|
|
6
|
-
var utils = require('@dynamic-labs/utils');
|
|
7
|
-
var decodeJwt = require('../../../shared/utils/functions/decodeJwt/decodeJwt.cjs');
|
|
8
|
-
var createUserProfile = require('../createUserProfile/createUserProfile.cjs');
|
|
9
|
-
var index = require('../storeAuthToken/index.cjs');
|
|
10
|
-
|
|
11
|
-
const updateJWTAndCreateUserProfile = (jwt, minJwt) => {
|
|
12
|
-
const decodedJWT = decodeJwt.decodeJwt(jwt);
|
|
13
|
-
if (!jwt || !decodedJWT || !minJwt) {
|
|
14
|
-
throw new utils.DynamicError('Invalid session');
|
|
15
|
-
}
|
|
16
|
-
index.storeAuthToken(jwt, minJwt);
|
|
17
|
-
return createUserProfile.createUserProfile(decodedJWT);
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
exports.updateJWTAndCreateUserProfile = updateJWTAndCreateUserProfile;
|
package/src/lib/utils/functions/updateJWTAndCreateUserProfile/updateJWTAndCreateUserProfile.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const updateJWTAndCreateUserProfile: (jwt: string | undefined, minJwt: string | undefined) => import("dist/packages/types/src").UserProfile;
|
package/src/lib/utils/functions/updateJWTAndCreateUserProfile/updateJWTAndCreateUserProfile.js
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
'use client'
|
|
2
|
-
import { DynamicError } from '@dynamic-labs/utils';
|
|
3
|
-
import { decodeJwt } from '../../../shared/utils/functions/decodeJwt/decodeJwt.js';
|
|
4
|
-
import { createUserProfile } from '../createUserProfile/createUserProfile.js';
|
|
5
|
-
import { storeAuthToken } from '../storeAuthToken/index.js';
|
|
6
|
-
|
|
7
|
-
const updateJWTAndCreateUserProfile = (jwt, minJwt) => {
|
|
8
|
-
const decodedJWT = decodeJwt(jwt);
|
|
9
|
-
if (!jwt || !decodedJWT || !minJwt) {
|
|
10
|
-
throw new DynamicError('Invalid session');
|
|
11
|
-
}
|
|
12
|
-
storeAuthToken(jwt, minJwt);
|
|
13
|
-
return createUserProfile(decodedJWT);
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
export { updateJWTAndCreateUserProfile };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './useCreateUserProfileByJWTCallback';
|