@mohasinac/appkit 2.7.36 → 2.7.37

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.
Files changed (140) hide show
  1. package/dist/_internal/client/features/layout/DashboardLayoutClient.js +1 -1
  2. package/dist/_internal/client/features/seller/print-center/InventoryLabel.d.ts +12 -0
  3. package/dist/_internal/client/features/seller/print-center/InventoryLabel.js +49 -0
  4. package/dist/_internal/client/features/seller/print-center/LabelDesignPicker.d.ts +7 -0
  5. package/dist/_internal/client/features/seller/print-center/LabelDesignPicker.js +32 -0
  6. package/dist/_internal/client/features/seller/print-center/OrderPackingLabel.d.ts +28 -0
  7. package/dist/_internal/client/features/seller/print-center/OrderPackingLabel.js +33 -0
  8. package/dist/_internal/client/features/seller/print-center/PhysicalLocationModal.d.ts +12 -0
  9. package/dist/_internal/client/features/seller/print-center/PhysicalLocationModal.js +30 -0
  10. package/dist/_internal/client/features/seller/print-center/PrintCenterView.d.ts +12 -0
  11. package/dist/_internal/client/features/seller/print-center/PrintCenterView.js +102 -0
  12. package/dist/_internal/client/features/seller/print-center/PrintGrid.d.ts +12 -0
  13. package/dist/_internal/client/features/seller/print-center/PrintGrid.js +13 -0
  14. package/dist/_internal/client/features/seller/print-center/StoreCard.d.ts +19 -0
  15. package/dist/_internal/client/features/seller/print-center/StoreCard.js +30 -0
  16. package/dist/_internal/client/features/seller/print-center/WebsiteCard.d.ts +11 -0
  17. package/dist/_internal/client/features/seller/print-center/WebsiteCard.js +25 -0
  18. package/dist/_internal/client/features/seller/print-center/index.d.ts +11 -0
  19. package/dist/_internal/client/features/seller/print-center/index.js +10 -0
  20. package/dist/_internal/client/features/seller/print-center/types.d.ts +20 -0
  21. package/dist/_internal/client/features/seller/print-center/types.js +20 -0
  22. package/dist/_internal/client/features/seller/print-center/useInventoryPdf.d.ts +18 -0
  23. package/dist/_internal/client/features/seller/print-center/useInventoryPdf.js +76 -0
  24. package/dist/_internal/server/jobs/core/draftPrune.d.ts +2 -0
  25. package/dist/_internal/server/jobs/core/draftPrune.js +15 -0
  26. package/dist/_internal/server/jobs/core/onBidPlaced.js +1 -1
  27. package/dist/_internal/server/jobs/core/promotions.d.ts +1 -0
  28. package/dist/_internal/server/jobs/core/promotions.js +21 -6
  29. package/dist/_internal/server/jobs/handlers/assignSpinPrize.js +18 -1
  30. package/dist/_internal/server/jobs/handlers/draftPrune.d.ts +2 -0
  31. package/dist/_internal/server/jobs/handlers/draftPrune.js +2 -0
  32. package/dist/_internal/server/jobs/handlers/index.d.ts +1 -0
  33. package/dist/_internal/server/jobs/handlers/index.js +2 -0
  34. package/dist/_internal/server/jobs/handlers/triggerEventRaffle.js +15 -1
  35. package/dist/_internal/shared/actions/action-registry.js +32 -0
  36. package/dist/_internal/shared/features/blog/schema.d.ts +8 -8
  37. package/dist/_internal/shared/features/categories/bundle-schemas.d.ts +10 -10
  38. package/dist/_internal/shared/features/orders/schema.d.ts +8 -8
  39. package/dist/_internal/shared/features/products/schema.d.ts +8 -8
  40. package/dist/_internal/shared/features/promotions/schema.d.ts +6 -6
  41. package/dist/_internal/shared/features/reviews/schema.d.ts +2 -2
  42. package/dist/client.d.ts +11 -1
  43. package/dist/client.js +6 -1
  44. package/dist/configs/next.js +1 -0
  45. package/dist/constants/api-endpoints.d.ts +6 -0
  46. package/dist/constants/api-endpoints.js +2 -0
  47. package/dist/core/server-action.d.ts +4 -0
  48. package/dist/errors/error-codes.d.ts +18 -0
  49. package/dist/errors/error-codes.js +18 -0
  50. package/dist/errors/index.d.ts +1 -1
  51. package/dist/errors/index.js +1 -1
  52. package/dist/errors/messages.d.ts +1 -0
  53. package/dist/errors/messages.js +1 -0
  54. package/dist/features/account/components/UserSidebar.js +1 -1
  55. package/dist/features/account/schemas/index.d.ts +12 -12
  56. package/dist/features/admin/components/AdminSidebar.js +1 -1
  57. package/dist/features/auctions/actions/bid-actions.js +13 -6
  58. package/dist/features/auctions/components/PlaceBidFormClient.js +10 -2
  59. package/dist/features/auctions/repository/bid.repository.d.ts +7 -0
  60. package/dist/features/auctions/repository/bid.repository.js +16 -0
  61. package/dist/features/auctions/schemas/index.d.ts +18 -18
  62. package/dist/features/auth/schemas/index.d.ts +2 -2
  63. package/dist/features/before-after/schemas/index.d.ts +2 -2
  64. package/dist/features/blog/actions/blog-actions.d.ts +32 -32
  65. package/dist/features/blog/components/BlogPostForm.js +1 -1
  66. package/dist/features/blog/schemas/index.d.ts +38 -38
  67. package/dist/features/categories/schemas/index.d.ts +10 -10
  68. package/dist/features/collections/schemas/index.d.ts +4 -4
  69. package/dist/features/consultation/schemas/index.d.ts +9 -9
  70. package/dist/features/corporate/schemas/index.d.ts +4 -4
  71. package/dist/features/events/schemas/index.d.ts +50 -50
  72. package/dist/features/faq/actions/faq-actions.d.ts +6 -6
  73. package/dist/features/faq/schemas/index.d.ts +8 -8
  74. package/dist/features/homepage/actions/homepage-section-actions.d.ts +4 -4
  75. package/dist/features/layout/AppLayoutShell.js +1 -1
  76. package/dist/features/layout/AutoBreadcrumbs.js +1 -1
  77. package/dist/features/media/AvatarUpload.js +1 -1
  78. package/dist/features/media/types/index.d.ts +4 -4
  79. package/dist/features/media/upload/ImageUpload.js +18 -9
  80. package/dist/features/media/upload/MediaUploadList.js +2 -2
  81. package/dist/features/orders/schemas/firestore.d.ts +6 -0
  82. package/dist/features/orders/schemas/index.d.ts +10 -10
  83. package/dist/features/orders/types/index.d.ts +5 -0
  84. package/dist/features/payments/schemas/index.d.ts +4 -4
  85. package/dist/features/pre-orders/schemas/index.d.ts +8 -8
  86. package/dist/features/products/components/PrizeDrawItemsEditor.js +1 -1
  87. package/dist/features/products/components/ProductForm.js +20 -2
  88. package/dist/features/products/repository/products.repository.d.ts +3 -1
  89. package/dist/features/products/repository/products.repository.js +12 -1
  90. package/dist/features/products/schemas/firestore.d.ts +7 -0
  91. package/dist/features/products/schemas/index.d.ts +34 -34
  92. package/dist/features/products/schemas/product-features.validators.d.ts +6 -6
  93. package/dist/features/products/types/index.d.ts +6 -0
  94. package/dist/features/promotions/schemas/index.d.ts +14 -14
  95. package/dist/features/reviews/schemas/index.d.ts +18 -18
  96. package/dist/features/seller/actions/offer-actions.js +10 -1
  97. package/dist/features/seller/components/PhysicalLocationModal.d.ts +12 -0
  98. package/dist/features/seller/components/PhysicalLocationModal.js +30 -0
  99. package/dist/features/seller/components/PrintCenterView.d.ts +40 -0
  100. package/dist/features/seller/components/PrintCenterView.js +6 -0
  101. package/dist/features/seller/components/SellerOrdersView.js +48 -3
  102. package/dist/features/seller/components/SellerProductShell.d.ts +1 -0
  103. package/dist/features/seller/components/SellerProductShell.js +26 -4
  104. package/dist/features/seller/components/SellerProductsView.js +54 -13
  105. package/dist/features/seller/components/SellerSidebar.js +1 -1
  106. package/dist/features/seller/components/index.d.ts +1 -0
  107. package/dist/features/seller/components/index.js +1 -0
  108. package/dist/features/seller/schemas/firestore.d.ts +2 -0
  109. package/dist/features/seller/schemas/firestore.js +1 -0
  110. package/dist/features/seller/schemas/index.d.ts +22 -22
  111. package/dist/features/shell/FormShell.js +1 -1
  112. package/dist/features/shell/StepForm.d.ts +3 -1
  113. package/dist/features/shell/StepForm.js +3 -3
  114. package/dist/features/stores/schemas/index.d.ts +4 -4
  115. package/dist/index.d.ts +9 -1
  116. package/dist/index.js +6 -1
  117. package/dist/next/routing/route-map.d.ts +8 -0
  118. package/dist/next/routing/route-map.js +3 -0
  119. package/dist/tailwind-utilities.css +1 -1
  120. package/dist/ui/components/RowActionMenu.js +45 -10
  121. package/dist/ui/components/SideDrawer.style.css +2 -2
  122. package/dist/ui/forms/FieldCheckbox.d.ts +13 -0
  123. package/dist/ui/forms/FieldCheckbox.js +25 -0
  124. package/dist/ui/forms/FieldInput.d.ts +11 -0
  125. package/dist/ui/forms/FieldInput.js +25 -0
  126. package/dist/ui/forms/FieldSelect.d.ts +17 -0
  127. package/dist/ui/forms/FieldSelect.js +25 -0
  128. package/dist/ui/forms/FormShell.d.ts +48 -0
  129. package/dist/ui/forms/FormShell.js +176 -0
  130. package/dist/ui/forms/FormShell.style.css +287 -0
  131. package/dist/ui/forms/index.d.ts +8 -0
  132. package/dist/ui/forms/index.js +4 -0
  133. package/dist/ui/index.d.ts +9 -0
  134. package/dist/ui/index.js +5 -0
  135. package/dist/utils/action-response.d.ts +6 -0
  136. package/dist/utils/action-response.js +22 -0
  137. package/dist/utils/index.d.ts +1 -0
  138. package/dist/utils/index.js +1 -0
  139. package/dist/validation/schemas.d.ts +10 -10
  140. package/package.json +2 -2
