@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.
package/dist/index.js CHANGED
@@ -30,6 +30,7 @@ var xDatePickers = require('@mui/x-date-pickers');
30
30
  var moment$1 = _interopDefault(require('moment/moment'));
31
31
  var router = require('next/router');
32
32
  var Cards = _interopDefault(require('react-credit-cards'));
33
+ var reactPdfViewer = require('@embedpdf/react-pdf-viewer');
33
34
  var hi = require('react-icons/hi');
34
35
  var bs = require('react-icons/bs');
35
36
  var tfi = require('react-icons/tfi');
@@ -2834,7 +2835,286 @@ var InfoContainer = styled__default.div(_templateObject$9 || (_templateObject$9
2834
2835
  return props.fontColor;
2835
2836
  });
2836
2837
 
2837
- 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;
2838
+ var DISABLED_CATEGORIES = ['annotation', 'annotation-shape', 'insert', 'form', 'redaction', 'panel-search', 'panel-comment', 'document-open', 'document-close', 'document-export', 'document-capture', 'document-protect'];
2839
+ var EMPTY_UNSUBSCRIBERS = [];
2840
+ var LOAD_TIMEOUT_MS = 20000;
2841
+ var DEFAULT_ERROR_MESSAGE = 'Unable to load this PDF. Please try again later.';
2842
+ var safeCall = function safeCall(fn) {
2843
+ try {
2844
+ return typeof fn === 'function' ? fn() : undefined;
2845
+ } catch (error) {
2846
+ console.error('[ViewPdf]', error);
2847
+ return undefined;
2848
+ }
2849
+ };
2850
+ var clearSubscriptions = function clearSubscriptions(unsubscribersRef) {
2851
+ var list = unsubscribersRef === null || unsubscribersRef === void 0 ? void 0 : unsubscribersRef.current;
2852
+ if (!Array.isArray(list)) return;
2853
+ list.forEach(function (unsubscribe) {
2854
+ safeCall(unsubscribe);
2855
+ });
2856
+ unsubscribersRef.current = [];
2857
+ };
2858
+ var hideEmptyStateOpenButton = function hideEmptyStateOpenButton(container) {
2859
+ try {
2860
+ var shadow = container === null || container === void 0 ? void 0 : container.shadowRoot;
2861
+ if (!shadow || typeof CSSStyleSheet === 'undefined') return;
2862
+ if (typeof shadow.adoptedStyleSheets === 'undefined') return;
2863
+ var sheet = new CSSStyleSheet();
2864
+ if (typeof (sheet === null || sheet === void 0 ? void 0 : sheet.replaceSync) !== 'function') return;
2865
+ 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 ");
2866
+ var existingSheets = Array.isArray(shadow.adoptedStyleSheets) ? shadow.adoptedStyleSheets : [];
2867
+ shadow.adoptedStyleSheets = [].concat(existingSheets, [sheet]);
2868
+ } catch (error) {
2869
+ console.error('[ViewPdf] Failed to hide open-document UI', error);
2870
+ }
2871
+ };
2872
+ var viewerShellStyle = {
2873
+ position: 'relative',
2874
+ width: '100%',
2875
+ minWidth: 900,
2876
+ minHeight: 600,
2877
+ height: '70vh',
2878
+ boxSizing: 'border-box'
2879
+ };
2880
+ var overlayStyle = {
2881
+ position: 'absolute',
2882
+ inset: 0,
2883
+ zIndex: 2,
2884
+ display: 'flex',
2885
+ flexDirection: 'column',
2886
+ alignItems: 'center',
2887
+ justifyContent: 'center',
2888
+ gap: '0.75rem',
2889
+ background: '#f4f5f7',
2890
+ color: '#4b5563',
2891
+ fontSize: '0.95rem',
2892
+ fontWeight: 600,
2893
+ padding: '1.5rem',
2894
+ textAlign: 'center',
2895
+ boxSizing: 'border-box'
2896
+ };
2897
+ var closeButtonStyle = {
2898
+ marginTop: '0.5rem',
2899
+ padding: '0.5rem 1rem',
2900
+ border: '1px solid #d1d5db',
2901
+ borderRadius: 6,
2902
+ background: '#fff',
2903
+ color: '#374151',
2904
+ fontSize: '0.875rem',
2905
+ fontWeight: 600,
2906
+ cursor: 'pointer'
2907
+ };
2908
+ var getErrorMessage = function getErrorMessage(error) {
2909
+ var _error$reason;
2910
+ if (typeof error === 'string' && error.trim()) return error.trim();
2911
+ if (error !== null && error !== void 0 && error.message && typeof error.message === 'string' && error.message.trim()) {
2912
+ return error.message.trim();
2913
+ }
2914
+ 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()) {
2915
+ return error.reason.message.trim();
2916
+ }
2917
+ if (typeof (error === null || error === void 0 ? void 0 : error.reason) === 'string' && error.reason.trim()) {
2918
+ return error.reason.trim();
2919
+ }
2920
+ return DEFAULT_ERROR_MESSAGE;
2921
+ };
2922
+ var syncDocumentStates = function syncDocumentStates(documentManager, onLoaded, onError) {
2923
+ var documents = typeof (documentManager === null || documentManager === void 0 ? void 0 : documentManager.getOpenDocuments) === 'function' ? documentManager.getOpenDocuments() : [];
2924
+ if (!Array.isArray(documents) || documents.length === 0) return false;
2925
+ var errored = documents.find(function (doc) {
2926
+ return (doc === null || doc === void 0 ? void 0 : doc.status) === 'error';
2927
+ });
2928
+ if (errored) {
2929
+ onError((errored === null || errored === void 0 ? void 0 : errored.error) || DEFAULT_ERROR_MESSAGE);
2930
+ return true;
2931
+ }
2932
+ var loaded = documents.find(function (doc) {
2933
+ return (doc === null || doc === void 0 ? void 0 : doc.status) === 'loaded';
2934
+ });
2935
+ if (loaded) {
2936
+ onLoaded();
2937
+ return true;
2938
+ }
2939
+ return false;
2940
+ };
2941
+ var ViewPdf = function ViewPdf(_ref) {
2942
+ var _ref$src = _ref.src,
2943
+ src = _ref$src === void 0 ? '' : _ref$src,
2944
+ onRequestClose = _ref.onRequestClose;
2945
+ var _useState = React.useState(Boolean(src)),
2946
+ isLoading = _useState[0],
2947
+ setIsLoading = _useState[1];
2948
+ var _useState2 = React.useState(''),
2949
+ loadError = _useState2[0],
2950
+ setLoadError = _useState2[1];
2951
+ var hadLoadErrorRef = React.useRef(false);
2952
+ var isMountedRef = React.useRef(true);
2953
+ var loadFinishedRef = React.useRef(false);
2954
+ var unsubscribersRef = React.useRef(EMPTY_UNSUBSCRIBERS);
2955
+ var timeoutRef = React.useRef(null);
2956
+ var pdfSrc = typeof src === 'string' ? src.trim() : '';
2957
+ var clearLoadTimeout = React.useCallback(function () {
2958
+ if (timeoutRef.current) {
2959
+ clearTimeout(timeoutRef.current);
2960
+ timeoutRef.current = null;
2961
+ }
2962
+ }, []);
2963
+ React.useEffect(function () {
2964
+ isMountedRef.current = true;
2965
+ return function () {
2966
+ isMountedRef.current = false;
2967
+ clearLoadTimeout();
2968
+ clearSubscriptions(unsubscribersRef);
2969
+ };
2970
+ }, [clearLoadTimeout]);
2971
+ React.useEffect(function () {
2972
+ hadLoadErrorRef.current = false;
2973
+ loadFinishedRef.current = false;
2974
+ clearLoadTimeout();
2975
+ setLoadError('');
2976
+ setIsLoading(Boolean(pdfSrc));
2977
+ }, [pdfSrc, clearLoadTimeout]);
2978
+ var finishWithError = React.useCallback(function (error) {
2979
+ if (loadFinishedRef.current || !isMountedRef.current) return;
2980
+ loadFinishedRef.current = true;
2981
+ clearLoadTimeout();
2982
+ hadLoadErrorRef.current = true;
2983
+ setIsLoading(false);
2984
+ setLoadError(getErrorMessage(error));
2985
+ }, [clearLoadTimeout]);
2986
+ var finishWithSuccess = React.useCallback(function () {
2987
+ if (loadFinishedRef.current || !isMountedRef.current) return;
2988
+ loadFinishedRef.current = true;
2989
+ clearLoadTimeout();
2990
+ hadLoadErrorRef.current = false;
2991
+ setLoadError('');
2992
+ setIsLoading(false);
2993
+ }, [clearLoadTimeout]);
2994
+ var handleInit = React.useCallback(function (container) {
2995
+ hideEmptyStateOpenButton(container);
2996
+ }, []);
2997
+ var handleReady = React.useCallback(function (registry) {
2998
+ try {
2999
+ var _registry$getPlugin, _registry$getPlugin$c, _registry$getPlugin$c2;
3000
+ clearSubscriptions(unsubscribersRef);
3001
+ loadFinishedRef.current = false;
3002
+ clearLoadTimeout();
3003
+ 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);
3004
+ if (!documentManager) {
3005
+ finishWithError('Unable to initialize the PDF viewer.');
3006
+ return;
3007
+ }
3008
+ var trackUnsubscribe = function trackUnsubscribe(unsubscribe) {
3009
+ if (typeof unsubscribe !== 'function') return;
3010
+ if (!Array.isArray(unsubscribersRef === null || unsubscribersRef === void 0 ? void 0 : unsubscribersRef.current)) {
3011
+ unsubscribersRef.current = [];
3012
+ }
3013
+ unsubscribersRef.current.push(unsubscribe);
3014
+ };
3015
+ if (typeof (documentManager === null || documentManager === void 0 ? void 0 : documentManager.onDocumentError) === 'function') {
3016
+ trackUnsubscribe(documentManager.onDocumentError(function (error) {
3017
+ finishWithError(error);
3018
+ }));
3019
+ }
3020
+ if (typeof (documentManager === null || documentManager === void 0 ? void 0 : documentManager.onDocumentOpened) === 'function') {
3021
+ trackUnsubscribe(documentManager.onDocumentOpened(function () {
3022
+ finishWithSuccess();
3023
+ }));
3024
+ }
3025
+ if (typeof (documentManager === null || documentManager === void 0 ? void 0 : documentManager.onDocumentClosed) === 'function') {
3026
+ trackUnsubscribe(documentManager.onDocumentClosed(function () {
3027
+ if (!(hadLoadErrorRef !== null && hadLoadErrorRef !== void 0 && hadLoadErrorRef.current)) return;
3028
+ hadLoadErrorRef.current = false;
3029
+ if (typeof onRequestClose === 'function') {
3030
+ safeCall(onRequestClose);
3031
+ }
3032
+ }));
3033
+ }
3034
+ if (syncDocumentStates(documentManager, finishWithSuccess, finishWithError)) {
3035
+ return;
3036
+ }
3037
+ if (!pdfSrc || typeof (documentManager === null || documentManager === void 0 ? void 0 : documentManager.openDocumentUrl) !== 'function') {
3038
+ finishWithError('No PDF document provided.');
3039
+ return;
3040
+ }
3041
+ timeoutRef.current = setTimeout(function () {
3042
+ finishWithError('The PDF is taking too long to load. Please try again later.');
3043
+ }, LOAD_TIMEOUT_MS);
3044
+ var openTask = documentManager.openDocumentUrl({
3045
+ url: pdfSrc,
3046
+ autoActivate: true
3047
+ });
3048
+ if (!openTask || typeof openTask.wait !== 'function') {
3049
+ finishWithError(DEFAULT_ERROR_MESSAGE);
3050
+ return;
3051
+ }
3052
+ openTask.wait(function (response) {
3053
+ var loadTask = response === null || response === void 0 ? void 0 : response.task;
3054
+ if (!loadTask || typeof loadTask.wait !== 'function') {
3055
+ syncDocumentStates(documentManager, finishWithSuccess, finishWithError);
3056
+ return;
3057
+ }
3058
+ loadTask.wait(function () {
3059
+ finishWithSuccess();
3060
+ }, function (error) {
3061
+ finishWithError(error);
3062
+ });
3063
+ }, function (error) {
3064
+ finishWithError(error);
3065
+ });
3066
+ } catch (error) {
3067
+ console.error('[ViewPdf] Failed during viewer ready setup', error);
3068
+ finishWithError(error);
3069
+ }
3070
+ }, [clearLoadTimeout, finishWithError, finishWithSuccess, onRequestClose, pdfSrc]);
3071
+ if (!pdfSrc) {
3072
+ return /*#__PURE__*/React__default.createElement("div", {
3073
+ style: _extends({}, viewerShellStyle, overlayStyle, {
3074
+ position: 'relative'
3075
+ })
3076
+ }, /*#__PURE__*/React__default.createElement("span", null, "No PDF document provided."), typeof onRequestClose === 'function' ? /*#__PURE__*/React__default.createElement("button", {
3077
+ type: "button",
3078
+ style: closeButtonStyle,
3079
+ onClick: onRequestClose
3080
+ }, "Close") : null);
3081
+ }
3082
+ return /*#__PURE__*/React__default.createElement("div", {
3083
+ style: viewerShellStyle
3084
+ }, isLoading ? /*#__PURE__*/React__default.createElement("div", {
3085
+ style: overlayStyle,
3086
+ "aria-live": "polite",
3087
+ "aria-busy": "true"
3088
+ }, /*#__PURE__*/React__default.createElement(material.CircularProgress, {
3089
+ size: 28
3090
+ }), /*#__PURE__*/React__default.createElement("span", null, "Loading...")) : null, loadError ? /*#__PURE__*/React__default.createElement("div", {
3091
+ style: overlayStyle,
3092
+ role: "alert",
3093
+ "aria-live": "assertive"
3094
+ }, /*#__PURE__*/React__default.createElement("span", null, loadError), typeof onRequestClose === 'function' ? /*#__PURE__*/React__default.createElement("button", {
3095
+ type: "button",
3096
+ style: closeButtonStyle,
3097
+ onClick: onRequestClose
3098
+ }, "Close") : null) : null, /*#__PURE__*/React__default.createElement(reactPdfViewer.PDFViewer, {
3099
+ key: pdfSrc,
3100
+ style: {
3101
+ height: '100%',
3102
+ width: '100%',
3103
+ minHeight: 600
3104
+ },
3105
+ onInit: handleInit,
3106
+ onReady: handleReady,
3107
+ config: {
3108
+ theme: {
3109
+ preference: 'light'
3110
+ },
3111
+ tabBar: 'never',
3112
+ disabledCategories: DISABLED_CATEGORIES
3113
+ }
3114
+ }));
3115
+ };
3116
+
3117
+ 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;
2838
3118
  var totalIcons = [{
2839
3119
  name: '',
2840
3120
  icon: /*#__PURE__*/React__default.createElement(ai.AiOutlineShoppingCart, null)
@@ -2877,7 +3157,8 @@ var Dashboard = function Dashboard(_ref) {
2877
3157
  showOnlyRecentOrder = _ref$showOnlyRecentOr === void 0 ? false : _ref$showOnlyRecentOr,
2878
3158
  hidePayActionButton = _ref.hidePayActionButton,
2879
3159
  hideInvoiceTab = _ref.hideInvoiceTab,
2880
- hideSalesOrderTab = _ref.hideSalesOrderTab;
3160
+ hideSalesOrderTab = _ref.hideSalesOrderTab,
3161
+ showPdfViewer = _ref.showPdfViewer;
2881
3162
  var _useState = React.useState({}),
2882
3163
  customerData = _useState[0],
2883
3164
  setCustomerData = _useState[1];
@@ -2913,38 +3194,6 @@ var Dashboard = function Dashboard(_ref) {
2913
3194
  var _useState7 = React.useState(0),
2914
3195
  value = _useState7[0],
2915
3196
  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.offsetHeight) || 0, (doc === null || doc === void 0 ? void 0 : (_doc$documentElement = doc.documentElement) === null || _doc$documentElement === void 0 ? void 0 : _doc$documentElement.offsetHeight) || 0);
2924
- if (contentHeight) {
2925
- iframe.style.height = contentHeight + "px";
2926
- }
2927
- } catch (_unused) {}
2928
- };
2929
- React.useEffect(function () {
2930
- if (!isTablet || !invoiceModal.open) return;
2931
- var scrollY = window.scrollY;
2932
- document.body.style.position = 'fixed';
2933
- document.body.style.top = "-" + scrollY + "px";
2934
- document.body.style.left = '0';
2935
- document.body.style.right = '0';
2936
- document.body.style.width = '100%';
2937
- document.body.style.overflow = 'hidden';
2938
- return function () {
2939
- document.body.style.position = '';
2940
- document.body.style.top = '';
2941
- document.body.style.left = '';
2942
- document.body.style.right = '';
2943
- document.body.style.width = '';
2944
- document.body.style.overflow = '';
2945
- window.scrollTo(0, scrollY);
2946
- };
2947
- }, [isTablet, invoiceModal.open]);
2948
3197
  React.useEffect(function () {
2949
3198
  if (hideSalesOrderTab) {
2950
3199
  setValue(1);
@@ -3352,24 +3601,23 @@ var Dashboard = function Dashboard(_ref) {
3352
3601
  })))))), /*#__PURE__*/React__default.createElement(TableContainer, null, /*#__PURE__*/React__default.createElement(InvoiceDialog, {
3353
3602
  onClose: function onClose() {
3354
3603
  return setInvoiceModal({
3355
- open: false,
3356
- url: ''
3604
+ open: false
3357
3605
  });
3358
3606
  },
3359
3607
  "aria-labelledby": "customized-dialog-title",
3360
3608
  open: invoiceModal === null || invoiceModal === void 0 ? void 0 : invoiceModal.open,
3361
- maxWidth: "lg",
3362
- fullScreen: isTablet,
3363
- $tablet: isTablet
3364
- }, isTablet ? /*#__PURE__*/React__default.createElement(InvoiceScrollArea, null, /*#__PURE__*/React__default.createElement("iframe", {
3365
- src: invoiceModal.url,
3366
- title: "Invoice preview",
3367
- onLoad: handleInvoiceIframeLoad
3368
- })) : /*#__PURE__*/React__default.createElement(material.DialogContent, {
3609
+ maxWidth: "lg"
3610
+ }, /*#__PURE__*/React__default.createElement(material.DialogContent, {
3369
3611
  dividers: true
3370
- }, /*#__PURE__*/React__default.createElement("iframe", {
3371
- src: invoiceModal.url,
3372
- title: "Invoice preview"
3612
+ }, showPdfViewer ? /*#__PURE__*/React__default.createElement(ViewPdf, {
3613
+ src: invoiceModal === null || invoiceModal === void 0 ? void 0 : invoiceModal.url,
3614
+ onRequestClose: function onRequestClose() {
3615
+ return setInvoiceModal({
3616
+ open: false
3617
+ });
3618
+ }
3619
+ }) : /*#__PURE__*/React__default.createElement("iframe", {
3620
+ src: invoiceModal === null || invoiceModal === void 0 ? void 0 : invoiceModal.url
3373
3621
  }))), /*#__PURE__*/React__default.createElement(APITable, {
3374
3622
  key: value,
3375
3623
  cacheFilters: true,
@@ -3636,12 +3884,8 @@ var StatusContainer = styled__default(material.Stack)(_templateObject16 || (_tem
3636
3884
  return props.primaryColor;
3637
3885
  });
3638
3886
  var TableContainer = styled__default.div(_templateObject17 || (_templateObject17 = _taggedTemplateLiteralLoose(["\n margin-top: 2rem;\n border-radius: 14px;\n"])));
3639
- 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) {
3640
- var $tablet = _ref3.$tablet;
3641
- 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 ";
3642
- });
3643
- var InvoiceScrollArea = styled__default.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"])));
3644
- var TabsContainer = styled__default(material.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) {
3887
+ var InvoiceDialog = styled__default(material.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"])));
3888
+ 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) {
3645
3889
  return props.fontColor;
3646
3890
  }, function (props) {
3647
3891
  return props.primaryColor;
@@ -4955,7 +5199,7 @@ var getDropzoneRejectionError = function getDropzoneRejectionError(fileRejection
4955
5199
  return (error === null || error === void 0 ? void 0 : error.message) || 'Invalid file';
4956
5200
  };
4957
5201
 
4958
- 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;
5202
+ 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;
4959
5203
  var DEFAULT_PRIMARY_COLOR = "#437c0f";
4960
5204
  var Container = styled__default.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"])));
4961
5205
  var Card = styled__default.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"])));
@@ -4995,7 +5239,7 @@ var DropzoneBtn = styled__default.span(_templateObject16$1 || (_templateObject16
4995
5239
  var DropzoneText = styled__default.span(_templateObject17$1 || (_templateObject17$1 = _taggedTemplateLiteralLoose(["\n font-size: 0.875rem;\n color: #666;\n"])));
4996
5240
  var DropzoneError = styled__default.p(_templateObject18$1 || (_templateObject18$1 = _taggedTemplateLiteralLoose(["\n margin: 0.5rem 0 0;\n font-size: 0.8rem;\n color: #c62828;\n"])));
4997
5241
  var SelectedFileRow = styled__default.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"])));
4998
- var SelectedFileInfo = styled__default.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"])));
5242
+ var SelectedFileInfo = styled__default.div(_templateObject20 || (_templateObject20 = _taggedTemplateLiteralLoose(["\n display: flex;\n align-items: center;\n gap: 0.5rem;\n min-width: 0;\n flex: 1;\n"])));
4999
5243
  var SelectedFileName = styled__default.span(_templateObject21 || (_templateObject21 = _taggedTemplateLiteralLoose(["\n font-size: 0.875rem;\n color: #333;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n"])));
5000
5244
  var ClearFileBtn = styled__default.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"])));
5001
5245
  var UploadedFiles = styled__default.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"])));
@@ -5344,7 +5588,9 @@ var AccountDetails = function AccountDetails(_ref) {
5344
5588
  _ref$hideSalesOrderTa = _ref.hideSalesOrderTab,
5345
5589
  hideSalesOrderTab = _ref$hideSalesOrderTa === void 0 ? false : _ref$hideSalesOrderTa,
5346
5590
  _ref$hideInvoiceTab = _ref.hideInvoiceTab,
5347
- hideInvoiceTab = _ref$hideInvoiceTab === void 0 ? false : _ref$hideInvoiceTab;
5591
+ hideInvoiceTab = _ref$hideInvoiceTab === void 0 ? false : _ref$hideInvoiceTab,
5592
+ _ref$showPdfViewer = _ref.showPdfViewer,
5593
+ showPdfViewer = _ref$showPdfViewer === void 0 ? false : _ref$showPdfViewer;
5348
5594
  var _useAllSystemFeatureV = useAllSystemFeatureValues({
5349
5595
  apiEndPoint: apiEndPoint,
5350
5596
  token: token
@@ -5517,7 +5763,8 @@ var AccountDetails = function AccountDetails(_ref) {
5517
5763
  showOnlyRecentOrder: showOnlyRecentOrder,
5518
5764
  hidePayActionButton: hidePayActionButton,
5519
5765
  hideSalesOrderTab: hideSalesOrderTab,
5520
- hideInvoiceTab: hideInvoiceTab
5766
+ hideInvoiceTab: hideInvoiceTab,
5767
+ showPdfViewer: showPdfViewer
5521
5768
  });
5522
5769
  case 'myProfile':
5523
5770
  return /*#__PURE__*/React__default.createElement(MyProfile, {