@dynamic-labs/sdk-react-core 4.0.0-alpha.40 → 4.0.0-alpha.42

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.
Files changed (26) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/package.cjs +1 -1
  3. package/package.js +1 -1
  4. package/package.json +11 -11
  5. package/src/index.cjs +1 -1
  6. package/src/index.js +1 -1
  7. package/src/lib/components/WalletConnectorEvents/WalletConnectorEvents.cjs +6 -2
  8. package/src/lib/components/WalletConnectorEvents/WalletConnectorEvents.js +6 -2
  9. package/src/lib/layout/DynamicAuthLayout/HelpContent/WalletListHelpContent/WalletListHelpContent.cjs +2 -2
  10. package/src/lib/layout/DynamicAuthLayout/HelpContent/WalletListHelpContent/WalletListHelpContent.js +3 -3
  11. package/src/lib/shared/utils/hooks/useGlobalLoading/useGlobalLoading.cjs +5 -4
  12. package/src/lib/shared/utils/hooks/useGlobalLoading/useGlobalLoading.js +4 -3
  13. package/src/lib/utils/functions/getOauthLoginUrl/getOauthLoginUrl.cjs +8 -3
  14. package/src/lib/utils/functions/getOauthLoginUrl/getOauthLoginUrl.js +8 -3
  15. package/src/lib/utils/hooks/useCreateWalletConnectorOptions/useCreateWalletConnectorOptions.cjs +6 -6
  16. package/src/lib/utils/hooks/useCreateWalletConnectorOptions/useCreateWalletConnectorOptions.js +4 -4
  17. package/src/lib/utils/hooks/useSocialAuth/useSocialAuth.cjs +1 -0
  18. package/src/lib/utils/hooks/useSocialAuth/useSocialAuth.js +1 -0
  19. package/src/lib/views/SelectWalletInWalletGroupView/SelectWalletInWalletGroupView.cjs +1 -1
  20. package/src/lib/views/SelectWalletInWalletGroupView/SelectWalletInWalletGroupView.js +1 -1
  21. package/src/lib/views/WalletGroupView/WalletGroupView.cjs +1 -1
  22. package/src/lib/views/WalletGroupView/WalletGroupView.js +1 -1
  23. package/src/lib/views/WalletList/WalletListItem/WalletListItem.cjs +1 -1
  24. package/src/lib/views/WalletList/WalletListItem/WalletListItem.js +1 -1
  25. package/src/lib/views/WalletList/data.cjs +1 -0
  26. package/src/lib/views/WalletList/data.js +1 -0
package/CHANGELOG.md CHANGED
@@ -1,4 +1,23 @@
1
1
 
