@dynamic-labs/sdk-react-core 4.0.0-alpha.33 → 4.0.0-alpha.34

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 (47) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/package.cjs +1 -1
  3. package/package.js +1 -1
  4. package/package.json +11 -11
  5. package/src/index.cjs +2 -1
  6. package/src/index.d.ts +1 -0
  7. package/src/index.js +1 -1
  8. package/src/lib/components/OverlayCardBase/OverlayCardBase.cjs +4 -2
  9. package/src/lib/components/OverlayCardBase/OverlayCardBase.js +5 -3
  10. package/src/lib/components/RenderView/RenderView.cjs +1 -1
  11. package/src/lib/components/RenderView/RenderView.js +1 -1
  12. package/src/lib/components/Transition/SlideInUpTransition/SlideInUpTransition.cjs +2 -2
  13. package/src/lib/components/Transition/SlideInUpTransition/SlideInUpTransition.js +2 -2
  14. package/src/lib/context/DynamicContext/DynamicContext.cjs +8 -2
  15. package/src/lib/context/DynamicContext/DynamicContext.js +8 -2
  16. package/src/lib/events/dynamicEvents.cjs +22 -0
  17. package/src/lib/events/dynamicEvents.d.ts +3 -0
  18. package/src/lib/events/dynamicEvents.js +21 -1
  19. package/src/lib/events/wallets.d.ts +4 -0
  20. package/src/lib/layout/DynamicAuthLayout/HelpContent/WalletListHelpContent/WalletListHelpContent.cjs +4 -3
  21. package/src/lib/layout/DynamicAuthLayout/HelpContent/WalletListHelpContent/WalletListHelpContent.js +5 -4
  22. package/src/lib/modals/AddNetworkModal/AddNetworkModal.cjs +3 -3
  23. package/src/lib/modals/AddNetworkModal/AddNetworkModal.d.ts +2 -1
  24. package/src/lib/modals/AddNetworkModal/AddNetworkModal.js +3 -3
  25. package/src/lib/styles/index.shadow.cjs +1 -1
  26. package/src/lib/styles/index.shadow.js +1 -1
  27. package/src/lib/utils/functions/getPlatformForConnector/getPlatformForConnector.cjs +1 -1
  28. package/src/lib/utils/functions/getPlatformForConnector/getPlatformForConnector.js +1 -1
  29. package/src/lib/utils/functions/parseWalletLinks/parseWalletLinks.d.ts +1 -1
  30. package/src/lib/utils/hooks/events/useDynamicEvents/useDynamicEvents.cjs +1 -16
  31. package/src/lib/utils/hooks/events/useDynamicEvents/useDynamicEvents.d.ts +1 -1
  32. package/src/lib/utils/hooks/events/useDynamicEvents/useDynamicEvents.js +1 -16
  33. package/src/lib/utils/hooks/useWalletConnectors/useWalletConnectors.cjs +10 -0
  34. package/src/lib/utils/hooks/useWalletConnectors/useWalletConnectors.js +11 -1
  35. package/src/lib/utils/hooks/useWalletUiUtils/useWalletUiUtils.cjs +2 -2
  36. package/src/lib/utils/hooks/useWalletUiUtils/useWalletUiUtils.js +2 -2
  37. package/src/lib/views/AddNetworkView/AddNetworkView.cjs +5 -5
  38. package/src/lib/views/AddNetworkView/AddNetworkView.d.ts +2 -1
  39. package/src/lib/views/AddNetworkView/AddNetworkView.js +5 -5
  40. package/src/lib/views/MobileWalletRedirectView/MobileWalletRedirectView.cjs +3 -5
  41. package/src/lib/views/MobileWalletRedirectView/MobileWalletRedirectView.js +4 -6
  42. package/src/lib/views/NoQrNotInstalledView/NoQrNotInstalledView.cjs +5 -6
  43. package/src/lib/views/NoQrNotInstalledView/NoQrNotInstalledView.js +6 -7
  44. package/src/lib/widgets/DynamicWidget/hooks/useWalletDownloadLinks/useWalletDownloadLinks.cjs +3 -4
  45. package/src/lib/widgets/DynamicWidget/hooks/useWalletDownloadLinks/useWalletDownloadLinks.js +3 -4
  46. package/src/lib/widgets/DynamicWidget/prompts/NoQrNotInstalledModalView/NoQrNotInstalledModalView.cjs +2 -3
  47. package/src/lib/widgets/DynamicWidget/prompts/NoQrNotInstalledModalView/NoQrNotInstalledModalView.js +4 -5
package/CHANGELOG.md CHANGED
@@ -1,4 +1,19 @@
1
1
 
