@depay/widgets 4.2.1 → 4.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +15 -1
- package/dist/cjs/index.bundle.js +6789 -2975
- package/dist/cjs/index.js +92 -82
- package/dist/es/index.bundle.js +6789 -2975
- package/dist/es/index.js +43 -33
- package/dist/umd/index.bundle.js +6789 -2975
- package/dist/umd/index.js +84 -74
- package/package.json +14 -14
package/dist/es/index.js
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
import React, { useState, useContext, useEffect } from 'react';
|
|
2
|
-
import { NavigateStackContext, ReactDialogStack } from 'depay
|
|
3
|
-
import { getWallet, wallets } from 'depay
|
|
2
|
+
import { NavigateStackContext, ReactDialogStack } from '@depay/react-dialog-stack';
|
|
3
|
+
import { getWallet, wallets } from '@depay/web3-wallets';
|
|
4
4
|
import ReactDOM from 'react-dom';
|
|
5
|
-
import { ReactShadowDOM } from 'depay
|
|
5
|
+
import { ReactShadowDOM } from '@depay/react-shadow-dom';
|
|
6
6
|
import { ethers } from 'ethers';
|
|
7
|
-
import { CONSTANTS } from 'depay
|
|
7
|
+
import { CONSTANTS } from '@depay/web3-constants';
|
|
8
8
|
import { Decimal } from 'decimal.js';
|
|
9
|
-
import { route } from 'depay
|
|
10
|
-
import { Token } from 'depay
|
|
11
|
-
import { Currency } from 'depay
|
|
12
|
-
import {
|
|
13
|
-
import { route as route$1 } from 'depay
|
|
9
|
+
import { route } from '@depay/web3-exchanges';
|
|
10
|
+
import { Token } from '@depay/web3-tokens';
|
|
11
|
+
import { Currency } from '@depay/local-currency';
|
|
12
|
+
import { setProviderEndpoints, provider } from '@depay/web3-client';
|
|
13
|
+
import { route as route$1 } from '@depay/web3-payments';
|
|
14
14
|
import Slider from 'react-rangeslider';
|
|
15
|
-
import { TokenImage } from 'depay
|
|
16
|
-
import { Blockchain } from 'depay
|
|
15
|
+
import { TokenImage } from '@depay/react-token-image';
|
|
16
|
+
import { Blockchain } from '@depay/web3-blockchains';
|
|
17
17
|
|
|
18
18
|
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
19
19
|
try {
|
|
@@ -1377,8 +1377,7 @@ function ReactDialogStyle (styles) {
|
|
|
1377
1377
|
let background =
|
|
1378
1378
|
typeof styles === 'object' && styles.background ? styles.background : 'rgba(0,0,0,0.4)';
|
|
1379
1379
|
|
|
1380
|
-
return
|
|
1381
|
-
`
|
|
1380
|
+
return `
|
|
1382
1381
|
.ReactDialog {
|
|
1383
1382
|
bottom: 0;
|
|
1384
1383
|
display: table;
|
|
@@ -1437,12 +1436,9 @@ function ReactDialogStyle (styles) {
|
|
|
1437
1436
|
top: -5vh;
|
|
1438
1437
|
}
|
|
1439
1438
|
`
|
|
1440
|
-
)
|
|
1441
1439
|
}
|
|
1442
1440
|
|
|
1443
|
-
const _jsxFileName = "/
|
|
1444
|
-
|
|
1445
|
-
|
|
1441
|
+
const _jsxFileName = "/home/runner/work/react-dialog/react-dialog/src/components/Dialog.jsx";
|
|
1446
1442
|
class Dialog extends React__default['default'].Component {
|
|
1447
1443
|
constructor(props) {
|
|
1448
1444
|
super(props);
|
|
@@ -1504,7 +1500,7 @@ class Dialog extends React__default['default'].Component {
|
|
|
1504
1500
|
}
|
|
1505
1501
|
}
|
|
1506
1502
|
|
|
1507
|
-
const _jsxFileName$1 = "/
|
|
1503
|
+
const _jsxFileName$1 = "/home/runner/work/react-dialog/react-dialog/src/index.jsx";
|
|
1508
1504
|
class ReactDialog extends React__default['default'].Component {
|
|
1509
1505
|
constructor(props) {
|
|
1510
1506
|
super(props);
|
|
@@ -1668,7 +1664,7 @@ var CardStyle = (function (style) {
|
|
|
1668
1664
|
});
|
|
1669
1665
|
|
|
1670
1666
|
var DialogStyle = (function (style) {
|
|
1671
|
-
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 .FooterLink {\n bottom: 0;\n left: 0;\n position: absolute;\n padding-bottom: 1rem;\n right: 0;\n width: 100%;\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
|
+
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 .FooterLink {\n bottom: 0;\n left: 0;\n position: absolute;\n padding-bottom: 1rem;\n right: 0;\n width: 100%;\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 ";
|
|
1672
1668
|
});
|
|
1673
1669
|
|
|
1674
1670
|
var FontStyle = (function (style) {
|
|
@@ -2024,12 +2020,18 @@ var ChangableAmountProvider = (function (props) {
|
|
|
2024
2020
|
});
|
|
2025
2021
|
})).then(function (amounts) {
|
|
2026
2022
|
setAcceptWithAmount(props.accept.map(function (configuration, index) {
|
|
2023
|
+
if (amounts[index] == undefined) {
|
|
2024
|
+
return;
|
|
2025
|
+
}
|
|
2026
|
+
|
|
2027
2027
|
return {
|
|
2028
2028
|
blockchain: configuration.blockchain,
|
|
2029
|
-
amount: round(amounts[index])
|
|
2029
|
+
amount: round(amounts[index]),
|
|
2030
2030
|
token: configuration.token,
|
|
2031
2031
|
receiver: configuration.receiver || account
|
|
2032
2032
|
};
|
|
2033
|
+
}).filter(function (configuration) {
|
|
2034
|
+
return !!configuration;
|
|
2033
2035
|
}));
|
|
2034
2036
|
})["catch"](setError);
|
|
2035
2037
|
})["catch"](setError);
|
|
@@ -2086,7 +2088,7 @@ var ConfigurationProvider = (function (props) {
|
|
|
2086
2088
|
useEffect(function () {
|
|
2087
2089
|
if (props.configuration.providers != undefined) {
|
|
2088
2090
|
Object.entries(props.configuration.providers).forEach(function (entry) {
|
|
2089
|
-
|
|
2091
|
+
setProviderEndpoints(entry[0], entry[1]);
|
|
2090
2092
|
});
|
|
2091
2093
|
}
|
|
2092
2094
|
}, [props.configuration]);
|
|
@@ -2878,11 +2880,7 @@ var ChangePaymentDialog = (function (props) {
|
|
|
2878
2880
|
className: "TokenAmountCell"
|
|
2879
2881
|
}, format(payment.amount)))), /*#__PURE__*/React.createElement("h3", {
|
|
2880
2882
|
className: "CardText"
|
|
2881
|
-
}, /*#__PURE__*/React.createElement("small", null, format(round(parseFloat(payment.route.fromBalance.toString()) / Math.pow(10, payment.decimals), 'down'))))))
|
|
2882
|
-
className: "CardInfo"
|
|
2883
|
-
}, payment.route.approvalRequired && /*#__PURE__*/React.createElement("span", {
|
|
2884
|
-
className: "Label"
|
|
2885
|
-
}, "Requires Approval")));
|
|
2883
|
+
}, /*#__PURE__*/React.createElement("small", null, format(round(parseFloat(payment.route.fromBalance.toString()) / Math.pow(10, payment.decimals), 'down')))))));
|
|
2886
2884
|
}));
|
|
2887
2885
|
}, [allPaymentRoutesWithData]);
|
|
2888
2886
|
|
|
@@ -3908,7 +3906,8 @@ var SaleOverviewDialog = (function (props) {
|
|
|
3908
3906
|
amount = _useContext.amount;
|
|
3909
3907
|
|
|
3910
3908
|
var _useContext2 = useContext(ConfigurationContext),
|
|
3911
|
-
currencyCode = _useContext2.currencyCode
|
|
3909
|
+
currencyCode = _useContext2.currencyCode,
|
|
3910
|
+
tokenImage = _useContext2.tokenImage;
|
|
3912
3911
|
|
|
3913
3912
|
var _useContext3 = useContext(PaymentValueContext),
|
|
3914
3913
|
paymentValue = _useContext3.paymentValue;
|
|
@@ -4009,6 +4008,19 @@ var SaleOverviewDialog = (function (props) {
|
|
|
4009
4008
|
return /*#__PURE__*/React.createElement(SaleOverviewSkeleton, null);
|
|
4010
4009
|
}
|
|
4011
4010
|
|
|
4011
|
+
var tokenImageElement;
|
|
4012
|
+
|
|
4013
|
+
if (tokenImage) {
|
|
4014
|
+
tokenImageElement = /*#__PURE__*/React.createElement("img", {
|
|
4015
|
+
src: tokenImage
|
|
4016
|
+
});
|
|
4017
|
+
} else {
|
|
4018
|
+
tokenImageElement = /*#__PURE__*/React.createElement(TokenImage, {
|
|
4019
|
+
blockchain: payment.route.blockchain,
|
|
4020
|
+
address: toToken.address
|
|
4021
|
+
});
|
|
4022
|
+
}
|
|
4023
|
+
|
|
4012
4024
|
return /*#__PURE__*/React.createElement(Dialog$1, {
|
|
4013
4025
|
header: /*#__PURE__*/React.createElement("div", {
|
|
4014
4026
|
className: "PaddingTopS PaddingLeftM PaddingRightM"
|
|
@@ -4030,10 +4042,7 @@ var SaleOverviewDialog = (function (props) {
|
|
|
4030
4042
|
}, /*#__PURE__*/React.createElement("div", {
|
|
4031
4043
|
className: "CardImage",
|
|
4032
4044
|
title: payment.name
|
|
4033
|
-
}, /*#__PURE__*/React.createElement(
|
|
4034
|
-
blockchain: payment.route.blockchain,
|
|
4035
|
-
address: toToken.address
|
|
4036
|
-
})), /*#__PURE__*/React.createElement("div", {
|
|
4045
|
+
}, tokenImageElement), /*#__PURE__*/React.createElement("div", {
|
|
4037
4046
|
className: "CardBody"
|
|
4038
4047
|
}, /*#__PURE__*/React.createElement("div", {
|
|
4039
4048
|
className: "CardBodyWrapper"
|
|
@@ -4159,12 +4168,12 @@ var preflight = /*#__PURE__*/function () {
|
|
|
4159
4168
|
|
|
4160
4169
|
var Sale = /*#__PURE__*/function () {
|
|
4161
4170
|
var _ref4 = _asyncToGenerator( /*#__PURE__*/regenerator.mark(function _callee2(_ref3) {
|
|
4162
|
-
var amount, sell, sent, confirmed, ensured, failed, error, critical, style, blacklist, providers, currency, connected, closed, document, accept, unmount;
|
|
4171
|
+
var amount, sell, sent, confirmed, ensured, failed, error, critical, style, blacklist, providers, currency, connected, closed, tokenImage, document, accept, unmount;
|
|
4163
4172
|
return regenerator.wrap(function _callee2$(_context2) {
|
|
4164
4173
|
while (1) {
|
|
4165
4174
|
switch (_context2.prev = _context2.next) {
|
|
4166
4175
|
case 0:
|
|
4167
|
-
amount = _ref3.amount, sell = _ref3.sell, sent = _ref3.sent, confirmed = _ref3.confirmed, ensured = _ref3.ensured, 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;
|
|
4176
|
+
amount = _ref3.amount, sell = _ref3.sell, sent = _ref3.sent, confirmed = _ref3.confirmed, ensured = _ref3.ensured, 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;
|
|
4168
4177
|
_context2.prev = 1;
|
|
4169
4178
|
_context2.next = 4;
|
|
4170
4179
|
return preflight({
|
|
@@ -4190,6 +4199,7 @@ var Sale = /*#__PURE__*/function () {
|
|
|
4190
4199
|
unmount: unmount
|
|
4191
4200
|
}, /*#__PURE__*/React.createElement(ConfigurationProvider, {
|
|
4192
4201
|
configuration: {
|
|
4202
|
+
tokenImage: tokenImage,
|
|
4193
4203
|
amount: amount,
|
|
4194
4204
|
sell: sell,
|
|
4195
4205
|
currency: currency,
|