medusajs-documents-plugin 1.1.11 → 1.1.12

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.
@@ -91,7 +91,7 @@ const DocumentsPage = () => {
91
91
  const [documents, setDocuments] = react.useState([]);
92
92
  const [loading, setLoading] = react.useState(true);
93
93
  const [searchTerm, setSearchTerm] = react.useState("");
94
- const [typeFilter, setTypeFilter] = react.useState("all");
94
+ const [typeFilter, setTypeFilter] = react.useState("invoice");
95
95
  const [sourceFilter, setSourceFilter] = react.useState("all");
96
96
  const [zohoLiveDocs, setZohoLiveDocs] = react.useState([]);
97
97
  const [loadingZoho, setLoadingZoho] = react.useState(false);
@@ -218,9 +218,10 @@ const DocumentsPage = () => {
218
218
  }
219
219
  }).catch((err) => console.error("Error loading settings:", err));
220
220
  };
221
- const loadZohoLiveDocs = () => {
221
+ const loadZohoLiveDocs = (customType) => {
222
222
  setLoadingZoho(true);
223
- fetch("/admin/documents/zoho/list", { credentials: "include" }).then((res) => res.json()).then((data) => {
223
+ const targetType = customType || (typeFilter === "estimate" ? "estimates" : typeFilter === "payment" ? "payments" : "invoices");
224
+ fetch(`/admin/documents/zoho/list?type=${targetType}`, { credentials: "include" }).then((res) => res.json()).then((data) => {
224
225
  if (data.items) {
225
226
  setZohoLiveDocs(data.items);
226
227
  }
@@ -229,6 +230,7 @@ const DocumentsPage = () => {
229
230
  react.useEffect(() => {
230
231
  loadDocuments();
231
232
  loadSettings();
233
+ loadZohoLiveDocs();
232
234
  }, []);
233
235
  const saveSettings = async () => {
234
236
  setIsSaving(true);
@@ -485,7 +487,19 @@ const DocumentsPage = () => {
485
487
  /* @__PURE__ */ jsxRuntime.jsx(icons.Sparkles, { className: "w-4 h-4 mr-1" }),
486
488
  " Custom Document"
487
489
  ] }),
488
- /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { variant: "transparent", size: "small", onClick: loadDocuments, children: /* @__PURE__ */ jsxRuntime.jsx(icons.ArrowPath, { className: "w-4 h-4" }) })
490
+ /* @__PURE__ */ jsxRuntime.jsx(
491
+ ui.Button,
492
+ {
493
+ variant: "transparent",
494
+ size: "small",
495
+ onClick: () => {
496
+ loadDocuments();
497
+ loadZohoLiveDocs();
498
+ },
499
+ title: "Refresh documents & live Zoho list",
500
+ children: /* @__PURE__ */ jsxRuntime.jsx(icons.ArrowPath, { className: `w-4 h-4 ${loading || loadingZoho ? "animate-spin" : ""}` })
501
+ }
502
+ )
489
503
  ] })
490
504
  ] }),
491
505
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-6 px-6 border-b border-ui-border-base bg-ui-bg-subtle text-sm", children: [
@@ -538,18 +552,32 @@ const DocumentsPage = () => {
538
552
  }
539
553
  ) }),
