@salesgenterp/ui-components 0.4.547 → 0.4.549

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.
@@ -1,7 +1,7 @@
1
1
  import { Skeleton as Skeleton$1, CircularProgress, TextField, Button, IconButton, Stack, Typography, Grid, InputAdornment, Popover, TableHead, TableRow, TableSortLabel, Paper, TableContainer as TableContainer$3, Table, TableBody, TableCell, TablePagination, Dialog, DialogContent, DialogActions, DialogTitle, RadioGroup, Radio, FormControlLabel, FormLabel, FormControl, FormHelperText, Select as Select$1, InputLabel, MenuItem, CardMedia, Divider, Tabs, Box, Tab, CardContent, ListItemIcon, ListItem, Collapse, List, ListItemText, Checkbox as Checkbox$1, Card as Card$1, CardHeader, CssBaseline, Toolbar, Drawer, useMediaQuery as useMediaQuery$1, Pagination, Tooltip, CardActionArea, Avatar as Avatar$1, alpha, Stepper, Step, StepLabel, StepContent, Container as Container$4 } from '@mui/material';
2
2
  import { styled as styled$1 } from '@mui/material/styles';
3
3
  import useMediaQuery from '@mui/material/useMediaQuery';
4
- import React__default, { useState, useEffect, forwardRef, createElement, useCallback, memo, Fragment as Fragment$1, useRef, useMemo } from 'react';
4
+ import React__default, { useState, useEffect, forwardRef, useRef, useCallback, createElement, memo, Fragment as Fragment$1, useMemo } from 'react';
5
5
  import { MdVisibilityOff, MdVisibility, MdClose, MdMonetizationOn, MdOutlineStorefront, MdRemoveRedEye, MdOutlineFileDownload, MdPersonOutline, MdOutlineCall, MdMailOutline, MdExpandMore, MdExpandLess, MdStore, MdOutlineMenuOpen, MdMenu, MdDarkMode, MdOutlineDarkMode, MdDelete, MdCheckCircle, MdArrowBack, MdOutlineCircle, MdOutlineStickyNote2, MdOutlineNumbers, MdDateRange, MdOutlineWarehouse } from 'react-icons/md';
6
6
  import styled, { css, ThemeProvider } from 'styled-components';
7
7
  import { isEmpty, isString, toNumber, reduce, concat, omit, replace, template, isArray, some, toLower, isPlainObject, includes, values, cloneDeep, filter, sortBy, isObject, sumBy, get, isNumber, remove } from 'lodash';
@@ -26,6 +26,7 @@ import { LocalizationProvider } from '@mui/x-date-pickers';
26
26
  import moment$1 from 'moment/moment';
27
27
  import { useRouter } from 'next/router';
28
28
  import Cards from 'react-credit-cards';
29
+ import { PDFViewer } from '@embedpdf/react-pdf-viewer';
29
30
  import { HiOutlineLocationMarker, HiOutlineChevronDown } from 'react-icons/hi';
30
31
  import { BsFileEarmarkImage, BsFileEarmarkPdf, BsCartX } from 'react-icons/bs';
31
32
  import { TfiMenuAlt } from 'react-icons/tfi';
@@ -2830,7 +2831,286 @@ var InfoContainer = styled.div(_templateObject$9 || (_templateObject$9 = _tagged
2830
2831
  return props.fontColor;
2831
2832
  });
2832
2833
 
