@depay/widgets 9.2.3 → 9.3.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/dist/esm/index.js CHANGED
@@ -533,7 +533,7 @@ var Dialog$1 = (function (props) {
533
533
  close = _useContext2.close,
534
534
  closable = _useContext2.closable;
535
535
  return /*#__PURE__*/React.createElement("div", {
536
- className: "Dialog"
536
+ className: ["Dialog", props.className].join(' ')
537
537
  }, /*#__PURE__*/React.createElement("div", {
538
538
  className: ["DialogHeader", props.stacked ? 'TextCenter' : ''].join(' ')
539
539
  }, props.stacked && /*#__PURE__*/React.createElement("div", {
@@ -546,7 +546,7 @@ var Dialog$1 = (function (props) {
546
546
  title: "Go back"
547
547
  }, /*#__PURE__*/React.createElement(ChevronLeft, null))), props.header, /*#__PURE__*/React.createElement("div", {
548
548
  className: "DialogHeaderActionRight PaddingTopS PaddingLeftS PaddingRightS"
549
- }, closable && /*#__PURE__*/React.createElement("button", {
549
+ }, closable && props.closable !== false && /*#__PURE__*/React.createElement("button", {
550
550
  onClick: close,
551
551
  className: "ButtonCircular",
552
552
  title: "Close dialog"
@@ -1226,7 +1226,7 @@ var CardStyle = (function (style) {
1226
1226
  });
1227
1227
 
1228
1228
  var DialogStyle = (function (style) {
1229
- return "\n\n .ReactDialogBackground {\n backdrop-filter: blur(5px);\n background: rgba(0,0,0,0.7);\n }\n\n .contained .ReactDialog {\n position: absolute;\n height: 100%;\n min-height: 100%;\n width: 100%;\n min-width: 100%;\n }\n\n .contained .ReactDialogBackground {\n position: absolute;\n }\n\n .contained .ReactDialog.ReactDialogOpen .ReactDialogAnimation {\n top: 0;\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.2);\n border-radius: 13px;\n background: rgb(248,248,248);\n }\n\n @media (max-width: 450px) {\n\n .Dialog {\n border-radius: 0;\n width: 100%;\n }\n }\n\n @media (orientation: portrait) and (max-width: 800px) {\n\n .ReactDialogAnimation {\n width: 100%;\n }\n\n .ReactDialog {\n height: 100%;\n min-height: 100%;\n }\n\n .ReactDialogStack {\n align-items: flex-end;\n }\n\n .Dialog {\n align-content: stretch;\n border-radius: 13px;\n border-top-radius: 13px;\n display: flex;\n flex-direction: column;\n border-bottom-left-radius: 0 !important;\n border-bottom-right-radius: 0 !important;\n }\n\n .DialogBody {\n flex: 1;\n align-items: flex-end;\n }\n\n .DialogFooter {\n padding-bottom: 20px;\n }\n\n .ReactDialogAnimation {\n margin-bottom: -100px !important;\n top: inherit !important;\n position: relative;\n transition: opacity 0.4s ease, margin-bottom 0.4s ease;\n }\n\n .ReactDialog.ReactDialogOpen .ReactDialogAnimation {\n margin-bottom: 0px !important;\n }\n\n .DialogFooter {\n border-bottom-left-radius: 0 !important;\n border-bottom-right-radius: 0 !important;\n }\n\n .ReactShadowDOMInsideContainer > .ReactDialog {\n align-items: flex-end;\n }\n }\n\n .DialogBody {\n overflow-x: hidden;\n overflow-y: auto;\n }\n\n .DialogBody.ScrollHeight {\n height: 30vh !important;\n max-height: 30vh !important;\n }\n\n .DialogHeader {\n border-top-left-radius: 13px;\n border-top-right-radius: 13px;\n min-height: 54px;\n position: relative;\n width: 100%;\n }\n\n .DialogHeaderActionRight {\n position: absolute;\n top: 0;\n right: 0;\n height: 48px;\n }\n\n .DialogHeaderActionLeft {\n position: absolute;\n top: 0;\n left: 0;\n height: 48px;\n }\n\n .DialogFooter {\n border-bottom-left-radius: 13px;\n border-bottom-right-radius: 13px;\n line-height: 24px;\n min-height: 32px;\n position: relative;\n text-align: center;\n }\n\n ";
1229
+ return "\n\n .ReactDialogBackground {\n z-index: -2;\n backdrop-filter: blur(5px);\n background: rgba(0,0,0,0.7);\n }\n\n .contained .ReactDialog {\n position: absolute;\n height: 100%;\n min-height: 100%;\n width: 100%;\n min-width: 100%;\n }\n\n .contained .ReactDialogBackground {\n position: absolute;\n }\n\n .contained .ReactDialog.ReactDialogOpen .ReactDialogAnimation {\n top: 0;\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.2);\n border-radius: 13px;\n background: rgb(248,248,248);\n }\n\n @media (max-width: 450px) {\n\n .Dialog {\n border-radius: 0;\n width: 100%;\n }\n }\n\n @media (orientation: portrait) and (max-width: 800px) {\n\n .ReactDialogAnimation {\n width: 100%;\n }\n\n .ReactDialog {\n height: 100%;\n min-height: 100%;\n }\n\n .ReactDialogStack {\n align-items: flex-end;\n }\n\n .Dialog {\n align-content: stretch;\n border-radius: 13px;\n border-top-radius: 13px;\n display: flex;\n flex-direction: column;\n border-bottom-left-radius: 0 !important;\n border-bottom-right-radius: 0 !important;\n }\n\n .DialogBody {\n flex: 1;\n align-items: flex-end;\n }\n\n .DialogFooter {\n padding-bottom: 20px;\n }\n\n .ReactDialogAnimation {\n margin-bottom: -100px !important;\n top: inherit !important;\n position: relative;\n transition: opacity 0.4s ease, margin-bottom 0.4s ease;\n }\n\n .ReactDialog.ReactDialogOpen .ReactDialogAnimation {\n margin-bottom: 0px !important;\n }\n\n .DialogFooter {\n border-bottom-left-radius: 0 !important;\n border-bottom-right-radius: 0 !important;\n }\n\n .ReactShadowDOMInsideContainer > .ReactDialog {\n align-items: flex-end;\n }\n }\n\n .DialogBody {\n overflow-x: hidden;\n overflow-y: auto;\n }\n\n .DialogBody.ScrollHeight {\n height: 30vh !important;\n max-height: 30vh !important;\n }\n\n .DialogBody.MinHeight {\n height: 120px !important;\n max-height: 120px !important;\n }\n\n .DialogHeader {\n border-top-left-radius: 13px;\n border-top-right-radius: 13px;\n min-height: 54px;\n position: relative;\n width: 100%;\n }\n\n .DialogHeaderActionRight {\n position: absolute;\n top: 0;\n right: 0;\n height: 48px;\n }\n\n .DialogHeaderActionLeft {\n position: absolute;\n top: 0;\n left: 0;\n height: 48px;\n }\n\n .DialogFooter {\n border-bottom-left-radius: 13px;\n border-bottom-right-radius: 13px;\n line-height: 24px;\n min-height: 32px;\n position: relative;\n text-align: center;\n }\n\n ";
1230
1230
  });
1231
1231
 
1232
1232
  var FontStyle = (function (style) {
@@ -20588,8 +20588,9 @@ var PaymentTrackingProvider = (function (props) {
20588
20588
  _useContext.errorCallback;
20589
20589
  var _useContext2 = useContext(ConfigurationContext),
20590
20590
  track = _useContext2.track,
20591
- validated = _useContext2.validated,
20592
- integration = _useContext2.integration,
20591
+ validated = _useContext2.validated;
20592
+ _useContext2.failed;
20593
+ var integration = _useContext2.integration,
20593
20594
  link = _useContext2.link,
20594
20595
  type = _useContext2.type;
20595
20596
  var _useContext3 = useContext(WalletContext),
@@ -20643,8 +20644,8 @@ var PaymentTrackingProvider = (function (props) {
20643
20644
  var _useContext4 = useContext(ClosableContext),
20644
20645
  setClosable = _useContext4.setClosable;
20645
20646
  var _useContext5 = useContext(NavigateContext),
20646
- navigate = _useContext5.navigate;
20647
- _useContext5.set;
20647
+ navigate = _useContext5.navigate,
20648
+ set = _useContext5.set;
20648
20649
  var openSocket = function openSocket(transaction) {
20649
20650
  var socket = new WebSocket('wss://integrate.depay.com/cable');
20650
20651
  socket.onopen = function (event) {
@@ -20670,18 +20671,24 @@ var PaymentTrackingProvider = (function (props) {
20670
20671
  if (item.type === "ping" || !item.message) {
20671
20672
  return;
20672
20673
  }
20674
+ var success = item.message.status == 'success';
20673
20675
  if (validated) {
20674
- validated(item.message.status == 'success');
20676
+ validated(success);
20675
20677
  }
20676
20678
  if (item.message.release) {
20677
- setRelease(true);
20678
- setClosable(!item.message.forward_to);
20679
- setForwardTo(item.message.forward_to);
20680
20679
  socket.close(1000);
20681
- if (!!item.message.forward_to) {
20682
- setTimeout(function () {
20683
- props.document.location.href = item.message.forward_to;
20684
- }, 200);
20680
+ if (success) {
20681
+ setRelease(true);
20682
+ setClosable(!item.message.forward_to);
20683
+ setForwardTo(item.message.forward_to);
20684
+ if (!!item.message.forward_to) {
20685
+ setTimeout(function () {
20686
+ props.document.location.href = item.message.forward_to;
20687
+ }, 200);
20688
+ }
20689
+ } else if (success == false) {
20690
+ setClosable(true);
20691
+ set(['PaymentFailed']);
20685
20692
  }
20686
20693
  } else if (item.message.confirmations) {
20687
20694
  setConfirmationsRequired(item.message.confirmations.required);
@@ -21300,6 +21307,111 @@ var Donation = /*#__PURE__*/function () {
21300
21307
  };
21301
21308
  }();
21302
21309
 
21310
+ var LoadingDialog = (function (props) {
21311
+ var _useContext = useContext(ConfigurationContext),
21312
+ text = _useContext.text;
21313
+ return /*#__PURE__*/React.createElement(Dialog$1, {
21314
+ closable: false,
21315
+ header: /*#__PURE__*/React.createElement("div", {
21316
+ className: "PaddingTopS PaddingLeftM PaddingRightM TextLeft"
21317
+ }, /*#__PURE__*/React.createElement("h1", {
21318
+ className: "LineHeightL FontSizeL"
21319
+ }, "Payment")),
21320
+ body: /*#__PURE__*/React.createElement("div", {
21321
+ className: "PaddingLeftM PaddingRightM PaddingBottomXS"
21322
+ }, /*#__PURE__*/React.createElement("div", {
21323
+ className: "Card Skeleton"
21324
+ }, /*#__PURE__*/React.createElement("div", {
21325
+ className: "SkeletonBackground"
21326
+ }))),
21327
+ footer: /*#__PURE__*/React.createElement("div", {
21328
+ className: "PaddingTopXS PaddingRightM PaddingLeftM PaddingBottomS"
21329
+ }, /*#__PURE__*/React.createElement("div", {
21330
+ className: "SkeletonWrapper"
21331
+ }, /*#__PURE__*/React.createElement("div", {
21332
+ className: "ButtonPrimary Skeleton"
21333
+ }, /*#__PURE__*/React.createElement("div", {
21334
+ className: "SkeletonBackground"
21335
+ }))), /*#__PURE__*/React.createElement("div", {
21336
+ className: "TextCenter Opacity05 PaddingTopS"
21337
+ }, /*#__PURE__*/React.createElement("strong", null, text)))
21338
+ });
21339
+ });
21340
+
21341
+ var LoadingStack = (function (props) {
21342
+ var _useContext = useContext(ClosableContext),
21343
+ open = _useContext.open,
21344
+ close = _useContext.close;
21345
+ var _useContext2 = useContext(NavigateContext),
21346
+ setNavigator = _useContext2.setNavigator;
21347
+ return /*#__PURE__*/React.createElement(ReactDialogStack, {
21348
+ setNavigator: setNavigator,
21349
+ open: open,
21350
+ close: close,
21351
+ start: "Loading",
21352
+ container: props.container,
21353
+ document: props.document,
21354
+ dialogs: {
21355
+ Loading: /*#__PURE__*/React.createElement(LoadingDialog, null)
21356
+ }
21357
+ });
21358
+ });
21359
+
21360
+ var Loading = /*#__PURE__*/function () {
21361
+ var _ref2 = _asyncToGenerator( /*#__PURE__*/regenerator.mark(function _callee(_ref) {
21362
+ var text, style, error, critical, container, document, unmount;
21363
+ return regenerator.wrap(function _callee$(_context) {
21364
+ while (1) switch (_context.prev = _context.next) {
21365
+ case 0:
21366
+ text = _ref.text, style = _ref.style, error = _ref.error, critical = _ref.critical, container = _ref.container, _ref.before, document = _ref.document;
21367
+ requireReactVersion();
21368
+ _context.prev = 2;
21369
+ unmount = mount({
21370
+ style: style,
21371
+ container: container,
21372
+ document: ensureDocument(document),
21373
+ closed: closed
21374
+ }, function (unmount) {
21375
+ return function (container) {
21376
+ return /*#__PURE__*/React.createElement(ErrorProvider, {
21377
+ errorCallback: error,
21378
+ container: container,
21379
+ unmount: unmount
21380
+ }, /*#__PURE__*/React.createElement(ConfigurationProvider, {
21381
+ configuration: {
21382
+ text: text
21383
+ }
21384
+ }, /*#__PURE__*/React.createElement(UpdatableProvider, null, /*#__PURE__*/React.createElement(ClosableProvider, {
21385
+ unmount: unmount,
21386
+ closable: false
21387
+ }, /*#__PURE__*/React.createElement(NavigateProvider, null, /*#__PURE__*/React.createElement(LoadingStack, {
21388
+ document: document,
21389
+ container: container
21390
+ }), /*#__PURE__*/React.createElement(PoweredBy, null))))));
21391
+ };
21392
+ });
21393
+ window._depayUnmountLoading = unmount;
21394
+ return _context.abrupt("return", {
21395
+ unmount: unmount
21396
+ });
21397
+ case 8:
21398
+ _context.prev = 8;
21399
+ _context.t0 = _context["catch"](2);
21400
+ console.log('critical error', _context.t0);
21401
+ if (critical != undefined) {
21402
+ critical(_context.t0);
21403
+ }
21404
+ case 12:
21405
+ case "end":
21406
+ return _context.stop();
21407
+ }
21408
+ }, _callee, null, [[2, 8]]);
21409
+ }));
21410
+ return function Loading(_x) {
21411
+ return _ref2.apply(this, arguments);
21412
+ };
21413
+ }();
21414
+
21303
21415
  var SignLoginDialog = (function (props) {
21304
21416
  var _useContext = useContext(ErrorContext),
21305
21417
  setError = _useContext.setError;
@@ -21517,7 +21629,7 @@ var PaymentOverviewSkeleton = (function (props) {
21517
21629
  className: "SkeletonBackground"
21518
21630
  }))),
21519
21631
  footer: /*#__PURE__*/React.createElement("div", {
21520
- className: "PaddingTopXS PaddingRightM PaddingLeftM PaddingBottomM"
21632
+ className: ["PaddingTopXS PaddingRightM PaddingLeftM", selectedRoute == undefined && slowRouting ? 'PaddingBottomS' : 'PaddingBottomM'].join(' ')
21521
21633
  }, /*#__PURE__*/React.createElement("div", {
21522
21634
  className: "SkeletonWrapper"
21523
21635
  }, /*#__PURE__*/React.createElement("div", {
@@ -21788,6 +21900,9 @@ var Payment = /*#__PURE__*/function () {
21788
21900
  recover: recover
21789
21901
  });
21790
21902
  case 5:
21903
+ if (typeof window._depayUnmountLoading == 'function') {
21904
+ window._depayUnmountLoading();
21905
+ }
21791
21906
  unmount = mount({
21792
21907
  style: style,
21793
21908
  container: container,
@@ -21850,18 +21965,18 @@ var Payment = /*#__PURE__*/function () {
21850
21965
  return _context2.abrupt("return", {
21851
21966
  unmount: unmount
21852
21967
  });
21853
- case 9:
21854
- _context2.prev = 9;
21968
+ case 10:
21969
+ _context2.prev = 10;
21855
21970
  _context2.t0 = _context2["catch"](2);
21856
21971
  console.log('critical error', _context2.t0);
21857
21972
  if (critical != undefined) {
21858
21973
  critical(_context2.t0);
21859
21974
  }
21860
- case 13:
21975
+ case 14:
21861
21976
  case "end":
21862
21977
  return _context2.stop();
21863
21978
  }
21864
- }, _callee2, null, [[2, 9]]);
21979
+ }, _callee2, null, [[2, 10]]);
21865
21980
  }));
21866
21981
  return function Payment(_x2) {
21867
21982
  return _ref4.apply(this, arguments);
@@ -23674,7 +23789,8 @@ var DePayWidgets = {
23674
23789
  Login: Login,
23675
23790
  Payment: Payment,
23676
23791
  Sale: Sale,
23677
- Select: Select
23792
+ Select: Select,
23793
+ Loading: Loading
23678
23794
  };
23679
23795
 
23680
23796
  export { DePayWidgets as default };