@depay/widgets 7.15.2 → 7.16.1
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 +110 -86
- package/dist/umd/index.bundle.js +3 -3
- package/dist/umd/index.js +110 -86
- package/package.json +2 -2
package/dist/umd/index.js
CHANGED
|
@@ -18933,7 +18933,7 @@
|
|
|
18933
18933
|
maxRoute = _useState12[0],
|
|
18934
18934
|
setMaxRoute = _useState12[1];
|
|
18935
18935
|
|
|
18936
|
-
var _useState13 = React.useState(
|
|
18936
|
+
var _useState13 = React.useState(),
|
|
18937
18937
|
_useState14 = _slicedToArray(_useState13, 2),
|
|
18938
18938
|
maxAmount = _useState14[0],
|
|
18939
18939
|
setMaxAmount = _useState14[1];
|
|
@@ -19056,6 +19056,11 @@
|
|
|
19056
19056
|
toAddress: account
|
|
19057
19057
|
}).then(function (routes) {
|
|
19058
19058
|
if (routes[0] == undefined) {
|
|
19059
|
+
web3Tokens.Token.readable({
|
|
19060
|
+
amount: maxRoute.fromBalance,
|
|
19061
|
+
blockchain: maxRoute.blockchain,
|
|
19062
|
+
address: maxRoute.toToken.address
|
|
19063
|
+
}).then(setMaxAmount);
|
|
19059
19064
|
return;
|
|
19060
19065
|
}
|
|
19061
19066
|
|
|
@@ -19313,30 +19318,34 @@
|
|
|
19313
19318
|
switch (_context.prev = _context.next) {
|
|
19314
19319
|
case 0:
|
|
19315
19320
|
if (!before) {
|
|
19316
|
-
_context.next =
|
|
19321
|
+
_context.next = 6;
|
|
19317
19322
|
break;
|
|
19318
19323
|
}
|
|
19319
19324
|
|
|
19320
|
-
|
|
19325
|
+
_context.next = 3;
|
|
19326
|
+
return before(payment.route.transaction);
|
|
19327
|
+
|
|
19328
|
+
case 3:
|
|
19329
|
+
stop = _context.sent;
|
|
19321
19330
|
|
|
19322
19331
|
if (!(stop === false)) {
|
|
19323
|
-
_context.next =
|
|
19332
|
+
_context.next = 6;
|
|
19324
19333
|
break;
|
|
19325
19334
|
}
|
|
19326
19335
|
|
|
19327
19336
|
return _context.abrupt("return");
|
|
19328
19337
|
|
|
19329
|
-
case
|
|
19338
|
+
case 6:
|
|
19330
19339
|
setClosable(false);
|
|
19331
19340
|
setPaymentState('paying');
|
|
19332
19341
|
setUpdatable(false);
|
|
19333
|
-
_context.next =
|
|
19342
|
+
_context.next = 11;
|
|
19334
19343
|
return web3Client.request({
|
|
19335
19344
|
blockchain: payment.route.transaction.blockchain,
|
|
19336
19345
|
method: 'latestBlockNumber'
|
|
19337
19346
|
});
|
|
19338
19347
|
|
|
19339
|
-
case
|
|
19348
|
+
case 11:
|
|
19340
19349
|
currentBlock = _context.sent;
|
|
19341
19350
|
wallet.sendTransaction(Object.assign({}, payment.route.transaction, {
|
|
19342
19351
|
sent: function sent(transaction) {
|
|
@@ -19362,7 +19371,7 @@
|
|
|
19362
19371
|
}
|
|
19363
19372
|
});
|
|
19364
19373
|
|
|
19365
|
-
case
|
|
19374
|
+
case 13:
|
|
19366
19375
|
case "end":
|
|
19367
19376
|
return _context.stop();
|
|
19368
19377
|
}
|
|
@@ -20372,7 +20381,11 @@
|
|
|
20372
20381
|
|
|
20373
20382
|
var toValidValue = function toValidValue(value) {
|
|
20374
20383
|
value = toValidStep(value);
|
|
20375
|
-
|
|
20384
|
+
|
|
20385
|
+
if (maxAmount) {
|
|
20386
|
+
value = Math.max(min, Math.min(value, maxAmount));
|
|
20387
|
+
}
|
|
20388
|
+
|
|
20376
20389
|
value = toValidStep(value);
|
|
20377
20390
|
return value;
|
|
20378
20391
|
};
|
|
@@ -20399,7 +20412,7 @@
|
|
|
20399
20412
|
}, /*#__PURE__*/React__default["default"].createElement("div", {
|
|
20400
20413
|
className: "PaddingBottomM"
|
|
20401
20414
|
}, /*#__PURE__*/React__default["default"].createElement("input", {
|
|
20402
|
-
max: parseFloat(maxAmount),
|
|
20415
|
+
max: maxAmount ? parseFloat(maxAmount) : null,
|
|
20403
20416
|
min: min,
|
|
20404
20417
|
step: step,
|
|
20405
20418
|
className: "Input FontSizeXXL TextAlignCenter",
|
|
@@ -20412,7 +20425,7 @@
|
|
|
20412
20425
|
onBlur: function onBlur(event) {
|
|
20413
20426
|
setValidValue(event.target.value);
|
|
20414
20427
|
}
|
|
20415
|
-
})), /*#__PURE__*/React__default["default"].createElement("div", {
|
|
20428
|
+
})), maxAmount && /*#__PURE__*/React__default["default"].createElement("div", {
|
|
20416
20429
|
style: {
|
|
20417
20430
|
height: '40px'
|
|
20418
20431
|
}
|
|
@@ -20606,19 +20619,6 @@
|
|
|
20606
20619
|
});
|
|
20607
20620
|
});
|
|
20608
20621
|
|
|
20609
|
-
var AlertIcon = (function (props) {
|
|
20610
|
-
return /*#__PURE__*/React__default["default"].createElement("svg", {
|
|
20611
|
-
className: "AlertIcon Icon " + props.className,
|
|
20612
|
-
version: "1.1",
|
|
20613
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
20614
|
-
x: "0px",
|
|
20615
|
-
y: "0px",
|
|
20616
|
-
viewBox: "0 0 20 20"
|
|
20617
|
-
}, /*#__PURE__*/React__default["default"].createElement("path", {
|
|
20618
|
-
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"
|
|
20619
|
-
}));
|
|
20620
|
-
});
|
|
20621
|
-
|
|
20622
20622
|
var Checkmark = (function (props) {
|
|
20623
20623
|
return /*#__PURE__*/React__default["default"].createElement("svg", {
|
|
20624
20624
|
className: "Checkmark Icon " + props.className,
|
|
@@ -20693,8 +20693,7 @@
|
|
|
20693
20693
|
var _useContext2 = React.useContext(PaymentTrackingContext),
|
|
20694
20694
|
tracking = _useContext2.tracking,
|
|
20695
20695
|
release = _useContext2.release,
|
|
20696
|
-
forwardTo = _useContext2.forwardTo
|
|
20697
|
-
trackingFailed = _useContext2.trackingFailed;
|
|
20696
|
+
forwardTo = _useContext2.forwardTo;
|
|
20698
20697
|
|
|
20699
20698
|
var _useContext3 = React.useContext(PaymentContext),
|
|
20700
20699
|
payment = _useContext3.payment,
|
|
@@ -20741,37 +20740,21 @@
|
|
|
20741
20740
|
className: "Opacity05"
|
|
20742
20741
|
}, "Payment validated")))));
|
|
20743
20742
|
} else {
|
|
20744
|
-
|
|
20745
|
-
|
|
20746
|
-
|
|
20747
|
-
|
|
20748
|
-
|
|
20749
|
-
|
|
20750
|
-
|
|
20751
|
-
|
|
20752
|
-
|
|
20753
|
-
|
|
20754
|
-
|
|
20755
|
-
|
|
20756
|
-
|
|
20757
|
-
|
|
20758
|
-
}
|
|
20759
|
-
return /*#__PURE__*/React__default["default"].createElement("div", null, /*#__PURE__*/React__default["default"].createElement("div", {
|
|
20760
|
-
className: "Card transparent small disabled"
|
|
20761
|
-
}, /*#__PURE__*/React__default["default"].createElement("div", {
|
|
20762
|
-
className: "CardImage"
|
|
20763
|
-
}, /*#__PURE__*/React__default["default"].createElement("div", {
|
|
20764
|
-
className: "TextCenter"
|
|
20765
|
-
}, /*#__PURE__*/React__default["default"].createElement("div", {
|
|
20766
|
-
className: "Loading Icon"
|
|
20767
|
-
}))), /*#__PURE__*/React__default["default"].createElement("div", {
|
|
20768
|
-
className: "CardBody"
|
|
20769
|
-
}, /*#__PURE__*/React__default["default"].createElement("div", {
|
|
20770
|
-
className: "CardBodyWrapper"
|
|
20771
|
-
}, /*#__PURE__*/React__default["default"].createElement("div", {
|
|
20772
|
-
className: "Opacity05"
|
|
20773
|
-
}, "Validating payment")))));
|
|
20774
|
-
}
|
|
20743
|
+
return /*#__PURE__*/React__default["default"].createElement("div", null, /*#__PURE__*/React__default["default"].createElement("div", {
|
|
20744
|
+
className: "Card transparent small disabled"
|
|
20745
|
+
}, /*#__PURE__*/React__default["default"].createElement("div", {
|
|
20746
|
+
className: "CardImage"
|
|
20747
|
+
}, /*#__PURE__*/React__default["default"].createElement("div", {
|
|
20748
|
+
className: "TextCenter"
|
|
20749
|
+
}, /*#__PURE__*/React__default["default"].createElement("div", {
|
|
20750
|
+
className: "Loading Icon"
|
|
20751
|
+
}))), /*#__PURE__*/React__default["default"].createElement("div", {
|
|
20752
|
+
className: "CardBody"
|
|
20753
|
+
}, /*#__PURE__*/React__default["default"].createElement("div", {
|
|
20754
|
+
className: "CardBodyWrapper"
|
|
20755
|
+
}, /*#__PURE__*/React__default["default"].createElement("div", {
|
|
20756
|
+
className: "Opacity05"
|
|
20757
|
+
}, "Validating payment")))));
|
|
20775
20758
|
}
|
|
20776
20759
|
};
|
|
20777
20760
|
|
|
@@ -21154,8 +21137,8 @@
|
|
|
21154
21137
|
});
|
|
21155
21138
|
|
|
21156
21139
|
var PaymentTrackingProvider = (function (props) {
|
|
21157
|
-
var _useContext = React.useContext(ErrorContext)
|
|
21158
|
-
|
|
21140
|
+
var _useContext = React.useContext(ErrorContext);
|
|
21141
|
+
_useContext.errorCallback;
|
|
21159
21142
|
|
|
21160
21143
|
var _useContext2 = React.useContext(ConfigurationContext),
|
|
21161
21144
|
track = _useContext2.track,
|
|
@@ -21192,20 +21175,16 @@
|
|
|
21192
21175
|
release = _useState12[0],
|
|
21193
21176
|
setRelease = _useState12[1];
|
|
21194
21177
|
|
|
21195
|
-
var _useState13 = React.useState(
|
|
21178
|
+
var _useState13 = React.useState(),
|
|
21196
21179
|
_useState14 = _slicedToArray(_useState13, 2),
|
|
21197
|
-
|
|
21198
|
-
|
|
21199
|
-
|
|
21200
|
-
var _useState15 = React.useState(),
|
|
21201
|
-
_useState16 = _slicedToArray(_useState15, 2),
|
|
21202
|
-
forwardTo = _useState16[0],
|
|
21203
|
-
setForwardTo = _useState16[1];
|
|
21180
|
+
forwardTo = _useState14[0],
|
|
21181
|
+
setForwardTo = _useState14[1];
|
|
21204
21182
|
|
|
21205
21183
|
var _useContext3 = React.useContext(ClosableContext),
|
|
21206
21184
|
setClosable = _useContext3.setClosable;
|
|
21207
21185
|
|
|
21208
21186
|
var _useContext4 = React.useContext(NavigateContext),
|
|
21187
|
+
navigate = _useContext4.navigate,
|
|
21209
21188
|
set = _useContext4.set;
|
|
21210
21189
|
|
|
21211
21190
|
var openSocket = function openSocket(transaction) {
|
|
@@ -21263,23 +21242,23 @@
|
|
|
21263
21242
|
|
|
21264
21243
|
var retryStartTracking = function retryStartTracking(transaction, afterBlock, paymentRoute, attempt) {
|
|
21265
21244
|
attempt = parseInt(attempt || 1, 10);
|
|
21245
|
+
console.log('attempt', attempt);
|
|
21246
|
+
console.log('track.attempts', track === null || track === void 0 ? void 0 : track.attempts);
|
|
21266
21247
|
|
|
21267
|
-
if (attempt <
|
|
21248
|
+
if (attempt < ((track === null || track === void 0 ? void 0 : track.attempts) || 40)) {
|
|
21268
21249
|
setTimeout(function () {
|
|
21269
21250
|
startTracking(transaction, afterBlock, paymentRoute, attempt + 1);
|
|
21270
21251
|
}, 3000);
|
|
21271
21252
|
} else {
|
|
21272
|
-
console.log('
|
|
21273
|
-
|
|
21274
|
-
|
|
21275
|
-
if (typeof errorCallback == 'function') {
|
|
21276
|
-
errorCallback({
|
|
21277
|
-
code: 'TRACKING_FAILED'
|
|
21278
|
-
});
|
|
21279
|
-
}
|
|
21253
|
+
console.log('navigate TrackingFailed');
|
|
21254
|
+
navigate('TrackingFailed');
|
|
21280
21255
|
}
|
|
21281
21256
|
};
|
|
21282
21257
|
|
|
21258
|
+
var continueTryTracking = function continueTryTracking() {
|
|
21259
|
+
retryStartTracking(transaction, afterBlock, paymentRoute, 1);
|
|
21260
|
+
};
|
|
21261
|
+
|
|
21283
21262
|
var callTracking = function callTracking(payment) {
|
|
21284
21263
|
if (track.endpoint) {
|
|
21285
21264
|
return fetch(track.endpoint, {
|
|
@@ -21386,10 +21365,6 @@
|
|
|
21386
21365
|
}, [polling, transaction, afterBlock, paymentRoute]);
|
|
21387
21366
|
|
|
21388
21367
|
var storePayment = function storePayment(transaction, afterBlock, paymentRoute, attempt) {
|
|
21389
|
-
if (attempt > 3) {
|
|
21390
|
-
return;
|
|
21391
|
-
}
|
|
21392
|
-
|
|
21393
21368
|
fetch('https://public.depay.com/payments', {
|
|
21394
21369
|
headers: {
|
|
21395
21370
|
'Content-Type': 'application/json'
|
|
@@ -21420,18 +21395,18 @@
|
|
|
21420
21395
|
}).then(function (response) {
|
|
21421
21396
|
if (response.status == 200 || response.status == 201) ; else {
|
|
21422
21397
|
setTimeout(function () {
|
|
21423
|
-
storePayment(transaction, afterBlock, paymentRoute
|
|
21398
|
+
storePayment(transaction, afterBlock, paymentRoute);
|
|
21424
21399
|
}, 3000);
|
|
21425
21400
|
}
|
|
21426
21401
|
})["catch"](function (error) {
|
|
21427
21402
|
setTimeout(function () {
|
|
21428
|
-
storePayment(transaction, afterBlock, paymentRoute
|
|
21403
|
+
storePayment(transaction, afterBlock, paymentRoute);
|
|
21429
21404
|
}, 3000);
|
|
21430
21405
|
});
|
|
21431
21406
|
};
|
|
21432
21407
|
|
|
21433
21408
|
var initializeTracking = function initializeTracking(transaction, afterBlock, paymentRoute) {
|
|
21434
|
-
storePayment(transaction, afterBlock, paymentRoute
|
|
21409
|
+
storePayment(transaction, afterBlock, paymentRoute);
|
|
21435
21410
|
|
|
21436
21411
|
if (tracking || track && track.async == true) {
|
|
21437
21412
|
startTracking(transaction, afterBlock, paymentRoute);
|
|
@@ -21451,9 +21426,9 @@
|
|
|
21451
21426
|
value: {
|
|
21452
21427
|
tracking: tracking,
|
|
21453
21428
|
initializeTracking: initializeTracking,
|
|
21429
|
+
continueTryTracking: continueTryTracking,
|
|
21454
21430
|
release: release,
|
|
21455
|
-
forwardTo: forwardTo
|
|
21456
|
-
trackingFailed: trackingFailed
|
|
21431
|
+
forwardTo: forwardTo
|
|
21457
21432
|
}
|
|
21458
21433
|
}, props.children);
|
|
21459
21434
|
});
|
|
@@ -22149,6 +22124,54 @@
|
|
|
22149
22124
|
});
|
|
22150
22125
|
});
|
|
22151
22126
|
|
|
22127
|
+
var TrackingFailedDialog = (function () {
|
|
22128
|
+
var _useContext = React.useContext(PaymentTrackingContext),
|
|
22129
|
+
continueTryTracking = _useContext.continueTryTracking;
|
|
22130
|
+
|
|
22131
|
+
var _useContext2 = React.useContext(PaymentContext),
|
|
22132
|
+
transaction = _useContext2.transaction;
|
|
22133
|
+
|
|
22134
|
+
var _useContext3 = React.useContext(reactDialogStack.NavigateStackContext),
|
|
22135
|
+
navigate = _useContext3.navigate;
|
|
22136
|
+
|
|
22137
|
+
var tryAgain = function tryAgain() {
|
|
22138
|
+
continueTryTracking();
|
|
22139
|
+
navigate('back');
|
|
22140
|
+
};
|
|
22141
|
+
|
|
22142
|
+
return /*#__PURE__*/React__default["default"].createElement(Dialog$1, {
|
|
22143
|
+
stacked: false,
|
|
22144
|
+
header: /*#__PURE__*/React__default["default"].createElement("div", {
|
|
22145
|
+
className: "PaddingTopS PaddingLeftM PaddingRightM"
|
|
22146
|
+
}),
|
|
22147
|
+
body: /*#__PURE__*/React__default["default"].createElement("div", {
|
|
22148
|
+
className: "TextCenter"
|
|
22149
|
+
}, /*#__PURE__*/React__default["default"].createElement("div", {
|
|
22150
|
+
className: "GraphicWrapper"
|
|
22151
|
+
}, /*#__PURE__*/React__default["default"].createElement("img", {
|
|
22152
|
+
className: "Graphic",
|
|
22153
|
+
src: ErrorGraphic
|
|
22154
|
+
})), /*#__PURE__*/React__default["default"].createElement("h1", {
|
|
22155
|
+
className: "LineHeightL Text FontSizeL PaddingTopS FontWeightBold"
|
|
22156
|
+
}, "Tracking payment failed"), /*#__PURE__*/React__default["default"].createElement("div", {
|
|
22157
|
+
className: "Text PaddingTopS PaddingBottomS PaddingLeftS PaddingRightS"
|
|
22158
|
+
}, /*#__PURE__*/React__default["default"].createElement("strong", {
|
|
22159
|
+
className: "FontSizeM"
|
|
22160
|
+
}, "Please ensure you are connected to the internet, then click \"Try again\"."), /*#__PURE__*/React__default["default"].createElement("div", {
|
|
22161
|
+
className: "PaddingTopS"
|
|
22162
|
+
}, /*#__PURE__*/React__default["default"].createElement("span", null, "If this keeps happening, "), /*#__PURE__*/React__default["default"].createElement("a", {
|
|
22163
|
+
className: "Link",
|
|
22164
|
+
href: "mailto:support@depay.com?subject=Payment%20tracking%20failed&body=Tracking%20my%20payment%20failed%0A%0ATransaction:%20".concat(transaction.url)
|
|
22165
|
+
}, "please report it"), "."))),
|
|
22166
|
+
footer: /*#__PURE__*/React__default["default"].createElement("div", {
|
|
22167
|
+
className: "PaddingTopXS PaddingRightM PaddingLeftM PaddingBottomM"
|
|
22168
|
+
}, /*#__PURE__*/React__default["default"].createElement("button", {
|
|
22169
|
+
className: "ButtonPrimary",
|
|
22170
|
+
onClick: tryAgain
|
|
22171
|
+
}, "Try again"))
|
|
22172
|
+
});
|
|
22173
|
+
});
|
|
22174
|
+
|
|
22152
22175
|
var PaymentStack = (function (props) {
|
|
22153
22176
|
var _useContext = React.useContext(ClosableContext),
|
|
22154
22177
|
open = _useContext.open,
|
|
@@ -22169,7 +22192,8 @@
|
|
|
22169
22192
|
ChangeAmount: /*#__PURE__*/React__default["default"].createElement(ChangeAmountDialog, null),
|
|
22170
22193
|
ChangePayment: /*#__PURE__*/React__default["default"].createElement(ChangePaymentDialog, null),
|
|
22171
22194
|
PaymentError: /*#__PURE__*/React__default["default"].createElement(PaymentErrorDialog, null),
|
|
22172
|
-
WrongNetwork: /*#__PURE__*/React__default["default"].createElement(WrongNetworkDialog, null)
|
|
22195
|
+
WrongNetwork: /*#__PURE__*/React__default["default"].createElement(WrongNetworkDialog, null),
|
|
22196
|
+
TrackingFailed: /*#__PURE__*/React__default["default"].createElement(TrackingFailedDialog, null)
|
|
22173
22197
|
}
|
|
22174
22198
|
});
|
|
22175
22199
|
});
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@depay/widgets",
|
|
3
3
|
"moduleName": "DePayWidgets",
|
|
4
|
-
"version": "7.
|
|
4
|
+
"version": "7.16.1",
|
|
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",
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"@depay/web3-client": "^8.5.0",
|
|
45
45
|
"@depay/web3-constants": "^6.0.0",
|
|
46
46
|
"@depay/web3-exchanges": "^9.2.0",
|
|
47
|
-
"@depay/web3-payments": "^10.6.
|
|
47
|
+
"@depay/web3-payments": "^10.6.2",
|
|
48
48
|
"@depay/web3-tokens": "^8.2.0",
|
|
49
49
|
"@depay/web3-wallets": "^11.1.1",
|
|
50
50
|
"decimal.js": "^10.3.1"
|