540
554
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2", children: [
541
- /* @__PURE__ */ jsxRuntime.jsxs(ui.Select, { value: typeFilter, onValueChange: (v) => setTypeFilter(v), children: [
542
- /* @__PURE__ */ jsxRuntime.jsx(ui.Select.Trigger, { size: "small", children: /* @__PURE__ */ jsxRuntime.jsx(ui.Select.Value, { placeholder: "Document Type" }) }),
543
- /* @__PURE__ */ jsxRuntime.jsxs(ui.Select.Content, { children: [
544
- /* @__PURE__ */ jsxRuntime.jsx(ui.Select.Item, { value: "all", children: "All Types" }),
545
- /* @__PURE__ */ jsxRuntime.jsx(ui.Select.Item, { value: "invoice", children: "Invoices" }),
546
- /* @__PURE__ */ jsxRuntime.jsx(ui.Select.Item, { value: "receipt", children: "Receipts" }),
547
- /* @__PURE__ */ jsxRuntime.jsx(ui.Select.Item, { value: "estimate", children: "Estimates / Quotes" }),
548
- /* @__PURE__ */ jsxRuntime.jsx(ui.Select.Item, { value: "job_card", children: "Job Cards" }),
549
- /* @__PURE__ */ jsxRuntime.jsx(ui.Select.Item, { value: "packing_slip", children: "Packing Slips" }),
550
- /* @__PURE__ */ jsxRuntime.jsx(ui.Select.Item, { value: "custom", children: "Custom Documents" })
551
- ] })
552
- ] }),
555
+ /* @__PURE__ */ jsxRuntime.jsxs(
556
+ ui.Select,
557
+ {
558
+ value: typeFilter,
559
+ onValueChange: (v) => {
560
+ setTypeFilter(v);
561
+ if (v === "estimate") {
562
+ loadZohoLiveDocs("estimates");
563
+ } else if (v === "invoice" || v === "all") {
564
+ loadZohoLiveDocs("invoices");
565
+ }
566
+ },
567
+ children: [
568
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Select.Trigger, { size: "small", children: /* @__PURE__ */ jsxRuntime.jsx(ui.Select.Value, { placeholder: "Document Type" }) }),
569
+ /* @__PURE__ */ jsxRuntime.jsxs(ui.Select.Content, { children: [
570
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Select.Item, { value: "all", children: "All Types" }),
571
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Select.Item, { value: "invoice", children: "Invoices" }),
572
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Select.Item, { value: "receipt", children: "Receipts" }),
573
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Select.Item, { value: "estimate", children: "Estimates / Quotes" }),
574
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Select.Item, { value: "job_card", children: "Job Cards" }),
575
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Select.Item, { value: "packing_slip", children: "Packing Slips" }),
576
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Select.Item, { value: "custom", children: "Custom Documents" })
577
+ ] })
578
+ ]
579
+ }
580
+ ),
553
581
  /* @__PURE__ */ jsxRuntime.jsxs(ui.Select, { value: sourceFilter, onValueChange: (v) => setSourceFilter(v), children: [
554
582
  /* @__PURE__ */ jsxRuntime.jsx(ui.Select.Trigger, { size: "small", children: /* @__PURE__ */ jsxRuntime.jsx(ui.Select.Value, { placeholder: "Source" }) }),
555
583
  /* @__PURE__ */ jsxRuntime.jsxs(ui.Select.Content, { children: [
@@ -558,16 +586,16 @@ const DocumentsPage = () => {
558
586
  /* @__PURE__ */ jsxRuntime.jsx(ui.Select.Item, { value: "pdfkit", children: "PDFKit Local" })
559
587
  ] })
560
588
  ] }),
561
- settings.zoho_books_enabled && /* @__PURE__ */ jsxRuntime.jsxs(
589
+ /* @__PURE__ */ jsxRuntime.jsxs(
562
590
  ui.Button,
563
591
  {
564
592
  variant: "secondary",
565
593
  size: "small",
566
- onClick: loadZohoLiveDocs,
594
+ onClick: () => loadZohoLiveDocs(),
567
595
  isLoading: loadingZoho,
568
596
  children: [
569
- /* @__PURE__ */ jsxRuntime.jsx(icons.ArrowPath, { className: "w-3.5 h-3.5 mr-1" }),
570
- " View Live Zoho List"
597
+ /* @__PURE__ */ jsxRuntime.jsx(icons.ArrowPath, { className: `w-3.5 h-3.5 mr-1 ${loadingZoho ? "animate-spin" : ""}` }),
598
+ " Refresh Live Zoho"
571
599
  ]
572
600
  }
573
601
  )
@@ -666,9 +694,34 @@ const DocumentsPage = () => {
666
694
  ] }, doc.id);
