@depay/widgets 6.23.1 → 6.24.0
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/README.md +127 -78
- package/dist/esm/index.bundle.js +17790 -418
- package/dist/esm/index.js +98 -40
- package/dist/umd/index.bundle.js +17790 -418
- package/dist/umd/index.js +98 -40
- package/package.json +5 -5
package/dist/umd/index.js
CHANGED
|
@@ -1689,7 +1689,7 @@
|
|
|
1689
1689
|
});
|
|
1690
1690
|
|
|
1691
1691
|
var DialogStyle = (function (style) {
|
|
1692
|
-
return "\n\n .ReactDialogBackground {\n backdrop-filter: blur(5px);\n background: rgba(0,0,0,0.7);\n }\n\n .Dialog {\n margin: 0 auto;\n position: relative;\n width: 420px;\n box-shadow: 0 0 20px rgba(0,0,0,0.1);\n border-radius: 0.8rem;\n background: rgb(248,248,248);\n }\n\n @media (max-width: 450px) {\n\n .Dialog {\n border-radius: 0;\n width: 100%;\n }\n
|
|
1692
|
+
return "\n\n .ReactDialogBackground {\n backdrop-filter: blur(5px);\n background: rgba(0,0,0,0.7);\n }\n\n .Dialog {\n margin: 0 auto;\n position: relative;\n width: 420px;\n box-shadow: 0 0 20px rgba(0,0,0,0.1);\n border-radius: 0.8rem;\n background: rgb(248,248,248);\n }\n\n @media (max-width: 450px) {\n\n .Dialog {\n border-radius: 0;\n width: 100%;\n }\n }\n\n @media (orientation: portrait) and (max-width: 800px) {\n\n .ReactDialogAnimation {\n width: 100%;\n }\n\n .ReactDialog {\n height: 100%;\n min-height: 100%;\n }\n\n .ReactDialogStack {\n align-items: flex-end;\n }\n\n .Dialog {\n align-content: stretch;\n border-radius: 0.8rem;\n border-top-radius: 0.8rem;\n display: flex;\n flex-direction: column;\n }\n\n .DialogBody {\n flex: 1;\n align-items: flex-end;\n }\n\n .DialogFooter {\n padding-bottom: 20px;\n }\n\n .ReactDialogAnimation {\n margin-bottom: -100px !important;\n top: inherit !important;\n position: relative;\n transition: opacity 0.4s ease, margin-bottom 0.4s ease;\n }\n\n .ReactDialog.ReactDialogOpen .ReactDialogAnimation {\n margin-bottom: 0px !important;\n }\n\n .DialogFooter {\n border-bottom-left-radius: 0 !important;\n border-bottom-right-radius: 0 !important;\n }\n\n .ReactShadowDOMInsideContainer > .ReactDialog {\n align-items: flex-end;\n }\n }\n\n .DialogBody {\n background: rgb(248,248,248);\n overflow-x: hidden;\n overflow-y: auto;\n }\n\n .DialogBody.ScrollHeight {\n height: 30vh !important;\n max-height: 30vh !important;\n }\n\n .DialogHeader {\n background: rgb(248,248,248);\n border-top-left-radius: 0.8rem;\n border-top-right-radius: 0.8rem;\n min-height: 3.4rem;\n position: relative;\n width: 100%;\n }\n\n .DialogHeaderActionRight {\n position: absolute;\n top: 0;\n right: 0;\n height: 3rem;\n }\n\n .DialogHeaderActionLeft {\n position: absolute;\n top: 0;\n left: 0;\n height: 3rem;\n }\n\n .DialogFooter {\n background: rgb(248,248,248);\n border-bottom-left-radius: 0.8rem;\n border-bottom-right-radius: 0.8rem;\n line-height: 1.5rem;\n min-height: 2rem;\n position: relative;\n text-align: center;\n }\n\n ";
|
|
1693
1693
|
});
|
|
1694
1694
|
|
|
1695
1695
|
var FontStyle = (function (style) {
|
|
@@ -2593,6 +2593,41 @@
|
|
|
2593
2593
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
2594
2594
|
|
|
2595
2595
|
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; }
|
|
2596
|
+
|
|
2597
|
+
var prepareAcceptedPayments = function prepareAcceptedPayments(accept) {
|
|
2598
|
+
var toAddress = _typeof(accept.receiver) == 'object' ? accept.receiver.address : accept.receiver;
|
|
2599
|
+
var toContract = _typeof(accept.receiver) == 'object' ? accept.receiver : undefined;
|
|
2600
|
+
return _objectSpread(_objectSpread({}, accept), {}, {
|
|
2601
|
+
toAddress: toAddress,
|
|
2602
|
+
toContract: toContract
|
|
2603
|
+
});
|
|
2604
|
+
};
|
|
2605
|
+
|
|
2606
|
+
var mergeFromAccounts = function mergeFromAccounts(accept, account) {
|
|
2607
|
+
var from = {};
|
|
2608
|
+
accept.forEach(function (accept) {
|
|
2609
|
+
from[accept.blockchain] = account;
|
|
2610
|
+
});
|
|
2611
|
+
return from;
|
|
2612
|
+
};
|
|
2613
|
+
|
|
2614
|
+
var routePayments = (function (_ref) {
|
|
2615
|
+
var accept = _ref.accept,
|
|
2616
|
+
account = _ref.account,
|
|
2617
|
+
whitelist = _ref.whitelist,
|
|
2618
|
+
blacklist = _ref.blacklist,
|
|
2619
|
+
event = _ref.event,
|
|
2620
|
+
fee = _ref.fee;
|
|
2621
|
+
return web3Payments.route({
|
|
2622
|
+
accept: accept.map(prepareAcceptedPayments),
|
|
2623
|
+
from: mergeFromAccounts(accept, account),
|
|
2624
|
+
whitelist: whitelist,
|
|
2625
|
+
blacklist: blacklist,
|
|
2626
|
+
event: event,
|
|
2627
|
+
fee: fee
|
|
2628
|
+
});
|
|
2629
|
+
});
|
|
2630
|
+
|
|
2596
2631
|
var PaymentRoutingProvider = (function (props) {
|
|
2597
2632
|
var _useState = React.useState(),
|
|
2598
2633
|
_useState2 = _slicedToArray(_useState, 2),
|
|
@@ -2618,50 +2653,49 @@
|
|
|
2618
2653
|
var _useContext3 = React.useContext(ConfigurationContext),
|
|
2619
2654
|
recover = _useContext3.recover;
|
|
2620
2655
|
|
|
2621
|
-
var
|
|
2622
|
-
|
|
2623
|
-
|
|
2624
|
-
|
|
2625
|
-
|
|
2626
|
-
|
|
2627
|
-
|
|
2628
|
-
}
|
|
2656
|
+
var onRoutesUpdate = function onRoutesUpdate(routes) {
|
|
2657
|
+
if (routes.length == 0) {
|
|
2658
|
+
setAllRoutes([]);
|
|
2659
|
+
|
|
2660
|
+
if (props.setMaxRoute) {
|
|
2661
|
+
props.setMaxRoute(null);
|
|
2662
|
+
}
|
|
2663
|
+
} else {
|
|
2664
|
+
roundAmounts(routes).then(function (roundedRoutes) {
|
|
2665
|
+
var selected;
|
|
2666
|
+
|
|
2667
|
+
if (selectedRoute) {
|
|
2668
|
+
selected = roundedRoutes[allRoutes.findIndex(function (route) {
|
|
2669
|
+
return route.fromToken == selectedRoute.fromToken && route.blockchain == selectedRoute.blockchain;
|
|
2670
|
+
})];
|
|
2671
|
+
}
|
|
2672
|
+
|
|
2673
|
+
if (selected == undefined) {
|
|
2674
|
+
selected = roundedRoutes[0];
|
|
2675
|
+
}
|
|
2676
|
+
|
|
2677
|
+
setSelectedRoute(selected);
|
|
2678
|
+
setAllRoutes(roundedRoutes);
|
|
2679
|
+
|
|
2680
|
+
if (props.setMaxRoute) {
|
|
2681
|
+
props.setMaxRoute(findMaxRoute(roundedRoutes));
|
|
2682
|
+
}
|
|
2683
|
+
});
|
|
2684
|
+
}
|
|
2629
2685
|
};
|
|
2630
2686
|
|
|
2631
2687
|
var getPaymentRoutes = function getPaymentRoutes(_ref) {
|
|
2632
|
-
|
|
2633
|
-
|
|
2634
|
-
updatable = _ref.updatable;
|
|
2688
|
+
_ref.allRoutes;
|
|
2689
|
+
_ref.selectedRoute;
|
|
2690
|
+
var updatable = _ref.updatable;
|
|
2635
2691
|
|
|
2636
2692
|
if (updatable == false || !props.accept || !account) {
|
|
2637
2693
|
return;
|
|
2638
2694
|
}
|
|
2639
2695
|
|
|
2640
|
-
|
|
2641
|
-
|
|
2642
|
-
|
|
2643
|
-
blacklist: props.blacklist,
|
|
2644
|
-
event: props.event,
|
|
2645
|
-
fee: props.fee
|
|
2646
|
-
}).then(function (routes) {
|
|
2647
|
-
if (routes.length == 0) {
|
|
2648
|
-
setAllRoutes([]);
|
|
2649
|
-
|
|
2650
|
-
if (props.setMaxRoute) {
|
|
2651
|
-
props.setMaxRoute(null);
|
|
2652
|
-
}
|
|
2653
|
-
} else {
|
|
2654
|
-
roundAmounts(routes).then(function (roundedRoutes) {
|
|
2655
|
-
var selected = selectedRoute ? roundedRoutes[allRoutes.indexOf(selectedRoute)] || roundedRoutes[0] : roundedRoutes[0];
|
|
2656
|
-
setSelectedRoute(selected);
|
|
2657
|
-
setAllRoutes(roundedRoutes);
|
|
2658
|
-
|
|
2659
|
-
if (props.setMaxRoute) {
|
|
2660
|
-
props.setMaxRoute(findMaxRoute(roundedRoutes));
|
|
2661
|
-
}
|
|
2662
|
-
});
|
|
2663
|
-
}
|
|
2664
|
-
});
|
|
2696
|
+
routePayments(Object.assign({}, props, {
|
|
2697
|
+
account: account
|
|
2698
|
+
})).then(onRoutesUpdate);
|
|
2665
2699
|
};
|
|
2666
2700
|
|
|
2667
2701
|
var roundAmounts = /*#__PURE__*/function () {
|
|
@@ -3776,11 +3810,11 @@
|
|
|
3776
3810
|
paymentRoute = _useState6[0],
|
|
3777
3811
|
setPaymentRoute = _useState6[1];
|
|
3778
3812
|
|
|
3779
|
-
var _useState7 = React.useState(!!(track && (track.endpoint || typeof track.method == 'function'))),
|
|
3813
|
+
var _useState7 = React.useState(!!(track && (track.endpoint || typeof track.method == 'function') && track.async != true)),
|
|
3780
3814
|
_useState8 = _slicedToArray(_useState7, 1),
|
|
3781
3815
|
tracking = _useState8[0];
|
|
3782
3816
|
|
|
3783
|
-
var _useState9 = React.useState(!!(track && track.poll && (track.poll.endpoint || typeof track.poll.method == 'function'))),
|
|
3817
|
+
var _useState9 = React.useState(!!(track && track.poll && (track.poll.endpoint || typeof track.poll.method == 'function') && track.async != true)),
|
|
3784
3818
|
_useState10 = _slicedToArray(_useState9, 1),
|
|
3785
3819
|
polling = _useState10[0];
|
|
3786
3820
|
|
|
@@ -3946,6 +3980,10 @@
|
|
|
3946
3980
|
return;
|
|
3947
3981
|
}
|
|
3948
3982
|
|
|
3983
|
+
if (!tracking) {
|
|
3984
|
+
return;
|
|
3985
|
+
}
|
|
3986
|
+
|
|
3949
3987
|
var pollingInterval = setInterval(function () {
|
|
3950
3988
|
return pollStatus(polling, transaction, afterBlock, paymentRoute, pollingInterval);
|
|
3951
3989
|
}, 5000);
|
|
@@ -4001,6 +4039,10 @@
|
|
|
4001
4039
|
var initializeTracking = function initializeTracking(transaction, afterBlock, paymentRoute) {
|
|
4002
4040
|
storePayment(transaction, afterBlock, paymentRoute, 1);
|
|
4003
4041
|
|
|
4042
|
+
if (tracking || track && track.async == true) {
|
|
4043
|
+
startTracking(transaction, afterBlock, paymentRoute);
|
|
4044
|
+
}
|
|
4045
|
+
|
|
4004
4046
|
if (tracking == false) {
|
|
4005
4047
|
return;
|
|
4006
4048
|
}
|
|
@@ -4009,7 +4051,6 @@
|
|
|
4009
4051
|
setAfterBlock(afterBlock);
|
|
4010
4052
|
setPaymentRoute(paymentRoute);
|
|
4011
4053
|
openSocket(transaction);
|
|
4012
|
-
startTracking(transaction, afterBlock, paymentRoute);
|
|
4013
4054
|
};
|
|
4014
4055
|
|
|
4015
4056
|
return /*#__PURE__*/React__default["default"].createElement(PaymentTrackingContext.Provider, {
|
|
@@ -4867,6 +4908,23 @@
|
|
|
4867
4908
|
};
|
|
4868
4909
|
}();
|
|
4869
4910
|
|
|
4911
|
+
Payment.preload = function (_ref5) {
|
|
4912
|
+
var account = _ref5.account,
|
|
4913
|
+
accept = _ref5.accept,
|
|
4914
|
+
whitelist = _ref5.whitelist,
|
|
4915
|
+
blacklist = _ref5.blacklist,
|
|
4916
|
+
event = _ref5.event,
|
|
4917
|
+
fee = _ref5.fee;
|
|
4918
|
+
routePayments({
|
|
4919
|
+
account: account,
|
|
4920
|
+
accept: accept,
|
|
4921
|
+
whitelist: whitelist,
|
|
4922
|
+
blacklist: blacklist,
|
|
4923
|
+
event: event,
|
|
4924
|
+
fee: fee
|
|
4925
|
+
});
|
|
4926
|
+
};
|
|
4927
|
+
|
|
4870
4928
|
var SaleRoutingContext = /*#__PURE__*/React__default["default"].createContext();
|
|
4871
4929
|
|
|
4872
4930
|
var ToTokenContext = /*#__PURE__*/React__default["default"].createContext();
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@depay/widgets",
|
|
3
3
|
"moduleName": "DePayWidgets",
|
|
4
|
-
"version": "6.
|
|
4
|
+
"version": "6.24.0",
|
|
5
5
|
"description": "Web3 Payments with any token. DePay simplifies and improves Web3 Payments with the power of DeFi. Accept any token with on-the-fly conversion.",
|
|
6
6
|
"main": "./dist/umd/index.js",
|
|
7
7
|
"module": "./dist/esm/index.js",
|
|
@@ -39,12 +39,12 @@
|
|
|
39
39
|
"@depay/react-shadow-dom": "^4.0.0",
|
|
40
40
|
"@depay/react-token-image": "^3.0.0",
|
|
41
41
|
"@depay/walletconnect-v1": "^1.1.0",
|
|
42
|
-
"@depay/web3-assets": "^
|
|
43
|
-
"@depay/web3-blockchains": "^4.
|
|
42
|
+
"@depay/web3-assets": "^6.1.5",
|
|
43
|
+
"@depay/web3-blockchains": "^4.3.0",
|
|
44
44
|
"@depay/web3-client": "^8.0.0",
|
|
45
45
|
"@depay/web3-constants": "^5.0.0",
|
|
46
|
-
"@depay/web3-exchanges": "^8.2.
|
|
47
|
-
"@depay/web3-payments": "^
|
|
46
|
+
"@depay/web3-exchanges": "^8.2.1",
|
|
47
|
+
"@depay/web3-payments": "^10.0.5",
|
|
48
48
|
"@depay/web3-tokens": "^8.0.1",
|
|
49
49
|
"@depay/web3-wallets": "^10.0.3",
|
|
50
50
|
"decimal.js": "^10.3.1",
|