@depay/widgets 7.15.3 → 7.16.2
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 +2 -2
- package/dist/esm/index.bundle.js +3 -3
- package/dist/esm/index.js +113 -102
- package/dist/umd/index.bundle.js +3 -3
- package/dist/umd/index.js +113 -102
- package/package.json +2 -2
package/dist/esm/index.js
CHANGED
|
@@ -1627,15 +1627,11 @@ var round = (function (input) {
|
|
|
1627
1627
|
|
|
1628
1628
|
var direction = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'up';
|
|
1629
1629
|
var inputAsFloat = parseFloat(input);
|
|
1630
|
-
var digitsAfterDecimal = inputAsFloat.toString().match(/\d+\.0*(\d{
|
|
1630
|
+
var digitsAfterDecimal = inputAsFloat.toString().match(/\d+\.0*(\d{5})/);
|
|
1631
1631
|
|
|
1632
1632
|
if ((_digitsAfterDecimal = digitsAfterDecimal) !== null && _digitsAfterDecimal !== void 0 && _digitsAfterDecimal.length) {
|
|
1633
1633
|
digitsAfterDecimal = digitsAfterDecimal[0];
|
|
1634
|
-
var focus = digitsAfterDecimal.match(/\d{
|
|
1635
|
-
|
|
1636
|
-
if (focus.match(/^00/)) {
|
|
1637
|
-
return inputAsFloat;
|
|
1638
|
-
}
|
|
1634
|
+
var focus = digitsAfterDecimal.match(/\d{5}$/)[0];
|
|
1639
1635
|
|
|
1640
1636
|
var _float;
|
|
1641
1637
|
|
|
@@ -1643,35 +1639,35 @@ var round = (function (input) {
|
|
|
1643
1639
|
|
|
1644
1640
|
if (focus.match(/^0/)) {
|
|
1645
1641
|
if (direction == 'up') {
|
|
1646
|
-
_float = parseFloat("".concat(focus[1], ".").concat(focus[2]));
|
|
1642
|
+
_float = parseFloat("".concat(focus[1], ".").concat(focus[2]).concat(focus[3]).concat(focus[4]));
|
|
1647
1643
|
} else {
|
|
1648
|
-
_float = parseFloat("".concat(focus[1], ".").concat(focus[2]));
|
|
1644
|
+
_float = parseFloat("".concat(focus[1], ".").concat(focus[2]).concat(focus[3]).concat(focus[4]));
|
|
1649
1645
|
}
|
|
1650
1646
|
|
|
1651
|
-
focusToFixed = parseFloat(_float).toFixed(
|
|
1647
|
+
focusToFixed = parseFloat(_float).toFixed(3);
|
|
1652
1648
|
focusToFixed = "0".concat(focusToFixed).replace('.', '');
|
|
1653
1649
|
} else {
|
|
1654
1650
|
if (direction == 'up') {
|
|
1655
|
-
_float = parseFloat("".concat(focus[0], ".").concat(focus[1], "9"));
|
|
1651
|
+
_float = parseFloat("".concat(focus[0], ".").concat(focus[1]).concat(focus[2]).concat(focus[3], "9"));
|
|
1656
1652
|
} else {
|
|
1657
|
-
_float = parseFloat("".concat(focus[0], ".").concat(focus[1], "1"));
|
|
1653
|
+
_float = parseFloat("".concat(focus[0], ".").concat(focus[1]).concat(focus[2]).concat(focus[3], "1"));
|
|
1658
1654
|
}
|
|
1659
1655
|
|
|
1660
|
-
focusToFixed = parseFloat(_float).toFixed(
|
|
1656
|
+
focusToFixed = parseFloat(_float).toFixed(3).replace('.', '');
|
|
1661
1657
|
}
|
|
1662
1658
|
|
|
1663
|
-
if (focusToFixed == '
|
|
1664
|
-
focusToFixed = direction == 'up' ? '
|
|
1665
|
-
return parseFloat(digitsAfterDecimal.replace(/\d{
|
|
1666
|
-
} else if (focusToFixed == '
|
|
1667
|
-
return parseFloat(digitsAfterDecimal.replace(/\d{
|
|
1668
|
-
} else if (focusToFixed.toString()[0] != "0" && focusToFixed.toString().length >
|
|
1659
|
+
if (focusToFixed == '09999' && parseInt(inputAsFloat.toFixed(0)) == 0) {
|
|
1660
|
+
focusToFixed = direction == 'up' ? '10000' : '09999';
|
|
1661
|
+
return parseFloat(digitsAfterDecimal.replace(/\d{5}$/, focusToFixed));
|
|
1662
|
+
} else if (focusToFixed == '10000' && parseInt(inputAsFloat.toFixed(0)) == 0) {
|
|
1663
|
+
return parseFloat(digitsAfterDecimal.replace(/\d{6}$/, focusToFixed));
|
|
1664
|
+
} else if (focusToFixed.toString()[0] != "0" && focusToFixed.toString().length > 4) {
|
|
1669
1665
|
return parseInt(inputAsFloat.toFixed(0));
|
|
1670
1666
|
} else {
|
|
1671
|
-
return parseFloat(digitsAfterDecimal.replace(/\d{
|
|
1667
|
+
return parseFloat(digitsAfterDecimal.replace(/\d{5}$/, focusToFixed));
|
|
1672
1668
|
}
|
|
1673
1669
|
} else {
|
|
1674
|
-
return parseFloat(inputAsFloat.toFixed(
|
|
1670
|
+
return parseFloat(inputAsFloat.toFixed(4));
|
|
1675
1671
|
}
|
|
1676
1672
|
});
|
|
1677
1673
|
|
|
@@ -19323,30 +19319,34 @@ var PaymentProvider = (function (props) {
|
|
|
19323
19319
|
switch (_context.prev = _context.next) {
|
|
19324
19320
|
case 0:
|
|
19325
19321
|
if (!before) {
|
|
19326
|
-
_context.next =
|
|
19322
|
+
_context.next = 6;
|
|
19327
19323
|
break;
|
|
19328
19324
|
}
|
|
19329
19325
|
|
|
19330
|
-
|
|
19326
|
+
_context.next = 3;
|
|
19327
|
+
return before(payment.route.transaction);
|
|
19328
|
+
|
|
19329
|
+
case 3:
|
|
19330
|
+
stop = _context.sent;
|
|
19331
19331
|
|
|
19332
19332
|
if (!(stop === false)) {
|
|
19333
|
-
_context.next =
|
|
19333
|
+
_context.next = 6;
|
|
19334
19334
|
break;
|
|
19335
19335
|
}
|
|
19336
19336
|
|
|
19337
19337
|
return _context.abrupt("return");
|
|
19338
19338
|
|
|
19339
|
-
case
|
|
19339
|
+
case 6:
|
|
19340
19340
|
setClosable(false);
|
|
19341
19341
|
setPaymentState('paying');
|
|
19342
19342
|
setUpdatable(false);
|
|
19343
|
-
_context.next =
|
|
19343
|
+
_context.next = 11;
|
|
19344
19344
|
return request({
|
|
19345
19345
|
blockchain: payment.route.transaction.blockchain,
|
|
19346
19346
|
method: 'latestBlockNumber'
|
|
19347
19347
|
});
|
|
19348
19348
|
|
|
19349
|
-
case
|
|
19349
|
+
case 11:
|
|
19350
19350
|
currentBlock = _context.sent;
|
|
19351
19351
|
wallet.sendTransaction(Object.assign({}, payment.route.transaction, {
|
|
19352
19352
|
sent: function sent(transaction) {
|
|
@@ -19372,7 +19372,7 @@ var PaymentProvider = (function (props) {
|
|
|
19372
19372
|
}
|
|
19373
19373
|
});
|
|
19374
19374
|
|
|
19375
|
-
case
|
|
19375
|
+
case 13:
|
|
19376
19376
|
case "end":
|
|
19377
19377
|
return _context.stop();
|
|
19378
19378
|
}
|
|
@@ -20620,19 +20620,6 @@ var DonationOverviewSkeleton = (function (props) {
|
|
|
20620
20620
|
});
|
|
20621
20621
|
});
|
|
20622
20622
|
|
|
20623
|
-
var AlertIcon = (function (props) {
|
|
20624
|
-
return /*#__PURE__*/React.createElement("svg", {
|
|
20625
|
-
className: "AlertIcon Icon " + props.className,
|
|
20626
|
-
version: "1.1",
|
|
20627
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
20628
|
-
x: "0px",
|
|
20629
|
-
y: "0px",
|
|
20630
|
-
viewBox: "0 0 20 20"
|
|
20631
|
-
}, /*#__PURE__*/React.createElement("path", {
|
|
20632
|
-
d: "M19.64 16.36L11.53 2.3A1.85 1.85 0 0 0 10 1.21 1.85 1.85 0 0 0 8.48 2.3L.36 16.36C-.48 17.81.21 19 1.88 19h16.24c1.67 0 2.36-1.19 1.52-2.64zM11 16H9v-2h2zm0-4H9V6h2z"
|
|
20633
|
-
}));
|
|
20634
|
-
});
|
|
20635
|
-
|
|
20636
20623
|
var Checkmark = (function (props) {
|
|
20637
20624
|
return /*#__PURE__*/React.createElement("svg", {
|
|
20638
20625
|
className: "Checkmark Icon " + props.className,
|
|
@@ -20707,8 +20694,7 @@ var Footer = (function () {
|
|
|
20707
20694
|
var _useContext2 = useContext(PaymentTrackingContext),
|
|
20708
20695
|
tracking = _useContext2.tracking,
|
|
20709
20696
|
release = _useContext2.release,
|
|
20710
|
-
forwardTo = _useContext2.forwardTo
|
|
20711
|
-
trackingFailed = _useContext2.trackingFailed;
|
|
20697
|
+
forwardTo = _useContext2.forwardTo;
|
|
20712
20698
|
|
|
20713
20699
|
var _useContext3 = useContext(PaymentContext),
|
|
20714
20700
|
payment = _useContext3.payment,
|
|
@@ -20755,37 +20741,21 @@ var Footer = (function () {
|
|
|
20755
20741
|
className: "Opacity05"
|
|
20756
20742
|
}, "Payment validated")))));
|
|
20757
20743
|
} else {
|
|
20758
|
-
|
|
20759
|
-
|
|
20760
|
-
|
|
20761
|
-
|
|
20762
|
-
|
|
20763
|
-
|
|
20764
|
-
|
|
20765
|
-
|
|
20766
|
-
|
|
20767
|
-
|
|
20768
|
-
|
|
20769
|
-
|
|
20770
|
-
|
|
20771
|
-
|
|
20772
|
-
}
|
|
20773
|
-
return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", {
|
|
20774
|
-
className: "Card transparent small disabled"
|
|
20775
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
20776
|
-
className: "CardImage"
|
|
20777
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
20778
|
-
className: "TextCenter"
|
|
20779
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
20780
|
-
className: "Loading Icon"
|
|
20781
|
-
}))), /*#__PURE__*/React.createElement("div", {
|
|
20782
|
-
className: "CardBody"
|
|
20783
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
20784
|
-
className: "CardBodyWrapper"
|
|
20785
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
20786
|
-
className: "Opacity05"
|
|
20787
|
-
}, "Validating payment")))));
|
|
20788
|
-
}
|
|
20744
|
+
return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", {
|
|
20745
|
+
className: "Card transparent small disabled"
|
|
20746
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
20747
|
+
className: "CardImage"
|
|
20748
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
20749
|
+
className: "TextCenter"
|
|
20750
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
20751
|
+
className: "Loading Icon"
|
|
20752
|
+
}))), /*#__PURE__*/React.createElement("div", {
|
|
20753
|
+
className: "CardBody"
|
|
20754
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
20755
|
+
className: "CardBodyWrapper"
|
|
20756
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
20757
|
+
className: "Opacity05"
|
|
20758
|
+
}, "Validating payment")))));
|
|
20789
20759
|
}
|
|
20790
20760
|
};
|
|
20791
20761
|
|
|
@@ -21168,8 +21138,8 @@ var NavigateProvider = (function (props) {
|
|
|
21168
21138
|
});
|
|
21169
21139
|
|
|
21170
21140
|
var PaymentTrackingProvider = (function (props) {
|
|
21171
|
-
var _useContext = useContext(ErrorContext)
|
|
21172
|
-
|
|
21141
|
+
var _useContext = useContext(ErrorContext);
|
|
21142
|
+
_useContext.errorCallback;
|
|
21173
21143
|
|
|
21174
21144
|
var _useContext2 = useContext(ConfigurationContext),
|
|
21175
21145
|
track = _useContext2.track,
|
|
@@ -21206,20 +21176,16 @@ var PaymentTrackingProvider = (function (props) {
|
|
|
21206
21176
|
release = _useState12[0],
|
|
21207
21177
|
setRelease = _useState12[1];
|
|
21208
21178
|
|
|
21209
|
-
var _useState13 = useState(
|
|
21179
|
+
var _useState13 = useState(),
|
|
21210
21180
|
_useState14 = _slicedToArray(_useState13, 2),
|
|
21211
|
-
|
|
21212
|
-
|
|
21213
|
-
|
|
21214
|
-
var _useState15 = useState(),
|
|
21215
|
-
_useState16 = _slicedToArray(_useState15, 2),
|
|
21216
|
-
forwardTo = _useState16[0],
|
|
21217
|
-
setForwardTo = _useState16[1];
|
|
21181
|
+
forwardTo = _useState14[0],
|
|
21182
|
+
setForwardTo = _useState14[1];
|
|
21218
21183
|
|
|
21219
21184
|
var _useContext3 = useContext(ClosableContext),
|
|
21220
21185
|
setClosable = _useContext3.setClosable;
|
|
21221
21186
|
|
|
21222
21187
|
var _useContext4 = useContext(NavigateContext),
|
|
21188
|
+
navigate = _useContext4.navigate,
|
|
21223
21189
|
set = _useContext4.set;
|
|
21224
21190
|
|
|
21225
21191
|
var openSocket = function openSocket(transaction) {
|
|
@@ -21277,23 +21243,23 @@ var PaymentTrackingProvider = (function (props) {
|
|
|
21277
21243
|
|
|
21278
21244
|
var retryStartTracking = function retryStartTracking(transaction, afterBlock, paymentRoute, attempt) {
|
|
21279
21245
|
attempt = parseInt(attempt || 1, 10);
|
|
21246
|
+
console.log('attempt', attempt);
|
|
21247
|
+
console.log('track.attempts', track === null || track === void 0 ? void 0 : track.attempts);
|
|
21280
21248
|
|
|
21281
|
-
if (attempt <
|
|
21249
|
+
if (attempt < ((track === null || track === void 0 ? void 0 : track.attempts) || 40)) {
|
|
21282
21250
|
setTimeout(function () {
|
|
21283
21251
|
startTracking(transaction, afterBlock, paymentRoute, attempt + 1);
|
|
21284
21252
|
}, 3000);
|
|
21285
21253
|
} else {
|
|
21286
|
-
console.log('
|
|
21287
|
-
|
|
21288
|
-
|
|
21289
|
-
if (typeof errorCallback == 'function') {
|
|
21290
|
-
errorCallback({
|
|
21291
|
-
code: 'TRACKING_FAILED'
|
|
21292
|
-
});
|
|
21293
|
-
}
|
|
21254
|
+
console.log('navigate TrackingFailed');
|
|
21255
|
+
navigate('TrackingFailed');
|
|
21294
21256
|
}
|
|
21295
21257
|
};
|
|
21296
21258
|
|
|
21259
|
+
var continueTryTracking = function continueTryTracking() {
|
|
21260
|
+
retryStartTracking(transaction, afterBlock, paymentRoute, 1);
|
|
21261
|
+
};
|
|
21262
|
+
|
|
21297
21263
|
var callTracking = function callTracking(payment) {
|
|
21298
21264
|
if (track.endpoint) {
|
|
21299
21265
|
return fetch(track.endpoint, {
|
|
@@ -21400,10 +21366,6 @@ var PaymentTrackingProvider = (function (props) {
|
|
|
21400
21366
|
}, [polling, transaction, afterBlock, paymentRoute]);
|
|
21401
21367
|
|
|
21402
21368
|
var storePayment = function storePayment(transaction, afterBlock, paymentRoute, attempt) {
|
|
21403
|
-
if (attempt > 3) {
|
|
21404
|
-
return;
|
|
21405
|
-
}
|
|
21406
|
-
|
|
21407
21369
|
fetch('https://public.depay.com/payments', {
|
|
21408
21370
|
headers: {
|
|
21409
21371
|
'Content-Type': 'application/json'
|
|
@@ -21434,18 +21396,18 @@ var PaymentTrackingProvider = (function (props) {
|
|
|
21434
21396
|
}).then(function (response) {
|
|
21435
21397
|
if (response.status == 200 || response.status == 201) ; else {
|
|
21436
21398
|
setTimeout(function () {
|
|
21437
|
-
storePayment(transaction, afterBlock, paymentRoute
|
|
21399
|
+
storePayment(transaction, afterBlock, paymentRoute);
|
|
21438
21400
|
}, 3000);
|
|
21439
21401
|
}
|
|
21440
21402
|
})["catch"](function (error) {
|
|
21441
21403
|
setTimeout(function () {
|
|
21442
|
-
storePayment(transaction, afterBlock, paymentRoute
|
|
21404
|
+
storePayment(transaction, afterBlock, paymentRoute);
|
|
21443
21405
|
}, 3000);
|
|
21444
21406
|
});
|
|
21445
21407
|
};
|
|
21446
21408
|
|
|
21447
21409
|
var initializeTracking = function initializeTracking(transaction, afterBlock, paymentRoute) {
|
|
21448
|
-
storePayment(transaction, afterBlock, paymentRoute
|
|
21410
|
+
storePayment(transaction, afterBlock, paymentRoute);
|
|
21449
21411
|
|
|
21450
21412
|
if (tracking || track && track.async == true) {
|
|
21451
21413
|
startTracking(transaction, afterBlock, paymentRoute);
|
|
@@ -21465,9 +21427,9 @@ var PaymentTrackingProvider = (function (props) {
|
|
|
21465
21427
|
value: {
|
|
21466
21428
|
tracking: tracking,
|
|
21467
21429
|
initializeTracking: initializeTracking,
|
|
21430
|
+
continueTryTracking: continueTryTracking,
|
|
21468
21431
|
release: release,
|
|
21469
|
-
forwardTo: forwardTo
|
|
21470
|
-
trackingFailed: trackingFailed
|
|
21432
|
+
forwardTo: forwardTo
|
|
21471
21433
|
}
|
|
21472
21434
|
}, props.children);
|
|
21473
21435
|
});
|
|
@@ -22163,6 +22125,54 @@ var PaymentOverviewDialog = (function (props) {
|
|
|
22163
22125
|
});
|
|
22164
22126
|
});
|
|
22165
22127
|
|
|
22128
|
+
var TrackingFailedDialog = (function () {
|
|
22129
|
+
var _useContext = useContext(PaymentTrackingContext),
|
|
22130
|
+
continueTryTracking = _useContext.continueTryTracking;
|
|
22131
|
+
|
|
22132
|
+
var _useContext2 = useContext(PaymentContext),
|
|
22133
|
+
transaction = _useContext2.transaction;
|
|
22134
|
+
|
|
22135
|
+
var _useContext3 = useContext(NavigateStackContext),
|
|
22136
|
+
navigate = _useContext3.navigate;
|
|
22137
|
+
|
|
22138
|
+
var tryAgain = function tryAgain() {
|
|
22139
|
+
continueTryTracking();
|
|
22140
|
+
navigate('back');
|
|
22141
|
+
};
|
|
22142
|
+
|
|
22143
|
+
return /*#__PURE__*/React.createElement(Dialog$1, {
|
|
22144
|
+
stacked: false,
|
|
22145
|
+
header: /*#__PURE__*/React.createElement("div", {
|
|
22146
|
+
className: "PaddingTopS PaddingLeftM PaddingRightM"
|
|
22147
|
+
}),
|
|
22148
|
+
body: /*#__PURE__*/React.createElement("div", {
|
|
22149
|
+
className: "TextCenter"
|
|
22150
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
22151
|
+
className: "GraphicWrapper"
|
|
22152
|
+
}, /*#__PURE__*/React.createElement("img", {
|
|
22153
|
+
className: "Graphic",
|
|
22154
|
+
src: ErrorGraphic
|
|
22155
|
+
})), /*#__PURE__*/React.createElement("h1", {
|
|
22156
|
+
className: "LineHeightL Text FontSizeL PaddingTopS FontWeightBold"
|
|
22157
|
+
}, "Tracking payment failed"), /*#__PURE__*/React.createElement("div", {
|
|
22158
|
+
className: "Text PaddingTopS PaddingBottomS PaddingLeftS PaddingRightS"
|
|
22159
|
+
}, /*#__PURE__*/React.createElement("strong", {
|
|
22160
|
+
className: "FontSizeM"
|
|
22161
|
+
}, "Please ensure you are connected to the internet, then click \"Try again\"."), /*#__PURE__*/React.createElement("div", {
|
|
22162
|
+
className: "PaddingTopS"
|
|
22163
|
+
}, /*#__PURE__*/React.createElement("span", null, "If this keeps happening, "), /*#__PURE__*/React.createElement("a", {
|
|
22164
|
+
className: "Link",
|
|
22165
|
+
href: "mailto:support@depay.com?subject=Payment%20tracking%20failed&body=Tracking%20my%20payment%20failed%0A%0ATransaction:%20".concat(transaction.url)
|
|
22166
|
+
}, "please report it"), "."))),
|
|
22167
|
+
footer: /*#__PURE__*/React.createElement("div", {
|
|
22168
|
+
className: "PaddingTopXS PaddingRightM PaddingLeftM PaddingBottomM"
|
|
22169
|
+
}, /*#__PURE__*/React.createElement("button", {
|
|
22170
|
+
className: "ButtonPrimary",
|
|
22171
|
+
onClick: tryAgain
|
|
22172
|
+
}, "Try again"))
|
|
22173
|
+
});
|
|
22174
|
+
});
|
|
22175
|
+
|
|
22166
22176
|
var PaymentStack = (function (props) {
|
|
22167
22177
|
var _useContext = useContext(ClosableContext),
|
|
22168
22178
|
open = _useContext.open,
|
|
@@ -22183,7 +22193,8 @@ var PaymentStack = (function (props) {
|
|
|
22183
22193
|
ChangeAmount: /*#__PURE__*/React.createElement(ChangeAmountDialog, null),
|
|
22184
22194
|
ChangePayment: /*#__PURE__*/React.createElement(ChangePaymentDialog, null),
|
|
22185
22195
|
PaymentError: /*#__PURE__*/React.createElement(PaymentErrorDialog, null),
|
|
22186
|
-
WrongNetwork: /*#__PURE__*/React.createElement(WrongNetworkDialog, null)
|
|
22196
|
+
WrongNetwork: /*#__PURE__*/React.createElement(WrongNetworkDialog, null),
|
|
22197
|
+
TrackingFailed: /*#__PURE__*/React.createElement(TrackingFailedDialog, null)
|
|
22187
22198
|
}
|
|
22188
22199
|
});
|
|
22189
22200
|
});
|