@salesgenterp/ui-components 0.4.544 → 0.4.546

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/index.js CHANGED
@@ -2913,6 +2913,19 @@ var Dashboard = function Dashboard(_ref) {
2913
2913
  var _useState7 = React.useState(0),
2914
2914
  value = _useState7[0],
2915
2915
  setValue = _useState7[1];
2916
+ var isTablet = useMediaQuery('(hover: none) and (pointer: coarse) and (min-width: 768px) and (min-height: 768px)');
2917
+ var handleInvoiceIframeLoad = function handleInvoiceIframeLoad(event) {
2918
+ if (!isTablet) return;
2919
+ var iframe = event.currentTarget;
2920
+ try {
2921
+ var _iframe$contentWindow, _doc$body, _doc$documentElement;
2922
+ var doc = iframe.contentDocument || ((_iframe$contentWindow = iframe.contentWindow) === null || _iframe$contentWindow === void 0 ? void 0 : _iframe$contentWindow.document);
2923
+ var contentHeight = Math.max((doc === null || doc === void 0 ? void 0 : (_doc$body = doc.body) === null || _doc$body === void 0 ? void 0 : _doc$body.scrollHeight) || 0, (doc === null || doc === void 0 ? void 0 : (_doc$documentElement = doc.documentElement) === null || _doc$documentElement === void 0 ? void 0 : _doc$documentElement.scrollHeight) || 0);
2924
+ if (contentHeight) {
2925
+ iframe.style.height = contentHeight + "px";
2926
+ }
2927
+ } catch (_unused) {}
2928
+ };
2916
2929
  React.useEffect(function () {
2917
2930
  if (hideSalesOrderTab) {
2918
2931
  setValue(1);
@@ -3320,16 +3333,21 @@ var Dashboard = function Dashboard(_ref) {
3320
3333
  })))))), /*#__PURE__*/React__default.createElement(TableContainer, null, /*#__PURE__*/React__default.createElement(InvoiceDialog, {
3321
3334
  onClose: function onClose() {
3322
3335
  return setInvoiceModal({
3323
- open: false
3336
+ open: false,
3337
+ url: ''
3324
3338
  });
3325
3339
  },
3326
3340
  "aria-labelledby": "customized-dialog-title",
3327
3341
  open: invoiceModal === null || invoiceModal === void 0 ? void 0 : invoiceModal.open,
3328
- maxWidth: "lg"
3342
+ maxWidth: "lg",
3343
+ fullScreen: isTablet,
3344
+ $tablet: isTablet
3329
3345
  }, /*#__PURE__*/React__default.createElement(material.DialogContent, {
3330
3346
  dividers: true
3331
3347
  }, /*#__PURE__*/React__default.createElement("iframe", {
3332
- src: invoiceModal.url
3348
+ src: invoiceModal.url,
3349
+ title: "Invoice preview",
3350
+ onLoad: handleInvoiceIframeLoad
3333
3351
  }))), /*#__PURE__*/React__default.createElement(APITable, {
3334
3352
  key: value,
3335
3353
  cacheFilters: true,
@@ -3596,7 +3614,10 @@ var StatusContainer = styled__default(material.Stack)(_templateObject16 || (_tem
3596
3614
  return props.primaryColor;
3597
3615
  });
3598
3616
  var TableContainer = styled__default.div(_templateObject17 || (_templateObject17 = _taggedTemplateLiteralLoose(["\n margin-top: 2rem;\n border-radius: 14px;\n"])));
3599
- var InvoiceDialog = styled__default(material.Dialog)(_templateObject18 || (_templateObject18 = _taggedTemplateLiteralLoose(["\n iframe {\n width: 900px;\n border: none;\n height: 600px;\n }\n"])));
3617
+ var InvoiceDialog = styled__default(material.Dialog)(_templateObject18 || (_templateObject18 = _taggedTemplateLiteralLoose(["\n iframe {\n width: 900px;\n border: none;\n height: 600px;\n display: block;\n }\n\n ", "\n"])), function (_ref3) {
3618
+ var $tablet = _ref3.$tablet;
3619
+ return $tablet && "\n .MuiDialog-paper {\n display: flex;\n flex-direction: column;\n overflow: hidden;\n }\n\n .MuiDialogContent-root {\n overflow: auto;\n -webkit-overflow-scrolling: touch;\n overscroll-behavior: contain;\n padding: 0;\n flex: 1;\n min-height: 0;\n }\n\n iframe {\n width: 100%;\n min-height: 600px;\n height: auto;\n pointer-events: none;\n }\n ";
3620
+ });
3600
3621
  var TabsContainer = styled__default(material.Tabs)(_templateObject19 || (_templateObject19 = _taggedTemplateLiteralLoose(["\n button {\n color: ", " !important;\n font-size: 1.1rem;\n font-weight: 600;\n }\n .Mui-selected {\n color: ", " !important;\n }\n .MuiTabs-indicator {\n background-color: ", " !important;\n }\n"])), function (props) {
3601
3622
  return props.fontColor;
3602
3623
  }, function (props) {
@@ -14342,7 +14363,11 @@ var CheckoutPageComponentWrapper = function CheckoutPageComponentWrapper(_ref) {
14342
14363
  }
14343
14364
  return data;
14344
14365
  });
14345
- }, function () {
14366
+ }, function (err) {
14367
+ var _err$response, _err$response$data;
14368
+ if ((err === null || err === void 0 ? void 0 : (_err$response = err.response) === null || _err$response === void 0 ? void 0 : (_err$response$data = _err$response.data) === null || _err$response$data === void 0 ? void 0 : _err$response$data.status) === 412) {
14369
+ window.location.replace("/cart");
14370
+ }
14346
14371
  return false;
14347
14372
  }));
14348
14373
  } catch (e) {