@dynamic-labs/sdk-react-core 0.19.0-alpha.7 → 0.19.0-alpha.8
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 +24 -0
- package/package.cjs +3 -3
- package/package.js +3 -3
- package/package.json +10 -10
- package/src/index.d.ts +1 -1
- package/src/lib/Main.cjs +1 -0
- package/src/lib/Main.js +1 -0
- package/src/lib/components/AuthProviderIcon/AuthProviderIcon.cjs +2 -2
- package/src/lib/components/AuthProviderIcon/AuthProviderIcon.js +2 -2
- package/src/lib/components/IconWithStatus/IconWithStatus.cjs +3 -3
- package/src/lib/components/IconWithStatus/IconWithStatus.d.ts +2 -2
- package/src/lib/components/IconWithStatus/IconWithStatus.js +3 -3
- package/src/lib/components/MockedQrCode/MockedQrCode.cjs +1 -1
- package/src/lib/components/MockedQrCode/MockedQrCode.js +1 -1
- package/src/lib/components/SendBalancePageLayout/SendBalancePageLayout.cjs +2 -2
- package/src/lib/components/SendBalancePageLayout/SendBalancePageLayout.d.ts +1 -1
- package/src/lib/components/SendBalancePageLayout/SendBalancePageLayout.js +2 -2
- package/src/lib/components/SocialSignIn/SocialSignIn.cjs +26 -14
- package/src/lib/components/SocialSignIn/SocialSignIn.d.ts +8 -7
- package/src/lib/components/SocialSignIn/SocialSignIn.js +26 -14
- package/src/lib/components/TransactionOriginDestination/TransactionOriginDestination.d.ts +1 -1
- package/src/lib/components/UserProfile/UserProfile.cjs +4 -1
- package/src/lib/components/UserProfile/UserProfile.js +4 -1
- package/src/lib/components/UserProfile/parts/UserProfileSocialAccount/UserProfileSocialAccount.cjs +15 -13
- package/src/lib/components/UserProfile/parts/UserProfileSocialAccount/UserProfileSocialAccount.js +15 -13
- package/src/lib/context/DynamicContext/helpers.cjs +22 -10
- package/src/lib/context/DynamicContext/helpers.d.ts +4 -2
- package/src/lib/context/DynamicContext/helpers.js +20 -10
- package/src/lib/context/ErrorContext/ErrorContext.cjs +4 -1
- package/src/lib/context/ErrorContext/ErrorContext.js +4 -1
- package/src/lib/context/SocialRedirectContext/SocialRedirectContext.cjs +7 -4
- package/src/lib/context/SocialRedirectContext/SocialRedirectContext.d.ts +5 -5
- package/src/lib/context/SocialRedirectContext/SocialRedirectContext.js +7 -4
- package/src/lib/data/api.cjs +48 -16
- package/src/lib/data/api.d.ts +1 -0
- package/src/lib/data/api.js +50 -19
- package/src/lib/layout/DynamicAuthLayout/HelpContent/WalletListHelpContent/WalletListHelpContent.cjs +1 -1
- package/src/lib/layout/DynamicAuthLayout/HelpContent/WalletListHelpContent/WalletListHelpContent.js +1 -1
- package/src/lib/locale/en/translation.cjs +2 -4
- package/src/lib/locale/en/translation.js +2 -4
- package/src/lib/shared/types/index.d.ts +4 -0
- package/src/lib/shared/utils/functions/wallet/createWallet.cjs +1 -1
- package/src/lib/shared/utils/functions/wallet/createWallet.js +1 -1
- package/src/lib/styles/index.shadow.cjs +1 -1
- package/src/lib/styles/index.shadow.js +1 -1
- package/src/lib/utils/constants/localStorage.cjs +4 -2
- package/src/lib/utils/constants/localStorage.d.ts +2 -1
- package/src/lib/utils/constants/localStorage.js +3 -2
- package/src/lib/utils/functions/getActiveOauthCredential/getActiveOauthCredential.cjs +11 -0
- package/src/lib/utils/functions/getActiveOauthCredential/getActiveOauthCredential.d.ts +2 -0
- package/src/lib/utils/functions/getActiveOauthCredential/getActiveOauthCredential.js +7 -0
- package/src/lib/utils/functions/getActiveOauthCredential/index.d.ts +1 -0
- package/src/lib/utils/functions/getEnabledSocialSignInProvidersAsProviderEnum/getEnabledSocialSignInProvidersAsProviderEnum.d.ts +2 -0
- package/src/lib/utils/functions/getEnabledSocialSignInProvidersAsProviderEnum/index.d.ts +1 -0
- package/src/lib/utils/functions/getProviderEnumForSocialSignInProvider/getProviderEnumForSocialSignInProvider.cjs +19 -0
- package/src/lib/utils/functions/getProviderEnumForSocialSignInProvider/getProviderEnumForSocialSignInProvider.d.ts +2 -0
- package/src/lib/utils/functions/getProviderEnumForSocialSignInProvider/getProviderEnumForSocialSignInProvider.js +15 -0
- package/src/lib/utils/functions/getProviderEnumForSocialSignInProvider/index.d.ts +1 -0
- package/src/lib/utils/functions/getSocialSignInProviderForProviderEnum/getSocialSignInProviderForProviderEnum.cjs +19 -0
- package/src/lib/utils/functions/getSocialSignInProviderForProviderEnum/getSocialSignInProviderForProviderEnum.d.ts +2 -0
- package/src/lib/utils/functions/getSocialSignInProviderForProviderEnum/getSocialSignInProviderForProviderEnum.js +15 -0
- package/src/lib/utils/functions/getSocialSignInProviderForProviderEnum/index.d.ts +1 -0
- package/src/lib/utils/functions/getSocialSignInProviderFromString/getSocialSignInProviderFromString.cjs +19 -0
- package/src/lib/utils/functions/getSocialSignInProviderFromString/getSocialSignInProviderFromString.d.ts +2 -0
- package/src/lib/utils/functions/getSocialSignInProviderFromString/getSocialSignInProviderFromString.js +15 -0
- package/src/lib/utils/functions/getSocialSignInProviderFromString/index.d.ts +1 -0
- package/src/lib/utils/functions/index.d.ts +5 -0
- package/src/lib/utils/hooks/useAuthLayoutChecks/useAuthLayoutChecks.cjs +2 -1
- package/src/lib/utils/hooks/useAuthLayoutChecks/useAuthLayoutChecks.js +2 -1
- package/src/lib/utils/hooks/useConnectWallet/useConnectWallet.cjs +3 -3
- package/src/lib/utils/hooks/useConnectWallet/useConnectWallet.js +4 -4
- package/src/lib/utils/hooks/useFetchProjectSettings/useFetchProjectSettings.cjs +10 -1
- package/src/lib/utils/hooks/useFetchProjectSettings/useFetchProjectSettings.js +10 -1
- package/src/lib/utils/hooks/useSocialAccounts/useSocialAccounts.cjs +10 -164
- package/src/lib/utils/hooks/useSocialAccounts/useSocialAccounts.d.ts +2 -2
- package/src/lib/utils/hooks/useSocialAccounts/useSocialAccounts.js +12 -166
- package/src/lib/utils/hooks/useSocialAuth/index.d.ts +1 -0
- package/src/lib/utils/hooks/useSocialAuth/useSocialAuth.cjs +278 -0
- package/src/lib/utils/hooks/useSocialAuth/useSocialAuth.d.ts +20 -0
- package/src/lib/utils/hooks/useSocialAuth/useSocialAuth.js +274 -0
- package/src/lib/utils/hooks/useVerifyWallet/useVerifyWallet.cjs +13 -3
- package/src/lib/utils/hooks/useVerifyWallet/useVerifyWallet.js +13 -3
- package/src/lib/views/AccountExistsView/AccountExistsView.cjs +4 -2
- package/src/lib/views/AccountExistsView/AccountExistsView.js +4 -2
- package/src/lib/views/BridgeSummaryView/BridgeSummaryView.cjs +1 -1
- package/src/lib/views/BridgeSummaryView/BridgeSummaryView.js +1 -1
- package/src/lib/views/LoginView/LoginView.cjs +1 -1
- package/src/lib/views/LoginView/LoginView.js +1 -1
- package/src/lib/views/LoginView/sections/LoginWidget.d.ts +5 -0
- package/src/lib/views/LoginView/sections/SocialSignInSection/DynamicSocialSignIn/DynamicSocialSignIn.cjs +77 -0
- package/src/lib/views/LoginView/sections/SocialSignInSection/DynamicSocialSignIn/DynamicSocialSignIn.d.ts +3 -0
- package/src/lib/views/LoginView/sections/SocialSignInSection/DynamicSocialSignIn/DynamicSocialSignIn.js +73 -0
- package/src/lib/views/LoginView/sections/SocialSignInSection/DynamicSocialSignIn/index.d.ts +1 -0
- package/src/lib/views/LoginView/sections/SocialSignInSection/MagicSocialSignIn/MagicSocialSignIn.cjs +3 -2
- package/src/lib/views/LoginView/sections/SocialSignInSection/MagicSocialSignIn/MagicSocialSignIn.d.ts +2 -1
- package/src/lib/views/LoginView/sections/SocialSignInSection/MagicSocialSignIn/MagicSocialSignIn.js +3 -2
- package/src/lib/views/LoginView/sections/SocialSignInSection/SocialSignInSection.cjs +18 -4
- package/src/lib/views/LoginView/sections/SocialSignInSection/SocialSignInSection.d.ts +6 -1
- package/src/lib/views/LoginView/sections/SocialSignInSection/SocialSignInSection.js +18 -4
- package/src/lib/views/LoginView/sections/WalletSignInSection/WalletSignInSection.cjs +3 -2
- package/src/lib/views/LoginView/sections/WalletSignInSection/WalletSignInSection.js +3 -2
- package/src/lib/views/LoginView/useLoginView.cjs +9 -10
- package/src/lib/views/LoginView/useLoginView.js +9 -10
- package/src/lib/views/MergeUserAccountsView/MergeUserAccountsView.cjs +1 -1
- package/src/lib/views/MergeUserAccountsView/MergeUserAccountsView.js +1 -1
- package/src/lib/views/NetworkNotSupported/NetworkNotSupported.cjs +1 -1
- package/src/lib/views/NetworkNotSupported/NetworkNotSupported.js +1 -1
- package/src/lib/views/NetworkNotSupportedSwitchManual/NetworkNotSupportedSwitchManual.cjs +1 -1
- package/src/lib/views/NetworkNotSupportedSwitchManual/NetworkNotSupportedSwitchManual.js +1 -1
- package/src/lib/views/NoQrNotInstalledView/NoQrNotInstalledView.cjs +2 -2
- package/src/lib/views/NoQrNotInstalledView/NoQrNotInstalledView.js +2 -2
- package/src/lib/views/PendingConnectView/PendingConnectView.cjs +1 -1
- package/src/lib/views/PendingConnectView/PendingConnectView.js +1 -1
- package/src/lib/views/PendingSignatureView/PendingSignatureView.cjs +1 -1
- package/src/lib/views/PendingSignatureView/PendingSignatureView.js +1 -1
- package/src/lib/views/QrCodeView/QRCode.cjs +3 -3
- package/src/lib/views/QrCodeView/QRCode.d.ts +2 -2
- package/src/lib/views/QrCodeView/QRCode.js +3 -3
- package/src/lib/views/QrCodeView/QrCodeContainer/QrCodeContainer.cjs +2 -2
- package/src/lib/views/QrCodeView/QrCodeContainer/QrCodeContainer.d.ts +2 -1
- package/src/lib/views/QrCodeView/QrCodeContainer/QrCodeContainer.js +2 -2
- package/src/lib/views/QrCodeView/QrCodeView.cjs +2 -2
- package/src/lib/views/QrCodeView/QrCodeView.js +2 -2
- package/src/lib/views/SendBalanceView/SendBalanceView.cjs +1 -1
- package/src/lib/views/SendBalanceView/SendBalanceView.js +1 -1
- package/src/lib/views/SocialRedirectView/SocialRedirectView.cjs +4 -6
- package/src/lib/views/SocialRedirectView/SocialRedirectView.d.ts +1 -1
- package/src/lib/views/SocialRedirectView/SocialRedirectView.js +4 -6
- package/src/lib/views/WalletCannotBeTransferredView/WalletCannotBeTransferredView.cjs +1 -1
- package/src/lib/views/WalletCannotBeTransferredView/WalletCannotBeTransferredView.js +1 -1
- package/src/lib/views/WalletGroupView/WalletGroupView.cjs +1 -1
- package/src/lib/views/WalletGroupView/WalletGroupView.js +1 -1
- package/src/lib/views/WalletList/WalletListItem/WalletListItem.cjs +2 -2
- package/src/lib/views/WalletList/WalletListItem/WalletListItem.js +2 -2
- package/src/lib/views/WalletLockedView/WalletLockedView.cjs +1 -1
- package/src/lib/views/WalletLockedView/WalletLockedView.js +1 -1
- package/src/lib/views/WalletSignSpinnerView/WalletSignSpinnerView.cjs +2 -2
- package/src/lib/views/WalletSignSpinnerView/WalletSignSpinnerView.js +2 -2
- package/src/lib/views/WalletUsedView/WalletUsedView.cjs +1 -1
- package/src/lib/views/WalletUsedView/WalletUsedView.js +1 -1
- package/src/lib/widgets/DynamicBridgeWidget/components/DynamicBridgeWalletCardBody/DynamicBridgeWalletCardBody.cjs +2 -2
- package/src/lib/widgets/DynamicBridgeWidget/components/DynamicBridgeWalletCardBody/DynamicBridgeWalletCardBody.d.ts +1 -1
- package/src/lib/widgets/DynamicBridgeWidget/components/DynamicBridgeWalletCardBody/DynamicBridgeWalletCardBody.js +2 -2
- package/src/lib/widgets/DynamicBridgeWidget/views/WalletsView/WalletsView.cjs +1 -1
- package/src/lib/widgets/DynamicBridgeWidget/views/WalletsView/WalletsView.js +1 -1
- package/src/lib/widgets/DynamicBridgeWidget/views/WalletsView/components/SecondaryWallets/SecondaryWallets.cjs +1 -1
- package/src/lib/widgets/DynamicBridgeWidget/views/WalletsView/components/SecondaryWallets/SecondaryWallets.js +1 -1
- package/src/lib/widgets/DynamicWidget/components/AccountControl/AccountControl.cjs +18 -3
- package/src/lib/widgets/DynamicWidget/components/AccountControl/AccountControl.js +18 -3
- package/src/lib/widgets/DynamicWidget/components/DynamicWidgetHeader/DynamicWidgetWalletHeader/DynamicWidgetWalletHeader.cjs +9 -1
- package/src/lib/widgets/DynamicWidget/components/DynamicWidgetHeader/DynamicWidgetWalletHeader/DynamicWidgetWalletHeader.d.ts +1 -1
- package/src/lib/widgets/DynamicWidget/components/DynamicWidgetHeader/DynamicWidgetWalletHeader/DynamicWidgetWalletHeader.js +9 -1
- package/src/lib/widgets/DynamicWidget/components/WalletIconWithStatus/WalletIconWithStatus.cjs +2 -2
- package/src/lib/widgets/DynamicWidget/components/WalletIconWithStatus/WalletIconWithStatus.d.ts +2 -2
- package/src/lib/widgets/DynamicWidget/components/WalletIconWithStatus/WalletIconWithStatus.js +2 -2
- package/src/lib/widgets/DynamicWidget/prompts/NoQrNotInstalledModalView/NoQrNotInstalledModalView.cjs +3 -3
- package/src/lib/widgets/DynamicWidget/prompts/NoQrNotInstalledModalView/NoQrNotInstalledModalView.js +3 -3
- package/src/lib/widgets/DynamicWidget/prompts/PendingAccountSwitchModal/PendingAccountSwitchModal.cjs +1 -1
- package/src/lib/widgets/DynamicWidget/prompts/PendingAccountSwitchModal/PendingAccountSwitchModal.js +1 -1
- package/src/lib/widgets/DynamicWidget/prompts/PendingAccountSwitchModal/SwitchOrUseActiveAccountView/SwitchOrUseActiveAccountView.cjs +1 -1
- package/src/lib/widgets/DynamicWidget/prompts/PendingAccountSwitchModal/SwitchOrUseActiveAccountView/SwitchOrUseActiveAccountView.js +1 -1
- package/src/lib/widgets/DynamicWidget/prompts/PendingAccountSwitchToLinkModal/PendingAccountSwitchToLinkModal.cjs +1 -1
- package/src/lib/widgets/DynamicWidget/prompts/PendingAccountSwitchToLinkModal/PendingAccountSwitchToLinkModal.js +1 -1
- package/src/lib/widgets/DynamicWidget/prompts/PendingSignModal/DefaultPendingSignModalContent/DefaultPendingSignModalContent.cjs +1 -1
- package/src/lib/widgets/DynamicWidget/prompts/PendingSignModal/DefaultPendingSignModalContent/DefaultPendingSignModalContent.js +1 -1
- package/src/lib/widgets/DynamicWidget/prompts/PrimaryNotConnectedModal/PrimaryNotConnectedModal.cjs +1 -1
- package/src/lib/widgets/DynamicWidget/prompts/PrimaryNotConnectedModal/PrimaryNotConnectedModal.js +1 -1
- package/src/lib/widgets/DynamicWidget/prompts/QrCodeModalView/QrCodeModalView.cjs +6 -5
- package/src/lib/widgets/DynamicWidget/prompts/QrCodeModalView/QrCodeModalView.js +6 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,4 +1,28 @@
|
|
|
1
1
|
|
|
2
|
+
## [0.19.0-alpha.8](https://github.com/dynamic-labs/DynamicAuth/compare/v0.19.0-alpha.7...v0.19.0-alpha.8) (2023-09-11)
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
### Features
|
|
6
|
+
|
|
7
|
+
* add onSignedMessage callback ([#3118](https://github.com/dynamic-labs/DynamicAuth/issues/3118)) ([acc36f6](https://github.com/dynamic-labs/DynamicAuth/commit/acc36f6cf584eb05a019027475a6e2e413fd6bd5))
|
|
8
|
+
* add social sign-in without embedded wallet ([#3172](https://github.com/dynamic-labs/DynamicAuth/issues/3172)) ([ff1acc6](https://github.com/dynamic-labs/DynamicAuth/commit/ff1acc6d9753ba745ac01c5ef6d26f2e4291b752))
|
|
9
|
+
* show default wallet icon when image breaks ([#3234](https://github.com/dynamic-labs/DynamicAuth/issues/3234)) ([657e6bb](https://github.com/dynamic-labs/DynamicAuth/commit/657e6bbc1cdcd840562d25194a827ea833237c1a))
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
### Bug Fixes
|
|
13
|
+
|
|
14
|
+
* catch error sending sdkSettings and log warning ([#3274](https://github.com/dynamic-labs/DynamicAuth/issues/3274)) ([fcbe01b](https://github.com/dynamic-labs/DynamicAuth/commit/fcbe01bc733a73f38aebd6ffb0969b040dd2f781))
|
|
15
|
+
* detect if oauth popup is blocked and throw error ([#3250](https://github.com/dynamic-labs/DynamicAuth/issues/3250)) ([b87ddf3](https://github.com/dynamic-labs/DynamicAuth/commit/b87ddf399104e29c56566abbbecab6ff947992d6))
|
|
16
|
+
* display error message to user if social account already exits ([#3258](https://github.com/dynamic-labs/DynamicAuth/issues/3258)) ([bb52cb4](https://github.com/dynamic-labs/DynamicAuth/commit/bb52cb4ae42d89310d435584ed4ece126f9b6a4a))
|
|
17
|
+
* don't call callbacks if window closed due to oauth process complete ([#3252](https://github.com/dynamic-labs/DynamicAuth/issues/3252)) ([09a3c73](https://github.com/dynamic-labs/DynamicAuth/commit/09a3c73446aa337f24e0875cd4a0af617ea8ca84))
|
|
18
|
+
* issue where unexpected token would occur when bundlers defined process.env ([#3283](https://github.com/dynamic-labs/DynamicAuth/issues/3283)) ([d31d0a4](https://github.com/dynamic-labs/DynamicAuth/commit/d31d0a4011256f59cb3760acdc2c3dfe6c5b504a))
|
|
19
|
+
* login view layout updates ([#3231](https://github.com/dynamic-labs/DynamicAuth/issues/3231)) ([7762d06](https://github.com/dynamic-labs/DynamicAuth/commit/7762d067bdd4b3f313a15308262f18dac0b961ab))
|
|
20
|
+
* **MagicWalletConnector:** remove async from getWeb3Provider method ([#3230](https://github.com/dynamic-labs/DynamicAuth/issues/3230)) ([69356e9](https://github.com/dynamic-labs/DynamicAuth/commit/69356e9b0bd1800acdf24fc96c72b094b595eaa7))
|
|
21
|
+
* remove react component props from sending to sdk api ([#3282](https://github.com/dynamic-labs/DynamicAuth/issues/3282)) ([b0d8f2b](https://github.com/dynamic-labs/DynamicAuth/commit/b0d8f2b9dd0856a5a7bd862f6c3499b65ec29f64))
|
|
22
|
+
* seprate ls checks for dynamiccontext and wagmi settings ([#3275](https://github.com/dynamic-labs/DynamicAuth/issues/3275)) ([aa4e756](https://github.com/dynamic-labs/DynamicAuth/commit/aa4e756a10310ce216b5942d0d6845f7092a89a2))
|
|
23
|
+
* use context to handle social sign-in and display message while processing ([#3216](https://github.com/dynamic-labs/DynamicAuth/issues/3216)) ([0e3ce73](https://github.com/dynamic-labs/DynamicAuth/commit/0e3ce73eafbb8d5725377c9a8cbd86a82d6c525f))
|
|
24
|
+
* **wallet-connect-v2:** use appropriate default chain id with WC v2 ([#3218](https://github.com/dynamic-labs/DynamicAuth/issues/3218)) ([2e6e7be](https://github.com/dynamic-labs/DynamicAuth/commit/2e6e7beb801ea5a8dc7429970bcd1e705610d605))
|
|
25
|
+
|
|
2
26
|
## [0.19.0-alpha.7](https://github.com/dynamic-labs/DynamicAuth/compare/v0.19.0-alpha.6...v0.19.0-alpha.7) (2023-08-31)
|
|
3
27
|
|
|
4
28
|
|
package/package.cjs
CHANGED
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var version = "0.19.0-alpha.
|
|
5
|
+
var version = "0.19.0-alpha.8";
|
|
6
6
|
var dependencies = {
|
|
7
|
-
"@dynamic-labs/iconic": "0.1.
|
|
8
|
-
"@dynamic-labs/sdk-api": "0.0.
|
|
7
|
+
"@dynamic-labs/iconic": "0.1.30",
|
|
8
|
+
"@dynamic-labs/sdk-api": "0.0.272",
|
|
9
9
|
"@hcaptcha/react-hcaptcha": "1.4.4",
|
|
10
10
|
"country-list": "2.3.0",
|
|
11
11
|
ethers: "5.7.2",
|
package/package.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
var version = "0.19.0-alpha.
|
|
1
|
+
var version = "0.19.0-alpha.8";
|
|
2
2
|
var dependencies = {
|
|
3
|
-
"@dynamic-labs/iconic": "0.1.
|
|
4
|
-
"@dynamic-labs/sdk-api": "0.0.
|
|
3
|
+
"@dynamic-labs/iconic": "0.1.30",
|
|
4
|
+
"@dynamic-labs/sdk-api": "0.0.272",
|
|
5
5
|
"@hcaptcha/react-hcaptcha": "1.4.4",
|
|
6
6
|
"country-list": "2.3.0",
|
|
7
7
|
ethers: "5.7.2",
|
package/package.json
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dynamic-labs/sdk-react-core",
|
|
3
|
-
"version": "0.19.0-alpha.
|
|
3
|
+
"version": "0.19.0-alpha.8",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "https://github.com/dynamic-labs/DynamicAuth.git",
|
|
7
7
|
"directory": "packages/sdk-react-core"
|
|
8
8
|
},
|
|
9
9
|
"dependencies": {
|
|
10
|
-
"@dynamic-labs/iconic": "0.1.
|
|
11
|
-
"@dynamic-labs/sdk-api": "0.0.
|
|
10
|
+
"@dynamic-labs/iconic": "0.1.30",
|
|
11
|
+
"@dynamic-labs/sdk-api": "0.0.272",
|
|
12
12
|
"@hcaptcha/react-hcaptcha": "1.4.4",
|
|
13
13
|
"country-list": "2.3.0",
|
|
14
14
|
"ethers": "5.7.2",
|
|
@@ -18,13 +18,13 @@
|
|
|
18
18
|
"react-focus-lock": "2.9.2",
|
|
19
19
|
"react-i18next": "^13.2.0",
|
|
20
20
|
"yup": "0.32.11",
|
|
21
|
-
"@dynamic-labs/logger": "0.19.0-alpha.
|
|
22
|
-
"@dynamic-labs/multi-wallet": "0.19.0-alpha.
|
|
23
|
-
"@dynamic-labs/rpc-providers": "0.19.0-alpha.
|
|
24
|
-
"@dynamic-labs/types": "0.19.0-alpha.
|
|
25
|
-
"@dynamic-labs/utils": "0.19.0-alpha.
|
|
26
|
-
"@dynamic-labs/wallet-book": "0.19.0-alpha.
|
|
27
|
-
"@dynamic-labs/wallet-connector-core": "0.19.0-alpha.
|
|
21
|
+
"@dynamic-labs/logger": "0.19.0-alpha.8",
|
|
22
|
+
"@dynamic-labs/multi-wallet": "0.19.0-alpha.8",
|
|
23
|
+
"@dynamic-labs/rpc-providers": "0.19.0-alpha.8",
|
|
24
|
+
"@dynamic-labs/types": "0.19.0-alpha.8",
|
|
25
|
+
"@dynamic-labs/utils": "0.19.0-alpha.8",
|
|
26
|
+
"@dynamic-labs/wallet-book": "0.19.0-alpha.8",
|
|
27
|
+
"@dynamic-labs/wallet-connector-core": "0.19.0-alpha.8",
|
|
28
28
|
"eventemitter3": "5.0.1"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
package/src/index.d.ts
CHANGED
|
@@ -14,7 +14,7 @@ export * from './lib/views';
|
|
|
14
14
|
export * from './lib/context/MockContext';
|
|
15
15
|
export * from './lib/context/ThemeContext/themesData';
|
|
16
16
|
export type { ViewType } from './lib/context/ViewContext';
|
|
17
|
-
export type { NotSupportedError, NoAccessError, ChainalysisError, EmailAlreadyExistsError, UsernameAlreadyExistsError, WalletNotDeployedError, WalletUsedError, EmailVerificationError, AccountExistsError, } from '@dynamic-labs/utils';
|
|
17
|
+
export type { NotSupportedError, NoAccessError, ChainalysisError, EmailAlreadyExistsError, UsernameAlreadyExistsError, SocialAccountAlreadyExistsError, WalletNotDeployedError, WalletUsedError, EmailVerificationError, AccountExistsError, } from '@dynamic-labs/utils';
|
|
18
18
|
export type { WalletConnector, Chain, } from '@dynamic-labs/wallet-connector-core';
|
|
19
19
|
export type { EvmNetwork } from '@dynamic-labs/types';
|
|
20
20
|
export { normalizeWalletName } from '@dynamic-labs/wallet-connector-core';
|
package/src/lib/Main.cjs
CHANGED
|
@@ -63,6 +63,7 @@ require('./main.global.cjs');
|
|
|
63
63
|
|
|
64
64
|
const viewsToDisableCloseOnOverlayClick = [
|
|
65
65
|
'email-wallet-otp-verification-view',
|
|
66
|
+
'social-redirect-view',
|
|
66
67
|
];
|
|
67
68
|
const Main = () => {
|
|
68
69
|
const { selectedWalletConnector, linkedWallets, isProjectSettingsLoading, projectSettings, setShowAuthFlow, showAuthFlow, wallets, clearStatesOnBackClick, user, unlinkConnectedWallet, authMode, connectedWallets, } = useInternalDynamicContext.useInternalDynamicContext();
|
package/src/lib/Main.js
CHANGED
|
@@ -59,6 +59,7 @@ import './main.global.js';
|
|
|
59
59
|
|
|
60
60
|
const viewsToDisableCloseOnOverlayClick = [
|
|
61
61
|
'email-wallet-otp-verification-view',
|
|
62
|
+
'social-redirect-view',
|
|
62
63
|
];
|
|
63
64
|
const Main = () => {
|
|
64
65
|
const { selectedWalletConnector, linkedWallets, isProjectSettingsLoading, projectSettings, setShowAuthFlow, showAuthFlow, wallets, clearStatesOnBackClick, user, unlinkConnectedWallet, authMode, connectedWallets, } = useInternalDynamicContext();
|
|
@@ -90,7 +90,7 @@ const AuthProviderIcon = ({ jwt, iconSize = 64, showStatus, wallet, }) => {
|
|
|
90
90
|
}
|
|
91
91
|
// it means that user tried to login with actual wallet and no magic social and failed to go through the access list
|
|
92
92
|
if (deniedAddress) {
|
|
93
|
-
return (jsxRuntime.jsx(walletBook.WalletIcon, {
|
|
93
|
+
return (jsxRuntime.jsx(walletBook.WalletIcon, { walletKey: selectedWalletConnector === null || selectedWalletConnector === void 0 ? void 0 : selectedWalletConnector.key, style: { height: pixelToRem.pixelToRem(iconSize), width: pixelToRem.pixelToRem(iconSize) } }));
|
|
94
94
|
}
|
|
95
95
|
const walletForIcon = wallet ? wallet : primaryWallet;
|
|
96
96
|
if (!walletForIcon) {
|
|
@@ -104,7 +104,7 @@ const AuthProviderIcon = ({ jwt, iconSize = 64, showStatus, wallet, }) => {
|
|
|
104
104
|
if (MagicEmailOrSocialIcon) {
|
|
105
105
|
return showStatus ? (jsxRuntime.jsx(IconWithStatus.IconWithStatus, { iconSize: iconSize, Icon: MagicEmailOrSocialIcon, variant: walletForIcon.connected ? 'green' : 'red' })) : (jsxRuntime.jsx(MagicEmailOrSocialIcon, { style: { height: pixelToRem.pixelToRem(iconSize), width: pixelToRem.pixelToRem(iconSize) } }));
|
|
106
106
|
}
|
|
107
|
-
return showStatus ? (jsxRuntime.jsx(WalletIconWithStatus.WalletIconWithStatus, { iconSize: iconSize,
|
|
107
|
+
return showStatus ? (jsxRuntime.jsx(WalletIconWithStatus.WalletIconWithStatus, { iconSize: iconSize, walletKey: walletForIcon.connector.key, connected: walletForIcon.connected, variant: 'secondary' })) : (jsxRuntime.jsx(walletBook.WalletIcon, { walletKey: walletForIcon.connector.key, style: { height: pixelToRem.pixelToRem(iconSize), width: pixelToRem.pixelToRem(iconSize) } }));
|
|
108
108
|
};
|
|
109
109
|
|
|
110
110
|
exports.AuthProviderIcon = AuthProviderIcon;
|
|
@@ -86,7 +86,7 @@ const AuthProviderIcon = ({ jwt, iconSize = 64, showStatus, wallet, }) => {
|
|
|
86
86
|
}
|
|
87
87
|
// it means that user tried to login with actual wallet and no magic social and failed to go through the access list
|
|
88
88
|
if (deniedAddress) {
|
|
89
|
-
return (jsx(WalletIcon, {
|
|
89
|
+
return (jsx(WalletIcon, { walletKey: selectedWalletConnector === null || selectedWalletConnector === void 0 ? void 0 : selectedWalletConnector.key, style: { height: pixelToRem(iconSize), width: pixelToRem(iconSize) } }));
|
|
90
90
|
}
|
|
91
91
|
const walletForIcon = wallet ? wallet : primaryWallet;
|
|
92
92
|
if (!walletForIcon) {
|
|
@@ -100,7 +100,7 @@ const AuthProviderIcon = ({ jwt, iconSize = 64, showStatus, wallet, }) => {
|
|
|
100
100
|
if (MagicEmailOrSocialIcon) {
|
|
101
101
|
return showStatus ? (jsx(IconWithStatus, { iconSize: iconSize, Icon: MagicEmailOrSocialIcon, variant: walletForIcon.connected ? 'green' : 'red' })) : (jsx(MagicEmailOrSocialIcon, { style: { height: pixelToRem(iconSize), width: pixelToRem(iconSize) } }));
|
|
102
102
|
}
|
|
103
|
-
return showStatus ? (jsx(WalletIconWithStatus, { iconSize: iconSize,
|
|
103
|
+
return showStatus ? (jsx(WalletIconWithStatus, { iconSize: iconSize, walletKey: walletForIcon.connector.key, connected: walletForIcon.connected, variant: 'secondary' })) : (jsx(WalletIcon, { walletKey: walletForIcon.connector.key, style: { height: pixelToRem(iconSize), width: pixelToRem(iconSize) } }));
|
|
104
104
|
};
|
|
105
105
|
|
|
106
106
|
export { AuthProviderIcon };
|
|
@@ -21,15 +21,15 @@ var classNames = require('../../utils/functions/classNames/classNames.cjs');
|
|
|
21
21
|
var StatusDot = require('../StatusDot/StatusDot.cjs');
|
|
22
22
|
var Icon = require('../Icon/Icon.cjs');
|
|
23
23
|
|
|
24
|
-
const IconWithStatus = ({ Icon: Icon$1, InnerIcon,
|
|
25
|
-
const Inner =
|
|
24
|
+
const IconWithStatus = ({ Icon: Icon$1, InnerIcon, primaryWalletKey, containerClassName, iconSize = 16, variant = 'green', }) => {
|
|
25
|
+
const Inner = primaryWalletKey ? (jsxRuntime.jsx("div", Object.assign({ className: 'inner-icon__container' }, { children: jsxRuntime.jsx("div", Object.assign({ className: classNames.classNames('inner-icon') }, { children: jsxRuntime.jsx(Icon.Icon, Object.assign({ size: 'medium' }, { children: jsxRuntime.jsx(walletBook.WalletIcon, { walletKey: primaryWalletKey }) })) })) }))) : (jsxRuntime.jsx("div", Object.assign({ className: 'inner-icon__container' }, { children: jsxRuntime.jsx("div", Object.assign({ className: classNames.classNames('inner-icon', `inner-icon--${variant}`) }, { children: InnerIcon && jsxRuntime.jsx(InnerIcon, {}) })) })));
|
|
26
26
|
return (jsxRuntime.jsxs("div", Object.assign({ className: classNames.classNames('icon-with-status__container', containerClassName || '') }, { children: [typeof Icon$1 === 'string' ? (jsxRuntime.jsx("img", { style: {
|
|
27
27
|
height: pixelToRem.pixelToRem(iconSize),
|
|
28
28
|
width: pixelToRem.pixelToRem(iconSize),
|
|
29
29
|
}, src: Icon$1, alt: '', className: 'icon' })) : (jsxRuntime.jsx(Icon$1, { style: {
|
|
30
30
|
height: pixelToRem.pixelToRem(iconSize),
|
|
31
31
|
width: pixelToRem.pixelToRem(iconSize),
|
|
32
|
-
} })), InnerIcon ||
|
|
32
|
+
} })), InnerIcon || primaryWalletKey ? (Inner) : (jsxRuntime.jsx(StatusDot.StatusDot, { variant: variant, containerClassName: 'icon-with-status__status-dot' }))] })));
|
|
33
33
|
};
|
|
34
34
|
|
|
35
35
|
exports.IconWithStatus = IconWithStatus;
|
|
@@ -5,8 +5,8 @@ type Props = {
|
|
|
5
5
|
InnerIcon?: Icon;
|
|
6
6
|
containerClassName?: string;
|
|
7
7
|
iconSize?: number;
|
|
8
|
-
|
|
8
|
+
primaryWalletKey?: string;
|
|
9
9
|
variant?: 'green' | 'red';
|
|
10
10
|
};
|
|
11
|
-
export declare const IconWithStatus: ({ Icon, InnerIcon,
|
|
11
|
+
export declare const IconWithStatus: ({ Icon, InnerIcon, primaryWalletKey, containerClassName, iconSize, variant, }: Props) => JSX.Element;
|
|
12
12
|
export {};
|
|
@@ -17,15 +17,15 @@ import { classNames } from '../../utils/functions/classNames/classNames.js';
|
|
|
17
17
|
import { StatusDot } from '../StatusDot/StatusDot.js';
|
|
18
18
|
import { Icon } from '../Icon/Icon.js';
|
|
19
19
|
|
|
20
|
-
const IconWithStatus = ({ Icon: Icon$1, InnerIcon,
|
|
21
|
-
const Inner =
|
|
20
|
+
const IconWithStatus = ({ Icon: Icon$1, InnerIcon, primaryWalletKey, containerClassName, iconSize = 16, variant = 'green', }) => {
|
|
21
|
+
const Inner = primaryWalletKey ? (jsx("div", Object.assign({ className: 'inner-icon__container' }, { children: jsx("div", Object.assign({ className: classNames('inner-icon') }, { children: jsx(Icon, Object.assign({ size: 'medium' }, { children: jsx(WalletIcon, { walletKey: primaryWalletKey }) })) })) }))) : (jsx("div", Object.assign({ className: 'inner-icon__container' }, { children: jsx("div", Object.assign({ className: classNames('inner-icon', `inner-icon--${variant}`) }, { children: InnerIcon && jsx(InnerIcon, {}) })) })));
|
|
22
22
|
return (jsxs("div", Object.assign({ className: classNames('icon-with-status__container', containerClassName || '') }, { children: [typeof Icon$1 === 'string' ? (jsx("img", { style: {
|
|
23
23
|
height: pixelToRem(iconSize),
|
|
24
24
|
width: pixelToRem(iconSize),
|
|
25
25
|
}, src: Icon$1, alt: '', className: 'icon' })) : (jsx(Icon$1, { style: {
|
|
26
26
|
height: pixelToRem(iconSize),
|
|
27
27
|
width: pixelToRem(iconSize),
|
|
28
|
-
} })), InnerIcon ||
|
|
28
|
+
} })), InnerIcon || primaryWalletKey ? (Inner) : (jsx(StatusDot, { variant: variant, containerClassName: 'icon-with-status__status-dot' }))] })));
|
|
29
29
|
};
|
|
30
30
|
|
|
31
31
|
export { IconWithStatus };
|
|
@@ -14,7 +14,7 @@ const MockedQrCode = () => {
|
|
|
14
14
|
if (!mockedSDK)
|
|
15
15
|
return null;
|
|
16
16
|
const accentColor = theme.theme.name === 'dark' ? '#FFF' : '#1648F9';
|
|
17
|
-
return (jsxRuntime.jsx(QRCode.QRCode, { Icon: jsxRuntime.jsx(iconic.CoinbaseIcon, {}), logoSize: 50, accentColor: accentColor, value: 'hello world!'.repeat(20),
|
|
17
|
+
return (jsxRuntime.jsx(QRCode.QRCode, { Icon: jsxRuntime.jsx(iconic.CoinbaseIcon, {}), logoSize: 50, accentColor: accentColor, value: 'hello world!'.repeat(20), walletKey: 'coinbase' }));
|
|
18
18
|
};
|
|
19
19
|
|
|
20
20
|
exports.MockedQrCode = MockedQrCode;
|
|
@@ -10,7 +10,7 @@ const MockedQrCode = () => {
|
|
|
10
10
|
if (!mockedSDK)
|
|
11
11
|
return null;
|
|
12
12
|
const accentColor = theme.theme.name === 'dark' ? '#FFF' : '#1648F9';
|
|
13
|
-
return (jsx(QRCode, { Icon: jsx(CoinbaseIcon, {}), logoSize: 50, accentColor: accentColor, value: 'hello world!'.repeat(20),
|
|
13
|
+
return (jsx(QRCode, { Icon: jsx(CoinbaseIcon, {}), logoSize: 50, accentColor: accentColor, value: 'hello world!'.repeat(20), walletKey: 'coinbase' }));
|
|
14
14
|
};
|
|
15
15
|
|
|
16
16
|
export { MockedQrCode };
|
|
@@ -34,7 +34,7 @@ var Chip = require('../Chip/Chip.cjs');
|
|
|
34
34
|
var FormFieldLabel = require('../FormFieldLabel/FormFieldLabel.cjs');
|
|
35
35
|
var TokenBalanceCard = require('./components/TokenBalanceCard/TokenBalanceCard.cjs');
|
|
36
36
|
|
|
37
|
-
const SendBalancePageLayout = ({ error, walletAddress, onClickClose, onClickBack,
|
|
37
|
+
const SendBalancePageLayout = ({ error, walletAddress, onClickClose, onClickBack, walletKey, onSubmit, displayPoweredByDynamicFooter = false, balance, chain, currencySymbol, initialValues, networkName, networkIcon, }) => {
|
|
38
38
|
const closeButton = onClickClose && (jsxRuntime.jsx(IconButton.IconButton, Object.assign({ type: 'button', onClick: onClickClose, "data-testid": 'close-button' }, { children: jsxRuntime.jsx(close.ReactComponent, {}) })));
|
|
39
39
|
const backButton = onClickBack && (jsxRuntime.jsx(IconButton.IconButton, Object.assign({ type: 'button', onClick: onClickBack, "data-testid": 'back-button' }, { children: jsxRuntime.jsx(chevronLeft.ReactComponent, {}) })));
|
|
40
40
|
const balanceNumber = React.useMemo(() => {
|
|
@@ -45,7 +45,7 @@ const SendBalancePageLayout = ({ error, walletAddress, onClickClose, onClickBack
|
|
|
45
45
|
return;
|
|
46
46
|
return parseFloat(balance);
|
|
47
47
|
}, [balance]);
|
|
48
|
-
return (jsxRuntime.jsxs("div", { children: [jsxRuntime.jsx(ModalHeader.ModalHeader, Object.assign({ leading: backButton, trailing: closeButton }, { children: jsxRuntime.jsxs("div", Object.assign({ className: 'send-balance-page-layout__header-content' }, { children: [jsxRuntime.jsx(Typography.Typography, Object.assign({ variant: 'body_normal', color: 'primary', as: 'p' }, { children: "Send from" })),
|
|
48
|
+
return (jsxRuntime.jsxs("div", { children: [jsxRuntime.jsx(ModalHeader.ModalHeader, Object.assign({ leading: backButton, trailing: closeButton }, { children: jsxRuntime.jsxs("div", Object.assign({ className: 'send-balance-page-layout__header-content' }, { children: [jsxRuntime.jsx(Typography.Typography, Object.assign({ variant: 'body_normal', color: 'primary', as: 'p' }, { children: "Send from" })), walletKey && (jsxRuntime.jsx(Icon.Icon, Object.assign({ size: 'small' }, { children: jsxRuntime.jsx(walletBook.WalletIcon, { walletKey: walletKey }) }))), jsxRuntime.jsx(Typography.Typography, Object.assign({ variant: 'body_normal', color: 'primary', as: 'p' }, { children: shortenWalletAddress.shortenWalletAddress(walletAddress, 3, 3) }))] })) })), jsxRuntime.jsxs("div", Object.assign({ className: 'send-balance-page-layout__body' }, { children: [jsxRuntime.jsx(AnimatePresence.AnimatePresence, Object.assign({ animationComponent: jsxRuntime.jsx(VerticalDrawerTransition.VerticalDrawerTransition, {}) }, { children: error && (jsxRuntime.jsx("div", Object.assign({ className: 'send-balance-page-layout__error' }, { children: jsxRuntime.jsx(Alert.Alert, Object.assign({ icon: 'error', variant: 'error' }, { children: error })) }))) })), networkName && networkIcon && (jsxRuntime.jsx("div", Object.assign({ className: 'send-balance-page-layout__network-container' }, { children: jsxRuntime.jsx(Chip.Chip, Object.assign({ icon: networkIcon }, { children: networkName })) }))), jsxRuntime.jsxs("div", Object.assign({ className: 'send-balance-page-layout__balance-container' }, { children: [jsxRuntime.jsx(FormFieldLabel.FormFieldLabel, Object.assign({ divider: true }, { children: "Token" })), jsxRuntime.jsx(TokenBalanceCard.TokenBalanceCard, { chain: chain, currencySymbol: currencySymbol, balance: balance })] })), jsxRuntime.jsx(SendBalanceForm.SendBalanceForm, { onSubmit: onSubmit, initialValues: initialValues, balance: balanceNumber }), displayPoweredByDynamicFooter && (jsxRuntime.jsx(PoweredByDynamic.PoweredByDynamic, { classNameRoot: 'send-balance-page-layout__footer' }))] }))] }));
|
|
49
49
|
};
|
|
50
50
|
|
|
51
51
|
exports.SendBalancePageLayout = SendBalancePageLayout;
|
|
@@ -14,6 +14,6 @@ export type SendBalancePageLayoutProps = {
|
|
|
14
14
|
onClickClose?: MouseEventHandler<HTMLButtonElement>;
|
|
15
15
|
onSubmit: (formValues: SendBalanceFormValues) => void;
|
|
16
16
|
walletAddress: string;
|
|
17
|
-
|
|
17
|
+
walletKey: string;
|
|
18
18
|
};
|
|
19
19
|
export declare const SendBalancePageLayout: FC<SendBalancePageLayoutProps>;
|
|
@@ -30,7 +30,7 @@ import { Chip } from '../Chip/Chip.js';
|
|
|
30
30
|
import { FormFieldLabel } from '../FormFieldLabel/FormFieldLabel.js';
|
|
31
31
|
import { TokenBalanceCard } from './components/TokenBalanceCard/TokenBalanceCard.js';
|
|
32
32
|
|
|
33
|
-
const SendBalancePageLayout = ({ error, walletAddress, onClickClose, onClickBack,
|
|
33
|
+
const SendBalancePageLayout = ({ error, walletAddress, onClickClose, onClickBack, walletKey, onSubmit, displayPoweredByDynamicFooter = false, balance, chain, currencySymbol, initialValues, networkName, networkIcon, }) => {
|
|
34
34
|
const closeButton = onClickClose && (jsx(IconButton, Object.assign({ type: 'button', onClick: onClickClose, "data-testid": 'close-button' }, { children: jsx(SvgClose, {}) })));
|
|
35
35
|
const backButton = onClickBack && (jsx(IconButton, Object.assign({ type: 'button', onClick: onClickBack, "data-testid": 'back-button' }, { children: jsx(SvgChevronLeft, {}) })));
|
|
36
36
|
const balanceNumber = useMemo(() => {
|
|
@@ -41,7 +41,7 @@ const SendBalancePageLayout = ({ error, walletAddress, onClickClose, onClickBack
|
|
|
41
41
|
return;
|
|
42
42
|
return parseFloat(balance);
|
|
43
43
|
}, [balance]);
|
|
44
|
-
return (jsxs("div", { children: [jsx(ModalHeader, Object.assign({ leading: backButton, trailing: closeButton }, { children: jsxs("div", Object.assign({ className: 'send-balance-page-layout__header-content' }, { children: [jsx(Typography, Object.assign({ variant: 'body_normal', color: 'primary', as: 'p' }, { children: "Send from" })),
|
|
44
|
+
return (jsxs("div", { children: [jsx(ModalHeader, Object.assign({ leading: backButton, trailing: closeButton }, { children: jsxs("div", Object.assign({ className: 'send-balance-page-layout__header-content' }, { children: [jsx(Typography, Object.assign({ variant: 'body_normal', color: 'primary', as: 'p' }, { children: "Send from" })), walletKey && (jsx(Icon, Object.assign({ size: 'small' }, { children: jsx(WalletIcon, { walletKey: walletKey }) }))), jsx(Typography, Object.assign({ variant: 'body_normal', color: 'primary', as: 'p' }, { children: shortenWalletAddress(walletAddress, 3, 3) }))] })) })), jsxs("div", Object.assign({ className: 'send-balance-page-layout__body' }, { children: [jsx(AnimatePresence, Object.assign({ animationComponent: jsx(VerticalDrawerTransition, {}) }, { children: error && (jsx("div", Object.assign({ className: 'send-balance-page-layout__error' }, { children: jsx(Alert, Object.assign({ icon: 'error', variant: 'error' }, { children: error })) }))) })), networkName && networkIcon && (jsx("div", Object.assign({ className: 'send-balance-page-layout__network-container' }, { children: jsx(Chip, Object.assign({ icon: networkIcon }, { children: networkName })) }))), jsxs("div", Object.assign({ className: 'send-balance-page-layout__balance-container' }, { children: [jsx(FormFieldLabel, Object.assign({ divider: true }, { children: "Token" })), jsx(TokenBalanceCard, { chain: chain, currencySymbol: currencySymbol, balance: balance })] })), jsx(SendBalanceForm, { onSubmit: onSubmit, initialValues: initialValues, balance: balanceNumber }), displayPoweredByDynamicFooter && (jsx(PoweredByDynamic, { classNameRoot: 'send-balance-page-layout__footer' }))] }))] }));
|
|
45
45
|
};
|
|
46
46
|
|
|
47
47
|
export { SendBalancePageLayout };
|
|
@@ -29,6 +29,7 @@ require('react-dom');
|
|
|
29
29
|
var Typography = require('../Typography/Typography.cjs');
|
|
30
30
|
require('../ShadowDOM/ShadowDOM.cjs');
|
|
31
31
|
require('../../context/ThemeContext/ThemeContext.cjs');
|
|
32
|
+
var classNames = require('../../utils/functions/classNames/classNames.cjs');
|
|
32
33
|
var Icon = require('../Icon/Icon.cjs');
|
|
33
34
|
require('react-focus-lock');
|
|
34
35
|
require('../Transition/ZoomTransition/ZoomTransition.cjs');
|
|
@@ -58,29 +59,40 @@ require('../../utils/hooks/useUserUpdateRequest/useUpdateUser/useUpdateUser.cjs'
|
|
|
58
59
|
require('../../context/UserFieldEditorContext/UserFieldEditorContext.cjs');
|
|
59
60
|
|
|
60
61
|
const MAX_INLINE_ITEMS = 5;
|
|
61
|
-
const SocialSignIn = ({ providers,
|
|
62
|
+
const SocialSignIn = ({ providers, onSelectProvider, isLoading, selectedProvider, testId, defaultProvider, numOfItemsToDisplay = 5, }) => {
|
|
62
63
|
const iconThemeVariant = useIconThemeVariant.useIconThemeVariant();
|
|
63
64
|
const [showCard, setShowCard] = React.useState(false);
|
|
64
65
|
const closeCard = () => !isLoading && setShowCard(false);
|
|
65
66
|
const numberOfEnabledSocialProviders = providers.length;
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
67
|
+
if (numberOfEnabledSocialProviders === 1) {
|
|
68
|
+
// set first and only item in providers list as default provider
|
|
69
|
+
[defaultProvider] = providers;
|
|
70
|
+
}
|
|
71
|
+
else {
|
|
72
|
+
// put default provider at the beggini of the list
|
|
73
|
+
providers.sort((p1, p2) => (p1 === defaultProvider ? -1 : 0));
|
|
74
|
+
}
|
|
75
|
+
const defaultProviderOffset = defaultProvider ? 1 : 0;
|
|
76
|
+
// display number of items set in prop, with a max limit of MAX_INLINE_ITEMS
|
|
77
|
+
const numOfInlineItems = Math.min(numOfItemsToDisplay, MAX_INLINE_ITEMS);
|
|
78
|
+
// show card button if there are more providers than numOfInlineItems items, not counting the default provider
|
|
79
|
+
const showCardButton = numberOfEnabledSocialProviders - defaultProviderOffset > numOfInlineItems;
|
|
80
|
+
const cardButtonOffset = showCardButton ? 1 : 0;
|
|
81
|
+
// get providers to display inline
|
|
82
|
+
const socialProvidersToDisplayInline = providers.slice(defaultProviderOffset, defaultProviderOffset + numOfInlineItems - cardButtonOffset);
|
|
83
|
+
const numberOfSocialGridItems = numberOfEnabledSocialProviders + cardButtonOffset;
|
|
76
84
|
const getProviderAsString = (provider) => provider;
|
|
77
85
|
const closeButton = (jsxRuntime.jsx(IconButton.IconButton, Object.assign({ onClick: closeCard, type: 'button', id: 'close-button', disabled: isLoading, "data-testid": 'close-button' }, { children: jsxRuntime.jsx(close.ReactComponent, {}) })));
|
|
78
|
-
const renderProviderItem = (provider, insideCard = false) => (jsxRuntime.jsxs(IconListTile.IconListTile, Object.assign({ dataTestId: insideCard ? `card-${provider}` : `inline-${provider}`, onClick: () => onSelectProvider(provider), disabled: Boolean(selectedProvider), className:
|
|
86
|
+
const renderProviderItem = (provider, fullWidth = false, insideCard = false) => (jsxRuntime.jsxs(IconListTile.IconListTile, Object.assign({ dataTestId: insideCard ? `card-${provider}` : `inline-${provider}`, onClick: () => onSelectProvider(provider), disabled: Boolean(selectedProvider), className: classNames.classNames({
|
|
87
|
+
'social-sign-in--card--tile': insideCard,
|
|
88
|
+
'social-sign-in--tile': !insideCard,
|
|
89
|
+
'social-sign-in--tile__full-width': fullWidth,
|
|
90
|
+
}) }, { children: [jsxRuntime.jsx(IconWithSpinner.IconWithSpinner, { Icon:
|
|
79
91
|
// eslint-disable-next-line react/jsx-wrap-multilines
|
|
80
|
-
jsxRuntime.jsx(iconic.SocialIcon, { name: getProviderAsString(provider), variant: iconThemeVariant }), isSpinning: selectedProvider === provider, iconSize: 32 }), !insideCard &&
|
|
92
|
+
jsxRuntime.jsx(iconic.SocialIcon, { name: getProviderAsString(provider), variant: iconThemeVariant }), isSpinning: selectedProvider === provider, iconSize: 32 }), !insideCard && fullWidth && (jsxRuntime.jsxs(Typography.Typography, Object.assign({ variant: 'button_primary' }, { children: ["Connect with ", capitalize.capitalize(getProviderAsString(provider))] })))] }), getProviderAsString(provider)));
|
|
81
93
|
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsxs("div", Object.assign({ className: 'social-sign-in', style: {
|
|
82
94
|
'--number-of-social-grid-items': numberOfSocialGridItems,
|
|
83
|
-
}, "data-testid": testId }, { children: [socialProvidersToDisplayInline.map((provider) => renderProviderItem(provider)), showCardButton && (jsxRuntime.jsx(IconListTile.IconListTile, Object.assign({ dataTestId: 'show-more-options', onClick: () => setShowCard(true) }, { children: jsxRuntime.jsx(Icon.Icon, Object.assign({ color: 'text-primary' }, { children: jsxRuntime.jsx(dotsHorizontal.ReactComponent, {}) })) }), 'show-more-options'))] })), jsxRuntime.jsx(OverlayCard.OverlayCard, Object.assign({ isOpen: showCard, onClickOverlay: closeCard }, { children: jsxRuntime.jsxs("div", Object.assign({ className: 'social-sign-in--card' }, { children: [jsxRuntime.jsx(ModalHeader.ModalHeader, Object.assign({ trailing: closeButton }, { children: jsxRuntime.jsx(Typography.Typography, Object.assign({ weight: 'medium', variant: 'body_normal', color: 'primary', as: 'span' }, { children: "Choose a social account" })) })), jsxRuntime.jsx("div", Object.assign({ className: 'social-sign-in--card--body' }, { children: providers.map((provider) => renderProviderItem(provider, true)) }))] })) }))] }));
|
|
95
|
+
}, "data-testid": testId }, { children: [defaultProvider && renderProviderItem(defaultProvider, true), socialProvidersToDisplayInline.map((provider) => renderProviderItem(provider, socialProvidersToDisplayInline.length < 2)), showCardButton && (jsxRuntime.jsx(IconListTile.IconListTile, Object.assign({ dataTestId: 'show-more-options', onClick: () => setShowCard(true), className: 'social-sign-in--tile' }, { children: jsxRuntime.jsx(Icon.Icon, Object.assign({ color: 'text-primary' }, { children: jsxRuntime.jsx(dotsHorizontal.ReactComponent, {}) })) }), 'show-more-options'))] })), jsxRuntime.jsx(OverlayCard.OverlayCard, Object.assign({ isOpen: showCard, onClickOverlay: closeCard }, { children: jsxRuntime.jsxs("div", Object.assign({ className: 'social-sign-in--card' }, { children: [jsxRuntime.jsx(ModalHeader.ModalHeader, Object.assign({ trailing: closeButton }, { children: jsxRuntime.jsx(Typography.Typography, Object.assign({ weight: 'medium', variant: 'body_normal', color: 'primary', as: 'span' }, { children: "Choose a social account" })) })), jsxRuntime.jsx("div", Object.assign({ className: 'social-sign-in--card--body' }, { children: providers.map((provider) => renderProviderItem(provider, false, true)) }))] })) }))] }));
|
|
84
96
|
};
|
|
85
97
|
|
|
86
98
|
exports.SocialSignIn = SocialSignIn;
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
import { SocialSignInProviderEnum } from '@dynamic-labs/sdk-api';
|
|
3
|
+
import { SocialSectionProps } from '../../views/LoginView/sections';
|
|
4
|
+
interface Props extends SocialSectionProps {
|
|
5
|
+
providers: SocialSignInProviderEnum[];
|
|
6
|
+
onSelectProvider: (provider: SocialSignInProviderEnum) => void;
|
|
5
7
|
isLoading?: boolean;
|
|
6
|
-
|
|
7
|
-
selectedProvider?: T;
|
|
8
|
+
selectedProvider?: SocialSignInProviderEnum;
|
|
8
9
|
testId?: string;
|
|
9
|
-
}
|
|
10
|
-
export declare const SocialSignIn:
|
|
10
|
+
}
|
|
11
|
+
export declare const SocialSignIn: ({ providers, onSelectProvider, isLoading, selectedProvider, testId, defaultProvider, numOfItemsToDisplay, }: Props) => JSX.Element;
|
|
11
12
|
export {};
|
|
@@ -25,6 +25,7 @@ import 'react-dom';
|
|
|
25
25
|
import { Typography } from '../Typography/Typography.js';
|
|
26
26
|
import '../ShadowDOM/ShadowDOM.js';
|
|
27
27
|
import '../../context/ThemeContext/ThemeContext.js';
|
|
28
|
+
import { classNames } from '../../utils/functions/classNames/classNames.js';
|
|
28
29
|
import { Icon } from '../Icon/Icon.js';
|
|
29
30
|
import 'react-focus-lock';
|
|
30
31
|
import '../Transition/ZoomTransition/ZoomTransition.js';
|
|
@@ -54,29 +55,40 @@ import '../../utils/hooks/useUserUpdateRequest/useUpdateUser/useUpdateUser.js';
|
|
|
54
55
|
import '../../context/UserFieldEditorContext/UserFieldEditorContext.js';
|
|
55
56
|
|
|
56
57
|
const MAX_INLINE_ITEMS = 5;
|
|
57
|
-
const SocialSignIn = ({ providers,
|
|
58
|
+
const SocialSignIn = ({ providers, onSelectProvider, isLoading, selectedProvider, testId, defaultProvider, numOfItemsToDisplay = 5, }) => {
|
|
58
59
|
const iconThemeVariant = useIconThemeVariant();
|
|
59
60
|
const [showCard, setShowCard] = useState(false);
|
|
60
61
|
const closeCard = () => !isLoading && setShowCard(false);
|
|
61
62
|
const numberOfEnabledSocialProviders = providers.length;
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
63
|
+
if (numberOfEnabledSocialProviders === 1) {
|
|
64
|
+
// set first and only item in providers list as default provider
|
|
65
|
+
[defaultProvider] = providers;
|
|
66
|
+
}
|
|
67
|
+
else {
|
|
68
|
+
// put default provider at the beggini of the list
|
|
69
|
+
providers.sort((p1, p2) => (p1 === defaultProvider ? -1 : 0));
|
|
70
|
+
}
|
|
71
|
+
const defaultProviderOffset = defaultProvider ? 1 : 0;
|
|
72
|
+
// display number of items set in prop, with a max limit of MAX_INLINE_ITEMS
|
|
73
|
+
const numOfInlineItems = Math.min(numOfItemsToDisplay, MAX_INLINE_ITEMS);
|
|
74
|
+
// show card button if there are more providers than numOfInlineItems items, not counting the default provider
|
|
75
|
+
const showCardButton = numberOfEnabledSocialProviders - defaultProviderOffset > numOfInlineItems;
|
|
76
|
+
const cardButtonOffset = showCardButton ? 1 : 0;
|
|
77
|
+
// get providers to display inline
|
|
78
|
+
const socialProvidersToDisplayInline = providers.slice(defaultProviderOffset, defaultProviderOffset + numOfInlineItems - cardButtonOffset);
|
|
79
|
+
const numberOfSocialGridItems = numberOfEnabledSocialProviders + cardButtonOffset;
|
|
72
80
|
const getProviderAsString = (provider) => provider;
|
|
73
81
|
const closeButton = (jsx(IconButton, Object.assign({ onClick: closeCard, type: 'button', id: 'close-button', disabled: isLoading, "data-testid": 'close-button' }, { children: jsx(SvgClose, {}) })));
|
|
74
|
-
const renderProviderItem = (provider, insideCard = false) => (jsxs(IconListTile, Object.assign({ dataTestId: insideCard ? `card-${provider}` : `inline-${provider}`, onClick: () => onSelectProvider(provider), disabled: Boolean(selectedProvider), className:
|
|
82
|
+
const renderProviderItem = (provider, fullWidth = false, insideCard = false) => (jsxs(IconListTile, Object.assign({ dataTestId: insideCard ? `card-${provider}` : `inline-${provider}`, onClick: () => onSelectProvider(provider), disabled: Boolean(selectedProvider), className: classNames({
|
|
83
|
+
'social-sign-in--card--tile': insideCard,
|
|
84
|
+
'social-sign-in--tile': !insideCard,
|
|
85
|
+
'social-sign-in--tile__full-width': fullWidth,
|
|
86
|
+
}) }, { children: [jsx(IconWithSpinner, { Icon:
|
|
75
87
|
// eslint-disable-next-line react/jsx-wrap-multilines
|
|
76
|
-
jsx(SocialIcon, { name: getProviderAsString(provider), variant: iconThemeVariant }), isSpinning: selectedProvider === provider, iconSize: 32 }), !insideCard &&
|
|
88
|
+
jsx(SocialIcon, { name: getProviderAsString(provider), variant: iconThemeVariant }), isSpinning: selectedProvider === provider, iconSize: 32 }), !insideCard && fullWidth && (jsxs(Typography, Object.assign({ variant: 'button_primary' }, { children: ["Connect with ", capitalize(getProviderAsString(provider))] })))] }), getProviderAsString(provider)));
|
|
77
89
|
return (jsxs(Fragment, { children: [jsxs("div", Object.assign({ className: 'social-sign-in', style: {
|
|
78
90
|
'--number-of-social-grid-items': numberOfSocialGridItems,
|
|
79
|
-
}, "data-testid": testId }, { children: [socialProvidersToDisplayInline.map((provider) => renderProviderItem(provider)), showCardButton && (jsx(IconListTile, Object.assign({ dataTestId: 'show-more-options', onClick: () => setShowCard(true) }, { children: jsx(Icon, Object.assign({ color: 'text-primary' }, { children: jsx(SvgDotsHorizontal, {}) })) }), 'show-more-options'))] })), jsx(OverlayCard, Object.assign({ isOpen: showCard, onClickOverlay: closeCard }, { children: jsxs("div", Object.assign({ className: 'social-sign-in--card' }, { children: [jsx(ModalHeader, Object.assign({ trailing: closeButton }, { children: jsx(Typography, Object.assign({ weight: 'medium', variant: 'body_normal', color: 'primary', as: 'span' }, { children: "Choose a social account" })) })), jsx("div", Object.assign({ className: 'social-sign-in--card--body' }, { children: providers.map((provider) => renderProviderItem(provider, true)) }))] })) }))] }));
|
|
91
|
+
}, "data-testid": testId }, { children: [defaultProvider && renderProviderItem(defaultProvider, true), socialProvidersToDisplayInline.map((provider) => renderProviderItem(provider, socialProvidersToDisplayInline.length < 2)), showCardButton && (jsx(IconListTile, Object.assign({ dataTestId: 'show-more-options', onClick: () => setShowCard(true), className: 'social-sign-in--tile' }, { children: jsx(Icon, Object.assign({ color: 'text-primary' }, { children: jsx(SvgDotsHorizontal, {}) })) }), 'show-more-options'))] })), jsx(OverlayCard, Object.assign({ isOpen: showCard, onClickOverlay: closeCard }, { children: jsxs("div", Object.assign({ className: 'social-sign-in--card' }, { children: [jsx(ModalHeader, Object.assign({ trailing: closeButton }, { children: jsx(Typography, Object.assign({ weight: 'medium', variant: 'body_normal', color: 'primary', as: 'span' }, { children: "Choose a social account" })) })), jsx("div", Object.assign({ className: 'social-sign-in--card--body' }, { children: providers.map((provider) => renderProviderItem(provider, false, true)) }))] })) }))] }));
|
|
80
92
|
};
|
|
81
93
|
|
|
82
94
|
export { SocialSignIn };
|
|
@@ -23,12 +23,15 @@ require('@dynamic-labs/multi-wallet');
|
|
|
23
23
|
var index = require('../../utils/functions/getEnabledOAuthProviders/index.cjs');
|
|
24
24
|
var isSocialKycEnabled = require('../../utils/functions/isSocialKycEnabled/isSocialKycEnabled.cjs');
|
|
25
25
|
var getUserProfileFields = require('../../utils/functions/getUserProfileFields/getUserProfileFields.cjs');
|
|
26
|
+
var ErrorContext = require('../../context/ErrorContext/ErrorContext.cjs');
|
|
27
|
+
var ErrorContainer = require('../ErrorContainer/ErrorContainer.cjs');
|
|
26
28
|
var UserProfileField = require('./parts/UserProfileField/UserProfileField.cjs');
|
|
27
29
|
var UserProfileSection = require('./parts/UserProfileSection/UserProfileSection.cjs');
|
|
28
30
|
var UserProfileSocialAccount = require('./parts/UserProfileSocialAccount/UserProfileSocialAccount.cjs');
|
|
29
31
|
|
|
30
32
|
const UserProfile = ({ rootClassName }) => {
|
|
31
33
|
const { projectSettings, user } = useInternalDynamicContext.useInternalDynamicContext();
|
|
34
|
+
const { error } = ErrorContext.useErrorContext();
|
|
32
35
|
const allUserFields = getUserProfileFields.getUserProfileFields({
|
|
33
36
|
projectSettingsKyc: projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.kyc,
|
|
34
37
|
user,
|
|
@@ -39,7 +42,7 @@ const UserProfile = ({ rootClassName }) => {
|
|
|
39
42
|
const mapFieldKeyToValue = (fieldKey) => user === null || user === void 0 ? void 0 : user[fieldKey];
|
|
40
43
|
if (!user)
|
|
41
44
|
return null;
|
|
42
|
-
return (jsxRuntime.jsxs("div", Object.assign({ "data-testid": 'userProfile', className: classNames.classNames('user-profile', rootClassName) }, { children: [(allUserFields === null || allUserFields === void 0 ? void 0 : allUserFields.length) > 0 && (jsxRuntime.jsx(UserProfileSection.UserProfileSection, Object.assign({ title: 'My information' }, { children: jsxRuntime.jsx("div", Object.assign({ className: 'user-profile__fields' }, { children: allUserFields.map(({ name }) => {
|
|
45
|
+
return (jsxRuntime.jsxs("div", Object.assign({ "data-testid": 'userProfile', className: classNames.classNames('user-profile', rootClassName) }, { children: [error && jsxRuntime.jsx(ErrorContainer.ErrorContainer, { children: error }), (allUserFields === null || allUserFields === void 0 ? void 0 : allUserFields.length) > 0 && (jsxRuntime.jsx(UserProfileSection.UserProfileSection, Object.assign({ title: 'My information' }, { children: jsxRuntime.jsx("div", Object.assign({ className: 'user-profile__fields' }, { children: allUserFields.map(({ name }) => {
|
|
43
46
|
const { label } = index$1.getValueByKey(fieldsConfig.fieldsConfig, name);
|
|
44
47
|
const value = mapFieldKeyToValue(name);
|
|
45
48
|
return (jsxRuntime.jsx(UserProfileField.UserProfileField, { name: name, label: label, value: value }, name));
|
|
@@ -19,12 +19,15 @@ import '@dynamic-labs/multi-wallet';
|
|
|
19
19
|
import { getEnabledOAuthProviders } from '../../utils/functions/getEnabledOAuthProviders/index.js';
|
|
20
20
|
import { isSocialKycEnabled } from '../../utils/functions/isSocialKycEnabled/isSocialKycEnabled.js';
|
|
21
21
|
import { getUserProfileFields } from '../../utils/functions/getUserProfileFields/getUserProfileFields.js';
|
|
22
|
+
import { useErrorContext } from '../../context/ErrorContext/ErrorContext.js';
|
|
23
|
+
import { ErrorContainer } from '../ErrorContainer/ErrorContainer.js';
|
|
22
24
|
import { UserProfileField } from './parts/UserProfileField/UserProfileField.js';
|
|
23
25
|
import { UserProfileSection } from './parts/UserProfileSection/UserProfileSection.js';
|
|
24
26
|
import { UserProfileSocialAccount } from './parts/UserProfileSocialAccount/UserProfileSocialAccount.js';
|
|
25
27
|
|
|
26
28
|
const UserProfile = ({ rootClassName }) => {
|
|
27
29
|
const { projectSettings, user } = useInternalDynamicContext();
|
|
30
|
+
const { error } = useErrorContext();
|
|
28
31
|
const allUserFields = getUserProfileFields({
|
|
29
32
|
projectSettingsKyc: projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.kyc,
|
|
30
33
|
user,
|
|
@@ -35,7 +38,7 @@ const UserProfile = ({ rootClassName }) => {
|
|
|
35
38
|
const mapFieldKeyToValue = (fieldKey) => user === null || user === void 0 ? void 0 : user[fieldKey];
|
|
36
39
|
if (!user)
|
|
37
40
|
return null;
|
|
38
|
-
return (jsxs("div", Object.assign({ "data-testid": 'userProfile', className: classNames('user-profile', rootClassName) }, { children: [(allUserFields === null || allUserFields === void 0 ? void 0 : allUserFields.length) > 0 && (jsx(UserProfileSection, Object.assign({ title: 'My information' }, { children: jsx("div", Object.assign({ className: 'user-profile__fields' }, { children: allUserFields.map(({ name }) => {
|
|
41
|
+
return (jsxs("div", Object.assign({ "data-testid": 'userProfile', className: classNames('user-profile', rootClassName) }, { children: [error && jsx(ErrorContainer, { children: error }), (allUserFields === null || allUserFields === void 0 ? void 0 : allUserFields.length) > 0 && (jsx(UserProfileSection, Object.assign({ title: 'My information' }, { children: jsx("div", Object.assign({ className: 'user-profile__fields' }, { children: allUserFields.map(({ name }) => {
|
|
39
42
|
const { label } = getValueByKey(fieldsConfig, name);
|
|
40
43
|
const value = mapFieldKeyToValue(name);
|
|
41
44
|
return (jsx(UserProfileField, { name: name, label: label, value: value }, name));
|
package/src/lib/components/UserProfile/parts/UserProfileSocialAccount/UserProfileSocialAccount.cjs
CHANGED
|
@@ -18,7 +18,7 @@ require('../../../../utils/constants/colors.cjs');
|
|
|
18
18
|
require('../../../../shared/utils/classes/storage/localStorage.cjs');
|
|
19
19
|
require('ethers');
|
|
20
20
|
require('../../../../shared/consts/index.cjs');
|
|
21
|
-
require('../../../../context/DynamicContext/
|
|
21
|
+
var useInternalDynamicContext = require('../../../../context/DynamicContext/useInternalDynamicContext.cjs');
|
|
22
22
|
require('@dynamic-labs/multi-wallet');
|
|
23
23
|
require('../../../ShadowDOM/ShadowDOM.cjs');
|
|
24
24
|
require('../../../../context/ThemeContext/ThemeContext.cjs');
|
|
@@ -57,22 +57,24 @@ var ConnectedAccountAvatar = require('./components/ConnectedAccountAvatar/Connec
|
|
|
57
57
|
|
|
58
58
|
const UserProfileSocialAccount = ({ provider, }) => {
|
|
59
59
|
var _a;
|
|
60
|
+
const { user, primaryWallet } = useInternalDynamicContext.useInternalDynamicContext();
|
|
60
61
|
const { linkSocialAccount, unlinkSocialAccount, isProcessing, isLinked, getLinkedAccountInformation, } = useSocialAccounts.useSocialAccounts();
|
|
61
62
|
const isProviderLinked = isLinked(provider);
|
|
62
63
|
const connectedAccountInfo = getLinkedAccountInformation(provider);
|
|
63
64
|
const iconThemeVariant = useIconThemeVariant.useIconThemeVariant();
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
65
|
+
const isActiveCredential = !primaryWallet &&
|
|
66
|
+
connectedAccountInfo &&
|
|
67
|
+
(connectedAccountInfo === null || connectedAccountInfo === void 0 ? void 0 : connectedAccountInfo.id) === (user === null || user === void 0 ? void 0 : user.lastVerifiedCredentialId);
|
|
68
|
+
const renderButton = () => (jsxRuntime.jsx(Button.Button, Object.assign({ buttonClassName: 'user-profile-social-account__button', buttonVariant: 'secondary', buttonRounded: 'small', buttonPadding: 'none', onClick: () => isProviderLinked
|
|
69
|
+
? unlinkSocialAccount(provider)
|
|
70
|
+
: linkSocialAccount(provider), loading: isProcessing, dataTestId: `social-account-${isProviderLinked ? 'disconnect' : 'connect'}-button`, typographyProps: {
|
|
71
|
+
color: 'secondary',
|
|
72
|
+
variant: 'button_tertiary',
|
|
73
|
+
// weight: 'medium',
|
|
74
|
+
}, startSlot:
|
|
75
|
+
// eslint-disable-next-line react/jsx-wrap-multilines
|
|
76
|
+
jsxRuntime.jsx(Icon.Icon, Object.assign({ color: 'text-tertiary', size: 'small' }, { children: isProviderLinked ? jsxRuntime.jsx(unlink.ReactComponent, {}) : jsxRuntime.jsx(add.ReactComponent, {}) })) }, { children: isProviderLinked ? null : 'Connect' })));
|
|
77
|
+
return (jsxRuntime.jsxs("div", Object.assign({ className: 'user-profile-social-account', "data-testid": `social-account-${provider}` }, { children: [jsxRuntime.jsx("div", Object.assign({ 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("div", Object.assign({ className: 'user-profile-social-account__label' }, { children: jsxRuntime.jsx(Typography.Typography, Object.assign({ weight: 'medium', variant: 'body_normal', color: 'primary' }, { children: (_a = connectedAccountInfo === null || connectedAccountInfo === void 0 ? void 0 : connectedAccountInfo.publicIdentifier) !== null && _a !== void 0 ? _a : helpers.capitalize(provider) })) })), !isActiveCredential ? renderButton() : null] })));
|
|
76
78
|
};
|
|
77
79
|
|
|
78
80
|
exports.UserProfileSocialAccount = UserProfileSocialAccount;
|