@huma-finance/widgets 0.0.42 → 0.0.43-beta.108
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/API.md +1 -1
- package/dist/cjs/index.cjs +26 -35
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +28 -37
- package/dist/index.js.map +1 -1
- package/package.json +7 -9
- package/src/components/ChainSupportProvider.tsx +50 -0
- package/src/index.tsx +5 -35
- package/cypress/e2e/01-invoice-factoring-borrow.test.ts +0 -62
- package/cypress/support/e2e.ts +0 -76
- package/cypress/support/ethereum.ts +0 -142
- package/cypress/tsconfig.json +0 -9
- package/cypress/utils/index.ts +0 -54
- package/cypress.config.ts +0 -20
- package/src/components/ChainNotSupportedModal.tsx +0 -33
package/API.md
CHANGED
|
@@ -286,7 +286,7 @@ To be used when re-enabling autopay and other pool actions that require allowanc
|
|
|
286
286
|
| --- | --- | --- |
|
|
287
287
|
| desiredChainId | <code>desiredChainId</code> \| <code>undefined</code> | <p>Optional desired chain id, will trigger the switch network action if different from the current chain id</p> |
|
|
288
288
|
| jsonRpcUrlMap | [<code>JsonRpcConnectionMap</code>](#JsonRpcConnectionMap) \| <code>undefined</code> | <p>Optional mapping of your JSON-RPC connections indexed by chainId</p> |
|
|
289
|
-
| provider | <code>Eip1193Provider</code> \| <code>
|
|
289
|
+
| provider | <code>Eip1193Provider</code> \| <code>JsonRpcProvider</code> | <p>EIP-1193 provider or JsonRpc Provider</p> |
|
|
290
290
|
|
|
291
291
|
<a name="InvoiceFactoringBorrowWidgetProps"></a>
|
|
292
292
|
|
package/dist/cjs/index.cjs
CHANGED
|
@@ -5,9 +5,9 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
var shared = require('@huma-finance/shared');
|
|
6
6
|
var material = require('@mui/material');
|
|
7
7
|
var jotai = require('jotai');
|
|
8
|
-
var React = require('react');
|
|
9
8
|
var reactRedux = require('react-redux');
|
|
10
9
|
var core = require('@web3-react/core');
|
|
10
|
+
var React = require('react');
|
|
11
11
|
var ErrorOutlineIcon = require('@mui/icons-material/ErrorOutline');
|
|
12
12
|
var utils = require('jotai/utils');
|
|
13
13
|
var toolkit = require('@reduxjs/toolkit');
|
|
@@ -607,11 +607,29 @@ function HumaModalHeader(_ref) {
|
|
|
607
607
|
});
|
|
608
608
|
}
|
|
609
609
|
|
|
610
|
-
function
|
|
611
|
-
var
|
|
612
|
-
|
|
610
|
+
function ChainSupportProvider(_ref) {
|
|
611
|
+
var children = _ref.children;
|
|
612
|
+
var _useWeb3React = core.useWeb3React(),
|
|
613
|
+
chainId = _useWeb3React.chainId;
|
|
614
|
+
var chainSupported = !!shared.supportedChainId(chainId);
|
|
615
|
+
var _useState = React.useState(false),
|
|
616
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
617
|
+
chainNotSupportedOpen = _useState2[0],
|
|
618
|
+
setChainNotSupportedOpen = _useState2[1];
|
|
619
|
+
React.useEffect(function () {
|
|
620
|
+
setChainNotSupportedOpen(!chainSupported);
|
|
621
|
+
}, [chainSupported]);
|
|
622
|
+
var handleClose = function handleClose() {
|
|
623
|
+
setChainNotSupportedOpen(false);
|
|
624
|
+
};
|
|
625
|
+
if (!chainId) {
|
|
626
|
+
return null;
|
|
627
|
+
}
|
|
628
|
+
if (chainSupported) {
|
|
629
|
+
return children;
|
|
630
|
+
}
|
|
613
631
|
return jsxRuntime.jsxs(HumaModal, {
|
|
614
|
-
isOpen:
|
|
632
|
+
isOpen: chainNotSupportedOpen,
|
|
615
633
|
overflowY: "auto",
|
|
616
634
|
onClose: handleClose,
|
|
617
635
|
width: "480px",
|
|
@@ -6366,42 +6384,15 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
|
|
|
6366
6384
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
6367
6385
|
function Widget(props) {
|
|
6368
6386
|
var children = props.children;
|
|
6369
|
-
var _useWeb3React = core.useWeb3React(),
|
|
6370
|
-
chainId = _useWeb3React.chainId;
|
|
6371
|
-
var chainSupported = !!shared.supportedChainId(chainId);
|
|
6372
|
-
var _useState = React.useState(false),
|
|
6373
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
6374
|
-
chainNotSupportedOpen = _useState2[0],
|
|
6375
|
-
setChainNotSupportedOpen = _useState2[1];
|
|
6376
|
-
React.useEffect(function () {
|
|
6377
|
-
if (chainSupported) {
|
|
6378
|
-
setChainNotSupportedOpen(false);
|
|
6379
|
-
} else {
|
|
6380
|
-
setChainNotSupportedOpen(true);
|
|
6381
|
-
}
|
|
6382
|
-
}, [chainSupported]);
|
|
6383
|
-
var handleCloseCallback = React.useCallback(function () {
|
|
6384
|
-
setChainNotSupportedOpen(false);
|
|
6385
|
-
}, []);
|
|
6386
|
-
if (!chainSupported) {
|
|
6387
|
-
return jsxRuntime.jsx(material.ThemeProvider, {
|
|
6388
|
-
theme: themeHuma,
|
|
6389
|
-
children: jsxRuntime.jsx(reactRedux.Provider, {
|
|
6390
|
-
store: store,
|
|
6391
|
-
children: jsxRuntime.jsx(ChainNotSupportedModal, {
|
|
6392
|
-
isOpen: chainNotSupportedOpen,
|
|
6393
|
-
handleClose: handleCloseCallback
|
|
6394
|
-
})
|
|
6395
|
-
})
|
|
6396
|
-
});
|
|
6397
|
-
}
|
|
6398
6387
|
return jsxRuntime.jsx(material.ThemeProvider, {
|
|
6399
6388
|
theme: themeHuma,
|
|
6400
6389
|
children: jsxRuntime.jsx(reactRedux.Provider, {
|
|
6401
6390
|
store: store,
|
|
6402
6391
|
children: jsxRuntime.jsx(shared.Provider, _objectSpread(_objectSpread({}, props), {}, {
|
|
6403
6392
|
children: jsxRuntime.jsx(jotai.Provider, {
|
|
6404
|
-
children:
|
|
6393
|
+
children: jsxRuntime.jsx(ChainSupportProvider, {
|
|
6394
|
+
children: children
|
|
6395
|
+
})
|
|
6405
6396
|
})
|
|
6406
6397
|
}))
|
|
6407
6398
|
})
|