@burdenoff/microfe-coolandlovely 2026.1123.2 → 2026.1124.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.
Files changed (21) hide show
  1. package/dist/coolandlovely/CoolAndLovelyRoutes.js +29 -25
  2. package/dist/coolandlovely/components/intelligence/BrandCreatorMatchPanel.d.ts +6 -0
  3. package/dist/coolandlovely/components/intelligence/BrandCreatorMatchPanel.js +147 -0
  4. package/dist/coolandlovely/components/intelligence/CollectionCurationCallout.d.ts +8 -0
  5. package/dist/coolandlovely/components/intelligence/CollectionCurationCallout.js +109 -0
  6. package/dist/coolandlovely/components/intelligence/ProvenanceChip.d.ts +8 -0
  7. package/dist/coolandlovely/components/intelligence/ProvenanceChip.js +36 -0
  8. package/dist/coolandlovely/components/intelligence/WardrobeIntelligenceStrip.d.ts +2 -0
  9. package/dist/coolandlovely/components/intelligence/WardrobeIntelligenceStrip.js +123 -0
  10. package/dist/coolandlovely/hooks/index.d.ts +1 -0
  11. package/dist/coolandlovely/hooks/index.js +1 -0
  12. package/dist/coolandlovely/hooks/useStyleIntelligenceApi.d.ts +24 -0
  13. package/dist/coolandlovely/hooks/useStyleIntelligenceApi.js +266 -0
  14. package/dist/coolandlovely/pages/brands/BrandDetailPage.js +157 -155
  15. package/dist/coolandlovely/pages/collections/CollectionDetailPage.js +110 -105
  16. package/dist/coolandlovely/pages/intelligence/StyleIntelligencePage.d.ts +15 -0
  17. package/dist/coolandlovely/pages/intelligence/StyleIntelligencePage.js +1007 -0
  18. package/dist/coolandlovely/pages/wardrobe/WardrobeListPage.js +71 -69
  19. package/dist/coolandlovely/types/index.d.ts +1 -0
  20. package/dist/coolandlovely/types/intelligence.d.ts +128 -0
  21. package/package.json +1 -1
