@depay/widgets 6.30.2 → 7.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/dist/esm/index.js CHANGED
@@ -12,7 +12,6 @@ import { Currency } from '@depay/local-currency';
12
12
  import { setProviderEndpoints, request, provider } from '@depay/web3-client';
13
13
  import { Blockchain } from '@depay/web3-blockchains';
14
14
  import { route as route$1 } from '@depay/web3-payments';
15
- import Slider from 'react-rangeslider';
16
15
  import { TokenImage } from '@depay/react-token-image';
17
16
 
18
17
  function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
@@ -82,7 +81,7 @@ function _typeof(obj) {
82
81
  module.exports = _typeof, module.exports.__esModule = true, module.exports["default"] = module.exports;
83
82
  });
84
83
 
85
- var regeneratorRuntime = createCommonjsModule(function (module) {
84
+ var regeneratorRuntime$1 = createCommonjsModule(function (module) {
86
85
  var _typeof = _typeof_1["default"];
87
86
 
88
87
  function _regeneratorRuntime() {
@@ -438,7 +437,21 @@ function _regeneratorRuntime() {
438
437
  module.exports = _regeneratorRuntime, module.exports.__esModule = true, module.exports["default"] = module.exports;
439
438
  });
440
439
 
441
- var regenerator = regeneratorRuntime();
440
+ // TODO(Babel 8): Remove this file.
441
+
442
+ var runtime = regeneratorRuntime$1();
443
+ var regenerator = runtime;
444
+
445
+ // Copied from https://github.com/facebook/regenerator/blob/main/packages/runtime/runtime.js#L736=
446
+ try {
447
+ regeneratorRuntime = runtime;
448
+ } catch (accidentalStrictMode) {
449
+ if (typeof globalThis === "object") {
450
+ globalThis.regeneratorRuntime = runtime;
451
+ } else {
452
+ Function("r", "regeneratorRuntime = r")(runtime);
453
+ }
454
+ }
442
455
 
443
456
  function _arrayWithHoles(arr) {
444
457
  if (Array.isArray(arr)) return arr;
@@ -713,34 +726,36 @@ var SelectWalletDialog = (function (props) {
713
726
  navigate = _useContext.navigate;
714
727
 
715
728
  var wallet = getWallet();
716
- useEffect( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/regenerator.mark(function _callee() {
717
- var accounts;
718
- return regenerator.wrap(function _callee$(_context) {
719
- while (1) {
720
- switch (_context.prev = _context.next) {
721
- case 0:
722
- if (!wallet) {
723
- _context.next = 5;
724
- break;
725
- }
729
+ useEffect(function () {
730
+ _asyncToGenerator( /*#__PURE__*/regenerator.mark(function _callee() {
731
+ var accounts;
732
+ return regenerator.wrap(function _callee$(_context) {
733
+ while (1) {
734
+ switch (_context.prev = _context.next) {
735
+ case 0:
736
+ if (!wallet) {
737
+ _context.next = 5;
738
+ break;
739
+ }
726
740
 
727
- _context.next = 3;
728
- return wallet.accounts();
741
+ _context.next = 3;
742
+ return wallet.accounts();
729
743
 
730
- case 3:
731
- accounts = _context.sent;
744
+ case 3:
745
+ accounts = _context.sent;
732
746
 
733
- if (accounts == undefined || accounts.length == 0) {
734
- navigate('ConnectingWallet');
735
- }
747
+ if (accounts == undefined || accounts.length == 0) {
748
+ navigate('ConnectingWallet');
749
+ }
736
750
 
737
- case 5:
738
- case "end":
739
- return _context.stop();
751
+ case 5:
752
+ case "end":
753
+ return _context.stop();
754
+ }
740
755
  }
741
- }
742
- }, _callee);
743
- })), [wallet]);
756
+ }, _callee);
757
+ }))();
758
+ }, [wallet]);
744
759
 
745
760
  var connect = function connect(walletClass) {
746
761
  var wallet = new walletClass();
@@ -874,40 +889,42 @@ var ConnectStack = (function (props) {
874
889
  setWallet(wallet);
875
890
  }
876
891
  }, []);
877
- useEffect( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/regenerator.mark(function _callee2() {
878
- var accounts;
879
- return regenerator.wrap(function _callee2$(_context2) {
880
- while (1) {
881
- switch (_context2.prev = _context2.next) {
882
- case 0:
883
- if (!wallet) {
884
- _context2.next = 5;
885
- break;
886
- }
892
+ useEffect(function () {
893
+ _asyncToGenerator( /*#__PURE__*/regenerator.mark(function _callee2() {
894
+ var accounts;
895
+ return regenerator.wrap(function _callee2$(_context2) {
896
+ while (1) {
897
+ switch (_context2.prev = _context2.next) {
898
+ case 0:
899
+ if (!wallet) {
900
+ _context2.next = 5;
901
+ break;
902
+ }
887
903
 
888
- _context2.next = 3;
889
- return wallet.accounts();
904
+ _context2.next = 3;
905
+ return wallet.accounts();
890
906
 
891
- case 3:
892
- accounts = _context2.sent;
907
+ case 3:
908
+ accounts = _context2.sent;
893
909
 
894
- if (accounts instanceof Array && accounts.length > 0) {
895
- if (props.resolve) props.resolve({
896
- wallet: wallet,
897
- account: accounts[0],
898
- accounts: accounts
899
- });
900
- } else {
901
- connect(wallet);
902
- }
910
+ if (accounts instanceof Array && accounts.length > 0) {
911
+ if (props.resolve) props.resolve({
912
+ wallet: wallet,
913
+ account: accounts[0],
914
+ accounts: accounts
915
+ });
916
+ } else {
917
+ connect(wallet);
918
+ }
903
919
 
904
- case 5:
905
- case "end":
906
- return _context2.stop();
920
+ case 5:
921
+ case "end":
922
+ return _context2.stop();
923
+ }
907
924
  }
908
- }
909
- }, _callee2);
910
- })), [wallet]);
925
+ }, _callee2);
926
+ }))();
927
+ }, [wallet]);
911
928
  return /*#__PURE__*/React.createElement(ReactDialogStack, {
912
929
  open: open,
913
930
  close: close,
@@ -962,11 +979,10 @@ function _createClass(Constructor, protoProps, staticProps) {
962
979
  }
963
980
 
964
981
  function _setPrototypeOf(o, p) {
965
- _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
982
+ _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) {
966
983
  o.__proto__ = p;
967
984
  return o;
968
985
  };
969
-
970
986
  return _setPrototypeOf(o, p);
971
987
  }
972
988
 
@@ -1007,7 +1023,7 @@ function _possibleConstructorReturn(self, call) {
1007
1023
  }
1008
1024
 
1009
1025
  function _getPrototypeOf(o) {
1010
- _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
1026
+ _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) {
1011
1027
  return o.__proto__ || Object.getPrototypeOf(o);
1012
1028
  };
1013
1029
  return _getPrototypeOf(o);
@@ -1078,7 +1094,7 @@ function ReactDialogStyle (styles) {
1078
1094
  `
1079
1095
  }
1080
1096
 
1081
- const _jsxFileName = "/home/runner/work/react-dialog/react-dialog/src/components/Dialog.jsx";
1097
+ const _jsxFileName$1 = "/home/runner/work/react-dialog/react-dialog/src/components/Dialog.jsx";
1082
1098
  class Dialog extends React.Component {
1083
1099
  constructor(props) {
1084
1100
  super(props);
@@ -1129,10 +1145,10 @@ class Dialog extends React.Component {
1129
1145
  const classNames = ['ReactDialog', this.state.open ? 'ReactDialogOpen' : ''];
1130
1146
  const style = ReactDialogStyle({ background: this.props.background });
1131
1147
  return (
1132
- React.createElement('div', { className: classNames.join(' '), __self: this, __source: {fileName: _jsxFileName, lineNumber: 56}}
1133
- , React.createElement('style', {__self: this, __source: {fileName: _jsxFileName, lineNumber: 57}}, style)
1134
- , React.createElement('div', { className: "ReactDialogInner", __self: this, __source: {fileName: _jsxFileName, lineNumber: 58}}
1135
- , React.createElement('div', { className: "ReactDialogBackground", onClick: this.onClickBackground.bind(this), __self: this, __source: {fileName: _jsxFileName, lineNumber: 59}} )
1148
+ React.createElement('div', { className: classNames.join(' '), __self: this, __source: {fileName: _jsxFileName$1, lineNumber: 55}}
1149
+ , React.createElement('style', {__self: this, __source: {fileName: _jsxFileName$1, lineNumber: 56}}, style)
1150
+ , React.createElement('div', { className: "ReactDialogInner", __self: this, __source: {fileName: _jsxFileName$1, lineNumber: 57}}
1151
+ , React.createElement('div', { className: "ReactDialogBackground", onClick: this.onClickBackground.bind(this), __self: this, __source: {fileName: _jsxFileName$1, lineNumber: 58}} )
1136
1152
  , this.props.children
1137
1153
  )
1138
1154
  )
@@ -1140,7 +1156,7 @@ class Dialog extends React.Component {
1140
1156
  }
1141
1157
  }
1142
1158
 
1143
- const _jsxFileName$1 = "/home/runner/work/react-dialog/react-dialog/src/index.jsx";
1159
+ const _jsxFileName = "/home/runner/work/react-dialog/react-dialog/src/index.jsx";
1144
1160
  class ReactDialog extends React.Component {
1145
1161
  constructor(props) {
1146
1162
  super(props);
@@ -1169,7 +1185,7 @@ class ReactDialog extends React.Component {
1169
1185
  background: this.props.background,
1170
1186
  close: this.props.close,
1171
1187
  document: _document,
1172
- open: this.props.open, __self: this, __source: {fileName: _jsxFileName$1, lineNumber: 29}}
1188
+ open: this.props.open, __self: this, __source: {fileName: _jsxFileName, lineNumber: 29}}
1173
1189
 
1174
1190
  , this.props.children
1175
1191
  ),
@@ -1312,7 +1328,7 @@ var DialogStyle = (function (style) {
1312
1328
  });
1313
1329
 
1314
1330
  var FontStyle = (function (style) {
1315
- return "\n\n *, div, div * {\n font-family: ".concat(style.fontFamily, ";\n }\n\n .FontSizeS {\n font-size: 16px;\n }\n\n .FontSizeM {\n font-size: 19px;\n }\n\n .FontSizeL {\n font-size: 23px;\n }\n\n .FontSizeXL {\n font-size: 32px;\n }\n\n .FontWeightBold {\n font-weight: bold;\n }\n\n .FontItalic {\n font-style: italic;\n }\n ");
1331
+ return "\n\n *, div, div * {\n font-family: ".concat(style.fontFamily, ";\n }\n\n .FontSizeS {\n font-size: 16px;\n }\n\n .FontSizeM {\n font-size: 19px;\n }\n\n .FontSizeL {\n font-size: 23px;\n }\n\n .FontSizeXL {\n font-size: 32px;\n }\n\n .FontSizeXXL {\n font-size: 42px;\n }\n\n .FontWeightBold {\n font-weight: bold;\n }\n\n .FontItalic {\n font-style: italic;\n }\n ");
1316
1332
  });
1317
1333
 
1318
1334
  var GraphicStyle = (function () {
@@ -1405,7 +1421,7 @@ var styleRenderer = (function (style) {
1405
1421
  },
1406
1422
  fontFamily: '-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"'
1407
1423
  }, style);
1408
- return [ResetStyle(), DialogStyle(), ButtonCircularStyle(), ButtonPrimaryStyle(style), CardStyle(style), PoweredByStyle(style), GraphicStyle(), SkeletonStyle(), TokenAmountStyle(), TextStyle(style), FontStyle(style), IconStyle(style), OpacityStyle(), PaddingStyle(), HeightStyle(), LoadingTextStyle(style), RangeSliderStyle(style), InputStyle(), TextButtonStyle(style), ImageStyle(), BlockchainLogoStyle(), SearchStyle(style), TokenImageStyle(), AlertStyle(), TableStyle(), LinkStyle(style), TooltipStyle(style)].join('');
1424
+ return [ResetStyle(), DialogStyle(style), ButtonCircularStyle(), ButtonPrimaryStyle(style), CardStyle(style), PoweredByStyle(style), GraphicStyle(), SkeletonStyle(), TokenAmountStyle(), TextStyle(style), FontStyle(style), IconStyle(style), OpacityStyle(style), PaddingStyle(), HeightStyle(), LoadingTextStyle(style), RangeSliderStyle(style), InputStyle(style), TextButtonStyle(style), ImageStyle(style), BlockchainLogoStyle(style), SearchStyle(style), TokenImageStyle(style), AlertStyle(style), TableStyle(style), LinkStyle(style), TooltipStyle(style)].join('');
1409
1425
  });
1410
1426
 
1411
1427
  var mount = (function (_ref, content) {
@@ -1718,7 +1734,7 @@ var ChangableAmountProvider = (function (props) {
1718
1734
  } else {
1719
1735
  Promise.all(props.accept.map(function (configuration) {
1720
1736
  if (CONSTANTS[configuration.blockchain].USD.toLowerCase() == configuration.token.toLowerCase()) {
1721
- return 1.00 / conversionRate;
1737
+ return 1.00 / conversionRate * amount;
1722
1738
  }
1723
1739
 
1724
1740
  return route({
@@ -2679,15 +2695,14 @@ var ChangeAmountDialog = (function (props) {
2679
2695
  className: "PaddingLeftM PaddingRightM"
2680
2696
  }, /*#__PURE__*/React.createElement("div", {
2681
2697
  className: "PaddingTopS TextCenter PaddingBottomL"
2682
- }, /*#__PURE__*/React.createElement("div", {
2683
- className: "FontSizeL"
2684
- }, /*#__PURE__*/React.createElement("input", {
2698
+ }, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("input", {
2685
2699
  max: parseFloat(maxAmount),
2686
2700
  min: min,
2687
2701
  step: step,
2688
- className: "Input FontSizeXL TextAlignCenter",
2702
+ className: "Input FontSizeXXL TextAlignCenter",
2689
2703
  type: "number",
2690
2704
  name: "amount",
2705
+ autoFocus: true,
2691
2706
  value: parseFloat(inputAmount),
2692
2707
  onChange: function onChange(event) {
2693
2708
  changeAmount(event.target.value);
@@ -2695,18 +2710,7 @@ var ChangeAmountDialog = (function (props) {
2695
2710
  onBlur: function onBlur(event) {
2696
2711
  setValidValue(event.target.value);
2697
2712
  }
2698
- })), /*#__PURE__*/React.createElement(Slider, {
2699
- max: parseFloat(maxAmount),
2700
- min: min,
2701
- step: step,
2702
- value: parseFloat(inputAmount),
2703
- onChange: function onChange(value) {
2704
- changeAmount(toValidStep(value));
2705
- },
2706
- onChangeComplete: function onChangeComplete() {
2707
- setValidValue(inputAmount);
2708
- }
2709
- }), /*#__PURE__*/React.createElement("div", {
2713
+ })), /*#__PURE__*/React.createElement("div", {
2710
2714
  style: {
2711
2715
  height: '40px'
2712
2716
  }
@@ -3225,6 +3229,7 @@ var DonationOverviewDialog = (function (props) {
3225
3229
  return /*#__PURE__*/React.createElement(DonationOverviewSkeleton, null);
3226
3230
  }
3227
3231
 
3232
+ var blockchain = Blockchain.findByName(payment.blockchain);
3228
3233
  return /*#__PURE__*/React.createElement(Dialog$1, {
3229
3234
  header: /*#__PURE__*/React.createElement("div", {
3230
3235
  className: "PaddingTopS PaddingLeftM PaddingRightM TextLeft"
@@ -3274,6 +3279,11 @@ var DonationOverviewDialog = (function (props) {
3274
3279
  }, /*#__PURE__*/React.createElement(TokenImage, {
3275
3280
  blockchain: payment.route.blockchain,
3276
3281
  address: payment.token
3282
+ }), /*#__PURE__*/React.createElement("img", {
3283
+ className: "BlockchainLogo small",
3284
+ src: blockchain.logo,
3285
+ alt: blockchain.label,
3286
+ title: blockchain.label
3277
3287
  })), /*#__PURE__*/React.createElement("div", {
3278
3288
  className: "CardBody"
3279
3289
  }, /*#__PURE__*/React.createElement("div", {
@@ -3931,7 +3941,7 @@ var preflight$2 = /*#__PURE__*/function () {
3931
3941
  throw 'You need to set the blockchain you want to receive the donation on!';
3932
3942
  }
3933
3943
 
3934
- if (!['ethereum', 'bsc'].includes(configuration.blockchain)) {
3944
+ if (!['ethereum', 'bsc', 'polygon'].includes(configuration.blockchain)) {
3935
3945
  throw 'You need to set a supported blockchain!';
3936
3946
  }
3937
3947
 
@@ -4316,6 +4326,7 @@ var PaymentOverviewDialog = (function (props) {
4316
4326
  return /*#__PURE__*/React.createElement(PaymentOverviewSkeleton, null);
4317
4327
  }
4318
4328
 
4329
+ var blockchain = Blockchain.findByName(payment.blockchain);
4319
4330
  return /*#__PURE__*/React.createElement(Dialog$1, {
4320
4331
  header: /*#__PURE__*/React.createElement("div", {
4321
4332
  className: "PaddingTopS PaddingLeftM PaddingRightM TextLeft"
@@ -4365,6 +4376,11 @@ var PaymentOverviewDialog = (function (props) {
4365
4376
  }, /*#__PURE__*/React.createElement(TokenImage, {
4366
4377
  blockchain: payment.blockchain,
4367
4378
  address: payment.token
4379
+ }), /*#__PURE__*/React.createElement("img", {
4380
+ className: "BlockchainLogo small",
4381
+ src: blockchain.logo,
4382
+ alt: blockchain.label,
4383
+ title: blockchain.label
4368
4384
  })), /*#__PURE__*/React.createElement("div", {
4369
4385
  className: "CardBody"
4370
4386
  }, /*#__PURE__*/React.createElement("div", {
@@ -4435,7 +4451,7 @@ var preflight$1 = /*#__PURE__*/function () {
4435
4451
  throw 'You need to set the blockchain your want to receive the payment on!';
4436
4452
  }
4437
4453
 
4438
- if (!['ethereum', 'bsc'].includes(configuration.blockchain)) {
4454
+ if (!['ethereum', 'bsc', 'polygon'].includes(configuration.blockchain)) {
4439
4455
  throw 'You need to set a supported blockchain!';
4440
4456
  }
4441
4457
 
@@ -4754,6 +4770,7 @@ var SaleOverviewDialog = (function (props) {
4754
4770
  });
4755
4771
  }
4756
4772
 
4773
+ var blockchain = Blockchain.findByName(payment.blockchain);
4757
4774
  return /*#__PURE__*/React.createElement(Dialog$1, {
4758
4775
  header: /*#__PURE__*/React.createElement("div", {
4759
4776
  className: "PaddingTopS PaddingLeftM PaddingRightM TextLeft"
@@ -4775,7 +4792,12 @@ var SaleOverviewDialog = (function (props) {
4775
4792
  }, /*#__PURE__*/React.createElement("div", {
4776
4793
  className: "CardImage",
4777
4794
  title: payment.name
4778
- }, tokenImageElement), /*#__PURE__*/React.createElement("div", {
4795
+ }, tokenImageElement, /*#__PURE__*/React.createElement("img", {
4796
+ className: "BlockchainLogo small",
4797
+ src: blockchain.logo,
4798
+ alt: blockchain.label,
4799
+ title: blockchain.label
4800
+ })), /*#__PURE__*/React.createElement("div", {
4779
4801
  className: "CardBody"
4780
4802
  }, /*#__PURE__*/React.createElement("div", {
4781
4803
  className: "CardBodyWrapper"
@@ -5145,7 +5167,7 @@ var SelectBlockchainDialog = (function (props) {
5145
5167
  navigate = _useContext2.navigate;
5146
5168
 
5147
5169
  var stacked = Object.keys(props.selection).length > 1;
5148
- var blockchains = [Blockchain.findByName('ethereum'), Blockchain.findByName('bsc')];
5170
+ var blockchains = [Blockchain.findByName('ethereum'), Blockchain.findByName('bsc'), Blockchain.findByName('polygon')];
5149
5171
 
5150
5172
  var selectBlockchain = function selectBlockchain(blockchain) {
5151
5173
  setSelection(Object.assign(props.selection, {