@burdenoff/microfe-coolandlovely 2026.1101.7 → 2026.1102.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.
Files changed (72) hide show
  1. package/dist/coolandlovely/components/WardrobeItemCard.d.ts +2 -1
  2. package/dist/coolandlovely/components/WardrobeItemCard.d.ts.map +1 -1
  3. package/dist/coolandlovely/components/WardrobeItemCard.js +4 -3
  4. package/dist/coolandlovely/components/WardrobeItemCard.js.map +1 -1
  5. package/dist/coolandlovely/components/prices/BestPriceBadge.d.ts +7 -0
  6. package/dist/coolandlovely/components/prices/BestPriceBadge.d.ts.map +1 -0
  7. package/dist/coolandlovely/components/prices/BestPriceBadge.js +22 -0
  8. package/dist/coolandlovely/components/prices/BestPriceBadge.js.map +1 -0
  9. package/dist/coolandlovely/components/prices/LookbookPriceBoard.d.ts +10 -0
  10. package/dist/coolandlovely/components/prices/LookbookPriceBoard.d.ts.map +1 -0
  11. package/dist/coolandlovely/components/prices/LookbookPriceBoard.js +120 -0
  12. package/dist/coolandlovely/components/prices/LookbookPriceBoard.js.map +1 -0
  13. package/dist/coolandlovely/components/prices/PriceComparison.d.ts +5 -0
  14. package/dist/coolandlovely/components/prices/PriceComparison.d.ts.map +1 -0
  15. package/dist/coolandlovely/components/prices/PriceComparison.js +95 -0
  16. package/dist/coolandlovely/components/prices/PriceComparison.js.map +1 -0
  17. package/dist/coolandlovely/components/prices/PriceCurrencySelect.d.ts +6 -0
  18. package/dist/coolandlovely/components/prices/PriceCurrencySelect.d.ts.map +1 -0
  19. package/dist/coolandlovely/components/prices/PriceCurrencySelect.js +38 -0
  20. package/dist/coolandlovely/components/prices/PriceCurrencySelect.js.map +1 -0
  21. package/dist/coolandlovely/components/prices/PricePanel.d.ts +6 -0
  22. package/dist/coolandlovely/components/prices/PricePanel.d.ts.map +1 -0
  23. package/dist/coolandlovely/components/prices/PricePanel.js +105 -0
  24. package/dist/coolandlovely/components/prices/PricePanel.js.map +1 -0
  25. package/dist/coolandlovely/components/prices/PriceWatchDisclosure.d.ts +2 -0
  26. package/dist/coolandlovely/components/prices/PriceWatchDisclosure.d.ts.map +1 -0
  27. package/dist/coolandlovely/components/prices/PriceWatchDisclosure.js +28 -0
  28. package/dist/coolandlovely/components/prices/PriceWatchDisclosure.js.map +1 -0
  29. package/dist/coolandlovely/components/prices/PriceWatchForm.d.ts +5 -0
  30. package/dist/coolandlovely/components/prices/PriceWatchForm.d.ts.map +1 -0
  31. package/dist/coolandlovely/components/prices/PriceWatchForm.js +89 -0
  32. package/dist/coolandlovely/components/prices/PriceWatchForm.js.map +1 -0
  33. package/dist/coolandlovely/components/prices/PriceWatches.d.ts +3 -0
  34. package/dist/coolandlovely/components/prices/PriceWatches.d.ts.map +1 -0
  35. package/dist/coolandlovely/components/prices/PriceWatches.js +189 -0
  36. package/dist/coolandlovely/components/prices/PriceWatches.js.map +1 -0
  37. package/dist/coolandlovely/components/prices/RetailerOfferLink.d.ts +6 -0
  38. package/dist/coolandlovely/components/prices/RetailerOfferLink.d.ts.map +1 -0
  39. package/dist/coolandlovely/components/prices/RetailerOfferLink.js +28 -0
  40. package/dist/coolandlovely/components/prices/RetailerOfferLink.js.map +1 -0
  41. package/dist/coolandlovely/components/prices/money.d.ts +6 -0
  42. package/dist/coolandlovely/components/prices/money.d.ts.map +1 -0
  43. package/dist/coolandlovely/components/prices/money.js +42 -0
  44. package/dist/coolandlovely/components/prices/money.js.map +1 -0
  45. package/dist/coolandlovely/hooks/usePriceApi.d.ts +57 -0
  46. package/dist/coolandlovely/hooks/usePriceApi.d.ts.map +1 -0
  47. package/dist/coolandlovely/hooks/usePriceApi.js +111 -0
  48. package/dist/coolandlovely/hooks/usePriceApi.js.map +1 -0
  49. package/dist/coolandlovely/pages/items/StoreListedPieceView.d.ts.map +1 -1
  50. package/dist/coolandlovely/pages/items/StoreListedPieceView.js +130 -123
  51. package/dist/coolandlovely/pages/items/StoreListedPieceView.js.map +1 -1
  52. package/dist/coolandlovely/pages/items/StyleItemDetailPage.d.ts.map +1 -1
  53. package/dist/coolandlovely/pages/items/StyleItemDetailPage.js +241 -230
  54. package/dist/coolandlovely/pages/items/StyleItemDetailPage.js.map +1 -1
  55. package/dist/coolandlovely/pages/lookbooks/LookbookDetailPage.d.ts.map +1 -1
  56. package/dist/coolandlovely/pages/lookbooks/LookbookDetailPage.js +64 -119
  57. package/dist/coolandlovely/pages/lookbooks/LookbookDetailPage.js.map +1 -1
  58. package/dist/coolandlovely/pages/profile/StyleProfilePage.d.ts.map +1 -1
  59. package/dist/coolandlovely/pages/profile/StyleProfilePage.js +214 -209
  60. package/dist/coolandlovely/pages/profile/StyleProfilePage.js.map +1 -1
  61. package/dist/coolandlovely/pages/wardrobe/WardrobeListPage.d.ts.map +1 -1
  62. package/dist/coolandlovely/pages/wardrobe/WardrobeListPage.js +83 -49
  63. package/dist/coolandlovely/pages/wardrobe/WardrobeListPage.js.map +1 -1
  64. package/dist/generated/wspace-operations.d.ts +282 -2
  65. package/dist/generated/wspace-operations.d.ts.map +1 -1
  66. package/dist/generated/wspace-operations.js +87 -1
  67. package/dist/generated/wspace-operations.js.map +1 -1
  68. package/dist/generated/wspace-types.d.ts +224 -0
  69. package/dist/generated/wspace-types.d.ts.map +1 -1
  70. package/dist/generated/wspace-types.js +8 -0
  71. package/dist/generated/wspace-types.js.map +1 -0
  72. package/package.json +4 -3