2
+ ## [4.0.0-alpha.34](https://github.com/dynamic-labs/dynamic-auth/compare/v4.0.0-alpha.33...v4.0.0-alpha.34) (2024-11-20)
3
+
4
+
5
+ ### ⚠ BREAKING CHANGES
6
+
7
+ * remove `supportsSatsConnect` helper ([#7453](https://github.com/dynamic-labs/dynamic-auth/issues/7453)) ([920c63b](https://github.com/dynamic-labs/dynamic-auth/commit/920c63bbb5a38dc3d676664db512a4da539c0909))
8
+ * moved `getWalletLinks` helper from `@dynamic-labs/wallet-book` to `@dynamic-labs/wallet-connector-core` ([#7416](https://github.com/dynamic-labs/dynamic-auth/issues/7416)) ([73fdfa8](https://github.com/dynamic-labs/dynamic-auth/commit/73fdfa8a19fe4c2cca55410d5ed3cb7b5bd8cdfd))
9
+
10
+ ### Features
11
+
12
+ * allow listening to dynamic events without using a hook ([#7466](https://github.com/dynamic-labs/dynamic-auth/issues/7466)) ([3b34e1b](https://github.com/dynamic-labs/dynamic-auth/commit/3b34e1bd2737003b987887a02d0e21436e9bf908))
13
+ * emit primaryWalletChanged event when primary wallets changes ([#7464](https://github.com/dynamic-labs/dynamic-auth/issues/7464)) ([3bc6ba0](https://github.com/dynamic-labs/dynamic-auth/commit/3bc6ba055e0232bff3c6c6bb93d3d57b1dd90bc6))
14
+ * emit primaryWalletNetworkChanged event when primary wallet network changes ([#7465](https://github.com/dynamic-labs/dynamic-auth/issues/7465)) ([33cc629](https://github.com/dynamic-labs/dynamic-auth/commit/33cc629d3c6a03c381b7e5591a8f4557987cc6fc))
15
+
16
+
2
17
  ## [4.0.0-alpha.33](https://github.com/dynamic-labs/dynamic-auth/compare/v4.0.0-alpha.32...v4.0.0-alpha.33) (2024-11-18)
3
18
 
4
19
 
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.33";
6
+ var version = "4.0.0-alpha.34";
7
7
  var dependencies = {
8
8
  "@dynamic-labs/sdk-api-core": "0.0.565",
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.33";
2
+ var version = "4.0.0-alpha.34";
3
3
  var dependencies = {
4
4
  "@dynamic-labs/sdk-api-core": "0.0.565",
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.33",
3
+ "version": "4.0.0-alpha.34",
4
4
  "dependencies": {
5
5
  "@dynamic-labs/sdk-api-core": "0.0.565",
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.33",
17
- "@dynamic-labs/iconic": "4.0.0-alpha.33",
18
- "@dynamic-labs/logger": "4.0.0-alpha.33",
19
- "@dynamic-labs/multi-wallet": "4.0.0-alpha.33",
20
- "@dynamic-labs/rpc-providers": "4.0.0-alpha.33",
21
- "@dynamic-labs/store": "4.0.0-alpha.33",
22
- "@dynamic-labs/types": "4.0.0-alpha.33",
23
- "@dynamic-labs/utils": "4.0.0-alpha.33",
24
- "@dynamic-labs/wallet-book": "4.0.0-alpha.33",
25
- "@dynamic-labs/wallet-connector-core": "4.0.0-alpha.33",
16
+ "@dynamic-labs/assert-package-version": "4.0.0-alpha.34",
17
+ "@dynamic-labs/iconic": "4.0.0-alpha.34",
18
+ "@dynamic-labs/logger": "4.0.0-alpha.34",
19
+ "@dynamic-labs/multi-wallet": "4.0.0-alpha.34",
20
+ "@dynamic-labs/rpc-providers": "4.0.0-alpha.34",
21
+ "@dynamic-labs/store": "4.0.0-alpha.34",
22
+ "@dynamic-labs/types": "4.0.0-alpha.34",
23
+ "@dynamic-labs/utils": "4.0.0-alpha.34",
24
+ "@dynamic-labs/wallet-book": "4.0.0-alpha.34",
25
+ "@dynamic-labs/wallet-connector-core": "4.0.0-alpha.34",
26
26
  "bs58": "5.0.0",
27
27
  "eventemitter3": "5.0.1"
28
28
  },
package/src/index.cjs CHANGED
@@ -61,7 +61,7 @@ var stroke = require('./lib/shared/assets/stroke.cjs');
61
61
  require('./lib/shared/consts/index.cjs');
62
62
  require('../_virtual/_tslib.cjs');
63
63
  require('react-dom');
64
- require('./lib/events/dynamicEvents.cjs');
64
+ var dynamicEvents = require('./lib/events/dynamicEvents.cjs');
65
65
  var api = require('./lib/data/api/api.cjs');
66
66
  require('@dynamic-labs/multi-wallet');
67
67
  require('react-international-phone');
@@ -213,6 +213,7 @@ exports.LogoutIcon = logout.ReactComponent;
213
213
  exports.PencilIcon = pencil.ReactComponent;
214
214
  exports.SpinnerIcon = spinner.ReactComponent;
215
215
  exports.ArrowIcon = stroke.ReactComponent;
216
+ exports.dynamicEvents = dynamicEvents.publicDynamicEvents;
216
217
  exports.apiClient = api.sdkApi;
217
218
  exports.mergeNetworks = mergeNetworks.mergeNetworks;
218
219
  exports.isAuthenticatedWithAWallet = isAuthenticatedWithAWallet.isAuthenticatedWithAWallet;
package/src/index.d.ts CHANGED
@@ -98,6 +98,7 @@ export type { EvmNetwork, PhoneData, OtpDestination, UserProfile,
98
98
  AuthOptions as AuthOption, AuthOptions,
99
99
  /** @deprecated use AuthMethod instead */
100
100
  AuthMethod as AuthType, AuthMethod, } from '@dynamic-labs/types';
101
+ export { publicDynamicEvents as dynamicEvents } from './lib/events/dynamicEvents';
101
102
  export { mergeNetworks } from './lib/utils/functions/mergeNetworks';
102
103
  export {
103
104
  /** @deprecated use https://www.npmjs.com/package/classnames */
package/src/index.js CHANGED
@@ -57,7 +57,7 @@ export { ReactComponent as ArrowIcon } from './lib/shared/assets/stroke.js';
57
57
  import './lib/shared/consts/index.js';
58
58
  import '../_virtual/_tslib.js';
59
59
  import 'react-dom';
60
- import './lib/events/dynamicEvents.js';
60
+ export { publicDynamicEvents as dynamicEvents } from './lib/events/dynamicEvents.js';
61
61
  export { sdkApi as apiClient } from './lib/data/api/api.js';
62
62
  import '@dynamic-labs/multi-wallet';
63
63
  import 'react-international-phone';
@@ -92,9 +92,11 @@ const OverlayCardBase = ({ isOpen, children, onClickOverlay, style, className, }
92
92
  usePreventPageScroll.usePreventPageScroll(isOpen && !target);
93
93
  const contentRef = React.useRef(null);
94
94
  index.useOnClickOutside(contentRef, () => onClickOverlay === null || onClickOverlay === void 0 ? void 0 : onClickOverlay());
95
- const content = (jsxRuntime.jsxs("div", { className: classNames.classNames('overlay-card-base', {
95
+ const opacityTransition = (jsxRuntime.jsx(OpacityTransition.OpacityTransition, { className: 'overlay-card-base__animation' }));
96
+ const slideTransition = (jsxRuntime.jsx(SlideInUpTransition.SlideInUpTransition, { className: 'overlay-card-base__animation' }));
97
+ const content = (jsxRuntime.jsx("div", { className: classNames.classNames('overlay-card-base', {
96
98
  'overlay-card-base--disabled': !isOpen,
97
- }), style: { position: target === undefined ? 'fixed' : 'absolute' }, children: [jsxRuntime.jsx(AnimatePresence.AnimatePresence, { animationComponent: jsxRuntime.jsx(OpacityTransition.OpacityTransition, { className: 'overlay-card-base__animation' }), children: isOpen && (jsxRuntime.jsx("div", { onClick: onClickOverlay, className: 'overlay-card-base__overlay' })) }), jsxRuntime.jsx(AnimatePresence.AnimatePresence, { animationComponent: jsxRuntime.jsx(SlideInUpTransition.SlideInUpTransition, { className: 'overlay-card-base__animation overlay-card-base__animation--limit-height' }), children: isOpen && (jsxRuntime.jsx(AnimatePresence.AnimatePresence, { animationComponent: jsxRuntime.jsx(OpacityTransition.OpacityTransition, { className: 'overlay-card-base__animation' }), children: jsxRuntime.jsx("div", { ref: contentRef, className: classNames.classNames('overlay-card-base__content', className), style: style, children: children }) })) })] }));
99
+ }), style: { position: target === undefined ? 'fixed' : 'absolute' }, children: isOpen && (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(AnimatePresence.AnimatePresence, { animationComponent: opacityTransition, children: jsxRuntime.jsx("div", { onClick: onClickOverlay, className: 'overlay-card-base__overlay' }) }), jsxRuntime.jsx("div", { className: 'overlay-card-base__content-wrapper', children: jsxRuntime.jsx(AnimatePresence.AnimatePresence, { animationComponent: slideTransition, children: jsxRuntime.jsx("div", { ref: contentRef, className: classNames.classNames('overlay-card-base__content', className), style: style, children: children }) }) })] })) }));
98
100
  if (target)
99
101
  return reactDom.createPortal(content, target);
100
102
  return reactDom.createPortal(jsxRuntime.jsx(ShadowDOM.ShadowDOM, { children: content }), document.body);
@@ -1,5 +1,5 @@
1
1
  'use client'
2
- import { jsxs, jsx } from 'react/jsx-runtime';
2
+ import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
3
3
  import { useRef } from 'react';
4
4
  import { createPortal } from 'react-dom';
5
5
  import '@dynamic-labs/sdk-api-core';
@@ -88,9 +88,11 @@ const OverlayCardBase = ({ isOpen, children, onClickOverlay, style, className, }
88
88
  usePreventPageScroll(isOpen && !target);
89
89
  const contentRef = useRef(null);
90
90
  useOnClickOutside(contentRef, () => onClickOverlay === null || onClickOverlay === void 0 ? void 0 : onClickOverlay());
91
- const content = (jsxs("div", { className: classNames('overlay-card-base', {
91
+ const opacityTransition = (jsx(OpacityTransition, { className: 'overlay-card-base__animation' }));
92
+ const slideTransition = (jsx(SlideInUpTransition, { className: 'overlay-card-base__animation' }));
93
+ const content = (jsx("div", { className: classNames('overlay-card-base', {
92
94
  'overlay-card-base--disabled': !isOpen,
93
- }), style: { position: target === undefined ? 'fixed' : 'absolute' }, children: [jsx(AnimatePresence, { animationComponent: jsx(OpacityTransition, { className: 'overlay-card-base__animation' }), children: isOpen && (jsx("div", { onClick: onClickOverlay, className: 'overlay-card-base__overlay' })) }), jsx(AnimatePresence, { animationComponent: jsx(SlideInUpTransition, { className: 'overlay-card-base__animation overlay-card-base__animation--limit-height' }), children: isOpen && (jsx(AnimatePresence, { animationComponent: jsx(OpacityTransition, { className: 'overlay-card-base__animation' }), children: jsx("div", { ref: contentRef, className: classNames('overlay-card-base__content', className), style: style, children: children }) })) })] }));
95
+ }), style: { position: target === undefined ? 'fixed' : 'absolute' }, children: isOpen && (jsxs(Fragment, { children: [jsx(AnimatePresence, { animationComponent: opacityTransition, children: jsx("div", { onClick: onClickOverlay, className: 'overlay-card-base__overlay' }) }), jsx("div", { className: 'overlay-card-base__content-wrapper', children: jsx(AnimatePresence, { animationComponent: slideTransition, children: jsx("div", { ref: contentRef, className: classNames('overlay-card-base__content', className), style: style, children: children }) }) })] })) }));
94
96
  if (target)
95
97
  return createPortal(content, target);
96
98
  return createPortal(jsx(ShadowDOM, { children: content }), document.body);
@@ -7,6 +7,7 @@ var jsxRuntime = require('react/jsx-runtime');
7
7
  var ViewContext = require('../../context/ViewContext/ViewContext.cjs');
8
8
  require('react-i18next');
9
9
  require('@dynamic-labs/wallet-book');
10
+ require('@dynamic-labs/wallet-connector-core');
10
11
  require('../Accordion/components/AccordionItem/AccordionItem.cjs');
11
12
  require('../Alert/Alert.cjs');
12
13
  require('react');
@@ -17,7 +18,6 @@ require('../../context/DynamicContext/DynamicContext.cjs');
17
18
  require('@dynamic-labs/sdk-api-core');
18
19
  require('../../shared/logger.cjs');
19
20
  require('@dynamic-labs/iconic');
20
- require('@dynamic-labs/wallet-connector-core');
21
21
  require('../../utils/constants/colors.cjs');
22
22
  require('../../utils/constants/values.cjs');
23
23
  require('../../store/state/loadingAndLifecycle.cjs');
@@ -3,6 +3,7 @@ import { jsx } from 'react/jsx-runtime';
3
3
  import { useViewContext } from '../../context/ViewContext/ViewContext.js';
4
4
  import 'react-i18next';
5
5
  import '@dynamic-labs/wallet-book';
6
+ import '@dynamic-labs/wallet-connector-core';
6
7
  import '../Accordion/components/AccordionItem/AccordionItem.js';
7
8
  import '../Alert/Alert.js';
8
9
  import 'react';
@@ -13,7 +14,6 @@ import '../../context/DynamicContext/DynamicContext.js';
13
14
  import '@dynamic-labs/sdk-api-core';
14
15
  import '../../shared/logger.js';
15
16
  import '@dynamic-labs/iconic';
16
- import '@dynamic-labs/wallet-connector-core';
17
17
  import '../../utils/constants/colors.js';
18
18
  import '../../utils/constants/values.js';
19
19
  import '../../store/state/loadingAndLifecycle.js';
@@ -20,10 +20,10 @@ const transitionStyles = {
20
20
  transform: 'translateY(0)',
21
21
  },
22
22
  ENTERING: {
23
- transform: 'translateY(0.625rem)',
23
+ transform: 'translateY(50vh)',
24
24
  },
25
25
  EXITING: {
26
- transform: 'translateY(0.625rem)',
26
+ transform: 'translateY(50vh)',
27
27
  },
28
28
  };
29
29
  const UnoptimizedSlideInUpTransition = (_a) => {
@@ -12,10 +12,10 @@ const transitionStyles = {
12
12
  transform: 'translateY(0)',
13
13
  },
14
14
  ENTERING: {
15
- transform: 'translateY(0.625rem)',
15
+ transform: 'translateY(50vh)',
16
16
  },
17
17
  EXITING: {
18
- transform: 'translateY(0.625rem)',
18
+ transform: 'translateY(50vh)',
19
19
  },
20
20
  };
21
21
  const UnoptimizedSlideInUpTransition = (_a) => {
@@ -15,7 +15,7 @@ var walletConnectorCore = require('@dynamic-labs/wallet-connector-core');
15
15
  var app = require('../../app.cjs');
16
16
  require('../../components/Accordion/components/AccordionItem/AccordionItem.cjs');
17
17
  require('../../components/Alert/Alert.cjs');
18
- require('../../events/dynamicEvents.cjs');
18
+ var dynamicEvents = require('../../events/dynamicEvents.cjs');
19
19
  require('@dynamic-labs/sdk-api-core');
20
20
  var logger$1 = require('../../shared/logger.cjs');
21
21
  var ViewContext = require('../ViewContext/ViewContext.cjs');
@@ -393,7 +393,13 @@ const InnerDynamicContextProvider = ({ children, theme, settings: settings$1, lo
393
393
  secondaryWallets,
394
394
  verifiedCredentials: (user$1 === null || user$1 === void 0 ? void 0 : user$1.verifiedCredentials) || [],
395
395
  });
396
- const { isLoading: loadingNetwork, network } = useWalletConnectorNetwork.useWalletConnectorNetwork(primaryWallet === null || primaryWallet === void 0 ? void 0 : primaryWallet.connector);
396
+ const { isLoading: loadingNetwork, network } = useWalletConnectorNetwork.useWalletConnectorNetwork(primaryWallet === null || primaryWallet === void 0 ? void 0 : primaryWallet.connector, {
397
+ onChange: (newNetwork) => {
398
+ if (newNetwork) {
399
+ dynamicEvents.dynamicEvents.emit('primaryWalletNetworkChanged', newNetwork);
400
+ }
401
+ },
402
+ });
397
403
  useWalletEventListeners.useWalletEventListeners({
398
404
  authMode,
399
405
  detectNewWalletsForLinking,
@@ -11,7 +11,7 @@ import { setChainInfoOverrides, logger as logger$1, isSessionKeyCompatibleWallet
11
11
  import { DynamicAuthFlow } from '../../app.js';
12
12
  import '../../components/Accordion/components/AccordionItem/AccordionItem.js';
13
13
  import '../../components/Alert/Alert.js';
14
- import '../../events/dynamicEvents.js';
14
+ import { dynamicEvents } from '../../events/dynamicEvents.js';
15
15
  import '@dynamic-labs/sdk-api-core';
16
16
  import { logger } from '../../shared/logger.js';
17
17
  import { ViewContextProvider } from '../ViewContext/ViewContext.js';
@@ -389,7 +389,13 @@ const InnerDynamicContextProvider = ({ children, theme, settings, locale, enable
389
389
  secondaryWallets,
390
390
  verifiedCredentials: (user === null || user === void 0 ? void 0 : user.verifiedCredentials) || [],
391
391
  });
392
- const { isLoading: loadingNetwork, network } = useWalletConnectorNetwork(primaryWallet === null || primaryWallet === void 0 ? void 0 : primaryWallet.connector);
392
+ const { isLoading: loadingNetwork, network } = useWalletConnectorNetwork(primaryWallet === null || primaryWallet === void 0 ? void 0 : primaryWallet.connector, {
393
+ onChange: (newNetwork) => {
394
+ if (newNetwork) {
395
+ dynamicEvents.emit('primaryWalletNetworkChanged', newNetwork);
396
+ }
397
+ },
398
+ });
393
399
  useWalletEventListeners({
394
400
  authMode,
395
401
  detectNewWalletsForLinking,
@@ -9,6 +9,28 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
9
9
 
10
10
  var EventEmitter__default = /*#__PURE__*/_interopDefaultLegacy(EventEmitter);
11
11
 
12
+ // ATTENTION
13
+ // Everything below should be made public soon, but we need to plan this out first
14
+ // Main issues:
15
+ // 1. How should we map customer callback names to our dynamic event names?
16
+ // -> Gui's suggestion: breaking change to rename customer callbacks so they fit these events names
17
+ // 2. We would have to remove these callbacks from the useCustomerCallbacks hook
18
+ /** Which events are accessible by our clients */
19
+ const externalEvents = [
20
+ 'emailVerificationResult',
21
+ 'embeddedWalletCreated',
22
+ 'logout',
23
+ 'walletAdded',
24
+ 'primaryWalletChanged',
25
+ 'primaryWalletNetworkChanged',
26
+ 'mfaCompletionSuccess',
27
+ 'mfaCompletionFailure',
28
+ ];
29
+ // Full internal event emitter
12
30
  const dynamicEvents = new EventEmitter__default["default"]();
31
+ // Limited public event emitter with subset of events
32
+ const publicDynamicEvents = dynamicEvents;
13
33
 
14
34
  exports.dynamicEvents = dynamicEvents;
35
+ exports.externalEvents = externalEvents;
36
+ exports.publicDynamicEvents = publicDynamicEvents;
@@ -10,5 +10,8 @@ import { MultiWalletInternalEvents } from './multiWallet';
10
10
  import { tokenBalancesEvents } from './tokenBalances';
11
11
  /** Maps internal event names to their listeners */
12
12
  export type DynamicEvents = AuthEvents & UIEvents & OTPEvents & WalletEvents & PasskeyEvents & SocialEvents & EmbeddedWalletEvents & MultiWalletInternalEvents & tokenBalancesEvents;
13
+ /** Which events are accessible by our clients */
14
+ export declare const externalEvents: ("logout" | "mfaCompletionSuccess" | "mfaCompletionFailure" | "emailVerificationResult" | "walletAdded" | "primaryWalletChanged" | "primaryWalletNetworkChanged" | "embeddedWalletCreated")[];
13
15
  export declare const dynamicEvents: EventEmitter<DynamicEvents, any>;
16
+ export declare const publicDynamicEvents: EventEmitter<"logout" | "mfaCompletionSuccess" | "mfaCompletionFailure" | "emailVerificationResult" | "walletAdded" | "primaryWalletChanged" | "primaryWalletNetworkChanged" | "embeddedWalletCreated", any>;
14
17
  export type DynamicEventEmitter = typeof dynamicEvents;
@@ -1,6 +1,26 @@
1
1
  'use client'
2
2
  import EventEmitter from 'eventemitter3';
3
3
 
4
+ // ATTENTION
5
+ // Everything below should be made public soon, but we need to plan this out first
6
+ // Main issues:
7
+ // 1. How should we map customer callback names to our dynamic event names?
8
+ // -> Gui's suggestion: breaking change to rename customer callbacks so they fit these events names
9
+ // 2. We would have to remove these callbacks from the useCustomerCallbacks hook
10
+ /** Which events are accessible by our clients */
11
+ const externalEvents = [
12
+ 'emailVerificationResult',
13
+ 'embeddedWalletCreated',
14
+ 'logout',
15
+ 'walletAdded',
16
+ 'primaryWalletChanged',
17
+ 'primaryWalletNetworkChanged',
18
+ 'mfaCompletionSuccess',
19
+ 'mfaCompletionFailure',
20
+ ];
21
+ // Full internal event emitter
4
22
  const dynamicEvents = new EventEmitter();
23
+ // Limited public event emitter with subset of events
24
+ const publicDynamicEvents = dynamicEvents;
5
25
 
6
- export { dynamicEvents };
26
+ export { dynamicEvents, externalEvents, publicDynamicEvents };
@@ -4,4 +4,8 @@ export type WalletEvents = {
4
4
  walletAdded: (wallet: Wallet, userWallets: Wallet[]) => void;
5
5
  /** Triggered when a wallet is removed from user wallets list */
6
6
  walletRemoved: (wallet: Wallet, userWallets: Wallet[]) => void;
7
+ /** Triggered when the primary wallet changes (a different wallet is selected) */
8
+ primaryWalletChanged: (newPrimaryWallet: Wallet) => void;
9
+ /** Triggered when the network changes in primary wallet */
10
+ primaryWalletNetworkChanged: (newNetwork: string | number) => void;
7
11
  };
@@ -8,10 +8,10 @@ var React = require('react');
8
8
  var iconic = require('@dynamic-labs/iconic');
9
9
  var walletBook = require('@dynamic-labs/wallet-book');
10
10
  var utils = require('@dynamic-labs/utils');
11
+ var walletConnectorCore = require('@dynamic-labs/wallet-connector-core');
11
12
  require('../../../../context/DynamicContext/DynamicContext.cjs');
12
13
  require('@dynamic-labs/sdk-api-core');
13
14
  require('../../../../shared/logger.cjs');
14
- require('@dynamic-labs/wallet-connector-core');
15
15
  require('../../../../context/ViewContext/ViewContext.cjs');
16
16
  var puzzle = require('../../../../shared/assets/puzzle.cjs');
17
17
  var index = require('../../../../shared/utils/functions/getValueByKey/index.cjs');
@@ -102,7 +102,8 @@ const WalletListHelpContent = ({ chains, newToWeb3WalletChainMap, }) => {
102
102
  const walletKey = index.getValueByKey(newToWeb3WalletChainMap === null || newToWeb3WalletChainMap === void 0 ? void 0 : newToWeb3WalletChainMap.wallets, chainName);
103
103
  const newToWeb3Wallet = walletConnectorOptions.find((wallet) => wallet.key === walletKey);
104
104
  const isCustodialServiceWallet = newToWeb3Wallet === null || newToWeb3Wallet === void 0 ? void 0 : newToWeb3Wallet.walletConnector.canConnectViaCustodialService;
105
- const links = walletBook.getWalletLinks(walletBook$1, walletKey);
105
+ const metadata = newToWeb3Wallet === null || newToWeb3Wallet === void 0 ? void 0 : newToWeb3Wallet.walletConnector.metadata;
106
+ const links = walletConnectorCore.getWalletLinks(metadata === null || metadata === void 0 ? void 0 : metadata.downloadLinks);
106
107
  const { currentDesktopUrl, canShowAndroidAppButton, canShowIosAppButton } = parseWalletLinks.parseWalletLinks(links);
107
108
  const walletLinksElements = [
108
109
  {
@@ -127,7 +128,7 @@ const WalletListHelpContent = ({ chains, newToWeb3WalletChainMap, }) => {
127
128
  if (!Object.keys((_b = walletBook$1 === null || walletBook$1 === void 0 ? void 0 : walletBook$1.wallets) !== null && _b !== void 0 ? _b : {}).length) {
128
129
  return jsxRuntime.jsx(Skeleton.Skeleton, { className: 'walletlist-footer-content__container' });
129
130
  }
130
- 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: newToWeb3Wallet === null || newToWeb3Wallet === void 0 ? void 0 : newToWeb3Wallet.walletConnector.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", ' ', walletBook.getWalletBookWallet(walletBook$1, walletKey).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 })] }) }));
131
+ 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 })] }) }));
131
132
  };
132
133
 
133
134
  exports.WalletListHelpContent = WalletListHelpContent;
@@ -2,12 +2,12 @@
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, getWalletLinks, WalletIcon, getWalletBookWallet } from '@dynamic-labs/wallet-book';
5
+ import { useWalletBookContext, WalletIcon } from '@dynamic-labs/wallet-book';
6
6
  import { isMobile } from '@dynamic-labs/utils';
7
+ import { getWalletLinks } from '@dynamic-labs/wallet-connector-core';
7
8
  import '../../../../context/DynamicContext/DynamicContext.js';
8
9
  import '@dynamic-labs/sdk-api-core';
9
10
  import '../../../../shared/logger.js';
10
- import '@dynamic-labs/wallet-connector-core';
11
11
  import '../../../../context/ViewContext/ViewContext.js';
12
12
  import { ReactComponent as SvgPuzzle } from '../../../../shared/assets/puzzle.js';
13
13
  import { getValueByKey } from '../../../../shared/utils/functions/getValueByKey/index.js';
@@ -98,7 +98,8 @@ const WalletListHelpContent = ({ chains, newToWeb3WalletChainMap, }) => {
98
98
  const walletKey = getValueByKey(newToWeb3WalletChainMap === null || newToWeb3WalletChainMap === void 0 ? void 0 : newToWeb3WalletChainMap.wallets, chainName);
99
99
  const newToWeb3Wallet = walletConnectorOptions.find((wallet) => wallet.key === walletKey);
100
100
  const isCustodialServiceWallet = newToWeb3Wallet === null || newToWeb3Wallet === void 0 ? void 0 : newToWeb3Wallet.walletConnector.canConnectViaCustodialService;
101
- const links = getWalletLinks(walletBook, walletKey);
101
+ const metadata = newToWeb3Wallet === null || newToWeb3Wallet === void 0 ? void 0 : newToWeb3Wallet.walletConnector.metadata;
102
+ const links = getWalletLinks(metadata === null || metadata === void 0 ? void 0 : metadata.downloadLinks);
102
103
  const { currentDesktopUrl, canShowAndroidAppButton, canShowIosAppButton } = parseWalletLinks(links);
103
104
  const walletLinksElements = [
104
105
  {
@@ -123,7 +124,7 @@ const WalletListHelpContent = ({ chains, newToWeb3WalletChainMap, }) => {
123
124
  if (!Object.keys((_b = walletBook === null || walletBook === void 0 ? void 0 : walletBook.wallets) !== null && _b !== void 0 ? _b : {}).length) {
124
125
  return jsx(Skeleton, { className: 'walletlist-footer-content__container' });
125
126
  }
126
- 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: newToWeb3Wallet === null || newToWeb3Wallet === void 0 ? void 0 : newToWeb3Wallet.walletConnector.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", ' ', getWalletBookWallet(walletBook, walletKey).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 })] }) }));
127
+ 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 })] }) }));
127
128
  };
128
129
 
129
130
  export { WalletListHelpContent };
@@ -8,6 +8,7 @@ var ConfirmationModal = require('../ConfirmationModal/ConfirmationModal.cjs');
8
8
  var useConfirmationPortal = require('../../utils/hooks/useConfirmationPortal/useConfirmationPortal.cjs');
9
9
  require('react-i18next');
10
10
  require('@dynamic-labs/wallet-book');
11
+ require('@dynamic-labs/wallet-connector-core');
11
12
  require('../../components/Accordion/components/AccordionItem/AccordionItem.cjs');
12
13
  require('../../components/Alert/Alert.cjs');
13
14
  require('react');
@@ -18,7 +19,6 @@ require('../../context/DynamicContext/DynamicContext.cjs');
18
19
  require('@dynamic-labs/sdk-api-core');
19
20
  require('../../shared/logger.cjs');
20
21
  require('@dynamic-labs/iconic');
21
- require('@dynamic-labs/wallet-connector-core');
22
22
  require('../../context/ViewContext/ViewContext.cjs');
23
23
  require('../../utils/constants/colors.cjs');
24
24
  require('../../utils/constants/values.cjs');
@@ -85,7 +85,7 @@ require('../../context/IpConfigurationContext/IpConfigurationContext.cjs');
85
85
  require('../../widgets/DynamicBridgeWidget/views/WalletsView/components/SecondaryWallets/SecondaryWallets.cjs');
86
86
  require('@hcaptcha/react-hcaptcha');
87
87
 
88
- const AddNetworkModal = ({ walletKey, network, onCancel, onNetworkAdded, addNetworkMutation, }) => {
88
+ const AddNetworkModal = ({ walletConnector, network, onCancel, onNetworkAdded, addNetworkMutation, }) => {
89
89
  const { onSuccess, show, handleOnModalUnmount, closeModal } = useConfirmationPortal.useConfirmationPortal({
90
90
  defaultErrorMessage: 'User canceled',
91
91
  onReject: onCancel,
@@ -93,7 +93,7 @@ const AddNetworkModal = ({ walletKey, network, onCancel, onNetworkAdded, addNetw
93
93
  });
94
94
  return (jsxRuntime.jsx(ConfirmationModal.ConfirmationModal, { modalId: 'prompt-to-add-network', show: show,
95
95
  // Disables the closing by clicking outside the modal
96
- closeModal: () => { }, handleOnModalUnmount: handleOnModalUnmount, children: jsxRuntime.jsx(AddNetworkView.AddNetworkView, { walletKey: walletKey, addNetworkMutation: addNetworkMutation, network: network, onCancel: closeModal, onNetworkAdded: onSuccess }) }));
96
+ closeModal: () => { }, handleOnModalUnmount: handleOnModalUnmount, children: jsxRuntime.jsx(AddNetworkView.AddNetworkView, { walletConnector: walletConnector, addNetworkMutation: addNetworkMutation, network: network, onCancel: closeModal, onNetworkAdded: onSuccess }) }));
97
97
  };
98
98
 
99
99
  exports.AddNetworkModal = AddNetworkModal;
@@ -1,7 +1,8 @@
1
1
  import { FC } from 'react';
2
2
  import { GenericNetwork } from '@dynamic-labs/types';
3
+ import { InternalWalletConnector } from '@dynamic-labs/wallet-connector-core';
3
4
  type AddNetworkModalProps = {
4
- walletKey: string;
5
+ walletConnector: InternalWalletConnector;
5
6
  network: GenericNetwork;
6
7
  onCancel: () => void;
7
8
  onNetworkAdded: () => void;
@@ -4,6 +4,7 @@ import { ConfirmationModal } from '../ConfirmationModal/ConfirmationModal.js';
4
4
  import { useConfirmationPortal } from '../../utils/hooks/useConfirmationPortal/useConfirmationPortal.js';
5
5
  import 'react-i18next';
6
6
  import '@dynamic-labs/wallet-book';
7
+ import '@dynamic-labs/wallet-connector-core';
7
8
  import '../../components/Accordion/components/AccordionItem/AccordionItem.js';
8
9
  import '../../components/Alert/Alert.js';
9
10
  import 'react';
@@ -14,7 +15,6 @@ import '../../context/DynamicContext/DynamicContext.js';
14
15
  import '@dynamic-labs/sdk-api-core';
15
16
  import '../../shared/logger.js';
16
17
  import '@dynamic-labs/iconic';
17
- import '@dynamic-labs/wallet-connector-core';
18
18
  import '../../context/ViewContext/ViewContext.js';
19
19
  import '../../utils/constants/colors.js';
20
20
  import '../../utils/constants/values.js';
@@ -81,7 +81,7 @@ import '../../context/IpConfigurationContext/IpConfigurationContext.js';
81
81
  import '../../widgets/DynamicBridgeWidget/views/WalletsView/components/SecondaryWallets/SecondaryWallets.js';
82
82
  import '@hcaptcha/react-hcaptcha';
83
83
 
84
- const AddNetworkModal = ({ walletKey, network, onCancel, onNetworkAdded, addNetworkMutation, }) => {
84
+ const AddNetworkModal = ({ walletConnector, network, onCancel, onNetworkAdded, addNetworkMutation, }) => {
85
85
  const { onSuccess, show, handleOnModalUnmount, closeModal } = useConfirmationPortal({
86
86
  defaultErrorMessage: 'User canceled',
87
87
  onReject: onCancel,
@@ -89,7 +89,7 @@ const AddNetworkModal = ({ walletKey, network, onCancel, onNetworkAdded, addNetw
89
89
  });
90
90
  return (jsx(ConfirmationModal, { modalId: 'prompt-to-add-network', show: show,
91
91
  // Disables the closing by clicking outside the modal
92
- closeModal: () => { }, handleOnModalUnmount: handleOnModalUnmount, children: jsx(AddNetworkView, { walletKey: walletKey, addNetworkMutation: addNetworkMutation, network: network, onCancel: closeModal, onNetworkAdded: onSuccess }) }));
92
+ closeModal: () => { }, handleOnModalUnmount: handleOnModalUnmount, children: jsx(AddNetworkView, { walletConnector: walletConnector, addNetworkMutation: addNetworkMutation, network: network, onCancel: closeModal, onNetworkAdded: onSuccess }) }));
93
93
  };
94
94
 
95
95
  export { AddNetworkModal };