@mohasinac/appkit 4.15.0 → 4.16.1
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/_internal/shared/actions/action-registry.d.ts +9 -2
- package/dist/_internal/shared/actions/action-registry.js +455 -6
- package/dist/_internal/shared/features/blog/schema.d.ts +4 -4
- package/dist/_internal/shared/features/cart/schema.d.ts +11 -11
- package/dist/_internal/shared/features/categories/bundle-schemas.d.ts +22 -22
- package/dist/_internal/shared/features/orders/schema.d.ts +4 -4
- package/dist/_internal/shared/features/products/schema.d.ts +25 -25
- package/dist/_internal/shared/features/promotions/schema.d.ts +4 -4
- package/dist/_internal/shared/features/reviews/schema.d.ts +2 -2
- package/dist/client.d.ts +3 -3
- package/dist/client.js +3 -3
- package/dist/contracts/extend.d.ts +29 -0
- package/dist/contracts/extend.js +20 -0
- package/dist/contracts/index.d.ts +2 -1
- package/dist/contracts/index.js +2 -0
- package/dist/features/admin/components/AdminViewCards.js +24 -17
- package/dist/features/admin/components/DataListingView.js +15 -1
- package/dist/features/admin/components/DataTable.js +7 -17
- package/dist/features/auctions/schemas/index.d.ts +14 -14
- package/dist/features/auth/schemas/index.d.ts +2 -2
- package/dist/features/blog/actions/blog-actions.d.ts +7 -7
- package/dist/features/blog/schemas/blog-form.d.ts +6 -6
- package/dist/features/blog/schemas/index.d.ts +10 -10
- package/dist/features/cart/schemas/index.d.ts +3 -3
- package/dist/features/catalogue/schemas/validation.d.ts +12 -12
- package/dist/features/categories/schemas/index.d.ts +16 -16
- package/dist/features/collections/schemas/index.d.ts +8 -8
- package/dist/features/events/schemas/index.d.ts +2 -2
- package/dist/features/faq/actions/faq-actions.d.ts +6 -6
- package/dist/features/faq/schemas/index.d.ts +6 -6
- package/dist/features/grouped/schemas/grouped-listing-form.d.ts +2 -2
- package/dist/features/grouped/schemas/index.d.ts +4 -4
- package/dist/features/homepage/schemas/index.d.ts +40 -40
- package/dist/features/messages/schemas/index.d.ts +2 -2
- package/dist/features/orders/schemas/index.d.ts +24 -24
- package/dist/features/pre-orders/schemas/index.d.ts +4 -4
- package/dist/features/products/schemas/index.d.ts +36 -36
- package/dist/features/products/schemas/product-features.validators.d.ts +2 -2
- package/dist/features/promotions/schemas/index.d.ts +14 -14
- package/dist/features/reviews/schemas/index.d.ts +14 -14
- package/dist/features/scams/schemas/index.d.ts +2 -2
- package/dist/features/search/schemas/index.d.ts +2 -2
- package/dist/features/seller/components/SellerAnalyticsAlertsView.js +27 -9
- package/dist/features/seller/schemas/index.d.ts +2 -2
- package/dist/features/shipments/schemas/validation.d.ts +22 -22
- package/dist/features/store-extensions/schemas/listing-template-form.d.ts +22 -4
- package/dist/features/store-extensions/schemas/listing-template-form.js +42 -1
- package/dist/features/store-extensions/schemas/shipping-config-form.d.ts +19 -13
- package/dist/features/store-extensions/schemas/shipping-config-form.js +25 -2
- package/dist/features/store-extensions/schemas/store-category-form.d.ts +42 -2
- package/dist/features/store-extensions/schemas/store-category-form.js +28 -0
- package/dist/features/stores/schemas/index.d.ts +4 -4
- package/dist/features/support/schemas/index.d.ts +4 -4
- package/dist/features/tester/seed-data/tester-checklist-seed-data.js +24 -0
- package/dist/features/wishlist/hooks/useWishlistWithGuest.d.ts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/schemas/registry.d.ts +116 -113
- package/dist/styles.css +1 -1
- package/dist/tailwind-utilities.css +1 -1
- package/dist/ui/DataTable.js +4 -2
- package/dist/ui/columns/build-columns.d.ts +6 -1
- package/dist/ui/columns/build-columns.js +53 -0
- package/dist/ui/columns/cell-renderers.d.ts +68 -0
- package/dist/ui/columns/cell-renderers.js +111 -0
- package/dist/ui/columns/column-renderers.d.ts +6 -1
- package/dist/ui/columns/column-renderers.js +6 -1
- package/dist/ui/columns/index.d.ts +2 -1
- package/dist/ui/columns/index.js +5 -1
- package/dist/ui/components/Button.js +27 -2
- package/dist/ui/icons/icon-registry.d.ts +65 -0
- package/dist/ui/icons/icon-registry.js +115 -0
- package/package.json +1 -1
package/dist/contracts/extend.js
CHANGED
|
@@ -37,6 +37,26 @@
|
|
|
37
37
|
* <ProductGrid products={products} {...productExt.slots} />
|
|
38
38
|
* ```
|
|
39
39
|
*/
|
|
40
|
+
/**
|
|
41
|
+
* Tailwind classes per priority. `always` emits nothing — an unprefixed
|
|
42
|
+
* column is visible at every width.
|
|
43
|
+
*
|
|
44
|
+
* Written out in full rather than interpolated: Tailwind's scanner only sees
|
|
45
|
+
* literal class strings, so `hidden ${bp}:table-cell` would be purged.
|
|
46
|
+
*/
|
|
47
|
+
export const COLUMN_PRIORITY_CLASS = {
|
|
48
|
+
always: "",
|
|
49
|
+
md: "hidden md:table-cell",
|
|
50
|
+
lg: "hidden lg:table-cell",
|
|
51
|
+
xl: "hidden xl:table-cell",
|
|
52
|
+
};
|
|
53
|
+
/** The same, for a non-table (card/list) cell where `table-cell` is wrong. */
|
|
54
|
+
export const COLUMN_PRIORITY_CLASS_BLOCK = {
|
|
55
|
+
always: "",
|
|
56
|
+
md: "hidden md:block",
|
|
57
|
+
lg: "hidden lg:block",
|
|
58
|
+
xl: "hidden xl:block",
|
|
59
|
+
};
|
|
40
60
|
/**
|
|
41
61
|
* Merges an array of extra filter/sort definitions with a base set,
|
|
42
62
|
* respecting `position` ordering. Used internally by listing views.
|
|
@@ -17,7 +17,8 @@ export type { ExtraFormField, ExtraFieldRenderArgs } from "./form";
|
|
|
17
17
|
export { registerFormFields, resolveFormFields, removeFormFields, _resetFormFields, } from "./form";
|
|
18
18
|
export type { RouteStub, ApiRouteStub, FeatureManifest, FeaturesConfig, } from "./feature";
|
|
19
19
|
export type { SiteConfig, NavItem } from "./config";
|
|
20
|
-
export type { WithTransformOpts, GenericListResponse, TableColumn, ColumnExtensionOpts, LayoutSlots, FeatureExtension, } from "./extend";
|
|
20
|
+
export type { WithTransformOpts, GenericListResponse, TableColumn, ColumnPriority, ColumnExtensionOpts, LayoutSlots, FeatureExtension, } from "./extend";
|
|
21
|
+
export { COLUMN_PRIORITY_CLASS, COLUMN_PRIORITY_CLASS_BLOCK } from "./extend";
|
|
21
22
|
export type { PaginationConfig, StickyConfig, TableConfig, TableViewMode, } from "./table";
|
|
22
23
|
export { DEFAULT_PAGINATION_CONFIG, DEFAULT_STICKY_CONFIG, DEFAULT_TABLE_CONFIG, mergeTableConfig, } from "./table";
|
|
23
24
|
export type { IFieldOps, FieldSentinel } from "./field-ops";
|
package/dist/contracts/index.js
CHANGED
|
@@ -10,6 +10,8 @@ export { IShippingProvider } from "./shipping";
|
|
|
10
10
|
export { registerProviders, getProviders, _resetProviders } from "./registry";
|
|
11
11
|
export { setCollectionHooks, getCollectionHooks, removeCollectionHooks, _resetCollectionHooks, } from "./repository";
|
|
12
12
|
export { registerFormFields, resolveFormFields, removeFormFields, _resetFormFields, } from "./form";
|
|
13
|
+
// Value exports (the priority→class maps are runtime lookups, not types).
|
|
14
|
+
export { COLUMN_PRIORITY_CLASS, COLUMN_PRIORITY_CLASS_BLOCK } from "./extend";
|
|
13
15
|
export { DEFAULT_PAGINATION_CONFIG, DEFAULT_STICKY_CONFIG, DEFAULT_TABLE_CONFIG, mergeTableConfig, } from "./table";
|
|
14
16
|
export { registerFieldOps, serverTimestamp, increment, arrayUnion, arrayRemove, deleteField, } from "./field-ops";
|
|
15
17
|
export { registerClientRealtimeProvider, getClientRealtimeProvider, } from "./client-realtime";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { Checkbox, Div, Grid, Row, Span, Stack, Text } from "../../../ui";
|
|
4
|
-
import {
|
|
4
|
+
import { STATUS_TONE_CLASSES, renderStatusBadge } from "../../../ui/columns/cell-renderers";
|
|
5
5
|
import { MediaImage } from "../../media/MediaImage";
|
|
6
6
|
const __P = {
|
|
7
7
|
p3: "p-[var(--appkit-space-3)]",
|
|
@@ -9,26 +9,33 @@ const __P = {
|
|
|
9
9
|
const __O = {
|
|
10
10
|
hidden: "overflow-hidden",
|
|
11
11
|
};
|
|
12
|
-
const STATUS_TONE_CLASSES = {
|
|
13
|
-
success: "bg-success-surface text-success",
|
|
14
|
-
warning: "bg-warning-surface text-warning",
|
|
15
|
-
error: "bg-error-surface text-error",
|
|
16
|
-
info: "bg-info-surface text-info",
|
|
17
|
-
neutral: "bg-primary-50 text-primary-800 dark:bg-secondary-900/30 dark:text-secondary-300",
|
|
18
|
-
};
|
|
19
12
|
function RowAvatar({ image, alt, icon, size = "9" }) {
|
|
20
13
|
const dims = size === "12" ? "h-12 w-12" : "h-9 w-9";
|
|
21
14
|
return (_jsx(Div, { className: `relative ${dims} shrink-0`, overflow: "hidden", rounded: "full", children: _jsx(MediaImage, { src: image, alt: alt, size: "avatar", fallback: icon }) }));
|
|
22
15
|
}
|
|
16
|
+
/*
|
|
17
|
+
* Flag chips, all drawn from the shared tone map.
|
|
18
|
+
*
|
|
19
|
+
* Three defects lived in the previous literal list:
|
|
20
|
+
* - `isSold` carried TWO backgrounds and TWO inks on one element
|
|
21
|
+
* (`bg-…surface … bg-…surface-elevated …`). Tailwind emits all four and
|
|
22
|
+
* stylesheet order — not string order — decides the winner, so the painted
|
|
23
|
+
* colour was not what the list said. The identical bug was found and fixed
|
|
24
|
+
* on the scammer status badge the same week.
|
|
25
|
+
* - `isPromoted` was raw dual-theme purple (`bg-purple-100 … dark:bg-purple-900/30`),
|
|
26
|
+
* the hand-written theme branching that variants exist to absorb.
|
|
27
|
+
* - `featured` repeated its light classes under `dark:`, which is a no-op —
|
|
28
|
+
* `-surface` tokens already invert with the theme.
|
|
29
|
+
*/
|
|
23
30
|
const FLAG_BADGES = [
|
|
24
|
-
{ key: "featured", label: "Featured",
|
|
25
|
-
{ key: "isPromoted", label: "Promoted",
|
|
26
|
-
{ key: "isOnSale", label: "Sale",
|
|
27
|
-
|
|
31
|
+
{ key: "featured", label: "Featured", tone: "warning" },
|
|
32
|
+
{ key: "isPromoted", label: "Promoted", tone: "info" },
|
|
33
|
+
{ key: "isOnSale", label: "Sale", tone: "success" },
|
|
34
|
+
// Sold is the absence of availability, not a status outcome — neutral.
|
|
35
|
+
{ key: "isSold", label: "Sold", tone: "neutral" },
|
|
28
36
|
];
|
|
29
37
|
function StatusBadge({ status }) {
|
|
30
|
-
|
|
31
|
-
return (_jsx(Span, { size: "xs", weight: "medium", className: `inline-flex truncate max-w-[120px] ${STATUS_TONE_CLASSES[tone]}`, rounded: "full", padding: "pill-xs", children: status }));
|
|
38
|
+
return _jsx(_Fragment, { children: renderStatusBadge(status) });
|
|
32
39
|
}
|
|
33
40
|
function SkeletonCard({ view }) {
|
|
34
41
|
if (view === "list") {
|
|
@@ -47,14 +54,14 @@ function AdminCardItem({ row, view, selected, onToggleSelect, onRowClick, render
|
|
|
47
54
|
return (_jsxs(Row, { gap: "sm", className: [
|
|
48
55
|
"px-[var(--appkit-space-4)] py-[var(--appkit-space-3)] cursor-pointer transition-colors hover:bg-zinc-50 hover:bg-[var(--appkit-color-surface-elevated)]/50",
|
|
49
56
|
selected ? "bg-primary-50/40 dark:bg-primary-900/10" : "",
|
|
50
|
-
].filter(Boolean).join(" "), onClick: handleClick, role: onRowClick ? "button" : undefined, children: [onToggleSelect && (_jsx(Div, { "data-no-row-click": true, className: "shrink-0", onClick: (e) => { e.stopPropagation(); onToggleSelect(row.id); }, children: _jsx(Checkbox, { bare: true, checked: selected, onChange: () => onToggleSelect(row.id), className: "h-4 w-4 rounded border-zinc-300 text-primary accent-primary cursor-pointer", "aria-label": `Select ${row.primary}` }) })), _jsx(RowAvatar, { image: row.image, alt: row.primary, icon: resourceIcon }), _jsxs(Stack, { gap: "none", className: "flex-1 min-w-0", children: [_jsx(Text, { size: "sm", weight: "semibold", className: "truncate", color: "primary", children: row.primary }), _jsx(Text, { size: "xs", color: "muted", className: "truncate", children: row.secondary }), row.barcodeId && (_jsx(Text, { size: "xs", color: "faint", className: "truncate font-mono", children: row.barcodeId }))] }), flags.length > 0 && (_jsx(Row, { gap: "xs", className: "hidden sm:flex shrink-0", children: flags.map(({ key, label,
|
|
57
|
+
].filter(Boolean).join(" "), onClick: handleClick, role: onRowClick ? "button" : undefined, children: [onToggleSelect && (_jsx(Div, { "data-no-row-click": true, className: "shrink-0", onClick: (e) => { e.stopPropagation(); onToggleSelect(row.id); }, children: _jsx(Checkbox, { bare: true, checked: selected, onChange: () => onToggleSelect(row.id), className: "h-4 w-4 rounded border-zinc-300 text-primary accent-primary cursor-pointer", "aria-label": `Select ${row.primary}` }) })), _jsx(RowAvatar, { image: row.image, alt: row.primary, icon: resourceIcon }), _jsxs(Stack, { gap: "none", className: "flex-1 min-w-0", children: [_jsx(Text, { size: "sm", weight: "semibold", className: "truncate", color: "primary", children: row.primary }), _jsx(Text, { size: "xs", color: "muted", className: "truncate", children: row.secondary }), row.barcodeId && (_jsx(Text, { size: "xs", color: "faint", className: "truncate font-mono", children: row.barcodeId }))] }), flags.length > 0 && (_jsx(Row, { gap: "xs", className: "hidden sm:flex shrink-0", children: flags.map(({ key, label, tone }) => (_jsx(Span, { padding: "pill-2xs", weight: "medium", className: `inline-flex text-[10px] ${STATUS_TONE_CLASSES[tone]}`, rounded: "full", children: label }, key))) })), _jsx(StatusBadge, { status: row.status }), _jsx(Span, { size: "xs", color: "muted", className: "hidden sm:block shrink-0 w-24", align: "end", children: row.updatedAt }), renderRowActions && (_jsx(Div, { "data-no-row-click": true, className: "shrink-0", onClick: (e) => e.stopPropagation(), children: renderRowActions(row) }))] }));
|
|
51
58
|
}
|
|
52
59
|
return (_jsxs(Div, { rounded: "xl", className: [
|
|
53
60
|
"border overflow-hidden cursor-pointer transition-all hover:shadow-md hover:-translate-y-0.5",
|
|
54
61
|
selected
|
|
55
62
|
? "border-primary ring-1 ring-primary/20 bg-primary-50/30 dark:bg-primary-900/10"
|
|
56
63
|
: "border-zinc-100 border-[var(--appkit-color-border)] bg-[var(--appkit-color-surface)]",
|
|
57
|
-
].filter(Boolean).join(" "), onClick: handleClick, role: onRowClick ? "button" : undefined, children: [onToggleSelect && (_jsxs(Row, { gap: "xs", "data-no-row-click": true, paddingY: "t-sm", padding: "x-sm", onClick: (e) => { e.stopPropagation(); onToggleSelect(row.id); }, children: [_jsx(Checkbox, { bare: true, checked: selected, onChange: () => onToggleSelect(row.id), className: "h-4 w-4 rounded border-zinc-300 text-primary accent-primary cursor-pointer", "aria-label": `Select ${row.primary}` }), flags.length > 0 && (_jsx(Row, { gap: "xs", wrap: true, children: flags.map(({ key, label,
|
|
64
|
+
].filter(Boolean).join(" "), onClick: handleClick, role: onRowClick ? "button" : undefined, children: [onToggleSelect && (_jsxs(Row, { gap: "xs", "data-no-row-click": true, paddingY: "t-sm", padding: "x-sm", onClick: (e) => { e.stopPropagation(); onToggleSelect(row.id); }, children: [_jsx(Checkbox, { bare: true, checked: selected, onChange: () => onToggleSelect(row.id), className: "h-4 w-4 rounded border-zinc-300 text-primary accent-primary cursor-pointer", "aria-label": `Select ${row.primary}` }), flags.length > 0 && (_jsx(Row, { gap: "xs", wrap: true, children: flags.map(({ key, label, tone }) => (_jsx(Span, { padding: "pill-2xs", weight: "medium", className: `inline-flex text-[10px] ${STATUS_TONE_CLASSES[tone]}`, rounded: "full", children: label }, key))) }))] })), _jsxs(Stack, { gap: "xs", className: `${__P.p3}.5`, children: [_jsxs(Row, { gap: "sm", align: "center", children: [_jsx(RowAvatar, { image: row.image, alt: row.primary, icon: resourceIcon, size: "12" }), _jsxs(Stack, { gap: "none", className: "min-w-0 flex-1", children: [_jsx(Text, { size: "sm", weight: "semibold", className: "line-clamp-2 leading-snug", color: "primary", children: row.primary }), _jsx(Text, { size: "xs", color: "muted", className: "truncate", children: row.secondary })] })] }), row.barcodeId && (_jsx(Text, { size: "xs", color: "faint", className: "truncate font-mono", children: row.barcodeId })), _jsxs(Row, { justify: "between", gap: "xs", children: [_jsx(StatusBadge, { status: row.status }), _jsx(Span, { color: "muted", className: "text-[11px] shrink-0", children: row.updatedAt })] }), renderRowActions && (_jsx(Row, { "data-no-row-click": true, justify: "end", gap: "xs", className: "border-t border-[var(--appkit-color-border)] -mx-[var(--appkit-space-3)] -mb-[var(--appkit-space-3)] mt-[var(--appkit-space-1)] px-[var(--appkit-space-3)] py-[var(--appkit-space-2)]", onClick: (e) => e.stopPropagation(), children: renderRowActions(row) }))] })] }));
|
|
58
65
|
}
|
|
59
66
|
export function AdminViewCards({ rows, view, isLoading, emptyLabel = "No items found", onRowClick, selectedIdSet, onToggleSelect, renderRowActions, resourceIcon, }) {
|
|
60
67
|
if (isLoading) {
|
|
@@ -7,7 +7,21 @@ import { useAdminListing } from "../hooks/useAdminListing";
|
|
|
7
7
|
import { getResourceIcon } from "../../../ui/columns/column-renderers";
|
|
8
8
|
import { AdminViewCards } from "./AdminViewCards";
|
|
9
9
|
import { DataTable } from "./DataTable";
|
|
10
|
+
import { useBreakpoint } from "../../../react/hooks/useBreakpoint";
|
|
10
11
|
export function DataListingView({ config, }) {
|
|
12
|
+
/*
|
|
13
|
+
* Below `md` the table view is suppressed entirely and the list/card view is
|
|
14
|
+
* rendered instead.
|
|
15
|
+
*
|
|
16
|
+
* No amount of per-column hiding rescues a grid at 320px — even a two-column
|
|
17
|
+
* table wraps its cells, so rows grow to different heights and stop being
|
|
18
|
+
* scannable. `TableColumn.priority` handles density from `md` upward; this
|
|
19
|
+
* handles the case below it, where the answer is "not a table at all".
|
|
20
|
+
*
|
|
21
|
+
* The user's stored preference is untouched, so widening the window brings
|
|
22
|
+
* their table straight back.
|
|
23
|
+
*/
|
|
24
|
+
const { isMobile } = useBreakpoint();
|
|
11
25
|
const effectiveInitialView = config.initialView ?? "list";
|
|
12
26
|
const listing = useAdminListing({
|
|
13
27
|
...config,
|
|
@@ -66,7 +80,7 @@ export function DataListingView({ config, }) {
|
|
|
66
80
|
: undefined;
|
|
67
81
|
return (_jsxs(Div, { className: config.className ?? "min-h-screen", children: [_jsx(ListingToolbar, { filterCount: activeFilterCount, onFiltersClick: openFilters, searchValue: searchInput, searchPlaceholder: config.searchPlaceholder, onSearchChange: setSearchInput, onSearchCommit: commitSearch, sortValue: table.get("sort") || config.defaultSort, sortOptions: config.sortOptions, onSortChange: (v) => table.set("sort", v), showTableView: !config.hideTableView, toggles: config.toggles, view: view, onViewChange: (v) => setView(v), onResetAll: resetAll, hasActiveState: hasActiveState, extra: config.primaryAction || config.toolbarExtra ? (_jsxs(Row, { align: "center", gap: "sm", children: [config.toolbarExtra, config.primaryAction && (_jsxs(Button, { gap: "sm", size: "sm", onClick: () => config.primaryAction.onClick({
|
|
68
82
|
openCreatePanel: panel.openCreatePanel,
|
|
69
|
-
}), children: [config.primaryAction.icon ?? _jsx(Plus, { className: "h-4 w-4" }), config.primaryAction.label] }))] })) : undefined }), config.renderAboveContent?.(), bulkActionItems && (_jsx(BulkActionBar, { selectedCount: selection.selectedCount, onClearSelection: selection.clearSelection, actions: bulkActionItems })), totalPages > 1 && (_jsx(StickyToolbar, { offset: "header+pagination", tone: "translucent", border: true, padding: "toolbar", children: _jsx(Row, { justify: "center", children: _jsx(Pagination, { currentPage: currentPage, totalPages: totalPages, onPageChange: (p) => table.setPage(p), pageSize: pageSize, onPageSizeChange: setPageSize, paginationConfig: { showPageSizeSelector: true, pageSizeOptions: [10, 25, 50, 100] } }) }) })), _jsxs(Div, { paddingX: "x-sm-md", padding: "y-md", children: [errorMessage && (_jsx(Div, { textSize: "sm", className: "mb-4 border border-error/20", color: "error", surface: "danger-surface", padding: "inline", rounded: "xl", children: errorMessage })), view === "table" && !config.hideTableView ? (_jsx(DataTable, { columns: config.columns, rows: rows, resourceIcon: resourceIcon, isLoading: isLoading, emptyLabel: config.emptyLabel ?? `No ${config.title.toLowerCase()} found`, selectedIds: selection.selectedIdSet, onToggleSelect: selection.toggle, onToggleSelectAll: (next) => next
|
|
83
|
+
}), children: [config.primaryAction.icon ?? _jsx(Plus, { className: "h-4 w-4" }), config.primaryAction.label] }))] })) : undefined }), config.renderAboveContent?.(), bulkActionItems && (_jsx(BulkActionBar, { selectedCount: selection.selectedCount, onClearSelection: selection.clearSelection, actions: bulkActionItems })), totalPages > 1 && (_jsx(StickyToolbar, { offset: "header+pagination", tone: "translucent", border: true, padding: "toolbar", children: _jsx(Row, { justify: "center", children: _jsx(Pagination, { currentPage: currentPage, totalPages: totalPages, onPageChange: (p) => table.setPage(p), pageSize: pageSize, onPageSizeChange: setPageSize, paginationConfig: { showPageSizeSelector: true, pageSizeOptions: [10, 25, 50, 100] } }) }) })), _jsxs(Div, { paddingX: "x-sm-md", padding: "y-md", children: [errorMessage && (_jsx(Div, { textSize: "sm", className: "mb-4 border border-error/20", color: "error", surface: "danger-surface", padding: "inline", rounded: "xl", children: errorMessage })), view === "table" && !config.hideTableView && !isMobile ? (_jsx(DataTable, { columns: config.columns, rows: rows, resourceIcon: resourceIcon, isLoading: isLoading, emptyLabel: config.emptyLabel ?? `No ${config.title.toLowerCase()} found`, selectedIds: selection.selectedIdSet, onToggleSelect: selection.toggle, onToggleSelectAll: (next) => next
|
|
70
84
|
? selection.setSelectedIds(rows.map((r) => r.id))
|
|
71
85
|
: selection.clearSelection(), rowHrefTemplate: config.rowHrefTemplate, onRowClick: config.onRowClick
|
|
72
86
|
? (row) => config.onRowClick(row, {
|
|
@@ -1,36 +1,26 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { BaseListingCard, Button, Checkbox, Div, Row, Span, Stack, Table, Tbody, Td, Text, Th, Thead, Tr } from "../../../ui";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
4
|
+
import { renderStatusBadge, renderThumbnail } from "../../../ui/columns/cell-renderers";
|
|
5
|
+
import { resolveColumnPriority } from "../../../ui/columns/build-columns";
|
|
6
|
+
import { COLUMN_PRIORITY_CLASS } from "../../../contracts/extend";
|
|
6
7
|
import { useLongPress } from "../../../react/hooks/useLongPress";
|
|
7
8
|
const __O = {
|
|
8
9
|
hidden: "overflow-hidden",
|
|
9
10
|
xAuto: "overflow-x-auto",
|
|
10
11
|
};
|
|
11
|
-
const STATUS_TONE_CLASSES = {
|
|
12
|
-
success: "bg-success-surface text-success",
|
|
13
|
-
warning: "bg-warning-surface text-warning",
|
|
14
|
-
error: "bg-error-surface text-error",
|
|
15
|
-
info: "bg-info-surface text-info",
|
|
16
|
-
neutral: "bg-primary-50 text-primary-800 dark:bg-secondary-900/30 dark:text-secondary-300",
|
|
17
|
-
};
|
|
18
12
|
function buildDefaultColumns(resourceIcon) {
|
|
19
13
|
return [
|
|
20
14
|
{
|
|
21
15
|
key: "primary",
|
|
22
16
|
header: "Name",
|
|
23
|
-
render: (row) => (_jsxs(Row, { gap: "sm", align: "center", children: [
|
|
17
|
+
render: (row) => (_jsxs(Row, { gap: "sm", align: "center", children: [renderThumbnail(typeof row.image === "string" ? row.image : undefined, String(row.primary ?? ""), { rounded: "full", fallback: resourceIcon }), _jsxs(Stack, { gap: "none", className: "min-w-0", children: [_jsx(Text, { weight: "medium", color: "primary", className: "truncate", children: String(row.primary ?? "") }), row.secondary ? _jsx(Text, { size: "xs", color: "muted", className: "truncate", children: String(row.secondary) }) : null] })] })),
|
|
24
18
|
},
|
|
25
19
|
{
|
|
26
20
|
key: "status",
|
|
27
21
|
header: "Status",
|
|
28
22
|
className: "w-32",
|
|
29
|
-
render: (row) =>
|
|
30
|
-
const status = String(row.status ?? "—");
|
|
31
|
-
const tone = getStatusTone(status);
|
|
32
|
-
return (_jsx(Span, { size: "xs", weight: "medium", className: `inline-flex ${STATUS_TONE_CLASSES[tone]}`, rounded: "full", padding: "pill-sm-tall", children: status }));
|
|
33
|
-
},
|
|
23
|
+
render: (row) => renderStatusBadge(row.status == null ? null : String(row.status)),
|
|
34
24
|
},
|
|
35
25
|
{
|
|
36
26
|
key: "updatedAt",
|
|
@@ -54,7 +44,7 @@ function SelectableRow({ row, columns, isSelected, onToggle, renderRowActions, o
|
|
|
54
44
|
}
|
|
55
45
|
: undefined;
|
|
56
46
|
const isInteractive = Boolean(onRowClick ?? rowHref);
|
|
57
|
-
return (_jsxs(Tr, { "data-testid": "data-table-row", onClick: handleClick, onKeyDown: handleKeyDown, role: isInteractive ? "link" : undefined, tabIndex: isInteractive ? 0 : undefined, onMouseDown: selectionEnabled && !isSelected ? longPress.onMouseDown : undefined, onMouseUp: selectionEnabled && !isSelected ? longPress.onMouseUp : undefined, onMouseLeave: selectionEnabled && !isSelected ? longPress.onMouseLeave : undefined, onTouchStart: selectionEnabled && !isSelected ? longPress.onTouchStart : undefined, onTouchEnd: selectionEnabled && !isSelected ? longPress.onTouchEnd : undefined, onTouchCancel: selectionEnabled && !isSelected ? longPress.onTouchCancel : undefined, className: `hover:bg-[var(--appkit-color-bg)] dark:hover:bg-[var(--appkit-color-bg)] ${isInteractive ? "cursor-pointer" : ""} ${isSelected ? "bg-primary/5 dark:bg-primary/10" : ""}`, border: "default", children: [selectionEnabled && (_jsx(Td, { padding: "xs-3", className: "relative w-10", onClick: (e) => e.stopPropagation(), children: _jsx(BaseListingCard.Checkbox, { selected: isSelected, onSelect: (e) => { e.preventDefault(); onToggle?.(row.id, !isSelected); }, label: isSelected ? "Deselect row" : "Select row", position: "top-1/2 left-2 -translate-y-1/2", "data-testid": "row-checkbox" }) })), columns.map((col) => (_jsx(Td, { color: "muted", className: col.className ?? ""
|
|
47
|
+
return (_jsxs(Tr, { "data-testid": "data-table-row", onClick: handleClick, onKeyDown: handleKeyDown, role: isInteractive ? "link" : undefined, tabIndex: isInteractive ? 0 : undefined, onMouseDown: selectionEnabled && !isSelected ? longPress.onMouseDown : undefined, onMouseUp: selectionEnabled && !isSelected ? longPress.onMouseUp : undefined, onMouseLeave: selectionEnabled && !isSelected ? longPress.onMouseLeave : undefined, onTouchStart: selectionEnabled && !isSelected ? longPress.onTouchStart : undefined, onTouchEnd: selectionEnabled && !isSelected ? longPress.onTouchEnd : undefined, onTouchCancel: selectionEnabled && !isSelected ? longPress.onTouchCancel : undefined, className: `hover:bg-[var(--appkit-color-bg)] dark:hover:bg-[var(--appkit-color-bg)] ${isInteractive ? "cursor-pointer" : ""} ${isSelected ? "bg-primary/5 dark:bg-primary/10" : ""}`, border: "default", children: [selectionEnabled && (_jsx(Td, { padding: "xs-3", className: "relative w-10", onClick: (e) => e.stopPropagation(), children: _jsx(BaseListingCard.Checkbox, { selected: isSelected, onSelect: (e) => { e.preventDefault(); onToggle?.(row.id, !isSelected); }, label: isSelected ? "Deselect row" : "Select row", position: "top-1/2 left-2 -translate-y-1/2", "data-testid": "row-checkbox" }) })), columns.map((col) => (_jsx(Td, { color: "muted", className: `${COLUMN_PRIORITY_CLASS[resolveColumnPriority(col)]} ${col.className ?? ""}`, padding: "md", children: col.render
|
|
58
48
|
? col.render(row)
|
|
59
49
|
: String(row[col.key] ?? "") }, col.key))), renderRowActions && (_jsx(Td, { padding: "xs-3", onClick: (e) => e.stopPropagation(), children: renderRowActions(row) }))] }));
|
|
60
50
|
}
|
|
@@ -62,7 +52,7 @@ export function DataTable({ columns: columnsProp, rows, isLoading, sortKey, sort
|
|
|
62
52
|
const columns = (columnsProp ?? buildDefaultColumns(resourceIcon));
|
|
63
53
|
const selectionEnabled = Boolean(onToggleSelect);
|
|
64
54
|
const allRowsSelected = selectionEnabled && rows.length > 0 && rows.every((r) => selectedIds?.has(r.id));
|
|
65
|
-
return (_jsxs(Div, { surface: "card", className: `${__O.hidden}`, children: [_jsx(Div, { className: `${__O.xAuto}`, children: _jsxs(Table, { "data-testid": "data-table", size: "sm", children: [_jsx(Thead, { children: _jsxs(Tr, { className: "bg-[var(--appkit-color-bg)] dark:bg-[var(--appkit-color-surface-elevated)]", border: "default", children: [selectionEnabled && (_jsx(Th, { padding: "xs-3", scope: "col", className: "w-10", children: onToggleSelectAll && (_jsx(Checkbox, { bare: true, "data-testid": "select-all-checkbox", "aria-label": allRowsSelected ? "Deselect all" : "Select all", checked: allRowsSelected, onChange: () => onToggleSelectAll(!allRowsSelected), className: "h-4 w-4 rounded border-[var(--appkit-color-border)] accent-zinc-900 dark:accent-zinc-100" })) })), columns.map((col) => (_jsxs(Th, { scope: "col", onClick: col.sortable && onSort ? () => onSort(col.key) : undefined, className: `text-left text-[var(--appkit-color-text)]
|
|
55
|
+
return (_jsxs(Div, { surface: "card", className: `${__O.hidden}`, children: [_jsx(Div, { className: `${__O.xAuto}`, children: _jsxs(Table, { "data-testid": "data-table", size: "sm", children: [_jsx(Thead, { children: _jsxs(Tr, { className: "bg-[var(--appkit-color-bg)] dark:bg-[var(--appkit-color-surface-elevated)]", border: "default", children: [selectionEnabled && (_jsx(Th, { padding: "xs-3", scope: "col", className: "w-10", children: onToggleSelectAll && (_jsx(Checkbox, { bare: true, "data-testid": "select-all-checkbox", "aria-label": allRowsSelected ? "Deselect all" : "Select all", checked: allRowsSelected, onChange: () => onToggleSelectAll(!allRowsSelected), className: "h-4 w-4 rounded border-[var(--appkit-color-border)] accent-zinc-900 dark:accent-zinc-100" })) })), columns.map((col) => (_jsxs(Th, { scope: "col", onClick: col.sortable && onSort ? () => onSort(col.key) : undefined, className: `text-left text-[var(--appkit-color-text)] ${col.sortable && onSort ? "cursor-pointer select-none hover:text-primary" : ""} ${COLUMN_PRIORITY_CLASS[resolveColumnPriority(col)]} ${col.className ?? ""}`, padding: "md", weight: "semibold", children: [col.header, col.sortable && sortKey === col.key && (_jsx(Span, { className: "ml-1", children: sortDir === "asc" ? "↑" : "↓" }))] }, col.key))), renderRowActions && _jsx(Th, { padding: "xs-3", scope: "col", className: "w-12" })] }) }), _jsx(Tbody, { children: isLoading ? (Array.from({ length: 5 }).map((_, i) => (_jsxs(Tr, { border: "default", children: [selectionEnabled && _jsx(Td, { padding: "xs-3", className: "w-10" }), columns.map((col) => (_jsx(Td, { padding: "md", className: COLUMN_PRIORITY_CLASS[resolveColumnPriority(col)], children: _jsx(Div, { className: "h-4 w-full animate-pulse bg-neutral-200", rounded: "default" }) }, col.key)))] }, i)))) : rows.length === 0 ? (_jsx(Tr, { children: _jsx(Td, { colSpan: columns.length + (selectionEnabled ? 1 : 0) + (renderRowActions ? 1 : 0), align: "center", color: "faint", paddingX: "md", paddingY: "md", children: emptyLabel }) })) : (rows.map((row) => (_jsx(SelectableRow, { row: row, columns: columns, isSelected: selectedIds?.has(row.id) ?? false, onToggle: onToggleSelect, renderRowActions: renderRowActions, onRowClick: onRowClick, rowHref: typeof rowHrefTemplate === "function"
|
|
66
56
|
? rowHrefTemplate(row)
|
|
67
57
|
: rowHrefTemplate?.replace("{id}", encodeURIComponent(row.id)), selectionEnabled: selectionEnabled }, row.id)))) })] }) }), totalPages > 1 && onPageChange && (_jsx(Row, { className: "border-t border-neutral-200", padding: "inline", align: "center", justify: "end", gap: "sm", children: Array.from({ length: totalPages }, (_, i) => i + 1).map((p) => (_jsx(Button, { onClick: () => onPageChange(p), variant: p === currentPage ? "primary" : "ghost", size: "sm", className: `h-8 w-8 rounded text-[length:var(--appkit-text-xs)] font-medium transition ${p === currentPage ? "bg-neutral-900 text-white" : "text-[var(--appkit-color-text-muted)] text-[var(--appkit-color-text-muted)] hover:bg-[var(--appkit-color-surface)] hover:bg-[var(--appkit-color-surface-elevated)]"}`, children: p }, p))) }))] }));
|
|
68
58
|
}
|
|
@@ -67,20 +67,15 @@ export declare const auctionItemSchema: z.ZodObject<{
|
|
|
67
67
|
title: string;
|
|
68
68
|
createdAt: string;
|
|
69
69
|
updatedAt: string;
|
|
70
|
-
slug: string;
|
|
71
70
|
price: number;
|
|
71
|
+
listingType: "auction";
|
|
72
|
+
slug: string;
|
|
72
73
|
sellerId: string;
|
|
73
74
|
featured: boolean;
|
|
74
|
-
listingType: "auction";
|
|
75
75
|
auctionEndDate: string;
|
|
76
76
|
startingBid: number;
|
|
77
77
|
bidCount: number;
|
|
78
78
|
storeId?: string | undefined;
|
|
79
|
-
description?: string | undefined;
|
|
80
|
-
mainImage?: string | undefined;
|
|
81
|
-
images?: string[] | undefined;
|
|
82
|
-
currentBid?: number | undefined;
|
|
83
|
-
storeSlug?: string | undefined;
|
|
84
79
|
media?: {
|
|
85
80
|
type: "video" | "image" | "file";
|
|
86
81
|
url: string;
|
|
@@ -90,6 +85,11 @@ export declare const auctionItemSchema: z.ZodObject<{
|
|
|
90
85
|
youtubeId?: string | undefined;
|
|
91
86
|
duration?: number | undefined;
|
|
92
87
|
}[] | undefined;
|
|
88
|
+
description?: string | undefined;
|
|
89
|
+
mainImage?: string | undefined;
|
|
90
|
+
images?: string[] | undefined;
|
|
91
|
+
currentBid?: number | undefined;
|
|
92
|
+
storeSlug?: string | undefined;
|
|
93
93
|
}, {
|
|
94
94
|
currency: string;
|
|
95
95
|
status: "draft" | "published" | "archived" | "sold";
|
|
@@ -97,20 +97,15 @@ export declare const auctionItemSchema: z.ZodObject<{
|
|
|
97
97
|
title: string;
|
|
98
98
|
createdAt: string;
|
|
99
99
|
updatedAt: string;
|
|
100
|
-
slug: string;
|
|
101
100
|
price: number;
|
|
101
|
+
listingType: "auction";
|
|
102
|
+
slug: string;
|
|
102
103
|
sellerId: string;
|
|
103
104
|
featured: boolean;
|
|
104
|
-
listingType: "auction";
|
|
105
105
|
auctionEndDate: string;
|
|
106
106
|
startingBid: number;
|
|
107
107
|
bidCount: number;
|
|
108
108
|
storeId?: string | undefined;
|
|
109
|
-
description?: string | undefined;
|
|
110
|
-
mainImage?: string | undefined;
|
|
111
|
-
images?: string[] | undefined;
|
|
112
|
-
currentBid?: number | undefined;
|
|
113
|
-
storeSlug?: string | undefined;
|
|
114
109
|
media?: {
|
|
115
110
|
type: "video" | "image" | "file";
|
|
116
111
|
url: string;
|
|
@@ -120,6 +115,11 @@ export declare const auctionItemSchema: z.ZodObject<{
|
|
|
120
115
|
youtubeId?: string | undefined;
|
|
121
116
|
duration?: number | undefined;
|
|
122
117
|
}[] | undefined;
|
|
118
|
+
description?: string | undefined;
|
|
119
|
+
mainImage?: string | undefined;
|
|
120
|
+
images?: string[] | undefined;
|
|
121
|
+
currentBid?: number | undefined;
|
|
122
|
+
storeSlug?: string | undefined;
|
|
123
123
|
}>;
|
|
124
124
|
export declare const bidRecordSchema: z.ZodObject<{
|
|
125
125
|
id: z.ZodString;
|
|
@@ -65,14 +65,14 @@ export declare const authUserSchema: z.ZodObject<{
|
|
|
65
65
|
isEmailVerified: z.ZodOptional<z.ZodBoolean>;
|
|
66
66
|
}, "strip", z.ZodTypeAny, {
|
|
67
67
|
id: string;
|
|
68
|
-
role?: "user" | "
|
|
68
|
+
role?: "user" | "admin" | "moderator" | "seller" | "employee" | undefined;
|
|
69
69
|
email?: string | undefined;
|
|
70
70
|
displayName?: string | undefined;
|
|
71
71
|
photoURL?: string | undefined;
|
|
72
72
|
isEmailVerified?: boolean | undefined;
|
|
73
73
|
}, {
|
|
74
74
|
id: string;
|
|
75
|
-
role?: "user" | "
|
|
75
|
+
role?: "user" | "admin" | "moderator" | "seller" | "employee" | undefined;
|
|
76
76
|
email?: string | undefined;
|
|
77
77
|
displayName?: string | undefined;
|
|
78
78
|
photoURL?: string | undefined;
|
|
@@ -72,8 +72,8 @@ export declare const createBlogPostSchema: z.ZodObject<{
|
|
|
72
72
|
status: "draft" | "published" | "archived";
|
|
73
73
|
title: string;
|
|
74
74
|
content: string;
|
|
75
|
-
slug: string;
|
|
76
75
|
category: "news" | "tips" | "guides" | "updates" | "community";
|
|
76
|
+
slug: string;
|
|
77
77
|
tags: string[];
|
|
78
78
|
isFeatured: boolean;
|
|
79
79
|
excerpt: string;
|
|
@@ -108,12 +108,12 @@ export declare const createBlogPostSchema: z.ZodObject<{
|
|
|
108
108
|
}, {
|
|
109
109
|
title: string;
|
|
110
110
|
content: string;
|
|
111
|
-
slug: string;
|
|
112
111
|
category: "news" | "tips" | "guides" | "updates" | "community";
|
|
112
|
+
slug: string;
|
|
113
113
|
excerpt: string;
|
|
114
114
|
status?: "draft" | "published" | "archived" | undefined;
|
|
115
|
-
tags?: string[] | undefined;
|
|
116
115
|
publishedAt?: string | undefined;
|
|
116
|
+
tags?: string[] | undefined;
|
|
117
117
|
isFeatured?: boolean | undefined;
|
|
118
118
|
coverImage?: string | {
|
|
119
119
|
type: "video" | "image" | "file";
|
|
@@ -211,10 +211,10 @@ export declare const updateBlogPostSchema: z.ZodObject<{
|
|
|
211
211
|
status?: "draft" | "published" | "archived" | undefined;
|
|
212
212
|
title?: string | undefined;
|
|
213
213
|
content?: string | undefined;
|
|
214
|
-
slug?: string | undefined;
|
|
215
214
|
category?: "news" | "tips" | "guides" | "updates" | "community" | undefined;
|
|
216
|
-
tags?: string[] | undefined;
|
|
217
215
|
publishedAt?: string | undefined;
|
|
216
|
+
slug?: string | undefined;
|
|
217
|
+
tags?: string[] | undefined;
|
|
218
218
|
isFeatured?: boolean | undefined;
|
|
219
219
|
excerpt?: string | undefined;
|
|
220
220
|
coverImage?: {
|
|
@@ -248,10 +248,10 @@ export declare const updateBlogPostSchema: z.ZodObject<{
|
|
|
248
248
|
status?: "draft" | "published" | "archived" | undefined;
|
|
249
249
|
title?: string | undefined;
|
|
250
250
|
content?: string | undefined;
|
|
251
|
-
slug?: string | undefined;
|
|
252
251
|
category?: "news" | "tips" | "guides" | "updates" | "community" | undefined;
|
|
253
|
-
tags?: string[] | undefined;
|
|
254
252
|
publishedAt?: string | undefined;
|
|
253
|
+
slug?: string | undefined;
|
|
254
|
+
tags?: string[] | undefined;
|
|
255
255
|
isFeatured?: boolean | undefined;
|
|
256
256
|
excerpt?: string | undefined;
|
|
257
257
|
coverImage?: string | {
|
|
@@ -51,11 +51,11 @@ export declare const blogDraftSchema: z.ZodObject<{
|
|
|
51
51
|
status: "draft" | "published" | "archived";
|
|
52
52
|
title: string;
|
|
53
53
|
content: string;
|
|
54
|
-
youtubeId: string;
|
|
55
|
-
slug: string;
|
|
56
54
|
category: "news" | "tips" | "guides" | "updates" | "community";
|
|
57
|
-
tags: string[];
|
|
58
55
|
publishedAt: string;
|
|
56
|
+
slug: string;
|
|
57
|
+
youtubeId: string;
|
|
58
|
+
tags: string[];
|
|
59
59
|
isFeatured: boolean;
|
|
60
60
|
excerpt: string;
|
|
61
61
|
coverImage: string;
|
|
@@ -66,11 +66,11 @@ export declare const blogDraftSchema: z.ZodObject<{
|
|
|
66
66
|
status: "draft" | "published" | "archived";
|
|
67
67
|
title: string;
|
|
68
68
|
content: string;
|
|
69
|
-
youtubeId: string;
|
|
70
|
-
slug: string;
|
|
71
69
|
category: "news" | "tips" | "guides" | "updates" | "community";
|
|
72
|
-
tags: string[];
|
|
73
70
|
publishedAt: string;
|
|
71
|
+
slug: string;
|
|
72
|
+
youtubeId: string;
|
|
73
|
+
tags: string[];
|
|
74
74
|
isFeatured: boolean;
|
|
75
75
|
excerpt: string;
|
|
76
76
|
coverImage: string;
|
|
@@ -125,15 +125,15 @@ export declare const blogPostFirestoreSchema: z.ZodObject<{
|
|
|
125
125
|
updatedAt: string | Date | z.objectOutputType<{
|
|
126
126
|
toDate: z.ZodFunction<z.ZodTuple<[], z.ZodUnknown>, z.ZodDate>;
|
|
127
127
|
}, z.ZodTypeAny, "passthrough">;
|
|
128
|
-
slug: string;
|
|
129
128
|
category: string;
|
|
129
|
+
slug: string;
|
|
130
|
+
views: number;
|
|
130
131
|
tags: string[];
|
|
131
132
|
isFeatured: boolean;
|
|
132
133
|
excerpt: string;
|
|
133
134
|
authorId: string;
|
|
134
135
|
authorName: string;
|
|
135
136
|
readTimeMinutes: number;
|
|
136
|
-
views: number;
|
|
137
137
|
publishedAt?: string | Date | z.objectOutputType<{
|
|
138
138
|
toDate: z.ZodFunction<z.ZodTuple<[], z.ZodUnknown>, z.ZodDate>;
|
|
139
139
|
}, z.ZodTypeAny, "passthrough"> | undefined;
|
|
@@ -178,15 +178,15 @@ export declare const blogPostFirestoreSchema: z.ZodObject<{
|
|
|
178
178
|
updatedAt: string | Date | z.objectInputType<{
|
|
179
179
|
toDate: z.ZodFunction<z.ZodTuple<[], z.ZodUnknown>, z.ZodDate>;
|
|
180
180
|
}, z.ZodTypeAny, "passthrough">;
|
|
181
|
-
slug: string;
|
|
182
181
|
category: string;
|
|
182
|
+
slug: string;
|
|
183
|
+
views: number;
|
|
183
184
|
tags: string[];
|
|
184
185
|
isFeatured: boolean;
|
|
185
186
|
excerpt: string;
|
|
186
187
|
authorId: string;
|
|
187
188
|
authorName: string;
|
|
188
189
|
readTimeMinutes: number;
|
|
189
|
-
views: number;
|
|
190
190
|
publishedAt?: string | Date | z.objectInputType<{
|
|
191
191
|
toDate: z.ZodFunction<z.ZodTuple<[], z.ZodUnknown>, z.ZodDate>;
|
|
192
192
|
}, z.ZodTypeAny, "passthrough"> | undefined;
|
|
@@ -358,8 +358,8 @@ export declare const blogPostSchema: z.ZodObject<{
|
|
|
358
358
|
status: "draft" | "published" | "archived";
|
|
359
359
|
id: string;
|
|
360
360
|
title: string;
|
|
361
|
-
slug: string;
|
|
362
361
|
category: "news" | "tips" | "guides" | "updates" | "community";
|
|
362
|
+
slug: string;
|
|
363
363
|
coverImage: {
|
|
364
364
|
type: "video" | "image" | "file";
|
|
365
365
|
url: string;
|
|
@@ -393,14 +393,14 @@ export declare const blogPostSchema: z.ZodObject<{
|
|
|
393
393
|
content?: string | undefined;
|
|
394
394
|
createdAt?: string | undefined;
|
|
395
395
|
updatedAt?: string | undefined;
|
|
396
|
-
tags?: string[] | undefined;
|
|
397
396
|
publishedAt?: string | undefined;
|
|
397
|
+
views?: number | undefined;
|
|
398
|
+
tags?: string[] | undefined;
|
|
398
399
|
isFeatured?: boolean | undefined;
|
|
399
400
|
excerpt?: string | undefined;
|
|
400
401
|
authorId?: string | undefined;
|
|
401
402
|
authorName?: string | undefined;
|
|
402
403
|
readTimeMinutes?: number | undefined;
|
|
403
|
-
views?: number | undefined;
|
|
404
404
|
metaTitle?: string | undefined;
|
|
405
405
|
metaDescription?: string | undefined;
|
|
406
406
|
authorAvatar?: string | undefined;
|
|
@@ -408,13 +408,14 @@ export declare const blogPostSchema: z.ZodObject<{
|
|
|
408
408
|
status: "draft" | "published" | "archived";
|
|
409
409
|
id: string;
|
|
410
410
|
title: string;
|
|
411
|
-
slug: string;
|
|
412
411
|
category: "news" | "tips" | "guides" | "updates" | "community";
|
|
412
|
+
slug: string;
|
|
413
413
|
content?: string | undefined;
|
|
414
414
|
createdAt?: string | undefined;
|
|
415
415
|
updatedAt?: string | undefined;
|
|
416
|
-
tags?: string[] | undefined;
|
|
417
416
|
publishedAt?: string | undefined;
|
|
417
|
+
views?: number | undefined;
|
|
418
|
+
tags?: string[] | undefined;
|
|
418
419
|
isFeatured?: boolean | undefined;
|
|
419
420
|
excerpt?: string | undefined;
|
|
420
421
|
coverImage?: string | {
|
|
@@ -429,7 +430,6 @@ export declare const blogPostSchema: z.ZodObject<{
|
|
|
429
430
|
authorId?: string | undefined;
|
|
430
431
|
authorName?: string | undefined;
|
|
431
432
|
readTimeMinutes?: number | undefined;
|
|
432
|
-
views?: number | undefined;
|
|
433
433
|
additionalImages?: {
|
|
434
434
|
type: "video" | "image" | "file";
|
|
435
435
|
url: string;
|
|
@@ -57,8 +57,8 @@ export declare const cartItemSchema: z.ZodObject<{
|
|
|
57
57
|
addedAt: z.ZodOptional<z.ZodString>;
|
|
58
58
|
}, "strip", z.ZodTypeAny, {
|
|
59
59
|
id: string;
|
|
60
|
-
productId: string;
|
|
61
60
|
quantity: number;
|
|
61
|
+
productId: string;
|
|
62
62
|
meta?: {
|
|
63
63
|
currency: string;
|
|
64
64
|
title: string;
|
|
@@ -113,8 +113,8 @@ export declare const cartSummarySchema: z.ZodObject<{
|
|
|
113
113
|
addedAt: z.ZodOptional<z.ZodString>;
|
|
114
114
|
}, "strip", z.ZodTypeAny, {
|
|
115
115
|
id: string;
|
|
116
|
-
productId: string;
|
|
117
116
|
quantity: number;
|
|
117
|
+
productId: string;
|
|
118
118
|
meta?: {
|
|
119
119
|
currency: string;
|
|
120
120
|
title: string;
|
|
@@ -147,8 +147,8 @@ export declare const cartSummarySchema: z.ZodObject<{
|
|
|
147
147
|
currency: string;
|
|
148
148
|
items: {
|
|
149
149
|
id: string;
|
|
150
|
-
productId: string;
|
|
151
150
|
quantity: number;
|
|
151
|
+
productId: string;
|
|
152
152
|
meta?: {
|
|
153
153
|
currency: string;
|
|
154
154
|
title: string;
|
|
@@ -12,25 +12,25 @@ export declare const createCatalogueItemSchema: z.ZodObject<{
|
|
|
12
12
|
visibility: z.ZodDefault<z.ZodEnum<["public", "private"]>>;
|
|
13
13
|
}, "strip", z.ZodTypeAny, {
|
|
14
14
|
title: string;
|
|
15
|
-
images: string[];
|
|
16
15
|
quantity: number;
|
|
16
|
+
images: string[];
|
|
17
17
|
visibility: "public" | "private";
|
|
18
|
+
price?: number | undefined;
|
|
19
|
+
brandSlug?: string | undefined;
|
|
18
20
|
description?: string | undefined;
|
|
19
21
|
categorySlugs?: string[] | undefined;
|
|
20
|
-
brandSlug?: string | undefined;
|
|
21
|
-
price?: number | undefined;
|
|
22
22
|
mainImage?: string | undefined;
|
|
23
23
|
condition?: "new" | "used" | "refurbished" | "like_new" | "good" | "fair" | "poor" | "broken" | "graded" | undefined;
|
|
24
24
|
}, {
|
|
25
25
|
title: string;
|
|
26
|
+
price?: number | undefined;
|
|
27
|
+
brandSlug?: string | undefined;
|
|
28
|
+
quantity?: number | undefined;
|
|
26
29
|
description?: string | undefined;
|
|
27
30
|
categorySlugs?: string[] | undefined;
|
|
28
|
-
brandSlug?: string | undefined;
|
|
29
|
-
price?: number | undefined;
|
|
30
31
|
mainImage?: string | undefined;
|
|
31
32
|
images?: string[] | undefined;
|
|
32
33
|
condition?: "new" | "used" | "refurbished" | "like_new" | "good" | "fair" | "poor" | "broken" | "graded" | undefined;
|
|
33
|
-
quantity?: number | undefined;
|
|
34
34
|
visibility?: "public" | "private" | undefined;
|
|
35
35
|
}>;
|
|
36
36
|
export declare const updateCatalogueItemSchema: z.ZodObject<{
|
|
@@ -46,25 +46,25 @@ export declare const updateCatalogueItemSchema: z.ZodObject<{
|
|
|
46
46
|
visibility: z.ZodOptional<z.ZodDefault<z.ZodEnum<["public", "private"]>>>;
|
|
47
47
|
}, "strip", z.ZodTypeAny, {
|
|
48
48
|
title?: string | undefined;
|
|
49
|
+
price?: number | undefined;
|
|
50
|
+
brandSlug?: string | undefined;
|
|
51
|
+
quantity?: number | undefined;
|
|
49
52
|
description?: string | undefined;
|
|
50
53
|
categorySlugs?: string[] | undefined;
|
|
51
|
-
brandSlug?: string | undefined;
|
|
52
|
-
price?: number | undefined;
|
|
53
54
|
mainImage?: string | undefined;
|
|
54
55
|
images?: string[] | undefined;
|
|
55
56
|
condition?: "new" | "used" | "refurbished" | "like_new" | "good" | "fair" | "poor" | "broken" | "graded" | undefined;
|
|
56
|
-
quantity?: number | undefined;
|
|
57
57
|
visibility?: "public" | "private" | undefined;
|
|
58
58
|
}, {
|
|
59
59
|
title?: string | undefined;
|
|
60
|
+
price?: number | undefined;
|
|
61
|
+
brandSlug?: string | undefined;
|
|
62
|
+
quantity?: number | undefined;
|
|
60
63
|
description?: string | undefined;
|
|
61
64
|
categorySlugs?: string[] | undefined;
|
|
62
|
-
brandSlug?: string | undefined;
|
|
63
|
-
price?: number | undefined;
|
|
64
65
|
mainImage?: string | undefined;
|
|
65
66
|
images?: string[] | undefined;
|
|
66
67
|
condition?: "new" | "used" | "refurbished" | "like_new" | "good" | "fair" | "poor" | "broken" | "graded" | undefined;
|
|
67
|
-
quantity?: number | undefined;
|
|
68
68
|
visibility?: "public" | "private" | undefined;
|
|
69
69
|
}>;
|
|
70
70
|
export type CreateCatalogueItemInput = z.infer<typeof createCatalogueItemSchema>;
|