667
695
  }) })
668
696
  ] }),
669
- zohoLiveDocs.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mt-8 border border-ui-border-base rounded-lg p-4 bg-ui-bg-subtle", children: [
670
- /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h2", className: "text-sm font-semibold mb-3", children: "Live Zoho Books Invoices" }),
671
- /* @__PURE__ */ jsxRuntime.jsxs(ui.Table, { children: [
697
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mt-8 border border-ui-border-base rounded-lg p-4 bg-ui-bg-subtle", children: [
698
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between mb-3", children: [
699
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2", children: [
700
+ /* @__PURE__ */ jsxRuntime.jsxs(ui.Heading, { level: "h2", className: "text-sm font-semibold", children: [
701
+ "Live Zoho Books Invoices ",
702
+ zohoLiveDocs.length > 0 && `(${zohoLiveDocs.length})`
703
+ ] }),
704
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Badge, { color: "purple", size: "small", children: "Live Cloud Sync" })
705
+ ] }),
706
+ /* @__PURE__ */ jsxRuntime.jsxs(
707
+ ui.Button,
708
+ {
709
+ variant: "transparent",
710
+ size: "small",
711
+ onClick: () => loadZohoLiveDocs(),
712
+ isLoading: loadingZoho,
713
+ className: "text-xs text-ui-fg-muted hover:text-ui-fg-base flex items-center gap-1",
714
+ children: [
715
+ /* @__PURE__ */ jsxRuntime.jsx(icons.ArrowPath, { className: `w-3.5 h-3.5 ${loadingZoho ? "animate-spin" : ""}` }),
716
+ " Refresh Zoho"
717
+ ]
718
+ }
719
+ )
720
+ ] }),
721
+ loadingZoho && zohoLiveDocs.length === 0 ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "py-8 text-center text-ui-fg-muted text-sm", children: "Fetching live documents from Zoho Books..." }) : zohoLiveDocs.length === 0 ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "py-8 text-center text-ui-fg-muted text-sm border border-dashed border-ui-border-base rounded-lg", children: [
722
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "text-sm font-medium", children: "No live Zoho documents found" }),
723
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "text-xs text-ui-fg-subtle mt-1", children: "Ensure Zoho Books credentials are configured in Settings and click Refresh Zoho." })
724
+ ] }) : /* @__PURE__ */ jsxRuntime.jsxs(ui.Table, { children: [
672
725
  /* @__PURE__ */ jsxRuntime.jsx(ui.Table.Header, { children: /* @__PURE__ */ jsxRuntime.jsxs(ui.Table.Row, { children: [
673
726
  /* @__PURE__ */ jsxRuntime.jsx(ui.Table.HeaderCell, { children: "Invoice #" }),
674
727
  /* @__PURE__ */ jsxRuntime.jsx(ui.Table.HeaderCell, { children: "Customer Name" }),
@@ -677,12 +730,12 @@ const DocumentsPage = () => {
677
730
  /* @__PURE__ */ jsxRuntime.jsx(ui.Table.HeaderCell, { children: "Date" })
678
731
  ] }) }),
679
732
  /* @__PURE__ */ jsxRuntime.jsx(ui.Table.Body, { children: zohoLiveDocs.map((zi) => /* @__PURE__ */ jsxRuntime.jsxs(ui.Table.Row, { children: [
680
- /* @__PURE__ */ jsxRuntime.jsx(ui.Table.Cell, { className: "font-medium", children: zi.invoice_number }),
681
- /* @__PURE__ */ jsxRuntime.jsx(ui.Table.Cell, { children: zi.customer_name }),
682
- /* @__PURE__ */ jsxRuntime.jsx(ui.Table.Cell, { children: zi.total }),
683
- /* @__PURE__ */ jsxRuntime.jsx(ui.Table.Cell, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Badge, { color: zi.status === "paid" ? "green" : "red", size: "small", children: zi.status }) }),
684
- /* @__PURE__ */ jsxRuntime.jsx(ui.Table.Cell, { children: zi.date })
685
- ] }, zi.invoice_id)) })
733
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Table.Cell, { className: "font-medium", children: zi.invoice_number || zi.estimate_number || zi.payment_number || "—" }),
734
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Table.Cell, { children: zi.customer_name || "—" }),
735
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Table.Cell, { children: zi.total != null ? `${zi.currency_symbol || ""}${zi.total}` : zi.amount != null ? `${zi.currency_symbol || ""}${zi.amount}` : "—" }),
736
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Table.Cell, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Badge, { color: zi.status === "paid" ? "green" : zi.status === "overdue" ? "red" : "blue", size: "small", children: zi.status || "draft" }) }),
737
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Table.Cell, { children: zi.date || "—" })
738
+ ] }, zi.invoice_id || zi.estimate_id || zi.payment_id || `${zi.invoice_number}-${zi.date}`)) })
686
739
  ] })
