@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/esm/index.js
CHANGED
|
@@ -1694,7 +1694,7 @@ var CardStyle = (function (style) {
|
|
|
1694
1694
|
});
|
|
1695
1695
|
|
|
1696
1696
|
var DialogStyle = (function (style) {
|
|
1697
|
-
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
|
|
1697
|
+
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 ";
|
|
1698
1698
|
});
|
|
1699
1699
|
|
|
1700
1700
|
var FontStyle = (function (style) {
|
|
@@ -2598,6 +2598,41 @@ function _defineProperty(obj, key, value) {
|
|
|
2598
2598
|
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; }
|
|
2599
2599
|
|
|
2600
2600
|
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; }
|
|
2601
|
+
|
|
2602
|
+
var prepareAcceptedPayments = function prepareAcceptedPayments(accept) {
|
|
2603
|
+
var toAddress = _typeof(accept.receiver) == 'object' ? accept.receiver.address : accept.receiver;
|
|
2604
|
+
var toContract = _typeof(accept.receiver) == 'object' ? accept.receiver : undefined;
|
|
2605
|
+
return _objectSpread(_objectSpread({}, accept), {}, {
|
|
2606
|
+
toAddress: toAddress,
|
|
2607
|
+
toContract: toContract
|
|
2608
|
+
});
|
|
2609
|
+
};
|
|
2610
|
+
|
|
2611
|
+
var mergeFromAccounts = function mergeFromAccounts(accept, account) {
|
|
2612
|
+
var from = {};
|
|
2613
|
+
accept.forEach(function (accept) {
|
|
2614
|
+
from[accept.blockchain] = account;
|
|
2615
|
+
});
|
|
2616
|
+
return from;
|
|
2617
|
+
};
|
|
2618
|
+
|
|
2619
|
+
var routePayments = (function (_ref) {
|
|
2620
|
+
var accept = _ref.accept,
|
|
2621
|
+
account = _ref.account,
|
|
2622
|
+
whitelist = _ref.whitelist,
|
|
2623
|
+
blacklist = _ref.blacklist,
|
|
2624
|
+
event = _ref.event,
|
|
2625
|
+
fee = _ref.fee;
|
|
2626
|
+
return route$1({
|
|
2627
|
+
accept: accept.map(prepareAcceptedPayments),
|
|
2628
|
+
from: mergeFromAccounts(accept, account),
|
|
2629
|
+
whitelist: whitelist,
|
|
2630
|
+
blacklist: blacklist,
|
|
2631
|
+
event: event,
|
|
2632
|
+
fee: fee
|
|
2633
|
+
});
|
|
2634
|
+
});
|
|
2635
|
+
|
|
2601
2636
|
var PaymentRoutingProvider = (function (props) {
|
|
2602
2637
|
var _useState = useState(),
|
|
2603
2638
|
_useState2 = _slicedToArray(_useState, 2),
|
|
@@ -2623,50 +2658,49 @@ var PaymentRoutingProvider = (function (props) {
|
|
|
2623
2658
|
var _useContext3 = useContext(ConfigurationContext),
|
|
2624
2659
|
recover = _useContext3.recover;
|
|
2625
2660
|
|
|
2626
|
-
var
|
|
2627
|
-
|
|
2628
|
-
|
|
2629
|
-
|
|
2630
|
-
|
|
2631
|
-
|
|
2632
|
-
|
|
2633
|
-
}
|
|
2661
|
+
var onRoutesUpdate = function onRoutesUpdate(routes) {
|
|
2662
|
+
if (routes.length == 0) {
|
|
2663
|
+
setAllRoutes([]);
|
|
2664
|
+
|
|
2665
|
+
if (props.setMaxRoute) {
|
|
2666
|
+
props.setMaxRoute(null);
|
|
2667
|
+
}
|
|
2668
|
+
} else {
|
|
2669
|
+
roundAmounts(routes).then(function (roundedRoutes) {
|
|
2670
|
+
var selected;
|
|
2671
|
+
|
|
2672
|
+
if (selectedRoute) {
|
|
2673
|
+
selected = roundedRoutes[allRoutes.findIndex(function (route) {
|
|
2674
|
+
return route.fromToken == selectedRoute.fromToken && route.blockchain == selectedRoute.blockchain;
|
|
2675
|
+
})];
|
|
2676
|
+
}
|
|
2677
|
+
|
|
2678
|
+
if (selected == undefined) {
|
|
2679
|
+
selected = roundedRoutes[0];
|
|
2680
|
+
}
|
|
2681
|
+
|
|
2682
|
+
setSelectedRoute(selected);
|
|
2683
|
+
setAllRoutes(roundedRoutes);
|
|
2684
|
+
|
|
2685
|
+
if (props.setMaxRoute) {
|
|
2686
|
+
props.setMaxRoute(findMaxRoute(roundedRoutes));
|
|
2687
|
+
}
|
|
2688
|
+
});
|
|
2689
|
+
}
|
|
2634
2690
|
};
|
|
2635
2691
|
|
|
2636
2692
|
var getPaymentRoutes = function getPaymentRoutes(_ref) {
|
|
2637
|
-
|
|
2638
|
-
|
|
2639
|
-
updatable = _ref.updatable;
|
|
2693
|
+
_ref.allRoutes;
|
|
2694
|
+
_ref.selectedRoute;
|
|
2695
|
+
var updatable = _ref.updatable;
|
|
2640
2696
|
|
|
2641
2697
|
if (updatable == false || !props.accept || !account) {
|
|
2642
2698
|
return;
|
|
2643
2699
|
}
|
|
2644
2700
|
|
|
2645
|
-
|
|
2646
|
-
|
|
2647
|
-
|
|
2648
|
-
blacklist: props.blacklist,
|
|
2649
|
-
event: props.event,
|
|
2650
|
-
fee: props.fee
|
|
2651
|
-
}).then(function (routes) {
|
|
2652
|
-
if (routes.length == 0) {
|
|
2653
|
-
setAllRoutes([]);
|
|
2654
|
-
|
|
2655
|
-
if (props.setMaxRoute) {
|
|
2656
|
-
props.setMaxRoute(null);
|
|
2657
|
-
}
|
|
2658
|
-
} else {
|
|
2659
|
-
roundAmounts(routes).then(function (roundedRoutes) {
|
|
2660
|
-
var selected = selectedRoute ? roundedRoutes[allRoutes.indexOf(selectedRoute)] || roundedRoutes[0] : roundedRoutes[0];
|
|
2661
|
-
setSelectedRoute(selected);
|
|
2662
|
-
setAllRoutes(roundedRoutes);
|
|
2663
|
-
|
|
2664
|
-
if (props.setMaxRoute) {
|
|
2665
|
-
props.setMaxRoute(findMaxRoute(roundedRoutes));
|
|
2666
|
-
}
|
|
2667
|
-
});
|
|
2668
|
-
}
|
|
2669
|
-
});
|
|
2701
|
+
routePayments(Object.assign({}, props, {
|
|
2702
|
+
account: account
|
|
2703
|
+
})).then(onRoutesUpdate);
|
|
2670
2704
|
};
|
|
2671
2705
|
|
|
2672
2706
|
var roundAmounts = /*#__PURE__*/function () {
|
|
@@ -3781,11 +3815,11 @@ var PaymentTrackingProvider = (function (props) {
|
|
|
3781
3815
|
paymentRoute = _useState6[0],
|
|
3782
3816
|
setPaymentRoute = _useState6[1];
|
|
3783
3817
|
|
|
3784
|
-
var _useState7 = useState(!!(track && (track.endpoint || typeof track.method == 'function'))),
|
|
3818
|
+
var _useState7 = useState(!!(track && (track.endpoint || typeof track.method == 'function') && track.async != true)),
|
|
3785
3819
|
_useState8 = _slicedToArray(_useState7, 1),
|
|
3786
3820
|
tracking = _useState8[0];
|
|
3787
3821
|
|
|
3788
|
-
var _useState9 = useState(!!(track && track.poll && (track.poll.endpoint || typeof track.poll.method == 'function'))),
|
|
3822
|
+
var _useState9 = useState(!!(track && track.poll && (track.poll.endpoint || typeof track.poll.method == 'function') && track.async != true)),
|
|
3789
3823
|
_useState10 = _slicedToArray(_useState9, 1),
|
|
3790
3824
|
polling = _useState10[0];
|
|
3791
3825
|
|
|
@@ -3951,6 +3985,10 @@ var PaymentTrackingProvider = (function (props) {
|
|
|
3951
3985
|
return;
|
|
3952
3986
|
}
|
|
3953
3987
|
|
|
3988
|
+
if (!tracking) {
|
|
3989
|
+
return;
|
|
3990
|
+
}
|
|
3991
|
+
|
|
3954
3992
|
var pollingInterval = setInterval(function () {
|
|
3955
3993
|
return pollStatus(polling, transaction, afterBlock, paymentRoute, pollingInterval);
|
|
3956
3994
|
}, 5000);
|
|
@@ -4006,6 +4044,10 @@ var PaymentTrackingProvider = (function (props) {
|
|
|
4006
4044
|
var initializeTracking = function initializeTracking(transaction, afterBlock, paymentRoute) {
|
|
4007
4045
|
storePayment(transaction, afterBlock, paymentRoute, 1);
|
|
4008
4046
|
|
|
4047
|
+
if (tracking || track && track.async == true) {
|
|
4048
|
+
startTracking(transaction, afterBlock, paymentRoute);
|
|
4049
|
+
}
|
|
4050
|
+
|
|
4009
4051
|
if (tracking == false) {
|
|
4010
4052
|
return;
|
|
4011
4053
|
}
|
|
@@ -4014,7 +4056,6 @@ var PaymentTrackingProvider = (function (props) {
|
|
|
4014
4056
|
setAfterBlock(afterBlock);
|
|
4015
4057
|
setPaymentRoute(paymentRoute);
|
|
4016
4058
|
openSocket(transaction);
|
|
4017
|
-
startTracking(transaction, afterBlock, paymentRoute);
|
|
4018
4059
|
};
|
|
4019
4060
|
|
|
4020
4061
|
return /*#__PURE__*/React.createElement(PaymentTrackingContext.Provider, {
|
|
@@ -4872,6 +4913,23 @@ var Payment = /*#__PURE__*/function () {
|
|
|
4872
4913
|
};
|
|
4873
4914
|
}();
|
|
4874
4915
|
|
|
4916
|
+
Payment.preload = function (_ref5) {
|
|
4917
|
+
var account = _ref5.account,
|
|
4918
|
+
accept = _ref5.accept,
|
|
4919
|
+
whitelist = _ref5.whitelist,
|
|
4920
|
+
blacklist = _ref5.blacklist,
|
|
4921
|
+
event = _ref5.event,
|
|
4922
|
+
fee = _ref5.fee;
|
|
4923
|
+
routePayments({
|
|
4924
|
+
account: account,
|
|
4925
|
+
accept: accept,
|
|
4926
|
+
whitelist: whitelist,
|
|
4927
|
+
blacklist: blacklist,
|
|
4928
|
+
event: event,
|
|
4929
|
+
fee: fee
|
|
4930
|
+
});
|
|
4931
|
+
};
|
|
4932
|
+
|
|
4875
4933
|
var SaleRoutingContext = /*#__PURE__*/React.createContext();
|
|
4876
4934
|
|
|
4877
4935
|
var ToTokenContext = /*#__PURE__*/React.createContext();
|