@dynamic-labs/sdk-react-core 0.19.0-alpha.25 → 0.19.0-alpha.27
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 +39 -0
- package/package.cjs +2 -2
- package/package.js +2 -2
- package/package.json +10 -10
- package/src/lib/components/Accordion/components/VerticalAccordion/VerticalAccordion.cjs +1 -1
- package/src/lib/components/Accordion/components/VerticalAccordion/VerticalAccordion.js +1 -1
- package/src/lib/components/Accordion/components/VerticalAccordion/VerticalAccordion.types.d.ts +2 -4
- package/src/lib/components/Button/Button.cjs +1 -0
- package/src/lib/components/Button/Button.d.ts +1 -1
- package/src/lib/components/Button/Button.js +1 -0
- package/src/lib/components/LogoutButton/LogoutButton.cjs +1 -3
- package/src/lib/components/LogoutButton/LogoutButton.js +1 -3
- package/src/lib/components/NetworkPicker/NetworkPicker.cjs +5 -2
- package/src/lib/components/NetworkPicker/NetworkPicker.js +5 -2
- package/src/lib/components/SendBalancePageLayout/SendBalancePageLayout.cjs +1 -1
- package/src/lib/components/SendBalancePageLayout/SendBalancePageLayout.js +2 -2
- package/src/lib/components/SocialSignIn/SocialSignIn.cjs +8 -3
- package/src/lib/components/SocialSignIn/SocialSignIn.js +8 -3
- package/src/lib/components/Typography/Typography.cjs +1 -0
- package/src/lib/components/Typography/Typography.js +1 -0
- package/src/lib/components/Typography/Typography.types.d.ts +1 -1
- package/src/lib/components/UserProfile/parts/UserProfileField/UserProfileField.cjs +1 -1
- package/src/lib/components/UserProfile/parts/UserProfileField/UserProfileField.js +1 -1
- package/src/lib/context/DynamicContext/DynamicContext.cjs +5 -3
- package/src/lib/context/DynamicContext/DynamicContext.js +5 -3
- package/src/lib/context/DynamicContext/internalEvents/internalEvents.d.ts +0 -1
- package/src/lib/context/DynamicContext/useDynamicContext.cjs +1 -2
- package/src/lib/context/DynamicContext/useDynamicContext.d.ts +1 -1
- package/src/lib/context/DynamicContext/useDynamicContext.js +1 -2
- package/src/lib/context/SocialRedirectContext/SocialRedirectContext.cjs +8 -8
- package/src/lib/context/SocialRedirectContext/SocialRedirectContext.js +8 -8
- package/src/lib/context/ViewContext/ViewContext.cjs +14 -1
- package/src/lib/context/ViewContext/ViewContext.d.ts +3 -1
- package/src/lib/context/ViewContext/ViewContext.js +15 -2
- package/src/lib/layout/DynamicAuthLayout/DynamicAuthLayout.cjs +2 -2
- package/src/lib/layout/DynamicAuthLayout/DynamicAuthLayout.d.ts +2 -2
- package/src/lib/layout/DynamicAuthLayout/DynamicAuthLayout.js +2 -2
- package/src/lib/layout/DynamicUserProfileLayout/DynamicUserProfileLayout.cjs +3 -2
- package/src/lib/layout/DynamicUserProfileLayout/DynamicUserProfileLayout.d.ts +2 -3
- package/src/lib/layout/DynamicUserProfileLayout/DynamicUserProfileLayout.js +4 -3
- package/src/lib/shared/utils/hooks/useOnClickOutside/index.cjs +2 -2
- package/src/lib/shared/utils/hooks/useOnClickOutside/index.js +2 -2
- package/src/lib/styles/index.shadow.cjs +1 -1
- package/src/lib/styles/index.shadow.js +1 -1
- package/src/lib/utils/functions/getUserWalletsFromVerifiedCredentials/getUserWalletsFromVerifiedCredentials.cjs +26 -0
- package/src/lib/utils/functions/getUserWalletsFromVerifiedCredentials/getUserWalletsFromVerifiedCredentials.d.ts +1 -0
- package/src/lib/utils/functions/getUserWalletsFromVerifiedCredentials/getUserWalletsFromVerifiedCredentials.js +22 -0
- package/src/lib/utils/functions/getUserWalletsFromVerifiedCredentials/index.d.ts +1 -0
- package/src/lib/utils/functions/index.d.ts +1 -0
- package/src/lib/utils/hooks/multiWallet/useSyncPrimaryWallet/useSyncPrimaryWallet.cjs +2 -5
- package/src/lib/utils/hooks/multiWallet/useSyncPrimaryWallet/useSyncPrimaryWallet.js +2 -5
- package/src/lib/utils/hooks/useEmbeddedWallet/useEmbeddedWallet.cjs +12 -6
- package/src/lib/utils/hooks/useEmbeddedWallet/useEmbeddedWallet.js +12 -6
- package/src/lib/utils/hooks/useFetchProjectSettings/useFetchProjectSettings.cjs +1 -7
- package/src/lib/utils/hooks/useFetchProjectSettings/useFetchProjectSettings.js +2 -8
- package/src/lib/utils/hooks/usePrimaryWalletId/usePrimaryWalletId.cjs +2 -6
- package/src/lib/utils/hooks/usePrimaryWalletId/usePrimaryWalletId.d.ts +1 -2
- package/src/lib/utils/hooks/usePrimaryWalletId/usePrimaryWalletId.js +2 -6
- package/src/lib/utils/hooks/useSocialAuth/useSocialAuth.cjs +15 -5
- package/src/lib/utils/hooks/useSocialAuth/useSocialAuth.js +15 -5
- package/src/lib/utils/hooks/useWalletConnectors/useWalletConnectors.cjs +4 -2
- package/src/lib/utils/hooks/useWalletConnectors/useWalletConnectors.d.ts +2 -1
- package/src/lib/utils/hooks/useWalletConnectors/useWalletConnectors.js +4 -2
- package/src/lib/utils/hooks/useWalletEventListeners/useWalletEventListeners.cjs +3 -8
- package/src/lib/utils/hooks/useWalletEventListeners/useWalletEventListeners.js +3 -8
- package/src/lib/utils/types/ClassStyleProps.d.ts +5 -0
- package/src/lib/utils/types/index.d.ts +1 -0
- package/src/lib/views/LoginView/LoginView.cjs +1 -1
- package/src/lib/views/LoginView/LoginView.js +1 -1
- package/src/lib/views/LoginView/sections/EmailSignInSection/LoginEmailForm.cjs +7 -2
- package/src/lib/views/LoginView/sections/EmailSignInSection/LoginEmailForm.js +8 -3
- package/src/lib/views/LoginView/sections/SocialSignInSection/MagicSocialSignIn/MagicSocialSignIn.cjs +2 -4
- package/src/lib/views/LoginView/sections/SocialSignInSection/MagicSocialSignIn/MagicSocialSignIn.js +2 -4
- package/src/lib/views/LoginView/useLoginView.cjs +31 -17
- package/src/lib/views/LoginView/useLoginView.js +32 -18
- package/src/lib/views/PendingSignatureView/PendingSignatureView.cjs +1 -1
- package/src/lib/views/PendingSignatureView/PendingSignatureView.js +1 -1
- package/src/lib/widgets/DynamicEmbeddedWidget/DynamicEmbeddedAuthFlow/DynamicEmbeddedAuthFlow.cjs +2 -2
- package/src/lib/widgets/DynamicEmbeddedWidget/DynamicEmbeddedAuthFlow/DynamicEmbeddedAuthFlow.d.ts +4 -1
- package/src/lib/widgets/DynamicEmbeddedWidget/DynamicEmbeddedAuthFlow/DynamicEmbeddedAuthFlow.js +2 -2
- package/src/lib/widgets/DynamicEmbeddedWidget/DynamicEmbeddedUserProfile/DynamicEmbeddedUserProfile.cjs +2 -2
- package/src/lib/widgets/DynamicEmbeddedWidget/DynamicEmbeddedUserProfile/DynamicEmbeddedUserProfile.d.ts +4 -1
- package/src/lib/widgets/DynamicEmbeddedWidget/DynamicEmbeddedUserProfile/DynamicEmbeddedUserProfile.js +2 -2
- package/src/lib/widgets/DynamicEmbeddedWidget/DynamicEmbeddedWidget.cjs +2 -2
- package/src/lib/widgets/DynamicEmbeddedWidget/DynamicEmbeddedWidget.d.ts +4 -1
- package/src/lib/widgets/DynamicEmbeddedWidget/DynamicEmbeddedWidget.js +2 -2
- package/src/lib/widgets/DynamicWidget/components/ActiveWalletInformation/ActiveWalletInformation.cjs +2 -2
- package/src/lib/widgets/DynamicWidget/components/ActiveWalletInformation/ActiveWalletInformation.js +2 -2
- package/src/lib/widgets/DynamicWidget/components/DynamicUserProfile/DynamicUserProfile.cjs +1 -1
- package/src/lib/widgets/DynamicWidget/components/DynamicUserProfile/DynamicUserProfile.js +1 -1
- package/src/lib/widgets/DynamicWidget/components/DynamicWidgetHeader/DynamicWidgetWalletHeader/DynamicWidgetWalletHeader.cjs +1 -1
- package/src/lib/widgets/DynamicWidget/components/DynamicWidgetHeader/DynamicWidgetWalletHeader/DynamicWidgetWalletHeader.js +2 -2
- package/src/lib/widgets/DynamicWidget/components/DynamicWidgetWallets/DynamicWidgetWallets.cjs +2 -2
- package/src/lib/widgets/DynamicWidget/components/DynamicWidgetWallets/DynamicWidgetWallets.js +2 -2
- package/src/lib/utils/hooks/useWalletEventListeners/utils/index.d.ts +0 -1
- package/src/lib/utils/hooks/useWalletEventListeners/utils/sortAccountsByPrimaryWallet/index.d.ts +0 -1
- package/src/lib/utils/hooks/useWalletEventListeners/utils/sortAccountsByPrimaryWallet/sortAccountsByPrimaryWallet.cjs +0 -9
- package/src/lib/utils/hooks/useWalletEventListeners/utils/sortAccountsByPrimaryWallet/sortAccountsByPrimaryWallet.d.ts +0 -2
- package/src/lib/utils/hooks/useWalletEventListeners/utils/sortAccountsByPrimaryWallet/sortAccountsByPrimaryWallet.js +0 -5
|
@@ -6,6 +6,7 @@ var React = require('react');
|
|
|
6
6
|
var reactI18next = require('react-i18next');
|
|
7
7
|
var sdkApi = require('@dynamic-labs/sdk-api');
|
|
8
8
|
var useInternalDynamicContext = require('../../context/DynamicContext/useInternalDynamicContext.cjs');
|
|
9
|
+
var SocialRedirectContext = require('../../context/SocialRedirectContext/SocialRedirectContext.cjs');
|
|
9
10
|
require('../../shared/logger.cjs');
|
|
10
11
|
require('@dynamic-labs/iconic');
|
|
11
12
|
require('@dynamic-labs/wallet-connector-core');
|
|
@@ -24,7 +25,9 @@ var index = require('../../utils/functions/getEnabledProviders/index.cjs');
|
|
|
24
25
|
/* eslint-disable multiline-comment-style */
|
|
25
26
|
const NUMBER_OF_WALLETS = 3;
|
|
26
27
|
const useLoginView = () => {
|
|
28
|
+
var _a, _b, _c, _d;
|
|
27
29
|
const { projectSettings, authorizationViewDisplayOrder, loginWithEmail, wallets, walletsFilter, } = useInternalDynamicContext.useInternalDynamicContext();
|
|
30
|
+
const { enabledSocialProviders } = SocialRedirectContext.useSocialRedirectContext();
|
|
28
31
|
/** Takes from wallets only those that can be selected in the wallet list by the user.
|
|
29
32
|
* Should filter out embedded wallets
|
|
30
33
|
* WHY: when we decide whether to show wallets or not, we need to know how many wallets
|
|
@@ -55,46 +58,51 @@ const useLoginView = () => {
|
|
|
55
58
|
* build email and social view sections from project settings design.modal props - backwards compatibility
|
|
56
59
|
* @returns SdkViewSection[]
|
|
57
60
|
*/
|
|
58
|
-
const getEmailViewSectionDefinition = () => {
|
|
59
|
-
var _a, _b
|
|
61
|
+
const getEmailViewSectionDefinition = React.useCallback(() => {
|
|
62
|
+
var _a, _b;
|
|
60
63
|
const loginViewSections = [
|
|
61
64
|
{
|
|
62
65
|
type: sdkApi.SdkViewSectionType.Email,
|
|
63
66
|
},
|
|
64
67
|
];
|
|
65
|
-
const enabledSocialProviders = (_b = (_a = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.sdk.socialSignIn) === null || _a === void 0 ? void 0 : _a.providers) === null || _b === void 0 ? void 0 : _b.filter((provider) => provider.enabled);
|
|
66
68
|
if (enabledSocialProviders === null || enabledSocialProviders === void 0 ? void 0 : enabledSocialProviders.length) {
|
|
67
|
-
|
|
69
|
+
const socialSection = {
|
|
68
70
|
numOfItemsToDisplay: 5,
|
|
69
71
|
type: sdkApi.SdkViewSectionType.Social,
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
+
};
|
|
73
|
+
loginViewSections.push(socialSection);
|
|
74
|
+
if ((_a = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.design.modal) === null || _a === void 0 ? void 0 : _a.splitEmailAndSocial) {
|
|
72
75
|
loginViewSections.splice(1, 0, {
|
|
73
76
|
label: t('dyn_login.separators.default'),
|
|
74
77
|
type: sdkApi.SdkViewSectionType.Separator,
|
|
75
78
|
});
|
|
76
|
-
|
|
77
|
-
|
|
79
|
+
// eslint-disable-next-line prefer-destructuring
|
|
80
|
+
socialSection.defaultItem = enabledSocialProviders[0];
|
|
78
81
|
}
|
|
79
82
|
}
|
|
80
|
-
if ((
|
|
83
|
+
if ((_b = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.design.modal) === null || _b === void 0 ? void 0 : _b.socialAboveEmail) {
|
|
81
84
|
loginViewSections.reverse();
|
|
82
85
|
}
|
|
83
86
|
return loginViewSections;
|
|
84
|
-
}
|
|
87
|
+
}, [
|
|
88
|
+
enabledSocialProviders,
|
|
89
|
+
(_a = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.design.modal) === null || _a === void 0 ? void 0 : _a.socialAboveEmail,
|
|
90
|
+
(_b = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.design.modal) === null || _b === void 0 ? void 0 : _b.splitEmailAndSocial,
|
|
91
|
+
t,
|
|
92
|
+
]);
|
|
85
93
|
// TODO: https://linear.app/dynamic-labs/issue/GVTY-212/rethink-or-implement-toolkit-template-for-email-wallet-order
|
|
86
94
|
/**
|
|
87
95
|
* remove wallet view section from projectSettings?.sdk?.views if no wallet defined
|
|
88
96
|
* @param sections
|
|
89
97
|
* @returns
|
|
90
98
|
*/
|
|
91
|
-
const filterLoginViewSections = (sections) => {
|
|
99
|
+
const filterLoginViewSections = React.useCallback((sections) => {
|
|
92
100
|
if (selectableWallets === null || selectableWallets === void 0 ? void 0 : selectableWallets.length) {
|
|
93
101
|
return sections;
|
|
94
102
|
}
|
|
95
103
|
return sections.filter((section) => section.type !== 'wallet');
|
|
96
|
-
};
|
|
97
|
-
const addSeparator = (index
|
|
104
|
+
}, [selectableWallets === null || selectableWallets === void 0 ? void 0 : selectableWallets.length]);
|
|
105
|
+
const addSeparator = React.useCallback((index) => {
|
|
98
106
|
// if not the first index, no separator is needed
|
|
99
107
|
// if the first index but does not have wallets or providers,
|
|
100
108
|
// it'll show only one view section - no separator is needed
|
|
@@ -107,12 +115,12 @@ const useLoginView = () => {
|
|
|
107
115
|
type: sdkApi.SdkViewSectionType.Separator,
|
|
108
116
|
},
|
|
109
117
|
];
|
|
110
|
-
};
|
|
118
|
+
}, [hasEnabledProviders, selectableWallets === null || selectableWallets === void 0 ? void 0 : selectableWallets.length, t]);
|
|
111
119
|
/**
|
|
112
120
|
* build login view sections array from project settings design.modal props - backwards compatibility
|
|
113
121
|
* @returns SdkViewSection[]
|
|
114
122
|
*/
|
|
115
|
-
const buildLoginSections = () => {
|
|
123
|
+
const buildLoginSections = React.useCallback(() => {
|
|
116
124
|
let loginViewSections = [];
|
|
117
125
|
authorizationViewDisplayOrder === null || authorizationViewDisplayOrder === void 0 ? void 0 : authorizationViewDisplayOrder.forEach((loginItem, index) => {
|
|
118
126
|
var _a, _b;
|
|
@@ -139,7 +147,14 @@ const useLoginView = () => {
|
|
|
139
147
|
}
|
|
140
148
|
});
|
|
141
149
|
return loginViewSections;
|
|
142
|
-
}
|
|
150
|
+
}, [
|
|
151
|
+
addSeparator,
|
|
152
|
+
authorizationViewDisplayOrder,
|
|
153
|
+
getEmailViewSectionDefinition,
|
|
154
|
+
(_d = (_c = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.design) === null || _c === void 0 ? void 0 : _c.modal) === null || _d === void 0 ? void 0 : _d.showWalletsButton,
|
|
155
|
+
projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.providers,
|
|
156
|
+
selectableWallets === null || selectableWallets === void 0 ? void 0 : selectableWallets.length,
|
|
157
|
+
]);
|
|
143
158
|
/**
|
|
144
159
|
* returns the login view sections to be displayed in order from projectSettings?.sdk?.views
|
|
145
160
|
* and has backwards compatibility with project settings design.modal props
|
|
@@ -156,7 +171,6 @@ const useLoginView = () => {
|
|
|
156
171
|
return buildLoginSections();
|
|
157
172
|
}, [
|
|
158
173
|
projectSettings,
|
|
159
|
-
authorizationViewDisplayOrder,
|
|
160
174
|
getEmailViewSectionDefinition,
|
|
161
175
|
filterLoginViewSections,
|
|
162
176
|
buildLoginSections,
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { useMemo } from 'react';
|
|
1
|
+
import { useMemo, useCallback } from 'react';
|
|
2
2
|
import { useTranslation } from 'react-i18next';
|
|
3
3
|
import { SdkViewType, SdkViewSectionType } from '@dynamic-labs/sdk-api';
|
|
4
4
|
import { useInternalDynamicContext } from '../../context/DynamicContext/useInternalDynamicContext.js';
|
|
5
|
+
import { useSocialRedirectContext } from '../../context/SocialRedirectContext/SocialRedirectContext.js';
|
|
5
6
|
import '../../shared/logger.js';
|
|
6
7
|
import '@dynamic-labs/iconic';
|
|
7
8
|
import '@dynamic-labs/wallet-connector-core';
|
|
@@ -20,7 +21,9 @@ import { getEnabledProviders } from '../../utils/functions/getEnabledProviders/i
|
|
|
20
21
|
/* eslint-disable multiline-comment-style */
|
|
21
22
|
const NUMBER_OF_WALLETS = 3;
|
|
22
23
|
const useLoginView = () => {
|
|
24
|
+
var _a, _b, _c, _d;
|
|
23
25
|
const { projectSettings, authorizationViewDisplayOrder, loginWithEmail, wallets, walletsFilter, } = useInternalDynamicContext();
|
|
26
|
+
const { enabledSocialProviders } = useSocialRedirectContext();
|
|
24
27
|
/** Takes from wallets only those that can be selected in the wallet list by the user.
|
|
25
28
|
* Should filter out embedded wallets
|
|
26
29
|
* WHY: when we decide whether to show wallets or not, we need to know how many wallets
|
|
@@ -51,46 +54,51 @@ const useLoginView = () => {
|
|
|
51
54
|
* build email and social view sections from project settings design.modal props - backwards compatibility
|
|
52
55
|
* @returns SdkViewSection[]
|
|
53
56
|
*/
|
|
54
|
-
const getEmailViewSectionDefinition = () => {
|
|
55
|
-
var _a, _b
|
|
57
|
+
const getEmailViewSectionDefinition = useCallback(() => {
|
|
58
|
+
var _a, _b;
|
|
56
59
|
const loginViewSections = [
|
|
57
60
|
{
|
|
58
61
|
type: SdkViewSectionType.Email,
|
|
59
62
|
},
|
|
60
63
|
];
|
|
61
|
-
const enabledSocialProviders = (_b = (_a = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.sdk.socialSignIn) === null || _a === void 0 ? void 0 : _a.providers) === null || _b === void 0 ? void 0 : _b.filter((provider) => provider.enabled);
|
|
62
64
|
if (enabledSocialProviders === null || enabledSocialProviders === void 0 ? void 0 : enabledSocialProviders.length) {
|
|
63
|
-
|
|
65
|
+
const socialSection = {
|
|
64
66
|
numOfItemsToDisplay: 5,
|
|
65
67
|
type: SdkViewSectionType.Social,
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
+
};
|
|
69
|
+
loginViewSections.push(socialSection);
|
|
70
|
+
if ((_a = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.design.modal) === null || _a === void 0 ? void 0 : _a.splitEmailAndSocial) {
|
|
68
71
|
loginViewSections.splice(1, 0, {
|
|
69
72
|
label: t('dyn_login.separators.default'),
|
|
70
73
|
type: SdkViewSectionType.Separator,
|
|
71
74
|
});
|
|
72
|
-
|
|
73
|
-
|
|
75
|
+
// eslint-disable-next-line prefer-destructuring
|
|
76
|
+
socialSection.defaultItem = enabledSocialProviders[0];
|
|
74
77
|
}
|
|
75
78
|
}
|
|
76
|
-
if ((
|
|
79
|
+
if ((_b = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.design.modal) === null || _b === void 0 ? void 0 : _b.socialAboveEmail) {
|
|
77
80
|
loginViewSections.reverse();
|
|
78
81
|
}
|
|
79
82
|
return loginViewSections;
|
|
80
|
-
}
|
|
83
|
+
}, [
|
|
84
|
+
enabledSocialProviders,
|
|
85
|
+
(_a = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.design.modal) === null || _a === void 0 ? void 0 : _a.socialAboveEmail,
|
|
86
|
+
(_b = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.design.modal) === null || _b === void 0 ? void 0 : _b.splitEmailAndSocial,
|
|
87
|
+
t,
|
|
88
|
+
]);
|
|
81
89
|
// TODO: https://linear.app/dynamic-labs/issue/GVTY-212/rethink-or-implement-toolkit-template-for-email-wallet-order
|
|
82
90
|
/**
|
|
83
91
|
* remove wallet view section from projectSettings?.sdk?.views if no wallet defined
|
|
84
92
|
* @param sections
|
|
85
93
|
* @returns
|
|
86
94
|
*/
|
|
87
|
-
const filterLoginViewSections = (sections) => {
|
|
95
|
+
const filterLoginViewSections = useCallback((sections) => {
|
|
88
96
|
if (selectableWallets === null || selectableWallets === void 0 ? void 0 : selectableWallets.length) {
|
|
89
97
|
return sections;
|
|
90
98
|
}
|
|
91
99
|
return sections.filter((section) => section.type !== 'wallet');
|
|
92
|
-
};
|
|
93
|
-
const addSeparator = (index
|
|
100
|
+
}, [selectableWallets === null || selectableWallets === void 0 ? void 0 : selectableWallets.length]);
|
|
101
|
+
const addSeparator = useCallback((index) => {
|
|
94
102
|
// if not the first index, no separator is needed
|
|
95
103
|
// if the first index but does not have wallets or providers,
|
|
96
104
|
// it'll show only one view section - no separator is needed
|
|
@@ -103,12 +111,12 @@ const useLoginView = () => {
|
|
|
103
111
|
type: SdkViewSectionType.Separator,
|
|
104
112
|
},
|
|
105
113
|
];
|
|
106
|
-
};
|
|
114
|
+
}, [hasEnabledProviders, selectableWallets === null || selectableWallets === void 0 ? void 0 : selectableWallets.length, t]);
|
|
107
115
|
/**
|
|
108
116
|
* build login view sections array from project settings design.modal props - backwards compatibility
|
|
109
117
|
* @returns SdkViewSection[]
|
|
110
118
|
*/
|
|
111
|
-
const buildLoginSections = () => {
|
|
119
|
+
const buildLoginSections = useCallback(() => {
|
|
112
120
|
let loginViewSections = [];
|
|
113
121
|
authorizationViewDisplayOrder === null || authorizationViewDisplayOrder === void 0 ? void 0 : authorizationViewDisplayOrder.forEach((loginItem, index) => {
|
|
114
122
|
var _a, _b;
|
|
@@ -135,7 +143,14 @@ const useLoginView = () => {
|
|
|
135
143
|
}
|
|
136
144
|
});
|
|
137
145
|
return loginViewSections;
|
|
138
|
-
}
|
|
146
|
+
}, [
|
|
147
|
+
addSeparator,
|
|
148
|
+
authorizationViewDisplayOrder,
|
|
149
|
+
getEmailViewSectionDefinition,
|
|
150
|
+
(_d = (_c = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.design) === null || _c === void 0 ? void 0 : _c.modal) === null || _d === void 0 ? void 0 : _d.showWalletsButton,
|
|
151
|
+
projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.providers,
|
|
152
|
+
selectableWallets === null || selectableWallets === void 0 ? void 0 : selectableWallets.length,
|
|
153
|
+
]);
|
|
139
154
|
/**
|
|
140
155
|
* returns the login view sections to be displayed in order from projectSettings?.sdk?.views
|
|
141
156
|
* and has backwards compatibility with project settings design.modal props
|
|
@@ -152,7 +167,6 @@ const useLoginView = () => {
|
|
|
152
167
|
return buildLoginSections();
|
|
153
168
|
}, [
|
|
154
169
|
projectSettings,
|
|
155
|
-
authorizationViewDisplayOrder,
|
|
156
170
|
getEmailViewSectionDefinition,
|
|
157
171
|
filterLoginViewSections,
|
|
158
172
|
buildLoginSections,
|
|
@@ -94,7 +94,7 @@ const PendingSignatureView = () => {
|
|
|
94
94
|
} }));
|
|
95
95
|
const typographyBodyCopy = isPhantomLedger
|
|
96
96
|
? "Click sign in your wallet to confirm you own this wallet (this doesn't cost gas)."
|
|
97
|
-
: 'Click sign in your wallet to confirm you own this wallet.';
|
|
97
|
+
: 'Click sign-in in your wallet to confirm you own this wallet.';
|
|
98
98
|
return (jsxRuntime.jsxs("div", { className: 'pending-signature__container', "data-testid": 'pending-signature-view', children: [jsxRuntime.jsx(IconWithSpinner.IconWithSpinner, { Icon: icon, iconSize: iconSize, isSpinning: true, indicator: 'connected', className: 'pending-signature__icon-with-spinner' }), jsxRuntime.jsx(Typography.Typography, { variant: 'body_normal', weight: 'regular', className: classNames.classNames('pending-signature__copy'), children: typographyBodyCopy }), isPhantomLedger && (jsxRuntime.jsxs(Typography.Typography, { variant: 'body_small', weight: 'regular', className: classNames.classNames('pending-signature__copy', 'pending-signature__copy--mini'), children: [jsxRuntime.jsx("strong", { children: "Note:" }), " Ledger with Phantom doesn\u2019t support message signing. When logging in, a small fee (which should not apply) may appear. See below to learn more."] })), requiresTwoStepAuthentication.requiresTwoStepAuthentication(walletConnector) && (jsxRuntime.jsx(Button.Button, { buttonClassName: 'pending-signature__button', onClick: handleClick, loading: loading, buttonVariant: 'primary', buttonPadding: 'large', expanded: true, typographyProps: {
|
|
99
99
|
variant: 'button_primary',
|
|
100
100
|
weight: 'medium',
|
|
@@ -90,7 +90,7 @@ const PendingSignatureView = () => {
|
|
|
90
90
|
} }));
|
|
91
91
|
const typographyBodyCopy = isPhantomLedger
|
|
92
92
|
? "Click sign in your wallet to confirm you own this wallet (this doesn't cost gas)."
|
|
93
|
-
: 'Click sign in your wallet to confirm you own this wallet.';
|
|
93
|
+
: 'Click sign-in in your wallet to confirm you own this wallet.';
|
|
94
94
|
return (jsxs("div", { className: 'pending-signature__container', "data-testid": 'pending-signature-view', children: [jsx(IconWithSpinner, { Icon: icon, iconSize: iconSize, isSpinning: true, indicator: 'connected', className: 'pending-signature__icon-with-spinner' }), jsx(Typography, { variant: 'body_normal', weight: 'regular', className: classNames('pending-signature__copy'), children: typographyBodyCopy }), isPhantomLedger && (jsxs(Typography, { variant: 'body_small', weight: 'regular', className: classNames('pending-signature__copy', 'pending-signature__copy--mini'), children: [jsx("strong", { children: "Note:" }), " Ledger with Phantom doesn\u2019t support message signing. When logging in, a small fee (which should not apply) may appear. See below to learn more."] })), requiresTwoStepAuthentication(walletConnector) && (jsx(Button, { buttonClassName: 'pending-signature__button', onClick: handleClick, loading: loading, buttonVariant: 'primary', buttonPadding: 'large', expanded: true, typographyProps: {
|
|
95
95
|
variant: 'button_primary',
|
|
96
96
|
weight: 'medium',
|
package/src/lib/widgets/DynamicEmbeddedWidget/DynamicEmbeddedAuthFlow/DynamicEmbeddedAuthFlow.cjs
CHANGED
|
@@ -61,7 +61,7 @@ var SocialRedirectContext = require('../../../context/SocialRedirectContext/Soci
|
|
|
61
61
|
require('../../../views/WalletList/WalletList.cjs');
|
|
62
62
|
var viewToComponentMap = require('../../../views/viewToComponentMap.cjs');
|
|
63
63
|
|
|
64
|
-
const DynamicEmbeddedAuthFlow = ({ background = 'none', }) => {
|
|
64
|
+
const DynamicEmbeddedAuthFlow = ({ background = 'none', className, style, }) => {
|
|
65
65
|
const hide = useIsLoggedIn.useIsLoggedIn();
|
|
66
66
|
const { projectSettings, internalEvents, isRenderingEmbeddedAuthFlow } = useInternalDynamicContext.useInternalDynamicContext();
|
|
67
67
|
const { view: authView, goToInitialView: resetAuthView } = ViewContext.useViewContext();
|
|
@@ -82,7 +82,7 @@ const DynamicEmbeddedAuthFlow = ({ background = 'none', }) => {
|
|
|
82
82
|
}, [hide]);
|
|
83
83
|
if (hide)
|
|
84
84
|
return null;
|
|
85
|
-
const content = (jsxRuntime.jsx(DynamicAuthLayout.DynamicAuthLayout, { projectSettings: projectSettings, children: viewToComponentMap.viewToComponentMap[authView] }));
|
|
85
|
+
const content = (jsxRuntime.jsx(DynamicAuthLayout.DynamicAuthLayout, { className: className, style: style, projectSettings: projectSettings, children: viewToComponentMap.viewToComponentMap[authView] }));
|
|
86
86
|
return (jsxRuntime.jsx(ShadowDOM.ShadowDOM, { className: 'embedded-widget', children: jsxRuntime.jsx(PopperContext.PopperProvider, { children: jsxRuntime.jsx(SocialRedirectContext.SocialRedirectContextProvider, { children: jsxRuntime.jsx(index.FooterAnimationContextProvider, { children: background === 'none' ? (content) : (jsxRuntime.jsx(ModalCard.ModalCard, { border: background === 'with-border', sharpBottomRadiusOnMobile: false, children: content })) }) }) }) }));
|
|
87
87
|
};
|
|
88
88
|
|
package/src/lib/widgets/DynamicEmbeddedWidget/DynamicEmbeddedAuthFlow/DynamicEmbeddedAuthFlow.d.ts
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
1
|
import { FC } from 'react';
|
|
2
2
|
import { EmbedProps } from '../EmbedProps.type';
|
|
3
|
-
|
|
3
|
+
import { ClassStyleProps } from '../../../utils/types';
|
|
4
|
+
type DynamicEmbeddedAuthFlowProps = EmbedProps & ClassStyleProps;
|
|
5
|
+
export declare const DynamicEmbeddedAuthFlow: FC<DynamicEmbeddedAuthFlowProps>;
|
|
6
|
+
export {};
|
package/src/lib/widgets/DynamicEmbeddedWidget/DynamicEmbeddedAuthFlow/DynamicEmbeddedAuthFlow.js
CHANGED
|
@@ -57,7 +57,7 @@ import { SocialRedirectContextProvider } from '../../../context/SocialRedirectCo
|
|
|
57
57
|
import '../../../views/WalletList/WalletList.js';
|
|
58
58
|
import { viewToComponentMap } from '../../../views/viewToComponentMap.js';
|
|
59
59
|
|
|
60
|
-
const DynamicEmbeddedAuthFlow = ({ background = 'none', }) => {
|
|
60
|
+
const DynamicEmbeddedAuthFlow = ({ background = 'none', className, style, }) => {
|
|
61
61
|
const hide = useIsLoggedIn();
|
|
62
62
|
const { projectSettings, internalEvents, isRenderingEmbeddedAuthFlow } = useInternalDynamicContext();
|
|
63
63
|
const { view: authView, goToInitialView: resetAuthView } = useViewContext();
|
|
@@ -78,7 +78,7 @@ const DynamicEmbeddedAuthFlow = ({ background = 'none', }) => {
|
|
|
78
78
|
}, [hide]);
|
|
79
79
|
if (hide)
|
|
80
80
|
return null;
|
|
81
|
-
const content = (jsx(DynamicAuthLayout, { projectSettings: projectSettings, children: viewToComponentMap[authView] }));
|
|
81
|
+
const content = (jsx(DynamicAuthLayout, { className: className, style: style, projectSettings: projectSettings, children: viewToComponentMap[authView] }));
|
|
82
82
|
return (jsx(ShadowDOM, { className: 'embedded-widget', children: jsx(PopperProvider, { children: jsx(SocialRedirectContextProvider, { children: jsx(FooterAnimationContextProvider, { children: background === 'none' ? (content) : (jsx(ModalCard, { border: background === 'with-border', sharpBottomRadiusOnMobile: false, children: content })) }) }) }) }));
|
|
83
83
|
};
|
|
84
84
|
|
|
@@ -54,11 +54,11 @@ var ModalCard = require('../../../components/ModalCard/ModalCard.cjs');
|
|
|
54
54
|
require('../../../components/InlineWidget/InlineWidget.cjs');
|
|
55
55
|
require('../../../components/MenuList/Dropdown/Dropdown.cjs');
|
|
56
56
|
|
|
57
|
-
const DynamicEmbeddedUserProfile = ({ background = 'none', }) => {
|
|
57
|
+
const DynamicEmbeddedUserProfile = ({ background = 'none', className, style }) => {
|
|
58
58
|
const show = useIsLoggedIn.useIsLoggedIn();
|
|
59
59
|
if (!show)
|
|
60
60
|
return null;
|
|
61
|
-
const content = jsxRuntime.jsx(DynamicUserProfileLayout.DynamicUserProfileLayout, { variant: 'modal' });
|
|
61
|
+
const content = (jsxRuntime.jsx(DynamicUserProfileLayout.DynamicUserProfileLayout, { className: className, style: style, variant: 'modal' }));
|
|
62
62
|
return (jsxRuntime.jsx(ShadowDOM.ShadowDOM, { className: 'embedded-widget', children: jsxRuntime.jsx(PopperContext.PopperProvider, { children: background === 'none' ? (content) : (jsxRuntime.jsx(ModalCard.ModalCard, { border: background === 'with-border', sharpBottomRadiusOnMobile: false, children: content })) }) }));
|
|
63
63
|
};
|
|
64
64
|
|
|
@@ -1,3 +1,6 @@
|
|
|
1
1
|
import { FC } from 'react';
|
|
2
2
|
import { EmbedProps } from '../EmbedProps.type';
|
|
3
|
-
|
|
3
|
+
import { ClassStyleProps } from '../../../utils/types';
|
|
4
|
+
type DynamicEmbeddedUserProfileProps = EmbedProps & ClassStyleProps;
|
|
5
|
+
export declare const DynamicEmbeddedUserProfile: FC<DynamicEmbeddedUserProfileProps>;
|
|
6
|
+
export {};
|
|
@@ -50,11 +50,11 @@ import { ModalCard } from '../../../components/ModalCard/ModalCard.js';
|
|
|
50
50
|
import '../../../components/InlineWidget/InlineWidget.js';
|
|
51
51
|
import '../../../components/MenuList/Dropdown/Dropdown.js';
|
|
52
52
|
|
|
53
|
-
const DynamicEmbeddedUserProfile = ({ background = 'none', }) => {
|
|
53
|
+
const DynamicEmbeddedUserProfile = ({ background = 'none', className, style }) => {
|
|
54
54
|
const show = useIsLoggedIn();
|
|
55
55
|
if (!show)
|
|
56
56
|
return null;
|
|
57
|
-
const content = jsx(DynamicUserProfileLayout, { variant: 'modal' });
|
|
57
|
+
const content = (jsx(DynamicUserProfileLayout, { className: className, style: style, variant: 'modal' }));
|
|
58
58
|
return (jsx(ShadowDOM, { className: 'embedded-widget', children: jsx(PopperProvider, { children: background === 'none' ? (content) : (jsx(ModalCard, { border: background === 'with-border', sharpBottomRadiusOnMobile: false, children: content })) }) }));
|
|
59
59
|
};
|
|
60
60
|
|
|
@@ -6,8 +6,8 @@ var jsxRuntime = require('react/jsx-runtime');
|
|
|
6
6
|
var DynamicEmbeddedAuthFlow = require('./DynamicEmbeddedAuthFlow/DynamicEmbeddedAuthFlow.cjs');
|
|
7
7
|
var DynamicEmbeddedUserProfile = require('./DynamicEmbeddedUserProfile/DynamicEmbeddedUserProfile.cjs');
|
|
8
8
|
|
|
9
|
-
const DynamicEmbeddedWidget = ({ background = 'none', }) => (
|
|
9
|
+
const DynamicEmbeddedWidget = ({ background = 'none', className, style, }) => (
|
|
10
10
|
// Only one of these 2 show at any given time, due these components' own definitions
|
|
11
|
-
jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(DynamicEmbeddedAuthFlow.DynamicEmbeddedAuthFlow, { background: background }), jsxRuntime.jsx(DynamicEmbeddedUserProfile.DynamicEmbeddedUserProfile, { background: background })] }));
|
|
11
|
+
jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(DynamicEmbeddedAuthFlow.DynamicEmbeddedAuthFlow, { background: background, className: className, style: style }), jsxRuntime.jsx(DynamicEmbeddedUserProfile.DynamicEmbeddedUserProfile, { background: background, className: className, style: style })] }));
|
|
12
12
|
|
|
13
13
|
exports.DynamicEmbeddedWidget = DynamicEmbeddedWidget;
|
|
@@ -1,3 +1,6 @@
|
|
|
1
1
|
import { FC } from 'react';
|
|
2
|
+
import { ClassStyleProps } from '../../utils/types';
|
|
2
3
|
import { EmbedProps } from './EmbedProps.type';
|
|
3
|
-
|
|
4
|
+
type DynamicEmbeddedWidgetProps = EmbedProps & ClassStyleProps;
|
|
5
|
+
export declare const DynamicEmbeddedWidget: FC<DynamicEmbeddedWidgetProps>;
|
|
6
|
+
export {};
|
|
@@ -2,8 +2,8 @@ import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
|
|
|
2
2
|
import { DynamicEmbeddedAuthFlow } from './DynamicEmbeddedAuthFlow/DynamicEmbeddedAuthFlow.js';
|
|
3
3
|
import { DynamicEmbeddedUserProfile } from './DynamicEmbeddedUserProfile/DynamicEmbeddedUserProfile.js';
|
|
4
4
|
|
|
5
|
-
const DynamicEmbeddedWidget = ({ background = 'none', }) => (
|
|
5
|
+
const DynamicEmbeddedWidget = ({ background = 'none', className, style, }) => (
|
|
6
6
|
// Only one of these 2 show at any given time, due these components' own definitions
|
|
7
|
-
jsxs(Fragment, { children: [jsx(DynamicEmbeddedAuthFlow, { background: background }), jsx(DynamicEmbeddedUserProfile, { background: background })] }));
|
|
7
|
+
jsxs(Fragment, { children: [jsx(DynamicEmbeddedAuthFlow, { background: background, className: className, style: style }), jsx(DynamicEmbeddedUserProfile, { background: background, className: className, style: style })] }));
|
|
8
8
|
|
|
9
9
|
export { DynamicEmbeddedWidget };
|
package/src/lib/widgets/DynamicWidget/components/ActiveWalletInformation/ActiveWalletInformation.cjs
CHANGED
|
@@ -71,7 +71,7 @@ const ICON_SIZE = 28;
|
|
|
71
71
|
const ActiveWalletInformation = () => {
|
|
72
72
|
const { t } = reactI18next.useTranslation();
|
|
73
73
|
const [isNetworkPickerOpen, setIsNetworkPickerOpen] = React.useState(false);
|
|
74
|
-
const { primaryWallet, authToken, network,
|
|
74
|
+
const { primaryWallet, authToken, network, projectSettings, handleLogOut } = useInternalDynamicContext.useInternalDynamicContext();
|
|
75
75
|
const address = primaryWallet === null || primaryWallet === void 0 ? void 0 : primaryWallet.address;
|
|
76
76
|
const nameService = useFetchNameService.useFetchNameService(address);
|
|
77
77
|
const { data: testnet } = usePromise.usePromise(() => isTestnet.isTestnet(primaryWallet), { deps: [network] });
|
|
@@ -105,7 +105,7 @@ const ActiveWalletInformation = () => {
|
|
|
105
105
|
const evmNetworks = ((primaryWallet === null || primaryWallet === void 0 ? void 0 : primaryWallet.connector) &&
|
|
106
106
|
(primaryWallet === null || primaryWallet === void 0 ? void 0 : primaryWallet.connector).evmNetworks) ||
|
|
107
107
|
[];
|
|
108
|
-
return (jsxRuntime.jsxs("div", { className: 'active-wallet-information-container', "data-testid": 'active-wallet-information', children: [jsxRuntime.jsxs("div", { className: 'active-wallet-information', children: [jsxRuntime.jsxs("div", { className: 'active-wallet-information__header', children: [(nameService === null || nameService === void 0 ? void 0 : nameService.avatar) ? (jsxRuntime.jsx("div", { className: 'active-wallet-information__avatar', children: jsxRuntime.jsx("img", { src: nameService === null || nameService === void 0 ? void 0 : nameService.avatar, alt: '' }) })) : (jsxRuntime.jsx("div", { className: 'active-wallet-information__wallet-img', children: jsxRuntime.jsx(AuthProviderIcon.AuthProviderIcon, { jwt: authToken, iconSize: ICON_SIZE, showStatus: true }) })), jsxRuntime.jsxs("div", { className: 'active-wallet-information__details', children: [jsxRuntime.jsxs("div", { className: classNames.classNames('active-wallet-information__actions-container', {
|
|
108
|
+
return (jsxRuntime.jsxs("div", { className: 'active-wallet-information-container', "data-testid": 'active-wallet-information', children: [jsxRuntime.jsxs("div", { className: 'active-wallet-information', children: [jsxRuntime.jsxs("div", { className: 'active-wallet-information__header', children: [jsxRuntime.jsx("div", { className: 'active-wallet-information__avatar--centered', children: (nameService === null || nameService === void 0 ? void 0 : nameService.avatar) ? (jsxRuntime.jsx("div", { className: 'active-wallet-information__avatar', children: jsxRuntime.jsx("img", { src: nameService === null || nameService === void 0 ? void 0 : nameService.avatar, alt: '' }) })) : (jsxRuntime.jsx("div", { className: 'active-wallet-information__wallet-img', children: jsxRuntime.jsx(AuthProviderIcon.AuthProviderIcon, { jwt: authToken, iconSize: ICON_SIZE, showStatus: true }) })) }), jsxRuntime.jsxs("div", { className: 'active-wallet-information__details', children: [jsxRuntime.jsxs("div", { className: classNames.classNames('active-wallet-information__actions-container', {
|
|
109
109
|
'active-wallet-information__actions-container--centered': !(nameService === null || nameService === void 0 ? void 0 : nameService.name),
|
|
110
110
|
}), children: [jsxRuntime.jsxs("div", { children: [jsxRuntime.jsx(Typography.Typography, { className: 'active-wallet-information__handle', color: 'primary', variant: 'body_normal', children: nameService === null || nameService === void 0 ? void 0 : nameService.name }), jsxRuntime.jsx(Typography.Typography, { className: 'active-wallet-information__address', weight: (nameService === null || nameService === void 0 ? void 0 : nameService.name) ? 'regular' : 'medium', variant: (nameService === null || nameService === void 0 ? void 0 : nameService.name) ? 'body_small' : 'body_normal', color: (nameService === null || nameService === void 0 ? void 0 : nameService.name) ? 'secondary' : 'primary', children: shortenWalletAddress.shortenWalletAddress(address, 4, 4) })] }), jsxRuntime.jsx(DotsMenu.DotsMenu, { "data-testid": 'dots-menu', options: options, buttonClassName: 'active-wallet-information__dots-menu', buttonClassNameWithOpenMenu: 'active-wallet-information__dots-menu' })] }), jsxRuntime.jsx(NetworkPicker.NetworkPicker, { connector: primaryWallet === null || primaryWallet === void 0 ? void 0 : primaryWallet.connector, isNetworkPickerOpen: isNetworkPickerOpen, setIsNetworkPickerOpen: setIsNetworkPickerOpen, mainClassName: 'active-wallet-information__network-picker', buttonClassName: 'active-wallet-information__network-picker-button', evmNetworks: evmNetworks, showNetworkName: true })] })] }), testnet && (jsxRuntime.jsx(Alert.Alert, { variant: 'warning', children: t('dyn_active_wallet_info.testnet_warning') }))] }), jsxRuntime.jsxs("div", { className: 'balance-container', children: [jsxRuntime.jsx(Typography.Typography, { color: 'secondary', variant: 'body_small', children: "Balance" }), primaryWallet && (jsxRuntime.jsx(Balance.Balance, { className: 'balance-container__balance', connector: primaryWallet.connector, address: primaryWallet.address, network: network }))] })] }));
|
|
111
111
|
};
|
package/src/lib/widgets/DynamicWidget/components/ActiveWalletInformation/ActiveWalletInformation.js
CHANGED
|
@@ -67,7 +67,7 @@ const ICON_SIZE = 28;
|
|
|
67
67
|
const ActiveWalletInformation = () => {
|
|
68
68
|
const { t } = useTranslation();
|
|
69
69
|
const [isNetworkPickerOpen, setIsNetworkPickerOpen] = useState(false);
|
|
70
|
-
const { primaryWallet, authToken, network,
|
|
70
|
+
const { primaryWallet, authToken, network, projectSettings, handleLogOut } = useInternalDynamicContext();
|
|
71
71
|
const address = primaryWallet === null || primaryWallet === void 0 ? void 0 : primaryWallet.address;
|
|
72
72
|
const nameService = useFetchNameService(address);
|
|
73
73
|
const { data: testnet } = usePromise(() => isTestnet(primaryWallet), { deps: [network] });
|
|
@@ -101,7 +101,7 @@ const ActiveWalletInformation = () => {
|
|
|
101
101
|
const evmNetworks = ((primaryWallet === null || primaryWallet === void 0 ? void 0 : primaryWallet.connector) &&
|
|
102
102
|
(primaryWallet === null || primaryWallet === void 0 ? void 0 : primaryWallet.connector).evmNetworks) ||
|
|
103
103
|
[];
|
|
104
|
-
return (jsxs("div", { className: 'active-wallet-information-container', "data-testid": 'active-wallet-information', children: [jsxs("div", { className: 'active-wallet-information', children: [jsxs("div", { className: 'active-wallet-information__header', children: [(nameService === null || nameService === void 0 ? void 0 : nameService.avatar) ? (jsx("div", { className: 'active-wallet-information__avatar', children: jsx("img", { src: nameService === null || nameService === void 0 ? void 0 : nameService.avatar, alt: '' }) })) : (jsx("div", { className: 'active-wallet-information__wallet-img', children: jsx(AuthProviderIcon, { jwt: authToken, iconSize: ICON_SIZE, showStatus: true }) })), jsxs("div", { className: 'active-wallet-information__details', children: [jsxs("div", { className: classNames('active-wallet-information__actions-container', {
|
|
104
|
+
return (jsxs("div", { className: 'active-wallet-information-container', "data-testid": 'active-wallet-information', children: [jsxs("div", { className: 'active-wallet-information', children: [jsxs("div", { className: 'active-wallet-information__header', children: [jsx("div", { className: 'active-wallet-information__avatar--centered', children: (nameService === null || nameService === void 0 ? void 0 : nameService.avatar) ? (jsx("div", { className: 'active-wallet-information__avatar', children: jsx("img", { src: nameService === null || nameService === void 0 ? void 0 : nameService.avatar, alt: '' }) })) : (jsx("div", { className: 'active-wallet-information__wallet-img', children: jsx(AuthProviderIcon, { jwt: authToken, iconSize: ICON_SIZE, showStatus: true }) })) }), jsxs("div", { className: 'active-wallet-information__details', children: [jsxs("div", { className: classNames('active-wallet-information__actions-container', {
|
|
105
105
|
'active-wallet-information__actions-container--centered': !(nameService === null || nameService === void 0 ? void 0 : nameService.name),
|
|
106
106
|
}), children: [jsxs("div", { children: [jsx(Typography, { className: 'active-wallet-information__handle', color: 'primary', variant: 'body_normal', children: nameService === null || nameService === void 0 ? void 0 : nameService.name }), jsx(Typography, { className: 'active-wallet-information__address', weight: (nameService === null || nameService === void 0 ? void 0 : nameService.name) ? 'regular' : 'medium', variant: (nameService === null || nameService === void 0 ? void 0 : nameService.name) ? 'body_small' : 'body_normal', color: (nameService === null || nameService === void 0 ? void 0 : nameService.name) ? 'secondary' : 'primary', children: shortenWalletAddress(address, 4, 4) })] }), jsx(DotsMenu, { "data-testid": 'dots-menu', options: options, buttonClassName: 'active-wallet-information__dots-menu', buttonClassNameWithOpenMenu: 'active-wallet-information__dots-menu' })] }), jsx(NetworkPicker, { connector: primaryWallet === null || primaryWallet === void 0 ? void 0 : primaryWallet.connector, isNetworkPickerOpen: isNetworkPickerOpen, setIsNetworkPickerOpen: setIsNetworkPickerOpen, mainClassName: 'active-wallet-information__network-picker', buttonClassName: 'active-wallet-information__network-picker-button', evmNetworks: evmNetworks, showNetworkName: true })] })] }), testnet && (jsx(Alert, { variant: 'warning', children: t('dyn_active_wallet_info.testnet_warning') }))] }), jsxs("div", { className: 'balance-container', children: [jsx(Typography, { color: 'secondary', variant: 'body_small', children: "Balance" }), primaryWallet && (jsx(Balance, { className: 'balance-container__balance', connector: primaryWallet.connector, address: primaryWallet.address, network: network }))] })] }));
|
|
107
107
|
};
|
|
@@ -67,7 +67,7 @@ const DynamicUserProfile = ({ variant, }) => {
|
|
|
67
67
|
}, [variant]);
|
|
68
68
|
if (!projectSettings)
|
|
69
69
|
return null;
|
|
70
|
-
return (jsxRuntime.jsx(IsBrowser.IsBrowser, { children: jsxRuntime.jsx(PopperContext.PopperProvider, { children: jsxRuntime.jsx(DynamicWidgetVariants.DynamicWidgetVariants, { isOpen: isOpen, setIsOpen: setIsOpen, variant: _variant, zIndex: index.widgetModalZIndex, children: jsxRuntime.jsx(DynamicWidgetCard.DynamicWidgetCard, { ref: widgetRef, children: jsxRuntime.jsx(DynamicUserProfileLayout.DynamicUserProfileLayout, { variant: variant }) }) }) }) }));
|
|
70
|
+
return (jsxRuntime.jsx(IsBrowser.IsBrowser, { children: jsxRuntime.jsx(PopperContext.PopperProvider, { children: jsxRuntime.jsx(DynamicWidgetVariants.DynamicWidgetVariants, { isOpen: isOpen, setIsOpen: setIsOpen, variant: _variant, zIndex: index.widgetModalZIndex, children: jsxRuntime.jsx(DynamicWidgetCard.DynamicWidgetCard, { ref: widgetRef, children: jsxRuntime.jsx(DynamicUserProfileLayout.DynamicUserProfileLayout, { className: 'modal-user-profile', variant: variant }) }) }) }) }));
|
|
71
71
|
};
|
|
72
72
|
const ShadowedDynamicUserProfile = () => (jsxRuntime.jsx(ShadowDOM.ShadowDOM, { zIndex: index.widgetModalZIndex, children: jsxRuntime.jsx(DynamicUserProfile, {}) }));
|
|
73
73
|
|
|
@@ -63,7 +63,7 @@ const DynamicUserProfile = ({ variant, }) => {
|
|
|
63
63
|
}, [variant]);
|
|
64
64
|
if (!projectSettings)
|
|
65
65
|
return null;
|
|
66
|
-
return (jsx(IsBrowser, { children: jsx(PopperProvider, { children: jsx(DynamicWidgetVariants, { isOpen: isOpen, setIsOpen: setIsOpen, variant: _variant, zIndex: widgetModalZIndex, children: jsx(DynamicWidgetCard, { ref: widgetRef, children: jsx(DynamicUserProfileLayout, { variant: variant }) }) }) }) }));
|
|
66
|
+
return (jsx(IsBrowser, { children: jsx(PopperProvider, { children: jsx(DynamicWidgetVariants, { isOpen: isOpen, setIsOpen: setIsOpen, variant: _variant, zIndex: widgetModalZIndex, children: jsx(DynamicWidgetCard, { ref: widgetRef, children: jsx(DynamicUserProfileLayout, { className: 'modal-user-profile', variant: variant }) }) }) }) }));
|
|
67
67
|
};
|
|
68
68
|
const ShadowedDynamicUserProfile = () => (jsx(ShadowDOM, { zIndex: widgetModalZIndex, children: jsx(DynamicUserProfile, {}) }));
|
|
69
69
|
|
|
@@ -99,7 +99,7 @@ const DynamicWidgetWalletHeader = ({ variant, }) => {
|
|
|
99
99
|
return shortenEmail.shortenEmail(user === null || user === void 0 ? void 0 : user.email);
|
|
100
100
|
};
|
|
101
101
|
const isActionsVisible = isSendBalanceEnabled || fundingEnabled;
|
|
102
|
-
return (jsxRuntime.jsxs("div", { className: 'dynamic-widget-wallet-header', "data-testid": 'dynamic-widget-wallet-header', children: [primaryWallet ? (jsxRuntime.
|
|
102
|
+
return (jsxRuntime.jsxs("div", { className: 'dynamic-widget-wallet-header', "data-testid": 'dynamic-widget-wallet-header', children: [primaryWallet ? (jsxRuntime.jsx(ActiveWalletInformation.ActiveWalletInformation, {})) : (jsxRuntime.jsx("div", { className: 'dynamic-widget-wallet-header__icon-container', children: jsxRuntime.jsx(UserAvatar.UserAvatar, { user: user }) })), primaryWallet ? (jsxRuntime.jsx("div", { "data-testid": 'primaryWalletStatus', className: 'dynamic-widget-wallet-header__wallet-info', children: isActionsVisible && (jsxRuntime.jsxs("div", { className: 'dynamic-widget-wallet-header__wallet-actions', children: [fundingEnabled && (jsxRuntime.jsx(Button.Button, { expanded: true, dataTestId: 'buy-crypto-button', buttonPadding: 'small', buttonVariant: 'primary', onClick: () => setShowFunding(true), disabled: !supportsFunding, startSlot:
|
|
103
103
|
// eslint-disable-next-line react/jsx-wrap-multilines
|
|
104
104
|
jsxRuntime.jsx(Icon.Icon, { size: 'small', color: 'text-secondary', children: jsxRuntime.jsx(add.ReactComponent, {}) }), children: "Buy" })), isSendBalanceEnabled && (jsxRuntime.jsx(Button.Button, { expanded: true, dataTestId: 'send-balance-button', buttonPadding: 'small', buttonVariant: 'primary', onClick: handleOnClickSend, startSlot:
|
|
105
105
|
// eslint-disable-next-line react/jsx-wrap-multilines
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { jsxs,
|
|
1
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
2
|
import React__default, { useMemo } from 'react';
|
|
3
3
|
import { isEmbeddedConnector } from '@dynamic-labs/wallet-connector-core';
|
|
4
4
|
import { Typography } from '../../../../../components/Typography/Typography.js';
|
|
@@ -91,7 +91,7 @@ const DynamicWidgetWalletHeader = ({ variant, }) => {
|
|
|
91
91
|
return shortenEmail(user === null || user === void 0 ? void 0 : user.email);
|
|
92
92
|
};
|
|
93
93
|
const isActionsVisible = isSendBalanceEnabled || fundingEnabled;
|
|
94
|
-
return (jsxs("div", { className: 'dynamic-widget-wallet-header', "data-testid": 'dynamic-widget-wallet-header', children: [primaryWallet ? (
|
|
94
|
+
return (jsxs("div", { className: 'dynamic-widget-wallet-header', "data-testid": 'dynamic-widget-wallet-header', children: [primaryWallet ? (jsx(ActiveWalletInformation, {})) : (jsx("div", { className: 'dynamic-widget-wallet-header__icon-container', children: jsx(UserAvatar, { user: user }) })), primaryWallet ? (jsx("div", { "data-testid": 'primaryWalletStatus', className: 'dynamic-widget-wallet-header__wallet-info', children: isActionsVisible && (jsxs("div", { className: 'dynamic-widget-wallet-header__wallet-actions', children: [fundingEnabled && (jsx(Button, { expanded: true, dataTestId: 'buy-crypto-button', buttonPadding: 'small', buttonVariant: 'primary', onClick: () => setShowFunding(true), disabled: !supportsFunding, startSlot:
|
|
95
95
|
// eslint-disable-next-line react/jsx-wrap-multilines
|
|
96
96
|
jsx(Icon, { size: 'small', color: 'text-secondary', children: jsx(SvgAdd, {}) }), children: "Buy" })), isSendBalanceEnabled && (jsx(Button, { expanded: true, dataTestId: 'send-balance-button', buttonPadding: 'small', buttonVariant: 'primary', onClick: handleOnClickSend, startSlot:
|
|
97
97
|
// eslint-disable-next-line react/jsx-wrap-multilines
|
package/src/lib/widgets/DynamicWidget/components/DynamicWidgetWallets/DynamicWidgetWallets.cjs
CHANGED
|
@@ -66,11 +66,11 @@ const DynamicWidgetWallets = () => {
|
|
|
66
66
|
const { secondaryWallets, user, authMode } = useInternalDynamicContext.useInternalDynamicContext();
|
|
67
67
|
const { availableWalletsContainerRef } = DynamicWidgetContext.useWidgetContext();
|
|
68
68
|
const isEmpty = secondaryWallets.length === 0;
|
|
69
|
-
return (jsxRuntime.jsxs("div", { ref: availableWalletsContainerRef, className: 'dynamic-widget-wallets', "data-testid": 'dynamicWidgetWallets', children: [jsxRuntime.jsx(Typography.Typography, { weight: 'medium', variant: 'body_small', color: 'secondary', className: 'dynamic-widget-wallets__title', children: t('dyn_widget.other_wallets') }), jsxRuntime.jsx("div", { className: classNames.classNames('
|
|
69
|
+
return (jsxRuntime.jsxs("div", { ref: availableWalletsContainerRef, className: 'dynamic-widget-wallets', "data-testid": 'dynamicWidgetWallets', children: [jsxRuntime.jsx(Typography.Typography, { weight: 'medium', variant: 'body_small', color: 'secondary', className: 'dynamic-widget-wallets__title', children: t('dyn_widget.other_wallets') }), jsxRuntime.jsx("div", { className: classNames.classNames('dynamic-widget-wallets__body', {
|
|
70
70
|
'dynamic-widget-wallets__body--apply-height': !isEmpty,
|
|
71
71
|
}), children: isEmpty ? (jsxRuntime.jsx(EmptyWallets.EmptyWallets, { text: t('dyn_widget.empty_wallets', {
|
|
72
72
|
action: authMode === 'connect-and-sign' ? 'Link' : 'Connect',
|
|
73
|
-
}) })) : (jsxRuntime.jsx("div", { className: '
|
|
73
|
+
}) })) : (jsxRuntime.jsx("div", { className: 'dynamic-widget-wallets__body__wallet-list', children: secondaryWallets.map((wallet, index) => {
|
|
74
74
|
var _a;
|
|
75
75
|
return (jsxRuntime.jsx(Wallet.Wallet, { ens: (_a = getWalletVerifiedCredential.getWalletVerifiedCredential(wallet.address, user === null || user === void 0 ? void 0 : user.verifiedCredentials, wallet.chain)) === null || _a === void 0 ? void 0 : _a.nameService, wallet: wallet }, wallet.id));
|
|
76
76
|
}) })) })] }));
|
package/src/lib/widgets/DynamicWidget/components/DynamicWidgetWallets/DynamicWidgetWallets.js
CHANGED
|
@@ -62,11 +62,11 @@ const DynamicWidgetWallets = () => {
|
|
|
62
62
|
const { secondaryWallets, user, authMode } = useInternalDynamicContext();
|
|
63
63
|
const { availableWalletsContainerRef } = useWidgetContext();
|
|
64
64
|
const isEmpty = secondaryWallets.length === 0;
|
|
65
|
-
return (jsxs("div", { ref: availableWalletsContainerRef, className: 'dynamic-widget-wallets', "data-testid": 'dynamicWidgetWallets', children: [jsx(Typography, { weight: 'medium', variant: 'body_small', color: 'secondary', className: 'dynamic-widget-wallets__title', children: t('dyn_widget.other_wallets') }), jsx("div", { className: classNames('
|
|
65
|
+
return (jsxs("div", { ref: availableWalletsContainerRef, className: 'dynamic-widget-wallets', "data-testid": 'dynamicWidgetWallets', children: [jsx(Typography, { weight: 'medium', variant: 'body_small', color: 'secondary', className: 'dynamic-widget-wallets__title', children: t('dyn_widget.other_wallets') }), jsx("div", { className: classNames('dynamic-widget-wallets__body', {
|
|
66
66
|
'dynamic-widget-wallets__body--apply-height': !isEmpty,
|
|
67
67
|
}), children: isEmpty ? (jsx(EmptyWallets, { text: t('dyn_widget.empty_wallets', {
|
|
68
68
|
action: authMode === 'connect-and-sign' ? 'Link' : 'Connect',
|
|
69
|
-
}) })) : (jsx("div", { className: '
|
|
69
|
+
}) })) : (jsx("div", { className: 'dynamic-widget-wallets__body__wallet-list', children: secondaryWallets.map((wallet, index) => {
|
|
70
70
|
var _a;
|
|
71
71
|
return (jsx(Wallet, { ens: (_a = getWalletVerifiedCredential(wallet.address, user === null || user === void 0 ? void 0 : user.verifiedCredentials, wallet.chain)) === null || _a === void 0 ? void 0 : _a.nameService, wallet: wallet }, wallet.id));
|
|
72
72
|
}) })) })] }));
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './sortAccountsByPrimaryWallet';
|
package/src/lib/utils/hooks/useWalletEventListeners/utils/sortAccountsByPrimaryWallet/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { sortAccountsByPrimaryWallet } from './sortAccountsByPrimaryWallet';
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
|
-
var walletConnectorCore = require('@dynamic-labs/wallet-connector-core');
|
|
6
|
-
|
|
7
|
-
const sortAccountsByPrimaryWallet = (accounts, primaryWallet) => [...accounts].sort((account) => walletConnectorCore.isSameAddress(account, primaryWallet.address, primaryWallet.chain) ? -1 : 1);
|
|
8
|
-
|
|
9
|
-
exports.sortAccountsByPrimaryWallet = sortAccountsByPrimaryWallet;
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import { isSameAddress } from '@dynamic-labs/wallet-connector-core';
|
|
2
|
-
|
|
3
|
-
const sortAccountsByPrimaryWallet = (accounts, primaryWallet) => [...accounts].sort((account) => isSameAddress(account, primaryWallet.address, primaryWallet.chain) ? -1 : 1);
|
|
4
|
-
|
|
5
|
-
export { sortAccountsByPrimaryWallet };
|