@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.
@@ -2909,6 +2909,19 @@ var Dashboard = function Dashboard(_ref) {
2909
2909
  var _useState7 = useState(0),
2910
2910
  value = _useState7[0],
2911
2911
  setValue = _useState7[1];
2912
+ var isTablet = useMediaQuery('(hover: none) and (pointer: coarse) and (min-width: 768px) and (min-height: 768px)');
2913
+ var handleInvoiceIframeLoad = function handleInvoiceIframeLoad(event) {
2914
+ if (!isTablet) return;
2915
+ var iframe = event.currentTarget;
2916
+ try {
2917
+ var _iframe$contentWindow, _doc$body, _doc$documentElement;
2918
+ var doc = iframe.contentDocument || ((_iframe$contentWindow = iframe.contentWindow) === null || _iframe$contentWindow === void 0 ? void 0 : _iframe$contentWindow.document);
2919
+ 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);
2920
+ if (contentHeight) {
2921
+ iframe.style.height = contentHeight + "px";
2922
+ }
2923
+ } catch (_unused) {}
2924
+ };
2912
2925
  useEffect(function () {
2913
2926
  if (hideSalesOrderTab) {
2914
2927
  setValue(1);
@@ -3316,16 +3329,21 @@ var Dashboard = function Dashboard(_ref) {
3316
3329
  })))))), /*#__PURE__*/React__default.createElement(TableContainer, null, /*#__PURE__*/React__default.createElement(InvoiceDialog, {
3317
3330
  onClose: function onClose() {
3318
3331
  return setInvoiceModal({
3319
- open: false
3332
+ open: false,
3333
+ url: ''
3320
3334
  });
3321
3335
  },
3322
3336
  "aria-labelledby": "customized-dialog-title",
3323
3337
  open: invoiceModal === null || invoiceModal === void 0 ? void 0 : invoiceModal.open,
3324
- maxWidth: "lg"
3338
+ maxWidth: "lg",
3339
+ fullScreen: isTablet,
3340
+ $tablet: isTablet
3325
3341
  }, /*#__PURE__*/React__default.createElement(DialogContent, {
3326
3342
  dividers: true
3327
3343
  }, /*#__PURE__*/React__default.createElement("iframe", {
3328
- src: invoiceModal.url
3344
+ src: invoiceModal.url,
3345
+ title: "Invoice preview",
3346
+ onLoad: handleInvoiceIframeLoad
3329
3347
  }))), /*#__PURE__*/React__default.createElement(APITable, {
3330
3348
  key: value,
3331
3349
  cacheFilters: true,
@@ -3592,7 +3610,10 @@ var StatusContainer = styled(Stack)(_templateObject16 || (_templateObject16 = _t
3592
3610
  return props.primaryColor;
3593
3611
  });
3594
3612
  var TableContainer = styled.div(_templateObject17 || (_templateObject17 = _taggedTemplateLiteralLoose(["\n margin-top: 2rem;\n border-radius: 14px;\n"])));
3595
- var InvoiceDialog = styled(Dialog)(_templateObject18 || (_templateObject18 = _taggedTemplateLiteralLoose(["\n iframe {\n width: 900px;\n border: none;\n height: 600px;\n }\n"])));
3613
+ var InvoiceDialog = styled(Dialog)(_templateObject18 || (_templateObject18 = _taggedTemplateLiteralLoose(["\n iframe {\n width: 900px;\n border: none;\n height: 600px;\n display: block;\n }\n\n ", "\n"])), function (_ref3) {
3614
+ var $tablet = _ref3.$tablet;
3615
+ 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 ";
3616
+ });
3596
3617
  var TabsContainer = styled(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) {
3597
3618
  return props.fontColor;
3598
3619
  }, function (props) {
@@ -14338,7 +14359,11 @@ var CheckoutPageComponentWrapper = function CheckoutPageComponentWrapper(_ref) {
14338
14359
  }
14339
14360
  return data;
14340
14361
  });
14341
- }, function () {
14362
+ }, function (err) {
14363
+ var _err$response, _err$response$data;
14364
+ 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) {
14365
+ window.location.replace("/cart");
14366
+ }
14342
14367
  return false;
14343
14368
  }));
14344
14369
  } catch (e) {