@@ -0,0 +1,111 @@
1
+ import { useCoolAndLovely as e } from "../context/CoolAndLovelyContext.js";
2
+ import "../context/index.js";
3
+ import { coolQuery as t } from "./useCoolAndLovelyApi.js";
4
+ import { CooBestPricesDocument as n, CooMyPriceWatchDeliveriesDocument as r, CooMyPriceWatchesDocument as i, CooPriceDetailDocument as a, CooRemovePriceWatchDocument as o, CooSavePriceWatchDocument as s } from "../../generated/wspace-operations.js";
5
+ import { useMutation as c, useQuery as l, useQueryClient as u } from "@tanstack/react-query";
6
+ import { print as d } from "graphql";
7
+ //#region src/coolandlovely/hooks/usePriceApi.ts
8
+ function f() {
9
+ let { apiGatewayUrl: t, tenantId: n, organizationId: r, workspaceId: i, currentUser: a } = e();
10
+ return {
11
+ apiGatewayUrl: t,
12
+ key: [
13
+ "coolandlovely",
14
+ "prices",
15
+ t,
16
+ n,
17
+ r,
18
+ i,
19
+ a?.id
20
+ ],
21
+ ready: !!(i && a?.id)
22
+ };
23
+ }
24
+ function p(e, r) {
25
+ let i = f(), a = [...new Set(e)].sort();
26
+ return l({
27
+ queryKey: [
28
+ ...i.key,
29
+ "best",
30
+ r,
31
+ a
32
+ ],
33
+ enabled: i.ready && a.length > 0 && a.length <= 100,
34
+ staleTime: 3e4,
35
+ queryFn: async ({ signal: e }) => (await t(d(n), {
36
+ styleItemIds: a,
37
+ currency: r
38
+ }, i.apiGatewayUrl, e)).cooBestPrices
39
+ });
40
+ }
41
+ function m(e, n, r, i, o) {
42
+ let s = f();
43
+ return l({
44
+ queryKey: [
45
+ ...s.key,
46
+ "detail",
47
+ e,
48
+ n,
49
+ r,
50
+ i
51
+ ],
52
+ enabled: s.ready && !!e && o,
53
+ staleTime: 3e4,
54
+ queryFn: ({ signal: o }) => t(d(a), {
55
+ styleItemId: e,
56
+ currency: n,
57
+ start: r,
58
+ end: i
59
+ }, s.apiGatewayUrl, o)
60
+ });
61
+ }
62
+ function h(e) {
63
+ let n = f();
64
+ return l({
65
+ queryKey: [
66
+ ...n.key,
67
+ "watches",
68
+ e
69
+ ],
70
+ enabled: n.ready,
71
+ queryFn: async ({ signal: r }) => (await t(d(i), { pagination: {
72
+ offset: e,
73
+ limit: 20
74
+ } }, n.apiGatewayUrl, r)).cooMyPriceAlerts
75
+ });
76
+ }
77
+ function g(e, n, i) {
78
+ let a = f();
79
+ return l({
80
+ queryKey: [
81
+ ...a.key,
82
+ "receipts",
83
+ e,
84
+ n
85
+ ],
86
+ enabled: a.ready && !!e && i,
87
+ queryFn: async ({ signal: i }) => (await t(d(r), {
88
+ alertId: e,
89
+ pagination: {
90
+ offset: n,
91
+ limit: 20
92
+ }
93
+ }, a.apiGatewayUrl, i)).cooMyPriceAlertDeliveries
94
+ });
95
+ }
96
+ function _() {
97
+ let e = f(), n = u();
98
+ return c({
99
+ mutationFn: async (n) => {
100
+ if (n.kind === "save") await t(d(s), { input: n.input }, e.apiGatewayUrl);
101
+ else if (!(await t(d(o), { id: n.id }, e.apiGatewayUrl)).cooDeletePriceAlert) throw Error("The price watch was not removed.");
102
+ },
103
+ onSuccess: async () => {
104
+ await Promise.all([n.invalidateQueries({ queryKey: [...e.key, "watches"] }), n.invalidateQueries({ queryKey: [...e.key, "receipts"] })]);
105
+ }
106
+ });
107
+ }
108
+ //#endregion
109
+ export { p as useBestPrices, m as usePriceDetail, _ as usePriceWatchAction, g as usePriceWatchDeliveries, h as usePriceWatches };
110
+
111
+ //# sourceMappingURL=usePriceApi.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"usePriceApi.js","names":[],"sources":["../../../src/coolandlovely/hooks/usePriceApi.ts"],"sourcesContent":["import { useMutation, useQuery, useQueryClient } from '@tanstack/react-query';\nimport { print } from 'graphql';\n\nimport {\n CooBestPricesDocument,\n CooMyPriceWatchesDocument,\n CooMyPriceWatchDeliveriesDocument,\n CooPriceDetailDocument,\n CooRemovePriceWatchDocument,\n CooSavePriceWatchDocument,\n} from '../../generated/wspace-operations';\nimport type {\n CooBestPricesQuery,\n CooMyPriceWatchesQuery,\n CooMyPriceWatchDeliveriesQuery,\n CooPriceDetailQuery,\n CooRemovePriceWatchMutation,\n CooSavePriceWatchMutation,\n} from '../../generated/wspace-operations';\nimport type { CooPriceAlertInput } from '../../generated/wspace-types';\nimport { useCoolAndLovely } from '../context';\nimport { coolQuery } from './useCoolAndLovelyApi';\n\nfunction usePriceScope() {\n const { apiGatewayUrl, tenantId, organizationId, workspaceId, currentUser } = useCoolAndLovely();\n return {\n apiGatewayUrl,\n key: [\n 'coolandlovely',\n 'prices',\n apiGatewayUrl,\n tenantId,\n organizationId,\n workspaceId,\n currentUser?.id,\n ],\n ready: Boolean(workspaceId && currentUser?.id),\n };\n}\n\n/** One request for the current card page; linked IDs only, never a per-card request burst. */\nexport function useBestPrices(styleItemIds: string[], currency: string) {\n const scope = usePriceScope();\n const ids = [...new Set(styleItemIds)].sort();\n return useQuery({\n queryKey: [...scope.key, 'best', currency, ids],\n enabled: scope.ready && ids.length > 0 && ids.length <= 100,\n staleTime: 30_000,\n queryFn: async ({ signal }) =>\n (\n await coolQuery<CooBestPricesQuery>(\n print(CooBestPricesDocument),\n { styleItemIds: ids, currency },\n scope.apiGatewayUrl,\n signal\n )\n ).cooBestPrices,\n });\n}\n\n/** History and full merchant details are loaded only when the shopper asks to compare. */\nexport function usePriceDetail(\n styleItemId: string,\n currency: string,\n start: string,\n end: string,\n enabled: boolean\n) {\n const scope = usePriceScope();\n return useQuery({\n queryKey: [...scope.key, 'detail', styleItemId, currency, start, end],\n enabled: scope.ready && Boolean(styleItemId) && enabled,\n staleTime: 30_000,\n queryFn: ({ signal }) =>\n coolQuery<CooPriceDetailQuery>(\n print(CooPriceDetailDocument),\n { styleItemId, currency, start, end },\n scope.apiGatewayUrl,\n signal\n ),\n });\n}\n\nexport function usePriceWatches(offset: number) {\n const scope = usePriceScope();\n return useQuery({\n queryKey: [...scope.key, 'watches', offset],\n enabled: scope.ready,\n queryFn: async ({ signal }) =>\n (\n await coolQuery<CooMyPriceWatchesQuery>(\n print(CooMyPriceWatchesDocument),\n { pagination: { offset, limit: 20 } },\n scope.apiGatewayUrl,\n signal\n )\n ).cooMyPriceAlerts,\n });\n}\n\nexport function usePriceWatchDeliveries(alertId: string, offset: number, enabled: boolean) {\n const scope = usePriceScope();\n return useQuery({\n queryKey: [...scope.key, 'receipts', alertId, offset],\n enabled: scope.ready && Boolean(alertId) && enabled,\n queryFn: async ({ signal }) =>\n (\n await coolQuery<CooMyPriceWatchDeliveriesQuery>(\n print(CooMyPriceWatchDeliveriesDocument),\n { alertId, pagination: { offset, limit: 20 } },\n scope.apiGatewayUrl,\n signal\n )\n ).cooMyPriceAlertDeliveries,\n });\n}\n\nexport function usePriceWatchAction() {\n const scope = usePriceScope();\n const client = useQueryClient();\n return useMutation({\n mutationFn: async (\n action: { kind: 'save'; input: CooPriceAlertInput } | { kind: 'remove'; id: string }\n ) => {\n if (action.kind === 'save') {\n await coolQuery<CooSavePriceWatchMutation>(\n print(CooSavePriceWatchDocument),\n { input: action.input },\n scope.apiGatewayUrl\n );\n } else {\n const result = await coolQuery<CooRemovePriceWatchMutation>(\n print(CooRemovePriceWatchDocument),\n { id: action.id },\n scope.apiGatewayUrl\n );\n if (!result.cooDeletePriceAlert) throw new Error('The price watch was not removed.');\n }\n },\n onSuccess: async () => {\n await Promise.all([\n client.invalidateQueries({ queryKey: [...scope.key, 'watches'] }),\n client.invalidateQueries({ queryKey: [...scope.key, 'receipts'] }),\n ]);\n },\n });\n}\n"],"mappings":";;;;;;;AAuBA,SAAS,IAAgB;CACvB,IAAM,EAAE,kBAAe,aAAU,mBAAgB,gBAAa,mBAAgB,EAAiB;CAC/F,OAAO;EACL;EACA,KAAK;GACH;GACA;GACA;GACA;GACA;GACA;GACA,GAAa;EACf;EACA,OAAO,GAAQ,KAAe,GAAa;CAC7C;AACF;AAGA,SAAgB,EAAc,GAAwB,GAAkB;CACtE,IAAM,IAAQ,EAAc,GACtB,IAAM,CAAC,GAAG,IAAI,IAAI,CAAY,CAAC,CAAC,CAAC,KAAK;CAC5C,OAAO,EAAS;EACd,UAAU;GAAC,GAAG,EAAM;GAAK;GAAQ;GAAU;EAAG;EAC9C,SAAS,EAAM,SAAS,EAAI,SAAS,KAAK,EAAI,UAAU;EACxD,WAAW;EACX,SAAS,OAAO,EAAE,iBAEd,MAAM,EACJ,EAAM,CAAqB,GAC3B;GAAE,cAAc;GAAK;EAAS,GAC9B,EAAM,eACN,CACF,EAAA,CACA;CACN,CAAC;AACH;AAGA,SAAgB,EACd,GACA,GACA,GACA,GACA,GACA;CACA,IAAM,IAAQ,EAAc;CAC5B,OAAO,EAAS;EACd,UAAU;GAAC,GAAG,EAAM;GAAK;GAAU;GAAa;GAAU;GAAO;EAAG;EACpE,SAAS,EAAM,SAAS,EAAQ,KAAgB;EAChD,WAAW;EACX,UAAU,EAAE,gBACV,EACE,EAAM,CAAsB,GAC5B;GAAE;GAAa;GAAU;GAAO;EAAI,GACpC,EAAM,eACN,CACF;CACJ,CAAC;AACH;AAEA,SAAgB,EAAgB,GAAgB;CAC9C,IAAM,IAAQ,EAAc;CAC5B,OAAO,EAAS;EACd,UAAU;GAAC,GAAG,EAAM;GAAK;GAAW;EAAM;EAC1C,SAAS,EAAM;EACf,SAAS,OAAO,EAAE,iBAEd,MAAM,EACJ,EAAM,CAAyB,GAC/B,EAAE,YAAY;GAAE;GAAQ,OAAO;EAAG,EAAE,GACpC,EAAM,eACN,CACF,EAAA,CACA;CACN,CAAC;AACH;AAEA,SAAgB,EAAwB,GAAiB,GAAgB,GAAkB;CACzF,IAAM,IAAQ,EAAc;CAC5B,OAAO,EAAS;EACd,UAAU;GAAC,GAAG,EAAM;GAAK;GAAY;GAAS;EAAM;EACpD,SAAS,EAAM,SAAS,EAAQ,KAAY;EAC5C,SAAS,OAAO,EAAE,iBAEd,MAAM,EACJ,EAAM,CAAiC,GACvC;GAAE;GAAS,YAAY;IAAE;IAAQ,OAAO;GAAG;EAAE,GAC7C,EAAM,eACN,CACF,EAAA,CACA;CACN,CAAC;AACH;AAEA,SAAgB,IAAsB;CACpC,IAAM,IAAQ,EAAc,GACtB,IAAS,EAAe;CAC9B,OAAO,EAAY;EACjB,YAAY,OACV,MACG;GACH,IAAI,EAAO,SAAS,QAClB,MAAM,EACJ,EAAM,CAAyB,GAC/B,EAAE,OAAO,EAAO,MAAM,GACtB,EAAM,aACR;QAOA,IAAI,EAAC,MALgB,EACnB,EAAM,CAA2B,GACjC,EAAE,IAAI,EAAO,GAAG,GAChB,EAAM,aACR,EAAA,CACY,qBAAqB,MAAU,MAAM,kCAAkC;EAEvF;EACA,WAAW,YAAY;GACrB,MAAM,QAAQ,IAAI,CAChB,EAAO,kBAAkB,EAAE,UAAU,CAAC,GAAG,EAAM,KAAK,SAAS,EAAE,CAAC,GAChE,EAAO,kBAAkB,EAAE,UAAU,CAAC,GAAG,EAAM,KAAK,UAAU,EAAE,CAAC,CACnE,CAAC;EACH;CACF,CAAC;AACH"}
@@ -1 +1 @@
1
- {"version":3,"file":"StoreListedPieceView.d.ts","sourceRoot":"","sources":["../../../../src/coolandlovely/pages/items/StoreListedPieceView.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,KAAK,EAAE,EAAY,MAAM,OAAO,CAAC;AAkS1C;;;GAGG;AACH,eAAO,MAAM,oBAAoB,EAAE,EAAE,CAAC;IAAE,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC;IAAC,OAAO,EAAE,MAAM,IAAI,CAAA;CAAE,CAkIxF,CAAC"}
1
+ {"version":3,"file":"StoreListedPieceView.d.ts","sourceRoot":"","sources":["../../../../src/coolandlovely/pages/items/StoreListedPieceView.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAGH,OAAO,EAAE,KAAK,EAAE,EAAY,MAAM,OAAO,CAAC;AAkS1C;;;GAGG;AACH,eAAO,MAAM,oBAAoB,EAAE,EAAE,CAAC;IAAE,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC;IAAC,OAAO,EAAE,MAAM,IAAI,CAAA;CAAE,CAqIxF,CAAC"}
@@ -12,115 +12,116 @@ import { TagList as f } from "../../components/TagList.js";
12
12
  import { ColourSwatchRow as p } from "../../components/ColourSwatchRow.js";
13
13
  import { useBuyStoreListedPiece as m, useStoreListedPiece as h, useSyncOrderPayment as g } from "../../hooks/useCommerceApi.js";
14
14
  import { PayForOrder as _ } from "../../components/PayForOrder.js";
15
- import { useState as v } from "react";
16
- import { ArrowLeft as y, Loader2 as b, ShoppingBag as x, Store as S } from "lucide-react";
17
- import { jsx as C, jsxs as w } from "react/jsx-runtime";
18
- import { GlassCard as T } from "@burdenoff/fe-libs/ui";
15
+ import { PricePanel as v } from "../../components/prices/PricePanel.js";
16
+ import { useState as y } from "react";
17
+ import { ArrowLeft as b, Loader2 as x, ShoppingBag as S, Store as C } from "lucide-react";
18
+ import { jsx as w, jsxs as T } from "react/jsx-runtime";
19
+ import { GlassCard as E } from "@burdenoff/fe-libs/ui";
19
20
  //#region src/coolandlovely/pages/items/StoreListedPieceView.tsx
20
- var E = 10, D = 5, O = (e) => t("inline-flex min-w-9 items-center justify-center rounded-full border px-3 py-1 text-sm font-medium transition-colors disabled:opacity-40 disabled:line-through", e ? "border-action-primary-bg bg-action-primary-bg text-action-primary-text" : "border-border-seam text-text-primary hover:bg-bg-sunken"), k = "inline-flex w-full items-center justify-center gap-2 rounded-lg bg-action-primary-bg px-4 py-2.5 text-sm font-semibold text-action-primary-text transition-colors hover:bg-action-primary-bg/90 disabled:opacity-50";
21
- function A(e, t, n) {
21
+ var D = 10, O = 5, k = (e) => t("inline-flex min-w-9 items-center justify-center rounded-full border px-3 py-1 text-sm font-medium transition-colors disabled:opacity-40 disabled:line-through", e ? "border-action-primary-bg bg-action-primary-bg text-action-primary-text" : "border-border-seam text-text-primary hover:bg-bg-sunken"), A = "inline-flex w-full items-center justify-center gap-2 rounded-lg bg-action-primary-bg px-4 py-2.5 text-sm font-semibold text-action-primary-text transition-colors hover:bg-action-primary-bg/90 disabled:opacity-50";
22
+ function j(e, t, n) {
22
23
  return e.trackInventory ? e.variants.filter((e) => (t === null || (e.size ?? "") === t) && (n === null || (e.colour ?? "") === n)).reduce((e, t) => e + t.available, 0) : null;
23
24
  }
24
- var j = ({ piece: e, onCheckout: n }) => {
25
- let i = r(), a = m(), [o, c] = v(e.sizes.length === 1 ? e.sizes[0] ?? null : null), [l, f] = v(e.colours.length === 1 ? e.colours[0] ?? null : null), [p, h] = v(1), [g, _] = v(""), [y, S] = v(""), [T, j] = v("");
26
- if (!e.inStock) return /* @__PURE__ */ C("p", {
25
+ var M = ({ piece: e, onCheckout: n }) => {
26
+ let i = r(), a = m(), [o, c] = y(e.sizes.length === 1 ? e.sizes[0] ?? null : null), [l, f] = y(e.colours.length === 1 ? e.colours[0] ?? null : null), [p, h] = y(1), [g, _] = y(""), [v, b] = y(""), [C, E] = y("");
27
+ if (!e.inStock) return /* @__PURE__ */ w("p", {
27
28
  className: "rounded-lg border border-border-seam bg-bg-sunken p-3 text-sm text-text-secondary",
28
29
  children: i("coolandlovely.storePiece.soldOut", "This piece is sold out right now.")
29
30
  });
30
- let M = e.sizes.length > 0 && !o, N = e.colours.length > 0 && !l, P = M || N ? null : A(e, o ?? "", l ?? ""), F = P !== null && P <= 0, I = P === null ? E : Math.max(1, Math.min(E, P)), L = !M && !N && !F && g.trim() !== "" && y.trim() !== "";
31
- return /* @__PURE__ */ w("div", {
31
+ let M = e.sizes.length > 0 && !o, N = e.colours.length > 0 && !l, P = M || N ? null : j(e, o ?? "", l ?? ""), F = P !== null && P <= 0, I = P === null ? D : Math.max(1, Math.min(D, P)), L = !M && !N && !F && g.trim() !== "" && v.trim() !== "";
32
+ return /* @__PURE__ */ T("div", {
32
33
  className: "space-y-4",
33
34
  "data-testid": "store-buy-panel",
34
35
  children: [
35
- e.sizes.length > 0 && /* @__PURE__ */ w("div", { children: [/* @__PURE__ */ C("p", {
36
+ e.sizes.length > 0 && /* @__PURE__ */ T("div", { children: [/* @__PURE__ */ w("p", {
36
37
  className: "mb-2 text-xs font-medium uppercase tracking-wide text-text-secondary",
37
38
  children: i("coolandlovely.cart.chooseSize", "Choose a size")
38
- }), /* @__PURE__ */ C("div", {
39
+ }), /* @__PURE__ */ w("div", {
39
40
  className: "flex flex-wrap gap-2",
40
- children: e.sizes.map((t) => /* @__PURE__ */ C("button", {
41
+ children: e.sizes.map((t) => /* @__PURE__ */ w("button", {
41
42
  type: "button",
42
43
  "aria-pressed": o === t,
43
- disabled: A(e, t, l) === 0,
44
+ disabled: j(e, t, l) === 0,
44
45
  onClick: () => {
45
46
  c(t), h(1);
46
47
  },
47
- className: O(o === t),
48
+ className: k(o === t),
48
49
  children: t
49
50
  }, t))
50
51
  })] }),
51
- e.colours.length > 0 && /* @__PURE__ */ w("div", { children: [/* @__PURE__ */ C("p", {
52
+ e.colours.length > 0 && /* @__PURE__ */ T("div", { children: [/* @__PURE__ */ w("p", {
52
53
  className: "mb-2 text-xs font-medium uppercase tracking-wide text-text-secondary",
53
54
  children: i("coolandlovely.cart.chooseColour", "Choose a colour")
54
- }), /* @__PURE__ */ C("div", {
55
+ }), /* @__PURE__ */ w("div", {
55
56
  className: "flex flex-wrap gap-2",
56
- children: e.colours.map((t) => /* @__PURE__ */ C("button", {
57
+ children: e.colours.map((t) => /* @__PURE__ */ w("button", {
57
58
  type: "button",
58
59
  "aria-pressed": l === t,
59
- disabled: A(e, o, t) === 0,
60
+ disabled: j(e, o, t) === 0,
60
61
  onClick: () => {
61
62
  f(t), h(1);
62
63
  },
63
- className: O(l === t),
64
+ className: k(l === t),
64
65
  children: t
65
66
  }, t))
66
67
  })] }),
67
- /* @__PURE__ */ w("div", {
68
+ /* @__PURE__ */ T("div", {
68
69
  className: "flex items-center gap-3",
69
- children: [/* @__PURE__ */ C("label", {
70
+ children: [/* @__PURE__ */ w("label", {
70
71
  htmlFor: "coo-store-quantity",
71
72
  className: "text-sm text-text-secondary",
72
73
  children: i("coolandlovely.cart.quantity", "Quantity")
73
- }), /* @__PURE__ */ C("select", {
74
+ }), /* @__PURE__ */ w("select", {
74
75
  id: "coo-store-quantity",
75
76
  value: p,
76
77
  onChange: (e) => h(Number(e.target.value)),
77
78
  className: "rounded-lg border border-border-seam bg-bg-surface px-2 py-1.5 text-sm text-text-primary",
78
- children: Array.from({ length: I }, (e, t) => t + 1).map((e) => /* @__PURE__ */ C("option", {
79
+ children: Array.from({ length: I }, (e, t) => t + 1).map((e) => /* @__PURE__ */ w("option", {
79
80
  value: e,
80
81
  children: e
81
82
  }, e))
82
83
  })]
83
84
  }),
84
- P !== null && /* @__PURE__ */ C("p", {
85
+ P !== null && /* @__PURE__ */ w("p", {
85
86
  "data-testid": "store-stock-left",
86
- className: t("text-sm font-medium", F || P <= D ? "text-status-warning-text" : "text-text-secondary"),
87
- children: F ? i("coolandlovely.cart.soldOut", "Sold out in this size and colour") : P <= D ? i("coolandlovely.cart.onlyLeft", "Only {{count}} left", { count: P }) : i("coolandlovely.cart.inStock", "In stock")
87
+ className: t("text-sm font-medium", F || P <= O ? "text-status-warning-text" : "text-text-secondary"),
88
+ children: F ? i("coolandlovely.cart.soldOut", "Sold out in this size and colour") : P <= O ? i("coolandlovely.cart.onlyLeft", "Only {{count}} left", { count: P }) : i("coolandlovely.cart.inStock", "In stock")
88
89
  }),
89
- /* @__PURE__ */ w("div", {
90
+ /* @__PURE__ */ T("div", {
90
91
  className: "space-y-3 border-t border-border-seam pt-4",
91
92
  children: [
92
- /* @__PURE__ */ C(d, {
93
+ /* @__PURE__ */ w(d, {
93
94
  id: "coo-store-shipping-name",
94
95
  label: i("coolandlovely.checkout.shippingName", "Full name"),
95
96
  value: g,
96
97
  onChange: _,
97
98
  required: !0
98
99
  }),
99
- /* @__PURE__ */ C(u, {
100
+ /* @__PURE__ */ w(u, {
100
101
  id: "coo-store-shipping-address",
101
102
  label: i("coolandlovely.checkout.shippingAddress", "Shipping address"),
102
- value: y,
103
- onChange: S,
103
+ value: v,
104
+ onChange: b,
104
105
  rows: 3,
105
106
  required: !0
106
107
  }),
107
- /* @__PURE__ */ C(d, {
108
+ /* @__PURE__ */ w(d, {
108
109
  id: "coo-store-buyer-note",
109
110
  label: i("coolandlovely.checkout.note", "Note for the brand (optional)"),
110
- value: T,
111
- onChange: j
111
+ value: C,
112
+ onChange: E
112
113
  })
113
114
  ]
114
115
  }),
115
- /* @__PURE__ */ C("p", {
116
+ /* @__PURE__ */ w("p", {
116
117
  className: "text-xs text-text-secondary",
117
118
  children: i("coolandlovely.cart.taxNote", "Tax is calculated when you place the order.")
118
119
  }),
119
- a.error && /* @__PURE__ */ C("p", {
120
+ a.error && /* @__PURE__ */ w("p", {
120
121
  className: "text-sm text-status-error-text",
121
122
  children: a.error.message
122
123
  }),
123
- /* @__PURE__ */ w("button", {
124
+ /* @__PURE__ */ T("button", {
124
125
  type: "button",
125
126
  disabled: !L || a.isPending,
126
127
  onClick: () => {
@@ -130,55 +131,55 @@ var j = ({ piece: e, onCheckout: n }) => {
130
131
  size: o,
131
132
  colour: l,
132
133
  shippingName: g.trim(),
133
- shippingAddress: y.trim(),
134
- buyerNote: T.trim() || null
134
+ shippingAddress: v.trim(),
135
+ buyerNote: C.trim() || null
135
136
  }, { onSuccess: n });
136
137
  },
137
- className: k,
138
- children: [a.isPending ? /* @__PURE__ */ C(b, { className: "h-4 w-4 animate-spin" }) : /* @__PURE__ */ C(x, { className: "h-4 w-4" }), i("coolandlovely.storePiece.buyNow", "Buy now · {{amount}}", { amount: s(e.price * p, e.currency) })]
138
+ className: A,
139
+ children: [a.isPending ? /* @__PURE__ */ w(x, { className: "h-4 w-4 animate-spin" }) : /* @__PURE__ */ w(S, { className: "h-4 w-4" }), i("coolandlovely.storePiece.buyNow", "Buy now · {{amount}}", { amount: s(e.price * p, e.currency) })]
139
140
  })
140
141
  ]
141
142
  });
142
- }, M = ({ session: t }) => {
143
+ }, N = ({ session: t }) => {
143
144
  let i = r(), { navigateTo: a } = e(), o = g();
144
- return /* @__PURE__ */ C(n, {
145
+ return /* @__PURE__ */ w(n, {
145
146
  title: i("coolandlovely.checkout.payTitle", "Pay for your order"),
146
147
  description: t.order.orderNumber,
147
- children: /* @__PURE__ */ C("div", {
148
+ children: /* @__PURE__ */ w("div", {
148
149
  className: "mx-auto max-w-lg space-y-4",
149
- children: /* @__PURE__ */ w(T, {
150
+ children: /* @__PURE__ */ T(E, {
150
151
  treatment: "glass",
151
152
  className: "space-y-4 p-6",
152
153
  children: [
153
- /* @__PURE__ */ w("dl", {
154
+ /* @__PURE__ */ T("dl", {
154
155
  className: "space-y-2 text-sm",
155
156
  children: [
156
- /* @__PURE__ */ w("div", {
157
+ /* @__PURE__ */ T("div", {
157
158
  className: "flex justify-between",
158
- children: [/* @__PURE__ */ C("dt", {
159
+ children: [/* @__PURE__ */ w("dt", {
159
160
  className: "text-text-secondary",
160
161
  children: i("coolandlovely.checkout.subtotal", "Subtotal")
161
- }), /* @__PURE__ */ C("dd", {
162
+ }), /* @__PURE__ */ w("dd", {
162
163
  className: "tabular-nums text-text-primary",
163
164
  children: s(t.subtotal, t.currency)
164
165
  })]
165
166
  }),
166
- /* @__PURE__ */ w("div", {
167
+ /* @__PURE__ */ T("div", {
167
168
  className: "flex justify-between",
168
- children: [/* @__PURE__ */ C("dt", {
169
+ children: [/* @__PURE__ */ w("dt", {
169
170
  className: "text-text-secondary",
170
171
  children: i("coolandlovely.checkout.tax", "Tax")
171
- }), /* @__PURE__ */ C("dd", {
172
+ }), /* @__PURE__ */ w("dd", {
172
173
  className: "tabular-nums text-text-primary",
173
174
  children: s(t.taxAmount, t.currency)
174
175
  })]
175
176
  }),
176
- /* @__PURE__ */ w("div", {
177
+ /* @__PURE__ */ T("div", {
177
178
  className: "flex justify-between border-t border-border-seam pt-2 text-base font-semibold",
178
- children: [/* @__PURE__ */ C("dt", {
179
+ children: [/* @__PURE__ */ w("dt", {
179
180
  className: "text-text-primary",
180
181
  children: i("coolandlovely.checkout.total", "Total")
181
- }), /* @__PURE__ */ C("dd", {
182
+ }), /* @__PURE__ */ w("dd", {
182
183
  className: "tabular-nums text-text-primary",
183
184
  "data-testid": "store-checkout-total",
184
185
  children: s(t.total, t.currency)
@@ -186,13 +187,13 @@ var j = ({ piece: e, onCheckout: n }) => {
186
187
  })
187
188
  ]
188
189
  }),
189
- /* @__PURE__ */ C(_, {
190
+ /* @__PURE__ */ w(_, {
190
191
  checkout: t,
191
192
  onSettle: async () => {
192
193
  await o.mutateAsync(t.order.id).catch(() => void 0), a(`/orders/${t.order.id}`);
193
194
  }
194
195
  }),
195
- /* @__PURE__ */ C("button", {
196
+ /* @__PURE__ */ w("button", {
196
197
  type: "button",
197
198
  onClick: () => a(`/orders/${t.order.id}`),
198
199
  className: "w-full text-center text-sm font-medium text-text-secondary hover:underline",
@@ -202,151 +203,157 @@ var j = ({ piece: e, onCheckout: n }) => {
202
203
  })
203
204
  })
204
205
  });
205
- }, N = ({ itemId: t, onRetry: u }) => {
206
- let d = r(), { navigateTo: m } = e(), g = h(t, !0), [_, b] = v(null), x = d("coolandlovely.storePiece.pageTitle", "Style item");
207
- if (_) return /* @__PURE__ */ C(M, { session: _ });
208
- if (g.isLoading) return /* @__PURE__ */ C(n, {
209
- title: x,
210
- children: /* @__PURE__ */ C(a, { label: d("coolandlovely.storePiece.loading", "Loading item…") })
206
+ }, P = ({ itemId: t, onRetry: u }) => {
207
+ let d = r(), { navigateTo: m } = e(), g = h(t, !0), [_, x] = y(null), S = d("coolandlovely.storePiece.pageTitle", "Style item");
208
+ if (_) return /* @__PURE__ */ w(N, { session: _ });
209
+ if (g.isLoading) return /* @__PURE__ */ w(n, {
210
+ title: S,
211
+ children: /* @__PURE__ */ w(a, { label: d("coolandlovely.storePiece.loading", "Loading item…") })
211
212
  });
212
- let E = g.data;
213
- return g.isError || !E ? /* @__PURE__ */ C(n, {
214
- title: x,
215
- children: /* @__PURE__ */ C(i, {
213
+ let D = g.data;
214
+ return g.isError || !D ? /* @__PURE__ */ w(n, {
215
+ title: S,
216
+ children: /* @__PURE__ */ w(i, {
216
217
  title: d("coolandlovely.storePiece.notFound", "Item not found"),
217
218
  onRetry: () => {
218
219
  u(), g.refetch();
219
220
  }
220
221
  })
221
- }) : /* @__PURE__ */ C(n, {
222
- title: E.name,
223
- description: E.brandName,
224
- actions: /* @__PURE__ */ w("button", {
222
+ }) : /* @__PURE__ */ T(n, {
223
+ title: D.name,
224
+ description: D.brandName,
225
+ actions: /* @__PURE__ */ T("button", {
225
226
  type: "button",
226
227
  onClick: () => m("/discover"),
227
228
  className: "inline-flex items-center gap-1.5 rounded-lg border border-border-seam px-3 py-2 text-sm font-medium text-text-primary transition-colors hover:bg-bg-sunken",
228
229
  children: [
229
- /* @__PURE__ */ C(y, { className: "h-4 w-4" }),
230
+ /* @__PURE__ */ w(b, { className: "h-4 w-4" }),
230
231
  " ",
231
232
  d("coolandlovely.storePiece.back", "Discover")
232
233
  ]
233
234
  }),
234
- children: /* @__PURE__ */ w("div", {
235
+ children: [/* @__PURE__ */ T("div", {
235
236
  className: "grid grid-cols-1 gap-6 lg:grid-cols-3",
236
237
  "data-testid": "store-listed-piece",
237
- children: [/* @__PURE__ */ C("div", {
238
+ children: [/* @__PURE__ */ w("div", {
238
239
  className: "lg:col-span-2",
239
- children: /* @__PURE__ */ w(T, {
240
+ children: /* @__PURE__ */ T(E, {
240
241
  treatment: "glass",
241
242
  className: "overflow-hidden p-0",
242
- children: [/* @__PURE__ */ C(o, {
243
- icon: l(E.category, 48),
244
- seed: E.id,
245
- alt: E.name,
243
+ children: [/* @__PURE__ */ w(o, {
244
+ icon: l(D.category, 48),
245
+ seed: D.id,
246
+ alt: D.name,
246
247
  className: "aspect-[4/5] w-full"
247
- }), E.description && /* @__PURE__ */ C("div", {
248
+ }), D.description && /* @__PURE__ */ w("div", {
248
249
  className: "p-6",
249
- children: /* @__PURE__ */ C("p", {
250
+ children: /* @__PURE__ */ w("p", {
250
251
  className: "text-sm leading-relaxed text-text-secondary",
251
- children: E.description
252
+ children: D.description
252
253
  })
253
254
  })]
254
255
  })
255
- }), /* @__PURE__ */ w("div", {
256
+ }), /* @__PURE__ */ T("div", {
256
257
  className: "space-y-4",
257
- children: [/* @__PURE__ */ w(T, {
258
+ children: [/* @__PURE__ */ T(E, {
258
259
  treatment: "glass",
259
260
  className: "space-y-5 p-6",
260
261
  children: [
261
- /* @__PURE__ */ w("div", { children: [
262
- /* @__PURE__ */ w("p", {
262
+ /* @__PURE__ */ T("div", { children: [
263
+ /* @__PURE__ */ T("p", {
263
264
  className: "inline-flex items-center gap-1.5 text-xs font-medium text-accent-primary",
264
- children: [/* @__PURE__ */ C(S, { className: "h-3.5 w-3.5" }), d("coolandlovely.storePiece.fromStore", "Listed in the Burdenoff store")]
265
+ children: [/* @__PURE__ */ w(C, { className: "h-3.5 w-3.5" }), d("coolandlovely.storePiece.fromStore", "Listed in the Burdenoff store")]
265
266
  }),
266
- /* @__PURE__ */ C("h2", {
267
+ /* @__PURE__ */ w("h2", {
267
268
  className: "mt-2 text-2xl font-semibold leading-tight text-text-primary",
268
- children: E.name
269
+ children: D.name
269
270
  }),
270
- /* @__PURE__ */ w("p", {
271
+ /* @__PURE__ */ T("p", {
271
272
  className: "mt-1 text-sm font-medium text-text-secondary",
272
- children: [E.brandName, /* @__PURE__ */ w("span", {
273
+ children: [D.brandName, /* @__PURE__ */ T("span", {
273
274
  className: "ml-1 text-text-tertiary",
274
- children: ["@", E.brandHandle]
275
+ children: ["@", D.brandHandle]
275
276
  })]
276
277
  }),
277
- /* @__PURE__ */ w("p", {
278
+ /* @__PURE__ */ T("p", {
278
279
  className: "mt-3 text-3xl font-bold text-text-primary tabular-nums",
279
- children: [s(E.price, E.currency), /* @__PURE__ */ C("span", {
280
+ children: [s(D.price, D.currency), /* @__PURE__ */ w("span", {
280
281
  className: "ml-2 text-base font-medium text-text-secondary",
281
- children: E.currency
282
+ children: D.currency
282
283
  })]
283
284
  })
284
285
  ] }),
285
- E.colours.length > 0 && /* @__PURE__ */ C(p, {
286
- colours: E.colours,
286
+ D.colours.length > 0 && /* @__PURE__ */ w(p, {
287
+ colours: D.colours,
287
288
  max: 12
288
289
  }),
289
- /* @__PURE__ */ C("div", {
290
+ /* @__PURE__ */ w("div", {
290
291
  className: "border-t border-border-seam pt-5",
291
- children: /* @__PURE__ */ C(j, {
292
- piece: E,
293
- onCheckout: b
292
+ children: /* @__PURE__ */ w(M, {
293
+ piece: D,
294
+ onCheckout: x
294
295
  })
295
296
  }),
296
- E.materials.length > 0 && /* @__PURE__ */ w("div", { children: [/* @__PURE__ */ C("p", {
297
+ D.materials.length > 0 && /* @__PURE__ */ T("div", { children: [/* @__PURE__ */ w("p", {
297
298
  className: "mb-1 text-xs font-medium uppercase tracking-wide text-text-secondary",
298
299
  children: d("coolandlovely.storePiece.materials", "Materials")
299
- }), /* @__PURE__ */ C("p", {
300
+ }), /* @__PURE__ */ w("p", {
300
301
  className: "text-sm text-text-primary",
301
- children: E.materials.join(", ")
302
+ children: D.materials.join(", ")
302
303
  })] }),
303
- E.tags.length > 0 && /* @__PURE__ */ C(f, {
304
- tags: E.tags,
304
+ D.tags.length > 0 && /* @__PURE__ */ w(f, {
305
+ tags: D.tags,
305
306
  max: 12,
306
307
  tone: "accent"
307
308
  })
308
309
  ]
309
- }), /* @__PURE__ */ w(T, {
310
+ }), /* @__PURE__ */ T(E, {
310
311
  treatment: "plain",
311
312
  className: "p-5",
312
313
  children: [
313
- /* @__PURE__ */ C("h3", {
314
+ /* @__PURE__ */ w("h3", {
314
315
  className: "mb-3 text-sm font-semibold text-text-primary",
315
316
  children: d("coolandlovely.storePiece.details", "Details")
316
317
  }),
317
- /* @__PURE__ */ w("dl", {
318
+ /* @__PURE__ */ T("dl", {
318
319
  className: "space-y-2 text-sm",
319
- children: [/* @__PURE__ */ w("div", {
320
+ children: [/* @__PURE__ */ T("div", {
320
321
  className: "flex justify-between gap-2",
321
- children: [/* @__PURE__ */ C("dt", {
322
+ children: [/* @__PURE__ */ w("dt", {
322
323
  className: "text-text-secondary",
323
324
  children: d("coolandlovely.storePiece.category", "Category")
324
- }), /* @__PURE__ */ C("dd", {
325
+ }), /* @__PURE__ */ w("dd", {
325
326
  className: "text-text-primary",
326
- children: c(E.category)
327
+ children: c(D.category)
327
328
  })]
328
- }), /* @__PURE__ */ w("div", {
329
+ }), /* @__PURE__ */ T("div", {
329
330
  className: "flex justify-between gap-2",
330
- children: [/* @__PURE__ */ C("dt", {
331
+ children: [/* @__PURE__ */ w("dt", {
331
332
  className: "text-text-secondary",
332
333
  children: "SKU"
333
- }), /* @__PURE__ */ C("dd", {
334
+ }), /* @__PURE__ */ w("dd", {
334
335
  className: "text-text-primary",
335
- children: E.sku ?? "—"
336
+ children: D.sku ?? "—"
336
337
  })]
337
338
  })]
338
339
  }),
339
- /* @__PURE__ */ C("p", {
340
+ /* @__PURE__ */ w("p", {
340
341
  className: "mt-3 text-xs text-text-secondary",
341
- children: d("coolandlovely.storePiece.soldBy", "Sold and shipped by {{brand}}. Your order appears in My Orders.", { brand: E.brandName })
342
+ children: d("coolandlovely.storePiece.soldBy", "Sold and shipped by {{brand}}. Your order appears in My Orders.", { brand: D.brandName })
342
343
  })
343
344
  ]
344
345
  })]
345
346
  })]
346
- })
347
+ }), /* @__PURE__ */ w("div", {
348
+ className: "mt-6",
349
+ children: /* @__PURE__ */ w(v, {
350
+ styleItemId: D.id,
351
+ currency: D.currency
352
+ }, D.id)
353
+ })]
347
354
  });
348
355
  };
349
356
  //#endregion
350
- export { N as StoreListedPieceView };
357
+ export { P as StoreListedPieceView };
351
358
 
352
359
  //# sourceMappingURL=StoreListedPieceView.js.map