2
+ ## [4.0.0-alpha.42](https://github.com/dynamic-labs/dynamic-auth/compare/v4.0.0-alpha.41...v4.0.0-alpha.42) (2024-12-06)
3
+
4
+
5
+ ### Bug Fixes
6
+
7
+ * walletbook loading issues ([#7553](https://github.com/dynamic-labs/dynamic-auth/issues/7553)) ([684ecc3](https://github.com/dynamic-labs/dynamic-auth/commit/684ecc32960e34680088d6cf200318336647ab77))
8
+
9
+ ## [4.0.0-alpha.41](https://github.com/dynamic-labs/dynamic-auth/compare/v4.0.0-alpha.40...v4.0.0-alpha.41) (2024-12-05)
10
+
11
+
12
+ ### Features
13
+
14
+ * add shopify login ([04c6a9e](https://github.com/dynamic-labs/dynamic-auth/commit/04c6a9ee9d039d1480aa3b476ab382d7ea6dbaf2))
15
+
16
+
17
+ ### Bug Fixes
18
+
19
+ * wallet group icon not rendering properly when no wallets with that same id are found ([#7543](https://github.com/dynamic-labs/dynamic-auth/issues/7543)) ([a26a629](https://github.com/dynamic-labs/dynamic-auth/commit/a26a6294bbe845147245cccc60a7fded49196db6))
20
+
2
21
  ## [4.0.0-alpha.40](https://github.com/dynamic-labs/dynamic-auth/compare/v4.0.0-alpha.39...v4.0.0-alpha.40) (2024-12-03)
3
22
 
4
23
 
package/package.cjs CHANGED
@@ -3,7 +3,7 @@
3
3
 
4
4
  Object.defineProperty(exports, '__esModule', { value: true });
5
5
 
6
- var version = "4.0.0-alpha.40";
6
+ var version = "4.0.0-alpha.42";
7
7
  var dependencies = {
8
8
  "@dynamic-labs/sdk-api-core": "0.0.570",
9
9
  "@hcaptcha/react-hcaptcha": "1.4.4",
package/package.js CHANGED
@@ -1,5 +1,5 @@
1
1
  'use client'
2
- var version = "4.0.0-alpha.40";
2
+ var version = "4.0.0-alpha.42";
3
3
  var dependencies = {
4
4
  "@dynamic-labs/sdk-api-core": "0.0.570",
5
5
  "@hcaptcha/react-hcaptcha": "1.4.4",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dynamic-labs/sdk-react-core",
3
- "version": "4.0.0-alpha.40",
3
+ "version": "4.0.0-alpha.42",
4
4
  "dependencies": {
5
5
  "@dynamic-labs/sdk-api-core": "0.0.570",
6
6
  "@hcaptcha/react-hcaptcha": "1.4.4",
@@ -13,16 +13,16 @@
13
13
  "react-i18next": "13.5.0",
14
14
  "yup": "0.32.11",
15
15
  "react-international-phone": "4.2.5",
16
- "@dynamic-labs/assert-package-version": "4.0.0-alpha.40",
17
- "@dynamic-labs/iconic": "4.0.0-alpha.40",
18
- "@dynamic-labs/logger": "4.0.0-alpha.40",
19
- "@dynamic-labs/multi-wallet": "4.0.0-alpha.40",
20
- "@dynamic-labs/rpc-providers": "4.0.0-alpha.40",
21
- "@dynamic-labs/store": "4.0.0-alpha.40",
22
- "@dynamic-labs/types": "4.0.0-alpha.40",
23
- "@dynamic-labs/utils": "4.0.0-alpha.40",
24
- "@dynamic-labs/wallet-book": "4.0.0-alpha.40",
25
- "@dynamic-labs/wallet-connector-core": "4.0.0-alpha.40",
16
+ "@dynamic-labs/assert-package-version": "4.0.0-alpha.42",
17
+ "@dynamic-labs/iconic": "4.0.0-alpha.42",
18
+ "@dynamic-labs/logger": "4.0.0-alpha.42",
19
+ "@dynamic-labs/multi-wallet": "4.0.0-alpha.42",
20
+ "@dynamic-labs/rpc-providers": "4.0.0-alpha.42",
21
+ "@dynamic-labs/store": "4.0.0-alpha.42",
22
+ "@dynamic-labs/types": "4.0.0-alpha.42",
23
+ "@dynamic-labs/utils": "4.0.0-alpha.42",
24
+ "@dynamic-labs/wallet-book": "4.0.0-alpha.42",
25
+ "@dynamic-labs/wallet-connector-core": "4.0.0-alpha.42",
26
26
  "bs58": "5.0.0",
27
27
  "eventemitter3": "5.0.1"
28
28
  },
package/src/index.cjs CHANGED
@@ -35,6 +35,7 @@ require('@dynamic-labs/utils');
35
35
  require('./lib/utils/constants/colors.cjs');
36
36
  require('./lib/utils/constants/values.cjs');
37
37
  require('@dynamic-labs/wallet-connector-core');
38
+ require('@dynamic-labs/wallet-book');
38
39
  require('./lib/store/state/loadingAndLifecycle.cjs');
39
40
  var useLocalStorage = require('./lib/shared/utils/hooks/useLocalStorage/useLocalStorage.cjs');
40
41
  var index$1 = require('./lib/shared/utils/hooks/useOnClickOutside/index.cjs');
@@ -103,7 +104,6 @@ require('./lib/components/Transition/SlideInUpTransition/SlideInUpTransition.cjs
103
104
  require('./lib/components/Transition/OpacityTransition/OpacityTransition.cjs');
104
105
  require('./lib/components/OverlayCardBase/OverlayCardTarget/OverlayCardTarget.cjs');
105
106
  require('./lib/context/SocialRedirectContext/SocialRedirectContext.cjs');
106
- require('@dynamic-labs/wallet-book');
107
107
  require('./lib/context/WalletGroupContext/WalletGroupContext.cjs');
108
108
  require('./lib/widgets/DynamicWidget/components/DynamicWidgetHeader/DynamicWidgetHeader.cjs');
109
109
  require('react-focus-lock');
package/src/index.js CHANGED
@@ -31,6 +31,7 @@ import '@dynamic-labs/utils';
31
31
  import './lib/utils/constants/colors.js';
32
32
  import './lib/utils/constants/values.js';
33
33
  import '@dynamic-labs/wallet-connector-core';
34
+ import '@dynamic-labs/wallet-book';
34
35
  import './lib/store/state/loadingAndLifecycle.js';
35
36
  export { useLocalStorage } from './lib/shared/utils/hooks/useLocalStorage/useLocalStorage.js';
36
37
  export { useOnClickOutside } from './lib/shared/utils/hooks/useOnClickOutside/index.js';
@@ -99,7 +100,6 @@ import './lib/components/Transition/SlideInUpTransition/SlideInUpTransition.js';
99
100
  import './lib/components/Transition/OpacityTransition/OpacityTransition.js';
100
101
  import './lib/components/OverlayCardBase/OverlayCardTarget/OverlayCardTarget.js';
101
102
  import './lib/context/SocialRedirectContext/SocialRedirectContext.js';
102
- import '@dynamic-labs/wallet-book';
103
103
  import './lib/context/WalletGroupContext/WalletGroupContext.js';
104
104
  import './lib/widgets/DynamicWidget/components/DynamicWidgetHeader/DynamicWidgetHeader.js';
105
105
  import 'react-focus-lock';
@@ -7,6 +7,7 @@ var React = require('react');
7
7
  var walletConnectorCore = require('@dynamic-labs/wallet-connector-core');
8
8
  var multiWallet = require('@dynamic-labs/multi-wallet');
9
9
  var rpcProviders = require('@dynamic-labs/rpc-providers');
10
+ var walletBook = require('@dynamic-labs/wallet-book');
10
11
  var useWalletItemActions = require('../../utils/hooks/useWalletItemActions/useWalletItemActions.cjs');
11
12
  require('../../context/DynamicContext/DynamicContext.cjs');
12
13
  require('@dynamic-labs/sdk-api-core');
@@ -66,7 +67,6 @@ require('../Popper/Popper/Popper.cjs');
66
67
  require('../Popper/PopperContext/PopperContext.cjs');
67
68
  require('react-focus-lock');
68
69
  require('qrcode');
69
- require('@dynamic-labs/wallet-book');
70
70
  require('formik');
71
71
  require('../../context/FooterAnimationContext/index.cjs');
72
72
  require('../../context/WalletGroupContext/WalletGroupContext.cjs');
@@ -92,7 +92,8 @@ const WalletConnectorEvents = ({ connectorProps, }) => {
92
92
  const walletConnectorConstructorOptions = React.useMemo(() => {
93
93
  var _a, _b;
94
94
  if (!connectorProps.projectSettings ||
95
- !connectorProps.networkConfigurations) {
95
+ !connectorProps.networkConfigurations ||
96
+ !walletBook.isWalletBookPopulated(connectorProps.walletBook)) {
96
97
  return;
97
98
  }
98
99
  return multiWallet.getWalletConnectorConstructorOptions(Object.assign(Object.assign({}, connectorProps), { chainRpcProviders: rpcProviders.ChainRpcProviders, settings: connectorProps.projectSettings, walletConnectProjectId: (_b = (_a = connectorProps.projectSettings) === null || _a === void 0 ? void 0 : _a.sdk.walletConnect) === null || _b === void 0 ? void 0 : _b.projectId }));
@@ -138,6 +139,9 @@ const WalletConnectorEvents = ({ connectorProps, }) => {
138
139
  }
139
140
  walletConnectorOptions.setWalletConnectorOptions(updatedConnectors);
140
141
  };
142
+ if (!walletBook.isWalletBookPopulated(connectorProps.walletBook)) {
143
+ return;
144
+ }
141
145
  walletConnectorCore.walletConnectorEvents.on('providerReady', handleProviderReady);
142
146
  return () => {
143
147
  walletConnectorCore.walletConnectorEvents.off('providerReady', handleProviderReady);
@@ -3,6 +3,7 @@ import { useMemo, useEffect } from 'react';
3
3
  import { walletConnectorEvents } from '@dynamic-labs/wallet-connector-core';
4
4
  import { getWalletConnectorConstructorOptions } from '@dynamic-labs/multi-wallet';
5
5
  import { ChainRpcProviders } from '@dynamic-labs/rpc-providers';
6
+ import { isWalletBookPopulated } from '@dynamic-labs/wallet-book';
6
7
  import { useWalletItemActions } from '../../utils/hooks/useWalletItemActions/useWalletItemActions.js';
7
8
  import '../../context/DynamicContext/DynamicContext.js';
8
9
  import '@dynamic-labs/sdk-api-core';
@@ -62,7 +63,6 @@ import '../Popper/Popper/Popper.js';
62
63
  import '../Popper/PopperContext/PopperContext.js';
63
64
  import 'react-focus-lock';
64
65
  import 'qrcode';
65
- import '@dynamic-labs/wallet-book';
66
66
  import 'formik';
67
67
  import '../../context/FooterAnimationContext/index.js';
68
68
  import '../../context/WalletGroupContext/WalletGroupContext.js';
@@ -88,7 +88,8 @@ const WalletConnectorEvents = ({ connectorProps, }) => {
88
88
  const walletConnectorConstructorOptions = useMemo(() => {
89
89
  var _a, _b;
90
90
  if (!connectorProps.projectSettings ||
91
- !connectorProps.networkConfigurations) {
91
+ !connectorProps.networkConfigurations ||
92
+ !isWalletBookPopulated(connectorProps.walletBook)) {
92
93
  return;
93
94
  }
94
95
  return getWalletConnectorConstructorOptions(Object.assign(Object.assign({}, connectorProps), { chainRpcProviders: ChainRpcProviders, settings: connectorProps.projectSettings, walletConnectProjectId: (_b = (_a = connectorProps.projectSettings) === null || _a === void 0 ? void 0 : _a.sdk.walletConnect) === null || _b === void 0 ? void 0 : _b.projectId }));
@@ -134,6 +135,9 @@ const WalletConnectorEvents = ({ connectorProps, }) => {
134
135
  }
135
136
  setWalletConnectorOptions(updatedConnectors);
136
137
  };
138
+ if (!isWalletBookPopulated(connectorProps.walletBook)) {
139
+ return;
140
+ }
137
141
  walletConnectorEvents.on('providerReady', handleProviderReady);
138
142
  return () => {
139
143
  walletConnectorEvents.off('providerReady', handleProviderReady);
@@ -95,7 +95,7 @@ require('../../../../shared/utils/functions/getInitialUrl/getInitialUrl.cjs');
95
95
  var useInternalDynamicContext = require('../../../../context/DynamicContext/useDynamicContext/useInternalDynamicContext.cjs');
96
96
 
97
97
  const WalletListHelpContent = ({ chains, newToWeb3WalletChainMap, }) => {
98
- var _a, _b;
98
+ var _a;
99
99
  const { walletConnectorOptions } = useInternalDynamicContext.useInternalDynamicContext();
100
100
  const { walletBook: walletBook$1 } = walletBook.useWalletBookContext();
101
101
  const [selectedUrl, setSelectedUrl] = React.useState('');
@@ -126,7 +126,7 @@ const WalletListHelpContent = ({ chains, newToWeb3WalletChainMap, }) => {
126
126
  url: links.android,
127
127
  },
128
128
  ];
129
- if (!Object.keys((_b = walletBook$1 === null || walletBook$1 === void 0 ? void 0 : walletBook$1.wallets) !== null && _b !== void 0 ? _b : {}).length) {
129
+ if (!walletBook.isWalletBookPopulated(walletBook$1)) {
130
130
  return jsxRuntime.jsx(Skeleton.Skeleton, { className: 'walletlist-footer-content__container' });
131
131
  }
132
132
  return (jsxRuntime.jsx("div", { className: 'walletlist-help-content__container', children: jsxRuntime.jsxs(EnterTileAnimation.EnterTileAnimation, { delay: '300ms', children: [jsxRuntime.jsx("div", { className: 'walletlist-help-content__icon', children: jsxRuntime.jsx(walletBook.WalletIcon, { icon: metadata === null || metadata === void 0 ? void 0 : metadata.icon, walletKey: walletKey, style: { height: pixelToRem.pixelToRem(56), width: pixelToRem.pixelToRem(56) } }) }), jsxRuntime.jsxs("div", { className: 'walletlist-help-content__typography-wrapper', children: [jsxRuntime.jsxs(Typography.Typography, { as: 'p', variant: 'title', weight: 'medium', children: ["We recommend installing ", metadata === null || metadata === void 0 ? void 0 : metadata.name] }), jsxRuntime.jsx(Typography.Typography, { as: 'label', variant: 'body_normal', weight: 'regular', color: 'secondary', className: 'walletlist-help-content__typography--label', children: "Select your preferred option below:" })] }), jsxRuntime.jsx("div", { className: 'walletlist-help-content__buttons-wrapper', children: walletLinksElements.map((element, i) => element.isEnabled ? (jsxRuntime.jsx("button", { onClick: () => setSelectedUrl(element.url), children: jsxRuntime.jsx(Item.Item, { StartIcon: element.icon, heading: element.content, url: element.url }) }, i)) : undefined) }), isCustodialServiceWallet && (jsxRuntime.jsxs("div", { className: 'walletlist-help-content__custodial-wallet-area', children: [jsxRuntime.jsx(Typography.Typography, { className: 'walletlist-help-content__custodial-wallet-area--title', as: 'p', color: 'secondary', variant: 'body_normal', weight: 'regular', children: "If you don't want to install a wallet, then use:" }), jsxRuntime.jsx(NewToWeb3WalletItem.NewToWeb3WalletItem, { wallet: newToWeb3Wallet })] })), jsxRuntime.jsx(WalletExtensionOrAppContinueButton.WalletExtensionOrAppContinueButton, { selectedUrl: selectedUrl, wallet: newToWeb3Wallet })] }) }));
@@ -2,7 +2,7 @@
2
2
  import { jsx, jsxs } from 'react/jsx-runtime';
3
3
  import { useState } from 'react';
4
4
  import { AppleIcon, AndroidIcon } from '@dynamic-labs/iconic';
5
- import { useWalletBookContext, WalletIcon } from '@dynamic-labs/wallet-book';
5
+ import { useWalletBookContext, isWalletBookPopulated, WalletIcon } from '@dynamic-labs/wallet-book';
6
6
  import { isMobile } from '@dynamic-labs/utils';
7
7
  import { getWalletLinks } from '@dynamic-labs/wallet-connector-core';
8
8
  import '../../../../context/DynamicContext/DynamicContext.js';
@@ -91,7 +91,7 @@ import '../../../../shared/utils/functions/getInitialUrl/getInitialUrl.js';
91
91
  import { useInternalDynamicContext } from '../../../../context/DynamicContext/useDynamicContext/useInternalDynamicContext.js';
92
92
 
93
93
  const WalletListHelpContent = ({ chains, newToWeb3WalletChainMap, }) => {
94
- var _a, _b;
94
+ var _a;
95
95
  const { walletConnectorOptions } = useInternalDynamicContext();
96
96
  const { walletBook } = useWalletBookContext();
97
97
  const [selectedUrl, setSelectedUrl] = useState('');
@@ -122,7 +122,7 @@ const WalletListHelpContent = ({ chains, newToWeb3WalletChainMap, }) => {
122
122
  url: links.android,
123
123
  },
124
124
  ];
125
- if (!Object.keys((_b = walletBook === null || walletBook === void 0 ? void 0 : walletBook.wallets) !== null && _b !== void 0 ? _b : {}).length) {
125
+ if (!isWalletBookPopulated(walletBook)) {
126
126
  return jsx(Skeleton, { className: 'walletlist-footer-content__container' });
127
127
  }
128
128
  return (jsx("div", { className: 'walletlist-help-content__container', children: jsxs(EnterTileAnimation, { delay: '300ms', children: [jsx("div", { className: 'walletlist-help-content__icon', children: jsx(WalletIcon, { icon: metadata === null || metadata === void 0 ? void 0 : metadata.icon, walletKey: walletKey, style: { height: pixelToRem(56), width: pixelToRem(56) } }) }), jsxs("div", { className: 'walletlist-help-content__typography-wrapper', children: [jsxs(Typography, { as: 'p', variant: 'title', weight: 'medium', children: ["We recommend installing ", metadata === null || metadata === void 0 ? void 0 : metadata.name] }), jsx(Typography, { as: 'label', variant: 'body_normal', weight: 'regular', color: 'secondary', className: 'walletlist-help-content__typography--label', children: "Select your preferred option below:" })] }), jsx("div", { className: 'walletlist-help-content__buttons-wrapper', children: walletLinksElements.map((element, i) => element.isEnabled ? (jsx("button", { onClick: () => setSelectedUrl(element.url), children: jsx(Item, { StartIcon: element.icon, heading: element.content, url: element.url }) }, i)) : undefined) }), isCustodialServiceWallet && (jsxs("div", { className: 'walletlist-help-content__custodial-wallet-area', children: [jsx(Typography, { className: 'walletlist-help-content__custodial-wallet-area--title', as: 'p', color: 'secondary', variant: 'body_normal', weight: 'regular', children: "If you don't want to install a wallet, then use:" }), jsx(NewToWeb3WalletItem, { wallet: newToWeb3Wallet })] })), jsx(WalletExtensionOrAppContinueButton, { selectedUrl: selectedUrl, wallet: newToWeb3Wallet })] }) }));
@@ -4,12 +4,13 @@
4
4
  Object.defineProperty(exports, '__esModule', { value: true });
5
5
 
6
6
  var React = require('react');
7
+ var walletBook = require('@dynamic-labs/wallet-book');
7
8
  var loadingAndLifecycle = require('../../../../store/state/loadingAndLifecycle.cjs');
8
9
  var logger = require('../../../logger.cjs');
9
10
  var index = require('../../functions/lastAuthenticatedAccount/index.cjs');
10
11
 
11
- const useGlobalLoading = ({ authMode, connectedInfo, connectedWallets, projectSettings, primaryWalletId, primaryWallet, user, isLoadingUserFromCookie, walletBook, enableInstrumentation, appName, environmentId, }) => {
12
- var _a, _b;
12
+ const useGlobalLoading = ({ authMode, connectedInfo, connectedWallets, projectSettings, primaryWalletId, primaryWallet, user, isLoadingUserFromCookie, walletBook: walletBook$1, enableInstrumentation, appName, environmentId, }) => {
13
+ var _a;
13
14
  // Once we declare the SDK as loaded, we do not ever want to flip back to false
14
15
  const hasLoaded = React.useRef(false);
15
16
  const loadingStart = React.useRef(new Date().getTime());
@@ -41,11 +42,11 @@ const useGlobalLoading = ({ authMode, connectedInfo, connectedWallets, projectSe
41
42
  };
42
43
  if (hasLoaded.current)
43
44
  return true;
44
- const isWalletBookLoading = !Object.keys((_a = walletBook === null || walletBook === void 0 ? void 0 : walletBook.wallets) !== null && _a !== void 0 ? _a : {}).length;
45
+ const isWalletBookLoading = !walletBook.isWalletBookPopulated(walletBook$1);
45
46
  const isProjectSettingsLoading = !projectSettings;
46
47
  const isUserLoading = isLoadingUserFromCookie;
47
48
  const shouldHavePrimaryWallet = primaryWalletId ||
48
- (user && ((_b = index.lastAuthenticatedAccount(user)) === null || _b === void 0 ? void 0 : _b.format) === 'blockchain');
49
+ (user && ((_a = index.lastAuthenticatedAccount(user)) === null || _a === void 0 ? void 0 : _a.format) === 'blockchain');
49
50
  const isPrimaryWalletLoading = Boolean(shouldHavePrimaryWallet && !primaryWallet);
50
51
  const isConnectOnlyWalletsLoading = authMode === 'connect-only' &&
51
52
  connectedInfo &&
@@ -1,11 +1,12 @@
1
1
  'use client'
2
2
  import { useRef } from 'react';
3
+ import { isWalletBookPopulated } from '@dynamic-labs/wallet-book';
3
4
  import { useLoadingAndLifecycle } from '../../../../store/state/loadingAndLifecycle.js';
4
5
  import { logger } from '../../../logger.js';
5
6
  import { lastAuthenticatedAccount } from '../../functions/lastAuthenticatedAccount/index.js';
6
7
 
7
8
  const useGlobalLoading = ({ authMode, connectedInfo, connectedWallets, projectSettings, primaryWalletId, primaryWallet, user, isLoadingUserFromCookie, walletBook, enableInstrumentation, appName, environmentId, }) => {
8
- var _a, _b;
9
+ var _a;
9
10
  // Once we declare the SDK as loaded, we do not ever want to flip back to false
10
11
  const hasLoaded = useRef(false);
11
12
  const loadingStart = useRef(new Date().getTime());
@@ -37,11 +38,11 @@ const useGlobalLoading = ({ authMode, connectedInfo, connectedWallets, projectSe
37
38
  };
38
39
  if (hasLoaded.current)
39
40
  return true;
40
- const isWalletBookLoading = !Object.keys((_a = walletBook === null || walletBook === void 0 ? void 0 : walletBook.wallets) !== null && _a !== void 0 ? _a : {}).length;
41
+ const isWalletBookLoading = !isWalletBookPopulated(walletBook);
41
42
  const isProjectSettingsLoading = !projectSettings;
42
43
  const isUserLoading = isLoadingUserFromCookie;
43
44
  const shouldHavePrimaryWallet = primaryWalletId ||
44
- (user && ((_b = lastAuthenticatedAccount(user)) === null || _b === void 0 ? void 0 : _b.format) === 'blockchain');
45
+ (user && ((_a = lastAuthenticatedAccount(user)) === null || _a === void 0 ? void 0 : _a.format) === 'blockchain');
45
46
  const isPrimaryWalletLoading = Boolean(shouldHavePrimaryWallet && !primaryWallet);
46
47
  const isConnectOnlyWalletsLoading = authMode === 'connect-only' &&
47
48
  connectedInfo &&
@@ -20,7 +20,7 @@ const getMobileOauthUrl = (provider, loginData) => {
20
20
  return provider.redirectUrl.replace('redirect', 'authorizeHtml');
21
21
  };
22
22
  const getOauthLoginUrl = (providers, providerType) => {
23
- var _a, _b;
23
+ var _a, _b, _c;
24
24
  const provider = getProviderByType.getProviderByType(providers, providerType);
25
25
  if (!(provider === null || provider === void 0 ? void 0 : provider.clientId)) {
26
26
  return '';
@@ -34,7 +34,12 @@ const getOauthLoginUrl = (providers, providerType) => {
34
34
  loginBaseUrl = (_a = provider.authorizationUrl) !== null && _a !== void 0 ? _a : '';
35
35
  }
36
36
  else if (provider.baseAuthUrl) {
37
- loginBaseUrl = provider.baseAuthUrl;
37
+ if (providerType === sdkApiCore.ProviderEnum.Shopify) {
38
+ loginBaseUrl = provider.baseAuthUrl.replace('{{shopifyStore}}', (_b = provider.shopifyStore) !== null && _b !== void 0 ? _b : '');
39
+ }
40
+ else {
41
+ loginBaseUrl = provider.baseAuthUrl;
42
+ }
38
43
  }
39
44
  else {
40
45
  return '';
@@ -42,7 +47,7 @@ const getOauthLoginUrl = (providers, providerType) => {
42
47
  const mobileUrl = getMobileOauthUrl(provider, loginData);
43
48
  const baseProps = {
44
49
  client_id: provider.clientId,
45
- redirect_uri: (_b = provider.redirectUrl) !== null && _b !== void 0 ? _b : '',
50
+ redirect_uri: (_c = provider.redirectUrl) !== null && _c !== void 0 ? _c : '',
46
51
  response_type: 'code',
47
52
  };
48
53
  if (providerType === sdkApiCore.ProviderEnum.Tiktok) {
@@ -16,7 +16,7 @@ const getMobileOauthUrl = (provider, loginData) => {
16
16
  return provider.redirectUrl.replace('redirect', 'authorizeHtml');
17
17
  };
18
18
  const getOauthLoginUrl = (providers, providerType) => {
19
- var _a, _b;
19
+ var _a, _b, _c;
20
20
  const provider = getProviderByType(providers, providerType);
21
21
  if (!(provider === null || provider === void 0 ? void 0 : provider.clientId)) {
22
22
  return '';
@@ -30,7 +30,12 @@ const getOauthLoginUrl = (providers, providerType) => {
30
30
  loginBaseUrl = (_a = provider.authorizationUrl) !== null && _a !== void 0 ? _a : '';
31
31
  }
32
32
  else if (provider.baseAuthUrl) {
33
- loginBaseUrl = provider.baseAuthUrl;
33
+ if (providerType === ProviderEnum.Shopify) {
34
+ loginBaseUrl = provider.baseAuthUrl.replace('{{shopifyStore}}', (_b = provider.shopifyStore) !== null && _b !== void 0 ? _b : '');
35
+ }
36
+ else {
37
+ loginBaseUrl = provider.baseAuthUrl;
38
+ }
34
39
  }
35
40
  else {
36
41
  return '';
@@ -38,7 +43,7 @@ const getOauthLoginUrl = (providers, providerType) => {
38
43
  const mobileUrl = getMobileOauthUrl(provider, loginData);
39
44
  const baseProps = {
40
45
  client_id: provider.clientId,
41
- redirect_uri: (_b = provider.redirectUrl) !== null && _b !== void 0 ? _b : '',
46
+ redirect_uri: (_c = provider.redirectUrl) !== null && _c !== void 0 ? _c : '',
42
47
  response_type: 'code',
43
48
  };
44
49
  if (providerType === ProviderEnum.Tiktok) {
@@ -5,6 +5,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
5
5
 
6
6
  var _tslib = require('../../../../../_virtual/_tslib.cjs');
7
7
  var React = require('react');
8
+ var walletBook = require('@dynamic-labs/wallet-book');
8
9
  var data = require('../../../views/WalletList/data.cjs');
9
10
  require('@dynamic-labs/sdk-api-core');
10
11
  require('../../constants/values.cjs');
@@ -17,7 +18,6 @@ require('@dynamic-labs/iconic');
17
18
  require('@dynamic-labs/wallet-connector-core');
18
19
  require('react/jsx-runtime');
19
20
  require('../../../context/ViewContext/ViewContext.cjs');
20
- require('@dynamic-labs/wallet-book');
21
21
  require('../../../store/state/loadingAndLifecycle.cjs');
22
22
  require('../../../shared/consts/index.cjs');
23
23
  require('../../../config/ApiEndpoint.cjs');
@@ -29,14 +29,14 @@ var walletConnectorOptions = require('../../../store/state/walletConnectorOption
29
29
  var verifyRequiredConnectorsAreSetup = require('./utils/verifyRequiredConnectorsAreSetup/verifyRequiredConnectorsAreSetup.cjs');
30
30
 
31
31
  const useCreateWalletConnectorOptions = (_a) => {
32
- var { projectSettings, networkConfigurations, walletBook, walletConnectorsProp, walletConnectorExtensions } = _a, props = _tslib.__rest(_a, ["projectSettings", "networkConfigurations", "walletBook", "walletConnectorsProp", "walletConnectorExtensions"]);
32
+ var { projectSettings, networkConfigurations, walletBook: walletBook$1, walletConnectorsProp, walletConnectorExtensions } = _a, props = _tslib.__rest(_a, ["projectSettings", "networkConfigurations", "walletBook", "walletConnectorsProp", "walletConnectorExtensions"]);
33
33
  const walletConnectorsKey = React.useMemo(() => { var _a; return (_a = serializeWalletConnectors.serializeWalletConnectors(walletConnectorsProp)) === null || _a === void 0 ? void 0 : _a.join(','); }, [walletConnectorsProp]);
34
- const walletBookLength = React.useMemo(() => Object.keys(walletBook !== null && walletBook !== void 0 ? walletBook : {}).length, [walletBook]);
34
+ const isWalletBookLoaded = React.useMemo(() => walletBook.isWalletBookPopulated(walletBook$1), [walletBook$1]);
35
35
  const walletConnectorOptions$1 = React.useMemo(() => {
36
- if (!projectSettings || !walletBookLength || !networkConfigurations)
36
+ if (!projectSettings || !isWalletBookLoaded || !networkConfigurations)
37
37
  return [];
38
38
  return data.getWallets({
39
- getSupportedWalletOpts: Object.assign({ networkConfigurations, settings: projectSettings, skipMemo: true, walletBook, walletConnectorsProp: walletConnectorsProp !== null && walletConnectorsProp !== void 0 ? walletConnectorsProp : [] }, props),
39
+ getSupportedWalletOpts: Object.assign({ networkConfigurations, settings: projectSettings, skipMemo: true, walletBook: walletBook$1, walletConnectorsProp: walletConnectorsProp !== null && walletConnectorsProp !== void 0 ? walletConnectorsProp : [] }, props),
40
40
  walletConnectorExtensions,
41
41
  });
42
42
  // Cannot include walletUiUtils in the dependency array because it will cause an infinite loop
@@ -44,7 +44,7 @@ const useCreateWalletConnectorOptions = (_a) => {
44
44
  }, [
45
45
  projectSettings,
46
46
  walletConnectorsKey,
47
- walletBookLength,
47
+ isWalletBookLoaded,
48
48
  networkConfigurations,
49
49
  ]);
50
50
  React.useEffect(() => {
@@ -1,6 +1,7 @@
1
1
  'use client'
2
2
  import { __rest } from '../../../../../_virtual/_tslib.js';
3
3
  import { useMemo, useEffect } from 'react';
4
+ import { isWalletBookPopulated } from '@dynamic-labs/wallet-book';
4
5
  import { getWallets } from '../../../views/WalletList/data.js';
5
6
  import '@dynamic-labs/sdk-api-core';
6
7
  import '../../constants/values.js';
@@ -13,7 +14,6 @@ import '@dynamic-labs/iconic';
13
14
  import '@dynamic-labs/wallet-connector-core';
14
15
  import 'react/jsx-runtime';
15
16
  import '../../../context/ViewContext/ViewContext.js';
16
- import '@dynamic-labs/wallet-book';
17
17
  import '../../../store/state/loadingAndLifecycle.js';
18
18
  import '../../../shared/consts/index.js';
19
19
  import '../../../config/ApiEndpoint.js';
@@ -27,9 +27,9 @@ import { verifyRequiredConnectorsAreSetup } from './utils/verifyRequiredConnecto
27
27
  const useCreateWalletConnectorOptions = (_a) => {
28
28
  var { projectSettings, networkConfigurations, walletBook, walletConnectorsProp, walletConnectorExtensions } = _a, props = __rest(_a, ["projectSettings", "networkConfigurations", "walletBook", "walletConnectorsProp", "walletConnectorExtensions"]);
29
29
  const walletConnectorsKey = useMemo(() => { var _a; return (_a = serializeWalletConnectors(walletConnectorsProp)) === null || _a === void 0 ? void 0 : _a.join(','); }, [walletConnectorsProp]);
30
- const walletBookLength = useMemo(() => Object.keys(walletBook !== null && walletBook !== void 0 ? walletBook : {}).length, [walletBook]);
30
+ const isWalletBookLoaded = useMemo(() => isWalletBookPopulated(walletBook), [walletBook]);
31
31
  const walletConnectorOptions = useMemo(() => {
32
- if (!projectSettings || !walletBookLength || !networkConfigurations)
32
+ if (!projectSettings || !isWalletBookLoaded || !networkConfigurations)
33
33
  return [];
34
34
  return getWallets({
35
35
  getSupportedWalletOpts: Object.assign({ networkConfigurations, settings: projectSettings, skipMemo: true, walletBook, walletConnectorsProp: walletConnectorsProp !== null && walletConnectorsProp !== void 0 ? walletConnectorsProp : [] }, props),
@@ -40,7 +40,7 @@ const useCreateWalletConnectorOptions = (_a) => {
40
40
  }, [
41
41
  projectSettings,
42
42
  walletConnectorsKey,
43
- walletBookLength,
43
+ isWalletBookLoaded,
44
44
  networkConfigurations,
45
45
  ]);
46
46
  useEffect(() => {
@@ -106,6 +106,7 @@ const socialProviders = [
106
106
  'google',
107
107
  'instagram',
108
108
  'line',
109
+ 'shopify',
109
110
  'spotify',
110
111
  'tiktok',
111
112
  'telegram',
@@ -102,6 +102,7 @@ const socialProviders = [
102
102
  'google',
103
103
  'instagram',
104
104
  'line',
105
+ 'shopify',
105
106
  'spotify',
106
107
  'tiktok',
107
108
  'telegram',
@@ -94,7 +94,7 @@ const SelectWalletInWalletGroupView = () => {
94
94
  if (!selectedWalletGroup)
95
95
  throw new Error('Could not access WalletGroup view without selected group');
96
96
  const walletBookData = walletBook.getWalletGroup(walletBook$1, selectedWalletGroup === null || selectedWalletGroup === void 0 ? void 0 : selectedWalletGroup.key);
97
- return (jsxRuntime.jsx(WalletGroupViewLayout.WalletGroupViewLayout, { icon: jsxRuntime.jsx(walletBook.WalletIcon, { walletKey: walletBookData.key }), title: t('dyn_select_wallet.description', {
97
+ return (jsxRuntime.jsx(WalletGroupViewLayout.WalletGroupViewLayout, { icon: jsxRuntime.jsx(walletBook.WalletIcon, { walletKey: walletBookData.key, isGroup: true }), title: t('dyn_select_wallet.description', {
98
98
  walletName: walletBookData.name,
99
99
  }), titleCopyKey: 'dyn_select_wallet.description', children: selectedWalletGroup.groupedWallets.map((wallet, index) => (jsxRuntime.jsx(WalletGroupItem.WalletGroupItem, { groupKey: selectedWalletGroup.key, wallet: wallet, onClick: () => handleWalletItemClick(wallet) }, `${wallet.key}_${index}`))) }));
100
100
  };
@@ -90,7 +90,7 @@ const SelectWalletInWalletGroupView = () => {
90
90
  if (!selectedWalletGroup)
91
91
  throw new Error('Could not access WalletGroup view without selected group');
92
92
  const walletBookData = getWalletGroup(walletBook, selectedWalletGroup === null || selectedWalletGroup === void 0 ? void 0 : selectedWalletGroup.key);
93
- return (jsx(WalletGroupViewLayout, { icon: jsx(WalletIcon, { walletKey: walletBookData.key }), title: t('dyn_select_wallet.description', {
93
+ return (jsx(WalletGroupViewLayout, { icon: jsx(WalletIcon, { walletKey: walletBookData.key, isGroup: true }), title: t('dyn_select_wallet.description', {
94
94
  walletName: walletBookData.name,
95
95
  }), titleCopyKey: 'dyn_select_wallet.description', children: selectedWalletGroup.groupedWallets.map((wallet, index) => (jsx(WalletGroupItem, { groupKey: selectedWalletGroup.key, wallet: wallet, onClick: () => handleWalletItemClick(wallet) }, `${wallet.key}_${index}`))) }));
96
96
  };
@@ -100,7 +100,7 @@ const WalletGroupView = () => {
100
100
  .map(({ walletConnector }) => walletConnector)
101
101
  .filter((connector) => walletConnectorCore.isHardwareWalletConnector(connector) &&
102
102
  connector.canConnectWithHardwareWallet());
103
- return (jsxRuntime.jsx(WalletGroupViewLayout.WalletGroupViewLayout, { icon: jsxRuntime.jsx(walletBook.WalletIcon, { walletKey: walletBookData.key }), title: t('dyn_select_chain.description'), titleCopyKey: 'dyn_select_chain.description', children: jsxRuntime.jsxs("div", { className: 'wallet-group__list', children: [Boolean(hardwareWalletConnectors.length) && (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(HardwareWalletToggle.HardwareWalletToggle, { connectors: hardwareWalletConnectors, copykey: 'dyn_select_chain.using_hardware_wallet_toggle_label', label: t('dyn_select_chain.using_hardware_wallet_toggle_label') }), jsxRuntime.jsx(Divider.Divider, {})] })), jsxRuntime.jsx("div", { className: 'wallet-group-view-layout__list', children: selectedWalletGroup.groupedWallets.map((wallet, index) => (jsxRuntime.jsx(WalletGroupItem.WalletGroupItem, { wallet: wallet, onClick: () => handleWalletItemClick(wallet) }, `${wallet.key}_${index}`))) })] }) }));
103
+ return (jsxRuntime.jsx(WalletGroupViewLayout.WalletGroupViewLayout, { icon: jsxRuntime.jsx(walletBook.WalletIcon, { walletKey: walletBookData.key, isGroup: true }), title: t('dyn_select_chain.description'), titleCopyKey: 'dyn_select_chain.description', children: jsxRuntime.jsxs("div", { className: 'wallet-group__list', children: [Boolean(hardwareWalletConnectors.length) && (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(HardwareWalletToggle.HardwareWalletToggle, { connectors: hardwareWalletConnectors, copykey: 'dyn_select_chain.using_hardware_wallet_toggle_label', label: t('dyn_select_chain.using_hardware_wallet_toggle_label') }), jsxRuntime.jsx(Divider.Divider, {})] })), jsxRuntime.jsx("div", { className: 'wallet-group-view-layout__list', children: selectedWalletGroup.groupedWallets.map((wallet, index) => (jsxRuntime.jsx(WalletGroupItem.WalletGroupItem, { wallet: wallet, onClick: () => handleWalletItemClick(wallet) }, `${wallet.key}_${index}`))) })] }) }));
104
104
  };
105
105
 
106
106
  exports.WalletGroupView = WalletGroupView;
@@ -96,7 +96,7 @@ const WalletGroupView = () => {
96
96
  .map(({ walletConnector }) => walletConnector)
97
97
  .filter((connector) => isHardwareWalletConnector(connector) &&
98
98
  connector.canConnectWithHardwareWallet());
99
- return (jsx(WalletGroupViewLayout, { icon: jsx(WalletIcon, { walletKey: walletBookData.key }), title: t('dyn_select_chain.description'), titleCopyKey: 'dyn_select_chain.description', children: jsxs("div", { className: 'wallet-group__list', children: [Boolean(hardwareWalletConnectors.length) && (jsxs(Fragment, { children: [jsx(HardwareWalletToggle, { connectors: hardwareWalletConnectors, copykey: 'dyn_select_chain.using_hardware_wallet_toggle_label', label: t('dyn_select_chain.using_hardware_wallet_toggle_label') }), jsx(Divider, {})] })), jsx("div", { className: 'wallet-group-view-layout__list', children: selectedWalletGroup.groupedWallets.map((wallet, index) => (jsx(WalletGroupItem, { wallet: wallet, onClick: () => handleWalletItemClick(wallet) }, `${wallet.key}_${index}`))) })] }) }));
99
+ return (jsx(WalletGroupViewLayout, { icon: jsx(WalletIcon, { walletKey: walletBookData.key, isGroup: true }), title: t('dyn_select_chain.description'), titleCopyKey: 'dyn_select_chain.description', children: jsxs("div", { className: 'wallet-group__list', children: [Boolean(hardwareWalletConnectors.length) && (jsxs(Fragment, { children: [jsx(HardwareWalletToggle, { connectors: hardwareWalletConnectors, copykey: 'dyn_select_chain.using_hardware_wallet_toggle_label', label: t('dyn_select_chain.using_hardware_wallet_toggle_label') }), jsx(Divider, {})] })), jsx("div", { className: 'wallet-group-view-layout__list', children: selectedWalletGroup.groupedWallets.map((wallet, index) => (jsx(WalletGroupItem, { wallet: wallet, onClick: () => handleWalletItemClick(wallet) }, `${wallet.key}_${index}`))) })] }) }));
100
100
  };
101
101
 
102
102
  export { WalletGroupView };
@@ -126,7 +126,7 @@ const WalletListItem = ({ disabled = false, wallet, onResetSearchValue, recommen
126
126
  const name = _isWalletGroup
127
127
  ? walletBook.getWalletGroup(walletBook$1, wallet.key).name
128
128
  : wallet.walletConnector.metadata.name;
129
- const leading = (jsxRuntime.jsx(walletBook.WalletIcon, { className: 'wallet-list-item__leading', icon: (_a = wallet.walletConnector) === null || _a === void 0 ? void 0 : _a.metadata.icon, walletKey: wallet.key, style: { height: pixelToRem.pixelToRem(28), width: pixelToRem.pixelToRem(28) } }));
129
+ const leading = (jsxRuntime.jsx(walletBook.WalletIcon, { className: 'wallet-list-item__leading', icon: (_a = wallet.walletConnector) === null || _a === void 0 ? void 0 : _a.metadata.icon, walletKey: wallet.key, style: { height: pixelToRem.pixelToRem(28), width: pixelToRem.pixelToRem(28) }, isGroup: _isWalletGroup }));
130
130
  const trailing = (jsxRuntime.jsx(ListTileAnimatedTrailing.ListTileAnimatedTrailing, { hoverElement:
131
131
  // eslint-disable-next-line react/jsx-wrap-multilines
132
132
  jsxRuntime.jsx(Icon.Icon, { color: 'text-tertiary', size: 'mini', children: jsxRuntime.jsx(stroke.ReactComponent, {}) }), children: labelSettings && (jsxRuntime.jsx(Badge.Badge, { dot: !labelSettings.isRecommended, variant: labelSettings.isRecommended ? 'primary' : 'secondary', text: jsxRuntime.jsx(Typography.Typography, { variant: 'body_small', children: labelSettings.label }) })) }));
@@ -122,7 +122,7 @@ const WalletListItem = ({ disabled = false, wallet, onResetSearchValue, recommen
122
122
  const name = _isWalletGroup
123
123
  ? getWalletGroup(walletBook, wallet.key).name
124
124
  : wallet.walletConnector.metadata.name;
125
- const leading = (jsx(WalletIcon, { className: 'wallet-list-item__leading', icon: (_a = wallet.walletConnector) === null || _a === void 0 ? void 0 : _a.metadata.icon, walletKey: wallet.key, style: { height: pixelToRem(28), width: pixelToRem(28) } }));
125
+ const leading = (jsx(WalletIcon, { className: 'wallet-list-item__leading', icon: (_a = wallet.walletConnector) === null || _a === void 0 ? void 0 : _a.metadata.icon, walletKey: wallet.key, style: { height: pixelToRem(28), width: pixelToRem(28) }, isGroup: _isWalletGroup }));
126
126
  const trailing = (jsx(ListTileAnimatedTrailing, { hoverElement:
127
127
  // eslint-disable-next-line react/jsx-wrap-multilines
128
128
  jsx(Icon, { color: 'text-tertiary', size: 'mini', children: jsx(SvgStroke, {}) }), children: labelSettings && (jsx(Badge, { dot: !labelSettings.isRecommended, variant: labelSettings.isRecommended ? 'primary' : 'secondary', text: jsx(Typography, { variant: 'body_small', children: labelSettings.label }) })) }));
@@ -16,6 +16,7 @@ var createWallet = require('../../shared/utils/functions/wallet/createWallet.cjs
16
16
  require('@dynamic-labs/utils');
17
17
  require('../../utils/constants/colors.cjs');
18
18
  require('../../utils/constants/values.cjs');
19
+ require('@dynamic-labs/wallet-book');
19
20
  require('../../store/state/loadingAndLifecycle.cjs');
20
21
  require('../../shared/consts/index.cjs');
21
22
 
@@ -12,6 +12,7 @@ import { createWallet } from '../../shared/utils/functions/wallet/createWallet.j
12
12
  import '@dynamic-labs/utils';
13
13
  import '../../utils/constants/colors.js';
14
14
  import '../../utils/constants/values.js';
15
+ import '@dynamic-labs/wallet-book';
15
16
  import '../../store/state/loadingAndLifecycle.js';
16
17
  import '../../shared/consts/index.js';
17
18