@burdenoff/microfe-coolandlovely 2026.1107.3 → 2026.1108.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.
@@ -1,6 +1,5 @@
1
- import { useCoolAndLovely as e } from "../../context/CoolAndLovelyContext.js";
2
- import "../../context/index.js";
3
- import { Thumbnail as t } from "../Thumbnail.js";
1
+ import { Thumbnail as e } from "../Thumbnail.js";
2
+ import { useContextNavigation as t } from "../../hooks/useContextNavigation.js";
4
3
  import { useBestPrices as n } from "../../hooks/usePriceApi.js";
5
4
  import { BestPriceBadge as r } from "./BestPriceBadge.js";
6
5
  import { PriceCurrencySelect as i } from "./PriceCurrencySelect.js";
@@ -14,7 +13,7 @@ var p = [
14
13
  "aspect-[4/5]"
15
14
  ];
16
15
  function m({ entries: m, looks: h, items: g, removingEntryId: _, onRemove: v }) {
17
- let { navigateTo: y } = e(), [b, x] = o("USD"), S = a(() => new Map(h.map((e) => [e.id, e])), [h]), C = a(() => new Map(g.map((e) => [e.id, e])), [g]), w = a(() => [...new Set(m.map((e) => e.styleItemId).filter((e) => !!e))], [m]), T = n(w.slice(0, 100), b), E = a(() => new Map(T.data?.map((e) => [e.styleItemId, e])), [T.data]);
16
+ let y = t(), [b, x] = o("USD"), S = a(() => new Map(h.map((e) => [e.id, e])), [h]), C = a(() => new Map(g.map((e) => [e.id, e])), [g]), w = a(() => [...new Set(m.map((e) => e.styleItemId).filter((e) => !!e))], [m]), T = n(w.slice(0, 100), b), E = a(() => new Map(T.data?.map((e) => [e.styleItemId, e])), [T.data]);
18
17
  return /* @__PURE__ */ f("section", {
19
18
  className: "mt-6",
20
19
  children: [
@@ -59,9 +58,9 @@ function m({ entries: m, looks: h, items: g, removingEntryId: _, onRemove: v })
59
58
  children: "This lookbook has no entries yet. Clip a catalogue piece or save a look to add one."
60
59
  }) : /* @__PURE__ */ d("div", {
61
60
  className: "columns-2 gap-4 md:columns-3",
62
- children: m.map((e, n) => {
63
- let i = !!e.lookId, a = e.lookId ? S.get(e.lookId) : void 0, o = e.styleItemId ? C.get(e.styleItemId) : void 0, m = i ? a?.title ?? "Saved look" : o?.name ?? "Clipped piece", h = i ? a?.image?.id : o?.image?.id, g = _ === e.id, b = () => {
64
- i && e.lookId ? y(`/looks/${e.lookId}`) : e.styleItemId && y(`/items/${e.styleItemId}`);
61
+ children: m.map((t, n) => {
62
+ let i = !!t.lookId, a = t.lookId ? S.get(t.lookId) : void 0, o = t.styleItemId ? C.get(t.styleItemId) : void 0, m = i ? a?.title ?? "Saved look" : o?.name ?? "Clipped piece", h = i ? a?.image?.id : o?.image?.id, g = _ === t.id, b = () => {
63
+ i && t.lookId ? y(`/looks/${t.lookId}`) : t.styleItemId && y(`/items/${t.styleItemId}`);
65
64
  };
66
65
  return /* @__PURE__ */ f("div", {
67
66
  className: "group relative mb-4 break-inside-avoid overflow-hidden rounded-xl border border-border-seam bg-bg-surface shadow-sm transition-shadow hover:shadow-lg",
@@ -71,19 +70,19 @@ function m({ entries: m, looks: h, items: g, removingEntryId: _, onRemove: v })
71
70
  onClick: b,
72
71
  "aria-label": `Open ${m}`,
73
72
  className: "block w-full text-left focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-[var(--color-focus-ring)]",
74
- children: /* @__PURE__ */ d(t, {
73
+ children: /* @__PURE__ */ d(e, {
75
74
  icon: d(i ? c : l, { className: "h-8 w-8" }),
76
- seed: e.id,
75
+ seed: t.id,
77
76
  fileId: h,
78
77
  alt: m,
79
78
  className: `w-full rounded-none ${p[n % p.length]}`,
80
79
  overlay: /* @__PURE__ */ f("div", {
81
80
  className: "pointer-events-none absolute inset-x-0 bottom-0 flex flex-col gap-1.5 bg-gradient-to-t from-bg-canvas/90 via-bg-canvas/40 to-transparent p-3 pt-10",
82
- children: [e.note && /* @__PURE__ */ d("span", {
81
+ children: [t.note && /* @__PURE__ */ d("span", {
83
82
  className: "inline-flex w-fit max-w-full items-center rounded-md bg-bg-canvas/80 px-2 py-0.5 text-[11px] font-medium text-text-primary backdrop-blur",
84
83
  children: /* @__PURE__ */ d("span", {
85
84
  className: "truncate",
86
- children: e.note
85
+ children: t.note
87
86
  })
88
87
  }), /* @__PURE__ */ d("p", {
89
88
  className: "truncate text-sm font-semibold text-text-primary",
@@ -92,23 +91,23 @@ function m({ entries: m, looks: h, items: g, removingEntryId: _, onRemove: v })
92
91
  })
93
92
  })
94
93
  }),
95
- e.styleItemId && /* @__PURE__ */ d("div", {
94
+ t.styleItemId && /* @__PURE__ */ d("div", {
96
95
  className: "px-3 pb-3",
97
96
  children: /* @__PURE__ */ d(r, {
98
- summary: E.get(e.styleItemId),
97
+ summary: E.get(t.styleItemId),
99
98
  onOpen: b
100
99
  })
101
100
  }),
102
101
  /* @__PURE__ */ d("button", {
103
102
  type: "button",
104
103
  disabled: !!_,
105
- onClick: () => v(e.id),
104
+ onClick: () => v(t.id),
106
105
  "aria-label": `Remove ${m}`,
107
106
  className: "absolute right-2 top-2 z-10 inline-flex h-7 w-7 items-center justify-center rounded-full bg-bg-surface/90 text-text-secondary opacity-100 shadow-sm backdrop-blur transition-opacity hover:text-status-error-text sm:opacity-0 sm:focus-visible:opacity-100 sm:group-hover:opacity-100 disabled:opacity-60",
108
107
  children: g ? /* @__PURE__ */ d(s, { className: "h-3.5 w-3.5 animate-spin" }) : /* @__PURE__ */ d(u, { className: "h-3.5 w-3.5" })
109
108
  })
110
109
  ]
111
- }, e.id);
110
+ }, t.id);
112
111
  })
113
112
  })
114
113
  ]
@@ -1 +1 @@
1
- {"version":3,"file":"LookbookPriceBoard.js","names":[],"sources":["../../../../src/coolandlovely/components/prices/LookbookPriceBoard.tsx"],"sourcesContent":["import { useMemo, useState } from 'react';\nimport { Loader2, Sparkles, Tag, X } from 'lucide-react';\nimport { useCoolAndLovely } from '../../context';\nimport { useBestPrices } from '../../hooks/usePriceApi';\nimport type { CooLook, CooLookbookEntry, CooStyleItem } from '../../types';\nimport { Thumbnail } from '../Thumbnail';\nimport { BestPriceBadge } from './BestPriceBadge';\nimport { PriceCurrencySelect } from './PriceCurrencySelect';\n\n/** Alternating aspect ratios preserve the existing board rhythm. */\nconst TILE_ASPECTS = ['aspect-[3/4]', 'aspect-square', 'aspect-[4/5]'];\n\nexport function LookbookPriceBoard({\n entries,\n looks,\n items,\n removingEntryId,\n onRemove,\n}: {\n entries: CooLookbookEntry[];\n looks: CooLook[];\n items: CooStyleItem[];\n removingEntryId?: string;\n onRemove: (id: string) => void;\n}) {\n const { navigateTo } = useCoolAndLovely();\n const [priceCurrency, setPriceCurrency] = useState('USD');\n const lookById = useMemo(() => new Map(looks.map((look) => [look.id, look])), [looks]);\n const itemById = useMemo(() => new Map(items.map((item) => [item.id, item])), [items]);\n const priceIds = useMemo(\n () => [\n ...new Set(\n entries.map((entry) => entry.styleItemId).filter((id): id is string => Boolean(id))\n ),\n ],\n [entries]\n );\n const bestPrices = useBestPrices(priceIds.slice(0, 100), priceCurrency);\n const priceByItem = useMemo(\n () => new Map(bestPrices.data?.map((entry) => [entry.styleItemId, entry])),\n [bestPrices.data]\n );\n return (\n <section className=\"mt-6\">\n <PriceCurrencySelect\n value={priceCurrency}\n onChange={setPriceCurrency}\n currencies={items.map((item) => item.currency)}\n />\n <p className=\"mb-3 text-xs text-text-secondary\">\n Retailer quotes for clipped catalog pieces use {priceCurrency} without currency conversion.\n {priceIds.length > 100 ? ' Pricing covers the first 100 linked pieces.' : ''}\n </p>\n {bestPrices.isError && (\n <p role=\"alert\" className=\"mb-3 text-sm text-status-error-text\">\n Retailer prices could not be loaded.{' '}\n <button type=\"button\" className=\"underline\" onClick={() => void bestPrices.refetch()}>\n Retry prices\n </button>\n </p>\n )}\n <h3 className=\"mb-3 text-lg font-semibold text-text-primary\">Board ({entries.length})</h3>\n {entries.length === 0 ? (\n <p className=\"rounded-lg border border-border-seam bg-bg-surface p-4 text-sm text-text-secondary\">\n This lookbook has no entries yet. Clip a catalogue piece or save a look to add one.\n </p>\n ) : (\n <div className=\"columns-2 gap-4 md:columns-3\">\n {entries.map((entry, idx) => {\n const isLook = Boolean(entry.lookId);\n const look = entry.lookId ? lookById.get(entry.lookId) : undefined;\n const item = entry.styleItemId ? itemById.get(entry.styleItemId) : undefined;\n const title = isLook ? (look?.title ?? 'Saved look') : (item?.name ?? 'Clipped piece');\n const imageFileId = isLook ? look?.image?.id : item?.image?.id;\n const removing = removingEntryId === entry.id;\n const onOpen = () => {\n if (isLook && entry.lookId) navigateTo(`/looks/${entry.lookId}`);\n else if (entry.styleItemId) navigateTo(`/items/${entry.styleItemId}`);\n };\n return (\n <div\n key={entry.id}\n className=\"group relative mb-4 break-inside-avoid overflow-hidden rounded-xl border border-border-seam bg-bg-surface shadow-sm transition-shadow hover:shadow-lg\"\n >\n <button\n type=\"button\"\n onClick={onOpen}\n aria-label={`Open ${title}`}\n className=\"block w-full text-left focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-[var(--color-focus-ring)]\"\n >\n <Thumbnail\n icon={isLook ? <Sparkles className=\"h-8 w-8\" /> : <Tag className=\"h-8 w-8\" />}\n seed={entry.id}\n fileId={imageFileId}\n alt={title}\n className={`w-full rounded-none ${TILE_ASPECTS[idx % TILE_ASPECTS.length]}`}\n overlay={\n <div className=\"pointer-events-none absolute inset-x-0 bottom-0 flex flex-col gap-1.5 bg-gradient-to-t from-bg-canvas/90 via-bg-canvas/40 to-transparent p-3 pt-10\">\n {entry.note && (\n <span className=\"inline-flex w-fit max-w-full items-center rounded-md bg-bg-canvas/80 px-2 py-0.5 text-[11px] font-medium text-text-primary backdrop-blur\">\n <span className=\"truncate\">{entry.note}</span>\n </span>\n )}\n <p className=\"truncate text-sm font-semibold text-text-primary\">{title}</p>\n </div>\n }\n />\n </button>\n {entry.styleItemId && (\n <div className=\"px-3 pb-3\">\n <BestPriceBadge summary={priceByItem.get(entry.styleItemId)} onOpen={onOpen} />\n </div>\n )}\n <button\n type=\"button\"\n disabled={Boolean(removingEntryId)}\n onClick={() => onRemove(entry.id)}\n aria-label={`Remove ${title}`}\n className=\"absolute right-2 top-2 z-10 inline-flex h-7 w-7 items-center justify-center rounded-full bg-bg-surface/90 text-text-secondary opacity-100 shadow-sm backdrop-blur transition-opacity hover:text-status-error-text sm:opacity-0 sm:focus-visible:opacity-100 sm:group-hover:opacity-100 disabled:opacity-60\"\n >\n {removing ? (\n <Loader2 className=\"h-3.5 w-3.5 animate-spin\" />\n ) : (\n <X className=\"h-3.5 w-3.5\" />\n )}\n </button>\n </div>\n );\n })}\n </div>\n )}\n </section>\n );\n}\n"],"mappings":";;;;;;;;;;AAUA,IAAM,IAAe;CAAC;CAAgB;CAAiB;AAAc;AAErE,SAAgB,EAAmB,EACjC,YACA,UACA,UACA,oBACA,eAOC;CACD,IAAM,EAAE,kBAAe,EAAiB,GAClC,CAAC,GAAe,KAAoB,EAAS,KAAK,GAClD,IAAW,QAAc,IAAI,IAAI,EAAM,KAAK,MAAS,CAAC,EAAK,IAAI,CAAI,CAAC,CAAC,GAAG,CAAC,CAAK,CAAC,GAC/E,IAAW,QAAc,IAAI,IAAI,EAAM,KAAK,MAAS,CAAC,EAAK,IAAI,CAAI,CAAC,CAAC,GAAG,CAAC,CAAK,CAAC,GAC/E,IAAW,QACT,CACJ,GAAG,IAAI,IACL,EAAQ,KAAK,MAAU,EAAM,WAAW,CAAC,CAAC,QAAQ,MAAqB,EAAQ,CAAG,CACpF,CACF,GACA,CAAC,CAAO,CACV,GACM,IAAa,EAAc,EAAS,MAAM,GAAG,GAAG,GAAG,CAAa,GAChE,IAAc,QACZ,IAAI,IAAI,EAAW,MAAM,KAAK,MAAU,CAAC,EAAM,aAAa,CAAK,CAAC,CAAC,GACzE,CAAC,EAAW,IAAI,CAClB;CACA,OACE,kBAAC,WAAD;EAAS,WAAU;YAAnB;GACE,kBAAC,GAAD;IACE,OAAO;IACP,UAAU;IACV,YAAY,EAAM,KAAK,MAAS,EAAK,QAAQ;GAC9C,CAAA;GACD,kBAAC,KAAD;IAAG,WAAU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,WAAU;sBAAY,EAAM;WAAW,CAAA;UACzC,CAAA,GAER,kBAAC,KAAD;WAAG,WAAU;qBAAoD;UAAS,CAAA,CACvE;;QAER,CAAA;OACK,CAAA;OACP,EAAM,eACL,kBAAC,OAAD;QAAK,WAAU;kBACb,kBAAC,GAAD;SAAgB,SAAS,EAAY,IAAI,EAAM,WAAW;SAAW;QAAS,CAAA;OAC3E,CAAA;OAEP,kBAAC,UAAD;QACE,MAAK;QACL,UAAU,EAAQ;QAClB,eAAe,EAAS,EAAM,EAAE;QAChC,cAAY,UAAU;QACtB,WAAU;kBAET,IACC,kBAAC,GAAD,EAAS,WAAU,2BAA4B,CAAA,IAE/C,kBAAC,GAAD,EAAG,WAAU,cAAe,CAAA;OAExB,CAAA;MACL;QA7CE,EAAM,EA6CR;IAET,CAAC;GACE,CAAA;EAEA;;AAEb"}
1
+ {"version":3,"file":"LookbookPriceBoard.js","names":[],"sources":["../../../../src/coolandlovely/components/prices/LookbookPriceBoard.tsx"],"sourcesContent":["import { useMemo, useState } from 'react';\nimport { Loader2, Sparkles, Tag, X } from 'lucide-react';\nimport { useContextNavigation } from '../../hooks/useContextNavigation';\nimport { useBestPrices } from '../../hooks/usePriceApi';\nimport type { CooLook, CooLookbookEntry, CooStyleItem } from '../../types';\nimport { Thumbnail } from '../Thumbnail';\nimport { BestPriceBadge } from './BestPriceBadge';\nimport { PriceCurrencySelect } from './PriceCurrencySelect';\n\n/** Alternating aspect ratios preserve the existing board rhythm. */\nconst TILE_ASPECTS = ['aspect-[3/4]', 'aspect-square', 'aspect-[4/5]'];\n\nexport function LookbookPriceBoard({\n entries,\n looks,\n items,\n removingEntryId,\n onRemove,\n}: {\n entries: CooLookbookEntry[];\n looks: CooLook[];\n items: CooStyleItem[];\n removingEntryId?: string;\n onRemove: (id: string) => void;\n}) {\n const navigateTo = useContextNavigation();\n const [priceCurrency, setPriceCurrency] = useState('USD');\n const lookById = useMemo(() => new Map(looks.map((look) => [look.id, look])), [looks]);\n const itemById = useMemo(() => new Map(items.map((item) => [item.id, item])), [items]);\n const priceIds = useMemo(\n () => [\n ...new Set(\n entries.map((entry) => entry.styleItemId).filter((id): id is string => Boolean(id))\n ),\n ],\n [entries]\n );\n const bestPrices = useBestPrices(priceIds.slice(0, 100), priceCurrency);\n const priceByItem = useMemo(\n () => new Map(bestPrices.data?.map((entry) => [entry.styleItemId, entry])),\n [bestPrices.data]\n );\n return (\n <section className=\"mt-6\">\n <PriceCurrencySelect\n value={priceCurrency}\n onChange={setPriceCurrency}\n currencies={items.map((item) => item.currency)}\n />\n <p className=\"mb-3 text-xs text-text-secondary\">\n Retailer quotes for clipped catalog pieces use {priceCurrency} without currency conversion.\n {priceIds.length > 100 ? ' Pricing covers the first 100 linked pieces.' : ''}\n </p>\n {bestPrices.isError && (\n <p role=\"alert\" className=\"mb-3 text-sm text-status-error-text\">\n Retailer prices could not be loaded.{' '}\n <button type=\"button\" className=\"underline\" onClick={() => void bestPrices.refetch()}>\n Retry prices\n </button>\n </p>\n )}\n <h3 className=\"mb-3 text-lg font-semibold text-text-primary\">Board ({entries.length})</h3>\n {entries.length === 0 ? (\n <p className=\"rounded-lg border border-border-seam bg-bg-surface p-4 text-sm text-text-secondary\">\n This lookbook has no entries yet. Clip a catalogue piece or save a look to add one.\n </p>\n ) : (\n <div className=\"columns-2 gap-4 md:columns-3\">\n {entries.map((entry, idx) => {\n const isLook = Boolean(entry.lookId);\n const look = entry.lookId ? lookById.get(entry.lookId) : undefined;\n const item = entry.styleItemId ? itemById.get(entry.styleItemId) : undefined;\n const title = isLook ? (look?.title ?? 'Saved look') : (item?.name ?? 'Clipped piece');\n const imageFileId = isLook ? look?.image?.id : item?.image?.id;\n const removing = removingEntryId === entry.id;\n const onOpen = () => {\n if (isLook && entry.lookId) navigateTo(`/looks/${entry.lookId}`);\n else if (entry.styleItemId) navigateTo(`/items/${entry.styleItemId}`);\n };\n return (\n <div\n key={entry.id}\n className=\"group relative mb-4 break-inside-avoid overflow-hidden rounded-xl border border-border-seam bg-bg-surface shadow-sm transition-shadow hover:shadow-lg\"\n >\n <button\n type=\"button\"\n onClick={onOpen}\n aria-label={`Open ${title}`}\n className=\"block w-full text-left focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-[var(--color-focus-ring)]\"\n >\n <Thumbnail\n icon={isLook ? <Sparkles className=\"h-8 w-8\" /> : <Tag className=\"h-8 w-8\" />}\n seed={entry.id}\n fileId={imageFileId}\n alt={title}\n className={`w-full rounded-none ${TILE_ASPECTS[idx % TILE_ASPECTS.length]}`}\n overlay={\n <div className=\"pointer-events-none absolute inset-x-0 bottom-0 flex flex-col gap-1.5 bg-gradient-to-t from-bg-canvas/90 via-bg-canvas/40 to-transparent p-3 pt-10\">\n {entry.note && (\n <span className=\"inline-flex w-fit max-w-full items-center rounded-md bg-bg-canvas/80 px-2 py-0.5 text-[11px] font-medium text-text-primary backdrop-blur\">\n <span className=\"truncate\">{entry.note}</span>\n </span>\n )}\n <p className=\"truncate text-sm font-semibold text-text-primary\">{title}</p>\n </div>\n }\n />\n </button>\n {entry.styleItemId && (\n <div className=\"px-3 pb-3\">\n <BestPriceBadge summary={priceByItem.get(entry.styleItemId)} onOpen={onOpen} />\n </div>\n )}\n <button\n type=\"button\"\n disabled={Boolean(removingEntryId)}\n onClick={() => onRemove(entry.id)}\n aria-label={`Remove ${title}`}\n className=\"absolute right-2 top-2 z-10 inline-flex h-7 w-7 items-center justify-center rounded-full bg-bg-surface/90 text-text-secondary opacity-100 shadow-sm backdrop-blur transition-opacity hover:text-status-error-text sm:opacity-0 sm:focus-visible:opacity-100 sm:group-hover:opacity-100 disabled:opacity-60\"\n >\n {removing ? (\n <Loader2 className=\"h-3.5 w-3.5 animate-spin\" />\n ) : (\n <X className=\"h-3.5 w-3.5\" />\n )}\n </button>\n </div>\n );\n })}\n </div>\n )}\n </section>\n );\n}\n"],"mappings":";;;;;;;;;AAUA,IAAM,IAAe;CAAC;CAAgB;CAAiB;AAAc;AAErE,SA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,GAAD,EAAG,WAAU,cAAe,CAAA;OAExB,CAAA;MACL;QA7CE,EAAM,EA6CR;IAET,CAAC;GACE,CAAA;EAEA;;AAEb"}
@@ -1,14 +1,14 @@
1
- import { useCoolAndLovely as e } from "../../context/CoolAndLovelyContext.js";
2
- import { cn as t } from "../../utils/cn.js";
3
- import { PageLayout as n } from "../../components/PageLayout.js";
4
- import { useLogWardrobeWear as r, useRemoveWardrobeItem as i, useWardrobeItems as a } from "../../hooks/useCoolAndLovelyApi.js";
5
- import { useTr as o } from "../../hooks/useTr.js";
1
+ import { cn as e } from "../../utils/cn.js";
2
+ import { PageLayout as t } from "../../components/PageLayout.js";
3
+ import { useLogWardrobeWear as n, useRemoveWardrobeItem as r, useWardrobeItems as i } from "../../hooks/useCoolAndLovelyApi.js";
4
+ import { useTr as a } from "../../hooks/useTr.js";
6
5
  import "../../hooks/index.js";
7
- import { ErrorView as s, LoadingView as c } from "../../components/StateViews.js";
8
- import { titleCase as l } from "../../utils/formatters.js";
9
- import { STYLE_CATEGORIES as u, categoryIcon as d } from "../../utils/icons.js";
10
- import { EmptyState as f } from "../../components/EmptyState.js";
11
- import { WardrobeItemCard as p } from "../../components/WardrobeItemCard.js";
6
+ import { ErrorView as o, LoadingView as s } from "../../components/StateViews.js";
7
+ import { titleCase as c } from "../../utils/formatters.js";
8
+ import { STYLE_CATEGORIES as l, categoryIcon as u } from "../../utils/icons.js";
9
+ import { EmptyState as d } from "../../components/EmptyState.js";
10
+ import { WardrobeItemCard as f } from "../../components/WardrobeItemCard.js";
11
+ import { useContextNavigation as p } from "../../hooks/useContextNavigation.js";
12
12
  import { useBestPrices as m } from "../../hooks/usePriceApi.js";
13
13
  import { BestPriceBadge as h } from "../../components/prices/BestPriceBadge.js";
14
14
  import { PriceCurrencySelect as g } from "../../components/prices/PriceCurrencySelect.js";
@@ -26,17 +26,17 @@ function w(e) {
26
26
  return e.replace(/_/g, " ").replace(/\b\w/g, (e) => e.toUpperCase());
27
27
  }
28
28
  function T() {
29
- let { navigateTo: T } = e(), E = o(), [D, O] = v("ALL"), [k, A] = v("ALL"), [j, M] = v("USD"), N = _(() => [{
29
+ let T = p(), E = a(), [D, O] = v("ALL"), [k, A] = v("ALL"), [j, M] = v("USD"), N = _(() => [{
30
30
  value: "ALL",
31
31
  label: E("coolandlovely.filters.all", "All")
32
32
  }, ...C.map((e) => ({
33
33
  value: e,
34
34
  label: E(`coolandlovely.source.${e.toLowerCase()}`, w(e))
35
- }))], [E]), P = a({
35
+ }))], [E]), P = i({
36
36
  category: D === "ALL" ? void 0 : D,
37
37
  source: k === "ALL" ? void 0 : k
38
- }), F = r(), I = i(), L = _(() => P.data ?? [], [P.data]), R = _(() => [...new Set(L.map((e) => e.styleItemId).filter((e) => !!e))], [L]), z = m(R.slice(0, 100), j), B = _(() => new Map(z.data?.map((e) => [e.styleItemId, e])), [z.data]);
39
- return /* @__PURE__ */ S(n, {
38
+ }), F = n(), I = r(), L = _(() => P.data ?? [], [P.data]), R = _(() => [...new Set(L.map((e) => e.styleItemId).filter((e) => !!e))], [L]), z = m(R.slice(0, 100), j), B = _(() => new Map(z.data?.map((e) => [e.styleItemId, e])), [z.data]);
39
+ return /* @__PURE__ */ S(t, {
40
40
  title: E("coolandlovely.page.wardrobeTitle", "My Wardrobe"),
41
41
  description: E("coolandlovely.page.wardrobeSubtitle", "A private catalogue of what you own — with a wear log"),
42
42
  actions: /* @__PURE__ */ S("button", {
@@ -79,32 +79,32 @@ function T() {
79
79
  }),
80
80
  /* @__PURE__ */ x("div", {
81
81
  className: "mb-3 flex flex-wrap items-center gap-2",
82
- children: N.map((e) => /* @__PURE__ */ x("button", {
82
+ children: N.map((t) => /* @__PURE__ */ x("button", {
83
83
  type: "button",
84
- onClick: () => A(e.value),
85
- className: t("rounded-full px-3 py-1.5 text-sm font-medium transition-colors", k === e.value ? "bg-action-primary-bg text-action-primary-text" : "bg-bg-sunken text-text-secondary hover:text-text-primary"),
86
- children: e.label
87
- }, e.value))
84
+ onClick: () => A(t.value),
85
+ className: e("rounded-full px-3 py-1.5 text-sm font-medium transition-colors", k === t.value ? "bg-action-primary-bg text-action-primary-text" : "bg-bg-sunken text-text-secondary hover:text-text-primary"),
86
+ children: t.label
87
+ }, t.value))
88
88
  }),
89
89
  /* @__PURE__ */ S("div", {
90
90
  className: "mb-6 flex flex-wrap items-center gap-2",
91
91
  children: [/* @__PURE__ */ x("button", {
92
92
  type: "button",
93
93
  onClick: () => O("ALL"),
94
- className: t("rounded-full px-3 py-1.5 text-xs font-medium transition-colors", D === "ALL" ? "bg-accent-purple-subtle text-text-primary" : "bg-bg-sunken text-text-secondary hover:text-text-primary"),
94
+ className: e("rounded-full px-3 py-1.5 text-xs font-medium transition-colors", D === "ALL" ? "bg-accent-purple-subtle text-text-primary" : "bg-bg-sunken text-text-secondary hover:text-text-primary"),
95
95
  children: E("coolandlovely.filters.allCategories", "All categories")
96
- }), u.map((e) => /* @__PURE__ */ S("button", {
96
+ }), l.map((t) => /* @__PURE__ */ S("button", {
97
97
  type: "button",
98
- onClick: () => O(e),
99
- className: t("inline-flex items-center gap-1.5 rounded-full px-3 py-1.5 text-xs font-medium transition-colors", D === e ? "bg-accent-purple-subtle text-text-primary" : "bg-bg-sunken text-text-secondary hover:text-text-primary"),
98
+ onClick: () => O(t),
99
+ className: e("inline-flex items-center gap-1.5 rounded-full px-3 py-1.5 text-xs font-medium transition-colors", D === t ? "bg-accent-purple-subtle text-text-primary" : "bg-bg-sunken text-text-secondary hover:text-text-primary"),
100
100
  children: [
101
- d(e, 14),
101
+ u(t, 14),
102
102
  " ",
103
- E(`coolandlovely.category.${e.toLowerCase()}`, l(e))
103
+ E(`coolandlovely.category.${t.toLowerCase()}`, c(t))
104
104
  ]
105
- }, e))]
105
+ }, t))]
106
106
  }),
107
- P.isLoading ? /* @__PURE__ */ x(c, { label: E("coolandlovely.loading.wardrobe", "Loading your wardrobe…") }) : P.isError ? /* @__PURE__ */ x(s, { onRetry: () => void P.refetch() }) : L.length === 0 ? /* @__PURE__ */ x(f, {
107
+ P.isLoading ? /* @__PURE__ */ x(s, { label: E("coolandlovely.loading.wardrobe", "Loading your wardrobe…") }) : P.isError ? /* @__PURE__ */ x(o, { onRetry: () => void P.refetch() }) : L.length === 0 ? /* @__PURE__ */ x(d, {
108
108
  illustration: "empty-data",
109
109
  icon: /* @__PURE__ */ x(y, { className: "h-10 w-10" }),
110
110
  title: E("coolandlovely.empty.wardrobeTitle", "Your wardrobe is empty"),
@@ -121,7 +121,7 @@ function T() {
121
121
  })
122
122
  }) : /* @__PURE__ */ x("div", {
123
123
  className: "grid grid-cols-1 gap-5 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4",
124
- children: L.map((e) => /* @__PURE__ */ x(p, {
124
+ children: L.map((e) => /* @__PURE__ */ x(f, {
125
125
  item: e,
126
126
  retailerPrice: e.styleItemId ? /* @__PURE__ */ x(h, {
127
127
  summary: B.get(e.styleItemId),
@@ -1 +1 @@
1
- {"version":3,"file":"WardrobeListPage.js","names":[],"sources":["../../../../src/coolandlovely/pages/wardrobe/WardrobeListPage.tsx"],"sourcesContent":["/**\n * Wardrobe List Page (self-scoped)\n * @module coolandlovely/pages/wardrobe\n *\n * The shopper's digital wardrobe (`cooListWardrobeItems`, self-scoped) rendered\n * as an image-forward gallery — each card is a large piece photo with a circular\n * \"Worn N×\" badge and a hover-revealed action bar (wear log via\n * `cooLogWardrobeWear`, removal via `cooRemoveWardrobeItem`), with category &\n * source filters.\n */\n\nimport { useBestPrices } from '../../hooks/usePriceApi';\nimport { BestPriceBadge } from '../../components/prices/BestPriceBadge';\nimport { PriceCurrencySelect } from '../../components/prices/PriceCurrencySelect';\nimport { useMemo, useState } from 'react';\nimport { Plus, Heart } from 'lucide-react';\nimport { PageLayout } from '../../components/PageLayout';\nimport { WardrobeItemCard } from '../../components/WardrobeItemCard';\nimport { EmptyState } from '../../components/EmptyState';\nimport { LoadingView, ErrorView } from '../../components/StateViews';\nimport { useCoolAndLovely } from '../../context/CoolAndLovelyContext';\nimport { useWardrobeItems, useLogWardrobeWear, useRemoveWardrobeItem, useTr } from '../../hooks';\nimport { categoryIcon, STYLE_CATEGORIES } from '../../utils/icons';\nimport { titleCase } from '../../utils/formatters';\nimport { cn } from '../../utils/cn';\nimport type { CooStyleCategory, CooWardrobeSource } from '../../types';\n\nconst SOURCE_ORDER: CooWardrobeSource[] = ['OWNED', 'WISHLIST', 'PURCHASED_ON_PLATFORM', 'GIFTED'];\n\nfunction formatSourceLabel(source: string): string {\n return source.replace(/_/g, ' ').replace(/\\b\\w/g, (c) => c.toUpperCase());\n}\n\nexport function WardrobeListPage() {\n const { navigateTo } = useCoolAndLovely();\n const tr = useTr();\n const [category, setCategory] = useState<CooStyleCategory | 'ALL'>('ALL');\n const [source, setSource] = useState<CooWardrobeSource | 'ALL'>('ALL');\n const [priceCurrency, setPriceCurrency] = useState('USD');\n\n const sourceOptions = useMemo(\n () => [\n { value: 'ALL' as const, label: tr('coolandlovely.filters.all', 'All') },\n ...SOURCE_ORDER.map((value) => ({\n value,\n label: tr(`coolandlovely.source.${value.toLowerCase()}`, formatSourceLabel(value)),\n })),\n ],\n [tr]\n );\n\n const query = useWardrobeItems({\n category: category === 'ALL' ? undefined : category,\n source: source === 'ALL' ? undefined : source,\n });\n const logWear = useLogWardrobeWear();\n const remove = useRemoveWardrobeItem();\n\n const items = useMemo(() => query.data ?? [], [query.data]);\n const priceIds = useMemo(\n () => [\n ...new Set(items.map((item) => item.styleItemId).filter((id): id is string => Boolean(id))),\n ],\n [items]\n );\n const bestPrices = useBestPrices(priceIds.slice(0, 100), priceCurrency);\n const priceByItem = useMemo(\n () => new Map(bestPrices.data?.map((entry) => [entry.styleItemId, entry])),\n [bestPrices.data]\n );\n\n return (\n <PageLayout\n title={tr('coolandlovely.page.wardrobeTitle', 'My Wardrobe')}\n description={tr(\n 'coolandlovely.page.wardrobeSubtitle',\n 'A private catalogue of what you own — with a wear log'\n )}\n actions={\n <button\n type=\"button\"\n onClick={() => navigateTo('/wardrobe/new')}\n className=\"inline-flex items-center gap-1.5 rounded-lg bg-action-primary-bg px-4 py-2 text-sm font-medium text-action-primary-text transition-colors hover:bg-action-primary-bg/90\"\n >\n <Plus className=\"h-4 w-4\" /> {tr('coolandlovely.actions.addPiece', 'Add piece')}\n </button>\n }\n >\n <PriceCurrencySelect value={priceCurrency} onChange={setPriceCurrency} />\n <p className=\"mb-3 text-xs text-text-secondary\">\n Retailer quotes use {priceCurrency} without currency conversion.\n {priceIds.length > 100 ? ' Pricing covers the first 100 linked pieces on this page.' : ''}\n </p>\n {bestPrices.isError && (\n <p role=\"alert\" className=\"mb-3 text-sm text-status-error-text\">\n Retailer prices could not be loaded.{' '}\n <button type=\"button\" className=\"underline\" onClick={() => void bestPrices.refetch()}>\n Retry prices\n </button>\n </p>\n )}\n {/* Source filter */}\n <div className=\"mb-3 flex flex-wrap items-center gap-2\">\n {sourceOptions.map((opt) => (\n <button\n key={opt.value}\n type=\"button\"\n onClick={() => setSource(opt.value)}\n className={cn(\n 'rounded-full px-3 py-1.5 text-sm font-medium transition-colors',\n source === opt.value\n ? 'bg-action-primary-bg text-action-primary-text'\n : 'bg-bg-sunken text-text-secondary hover:text-text-primary'\n )}\n >\n {opt.label}\n </button>\n ))}\n </div>\n\n {/* Category filter */}\n <div className=\"mb-6 flex flex-wrap items-center gap-2\">\n <button\n type=\"button\"\n onClick={() => setCategory('ALL')}\n className={cn(\n 'rounded-full px-3 py-1.5 text-xs font-medium transition-colors',\n category === 'ALL'\n ? 'bg-accent-purple-subtle text-text-primary'\n : 'bg-bg-sunken text-text-secondary hover:text-text-primary'\n )}\n >\n {tr('coolandlovely.filters.allCategories', 'All categories')}\n </button>\n {STYLE_CATEGORIES.map((c) => (\n <button\n key={c}\n type=\"button\"\n onClick={() => setCategory(c)}\n className={cn(\n 'inline-flex items-center gap-1.5 rounded-full px-3 py-1.5 text-xs font-medium transition-colors',\n category === c\n ? 'bg-accent-purple-subtle text-text-primary'\n : 'bg-bg-sunken text-text-secondary hover:text-text-primary'\n )}\n >\n {categoryIcon(c, 14)} {tr(`coolandlovely.category.${c.toLowerCase()}`, titleCase(c))}\n </button>\n ))}\n </div>\n\n {query.isLoading ? (\n <LoadingView label={tr('coolandlovely.loading.wardrobe', 'Loading your wardrobe…')} />\n ) : query.isError ? (\n <ErrorView onRetry={() => void query.refetch()} />\n ) : items.length === 0 ? (\n <EmptyState\n illustration=\"empty-data\"\n icon={<Heart className=\"h-10 w-10\" />}\n title={tr('coolandlovely.empty.wardrobeTitle', 'Your wardrobe is empty')}\n description={tr(\n 'coolandlovely.empty.wardrobeDescription',\n 'Add the pieces you already own (or want) to start your digital closet.'\n )}\n action={\n <button\n type=\"button\"\n onClick={() => navigateTo('/wardrobe/new')}\n className=\"inline-flex items-center gap-1.5 rounded-lg bg-action-primary-bg px-4 py-2 text-sm font-medium text-action-primary-text\"\n >\n <Plus className=\"h-4 w-4\" /> {tr('coolandlovely.actions.addPiece', 'Add piece')}\n </button>\n }\n />\n ) : (\n <div className=\"grid grid-cols-1 gap-5 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4\">\n {items.map((item) => (\n <WardrobeItemCard\n key={item.id}\n item={item}\n retailerPrice={\n item.styleItemId ? (\n <BestPriceBadge\n summary={priceByItem.get(item.styleItemId)}\n onOpen={() => navigateTo(`/items/${item.styleItemId}`)}\n />\n ) : undefined\n }\n onLogWear={() => logWear.mutate(item.id)}\n onRemove={() => remove.mutate(item.id)}\n isLoggingWear={logWear.isPending && logWear.variables === item.id}\n isRemoving={remove.isPending && remove.variables === item.id}\n />\n ))}\n </div>\n )}\n </PageLayout>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AA2BA,IAAM,IAAoC;CAAC;CAAS;CAAY;CAAyB;AAAQ;AAEjG,SAAS,EAAkB,GAAwB;CACjD,OAAO,EAAO,QAAQ,MAAM,GAAG,CAAC,CAAC,QAAQ,UAAU,MAAM,EAAE,YAAY,CAAC;AAC1E;AAEA,SAAgB,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,UAAD;KACE,MAAK;KACL,eAAe,EAAW,eAAe;KACzC,WAAU;eAHZ;MAKE,kBAAC,GAAD,EAAM,WAAU,UAAW,CAAA;MAAC;MAAE,EAAG,kCAAkC,WAAW;KACxE;;GAEX,CAAA,IAED,kBAAC,OAAD;IAAK,WAAU;cACZ,EAAM,KAAK,MACV,kBAAC,GAAD;KAEQ;KACN,eACE,EAAK,cACH,kBAAC,GAAD;MACE,SAAS,EAAY,IAAI,EAAK,WAAW;MACzC,cAAc,EAAW,UAAU,EAAK,aAAa;KACtD,CAAA,IACC,KAAA;KAEN,iBAAiB,EAAQ,OAAO,EAAK,EAAE;KACvC,gBAAgB,EAAO,OAAO,EAAK,EAAE;KACrC,eAAe,EAAQ,aAAa,EAAQ,cAAc,EAAK;KAC/D,YAAY,EAAO,aAAa,EAAO,cAAc,EAAK;IAC3D,GAdM,EAAK,EAcX,CACF;GACE,CAAA;EAEG;;AAEhB"}
1
+ {"version":3,"file":"WardrobeListPage.js","names":[],"sources":["../../../../src/coolandlovely/pages/wardrobe/WardrobeListPage.tsx"],"sourcesContent":["/**\n * Wardrobe List Page (self-scoped)\n * @module coolandlovely/pages/wardrobe\n *\n * The shopper's digital wardrobe (`cooListWardrobeItems`, self-scoped) rendered\n * as an image-forward gallery — each card is a large piece photo with a circular\n * \"Worn N×\" badge and a hover-revealed action bar (wear log via\n * `cooLogWardrobeWear`, removal via `cooRemoveWardrobeItem`), with category &\n * source filters.\n */\n\nimport { useBestPrices } from '../../hooks/usePriceApi';\nimport { BestPriceBadge } from '../../components/prices/BestPriceBadge';\nimport { PriceCurrencySelect } from '../../components/prices/PriceCurrencySelect';\nimport { useMemo, useState } from 'react';\nimport { Plus, Heart } from 'lucide-react';\nimport { PageLayout } from '../../components/PageLayout';\nimport { WardrobeItemCard } from '../../components/WardrobeItemCard';\nimport { EmptyState } from '../../components/EmptyState';\nimport { LoadingView, ErrorView } from '../../components/StateViews';\nimport { useContextNavigation } from '../../hooks/useContextNavigation';\nimport { useWardrobeItems, useLogWardrobeWear, useRemoveWardrobeItem, useTr } from '../../hooks';\nimport { categoryIcon, STYLE_CATEGORIES } from '../../utils/icons';\nimport { titleCase } from '../../utils/formatters';\nimport { cn } from '../../utils/cn';\nimport type { CooStyleCategory, CooWardrobeSource } from '../../types';\n\nconst SOURCE_ORDER: CooWardrobeSource[] = ['OWNED', 'WISHLIST', 'PURCHASED_ON_PLATFORM', 'GIFTED'];\n\nfunction formatSourceLabel(source: string): string {\n return source.replace(/_/g, ' ').replace(/\\b\\w/g, (c) => c.toUpperCase());\n}\n\nexport function WardrobeListPage() {\n const navigateTo = useContextNavigation();\n const tr = useTr();\n const [category, setCategory] = useState<CooStyleCategory | 'ALL'>('ALL');\n const [source, setSource] = useState<CooWardrobeSource | 'ALL'>('ALL');\n const [priceCurrency, setPriceCurrency] = useState('USD');\n\n const sourceOptions = useMemo(\n () => [\n { value: 'ALL' as const, label: tr('coolandlovely.filters.all', 'All') },\n ...SOURCE_ORDER.map((value) => ({\n value,\n label: tr(`coolandlovely.source.${value.toLowerCase()}`, formatSourceLabel(value)),\n })),\n ],\n [tr]\n );\n\n const query = useWardrobeItems({\n category: category === 'ALL' ? undefined : category,\n source: source === 'ALL' ? undefined : source,\n });\n const logWear = useLogWardrobeWear();\n const remove = useRemoveWardrobeItem();\n\n const items = useMemo(() => query.data ?? [], [query.data]);\n const priceIds = useMemo(\n () => [\n ...new Set(items.map((item) => item.styleItemId).filter((id): id is string => Boolean(id))),\n ],\n [items]\n );\n const bestPrices = useBestPrices(priceIds.slice(0, 100), priceCurrency);\n const priceByItem = useMemo(\n () => new Map(bestPrices.data?.map((entry) => [entry.styleItemId, entry])),\n [bestPrices.data]\n );\n\n return (\n <PageLayout\n title={tr('coolandlovely.page.wardrobeTitle', 'My Wardrobe')}\n description={tr(\n 'coolandlovely.page.wardrobeSubtitle',\n 'A private catalogue of what you own — with a wear log'\n )}\n actions={\n <button\n type=\"button\"\n onClick={() => navigateTo('/wardrobe/new')}\n className=\"inline-flex items-center gap-1.5 rounded-lg bg-action-primary-bg px-4 py-2 text-sm font-medium text-action-primary-text transition-colors hover:bg-action-primary-bg/90\"\n >\n <Plus className=\"h-4 w-4\" /> {tr('coolandlovely.actions.addPiece', 'Add piece')}\n </button>\n }\n >\n <PriceCurrencySelect value={priceCurrency} onChange={setPriceCurrency} />\n <p className=\"mb-3 text-xs text-text-secondary\">\n Retailer quotes use {priceCurrency} without currency conversion.\n {priceIds.length > 100 ? ' Pricing covers the first 100 linked pieces on this page.' : ''}\n </p>\n {bestPrices.isError && (\n <p role=\"alert\" className=\"mb-3 text-sm text-status-error-text\">\n Retailer prices could not be loaded.{' '}\n <button type=\"button\" className=\"underline\" onClick={() => void bestPrices.refetch()}>\n Retry prices\n </button>\n </p>\n )}\n {/* Source filter */}\n <div className=\"mb-3 flex flex-wrap items-center gap-2\">\n {sourceOptions.map((opt) => (\n <button\n key={opt.value}\n type=\"button\"\n onClick={() => setSource(opt.value)}\n className={cn(\n 'rounded-full px-3 py-1.5 text-sm font-medium transition-colors',\n source === opt.value\n ? 'bg-action-primary-bg text-action-primary-text'\n : 'bg-bg-sunken text-text-secondary hover:text-text-primary'\n )}\n >\n {opt.label}\n </button>\n ))}\n </div>\n\n {/* Category filter */}\n <div className=\"mb-6 flex flex-wrap items-center gap-2\">\n <button\n type=\"button\"\n onClick={() => setCategory('ALL')}\n className={cn(\n 'rounded-full px-3 py-1.5 text-xs font-medium transition-colors',\n category === 'ALL'\n ? 'bg-accent-purple-subtle text-text-primary'\n : 'bg-bg-sunken text-text-secondary hover:text-text-primary'\n )}\n >\n {tr('coolandlovely.filters.allCategories', 'All categories')}\n </button>\n {STYLE_CATEGORIES.map((c) => (\n <button\n key={c}\n type=\"button\"\n onClick={() => setCategory(c)}\n className={cn(\n 'inline-flex items-center gap-1.5 rounded-full px-3 py-1.5 text-xs font-medium transition-colors',\n category === c\n ? 'bg-accent-purple-subtle text-text-primary'\n : 'bg-bg-sunken text-text-secondary hover:text-text-primary'\n )}\n >\n {categoryIcon(c, 14)} {tr(`coolandlovely.category.${c.toLowerCase()}`, titleCase(c))}\n </button>\n ))}\n </div>\n\n {query.isLoading ? (\n <LoadingView label={tr('coolandlovely.loading.wardrobe', 'Loading your wardrobe…')} />\n ) : query.isError ? (\n <ErrorView onRetry={() => void query.refetch()} />\n ) : items.length === 0 ? (\n <EmptyState\n illustration=\"empty-data\"\n icon={<Heart className=\"h-10 w-10\" />}\n title={tr('coolandlovely.empty.wardrobeTitle', 'Your wardrobe is empty')}\n description={tr(\n 'coolandlovely.empty.wardrobeDescription',\n 'Add the pieces you already own (or want) to start your digital closet.'\n )}\n action={\n <button\n type=\"button\"\n onClick={() => navigateTo('/wardrobe/new')}\n className=\"inline-flex items-center gap-1.5 rounded-lg bg-action-primary-bg px-4 py-2 text-sm font-medium text-action-primary-text\"\n >\n <Plus className=\"h-4 w-4\" /> {tr('coolandlovely.actions.addPiece', 'Add piece')}\n </button>\n }\n />\n ) : (\n <div className=\"grid grid-cols-1 gap-5 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4\">\n {items.map((item) => (\n <WardrobeItemCard\n key={item.id}\n item={item}\n retailerPrice={\n item.styleItemId ? (\n <BestPriceBadge\n summary={priceByItem.get(item.styleItemId)}\n onOpen={() => navigateTo(`/items/${item.styleItemId}`)}\n />\n ) : undefined\n }\n onLogWear={() => logWear.mutate(item.id)}\n onRemove={() => remove.mutate(item.id)}\n isLoggingWear={logWear.isPending && logWear.variables === item.id}\n isRemoving={remove.isPending && remove.variables === item.id}\n />\n ))}\n </div>\n )}\n </PageLayout>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AA2BA,IAAM,IAAoC;CAAC;CAAS;CAAY;CAAyB;AAAQ;AAEjG,SAAS,EAAkB,GAAwB;CACjD,OAAO,EAAO,QAAQ,MAAM,GAAG,CAAC,CAAC,QAAQ,UAAU,MAAM,EAAE,YAAY,CAAC;AAC1E;AAEA,SAAgB,IAAmB;CACjC,IAAM,I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,EAAW,eAAe;KACzC,WAAU;eAHZ;MAKE,kBAAC,GAAD,EAAM,WAAU,UAAW,CAAA;MAAC;MAAE,EAAG,kCAAkC,WAAW;KACxE;;GAEX,CAAA,IAED,kBAAC,OAAD;IAAK,WAAU;cACZ,EAAM,KAAK,MACV,kBAAC,GAAD;KAEQ;KACN,eACE,EAAK,cACH,kBAAC,GAAD;MACE,SAAS,EAAY,IAAI,EAAK,WAAW;MACzC,cAAc,EAAW,UAAU,EAAK,aAAa;KACtD,CAAA,IACC,KAAA;KAEN,iBAAiB,EAAQ,OAAO,EAAK,EAAE;KACvC,gBAAgB,EAAO,OAAO,EAAK,EAAE;KACrC,eAAe,EAAQ,aAAa,EAAQ,cAAc,EAAK;KAC/D,YAAY,EAAO,aAAa,EAAO,cAAc,EAAK;IAC3D,GAdM,EAAK,EAcX,CACF;GACE,CAAA;EAEG;;AAEhB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@burdenoff/microfe-coolandlovely",
3
- "version": "2026.1107.3",
3
+ "version": "2026.1108.1",
4
4
  "description": "Burdenoff CoolAndLovely Microfrontend",
5
5
  "type": "module",
6
6
  "files": [