@liiift-studio/sales-portal 3.1.5 → 3.1.6

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.
@@ -706,56 +706,53 @@ export default function Sales(props) {
706
706
  const portalIndex = allPortals.indexOf(currentPortal) + 1;
707
707
 
708
708
  style.textContent = `
709
- @media print {
710
- @page {
711
- size: letter portrait;
712
- margin: 0.5in;
713
- }
714
- /* Hide everything except this sales portal */
715
- header, nav, footer, #navBar, #footer, #titleContainer,
716
- .exportSection, .date-range-sales-table-wrapper,
717
- .salesPortal:not(:nth-child(${portalIndex})) {
718
- display: none !important;
719
- }
720
- .salesPortal, .salesPortalWrap {
721
- background: white !important;
722
- }
723
- body {
724
- -webkit-print-color-adjust: exact !important;
725
- print-color-adjust: exact !important;
726
- }
727
- /* Clean up layout */
728
- .salesPortal {
729
- padding: 0 !important;
730
- width: 100% !important;
731
- }
732
- .salesPortal > * {
733
- page-break-inside: avoid;
734
- }
735
- /* Hide interactive elements */
736
- button, .MuiIconButton-root, .MuiInput-root,
737
- .MuiDateCalendar-root, .print-button,
738
- .year-overview-wrapper, .sales-chart-wrapper {
739
- display: none !important;
740
- }
741
- /* Full width sections */
742
- .sales-header-section, .sales-data-section,
743
- .insights-wrapper, .sales-table-wrapper {
744
- width: 100% !important;
745
- padding: 0 !important;
746
- margin: 10px 0 !important;
747
- }
748
- /* Readable text */
749
- .MuiTypography-root {
750
- color: black !important;
751
- }
752
- /* Compact cards for print */
753
- .MuiPaper-root {
754
- box-shadow: none !important;
755
- border: 1px solid #ddd !important;
756
- page-break-inside: avoid;
757
- }
758
- }
709
+ @media print {
710
+ @page { size: letter portrait; margin: 0.5in; }
711
+ body { -webkit-print-color-adjust: exact !important; print-color-adjust: exact !important; }
712
+
713
+ /* Hide site chrome and other portals */
714
+ header, nav, footer, #navBar, #footer, #titleContainer,
715
+ .exportSection, .date-range-sales-table-wrapper,
716
+ .salesPortal:not(:nth-child(${portalIndex})) { display: none !important; }
717
+
718
+ /* Hide interactive controls */
719
+ .MuiIconButton-root, .MuiInput-root, .MuiDateCalendar-root,
720
+ .print-button, .MuiFilledInput-root, .MuiFormControl-root { display: none !important; }
721
+
722
+ /* Portal layout */
723
+ .salesPortal, .salesPortalWrap { background: white !important; padding: 0 !important; width: 100% !important; }
724
+
725
+ /* Full width sections */
726
+ .sales-header-section, .sales-data-section, .insights-wrapper, .sales-table-wrapper,
727
+ .sales-chart-wrapper, .year-overview-wrapper, .typeface-list-wrapper,
728
+ .license-type-list-wrapper, .top-performers-wrapper { width: 100% !important; padding: 0 !important; margin: 10px 0 !important; }
729
+
730
+ /* Page break control */
731
+ .insights-wrapper, .top-performers-wrapper, .typeface-list-wrapper,
732
+ .license-type-list-wrapper, .sales-table-wrapper { page-break-inside: avoid; break-inside: avoid; }
733
+
734
+ /* Prevent cutting elements across pages */
735
+ .MuiPaper-root, tr, .designers-section > div,
736
+ .top-performers-section > div, .product-section > div { page-break-inside: avoid; break-inside: avoid; }
737
+
738
+ /* Insight cards: keep dark bg with white text */
739
+ .insights-wrapper .MuiPaper-root { background-color: #000 !important; color: white !important; border: none !important; box-shadow: none !important; }
740
+ .insights-wrapper .MuiTypography-root { color: inherit !important; }
741
+
742
+ /* Other text: black on white */
743
+ .sales-header-section .MuiTypography-root, .typeface-list-wrapper .MuiTypography-root,
744
+ .license-type-list-wrapper .MuiTypography-root, .sales-table-wrapper .MuiTypography-root { color: black !important; }
745
+
746
+ /* Section header bars: keep dark bg */
747
+ .designers-section .MuiTypography-h5, .top-performers-section .MuiTypography-h5,
748
+ .product-section .MuiTypography-h5 { color: white !important; }
749
+
750
+ /* Charts: ensure visible */
751
+ .sales-chart-wrapper, .year-overview-wrapper { max-height: 400px !important; overflow: hidden !important; page-break-inside: avoid; }
752
+
753
+ /* Compact tables */
754
+ .MuiTableCell-root { padding: 4px 8px !important; font-size: 10px !important; }
755
+ }
759
756
  `;
760
757
  document.head.appendChild(style);
761
758
 
@@ -196,7 +196,7 @@ export default function TopPerformers({
196
196
 
197
197
  {/* Individual typefaces for this designer */}
198
198
  {typefaceData
199
- ?.filter(typeface => typeface.author._id === designer._id)
199
+ ?.filter(typeface => typeface.author?._id === designer._id)
200
200
  .map((typeface, j) => (
201
201
  <Typography
202
202
  key={`designer-typeface-${i}-${j}`}
@@ -209,7 +209,7 @@ export default function TopPerformers({
209
209
  }}>
210
210
  {typeface.title}
211
211
  <span className={styles.earningContainer}>
212
- <strong> {(typeface.total / (total + chartState.refundTotal)).toLocaleString('en-US', { minimumFractionDigits: 2, maximumFractionDigits: 2 })}</strong>%
212
+ <strong> {(typeface.total / (total + (chartState?.refundTotal || 0))).toLocaleString('en-US', { minimumFractionDigits: 2, maximumFractionDigits: 2 })}</strong>%
213
213
  </span>
214
214
  <span style={{ opacity: "0.5", textTransform: "none" }}> ({typeface.orders} Orders for a total of </span>
215
215
  <span style={{ opacity: "0.5" }}> USD</span>$<strong>{(typeface.total / 100).toLocaleString('en-US', { minimumFractionDigits: 2 })}</strong>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@liiift-studio/sales-portal",
3
- "version": "3.1.5",
3
+ "version": "3.1.6",
4
4
  "description": "Centralized sales portal package for Liiift Studio projects",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
@@ -446,6 +446,7 @@ export function processDesignersData(typefaceData) {
446
446
  let designersData = [];
447
447
 
448
448
  typefaceData?.forEach(typeface => {
449
+ if (!typeface.author?._id) return;
449
450
  let designer = designersData.find(author => author._id === typeface.author._id);
450
451
  if (designer) {
451
452
  designer.total += typeface.total;