687
740
  ] })
688
741
  ] }),
@@ -90,7 +90,7 @@ const DocumentsPage = () => {
90
90
  const [documents, setDocuments] = useState([]);
91
91
  const [loading, setLoading] = useState(true);
92
92
  const [searchTerm, setSearchTerm] = useState("");
93
- const [typeFilter, setTypeFilter] = useState("all");
93
+ const [typeFilter, setTypeFilter] = useState("invoice");
94
94
  const [sourceFilter, setSourceFilter] = useState("all");
95
95
  const [zohoLiveDocs, setZohoLiveDocs] = useState([]);
96
96
  const [loadingZoho, setLoadingZoho] = useState(false);
@@ -217,9 +217,10 @@ const DocumentsPage = () => {
217
217
  }
218
218
  }).catch((err) => console.error("Error loading settings:", err));
219
219
  };
220
- const loadZohoLiveDocs = () => {
220
+ const loadZohoLiveDocs = (customType) => {
221
221
  setLoadingZoho(true);
222
- fetch("/admin/documents/zoho/list", { credentials: "include" }).then((res) => res.json()).then((data) => {
222
+ const targetType = customType || (typeFilter === "estimate" ? "estimates" : typeFilter === "payment" ? "payments" : "invoices");
223
+ fetch(`/admin/documents/zoho/list?type=${targetType}`, { credentials: "include" }).then((res) => res.json()).then((data) => {
223
224
  if (data.items) {
224
225
  setZohoLiveDocs(data.items);
225
226
  }
@@ -228,6 +229,7 @@ const DocumentsPage = () => {
228
229
  useEffect(() => {
229
230
  loadDocuments();
230
231
  loadSettings();
232
+ loadZohoLiveDocs();
231
233
  }, []);
232
234
  const saveSettings = async () => {
233
235
  setIsSaving(true);
@@ -484,7 +486,19 @@ const DocumentsPage = () => {
484
486
  /* @__PURE__ */ jsx(Sparkles, { className: "w-4 h-4 mr-1" }),
485
487
  " Custom Document"
486
488
  ] }),
487
- /* @__PURE__ */ jsx(Button, { variant: "transparent", size: "small", onClick: loadDocuments, children: /* @__PURE__ */ jsx(ArrowPath, { className: "w-4 h-4" }) })
489
+ /* @__PURE__ */ jsx(
490
+ Button,
491
+ {
492
+ variant: "transparent",
493
+ size: "small",
494
+ onClick: () => {
495
+ loadDocuments();
496
+ loadZohoLiveDocs();
497
+ },
498
+ title: "Refresh documents & live Zoho list",
499
+ children: /* @__PURE__ */ jsx(ArrowPath, { className: `w-4 h-4 ${loading || loadingZoho ? "animate-spin" : ""}` })
500
+ }
501
+ )
488
502
  ] })
489
503
  ] }),
