@dynamic-labs/sdk-react-core 4.0.0-alpha.49 → 4.0.0-alpha.50

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
+ ## [4.0.0-alpha.50](https://github.com/dynamic-labs/dynamic-auth/compare/v4.0.0-alpha.49...v4.0.0-alpha.50) (2024-12-28)
3
+
4
+
5
+ ### Bug Fixes
6
+
7
+ * map user reject error to viem user reject error ([#7712](https://github.com/dynamic-labs/dynamic-auth/issues/7712)) ([ff2cb62](https://github.com/dynamic-labs/dynamic-auth/commit/ff2cb621b860b8d42ed520c64edc916d875e1abb))
8
+
2
9
  ## [4.0.0-alpha.49](https://github.com/dynamic-labs/dynamic-auth/compare/v4.0.0-alpha.48...v4.0.0-alpha.49) (2024-12-27)
3
10
 
4
11
 
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.49";
6
+ var version = "4.0.0-alpha.50";
7
7
  var dependencies = {
8
8
  "@dynamic-labs/sdk-api-core": "0.0.578",
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.49";
2
+ var version = "4.0.0-alpha.50";
3
3
  var dependencies = {
4
4
  "@dynamic-labs/sdk-api-core": "0.0.578",
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.49",
3
+ "version": "4.0.0-alpha.50",
4
4
  "dependencies": {
5
5
  "@dynamic-labs/sdk-api-core": "0.0.578",
6
6
  "@hcaptcha/react-hcaptcha": "1.4.4",
@@ -13,17 +13,17 @@
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.49",
17
- "@dynamic-labs/ethereum-aa": "4.0.0-alpha.49",
18
- "@dynamic-labs/iconic": "4.0.0-alpha.49",
19
- "@dynamic-labs/logger": "4.0.0-alpha.49",
20
- "@dynamic-labs/multi-wallet": "4.0.0-alpha.49",
21
- "@dynamic-labs/rpc-providers": "4.0.0-alpha.49",
22
- "@dynamic-labs/store": "4.0.0-alpha.49",
23
- "@dynamic-labs/types": "4.0.0-alpha.49",
24
- "@dynamic-labs/utils": "4.0.0-alpha.49",
25
- "@dynamic-labs/wallet-book": "4.0.0-alpha.49",
26
- "@dynamic-labs/wallet-connector-core": "4.0.0-alpha.49",
16
+ "@dynamic-labs/assert-package-version": "4.0.0-alpha.50",
17
+ "@dynamic-labs/ethereum-aa": "4.0.0-alpha.50",
18
+ "@dynamic-labs/iconic": "4.0.0-alpha.50",
19
+ "@dynamic-labs/logger": "4.0.0-alpha.50",
20
+ "@dynamic-labs/multi-wallet": "4.0.0-alpha.50",
21
+ "@dynamic-labs/rpc-providers": "4.0.0-alpha.50",
22
+ "@dynamic-labs/store": "4.0.0-alpha.50",
23
+ "@dynamic-labs/types": "4.0.0-alpha.50",
24
+ "@dynamic-labs/utils": "4.0.0-alpha.50",
25
+ "@dynamic-labs/wallet-book": "4.0.0-alpha.50",
26
+ "@dynamic-labs/wallet-connector-core": "4.0.0-alpha.50",
27
27
  "bs58": "5.0.0",
28
28
  "eventemitter3": "5.0.1"
29
29
  },
@@ -3,13 +3,13 @@
3
3
 
4
4
  Object.defineProperty(exports, '__esModule', { value: true });
5
5
 
6
- var _tslib = require('../../../../_virtual/_tslib.cjs');
7
6
  var jsxRuntime = require('react/jsx-runtime');
8
7
  var React = require('react');
9
8
  var utils = require('@dynamic-labs/utils');
10
9
  require('../../components/Accordion/components/AccordionItem/AccordionItem.cjs');
11
10
  require('../../components/Alert/Alert.cjs');
12
11
  require('../../events/dynamicEvents.cjs');
12
+ require('../../../../_virtual/_tslib.cjs');
13
13
  require('../../context/DynamicContext/DynamicContext.cjs');
14
14
  require('@dynamic-labs/sdk-api-core');
15
15
  require('../../shared/logger.cjs');
@@ -89,41 +89,27 @@ require('../../components/Popper/PopperContext/PopperContext.cjs');
89
89
  require('qrcode');
90
90
  require('@dynamic-labs/ethereum-aa');
91
91
 
92
- const TransactionModalContent = ({ title, onReject, onTransactionResponseSuccess, transaction, copykey, walletConnector, hideModal, isNativeToken, currentToken, }) => {
92
+ const TransactionConfirmationModal = ({ title, onReject, onTransactionResponseSuccess, transaction, copykey, walletConnector, hideModal, isNativeToken, currentToken, }) => {
93
93
  usePreventPageScroll.usePreventPageScroll(true);
94
+ const [show, setShow] = React.useState(true);
94
95
  const errorRef = React.useRef(null);
95
96
  const transactionResponseRef = React.useRef(null);
96
- const isClosingRef = React.useRef(false);
97
- const isTransactionPendingRef = React.useRef(false);
98
- const [show, setShow] = React.useState(true);
99
97
  const closeModal = React.useCallback(() => {
100
- if (transactionResponseRef.current) {
101
- onTransactionResponseSuccess(transactionResponseRef.current);
102
- }
103
- isClosingRef.current = true;
104
98
  setShow(false);
105
- }, [onTransactionResponseSuccess]);
99
+ }, [setShow]);
106
100
  const handleOnModalUnmount = React.useCallback(() => {
107
101
  if (transactionResponseRef.current) {
108
102
  return onTransactionResponseSuccess(transactionResponseRef.current);
109
103
  }
110
104
  return onReject(errorRef.current || new utils.UserRejectedTransactionError());
111
105
  }, [onTransactionResponseSuccess, onReject]);
112
- if (isClosingRef.current)
113
- return null;
114
106
  return (jsxRuntime.jsx(Portal.Portal, { handleClose: closeModal, isShown: show, zIndex: index.authModalZIndex, withBackdrop: true, elementId: 'dynamic-send-transaction', transitionEvents: {
115
107
  onUnmount: handleOnModalUnmount,
116
- }, children: jsxRuntime.jsx(Modal.Modal, { children: jsxRuntime.jsx(ModalCard.ModalCard, { children: jsxRuntime.jsx(TransactionConfirmationView.TransactionConfirmationView, { transaction: transaction, title: title, copykey: copykey, hideModal: hideModal, mutation: () => _tslib.__awaiter(void 0, void 0, void 0, function* () {
117
- isTransactionPendingRef.current = true;
118
- return transaction.submit();
119
- }), onClickClose: closeModal, onError: (error) => (errorRef.current = error), displayPoweredByDynamicFooter: true, walletConnector: walletConnector, onSuccess: (receipt) => {
120
- transactionResponseRef.current = receipt;
121
- isTransactionPendingRef.current = false;
108
+ }, children: jsxRuntime.jsx(Modal.Modal, { children: jsxRuntime.jsx(ModalCard.ModalCard, { children: jsxRuntime.jsx(TransactionConfirmationView.TransactionConfirmationView, { transaction: transaction, title: title, copykey: copykey, hideModal: hideModal, mutation: () => transaction.submit(), onClickClose: closeModal, onError: (error) => (errorRef.current = error), displayPoweredByDynamicFooter: true, walletConnector: walletConnector, onSuccess: (transactionResponse) => {
109
+ errorRef.current = null;
110
+ transactionResponseRef.current = transactionResponse;
122
111
  closeModal();
123
112
  }, isNativeToken: isNativeToken, currentToken: currentToken, isModal: true }) }) }) }));
124
113
  };
125
- const TransactionConfirmationModal = (props) => (jsxRuntime.jsx(TransactionModalContent
126
- // force re-render for each new transaction
127
- , Object.assign({}, props), `${props.transaction.to}-${Date.now()}`));
128
114
 
129
115
  exports.TransactionConfirmationModal = TransactionConfirmationModal;
@@ -1,11 +1,11 @@
1
1
  'use client'
2
- import { __awaiter } from '../../../../_virtual/_tslib.js';
3
2
  import { jsx } from 'react/jsx-runtime';
4
- import { useRef, useState, useCallback } from 'react';
3
+ import { useState, useRef, useCallback } from 'react';
5
4
  import { UserRejectedTransactionError } from '@dynamic-labs/utils';
6
5
  import '../../components/Accordion/components/AccordionItem/AccordionItem.js';
7
6
  import '../../components/Alert/Alert.js';
8
7
  import '../../events/dynamicEvents.js';
8
+ import '../../../../_virtual/_tslib.js';
9
9
  import '../../context/DynamicContext/DynamicContext.js';
10
10
  import '@dynamic-labs/sdk-api-core';
11
11
  import '../../shared/logger.js';
@@ -85,41 +85,27 @@ import '../../components/Popper/PopperContext/PopperContext.js';
85
85
  import 'qrcode';
86
86
  import '@dynamic-labs/ethereum-aa';
87
87
 
88
- const TransactionModalContent = ({ title, onReject, onTransactionResponseSuccess, transaction, copykey, walletConnector, hideModal, isNativeToken, currentToken, }) => {
88
+ const TransactionConfirmationModal = ({ title, onReject, onTransactionResponseSuccess, transaction, copykey, walletConnector, hideModal, isNativeToken, currentToken, }) => {
89
89
  usePreventPageScroll(true);
90
+ const [show, setShow] = useState(true);
90
91
  const errorRef = useRef(null);
91
92
  const transactionResponseRef = useRef(null);
92
- const isClosingRef = useRef(false);
93
- const isTransactionPendingRef = useRef(false);
94
- const [show, setShow] = useState(true);
95
93
  const closeModal = useCallback(() => {
96
- if (transactionResponseRef.current) {
97
- onTransactionResponseSuccess(transactionResponseRef.current);
98
- }
99
- isClosingRef.current = true;
100
94
  setShow(false);
101
- }, [onTransactionResponseSuccess]);
95
+ }, [setShow]);
102
96
  const handleOnModalUnmount = useCallback(() => {
103
97
  if (transactionResponseRef.current) {
104
98
  return onTransactionResponseSuccess(transactionResponseRef.current);
105
99
  }
106
100
  return onReject(errorRef.current || new UserRejectedTransactionError());
107
101
  }, [onTransactionResponseSuccess, onReject]);
108
- if (isClosingRef.current)
109
- return null;
110
102
  return (jsx(Portal, { handleClose: closeModal, isShown: show, zIndex: authModalZIndex, withBackdrop: true, elementId: 'dynamic-send-transaction', transitionEvents: {
111
103
  onUnmount: handleOnModalUnmount,
112
- }, children: jsx(Modal, { children: jsx(ModalCard, { children: jsx(TransactionConfirmationView, { transaction: transaction, title: title, copykey: copykey, hideModal: hideModal, mutation: () => __awaiter(void 0, void 0, void 0, function* () {
113
- isTransactionPendingRef.current = true;
114
- return transaction.submit();
115
- }), onClickClose: closeModal, onError: (error) => (errorRef.current = error), displayPoweredByDynamicFooter: true, walletConnector: walletConnector, onSuccess: (receipt) => {
116
- transactionResponseRef.current = receipt;
117
- isTransactionPendingRef.current = false;
104
+ }, children: jsx(Modal, { children: jsx(ModalCard, { children: jsx(TransactionConfirmationView, { transaction: transaction, title: title, copykey: copykey, hideModal: hideModal, mutation: () => transaction.submit(), onClickClose: closeModal, onError: (error) => (errorRef.current = error), displayPoweredByDynamicFooter: true, walletConnector: walletConnector, onSuccess: (transactionResponse) => {
105
+ errorRef.current = null;
106
+ transactionResponseRef.current = transactionResponse;
118
107
  closeModal();
119
108
  }, isNativeToken: isNativeToken, currentToken: currentToken, isModal: true }) }) }) }));
120
109
  };
121
- const TransactionConfirmationModal = (props) => (jsx(TransactionModalContent
122
- // force re-render for each new transaction
123
- , Object.assign({}, props), `${props.transaction.to}-${Date.now()}`));
124
110
 
125
111
  export { TransactionConfirmationModal };