2833
- var _templateObject$a, _templateObject2$5, _templateObject3$3, _templateObject4$2, _templateObject5$1, _templateObject6$1, _templateObject7$1, _templateObject8$1, _templateObject9$1, _templateObject10$1, _templateObject11$1, _templateObject12, _templateObject13, _templateObject14, _templateObject15, _templateObject16, _templateObject17, _templateObject18, _templateObject19, _templateObject20;
2834
+ var DISABLED_CATEGORIES = ['annotation', 'annotation-shape', 'insert', 'form', 'redaction', 'panel-search', 'panel-comment', 'document-open', 'document-close', 'document-export', 'document-capture', 'document-protect'];
2835
+ var EMPTY_UNSUBSCRIBERS = [];
2836
+ var LOAD_TIMEOUT_MS = 20000;
2837
+ var DEFAULT_ERROR_MESSAGE = 'Unable to load this PDF. Please try again later.';
2838
+ var safeCall = function safeCall(fn) {
2839
+ try {
2840
+ return typeof fn === 'function' ? fn() : undefined;
2841
+ } catch (error) {
2842
+ console.error('[ViewPdf]', error);
2843
+ return undefined;
2844
+ }
2845
+ };
2846
+ var clearSubscriptions = function clearSubscriptions(unsubscribersRef) {
2847
+ var list = unsubscribersRef === null || unsubscribersRef === void 0 ? void 0 : unsubscribersRef.current;
2848
+ if (!Array.isArray(list)) return;
2849
+ list.forEach(function (unsubscribe) {
2850
+ safeCall(unsubscribe);
2851
+ });
2852
+ unsubscribersRef.current = [];
2853
+ };
2854
+ var hideEmptyStateOpenButton = function hideEmptyStateOpenButton(container) {
2855
+ try {
2856
+ var shadow = container === null || container === void 0 ? void 0 : container.shadowRoot;
2857
+ if (!shadow || typeof CSSStyleSheet === 'undefined') return;
2858
+ if (typeof shadow.adoptedStyleSheets === 'undefined') return;
2859
+ var sheet = new CSSStyleSheet();
2860
+ if (typeof (sheet === null || sheet === void 0 ? void 0 : sheet.replaceSync) !== 'function') return;
2861
+ sheet.replaceSync("\n button[aria-label=\"Open File\"],\n button[aria-label=\"Open Document\"],\n button[aria-label*=\"Open Document\"],\n button.bg-accent.inline-flex {\n display: none !important;\n pointer-events: none !important;\n }\n p.text-fg-muted.mt-4.text-xs {\n display: none !important;\n }\n ");
2862
+ var existingSheets = Array.isArray(shadow.adoptedStyleSheets) ? shadow.adoptedStyleSheets : [];
2863
+ shadow.adoptedStyleSheets = [].concat(existingSheets, [sheet]);
2864
+ } catch (error) {
2865
+ console.error('[ViewPdf] Failed to hide open-document UI', error);
2866
+ }
2867
+ };
2868
+ var viewerShellStyle = {
2869
+ position: 'relative',
2870
+ width: '100%',
2871
+ minWidth: 900,
2872
+ minHeight: 600,
2873
+ height: '70vh',
2874
+ boxSizing: 'border-box'
2875
+ };
2876
+ var overlayStyle = {
2877
+ position: 'absolute',
2878
+ inset: 0,
2879
+ zIndex: 2,
2880
+ display: 'flex',
2881
+ flexDirection: 'column',
2882
+ alignItems: 'center',
2883
+ justifyContent: 'center',
2884
+ gap: '0.75rem',
2885
+ background: '#f4f5f7',
2886
+ color: '#4b5563',
2887
+ fontSize: '0.95rem',
2888
+ fontWeight: 600,
2889
+ padding: '1.5rem',
2890
+ textAlign: 'center',
2891
+ boxSizing: 'border-box'
2892
+ };
2893
+ var closeButtonStyle = {
2894
+ marginTop: '0.5rem',
2895
+ padding: '0.5rem 1rem',
2896
+ border: '1px solid #d1d5db',
2897
+ borderRadius: 6,
2898
+ background: '#fff',
2899
+ color: '#374151',
2900
+ fontSize: '0.875rem',
2901
+ fontWeight: 600,
2902
+ cursor: 'pointer'
2903
+ };
2904
+ var getErrorMessage = function getErrorMessage(error) {
2905
+ var _error$reason;
2906
+ if (typeof error === 'string' && error.trim()) return error.trim();
2907
+ if (error !== null && error !== void 0 && error.message && typeof error.message === 'string' && error.message.trim()) {
2908
+ return error.message.trim();
2909
+ }
2910
+ if (error !== null && error !== void 0 && (_error$reason = error.reason) !== null && _error$reason !== void 0 && _error$reason.message && typeof error.reason.message === 'string' && error.reason.message.trim()) {
2911
+ return error.reason.message.trim();
2912
+ }
2913
+ if (typeof (error === null || error === void 0 ? void 0 : error.reason) === 'string' && error.reason.trim()) {
2914
+ return error.reason.trim();
2915
+ }
2916
+ return DEFAULT_ERROR_MESSAGE;
2917
+ };
2918
+ var syncDocumentStates = function syncDocumentStates(documentManager, onLoaded, onError) {
2919
+ var documents = typeof (documentManager === null || documentManager === void 0 ? void 0 : documentManager.getOpenDocuments) === 'function' ? documentManager.getOpenDocuments() : [];
2920
+ if (!Array.isArray(documents) || documents.length === 0) return false;
2921
+ var errored = documents.find(function (doc) {
2922
+ return (doc === null || doc === void 0 ? void 0 : doc.status) === 'error';
2923
+ });
2924
+ if (errored) {
2925
+ onError((errored === null || errored === void 0 ? void 0 : errored.error) || DEFAULT_ERROR_MESSAGE);
2926
+ return true;
2927
+ }
2928
+ var loaded = documents.find(function (doc) {
2929
+ return (doc === null || doc === void 0 ? void 0 : doc.status) === 'loaded';
2930
+ });
2931
+ if (loaded) {
2932
+ onLoaded();
2933
+ return true;
2934
+ }
2935
+ return false;
2936
+ };
2937
+ var ViewPdf = function ViewPdf(_ref) {
2938
+ var _ref$src = _ref.src,
2939
+ src = _ref$src === void 0 ? '' : _ref$src,
2940
+ onRequestClose = _ref.onRequestClose;
2941
+ var _useState = useState(Boolean(src)),
2942
+ isLoading = _useState[0],
2943
+ setIsLoading = _useState[1];
2944
+ var _useState2 = useState(''),
2945
+ loadError = _useState2[0],
2946
+ setLoadError = _useState2[1];
2947
+ var hadLoadErrorRef = useRef(false);
2948
+ var isMountedRef = useRef(true);
2949
+ var loadFinishedRef = useRef(false);
2950
+ var unsubscribersRef = useRef(EMPTY_UNSUBSCRIBERS);
2951
+ var timeoutRef = useRef(null);
2952
+ var pdfSrc = typeof src === 'string' ? src.trim() : '';
2953
+ var clearLoadTimeout = useCallback(function () {
2954
+ if (timeoutRef.current) {
2955
+ clearTimeout(timeoutRef.current);
2956
+ timeoutRef.current = null;
2957
+ }
2958
+ }, []);
2959
+ useEffect(function () {
2960
+ isMountedRef.current = true;
2961
+ return function () {
2962
+ isMountedRef.current = false;
2963
+ clearLoadTimeout();
2964
+ clearSubscriptions(unsubscribersRef);
2965
+ };
2966
+ }, [clearLoadTimeout]);
2967
+ useEffect(function () {
2968
+ hadLoadErrorRef.current = false;
2969
+ loadFinishedRef.current = false;
2970
+ clearLoadTimeout();
2971
+ setLoadError('');
2972
+ setIsLoading(Boolean(pdfSrc));
2973
+ }, [pdfSrc, clearLoadTimeout]);
2974
+ var finishWithError = useCallback(function (error) {
2975
+ if (loadFinishedRef.current || !isMountedRef.current) return;
2976
+ loadFinishedRef.current = true;
2977
+ clearLoadTimeout();
2978
+ hadLoadErrorRef.current = true;
2979
+ setIsLoading(false);
2980
+ setLoadError(getErrorMessage(error));
2981
+ }, [clearLoadTimeout]);
2982
+ var finishWithSuccess = useCallback(function () {
2983
+ if (loadFinishedRef.current || !isMountedRef.current) return;
2984
+ loadFinishedRef.current = true;
2985
+ clearLoadTimeout();
2986
+ hadLoadErrorRef.current = false;
2987
+ setLoadError('');
2988
+ setIsLoading(false);
2989
+ }, [clearLoadTimeout]);
2990
+ var handleInit = useCallback(function (container) {
2991
+ hideEmptyStateOpenButton(container);
2992
+ }, []);
2993
+ var handleReady = useCallback(function (registry) {
2994
+ try {
2995
+ var _registry$getPlugin, _registry$getPlugin$c, _registry$getPlugin$c2;
2996
+ clearSubscriptions(unsubscribersRef);
2997
+ loadFinishedRef.current = false;
2998
+ clearLoadTimeout();
2999
+ var documentManager = registry === null || registry === void 0 ? void 0 : (_registry$getPlugin = registry.getPlugin) === null || _registry$getPlugin === void 0 ? void 0 : (_registry$getPlugin$c = _registry$getPlugin.call(registry, 'document-manager')) === null || _registry$getPlugin$c === void 0 ? void 0 : (_registry$getPlugin$c2 = _registry$getPlugin$c.provides) === null || _registry$getPlugin$c2 === void 0 ? void 0 : _registry$getPlugin$c2.call(_registry$getPlugin$c);
3000
+ if (!documentManager) {
3001
+ finishWithError('Unable to initialize the PDF viewer.');
3002
+ return;
3003
+ }
3004
+ var trackUnsubscribe = function trackUnsubscribe(unsubscribe) {
3005
+ if (typeof unsubscribe !== 'function') return;
3006
+ if (!Array.isArray(unsubscribersRef === null || unsubscribersRef === void 0 ? void 0 : unsubscribersRef.current)) {
3007
+ unsubscribersRef.current = [];
3008
+ }
3009
+ unsubscribersRef.current.push(unsubscribe);
3010
+ };
3011
+ if (typeof (documentManager === null || documentManager === void 0 ? void 0 : documentManager.onDocumentError) === 'function') {
3012
+ trackUnsubscribe(documentManager.onDocumentError(function (error) {
3013
+ finishWithError(error);
3014
+ }));
3015
+ }
3016
+ if (typeof (documentManager === null || documentManager === void 0 ? void 0 : documentManager.onDocumentOpened) === 'function') {
3017
+ trackUnsubscribe(documentManager.onDocumentOpened(function () {
3018
+ finishWithSuccess();
3019
+ }));
3020
+ }
3021
+ if (typeof (documentManager === null || documentManager === void 0 ? void 0 : documentManager.onDocumentClosed) === 'function') {
3022
+ trackUnsubscribe(documentManager.onDocumentClosed(function () {
3023
+ if (!(hadLoadErrorRef !== null && hadLoadErrorRef !== void 0 && hadLoadErrorRef.current)) return;
3024
+ hadLoadErrorRef.current = false;
3025
+ if (typeof onRequestClose === 'function') {
3026
+ safeCall(onRequestClose);
3027
+ }
3028
+ }));
3029
+ }
3030
+ if (syncDocumentStates(documentManager, finishWithSuccess, finishWithError)) {
3031
+ return;
3032
+ }
3033
+ if (!pdfSrc || typeof (documentManager === null || documentManager === void 0 ? void 0 : documentManager.openDocumentUrl) !== 'function') {
3034
+ finishWithError('No PDF document provided.');
3035
+ return;
3036
+ }
3037
+ timeoutRef.current = setTimeout(function () {
3038
+ finishWithError('The PDF is taking too long to load. Please try again later.');
3039
+ }, LOAD_TIMEOUT_MS);
3040
+ var openTask = documentManager.openDocumentUrl({
3041
+ url: pdfSrc,
3042
+ autoActivate: true
3043
+ });
3044
+ if (!openTask || typeof openTask.wait !== 'function') {
3045
+ finishWithError(DEFAULT_ERROR_MESSAGE);
3046
+ return;
3047
+ }
3048
+ openTask.wait(function (response) {
3049
+ var loadTask = response === null || response === void 0 ? void 0 : response.task;
3050
+ if (!loadTask || typeof loadTask.wait !== 'function') {
3051
+ syncDocumentStates(documentManager, finishWithSuccess, finishWithError);
3052
+ return;
3053
+ }
3054
+ loadTask.wait(function () {
3055
+ finishWithSuccess();
3056
+ }, function (error) {
3057
+ finishWithError(error);
3058
+ });
3059
+ }, function (error) {
3060
+ finishWithError(error);
3061
+ });
3062
+ } catch (error) {
3063
+ console.error('[ViewPdf] Failed during viewer ready setup', error);
3064
+ finishWithError(error);
3065
+ }
3066
+ }, [clearLoadTimeout, finishWithError, finishWithSuccess, onRequestClose, pdfSrc]);
3067
+ if (!pdfSrc) {
3068
+ return /*#__PURE__*/React__default.createElement("div", {
3069
+ style: _extends({}, viewerShellStyle, overlayStyle, {
3070
+ position: 'relative'
3071
+ })
3072
+ }, /*#__PURE__*/React__default.createElement("span", null, "No PDF document provided."), typeof onRequestClose === 'function' ? /*#__PURE__*/React__default.createElement("button", {
3073
+ type: "button",
3074
+ style: closeButtonStyle,
3075
+ onClick: onRequestClose
3076
+ }, "Close") : null);
3077
+ }
3078
+ return /*#__PURE__*/React__default.createElement("div", {
3079
+ style: viewerShellStyle
3080
+ }, isLoading ? /*#__PURE__*/React__default.createElement("div", {
3081
+ style: overlayStyle,
3082
+ "aria-live": "polite",
3083
+ "aria-busy": "true"
3084
+ }, /*#__PURE__*/React__default.createElement(CircularProgress, {
3085
+ size: 28
3086
+ }), /*#__PURE__*/React__default.createElement("span", null, "Loading...")) : null, loadError ? /*#__PURE__*/React__default.createElement("div", {
3087
+ style: overlayStyle,
3088
+ role: "alert",
3089
+ "aria-live": "assertive"
3090
+ }, /*#__PURE__*/React__default.createElement("span", null, loadError), typeof onRequestClose === 'function' ? /*#__PURE__*/React__default.createElement("button", {
3091
+ type: "button",
3092
+ style: closeButtonStyle,
3093
+ onClick: onRequestClose
3094
+ }, "Close") : null) : null, /*#__PURE__*/React__default.createElement(PDFViewer, {
3095
+ key: pdfSrc,
3096
+ style: {
3097
+ height: '100%',
3098
+ width: '100%',
3099
+ minHeight: 600
3100
+ },
3101
+ onInit: handleInit,
3102
+ onReady: handleReady,
3103
+ config: {
3104
+ theme: {
3105
+ preference: 'light'
3106
+ },
3107
+ tabBar: 'never',
3108
+ disabledCategories: DISABLED_CATEGORIES
3109
+ }
3110
+ }));
3111
+ };
3112
+
3113
+ var _templateObject$a, _templateObject2$5, _templateObject3$3, _templateObject4$2, _templateObject5$1, _templateObject6$1, _templateObject7$1, _templateObject8$1, _templateObject9$1, _templateObject10$1, _templateObject11$1, _templateObject12, _templateObject13, _templateObject14, _templateObject15, _templateObject16, _templateObject17, _templateObject18, _templateObject19;
2834
3114
  var totalIcons = [{
2835
3115
  name: '',
2836
3116
  icon: /*#__PURE__*/React__default.createElement(AiOutlineShoppingCart, null)
@@ -2873,7 +3153,8 @@ var Dashboard = function Dashboard(_ref) {
2873
3153
  showOnlyRecentOrder = _ref$showOnlyRecentOr === void 0 ? false : _ref$showOnlyRecentOr,
2874
3154
  hidePayActionButton = _ref.hidePayActionButton,
2875
3155
  hideInvoiceTab = _ref.hideInvoiceTab,
2876
- hideSalesOrderTab = _ref.hideSalesOrderTab;
3156
+ hideSalesOrderTab = _ref.hideSalesOrderTab,
3157
+ showPdfViewer = _ref.showPdfViewer;
2877
3158
  var _useState = useState({}),
2878
3159
  customerData = _useState[0],
2879
3160
  setCustomerData = _useState[1];
@@ -2909,38 +3190,6 @@ var Dashboard = function Dashboard(_ref) {
2909
3190
  var _useState7 = useState(0),
2910
3191
  value = _useState7[0],
2911
3192
  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.offsetHeight) || 0, (doc === null || doc === void 0 ? void 0 : (_doc$documentElement = doc.documentElement) === null || _doc$documentElement === void 0 ? void 0 : _doc$documentElement.offsetHeight) || 0);
2920
- if (contentHeight) {
2921
- iframe.style.height = contentHeight + "px";
2922
- }
2923
- } catch (_unused) {}
2924
- };
2925
- useEffect(function () {
2926
- if (!isTablet || !invoiceModal.open) return;
2927
- var scrollY = window.scrollY;
2928
- document.body.style.position = 'fixed';
2929
- document.body.style.top = "-" + scrollY + "px";
2930
- document.body.style.left = '0';
2931
- document.body.style.right = '0';
2932
- document.body.style.width = '100%';
2933
- document.body.style.overflow = 'hidden';
2934
- return function () {
2935
- document.body.style.position = '';
2936
- document.body.style.top = '';
2937
- document.body.style.left = '';
2938
- document.body.style.right = '';
2939
- document.body.style.width = '';
2940
- document.body.style.overflow = '';
2941
- window.scrollTo(0, scrollY);
2942
- };
2943
- }, [isTablet, invoiceModal.open]);
2944
3193
  useEffect(function () {
2945
3194
  if (hideSalesOrderTab) {
2946
3195
  setValue(1);
@@ -3348,24 +3597,23 @@ var Dashboard = function Dashboard(_ref) {
3348
3597
  })))))), /*#__PURE__*/React__default.createElement(TableContainer, null, /*#__PURE__*/React__default.createElement(InvoiceDialog, {
3349
3598
  onClose: function onClose() {
3350
3599
  return setInvoiceModal({
3351
- open: false,
3352
- url: ''
3600
+ open: false
3353
3601
  });
3354
3602
  },
3355
3603
  "aria-labelledby": "customized-dialog-title",
3356
3604
  open: invoiceModal === null || invoiceModal === void 0 ? void 0 : invoiceModal.open,
3357
- maxWidth: "lg",
3358
- fullScreen: isTablet,
3359
- $tablet: isTablet
3360
- }, isTablet ? /*#__PURE__*/React__default.createElement(InvoiceScrollArea, null, /*#__PURE__*/React__default.createElement("iframe", {
3361
- src: invoiceModal.url,
3362
- title: "Invoice preview",
3363
- onLoad: handleInvoiceIframeLoad
3364
- })) : /*#__PURE__*/React__default.createElement(DialogContent, {
3605
+ maxWidth: "lg"
3606
+ }, /*#__PURE__*/React__default.createElement(DialogContent, {
3365
3607
  dividers: true
3366
- }, /*#__PURE__*/React__default.createElement("iframe", {
3367
- src: invoiceModal.url,
3368
- title: "Invoice preview"
3608
+ }, showPdfViewer ? /*#__PURE__*/React__default.createElement(ViewPdf, {
3609
+ src: invoiceModal === null || invoiceModal === void 0 ? void 0 : invoiceModal.url,
3610
+ onRequestClose: function onRequestClose() {
3611
+ return setInvoiceModal({
3612
+ open: false
3613
+ });
3614
+ }
3615
+ }) : /*#__PURE__*/React__default.createElement("iframe", {
3616
+ src: invoiceModal === null || invoiceModal === void 0 ? void 0 : invoiceModal.url
3369
3617
  }))), /*#__PURE__*/React__default.createElement(APITable, {
3370
3618
  key: value,
3371
3619
  cacheFilters: true,
@@ -3632,12 +3880,8 @@ var StatusContainer = styled(Stack)(_templateObject16 || (_templateObject16 = _t
3632
3880
  return props.primaryColor;
3633
3881
  });
3634
3882
  var TableContainer = styled.div(_templateObject17 || (_templateObject17 = _taggedTemplateLiteralLoose(["\n margin-top: 2rem;\n border-radius: 14px;\n"])));
3635
- 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) {
3636
- var $tablet = _ref3.$tablet;
3637
- return $tablet && "\n .MuiDialog-container {\n overscroll-behavior: none;\n }\n\n .MuiDialog-paper {\n display: flex;\n flex-direction: column;\n overflow: hidden;\n height: 100%;\n max-height: 100%;\n margin: 0;\n }\n ";
3638
- });
3639
- var InvoiceScrollArea = styled.div(_templateObject19 || (_templateObject19 = _taggedTemplateLiteralLoose(["\n overflow-y: auto;\n overflow-x: hidden;\n -webkit-overflow-scrolling: touch;\n overscroll-behavior: contain;\n touch-action: pan-y;\n flex: 1;\n min-height: 0;\n width: 100%;\n height: 100%;\n\n iframe {\n width: 100%;\n border: none;\n display: block;\n pointer-events: none;\n }\n"])));
3640
- var TabsContainer = styled(Tabs)(_templateObject20 || (_templateObject20 = _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) {
3883
+ var InvoiceDialog = styled(Dialog)(_templateObject18 || (_templateObject18 = _taggedTemplateLiteralLoose(["\n .MuiDialog-paper {\n width: 100%;\n max-width: 900px;\n }\n\n iframe {\n width: 900px;\n max-width: 100%;\n border: none;\n height: 600px;\n }\n"])));
3884
+ 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) {
3641
3885
  return props.fontColor;
3642
3886
  }, function (props) {
3643
3887
  return props.primaryColor;
@@ -4951,7 +5195,7 @@ var getDropzoneRejectionError = function getDropzoneRejectionError(fileRejection
4951
5195
  return (error === null || error === void 0 ? void 0 : error.message) || 'Invalid file';
4952
5196
  };
4953
5197
 
4954
- var _templateObject$k, _templateObject2$c, _templateObject3$8, _templateObject4$6, _templateObject5$4, _templateObject6$3, _templateObject7$2, _templateObject8$2, _templateObject9$2, _templateObject10$2, _templateObject11$2, _templateObject12$1, _templateObject13$1, _templateObject14$1, _templateObject15$1, _templateObject16$1, _templateObject17$1, _templateObject18$1, _templateObject19$1, _templateObject20$1, _templateObject21, _templateObject22, _templateObject23, _templateObject24, _templateObject25, _templateObject26, _templateObject27, _templateObject28, _templateObject29, _templateObject30, _templateObject31, _templateObject32, _templateObject33, _templateObject34;
5198
+ var _templateObject$k, _templateObject2$c, _templateObject3$8, _templateObject4$6, _templateObject5$4, _templateObject6$3, _templateObject7$2, _templateObject8$2, _templateObject9$2, _templateObject10$2, _templateObject11$2, _templateObject12$1, _templateObject13$1, _templateObject14$1, _templateObject15$1, _templateObject16$1, _templateObject17$1, _templateObject18$1, _templateObject19$1, _templateObject20, _templateObject21, _templateObject22, _templateObject23, _templateObject24, _templateObject25, _templateObject26, _templateObject27, _templateObject28, _templateObject29, _templateObject30, _templateObject31, _templateObject32, _templateObject33, _templateObject34;
4955
5199
  var DEFAULT_PRIMARY_COLOR = "#437c0f";
4956
5200
  var Container = styled.div(_templateObject$k || (_templateObject$k = _taggedTemplateLiteralLoose(["\n width: 100%;\n min-height: 80vh;\n display: flex;\n justify-content: center;\n align-items: center;\n background: #f6f6f6;\n padding: 2rem 1rem;\n"])));
4957
5201
  var Card = styled.div(_templateObject2$c || (_templateObject2$c = _taggedTemplateLiteralLoose(["\n width: min(100%, 720px);\n background: #fff;\n border: 1px solid #cac8c8;\n border-radius: 8px;\n padding: 1.5rem;\n"])));
@@ -4991,7 +5235,7 @@ var DropzoneBtn = styled.span(_templateObject16$1 || (_templateObject16$1 = _tag
4991
5235
  var DropzoneText = styled.span(_templateObject17$1 || (_templateObject17$1 = _taggedTemplateLiteralLoose(["\n font-size: 0.875rem;\n color: #666;\n"])));
4992
5236
  var DropzoneError = styled.p(_templateObject18$1 || (_templateObject18$1 = _taggedTemplateLiteralLoose(["\n margin: 0.5rem 0 0;\n font-size: 0.8rem;\n color: #c62828;\n"])));
4993
5237
  var SelectedFileRow = styled.div(_templateObject19$1 || (_templateObject19$1 = _taggedTemplateLiteralLoose(["\n display: flex;\n align-items: center;\n justify-content: space-between;\n gap: 1rem;\n padding: 0.6rem 0.75rem;\n border: 1px solid #e0e0e0;\n border-radius: 6px;\n background: #fafafa;\n"])));
4994
- var SelectedFileInfo = styled.div(_templateObject20$1 || (_templateObject20$1 = _taggedTemplateLiteralLoose(["\n display: flex;\n align-items: center;\n gap: 0.5rem;\n min-width: 0;\n flex: 1;\n"])));
5238
+ var SelectedFileInfo = styled.div(_templateObject20 || (_templateObject20 = _taggedTemplateLiteralLoose(["\n display: flex;\n align-items: center;\n gap: 0.5rem;\n min-width: 0;\n flex: 1;\n"])));
4995
5239
  var SelectedFileName = styled.span(_templateObject21 || (_templateObject21 = _taggedTemplateLiteralLoose(["\n font-size: 0.875rem;\n color: #333;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n"])));
4996
5240
  var ClearFileBtn = styled.button(_templateObject22 || (_templateObject22 = _taggedTemplateLiteralLoose(["\n display: flex;\n align-items: center;\n justify-content: center;\n padding: 0;\n border: none;\n background: none;\n color: #c62828;\n font-size: 1.1rem;\n cursor: pointer;\n flex-shrink: 0;\n\n &:disabled {\n opacity: 0.5;\n cursor: not-allowed;\n }\n"])));
4997
5241
  var UploadedFiles = styled.ul(_templateObject23 || (_templateObject23 = _taggedTemplateLiteralLoose(["\n margin: 0;\n padding: 0;\n list-style: none;\n display: flex;\n flex-direction: column;\n gap: 0.5rem;\n\n li {\n display: flex;\n align-items: center;\n gap: 0.75rem;\n font-size: 0.875rem;\n color: #555;\n padding: 0.65rem 0.75rem;\n background: #fff;\n border: 1px solid #eee;\n border-radius: 4px;\n }\n"])));
@@ -5340,7 +5584,9 @@ var AccountDetails = function AccountDetails(_ref) {
5340
5584
  _ref$hideSalesOrderTa = _ref.hideSalesOrderTab,
5341
5585
  hideSalesOrderTab = _ref$hideSalesOrderTa === void 0 ? false : _ref$hideSalesOrderTa,
5342
5586
  _ref$hideInvoiceTab = _ref.hideInvoiceTab,
5343
- hideInvoiceTab = _ref$hideInvoiceTab === void 0 ? false : _ref$hideInvoiceTab;
5587
+ hideInvoiceTab = _ref$hideInvoiceTab === void 0 ? false : _ref$hideInvoiceTab,
5588
+ _ref$showPdfViewer = _ref.showPdfViewer,
5589
+ showPdfViewer = _ref$showPdfViewer === void 0 ? false : _ref$showPdfViewer;
5344
5590
  var _useAllSystemFeatureV = useAllSystemFeatureValues({
5345
5591
  apiEndPoint: apiEndPoint,
5346
5592
  token: token
@@ -5513,7 +5759,8 @@ var AccountDetails = function AccountDetails(_ref) {
5513
5759
  showOnlyRecentOrder: showOnlyRecentOrder,
5514
5760
  hidePayActionButton: hidePayActionButton,
5515
5761
  hideSalesOrderTab: hideSalesOrderTab,
5516
- hideInvoiceTab: hideInvoiceTab
5762
+ hideInvoiceTab: hideInvoiceTab,
5763
+ showPdfViewer: showPdfViewer
5517
5764
  });
5518
5765
  case 'myProfile':
5519
5766
  return /*#__PURE__*/React__default.createElement(MyProfile, {