@@ -91,5 +91,5 @@ export function DashboardLayoutClient({ variant, groups, permissions, activeHref
91
91
  const adminGroups = variant === "admin"
92
92
  ? filteredGroups
93
93
  : groups;
94
- return (_jsxs(_Fragment, { children: [variant === "admin" && (_jsx(AdminSidebar, { variant: "sidebar", desktopOpen: desktopOpen, mobileOpen: mobileOpen, activePath: activeHref, groups: adminGroups, onCloseMobile: close, onToggle: toggle, className: className })), variant === "store" && (_jsx(StoreSidebar, { variant: "sidebar", desktopOpen: desktopOpen, mobileOpen: mobileOpen, activeHref: activeHref, items: [], groups: filteredGroups, onCloseMobile: close, onToggle: toggle, className: className })), variant === "user" && (_jsx(UserSidebar, { variant: "sidebar", desktopOpen: desktopOpen, mobileOpen: mobileOpen, items: filteredGroups.flatMap((g) => g.items), groups: filteredGroups, onCloseMobile: close, onToggle: toggle, className: className })), _jsx("div", { className: "w-full px-4 py-8 md:pl-7 md:pr-6 lg:pl-8 lg:pr-8 min-h-[calc(100dvh-var(--header-height,3.5rem))]", children: children })] }));
94
+ return (_jsxs(_Fragment, { children: [variant === "admin" && (_jsx(AdminSidebar, { variant: "sidebar", desktopOpen: desktopOpen, mobileOpen: mobileOpen, activePath: activeHref, groups: adminGroups, onCloseMobile: close, onToggle: toggle, className: className })), variant === "store" && (_jsx(StoreSidebar, { variant: "sidebar", desktopOpen: desktopOpen, mobileOpen: mobileOpen, activeHref: activeHref, items: [], groups: filteredGroups, onCloseMobile: close, onToggle: toggle, className: className })), variant === "user" && (_jsx(UserSidebar, { variant: "sidebar", desktopOpen: desktopOpen, mobileOpen: mobileOpen, items: filteredGroups.flatMap((g) => g.items), groups: filteredGroups, onCloseMobile: close, onToggle: toggle, className: className })), _jsx("div", { className: "w-full px-5 py-8 md:pl-10 md:pr-6 lg:pl-11 lg:pr-8 min-h-[calc(100dvh-var(--header-height,3.5rem))]", children: children })] }));
95
95
  }
@@ -0,0 +1,12 @@
1
+ import type { ProductItem } from "../../../../../features/products/types";
2
+ import type { LabelDesign } from "./types";
3
+ interface InventoryLabelProps {
4
+ product: ProductItem;
5
+ publicBaseUrl: string;
6
+ design: LabelDesign;
7
+ qrDataUrl?: string;
8
+ barcodeDataUrl?: string;
9
+ brandName?: string;
10
+ }
11
+ export declare function InventoryLabel({ product, design, qrDataUrl, barcodeDataUrl, brandName }: InventoryLabelProps): import("react/jsx-runtime").JSX.Element;
12
+ export {};
@@ -0,0 +1,49 @@
1
+ "use client";
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ function getListingBadge(product) {
4
+ const lt = product.listingType;
5
+ if (lt === "auction") {
6
+ const sub = product.auctionEndDate
7
+ ? `Ends ${new Date(product.auctionEndDate).toLocaleDateString("en-IN")}`
8
+ : undefined;
9
+ return { label: "AUCTION", sub };
10
+ }
11
+ if (lt === "pre-order") {
12
+ const sub = product.preOrderDeliveryDate
13
+ ? `Expected ${new Date(product.preOrderDeliveryDate).toLocaleDateString("en-IN")}`
14
+ : undefined;
15
+ return { label: "PRE-ORDER", sub };
16
+ }
17
+ if (lt === "prize-draw")
18
+ return { label: "PRIZE DRAW" };
19
+ return null;
20
+ }
21
+ export function InventoryLabel({ product, design, qrDataUrl, barcodeDataUrl, brandName = "" }) {
22
+ const { size, show, colorScheme } = design;
23
+ const isDark = colorScheme === "dark";
24
+ const bg = isDark ? "#1a1a1a" : "#ffffff";
25
+ const fg = isDark ? "#f5f5f5" : "#111111";
26
+ const muted = isDark ? "#999999" : "#666666";
27
+ const border = isDark ? "#333333" : "#e5e5e5";
28
+ const badge = show.listingTypeBadge ? getListingBadge(product) : null;
29
+ const loc = product.physicalLocation;
30
+ const locStr = loc ? `${loc.zone} / ${loc.shelf} / ${loc.bin}` : null;
31
+ const priceStr = product.price != null ? `₹${(product.price / 100).toFixed(2)}` : null;
32
+ return (_jsxs("div", { style: {
33
+ width: `${size.widthMm}mm`,
34
+ height: `${size.heightMm}mm`,
35
+ background: bg,
36
+ color: fg,
37
+ border: `1px solid ${border}`,
38
+ borderRadius: "2px",
39
+ padding: "2mm",
40
+ fontFamily: "monospace, sans-serif",
41
+ fontSize: "7pt",
42
+ display: "flex",
43
+ flexDirection: "column",
44
+ gap: "1mm",
45
+ overflow: "hidden",
46
+ boxSizing: "border-box",
47
+ pageBreakInside: "avoid",
48
+ }, children: [_jsxs("div", { style: { display: "flex", justifyContent: "space-between", alignItems: "flex-start" }, children: [show.logo && brandName && (_jsx("span", { style: { fontWeight: 700, fontSize: "6pt", color: muted, letterSpacing: "0.05em" }, children: brandName })), badge && (_jsx("span", { style: { background: "#111", color: "#fff", fontSize: "5pt", fontWeight: 700, padding: "0.5mm 1.5mm", borderRadius: "1px", letterSpacing: "0.05em" }, children: badge.label }))] }), _jsx("div", { style: { fontWeight: 700, fontSize: "8pt", lineHeight: 1.2, flex: 1 }, children: product.title }), badge?.sub && _jsx("div", { style: { fontSize: "6pt", color: muted }, children: badge.sub }), (show.price || show.stock) && (_jsxs("div", { style: { display: "flex", gap: "3mm", alignItems: "center" }, children: [show.price && priceStr && _jsx("span", { style: { fontWeight: 700, fontSize: "8pt" }, children: priceStr }), show.stock && product.stockCount != null && (_jsxs("span", { style: { fontSize: "6pt", color: muted }, children: ["Qty: ", product.stockCount] })), product.condition && _jsx("span", { style: { fontSize: "6pt", color: muted }, children: product.condition })] })), show.location && locStr && _jsx("div", { style: { fontSize: "6pt", color: muted }, children: locStr }), (show.barcode || qrDataUrl) && (_jsxs("div", { style: { display: "flex", justifyContent: "space-between", alignItems: "flex-end", marginTop: "auto" }, children: [show.barcode && barcodeDataUrl && (_jsx("img", { src: barcodeDataUrl, alt: "barcode", style: { height: "8mm", maxWidth: "60%" } })), qrDataUrl && _jsx("img", { src: qrDataUrl, alt: "qr", style: { width: "10mm", height: "10mm" } })] })), _jsx("div", { style: { fontSize: "5pt", color: muted, textAlign: "center" }, children: product.id })] }));
49
+ }
@@ -0,0 +1,7 @@
1
+ import { type LabelDesign } from "./types";
2
+ interface LabelDesignPickerProps {
3
+ value: LabelDesign;
4
+ onChange: (design: LabelDesign) => void;
5
+ }
6
+ export declare function LabelDesignPicker({ value, onChange }: LabelDesignPickerProps): import("react/jsx-runtime").JSX.Element;
7
+ export {};
@@ -0,0 +1,32 @@
1
+ "use client";
2
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { Row } from "../../../../../ui/components/Layout";
4
+ import { Button } from "../../../../../ui/components/Button";
5
+ import { Input } from "../../../../../ui/components/Input";
6
+ import { Text } from "../../../../../ui/components/Typography";
7
+ import { LABEL_DESIGN_STORAGE_KEY } from "./types";
8
+ const TEMPLATES = ["minimal", "detailed", "branded"];
9
+ const SCHEMES = [
10
+ { value: "light", label: "Light" },
11
+ { value: "dark", label: "Dark" },
12
+ { value: "store-primary", label: "Brand" },
13
+ ];
14
+ const SHOW_FIELDS = [
15
+ { key: "logo", label: "Logo" },
16
+ { key: "price", label: "Price" },
17
+ { key: "stock", label: "Stock" },
18
+ { key: "barcode", label: "Barcode" },
19
+ { key: "location", label: "Location" },
20
+ { key: "listingTypeBadge", label: "Type badge" },
21
+ ];
22
+ export function LabelDesignPicker({ value, onChange }) {
23
+ const set = (key, val) => {
24
+ const next = { ...value, [key]: val };
25
+ onChange(next);
26
+ try {
27
+ localStorage.setItem(LABEL_DESIGN_STORAGE_KEY, JSON.stringify(next));
28
+ }
29
+ catch { /* noop */ }
30
+ };
31
+ return (_jsxs("div", { style: { display: "flex", flexDirection: "column", gap: "12px", padding: "16px" }, children: [_jsxs(_Fragment, { children: [_jsx(Text, { variant: "muted", style: { fontSize: "11px", fontWeight: 600, marginBottom: "6px", display: "block" }, children: "Template" }), _jsx(Row, { gap: "xs", children: TEMPLATES.map(t => (_jsx(Button, { variant: value.template === t ? "primary" : "outline", size: "sm", onClick: () => set("template", t), children: t.charAt(0).toUpperCase() + t.slice(1) }, t))) })] }), _jsxs(_Fragment, { children: [_jsx(Text, { variant: "muted", style: { fontSize: "11px", fontWeight: 600, marginBottom: "6px", display: "block" }, children: "Color" }), _jsx(Row, { gap: "xs", children: SCHEMES.map(s => (_jsx(Button, { variant: value.colorScheme === s.value ? "primary" : "outline", size: "sm", onClick: () => set("colorScheme", s.value), children: s.label }, s.value))) })] }), _jsxs(_Fragment, { children: [_jsx(Text, { variant: "muted", style: { fontSize: "11px", fontWeight: 600, marginBottom: "6px", display: "block" }, children: "Size (mm)" }), _jsxs(Row, { gap: "sm", children: [_jsx(Input, { label: "W", type: "number", value: value.size.widthMm, onChange: e => set("size", { ...value.size, widthMm: Number(e.target.value) }), style: { width: "70px" } }), _jsx(Input, { label: "H", type: "number", value: value.size.heightMm, onChange: e => set("size", { ...value.size, heightMm: Number(e.target.value) }), style: { width: "70px" } })] })] }), _jsxs(_Fragment, { children: [_jsx(Text, { variant: "muted", style: { fontSize: "11px", fontWeight: 600, marginBottom: "6px", display: "block" }, children: "Show" }), _jsx("div", { style: { display: "grid", gridTemplateColumns: "1fr 1fr", gap: "4px" }, children: SHOW_FIELDS.map(f => (_jsxs("label", { style: { display: "flex", alignItems: "center", gap: "6px", cursor: "pointer", fontSize: "12px" }, children: [_jsx("input", { type: "checkbox", checked: value.show[f.key], onChange: e => set("show", { ...value.show, [f.key]: e.target.checked }) }), f.label] }, f.key))) })] })] }));
32
+ }
@@ -0,0 +1,28 @@
1
+ import type { LabelDesign } from "./types";
2
+ export interface OrderForLabel {
3
+ id: string;
4
+ createdAt?: string;
5
+ status?: string;
6
+ buyerDisplayName?: string;
7
+ buyerCity?: string;
8
+ items: {
9
+ productName: string;
10
+ quantity: number;
11
+ price: number;
12
+ }[];
13
+ physicalLocation?: {
14
+ zone: string;
15
+ shelf: string;
16
+ bin: string;
17
+ };
18
+ }
19
+ interface OrderPackingLabelProps {
20
+ order: OrderForLabel;
21
+ storeBaseUrl: string;
22
+ design: LabelDesign;
23
+ qrDataUrl?: string;
24
+ barcodeDataUrl?: string;
25
+ brandName?: string;
26
+ }
27
+ export declare function OrderPackingLabel({ order, design, qrDataUrl, barcodeDataUrl, brandName }: OrderPackingLabelProps): import("react/jsx-runtime").JSX.Element;
28
+ export {};
@@ -0,0 +1,33 @@
1
+ "use client";
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ export function OrderPackingLabel({ order, design, qrDataUrl, barcodeDataUrl, brandName = "" }) {
4
+ const { size, show, colorScheme } = design;
5
+ const isDark = colorScheme === "dark";
6
+ const bg = isDark ? "#1a1a1a" : "#ffffff";
7
+ const fg = isDark ? "#f5f5f5" : "#111111";
8
+ const muted = isDark ? "#999999" : "#666666";
9
+ const border = isDark ? "#333333" : "#e5e5e5";
10
+ const MAX_ITEMS = 4;
11
+ const shownItems = order.items.slice(0, MAX_ITEMS);
12
+ const extraCount = order.items.length - MAX_ITEMS;
13
+ const loc = order.physicalLocation;
14
+ const locStr = loc ? `${loc.zone} / ${loc.shelf} / ${loc.bin}` : null;
15
+ const dateStr = order.createdAt ? new Date(order.createdAt).toLocaleDateString("en-IN") : "";
16
+ return (_jsxs("div", { style: {
17
+ width: `${size.widthMm}mm`,
18
+ height: `${size.heightMm}mm`,
19
+ background: bg,
20
+ color: fg,
21
+ border: `1px solid ${border}`,
22
+ borderRadius: "2px",
23
+ padding: "2mm",
24
+ fontFamily: "monospace, sans-serif",
25
+ fontSize: "7pt",
26
+ display: "flex",
27
+ flexDirection: "column",
28
+ gap: "1mm",
29
+ overflow: "hidden",
30
+ boxSizing: "border-box",
31
+ pageBreakInside: "avoid",
32
+ }, children: [_jsxs("div", { style: { display: "flex", justifyContent: "space-between", alignItems: "center" }, children: [_jsx("span", { style: { fontWeight: 700, fontSize: "9pt", letterSpacing: "0.1em" }, children: "PACKING SLIP" }), show.logo && brandName && _jsx("span", { style: { fontSize: "6pt", color: muted }, children: brandName })] }), _jsx("div", { style: { fontWeight: 700, fontSize: "8pt" }, children: order.id }), _jsxs("div", { style: { fontSize: "6pt", color: muted }, children: [dateStr, order.status ? ` · ${order.status}` : ""] }), _jsxs("div", { style: { borderTop: `1px solid ${border}`, paddingTop: "1mm", flex: 1 }, children: [shownItems.map((item, i) => (_jsxs("div", { style: { display: "flex", justifyContent: "space-between", fontSize: "6pt", marginBottom: "0.5mm" }, children: [_jsxs("span", { style: { flex: 1, overflow: "hidden" }, children: ["x", item.quantity, " ", item.productName] }), _jsxs("span", { children: ["Rs.", (item.price / 100).toFixed(0)] })] }, i))), extraCount > 0 && _jsxs("div", { style: { fontSize: "6pt", color: muted }, children: ["+", extraCount, " more"] })] }), (order.buyerDisplayName || order.buyerCity) && (_jsxs("div", { style: { fontSize: "6pt" }, children: [order.buyerDisplayName?.split(" ")[0], order.buyerCity ? ` · ${order.buyerCity}` : ""] })), show.location && locStr && _jsxs("div", { style: { fontSize: "6pt", color: muted }, children: ["Stage: ", locStr] }), (show.barcode || qrDataUrl) && (_jsxs("div", { style: { display: "flex", justifyContent: "space-between", alignItems: "flex-end", marginTop: "auto" }, children: [show.barcode && barcodeDataUrl && (_jsx("img", { src: barcodeDataUrl, alt: "barcode", style: { height: "8mm", maxWidth: "65%" } })), qrDataUrl && _jsx("img", { src: qrDataUrl, alt: "qr", style: { width: "10mm", height: "10mm" } })] }))] }));
33
+ }
@@ -0,0 +1,12 @@
1
+ export interface PhysicalLocation {
2
+ zone: string;
3
+ shelf: string;
4
+ bin: string;
5
+ }
6
+ interface PhysicalLocationModalProps {
7
+ count: number;
8
+ onSave: (loc: PhysicalLocation) => Promise<void>;
9
+ onClose: () => void;
10
+ }
11
+ export declare function PhysicalLocationModal({ count, onSave, onClose }: PhysicalLocationModalProps): import("react/jsx-runtime").JSX.Element;
12
+ export {};
@@ -0,0 +1,30 @@
1
+ "use client";
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { useState } from "react";
4
+ import { Modal } from "../../../../../ui/components/Modal";
5
+ import { Input } from "../../../../../ui/components/Input";
6
+ import { Button } from "../../../../../ui/components/Button";
7
+ import { Row } from "../../../../../ui/components/Layout";
8
+ import { Text } from "../../../../../ui/components/Typography";
9
+ export function PhysicalLocationModal({ count, onSave, onClose }) {
10
+ const [zone, setZone] = useState("");
11
+ const [shelf, setShelf] = useState("");
12
+ const [bin, setBin] = useState("");
13
+ const [saving, setSaving] = useState(false);
14
+ const [error, setError] = useState("");
15
+ const handleSave = async () => {
16
+ setSaving(true);
17
+ setError("");
18
+ try {
19
+ await onSave({ zone: zone.trim(), shelf: shelf.trim(), bin: bin.trim() });
20
+ onClose();
21
+ }
22
+ catch (e) {
23
+ setError(e instanceof Error ? e.message : "Failed to save location");
24
+ }
25
+ finally {
26
+ setSaving(false);
27
+ }
28
+ };
29
+ return (_jsx(Modal, { isOpen: true, onClose: onClose, title: `Set Location — ${count} item${count !== 1 ? "s" : ""}`, size: "sm", actions: _jsxs(Row, { gap: "sm", justify: "end", children: [_jsx(Button, { variant: "ghost", onClick: onClose, disabled: saving, children: "Cancel" }), _jsx(Button, { variant: "primary", onClick: handleSave, disabled: saving, children: saving ? "Saving..." : "Save" })] }), children: _jsxs("div", { style: { display: "flex", flexDirection: "column", gap: "12px" }, children: [_jsx(Text, { variant: "muted", children: "Assign a physical storage location to the selected items. All fields are optional." }), _jsx(Input, { label: "Zone (e.g. A, B, Storage-1)", value: zone, onChange: e => setZone(e.target.value), placeholder: "A" }), _jsx(Input, { label: "Shelf (e.g. 3, Top, Middle)", value: shelf, onChange: e => setShelf(e.target.value), placeholder: "3" }), _jsx(Input, { label: "Bin (e.g. Blue, Box-12)", value: bin, onChange: e => setBin(e.target.value), placeholder: "Blue" }), error && _jsx(Text, { variant: "error", children: error })] }) }));
30
+ }
@@ -0,0 +1,12 @@
1
+ import type { ProductItem } from "../../../../../features/products/types";
2
+ import { type OrderForLabel } from "./OrderPackingLabel";
3
+ import { type StoreForCard } from "./StoreCard";
4
+ export interface PrintCenterViewProps {
5
+ store: StoreForCard | null;
6
+ publicBaseUrl: string;
7
+ isAdmin?: boolean;
8
+ initialProducts?: ProductItem[];
9
+ initialOrders?: OrderForLabel[];
10
+ brandName?: string;
11
+ }
12
+ export declare function PrintCenterView({ store, publicBaseUrl, isAdmin, initialProducts, initialOrders, brandName, }: PrintCenterViewProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,102 @@
1
+ "use client";
2
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
3
+ import { useState, useEffect, useCallback } from "react";
4
+ import { Tabs, TabsList, TabsTrigger, TabsContent } from "../../../../../ui/components/Tabs";
5
+ import { Button } from "../../../../../ui/components/Button";
6
+ import { Input } from "../../../../../ui/components/Input";
7
+ import { Text } from "../../../../../ui/components/Typography";
8
+ import { Row } from "../../../../../ui/components/Layout";
9
+ import { DEFAULT_PRODUCT_LABEL_DESIGN, DEFAULT_ORDER_LABEL_DESIGN, DEFAULT_CARD_DESIGN, LABEL_DESIGN_STORAGE_KEY, } from "./types";
10
+ import { LabelDesignPicker } from "./LabelDesignPicker";
11
+ import { PrintGrid } from "./PrintGrid";
12
+ import { InventoryLabel } from "./InventoryLabel";
13
+ import { OrderPackingLabel } from "./OrderPackingLabel";
14
+ import { StoreCard } from "./StoreCard";
15
+ import { WebsiteCard } from "./WebsiteCard";
16
+ import { useInventoryPdf } from "./useInventoryPdf";
17
+ function loadSavedDesign(def) {
18
+ try {
19
+ const raw = localStorage.getItem(LABEL_DESIGN_STORAGE_KEY);
20
+ if (raw)
21
+ return { ...def, ...JSON.parse(raw) };
22
+ }
23
+ catch { /* noop */ }
24
+ return def;
25
+ }
26
+ async function generateLabelData(id, qrUrl) {
27
+ try {
28
+ const [qrcode, jsbarcodeModule] = await Promise.all([
29
+ import("qrcode"),
30
+ import("jsbarcode"),
31
+ ]);
32
+ const JsBarcode = jsbarcodeModule.default;
33
+ const qrDataUrl = await qrcode.toDataURL(qrUrl, { width: 80, margin: 1 });
34
+ const svg = document.createElementNS("http://www.w3.org/2000/svg", "svg");
35
+ JsBarcode(svg, id, { format: "CODE128", width: 1, height: 25, displayValue: false });
36
+ const barcodeDataUrl = "data:image/svg+xml;base64," + btoa(new XMLSerializer().serializeToString(svg));
37
+ return { qrDataUrl, barcodeDataUrl };
38
+ }
39
+ catch {
40
+ return {};
41
+ }
42
+ }
43
+ export function PrintCenterView({ store, publicBaseUrl, isAdmin = false, initialProducts = [], initialOrders = [], brandName = "", }) {
44
+ const [tab, setTab] = useState("products");
45
+ const [productDesign, setProductDesign] = useState(() => loadSavedDesign(DEFAULT_PRODUCT_LABEL_DESIGN));
46
+ const [orderDesign, setOrderDesign] = useState(DEFAULT_ORDER_LABEL_DESIGN);
47
+ const [cardDesign, setCardDesign] = useState(DEFAULT_CARD_DESIGN);
48
+ const [selectedProductIds, setSelectedProductIds] = useState(new Set());
49
+ const [selectedOrderIds, setSelectedOrderIds] = useState(new Set());
50
+ const [storeCardCopies, setStoreCardCopies] = useState(1);
51
+ const [websiteCardCopies, setWebsiteCardCopies] = useState(1);
52
+ const [labelCache, setLabelCache] = useState({});
53
+ const [showGrid, setShowGrid] = useState(false);
54
+ const [printMode, setPrintMode] = useState("products");
55
+ const selectedProducts = initialProducts.filter(p => selectedProductIds.has(p.id));
56
+ const selectedOrders = initialOrders.filter(o => selectedOrderIds.has(o.id));
57
+ useEffect(() => {
58
+ const items = [
59
+ ...initialProducts.map(p => ({ id: p.id, url: `${publicBaseUrl}/products/${p.id}` })),
60
+ ...initialOrders.map(o => ({ id: o.id, url: `${publicBaseUrl}/store/orders/${o.id}/view` })),
61
+ ...(store ? [{ id: store.id, url: `${publicBaseUrl}/stores/${store.id}` }] : []),
62
+ ];
63
+ for (const item of items) {
64
+ if (labelCache[item.id])
65
+ continue;
66
+ generateLabelData(item.id, item.url).then(data => setLabelCache(prev => ({ ...prev, [item.id]: data })));
67
+ }
68
+ // eslint-disable-next-line react-hooks/exhaustive-deps
69
+ }, [initialProducts.length, initialOrders.length, store?.id, publicBaseUrl]);
70
+ const { downloadPdf: dlProducts, isGenerating: genProducts } = useInventoryPdf({ products: selectedProducts, design: productDesign, publicBaseUrl, brandName });
71
+ const { downloadPdf: dlOrders, isGenerating: genOrders } = useInventoryPdf({ orders: selectedOrders, design: orderDesign, publicBaseUrl, brandName });
72
+ const { downloadPdf: dlStore, isGenerating: genStore } = useInventoryPdf({ storeCards: store ? Array(storeCardCopies).fill(store) : [], design: cardDesign, publicBaseUrl, brandName });
73
+ const { downloadPdf: dlWebsite, isGenerating: genWebsite } = useInventoryPdf({ websiteCards: store ? Array(websiteCardCopies).fill(store) : [], design: cardDesign, publicBaseUrl, brandName });
74
+ const toggleProduct = useCallback((id) => {
75
+ setSelectedProductIds(prev => { const s = new Set(prev); if (s.has(id))
76
+ s.delete(id);
77
+ else
78
+ s.add(id); return s; });
79
+ }, []);
80
+ const toggleOrder = useCallback((id) => {
81
+ setSelectedOrderIds(prev => { const s = new Set(prev); if (s.has(id))
82
+ s.delete(id);
83
+ else
84
+ s.add(id); return s; });
85
+ }, []);
86
+ if (showGrid && printMode === "products") {
87
+ return _jsx(PrintGrid, { items: selectedProducts.map(p => _jsx(InventoryLabel, { product: p, publicBaseUrl: publicBaseUrl, design: productDesign, qrDataUrl: labelCache[p.id]?.qrDataUrl, barcodeDataUrl: labelCache[p.id]?.barcodeDataUrl }, p.id)), columns: 4, onBack: () => setShowGrid(false), onDownloadPdf: dlProducts, isGeneratingPdf: genProducts });
88
+ }
89
+ if (showGrid && printMode === "orders") {
90
+ return _jsx(PrintGrid, { items: selectedOrders.map(o => _jsx(OrderPackingLabel, { order: o, storeBaseUrl: publicBaseUrl, design: orderDesign, qrDataUrl: labelCache[o.id]?.qrDataUrl, barcodeDataUrl: labelCache[o.id]?.barcodeDataUrl }, o.id)), columns: 4, onBack: () => setShowGrid(false), onDownloadPdf: dlOrders, isGeneratingPdf: genOrders });
91
+ }
92
+ if (showGrid && printMode === "store" && store) {
93
+ return _jsx(PrintGrid, { items: Array.from({ length: storeCardCopies }, (_, i) => _jsx(StoreCard, { store: store, publicBaseUrl: publicBaseUrl, design: cardDesign, qrDataUrl: labelCache[store.id]?.qrDataUrl, barcodeDataUrl: labelCache[store.id]?.barcodeDataUrl }, i)), columns: 4, onBack: () => setShowGrid(false), onDownloadPdf: dlStore, isGeneratingPdf: genStore });
94
+ }
95
+ if (showGrid && printMode === "website" && store) {
96
+ return _jsx(PrintGrid, { items: Array.from({ length: websiteCardCopies }, (_, i) => _jsx(WebsiteCard, { store: store, publicBaseUrl: publicBaseUrl, design: cardDesign, qrDataUrl: labelCache[store.id]?.qrDataUrl, brandName: brandName }, i)), columns: 4, onBack: () => setShowGrid(false), onDownloadPdf: dlWebsite, isGeneratingPdf: genWebsite });
97
+ }
98
+ const PANEL_STYLE = { border: "1px solid #e5e7eb", borderRadius: "6px", overflow: "hidden" };
99
+ const PANEL_HEAD = { padding: "12px", borderBottom: "1px solid #e5e7eb", fontWeight: 600, fontSize: "13px" };
100
+ const GRID_LAYOUT = { display: "grid", gridTemplateColumns: "1fr 280px", gap: "16px", marginTop: "16px" };
101
+ return (_jsxs("div", { style: { maxWidth: "960px" }, children: [isAdmin && (_jsxs("div", { style: { marginBottom: "16px", padding: "12px", background: "var(--appkit-color-primary, #6d28d9)", color: "#fff", borderRadius: "6px", fontSize: "13px" }, children: ["Admin mode \u2014 generating materials for: ", store?.storeName ?? "all stores"] })), _jsxs(Tabs, { value: tab, onChange: setTab, children: [_jsxs(TabsList, { children: [_jsx(TabsTrigger, { value: "products", children: "Product Labels" }), _jsx(TabsTrigger, { value: "orders", children: "Packing Slips" }), _jsx(TabsTrigger, { value: "store", children: "Store Cards" }), _jsx(TabsTrigger, { value: "website", children: "Website Cards" })] }), _jsx(TabsContent, { value: "products", children: _jsxs("div", { style: GRID_LAYOUT, children: [_jsxs("div", { style: { minWidth: 0 }, children: [_jsxs(Text, { variant: "muted", style: { marginBottom: "8px", display: "block" }, children: ["Select products (", selectedProductIds.size, " selected)"] }), _jsxs("div", { style: PANEL_STYLE, children: [initialProducts.length === 0 && (_jsx("div", { style: { padding: "24px", textAlign: "center", color: "#9ca3af" }, children: "No products loaded" })), initialProducts.map(p => (_jsxs("label", { style: { display: "flex", alignItems: "center", gap: "10px", padding: "10px 14px", borderBottom: "1px solid #f3f4f6", cursor: "pointer", background: selectedProductIds.has(p.id) ? "#f5f3ff" : "#fff" }, children: [_jsx("input", { type: "checkbox", checked: selectedProductIds.has(p.id), onChange: () => toggleProduct(p.id) }), _jsx("span", { style: { flex: 1, fontSize: "13px", fontWeight: 500 }, children: p.title }), _jsx("span", { style: { fontSize: "11px", color: "#9ca3af" }, children: p.listingType ?? "standard" }), p.physicalLocation && (_jsxs("span", { style: { fontSize: "11px", color: "#6b7280", background: "#f3f4f6", padding: "2px 6px", borderRadius: "4px" }, children: [p.physicalLocation.zone, "/", p.physicalLocation.shelf, "/", p.physicalLocation.bin] }))] }, p.id)))] }), initialProducts.length > 0 && (_jsxs(Row, { gap: "sm", style: { marginTop: "6px" }, children: [_jsx(Button, { variant: "ghost", size: "sm", onClick: () => setSelectedProductIds(new Set(initialProducts.map(p => p.id))), children: "All" }), _jsx(Button, { variant: "ghost", size: "sm", onClick: () => setSelectedProductIds(new Set()), children: "Clear" })] })), _jsxs(Row, { gap: "sm", style: { marginTop: "12px" }, children: [_jsxs(Button, { variant: "primary", disabled: selectedProductIds.size === 0, onClick: () => { setPrintMode("products"); setShowGrid(true); }, children: ["Print", selectedProductIds.size > 0 ? ` (${selectedProductIds.size})` : ""] }), _jsx(Button, { variant: "outline", disabled: selectedProductIds.size === 0 || genProducts, onClick: dlProducts, children: genProducts ? "Generating..." : "Download PDF" })] })] }), _jsxs("div", { style: PANEL_STYLE, children: [_jsx("div", { style: PANEL_HEAD, children: "Label Design" }), _jsx(LabelDesignPicker, { value: productDesign, onChange: setProductDesign })] })] }) }), _jsx(TabsContent, { value: "orders", children: _jsxs("div", { style: GRID_LAYOUT, children: [_jsxs("div", { style: { minWidth: 0 }, children: [_jsxs(Text, { variant: "muted", style: { marginBottom: "8px", display: "block" }, children: ["Select orders (", selectedOrderIds.size, " selected)"] }), _jsxs("div", { style: PANEL_STYLE, children: [initialOrders.length === 0 && (_jsx("div", { style: { padding: "24px", textAlign: "center", color: "#9ca3af" }, children: "No orders loaded" })), initialOrders.map(o => (_jsxs("label", { style: { display: "flex", alignItems: "center", gap: "10px", padding: "10px 14px", borderBottom: "1px solid #f3f4f6", cursor: "pointer", background: selectedOrderIds.has(o.id) ? "#f5f3ff" : "#fff" }, children: [_jsx("input", { type: "checkbox", checked: selectedOrderIds.has(o.id), onChange: () => toggleOrder(o.id) }), _jsx("span", { style: { flex: 1, fontSize: "13px", fontWeight: 500 }, children: o.id }), _jsxs("span", { style: { fontSize: "11px", color: "#9ca3af" }, children: [o.items.length, " item", o.items.length !== 1 ? "s" : ""] })] }, o.id)))] }), initialOrders.length > 0 && (_jsxs(Row, { gap: "sm", style: { marginTop: "6px" }, children: [_jsx(Button, { variant: "ghost", size: "sm", onClick: () => setSelectedOrderIds(new Set(initialOrders.map(o => o.id))), children: "All" }), _jsx(Button, { variant: "ghost", size: "sm", onClick: () => setSelectedOrderIds(new Set()), children: "Clear" })] })), _jsxs(Row, { gap: "sm", style: { marginTop: "12px" }, children: [_jsxs(Button, { variant: "primary", disabled: selectedOrderIds.size === 0, onClick: () => { setPrintMode("orders"); setShowGrid(true); }, children: ["Print", selectedOrderIds.size > 0 ? ` (${selectedOrderIds.size})` : ""] }), _jsx(Button, { variant: "outline", disabled: selectedOrderIds.size === 0 || genOrders, onClick: dlOrders, children: genOrders ? "Generating..." : "Download PDF" })] })] }), _jsxs("div", { style: PANEL_STYLE, children: [_jsx("div", { style: PANEL_HEAD, children: "Label Design" }), _jsx(LabelDesignPicker, { value: orderDesign, onChange: setOrderDesign })] })] }) }), _jsx(TabsContent, { value: "store", children: _jsxs("div", { style: GRID_LAYOUT, children: [_jsx("div", { style: { minWidth: 0 }, children: !store ? (_jsx(Text, { variant: "muted", children: "No store data available." })) : (_jsxs(_Fragment, { children: [_jsxs(Text, { variant: "muted", style: { marginBottom: "12px", display: "block" }, children: ["Business cards for ", _jsx("strong", { children: store.storeName })] }), _jsxs(Row, { gap: "sm", style: { alignItems: "center", marginBottom: "16px" }, children: [_jsx("span", { style: { fontSize: "13px", fontWeight: 500 }, children: "Copies:" }), _jsx(Input, { type: "number", value: storeCardCopies, onChange: e => setStoreCardCopies(Math.max(1, Math.min(100, Number(e.target.value)))), style: { width: "80px" } })] }), _jsx("div", { style: { marginBottom: "16px" }, children: _jsx(StoreCard, { store: store, publicBaseUrl: publicBaseUrl, design: cardDesign, qrDataUrl: labelCache[store.id]?.qrDataUrl, barcodeDataUrl: labelCache[store.id]?.barcodeDataUrl }) }), _jsxs(Row, { gap: "sm", children: [_jsxs(Button, { variant: "primary", onClick: () => { setPrintMode("store"); setShowGrid(true); }, children: ["Print ", storeCardCopies, " card", storeCardCopies !== 1 ? "s" : ""] }), _jsx(Button, { variant: "outline", disabled: genStore, onClick: dlStore, children: genStore ? "Generating..." : "Download PDF" })] })] })) }), _jsxs("div", { style: PANEL_STYLE, children: [_jsx("div", { style: PANEL_HEAD, children: "Card Design" }), _jsx(LabelDesignPicker, { value: cardDesign, onChange: setCardDesign })] })] }) }), _jsx(TabsContent, { value: "website", children: _jsxs("div", { style: GRID_LAYOUT, children: [_jsx("div", { style: { minWidth: 0 }, children: !store ? (_jsx(Text, { variant: "muted", children: "No store data available." })) : (_jsxs(_Fragment, { children: [_jsx(Text, { variant: "muted", style: { marginBottom: "12px", display: "block" }, children: "Promotional cards to hand out at physical stalls and events." }), _jsxs(Row, { gap: "sm", style: { alignItems: "center", marginBottom: "16px" }, children: [_jsx("span", { style: { fontSize: "13px", fontWeight: 500 }, children: "Copies:" }), _jsx(Input, { type: "number", value: websiteCardCopies, onChange: e => setWebsiteCardCopies(Math.max(1, Math.min(100, Number(e.target.value)))), style: { width: "80px" } })] }), _jsx("div", { style: { marginBottom: "16px" }, children: _jsx(WebsiteCard, { store: store, publicBaseUrl: publicBaseUrl, design: cardDesign, qrDataUrl: labelCache[store.id]?.qrDataUrl, brandName: brandName }) }), _jsxs(Row, { gap: "sm", children: [_jsxs(Button, { variant: "primary", onClick: () => { setPrintMode("website"); setShowGrid(true); }, children: ["Print ", websiteCardCopies, " card", websiteCardCopies !== 1 ? "s" : ""] }), _jsx(Button, { variant: "outline", disabled: genWebsite, onClick: dlWebsite, children: genWebsite ? "Generating..." : "Download PDF" })] })] })) }), _jsxs("div", { style: PANEL_STYLE, children: [_jsx("div", { style: PANEL_HEAD, children: "Card Design" }), _jsx(LabelDesignPicker, { value: cardDesign, onChange: setCardDesign })] })] }) })] })] }));
102
+ }
@@ -0,0 +1,12 @@
1
+ import React from "react";
2
+ interface PrintGridProps {
3
+ items: React.ReactNode[];
4
+ columns?: 2 | 4;
5
+ pageSize?: "A4" | "Letter" | "Label";
6
+ autoprint?: boolean;
7
+ onBack?: () => void;
8
+ onDownloadPdf?: () => void;
9
+ isGeneratingPdf?: boolean;
10
+ }
11
+ export declare function PrintGrid({ items, columns, autoprint, onBack, onDownloadPdf, isGeneratingPdf }: PrintGridProps): import("react/jsx-runtime").JSX.Element;
12
+ export {};
@@ -0,0 +1,13 @@
1
+ "use client";
2
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
3
+ import { useEffect } from "react";
4
+ import { Button } from "../../../../../ui/components/Button";
5
+ export function PrintGrid({ items, columns = 4, autoprint = false, onBack, onDownloadPdf, isGeneratingPdf = false }) {
6
+ useEffect(() => {
7
+ if (!autoprint || items.length === 0)
8
+ return;
9
+ const t = setTimeout(() => window.print(), 500);
10
+ return () => clearTimeout(t);
11
+ }, [autoprint, items.length]);
12
+ return (_jsxs(_Fragment, { children: [_jsxs("div", { className: "appkit-print-hide", style: { display: "flex", gap: "8px", marginBottom: "16px", alignItems: "center" }, children: [onBack && _jsx(Button, { variant: "ghost", onClick: onBack, children: "Back" }), _jsx(Button, { variant: "outline", onClick: () => window.print(), children: "Print" }), onDownloadPdf && (_jsx(Button, { variant: "primary", onClick: onDownloadPdf, disabled: isGeneratingPdf, children: isGeneratingPdf ? "Generating..." : "Download PDF" }))] }), _jsx("style", { children: `@media print { .appkit-print-hide { display: none !important; } body { margin: 0; } }` }), _jsx("div", { style: { display: "grid", gridTemplateColumns: `repeat(${columns}, auto)`, gap: "4mm", justifyContent: "start" }, children: items.map((item, i) => (_jsx("div", { style: { pageBreakInside: "avoid" }, children: item }, i))) })] }));
13
+ }
@@ -0,0 +1,19 @@
1
+ import type { LabelDesign } from "./types";
2
+ export interface StoreForCard {
3
+ id: string;
4
+ storeName: string;
5
+ storeDescription?: string;
6
+ storeLogoURL?: string;
7
+ storeCategory?: string;
8
+ primaryAddress?: string;
9
+ }
10
+ interface StoreCardProps {
11
+ store: StoreForCard;
12
+ publicBaseUrl: string;
13
+ design: LabelDesign;
14
+ qrDataUrl?: string;
15
+ barcodeDataUrl?: string;
16
+ brandName?: string;
17
+ }
18
+ export declare function StoreCard({ store, publicBaseUrl, design, qrDataUrl, barcodeDataUrl, brandName }: StoreCardProps): import("react/jsx-runtime").JSX.Element;
19
+ export {};
@@ -0,0 +1,30 @@
1
+ "use client";
2
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
3
+ export function StoreCard({ store, publicBaseUrl, design, qrDataUrl, barcodeDataUrl, brandName }) {
4
+ const { size, show, colorScheme } = design;
5
+ const isDark = colorScheme === "dark";
6
+ const bg = isDark ? "#1a1a1a" : "#ffffff";
7
+ const fg = isDark ? "#f5f5f5" : "#111111";
8
+ const muted = isDark ? "#999999" : "#666666";
9
+ const border = isDark ? "#333333" : "#e5e5e5";
10
+ const desc = store.storeDescription
11
+ ? store.storeDescription.slice(0, 80) + (store.storeDescription.length > 80 ? "..." : "")
12
+ : null;
13
+ return (_jsxs("div", { style: {
14
+ width: `${size.widthMm}mm`,
15
+ height: `${size.heightMm}mm`,
16
+ background: bg,
17
+ color: fg,
18
+ border: `1px solid ${border}`,
19
+ borderRadius: "3px",
20
+ padding: "3mm",
21
+ fontFamily: "sans-serif",
22
+ fontSize: "7pt",
23
+ display: "flex",
24
+ flexDirection: "column",
25
+ gap: "1.5mm",
26
+ overflow: "hidden",
27
+ boxSizing: "border-box",
28
+ pageBreakInside: "avoid",
29
+ }, children: [_jsxs("div", { style: { display: "flex", alignItems: "center", gap: "2mm" }, children: [show.logo && store.storeLogoURL && (_jsx("img", { src: store.storeLogoURL, alt: store.storeName, style: { width: "8mm", height: "8mm", borderRadius: "2px", objectFit: "cover" } })), _jsxs(_Fragment, { children: [_jsx("div", { style: { fontWeight: 700, fontSize: "9pt" }, children: store.storeName }), store.storeCategory && _jsx("div", { style: { fontSize: "6pt", color: muted }, children: store.storeCategory })] })] }), desc && _jsx("div", { style: { fontSize: "6pt", color: muted, flex: 1 }, children: desc }), store.primaryAddress && _jsx("div", { style: { fontSize: "6pt", color: muted }, children: store.primaryAddress }), (show.barcode || qrDataUrl) && (_jsxs("div", { style: { display: "flex", justifyContent: "space-between", alignItems: "flex-end", marginTop: "auto" }, children: [show.barcode && barcodeDataUrl && (_jsx("img", { src: barcodeDataUrl, alt: "barcode", style: { height: "7mm", maxWidth: "55%" } })), qrDataUrl && _jsx("img", { src: qrDataUrl, alt: "qr", style: { width: "12mm", height: "12mm" } })] })), brandName && (_jsxs("div", { style: { fontSize: "5pt", color: muted, textAlign: "center", borderTop: `1px solid ${border}`, paddingTop: "1mm" }, children: [brandName, " \u00B7 ", publicBaseUrl.replace(/^https?:\/\//, "")] }))] }));
30
+ }
@@ -0,0 +1,11 @@
1
+ import type { StoreForCard } from "./StoreCard";
2
+ import type { LabelDesign } from "./types";
3
+ interface WebsiteCardProps {
4
+ store: StoreForCard;
5
+ publicBaseUrl: string;
6
+ design: LabelDesign;
7
+ qrDataUrl?: string;
8
+ brandName?: string;
9
+ }
10
+ export declare function WebsiteCard({ store, publicBaseUrl, design, qrDataUrl, brandName }: WebsiteCardProps): import("react/jsx-runtime").JSX.Element;
11
+ export {};
@@ -0,0 +1,25 @@
1
+ "use client";
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ export function WebsiteCard({ store, publicBaseUrl, design, qrDataUrl, brandName = "" }) {
4
+ const { size, colorScheme } = design;
5
+ const isDark = colorScheme === "dark";
6
+ const bg = isDark ? "#2d1b69" : "#6d28d9";
7
+ return (_jsxs("div", { style: {
8
+ width: `${size.widthMm}mm`,
9
+ height: `${size.heightMm}mm`,
10
+ background: bg,
11
+ color: "#ffffff",
12
+ borderRadius: "3px",
13
+ padding: "3mm",
14
+ fontFamily: "sans-serif",
15
+ fontSize: "7pt",
16
+ display: "flex",
17
+ flexDirection: "column",
18
+ alignItems: "center",
19
+ justifyContent: "space-between",
20
+ overflow: "hidden",
21
+ boxSizing: "border-box",
22
+ pageBreakInside: "avoid",
23
+ textAlign: "center",
24
+ }, children: [brandName && _jsx("div", { style: { fontWeight: 800, fontSize: "11pt", letterSpacing: "0.05em" }, children: brandName }), qrDataUrl && (_jsx("img", { src: qrDataUrl, alt: "qr", style: { width: "16mm", height: "16mm", background: "#fff", padding: "1mm", borderRadius: "2px" } })), _jsxs("div", { style: { textAlign: "center" }, children: [_jsx("div", { style: { fontSize: "8pt", fontWeight: 600 }, children: "Scan to shop" }), _jsxs("div", { style: { fontSize: "6pt", color: "rgba(255,255,255,0.75)" }, children: [store.storeName, brandName ? ` on ${brandName}` : ""] }), _jsx("div", { style: { fontSize: "5pt", color: "rgba(255,255,255,0.55)", marginTop: "0.5mm" }, children: publicBaseUrl.replace(/^https?:\/\//, "") })] })] }));
25
+ }
@@ -0,0 +1,11 @@
1
+ export { InventoryLabel } from "./InventoryLabel";
2
+ export { OrderPackingLabel, type OrderForLabel } from "./OrderPackingLabel";
3
+ export { StoreCard } from "./StoreCard";
4
+ export { WebsiteCard } from "./WebsiteCard";
5
+ export { LabelDesignPicker } from "./LabelDesignPicker";
6
+ export { PrintGrid } from "./PrintGrid";
7
+ export { PhysicalLocationModal } from "./PhysicalLocationModal";
8
+ export { PrintCenterView } from "./PrintCenterView";
9
+ export { useInventoryPdf } from "./useInventoryPdf";
10
+ export type { LabelDesign } from "./types";
11
+ export { DEFAULT_PRODUCT_LABEL_DESIGN, DEFAULT_ORDER_LABEL_DESIGN, DEFAULT_CARD_DESIGN, LABEL_DESIGN_STORAGE_KEY, } from "./types";
@@ -0,0 +1,10 @@
1
+ export { InventoryLabel } from "./InventoryLabel";
2
+ export { OrderPackingLabel } from "./OrderPackingLabel";
3
+ export { StoreCard } from "./StoreCard";
4
+ export { WebsiteCard } from "./WebsiteCard";
5
+ export { LabelDesignPicker } from "./LabelDesignPicker";
6
+ export { PrintGrid } from "./PrintGrid";
7
+ export { PhysicalLocationModal } from "./PhysicalLocationModal";
8
+ export { PrintCenterView } from "./PrintCenterView";
9
+ export { useInventoryPdf } from "./useInventoryPdf";
10
+ export { DEFAULT_PRODUCT_LABEL_DESIGN, DEFAULT_ORDER_LABEL_DESIGN, DEFAULT_CARD_DESIGN, LABEL_DESIGN_STORAGE_KEY, } from "./types";
@@ -0,0 +1,20 @@
1
+ export interface LabelDesign {
2
+ template: "minimal" | "detailed" | "branded";
3
+ colorScheme: "light" | "dark" | "store-primary";
4
+ size: {
5
+ widthMm: number;
6
+ heightMm: number;
7
+ };
8
+ show: {
9
+ logo: boolean;
10
+ price: boolean;
11
+ stock: boolean;
12
+ barcode: boolean;
13
+ location: boolean;
14
+ listingTypeBadge: boolean;
15
+ };
16
+ }
17
+ export declare const LABEL_DESIGN_STORAGE_KEY = "print-center:label-design";
18
+ export declare const DEFAULT_PRODUCT_LABEL_DESIGN: LabelDesign;
19
+ export declare const DEFAULT_ORDER_LABEL_DESIGN: LabelDesign;
20
+ export declare const DEFAULT_CARD_DESIGN: LabelDesign;
@@ -0,0 +1,20 @@
1
+ "use client";
2
+ export const LABEL_DESIGN_STORAGE_KEY = "print-center:label-design";
3
+ export const DEFAULT_PRODUCT_LABEL_DESIGN = {
4
+ template: "detailed",
5
+ colorScheme: "light",
6
+ size: { widthMm: 62, heightMm: 38 },
7
+ show: { logo: true, price: true, stock: true, barcode: true, location: true, listingTypeBadge: true },
8
+ };
9
+ export const DEFAULT_ORDER_LABEL_DESIGN = {
10
+ template: "detailed",
11
+ colorScheme: "light",
12
+ size: { widthMm: 100, heightMm: 70 },
13
+ show: { logo: true, price: false, stock: false, barcode: true, location: true, listingTypeBadge: false },
14
+ };
15
+ export const DEFAULT_CARD_DESIGN = {
16
+ template: "branded",
17
+ colorScheme: "light",
18
+ size: { widthMm: 85, heightMm: 54 },
19
+ show: { logo: true, price: false, stock: false, barcode: true, location: false, listingTypeBadge: false },
20
+ };
@@ -0,0 +1,18 @@
1
+ import type { ProductItem } from "../../../../../features/products/types";
2
+ import type { OrderForLabel } from "./OrderPackingLabel";
3
+ import type { StoreForCard } from "./StoreCard";
4
+ import type { LabelDesign } from "./types";
5
+ interface UseInventoryPdfOptions {
6
+ products?: ProductItem[];
7
+ orders?: OrderForLabel[];
8
+ storeCards?: StoreForCard[];
9
+ websiteCards?: StoreForCard[];
10
+ design: LabelDesign;
11
+ publicBaseUrl: string;
12
+ brandName?: string;
13
+ }
14
+ export declare function useInventoryPdf({ products, orders, storeCards, websiteCards, design, publicBaseUrl, brandName, }: UseInventoryPdfOptions): {
15
+ downloadPdf: () => Promise<void>;
16
+ isGenerating: boolean;
17
+ };
18
+ export {};