490
504
  /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-6 px-6 border-b border-ui-border-base bg-ui-bg-subtle text-sm", children: [
@@ -537,18 +551,32 @@ const DocumentsPage = () => {
537
551
  }
538
552
  ) }),
539
553
  /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
540
- /* @__PURE__ */ jsxs(Select, { value: typeFilter, onValueChange: (v) => setTypeFilter(v), children: [
541
- /* @__PURE__ */ jsx(Select.Trigger, { size: "small", children: /* @__PURE__ */ jsx(Select.Value, { placeholder: "Document Type" }) }),
542
- /* @__PURE__ */ jsxs(Select.Content, { children: [
543
- /* @__PURE__ */ jsx(Select.Item, { value: "all", children: "All Types" }),
544
- /* @__PURE__ */ jsx(Select.Item, { value: "invoice", children: "Invoices" }),
545
- /* @__PURE__ */ jsx(Select.Item, { value: "receipt", children: "Receipts" }),
546
- /* @__PURE__ */ jsx(Select.Item, { value: "estimate", children: "Estimates / Quotes" }),
547
- /* @__PURE__ */ jsx(Select.Item, { value: "job_card", children: "Job Cards" }),
548
- /* @__PURE__ */ jsx(Select.Item, { value: "packing_slip", children: "Packing Slips" }),
549
- /* @__PURE__ */ jsx(Select.Item, { value: "custom", children: "Custom Documents" })
550
- ] })
551
- ] }),
554
+ /* @__PURE__ */ jsxs(
555
+ Select,
556
+ {
557
+ value: typeFilter,
558
+ onValueChange: (v) => {
559
+ setTypeFilter(v);
560
+ if (v === "estimate") {
561
+ loadZohoLiveDocs("estimates");
562
+ } else if (v === "invoice" || v === "all") {
563
+ loadZohoLiveDocs("invoices");
564
+ }
565
+ },
566
+ children: [
567
+ /* @__PURE__ */ jsx(Select.Trigger, { size: "small", children: /* @__PURE__ */ jsx(Select.Value, { placeholder: "Document Type" }) }),
568
+ /* @__PURE__ */ jsxs(Select.Content, { children: [
569
+ /* @__PURE__ */ jsx(Select.Item, { value: "all", children: "All Types" }),
570
+ /* @__PURE__ */ jsx(Select.Item, { value: "invoice", children: "Invoices" }),
571
+ /* @__PURE__ */ jsx(Select.Item, { value: "receipt", children: "Receipts" }),
572
+ /* @__PURE__ */ jsx(Select.Item, { value: "estimate", children: "Estimates / Quotes" }),
573
+ /* @__PURE__ */ jsx(Select.Item, { value: "job_card", children: "Job Cards" }),
574
+ /* @__PURE__ */ jsx(Select.Item, { value: "packing_slip", children: "Packing Slips" }),
575
+ /* @__PURE__ */ jsx(Select.Item, { value: "custom", children: "Custom Documents" })
576
+ ] })
577
+ ]
578
+ }
579
+ ),
552
580
  /* @__PURE__ */ jsxs(Select, { value: sourceFilter, onValueChange: (v) => setSourceFilter(v), children: [
553
581
  /* @__PURE__ */ jsx(Select.Trigger, { size: "small", children: /* @__PURE__ */ jsx(Select.Value, { placeholder: "Source" }) }),
554
582
  /* @__PURE__ */ jsxs(Select.Content, { children: [
@@ -557,16 +585,16 @@ const DocumentsPage = () => {
557
585
  /* @__PURE__ */ jsx(Select.Item, { value: "pdfkit", children: "PDFKit Local" })
558
586
  ] })
559
587
  ] }),
560
- settings.zoho_books_enabled && /* @__PURE__ */ jsxs(
588
+ /* @__PURE__ */ jsxs(
561
589
  Button,
562
590
  {
563
591
  variant: "secondary",
564
592
  size: "small",
565
- onClick: loadZohoLiveDocs,
593
+ onClick: () => loadZohoLiveDocs(),
566
594
  isLoading: loadingZoho,
567
595
  children: [
568
- /* @__PURE__ */ jsx(ArrowPath, { className: "w-3.5 h-3.5 mr-1" }),
569
- " View Live Zoho List"
596
+ /* @__PURE__ */ jsx(ArrowPath, { className: `w-3.5 h-3.5 mr-1 ${loadingZoho ? "animate-spin" : ""}` }),
597
+ " Refresh Live Zoho"
570
598
  ]
571
599
  }
572
600
  )
@@ -665,9 +693,34 @@ const DocumentsPage = () => {
665
693
  ] }, doc.id);
