@depay/widgets 8.0.7 → 8.1.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 +26 -0
- package/dist/esm/index.bundle.js +10 -10
- package/dist/esm/index.js +118 -62
- package/dist/umd/index.bundle.js +6 -6
- package/dist/umd/index.js +118 -62
- package/package.json +2 -2
package/dist/umd/index.js
CHANGED
|
@@ -207,14 +207,9 @@
|
|
|
207
207
|
};
|
|
208
208
|
}
|
|
209
209
|
function maybeInvokeDelegate(delegate, context) {
|
|
210
|
-
var
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
if (delegate.iterator["return"] && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method)) return ContinueSentinel;
|
|
214
|
-
context.method = "throw", context.arg = new TypeError("The iterator does not provide a 'throw' method");
|
|
215
|
-
}
|
|
216
|
-
return ContinueSentinel;
|
|
217
|
-
}
|
|
210
|
+
var methodName = context.method,
|
|
211
|
+
method = delegate.iterator[methodName];
|
|
212
|
+
if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator["return"] && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel;
|
|
218
213
|
var record = tryCatch(method, delegate.iterator, context.arg);
|
|
219
214
|
if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel;
|
|
220
215
|
var info = record.arg;
|
|
@@ -408,28 +403,33 @@
|
|
|
408
403
|
}
|
|
409
404
|
|
|
410
405
|
function _iterableToArrayLimit(arr, i) {
|
|
411
|
-
var _i =
|
|
412
|
-
if (
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
if (i && _arr.length === i) break;
|
|
421
|
-
}
|
|
422
|
-
} catch (err) {
|
|
423
|
-
_d = true;
|
|
424
|
-
_e = err;
|
|
425
|
-
} finally {
|
|
406
|
+
var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"];
|
|
407
|
+
if (null != _i) {
|
|
408
|
+
var _s,
|
|
409
|
+
_e,
|
|
410
|
+
_x,
|
|
411
|
+
_r,
|
|
412
|
+
_arr = [],
|
|
413
|
+
_n = !0,
|
|
414
|
+
_d = !1;
|
|
426
415
|
try {
|
|
427
|
-
if (
|
|
416
|
+
if (_x = (_i = _i.call(arr)).next, 0 === i) {
|
|
417
|
+
if (Object(_i) !== _i) return;
|
|
418
|
+
_n = !1;
|
|
419
|
+
} else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0) {
|
|
420
|
+
;
|
|
421
|
+
}
|
|
422
|
+
} catch (err) {
|
|
423
|
+
_d = !0, _e = err;
|
|
428
424
|
} finally {
|
|
429
|
-
|
|
425
|
+
try {
|
|
426
|
+
if (!_n && null != _i["return"] && (_r = _i["return"](), Object(_r) !== _r)) return;
|
|
427
|
+
} finally {
|
|
428
|
+
if (_d) throw _e;
|
|
429
|
+
}
|
|
430
430
|
}
|
|
431
|
+
return _arr;
|
|
431
432
|
}
|
|
432
|
-
return _arr;
|
|
433
433
|
}
|
|
434
434
|
|
|
435
435
|
function _arrayLikeToArray(arr, len) {
|
|
@@ -863,13 +863,29 @@
|
|
|
863
863
|
}
|
|
864
864
|
}
|
|
865
865
|
|
|
866
|
+
function _toPrimitive(input, hint) {
|
|
867
|
+
if (_typeof(input) !== "object" || input === null) return input;
|
|
868
|
+
var prim = input[Symbol.toPrimitive];
|
|
869
|
+
if (prim !== undefined) {
|
|
870
|
+
var res = prim.call(input, hint || "default");
|
|
871
|
+
if (_typeof(res) !== "object") return res;
|
|
872
|
+
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
873
|
+
}
|
|
874
|
+
return (hint === "string" ? String : Number)(input);
|
|
875
|
+
}
|
|
876
|
+
|
|
877
|
+
function _toPropertyKey(arg) {
|
|
878
|
+
var key = _toPrimitive(arg, "string");
|
|
879
|
+
return _typeof(key) === "symbol" ? key : String(key);
|
|
880
|
+
}
|
|
881
|
+
|
|
866
882
|
function _defineProperties(target, props) {
|
|
867
883
|
for (var i = 0; i < props.length; i++) {
|
|
868
884
|
var descriptor = props[i];
|
|
869
885
|
descriptor.enumerable = descriptor.enumerable || false;
|
|
870
886
|
descriptor.configurable = true;
|
|
871
887
|
if ("value" in descriptor) descriptor.writable = true;
|
|
872
|
-
Object.defineProperty(target, descriptor.key, descriptor);
|
|
888
|
+
Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor);
|
|
873
889
|
}
|
|
874
890
|
}
|
|
875
891
|
function _createClass(Constructor, protoProps, staticProps) {
|
|
@@ -19088,7 +19104,9 @@
|
|
|
19088
19104
|
wallet = _useContext8.wallet;
|
|
19089
19105
|
var _useContext9 = React.useContext(PaymentTrackingContext),
|
|
19090
19106
|
release = _useContext9.release,
|
|
19091
|
-
|
|
19107
|
+
synchronousTracking = _useContext9.synchronousTracking,
|
|
19108
|
+
asynchronousTracking = _useContext9.asynchronousTracking,
|
|
19109
|
+
trackingInitialized = _useContext9.trackingInitialized,
|
|
19092
19110
|
initializePaymentTracking = _useContext9.initializeTracking;
|
|
19093
19111
|
var _useContext10 = React.useContext(TransactionTrackingContext),
|
|
19094
19112
|
foundTransaction = _useContext10.foundTransaction,
|
|
@@ -19110,7 +19128,7 @@
|
|
|
19110
19128
|
paymentState = _useState8[0],
|
|
19111
19129
|
setPaymentState = _useState8[1];
|
|
19112
19130
|
var paymentSucceeded = function paymentSucceeded(transaction) {
|
|
19113
|
-
if (
|
|
19131
|
+
if (synchronousTracking == false && (asynchronousTracking == false || trackingInitialized == true)) {
|
|
19114
19132
|
setClosable(true);
|
|
19115
19133
|
}
|
|
19116
19134
|
setPaymentState('success');
|
|
@@ -19119,11 +19137,14 @@
|
|
|
19119
19137
|
}
|
|
19120
19138
|
};
|
|
19121
19139
|
var paymentFailed = function paymentFailed(transaction, error) {
|
|
19140
|
+
if (asynchronousTracking == false || trackingInitialized == true) {
|
|
19141
|
+
setClosable(true);
|
|
19142
|
+
}
|
|
19143
|
+
set(['PaymentFailed']);
|
|
19144
|
+
setPaymentState('failed');
|
|
19122
19145
|
if (failed) {
|
|
19123
19146
|
failed(transaction, error);
|
|
19124
19147
|
}
|
|
19125
|
-
setClosable(true);
|
|
19126
|
-
set(['PaymentFailed']);
|
|
19127
19148
|
};
|
|
19128
19149
|
var pay = /*#__PURE__*/function () {
|
|
19129
19150
|
var _ref = _asyncToGenerator( /*#__PURE__*/regenerator.mark(function _callee() {
|
|
@@ -19211,6 +19232,11 @@
|
|
|
19211
19232
|
setPaymentState('success');
|
|
19212
19233
|
}
|
|
19213
19234
|
}, [release]);
|
|
19235
|
+
React.useEffect(function () {
|
|
19236
|
+
if (asynchronousTracking && trackingInitialized && (paymentState == 'success' || paymentState == 'failed')) {
|
|
19237
|
+
setClosable(true);
|
|
19238
|
+
}
|
|
19239
|
+
}, [trackingInitialized, paymentState]);
|
|
19214
19240
|
React.useEffect(function () {
|
|
19215
19241
|
if (recover) {
|
|
19216
19242
|
setClosable(false);
|
|
@@ -19316,6 +19342,7 @@
|
|
|
19316
19342
|
});
|
|
19317
19343
|
|
|
19318
19344
|
function _defineProperty(obj, key, value) {
|
|
19345
|
+
key = _toPropertyKey(key);
|
|
19319
19346
|
if (key in obj) {
|
|
19320
19347
|
Object.defineProperty(obj, key, {
|
|
19321
19348
|
value: value,
|
|
@@ -20087,7 +20114,9 @@
|
|
|
20087
20114
|
_useContext.amount;
|
|
20088
20115
|
_useContext.amountsMissing;
|
|
20089
20116
|
var _useContext2 = React.useContext(PaymentTrackingContext),
|
|
20090
|
-
|
|
20117
|
+
synchronousTracking = _useContext2.synchronousTracking,
|
|
20118
|
+
asynchronousTracking = _useContext2.asynchronousTracking,
|
|
20119
|
+
trackingInitialized = _useContext2.trackingInitialized,
|
|
20091
20120
|
release = _useContext2.release,
|
|
20092
20121
|
forwardTo = _useContext2.forwardTo;
|
|
20093
20122
|
var _useContext3 = React.useContext(PaymentContext),
|
|
@@ -20109,10 +20138,25 @@
|
|
|
20109
20138
|
var _useContext7 = React.useContext(ClosableContext),
|
|
20110
20139
|
close = _useContext7.close;
|
|
20111
20140
|
var trackingInfo = function trackingInfo() {
|
|
20112
|
-
if (
|
|
20141
|
+
if (synchronousTracking == false && asynchronousTracking == false || asynchronousTracking && trackingInitialized) {
|
|
20113
20142
|
return null;
|
|
20114
|
-
}
|
|
20115
|
-
|
|
20143
|
+
} else if (asynchronousTracking && trackingInitialized == false) {
|
|
20144
|
+
return /*#__PURE__*/React__default["default"].createElement("div", null, /*#__PURE__*/React__default["default"].createElement("div", {
|
|
20145
|
+
className: "Card transparent small disabled"
|
|
20146
|
+
}, /*#__PURE__*/React__default["default"].createElement("div", {
|
|
20147
|
+
className: "CardImage"
|
|
20148
|
+
}, /*#__PURE__*/React__default["default"].createElement("div", {
|
|
20149
|
+
className: "TextCenter"
|
|
20150
|
+
}, /*#__PURE__*/React__default["default"].createElement("div", {
|
|
20151
|
+
className: "Loading Icon"
|
|
20152
|
+
}))), /*#__PURE__*/React__default["default"].createElement("div", {
|
|
20153
|
+
className: "CardBody"
|
|
20154
|
+
}, /*#__PURE__*/React__default["default"].createElement("div", {
|
|
20155
|
+
className: "CardBodyWrapper"
|
|
20156
|
+
}, /*#__PURE__*/React__default["default"].createElement("div", {
|
|
20157
|
+
className: "Opacity05"
|
|
20158
|
+
}, "Initializing tracking")))));
|
|
20159
|
+
} else if (release) {
|
|
20116
20160
|
return /*#__PURE__*/React__default["default"].createElement("div", null, /*#__PURE__*/React__default["default"].createElement("div", {
|
|
20117
20161
|
className: "Card transparent small disabled"
|
|
20118
20162
|
}, /*#__PURE__*/React__default["default"].createElement("div", {
|
|
@@ -20170,7 +20214,7 @@
|
|
|
20170
20214
|
className: "PaddingBottomS"
|
|
20171
20215
|
}, /*#__PURE__*/React__default["default"].createElement("div", null, /*#__PURE__*/React__default["default"].createElement("a", {
|
|
20172
20216
|
className: "Card transparent small",
|
|
20173
|
-
title: "
|
|
20217
|
+
title: "Transaction has been confirmed by the network",
|
|
20174
20218
|
href: transaction === null || transaction === void 0 ? void 0 : transaction.url,
|
|
20175
20219
|
target: "_blank",
|
|
20176
20220
|
rel: "noopener noreferrer"
|
|
@@ -20186,7 +20230,7 @@
|
|
|
20186
20230
|
className: "CardBodyWrapper"
|
|
20187
20231
|
}, /*#__PURE__*/React__default["default"].createElement("div", {
|
|
20188
20232
|
className: "Opacity05"
|
|
20189
|
-
}, "
|
|
20233
|
+
}, "Transaction confirmed"))))), trackingInfo());
|
|
20190
20234
|
}
|
|
20191
20235
|
};
|
|
20192
20236
|
var approvalButton = function approvalButton() {
|
|
@@ -20252,7 +20296,7 @@
|
|
|
20252
20296
|
rel: "noopener noreferrer"
|
|
20253
20297
|
}, /*#__PURE__*/React__default["default"].createElement(LoadingText, null, "Paying"));
|
|
20254
20298
|
} else if (paymentState == 'success') {
|
|
20255
|
-
if (
|
|
20299
|
+
if (synchronousTracking == true) {
|
|
20256
20300
|
if (release) {
|
|
20257
20301
|
if (forwardTo) {
|
|
20258
20302
|
return /*#__PURE__*/React__default["default"].createElement("a", {
|
|
@@ -20272,6 +20316,11 @@
|
|
|
20272
20316
|
onClick: function onClick() {}
|
|
20273
20317
|
}, "Continue");
|
|
20274
20318
|
}
|
|
20319
|
+
} else if (asynchronousTracking == true && trackingInitialized == false) {
|
|
20320
|
+
return /*#__PURE__*/React__default["default"].createElement("button", {
|
|
20321
|
+
className: "ButtonPrimary disabled",
|
|
20322
|
+
onClick: function onClick() {}
|
|
20323
|
+
}, "Close");
|
|
20275
20324
|
} else {
|
|
20276
20325
|
return /*#__PURE__*/React__default["default"].createElement("button", {
|
|
20277
20326
|
className: "ButtonPrimary",
|
|
@@ -20395,7 +20444,7 @@
|
|
|
20395
20444
|
className: "Text PaddingTopS PaddingBottomS PaddingLeftS PaddingRightS"
|
|
20396
20445
|
}, /*#__PURE__*/React__default["default"].createElement("strong", {
|
|
20397
20446
|
className: "FontSizeM"
|
|
20398
|
-
}, "Unfortunately executing your payment failed
|
|
20447
|
+
}, "Unfortunately executing your payment failed, but you can try again."), transaction && /*#__PURE__*/React__default["default"].createElement("div", {
|
|
20399
20448
|
className: "PaddingTopS"
|
|
20400
20449
|
}, /*#__PURE__*/React__default["default"].createElement("a", {
|
|
20401
20450
|
className: "Link",
|
|
@@ -20523,20 +20572,27 @@
|
|
|
20523
20572
|
_useState6 = _slicedToArray(_useState5, 2),
|
|
20524
20573
|
paymentRoute = _useState6[0],
|
|
20525
20574
|
setPaymentRoute = _useState6[1];
|
|
20526
|
-
var _useState7 = React.useState(
|
|
20527
|
-
_useState8 = _slicedToArray(_useState7,
|
|
20528
|
-
|
|
20529
|
-
|
|
20575
|
+
var _useState7 = React.useState(false),
|
|
20576
|
+
_useState8 = _slicedToArray(_useState7, 2),
|
|
20577
|
+
trackingInitialized = _useState8[0],
|
|
20578
|
+
setTrackingInitialized = _useState8[1];
|
|
20579
|
+
var _useState9 = React.useState(!!(track && (track.endpoint || typeof track.method == 'function') && track.async != true)),
|
|
20530
20580
|
_useState10 = _slicedToArray(_useState9, 1),
|
|
20531
|
-
|
|
20532
|
-
var _useState11 = React.useState(
|
|
20533
|
-
_useState12 = _slicedToArray(_useState11,
|
|
20534
|
-
|
|
20535
|
-
|
|
20536
|
-
|
|
20537
|
-
|
|
20538
|
-
|
|
20539
|
-
|
|
20581
|
+
synchronousTracking = _useState10[0];
|
|
20582
|
+
var _useState11 = React.useState(!!(track && track.async == true)),
|
|
20583
|
+
_useState12 = _slicedToArray(_useState11, 1),
|
|
20584
|
+
asynchronousTracking = _useState12[0];
|
|
20585
|
+
var _useState13 = React.useState(!!(track && track.poll && (track.poll.endpoint || typeof track.poll.method == 'function') && track.async != true)),
|
|
20586
|
+
_useState14 = _slicedToArray(_useState13, 1),
|
|
20587
|
+
polling = _useState14[0];
|
|
20588
|
+
var _useState15 = React.useState(false),
|
|
20589
|
+
_useState16 = _slicedToArray(_useState15, 2),
|
|
20590
|
+
release = _useState16[0],
|
|
20591
|
+
setRelease = _useState16[1];
|
|
20592
|
+
var _useState17 = React.useState(),
|
|
20593
|
+
_useState18 = _slicedToArray(_useState17, 2),
|
|
20594
|
+
forwardTo = _useState18[0],
|
|
20595
|
+
setForwardTo = _useState18[1];
|
|
20540
20596
|
var _useContext3 = React.useContext(ClosableContext),
|
|
20541
20597
|
setClosable = _useContext3.setClosable;
|
|
20542
20598
|
var _useContext4 = React.useContext(NavigateContext),
|
|
@@ -20631,6 +20687,7 @@
|
|
|
20631
20687
|
to_decimals: paymentRoute.toDecimals,
|
|
20632
20688
|
fee_amount: paymentRoute === null || paymentRoute === void 0 ? void 0 : (_paymentRoute$feeAmou = paymentRoute.feeAmount) === null || _paymentRoute$feeAmou === void 0 ? void 0 : _paymentRoute$feeAmou.toString()
|
|
20633
20689
|
}).then(function (response) {
|
|
20690
|
+
setTrackingInitialized(true);
|
|
20634
20691
|
console.log('PAYMENT TRACKING INITIALIZED');
|
|
20635
20692
|
})["catch"](function (error) {
|
|
20636
20693
|
console.log('PAYMENT TRACKING FAILED', error);
|
|
@@ -20687,7 +20744,7 @@
|
|
|
20687
20744
|
if (!polling) {
|
|
20688
20745
|
return;
|
|
20689
20746
|
}
|
|
20690
|
-
if (!
|
|
20747
|
+
if (!synchronousTracking) {
|
|
20691
20748
|
return;
|
|
20692
20749
|
}
|
|
20693
20750
|
var pollingInterval = setInterval(function () {
|
|
@@ -20739,10 +20796,10 @@
|
|
|
20739
20796
|
};
|
|
20740
20797
|
var initializeTracking = function initializeTracking(transaction, afterBlock, paymentRoute) {
|
|
20741
20798
|
storePayment(transaction, afterBlock, paymentRoute);
|
|
20742
|
-
if (
|
|
20799
|
+
if (synchronousTracking || track && track.async == true) {
|
|
20743
20800
|
startTracking(transaction, afterBlock, paymentRoute);
|
|
20744
20801
|
}
|
|
20745
|
-
if (
|
|
20802
|
+
if (synchronousTracking == false) {
|
|
20746
20803
|
return;
|
|
20747
20804
|
}
|
|
20748
20805
|
setTransaction(transaction);
|
|
@@ -20752,8 +20809,10 @@
|
|
|
20752
20809
|
};
|
|
20753
20810
|
return /*#__PURE__*/React__default["default"].createElement(PaymentTrackingContext.Provider, {
|
|
20754
20811
|
value: {
|
|
20755
|
-
|
|
20812
|
+
synchronousTracking: synchronousTracking,
|
|
20813
|
+
asynchronousTracking: asynchronousTracking,
|
|
20756
20814
|
initializeTracking: initializeTracking,
|
|
20815
|
+
trackingInitialized: trackingInitialized,
|
|
20757
20816
|
continueTryTracking: continueTryTracking,
|
|
20758
20817
|
release: release,
|
|
20759
20818
|
forwardTo: forwardTo
|
|
@@ -21389,8 +21448,8 @@
|
|
|
21389
21448
|
var TrackingFailedDialog = (function () {
|
|
21390
21449
|
var _useContext = React.useContext(PaymentTrackingContext),
|
|
21391
21450
|
continueTryTracking = _useContext.continueTryTracking;
|
|
21392
|
-
var _useContext2 = React.useContext(PaymentContext)
|
|
21393
|
-
|
|
21451
|
+
var _useContext2 = React.useContext(PaymentContext);
|
|
21452
|
+
_useContext2.transaction;
|
|
21394
21453
|
var _useContext3 = React.useContext(reactDialogStack.NavigateStackContext),
|
|
21395
21454
|
navigate = _useContext3.navigate;
|
|
21396
21455
|
var tryAgain = function tryAgain() {
|
|
@@ -21417,10 +21476,7 @@
|
|
|
21417
21476
|
className: "FontSizeM"
|
|
21418
21477
|
}, "Please ensure you are connected to the internet, then click \"Try again\"."), /*#__PURE__*/React__default["default"].createElement("div", {
|
|
21419
21478
|
className: "PaddingTopS"
|
|
21420
|
-
}, /*#__PURE__*/React__default["default"].createElement("span", null, "If this keeps happening,
|
|
21421
|
-
className: "Link",
|
|
21422
|
-
href: "mailto:support@depay.com?subject=Payment%20tracking%20failed&body=Tracking%20my%20payment%20failed%0A%0ATransaction:%20".concat(transaction.url)
|
|
21423
|
-
}, "please report it"), "."))),
|
|
21479
|
+
}, /*#__PURE__*/React__default["default"].createElement("span", null, "If this keeps happening, please report it.")))),
|
|
21424
21480
|
footer: /*#__PURE__*/React__default["default"].createElement("div", {
|
|
21425
21481
|
className: "PaddingTopXS PaddingRightM PaddingLeftM PaddingBottomM"
|
|
21426
21482
|
}, /*#__PURE__*/React__default["default"].createElement("button", {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@depay/widgets",
|
|
3
3
|
"moduleName": "DePayWidgets",
|
|
4
|
-
"version": "8.0
|
|
4
|
+
"version": "8.1.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",
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
"@depay/walletconnect-v1": "^1.7.10",
|
|
44
44
|
"@depay/web3-assets": "^6.6.1",
|
|
45
45
|
"@depay/web3-blockchains": "^6.2.3",
|
|
46
|
-
"@depay/web3-client": "^10.
|
|
46
|
+
"@depay/web3-client": "^10.2.0",
|
|
47
47
|
"@depay/web3-constants": "^6.3.2",
|
|
48
48
|
"@depay/web3-exchanges": "^11.2.4",
|
|
49
49
|
"@depay/web3-payments": "^10.8.4",
|