@burdenoff/microfe-coolandlovely 2026.1101.8 → 2026.1102.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +15 -0
- package/dist/coolandlovely/CoolAndLovelyRoot.d.ts.map +1 -1
- package/dist/coolandlovely/CoolAndLovelyRoot.js +8 -0
- package/dist/coolandlovely/CoolAndLovelyRoot.js.map +1 -1
- package/dist/coolandlovely/CoolAndLovelyRoutes.d.ts.map +1 -1
- package/dist/coolandlovely/CoolAndLovelyRoutes.js +20 -16
- package/dist/coolandlovely/CoolAndLovelyRoutes.js.map +1 -1
- package/dist/coolandlovely/components/WardrobeItemCard.d.ts +2 -1
- package/dist/coolandlovely/components/WardrobeItemCard.d.ts.map +1 -1
- package/dist/coolandlovely/components/WardrobeItemCard.js +4 -3
- package/dist/coolandlovely/components/WardrobeItemCard.js.map +1 -1
- package/dist/coolandlovely/components/prices/BestPriceBadge.d.ts +7 -0
- package/dist/coolandlovely/components/prices/BestPriceBadge.d.ts.map +1 -0
- package/dist/coolandlovely/components/prices/BestPriceBadge.js +22 -0
- package/dist/coolandlovely/components/prices/BestPriceBadge.js.map +1 -0
- package/dist/coolandlovely/components/prices/LookbookPriceBoard.d.ts +10 -0
- package/dist/coolandlovely/components/prices/LookbookPriceBoard.d.ts.map +1 -0
- package/dist/coolandlovely/components/prices/LookbookPriceBoard.js +120 -0
- package/dist/coolandlovely/components/prices/LookbookPriceBoard.js.map +1 -0
- package/dist/coolandlovely/components/prices/PriceComparison.d.ts +5 -0
- package/dist/coolandlovely/components/prices/PriceComparison.d.ts.map +1 -0
- package/dist/coolandlovely/components/prices/PriceComparison.js +95 -0
- package/dist/coolandlovely/components/prices/PriceComparison.js.map +1 -0
- package/dist/coolandlovely/components/prices/PriceCurrencySelect.d.ts +6 -0
- package/dist/coolandlovely/components/prices/PriceCurrencySelect.d.ts.map +1 -0
- package/dist/coolandlovely/components/prices/PriceCurrencySelect.js +38 -0
- package/dist/coolandlovely/components/prices/PriceCurrencySelect.js.map +1 -0
- package/dist/coolandlovely/components/prices/PricePanel.d.ts +6 -0
- package/dist/coolandlovely/components/prices/PricePanel.d.ts.map +1 -0
- package/dist/coolandlovely/components/prices/PricePanel.js +105 -0
- package/dist/coolandlovely/components/prices/PricePanel.js.map +1 -0
- package/dist/coolandlovely/components/prices/PriceWatchDisclosure.d.ts +2 -0
- package/dist/coolandlovely/components/prices/PriceWatchDisclosure.d.ts.map +1 -0
- package/dist/coolandlovely/components/prices/PriceWatchDisclosure.js +28 -0
- package/dist/coolandlovely/components/prices/PriceWatchDisclosure.js.map +1 -0
- package/dist/coolandlovely/components/prices/PriceWatchForm.d.ts +5 -0
- package/dist/coolandlovely/components/prices/PriceWatchForm.d.ts.map +1 -0
- package/dist/coolandlovely/components/prices/PriceWatchForm.js +89 -0
- package/dist/coolandlovely/components/prices/PriceWatchForm.js.map +1 -0
- package/dist/coolandlovely/components/prices/PriceWatches.d.ts +3 -0
- package/dist/coolandlovely/components/prices/PriceWatches.d.ts.map +1 -0
- package/dist/coolandlovely/components/prices/PriceWatches.js +189 -0
- package/dist/coolandlovely/components/prices/PriceWatches.js.map +1 -0
- package/dist/coolandlovely/components/prices/RetailerOfferLink.d.ts +6 -0
- package/dist/coolandlovely/components/prices/RetailerOfferLink.d.ts.map +1 -0
- package/dist/coolandlovely/components/prices/RetailerOfferLink.js +28 -0
- package/dist/coolandlovely/components/prices/RetailerOfferLink.js.map +1 -0
- package/dist/coolandlovely/components/prices/money.d.ts +6 -0
- package/dist/coolandlovely/components/prices/money.d.ts.map +1 -0
- package/dist/coolandlovely/components/prices/money.js +42 -0
- package/dist/coolandlovely/components/prices/money.js.map +1 -0
- package/dist/coolandlovely/hooks/useContextNavigation.d.ts +3 -0
- package/dist/coolandlovely/hooks/useContextNavigation.d.ts.map +1 -0
- package/dist/coolandlovely/hooks/useContextNavigation.js +31 -0
- package/dist/coolandlovely/hooks/useContextNavigation.js.map +1 -0
- package/dist/coolandlovely/hooks/useCoolAndLovelyApi.d.ts.map +1 -1
- package/dist/coolandlovely/hooks/useCoolAndLovelyApi.js +1 -1
- package/dist/coolandlovely/hooks/useCoolAndLovelyApi.js.map +1 -1
- package/dist/coolandlovely/hooks/useCreatorMarketplace.d.ts +118 -0
- package/dist/coolandlovely/hooks/useCreatorMarketplace.d.ts.map +1 -0
- package/dist/coolandlovely/hooks/useCreatorMarketplace.js +120 -0
- package/dist/coolandlovely/hooks/useCreatorMarketplace.js.map +1 -0
- package/dist/coolandlovely/hooks/usePriceApi.d.ts +57 -0
- package/dist/coolandlovely/hooks/usePriceApi.d.ts.map +1 -0
- package/dist/coolandlovely/hooks/usePriceApi.js +111 -0
- package/dist/coolandlovely/hooks/usePriceApi.js.map +1 -0
- package/dist/coolandlovely/pages/collaborations/CollaborationDetailPage.d.ts.map +1 -1
- package/dist/coolandlovely/pages/collaborations/CollaborationDetailPage.js +139 -121
- package/dist/coolandlovely/pages/collaborations/CollaborationDetailPage.js.map +1 -1
- package/dist/coolandlovely/pages/collaborations/CollaborationFormPage.d.ts.map +1 -1
- package/dist/coolandlovely/pages/collaborations/CollaborationFormPage.js +140 -137
- package/dist/coolandlovely/pages/collaborations/CollaborationFormPage.js.map +1 -1
- package/dist/coolandlovely/pages/collaborations/CollaborationsListPage.d.ts.map +1 -1
- package/dist/coolandlovely/pages/collaborations/CollaborationsListPage.js +104 -95
- package/dist/coolandlovely/pages/collaborations/CollaborationsListPage.js.map +1 -1
- package/dist/coolandlovely/pages/commerce/CreatorEarningsPage.d.ts.map +1 -1
- package/dist/coolandlovely/pages/commerce/CreatorEarningsPage.js +49 -40
- package/dist/coolandlovely/pages/commerce/CreatorEarningsPage.js.map +1 -1
- package/dist/coolandlovely/pages/items/StoreListedPieceView.d.ts.map +1 -1
- package/dist/coolandlovely/pages/items/StoreListedPieceView.js +130 -123
- package/dist/coolandlovely/pages/items/StoreListedPieceView.js.map +1 -1
- package/dist/coolandlovely/pages/items/StyleItemDetailPage.d.ts.map +1 -1
- package/dist/coolandlovely/pages/items/StyleItemDetailPage.js +241 -230
- package/dist/coolandlovely/pages/items/StyleItemDetailPage.js.map +1 -1
- package/dist/coolandlovely/pages/lookbooks/LookbookDetailPage.d.ts.map +1 -1
- package/dist/coolandlovely/pages/lookbooks/LookbookDetailPage.js +64 -119
- package/dist/coolandlovely/pages/lookbooks/LookbookDetailPage.js.map +1 -1
- package/dist/coolandlovely/pages/marketplace/CreatorMarketplacePage.d.ts +2 -0
- package/dist/coolandlovely/pages/marketplace/CreatorMarketplacePage.d.ts.map +1 -0
- package/dist/coolandlovely/pages/marketplace/CreatorMarketplacePage.js +714 -0
- package/dist/coolandlovely/pages/marketplace/CreatorMarketplacePage.js.map +1 -0
- package/dist/coolandlovely/pages/profile/StyleProfilePage.d.ts.map +1 -1
- package/dist/coolandlovely/pages/profile/StyleProfilePage.js +214 -209
- package/dist/coolandlovely/pages/profile/StyleProfilePage.js.map +1 -1
- package/dist/coolandlovely/pages/wardrobe/WardrobeListPage.d.ts.map +1 -1
- package/dist/coolandlovely/pages/wardrobe/WardrobeListPage.js +83 -49
- package/dist/coolandlovely/pages/wardrobe/WardrobeListPage.js.map +1 -1
- package/dist/coolandlovely/types/index.d.ts +5 -0
- package/dist/coolandlovely/types/index.d.ts.map +1 -1
- package/dist/generated/wspace-operations.d.ts +931 -2
- package/dist/generated/wspace-operations.d.ts.map +1 -1
- package/dist/generated/wspace-operations.js +221 -1
- package/dist/generated/wspace-operations.js.map +1 -1
- package/dist/generated/wspace-types.d.ts +539 -1
- package/dist/generated/wspace-types.d.ts.map +1 -1
- package/dist/generated/wspace-types.js +14 -0
- package/dist/generated/wspace-types.js.map +1 -0
- package/package.json +4 -3
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
import { useCoolAndLovely as e } from "../../context/CoolAndLovelyContext.js";
|
|
2
|
+
import "../../context/index.js";
|
|
3
|
+
import { usePriceWatchAction as t, usePriceWatchDeliveries as n, usePriceWatches as r } from "../../hooks/usePriceApi.js";
|
|
4
|
+
import { formatRetailerPrice as i } from "./money.js";
|
|
5
|
+
import { useState as a } from "react";
|
|
6
|
+
import { jsx as o, jsxs as s } from "react/jsx-runtime";
|
|
7
|
+
//#region src/coolandlovely/components/prices/PriceWatches.tsx
|
|
8
|
+
var c = {
|
|
9
|
+
DELIVERED: "Sent",
|
|
10
|
+
PENDING: "Waiting",
|
|
11
|
+
CLAIMED: "Sending",
|
|
12
|
+
FAILED: "Could not send"
|
|
13
|
+
}, l = "rounded-lg border border-border-seam px-3 py-2 text-sm font-medium text-text-primary hover:bg-bg-sunken disabled:opacity-50";
|
|
14
|
+
function u({ alertId: e }) {
|
|
15
|
+
let [t, r] = a(0), i = n(e, t, !0);
|
|
16
|
+
return i.isPending ? /* @__PURE__ */ o("p", {
|
|
17
|
+
role: "status",
|
|
18
|
+
className: "text-sm text-text-secondary",
|
|
19
|
+
children: "Loading delivery receipts…"
|
|
20
|
+
}) : i.isError ? /* @__PURE__ */ s("p", {
|
|
21
|
+
role: "alert",
|
|
22
|
+
className: "text-sm text-status-error-text",
|
|
23
|
+
children: [
|
|
24
|
+
"Receipts could not be loaded.",
|
|
25
|
+
" ",
|
|
26
|
+
/* @__PURE__ */ o("button", {
|
|
27
|
+
type: "button",
|
|
28
|
+
className: l,
|
|
29
|
+
onClick: () => void i.refetch(),
|
|
30
|
+
children: "Retry"
|
|
31
|
+
})
|
|
32
|
+
]
|
|
33
|
+
}) : /* @__PURE__ */ s("div", {
|
|
34
|
+
className: "space-y-2",
|
|
35
|
+
children: [
|
|
36
|
+
/* @__PURE__ */ o("p", {
|
|
37
|
+
className: "text-xs text-text-secondary",
|
|
38
|
+
children: "A delivered receipt confirms platform acceptance. Device display and retries can differ; delivery is at least once."
|
|
39
|
+
}),
|
|
40
|
+
i.data?.items.length ? /* @__PURE__ */ o("ul", {
|
|
41
|
+
className: "space-y-1 text-sm text-text-secondary",
|
|
42
|
+
children: i.data.items.map((e) => /* @__PURE__ */ s("li", { children: [
|
|
43
|
+
c[e.status] ?? "Status unavailable",
|
|
44
|
+
" ·",
|
|
45
|
+
" ",
|
|
46
|
+
new Date(e.createdAt).toLocaleString(),
|
|
47
|
+
e.deliveredAt ? ` · accepted ${new Date(e.deliveredAt).toLocaleString()}` : ""
|
|
48
|
+
] }, e.id))
|
|
49
|
+
}) : /* @__PURE__ */ o("p", {
|
|
50
|
+
className: "text-sm text-text-secondary",
|
|
51
|
+
children: "No transitions recorded yet."
|
|
52
|
+
}),
|
|
53
|
+
/* @__PURE__ */ s("div", {
|
|
54
|
+
className: "flex gap-2",
|
|
55
|
+
children: [/* @__PURE__ */ o("button", {
|
|
56
|
+
type: "button",
|
|
57
|
+
className: l,
|
|
58
|
+
disabled: t === 0,
|
|
59
|
+
onClick: () => r((e) => Math.max(0, e - 20)),
|
|
60
|
+
children: "Previous receipts"
|
|
61
|
+
}), /* @__PURE__ */ o("button", {
|
|
62
|
+
type: "button",
|
|
63
|
+
className: l,
|
|
64
|
+
disabled: !i.data?.pageInfo.hasMore,
|
|
65
|
+
onClick: () => r((e) => e + 20),
|
|
66
|
+
children: "Next receipts"
|
|
67
|
+
})]
|
|
68
|
+
})
|
|
69
|
+
]
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
function d() {
|
|
73
|
+
let [n, c] = a(0), [d, f] = a(null), p = r(n), m = t(), { navigateTo: h } = e();
|
|
74
|
+
return /* @__PURE__ */ s("section", {
|
|
75
|
+
className: "space-y-4 rounded-xl border border-border-seam bg-bg-surface p-4",
|
|
76
|
+
"aria-label": "My price watches",
|
|
77
|
+
children: [
|
|
78
|
+
/* @__PURE__ */ o("h2", {
|
|
79
|
+
className: "text-lg font-semibold text-text-primary",
|
|
80
|
+
children: "My price watches"
|
|
81
|
+
}),
|
|
82
|
+
/* @__PURE__ */ o("p", {
|
|
83
|
+
className: "text-sm text-text-secondary",
|
|
84
|
+
children: "Private watches for pieces you selected. Manage currency and targets from a piece’s retailer comparison. Withdrawn private pieces disable their watches automatically."
|
|
85
|
+
}),
|
|
86
|
+
p.isPending ? /* @__PURE__ */ o("p", {
|
|
87
|
+
role: "status",
|
|
88
|
+
className: "text-sm text-text-secondary",
|
|
89
|
+
children: "Loading watches…"
|
|
90
|
+
}) : p.isError ? /* @__PURE__ */ s("p", {
|
|
91
|
+
role: "alert",
|
|
92
|
+
className: "text-sm text-status-error-text",
|
|
93
|
+
children: [
|
|
94
|
+
"Watches could not be loaded.",
|
|
95
|
+
" ",
|
|
96
|
+
/* @__PURE__ */ o("button", {
|
|
97
|
+
type: "button",
|
|
98
|
+
className: l,
|
|
99
|
+
onClick: () => void p.refetch(),
|
|
100
|
+
children: "Retry"
|
|
101
|
+
})
|
|
102
|
+
]
|
|
103
|
+
}) : p.data?.items.length ? /* @__PURE__ */ o("ul", {
|
|
104
|
+
className: "space-y-3",
|
|
105
|
+
children: p.data.items.map((e) => /* @__PURE__ */ s("li", {
|
|
106
|
+
className: "space-y-3 rounded-lg border border-border-seam p-3",
|
|
107
|
+
children: [/* @__PURE__ */ s("div", {
|
|
108
|
+
className: "flex flex-wrap items-center justify-between gap-3",
|
|
109
|
+
children: [/* @__PURE__ */ s("div", { children: [
|
|
110
|
+
/* @__PURE__ */ o("button", {
|
|
111
|
+
type: "button",
|
|
112
|
+
className: "text-left text-sm font-semibold text-text-primary underline",
|
|
113
|
+
onClick: () => h(`/items/${e.styleItemId}`),
|
|
114
|
+
children: "View watched piece"
|
|
115
|
+
}),
|
|
116
|
+
/* @__PURE__ */ s("p", {
|
|
117
|
+
className: "text-sm text-text-secondary",
|
|
118
|
+
children: [
|
|
119
|
+
e.kind === "PRICE_DROP" ? "Price drop" : "Back in stock",
|
|
120
|
+
" ·",
|
|
121
|
+
" ",
|
|
122
|
+
e.currency,
|
|
123
|
+
e.targetPriceMinor == null ? "" : ` · at or below ${i(e.targetPriceMinor, e.currency)}`,
|
|
124
|
+
" ",
|
|
125
|
+
"· ",
|
|
126
|
+
e.enabled ? "Enabled" : "Disabled"
|
|
127
|
+
]
|
|
128
|
+
}),
|
|
129
|
+
/* @__PURE__ */ o("p", {
|
|
130
|
+
className: "text-xs text-text-secondary",
|
|
131
|
+
children: e.lastEvaluatedAt ? `Last checked ${new Date(e.lastEvaluatedAt).toLocaleString()}` : "Waiting for first check"
|
|
132
|
+
})
|
|
133
|
+
] }), /* @__PURE__ */ s("div", {
|
|
134
|
+
className: "flex flex-wrap gap-2",
|
|
135
|
+
children: [/* @__PURE__ */ o("button", {
|
|
136
|
+
type: "button",
|
|
137
|
+
className: l,
|
|
138
|
+
"aria-expanded": d === e.id,
|
|
139
|
+
onClick: () => f((t) => t === e.id ? null : e.id),
|
|
140
|
+
children: "Delivery receipts"
|
|
141
|
+
}), /* @__PURE__ */ o("button", {
|
|
142
|
+
type: "button",
|
|
143
|
+
className: l,
|
|
144
|
+
disabled: m.isPending,
|
|
145
|
+
onClick: () => m.mutate({
|
|
146
|
+
kind: "remove",
|
|
147
|
+
id: e.id
|
|
148
|
+
}),
|
|
149
|
+
children: "Remove watch"
|
|
150
|
+
})]
|
|
151
|
+
})]
|
|
152
|
+
}), d === e.id && /* @__PURE__ */ o(u, { alertId: e.id }, e.id)]
|
|
153
|
+
}, e.id))
|
|
154
|
+
}) : /* @__PURE__ */ o("p", {
|
|
155
|
+
className: "text-sm text-text-secondary",
|
|
156
|
+
children: "No price watches on this page. Open a piece’s retailer comparison to create one."
|
|
157
|
+
}),
|
|
158
|
+
m.isError && /* @__PURE__ */ o("p", {
|
|
159
|
+
role: "alert",
|
|
160
|
+
className: "text-sm text-status-error-text",
|
|
161
|
+
children: m.error.message
|
|
162
|
+
}),
|
|
163
|
+
/* @__PURE__ */ s("div", {
|
|
164
|
+
className: "flex gap-2",
|
|
165
|
+
children: [/* @__PURE__ */ o("button", {
|
|
166
|
+
type: "button",
|
|
167
|
+
className: l,
|
|
168
|
+
disabled: n === 0 || p.isFetching,
|
|
169
|
+
onClick: () => {
|
|
170
|
+
c((e) => Math.max(0, e - 20)), f(null);
|
|
171
|
+
},
|
|
172
|
+
children: "Previous watches"
|
|
173
|
+
}), /* @__PURE__ */ o("button", {
|
|
174
|
+
type: "button",
|
|
175
|
+
className: l,
|
|
176
|
+
disabled: !p.data?.pageInfo.hasMore || p.isFetching,
|
|
177
|
+
onClick: () => {
|
|
178
|
+
c((e) => e + 20), f(null);
|
|
179
|
+
},
|
|
180
|
+
children: "Next watches"
|
|
181
|
+
})]
|
|
182
|
+
})
|
|
183
|
+
]
|
|
184
|
+
});
|
|
185
|
+
}
|
|
186
|
+
//#endregion
|
|
187
|
+
export { d as PriceWatches };
|
|
188
|
+
|
|
189
|
+
//# sourceMappingURL=PriceWatches.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PriceWatches.js","names":[],"sources":["../../../../src/coolandlovely/components/prices/PriceWatches.tsx"],"sourcesContent":["import { useState } from 'react';\nimport { useCoolAndLovely } from '../../context';\nimport {\n usePriceWatchAction,\n usePriceWatchDeliveries,\n usePriceWatches,\n} from '../../hooks/usePriceApi';\nimport { formatRetailerPrice } from './money';\n\nconst receiptStatusLabels: Record<string, string> = {\n DELIVERED: 'Sent',\n PENDING: 'Waiting',\n CLAIMED: 'Sending',\n FAILED: 'Could not send',\n};\n\nconst buttonClass =\n 'rounded-lg border border-border-seam px-3 py-2 text-sm font-medium text-text-primary hover:bg-bg-sunken disabled:opacity-50';\n\nfunction WatchReceipts({ alertId }: { alertId: string }) {\n const [offset, setOffset] = useState(0);\n const query = usePriceWatchDeliveries(alertId, offset, true);\n if (query.isPending)\n return (\n <p role=\"status\" className=\"text-sm text-text-secondary\">\n Loading delivery receipts…\n </p>\n );\n if (query.isError)\n return (\n <p role=\"alert\" className=\"text-sm text-status-error-text\">\n Receipts could not be loaded.{' '}\n <button type=\"button\" className={buttonClass} onClick={() => void query.refetch()}>\n Retry\n </button>\n </p>\n );\n return (\n <div className=\"space-y-2\">\n <p className=\"text-xs text-text-secondary\">\n A delivered receipt confirms platform acceptance. Device display and retries can differ;\n delivery is at least once.\n </p>\n {query.data?.items.length ? (\n <ul className=\"space-y-1 text-sm text-text-secondary\">\n {query.data.items.map((entry) => (\n <li key={entry.id}>\n {receiptStatusLabels[entry.status] ?? 'Status unavailable'} ·{' '}\n {new Date(entry.createdAt).toLocaleString()}\n {entry.deliveredAt\n ? ` · accepted ${new Date(entry.deliveredAt).toLocaleString()}`\n : ''}\n </li>\n ))}\n </ul>\n ) : (\n <p className=\"text-sm text-text-secondary\">No transitions recorded yet.</p>\n )}\n <div className=\"flex gap-2\">\n <button\n type=\"button\"\n className={buttonClass}\n disabled={offset === 0}\n onClick={() => setOffset((value) => Math.max(0, value - 20))}\n >\n Previous receipts\n </button>\n <button\n type=\"button\"\n className={buttonClass}\n disabled={!query.data?.pageInfo.hasMore}\n onClick={() => setOffset((value) => value + 20)}\n >\n Next receipts\n </button>\n </div>\n </div>\n );\n}\n\n/** Mounted lazily from Style Profile; actor/context changes remount through the scoped Root. */\nexport function PriceWatches() {\n const [offset, setOffset] = useState(0);\n const [receiptId, setReceiptId] = useState<string | null>(null);\n const query = usePriceWatches(offset);\n const action = usePriceWatchAction();\n const { navigateTo } = useCoolAndLovely();\n return (\n <section\n className=\"space-y-4 rounded-xl border border-border-seam bg-bg-surface p-4\"\n aria-label=\"My price watches\"\n >\n <h2 className=\"text-lg font-semibold text-text-primary\">My price watches</h2>\n <p className=\"text-sm text-text-secondary\">\n Private watches for pieces you selected. Manage currency and targets from a piece’s retailer\n comparison. Withdrawn private pieces disable their watches automatically.\n </p>\n {query.isPending ? (\n <p role=\"status\" className=\"text-sm text-text-secondary\">\n Loading watches…\n </p>\n ) : query.isError ? (\n <p role=\"alert\" className=\"text-sm text-status-error-text\">\n Watches could not be loaded.{' '}\n <button type=\"button\" className={buttonClass} onClick={() => void query.refetch()}>\n Retry\n </button>\n </p>\n ) : query.data?.items.length ? (\n <ul className=\"space-y-3\">\n {query.data.items.map((watch) => (\n <li key={watch.id} className=\"space-y-3 rounded-lg border border-border-seam p-3\">\n <div className=\"flex flex-wrap items-center justify-between gap-3\">\n <div>\n <button\n type=\"button\"\n className=\"text-left text-sm font-semibold text-text-primary underline\"\n onClick={() => navigateTo(`/items/${watch.styleItemId}`)}\n >\n View watched piece\n </button>\n <p className=\"text-sm text-text-secondary\">\n {watch.kind === 'PRICE_DROP' ? 'Price drop' : 'Back in stock'} ·{' '}\n {watch.currency}\n {watch.targetPriceMinor != null\n ? ` · at or below ${formatRetailerPrice(watch.targetPriceMinor, watch.currency)}`\n : ''}{' '}\n · {watch.enabled ? 'Enabled' : 'Disabled'}\n </p>\n <p className=\"text-xs text-text-secondary\">\n {watch.lastEvaluatedAt\n ? `Last checked ${new Date(watch.lastEvaluatedAt).toLocaleString()}`\n : 'Waiting for first check'}\n </p>\n </div>\n <div className=\"flex flex-wrap gap-2\">\n <button\n type=\"button\"\n className={buttonClass}\n aria-expanded={receiptId === watch.id}\n onClick={() => setReceiptId((value) => (value === watch.id ? null : watch.id))}\n >\n Delivery receipts\n </button>\n <button\n type=\"button\"\n className={buttonClass}\n disabled={action.isPending}\n onClick={() => action.mutate({ kind: 'remove', id: watch.id })}\n >\n Remove watch\n </button>\n </div>\n </div>\n {receiptId === watch.id && <WatchReceipts key={watch.id} alertId={watch.id} />}\n </li>\n ))}\n </ul>\n ) : (\n <p className=\"text-sm text-text-secondary\">\n No price watches on this page. Open a piece’s retailer comparison to create one.\n </p>\n )}\n {action.isError && (\n <p role=\"alert\" className=\"text-sm text-status-error-text\">\n {action.error.message}\n </p>\n )}\n <div className=\"flex gap-2\">\n <button\n type=\"button\"\n className={buttonClass}\n disabled={offset === 0 || query.isFetching}\n onClick={() => {\n setOffset((value) => Math.max(0, value - 20));\n setReceiptId(null);\n }}\n >\n Previous watches\n </button>\n <button\n type=\"button\"\n className={buttonClass}\n disabled={!query.data?.pageInfo.hasMore || query.isFetching}\n onClick={() => {\n setOffset((value) => value + 20);\n setReceiptId(null);\n }}\n >\n Next watches\n </button>\n </div>\n </section>\n );\n}\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AAA,GACL,kBAAC,OAAD;OAAK,WAAU;iBAAf,CACE,kBAAC,UAAD;QACE,MAAK;QACL,WAAW;QACX,iBAAe,MAAc,EAAM;QACnC,eAAe,GAAc,MAAW,MAAU,EAAM,KAAK,OAAO,EAAM,EAAG;kBAC9E;OAEO,CAAA,GACR,kBAAC,UAAD;QACE,MAAK;QACL,WAAW;QACX,UAAU,EAAO;QACjB,eAAe,EAAO,OAAO;SAAE,MAAM;SAAU,IAAI,EAAM;QAAG,CAAC;kBAC9D;OAEO,CAAA,CACL;QACF;SACJ,MAAc,EAAM,MAAM,kBAAC,GAAD,EAA8B,SAAS,EAAM,GAAK,GAA9B,EAAM,EAAwB,CAC3E;OA5CK,EAAM,EA4CX,CACL;GACC,CAAA,IAEJ,kBAAC,KAAD;IAAG,WAAU;cAA8B;GAExC,CAAA;GAEJ,EAAO,WACN,kBAAC,KAAD;IAAG,MAAK;IAAQ,WAAU;cACvB,EAAO,MAAM;GACb,CAAA;GAEL,kBAAC,OAAD;IAAK,WAAU;cAAf,CACE,kBAAC,UAAD;KACE,MAAK;KACL,WAAW;KACX,UAAU,MAAW,KAAK,EAAM;KAChC,eAAe;MAEb,AADA,GAAW,MAAU,KAAK,IAAI,GAAG,IAAQ,EAAE,CAAC,GAC5C,EAAa,IAAI;KACnB;eACD;IAEO,CAAA,GACR,kBAAC,UAAD;KACE,MAAK;KACL,WAAW;KACX,UAAU,CAAC,EAAM,MAAM,SAAS,WAAW,EAAM;KACjD,eAAe;MAEb,AADA,GAAW,MAAU,IAAQ,EAAE,GAC/B,EAAa,IAAI;KACnB;eACD;IAEO,CAAA,CACL;;EACE;;AAEb"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RetailerOfferLink.d.ts","sourceRoot":"","sources":["../../../../src/coolandlovely/components/prices/RetailerOfferLink.tsx"],"names":[],"mappings":"AAYA,wBAAgB,iBAAiB,CAAC,EAChC,GAAG,EACH,UAAU,EACV,QAAQ,GACT,EAAE;IACD,GAAG,EAAE,MAAM,CAAC;IACZ,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;CAClB,+BAeA"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { formatRetailerPrice as e } from "./money.js";
|
|
2
|
+
import { jsxs as t } from "react/jsx-runtime";
|
|
3
|
+
//#region src/coolandlovely/components/prices/RetailerOfferLink.tsx
|
|
4
|
+
function n(e) {
|
|
5
|
+
try {
|
|
6
|
+
let t = new URL(e);
|
|
7
|
+
return t.protocol === "https:" && !t.username && !t.password ? t.href : null;
|
|
8
|
+
} catch {
|
|
9
|
+
return null;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
function r({ url: r, priceMinor: i, currency: a }) {
|
|
13
|
+
let o = n(r), s = e(i, a);
|
|
14
|
+
return o ? /* @__PURE__ */ t("a", {
|
|
15
|
+
className: "rounded-lg border border-border-seam px-3 py-2 text-sm font-medium text-text-primary hover:bg-bg-sunken",
|
|
16
|
+
href: o,
|
|
17
|
+
target: "_blank",
|
|
18
|
+
rel: "noopener noreferrer",
|
|
19
|
+
children: [s, " · Visit retailer"]
|
|
20
|
+
}) : /* @__PURE__ */ t("span", {
|
|
21
|
+
className: "text-sm text-text-secondary",
|
|
22
|
+
children: [s, " · Retailer link unavailable"]
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
//#endregion
|
|
26
|
+
export { r as RetailerOfferLink };
|
|
27
|
+
|
|
28
|
+
//# sourceMappingURL=RetailerOfferLink.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RetailerOfferLink.js","names":[],"sources":["../../../../src/coolandlovely/components/prices/RetailerOfferLink.tsx"],"sourcesContent":["import { formatRetailerPrice } from './money';\n\n/** The backend validates source URLs; the rendered link independently refuses active schemes. */\nfunction safeHref(value: string): string | null {\n try {\n const url = new URL(value);\n return url.protocol === 'https:' && !url.username && !url.password ? url.href : null;\n } catch {\n return null;\n }\n}\n\nexport function RetailerOfferLink({\n url,\n priceMinor,\n currency,\n}: {\n url: string;\n priceMinor: number;\n currency: string;\n}) {\n const href = safeHref(url);\n const price = formatRetailerPrice(priceMinor, currency);\n if (!href)\n return <span className=\"text-sm text-text-secondary\">{price} · Retailer link unavailable</span>;\n return (\n <a\n className=\"rounded-lg border border-border-seam px-3 py-2 text-sm font-medium text-text-primary hover:bg-bg-sunken\"\n href={href}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n >\n {price} · Visit retailer\n </a>\n );\n}\n"],"mappings":";;;AAGA,SAAS,EAAS,GAA8B;CAC9C,IAAI;EACF,IAAM,IAAM,IAAI,IAAI,CAAK;EACzB,OAAO,EAAI,aAAa,YAAY,CAAC,EAAI,YAAY,CAAC,EAAI,WAAW,EAAI,OAAO;CAClF,QAAQ;EACN,OAAO;CACT;AACF;AAEA,SAAgB,EAAkB,EAChC,QACA,eACA,eAKC;CACD,IAAM,IAAO,EAAS,CAAG,GACnB,IAAQ,EAAoB,GAAY,CAAQ;CAGtD,OAFK,IAGH,kBAAC,KAAD;EACE,WAAU;EACJ;EACN,QAAO;EACP,KAAI;YAJN,CAMG,GAAM,mBACN;MATI,kBAAC,QAAD;EAAM,WAAU;YAAhB,CAA+C,GAAM,8BAAkC;;AAWlG"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/** Retailer evidence uses integer minor units; never assume every currency has two decimals. */
|
|
2
|
+
export declare function formatRetailerPrice(minor: number, currency: string, locale?: string): string;
|
|
3
|
+
/** A localized, ungrouped example that matches the decimal keypad's expected separator. */
|
|
4
|
+
export declare function retailerTargetExample(currency: string, locale?: string): string;
|
|
5
|
+
export declare function retailerTargetMinor(value: string, currency: string, locale?: string): number;
|
|
6
|
+
//# sourceMappingURL=money.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"money.d.ts","sourceRoot":"","sources":["../../../../src/coolandlovely/components/prices/money.ts"],"names":[],"mappings":"AAeA,gGAAgG;AAChG,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,CAI5F;AAED,2FAA2F;AAC3F,wBAAgB,qBAAqB,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,CAM/E;AAED,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,CAkC5F"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
//#region src/coolandlovely/components/prices/money.ts
|
|
2
|
+
var e = /* @__PURE__ */ new Map();
|
|
3
|
+
function t(t, n) {
|
|
4
|
+
let r = `${n ?? "browser"}:${t}`, i = e.get(r);
|
|
5
|
+
if (i) return i;
|
|
6
|
+
let a = new Intl.NumberFormat(n, {
|
|
7
|
+
style: "currency",
|
|
8
|
+
currency: t
|
|
9
|
+
});
|
|
10
|
+
if (e.size >= 16) {
|
|
11
|
+
let t = e.keys().next().value;
|
|
12
|
+
t !== void 0 && e.delete(t);
|
|
13
|
+
}
|
|
14
|
+
return e.set(r, a), a;
|
|
15
|
+
}
|
|
16
|
+
function n(e, n, r) {
|
|
17
|
+
let i = t(n, r), a = i.resolvedOptions().maximumFractionDigits ?? 2;
|
|
18
|
+
return i.format(e / 10 ** a);
|
|
19
|
+
}
|
|
20
|
+
function r(e, n) {
|
|
21
|
+
return t(e, n).formatToParts(12.34).filter((e) => [
|
|
22
|
+
"integer",
|
|
23
|
+
"decimal",
|
|
24
|
+
"fraction"
|
|
25
|
+
].includes(e.type)).map((e) => e.value).join("");
|
|
26
|
+
}
|
|
27
|
+
function i(e, n, i) {
|
|
28
|
+
let a = t(n, i), o = a.resolvedOptions().maximumFractionDigits ?? 2, s = /* @__PURE__ */ new Map();
|
|
29
|
+
for (let e = 0; e < 10; e++) {
|
|
30
|
+
let t = a.formatToParts(e).filter((e) => e.type === "integer").map((e) => e.value).join("");
|
|
31
|
+
s.set(t, String(e));
|
|
32
|
+
}
|
|
33
|
+
let c = Array.from(e.trim()).map((e) => s.get(e) ?? e).join(""), l = a.formatToParts(1.1).find((e) => e.type === "decimal")?.value ?? ".", u = c.split(l);
|
|
34
|
+
if (u.length > 2 || !/^\d+$/.test(u[0] ?? "") || u.length === 2 && (o === 0 || !/^\d+$/.test(u[1] ?? "") || (u[1]?.length ?? 0) > o)) throw Error(`Use an ungrouped positive amount such as ${r(n, i)}.`);
|
|
35
|
+
let [d = "0", f = ""] = u, p = Number(d) * 10 ** o + Number(f.padEnd(o, "0"));
|
|
36
|
+
if (!Number.isSafeInteger(p) || p < 1 || p > 2147483647) throw Error("Enter a positive amount within the supported price range.");
|
|
37
|
+
return p;
|
|
38
|
+
}
|
|
39
|
+
//#endregion
|
|
40
|
+
export { n as formatRetailerPrice, r as retailerTargetExample, i as retailerTargetMinor };
|
|
41
|
+
|
|
42
|
+
//# sourceMappingURL=money.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"money.js","names":[],"sources":["../../../../src/coolandlovely/components/prices/money.ts"],"sourcesContent":["// Cache bounded formatting rules only; no price, actor or workspace data is retained.\nconst currencyFormatters = new Map<string, Intl.NumberFormat>();\nfunction currencyFormatter(currency: string, locale?: string): Intl.NumberFormat {\n const key = `${locale ?? 'browser'}:${currency}`;\n const prior = currencyFormatters.get(key);\n if (prior) return prior;\n const formatter = new Intl.NumberFormat(locale, { style: 'currency', currency });\n if (currencyFormatters.size >= 16) {\n const oldest = currencyFormatters.keys().next().value;\n if (oldest !== undefined) currencyFormatters.delete(oldest);\n }\n currencyFormatters.set(key, formatter);\n return formatter;\n}\n\n/** Retailer evidence uses integer minor units; never assume every currency has two decimals. */\nexport function formatRetailerPrice(minor: number, currency: string, locale?: string): string {\n const formatter = currencyFormatter(currency, locale);\n const digits = formatter.resolvedOptions().maximumFractionDigits ?? 2;\n return formatter.format(minor / 10 ** digits);\n}\n\n/** A localized, ungrouped example that matches the decimal keypad's expected separator. */\nexport function retailerTargetExample(currency: string, locale?: string): string {\n return currencyFormatter(currency, locale)\n .formatToParts(12.34)\n .filter((part) => ['integer', 'decimal', 'fraction'].includes(part.type))\n .map((part) => part.value)\n .join('');\n}\n\nexport function retailerTargetMinor(value: string, currency: string, locale?: string): number {\n const formatter = currencyFormatter(currency, locale);\n const digits = formatter.resolvedOptions().maximumFractionDigits ?? 2;\n const digitMap = new Map<string, string>();\n for (let digit = 0; digit < 10; digit++) {\n const localized = formatter\n .formatToParts(digit)\n .filter((part) => part.type === 'integer')\n .map((part) => part.value)\n .join('');\n digitMap.set(localized, String(digit));\n }\n const normalized = Array.from(value.trim())\n .map((character) => digitMap.get(character) ?? character)\n .join('');\n const separator =\n formatter.formatToParts(1.1).find((part) => part.type === 'decimal')?.value ?? '.';\n const parts = normalized.split(separator);\n // Grouping is intentionally refused: accepting both comma and dot can silently change amounts.\n if (\n parts.length > 2 ||\n !/^\\d+$/.test(parts[0] ?? '') ||\n (parts.length === 2 &&\n (digits === 0 || !/^\\d+$/.test(parts[1] ?? '') || (parts[1]?.length ?? 0) > digits))\n ) {\n throw new Error(\n `Use an ungrouped positive amount such as ${retailerTargetExample(currency, locale)}.`\n );\n }\n const [whole = '0', fraction = ''] = parts;\n const minor = Number(whole) * 10 ** digits + Number(fraction.padEnd(digits, '0'));\n if (!Number.isSafeInteger(minor) || minor < 1 || minor > 2147483647)\n throw new Error('Enter a positive amount within the supported price range.');\n return minor;\n}\n"],"mappings":";AACA,IAAM,oBAAqB,IAAI,IAA+B;AAC9D,SAAS,EAAkB,GAAkB,GAAoC;CAC/E,IAAM,IAAM,GAAG,KAAU,UAAU,GAAG,KAChC,IAAQ,EAAmB,IAAI,CAAG;CACxC,IAAI,GAAO,OAAO;CAClB,IAAM,IAAY,IAAI,KAAK,aAAa,GAAQ;EAAE,OAAO;EAAY;CAAS,CAAC;CAC/E,IAAI,EAAmB,QA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AAS;CAExC,IACE,EAAM,SAAS,KACf,CAAC,QAAQ,KAAK,EAAM,MAAM,EAAE,KAC3B,EAAM,WAAW,MACf,MAAW,KAAK,CAAC,QAAQ,KAAK,EAAM,MAAM,EAAE,MAAM,EAAM,EAAE,EAAE,UAAU,KAAK,IAE9E,MAAU,MACR,4CAA4C,EAAsB,GAAU,CAAM,EAAE,EACtF;CAEF,IAAM,CAAC,IAAQ,KAAK,IAAW,MAAM,GAC/B,IAAQ,OAAO,CAAK,IAAI,MAAM,IAAS,OAAO,EAAS,OAAO,GAAQ,GAAG,CAAC;CAChF,IAAI,CAAC,OAAO,cAAc,CAAK,KAAK,IAAQ,KAAK,IAAQ,YACvD,MAAU,MAAM,2DAA2D;CAC7E,OAAO;AACT"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useContextNavigation.d.ts","sourceRoot":"","sources":["../../../src/coolandlovely/hooks/useContextNavigation.ts"],"names":[],"mappings":"AAIA,wFAAwF;AACxF,wBAAgB,oBAAoB,WAKzB,MAAM,8BAehB"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { useCoolAndLovely as e } from "../context/CoolAndLovelyContext.js";
|
|
2
|
+
import "../context/index.js";
|
|
3
|
+
import { useCallback as t } from "react";
|
|
4
|
+
import { useLocation as n, useNavigate as r } from "react-router";
|
|
5
|
+
//#region src/coolandlovely/hooks/useContextNavigation.ts
|
|
6
|
+
function i() {
|
|
7
|
+
let { navigateTo: i, navigate: a } = e(), o = r(), { search: s } = n();
|
|
8
|
+
return t((e, t = !1) => {
|
|
9
|
+
let n = new URLSearchParams(s), [r, c] = e.split("#", 2), [l, u] = (r ?? "").split("?", 2), d = new URLSearchParams(u);
|
|
10
|
+
for (let e of [
|
|
11
|
+
"org",
|
|
12
|
+
"workspace",
|
|
13
|
+
"project",
|
|
14
|
+
"tenant"
|
|
15
|
+
]) {
|
|
16
|
+
let t = n.get(e);
|
|
17
|
+
t && d.set(e, t);
|
|
18
|
+
}
|
|
19
|
+
let f = `${l}${d.size ? `?${d}` : ""}${c === void 0 ? "" : `#${c}`}`;
|
|
20
|
+
t ? (a ?? o)(f) : i(f);
|
|
21
|
+
}, [
|
|
22
|
+
i,
|
|
23
|
+
a,
|
|
24
|
+
o,
|
|
25
|
+
s
|
|
26
|
+
]);
|
|
27
|
+
}
|
|
28
|
+
//#endregion
|
|
29
|
+
export { i as useContextNavigation };
|
|
30
|
+
|
|
31
|
+
//# sourceMappingURL=useContextNavigation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useContextNavigation.js","names":[],"sources":["../../../src/coolandlovely/hooks/useContextNavigation.ts"],"sourcesContent":["import { useCallback } from 'react';\nimport { useLocation, useNavigate } from 'react-router';\nimport { useCoolAndLovely } from '../context';\n\n/** Preserve the host's selected context when entering or leaving a marketplace flow. */\nexport function useContextNavigation() {\n const { navigateTo, navigate } = useCoolAndLovely();\n const routerNavigate = useNavigate();\n const { search } = useLocation();\n return useCallback(\n (path: string, absolute = false) => {\n const source = new URLSearchParams(search);\n const [beforeHash, fragment] = path.split('#', 2);\n const [pathname, existingQuery] = (beforeHash ?? '').split('?', 2);\n const context = new URLSearchParams(existingQuery);\n for (const key of ['org', 'workspace', 'project', 'tenant']) {\n const value = source.get(key);\n if (value) context.set(key, value);\n }\n const target = `${pathname}${context.size ? `?${context}` : ''}${fragment === undefined ? '' : `#${fragment}`}`;\n if (absolute) (navigate ?? routerNavigate)(target);\n else navigateTo(target);\n },\n [navigateTo, navigate, routerNavigate, search]\n );\n}\n"],"mappings":";;;;;AAKA,SAAgB,IAAuB;CACrC,IAAM,EAAE,eAAY,gBAAa,EAAiB,GAC5C,IAAiB,EAAY,GAC7B,EAAE,cAAW,EAAY;CAC/B,OAAO,GACJ,GAAc,IAAW,OAAU;EAClC,IAAM,IAAS,IAAI,gBAAgB,CAAM,GACnC,CAAC,GAAY,KAAY,EAAK,MAAM,KAAK,CAAC,GAC1C,CAAC,GAAU,MAAk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E,OAAO,CAAC,EAClC,UAAU,MAAM,EAChB,SAAS,WAAW,KACnB,OAAO,CAAC,KAAK,CAyBf,CAAC;
|
|
1
|
+
{"version":3,"file":"useCoolAndLovelyApi.d.ts","sourceRoot":"","sources":["../../../src/coolandlovely/hooks/useCoolAndLovelyApi.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAWH,OAAO,KAAK,EACV,wBAAwB,EACxB,QAAQ,EACR,kBAAkB,EAClB,cAAc,EACd,gBAAgB,EAEhB,sBAAsB,EACtB,aAAa,EAEb,mBAAmB,EACnB,mBAAmB,EACnB,2BAA2B,EAC3B,wBAAwB,EACxB,kBAAkB,EAClB,sBAAsB,EACtB,uBAAuB,EACvB,0BAA0B,EAC1B,OAAO,EACP,iBAAiB,EAEjB,eAAe,EACf,WAAW,EAEX,gBAAgB,EAChB,YAAY,EACZ,sBAAsB,EACtB,kBAAkB,EAClB,eAAe,EAEf,mBAAmB,EACnB,2BAA2B,EAC3B,wBAAwB,EACxB,kBAAkB,EAClB,uBAAuB,EACvB,0BAA0B,EAC1B,0BAA0B,EAC1B,eAAe,EAEf,iBAAiB,EACjB,eAAe,EACf,wBAAwB,EACxB,mBAAmB,EACnB,2BAA2B,EAC5B,MAAM,UAAU,CAAC;AAYlB,eAAO,MAAM,SAAS,GAAU,KAAK,EACnC,OAAO,MAAM,EACb,WAAW,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAClC,UAAU,MAAM,EAChB,SAAS,WAAW,KACnB,OAAO,CAAC,KAAK,CAyBf,CAAC;AA4CF,iFAAiF;AACjF,eAAO,MAAM,2BAA2B,4KAGvC,CAAC;AAuBF,MAAM,WAAW,cAAc;IAC7B,MAAM,CAAC,EAAE,cAAc,CAAC;IACxB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,UAAU,CAAC,EAAE,eAAe,CAAC;CAC9B;AAED,eAAO,MAAM,SAAS,GAAI,OAAM,cAAmB,8EAsBlD,CAAC;AAQF,eAAO,MAAM,Q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iB,0FAiB7B,CAAC;AAMF,MAAM,WAAW,oBAAoB;IACnC,KAAK,EAAE,wBAAwB,CAAC;IAChC,UAAU,CAAC,EAAE,eAAe,CAAC;IAC7B;;;;OAIG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,eAAO,MAAM,mBAAmB,GAAI,sBAA6B,oBAAoB,kFAsBpF,CAAC;AAEF,MAAM,WAAW,eAAe;IAC9B,KAAK,EAAE,mBAAmB,CAAC;IAC3B,UAAU,CAAC,EAAE,eAAe,CAAC;IAC7B;;;;OAIG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,eAAO,MAAM,cAAc,GAAI,sBAA6B,eAAe,6EAsB1E,CAAC;AAMF,eAAO,MAAM,eAAe,2FAiB3B,CAAC;AAEF,eAAO,MAAM,cAAc,2FAiB1B,CAAC;AAEF,eAAO,MAAM,sBAAsB;QAIS,MAAM;WAAS,2BAA2B;WAerF,CAAC;AAEF,eAAO,MAAM,mBAAmB,+FAiB/B,CAAC;AAEF,eAAO,MAAM,qBAAqB,+FAiBjC,CAAC"}
|
|
@@ -16,7 +16,7 @@ var o = "coolandlovely", s = async (e, t, n, r) => {
|
|
|
16
16
|
if (o.errors?.length) throw Error(o.errors[0]?.message ?? "GraphQL request failed");
|
|
17
17
|
if (!o.data) throw Error("GraphQL response did not include data");
|
|
18
18
|
return /^\s*mutation\b/.test(e) && a(), o.data;
|
|
19
|
-
}, c = "\n id workspaceId name handle tagline bio aesthetics tags websiteUrl\n isFeatured status logo { id } cover { id } createdAt updatedAt\n", l = "\n id workspaceId brandId name description season status tags\n cover { id } publishAt endAt createdAt updatedAt\n", u = "\n id workspaceId brandId collectionId name description category status\n sku price currency colours sizes materials tags image { id }\n createdAt updatedAt\n", d = "\n storeProductId storeListingStatus storeSyncStatus storeSyncedAt\n", f = "\n id workspaceId authorId title caption occasion visibility isFeatured\n likeCount saveCount collaborationId image { id } tags publishedAt\n createdAt updatedAt isLikedByMe isSavedByMe\n", p = "\n id workspaceId lookId styleItemId position styling createdAt updatedAt\n styleItem { id name category price currency brand { id name handle } image { id } }\n", m = "\n id workspaceId brandId creatorId collectionId title brief role status\n compensation currency tags startDate endDate publishedAt createdAt updatedAt\n", h = "\n id collaborationId collaborationTitle brandId creatorId amount currency status paymentProvider\n paidAt earningAvailableAt earningSyncStatus createdAt updatedAt\n", g = "\n id workspaceId profileId name category source brandName colour size notes\n styleItemId purchasePrice currency costPerWear timesWorn lastWornAt tags\n image { id } createdAt updatedAt\n", _ = "\n id workspaceId ownerId displayName bio visibility stylePreferences\n palette favouriteBrands sizes createdAt updatedAt\n isFollowedByMe followerCount followingCount\n", v = "\n id workspaceId ownerId profileId name description visibility tags\n cover { id } createdAt updatedAt\n", ee = (t = {}) => {
|
|
19
|
+
}, c = "\n id workspaceId name handle tagline bio aesthetics tags websiteUrl\n isFeatured status logo { id } cover { id } createdAt updatedAt\n", l = "\n id workspaceId brandId name description season status tags\n cover { id } publishAt endAt createdAt updatedAt\n", u = "\n id workspaceId brandId collectionId name description category status\n sku price currency colours sizes materials tags image { id }\n createdAt updatedAt\n", d = "\n storeProductId storeListingStatus storeSyncStatus storeSyncedAt\n", f = "\n id workspaceId authorId title caption occasion visibility isFeatured\n likeCount saveCount collaborationId image { id } tags publishedAt\n createdAt updatedAt isLikedByMe isSavedByMe\n", p = "\n id workspaceId lookId styleItemId position styling createdAt updatedAt\n styleItem { id name category price currency brand { id name handle } image { id } }\n", m = "\n id workspaceId brandId creatorId collectionId title brief role status\n compensation currency tags startDate endDate publishedAt createdAt updatedAt\n rateCardId rateCardRevision rateCardTitle quotedDeliverables quotedDeliveryDays\n", h = "\n id collaborationId collaborationTitle brandId creatorId amount currency status paymentProvider\n paidAt earningAvailableAt earningSyncStatus createdAt updatedAt\n", g = "\n id workspaceId profileId name category source brandName colour size notes\n styleItemId purchasePrice currency costPerWear timesWorn lastWornAt tags\n image { id } createdAt updatedAt\n", _ = "\n id workspaceId ownerId displayName bio visibility stylePreferences\n palette favouriteBrands sizes createdAt updatedAt\n isFollowedByMe followerCount followingCount\n", v = "\n id workspaceId ownerId profileId name description visibility tags\n cover { id } createdAt updatedAt\n", ee = (t = {}) => {
|
|
20
20
|
let { apiGatewayUrl: r } = e();
|
|
21
21
|
return n({
|
|
22
22
|
queryKey: [
|