@mohasinac/appkit 4.33.0 → 4.34.0

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 (89) hide show
  1. package/dist/_internal/server/features/checkout/actions.js +9 -1
  2. package/dist/_internal/server/features/checkout/expand-order-items.js +9 -0
  3. package/dist/_internal/server/features/media/contextGuards.d.ts +3 -3
  4. package/dist/_internal/server/features/media/contextGuards.js +19 -5
  5. package/dist/_internal/server/features/orders/actions.d.ts +9 -0
  6. package/dist/_internal/server/features/orders/actions.js +47 -4
  7. package/dist/_internal/server/features/orders/adapters.js +10 -0
  8. package/dist/_internal/server/features/refunds/actions.d.ts +9 -1
  9. package/dist/_internal/server/features/refunds/actions.js +36 -3
  10. package/dist/_internal/server/features/site-settings/adapters.js +1 -1
  11. package/dist/_internal/shared/features/orders/refund-copy.d.ts +12 -0
  12. package/dist/_internal/shared/features/orders/refund-copy.js +12 -0
  13. package/dist/_internal/shared/features/orders/return-reasons.d.ts +59 -0
  14. package/dist/_internal/shared/features/orders/return-reasons.js +96 -0
  15. package/dist/_internal/shared/features/orders/schema.d.ts +30 -0
  16. package/dist/_internal/shared/features/orders/schema.js +20 -0
  17. package/dist/_internal/shared/features/products/schema.d.ts +12 -0
  18. package/dist/_internal/shared/features/products/schema.js +4 -1
  19. package/dist/_internal/shared/media/limits.d.ts +14 -0
  20. package/dist/_internal/shared/media/limits.js +29 -0
  21. package/dist/client.d.ts +9 -1
  22. package/dist/client.js +19 -1
  23. package/dist/features/about/components/PolicyPageView.js +1 -1
  24. package/dist/features/admin/components/AdminProductEditorView.js +6 -1
  25. package/dist/features/admin/components/AdminSiteSettingsView.js +2 -6
  26. package/dist/features/admin/components/index.d.ts +0 -2
  27. package/dist/features/admin/components/index.js +0 -1
  28. package/dist/features/admin/schemas/admin-editor-forms.js +1 -1
  29. package/dist/features/admin/schemas/firestore.d.ts +0 -2
  30. package/dist/features/auctions/components/AuctionDetailPageView.js +4 -3
  31. package/dist/features/contact/components/ContactForm.js +46 -31
  32. package/dist/features/media/upload/MediaUploadList.d.ts +16 -1
  33. package/dist/features/media/upload/MediaUploadList.js +58 -8
  34. package/dist/features/orders/components/RefundRequestView.d.ts +26 -10
  35. package/dist/features/orders/components/RefundRequestView.js +108 -24
  36. package/dist/features/orders/schemas/firestore.d.ts +42 -0
  37. package/dist/features/orders/types/index.d.ts +24 -0
  38. package/dist/features/pre-orders/components/PreOrderDetailPageView.js +5 -3
  39. package/dist/features/products/components/ProductDetailPageView.js +14 -2
  40. package/dist/features/products/components/ProductFeatureBadges.d.ts +9 -1
  41. package/dist/features/products/components/ProductFeatureBadges.js +17 -1
  42. package/dist/features/products/components/ProductForm.js +46 -10
  43. package/dist/features/products/components/ProductGrid.js +10 -1
  44. package/dist/features/products/constants/final-sale.d.ts +40 -0
  45. package/dist/features/products/constants/final-sale.js +40 -0
  46. package/dist/features/products/index.d.ts +1 -0
  47. package/dist/features/products/index.js +1 -0
  48. package/dist/features/products/schemas/firestore.d.ts +19 -2
  49. package/dist/features/products/schemas/firestore.js +4 -0
  50. package/dist/features/products/types/index.d.ts +2 -0
  51. package/dist/features/seller/components/SellerProductShell.d.ts +7 -0
  52. package/dist/features/seller/components/SellerProductShell.js +82 -11
  53. package/dist/features/seller/index.d.ts +1 -0
  54. package/dist/features/seller/index.js +1 -0
  55. package/dist/features/seller/schemas/product-form.d.ts +304 -0
  56. package/dist/features/seller/schemas/product-form.js +132 -0
  57. package/dist/features/seller/utils/product-draft-mapping.d.ts +117 -0
  58. package/dist/features/seller/utils/product-draft-mapping.js +147 -0
  59. package/dist/features/shell/SectionForm.js +62 -7
  60. package/dist/features/shell/form-sections.js +4 -0
  61. package/dist/features/tester/seed-data/tester-checklist-seed-data.js +200 -0
  62. package/dist/index.d.ts +6 -3
  63. package/dist/index.js +12 -3
  64. package/dist/next/routing/route-map.d.ts +2 -0
  65. package/dist/next/routing/route-map.js +1 -0
  66. package/dist/schemas/registry.d.ts +271 -0
  67. package/dist/schemas/registry.js +9 -0
  68. package/dist/seed/_helpers/final-sale-fixtures.d.ts +35 -0
  69. package/dist/seed/_helpers/final-sale-fixtures.js +61 -0
  70. package/dist/seed/products-art-seed-data.js +9 -1
  71. package/dist/seed/products-auctions-seed-data.js +2 -1
  72. package/dist/seed/products-classifieds-seed-data.js +2 -1
  73. package/dist/seed/products-digital-codes-seed-data.js +2 -1
  74. package/dist/seed/products-live-items-seed-data.js +2 -1
  75. package/dist/seed/products-preorders-seed-data.d.ts +2 -138
  76. package/dist/seed/products-preorders-seed-data.js +2 -1
  77. package/dist/seed/products-prize-draws-seed-data.js +2 -1
  78. package/dist/seed/products-standard-seed-data.js +2 -1
  79. package/dist/seed/products-stickers-seed-data.js +9 -1
  80. package/dist/server.d.ts +6 -2
  81. package/dist/server.js +15 -2
  82. package/dist/styles.css +1 -1
  83. package/dist/tailwind-utilities.css +1 -1
  84. package/dist/tokens/motion.d.ts +12 -0
  85. package/dist/tokens/motion.js +12 -0
  86. package/dist/ui/components/CollapsibleSection.d.ts +18 -1
  87. package/dist/ui/components/CollapsibleSection.js +20 -3
  88. package/dist/ui/components/Motion.js +17 -1
  89. package/package.json +1 -1