@@ -0,0 +1,24 @@
1
+ import { CooActivityEntry } from './useActivity';
2
+ import { CooAiCreditStatus, CooCollaborationMatchResult, CooCollectionCuration, CooDecisionProvenance, CooOutfitSuggestion, CooPublishBlockerCode, CooSeason, CooSuggestOutfitInput, CooWardrobeFindingKind, CooWardrobeGapAnalysis } from '../types';
3
+ export declare function isRewearFinding(kind: CooWardrobeFindingKind): boolean;
4
+ export declare function formatFindingKindLabel(kind: CooWardrobeFindingKind): string;
5
+ export declare function formatBlockerLabel(code: CooPublishBlockerCode): string;
6
+ export declare function formatProvenanceLabel(provenance: CooDecisionProvenance): string;
7
+ /**
8
+ * Extract unique catalog `styleItemId`s referenced by an outfit suggestion
9
+ * (from wardrobe pieces linked to catalog items + suggested catalog gap pieces).
10
+ */
11
+ export declare function extractLookStyleItemIds(suggestion: CooOutfitSuggestion): string[];
12
+ export declare function isQuotaExhaustedError(error: unknown): boolean;
13
+ export declare function useAiCreditStatus(): import('@tanstack/react-query').UseQueryResult<CooAiCreditStatus | null, Error>;
14
+ export declare function useDecisionActivity(limit?: number): import('@tanstack/react-query').UseQueryResult<CooActivityEntry[], Error>;
15
+ export declare function useSuggestOutfit(): import('@tanstack/react-query').UseMutationResult<CooOutfitSuggestion, Error, CooSuggestOutfitInput, unknown>;
16
+ export declare function useAnalyzeWardrobeGaps(): import('@tanstack/react-query').UseMutationResult<CooWardrobeGapAnalysis, Error, void, unknown>;
17
+ export declare function useCurateCollection(): import('@tanstack/react-query').UseMutationResult<CooCollectionCuration, Error, {
18
+ brandId: string;
19
+ season: CooSeason;
20
+ }, unknown>;
21
+ export declare function useSuggestCollaborationMatch(): import('@tanstack/react-query').UseMutationResult<CooCollaborationMatchResult, Error, {
22
+ brandId: string;
23
+ limit?: number;
24
+ }, unknown>;
@@ -0,0 +1,266 @@
1
+ import { useCoolAndLovely as e } from "../context/CoolAndLovelyContext.js";
2
+ import "../context/index.js";
3
+ import { coolQuery as t } from "./useCoolAndLovelyApi.js";
4
+ import { useMutation as n, useQuery as r, useQueryClient as i } from "@tanstack/react-query";
5
+ import { graphqlFetch as a } from "@burdenoff/fe-libs/shared/graphql";
6
+ import { clearGraphqlFetchResponseCache as o } from "@burdenoff/fe-libs/shared/graphql/fetch";
7
+ // src/coolandlovely/hooks/useStyleIntelligenceApi.ts
8
+ var s = "coolandlovely-intelligence", c = "\n decisionId decision engine modelBacked generatedAt candidateCount\n", l = "\n code message evidenceIds\n", u = `
9
+ mutation CooSuggestOutfit($input: CooSuggestOutfitInput!) {
10
+ cooSuggestOutfit(input: $input) {
11
+ provenance { ${c} }
12
+ occasion
13
+ weatherHint
14
+ date
15
+ draftTitle
16
+ pieces {
17
+ slot
18
+ wardrobeItemId
19
+ score
20
+ reasons { ${l} }
21
+ wardrobeItem {
22
+ id name category colour brandName styleItemId image { id }
23
+ }
24
+ }
25
+ gapPieces {
26
+ slot
27
+ styleItemId
28
+ score
29
+ reasons { ${l} }
30
+ styleItem {
31
+ id name category price currency colours status image { id }
32
+ }
33
+ }
34
+ missingSlots
35
+ excludedForSizeIds
36
+ supportingLookIds
37
+ confidence
38
+ summary
39
+ }
40
+ }
41
+ `, d = `
42
+ mutation CooAnalyzeWardrobeGaps {
43
+ cooAnalyzeWardrobeGaps {
44
+ provenance { ${c} }
45
+ wardrobeItemCount
46
+ findings {
47
+ kind
48
+ severity
49
+ title
50
+ detail
51
+ occasion
52
+ category
53
+ colour
54
+ missingSlots
55
+ wardrobeItemIds
56
+ suggestedStyleItemIds
57
+ }
58
+ }
59
+ }
60
+ `, f = `
61
+ mutation CooCurateCollection($brandId: ID!, $season: CooSeason!) {
62
+ cooCurateCollection(brandId: $brandId, season: $season) {
63
+ provenance { ${c} }
64
+ brandId
65
+ season
66
+ storyPalette
67
+ storyMaterials
68
+ blockedCount
69
+ proposed {
70
+ styleItemId
71
+ position
72
+ coherence
73
+ suggestedSeason
74
+ blockers { code message }
75
+ reasons { ${l} }
76
+ styleItem {
77
+ id name category status price currency colours image { id }
78
+ }
79
+ }
80
+ outliers {
81
+ styleItemId
82
+ position
83
+ coherence
84
+ suggestedSeason
85
+ blockers { code message }
86
+ reasons { ${l} }
87
+ styleItem {
88
+ id name category status price currency colours image { id }
89
+ }
90
+ }
91
+ }
92
+ }
93
+ `, p = `
94
+ mutation CooSuggestCollaborationMatch($brandId: ID!, $limit: Int) {
95
+ cooSuggestCollaborationMatch(brandId: $brandId, limit: $limit) {
96
+ provenance { ${c} }
97
+ brandId
98
+ brandStyleItemIds
99
+ excludedCreatorIds
100
+ matches {
101
+ creatorId
102
+ fitScore
103
+ sharedColours
104
+ sharedMaterials
105
+ sharedCategories
106
+ evidenceLookIds
107
+ featuredBrandItemIds
108
+ reasons { ${l} }
109
+ draft {
110
+ title
111
+ brief
112
+ status
113
+ role
114
+ brandId
115
+ creatorId
116
+ }
117
+ }
118
+ }
119
+ }
120
+ `, m = "\n query CooAiCreditStatus($productKey: String!) {\n aiCreditStatus(productKey: $productKey) {\n productKey\n quotaName\n provisioned\n noLimit\n used\n limit\n remaining\n exhausted\n }\n }\n", h = "\n query CooDecisionActivities($filter: ActivityLogFilter) {\n getActivities(filter: $filter) {\n id\n action\n description\n resourceType\n resourceId\n userId\n timestamp\n }\n }\n", g = /* @__PURE__ */ new Set([
121
+ "DORMANT_PIECE",
122
+ "NEVER_WORN",
123
+ "COST_PER_WEAR_OUTLIER"
124
+ ]);
125
+ function _(e) {
126
+ return g.has(e);
127
+ }
128
+ function v(e) {
129
+ switch (e) {
130
+ case "OCCASION_GAP": return "Occasion gap";
131
+ case "CATEGORY_GAP": return "Category gap";
132
+ case "PALETTE_GAP": return "Palette gap";
133
+ case "DORMANT_PIECE": return "Re-wear nudge";
134
+ case "NEVER_WORN": return "Never worn";
135
+ case "COST_PER_WEAR_OUTLIER": return "High cost per wear";
136
+ }
137
+ }
138
+ function y(e) {
139
+ switch (e) {
140
+ case "MISSING_PRIMARY_IMAGE": return "Missing primary image";
141
+ case "NO_COLOURWAYS": return "No colourways";
142
+ case "NO_MATERIALS": return "No materials";
143
+ case "NO_SKU": return "Missing SKU";
144
+ case "NO_SIZES": return "No sizes";
145
+ case "ZERO_PRICE": return "Zero price";
146
+ case "PRICE_OUTLIER": return "Price outlier";
147
+ }
148
+ }
149
+ function b(e) {
150
+ return `${e.modelBacked ? "Model-backed" : "Deterministic rules"} · ${e.engine}`;
151
+ }
152
+ function x(e) {
153
+ let t = /* @__PURE__ */ new Set();
154
+ for (let n of e.pieces) n.wardrobeItem.styleItemId && t.add(n.wardrobeItem.styleItemId);
155
+ for (let n of e.gapPieces) n.styleItemId && t.add(n.styleItemId);
156
+ return [...t];
157
+ }
158
+ function S(e) {
159
+ return e instanceof Error && /quota_exhausted|quota exceeded|credit limit|429/i.test(e.message);
160
+ }
161
+ function C() {
162
+ let { apiGatewayUrl: t, workspaceId: n } = e();
163
+ return r({
164
+ queryKey: [
165
+ s,
166
+ "ai-credit-status",
167
+ n
168
+ ],
169
+ enabled: !!n,
170
+ retry: !1,
171
+ queryFn: async () => {
172
+ let e = await a({
173
+ gateway: "workspace",
174
+ baseUrl: t,
175
+ query: m,
176
+ variables: { productKey: "coolandlovely" },
177
+ workspaceToken: !0
178
+ });
179
+ return e.errors?.length || !e.data ? null : e.data.aiCreditStatus;
180
+ }
181
+ });
182
+ }
183
+ function w(t = 20) {
184
+ let { apiGatewayUrl: n, workspaceId: i } = e();
185
+ return r({
186
+ queryKey: [
187
+ s,
188
+ "decision-activity",
189
+ i,
190
+ t
191
+ ],
192
+ enabled: !!i,
193
+ retry: !1,
194
+ queryFn: async () => {
195
+ let e = await a({
196
+ gateway: "workspace",
197
+ baseUrl: n,
198
+ query: h,
199
+ variables: { filter: {
200
+ workspaceId: i,
201
+ resourceType: "coolandlovely-ai-decision",
202
+ productId: "coolandlovely",
203
+ limit: t
204
+ } },
205
+ workspaceToken: !0
206
+ });
207
+ if (e.errors?.length) throw Error(e.errors[0]?.message ?? "Could not load AI decision activity");
208
+ return [...e.data?.getActivities ?? []].sort((e, t) => new Date(t.timestamp).getTime() - new Date(e.timestamp).getTime());
209
+ }
210
+ });
211
+ }
212
+ function T() {
213
+ let r = i(), { apiGatewayUrl: a } = e();
214
+ return n({
215
+ mutationFn: async (e) => {
216
+ let n = await t(u, { input: e }, a);
217
+ return o(), n.cooSuggestOutfit;
218
+ },
219
+ onSuccess: () => {
220
+ r.invalidateQueries({ queryKey: [s, "decision-activity"] }), r.invalidateQueries({ queryKey: [s, "ai-credit-status"] });
221
+ }
222
+ });
223
+ }
224
+ function E() {
225
+ let r = i(), { apiGatewayUrl: a } = e();
226
+ return n({
227
+ mutationFn: async () => {
228
+ let e = await t(d, {}, a);
229
+ return o(), e.cooAnalyzeWardrobeGaps;
230
+ },
231
+ onSuccess: () => {
232
+ r.invalidateQueries({ queryKey: [s, "decision-activity"] }), r.invalidateQueries({ queryKey: [s, "ai-credit-status"] });
233
+ }
234
+ });
235
+ }
236
+ function D() {
237
+ let r = i(), { apiGatewayUrl: a } = e();
238
+ return n({
239
+ mutationFn: async ({ brandId: e, season: n }) => {
240
+ let r = await t(f, {
241
+ brandId: e,
242
+ season: n
243
+ }, a);
244
+ return o(), r.cooCurateCollection;
245
+ },
246
+ onSuccess: () => {
247
+ r.invalidateQueries({ queryKey: [s, "decision-activity"] }), r.invalidateQueries({ queryKey: [s, "ai-credit-status"] });
248
+ }
249
+ });
250
+ }
251
+ function O() {
252
+ let r = i(), { apiGatewayUrl: a } = e();
253
+ return n({
254
+ mutationFn: async ({ brandId: e, limit: n = 5 }) => {
255
+ let r = await t(p, {
256
+ brandId: e,
257
+ limit: n
258
+ }, a);
259
+ return o(), r.cooSuggestCollaborationMatch;
260
+ },
261
+ onSuccess: () => {
262
+ r.invalidateQueries({ queryKey: [s, "decision-activity"] }), r.invalidateQueries({ queryKey: [s, "ai-credit-status"] });
263
+ }
264
+ });
265
+ }
266
+ export { x as extractLookStyleItemIds, y as formatBlockerLabel, v as formatFindingKindLabel, b as formatProvenanceLabel, S as isQuotaExhaustedError, _ as isRewearFinding, C as useAiCreditStatus, E as useAnalyzeWardrobeGaps, D as useCurateCollection, w as useDecisionActivity, O as useSuggestCollaborationMatch, T as useSuggestOutfit };