@dynamic-labs/sdk-react-core 3.0.0-alpha.19 → 3.0.0-alpha.20

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 CHANGED
@@ -1,4 +1,11 @@
1
1
 
2
+ ## [3.0.0-alpha.20](https://github.com/dynamic-labs/DynamicAuth/compare/v3.0.0-alpha.19...v3.0.0-alpha.20) (2024-07-15)
3
+
4
+
5
+ ### Bug Fixes
6
+
7
+ * show/hide confirmation ui for aa session key wallets ([#6334](https://github.com/dynamic-labs/DynamicAuth/issues/6334)) ([6e17162](https://github.com/dynamic-labs/DynamicAuth/commit/6e17162e31915620b622f3ec5b4f8b7087f1728c))
8
+
2
9
  ## [3.0.0-alpha.19](https://github.com/dynamic-labs/DynamicAuth/compare/v3.0.0-alpha.18...v3.0.0-alpha.19) (2024-07-13)
3
10
 
4
11
  ## [3.0.0-alpha.18](https://github.com/dynamic-labs/DynamicAuth/compare/v3.0.0-alpha.17...v3.0.0-alpha.18) (2024-07-12)
package/package.cjs CHANGED
@@ -3,7 +3,7 @@
3
3
 
4
4
  Object.defineProperty(exports, '__esModule', { value: true });
5
5
 
6
- var version = "3.0.0-alpha.19";
6
+ var version = "3.0.0-alpha.20";
7
7
  var dependencies = {
8
8
  "@dynamic-labs/sdk-api-core": "0.0.470",
9
9
  "@hcaptcha/react-hcaptcha": "1.4.4",
package/package.js CHANGED
@@ -1,5 +1,5 @@
1
1
  'use client'
2
- var version = "3.0.0-alpha.19";
2
+ var version = "3.0.0-alpha.20";
3
3
  var dependencies = {
4
4
  "@dynamic-labs/sdk-api-core": "0.0.470",
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": "3.0.0-alpha.19",
3
+ "version": "3.0.0-alpha.20",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/dynamic-labs/dynamic-auth.git",
@@ -17,15 +17,15 @@
17
17
  "react-i18next": "13.5.0",
18
18
  "yup": "0.32.11",
19
19
  "react-international-phone": "4.2.5",
20
- "@dynamic-labs/iconic": "3.0.0-alpha.19",
21
- "@dynamic-labs/logger": "3.0.0-alpha.19",
22
- "@dynamic-labs/multi-wallet": "3.0.0-alpha.19",
23
- "@dynamic-labs/rpc-providers": "3.0.0-alpha.19",
24
- "@dynamic-labs/store": "3.0.0-alpha.19",
25
- "@dynamic-labs/types": "3.0.0-alpha.19",
26
- "@dynamic-labs/utils": "3.0.0-alpha.19",
27
- "@dynamic-labs/wallet-book": "3.0.0-alpha.19",
28
- "@dynamic-labs/wallet-connector-core": "3.0.0-alpha.19",
20
+ "@dynamic-labs/iconic": "3.0.0-alpha.20",
21
+ "@dynamic-labs/logger": "3.0.0-alpha.20",
22
+ "@dynamic-labs/multi-wallet": "3.0.0-alpha.20",
23
+ "@dynamic-labs/rpc-providers": "3.0.0-alpha.20",
24
+ "@dynamic-labs/store": "3.0.0-alpha.20",
25
+ "@dynamic-labs/types": "3.0.0-alpha.20",
26
+ "@dynamic-labs/utils": "3.0.0-alpha.20",
27
+ "@dynamic-labs/wallet-book": "3.0.0-alpha.20",
28
+ "@dynamic-labs/wallet-connector-core": "3.0.0-alpha.20",
29
29
  "eventemitter3": "5.0.1"
30
30
  },
31
31
  "devDependencies": {
package/src/index.cjs CHANGED
@@ -32,6 +32,7 @@ require('./lib/utils/constants/colors.cjs');
32
32
  require('./lib/utils/constants/values.cjs');
33
33
  var localStorage = require('./lib/shared/utils/classes/storage/localStorage.cjs');
34
34
  require('./lib/shared/utils/classes/storage/sessionStorage.cjs');
35
+ require('@dynamic-labs/wallet-connector-core');
35
36
  var useLocalStorage = require('./lib/shared/utils/hooks/useLocalStorage/useLocalStorage.cjs');
36
37
  var index$1 = require('./lib/shared/utils/hooks/useOnClickOutside/index.cjs');
37
38
  require('@dynamic-labs/utils');
@@ -58,7 +59,6 @@ var stroke = require('./lib/shared/assets/stroke.cjs');
58
59
  require('./lib/shared/consts/index.cjs');
59
60
  require('../_virtual/_tslib.cjs');
60
61
  require('react-dom');
61
- require('@dynamic-labs/wallet-connector-core');
62
62
  require('./lib/events/dynamicEvents.cjs');
63
63
  require('./lib/config/ApiEndpoint.cjs');
64
64
  require('@dynamic-labs/multi-wallet');
package/src/index.js CHANGED
@@ -28,6 +28,7 @@ import './lib/utils/constants/colors.js';
28
28
  import './lib/utils/constants/values.js';
29
29
  export { LocalStorage } from './lib/shared/utils/classes/storage/localStorage.js';
30
30
  import './lib/shared/utils/classes/storage/sessionStorage.js';
31
+ import '@dynamic-labs/wallet-connector-core';
31
32
  export { useLocalStorage } from './lib/shared/utils/hooks/useLocalStorage/useLocalStorage.js';
32
33
  export { useOnClickOutside } from './lib/shared/utils/hooks/useOnClickOutside/index.js';
33
34
  import '@dynamic-labs/utils';
@@ -54,7 +55,6 @@ export { ReactComponent as ArrowIcon } from './lib/shared/assets/stroke.js';
54
55
  import './lib/shared/consts/index.js';
55
56
  import '../_virtual/_tslib.js';
56
57
  import 'react-dom';
57
- import '@dynamic-labs/wallet-connector-core';
58
58
  import './lib/events/dynamicEvents.js';
59
59
  import './lib/config/ApiEndpoint.js';
60
60
  import '@dynamic-labs/multi-wallet';
@@ -6,13 +6,13 @@ Object.defineProperty(exports, '__esModule', { value: true });
6
6
  var _tslib = require('../../../../_virtual/_tslib.cjs');
7
7
  var jsxRuntime = require('react/jsx-runtime');
8
8
  var reactI18next = require('react-i18next');
9
- var walletConnectorCore = require('@dynamic-labs/wallet-connector-core');
10
9
  var ModalHeader = require('../ModalHeader/ModalHeader.cjs');
11
10
  var IconWithSpinner = require('../IconWithSpinner/IconWithSpinner.cjs');
12
11
  var Icon = require('../Icon/Icon.cjs');
13
12
  require('@dynamic-labs/sdk-api-core');
14
13
  require('../../shared/logger.cjs');
15
14
  require('@dynamic-labs/iconic');
15
+ require('@dynamic-labs/wallet-connector-core');
16
16
  var ViewContext = require('../../context/ViewContext/ViewContext.cjs');
17
17
  require('react');
18
18
  var chevronLeft = require('../../shared/assets/chevron-left.cjs');
@@ -23,6 +23,7 @@ require('../../utils/constants/colors.cjs');
23
23
  require('../../utils/constants/values.cjs');
24
24
  require('../../shared/utils/classes/storage/localStorage.cjs');
25
25
  require('../../shared/utils/classes/storage/sessionStorage.cjs');
26
+ var usingSessionKeys = require('../../shared/utils/functions/usingSessionKeys/usingSessionKeys.cjs');
26
27
  var useEffectOnce = require('../../shared/utils/hooks/useEffectOnce/useEffectOnce.cjs');
27
28
  require('@dynamic-labs/utils');
28
29
  require('../../shared/consts/index.cjs');
@@ -111,7 +112,9 @@ const TransactionConfirmationPageLayout = ({ onClickClose, isLoading, onClickBac
111
112
  const { userNeedsCrossDomainPasskey } = PasskeyContext.usePasskeyContext();
112
113
  const { initPasskeyRecoveryProcess, shouldInitRecovery } = usePasskeyRecovery.usePasskeyRecovery();
113
114
  const handleRecovery = () => _tslib.__awaiter(void 0, void 0, void 0, function* () {
114
- if (yield shouldInitRecovery())
115
+ if ((yield shouldInitRecovery()) &&
116
+ walletConnector &&
117
+ !usingSessionKeys.usingSessionKey(walletConnector))
115
118
  yield initPasskeyRecoveryProcess('email', 'sendTransaction');
116
119
  onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess('callHandlerOutsideModal');
117
120
  });
@@ -123,9 +126,7 @@ const TransactionConfirmationPageLayout = ({ onClickClose, isLoading, onClickBac
123
126
  const closeButton = onClickClose && (jsxRuntime.jsx(IconButton.IconButton, { type: 'button', onClick: onClickClose, "data-testid": 'close', disabled: isLoading, children: jsxRuntime.jsx(close.ReactComponent, {}) }));
124
127
  const backButton = onClickBack && (jsxRuntime.jsx(IconButton.IconButton, { type: 'button', onClick: onClickBack, "data-testid": 'back-button', children: jsxRuntime.jsx(chevronLeft.ReactComponent, {}) }));
125
128
  const handleSubmitWithChecks = (e) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
126
- if (walletConnectorCore.isSessionKeyCompatibleWalletConnector(walletConnector) ||
127
- ((walletConnector === null || walletConnector === void 0 ? void 0 : walletConnector.key) === 'zerodev' &&
128
- walletConnectorCore.isSessionKeyCompatibleWalletConnector(walletConnector.getEOAConnector()))) {
129
+ if (walletConnector && usingSessionKeys.usingSessionKey(walletConnector)) {
129
130
  onClickSend(e);
130
131
  return;
131
132
  }
@@ -2,13 +2,13 @@
2
2
  import { __awaiter } from '../../../../_virtual/_tslib.js';
3
3
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
4
4
  import { useTranslation } from 'react-i18next';
5
- import { isSessionKeyCompatibleWalletConnector } from '@dynamic-labs/wallet-connector-core';
6
5
  import { ModalHeader } from '../ModalHeader/ModalHeader.js';
7
6
  import { IconWithSpinner } from '../IconWithSpinner/IconWithSpinner.js';
8
7
  import { Icon } from '../Icon/Icon.js';
9
8
  import '@dynamic-labs/sdk-api-core';
10
9
  import '../../shared/logger.js';
11
10
  import '@dynamic-labs/iconic';
11
+ import '@dynamic-labs/wallet-connector-core';
12
12
  import { useViewContext } from '../../context/ViewContext/ViewContext.js';
13
13
  import 'react';
14
14
  import { ReactComponent as SvgChevronLeft } from '../../shared/assets/chevron-left.js';
@@ -19,6 +19,7 @@ import '../../utils/constants/colors.js';
19
19
  import '../../utils/constants/values.js';
20
20
  import '../../shared/utils/classes/storage/localStorage.js';
21
21
  import '../../shared/utils/classes/storage/sessionStorage.js';
22
+ import { usingSessionKey } from '../../shared/utils/functions/usingSessionKeys/usingSessionKeys.js';
22
23
  import { useEffectOnce } from '../../shared/utils/hooks/useEffectOnce/useEffectOnce.js';
23
24
  import '@dynamic-labs/utils';
24
25
  import '../../shared/consts/index.js';
@@ -107,7 +108,9 @@ const TransactionConfirmationPageLayout = ({ onClickClose, isLoading, onClickBac
107
108
  const { userNeedsCrossDomainPasskey } = usePasskeyContext();
108
109
  const { initPasskeyRecoveryProcess, shouldInitRecovery } = usePasskeyRecovery();
109
110
  const handleRecovery = () => __awaiter(void 0, void 0, void 0, function* () {
110
- if (yield shouldInitRecovery())
111
+ if ((yield shouldInitRecovery()) &&
112
+ walletConnector &&
113
+ !usingSessionKey(walletConnector))
111
114
  yield initPasskeyRecoveryProcess('email', 'sendTransaction');
112
115
  onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess('callHandlerOutsideModal');
113
116
  });
@@ -119,9 +122,7 @@ const TransactionConfirmationPageLayout = ({ onClickClose, isLoading, onClickBac
119
122
  const closeButton = onClickClose && (jsx(IconButton, { type: 'button', onClick: onClickClose, "data-testid": 'close', disabled: isLoading, children: jsx(SvgClose, {}) }));
120
123
  const backButton = onClickBack && (jsx(IconButton, { type: 'button', onClick: onClickBack, "data-testid": 'back-button', children: jsx(SvgChevronLeft, {}) }));
121
124
  const handleSubmitWithChecks = (e) => __awaiter(void 0, void 0, void 0, function* () {
122
- if (isSessionKeyCompatibleWalletConnector(walletConnector) ||
123
- ((walletConnector === null || walletConnector === void 0 ? void 0 : walletConnector.key) === 'zerodev' &&
124
- isSessionKeyCompatibleWalletConnector(walletConnector.getEOAConnector()))) {
125
+ if (walletConnector && usingSessionKey(walletConnector)) {
125
126
  onClickSend(e);
126
127
  return;
127
128
  }
@@ -8,7 +8,6 @@ var jsxRuntime = require('react/jsx-runtime');
8
8
  var React = require('react');
9
9
  var reactI18next = require('react-i18next');
10
10
  var utils = require('@dynamic-labs/utils');
11
- var walletConnectorCore = require('@dynamic-labs/wallet-connector-core');
12
11
  require('../../components/Accordion/components/AccordionItem/AccordionItem.cjs');
13
12
  require('../../components/Alert/Alert.cjs');
14
13
  var AnimatePresence = require('../../components/AnimatePresence/AnimatePresence.cjs');
@@ -16,6 +15,7 @@ var AppOriginTile = require('../../components/AppOriginTile/AppOriginTile.cjs');
16
15
  require('@dynamic-labs/sdk-api-core');
17
16
  require('../../shared/logger.cjs');
18
17
  require('@dynamic-labs/iconic');
18
+ require('@dynamic-labs/wallet-connector-core');
19
19
  var ViewContext = require('../../context/ViewContext/ViewContext.cjs');
20
20
  var close = require('../../shared/assets/close.cjs');
21
21
  var signCircle = require('../../shared/assets/sign-circle.cjs');
@@ -24,6 +24,7 @@ require('../../utils/constants/colors.cjs');
24
24
  require('../../utils/constants/values.cjs');
25
25
  require('../../shared/utils/classes/storage/localStorage.cjs');
26
26
  require('../../shared/utils/classes/storage/sessionStorage.cjs');
27
+ var usingSessionKeys = require('../../shared/utils/functions/usingSessionKeys/usingSessionKeys.cjs');
27
28
  var useEffectOnce = require('../../shared/utils/hooks/useEffectOnce/useEffectOnce.cjs');
28
29
  var usePreventPageScroll = require('../../shared/utils/hooks/usePreventPageScroll/usePreventPageScroll.cjs');
29
30
  var index = require('../../shared/consts/index.cjs');
@@ -154,16 +155,16 @@ const SignMessageConfirmationModal = ({ appLogoUrl, appName, appOrigin, message,
154
155
  onReject(signMessageError || new Error('user rejected signing'));
155
156
  }, [signedMessage, onSignMessage, onReject, signMessageError]);
156
157
  const handleMessageSign = (signWithoutModal) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
157
- if (yield shouldInitRecovery()) {
158
+ if ((yield shouldInitRecovery()) &&
159
+ walletConnector &&
160
+ !usingSessionKeys.usingSessionKey(walletConnector)) {
158
161
  yield initPasskeyRecoveryProcess('email', 'signMessage');
159
162
  }
160
163
  if (signWithoutModal === true) {
161
164
  onSignMessage('callHandlerOutsideModal');
162
165
  return;
163
166
  }
164
- if (walletConnectorCore.isSessionKeyCompatibleWalletConnector(walletConnector) ||
165
- ((walletConnector === null || walletConnector === void 0 ? void 0 : walletConnector.key) === 'zerodev' &&
166
- walletConnectorCore.isSessionKeyCompatibleWalletConnector(walletConnector.getEOAConnector()))) {
167
+ if (walletConnector && usingSessionKeys.usingSessionKey(walletConnector)) {
167
168
  confirm();
168
169
  return;
169
170
  }
@@ -4,7 +4,6 @@ import { jsx, jsxs } from 'react/jsx-runtime';
4
4
  import { useRef, useState, useCallback, useMemo } from 'react';
5
5
  import { useTranslation } from 'react-i18next';
6
6
  import { DynamicError, AccessBlockedError } from '@dynamic-labs/utils';
7
- import { isSessionKeyCompatibleWalletConnector } from '@dynamic-labs/wallet-connector-core';
8
7
  import '../../components/Accordion/components/AccordionItem/AccordionItem.js';
9
8
  import '../../components/Alert/Alert.js';
10
9
  import { AnimatePresence } from '../../components/AnimatePresence/AnimatePresence.js';
@@ -12,6 +11,7 @@ import { AppOriginTile } from '../../components/AppOriginTile/AppOriginTile.js';
12
11
  import '@dynamic-labs/sdk-api-core';
13
12
  import '../../shared/logger.js';
14
13
  import '@dynamic-labs/iconic';
14
+ import '@dynamic-labs/wallet-connector-core';
15
15
  import { useViewContext } from '../../context/ViewContext/ViewContext.js';
16
16
  import { ReactComponent as SvgClose } from '../../shared/assets/close.js';
17
17
  import { ReactComponent as SvgSignCircle } from '../../shared/assets/sign-circle.js';
@@ -20,6 +20,7 @@ import '../../utils/constants/colors.js';
20
20
  import '../../utils/constants/values.js';
21
21
  import '../../shared/utils/classes/storage/localStorage.js';
22
22
  import '../../shared/utils/classes/storage/sessionStorage.js';
23
+ import { usingSessionKey } from '../../shared/utils/functions/usingSessionKeys/usingSessionKeys.js';
23
24
  import { useEffectOnce } from '../../shared/utils/hooks/useEffectOnce/useEffectOnce.js';
24
25
  import { usePreventPageScroll } from '../../shared/utils/hooks/usePreventPageScroll/usePreventPageScroll.js';
25
26
  import { authModalZIndex } from '../../shared/consts/index.js';
@@ -150,16 +151,16 @@ const SignMessageConfirmationModal = ({ appLogoUrl, appName, appOrigin, message,
150
151
  onReject(signMessageError || new Error('user rejected signing'));
151
152
  }, [signedMessage, onSignMessage, onReject, signMessageError]);
152
153
  const handleMessageSign = (signWithoutModal) => __awaiter(void 0, void 0, void 0, function* () {
153
- if (yield shouldInitRecovery()) {
154
+ if ((yield shouldInitRecovery()) &&
155
+ walletConnector &&
156
+ !usingSessionKey(walletConnector)) {
154
157
  yield initPasskeyRecoveryProcess('email', 'signMessage');
155
158
  }
156
159
  if (signWithoutModal === true) {
157
160
  onSignMessage('callHandlerOutsideModal');
158
161
  return;
159
162
  }
160
- if (isSessionKeyCompatibleWalletConnector(walletConnector) ||
161
- ((walletConnector === null || walletConnector === void 0 ? void 0 : walletConnector.key) === 'zerodev' &&
162
- isSessionKeyCompatibleWalletConnector(walletConnector.getEOAConnector()))) {
163
+ if (walletConnector && usingSessionKey(walletConnector)) {
163
164
  confirm();
164
165
  return;
165
166
  }
@@ -13,3 +13,4 @@ export * from './getWalletListItemLabel';
13
13
  export * from './providerLabel';
14
14
  export * from './validatePassword';
15
15
  export * from './generateRandomPassword';
16
+ export * from './usingSessionKeys';
@@ -0,0 +1 @@
1
+ export * from './usingSessionKeys';
@@ -0,0 +1,12 @@
1
+ 'use client'
2
+ 'use strict';
3
+
4
+ Object.defineProperty(exports, '__esModule', { value: true });
5
+
6
+ var walletConnectorCore = require('@dynamic-labs/wallet-connector-core');
7
+
8
+ const usingSessionKey = (walletConnector) => walletConnectorCore.isSessionKeyCompatibleWalletConnector(walletConnector) ||
9
+ ((walletConnector === null || walletConnector === void 0 ? void 0 : walletConnector.key) === 'zerodev' &&
10
+ walletConnectorCore.isSessionKeyCompatibleWalletConnector(walletConnector.getEOAConnector()));
11
+
12
+ exports.usingSessionKey = usingSessionKey;
@@ -0,0 +1,2 @@
1
+ import { WalletConnector } from '@dynamic-labs/wallet-connector-core';
2
+ export declare const usingSessionKey: (walletConnector: WalletConnector) => boolean;
@@ -0,0 +1,8 @@
1
+ 'use client'
2
+ import { isSessionKeyCompatibleWalletConnector } from '@dynamic-labs/wallet-connector-core';
3
+
4
+ const usingSessionKey = (walletConnector) => isSessionKeyCompatibleWalletConnector(walletConnector) ||
5
+ ((walletConnector === null || walletConnector === void 0 ? void 0 : walletConnector.key) === 'zerodev' &&
6
+ isSessionKeyCompatibleWalletConnector(walletConnector.getEOAConnector()));
7
+
8
+ export { usingSessionKey };