@@ -8,6 +8,18 @@ import type { Transition } from "motion/react";
8
8
  export declare const SPRING_SNAPPY: Transition;
9
9
  export declare const SPRING_GENTLE: Transition;
10
10
  export declare const EASE_OUT: Transition;
11
+ /**
12
+ * `EASE_OUT`'s duration in MILLISECONDS.
13
+ *
14
+ * For the callers that must wait for an `EASE_OUT` animation to finish before
15
+ * measuring or focusing — `<Collapse>` animates height with it, and Framer
16
+ * drives that via rAF rather than a CSS transition, so there is no
17
+ * `transitionend` event to listen for and a timer is the only handle.
18
+ *
19
+ * DERIVED, never a second literal: a hardcoded `300` here would silently stop
20
+ * matching the moment `EASE_OUT.duration` was tuned.
21
+ */
22
+ export declare const EASE_OUT_MS: number;
11
23
  export declare const MOTION_PRESETS: {
12
24
  readonly fadeIn: {
13
25
  readonly initial: {
@@ -19,6 +19,18 @@ export const EASE_OUT = {
19
19
  ease: [0.25, 0.46, 0.45, 0.94],
20
20
  duration: 0.3,
21
21
  };
22
+ /**
23
+ * `EASE_OUT`'s duration in MILLISECONDS.
24
+ *
25
+ * For the callers that must wait for an `EASE_OUT` animation to finish before
26
+ * measuring or focusing — `<Collapse>` animates height with it, and Framer
27
+ * drives that via rAF rather than a CSS transition, so there is no
28
+ * `transitionend` event to listen for and a timer is the only handle.
29
+ *
30
+ * DERIVED, never a second literal: a hardcoded `300` here would silently stop
31
+ * matching the moment `EASE_OUT.duration` was tuned.
32
+ */
33
+ export const EASE_OUT_MS = EASE_OUT.duration * 1000;
22
34
  export const MOTION_PRESETS = {
23
35
  fadeIn: {
24
36
  initial: { opacity: 0 },
@@ -3,6 +3,23 @@ export interface CollapsibleSectionProps {
3
3
  title: React.ReactNode;
4
4
  isCollapsed: boolean;
5
5
  onToggle: () => void;
6
+ /**
7
+ * Render the header as a STATIC heading with no toggle control, and the
8
+ * body permanently open.
9
+ *
10
+ * Exists because `SectionForm` documents required sections as rendering
11
+ * "without a collapse control so it can't be hidden" and had no way to say
12
+ * so: it passed a no-op `onToggle` instead, while this component went on
13
+ * rendering a full `<Button>` with a rotating chevron. Every required
14
+ * section — ~73 `sectionRequired: true` annotations across the schemas —
15
+ * therefore showed an interactive-looking control that did nothing when
16
+ * clicked, which reads as a broken form rather than as an intentionally
17
+ * permanent section.
18
+ *
19
+ * Not the same thing as `isCollapsed={false}`: that is an open section the
20
+ * user may still close.
21
+ */
22
+ collapsible?: boolean;
6
23
  /** Optional right-aligned content next to the title (badges, counts). */
7
24
  renderHeaderExtra?: () => React.ReactNode;
8
25
  /**
@@ -28,4 +45,4 @@ export interface CollapsibleSectionProps {
28
45
  * per-user, accordion-scoped collapse state (see that hook for the
29
46
  * server-side merge/default-collapsed semantics). Purely presentational
30
47
  * here: isCollapsed/onToggle are always controlled by the caller. */
31
- export declare function CollapsibleSection({ title, isCollapsed, onToggle, renderHeaderExtra, keepMounted, id, className, children, }: CollapsibleSectionProps): React.JSX.Element;
48
+ export declare function CollapsibleSection({ title, isCollapsed, onToggle, collapsible, renderHeaderExtra, keepMounted, id, className, children, }: CollapsibleSectionProps): React.JSX.Element;
@@ -8,10 +8,27 @@ import { Collapse } from "./Motion";
8
8
  * per-user, accordion-scoped collapse state (see that hook for the
9
9
  * server-side merge/default-collapsed semantics). Purely presentational
10
10
  * here: isCollapsed/onToggle are always controlled by the caller. */
11
- export function CollapsibleSection({ title, isCollapsed, onToggle, renderHeaderExtra, keepMounted = false, id, className = "", children, }) {
12
- return (_jsxs(Div, { id: id, className: className, rounded: "xl", border: "default", surface: "default", children: [_jsxs(Row, { align: "center", justify: "between", paddingX: "x-md", paddingY: "y-sm", children: [_jsx(Button, { type: "button", variant: "ghost", onClick: onToggle, paddingX: "none", paddingY: "none", rounded: "none", className: "min-w-0 flex-1", "aria-expanded": !isCollapsed, children: _jsxs(Row, { align: "center", justify: "between", className: "w-full", children: [_jsx(Span, { weight: "semibold", size: "sm", children: title }), _jsx("svg", { className: `w-4 h-4 transition-transform duration-150 ${isCollapsed ? "" : "rotate-180"} shrink-0`, fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", "aria-hidden": "true", children: _jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M19 9l-7 7-7-7" }) })] }) }), renderHeaderExtra && _jsx(Div, { className: "ml-3 shrink-0", children: renderHeaderExtra() })] }), keepMounted ? (
11
+ export function CollapsibleSection({ title, isCollapsed, onToggle, collapsible = true, renderHeaderExtra, keepMounted = false, id, className = "", children, }) {
12
+ /*
13
+ * A static section is always open, whatever the caller passed. Honouring
14
+ * `isCollapsed` here would produce a permanently hidden panel with no
15
+ * control to reveal it — strictly worse than the dead chevron this replaces.
16
+ */
17
+ const open = collapsible ? !isCollapsed : true;
18
+ const panelId = id ? `${id}-panel` : undefined;
19
+ const headerId = id ? `${id}-header` : undefined;
20
+ /*
21
+ * Only wrap a STRING title. `SectionForm` passes phrasing content that
22
+ * already carries its own weight/size, and wrapping that produced a nested
23
+ * duplicate `<Span weight="semibold" size="sm">`.
24
+ */
25
+ const titleNode = typeof title === "string" ? (_jsx(Span, { weight: "semibold", size: "sm", children: title })) : (title);
26
+ return (_jsxs(Div, { id: id, className: className, rounded: "xl", border: "default", surface: "default", children: [_jsxs(Row, { align: "center", justify: "between", paddingX: "x-md", paddingY: "y-sm", children: [collapsible ? (_jsx(Button, { type: "button", variant: "ghost", onClick: onToggle, paddingX: "none", paddingY: "none", rounded: "none", className: "min-w-0 flex-1", "aria-expanded": open, "aria-controls": panelId, id: headerId, children: _jsxs(Span, { className: "flex w-full items-center justify-between", children: [titleNode, _jsx("svg", { className: `w-4 h-4 transition-transform duration-150 ${open ? "rotate-180" : ""} shrink-0`, fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", "aria-hidden": "true", children: _jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M19 9l-7 7-7-7" }) })] }) })) : (
27
+ // No <Button>, no chevron: nothing here is interactive, so nothing
28
+ // should look interactive.
29
+ _jsx(Div, { className: "min-w-0 flex-1", id: headerId, children: titleNode })), renderHeaderExtra && _jsx(Div, { className: "ml-3 shrink-0", children: renderHeaderExtra() })] }), !collapsible ? (_jsx(Div, { id: panelId, role: "region", "aria-labelledby": headerId, padding: "md", border: "top", children: children })) : keepMounted ? (
13
30
  // No <Collapse>: it unmounts on close, which would discard uncommitted
14
31
  // child state (see `keepMounted` docs). `hidden` keeps the subtree
15
32
  // mounted and removes it from the a11y tree at the same time.
16
- _jsx(Div, { padding: "md", border: "top", hidden: isCollapsed, children: children })) : (_jsx(Collapse, { isOpen: !isCollapsed, children: _jsx(Div, { padding: "md", border: "top", children: children }) }))] }));
33
+ _jsx(Div, { id: panelId, role: "region", "aria-labelledby": headerId, padding: "md", border: "top", hidden: !open, children: children })) : (_jsx(Collapse, { isOpen: open, children: _jsx(Div, { id: panelId, role: "region", "aria-labelledby": headerId, padding: "md", border: "top", children: children }) }))] }));
17
34
  }
@@ -61,7 +61,23 @@ export function ScaleIn({ delay = 0, children, ...props }) {
61
61
  }
62
62
  export function Collapse({ isOpen, children, ...props }) {
63
63
  const reduced = useReducedMotion();
64
- return (_jsx(MotionAnimatePresence, { initial: false, children: isOpen && (_jsx(motion.div, { initial: reduced ? false : { height: 0, opacity: 0, overflow: "hidden" }, animate: { height: "auto", opacity: 1, overflow: "hidden" }, exit: { height: 0, opacity: 0, overflow: "hidden" }, transition: EASE_OUT, ...props, children: children })) }));
64
+ return (_jsx(MotionAnimatePresence, { initial: false, children: isOpen && (_jsx(motion.div, { initial: reduced ? false : { height: 0, opacity: 0, overflow: "hidden" },
65
+ /*
66
+ * `overflow: hidden` is needed WHILE the height animates, and is
67
+ * wrong once it lands. Keeping it in the settled state made every
68
+ * open panel clip anything that escapes its box — a dropdown, a
69
+ * popover, a tooltip, a focus ring on the last row.
70
+ *
71
+ * `transitionEnd` applies after the animation completes, so the
72
+ * clipping still happens during the transition and is released the
73
+ * moment the panel reaches its natural height.
74
+ */
75
+ animate: {
76
+ height: "auto",
77
+ opacity: 1,
78
+ overflow: "hidden",
79
+ transitionEnd: { overflow: "visible" },
80
+ }, exit: { height: 0, opacity: 0, overflow: "hidden" }, transition: EASE_OUT, ...props, children: children })) }));
65
81
  }
66
82
  export function PressScale({ scale = 0.97, children, ...props }) {
67
83
  const reduced = useReducedMotion();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mohasinac/appkit",
3
- "version": "4.33.0",
3
+ "version": "4.34.0",
4
4
  "license": "MIT",
5
5
  "publishConfig": {
6
6
  "access": "public"