666
694
  }) })
667
695
  ] }),
668
- zohoLiveDocs.length > 0 && /* @__PURE__ */ jsxs("div", { className: "mt-8 border border-ui-border-base rounded-lg p-4 bg-ui-bg-subtle", children: [
669
- /* @__PURE__ */ jsx(Heading, { level: "h2", className: "text-sm font-semibold mb-3", children: "Live Zoho Books Invoices" }),
670
- /* @__PURE__ */ jsxs(Table, { children: [
696
+ /* @__PURE__ */ jsxs("div", { className: "mt-8 border border-ui-border-base rounded-lg p-4 bg-ui-bg-subtle", children: [
697
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between mb-3", children: [
698
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
699
+ /* @__PURE__ */ jsxs(Heading, { level: "h2", className: "text-sm font-semibold", children: [
700
+ "Live Zoho Books Invoices ",
701
+ zohoLiveDocs.length > 0 && `(${zohoLiveDocs.length})`
702
+ ] }),
703
+ /* @__PURE__ */ jsx(Badge, { color: "purple", size: "small", children: "Live Cloud Sync" })
704
+ ] }),
705
+ /* @__PURE__ */ jsxs(
706
+ Button,
707
+ {
708
+ variant: "transparent",
709
+ size: "small",
710
+ onClick: () => loadZohoLiveDocs(),
711
+ isLoading: loadingZoho,
712
+ className: "text-xs text-ui-fg-muted hover:text-ui-fg-base flex items-center gap-1",
713
+ children: [
714
+ /* @__PURE__ */ jsx(ArrowPath, { className: `w-3.5 h-3.5 ${loadingZoho ? "animate-spin" : ""}` }),
715
+ " Refresh Zoho"
716
+ ]
717
+ }
718
+ )
719
+ ] }),
720
+ loadingZoho && zohoLiveDocs.length === 0 ? /* @__PURE__ */ jsx("div", { className: "py-8 text-center text-ui-fg-muted text-sm", children: "Fetching live documents from Zoho Books..." }) : zohoLiveDocs.length === 0 ? /* @__PURE__ */ jsxs("div", { className: "py-8 text-center text-ui-fg-muted text-sm border border-dashed border-ui-border-base rounded-lg", children: [
721
+ /* @__PURE__ */ jsx(Text, { className: "text-sm font-medium", children: "No live Zoho documents found" }),
722
+ /* @__PURE__ */ jsx(Text, { className: "text-xs text-ui-fg-subtle mt-1", children: "Ensure Zoho Books credentials are configured in Settings and click Refresh Zoho." })
723
+ ] }) : /* @__PURE__ */ jsxs(Table, { children: [
671
724
  /* @__PURE__ */ jsx(Table.Header, { children: /* @__PURE__ */ jsxs(Table.Row, { children: [
672
725
  /* @__PURE__ */ jsx(Table.HeaderCell, { children: "Invoice #" }),
673
726
  /* @__PURE__ */ jsx(Table.HeaderCell, { children: "Customer Name" }),
@@ -676,12 +729,12 @@ const DocumentsPage = () => {
676
729
  /* @__PURE__ */ jsx(Table.HeaderCell, { children: "Date" })
677
730
  ] }) }),
678
731
  /* @__PURE__ */ jsx(Table.Body, { children: zohoLiveDocs.map((zi) => /* @__PURE__ */ jsxs(Table.Row, { children: [
679
- /* @__PURE__ */ jsx(Table.Cell, { className: "font-medium", children: zi.invoice_number }),
680
- /* @__PURE__ */ jsx(Table.Cell, { children: zi.customer_name }),
681
- /* @__PURE__ */ jsx(Table.Cell, { children: zi.total }),
682
- /* @__PURE__ */ jsx(Table.Cell, { children: /* @__PURE__ */ jsx(Badge, { color: zi.status === "paid" ? "green" : "red", size: "small", children: zi.status }) }),
683
- /* @__PURE__ */ jsx(Table.Cell, { children: zi.date })
684
- ] }, zi.invoice_id)) })
732
+ /* @__PURE__ */ jsx(Table.Cell, { className: "font-medium", children: zi.invoice_number || zi.estimate_number || zi.payment_number || "—" }),
733
+ /* @__PURE__ */ jsx(Table.Cell, { children: zi.customer_name || "—" }),
734
+ /* @__PURE__ */ jsx(Table.Cell, { children: zi.total != null ? `${zi.currency_symbol || ""}${zi.total}` : zi.amount != null ? `${zi.currency_symbol || ""}${zi.amount}` : "—" }),
735
+ /* @__PURE__ */ jsx(Table.Cell, { children: /* @__PURE__ */ jsx(Badge, { color: zi.status === "paid" ? "green" : zi.status === "overdue" ? "red" : "blue", size: "small", children: zi.status || "draft" }) }),
736
+ /* @__PURE__ */ jsx(Table.Cell, { children: zi.date || "—" })
737
+ ] }, zi.invoice_id || zi.estimate_id || zi.payment_id || `${zi.invoice_number}-${zi.date}`)) })
685
738
  ] })
