@depay/widgets 4.2.2 → 5.0.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 +51 -52
- package/dist/cjs/index.bundle.js +6988 -2969
- package/dist/cjs/index.js +670 -436
- package/dist/es/index.bundle.js +6988 -2969
- package/dist/es/index.js +625 -391
- package/dist/umd/index.bundle.js +6988 -2969
- package/dist/umd/index.js +662 -428
- package/package.json +15 -14
package/dist/umd/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
(function (global, factory) {
|
|
2
|
-
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('react'), require('depay
|
|
3
|
-
typeof define === 'function' && define.amd ? define(['react', 'depay
|
|
2
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('react'), require('@depay/react-dialog-stack'), require('@depay/web3-wallets'), require('react-dom'), require('@depay/react-shadow-dom'), require('ethers'), require('@depay/web3-constants'), require('decimal.js'), require('@depay/web3-exchanges'), require('@depay/web3-tokens'), require('@depay/local-currency'), require('@depay/web3-client'), require('@depay/web3-payments'), require('react-rangeslider'), require('@depay/react-token-image'), require('@depay/web3-blockchains')) :
|
|
3
|
+
typeof define === 'function' && define.amd ? define(['react', '@depay/react-dialog-stack', '@depay/web3-wallets', 'react-dom', '@depay/react-shadow-dom', 'ethers', '@depay/web3-constants', 'decimal.js', '@depay/web3-exchanges', '@depay/web3-tokens', '@depay/local-currency', '@depay/web3-client', '@depay/web3-payments', 'react-rangeslider', '@depay/react-token-image', '@depay/web3-blockchains'], factory) :
|
|
4
4
|
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.DePayWidgets = factory(global.React, global.ReactDialogStack, global.Web3Wallets, global.ReactDOM, global.ReactShadowDOM, global.ethers, global.Web3Constants, global.Decimal, global.Web3Exchanges, global.Web3Tokens, global.LocalCurrency, global.Web3Client, global.Web3Payments, global.ReactRangeslider, global.ReactTokenImage, global.Web3Blockchains));
|
|
5
|
-
})(this, (function (React,
|
|
5
|
+
})(this, (function (React, reactDialogStack, web3Wallets, ReactDOM, reactShadowDom, ethers, web3Constants, decimal_js, web3Exchanges, web3Tokens, localCurrency, web3Client, web3Payments, Slider, reactTokenImage, web3Blockchains) { 'use strict';
|
|
6
6
|
|
|
7
7
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
8
8
|
|
|
@@ -888,6 +888,8 @@
|
|
|
888
888
|
|
|
889
889
|
var ClosableContext = /*#__PURE__*/React__default$1["default"].createContext();
|
|
890
890
|
|
|
891
|
+
var UpdatableContext = /*#__PURE__*/React__default$1["default"].createContext();
|
|
892
|
+
|
|
891
893
|
var ClosableProvider = (function (props) {
|
|
892
894
|
var _useState = React.useState(true),
|
|
893
895
|
_useState2 = _slicedToArray(_useState, 2),
|
|
@@ -899,11 +901,15 @@
|
|
|
899
901
|
open = _useState4[0],
|
|
900
902
|
setOpen = _useState4[1];
|
|
901
903
|
|
|
904
|
+
var _useContext = React.useContext(UpdatableContext),
|
|
905
|
+
setUpdatable = _useContext.setUpdatable;
|
|
906
|
+
|
|
902
907
|
var close = function close() {
|
|
903
908
|
if (!closable) {
|
|
904
909
|
return;
|
|
905
910
|
}
|
|
906
911
|
|
|
912
|
+
setUpdatable(false);
|
|
907
913
|
setOpen(false);
|
|
908
914
|
setTimeout(props.unmount, 300);
|
|
909
915
|
};
|
|
@@ -956,7 +962,7 @@
|
|
|
956
962
|
});
|
|
957
963
|
|
|
958
964
|
var Dialog$1 = (function (props) {
|
|
959
|
-
var _useContext = React.useContext(
|
|
965
|
+
var _useContext = React.useContext(reactDialogStack.NavigateStackContext),
|
|
960
966
|
navigate = _useContext.navigate;
|
|
961
967
|
|
|
962
968
|
var _useContext2 = React.useContext(ClosableContext),
|
|
@@ -987,16 +993,11 @@
|
|
|
987
993
|
className: "DialogBody"
|
|
988
994
|
}, props.body), /*#__PURE__*/React__default$1["default"].createElement("div", {
|
|
989
995
|
className: "DialogFooter"
|
|
990
|
-
}, props.footer
|
|
991
|
-
href: 'https://depay.fi?utm_source=' + window.location.hostname + '&utm_medium=widget&utm_campaign=WidgetV2',
|
|
992
|
-
rel: "noopener noreferrer",
|
|
993
|
-
target: "_blank",
|
|
994
|
-
className: "FooterLink"
|
|
995
|
-
}, "by DePay")));
|
|
996
|
+
}, props.footer));
|
|
996
997
|
});
|
|
997
998
|
|
|
998
999
|
var ConnectingWalletDialog = (function (props) {
|
|
999
|
-
var _useContext = React.useContext(
|
|
1000
|
+
var _useContext = React.useContext(reactDialogStack.NavigateStackContext),
|
|
1000
1001
|
navigate = _useContext.navigate;
|
|
1001
1002
|
|
|
1002
1003
|
var wallet = props.wallet;
|
|
@@ -1042,9 +1043,9 @@
|
|
|
1042
1043
|
className: "TextButton"
|
|
1043
1044
|
}, "Connect with another wallet")))),
|
|
1044
1045
|
footer: /*#__PURE__*/React__default$1["default"].createElement("div", {
|
|
1045
|
-
className: "PaddingTopXS PaddingRightM PaddingLeftM"
|
|
1046
|
+
className: "PaddingTopXS PaddingRightM PaddingLeftM PaddingBottomM"
|
|
1046
1047
|
}, /*#__PURE__*/React__default$1["default"].createElement("button", {
|
|
1047
|
-
className: "ButtonPrimary
|
|
1048
|
+
className: "ButtonPrimary",
|
|
1048
1049
|
onClick: function onClick() {
|
|
1049
1050
|
return props.connect(wallet);
|
|
1050
1051
|
}
|
|
@@ -1073,10 +1074,10 @@
|
|
|
1073
1074
|
showExplanation = _useState2[0],
|
|
1074
1075
|
setShowExplanation = _useState2[1];
|
|
1075
1076
|
|
|
1076
|
-
var _useContext = React.useContext(
|
|
1077
|
+
var _useContext = React.useContext(reactDialogStack.NavigateStackContext),
|
|
1077
1078
|
navigate = _useContext.navigate;
|
|
1078
1079
|
|
|
1079
|
-
var wallet =
|
|
1080
|
+
var wallet = web3Wallets.getWallet();
|
|
1080
1081
|
React.useEffect( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/regenerator.mark(function _callee() {
|
|
1081
1082
|
var accounts;
|
|
1082
1083
|
return regenerator.wrap(function _callee$(_context) {
|
|
@@ -1112,7 +1113,7 @@
|
|
|
1112
1113
|
props.connect(wallet);
|
|
1113
1114
|
};
|
|
1114
1115
|
|
|
1115
|
-
var availableWallets = [
|
|
1116
|
+
var availableWallets = [web3Wallets.wallets.WalletConnect];
|
|
1116
1117
|
|
|
1117
1118
|
if (wallet) {
|
|
1118
1119
|
availableWallets.unshift(wallet);
|
|
@@ -1127,7 +1128,7 @@
|
|
|
1127
1128
|
return connect(wallet);
|
|
1128
1129
|
}
|
|
1129
1130
|
}, /*#__PURE__*/React__default$1["default"].createElement("div", {
|
|
1130
|
-
className: "CardImage
|
|
1131
|
+
className: "CardImage"
|
|
1131
1132
|
}, /*#__PURE__*/React__default$1["default"].createElement("img", {
|
|
1132
1133
|
src: wallet.logo
|
|
1133
1134
|
})), /*#__PURE__*/React__default$1["default"].createElement("div", {
|
|
@@ -1140,9 +1141,9 @@
|
|
|
1140
1141
|
});
|
|
1141
1142
|
return /*#__PURE__*/React__default$1["default"].createElement(Dialog$1, {
|
|
1142
1143
|
header: /*#__PURE__*/React__default$1["default"].createElement("div", {
|
|
1143
|
-
className: "PaddingTopS PaddingLeftM PaddingRightM"
|
|
1144
|
+
className: "PaddingTopS PaddingLeftM PaddingRightM TextLeft"
|
|
1144
1145
|
}, /*#__PURE__*/React__default$1["default"].createElement("h1", {
|
|
1145
|
-
className: "LineHeightL FontSizeL
|
|
1146
|
+
className: "LineHeightL FontSizeL"
|
|
1146
1147
|
}, "Select a wallet")),
|
|
1147
1148
|
body: /*#__PURE__*/React__default$1["default"].createElement("div", {
|
|
1148
1149
|
className: "PaddingTopS PaddingBottomXS PaddingLeftS PaddingRightS"
|
|
@@ -1150,11 +1151,13 @@
|
|
|
1150
1151
|
footer: /*#__PURE__*/React__default$1["default"].createElement("div", {
|
|
1151
1152
|
className: "PaddingBottomS"
|
|
1152
1153
|
}, /*#__PURE__*/React__default$1["default"].createElement("button", {
|
|
1153
|
-
className: "FontSizeS FontWeightBold
|
|
1154
|
+
className: "FontSizeS FontWeightBold TextButton",
|
|
1154
1155
|
onClick: function onClick() {
|
|
1155
1156
|
return setShowExplanation(!showExplanation);
|
|
1156
1157
|
}
|
|
1157
|
-
}, /*#__PURE__*/React__default$1["default"].createElement("strong",
|
|
1158
|
+
}, /*#__PURE__*/React__default$1["default"].createElement("strong", {
|
|
1159
|
+
className: "Opacity05"
|
|
1160
|
+
}, "What is a wallet?")), showExplanation && /*#__PURE__*/React__default$1["default"].createElement("p", {
|
|
1158
1161
|
className: "PaddingLeftM PaddingRightM"
|
|
1159
1162
|
}, "Wallets are used to send, receive, and store digital assets. Wallets come in many forms. They are either built into your browser, an extension added to your browser, a piece of hardware plugged into your computer or even an app on your phone."))
|
|
1160
1163
|
});
|
|
@@ -1220,7 +1223,7 @@
|
|
|
1220
1223
|
};
|
|
1221
1224
|
|
|
1222
1225
|
React.useEffect(function () {
|
|
1223
|
-
var wallet =
|
|
1226
|
+
var wallet = web3Wallets.getWallet();
|
|
1224
1227
|
|
|
1225
1228
|
if (wallet) {
|
|
1226
1229
|
setWallet(wallet);
|
|
@@ -1260,7 +1263,7 @@
|
|
|
1260
1263
|
}
|
|
1261
1264
|
}, _callee2);
|
|
1262
1265
|
})), [wallet]);
|
|
1263
|
-
return /*#__PURE__*/React__default$1["default"].createElement(
|
|
1266
|
+
return /*#__PURE__*/React__default$1["default"].createElement(reactDialogStack.ReactDialogStack, {
|
|
1264
1267
|
open: open,
|
|
1265
1268
|
close: close,
|
|
1266
1269
|
start: "SelectWallet",
|
|
@@ -1372,8 +1375,7 @@
|
|
|
1372
1375
|
let background =
|
|
1373
1376
|
typeof styles === 'object' && styles.background ? styles.background : 'rgba(0,0,0,0.4)';
|
|
1374
1377
|
|
|
1375
|
-
return
|
|
1376
|
-
`
|
|
1378
|
+
return `
|
|
1377
1379
|
.ReactDialog {
|
|
1378
1380
|
bottom: 0;
|
|
1379
1381
|
display: table;
|
|
@@ -1432,12 +1434,9 @@
|
|
|
1432
1434
|
top: -5vh;
|
|
1433
1435
|
}
|
|
1434
1436
|
`
|
|
1435
|
-
)
|
|
1436
1437
|
}
|
|
1437
1438
|
|
|
1438
|
-
const _jsxFileName = "/
|
|
1439
|
-
|
|
1440
|
-
|
|
1439
|
+
const _jsxFileName = "/home/runner/work/react-dialog/react-dialog/src/components/Dialog.jsx";
|
|
1441
1440
|
class Dialog extends React__default['default'].Component {
|
|
1442
1441
|
constructor(props) {
|
|
1443
1442
|
super(props);
|
|
@@ -1499,7 +1498,7 @@
|
|
|
1499
1498
|
}
|
|
1500
1499
|
}
|
|
1501
1500
|
|
|
1502
|
-
const _jsxFileName$1 = "/
|
|
1501
|
+
const _jsxFileName$1 = "/home/runner/work/react-dialog/react-dialog/src/index.jsx";
|
|
1503
1502
|
class ReactDialog extends React__default['default'].Component {
|
|
1504
1503
|
constructor(props) {
|
|
1505
1504
|
super(props);
|
|
@@ -1612,7 +1611,7 @@
|
|
|
1612
1611
|
})), /*#__PURE__*/React__default$1["default"].createElement("div", {
|
|
1613
1612
|
className: "DialogBody"
|
|
1614
1613
|
}, /*#__PURE__*/React__default$1["default"].createElement("div", {
|
|
1615
|
-
className: "GraphicWrapper"
|
|
1614
|
+
className: "GraphicWrapper PaddingTopS"
|
|
1616
1615
|
}, /*#__PURE__*/React__default$1["default"].createElement("img", {
|
|
1617
1616
|
className: "Graphic",
|
|
1618
1617
|
src: ErrorGraphic
|
|
@@ -1630,15 +1629,12 @@
|
|
|
1630
1629
|
className: "FontSizeM PaddingTopS"
|
|
1631
1630
|
}, "If this keeps happening, please report it.")))), /*#__PURE__*/React__default$1["default"].createElement("div", {
|
|
1632
1631
|
className: "DialogFooter"
|
|
1633
|
-
}, /*#__PURE__*/React__default$1["default"].createElement("div",
|
|
1632
|
+
}, /*#__PURE__*/React__default$1["default"].createElement("div", {
|
|
1633
|
+
className: "PaddingTopXS PaddingRightM PaddingLeftM PaddingBottomM"
|
|
1634
|
+
}, /*#__PURE__*/React__default$1["default"].createElement("button", {
|
|
1634
1635
|
className: "ButtonPrimary",
|
|
1635
1636
|
onClick: close
|
|
1636
|
-
}, "Try again"))
|
|
1637
|
-
href: 'https://depay.fi?utm_source=' + window.location.hostname + '&utm_medium=widget&utm_campaign=WidgetV2',
|
|
1638
|
-
rel: "noopener noreferrer",
|
|
1639
|
-
target: "_blank",
|
|
1640
|
-
className: "FooterLink"
|
|
1641
|
-
}, "by DePay"))));
|
|
1637
|
+
}, "Try again")))));
|
|
1642
1638
|
} else {
|
|
1643
1639
|
return /*#__PURE__*/React__default$1["default"].createElement(ErrorContext.Provider, {
|
|
1644
1640
|
value: {
|
|
@@ -1650,28 +1646,28 @@
|
|
|
1650
1646
|
}
|
|
1651
1647
|
});
|
|
1652
1648
|
|
|
1649
|
+
var BlockchainLogoStyle = (function (style) {
|
|
1650
|
+
return "\n\n .BlockchainLogo {\n border-radius: 999px;\n }\n\n .BlockchainLogo.small {\n height: 18px;\n width: 18px;\n }\n ";
|
|
1651
|
+
});
|
|
1652
|
+
|
|
1653
1653
|
var ButtonCircularStyle = (function () {
|
|
1654
1654
|
return "\n\n .ButtonCircular {\n border-radius: 99rem;\n cursor: pointer;\n height: 34px;\n opacity: 0.5;\n padding: 5px 4px 4px 4px;\n width: 34px;\n }\n\n .ButtonCircular:hover {\n background: rgba(0,0,0,0.1);\n opacity: 1;\n }\n\n .ButtonCircular:active {\n background: rgba(0,0,0,0.25);\n opacity: 1;\n }\n ";
|
|
1655
1655
|
});
|
|
1656
1656
|
|
|
1657
1657
|
var ButtonPrimaryStyle = (function (style) {
|
|
1658
|
-
return "\n\n .ButtonPrimary {\n align-items: center;\n align-self: center;\n background: ".concat(style.colors.primary, ";\n border-radius:
|
|
1658
|
+
return "\n\n .ButtonPrimary {\n align-items: center;\n align-self: center;\n background: ".concat(style.colors.primary, ";\n border-radius: 0.8rem;\n border: 1px solid transparent;\n box-shadow: 0 0 16px rgba(0,0,0,0.1);\n font-size: 1.3rem;\n font-weight: 400;\n line-height: 2.8rem;\n height: 3.6rem;\n justify-content: center;\n width: 100%;\n overflow: hidden;\n padding: 0.4rem 0;\n position: relative;\n text-align: center;\n text-decoration: none;\n text-overflow: ellipsis;\n transition: background 0.1s;\n vertical-align: middle;\n display: inline-block;\n }\n\n .ButtonPrimary, .ButtonPrimary * {\n color: ").concat(style.colors.buttonText, ";\n }\n\n .ButtonPrimary.disabled {\n background: rgb(210,210,210);\n color: rgb(140,140,140);\n }\n\n .ButtonPrimary:not(.disabled){\n cursor: pointer;\n }\n .ButtonPrimary:not(.disabled):hover {\n box-shadow: inset 0 0 300px rgba(0,0,0,0.1);\n }\n .ButtonPrimary:not(.disabled):active {\n box-shadow: inset 0 0 300px rgba(0,0,0,0.2);\n }\n ");
|
|
1659
1659
|
});
|
|
1660
1660
|
|
|
1661
1661
|
var CardStyle = (function (style) {
|
|
1662
|
-
return "\n\n .Card {\n align-items: center;\n background: rgb(255,255,255);\n border-radius: 0.8rem;\n box-shadow: 0 0 8px rgba(0,0,0,0.03);\n cursor: pointer;\n display: flex;\n flex-direction: row;\n margin-bottom: 0.5rem;\n min-height: 4.78rem;\n padding: 1rem 0.6rem;\n width: 100%;\n }\n\n a.Card, a.Card * {\n color: inherit;\n text-decoration: none;\n }\n\n .Card.small {\n min-height: auto;\n padding: 0.
|
|
1662
|
+
return "\n\n .Card {\n align-items: center;\n background: rgb(255,255,255);\n border-radius: 0.8rem;\n box-shadow: 0 0 8px rgba(0,0,0,0.03);\n cursor: pointer;\n display: flex;\n flex-direction: row;\n margin-bottom: 0.5rem;\n min-height: 4.78rem;\n padding: 1rem 0.6rem;\n width: 100%;\n }\n\n a.Card, a.Card * {\n color: inherit;\n text-decoration: none;\n }\n\n .Card.transparent {\n background: none;\n box-shadow: none;\n }\n\n .Card.small {\n min-height: auto;\n padding: 0.5rem 0.5rem;\n margin: 0;\n }\n\n .Card.disabled {\n cursor: default;\n }\n\n .Card:hover:not(.disabled) {\n background: rgb(240,240,240);\n box-shadow: 0 0 0 rgba(0,0,0,0); \n }\n\n .Card:active:not(.disabled) {\n background: rgb(235,235,235);\n box-shadow: inset 0 0 6px rgba(0,0,0,0.02);\n color: inherit;\n }\n\n .Card:hover:not(.disabled) .CardAction {\n opacity: 0.4;\n }\n\n .CardImage, .CardBody, .CardAction, .CardInfo {\n align-items: center;\n display: flex;\n min-width: 0;\n padding: 0 0.4rem;\n }\n\n .CardImage {\n flex-basis: auto;\n flex-grow: 0;\n flex-shrink: 0;\n justify-content: center;\n position: relative;\n width: 3.6rem;\n }\n\n .CardBody {\n flex-basis: auto;\n flex-grow: 1;\n flex-shrink: 1;\n line-height: 1.4rem;\n padding-left: 0.6rem;\n text-align: left;\n }\n\n .CardBodyWrapper {\n min-width: 0;\n }\n\n .CardAction {\n flex-basis: auto;\n flex-shrink: 0;\n flex-grow: 0;\n padding-right: 0;\n margin-left: auto;\n }\n\n .Card.disabled .CardAction {\n opacity: 0; \n }\n\n .CardInfo {\n display: flex;\n flex-basis: auto;\n flex-direction: column;\n flex-grow: 0;\n flex-shrink: 1;\n justify-content: center;\n margin-left: auto; \n padding-right: 0;\n }\n\n .CardImage img {\n background: white;\n border-radius: 99rem;\n border: 1px solid white;\n box-shadow: 0 2px 8px rgb(0 0 0 / 10%);\n height: 2.8rem;\n position: relative;\n vertical-align: middle;\n width: 2.8rem;\n }\n\n .CardImage .BlockchainLogo {\n position: absolute;\n bottom: 0;\n right: 0;\n }\n\n .CardTitle {\n font-size: 0.9rem;\n color: rgb(150,150,150);\n }\n \n .CardText, a .CardText {\n color: ".concat(style.colors.text, ";\n flex: 1;\n font-size: 1.3rem;\n }\n\n .CardText strong {\n font-weight: 500;\n }\n\n .CardText small {\n font-size: 1.1rem;\n color: rgb(150,150,150);\n }\n\n .CardAction {\n opacity: 0.2;\n }\n\n .Card.More {\n display: inline-block;\n text-align: center;\n }\n ");
|
|
1663
1663
|
});
|
|
1664
1664
|
|
|
1665
1665
|
var DialogStyle = (function (style) {
|
|
1666
|
-
return "\n\n .ReactDialogBackground {\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 }\n\n @media screen and (max-width: 450px) {\n \n .Dialog, .ReactDialogAnimation {\n width: 100%;\n }\n\n }\n\n @media (orientation: portrait) and (max-width: 900px) {\n\n .Dialog {\n align-content: stretch;\n display: flex;\n flex-direction: column;\n height: 100%;\n }\n\n .DialogBody {\n flex: 1;\n align-items: flex-end;\n max-height: 40vh !important;\n }\n\n .
|
|
1666
|
+
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 }\n\n @media screen and (max-width: 450px) {\n \n .Dialog, .ReactDialogAnimation {\n width: 100%;\n }\n\n }\n\n @media (orientation: portrait) and (max-width: 900px) {\n\n .Dialog {\n align-content: stretch;\n display: flex;\n flex-direction: column;\n height: 100%;\n }\n\n .DialogBody {\n flex: 1;\n align-items: flex-end;\n max-height: 40vh !important;\n }\n\n .DialogFooter {\n padding-bottom: 50px;\n }\n\n .ReactDialogStackCell {\n vertical-align: bottom;\n }\n\n .ReactDialogAnimation {\n bottom: -100px !important;\n max-height: 66vh !important;\n top: inherit !important;\n transition: opacity 0.4s ease, bottom 0.4s ease;\n }\n\n .ReactDialog.ReactDialogOpen .ReactDialogAnimation {\n bottom: 0px !important;\n }\n\n .DialogFooter {\n border-bottom-left-radius: 0 !important;\n border-bottom-right-radius: 0 !important;\n }\n }\n\n .DialogBody {\n background: rgb(248,248,248);\n overflow-x: hidden;\n overflow-y: auto;\n }\n\n .DialogBody.HeightAuto {\n height: auto;\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 display: flex;\n flex-direction: row;\n position: relative;\n }\n\n .DialogHeaderTitle {\n flex-basis: auto;\n flex-grow: 1;\n }\n \n .DialogHeaderAction {\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 .ReactShadowDOMInsideContainer > .ReactDialog {\n display: table;\n }\n\n ";
|
|
1667
1667
|
});
|
|
1668
1668
|
|
|
1669
1669
|
var FontStyle = (function (style) {
|
|
1670
|
-
return "\n\n
|
|
1671
|
-
});
|
|
1672
|
-
|
|
1673
|
-
var FooterStyle = (function (style) {
|
|
1674
|
-
return "\n\n .FooterLink {\n color: rgba(0,0,0,0.2);\n display: inline-block;\n font-size: 0.9rem;\n text-decoration: none;\n }\n\n .FooterLink:hover, .FooterLink:active {\n color: ".concat(style.colors.primary, ";\n }\n ");
|
|
1670
|
+
return "\n\n *, div, div * {\n font-family: ".concat(style.fontFamily, ";\n }\n\n .FontSizeS {\n font-size: 1rem;\n }\n\n .FontSizeM {\n font-size: 1.2rem;\n }\n\n .FontSizeL {\n font-size: 1.4rem;\n }\n\n .FontSizeXL {\n font-size: 2.0rem;\n }\n\n .FontWeightBold {\n font-weight: bold;\n }\n\n .FontItalic {\n font-style: italic;\n }\n ");
|
|
1675
1671
|
});
|
|
1676
1672
|
|
|
1677
1673
|
var GraphicStyle = (function () {
|
|
@@ -1683,7 +1679,7 @@
|
|
|
1683
1679
|
});
|
|
1684
1680
|
|
|
1685
1681
|
var IconStyle = (function (style) {
|
|
1686
|
-
return "\n\n .Icon {\n fill : ".concat(style.colors.icons, ";\n stroke : ").concat(style.colors.icons, ";\n }\n\n .ChevronLeft, .ChevronRight {\n position: relative;\n top: 1px;\n }\n\n .Checkmark {\n height:
|
|
1682
|
+
return "\n\n .Icon {\n fill : ".concat(style.colors.icons, ";\n stroke : ").concat(style.colors.icons, ";\n }\n\n .ChevronLeft, .ChevronRight {\n position: relative;\n top: 1px;\n }\n\n .Checkmark {\n height: 24px;\n position: relative;\n top: -1px;\n vertical-align: middle;\n width: 24px;\n }\n\n .CheckMark.small {\n height: 16px;\n width: 16px;\n }\n\n .DigitalWalletIcon {\n height: 24px;\n position: relative;\n top: -1px;\n vertical-align: middle;\n width: 24px;\n }\n\n .ButtonPrimary .Icon {\n fill : ").concat(style.colors.buttonText, ";\n stroke : ").concat(style.colors.buttonText, ";\n }\n\n .Loading {\n border: 3px solid ").concat(style.colors.primary, ";\n border-top: 3px solid rgba(0,0,0,0.1);\n border-radius: 100%;\n position: relative;\n left: -1px;\n width: 18px;\n height: 18px;\n animation: spin 1.5s linear infinite;\n }\n\n @keyframes spin {\n 0% { transform: rotate(0deg); }\n 100% { transform: rotate(360deg); }\n }\n ");
|
|
1687
1683
|
});
|
|
1688
1684
|
|
|
1689
1685
|
var ImageStyle = (function (style) {
|
|
@@ -1702,10 +1698,18 @@
|
|
|
1702
1698
|
return "\n\n .LoadingText {\n color: ".concat(style.colors.buttonText, ";\n display: inline-block;\n text-decoration: none;\n }\n\n @keyframes blink {\n 0% { opacity: .2; }\n 20% { opacity: 1; }\n 100% { opacity: .2; }\n }\n \n .LoadingText .dot {\n animation-name: blink;\n animation-duration: 1.4s;\n animation-iteration-count: infinite;\n animation-fill-mode: both;\n }\n \n .LoadingText .dot:nth-child(2) {\n animation-delay: .2s;\n }\n \n .LoadingText .dot:nth-child(3) {\n animation-delay: .4s;\n }\n ");
|
|
1703
1699
|
});
|
|
1704
1700
|
|
|
1701
|
+
var OpacityStyle = (function (style) {
|
|
1702
|
+
return "\n\n .Opacity05 {\n opacity: 0.5;\n }\n ";
|
|
1703
|
+
});
|
|
1704
|
+
|
|
1705
1705
|
var PaddingStyle = (function () {
|
|
1706
1706
|
return "\n\n .PaddingTopXS {\n padding-top: 0.2rem;\n }\n\n .PaddingRightXS {\n padding-right: 0.2rem;\n }\n\n .PaddingBottomXS {\n padding-bottom: 0.2rem;\n }\n\n .PaddingLeftXS {\n padding-left: 0.2rem; \n }\n\n .PaddingTopS {\n padding-top: 0.8rem;\n }\n\n .PaddingRightS {\n padding-right: 0.8rem;\n }\n\n .PaddingBottomS {\n padding-bottom: 0.8rem;\n }\n\n .PaddingLeftS {\n padding-left: 0.8rem; \n }\n\n .PaddingTopM {\n padding-top: 1.2rem;\n }\n\n .PaddingRightM {\n padding-right: 1.2rem;\n }\n\n .PaddingBottomM {\n padding-bottom: 1.2rem;\n }\n\n .PaddingLeftM {\n padding-left: 1.2rem; \n }\n\n .PaddingTopL {\n padding-top: 1.8rem;\n }\n\n .PaddingRightL {\n padding-right: 1.8rem;\n }\n\n .PaddingBottomL {\n padding-bottom: 1.8rem;\n }\n\n .PaddingLeftL {\n padding-left: 1.28em; \n }\n ";
|
|
1707
1707
|
});
|
|
1708
1708
|
|
|
1709
|
+
var PoweredByStyle = (function (style) {
|
|
1710
|
+
return "\n\n .PoweredByWrapper {\n display: block;\n left: 0;\n padding-top: 0.2rem;\n position: fixed;\n right: 0;\n text-align: center;\n top: 0;\n }\n\n .PoweredByLink {\n color: white;\n opacity: 0.4;\n display: inline-block;\n font-size: 0.78rem;\n font-style: italic;\n font-weight: bold;\n letter-spacing: -0.2px;\n margin-left: 0.5rem;\n text-decoration: none;\n }\n\n .PoweredByLink:hover, .PoweredByLink:active {\n opacity: 1.0;\n color: ".concat(style.colors.primary, ";\n }\n ");
|
|
1711
|
+
});
|
|
1712
|
+
|
|
1709
1713
|
var RangeSliderStyle = (function (style) {
|
|
1710
1714
|
return "\n\n .rangeslider {\n margin: 20px 0;\n position: relative;\n background: #e6e6e6;\n -ms-touch-action: none;\n touch-action: none;\n }\n\n .rangeslider,\n .rangeslider__fill {\n display: block;\n box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.4);\n }\n\n .rangeslider__handle {\n outline: none;\n cursor: pointer;\n display: inline-block;\n position: absolute;\n border-radius: 50%;\n background-color: " + style.colors.primary + ";\n border: 1px solid white;\n box-shadow: 0 0 8px rgba(0,0,0,0.1);\n }\n\n .rangeslider__handle:hover {\n box-shadow: inset 0 0 300px rgba(0,0,0,0.2);\n }\n\n .rangeslider__handle:active {\n box-shadow: inset 0 0 300px rgba(0,0,0,0.3);\n }\n\n .rangeslider__active {\n opacity: 1;\n }\n\n .rangeslider__handle-tooltip {\n display: none;\n }\n\n .rangeslider-horizontal {\n height: 12px;\n border-radius: 10px;\n }\n\n .rangeslider-horizontal .rangeslider__fill {\n height: 100%;\n background-color: " + style.colors.primary + ";\n border-radius: 10px;\n top: 0;\n }\n .rangeslider-horizontal .rangeslider__handle {\n width: 18px;\n height: 18px;\n border-radius: 30px;\n top: 50%;\n transform: translate3d(-50%, -50%, 0);\n }\n\n\n .rangeslider-horizontal .rangeslider__handle-tooltip {\n top: -55px;\n }\n\n ";
|
|
1711
1715
|
});
|
|
@@ -1715,15 +1719,15 @@
|
|
|
1715
1719
|
});
|
|
1716
1720
|
|
|
1717
1721
|
var SkeletonStyle = (function () {
|
|
1718
|
-
return "\n \n .Skeleton {\n background: rgb(230,230,230) !important;\n box-shadow: none !important;\n cursor: inherit !important;\n line-height: 0;\n overflow: hidden;\n position: relative;\n }\n\n @keyframes SkeletonBackgroundAnimation {\n from {\n left: -500px;\n }\n to {\n left: +120%;\n }\n }\n\n .SkeletonBackground {\n animation: 2s SkeletonBackgroundAnimation 0.2s ease infinite;\n background: linear-gradient(to right, transparent 0%, rgba(0,0,0,0.1) 50%, transparent 100%);\n height: 100%;\n left: -140%;\n position: absolute;\n top: 0;\n width: 400px;\n }\n\n .SkeletonWrapper {\n line-height: 0;\n }\n ";
|
|
1722
|
+
return "\n \n .Skeleton {\n background: rgb(230,230,230) !important;\n border: 0px solid transparent !important;\n box-shadow: none !important;\n cursor: inherit !important;\n line-height: 0;\n overflow: hidden;\n position: relative;\n }\n\n @keyframes SkeletonBackgroundAnimation {\n from {\n left: -500px;\n }\n to {\n left: +120%;\n }\n }\n\n .SkeletonBackground {\n animation: 2s SkeletonBackgroundAnimation 0.2s ease infinite;\n background: linear-gradient(to right, transparent 0%, rgba(0,0,0,0.1) 50%, transparent 100%);\n height: 100%;\n left: -140%;\n position: absolute;\n top: 0;\n width: 400px;\n }\n\n .SkeletonWrapper {\n line-height: 0;\n }\n ";
|
|
1719
1723
|
});
|
|
1720
1724
|
|
|
1721
1725
|
var TextButtonStyle = (function (style) {
|
|
1722
|
-
return "\n\n .TextButton {\n cursor: pointer;\n font-size: 16px;\n color: ".concat(style.colors.primary, "\n }\n\n .TextButton
|
|
1726
|
+
return "\n\n .TextButton {\n cursor: pointer;\n font-size: 16px;\n color: ".concat(style.colors.primary, "\n }\n\n .TextButton:hover * {\n opacity: 1.0;\n }\n ");
|
|
1723
1727
|
});
|
|
1724
1728
|
|
|
1725
1729
|
var TextStyle = (function (style) {
|
|
1726
|
-
return "\n\n * {\n color: ".concat(style.colors.text, ";\n }\n\n
|
|
1730
|
+
return "\n\n * {\n color: ".concat(style.colors.text, ";\n }\n\n h1, h2, h3, h4, h5, h6 {\n display: block;\n }\n\n .TextLeft, .TextLeft * {\n text-align: left;\n }\n\n .TextCenter, .TextCenter * {\n text-align: center;\n }\n\n .LineHeightL {\n line-height: 2.0rem;\n }\n\n .ErrorSnippetText {\n background: rgb(30, 30, 20);\n border-radius: 1.2rem;\n border: 0.5rem solid rgb(30, 30, 20);\n color: #00FF41;\n font-size: 0.9rem;\n font-style: italic;\n max-height: 100px;\n padding: 6px;\n overflow-wrap: break-word;\n overflow-y: auto;\n white-space: pre-wrap;\n word-wrap: break-word;\n }\n ");
|
|
1727
1731
|
});
|
|
1728
1732
|
|
|
1729
1733
|
var TokenAmountStyle = (function () {
|
|
@@ -1740,7 +1744,7 @@
|
|
|
1740
1744
|
},
|
|
1741
1745
|
fontFamily: '-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"'
|
|
1742
1746
|
}, style);
|
|
1743
|
-
return [ResetStyle(), FontStyle(style), DialogStyle(), ButtonCircularStyle(), ButtonPrimaryStyle(style), CardStyle(style),
|
|
1747
|
+
return [ResetStyle(), FontStyle(style), DialogStyle(), ButtonCircularStyle(), ButtonPrimaryStyle(style), CardStyle(style), PoweredByStyle(style), GraphicStyle(), SkeletonStyle(), TokenAmountStyle(), TextStyle(style), IconStyle(style), OpacityStyle(), PaddingStyle(), HeightStyle(), LabelStyle(style), LoadingTextStyle(style), RangeSliderStyle(style), InputStyle(), TextButtonStyle(style), ImageStyle(), BlockchainLogoStyle()].join('');
|
|
1744
1748
|
});
|
|
1745
1749
|
|
|
1746
1750
|
var mount = (function (_ref, content) {
|
|
@@ -1764,7 +1768,7 @@
|
|
|
1764
1768
|
}, 300);
|
|
1765
1769
|
};
|
|
1766
1770
|
|
|
1767
|
-
var _ReactShadowDOM =
|
|
1771
|
+
var _ReactShadowDOM = reactShadowDom.ReactShadowDOM({
|
|
1768
1772
|
document: document,
|
|
1769
1773
|
element: document.body,
|
|
1770
1774
|
content: content(unmountShadowDOM),
|
|
@@ -1776,6 +1780,31 @@
|
|
|
1776
1780
|
return unmount;
|
|
1777
1781
|
});
|
|
1778
1782
|
|
|
1783
|
+
var PoweredBy = (function () {
|
|
1784
|
+
return /*#__PURE__*/React__default$1["default"].createElement("div", {
|
|
1785
|
+
className: "PoweredByWrapper"
|
|
1786
|
+
}, /*#__PURE__*/React__default$1["default"].createElement("a", {
|
|
1787
|
+
href: 'https://depay.fi?utm_source=' + window.location.hostname + '&utm_medium=widget&utm_campaign=WidgetV2',
|
|
1788
|
+
rel: "noopener noreferrer",
|
|
1789
|
+
target: "_blank",
|
|
1790
|
+
className: "PoweredByLink"
|
|
1791
|
+
}, "by DePay"));
|
|
1792
|
+
});
|
|
1793
|
+
|
|
1794
|
+
var UpdatableProvider = (function (props) {
|
|
1795
|
+
var _useState = React.useState(true),
|
|
1796
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
1797
|
+
updatable = _useState2[0],
|
|
1798
|
+
setUpdatable = _useState2[1];
|
|
1799
|
+
|
|
1800
|
+
return /*#__PURE__*/React__default$1["default"].createElement(UpdatableContext.Provider, {
|
|
1801
|
+
value: {
|
|
1802
|
+
updatable: updatable,
|
|
1803
|
+
setUpdatable: setUpdatable
|
|
1804
|
+
}
|
|
1805
|
+
}, props.children);
|
|
1806
|
+
});
|
|
1807
|
+
|
|
1779
1808
|
var Connect = function Connect(options) {
|
|
1780
1809
|
var style, error, document;
|
|
1781
1810
|
|
|
@@ -1792,7 +1821,7 @@
|
|
|
1792
1821
|
while (1) {
|
|
1793
1822
|
switch (_context.prev = _context.next) {
|
|
1794
1823
|
case 0:
|
|
1795
|
-
wallet =
|
|
1824
|
+
wallet = web3Wallets.getWallet();
|
|
1796
1825
|
|
|
1797
1826
|
if (!wallet) {
|
|
1798
1827
|
_context.next = 7;
|
|
@@ -1831,7 +1860,7 @@
|
|
|
1831
1860
|
error: error,
|
|
1832
1861
|
container: container,
|
|
1833
1862
|
unmount: unmount
|
|
1834
|
-
}, /*#__PURE__*/React__default$1["default"].createElement(ClosableProvider, {
|
|
1863
|
+
}, /*#__PURE__*/React__default$1["default"].createElement(UpdatableProvider, null, /*#__PURE__*/React__default$1["default"].createElement(ClosableProvider, {
|
|
1835
1864
|
unmount: rejectBeforeUnmount
|
|
1836
1865
|
}, /*#__PURE__*/React__default$1["default"].createElement(ConnectStack, {
|
|
1837
1866
|
document: document,
|
|
@@ -1839,7 +1868,7 @@
|
|
|
1839
1868
|
resolve: resolve,
|
|
1840
1869
|
reject: reject,
|
|
1841
1870
|
autoClose: true
|
|
1842
|
-
})));
|
|
1871
|
+
}), /*#__PURE__*/React__default$1["default"].createElement(PoweredBy, null))));
|
|
1843
1872
|
};
|
|
1844
1873
|
});
|
|
1845
1874
|
|
|
@@ -1998,9 +2027,9 @@
|
|
|
1998
2027
|
React.useEffect(function () {
|
|
1999
2028
|
if (amountsMissing && account && conversionRate) {
|
|
2000
2029
|
Promise.all(props.accept.map(function (configuration) {
|
|
2001
|
-
return
|
|
2030
|
+
return web3Exchanges.route({
|
|
2002
2031
|
blockchain: configuration.blockchain,
|
|
2003
|
-
tokenIn:
|
|
2032
|
+
tokenIn: web3Constants.CONSTANTS[configuration.blockchain].USD,
|
|
2004
2033
|
amountIn: 1.00 / conversionRate * amount,
|
|
2005
2034
|
tokenOut: configuration.token,
|
|
2006
2035
|
fromAddress: account,
|
|
@@ -2012,19 +2041,25 @@
|
|
|
2012
2041
|
return;
|
|
2013
2042
|
}
|
|
2014
2043
|
|
|
2015
|
-
return
|
|
2044
|
+
return web3Tokens.Token.readable({
|
|
2016
2045
|
blockchain: props.accept[index].blockchain,
|
|
2017
2046
|
amount: routes[0].amountOut,
|
|
2018
2047
|
address: routes[0].tokenOut
|
|
2019
2048
|
});
|
|
2020
2049
|
})).then(function (amounts) {
|
|
2021
2050
|
setAcceptWithAmount(props.accept.map(function (configuration, index) {
|
|
2051
|
+
if (amounts[index] == undefined) {
|
|
2052
|
+
return;
|
|
2053
|
+
}
|
|
2054
|
+
|
|
2022
2055
|
return {
|
|
2023
2056
|
blockchain: configuration.blockchain,
|
|
2024
|
-
amount: round(amounts[index])
|
|
2057
|
+
amount: round(amounts[index]),
|
|
2025
2058
|
token: configuration.token,
|
|
2026
2059
|
receiver: configuration.receiver || account
|
|
2027
2060
|
};
|
|
2061
|
+
}).filter(function (configuration) {
|
|
2062
|
+
return !!configuration;
|
|
2028
2063
|
}));
|
|
2029
2064
|
})["catch"](setError);
|
|
2030
2065
|
})["catch"](setError);
|
|
@@ -2033,23 +2068,23 @@
|
|
|
2033
2068
|
React.useEffect(function () {
|
|
2034
2069
|
if (amountsMissing && maxRoute) {
|
|
2035
2070
|
maxRoute.fromToken.readable(maxRoute.fromBalance).then(function (readableMaxAmount) {
|
|
2036
|
-
if (maxRoute.fromToken.address ==
|
|
2071
|
+
if (maxRoute.fromToken.address == web3Constants.CONSTANTS[maxRoute.blockchain].USD) {
|
|
2037
2072
|
var _maxAmount = parseFloat(new decimal_js.Decimal(readableMaxAmount).mul(conversionRate).toString());
|
|
2038
2073
|
|
|
2039
2074
|
setMaxAmount(_maxAmount > 10 ? Math.round(_maxAmount) : _maxAmount);
|
|
2040
2075
|
} else {
|
|
2041
|
-
|
|
2076
|
+
web3Exchanges.route({
|
|
2042
2077
|
blockchain: maxRoute.blockchain,
|
|
2043
2078
|
tokenIn: maxRoute.fromToken.address,
|
|
2044
|
-
tokenOut:
|
|
2079
|
+
tokenOut: web3Constants.CONSTANTS[maxRoute.blockchain].USD,
|
|
2045
2080
|
amountIn: parseFloat(readableMaxAmount),
|
|
2046
2081
|
fromAddress: account,
|
|
2047
2082
|
toAddress: account
|
|
2048
2083
|
}).then(function (routes) {
|
|
2049
|
-
|
|
2084
|
+
web3Tokens.Token.readable({
|
|
2050
2085
|
amount: routes[0].amountOut,
|
|
2051
2086
|
blockchain: maxRoute.blockchain,
|
|
2052
|
-
address:
|
|
2087
|
+
address: web3Constants.CONSTANTS[maxRoute.blockchain].USD
|
|
2053
2088
|
}).then(function (readableMaxAmount) {
|
|
2054
2089
|
var slippage = 1.01;
|
|
2055
2090
|
var maxAmount = parseFloat(new decimal_js.Decimal(readableMaxAmount).div(slippage).mul(conversionRate).toString());
|
|
@@ -2075,13 +2110,13 @@
|
|
|
2075
2110
|
});
|
|
2076
2111
|
|
|
2077
2112
|
var ConfigurationProvider = (function (props) {
|
|
2078
|
-
var currencyCode = new
|
|
2113
|
+
var currencyCode = new localCurrency.Currency({
|
|
2079
2114
|
code: props.configuration.currency
|
|
2080
2115
|
}).code;
|
|
2081
2116
|
React.useEffect(function () {
|
|
2082
2117
|
if (props.configuration.providers != undefined) {
|
|
2083
2118
|
Object.entries(props.configuration.providers).forEach(function (entry) {
|
|
2084
|
-
|
|
2119
|
+
web3Client.setProviderEndpoints(entry[0], entry[1]);
|
|
2085
2120
|
});
|
|
2086
2121
|
}
|
|
2087
2122
|
}, [props.configuration]);
|
|
@@ -2107,7 +2142,7 @@
|
|
|
2107
2142
|
setConversionRate = _useState2[1];
|
|
2108
2143
|
|
|
2109
2144
|
React.useEffect(function () {
|
|
2110
|
-
|
|
2145
|
+
localCurrency.Currency.fromUSD({
|
|
2111
2146
|
amount: 1,
|
|
2112
2147
|
code: currency,
|
|
2113
2148
|
apiKey: apiKey
|
|
@@ -2146,7 +2181,9 @@
|
|
|
2146
2181
|
}, /*#__PURE__*/React__default$1["default"].createElement("strong", {
|
|
2147
2182
|
className: "FontSizeM"
|
|
2148
2183
|
}, "We were not able to find any asset of value in your wallet. Please top up your account in order to proceed with this payment."))),
|
|
2149
|
-
footer: /*#__PURE__*/React__default$1["default"].createElement("div",
|
|
2184
|
+
footer: /*#__PURE__*/React__default$1["default"].createElement("div", {
|
|
2185
|
+
className: "PaddingTopXS PaddingRightM PaddingLeftM PaddingBottomM"
|
|
2186
|
+
}, /*#__PURE__*/React__default$1["default"].createElement("button", {
|
|
2150
2187
|
className: "ButtonPrimary",
|
|
2151
2188
|
onClick: close
|
|
2152
2189
|
}, "Ok"))
|
|
@@ -2157,7 +2194,7 @@
|
|
|
2157
2194
|
|
|
2158
2195
|
var PaymentRoutingContext = /*#__PURE__*/React__default$1["default"].createContext();
|
|
2159
2196
|
|
|
2160
|
-
var
|
|
2197
|
+
var TrackingContext = /*#__PURE__*/React__default$1["default"].createContext();
|
|
2161
2198
|
|
|
2162
2199
|
var PaymentProvider = (function (props) {
|
|
2163
2200
|
var _useContext = React.useContext(ErrorContext),
|
|
@@ -2166,7 +2203,6 @@
|
|
|
2166
2203
|
var _useContext2 = React.useContext(ConfigurationContext),
|
|
2167
2204
|
_sent = _useContext2.sent,
|
|
2168
2205
|
_confirmed = _useContext2.confirmed,
|
|
2169
|
-
_ensured = _useContext2.ensured,
|
|
2170
2206
|
_failed = _useContext2.failed;
|
|
2171
2207
|
|
|
2172
2208
|
var _useContext3 = React.useContext(PaymentRoutingContext),
|
|
@@ -2180,13 +2216,17 @@
|
|
|
2180
2216
|
var _useContext5 = React.useContext(PaymentRoutingContext),
|
|
2181
2217
|
allRoutes = _useContext5.allRoutes;
|
|
2182
2218
|
|
|
2183
|
-
var _useContext6 = React.useContext(
|
|
2184
|
-
_useContext6.
|
|
2185
|
-
var setUpdate = _useContext6.setUpdate;
|
|
2219
|
+
var _useContext6 = React.useContext(UpdatableContext),
|
|
2220
|
+
setUpdatable = _useContext6.setUpdatable;
|
|
2186
2221
|
|
|
2187
2222
|
var _useContext7 = React.useContext(WalletContext),
|
|
2188
2223
|
wallet = _useContext7.wallet;
|
|
2189
2224
|
|
|
2225
|
+
var _useContext8 = React.useContext(TrackingContext),
|
|
2226
|
+
forward = _useContext8.forward,
|
|
2227
|
+
tracking = _useContext8.tracking,
|
|
2228
|
+
initializeTracking = _useContext8.initializeTracking;
|
|
2229
|
+
|
|
2190
2230
|
var _useState = React.useState(),
|
|
2191
2231
|
_useState2 = _slicedToArray(_useState, 2),
|
|
2192
2232
|
payment = _useState2[0],
|
|
@@ -2207,53 +2247,81 @@
|
|
|
2207
2247
|
paymentState = _useState8[0],
|
|
2208
2248
|
setPaymentState = _useState8[1];
|
|
2209
2249
|
|
|
2210
|
-
var pay = function
|
|
2211
|
-
var
|
|
2212
|
-
|
|
2213
|
-
|
|
2214
|
-
|
|
2215
|
-
|
|
2216
|
-
|
|
2217
|
-
|
|
2218
|
-
|
|
2219
|
-
|
|
2220
|
-
|
|
2221
|
-
|
|
2222
|
-
|
|
2223
|
-
|
|
2250
|
+
var pay = /*#__PURE__*/function () {
|
|
2251
|
+
var _ref2 = _asyncToGenerator( /*#__PURE__*/regenerator.mark(function _callee(_ref) {
|
|
2252
|
+
var navigate, currentBlock;
|
|
2253
|
+
return regenerator.wrap(function _callee$(_context) {
|
|
2254
|
+
while (1) {
|
|
2255
|
+
switch (_context.prev = _context.next) {
|
|
2256
|
+
case 0:
|
|
2257
|
+
navigate = _ref.navigate;
|
|
2258
|
+
setClosable(false);
|
|
2259
|
+
setPaymentState('paying');
|
|
2260
|
+
setUpdatable(false);
|
|
2261
|
+
_context.next = 6;
|
|
2262
|
+
return web3Client.request({
|
|
2263
|
+
blockchain: payment.route.transaction.blockchain,
|
|
2264
|
+
method: 'latestBlockNumber'
|
|
2265
|
+
});
|
|
2224
2266
|
|
|
2225
|
-
|
|
2226
|
-
|
|
2227
|
-
|
|
2228
|
-
|
|
2229
|
-
|
|
2230
|
-
|
|
2231
|
-
|
|
2232
|
-
|
|
2233
|
-
|
|
2234
|
-
|
|
2235
|
-
|
|
2236
|
-
|
|
2237
|
-
}
|
|
2267
|
+
case 6:
|
|
2268
|
+
currentBlock = _context.sent;
|
|
2269
|
+
wallet.sendTransaction(Object.assign({}, payment.route.transaction, {
|
|
2270
|
+
sent: function sent(transaction) {
|
|
2271
|
+
if (_sent) {
|
|
2272
|
+
_sent(transaction);
|
|
2273
|
+
}
|
|
2274
|
+
},
|
|
2275
|
+
confirmed: function confirmed(transaction) {
|
|
2276
|
+
if (tracking != true) {
|
|
2277
|
+
setClosable(true);
|
|
2278
|
+
}
|
|
2238
2279
|
|
|
2239
|
-
|
|
2240
|
-
setClosable(true);
|
|
2241
|
-
setUpdate(true);
|
|
2242
|
-
navigate('PaymentError');
|
|
2243
|
-
}
|
|
2244
|
-
})).then(function (sentTransaction) {
|
|
2245
|
-
setTransaction(sentTransaction);
|
|
2246
|
-
})["catch"](function (error) {
|
|
2247
|
-
console.log('error', error);
|
|
2248
|
-
setPaymentState('initialized');
|
|
2249
|
-
setClosable(true);
|
|
2250
|
-
setUpdate(true);
|
|
2280
|
+
setPaymentState('confirmed');
|
|
2251
2281
|
|
|
2252
|
-
|
|
2253
|
-
|
|
2254
|
-
|
|
2255
|
-
|
|
2256
|
-
|
|
2282
|
+
if (_confirmed) {
|
|
2283
|
+
_confirmed(transaction);
|
|
2284
|
+
}
|
|
2285
|
+
},
|
|
2286
|
+
failed: function failed(transaction, error) {
|
|
2287
|
+
if (_failed) {
|
|
2288
|
+
_failed(transaction, error);
|
|
2289
|
+
}
|
|
2290
|
+
|
|
2291
|
+
setPaymentState('initialized');
|
|
2292
|
+
setClosable(true);
|
|
2293
|
+
setUpdatable(true);
|
|
2294
|
+
navigate('PaymentError');
|
|
2295
|
+
}
|
|
2296
|
+
})).then(function (sentTransaction) {
|
|
2297
|
+
if (tracking) {
|
|
2298
|
+
initializeTracking(sentTransaction, currentBlock);
|
|
2299
|
+
}
|
|
2300
|
+
|
|
2301
|
+
setTransaction(sentTransaction);
|
|
2302
|
+
})["catch"](function (error) {
|
|
2303
|
+
console.log('error', error);
|
|
2304
|
+
setPaymentState('initialized');
|
|
2305
|
+
setClosable(true);
|
|
2306
|
+
setUpdatable(true);
|
|
2307
|
+
|
|
2308
|
+
if ((error === null || error === void 0 ? void 0 : error.code) == 'WRONG_NETWORK') {
|
|
2309
|
+
navigate('WrongNetwork');
|
|
2310
|
+
}
|
|
2311
|
+
});
|
|
2312
|
+
|
|
2313
|
+
case 8:
|
|
2314
|
+
case "end":
|
|
2315
|
+
return _context.stop();
|
|
2316
|
+
}
|
|
2317
|
+
}
|
|
2318
|
+
}, _callee);
|
|
2319
|
+
}));
|
|
2320
|
+
|
|
2321
|
+
return function pay(_x) {
|
|
2322
|
+
return _ref2.apply(this, arguments);
|
|
2323
|
+
};
|
|
2324
|
+
}();
|
|
2257
2325
|
|
|
2258
2326
|
var approve = function approve() {
|
|
2259
2327
|
setClosable(false);
|
|
@@ -2274,15 +2342,20 @@
|
|
|
2274
2342
|
});
|
|
2275
2343
|
};
|
|
2276
2344
|
|
|
2345
|
+
React.useEffect(function () {
|
|
2346
|
+
if (forward) {
|
|
2347
|
+
setPaymentState('confirmed');
|
|
2348
|
+
}
|
|
2349
|
+
}, [forward]);
|
|
2277
2350
|
React.useEffect(function () {
|
|
2278
2351
|
if (selectedRoute) {
|
|
2279
2352
|
var fromToken = selectedRoute.fromToken;
|
|
2280
2353
|
selectedRoute.transaction.params;
|
|
2281
|
-
Promise.all([fromToken.name(), fromToken.symbol(), fromToken.readable(selectedRoute.fromAmount)]).then(function (
|
|
2282
|
-
var
|
|
2283
|
-
name =
|
|
2284
|
-
symbol =
|
|
2285
|
-
amount =
|
|
2354
|
+
Promise.all([fromToken.name(), fromToken.symbol(), fromToken.readable(selectedRoute.fromAmount)]).then(function (_ref3) {
|
|
2355
|
+
var _ref4 = _slicedToArray(_ref3, 3),
|
|
2356
|
+
name = _ref4[0],
|
|
2357
|
+
symbol = _ref4[1],
|
|
2358
|
+
amount = _ref4[2];
|
|
2286
2359
|
|
|
2287
2360
|
setPayment({
|
|
2288
2361
|
route: selectedRoute,
|
|
@@ -2298,14 +2371,14 @@
|
|
|
2298
2371
|
}, [selectedRoute]);
|
|
2299
2372
|
React.useEffect(function () {
|
|
2300
2373
|
if (allRoutes && allRoutes.length == 0) {
|
|
2301
|
-
|
|
2374
|
+
setUpdatable(false);
|
|
2302
2375
|
} else if (allRoutes && allRoutes.length > 0) {
|
|
2303
|
-
|
|
2376
|
+
setUpdatable(true);
|
|
2304
2377
|
}
|
|
2305
2378
|
}, [allRoutes]);
|
|
2306
2379
|
|
|
2307
2380
|
if (allRoutes instanceof Array && allRoutes.length == 0) {
|
|
2308
|
-
return /*#__PURE__*/React__default$1["default"].createElement(
|
|
2381
|
+
return /*#__PURE__*/React__default$1["default"].createElement(reactDialogStack.ReactDialogStack, {
|
|
2309
2382
|
open: open,
|
|
2310
2383
|
close: close,
|
|
2311
2384
|
start: "NoPaymentMethodFound",
|
|
@@ -2366,8 +2439,8 @@
|
|
|
2366
2439
|
var _useContext = React.useContext(WalletContext),
|
|
2367
2440
|
account = _useContext.account;
|
|
2368
2441
|
|
|
2369
|
-
var _useContext2 = React.useContext(
|
|
2370
|
-
|
|
2442
|
+
var _useContext2 = React.useContext(UpdatableContext),
|
|
2443
|
+
updatable = _useContext2.updatable;
|
|
2371
2444
|
|
|
2372
2445
|
var prepareAcceptedPayments = function prepareAcceptedPayments(accept) {
|
|
2373
2446
|
var toAddress = _typeof(accept.receiver) == 'object' ? accept.receiver.address : accept.receiver;
|
|
@@ -2382,13 +2455,13 @@
|
|
|
2382
2455
|
var getPaymentRoutes = function getPaymentRoutes(_ref) {
|
|
2383
2456
|
var allRoutes = _ref.allRoutes,
|
|
2384
2457
|
selectedRoute = _ref.selectedRoute,
|
|
2385
|
-
|
|
2458
|
+
updatable = _ref.updatable;
|
|
2386
2459
|
|
|
2387
|
-
if (
|
|
2460
|
+
if (updatable == false || !props.accept || !account) {
|
|
2388
2461
|
return;
|
|
2389
2462
|
}
|
|
2390
2463
|
|
|
2391
|
-
|
|
2464
|
+
web3Payments.route({
|
|
2392
2465
|
accept: props.accept.map(prepareAcceptedPayments),
|
|
2393
2466
|
whitelist: props.whitelist,
|
|
2394
2467
|
blacklist: props.blacklist,
|
|
@@ -2487,13 +2560,13 @@
|
|
|
2487
2560
|
getPaymentRoutes({
|
|
2488
2561
|
allRoutes: allRoutes,
|
|
2489
2562
|
selectedRoute: selectedRoute,
|
|
2490
|
-
|
|
2563
|
+
updatable: updatable
|
|
2491
2564
|
});
|
|
2492
2565
|
}, 15000);
|
|
2493
2566
|
return function () {
|
|
2494
2567
|
return clearTimeout(timeout);
|
|
2495
2568
|
};
|
|
2496
|
-
}, [reloadCount, allRoutes, selectedRoute,
|
|
2569
|
+
}, [reloadCount, allRoutes, selectedRoute, updatable]);
|
|
2497
2570
|
React.useEffect(function () {
|
|
2498
2571
|
if (account && props.accept) {
|
|
2499
2572
|
setAllRoutes(undefined);
|
|
@@ -2523,8 +2596,8 @@
|
|
|
2523
2596
|
var _useContext2 = React.useContext(WalletContext),
|
|
2524
2597
|
account = _useContext2.account;
|
|
2525
2598
|
|
|
2526
|
-
var _useContext3 = React.useContext(
|
|
2527
|
-
|
|
2599
|
+
var _useContext3 = React.useContext(UpdatableContext),
|
|
2600
|
+
updatable = _useContext3.updatable;
|
|
2528
2601
|
|
|
2529
2602
|
var _useContext4 = React.useContext(PaymentContext),
|
|
2530
2603
|
payment = _useContext4.payment;
|
|
@@ -2543,23 +2616,23 @@
|
|
|
2543
2616
|
setReloadCount = _useState4[1];
|
|
2544
2617
|
|
|
2545
2618
|
var getToTokenLocalValue = function getToTokenLocalValue(_ref) {
|
|
2546
|
-
var
|
|
2619
|
+
var updatable = _ref.updatable,
|
|
2547
2620
|
payment = _ref.payment;
|
|
2548
2621
|
|
|
2549
|
-
if (
|
|
2622
|
+
if (updatable == false || (payment === null || payment === void 0 ? void 0 : payment.route) == undefined) {
|
|
2550
2623
|
return;
|
|
2551
2624
|
}
|
|
2552
2625
|
|
|
2553
|
-
Promise.all([
|
|
2626
|
+
Promise.all([web3Exchanges.route({
|
|
2554
2627
|
blockchain: payment.route.blockchain,
|
|
2555
2628
|
tokenIn: payment.route.toToken.address,
|
|
2556
|
-
tokenOut:
|
|
2629
|
+
tokenOut: web3Constants.CONSTANTS[payment.route.blockchain].USD,
|
|
2557
2630
|
amountIn: payment.route.toAmount,
|
|
2558
2631
|
fromAddress: account,
|
|
2559
2632
|
toAddress: account
|
|
2560
|
-
}), new
|
|
2633
|
+
}), new web3Tokens.Token({
|
|
2561
2634
|
blockchain: payment.route.blockchain,
|
|
2562
|
-
address:
|
|
2635
|
+
address: web3Constants.CONSTANTS[payment.route.blockchain].USD
|
|
2563
2636
|
}).decimals()]).then(function (_ref2) {
|
|
2564
2637
|
var _ref3 = _slicedToArray(_ref2, 2),
|
|
2565
2638
|
USDExchangeRoutes = _ref3[0],
|
|
@@ -2568,7 +2641,7 @@
|
|
|
2568
2641
|
var USDRoute = USDExchangeRoutes[0];
|
|
2569
2642
|
var USDAmount;
|
|
2570
2643
|
|
|
2571
|
-
if (payment.route.toToken.address.toLowerCase() ==
|
|
2644
|
+
if (payment.route.toToken.address.toLowerCase() == web3Constants.CONSTANTS[payment.route.blockchain].USD.toLowerCase()) {
|
|
2572
2645
|
USDAmount = payment.route.toAmount.toString();
|
|
2573
2646
|
} else if (USDRoute == undefined) {
|
|
2574
2647
|
setPaymentValue('');
|
|
@@ -2578,7 +2651,7 @@
|
|
|
2578
2651
|
}
|
|
2579
2652
|
|
|
2580
2653
|
var USDValue = ethers.ethers.utils.formatUnits(USDAmount, USDDecimals);
|
|
2581
|
-
|
|
2654
|
+
localCurrency.Currency.fromUSD({
|
|
2582
2655
|
amount: USDValue,
|
|
2583
2656
|
code: currency,
|
|
2584
2657
|
apiKey: apiKey
|
|
@@ -2589,7 +2662,7 @@
|
|
|
2589
2662
|
React.useEffect(function () {
|
|
2590
2663
|
if (account && payment) {
|
|
2591
2664
|
getToTokenLocalValue({
|
|
2592
|
-
|
|
2665
|
+
updatable: updatable,
|
|
2593
2666
|
payment: payment
|
|
2594
2667
|
});
|
|
2595
2668
|
}
|
|
@@ -2598,13 +2671,13 @@
|
|
|
2598
2671
|
var timeout = setTimeout(function () {
|
|
2599
2672
|
setReloadCount(reloadCount + 1);
|
|
2600
2673
|
getToTokenLocalValue({
|
|
2601
|
-
|
|
2674
|
+
updatable: updatable
|
|
2602
2675
|
});
|
|
2603
2676
|
}, 15000);
|
|
2604
2677
|
return function () {
|
|
2605
2678
|
return clearTimeout(timeout);
|
|
2606
2679
|
};
|
|
2607
|
-
}, [reloadCount,
|
|
2680
|
+
}, [reloadCount, updatable]);
|
|
2608
2681
|
return /*#__PURE__*/React__default$1["default"].createElement(PaymentValueContext.Provider, {
|
|
2609
2682
|
value: {
|
|
2610
2683
|
paymentValue: paymentValue
|
|
@@ -2646,7 +2719,7 @@
|
|
|
2646
2719
|
});
|
|
2647
2720
|
|
|
2648
2721
|
var ChangeAmountDialog = (function (props) {
|
|
2649
|
-
var _useContext = React.useContext(
|
|
2722
|
+
var _useContext = React.useContext(reactDialogStack.NavigateStackContext),
|
|
2650
2723
|
navigate = _useContext.navigate;
|
|
2651
2724
|
|
|
2652
2725
|
var _useContext2 = React.useContext(ErrorContext);
|
|
@@ -2759,7 +2832,9 @@
|
|
|
2759
2832
|
changeAmount(toValidValue(maxAmount));
|
|
2760
2833
|
}
|
|
2761
2834
|
}, "(Max)")))))),
|
|
2762
|
-
footer: /*#__PURE__*/React__default$1["default"].createElement("div",
|
|
2835
|
+
footer: /*#__PURE__*/React__default$1["default"].createElement("div", {
|
|
2836
|
+
className: "PaddingTopXS PaddingRightM PaddingLeftM PaddingBottomM"
|
|
2837
|
+
}, /*#__PURE__*/React__default$1["default"].createElement("button", {
|
|
2763
2838
|
className: "ButtonPrimary",
|
|
2764
2839
|
onClick: changeAmountAndGoBack
|
|
2765
2840
|
}, "Done"))
|
|
@@ -2810,7 +2885,7 @@
|
|
|
2810
2885
|
var _useContext3 = React.useContext(PaymentValueContext),
|
|
2811
2886
|
paymentValue = _useContext3.paymentValue;
|
|
2812
2887
|
|
|
2813
|
-
var _useContext4 = React.useContext(
|
|
2888
|
+
var _useContext4 = React.useContext(reactDialogStack.NavigateStackContext),
|
|
2814
2889
|
navigate = _useContext4.navigate;
|
|
2815
2890
|
|
|
2816
2891
|
var _useState = React.useState([]),
|
|
@@ -2846,6 +2921,7 @@
|
|
|
2846
2921
|
}, [allRoutes]);
|
|
2847
2922
|
React.useEffect(function () {
|
|
2848
2923
|
setCards(allPaymentRoutesWithData.map(function (payment, index) {
|
|
2924
|
+
var blockchain = web3Blockchains.Blockchain.findByName(payment.route.blockchain);
|
|
2849
2925
|
return /*#__PURE__*/React__default$1["default"].createElement("div", {
|
|
2850
2926
|
key: index,
|
|
2851
2927
|
className: "Card",
|
|
@@ -2856,9 +2932,14 @@
|
|
|
2856
2932
|
}
|
|
2857
2933
|
}, /*#__PURE__*/React__default$1["default"].createElement("div", {
|
|
2858
2934
|
className: "CardImage"
|
|
2859
|
-
}, /*#__PURE__*/React__default$1["default"].createElement(
|
|
2935
|
+
}, /*#__PURE__*/React__default$1["default"].createElement(reactTokenImage.TokenImage, {
|
|
2860
2936
|
blockchain: payment.route.blockchain,
|
|
2861
2937
|
address: payment.route.fromToken.address
|
|
2938
|
+
}), /*#__PURE__*/React__default$1["default"].createElement("img", {
|
|
2939
|
+
className: "BlockchainLogo small",
|
|
2940
|
+
src: blockchain.logo,
|
|
2941
|
+
alt: blockchain.label,
|
|
2942
|
+
title: blockchain.label
|
|
2862
2943
|
})), /*#__PURE__*/React__default$1["default"].createElement("div", {
|
|
2863
2944
|
className: "CardBody"
|
|
2864
2945
|
}, /*#__PURE__*/React__default$1["default"].createElement("div", {
|
|
@@ -2873,11 +2954,7 @@
|
|
|
2873
2954
|
className: "TokenAmountCell"
|
|
2874
2955
|
}, format(payment.amount)))), /*#__PURE__*/React__default$1["default"].createElement("h3", {
|
|
2875
2956
|
className: "CardText"
|
|
2876
|
-
}, /*#__PURE__*/React__default$1["default"].createElement("small", null, format(round(parseFloat(payment.route.fromBalance.toString()) / Math.pow(10, payment.decimals), 'down'))))))
|
|
2877
|
-
className: "CardInfo"
|
|
2878
|
-
}, payment.route.approvalRequired && /*#__PURE__*/React__default$1["default"].createElement("span", {
|
|
2879
|
-
className: "Label"
|
|
2880
|
-
}, "Requires Approval")));
|
|
2957
|
+
}, /*#__PURE__*/React__default$1["default"].createElement("small", null, format(round(parseFloat(payment.route.fromBalance.toString()) / Math.pow(10, payment.decimals), 'down')))))));
|
|
2881
2958
|
}));
|
|
2882
2959
|
}, [allPaymentRoutesWithData]);
|
|
2883
2960
|
|
|
@@ -2903,25 +2980,12 @@
|
|
|
2903
2980
|
});
|
|
2904
2981
|
});
|
|
2905
2982
|
|
|
2906
|
-
var Checkmark = (function () {
|
|
2907
|
-
return /*#__PURE__*/React__default$1["default"].createElement("svg", {
|
|
2908
|
-
className: "Checkmark Icon",
|
|
2909
|
-
version: "1.1",
|
|
2910
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
2911
|
-
x: "0px",
|
|
2912
|
-
y: "0px",
|
|
2913
|
-
viewBox: "0 0 24 24"
|
|
2914
|
-
}, /*#__PURE__*/React__default$1["default"].createElement("path", {
|
|
2915
|
-
d: "M20,4.9L9.2,16l-5.4-3.9c-0.7-0.5-1.6-0.3-2.1,0.3c-0.5,0.7-0.3,1.6,0.3,2.1l6.4,4.7c0.3,0.2,0.6,0.3,0.9,0.3 c0.4,0,0.8-0.2,1.1-0.5l11.7-12c0.6-0.6,0.6-1.6,0-2.2C21.6,4.3,20.6,4.3,20,4.9z"
|
|
2916
|
-
}));
|
|
2917
|
-
});
|
|
2918
|
-
|
|
2919
2983
|
var DonationOverviewSkeleton = (function (props) {
|
|
2920
2984
|
return /*#__PURE__*/React__default$1["default"].createElement(Dialog$1, {
|
|
2921
2985
|
header: /*#__PURE__*/React__default$1["default"].createElement("div", {
|
|
2922
|
-
className: "PaddingTopS PaddingLeftM PaddingRightM"
|
|
2986
|
+
className: "PaddingTopS PaddingLeftM PaddingRightM TextLeft"
|
|
2923
2987
|
}, /*#__PURE__*/React__default$1["default"].createElement("h1", {
|
|
2924
|
-
className: "LineHeightL FontSizeL
|
|
2988
|
+
className: "LineHeightL FontSizeL"
|
|
2925
2989
|
}, "Donation")),
|
|
2926
2990
|
body: /*#__PURE__*/React__default$1["default"].createElement("div", {
|
|
2927
2991
|
className: "PaddingTopS PaddingLeftM PaddingRightM PaddingBottomXS"
|
|
@@ -2935,7 +2999,7 @@
|
|
|
2935
2999
|
className: "SkeletonBackground"
|
|
2936
3000
|
}))),
|
|
2937
3001
|
footer: /*#__PURE__*/React__default$1["default"].createElement("div", {
|
|
2938
|
-
className: "PaddingTopXS PaddingRightM PaddingLeftM"
|
|
3002
|
+
className: "PaddingTopXS PaddingRightM PaddingLeftM PaddingBottomM"
|
|
2939
3003
|
}, /*#__PURE__*/React__default$1["default"].createElement("div", {
|
|
2940
3004
|
className: "SkeletonWrapper"
|
|
2941
3005
|
}, /*#__PURE__*/React__default$1["default"].createElement("div", {
|
|
@@ -2946,6 +3010,60 @@
|
|
|
2946
3010
|
});
|
|
2947
3011
|
});
|
|
2948
3012
|
|
|
3013
|
+
var Checkmark = (function (props) {
|
|
3014
|
+
return /*#__PURE__*/React__default$1["default"].createElement("svg", {
|
|
3015
|
+
className: "Checkmark Icon " + props.className,
|
|
3016
|
+
version: "1.1",
|
|
3017
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
3018
|
+
x: "0px",
|
|
3019
|
+
y: "0px",
|
|
3020
|
+
viewBox: "0 0 24 24"
|
|
3021
|
+
}, /*#__PURE__*/React__default$1["default"].createElement("path", {
|
|
3022
|
+
d: "M20,4.9L9.2,16l-5.4-3.9c-0.7-0.5-1.6-0.3-2.1,0.3c-0.5,0.7-0.3,1.6,0.3,2.1l6.4,4.7c0.3,0.2,0.6,0.3,0.9,0.3 c0.4,0,0.8-0.2,1.1-0.5l11.7-12c0.6-0.6,0.6-1.6,0-2.2C21.6,4.3,20.6,4.3,20,4.9z"
|
|
3023
|
+
}));
|
|
3024
|
+
});
|
|
3025
|
+
|
|
3026
|
+
var DigitalWalletIcon = (function (props) {
|
|
3027
|
+
return /*#__PURE__*/React__default$1["default"].createElement("svg", {
|
|
3028
|
+
className: "DigitalWalletIcon Icon " + props.className,
|
|
3029
|
+
version: "1.1",
|
|
3030
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
3031
|
+
height: "24",
|
|
3032
|
+
width: "24",
|
|
3033
|
+
viewBox: "0 0 24 24"
|
|
3034
|
+
}, /*#__PURE__*/React__default$1["default"].createElement("path", {
|
|
3035
|
+
d: "M8.51,4.84l-.39-.53,4-2.89a2.2,2.2,0,0,1,3.06.48l.4.56-.53.39-.4-.56A1.54,1.54,0,0,0,12.5,2Z",
|
|
3036
|
+
transform: "translate(-0.81 -1)"
|
|
3037
|
+
}), /*#__PURE__*/React__default$1["default"].createElement("path", {
|
|
3038
|
+
d: "M9.77,4.89l-.21-.62,6.31-2.13h0a2.18,2.18,0,0,1,.67-.1h0a2.21,2.21,0,0,1,2.08,1.49l.32.95-.63.21L18,3.73a1.53,1.53,0,0,0-1.45-1h0a1.61,1.61,0,0,0-.48.08h0Z",
|
|
3039
|
+
transform: "translate(-0.81 -1)"
|
|
3040
|
+
}), /*#__PURE__*/React__default$1["default"].createElement("path", {
|
|
3041
|
+
d: "M19.72,16.2H18.27a3.28,3.28,0,1,1,0-6.56h1.45a3.21,3.21,0,0,1,1.33.28h0a3.28,3.28,0,0,1,0,6A3.21,3.21,0,0,1,19.72,16.2Zm-1.45-5.9a2.63,2.63,0,0,0,0,5.25h1.45a2.56,2.56,0,0,0,1.06-.23,2.62,2.62,0,0,0,0-4.8,2.55,2.55,0,0,0-1.06-.22ZM19,14.53a1.61,1.61,0,1,1,1.61-1.61A1.62,1.62,0,0,1,19,14.53ZM19,12a1,1,0,1,0,.95.95A1,1,0,0,0,19,12Z",
|
|
3042
|
+
transform: "translate(-0.81 -1)"
|
|
3043
|
+
}), /*#__PURE__*/React__default$1["default"].createElement("path", {
|
|
3044
|
+
d: "M10.49,19.69a1.58,1.58,0,1,1,1.58-1.57A1.57,1.57,0,0,1,10.49,19.69Zm0-2.49a.92.92,0,1,0,.92.92A.92.92,0,0,0,10.49,17.2Z",
|
|
3045
|
+
transform: "translate(-0.81 -1)"
|
|
3046
|
+
}), /*#__PURE__*/React__default$1["default"].createElement("path", {
|
|
3047
|
+
d: "M19.09,22.14H2.79a2,2,0,0,1-2-2V6.25a2.1,2.1,0,0,1,0-.43,2,2,0,0,1,.48-.92,2,2,0,0,1,1.48-.65H19.09a2,2,0,0,1,.64.1,2,2,0,0,1,1.36,1.79v0a.28.28,0,0,1,0,.09v3.91h-.66v-4a1.49,1.49,0,0,0-.23-.69A1.35,1.35,0,0,0,19.52,5a1.26,1.26,0,0,0-.43-.08H2.82a1.34,1.34,0,0,0-1,.44A1.49,1.49,0,0,0,1.5,6a1.5,1.5,0,0,0,0,.29V20.13a1.36,1.36,0,0,0,1.34,1.35H19.09a1.35,1.35,0,0,0,1.35-1.35V15.68h.66v4.45A2,2,0,0,1,19.09,22.14Z",
|
|
3048
|
+
transform: "translate(-0.81 -1)"
|
|
3049
|
+
}), /*#__PURE__*/React__default$1["default"].createElement("path", {
|
|
3050
|
+
d: "M9.27,9.31a1.58,1.58,0,1,1,0-3.15,1.58,1.58,0,0,1,0,3.15Zm0-2.5a.92.92,0,1,0,.92.92A.92.92,0,0,0,9.27,6.81Z",
|
|
3051
|
+
transform: "translate(-0.81 -1)"
|
|
3052
|
+
}), /*#__PURE__*/React__default$1["default"].createElement("path", {
|
|
3053
|
+
d: "M7.11,14.67A1.58,1.58,0,1,1,8.69,13.1,1.57,1.57,0,0,1,7.11,14.67Zm0-2.49A.92.92,0,1,0,8,13.1.92.92,0,0,0,7.11,12.18Z",
|
|
3054
|
+
transform: "translate(-0.81 -1)"
|
|
3055
|
+
}), /*#__PURE__*/React__default$1["default"].createElement("rect", {
|
|
3056
|
+
x: "0.33",
|
|
3057
|
+
y: "11.77",
|
|
3058
|
+
width: "4.72",
|
|
3059
|
+
height: "0.66"
|
|
3060
|
+
}), /*#__PURE__*/React__default$1["default"].createElement("polygon", {
|
|
3061
|
+
points: "2.08 9.53 0.33 9.53 0.33 8.87 1.8 8.87 4.28 6.39 7.21 6.39 7.21 7.05 4.55 7.05 2.08 9.53"
|
|
3062
|
+
}), /*#__PURE__*/React__default$1["default"].createElement("polygon", {
|
|
3063
|
+
points: "8.43 17.45 4.53 17.45 2.63 15.55 0.33 15.55 0.33 14.89 2.9 14.89 4.8 16.79 8.43 16.79 8.43 17.45"
|
|
3064
|
+
}));
|
|
3065
|
+
});
|
|
3066
|
+
|
|
2949
3067
|
var LoadingText = (function (props) {
|
|
2950
3068
|
return /*#__PURE__*/React__default$1["default"].createElement("div", {
|
|
2951
3069
|
className: "LoadingText"
|
|
@@ -2958,26 +3076,143 @@
|
|
|
2958
3076
|
}, "."));
|
|
2959
3077
|
});
|
|
2960
3078
|
|
|
2961
|
-
var
|
|
3079
|
+
var Footer = (function () {
|
|
2962
3080
|
var _useContext = React.useContext(ConfigurationContext),
|
|
2963
3081
|
currencyCode = _useContext.currencyCode;
|
|
2964
3082
|
|
|
2965
3083
|
var _useContext2 = React.useContext(ChangableAmountContext),
|
|
2966
3084
|
amount = _useContext2.amount;
|
|
3085
|
+
_useContext2.amountsMissing;
|
|
2967
3086
|
|
|
2968
|
-
var _useContext3 = React.useContext(
|
|
2969
|
-
|
|
2970
|
-
|
|
2971
|
-
|
|
2972
|
-
transaction = _useContext3.transaction,
|
|
2973
|
-
approve = _useContext3.approve,
|
|
2974
|
-
approvalTransaction = _useContext3.approvalTransaction;
|
|
3087
|
+
var _useContext3 = React.useContext(TrackingContext),
|
|
3088
|
+
tracking = _useContext3.tracking,
|
|
3089
|
+
forward = _useContext3.forward,
|
|
3090
|
+
forwardTo = _useContext3.forwardTo;
|
|
2975
3091
|
|
|
2976
|
-
var _useContext4 = React.useContext(
|
|
2977
|
-
|
|
3092
|
+
var _useContext4 = React.useContext(PaymentContext),
|
|
3093
|
+
payment = _useContext4.payment,
|
|
3094
|
+
paymentState = _useContext4.paymentState,
|
|
3095
|
+
pay = _useContext4.pay,
|
|
3096
|
+
transaction = _useContext4.transaction,
|
|
3097
|
+
approve = _useContext4.approve,
|
|
3098
|
+
approvalTransaction = _useContext4.approvalTransaction;
|
|
3099
|
+
|
|
3100
|
+
var _useContext5 = React.useContext(PaymentValueContext),
|
|
3101
|
+
paymentValue = _useContext5.paymentValue;
|
|
3102
|
+
|
|
3103
|
+
var _useContext6 = React.useContext(reactDialogStack.NavigateStackContext),
|
|
3104
|
+
navigate = _useContext6.navigate;
|
|
3105
|
+
|
|
3106
|
+
var _useContext7 = React.useContext(ClosableContext),
|
|
3107
|
+
close = _useContext7.close;
|
|
3108
|
+
|
|
3109
|
+
var trackingInfo = function trackingInfo() {
|
|
3110
|
+
if (tracking != true) {
|
|
3111
|
+
return null;
|
|
3112
|
+
}
|
|
3113
|
+
|
|
3114
|
+
if (forward) {
|
|
3115
|
+
return /*#__PURE__*/React__default$1["default"].createElement("div", null, /*#__PURE__*/React__default$1["default"].createElement("a", {
|
|
3116
|
+
className: "Card transparent small disabled"
|
|
3117
|
+
}, /*#__PURE__*/React__default$1["default"].createElement("div", {
|
|
3118
|
+
className: "CardImage"
|
|
3119
|
+
}, /*#__PURE__*/React__default$1["default"].createElement("div", {
|
|
3120
|
+
className: "TextCenter Opacity05"
|
|
3121
|
+
}, /*#__PURE__*/React__default$1["default"].createElement(Checkmark, {
|
|
3122
|
+
className: "small"
|
|
3123
|
+
}))), /*#__PURE__*/React__default$1["default"].createElement("div", {
|
|
3124
|
+
className: "CardBody"
|
|
3125
|
+
}, /*#__PURE__*/React__default$1["default"].createElement("div", {
|
|
3126
|
+
className: "CardBodyWrapper"
|
|
3127
|
+
}, /*#__PURE__*/React__default$1["default"].createElement("div", {
|
|
3128
|
+
className: "Opacity05"
|
|
3129
|
+
}, "Payment confirmation has been stored")))));
|
|
3130
|
+
} else {
|
|
3131
|
+
return /*#__PURE__*/React__default$1["default"].createElement("div", null, /*#__PURE__*/React__default$1["default"].createElement("a", {
|
|
3132
|
+
className: "Card transparent small disabled"
|
|
3133
|
+
}, /*#__PURE__*/React__default$1["default"].createElement("div", {
|
|
3134
|
+
className: "CardImage"
|
|
3135
|
+
}, /*#__PURE__*/React__default$1["default"].createElement("div", {
|
|
3136
|
+
className: "TextCenter"
|
|
3137
|
+
}, /*#__PURE__*/React__default$1["default"].createElement("div", {
|
|
3138
|
+
className: "Loading Icon"
|
|
3139
|
+
}))), /*#__PURE__*/React__default$1["default"].createElement("div", {
|
|
3140
|
+
className: "CardBody"
|
|
3141
|
+
}, /*#__PURE__*/React__default$1["default"].createElement("div", {
|
|
3142
|
+
className: "CardBodyWrapper"
|
|
3143
|
+
}, /*#__PURE__*/React__default$1["default"].createElement("div", {
|
|
3144
|
+
className: "Opacity05"
|
|
3145
|
+
}, "Storing payment confirmation")))));
|
|
3146
|
+
}
|
|
3147
|
+
};
|
|
2978
3148
|
|
|
2979
|
-
var
|
|
2980
|
-
|
|
3149
|
+
var additionalPaymentInformation = function additionalPaymentInformation() {
|
|
3150
|
+
if (paymentState == 'paying' && transaction == undefined) {
|
|
3151
|
+
return /*#__PURE__*/React__default$1["default"].createElement("div", {
|
|
3152
|
+
className: "PaddingBottomS"
|
|
3153
|
+
}, /*#__PURE__*/React__default$1["default"].createElement("div", {
|
|
3154
|
+
className: "Card transparent disabled small"
|
|
3155
|
+
}, /*#__PURE__*/React__default$1["default"].createElement("div", {
|
|
3156
|
+
className: "CardImage"
|
|
3157
|
+
}, /*#__PURE__*/React__default$1["default"].createElement("div", {
|
|
3158
|
+
className: "TextCenter Opacity05"
|
|
3159
|
+
}, /*#__PURE__*/React__default$1["default"].createElement(DigitalWalletIcon, {
|
|
3160
|
+
className: "small"
|
|
3161
|
+
}))), /*#__PURE__*/React__default$1["default"].createElement("div", {
|
|
3162
|
+
className: "CardBody"
|
|
3163
|
+
}, /*#__PURE__*/React__default$1["default"].createElement("div", {
|
|
3164
|
+
className: "CardBodyWrapper"
|
|
3165
|
+
}, /*#__PURE__*/React__default$1["default"].createElement("div", {
|
|
3166
|
+
className: "Opacity05"
|
|
3167
|
+
}, "Confirm transaction in your wallet")))));
|
|
3168
|
+
} else if (paymentState == 'confirmed') {
|
|
3169
|
+
return /*#__PURE__*/React__default$1["default"].createElement("div", {
|
|
3170
|
+
className: "PaddingBottomS"
|
|
3171
|
+
}, /*#__PURE__*/React__default$1["default"].createElement("div", null, /*#__PURE__*/React__default$1["default"].createElement("a", {
|
|
3172
|
+
className: "Card transparent small",
|
|
3173
|
+
title: "Payment has been confirmed by the network",
|
|
3174
|
+
href: transaction === null || transaction === void 0 ? void 0 : transaction.url,
|
|
3175
|
+
target: "_blank",
|
|
3176
|
+
rel: "noopener noreferrer"
|
|
3177
|
+
}, /*#__PURE__*/React__default$1["default"].createElement("div", {
|
|
3178
|
+
className: "CardImage"
|
|
3179
|
+
}, /*#__PURE__*/React__default$1["default"].createElement("div", {
|
|
3180
|
+
className: "TextCenter Opacity05"
|
|
3181
|
+
}, /*#__PURE__*/React__default$1["default"].createElement(Checkmark, {
|
|
3182
|
+
className: "small"
|
|
3183
|
+
}))), /*#__PURE__*/React__default$1["default"].createElement("div", {
|
|
3184
|
+
className: "CardBody"
|
|
3185
|
+
}, /*#__PURE__*/React__default$1["default"].createElement("div", {
|
|
3186
|
+
className: "CardBodyWrapper"
|
|
3187
|
+
}, /*#__PURE__*/React__default$1["default"].createElement("div", {
|
|
3188
|
+
className: "Opacity05"
|
|
3189
|
+
}, "Payment has been confirmed"))))), trackingInfo());
|
|
3190
|
+
}
|
|
3191
|
+
};
|
|
3192
|
+
|
|
3193
|
+
var approvalButton = function approvalButton() {
|
|
3194
|
+
if (!payment.route.approvalRequired || payment.route.directTransfer) {
|
|
3195
|
+
return null;
|
|
3196
|
+
} else if (paymentState == 'initialized') {
|
|
3197
|
+
return /*#__PURE__*/React__default$1["default"].createElement("div", {
|
|
3198
|
+
className: "PaddingBottomS"
|
|
3199
|
+
}, /*#__PURE__*/React__default$1["default"].createElement("button", {
|
|
3200
|
+
className: "ButtonPrimary",
|
|
3201
|
+
onClick: approve,
|
|
3202
|
+
title: "Allow ".concat(payment.symbol, " to be used as payment")
|
|
3203
|
+
}, "Allow ", payment.symbol, " to be used as payment"));
|
|
3204
|
+
} else if (paymentState == 'approving') {
|
|
3205
|
+
return /*#__PURE__*/React__default$1["default"].createElement("div", {
|
|
3206
|
+
className: "PaddingBottomS"
|
|
3207
|
+
}, /*#__PURE__*/React__default$1["default"].createElement("a", {
|
|
3208
|
+
className: "ButtonPrimary",
|
|
3209
|
+
title: "Approving payment token - please wait",
|
|
3210
|
+
href: approvalTransaction === null || approvalTransaction === void 0 ? void 0 : approvalTransaction.url,
|
|
3211
|
+
target: "_blank",
|
|
3212
|
+
rel: "noopener noreferrer"
|
|
3213
|
+
}, /*#__PURE__*/React__default$1["default"].createElement(LoadingText, null, "Approving")));
|
|
3214
|
+
}
|
|
3215
|
+
};
|
|
2981
3216
|
|
|
2982
3217
|
var mainAction = function mainAction() {
|
|
2983
3218
|
if (paymentState == 'initialized' || paymentState == 'approving') {
|
|
@@ -2992,10 +3227,10 @@
|
|
|
2992
3227
|
navigate: navigate
|
|
2993
3228
|
});
|
|
2994
3229
|
}
|
|
2995
|
-
}, "Pay ", new
|
|
3230
|
+
}, "Pay ", amount ? new localCurrency.Currency({
|
|
2996
3231
|
amount: amount.toFixed(2),
|
|
2997
3232
|
code: currencyCode
|
|
2998
|
-
}).toString());
|
|
3233
|
+
}).toString() : paymentValue.toString().length ? paymentValue.toString() : "".concat(payment.amount));
|
|
2999
3234
|
} else if (paymentState == 'paying') {
|
|
3000
3235
|
return /*#__PURE__*/React__default$1["default"].createElement("a", {
|
|
3001
3236
|
className: "ButtonPrimary",
|
|
@@ -3005,39 +3240,51 @@
|
|
|
3005
3240
|
rel: "noopener noreferrer"
|
|
3006
3241
|
}, /*#__PURE__*/React__default$1["default"].createElement(LoadingText, null, "Paying"));
|
|
3007
3242
|
} else if (paymentState == 'confirmed') {
|
|
3008
|
-
|
|
3009
|
-
|
|
3010
|
-
|
|
3011
|
-
|
|
3012
|
-
|
|
3243
|
+
if (tracking == true) {
|
|
3244
|
+
if (forward) {
|
|
3245
|
+
if (forwardTo) {
|
|
3246
|
+
return /*#__PURE__*/React__default$1["default"].createElement("a", {
|
|
3247
|
+
className: "ButtonPrimary",
|
|
3248
|
+
href: forwardTo,
|
|
3249
|
+
rel: "noopener noreferrer"
|
|
3250
|
+
}, "Continue");
|
|
3251
|
+
} else {
|
|
3252
|
+
return /*#__PURE__*/React__default$1["default"].createElement("button", {
|
|
3253
|
+
className: "ButtonPrimary",
|
|
3254
|
+
onClick: close
|
|
3255
|
+
}, "Continue");
|
|
3256
|
+
}
|
|
3257
|
+
} else {
|
|
3258
|
+
return /*#__PURE__*/React__default$1["default"].createElement("button", {
|
|
3259
|
+
className: "ButtonPrimary disabled",
|
|
3260
|
+
onClick: function onClick() {}
|
|
3261
|
+
}, "Continue");
|
|
3262
|
+
}
|
|
3263
|
+
} else {
|
|
3264
|
+
return /*#__PURE__*/React__default$1["default"].createElement("button", {
|
|
3265
|
+
className: "ButtonPrimary",
|
|
3266
|
+
onClick: close
|
|
3267
|
+
}, "Close");
|
|
3268
|
+
}
|
|
3013
3269
|
}
|
|
3014
3270
|
};
|
|
3015
3271
|
|
|
3016
|
-
|
|
3017
|
-
|
|
3018
|
-
return /*#__PURE__*/React__default$1["default"].createElement("div", {
|
|
3019
|
-
className: "PaddingBottomS"
|
|
3020
|
-
}, /*#__PURE__*/React__default$1["default"].createElement("button", {
|
|
3021
|
-
className: "ButtonPrimary wide",
|
|
3022
|
-
onClick: approve,
|
|
3023
|
-
title: "Allow ".concat(payment.symbol, " to be used as payment")
|
|
3024
|
-
}, "Allow ", payment.symbol, " to be used as payment"));
|
|
3025
|
-
} else if (paymentState == 'approving') {
|
|
3026
|
-
return /*#__PURE__*/React__default$1["default"].createElement("div", {
|
|
3027
|
-
className: "PaddingBottomS"
|
|
3028
|
-
}, /*#__PURE__*/React__default$1["default"].createElement("a", {
|
|
3029
|
-
className: "ButtonPrimary wide",
|
|
3030
|
-
title: "Approving payment token - please wait",
|
|
3031
|
-
href: approvalTransaction === null || approvalTransaction === void 0 ? void 0 : approvalTransaction.url,
|
|
3032
|
-
target: "_blank",
|
|
3033
|
-
rel: "noopener noreferrer"
|
|
3034
|
-
}, /*#__PURE__*/React__default$1["default"].createElement(LoadingText, null, "Approving")));
|
|
3035
|
-
}
|
|
3036
|
-
};
|
|
3272
|
+
return /*#__PURE__*/React__default$1["default"].createElement("div", null, approvalButton(), additionalPaymentInformation(), mainAction());
|
|
3273
|
+
});
|
|
3037
3274
|
|
|
3038
|
-
|
|
3039
|
-
|
|
3040
|
-
|
|
3275
|
+
var DonationOverviewDialog = (function (props) {
|
|
3276
|
+
var _useContext = React.useContext(ConfigurationContext),
|
|
3277
|
+
currencyCode = _useContext.currencyCode;
|
|
3278
|
+
|
|
3279
|
+
var _useContext2 = React.useContext(ChangableAmountContext),
|
|
3280
|
+
amount = _useContext2.amount;
|
|
3281
|
+
|
|
3282
|
+
var _useContext3 = React.useContext(PaymentContext),
|
|
3283
|
+
payment = _useContext3.payment,
|
|
3284
|
+
paymentState = _useContext3.paymentState;
|
|
3285
|
+
|
|
3286
|
+
var _useContext4 = React.useContext(reactDialogStack.NavigateStackContext),
|
|
3287
|
+
navigate = _useContext4.navigate;
|
|
3041
3288
|
|
|
3042
3289
|
if (payment == undefined) {
|
|
3043
3290
|
return /*#__PURE__*/React__default$1["default"].createElement(DonationOverviewSkeleton, null);
|
|
@@ -3045,9 +3292,9 @@
|
|
|
3045
3292
|
|
|
3046
3293
|
return /*#__PURE__*/React__default$1["default"].createElement(Dialog$1, {
|
|
3047
3294
|
header: /*#__PURE__*/React__default$1["default"].createElement("div", {
|
|
3048
|
-
className: "PaddingTopS PaddingLeftM PaddingRightM"
|
|
3295
|
+
className: "PaddingTopS PaddingLeftM PaddingRightM TextLeft"
|
|
3049
3296
|
}, /*#__PURE__*/React__default$1["default"].createElement("h1", {
|
|
3050
|
-
className: "LineHeightL FontSizeL
|
|
3297
|
+
className: "LineHeightL FontSizeL"
|
|
3051
3298
|
}, "Donation")),
|
|
3052
3299
|
body: /*#__PURE__*/React__default$1["default"].createElement("div", {
|
|
3053
3300
|
className: "PaddingTopS PaddingLeftM PaddingRightM PaddingBottomXS"
|
|
@@ -3071,7 +3318,7 @@
|
|
|
3071
3318
|
className: "CardText"
|
|
3072
3319
|
}, /*#__PURE__*/React__default$1["default"].createElement("div", {
|
|
3073
3320
|
className: "TokenAmountRow"
|
|
3074
|
-
}, new
|
|
3321
|
+
}, new localCurrency.Currency({
|
|
3075
3322
|
amount: amount.toFixed(2),
|
|
3076
3323
|
code: currencyCode
|
|
3077
3324
|
}).toString())))), /*#__PURE__*/React__default$1["default"].createElement("div", {
|
|
@@ -3089,7 +3336,7 @@
|
|
|
3089
3336
|
}, /*#__PURE__*/React__default$1["default"].createElement("div", {
|
|
3090
3337
|
className: "CardImage",
|
|
3091
3338
|
title: payment.name
|
|
3092
|
-
}, /*#__PURE__*/React__default$1["default"].createElement(
|
|
3339
|
+
}, /*#__PURE__*/React__default$1["default"].createElement(reactTokenImage.TokenImage, {
|
|
3093
3340
|
blockchain: payment.route.blockchain,
|
|
3094
3341
|
address: payment.token
|
|
3095
3342
|
})), /*#__PURE__*/React__default$1["default"].createElement("div", {
|
|
@@ -3110,13 +3357,13 @@
|
|
|
3110
3357
|
className: "CardAction"
|
|
3111
3358
|
}, /*#__PURE__*/React__default$1["default"].createElement(ChevronRight, null)))),
|
|
3112
3359
|
footer: /*#__PURE__*/React__default$1["default"].createElement("div", {
|
|
3113
|
-
className: "PaddingTopXS PaddingRightM PaddingLeftM"
|
|
3114
|
-
},
|
|
3360
|
+
className: "PaddingTopXS PaddingRightM PaddingLeftM PaddingBottomM"
|
|
3361
|
+
}, /*#__PURE__*/React__default$1["default"].createElement(Footer, null))
|
|
3115
3362
|
});
|
|
3116
3363
|
});
|
|
3117
3364
|
|
|
3118
3365
|
var PaymentErrorDialog = (function () {
|
|
3119
|
-
var _useContext = React.useContext(
|
|
3366
|
+
var _useContext = React.useContext(reactDialogStack.NavigateStackContext),
|
|
3120
3367
|
navigate = _useContext.navigate;
|
|
3121
3368
|
|
|
3122
3369
|
var _useContext2 = React.useContext(PaymentContext),
|
|
@@ -3148,9 +3395,9 @@
|
|
|
3148
3395
|
rel: "noopener noreferrer"
|
|
3149
3396
|
}, "View on explorer")))),
|
|
3150
3397
|
footer: /*#__PURE__*/React__default$1["default"].createElement("div", {
|
|
3151
|
-
className: "PaddingTopXS PaddingRightM PaddingLeftM"
|
|
3398
|
+
className: "PaddingTopXS PaddingRightM PaddingLeftM PaddingBottomM"
|
|
3152
3399
|
}, /*#__PURE__*/React__default$1["default"].createElement("button", {
|
|
3153
|
-
className: "ButtonPrimary
|
|
3400
|
+
className: "ButtonPrimary",
|
|
3154
3401
|
onClick: function onClick() {
|
|
3155
3402
|
return navigate('back');
|
|
3156
3403
|
}
|
|
@@ -3164,16 +3411,16 @@
|
|
|
3164
3411
|
var _useContext = React.useContext(PaymentContext),
|
|
3165
3412
|
payment = _useContext.payment;
|
|
3166
3413
|
|
|
3167
|
-
var _useContext2 = React.useContext(
|
|
3414
|
+
var _useContext2 = React.useContext(reactDialogStack.NavigateStackContext),
|
|
3168
3415
|
navigate = _useContext2.navigate;
|
|
3169
3416
|
|
|
3170
|
-
var blockchain =
|
|
3417
|
+
var blockchain = web3Blockchains.Blockchain.findByName(payment.route.blockchain);
|
|
3171
3418
|
return /*#__PURE__*/React__default$1["default"].createElement(Dialog$1, {
|
|
3172
3419
|
stacked: true,
|
|
3173
3420
|
header: /*#__PURE__*/React__default$1["default"].createElement("div", {
|
|
3174
|
-
className: "PaddingTopS PaddingLeftM PaddingRightM"
|
|
3421
|
+
className: "PaddingTopS PaddingLeftM PaddingRightM TextLeft"
|
|
3175
3422
|
}, /*#__PURE__*/React__default$1["default"].createElement("h1", {
|
|
3176
|
-
className: "LineHeightL FontSizeL
|
|
3423
|
+
className: "LineHeightL FontSizeL"
|
|
3177
3424
|
}, "Wrong Network")),
|
|
3178
3425
|
body: /*#__PURE__*/React__default$1["default"].createElement("div", {
|
|
3179
3426
|
className: "PaddingTopS PaddingLeftM PaddingRightM PaddingBottomXS"
|
|
@@ -3190,7 +3437,7 @@
|
|
|
3190
3437
|
className: "FontSizeM"
|
|
3191
3438
|
}, "Please make sure you connect your wallet to the correct network before you try again!"))),
|
|
3192
3439
|
footer: /*#__PURE__*/React__default$1["default"].createElement("div", {
|
|
3193
|
-
className: "PaddingTopXS PaddingRightM PaddingLeftM"
|
|
3440
|
+
className: "PaddingTopXS PaddingRightM PaddingLeftM PaddingBottomM"
|
|
3194
3441
|
}, /*#__PURE__*/React__default$1["default"].createElement("button", {
|
|
3195
3442
|
className: "ButtonPrimary",
|
|
3196
3443
|
onClick: function onClick() {
|
|
@@ -3205,7 +3452,7 @@
|
|
|
3205
3452
|
open = _useContext.open,
|
|
3206
3453
|
close = _useContext.close;
|
|
3207
3454
|
|
|
3208
|
-
return /*#__PURE__*/React__default$1["default"].createElement(
|
|
3455
|
+
return /*#__PURE__*/React__default$1["default"].createElement(reactDialogStack.ReactDialogStack, {
|
|
3209
3456
|
open: open,
|
|
3210
3457
|
close: close,
|
|
3211
3458
|
start: "DonationOverview",
|
|
@@ -3221,16 +3468,122 @@
|
|
|
3221
3468
|
});
|
|
3222
3469
|
});
|
|
3223
3470
|
|
|
3224
|
-
var
|
|
3225
|
-
var
|
|
3471
|
+
var TrackingProvider = (function (props) {
|
|
3472
|
+
var _useContext = React.useContext(ConfigurationContext),
|
|
3473
|
+
track = _useContext.track;
|
|
3474
|
+
|
|
3475
|
+
var _useState = React.useState(track && !!track.endpoint),
|
|
3226
3476
|
_useState2 = _slicedToArray(_useState, 2),
|
|
3227
|
-
|
|
3228
|
-
|
|
3477
|
+
tracking = _useState2[0],
|
|
3478
|
+
setTracking = _useState2[1];
|
|
3479
|
+
|
|
3480
|
+
var _useState3 = React.useState(false),
|
|
3481
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
3482
|
+
forward = _useState4[0],
|
|
3483
|
+
setForward = _useState4[1];
|
|
3484
|
+
|
|
3485
|
+
var _useState5 = React.useState(),
|
|
3486
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
3487
|
+
forwardTo = _useState6[0],
|
|
3488
|
+
setForwardTo = _useState6[1];
|
|
3489
|
+
|
|
3490
|
+
var _useContext2 = React.useContext(ClosableContext),
|
|
3491
|
+
setClosable = _useContext2.setClosable;
|
|
3492
|
+
|
|
3493
|
+
React.useEffect(function () {
|
|
3494
|
+
setTracking(track && !!track.endpoint);
|
|
3495
|
+
}, [track]);
|
|
3496
|
+
|
|
3497
|
+
var openSocket = function openSocket(transaction) {
|
|
3498
|
+
var socket = new WebSocket('wss://integrate.depay.fi/cable');
|
|
3499
|
+
|
|
3500
|
+
socket.onopen = function (event) {
|
|
3501
|
+
var msg = {
|
|
3502
|
+
command: 'subscribe',
|
|
3503
|
+
identifier: JSON.stringify({
|
|
3504
|
+
blockchain: transaction.blockchain,
|
|
3505
|
+
sender: transaction.from.toLowerCase(),
|
|
3506
|
+
nonce: transaction.nonce,
|
|
3507
|
+
channel: 'PaymentChannel'
|
|
3508
|
+
})
|
|
3509
|
+
};
|
|
3510
|
+
socket.send(JSON.stringify(msg));
|
|
3511
|
+
};
|
|
3229
3512
|
|
|
3230
|
-
|
|
3513
|
+
socket.onclose = function (event) {};
|
|
3514
|
+
|
|
3515
|
+
socket.onmessage = function (event) {
|
|
3516
|
+
var item = JSON.parse(event.data);
|
|
3517
|
+
|
|
3518
|
+
if (item.type === "ping") {
|
|
3519
|
+
return;
|
|
3520
|
+
}
|
|
3521
|
+
|
|
3522
|
+
if (item.message && item.message.forward) {
|
|
3523
|
+
setClosable(!item.message.forward_to);
|
|
3524
|
+
setForwardTo(item.message.forward_to);
|
|
3525
|
+
setForward(item.message.forward);
|
|
3526
|
+
socket.close();
|
|
3527
|
+
|
|
3528
|
+
if (!!item.message.forward_to) {
|
|
3529
|
+
setTimeout(function () {
|
|
3530
|
+
props.document.location.href = item.message.forward_to;
|
|
3531
|
+
}, 500);
|
|
3532
|
+
}
|
|
3533
|
+
}
|
|
3534
|
+
};
|
|
3535
|
+
|
|
3536
|
+
socket.onerror = function (error) {
|
|
3537
|
+
console.log('WebSocket Error: ' + error);
|
|
3538
|
+
};
|
|
3539
|
+
};
|
|
3540
|
+
|
|
3541
|
+
var retryStartTracking = function retryStartTracking(transaction, afterBlock, attempt) {
|
|
3542
|
+
attempt = parseInt(attempt || 1, 10);
|
|
3543
|
+
console.log('RETRY TRACKING ATTEMPT ', attempt);
|
|
3544
|
+
|
|
3545
|
+
if (attempt < 3) {
|
|
3546
|
+
setTimeout(function () {
|
|
3547
|
+
startTracking(transaction, afterBlock, attempt + 1);
|
|
3548
|
+
}, 3000);
|
|
3549
|
+
} else {
|
|
3550
|
+
console.log('TRACKING FAILED AFTER 3 ATTEMPTS!');
|
|
3551
|
+
}
|
|
3552
|
+
};
|
|
3553
|
+
|
|
3554
|
+
var startTracking = function startTracking(transaction, afterBlock, attempt) {
|
|
3555
|
+
fetch(track.endpoint, {
|
|
3556
|
+
method: 'POST',
|
|
3557
|
+
body: JSON.stringify({
|
|
3558
|
+
blockchain: transaction.blockchain,
|
|
3559
|
+
transaction: transaction.id.toLowerCase(),
|
|
3560
|
+
sender: transaction.from.toLowerCase(),
|
|
3561
|
+
nonce: transaction.nonce,
|
|
3562
|
+
after_block: afterBlock
|
|
3563
|
+
})
|
|
3564
|
+
}).then(function (response) {
|
|
3565
|
+
if (response.status == 200) {
|
|
3566
|
+
console.log('TRACKING INITIALIZED');
|
|
3567
|
+
} else {
|
|
3568
|
+
retryStartTracking(transaction, afterBlock, attempt);
|
|
3569
|
+
}
|
|
3570
|
+
})["catch"](function (error) {
|
|
3571
|
+
console.log('TRACKING FAILED', error);
|
|
3572
|
+
retryStartTracking(transaction, afterBlock, attempt);
|
|
3573
|
+
});
|
|
3574
|
+
};
|
|
3575
|
+
|
|
3576
|
+
var initializeTracking = function initializeTracking(transaction, afterBlock) {
|
|
3577
|
+
openSocket(transaction);
|
|
3578
|
+
startTracking(transaction, afterBlock);
|
|
3579
|
+
};
|
|
3580
|
+
|
|
3581
|
+
return /*#__PURE__*/React__default$1["default"].createElement(TrackingContext.Provider, {
|
|
3231
3582
|
value: {
|
|
3232
|
-
|
|
3233
|
-
|
|
3583
|
+
tracking: tracking,
|
|
3584
|
+
initializeTracking: initializeTracking,
|
|
3585
|
+
forward: forward,
|
|
3586
|
+
forwardTo: forwardTo
|
|
3234
3587
|
}
|
|
3235
3588
|
}, props.children);
|
|
3236
3589
|
});
|
|
@@ -3333,12 +3686,12 @@
|
|
|
3333
3686
|
|
|
3334
3687
|
var Donation = /*#__PURE__*/function () {
|
|
3335
3688
|
var _ref4 = _asyncToGenerator( /*#__PURE__*/regenerator.mark(function _callee2(_ref3) {
|
|
3336
|
-
var amount, accept, event, sent, confirmed,
|
|
3689
|
+
var amount, accept, event, sent, confirmed, failed, error, critical, style, blacklist, providers, currency, connected, closed, document, unmount;
|
|
3337
3690
|
return regenerator.wrap(function _callee2$(_context2) {
|
|
3338
3691
|
while (1) {
|
|
3339
3692
|
switch (_context2.prev = _context2.next) {
|
|
3340
3693
|
case 0:
|
|
3341
|
-
amount = _ref3.amount, accept = _ref3.accept, event = _ref3.event, sent = _ref3.sent, confirmed = _ref3.confirmed,
|
|
3694
|
+
amount = _ref3.amount, accept = _ref3.accept, event = _ref3.event, sent = _ref3.sent, confirmed = _ref3.confirmed, failed = _ref3.failed, error = _ref3.error, critical = _ref3.critical, style = _ref3.style, blacklist = _ref3.blacklist, providers = _ref3.providers, currency = _ref3.currency, connected = _ref3.connected, closed = _ref3.closed, document = _ref3.document;
|
|
3342
3695
|
_context2.prev = 1;
|
|
3343
3696
|
_context2.next = 4;
|
|
3344
3697
|
return preflight$2({
|
|
@@ -3364,26 +3717,27 @@
|
|
|
3364
3717
|
event: event,
|
|
3365
3718
|
sent: sent,
|
|
3366
3719
|
confirmed: confirmed,
|
|
3367
|
-
ensured: ensured,
|
|
3368
3720
|
failed: failed,
|
|
3369
3721
|
blacklist: blacklist,
|
|
3370
3722
|
providers: providers
|
|
3371
3723
|
}
|
|
3372
|
-
}, /*#__PURE__*/React__default$1["default"].createElement(ClosableProvider, {
|
|
3724
|
+
}, /*#__PURE__*/React__default$1["default"].createElement(UpdatableProvider, null, /*#__PURE__*/React__default$1["default"].createElement(ClosableProvider, {
|
|
3373
3725
|
unmount: unmount
|
|
3374
|
-
}, /*#__PURE__*/React__default$1["default"].createElement(
|
|
3726
|
+
}, /*#__PURE__*/React__default$1["default"].createElement(WalletProvider, {
|
|
3375
3727
|
container: container,
|
|
3376
3728
|
connected: connected,
|
|
3377
3729
|
unmount: unmount
|
|
3378
3730
|
}, /*#__PURE__*/React__default$1["default"].createElement(ConversionRateProvider, null, /*#__PURE__*/React__default$1["default"].createElement(ChangableAmountProvider, {
|
|
3379
3731
|
accept: accept
|
|
3732
|
+
}, /*#__PURE__*/React__default$1["default"].createElement(TrackingProvider, {
|
|
3733
|
+
document: ensureDocument(document)
|
|
3380
3734
|
}, /*#__PURE__*/React__default$1["default"].createElement(DonationRoutingProvider, {
|
|
3381
3735
|
container: container,
|
|
3382
3736
|
document: document
|
|
3383
3737
|
}, /*#__PURE__*/React__default$1["default"].createElement(DonationStack, {
|
|
3384
3738
|
document: document,
|
|
3385
3739
|
container: container
|
|
3386
|
-
})))))))));
|
|
3740
|
+
}), /*#__PURE__*/React__default$1["default"].createElement(PoweredBy, null))))))))));
|
|
3387
3741
|
};
|
|
3388
3742
|
});
|
|
3389
3743
|
return _context2.abrupt("return", {
|
|
@@ -3451,9 +3805,9 @@
|
|
|
3451
3805
|
|
|
3452
3806
|
return /*#__PURE__*/React__default$1["default"].createElement(Dialog$1, {
|
|
3453
3807
|
header: /*#__PURE__*/React__default$1["default"].createElement("div", {
|
|
3454
|
-
className: "PaddingTopS PaddingLeftM PaddingRightM"
|
|
3808
|
+
className: "PaddingTopS PaddingLeftM PaddingRightM TextLeft"
|
|
3455
3809
|
}, /*#__PURE__*/React__default$1["default"].createElement("h1", {
|
|
3456
|
-
className: "LineHeightL FontSizeL
|
|
3810
|
+
className: "LineHeightL FontSizeL"
|
|
3457
3811
|
}, "Payment")),
|
|
3458
3812
|
body: /*#__PURE__*/React__default$1["default"].createElement("div", {
|
|
3459
3813
|
className: "PaddingTopS PaddingLeftM PaddingRightM PaddingBottomXS"
|
|
@@ -3467,7 +3821,7 @@
|
|
|
3467
3821
|
className: "SkeletonBackground"
|
|
3468
3822
|
}))),
|
|
3469
3823
|
footer: /*#__PURE__*/React__default$1["default"].createElement("div", {
|
|
3470
|
-
className: "PaddingTopXS PaddingRightM PaddingLeftM"
|
|
3824
|
+
className: "PaddingTopXS PaddingRightM PaddingLeftM PaddingBottomM"
|
|
3471
3825
|
}, /*#__PURE__*/React__default$1["default"].createElement("div", {
|
|
3472
3826
|
className: "SkeletonWrapper"
|
|
3473
3827
|
}, /*#__PURE__*/React__default$1["default"].createElement("div", {
|
|
@@ -3482,96 +3836,29 @@
|
|
|
3482
3836
|
var _useContext = React.useContext(ConfigurationContext),
|
|
3483
3837
|
currencyCode = _useContext.currencyCode;
|
|
3484
3838
|
|
|
3485
|
-
var _useContext2 = React.useContext(
|
|
3486
|
-
|
|
3487
|
-
|
|
3839
|
+
var _useContext2 = React.useContext(PaymentContext),
|
|
3840
|
+
payment = _useContext2.payment,
|
|
3841
|
+
paymentState = _useContext2.paymentState;
|
|
3488
3842
|
|
|
3489
|
-
var _useContext3 = React.useContext(
|
|
3490
|
-
|
|
3491
|
-
|
|
3492
|
-
pay = _useContext3.pay,
|
|
3493
|
-
transaction = _useContext3.transaction,
|
|
3494
|
-
approve = _useContext3.approve,
|
|
3495
|
-
approvalTransaction = _useContext3.approvalTransaction;
|
|
3843
|
+
var _useContext3 = React.useContext(ChangableAmountContext),
|
|
3844
|
+
amount = _useContext3.amount,
|
|
3845
|
+
amountsMissing = _useContext3.amountsMissing;
|
|
3496
3846
|
|
|
3497
3847
|
var _useContext4 = React.useContext(PaymentValueContext),
|
|
3498
3848
|
paymentValue = _useContext4.paymentValue;
|
|
3499
3849
|
|
|
3500
|
-
var _useContext5 = React.useContext(
|
|
3850
|
+
var _useContext5 = React.useContext(reactDialogStack.NavigateStackContext),
|
|
3501
3851
|
navigate = _useContext5.navigate;
|
|
3502
3852
|
|
|
3503
|
-
var _useContext6 = React.useContext(ClosableContext),
|
|
3504
|
-
close = _useContext6.close;
|
|
3505
|
-
|
|
3506
|
-
var mainAction = function mainAction() {
|
|
3507
|
-
if (paymentState == 'initialized' || paymentState == 'approving') {
|
|
3508
|
-
return /*#__PURE__*/React__default$1["default"].createElement("button", {
|
|
3509
|
-
className: ["ButtonPrimary", payment.route.approvalRequired && !payment.route.directTransfer ? 'disabled' : ''].join(' '),
|
|
3510
|
-
onClick: function onClick() {
|
|
3511
|
-
if (payment.route.approvalRequired && !payment.route.directTransfer) {
|
|
3512
|
-
return;
|
|
3513
|
-
}
|
|
3514
|
-
|
|
3515
|
-
pay({
|
|
3516
|
-
navigate: navigate
|
|
3517
|
-
});
|
|
3518
|
-
}
|
|
3519
|
-
}, "Pay ", amount ? new depayLocalCurrency.Currency({
|
|
3520
|
-
amount: amount.toFixed(2),
|
|
3521
|
-
code: currencyCode
|
|
3522
|
-
}).toString() : paymentValue.toString().length ? paymentValue.toString() : "".concat(payment.amount));
|
|
3523
|
-
} else if (paymentState == 'paying') {
|
|
3524
|
-
return /*#__PURE__*/React__default$1["default"].createElement("a", {
|
|
3525
|
-
className: "ButtonPrimary",
|
|
3526
|
-
title: "Performing the payment - please wait",
|
|
3527
|
-
href: transaction === null || transaction === void 0 ? void 0 : transaction.url,
|
|
3528
|
-
target: "_blank",
|
|
3529
|
-
rel: "noopener noreferrer"
|
|
3530
|
-
}, /*#__PURE__*/React__default$1["default"].createElement(LoadingText, null, "Paying"));
|
|
3531
|
-
} else if (paymentState == 'confirmed') {
|
|
3532
|
-
return /*#__PURE__*/React__default$1["default"].createElement("button", {
|
|
3533
|
-
className: "ButtonPrimary round",
|
|
3534
|
-
title: "Done",
|
|
3535
|
-
onClick: close
|
|
3536
|
-
}, /*#__PURE__*/React__default$1["default"].createElement(Checkmark, null));
|
|
3537
|
-
}
|
|
3538
|
-
};
|
|
3539
|
-
|
|
3540
|
-
var approvalAction = function approvalAction() {
|
|
3541
|
-
if (paymentState == 'initialized') {
|
|
3542
|
-
return /*#__PURE__*/React__default$1["default"].createElement("div", {
|
|
3543
|
-
className: "PaddingBottomS"
|
|
3544
|
-
}, /*#__PURE__*/React__default$1["default"].createElement("button", {
|
|
3545
|
-
className: "ButtonPrimary wide",
|
|
3546
|
-
onClick: approve,
|
|
3547
|
-
title: "Allow ".concat(payment.symbol, " to be used as payment")
|
|
3548
|
-
}, "Allow ", payment.symbol, " to be used as payment"));
|
|
3549
|
-
} else if (paymentState == 'approving') {
|
|
3550
|
-
return /*#__PURE__*/React__default$1["default"].createElement("div", {
|
|
3551
|
-
className: "PaddingBottomS"
|
|
3552
|
-
}, /*#__PURE__*/React__default$1["default"].createElement("a", {
|
|
3553
|
-
className: "ButtonPrimary wide",
|
|
3554
|
-
title: "Approving payment token - please wait",
|
|
3555
|
-
href: approvalTransaction === null || approvalTransaction === void 0 ? void 0 : approvalTransaction.url,
|
|
3556
|
-
target: "_blank",
|
|
3557
|
-
rel: "noopener noreferrer"
|
|
3558
|
-
}, /*#__PURE__*/React__default$1["default"].createElement(LoadingText, null, "Approving")));
|
|
3559
|
-
}
|
|
3560
|
-
};
|
|
3561
|
-
|
|
3562
|
-
var actions = function actions() {
|
|
3563
|
-
return /*#__PURE__*/React__default$1["default"].createElement("div", null, payment.route.approvalRequired && !payment.route.directTransfer && approvalAction(), mainAction());
|
|
3564
|
-
};
|
|
3565
|
-
|
|
3566
3853
|
if (payment == undefined || paymentValue == undefined) {
|
|
3567
3854
|
return /*#__PURE__*/React__default$1["default"].createElement(PaymentOverviewSkeleton, null);
|
|
3568
3855
|
}
|
|
3569
3856
|
|
|
3570
3857
|
return /*#__PURE__*/React__default$1["default"].createElement(Dialog$1, {
|
|
3571
3858
|
header: /*#__PURE__*/React__default$1["default"].createElement("div", {
|
|
3572
|
-
className: "PaddingTopS PaddingLeftM PaddingRightM"
|
|
3859
|
+
className: "PaddingTopS PaddingLeftM PaddingRightM TextLeft"
|
|
3573
3860
|
}, /*#__PURE__*/React__default$1["default"].createElement("h1", {
|
|
3574
|
-
className: "LineHeightL FontSizeL
|
|
3861
|
+
className: "LineHeightL FontSizeL"
|
|
3575
3862
|
}, "Payment")),
|
|
3576
3863
|
body: /*#__PURE__*/React__default$1["default"].createElement("div", {
|
|
3577
3864
|
className: "PaddingTopS PaddingLeftM PaddingRightM PaddingBottomXS"
|
|
@@ -3595,7 +3882,7 @@
|
|
|
3595
3882
|
className: "CardText"
|
|
3596
3883
|
}, /*#__PURE__*/React__default$1["default"].createElement("div", {
|
|
3597
3884
|
className: "TokenAmountRow"
|
|
3598
|
-
}, new
|
|
3885
|
+
}, new localCurrency.Currency({
|
|
3599
3886
|
amount: amount.toFixed(2),
|
|
3600
3887
|
code: currencyCode
|
|
3601
3888
|
}).toString())))), /*#__PURE__*/React__default$1["default"].createElement("div", {
|
|
@@ -3613,7 +3900,7 @@
|
|
|
3613
3900
|
}, /*#__PURE__*/React__default$1["default"].createElement("div", {
|
|
3614
3901
|
className: "CardImage",
|
|
3615
3902
|
title: payment.name
|
|
3616
|
-
}, /*#__PURE__*/React__default$1["default"].createElement(
|
|
3903
|
+
}, /*#__PURE__*/React__default$1["default"].createElement(reactTokenImage.TokenImage, {
|
|
3617
3904
|
blockchain: payment.route.blockchain,
|
|
3618
3905
|
address: payment.token
|
|
3619
3906
|
})), /*#__PURE__*/React__default$1["default"].createElement("div", {
|
|
@@ -3634,8 +3921,8 @@
|
|
|
3634
3921
|
className: "CardAction"
|
|
3635
3922
|
}, /*#__PURE__*/React__default$1["default"].createElement(ChevronRight, null)))),
|
|
3636
3923
|
footer: /*#__PURE__*/React__default$1["default"].createElement("div", {
|
|
3637
|
-
className: "PaddingTopXS PaddingRightM PaddingLeftM"
|
|
3638
|
-
},
|
|
3924
|
+
className: "PaddingTopXS PaddingRightM PaddingLeftM PaddingBottomM"
|
|
3925
|
+
}, /*#__PURE__*/React__default$1["default"].createElement(Footer, null))
|
|
3639
3926
|
});
|
|
3640
3927
|
});
|
|
3641
3928
|
|
|
@@ -3644,7 +3931,7 @@
|
|
|
3644
3931
|
open = _useContext.open,
|
|
3645
3932
|
close = _useContext.close;
|
|
3646
3933
|
|
|
3647
|
-
return /*#__PURE__*/React__default$1["default"].createElement(
|
|
3934
|
+
return /*#__PURE__*/React__default$1["default"].createElement(reactDialogStack.ReactDialogStack, {
|
|
3648
3935
|
open: open,
|
|
3649
3936
|
close: close,
|
|
3650
3937
|
start: "PaymentOverview",
|
|
@@ -3701,12 +3988,12 @@
|
|
|
3701
3988
|
|
|
3702
3989
|
var Payment = /*#__PURE__*/function () {
|
|
3703
3990
|
var _ref4 = _asyncToGenerator( /*#__PURE__*/regenerator.mark(function _callee2(_ref3) {
|
|
3704
|
-
var accept, amount, event, sent, confirmed,
|
|
3991
|
+
var accept, amount, event, sent, confirmed, failed, error, critical, style, whitelist, blacklist, providers, currency, connected, closed, track, document, unmount;
|
|
3705
3992
|
return regenerator.wrap(function _callee2$(_context2) {
|
|
3706
3993
|
while (1) {
|
|
3707
3994
|
switch (_context2.prev = _context2.next) {
|
|
3708
3995
|
case 0:
|
|
3709
|
-
accept = _ref3.accept, amount = _ref3.amount, event = _ref3.event, sent = _ref3.sent, confirmed = _ref3.confirmed,
|
|
3996
|
+
accept = _ref3.accept, amount = _ref3.amount, event = _ref3.event, sent = _ref3.sent, confirmed = _ref3.confirmed, failed = _ref3.failed, error = _ref3.error, critical = _ref3.critical, style = _ref3.style, whitelist = _ref3.whitelist, blacklist = _ref3.blacklist, providers = _ref3.providers, currency = _ref3.currency, connected = _ref3.connected, closed = _ref3.closed, track = _ref3.track, document = _ref3.document;
|
|
3710
3997
|
_context2.prev = 1;
|
|
3711
3998
|
_context2.next = 4;
|
|
3712
3999
|
return preflight$1({
|
|
@@ -3732,15 +4019,15 @@
|
|
|
3732
4019
|
event: event,
|
|
3733
4020
|
sent: sent,
|
|
3734
4021
|
confirmed: confirmed,
|
|
3735
|
-
ensured: ensured,
|
|
3736
4022
|
failed: failed,
|
|
3737
4023
|
whitelist: whitelist,
|
|
3738
4024
|
blacklist: blacklist,
|
|
3739
|
-
providers: providers
|
|
4025
|
+
providers: providers,
|
|
4026
|
+
track: track
|
|
3740
4027
|
}
|
|
3741
|
-
}, /*#__PURE__*/React__default$1["default"].createElement(ClosableProvider, {
|
|
4028
|
+
}, /*#__PURE__*/React__default$1["default"].createElement(UpdatableProvider, null, /*#__PURE__*/React__default$1["default"].createElement(ClosableProvider, {
|
|
3742
4029
|
unmount: unmount
|
|
3743
|
-
}, /*#__PURE__*/React__default$1["default"].createElement(
|
|
4030
|
+
}, /*#__PURE__*/React__default$1["default"].createElement(WalletProvider, {
|
|
3744
4031
|
document: document,
|
|
3745
4032
|
container: container,
|
|
3746
4033
|
connected: connected,
|
|
@@ -3752,13 +4039,15 @@
|
|
|
3752
4039
|
whitelist: whitelist,
|
|
3753
4040
|
blacklist: blacklist,
|
|
3754
4041
|
event: event
|
|
4042
|
+
}, /*#__PURE__*/React__default$1["default"].createElement(TrackingProvider, {
|
|
4043
|
+
document: ensureDocument(document)
|
|
3755
4044
|
}, /*#__PURE__*/React__default$1["default"].createElement(PaymentProvider, {
|
|
3756
4045
|
container: container,
|
|
3757
4046
|
document: document
|
|
3758
4047
|
}, /*#__PURE__*/React__default$1["default"].createElement(PaymentValueProvider, null, /*#__PURE__*/React__default$1["default"].createElement(PaymentStack, {
|
|
3759
4048
|
document: document,
|
|
3760
4049
|
container: container
|
|
3761
|
-
})))))))))));
|
|
4050
|
+
}), /*#__PURE__*/React__default$1["default"].createElement(PoweredBy, null))))))))))));
|
|
3762
4051
|
};
|
|
3763
4052
|
});
|
|
3764
4053
|
return _context2.abrupt("return", {
|
|
@@ -3868,9 +4157,9 @@
|
|
|
3868
4157
|
var SaleOverviewSkeleton = (function (props) {
|
|
3869
4158
|
return /*#__PURE__*/React__default$1["default"].createElement(Dialog$1, {
|
|
3870
4159
|
header: /*#__PURE__*/React__default$1["default"].createElement("div", {
|
|
3871
|
-
className: "PaddingTopS PaddingLeftM PaddingRightM"
|
|
4160
|
+
className: "PaddingTopS PaddingLeftM PaddingRightM TextLeft"
|
|
3872
4161
|
}, /*#__PURE__*/React__default$1["default"].createElement("h1", {
|
|
3873
|
-
className: "LineHeightL FontSizeL
|
|
4162
|
+
className: "LineHeightL FontSizeL"
|
|
3874
4163
|
}, "Purchase")),
|
|
3875
4164
|
body: /*#__PURE__*/React__default$1["default"].createElement("div", {
|
|
3876
4165
|
className: "PaddingTopS PaddingLeftM PaddingRightM PaddingBottomXS"
|
|
@@ -3887,7 +4176,7 @@
|
|
|
3887
4176
|
className: "SkeletonBackground"
|
|
3888
4177
|
}))),
|
|
3889
4178
|
footer: /*#__PURE__*/React__default$1["default"].createElement("div", {
|
|
3890
|
-
className: "PaddingTopXS PaddingRightM PaddingLeftM"
|
|
4179
|
+
className: "PaddingTopXS PaddingRightM PaddingLeftM PaddingBottomM"
|
|
3891
4180
|
}, /*#__PURE__*/React__default$1["default"].createElement("div", {
|
|
3892
4181
|
className: "SkeletonWrapper"
|
|
3893
4182
|
}, /*#__PURE__*/React__default$1["default"].createElement("div", {
|
|
@@ -3899,101 +4188,34 @@
|
|
|
3899
4188
|
});
|
|
3900
4189
|
|
|
3901
4190
|
var SaleOverviewDialog = (function (props) {
|
|
3902
|
-
var _useContext = React.useContext(ChangableAmountContext)
|
|
3903
|
-
|
|
4191
|
+
var _useContext = React.useContext(ChangableAmountContext);
|
|
4192
|
+
_useContext.amount;
|
|
3904
4193
|
|
|
3905
4194
|
var _useContext2 = React.useContext(ConfigurationContext),
|
|
3906
|
-
|
|
4195
|
+
tokenImage = _useContext2.tokenImage;
|
|
3907
4196
|
|
|
3908
4197
|
var _useContext3 = React.useContext(PaymentValueContext),
|
|
3909
4198
|
paymentValue = _useContext3.paymentValue;
|
|
3910
4199
|
|
|
3911
4200
|
var _useContext4 = React.useContext(PaymentContext),
|
|
3912
4201
|
payment = _useContext4.payment,
|
|
3913
|
-
paymentState = _useContext4.paymentState
|
|
3914
|
-
pay = _useContext4.pay,
|
|
3915
|
-
transaction = _useContext4.transaction,
|
|
3916
|
-
approve = _useContext4.approve,
|
|
3917
|
-
approvalTransaction = _useContext4.approvalTransaction;
|
|
4202
|
+
paymentState = _useContext4.paymentState;
|
|
3918
4203
|
|
|
3919
|
-
var _useContext5 = React.useContext(
|
|
4204
|
+
var _useContext5 = React.useContext(reactDialogStack.NavigateStackContext),
|
|
3920
4205
|
navigate = _useContext5.navigate;
|
|
3921
4206
|
|
|
3922
|
-
var _useContext6 = React.useContext(
|
|
3923
|
-
|
|
3924
|
-
|
|
3925
|
-
var _useContext7 = React.useContext(ToTokenContext),
|
|
3926
|
-
toToken = _useContext7.toToken,
|
|
3927
|
-
toTokenReadableAmount = _useContext7.toTokenReadableAmount;
|
|
4207
|
+
var _useContext6 = React.useContext(ToTokenContext),
|
|
4208
|
+
toToken = _useContext6.toToken,
|
|
4209
|
+
toTokenReadableAmount = _useContext6.toTokenReadableAmount;
|
|
3928
4210
|
|
|
3929
4211
|
var _useState = React.useState(),
|
|
3930
4212
|
_useState2 = _slicedToArray(_useState, 2),
|
|
3931
4213
|
salePerTokenValue = _useState2[0],
|
|
3932
4214
|
setSalePerTokenValue = _useState2[1];
|
|
3933
4215
|
|
|
3934
|
-
var mainAction = function mainAction() {
|
|
3935
|
-
if (paymentState == 'initialized' || paymentState == 'approving') {
|
|
3936
|
-
return /*#__PURE__*/React__default$1["default"].createElement("button", {
|
|
3937
|
-
className: ["ButtonPrimary", payment.route.approvalRequired && !payment.route.directTransfer ? 'disabled' : ''].join(' '),
|
|
3938
|
-
onClick: function onClick() {
|
|
3939
|
-
if (payment.route.approvalRequired && !payment.route.directTransfer) {
|
|
3940
|
-
return;
|
|
3941
|
-
}
|
|
3942
|
-
|
|
3943
|
-
pay({
|
|
3944
|
-
navigate: navigate
|
|
3945
|
-
});
|
|
3946
|
-
}
|
|
3947
|
-
}, "Pay ", new depayLocalCurrency.Currency({
|
|
3948
|
-
amount: amount.toFixed(2),
|
|
3949
|
-
code: currencyCode
|
|
3950
|
-
}).toString());
|
|
3951
|
-
} else if (paymentState == 'paying') {
|
|
3952
|
-
return /*#__PURE__*/React__default$1["default"].createElement("a", {
|
|
3953
|
-
className: "ButtonPrimary",
|
|
3954
|
-
title: "Performing the payment - please wait",
|
|
3955
|
-
href: transaction === null || transaction === void 0 ? void 0 : transaction.url,
|
|
3956
|
-
target: "_blank",
|
|
3957
|
-
rel: "noopener noreferrer"
|
|
3958
|
-
}, /*#__PURE__*/React__default$1["default"].createElement(LoadingText, null, "Paying"));
|
|
3959
|
-
} else if (paymentState == 'confirmed') {
|
|
3960
|
-
return /*#__PURE__*/React__default$1["default"].createElement("button", {
|
|
3961
|
-
className: "ButtonPrimary round",
|
|
3962
|
-
title: "Done",
|
|
3963
|
-
onClick: close
|
|
3964
|
-
}, /*#__PURE__*/React__default$1["default"].createElement(Checkmark, null));
|
|
3965
|
-
}
|
|
3966
|
-
};
|
|
3967
|
-
|
|
3968
|
-
var approvalAction = function approvalAction() {
|
|
3969
|
-
if (paymentState == 'initialized') {
|
|
3970
|
-
return /*#__PURE__*/React__default$1["default"].createElement("div", {
|
|
3971
|
-
className: "PaddingBottomS"
|
|
3972
|
-
}, /*#__PURE__*/React__default$1["default"].createElement("button", {
|
|
3973
|
-
className: "ButtonPrimary wide",
|
|
3974
|
-
onClick: approve,
|
|
3975
|
-
title: "Allow ".concat(payment.symbol, " to be used as payment")
|
|
3976
|
-
}, "Allow ", payment.symbol, " to be used as payment"));
|
|
3977
|
-
} else if (paymentState == 'approving') {
|
|
3978
|
-
return /*#__PURE__*/React__default$1["default"].createElement("div", {
|
|
3979
|
-
className: "PaddingBottomS"
|
|
3980
|
-
}, /*#__PURE__*/React__default$1["default"].createElement("a", {
|
|
3981
|
-
className: "ButtonPrimary wide",
|
|
3982
|
-
title: "Approving payment token - please wait",
|
|
3983
|
-
href: approvalTransaction === null || approvalTransaction === void 0 ? void 0 : approvalTransaction.url,
|
|
3984
|
-
target: "_blank",
|
|
3985
|
-
rel: "noopener noreferrer"
|
|
3986
|
-
}, /*#__PURE__*/React__default$1["default"].createElement(LoadingText, null, "Approving")));
|
|
3987
|
-
}
|
|
3988
|
-
};
|
|
3989
|
-
|
|
3990
|
-
var actions = function actions() {
|
|
3991
|
-
return /*#__PURE__*/React__default$1["default"].createElement("div", null, payment.route.approvalRequired && !payment.route.directTransfer && approvalAction(), mainAction());
|
|
3992
|
-
};
|
|
3993
|
-
|
|
3994
4216
|
React.useEffect(function () {
|
|
3995
4217
|
if (paymentValue) {
|
|
3996
|
-
setSalePerTokenValue(new
|
|
4218
|
+
setSalePerTokenValue(new localCurrency.Currency({
|
|
3997
4219
|
amount: (paymentValue.amount / parseFloat(toTokenReadableAmount)).toFixed(2),
|
|
3998
4220
|
code: paymentValue.code
|
|
3999
4221
|
}).toString());
|
|
@@ -4004,11 +4226,24 @@
|
|
|
4004
4226
|
return /*#__PURE__*/React__default$1["default"].createElement(SaleOverviewSkeleton, null);
|
|
4005
4227
|
}
|
|
4006
4228
|
|
|
4229
|
+
var tokenImageElement;
|
|
4230
|
+
|
|
4231
|
+
if (tokenImage) {
|
|
4232
|
+
tokenImageElement = /*#__PURE__*/React__default$1["default"].createElement("img", {
|
|
4233
|
+
src: tokenImage
|
|
4234
|
+
});
|
|
4235
|
+
} else {
|
|
4236
|
+
tokenImageElement = /*#__PURE__*/React__default$1["default"].createElement(reactTokenImage.TokenImage, {
|
|
4237
|
+
blockchain: payment.route.blockchain,
|
|
4238
|
+
address: toToken.address
|
|
4239
|
+
});
|
|
4240
|
+
}
|
|
4241
|
+
|
|
4007
4242
|
return /*#__PURE__*/React__default$1["default"].createElement(Dialog$1, {
|
|
4008
4243
|
header: /*#__PURE__*/React__default$1["default"].createElement("div", {
|
|
4009
|
-
className: "PaddingTopS PaddingLeftM PaddingRightM"
|
|
4244
|
+
className: "PaddingTopS PaddingLeftM PaddingRightM TextLeft"
|
|
4010
4245
|
}, /*#__PURE__*/React__default$1["default"].createElement("h1", {
|
|
4011
|
-
className: "LineHeightL FontSizeL
|
|
4246
|
+
className: "LineHeightL FontSizeL"
|
|
4012
4247
|
}, "Purchase")),
|
|
4013
4248
|
body: /*#__PURE__*/React__default$1["default"].createElement("div", {
|
|
4014
4249
|
className: "PaddingTopS PaddingLeftM PaddingRightM PaddingBottomXS"
|
|
@@ -4025,10 +4260,7 @@
|
|
|
4025
4260
|
}, /*#__PURE__*/React__default$1["default"].createElement("div", {
|
|
4026
4261
|
className: "CardImage",
|
|
4027
4262
|
title: payment.name
|
|
4028
|
-
}, /*#__PURE__*/React__default$1["default"].createElement(
|
|
4029
|
-
blockchain: payment.route.blockchain,
|
|
4030
|
-
address: toToken.address
|
|
4031
|
-
})), /*#__PURE__*/React__default$1["default"].createElement("div", {
|
|
4263
|
+
}, tokenImageElement), /*#__PURE__*/React__default$1["default"].createElement("div", {
|
|
4032
4264
|
className: "CardBody"
|
|
4033
4265
|
}, /*#__PURE__*/React__default$1["default"].createElement("div", {
|
|
4034
4266
|
className: "CardBodyWrapper"
|
|
@@ -4059,7 +4291,7 @@
|
|
|
4059
4291
|
}, /*#__PURE__*/React__default$1["default"].createElement("div", {
|
|
4060
4292
|
className: "CardImage",
|
|
4061
4293
|
title: payment.name
|
|
4062
|
-
}, /*#__PURE__*/React__default$1["default"].createElement(
|
|
4294
|
+
}, /*#__PURE__*/React__default$1["default"].createElement(reactTokenImage.TokenImage, {
|
|
4063
4295
|
blockchain: payment.route.blockchain,
|
|
4064
4296
|
address: payment.token
|
|
4065
4297
|
})), /*#__PURE__*/React__default$1["default"].createElement("div", {
|
|
@@ -4080,8 +4312,8 @@
|
|
|
4080
4312
|
className: "CardAction"
|
|
4081
4313
|
}, /*#__PURE__*/React__default$1["default"].createElement(ChevronRight, null)))),
|
|
4082
4314
|
footer: /*#__PURE__*/React__default$1["default"].createElement("div", {
|
|
4083
|
-
className: "PaddingTopXS PaddingRightM PaddingLeftM"
|
|
4084
|
-
},
|
|
4315
|
+
className: "PaddingTopXS PaddingRightM PaddingLeftM PaddingBottomM"
|
|
4316
|
+
}, /*#__PURE__*/React__default$1["default"].createElement(Footer, null))
|
|
4085
4317
|
});
|
|
4086
4318
|
});
|
|
4087
4319
|
|
|
@@ -4090,7 +4322,7 @@
|
|
|
4090
4322
|
open = _useContext.open,
|
|
4091
4323
|
close = _useContext.close;
|
|
4092
4324
|
|
|
4093
|
-
return /*#__PURE__*/React__default$1["default"].createElement(
|
|
4325
|
+
return /*#__PURE__*/React__default$1["default"].createElement(reactDialogStack.ReactDialogStack, {
|
|
4094
4326
|
open: open,
|
|
4095
4327
|
close: close,
|
|
4096
4328
|
start: "SaleOverview",
|
|
@@ -4154,12 +4386,12 @@
|
|
|
4154
4386
|
|
|
4155
4387
|
var Sale = /*#__PURE__*/function () {
|
|
4156
4388
|
var _ref4 = _asyncToGenerator( /*#__PURE__*/regenerator.mark(function _callee2(_ref3) {
|
|
4157
|
-
var amount, sell, sent, confirmed,
|
|
4389
|
+
var amount, sell, sent, confirmed, failed, error, critical, style, blacklist, providers, currency, connected, closed, tokenImage, document, accept, unmount;
|
|
4158
4390
|
return regenerator.wrap(function _callee2$(_context2) {
|
|
4159
4391
|
while (1) {
|
|
4160
4392
|
switch (_context2.prev = _context2.next) {
|
|
4161
4393
|
case 0:
|
|
4162
|
-
amount = _ref3.amount, sell = _ref3.sell, sent = _ref3.sent, confirmed = _ref3.confirmed,
|
|
4394
|
+
amount = _ref3.amount, sell = _ref3.sell, sent = _ref3.sent, confirmed = _ref3.confirmed, failed = _ref3.failed, error = _ref3.error, critical = _ref3.critical, style = _ref3.style, blacklist = _ref3.blacklist, providers = _ref3.providers, currency = _ref3.currency, connected = _ref3.connected, closed = _ref3.closed, tokenImage = _ref3.tokenImage, document = _ref3.document;
|
|
4163
4395
|
_context2.prev = 1;
|
|
4164
4396
|
_context2.next = 4;
|
|
4165
4397
|
return preflight({
|
|
@@ -4185,31 +4417,33 @@
|
|
|
4185
4417
|
unmount: unmount
|
|
4186
4418
|
}, /*#__PURE__*/React__default$1["default"].createElement(ConfigurationProvider, {
|
|
4187
4419
|
configuration: {
|
|
4420
|
+
tokenImage: tokenImage,
|
|
4188
4421
|
amount: amount,
|
|
4189
4422
|
sell: sell,
|
|
4190
4423
|
currency: currency,
|
|
4191
4424
|
sent: sent,
|
|
4192
4425
|
confirmed: confirmed,
|
|
4193
|
-
ensured: ensured,
|
|
4194
4426
|
failed: failed,
|
|
4195
4427
|
blacklist: blacklist,
|
|
4196
4428
|
providers: providers
|
|
4197
4429
|
}
|
|
4198
|
-
}, /*#__PURE__*/React__default$1["default"].createElement(ClosableProvider, {
|
|
4430
|
+
}, /*#__PURE__*/React__default$1["default"].createElement(UpdatableProvider, null, /*#__PURE__*/React__default$1["default"].createElement(ClosableProvider, {
|
|
4199
4431
|
unmount: unmount
|
|
4200
|
-
}, /*#__PURE__*/React__default$1["default"].createElement(
|
|
4432
|
+
}, /*#__PURE__*/React__default$1["default"].createElement(WalletProvider, {
|
|
4201
4433
|
container: container,
|
|
4202
4434
|
connected: connected,
|
|
4203
4435
|
unmount: unmount
|
|
4204
4436
|
}, /*#__PURE__*/React__default$1["default"].createElement(ConversionRateProvider, null, /*#__PURE__*/React__default$1["default"].createElement(ChangableAmountProvider, {
|
|
4205
4437
|
accept: accept
|
|
4438
|
+
}, /*#__PURE__*/React__default$1["default"].createElement(TrackingProvider, {
|
|
4439
|
+
document: ensureDocument(document)
|
|
4206
4440
|
}, /*#__PURE__*/React__default$1["default"].createElement(SaleRoutingProvider, {
|
|
4207
4441
|
container: container,
|
|
4208
4442
|
document: document
|
|
4209
4443
|
}, /*#__PURE__*/React__default$1["default"].createElement(SaleStack, {
|
|
4210
4444
|
document: document,
|
|
4211
4445
|
container: container
|
|
4212
|
-
})))))))));
|
|
4446
|
+
}), /*#__PURE__*/React__default$1["default"].createElement(PoweredBy, null))))))))));
|
|
4213
4447
|
};
|
|
4214
4448
|
});
|
|
4215
4449
|
return _context2.abrupt("return", {
|
|
@@ -4243,7 +4477,7 @@
|
|
|
4243
4477
|
Payment: Payment,
|
|
4244
4478
|
Sale: Sale,
|
|
4245
4479
|
Donation: Donation,
|
|
4246
|
-
provider:
|
|
4480
|
+
provider: web3Client.provider
|
|
4247
4481
|
};
|
|
4248
4482
|
|
|
4249
4483
|
return DePayWidgets;
|