@liiift-studio/sales-portal 3.1.5 → 3.1.8

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.
@@ -33,8 +33,8 @@ export default function LoginForm({
33
33
 
34
34
  const {
35
35
  title = 'Sales Portal',
36
- description = 'A comprehensive dashboard for type designers to track their typeface sales performance and revenue.',
37
- subtitle = 'All sales are reviewed internally before payouts. Contact support if you have questions about your sales data.',
36
+ description = 'Track your typeface sales, monitor revenue trends, and gain insights into how your work is performing across the foundry.',
37
+ subtitle = 'Sales data is reviewed internally before payouts are issued. If something looks off, reach out to us.',
38
38
  buttonLabel = 'Login',
39
39
  errorMessage = 'Incorrect username/password or the user is not a designer.',
40
40
  emptyFieldsMessage = 'Please enter a username and password.',
@@ -695,67 +695,63 @@ export default function Sales(props) {
695
695
  <Box sx={{ display: { xs: 'none', md: 'flex' } }}>
696
696
  <IconButton
697
697
  className='print-button'
698
- onClick={() => {
698
+ onClick={(e) => {
699
699
  // Add print-specific styles to the document
700
700
  const style = document.createElement('style');
701
701
  style.id = 'print-style';
702
702
  // Find the current salesPortal containing the clicked print button
703
- const printButton = document.querySelector('.print-button:hover');
704
- const currentPortal = printButton.closest('.salesPortal');
703
+ const currentPortal = e.currentTarget.closest('.salesPortal');
705
704
  const allPortals = Array.from(document.querySelectorAll('.salesPortal'));
706
705
  const portalIndex = allPortals.indexOf(currentPortal) + 1;
707
706
 
708
707
  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
- }
708
+ @media print {
709
+ @page { size: letter portrait; margin: 0.5in; }
710
+ body { -webkit-print-color-adjust: exact !important; print-color-adjust: exact !important; }
711
+
712
+ /* Hide site chrome and other portals */
713
+ header, nav, footer, #navBar, #footer, #titleContainer,
714
+ .exportSection, .date-range-sales-table-wrapper,
715
+ .salesPortal:not(:nth-child(${portalIndex})) { display: none !important; }
716
+
717
+ /* Hide interactive controls */
718
+ .MuiIconButton-root, .MuiInput-root, .MuiDateCalendar-root,
719
+ .print-button, .MuiFilledInput-root, .MuiFormControl-root { display: none !important; }
720
+
721
+ /* Portal layout */
722
+ .salesPortal, .salesPortalWrap { background: white !important; padding: 0 !important; width: 100% !important; }
723
+
724
+ /* Full width sections */
725
+ .sales-header-section, .sales-data-section, .insights-wrapper, .sales-table-wrapper,
726
+ .sales-chart-wrapper, .year-overview-wrapper, .typeface-list-wrapper,
727
+ .license-type-list-wrapper, .top-performers-wrapper { width: 100% !important; padding: 0 !important; margin: 10px 0 !important; }
728
+
729
+ /* Page break control */
730
+ .insights-wrapper, .top-performers-wrapper, .typeface-list-wrapper,
731
+ .license-type-list-wrapper, .sales-table-wrapper { page-break-inside: avoid; break-inside: avoid; }
732
+
733
+ /* Prevent cutting elements across pages */
734
+ .MuiPaper-root, tr, .designers-section > div,
735
+ .top-performers-section > div, .product-section > div { page-break-inside: avoid; break-inside: avoid; }
736
+
737
+ /* Insight cards: keep dark bg with white text */
738
+ .insights-wrapper .MuiPaper-root { background-color: #000 !important; color: white !important; border: none !important; box-shadow: none !important; }
739
+ .insights-wrapper .MuiTypography-root { color: inherit !important; }
740
+
741
+ /* Other text: black on white */
742
+ .sales-header-section .MuiTypography-root, .typeface-list-wrapper .MuiTypography-root,
743
+ .license-type-list-wrapper .MuiTypography-root, .sales-table-wrapper .MuiTypography-root { color: black !important; }
744
+
745
+ /* Section header bars: keep dark bg */
746
+ .designers-section .MuiTypography-h5, .top-performers-section .MuiTypography-h5,
747
+ .product-section .MuiTypography-h5 { color: white !important; }
748
+
749
+ /* Charts: ensure visible */
750
+ .sales-chart-wrapper, .year-overview-wrapper { max-height: 400px !important; overflow: hidden !important; page-break-inside: avoid; }
751
+
752
+ /* Compact tables */
753
+ .MuiTableCell-root { padding: 4px 8px !important; font-size: 10px !important; }
754
+ }
759
755
  `;
760
756
  document.head.appendChild(style);
761
757
 
@@ -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,7 +1,7 @@
1
1
  {
2
2
  "name": "@liiift-studio/sales-portal",
3
- "version": "3.1.5",
4
- "description": "Centralized sales portal package for Liiift Studio projects",
3
+ "version": "3.1.8",
4
+ "description": "Sales dashboard and analytics components for Next.js type foundry sites — Stripe integration, MUI DataGrid, charts, CSV export, and multi-designer reporting.",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
7
7
  "files": [
@@ -58,7 +58,17 @@
58
58
  "sales",
59
59
  "portal",
60
60
  "dashboard",
61
- "stripe"
61
+ "analytics",
62
+ "stripe",
63
+ "next",
64
+ "nextjs",
65
+ "mui",
66
+ "datagrid",
67
+ "charts",
68
+ "e-commerce",
69
+ "type-foundry",
70
+ "reporting",
71
+ "csv-export"
62
72
  ],
63
73
  "author": "Liiift Studio",
64
74
  "license": "UNLICENSED",
@@ -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;