686
739
  ] })
687
740
  ] }),
package/CHANGELOG.md CHANGED
@@ -7,6 +7,23 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ---
9
9
 
10
+ ## [1.1.12] - 2026-10-16
11
+
12
+ ### Admin UI Enhancements: Auto-fetch Live Zoho Documents & Invoices Default Filter
13
+
14
+ - **Persistent Live Zoho Books Invoices Section**:
15
+ - The live Zoho Books documents table is now permanently visible on the All Documents tab instead of hiding when unpopulated.
16
+ - Added dedicated loading state ("Fetching live documents from Zoho Books...") and empty state guidance.
17
+ - Added localized "Refresh Zoho" action button directly in the section header.
18
+ - **Auto-Fetch on Mount & Global Refresh Integration**:
19
+ - Automatically fetches live Zoho invoices upon mounting the documents admin route (`useEffect`).
20
+ - Integrated live Zoho fetching into the global toolbar refresh button to update both local documents and Zoho cloud documents simultaneously with spinning feedback.
21
+ - Linked document type filter dropdown changes to trigger synchronous live Zoho document category lookups (`invoices` vs `estimates`).
22
+ - **Default Document Filter**:
23
+ - Initialized default `typeFilter` to `"invoice"` (Invoices) when opening the Documents Hub.
24
+
25
+ ---
26
+
10
27
  ## [1.1.10] - 2026-10-16
11
28
 
12
29
  ### Documentation & Registration Safeguards
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "medusajs-documents-plugin",
3
- "version": "1.1.11",
3
+ "version": "1.1.12",
4
4
  "description": "Comprehensive document generation and management module for Medusa v2 with Zoho Books integration, PDFKit fallback, QR codes, shortlinks, multi-channel notifications and unified admin hub.",
5
5
  "author": "Urban Device Care <info@urbandevicecare.co.uk>",
6
6
  "license": "MIT",