@burdenoff/microfe-coolandlovely 2026.629.1 → 2026.706.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.
|
@@ -2,8 +2,9 @@ import { useCoolAndLovely as e } from "../context/CoolAndLovelyContext.js";
|
|
|
2
2
|
import "../context/index.js";
|
|
3
3
|
import { useMutation as t, useQuery as n, useQueryClient as r } from "@tanstack/react-query";
|
|
4
4
|
import { graphqlFetch as i } from "@burdenoff/fe-libs/shared/graphql";
|
|
5
|
+
import { clearGraphqlFetchResponseCache as a } from "@burdenoff/fe-libs/shared/graphql/fetch";
|
|
5
6
|
//#region src/coolandlovely/hooks/useCoolAndLovelyApi.ts
|
|
6
|
-
var
|
|
7
|
+
var o = "coolandlovely", s = async (e, t, n) => {
|
|
7
8
|
let r = await i({
|
|
8
9
|
gateway: "workspace",
|
|
9
10
|
baseUrl: n,
|
|
@@ -13,18 +14,18 @@ var a = "coolandlovely", o = async (e, t, n) => {
|
|
|
13
14
|
});
|
|
14
15
|
if (r.errors?.length) throw Error(r.errors[0]?.message ?? "GraphQL request failed");
|
|
15
16
|
if (!r.data) throw Error("GraphQL response did not include data");
|
|
16
|
-
return r.data;
|
|
17
|
-
},
|
|
17
|
+
return /^\s*mutation\b/.test(e) && a(), r.data;
|
|
18
|
+
}, 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 id workspaceId authorId title caption occasion visibility isFeatured\n likeCount saveCount collaborationId image { id } tags publishedAt\n createdAt updatedAt\n", f = "\n id workspaceId brandId creatorId collectionId title brief role status\n compensation currency tags startDate endDate publishedAt createdAt updatedAt\n", p = "\n id workspaceId profileId name category source brandName colour size notes\n styleItemId timesWorn lastWornAt tags image { id } createdAt updatedAt\n", m = "\n id workspaceId ownerId displayName bio visibility stylePreferences\n palette favouriteBrands sizes createdAt updatedAt\n", h = "\n id workspaceId ownerId profileId name description visibility tags\n cover { id } createdAt updatedAt\n", g = (t = {}) => {
|
|
18
19
|
let { apiGatewayUrl: r } = e();
|
|
19
20
|
return n({
|
|
20
21
|
queryKey: [
|
|
21
|
-
|
|
22
|
+
o,
|
|
22
23
|
"brands",
|
|
23
24
|
t
|
|
24
25
|
],
|
|
25
|
-
queryFn: async () => (await
|
|
26
|
+
queryFn: async () => (await s(`query CooListBrands($status: CooBrandStatus, $featured: Boolean, $pagination: PaginationInput) {
|
|
26
27
|
cooListBrands(status: $status, featured: $featured, pagination: $pagination) {
|
|
27
|
-
items { ${
|
|
28
|
+
items { ${c} }
|
|
28
29
|
pageInfo { cursor hasMore }
|
|
29
30
|
}
|
|
30
31
|
}`, {
|
|
@@ -36,78 +37,78 @@ var a = "coolandlovely", o = async (e, t, n) => {
|
|
|
36
37
|
}
|
|
37
38
|
}, r)).cooListBrands
|
|
38
39
|
});
|
|
39
|
-
},
|
|
40
|
+
}, _ = (t) => {
|
|
40
41
|
let { apiGatewayUrl: r } = e();
|
|
41
42
|
return n({
|
|
42
43
|
queryKey: [
|
|
43
|
-
|
|
44
|
+
o,
|
|
44
45
|
"brand",
|
|
45
46
|
t
|
|
46
47
|
],
|
|
47
|
-
queryFn: async () => (await
|
|
48
|
+
queryFn: async () => (await s(`query CooBrand($id: ID!) {
|
|
48
49
|
cooBrand(id: $id) {
|
|
49
|
-
${
|
|
50
|
-
collections { ${
|
|
51
|
-
items { ${
|
|
50
|
+
${c}
|
|
51
|
+
collections { ${l} }
|
|
52
|
+
items { ${u} }
|
|
52
53
|
}
|
|
53
54
|
}`, { id: t }, r)).cooBrand,
|
|
54
55
|
enabled: !!t
|
|
55
56
|
});
|
|
56
|
-
},
|
|
57
|
+
}, v = () => {
|
|
57
58
|
let n = r(), { apiGatewayUrl: i } = e();
|
|
58
59
|
return t({
|
|
59
|
-
mutationFn: async (e) => (await
|
|
60
|
-
cooCreateBrand(input: $input) { ${
|
|
60
|
+
mutationFn: async (e) => (await s(`mutation CooCreateBrand($input: CooCreateBrandInput!) {
|
|
61
|
+
cooCreateBrand(input: $input) { ${c} }
|
|
61
62
|
}`, { input: e }, i)).cooCreateBrand,
|
|
62
63
|
onSuccess: () => {
|
|
63
|
-
n.invalidateQueries({ queryKey: [
|
|
64
|
+
n.invalidateQueries({ queryKey: [o, "brands"] });
|
|
64
65
|
}
|
|
65
66
|
});
|
|
66
|
-
},
|
|
67
|
+
}, y = () => {
|
|
67
68
|
let n = r(), { apiGatewayUrl: i } = e();
|
|
68
69
|
return t({
|
|
69
|
-
mutationFn: async ({ id: e, input: t }) => (await
|
|
70
|
-
cooUpdateBrand(id: $id, input: $input) { ${
|
|
70
|
+
mutationFn: async ({ id: e, input: t }) => (await s(`mutation CooUpdateBrand($id: ID!, $input: CooUpdateBrandInput!) {
|
|
71
|
+
cooUpdateBrand(id: $id, input: $input) { ${c} }
|
|
71
72
|
}`, {
|
|
72
73
|
id: e,
|
|
73
74
|
input: t
|
|
74
75
|
}, i)).cooUpdateBrand,
|
|
75
76
|
onSuccess: (e) => {
|
|
76
|
-
n.invalidateQueries({ queryKey: [
|
|
77
|
-
|
|
77
|
+
n.invalidateQueries({ queryKey: [o, "brands"] }), n.invalidateQueries({ queryKey: [
|
|
78
|
+
o,
|
|
78
79
|
"brand",
|
|
79
80
|
e.id
|
|
80
81
|
] });
|
|
81
82
|
}
|
|
82
83
|
});
|
|
83
|
-
},
|
|
84
|
+
}, b = () => {
|
|
84
85
|
let n = r(), { apiGatewayUrl: i } = e();
|
|
85
86
|
return t({
|
|
86
|
-
mutationFn: async ({ id: e, status: t }) => (await
|
|
87
|
-
cooTransitionBrand(id: $id, status: $status) { ${
|
|
87
|
+
mutationFn: async ({ id: e, status: t }) => (await s(`mutation CooTransitionBrand($id: ID!, $status: CooBrandStatus!) {
|
|
88
|
+
cooTransitionBrand(id: $id, status: $status) { ${c} }
|
|
88
89
|
}`, {
|
|
89
90
|
id: e,
|
|
90
91
|
status: t
|
|
91
92
|
}, i)).cooTransitionBrand,
|
|
92
93
|
onSuccess: (e) => {
|
|
93
|
-
n.invalidateQueries({ queryKey: [
|
|
94
|
-
|
|
94
|
+
n.invalidateQueries({ queryKey: [o, "brands"] }), n.invalidateQueries({ queryKey: [
|
|
95
|
+
o,
|
|
95
96
|
"brand",
|
|
96
97
|
e.id
|
|
97
98
|
] });
|
|
98
99
|
}
|
|
99
100
|
});
|
|
100
|
-
},
|
|
101
|
+
}, x = (t = {}) => {
|
|
101
102
|
let { apiGatewayUrl: r } = e();
|
|
102
103
|
return n({
|
|
103
104
|
queryKey: [
|
|
104
|
-
|
|
105
|
+
o,
|
|
105
106
|
"collections",
|
|
106
107
|
t
|
|
107
108
|
],
|
|
108
|
-
queryFn: async () => (await
|
|
109
|
+
queryFn: async () => (await s(`query CooListCollections($brandId: ID, $status: CooCollectionStatus) {
|
|
109
110
|
cooListCollections(brandId: $brandId, status: $status) {
|
|
110
|
-
${
|
|
111
|
+
${l}
|
|
111
112
|
brand { id name handle }
|
|
112
113
|
}
|
|
113
114
|
}`, {
|
|
@@ -115,73 +116,73 @@ var a = "coolandlovely", o = async (e, t, n) => {
|
|
|
115
116
|
status: t.status
|
|
116
117
|
}, r)).cooListCollections
|
|
117
118
|
});
|
|
118
|
-
},
|
|
119
|
+
}, S = (t) => {
|
|
119
120
|
let { apiGatewayUrl: r } = e();
|
|
120
121
|
return n({
|
|
121
122
|
queryKey: [
|
|
122
|
-
|
|
123
|
+
o,
|
|
123
124
|
"collection",
|
|
124
125
|
t
|
|
125
126
|
],
|
|
126
|
-
queryFn: async () => (await
|
|
127
|
+
queryFn: async () => (await s(`query CooCollection($id: ID!) {
|
|
127
128
|
cooCollection(id: $id) {
|
|
128
|
-
${
|
|
129
|
+
${l}
|
|
129
130
|
brand { id name handle }
|
|
130
|
-
items { ${
|
|
131
|
+
items { ${u} }
|
|
131
132
|
}
|
|
132
133
|
}`, { id: t }, r)).cooCollection,
|
|
133
134
|
enabled: !!t
|
|
134
135
|
});
|
|
135
|
-
},
|
|
136
|
+
}, C = () => {
|
|
136
137
|
let n = r(), { apiGatewayUrl: i } = e();
|
|
137
138
|
return t({
|
|
138
|
-
mutationFn: async (e) => (await
|
|
139
|
-
cooCreateCollection(input: $input) { ${
|
|
139
|
+
mutationFn: async (e) => (await s(`mutation CooCreateCollection($input: CooCreateCollectionInput!) {
|
|
140
|
+
cooCreateCollection(input: $input) { ${l} }
|
|
140
141
|
}`, { input: e }, i)).cooCreateCollection,
|
|
141
142
|
onSuccess: () => {
|
|
142
|
-
n.invalidateQueries({ queryKey: [
|
|
143
|
+
n.invalidateQueries({ queryKey: [o, "collections"] });
|
|
143
144
|
}
|
|
144
145
|
});
|
|
145
|
-
},
|
|
146
|
+
}, w = () => {
|
|
146
147
|
let n = r(), { apiGatewayUrl: i } = e();
|
|
147
148
|
return t({
|
|
148
|
-
mutationFn: async ({ id: e, input: t }) => (await
|
|
149
|
-
cooUpdateCollection(id: $id, input: $input) { ${
|
|
149
|
+
mutationFn: async ({ id: e, input: t }) => (await s(`mutation CooUpdateCollection($id: ID!, $input: CooUpdateCollectionInput!) {
|
|
150
|
+
cooUpdateCollection(id: $id, input: $input) { ${l} }
|
|
150
151
|
}`, {
|
|
151
152
|
id: e,
|
|
152
153
|
input: t
|
|
153
154
|
}, i)).cooUpdateCollection,
|
|
154
155
|
onSuccess: (e) => {
|
|
155
|
-
n.invalidateQueries({ queryKey: [
|
|
156
|
-
|
|
156
|
+
n.invalidateQueries({ queryKey: [o, "collections"] }), n.invalidateQueries({ queryKey: [
|
|
157
|
+
o,
|
|
157
158
|
"collection",
|
|
158
159
|
e.id
|
|
159
160
|
] });
|
|
160
161
|
}
|
|
161
162
|
});
|
|
162
|
-
},
|
|
163
|
+
}, T = () => {
|
|
163
164
|
let n = r(), { apiGatewayUrl: i } = e();
|
|
164
165
|
return t({
|
|
165
|
-
mutationFn: async (e) => (await
|
|
166
|
-
cooPublishCollection(id: $id) { ${
|
|
166
|
+
mutationFn: async (e) => (await s(`mutation CooPublishCollection($id: ID!) {
|
|
167
|
+
cooPublishCollection(id: $id) { ${l} }
|
|
167
168
|
}`, { id: e }, i)).cooPublishCollection,
|
|
168
169
|
onSuccess: (e) => {
|
|
169
|
-
n.invalidateQueries({ queryKey: [
|
|
170
|
-
|
|
170
|
+
n.invalidateQueries({ queryKey: [o, "collections"] }), n.invalidateQueries({ queryKey: [
|
|
171
|
+
o,
|
|
171
172
|
"collection",
|
|
172
173
|
e.id
|
|
173
174
|
] });
|
|
174
175
|
}
|
|
175
176
|
});
|
|
176
|
-
},
|
|
177
|
+
}, E = (t = {}) => {
|
|
177
178
|
let { apiGatewayUrl: r } = e();
|
|
178
179
|
return n({
|
|
179
180
|
queryKey: [
|
|
180
|
-
|
|
181
|
+
o,
|
|
181
182
|
"style-items",
|
|
182
183
|
t
|
|
183
184
|
],
|
|
184
|
-
queryFn: async () => (await
|
|
185
|
+
queryFn: async () => (await s(`query CooListStyleItems(
|
|
185
186
|
$brandId: ID, $collectionId: ID, $category: CooStyleCategory,
|
|
186
187
|
$status: CooStyleItemStatus, $pagination: PaginationInput
|
|
187
188
|
) {
|
|
@@ -189,7 +190,7 @@ var a = "coolandlovely", o = async (e, t, n) => {
|
|
|
189
190
|
brandId: $brandId, collectionId: $collectionId, category: $category,
|
|
190
191
|
status: $status, pagination: $pagination
|
|
191
192
|
) {
|
|
192
|
-
items { ${
|
|
193
|
+
items { ${u} brand { id name handle } }
|
|
193
194
|
pageInfo { cursor hasMore }
|
|
194
195
|
}
|
|
195
196
|
}`, {
|
|
@@ -203,71 +204,71 @@ var a = "coolandlovely", o = async (e, t, n) => {
|
|
|
203
204
|
}
|
|
204
205
|
}, r)).cooListStyleItems
|
|
205
206
|
});
|
|
206
|
-
},
|
|
207
|
+
}, D = (t) => {
|
|
207
208
|
let { apiGatewayUrl: r } = e();
|
|
208
209
|
return n({
|
|
209
210
|
queryKey: [
|
|
210
|
-
|
|
211
|
+
o,
|
|
211
212
|
"style-item",
|
|
212
213
|
t
|
|
213
214
|
],
|
|
214
|
-
queryFn: async () => (await
|
|
215
|
+
queryFn: async () => (await s(`query CooStyleItem($id: ID!) {
|
|
215
216
|
cooStyleItem(id: $id) {
|
|
216
|
-
${
|
|
217
|
+
${u}
|
|
217
218
|
brand { id name handle }
|
|
218
219
|
collection { id name }
|
|
219
220
|
}
|
|
220
221
|
}`, { id: t }, r)).cooStyleItem,
|
|
221
222
|
enabled: !!t
|
|
222
223
|
});
|
|
223
|
-
},
|
|
224
|
+
}, O = () => {
|
|
224
225
|
let n = r(), { apiGatewayUrl: i } = e();
|
|
225
226
|
return t({
|
|
226
|
-
mutationFn: async (e) => (await
|
|
227
|
-
cooCreateStyleItem(input: $input) { ${
|
|
227
|
+
mutationFn: async (e) => (await s(`mutation CooCreateStyleItem($input: CooCreateStyleItemInput!) {
|
|
228
|
+
cooCreateStyleItem(input: $input) { ${u} }
|
|
228
229
|
}`, { input: e }, i)).cooCreateStyleItem,
|
|
229
230
|
onSuccess: () => {
|
|
230
|
-
n.invalidateQueries({ queryKey: [
|
|
231
|
+
n.invalidateQueries({ queryKey: [o, "style-items"] });
|
|
231
232
|
}
|
|
232
233
|
});
|
|
233
|
-
},
|
|
234
|
+
}, k = () => {
|
|
234
235
|
let n = r(), { apiGatewayUrl: i } = e();
|
|
235
236
|
return t({
|
|
236
|
-
mutationFn: async ({ id: e, input: t }) => (await
|
|
237
|
-
cooUpdateStyleItem(id: $id, input: $input) { ${
|
|
237
|
+
mutationFn: async ({ id: e, input: t }) => (await s(`mutation CooUpdateStyleItem($id: ID!, $input: CooUpdateStyleItemInput!) {
|
|
238
|
+
cooUpdateStyleItem(id: $id, input: $input) { ${u} }
|
|
238
239
|
}`, {
|
|
239
240
|
id: e,
|
|
240
241
|
input: t
|
|
241
242
|
}, i)).cooUpdateStyleItem,
|
|
242
243
|
onSuccess: (e) => {
|
|
243
|
-
n.invalidateQueries({ queryKey: [
|
|
244
|
-
|
|
244
|
+
n.invalidateQueries({ queryKey: [o, "style-items"] }), n.invalidateQueries({ queryKey: [
|
|
245
|
+
o,
|
|
245
246
|
"style-item",
|
|
246
247
|
e.id
|
|
247
248
|
] });
|
|
248
249
|
}
|
|
249
250
|
});
|
|
250
|
-
},
|
|
251
|
+
}, A = () => {
|
|
251
252
|
let n = r(), { apiGatewayUrl: i } = e();
|
|
252
253
|
return t({
|
|
253
|
-
mutationFn: async (e) => (await
|
|
254
|
+
mutationFn: async (e) => (await s("mutation CooArchiveStyleItem($id: ID!) { cooArchiveStyleItem(id: $id) }", { id: e }, i)).cooArchiveStyleItem,
|
|
254
255
|
onSuccess: () => {
|
|
255
|
-
n.invalidateQueries({ queryKey: [
|
|
256
|
+
n.invalidateQueries({ queryKey: [o, "style-items"] });
|
|
256
257
|
}
|
|
257
258
|
});
|
|
258
|
-
},
|
|
259
|
+
}, j = (t = {}) => {
|
|
259
260
|
let { apiGatewayUrl: r } = e();
|
|
260
261
|
return n({
|
|
261
262
|
queryKey: [
|
|
262
|
-
|
|
263
|
+
o,
|
|
263
264
|
"looks",
|
|
264
265
|
t
|
|
265
266
|
],
|
|
266
|
-
queryFn: async () => (await
|
|
267
|
+
queryFn: async () => (await s(`query CooListLooks(
|
|
267
268
|
$authorId: ID, $occasion: CooLookOccasion, $featured: Boolean, $pagination: PaginationInput
|
|
268
269
|
) {
|
|
269
270
|
cooListLooks(authorId: $authorId, occasion: $occasion, featured: $featured, pagination: $pagination) {
|
|
270
|
-
items { ${
|
|
271
|
+
items { ${d} }
|
|
271
272
|
pageInfo { cursor hasMore }
|
|
272
273
|
}
|
|
273
274
|
}`, {
|
|
@@ -280,17 +281,17 @@ var a = "coolandlovely", o = async (e, t, n) => {
|
|
|
280
281
|
}
|
|
281
282
|
}, r)).cooListLooks
|
|
282
283
|
});
|
|
283
|
-
},
|
|
284
|
+
}, M = (t) => {
|
|
284
285
|
let { apiGatewayUrl: r } = e();
|
|
285
286
|
return n({
|
|
286
287
|
queryKey: [
|
|
287
|
-
|
|
288
|
+
o,
|
|
288
289
|
"look",
|
|
289
290
|
t
|
|
290
291
|
],
|
|
291
|
-
queryFn: async () => (await
|
|
292
|
+
queryFn: async () => (await s(`query CooLook($id: ID!) {
|
|
292
293
|
cooLook(id: $id) {
|
|
293
|
-
${
|
|
294
|
+
${d}
|
|
294
295
|
items {
|
|
295
296
|
id lookId styleItemId position styling
|
|
296
297
|
styleItem { id name category price currency }
|
|
@@ -299,59 +300,59 @@ var a = "coolandlovely", o = async (e, t, n) => {
|
|
|
299
300
|
}`, { id: t }, r)).cooLook,
|
|
300
301
|
enabled: !!t
|
|
301
302
|
});
|
|
302
|
-
},
|
|
303
|
+
}, N = () => {
|
|
303
304
|
let n = r(), { apiGatewayUrl: i } = e();
|
|
304
305
|
return t({
|
|
305
|
-
mutationFn: async (e) => (await
|
|
306
|
-
cooCreateLook(input: $input) { ${
|
|
306
|
+
mutationFn: async (e) => (await s(`mutation CooCreateLook($input: CooCreateLookInput!) {
|
|
307
|
+
cooCreateLook(input: $input) { ${d} }
|
|
307
308
|
}`, { input: e }, i)).cooCreateLook,
|
|
308
309
|
onSuccess: () => {
|
|
309
|
-
n.invalidateQueries({ queryKey: [
|
|
310
|
+
n.invalidateQueries({ queryKey: [o, "looks"] });
|
|
310
311
|
}
|
|
311
312
|
});
|
|
312
|
-
},
|
|
313
|
+
}, P = () => {
|
|
313
314
|
let n = r(), { apiGatewayUrl: i } = e();
|
|
314
315
|
return t({
|
|
315
|
-
mutationFn: async (e) => (await
|
|
316
|
+
mutationFn: async (e) => (await s(`mutation CooPublishLook($id: ID!) { cooPublishLook(id: $id) { ${d} } }`, { id: e }, i)).cooPublishLook,
|
|
316
317
|
onSuccess: (e) => {
|
|
317
|
-
n.invalidateQueries({ queryKey: [
|
|
318
|
-
|
|
318
|
+
n.invalidateQueries({ queryKey: [o, "looks"] }), n.invalidateQueries({ queryKey: [
|
|
319
|
+
o,
|
|
319
320
|
"look",
|
|
320
321
|
e.id
|
|
321
322
|
] });
|
|
322
323
|
}
|
|
323
324
|
});
|
|
324
|
-
},
|
|
325
|
+
}, F = () => {
|
|
325
326
|
let n = r(), { apiGatewayUrl: i } = e();
|
|
326
327
|
return t({
|
|
327
|
-
mutationFn: async (e) => (await
|
|
328
|
+
mutationFn: async (e) => (await s(`mutation CooLikeLook($id: ID!) { cooLikeLook(id: $id) { ${d} } }`, { id: e }, i)).cooLikeLook,
|
|
328
329
|
onSuccess: (e) => {
|
|
329
|
-
n.invalidateQueries({ queryKey: [
|
|
330
|
-
|
|
330
|
+
n.invalidateQueries({ queryKey: [o, "looks"] }), n.invalidateQueries({ queryKey: [
|
|
331
|
+
o,
|
|
331
332
|
"look",
|
|
332
333
|
e.id
|
|
333
334
|
] });
|
|
334
335
|
}
|
|
335
336
|
});
|
|
336
|
-
},
|
|
337
|
+
}, I = () => {
|
|
337
338
|
let n = r(), { apiGatewayUrl: i } = e();
|
|
338
339
|
return t({
|
|
339
|
-
mutationFn: async (e) => (await
|
|
340
|
+
mutationFn: async (e) => (await s("mutation CooDeleteLook($id: ID!) { cooDeleteLook(id: $id) }", { id: e }, i)).cooDeleteLook,
|
|
340
341
|
onSuccess: () => {
|
|
341
|
-
n.invalidateQueries({ queryKey: [
|
|
342
|
+
n.invalidateQueries({ queryKey: [o, "looks"] });
|
|
342
343
|
}
|
|
343
344
|
});
|
|
344
|
-
},
|
|
345
|
+
}, L = (t = {}) => {
|
|
345
346
|
let { apiGatewayUrl: r } = e();
|
|
346
347
|
return n({
|
|
347
348
|
queryKey: [
|
|
348
|
-
|
|
349
|
+
o,
|
|
349
350
|
"collaborations",
|
|
350
351
|
t
|
|
351
352
|
],
|
|
352
|
-
queryFn: async () => (await
|
|
353
|
+
queryFn: async () => (await s(`query CooListCollaborations($brandId: ID, $creatorId: ID, $status: CooCollaborationStatus) {
|
|
353
354
|
cooListCollaborations(brandId: $brandId, creatorId: $creatorId, status: $status) {
|
|
354
|
-
${
|
|
355
|
+
${f}
|
|
355
356
|
brand { id name handle }
|
|
356
357
|
}
|
|
357
358
|
}`, {
|
|
@@ -360,150 +361,150 @@ var a = "coolandlovely", o = async (e, t, n) => {
|
|
|
360
361
|
status: t.status
|
|
361
362
|
}, r)).cooListCollaborations
|
|
362
363
|
});
|
|
363
|
-
},
|
|
364
|
+
}, R = (t) => {
|
|
364
365
|
let { apiGatewayUrl: r } = e();
|
|
365
366
|
return n({
|
|
366
367
|
queryKey: [
|
|
367
|
-
|
|
368
|
+
o,
|
|
368
369
|
"collaboration",
|
|
369
370
|
t
|
|
370
371
|
],
|
|
371
|
-
queryFn: async () => (await
|
|
372
|
+
queryFn: async () => (await s(`query CooCollaboration($id: ID!) {
|
|
372
373
|
cooCollaboration(id: $id) {
|
|
373
|
-
${
|
|
374
|
+
${f}
|
|
374
375
|
brand { id name handle }
|
|
375
|
-
looks { ${
|
|
376
|
+
looks { ${d} }
|
|
376
377
|
}
|
|
377
378
|
}`, { id: t }, r)).cooCollaboration,
|
|
378
379
|
enabled: !!t
|
|
379
380
|
});
|
|
380
|
-
},
|
|
381
|
+
}, z = () => {
|
|
381
382
|
let n = r(), { apiGatewayUrl: i } = e();
|
|
382
383
|
return t({
|
|
383
|
-
mutationFn: async (e) => (await
|
|
384
|
-
cooCreateCollaboration(input: $input) { ${
|
|
384
|
+
mutationFn: async (e) => (await s(`mutation CooCreateCollaboration($input: CooCreateCollaborationInput!) {
|
|
385
|
+
cooCreateCollaboration(input: $input) { ${f} }
|
|
385
386
|
}`, { input: e }, i)).cooCreateCollaboration,
|
|
386
387
|
onSuccess: () => {
|
|
387
|
-
n.invalidateQueries({ queryKey: [
|
|
388
|
+
n.invalidateQueries({ queryKey: [o, "collaborations"] });
|
|
388
389
|
}
|
|
389
390
|
});
|
|
390
|
-
},
|
|
391
|
+
}, B = () => {
|
|
391
392
|
let n = r(), { apiGatewayUrl: i } = e();
|
|
392
393
|
return t({
|
|
393
|
-
mutationFn: async ({ id: e, status: t }) => (await
|
|
394
|
-
cooTransitionCollaboration(id: $id, status: $status) { ${
|
|
394
|
+
mutationFn: async ({ id: e, status: t }) => (await s(`mutation CooTransitionCollaboration($id: ID!, $status: CooCollaborationStatus!) {
|
|
395
|
+
cooTransitionCollaboration(id: $id, status: $status) { ${f} }
|
|
395
396
|
}`, {
|
|
396
397
|
id: e,
|
|
397
398
|
status: t
|
|
398
399
|
}, i)).cooTransitionCollaboration,
|
|
399
400
|
onSuccess: (e) => {
|
|
400
|
-
n.invalidateQueries({ queryKey: [
|
|
401
|
-
|
|
401
|
+
n.invalidateQueries({ queryKey: [o, "collaborations"] }), n.invalidateQueries({ queryKey: [
|
|
402
|
+
o,
|
|
402
403
|
"collaboration",
|
|
403
404
|
e.id
|
|
404
405
|
] });
|
|
405
406
|
}
|
|
406
407
|
});
|
|
407
|
-
},
|
|
408
|
+
}, V = (t = {}) => {
|
|
408
409
|
let { apiGatewayUrl: r } = e();
|
|
409
410
|
return n({
|
|
410
411
|
queryKey: [
|
|
411
|
-
|
|
412
|
+
o,
|
|
412
413
|
"wardrobe",
|
|
413
414
|
t
|
|
414
415
|
],
|
|
415
|
-
queryFn: async () => (await
|
|
416
|
-
cooListWardrobeItems(category: $category, source: $source) { ${
|
|
416
|
+
queryFn: async () => (await s(`query CooListWardrobeItems($category: CooStyleCategory, $source: CooWardrobeSource) {
|
|
417
|
+
cooListWardrobeItems(category: $category, source: $source) { ${p} }
|
|
417
418
|
}`, {
|
|
418
419
|
category: t.category,
|
|
419
420
|
source: t.source
|
|
420
421
|
}, r)).cooListWardrobeItems
|
|
421
422
|
});
|
|
422
|
-
},
|
|
423
|
+
}, H = () => {
|
|
423
424
|
let n = r(), { apiGatewayUrl: i } = e();
|
|
424
425
|
return t({
|
|
425
|
-
mutationFn: async (e) => (await
|
|
426
|
-
cooCreateWardrobeItem(input: $input) { ${
|
|
426
|
+
mutationFn: async (e) => (await s(`mutation CooCreateWardrobeItem($input: CooCreateWardrobeItemInput!) {
|
|
427
|
+
cooCreateWardrobeItem(input: $input) { ${p} }
|
|
427
428
|
}`, { input: e }, i)).cooCreateWardrobeItem,
|
|
428
429
|
onSuccess: () => {
|
|
429
|
-
n.invalidateQueries({ queryKey: [
|
|
430
|
+
n.invalidateQueries({ queryKey: [o, "wardrobe"] });
|
|
430
431
|
}
|
|
431
432
|
});
|
|
432
|
-
},
|
|
433
|
+
}, U = () => {
|
|
433
434
|
let n = r(), { apiGatewayUrl: i } = e();
|
|
434
435
|
return t({
|
|
435
|
-
mutationFn: async (e) => (await
|
|
436
|
-
cooLogWardrobeWear(id: $id) { ${
|
|
436
|
+
mutationFn: async (e) => (await s(`mutation CooLogWardrobeWear($id: ID!) {
|
|
437
|
+
cooLogWardrobeWear(id: $id) { ${p} }
|
|
437
438
|
}`, { id: e }, i)).cooLogWardrobeWear,
|
|
438
439
|
onSuccess: () => {
|
|
439
|
-
n.invalidateQueries({ queryKey: [
|
|
440
|
+
n.invalidateQueries({ queryKey: [o, "wardrobe"] });
|
|
440
441
|
}
|
|
441
442
|
});
|
|
442
|
-
},
|
|
443
|
+
}, W = () => {
|
|
443
444
|
let n = r(), { apiGatewayUrl: i } = e();
|
|
444
445
|
return t({
|
|
445
|
-
mutationFn: async (e) => (await
|
|
446
|
+
mutationFn: async (e) => (await s("mutation CooRemoveWardrobeItem($id: ID!) { cooRemoveWardrobeItem(id: $id) }", { id: e }, i)).cooRemoveWardrobeItem,
|
|
446
447
|
onSuccess: () => {
|
|
447
|
-
n.invalidateQueries({ queryKey: [
|
|
448
|
+
n.invalidateQueries({ queryKey: [o, "wardrobe"] });
|
|
448
449
|
}
|
|
449
450
|
});
|
|
450
|
-
},
|
|
451
|
+
}, G = () => {
|
|
451
452
|
let { apiGatewayUrl: t } = e();
|
|
452
453
|
return n({
|
|
453
|
-
queryKey: [
|
|
454
|
-
queryFn: async () => (await
|
|
454
|
+
queryKey: [o, "my-style-profile"],
|
|
455
|
+
queryFn: async () => (await s(`query CooMyStyleProfile { cooMyStyleProfile { ${m} } }`, {}, t)).cooMyStyleProfile
|
|
455
456
|
});
|
|
456
|
-
},
|
|
457
|
+
}, K = () => {
|
|
457
458
|
let n = r(), { apiGatewayUrl: i } = e();
|
|
458
459
|
return t({
|
|
459
|
-
mutationFn: async (e) => (await
|
|
460
|
-
cooUpsertStyleProfile(input: $input) { ${
|
|
460
|
+
mutationFn: async (e) => (await s(`mutation CooUpsertStyleProfile($input: CooUpsertStyleProfileInput!) {
|
|
461
|
+
cooUpsertStyleProfile(input: $input) { ${m} }
|
|
461
462
|
}`, { input: e }, i)).cooUpsertStyleProfile,
|
|
462
463
|
onSuccess: () => {
|
|
463
|
-
n.invalidateQueries({ queryKey: [
|
|
464
|
+
n.invalidateQueries({ queryKey: [o, "my-style-profile"] });
|
|
464
465
|
}
|
|
465
466
|
});
|
|
466
|
-
},
|
|
467
|
+
}, q = (t) => {
|
|
467
468
|
let { apiGatewayUrl: r } = e();
|
|
468
469
|
return n({
|
|
469
470
|
queryKey: [
|
|
470
|
-
|
|
471
|
+
o,
|
|
471
472
|
"lookbooks",
|
|
472
473
|
t
|
|
473
474
|
],
|
|
474
|
-
queryFn: async () => (await
|
|
475
|
-
cooListLookbooks(ownerId: $ownerId) { ${
|
|
475
|
+
queryFn: async () => (await s(`query CooListLookbooks($ownerId: ID) {
|
|
476
|
+
cooListLookbooks(ownerId: $ownerId) { ${h} }
|
|
476
477
|
}`, { ownerId: t }, r)).cooListLookbooks
|
|
477
478
|
});
|
|
478
|
-
},
|
|
479
|
+
}, J = () => {
|
|
479
480
|
let n = r(), { apiGatewayUrl: i } = e();
|
|
480
481
|
return t({
|
|
481
|
-
mutationFn: async (e) => (await
|
|
482
|
-
cooCreateLookbook(input: $input) { ${
|
|
482
|
+
mutationFn: async (e) => (await s(`mutation CooCreateLookbook($input: CooCreateLookbookInput!) {
|
|
483
|
+
cooCreateLookbook(input: $input) { ${h} }
|
|
483
484
|
}`, { input: e }, i)).cooCreateLookbook,
|
|
484
485
|
onSuccess: () => {
|
|
485
|
-
n.invalidateQueries({ queryKey: [
|
|
486
|
+
n.invalidateQueries({ queryKey: [o, "lookbooks"] });
|
|
486
487
|
}
|
|
487
488
|
});
|
|
488
|
-
},
|
|
489
|
+
}, Y = () => {
|
|
489
490
|
let n = r(), { apiGatewayUrl: i } = e();
|
|
490
491
|
return t({
|
|
491
|
-
mutationFn: async (e) => (await
|
|
492
|
+
mutationFn: async (e) => (await s("mutation CooRemoveLookbookEntry($id: ID!) { cooRemoveLookbookEntry(id: $id) }", { id: e }, i)).cooRemoveLookbookEntry,
|
|
492
493
|
onSuccess: () => {
|
|
493
|
-
n.invalidateQueries({ queryKey: [
|
|
494
|
+
n.invalidateQueries({ queryKey: [o, "lookbook"] });
|
|
494
495
|
}
|
|
495
496
|
});
|
|
496
|
-
},
|
|
497
|
+
}, X = (t) => {
|
|
497
498
|
let { apiGatewayUrl: r } = e();
|
|
498
499
|
return n({
|
|
499
500
|
queryKey: [
|
|
500
|
-
|
|
501
|
+
o,
|
|
501
502
|
"lookbook",
|
|
502
503
|
t
|
|
503
504
|
],
|
|
504
|
-
queryFn: async () => (await
|
|
505
|
+
queryFn: async () => (await s(`query CooLookbook($id: ID!) {
|
|
505
506
|
cooLookbook(id: $id) {
|
|
506
|
-
${
|
|
507
|
+
${h}
|
|
507
508
|
entries { id lookbookId lookId styleItemId note position createdAt updatedAt }
|
|
508
509
|
}
|
|
509
510
|
}`, { id: t }, r)).cooLookbook,
|
|
@@ -511,6 +512,6 @@ var a = "coolandlovely", o = async (e, t, n) => {
|
|
|
511
512
|
});
|
|
512
513
|
};
|
|
513
514
|
//#endregion
|
|
514
|
-
export {
|
|
515
|
+
export { A as useArchiveStyleItem, _ as useBrand, g as useBrands, R as useCollaboration, L as useCollaborations, S as useCollection, x as useCollections, v as useCreateBrand, z as useCreateCollaboration, C as useCreateCollection, N as useCreateLook, J as useCreateLookbook, O as useCreateStyleItem, H as useCreateWardrobeItem, I as useDeleteLook, F as useLikeLook, U as useLogWardrobeWear, M as useLook, X as useLookbook, q as useLookbooks, j as useLooks, G as useMyStyleProfile, T as usePublishCollection, P as usePublishLook, Y as useRemoveLookbookEntry, W as useRemoveWardrobeItem, D as useStyleItem, E as useStyleItems, b as useTransitionBrand, B as useTransitionCollaboration, y as useUpdateBrand, w as useUpdateCollection, k as useUpdateStyleItem, K as useUpsertStyleProfile, V as useWardrobeItems };
|
|
515
516
|
|
|
516
517
|
//# sourceMappingURL=useCoolAndLovelyApi.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useCoolAndLovelyApi.js","names":[],"sources":["../../../src/coolandlovely/hooks/useCoolAndLovelyApi.ts"],"sourcesContent":["/**\n * CoolAndLovely API hooks\n * @module coolandlovely/hooks\n *\n * Thin, strictly-typed React Query layer over the federated\n * `wspace-coolandlovely-svc` GraphQL contract. Every query/mutation here maps\n * 1:1 to a real `coo*` root field — no mocks. Requests go through the workspace\n * gateway via `graphqlFetch({ gateway: 'workspace', workspaceToken: true })`.\n */\n\nimport { useMutation, useQuery, useQueryClient } from '@tanstack/react-query';\n\nimport { graphqlFetch } from '@burdenoff/fe-libs/shared/graphql';\n\nimport { useCoolAndLovely } from '../context';\nimport type {\n CooBrand,\n CooBrandConnection,\n CooBrandStatus,\n CooCollaboration,\n CooCollaborationStatus,\n CooCollection,\n CooCollectionStatus,\n CooCreateBrandInput,\n CooCreateCollaborationInput,\n CooCreateCollectionInput,\n CooCreateLookInput,\n CooCreateLookbookInput,\n CooCreateStyleItemInput,\n CooCreateWardrobeItemInput,\n CooLook,\n CooLookConnection,\n CooLookOccasion,\n CooLookbook,\n CooStyleCategory,\n CooStyleItem,\n CooStyleItemConnection,\n CooStyleItemStatus,\n CooStyleProfile,\n CooUpdateBrandInput,\n CooUpdateCollectionInput,\n CooUpdateLookInput,\n CooUpdateStyleItemInput,\n CooUpdateWardrobeItemInput,\n CooUpsertStyleProfileInput,\n CooWardrobeItem,\n CooWardrobeSource,\n PaginationInput,\n} from '../types';\n\n// ---------------------------------------------------------------------------\n// Query key root\n// ---------------------------------------------------------------------------\n\nconst QK = 'coolandlovely';\n\n// ---------------------------------------------------------------------------\n// Low-level fetch wrapper\n// ---------------------------------------------------------------------------\n\nconst coolQuery = async <TData>(\n query: string,\n variables: Record<string, unknown>,\n baseUrl?: string\n): Promise<TData> => {\n const response = await graphqlFetch<TData>({\n gateway: 'workspace',\n baseUrl,\n query,\n variables,\n workspaceToken: true,\n });\n\n if (response.errors?.length) {\n throw new Error(response.errors[0]?.message ?? 'GraphQL request failed');\n }\n if (!response.data) {\n throw new Error('GraphQL response did not include data');\n }\n return response.data;\n};\n\n// ---------------------------------------------------------------------------\n// Reusable GraphQL field selections\n// ---------------------------------------------------------------------------\n\nconst BRAND_FIELDS = `\n id workspaceId name handle tagline bio aesthetics tags websiteUrl\n isFeatured status logo { id } cover { id } createdAt updatedAt\n`;\n\nconst COLLECTION_FIELDS = `\n id workspaceId brandId name description season status tags\n cover { id } publishAt endAt createdAt updatedAt\n`;\n\nconst STYLE_ITEM_FIELDS = `\n id workspaceId brandId collectionId name description category status\n sku price currency colours sizes materials tags image { id }\n createdAt updatedAt\n`;\n\nconst LOOK_FIELDS = `\n id workspaceId authorId title caption occasion visibility isFeatured\n likeCount saveCount collaborationId image { id } tags publishedAt\n createdAt updatedAt\n`;\n\nconst COLLABORATION_FIELDS = `\n id workspaceId brandId creatorId collectionId title brief role status\n compensation currency tags startDate endDate publishedAt createdAt updatedAt\n`;\n\nconst WARDROBE_FIELDS = `\n id workspaceId profileId name category source brandName colour size notes\n styleItemId timesWorn lastWornAt tags image { id } createdAt updatedAt\n`;\n\nconst PROFILE_FIELDS = `\n id workspaceId ownerId displayName bio visibility stylePreferences\n palette favouriteBrands sizes createdAt updatedAt\n`;\n\nconst LOOKBOOK_FIELDS = `\n id workspaceId ownerId profileId name description visibility tags\n cover { id } createdAt updatedAt\n`;\n\n// ===========================================================================\n// Brands\n// ===========================================================================\n\nexport interface ListBrandsArgs {\n status?: CooBrandStatus;\n featured?: boolean;\n pagination?: PaginationInput;\n}\n\nexport const useBrands = (args: ListBrandsArgs = {}) => {\n const { apiGatewayUrl } = useCoolAndLovely();\n return useQuery({\n queryKey: [QK, 'brands', args],\n queryFn: async () => {\n const data = await coolQuery<{ cooListBrands: CooBrandConnection }>(\n `query CooListBrands($status: CooBrandStatus, $featured: Boolean, $pagination: PaginationInput) {\n cooListBrands(status: $status, featured: $featured, pagination: $pagination) {\n items { ${BRAND_FIELDS} }\n pageInfo { cursor hasMore }\n }\n }`,\n {\n status: args.status,\n featured: args.featured,\n pagination: args.pagination ?? { limit: 50, offset: 0 },\n },\n apiGatewayUrl\n );\n return data.cooListBrands;\n },\n });\n};\n\nexport const useBrand = (id: string | undefined) => {\n const { apiGatewayUrl } = useCoolAndLovely();\n return useQuery({\n queryKey: [QK, 'brand', id],\n queryFn: async () => {\n const data = await coolQuery<{ cooBrand: CooBrand | null }>(\n `query CooBrand($id: ID!) {\n cooBrand(id: $id) {\n ${BRAND_FIELDS}\n collections { ${COLLECTION_FIELDS} }\n items { ${STYLE_ITEM_FIELDS} }\n }\n }`,\n { id },\n apiGatewayUrl\n );\n return data.cooBrand;\n },\n enabled: Boolean(id),\n });\n};\n\nexport const useCreateBrand = () => {\n const queryClient = useQueryClient();\n const { apiGatewayUrl } = useCoolAndLovely();\n return useMutation({\n mutationFn: async (input: CooCreateBrandInput) => {\n const data = await coolQuery<{ cooCreateBrand: CooBrand }>(\n `mutation CooCreateBrand($input: CooCreateBrandInput!) {\n cooCreateBrand(input: $input) { ${BRAND_FIELDS} }\n }`,\n { input },\n apiGatewayUrl\n );\n return data.cooCreateBrand;\n },\n onSuccess: () => {\n void queryClient.invalidateQueries({ queryKey: [QK, 'brands'] });\n },\n });\n};\n\nexport const useUpdateBrand = () => {\n const queryClient = useQueryClient();\n const { apiGatewayUrl } = useCoolAndLovely();\n return useMutation({\n mutationFn: async ({ id, input }: { id: string; input: CooUpdateBrandInput }) => {\n const data = await coolQuery<{ cooUpdateBrand: CooBrand }>(\n `mutation CooUpdateBrand($id: ID!, $input: CooUpdateBrandInput!) {\n cooUpdateBrand(id: $id, input: $input) { ${BRAND_FIELDS} }\n }`,\n { id, input },\n apiGatewayUrl\n );\n return data.cooUpdateBrand;\n },\n onSuccess: (brand) => {\n void queryClient.invalidateQueries({ queryKey: [QK, 'brands'] });\n void queryClient.invalidateQueries({ queryKey: [QK, 'brand', brand.id] });\n },\n });\n};\n\nexport const useTransitionBrand = () => {\n const queryClient = useQueryClient();\n const { apiGatewayUrl } = useCoolAndLovely();\n return useMutation({\n mutationFn: async ({ id, status }: { id: string; status: CooBrandStatus }) => {\n const data = await coolQuery<{ cooTransitionBrand: CooBrand }>(\n `mutation CooTransitionBrand($id: ID!, $status: CooBrandStatus!) {\n cooTransitionBrand(id: $id, status: $status) { ${BRAND_FIELDS} }\n }`,\n { id, status },\n apiGatewayUrl\n );\n return data.cooTransitionBrand;\n },\n onSuccess: (brand) => {\n void queryClient.invalidateQueries({ queryKey: [QK, 'brands'] });\n void queryClient.invalidateQueries({ queryKey: [QK, 'brand', brand.id] });\n },\n });\n};\n\nexport const useArchiveBrand = () => {\n const queryClient = useQueryClient();\n const { apiGatewayUrl } = useCoolAndLovely();\n return useMutation({\n mutationFn: async (id: string) => {\n const data = await coolQuery<{ cooArchiveBrand: boolean }>(\n `mutation CooArchiveBrand($id: ID!) { cooArchiveBrand(id: $id) }`,\n { id },\n apiGatewayUrl\n );\n return data.cooArchiveBrand;\n },\n onSuccess: () => {\n void queryClient.invalidateQueries({ queryKey: [QK, 'brands'] });\n },\n });\n};\n\n// ===========================================================================\n// Collections\n// ===========================================================================\n\nexport interface ListCollectionsArgs {\n brandId?: string;\n status?: CooCollectionStatus;\n}\n\nexport const useCollections = (args: ListCollectionsArgs = {}) => {\n const { apiGatewayUrl } = useCoolAndLovely();\n return useQuery({\n queryKey: [QK, 'collections', args],\n queryFn: async () => {\n const data = await coolQuery<{ cooListCollections: CooCollection[] }>(\n `query CooListCollections($brandId: ID, $status: CooCollectionStatus) {\n cooListCollections(brandId: $brandId, status: $status) {\n ${COLLECTION_FIELDS}\n brand { id name handle }\n }\n }`,\n { brandId: args.brandId, status: args.status },\n apiGatewayUrl\n );\n return data.cooListCollections;\n },\n });\n};\n\nexport const useCollection = (id: string | undefined) => {\n const { apiGatewayUrl } = useCoolAndLovely();\n return useQuery({\n queryKey: [QK, 'collection', id],\n queryFn: async () => {\n const data = await coolQuery<{ cooCollection: CooCollection | null }>(\n `query CooCollection($id: ID!) {\n cooCollection(id: $id) {\n ${COLLECTION_FIELDS}\n brand { id name handle }\n items { ${STYLE_ITEM_FIELDS} }\n }\n }`,\n { id },\n apiGatewayUrl\n );\n return data.cooCollection;\n },\n enabled: Boolean(id),\n });\n};\n\nexport const useCreateCollection = () => {\n const queryClient = useQueryClient();\n const { apiGatewayUrl } = useCoolAndLovely();\n return useMutation({\n mutationFn: async (input: CooCreateCollectionInput) => {\n const data = await coolQuery<{ cooCreateCollection: CooCollection }>(\n `mutation CooCreateCollection($input: CooCreateCollectionInput!) {\n cooCreateCollection(input: $input) { ${COLLECTION_FIELDS} }\n }`,\n { input },\n apiGatewayUrl\n );\n return data.cooCreateCollection;\n },\n onSuccess: () => {\n void queryClient.invalidateQueries({ queryKey: [QK, 'collections'] });\n },\n });\n};\n\nexport const useUpdateCollection = () => {\n const queryClient = useQueryClient();\n const { apiGatewayUrl } = useCoolAndLovely();\n return useMutation({\n mutationFn: async ({ id, input }: { id: string; input: CooUpdateCollectionInput }) => {\n const data = await coolQuery<{ cooUpdateCollection: CooCollection }>(\n `mutation CooUpdateCollection($id: ID!, $input: CooUpdateCollectionInput!) {\n cooUpdateCollection(id: $id, input: $input) { ${COLLECTION_FIELDS} }\n }`,\n { id, input },\n apiGatewayUrl\n );\n return data.cooUpdateCollection;\n },\n onSuccess: (collection) => {\n void queryClient.invalidateQueries({ queryKey: [QK, 'collections'] });\n void queryClient.invalidateQueries({ queryKey: [QK, 'collection', collection.id] });\n },\n });\n};\n\nexport const usePublishCollection = () => {\n const queryClient = useQueryClient();\n const { apiGatewayUrl } = useCoolAndLovely();\n return useMutation({\n mutationFn: async (id: string) => {\n const data = await coolQuery<{ cooPublishCollection: CooCollection }>(\n `mutation CooPublishCollection($id: ID!) {\n cooPublishCollection(id: $id) { ${COLLECTION_FIELDS} }\n }`,\n { id },\n apiGatewayUrl\n );\n return data.cooPublishCollection;\n },\n onSuccess: (collection) => {\n void queryClient.invalidateQueries({ queryKey: [QK, 'collections'] });\n void queryClient.invalidateQueries({ queryKey: [QK, 'collection', collection.id] });\n },\n });\n};\n\n// ===========================================================================\n// Style Items\n// ===========================================================================\n\nexport interface ListStyleItemsArgs {\n brandId?: string;\n collectionId?: string;\n category?: CooStyleCategory;\n status?: CooStyleItemStatus;\n pagination?: PaginationInput;\n}\n\nexport const useStyleItems = (args: ListStyleItemsArgs = {}) => {\n const { apiGatewayUrl } = useCoolAndLovely();\n return useQuery({\n queryKey: [QK, 'style-items', args],\n queryFn: async () => {\n const data = await coolQuery<{ cooListStyleItems: CooStyleItemConnection }>(\n `query CooListStyleItems(\n $brandId: ID, $collectionId: ID, $category: CooStyleCategory,\n $status: CooStyleItemStatus, $pagination: PaginationInput\n ) {\n cooListStyleItems(\n brandId: $brandId, collectionId: $collectionId, category: $category,\n status: $status, pagination: $pagination\n ) {\n items { ${STYLE_ITEM_FIELDS} brand { id name handle } }\n pageInfo { cursor hasMore }\n }\n }`,\n {\n brandId: args.brandId,\n collectionId: args.collectionId,\n category: args.category,\n status: args.status,\n pagination: args.pagination ?? { limit: 50, offset: 0 },\n },\n apiGatewayUrl\n );\n return data.cooListStyleItems;\n },\n });\n};\n\nexport const useStyleItem = (id: string | undefined) => {\n const { apiGatewayUrl } = useCoolAndLovely();\n return useQuery({\n queryKey: [QK, 'style-item', id],\n queryFn: async () => {\n const data = await coolQuery<{ cooStyleItem: CooStyleItem | null }>(\n `query CooStyleItem($id: ID!) {\n cooStyleItem(id: $id) {\n ${STYLE_ITEM_FIELDS}\n brand { id name handle }\n collection { id name }\n }\n }`,\n { id },\n apiGatewayUrl\n );\n return data.cooStyleItem;\n },\n enabled: Boolean(id),\n });\n};\n\nexport const useCreateStyleItem = () => {\n const queryClient = useQueryClient();\n const { apiGatewayUrl } = useCoolAndLovely();\n return useMutation({\n mutationFn: async (input: CooCreateStyleItemInput) => {\n const data = await coolQuery<{ cooCreateStyleItem: CooStyleItem }>(\n `mutation CooCreateStyleItem($input: CooCreateStyleItemInput!) {\n cooCreateStyleItem(input: $input) { ${STYLE_ITEM_FIELDS} }\n }`,\n { input },\n apiGatewayUrl\n );\n return data.cooCreateStyleItem;\n },\n onSuccess: () => {\n void queryClient.invalidateQueries({ queryKey: [QK, 'style-items'] });\n },\n });\n};\n\nexport const useUpdateStyleItem = () => {\n const queryClient = useQueryClient();\n const { apiGatewayUrl } = useCoolAndLovely();\n return useMutation({\n mutationFn: async ({ id, input }: { id: string; input: CooUpdateStyleItemInput }) => {\n const data = await coolQuery<{ cooUpdateStyleItem: CooStyleItem }>(\n `mutation CooUpdateStyleItem($id: ID!, $input: CooUpdateStyleItemInput!) {\n cooUpdateStyleItem(id: $id, input: $input) { ${STYLE_ITEM_FIELDS} }\n }`,\n { id, input },\n apiGatewayUrl\n );\n return data.cooUpdateStyleItem;\n },\n onSuccess: (item) => {\n void queryClient.invalidateQueries({ queryKey: [QK, 'style-items'] });\n void queryClient.invalidateQueries({ queryKey: [QK, 'style-item', item.id] });\n },\n });\n};\n\nexport const useArchiveStyleItem = () => {\n const queryClient = useQueryClient();\n const { apiGatewayUrl } = useCoolAndLovely();\n return useMutation({\n mutationFn: async (id: string) => {\n const data = await coolQuery<{ cooArchiveStyleItem: boolean }>(\n `mutation CooArchiveStyleItem($id: ID!) { cooArchiveStyleItem(id: $id) }`,\n { id },\n apiGatewayUrl\n );\n return data.cooArchiveStyleItem;\n },\n onSuccess: () => {\n void queryClient.invalidateQueries({ queryKey: [QK, 'style-items'] });\n },\n });\n};\n\n// ===========================================================================\n// Looks\n// ===========================================================================\n\nexport interface ListLooksArgs {\n authorId?: string;\n occasion?: CooLookOccasion;\n featured?: boolean;\n pagination?: PaginationInput;\n}\n\nexport const useLooks = (args: ListLooksArgs = {}) => {\n const { apiGatewayUrl } = useCoolAndLovely();\n return useQuery({\n queryKey: [QK, 'looks', args],\n queryFn: async () => {\n const data = await coolQuery<{ cooListLooks: CooLookConnection }>(\n `query CooListLooks(\n $authorId: ID, $occasion: CooLookOccasion, $featured: Boolean, $pagination: PaginationInput\n ) {\n cooListLooks(authorId: $authorId, occasion: $occasion, featured: $featured, pagination: $pagination) {\n items { ${LOOK_FIELDS} }\n pageInfo { cursor hasMore }\n }\n }`,\n {\n authorId: args.authorId,\n occasion: args.occasion,\n featured: args.featured,\n pagination: args.pagination ?? { limit: 50, offset: 0 },\n },\n apiGatewayUrl\n );\n return data.cooListLooks;\n },\n });\n};\n\nexport const useLook = (id: string | undefined) => {\n const { apiGatewayUrl } = useCoolAndLovely();\n return useQuery({\n queryKey: [QK, 'look', id],\n queryFn: async () => {\n const data = await coolQuery<{ cooLook: CooLook | null }>(\n `query CooLook($id: ID!) {\n cooLook(id: $id) {\n ${LOOK_FIELDS}\n items {\n id lookId styleItemId position styling\n styleItem { id name category price currency }\n }\n }\n }`,\n { id },\n apiGatewayUrl\n );\n return data.cooLook;\n },\n enabled: Boolean(id),\n });\n};\n\nexport const useCreateLook = () => {\n const queryClient = useQueryClient();\n const { apiGatewayUrl } = useCoolAndLovely();\n return useMutation({\n mutationFn: async (input: CooCreateLookInput) => {\n const data = await coolQuery<{ cooCreateLook: CooLook }>(\n `mutation CooCreateLook($input: CooCreateLookInput!) {\n cooCreateLook(input: $input) { ${LOOK_FIELDS} }\n }`,\n { input },\n apiGatewayUrl\n );\n return data.cooCreateLook;\n },\n onSuccess: () => {\n void queryClient.invalidateQueries({ queryKey: [QK, 'looks'] });\n },\n });\n};\n\nexport const useUpdateLook = () => {\n const queryClient = useQueryClient();\n const { apiGatewayUrl } = useCoolAndLovely();\n return useMutation({\n mutationFn: async ({ id, input }: { id: string; input: CooUpdateLookInput }) => {\n const data = await coolQuery<{ cooUpdateLook: CooLook }>(\n `mutation CooUpdateLook($id: ID!, $input: CooUpdateLookInput!) {\n cooUpdateLook(id: $id, input: $input) { ${LOOK_FIELDS} }\n }`,\n { id, input },\n apiGatewayUrl\n );\n return data.cooUpdateLook;\n },\n onSuccess: (look) => {\n void queryClient.invalidateQueries({ queryKey: [QK, 'looks'] });\n void queryClient.invalidateQueries({ queryKey: [QK, 'look', look.id] });\n },\n });\n};\n\nexport const usePublishLook = () => {\n const queryClient = useQueryClient();\n const { apiGatewayUrl } = useCoolAndLovely();\n return useMutation({\n mutationFn: async (id: string) => {\n const data = await coolQuery<{ cooPublishLook: CooLook }>(\n `mutation CooPublishLook($id: ID!) { cooPublishLook(id: $id) { ${LOOK_FIELDS} } }`,\n { id },\n apiGatewayUrl\n );\n return data.cooPublishLook;\n },\n onSuccess: (look) => {\n void queryClient.invalidateQueries({ queryKey: [QK, 'looks'] });\n void queryClient.invalidateQueries({ queryKey: [QK, 'look', look.id] });\n },\n });\n};\n\nexport const useLikeLook = () => {\n const queryClient = useQueryClient();\n const { apiGatewayUrl } = useCoolAndLovely();\n return useMutation({\n mutationFn: async (id: string) => {\n const data = await coolQuery<{ cooLikeLook: CooLook }>(\n `mutation CooLikeLook($id: ID!) { cooLikeLook(id: $id) { ${LOOK_FIELDS} } }`,\n { id },\n apiGatewayUrl\n );\n return data.cooLikeLook;\n },\n onSuccess: (look) => {\n void queryClient.invalidateQueries({ queryKey: [QK, 'looks'] });\n void queryClient.invalidateQueries({ queryKey: [QK, 'look', look.id] });\n },\n });\n};\n\nexport const useDeleteLook = () => {\n const queryClient = useQueryClient();\n const { apiGatewayUrl } = useCoolAndLovely();\n return useMutation({\n mutationFn: async (id: string) => {\n const data = await coolQuery<{ cooDeleteLook: boolean }>(\n `mutation CooDeleteLook($id: ID!) { cooDeleteLook(id: $id) }`,\n { id },\n apiGatewayUrl\n );\n return data.cooDeleteLook;\n },\n onSuccess: () => {\n void queryClient.invalidateQueries({ queryKey: [QK, 'looks'] });\n },\n });\n};\n\n// ===========================================================================\n// Collaborations\n// ===========================================================================\n\nexport interface ListCollaborationsArgs {\n brandId?: string;\n creatorId?: string;\n status?: CooCollaborationStatus;\n}\n\nexport const useCollaborations = (args: ListCollaborationsArgs = {}) => {\n const { apiGatewayUrl } = useCoolAndLovely();\n return useQuery({\n queryKey: [QK, 'collaborations', args],\n queryFn: async () => {\n const data = await coolQuery<{ cooListCollaborations: CooCollaboration[] }>(\n `query CooListCollaborations($brandId: ID, $creatorId: ID, $status: CooCollaborationStatus) {\n cooListCollaborations(brandId: $brandId, creatorId: $creatorId, status: $status) {\n ${COLLABORATION_FIELDS}\n brand { id name handle }\n }\n }`,\n { brandId: args.brandId, creatorId: args.creatorId, status: args.status },\n apiGatewayUrl\n );\n return data.cooListCollaborations;\n },\n });\n};\n\nexport const useCollaboration = (id: string | undefined) => {\n const { apiGatewayUrl } = useCoolAndLovely();\n return useQuery({\n queryKey: [QK, 'collaboration', id],\n queryFn: async () => {\n const data = await coolQuery<{ cooCollaboration: CooCollaboration | null }>(\n `query CooCollaboration($id: ID!) {\n cooCollaboration(id: $id) {\n ${COLLABORATION_FIELDS}\n brand { id name handle }\n looks { ${LOOK_FIELDS} }\n }\n }`,\n { id },\n apiGatewayUrl\n );\n return data.cooCollaboration;\n },\n enabled: Boolean(id),\n });\n};\n\nexport const useCreateCollaboration = () => {\n const queryClient = useQueryClient();\n const { apiGatewayUrl } = useCoolAndLovely();\n return useMutation({\n mutationFn: async (input: CooCreateCollaborationInput) => {\n const data = await coolQuery<{ cooCreateCollaboration: CooCollaboration }>(\n `mutation CooCreateCollaboration($input: CooCreateCollaborationInput!) {\n cooCreateCollaboration(input: $input) { ${COLLABORATION_FIELDS} }\n }`,\n { input },\n apiGatewayUrl\n );\n return data.cooCreateCollaboration;\n },\n onSuccess: () => {\n void queryClient.invalidateQueries({ queryKey: [QK, 'collaborations'] });\n },\n });\n};\n\nexport const useTransitionCollaboration = () => {\n const queryClient = useQueryClient();\n const { apiGatewayUrl } = useCoolAndLovely();\n return useMutation({\n mutationFn: async ({ id, status }: { id: string; status: CooCollaborationStatus }) => {\n const data = await coolQuery<{ cooTransitionCollaboration: CooCollaboration }>(\n `mutation CooTransitionCollaboration($id: ID!, $status: CooCollaborationStatus!) {\n cooTransitionCollaboration(id: $id, status: $status) { ${COLLABORATION_FIELDS} }\n }`,\n { id, status },\n apiGatewayUrl\n );\n return data.cooTransitionCollaboration;\n },\n onSuccess: (collab) => {\n void queryClient.invalidateQueries({ queryKey: [QK, 'collaborations'] });\n void queryClient.invalidateQueries({ queryKey: [QK, 'collaboration', collab.id] });\n },\n });\n};\n\n// ===========================================================================\n// Wardrobe (self-scoped)\n// ===========================================================================\n\nexport interface ListWardrobeArgs {\n category?: CooStyleCategory;\n source?: CooWardrobeSource;\n}\n\nexport const useWardrobeItems = (args: ListWardrobeArgs = {}) => {\n const { apiGatewayUrl } = useCoolAndLovely();\n return useQuery({\n queryKey: [QK, 'wardrobe', args],\n queryFn: async () => {\n const data = await coolQuery<{ cooListWardrobeItems: CooWardrobeItem[] }>(\n `query CooListWardrobeItems($category: CooStyleCategory, $source: CooWardrobeSource) {\n cooListWardrobeItems(category: $category, source: $source) { ${WARDROBE_FIELDS} }\n }`,\n { category: args.category, source: args.source },\n apiGatewayUrl\n );\n return data.cooListWardrobeItems;\n },\n });\n};\n\nexport const useCreateWardrobeItem = () => {\n const queryClient = useQueryClient();\n const { apiGatewayUrl } = useCoolAndLovely();\n return useMutation({\n mutationFn: async (input: CooCreateWardrobeItemInput) => {\n const data = await coolQuery<{ cooCreateWardrobeItem: CooWardrobeItem }>(\n `mutation CooCreateWardrobeItem($input: CooCreateWardrobeItemInput!) {\n cooCreateWardrobeItem(input: $input) { ${WARDROBE_FIELDS} }\n }`,\n { input },\n apiGatewayUrl\n );\n return data.cooCreateWardrobeItem;\n },\n onSuccess: () => {\n void queryClient.invalidateQueries({ queryKey: [QK, 'wardrobe'] });\n },\n });\n};\n\nexport const useUpdateWardrobeItem = () => {\n const queryClient = useQueryClient();\n const { apiGatewayUrl } = useCoolAndLovely();\n return useMutation({\n mutationFn: async ({ id, input }: { id: string; input: CooUpdateWardrobeItemInput }) => {\n const data = await coolQuery<{ cooUpdateWardrobeItem: CooWardrobeItem }>(\n `mutation CooUpdateWardrobeItem($id: ID!, $input: CooUpdateWardrobeItemInput!) {\n cooUpdateWardrobeItem(id: $id, input: $input) { ${WARDROBE_FIELDS} }\n }`,\n { id, input },\n apiGatewayUrl\n );\n return data.cooUpdateWardrobeItem;\n },\n onSuccess: () => {\n void queryClient.invalidateQueries({ queryKey: [QK, 'wardrobe'] });\n },\n });\n};\n\nexport const useLogWardrobeWear = () => {\n const queryClient = useQueryClient();\n const { apiGatewayUrl } = useCoolAndLovely();\n return useMutation({\n mutationFn: async (id: string) => {\n const data = await coolQuery<{ cooLogWardrobeWear: CooWardrobeItem }>(\n `mutation CooLogWardrobeWear($id: ID!) {\n cooLogWardrobeWear(id: $id) { ${WARDROBE_FIELDS} }\n }`,\n { id },\n apiGatewayUrl\n );\n return data.cooLogWardrobeWear;\n },\n onSuccess: () => {\n void queryClient.invalidateQueries({ queryKey: [QK, 'wardrobe'] });\n },\n });\n};\n\nexport const useRemoveWardrobeItem = () => {\n const queryClient = useQueryClient();\n const { apiGatewayUrl } = useCoolAndLovely();\n return useMutation({\n mutationFn: async (id: string) => {\n const data = await coolQuery<{ cooRemoveWardrobeItem: boolean }>(\n `mutation CooRemoveWardrobeItem($id: ID!) { cooRemoveWardrobeItem(id: $id) }`,\n { id },\n apiGatewayUrl\n );\n return data.cooRemoveWardrobeItem;\n },\n onSuccess: () => {\n void queryClient.invalidateQueries({ queryKey: [QK, 'wardrobe'] });\n },\n });\n};\n\n// ===========================================================================\n// Style Profile (self-scoped)\n// ===========================================================================\n\nexport const useMyStyleProfile = () => {\n const { apiGatewayUrl } = useCoolAndLovely();\n return useQuery({\n queryKey: [QK, 'my-style-profile'],\n queryFn: async () => {\n const data = await coolQuery<{ cooMyStyleProfile: CooStyleProfile | null }>(\n `query CooMyStyleProfile { cooMyStyleProfile { ${PROFILE_FIELDS} } }`,\n {},\n apiGatewayUrl\n );\n return data.cooMyStyleProfile;\n },\n });\n};\n\nexport const useUpsertStyleProfile = () => {\n const queryClient = useQueryClient();\n const { apiGatewayUrl } = useCoolAndLovely();\n return useMutation({\n mutationFn: async (input: CooUpsertStyleProfileInput) => {\n const data = await coolQuery<{ cooUpsertStyleProfile: CooStyleProfile }>(\n `mutation CooUpsertStyleProfile($input: CooUpsertStyleProfileInput!) {\n cooUpsertStyleProfile(input: $input) { ${PROFILE_FIELDS} }\n }`,\n { input },\n apiGatewayUrl\n );\n return data.cooUpsertStyleProfile;\n },\n onSuccess: () => {\n void queryClient.invalidateQueries({ queryKey: [QK, 'my-style-profile'] });\n },\n });\n};\n\n// ===========================================================================\n// Lookbooks\n// ===========================================================================\n\nexport const useLookbooks = (ownerId?: string) => {\n const { apiGatewayUrl } = useCoolAndLovely();\n return useQuery({\n queryKey: [QK, 'lookbooks', ownerId],\n queryFn: async () => {\n const data = await coolQuery<{ cooListLookbooks: CooLookbook[] }>(\n `query CooListLookbooks($ownerId: ID) {\n cooListLookbooks(ownerId: $ownerId) { ${LOOKBOOK_FIELDS} }\n }`,\n { ownerId },\n apiGatewayUrl\n );\n return data.cooListLookbooks;\n },\n });\n};\n\nexport const useCreateLookbook = () => {\n const queryClient = useQueryClient();\n const { apiGatewayUrl } = useCoolAndLovely();\n return useMutation({\n mutationFn: async (input: CooCreateLookbookInput) => {\n const data = await coolQuery<{ cooCreateLookbook: CooLookbook }>(\n `mutation CooCreateLookbook($input: CooCreateLookbookInput!) {\n cooCreateLookbook(input: $input) { ${LOOKBOOK_FIELDS} }\n }`,\n { input },\n apiGatewayUrl\n );\n return data.cooCreateLookbook;\n },\n onSuccess: () => {\n void queryClient.invalidateQueries({ queryKey: [QK, 'lookbooks'] });\n },\n });\n};\n\nexport const useRemoveLookbookEntry = () => {\n const queryClient = useQueryClient();\n const { apiGatewayUrl } = useCoolAndLovely();\n return useMutation({\n mutationFn: async (id: string) => {\n const data = await coolQuery<{ cooRemoveLookbookEntry: boolean }>(\n `mutation CooRemoveLookbookEntry($id: ID!) { cooRemoveLookbookEntry(id: $id) }`,\n { id },\n apiGatewayUrl\n );\n return data.cooRemoveLookbookEntry;\n },\n onSuccess: () => {\n void queryClient.invalidateQueries({ queryKey: [QK, 'lookbook'] });\n },\n });\n};\n\nexport const useLookbook = (id: string | undefined) => {\n const { apiGatewayUrl } = useCoolAndLovely();\n return useQuery({\n queryKey: [QK, 'lookbook', id],\n queryFn: async () => {\n const data = await coolQuery<{ cooLookbook: CooLookbook | null }>(\n `query CooLookbook($id: ID!) {\n cooLookbook(id: $id) {\n ${LOOKBOOK_FIELDS}\n entries { id lookbookId lookId styleItemId note position createdAt updatedAt }\n }\n }`,\n { id },\n apiGatewayUrl\n );\n return data.cooLookbook;\n },\n enabled: Boolean(id),\n });\n};\n"],"mappings":";;;;;AAsDA,IAAM,IAAK,iBAML,IAAY,OAChB,GACA,GACA,MACmB;CACnB,IAAM,IAAW,MAAM,EAAoB;EACzC,SAAS;EACT;EACA;EACA;EACA,gBAAgB;EACjB,CAAC;AAEF,KAAI,EAAS,QAAQ,OACnB,OAAU,MAAM,EAAS,OAAO,IAAI,WAAW,yBAAyB;AAE1E,KAAI,CAAC,EAAS,KACZ,OAAU,MAAM,wCAAwC;AAE1D,QAAO,EAAS;GAOZ,IAAe,6IAKf,IAAoB,wHAKpB,IAAoB,qKAMpB,IAAc,0KAMd,IAAuB,+JAKvB,IAAkB,6JAKlB,IAAiB,iIAKjB,IAAkB,+GAeX,KAAa,IAAuB,EAAE,KAAK;CACtD,IAAM,EAAE,qBAAkB,GAAkB;AAC5C,QAAO,EAAS;EACd,UAAU;GAAC;GAAI;GA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;GAOS,KAAgB,MAAqB;CAChD,IAAM,EAAE,qBAAkB,GAAkB;AAC5C,QAAO,EAAS;EACd,UAAU;GAAC;GAAI;GAAa;GAAQ;EACpC,SAAS,aACM,MAAM,EACjB;kDAC0C,EAAgB;YAE1D,EAAE,YAAS,EACX,EACD,EACW;EAEf,CAAC;GAGS,UAA0B;CACrC,IAAM,IAAc,GAAgB,EAC9B,EAAE,qBAAkB,GAAkB;AAC5C,QAAO,EAAY;EACjB,YAAY,OAAO,OACJ,MAAM,EACjB;+CACuC,EAAgB;YAEvD,EAAE,UAAO,EACT,EACD,EACW;EAEd,iBAAiB;AACV,KAAY,kBAAkB,EAAE,UAAU,CAAC,GAAI,YAAY,EAAE,CAAC;;EAEtE,CAAC;GAGS,UAA+B;CAC1C,IAAM,IAAc,GAAgB,EAC9B,EAAE,qBAAkB,GAAkB;AAC5C,QAAO,EAAY;EACjB,YAAY,OAAO,OACJ,MAAM,EACjB,iFACA,EAAE,OAAI,EACN,EACD,EACW;EAEd,iBAAiB;AACV,KAAY,kBAAkB,EAAE,UAAU,CAAC,GAAI,WAAW,EAAE,CAAC;;EAErE,CAAC;GAGS,KAAe,MAA2B;CACrD,IAAM,EAAE,qBAAkB,GAAkB;AAC5C,QAAO,EAAS;EACd,UAAU;GAAC;GAAI;GAAY;GAAG;EAC9B,SAAS,aACM,MAAM,EACjB;;cAEM,EAAgB;;;YAItB,EAAE,OAAI,EACN,EACD,EACW;EAEd,SAAS,EAAQ;EAClB,CAAC"}
|
|
1
|
+
{"version":3,"file":"useCoolAndLovelyApi.js","names":[],"sources":["../../../src/coolandlovely/hooks/useCoolAndLovelyApi.ts"],"sourcesContent":["/**\n * CoolAndLovely API hooks\n * @module coolandlovely/hooks\n *\n * Thin, strictly-typed React Query layer over the federated\n * `wspace-coolandlovely-svc` GraphQL contract. Every query/mutation here maps\n * 1:1 to a real `coo*` root field — no mocks. Requests go through the workspace\n * gateway via `graphqlFetch({ gateway: 'workspace', workspaceToken: true })`.\n */\n\nimport { useMutation, useQuery, useQueryClient } from '@tanstack/react-query';\n\nimport { graphqlFetch } from '@burdenoff/fe-libs/shared/graphql';\n// Imported from the `/fetch` subpath (not the barrel) so it resolves against the\n// MFE's pinned fe-libs, which exposes the helper in fetch but not yet in the\n// graphql barrel index.\nimport { clearGraphqlFetchResponseCache } from '@burdenoff/fe-libs/shared/graphql/fetch';\n\nimport { useCoolAndLovely } from '../context';\nimport type {\n CooBrand,\n CooBrandConnection,\n CooBrandStatus,\n CooCollaboration,\n CooCollaborationStatus,\n CooCollection,\n CooCollectionStatus,\n CooCreateBrandInput,\n CooCreateCollaborationInput,\n CooCreateCollectionInput,\n CooCreateLookInput,\n CooCreateLookbookInput,\n CooCreateStyleItemInput,\n CooCreateWardrobeItemInput,\n CooLook,\n CooLookConnection,\n CooLookOccasion,\n CooLookbook,\n CooStyleCategory,\n CooStyleItem,\n CooStyleItemConnection,\n CooStyleItemStatus,\n CooStyleProfile,\n CooUpdateBrandInput,\n CooUpdateCollectionInput,\n CooUpdateLookInput,\n CooUpdateStyleItemInput,\n CooUpdateWardrobeItemInput,\n CooUpsertStyleProfileInput,\n CooWardrobeItem,\n CooWardrobeSource,\n PaginationInput,\n} from '../types';\n\n// ---------------------------------------------------------------------------\n// Query key root\n// ---------------------------------------------------------------------------\n\nconst QK = 'coolandlovely';\n\n// ---------------------------------------------------------------------------\n// Low-level fetch wrapper\n// ---------------------------------------------------------------------------\n\nconst coolQuery = async <TData>(\n query: string,\n variables: Record<string, unknown>,\n baseUrl?: string\n): Promise<TData> => {\n const response = await graphqlFetch<TData>({\n gateway: 'workspace',\n baseUrl,\n query,\n variables,\n workspaceToken: true,\n });\n\n if (response.errors?.length) {\n throw new Error(response.errors[0]?.message ?? 'GraphQL request failed');\n }\n if (!response.data) {\n throw new Error('GraphQL response did not include data');\n }\n // fe-libs graphqlFetch caches every *query* response for ~15s in a global\n // response cache. After a successful mutation we drop that cache so the\n // React Query `invalidateQueries` refetch reads fresh data instead of the\n // stale pre-mutation response (otherwise a like/publish/transition/remove\n // shows no change for up to 15s).\n if (/^\\s*mutation\\b/.test(query)) {\n clearGraphqlFetchResponseCache();\n }\n return response.data;\n};\n\n// ---------------------------------------------------------------------------\n// Reusable GraphQL field selections\n// ---------------------------------------------------------------------------\n\nconst BRAND_FIELDS = `\n id workspaceId name handle tagline bio aesthetics tags websiteUrl\n isFeatured status logo { id } cover { id } createdAt updatedAt\n`;\n\nconst COLLECTION_FIELDS = `\n id workspaceId brandId name description season status tags\n cover { id } publishAt endAt createdAt updatedAt\n`;\n\nconst STYLE_ITEM_FIELDS = `\n id workspaceId brandId collectionId name description category status\n sku price currency colours sizes materials tags image { id }\n createdAt updatedAt\n`;\n\nconst LOOK_FIELDS = `\n id workspaceId authorId title caption occasion visibility isFeatured\n likeCount saveCount collaborationId image { id } tags publishedAt\n createdAt updatedAt\n`;\n\nconst COLLABORATION_FIELDS = `\n id workspaceId brandId creatorId collectionId title brief role status\n compensation currency tags startDate endDate publishedAt createdAt updatedAt\n`;\n\nconst WARDROBE_FIELDS = `\n id workspaceId profileId name category source brandName colour size notes\n styleItemId timesWorn lastWornAt tags image { id } createdAt updatedAt\n`;\n\nconst PROFILE_FIELDS = `\n id workspaceId ownerId displayName bio visibility stylePreferences\n palette favouriteBrands sizes createdAt updatedAt\n`;\n\nconst LOOKBOOK_FIELDS = `\n id workspaceId ownerId profileId name description visibility tags\n cover { id } createdAt updatedAt\n`;\n\n// ===========================================================================\n// Brands\n// ===========================================================================\n\nexport interface ListBrandsArgs {\n status?: CooBrandStatus;\n featured?: boolean;\n pagination?: PaginationInput;\n}\n\nexport const useBrands = (args: ListBrandsArgs = {}) => {\n const { apiGatewayUrl } = useCoolAndLovely();\n return useQuery({\n queryKey: [QK, 'brands', args],\n queryFn: async () => {\n const data = await coolQuery<{ cooListBrands: CooBrandConnection }>(\n `query CooListBrands($status: CooBrandStatus, $featured: Boolean, $pagination: PaginationInput) {\n cooListBrands(status: $status, featured: $featured, pagination: $pagination) {\n items { ${BRAND_FIELDS} }\n pageInfo { cursor hasMore }\n }\n }`,\n {\n status: args.status,\n featured: args.featured,\n pagination: args.pagination ?? { limit: 50, offset: 0 },\n },\n apiGatewayUrl\n );\n return data.cooListBrands;\n },\n });\n};\n\nexport const useBrand = (id: string | undefined) => {\n const { apiGatewayUrl } = useCoolAndLovely();\n return useQuery({\n queryKey: [QK, 'brand', id],\n queryFn: async () => {\n const data = await coolQuery<{ cooBrand: CooBrand | null }>(\n `query CooBrand($id: ID!) {\n cooBrand(id: $id) {\n ${BRAND_FIELDS}\n collections { ${COLLECTION_FIELDS} }\n items { ${STYLE_ITEM_FIELDS} }\n }\n }`,\n { id },\n apiGatewayUrl\n );\n return data.cooBrand;\n },\n enabled: Boolean(id),\n });\n};\n\nexport const useCreateBrand = () => {\n const queryClient = useQueryClient();\n const { apiGatewayUrl } = useCoolAndLovely();\n return useMutation({\n mutationFn: async (input: CooCreateBrandInput) => {\n const data = await coolQuery<{ cooCreateBrand: CooBrand }>(\n `mutation CooCreateBrand($input: CooCreateBrandInput!) {\n cooCreateBrand(input: $input) { ${BRAND_FIELDS} }\n }`,\n { input },\n apiGatewayUrl\n );\n return data.cooCreateBrand;\n },\n onSuccess: () => {\n void queryClient.invalidateQueries({ queryKey: [QK, 'brands'] });\n },\n });\n};\n\nexport const useUpdateBrand = () => {\n const queryClient = useQueryClient();\n const { apiGatewayUrl } = useCoolAndLovely();\n return useMutation({\n mutationFn: async ({ id, input }: { id: string; input: CooUpdateBrandInput }) => {\n const data = await coolQuery<{ cooUpdateBrand: CooBrand }>(\n `mutation CooUpdateBrand($id: ID!, $input: CooUpdateBrandInput!) {\n cooUpdateBrand(id: $id, input: $input) { ${BRAND_FIELDS} }\n }`,\n { id, input },\n apiGatewayUrl\n );\n return data.cooUpdateBrand;\n },\n onSuccess: (brand) => {\n void queryClient.invalidateQueries({ queryKey: [QK, 'brands'] });\n void queryClient.invalidateQueries({ queryKey: [QK, 'brand', brand.id] });\n },\n });\n};\n\nexport const useTransitionBrand = () => {\n const queryClient = useQueryClient();\n const { apiGatewayUrl } = useCoolAndLovely();\n return useMutation({\n mutationFn: async ({ id, status }: { id: string; status: CooBrandStatus }) => {\n const data = await coolQuery<{ cooTransitionBrand: CooBrand }>(\n `mutation CooTransitionBrand($id: ID!, $status: CooBrandStatus!) {\n cooTransitionBrand(id: $id, status: $status) { ${BRAND_FIELDS} }\n }`,\n { id, status },\n apiGatewayUrl\n );\n return data.cooTransitionBrand;\n },\n onSuccess: (brand) => {\n void queryClient.invalidateQueries({ queryKey: [QK, 'brands'] });\n void queryClient.invalidateQueries({ queryKey: [QK, 'brand', brand.id] });\n },\n });\n};\n\nexport const useArchiveBrand = () => {\n const queryClient = useQueryClient();\n const { apiGatewayUrl } = useCoolAndLovely();\n return useMutation({\n mutationFn: async (id: string) => {\n const data = await coolQuery<{ cooArchiveBrand: boolean }>(\n `mutation CooArchiveBrand($id: ID!) { cooArchiveBrand(id: $id) }`,\n { id },\n apiGatewayUrl\n );\n return data.cooArchiveBrand;\n },\n onSuccess: () => {\n void queryClient.invalidateQueries({ queryKey: [QK, 'brands'] });\n },\n });\n};\n\n// ===========================================================================\n// Collections\n// ===========================================================================\n\nexport interface ListCollectionsArgs {\n brandId?: string;\n status?: CooCollectionStatus;\n}\n\nexport const useCollections = (args: ListCollectionsArgs = {}) => {\n const { apiGatewayUrl } = useCoolAndLovely();\n return useQuery({\n queryKey: [QK, 'collections', args],\n queryFn: async () => {\n const data = await coolQuery<{ cooListCollections: CooCollection[] }>(\n `query CooListCollections($brandId: ID, $status: CooCollectionStatus) {\n cooListCollections(brandId: $brandId, status: $status) {\n ${COLLECTION_FIELDS}\n brand { id name handle }\n }\n }`,\n { brandId: args.brandId, status: args.status },\n apiGatewayUrl\n );\n return data.cooListCollections;\n },\n });\n};\n\nexport const useCollection = (id: string | undefined) => {\n const { apiGatewayUrl } = useCoolAndLovely();\n return useQuery({\n queryKey: [QK, 'collection', id],\n queryFn: async () => {\n const data = await coolQuery<{ cooCollection: CooCollection | null }>(\n `query CooCollection($id: ID!) {\n cooCollection(id: $id) {\n ${COLLECTION_FIELDS}\n brand { id name handle }\n items { ${STYLE_ITEM_FIELDS} }\n }\n }`,\n { id },\n apiGatewayUrl\n );\n return data.cooCollection;\n },\n enabled: Boolean(id),\n });\n};\n\nexport const useCreateCollection = () => {\n const queryClient = useQueryClient();\n const { apiGatewayUrl } = useCoolAndLovely();\n return useMutation({\n mutationFn: async (input: CooCreateCollectionInput) => {\n const data = await coolQuery<{ cooCreateCollection: CooCollection }>(\n `mutation CooCreateCollection($input: CooCreateCollectionInput!) {\n cooCreateCollection(input: $input) { ${COLLECTION_FIELDS} }\n }`,\n { input },\n apiGatewayUrl\n );\n return data.cooCreateCollection;\n },\n onSuccess: () => {\n void queryClient.invalidateQueries({ queryKey: [QK, 'collections'] });\n },\n });\n};\n\nexport const useUpdateCollection = () => {\n const queryClient = useQueryClient();\n const { apiGatewayUrl } = useCoolAndLovely();\n return useMutation({\n mutationFn: async ({ id, input }: { id: string; input: CooUpdateCollectionInput }) => {\n const data = await coolQuery<{ cooUpdateCollection: CooCollection }>(\n `mutation CooUpdateCollection($id: ID!, $input: CooUpdateCollectionInput!) {\n cooUpdateCollection(id: $id, input: $input) { ${COLLECTION_FIELDS} }\n }`,\n { id, input },\n apiGatewayUrl\n );\n return data.cooUpdateCollection;\n },\n onSuccess: (collection) => {\n void queryClient.invalidateQueries({ queryKey: [QK, 'collections'] });\n void queryClient.invalidateQueries({ queryKey: [QK, 'collection', collection.id] });\n },\n });\n};\n\nexport const usePublishCollection = () => {\n const queryClient = useQueryClient();\n const { apiGatewayUrl } = useCoolAndLovely();\n return useMutation({\n mutationFn: async (id: string) => {\n const data = await coolQuery<{ cooPublishCollection: CooCollection }>(\n `mutation CooPublishCollection($id: ID!) {\n cooPublishCollection(id: $id) { ${COLLECTION_FIELDS} }\n }`,\n { id },\n apiGatewayUrl\n );\n return data.cooPublishCollection;\n },\n onSuccess: (collection) => {\n void queryClient.invalidateQueries({ queryKey: [QK, 'collections'] });\n void queryClient.invalidateQueries({ queryKey: [QK, 'collection', collection.id] });\n },\n });\n};\n\n// ===========================================================================\n// Style Items\n// ===========================================================================\n\nexport interface ListStyleItemsArgs {\n brandId?: string;\n collectionId?: string;\n category?: CooStyleCategory;\n status?: CooStyleItemStatus;\n pagination?: PaginationInput;\n}\n\nexport const useStyleItems = (args: ListStyleItemsArgs = {}) => {\n const { apiGatewayUrl } = useCoolAndLovely();\n return useQuery({\n queryKey: [QK, 'style-items', args],\n queryFn: async () => {\n const data = await coolQuery<{ cooListStyleItems: CooStyleItemConnection }>(\n `query CooListStyleItems(\n $brandId: ID, $collectionId: ID, $category: CooStyleCategory,\n $status: CooStyleItemStatus, $pagination: PaginationInput\n ) {\n cooListStyleItems(\n brandId: $brandId, collectionId: $collectionId, category: $category,\n status: $status, pagination: $pagination\n ) {\n items { ${STYLE_ITEM_FIELDS} brand { id name handle } }\n pageInfo { cursor hasMore }\n }\n }`,\n {\n brandId: args.brandId,\n collectionId: args.collectionId,\n category: args.category,\n status: args.status,\n pagination: args.pagination ?? { limit: 50, offset: 0 },\n },\n apiGatewayUrl\n );\n return data.cooListStyleItems;\n },\n });\n};\n\nexport const useStyleItem = (id: string | undefined) => {\n const { apiGatewayUrl } = useCoolAndLovely();\n return useQuery({\n queryKey: [QK, 'style-item', id],\n queryFn: async () => {\n const data = await coolQuery<{ cooStyleItem: CooStyleItem | null }>(\n `query CooStyleItem($id: ID!) {\n cooStyleItem(id: $id) {\n ${STYLE_ITEM_FIELDS}\n brand { id name handle }\n collection { id name }\n }\n }`,\n { id },\n apiGatewayUrl\n );\n return data.cooStyleItem;\n },\n enabled: Boolean(id),\n });\n};\n\nexport const useCreateStyleItem = () => {\n const queryClient = useQueryClient();\n const { apiGatewayUrl } = useCoolAndLovely();\n return useMutation({\n mutationFn: async (input: CooCreateStyleItemInput) => {\n const data = await coolQuery<{ cooCreateStyleItem: CooStyleItem }>(\n `mutation CooCreateStyleItem($input: CooCreateStyleItemInput!) {\n cooCreateStyleItem(input: $input) { ${STYLE_ITEM_FIELDS} }\n }`,\n { input },\n apiGatewayUrl\n );\n return data.cooCreateStyleItem;\n },\n onSuccess: () => {\n void queryClient.invalidateQueries({ queryKey: [QK, 'style-items'] });\n },\n });\n};\n\nexport const useUpdateStyleItem = () => {\n const queryClient = useQueryClient();\n const { apiGatewayUrl } = useCoolAndLovely();\n return useMutation({\n mutationFn: async ({ id, input }: { id: string; input: CooUpdateStyleItemInput }) => {\n const data = await coolQuery<{ cooUpdateStyleItem: CooStyleItem }>(\n `mutation CooUpdateStyleItem($id: ID!, $input: CooUpdateStyleItemInput!) {\n cooUpdateStyleItem(id: $id, input: $input) { ${STYLE_ITEM_FIELDS} }\n }`,\n { id, input },\n apiGatewayUrl\n );\n return data.cooUpdateStyleItem;\n },\n onSuccess: (item) => {\n void queryClient.invalidateQueries({ queryKey: [QK, 'style-items'] });\n void queryClient.invalidateQueries({ queryKey: [QK, 'style-item', item.id] });\n },\n });\n};\n\nexport const useArchiveStyleItem = () => {\n const queryClient = useQueryClient();\n const { apiGatewayUrl } = useCoolAndLovely();\n return useMutation({\n mutationFn: async (id: string) => {\n const data = await coolQuery<{ cooArchiveStyleItem: boolean }>(\n `mutation CooArchiveStyleItem($id: ID!) { cooArchiveStyleItem(id: $id) }`,\n { id },\n apiGatewayUrl\n );\n return data.cooArchiveStyleItem;\n },\n onSuccess: () => {\n void queryClient.invalidateQueries({ queryKey: [QK, 'style-items'] });\n },\n });\n};\n\n// ===========================================================================\n// Looks\n// ===========================================================================\n\nexport interface ListLooksArgs {\n authorId?: string;\n occasion?: CooLookOccasion;\n featured?: boolean;\n pagination?: PaginationInput;\n}\n\nexport const useLooks = (args: ListLooksArgs = {}) => {\n const { apiGatewayUrl } = useCoolAndLovely();\n return useQuery({\n queryKey: [QK, 'looks', args],\n queryFn: async () => {\n const data = await coolQuery<{ cooListLooks: CooLookConnection }>(\n `query CooListLooks(\n $authorId: ID, $occasion: CooLookOccasion, $featured: Boolean, $pagination: PaginationInput\n ) {\n cooListLooks(authorId: $authorId, occasion: $occasion, featured: $featured, pagination: $pagination) {\n items { ${LOOK_FIELDS} }\n pageInfo { cursor hasMore }\n }\n }`,\n {\n authorId: args.authorId,\n occasion: args.occasion,\n featured: args.featured,\n pagination: args.pagination ?? { limit: 50, offset: 0 },\n },\n apiGatewayUrl\n );\n return data.cooListLooks;\n },\n });\n};\n\nexport const useLook = (id: string | undefined) => {\n const { apiGatewayUrl } = useCoolAndLovely();\n return useQuery({\n queryKey: [QK, 'look', id],\n queryFn: async () => {\n const data = await coolQuery<{ cooLook: CooLook | null }>(\n `query CooLook($id: ID!) {\n cooLook(id: $id) {\n ${LOOK_FIELDS}\n items {\n id lookId styleItemId position styling\n styleItem { id name category price currency }\n }\n }\n }`,\n { id },\n apiGatewayUrl\n );\n return data.cooLook;\n },\n enabled: Boolean(id),\n });\n};\n\nexport const useCreateLook = () => {\n const queryClient = useQueryClient();\n const { apiGatewayUrl } = useCoolAndLovely();\n return useMutation({\n mutationFn: async (input: CooCreateLookInput) => {\n const data = await coolQuery<{ cooCreateLook: CooLook }>(\n `mutation CooCreateLook($input: CooCreateLookInput!) {\n cooCreateLook(input: $input) { ${LOOK_FIELDS} }\n }`,\n { input },\n apiGatewayUrl\n );\n return data.cooCreateLook;\n },\n onSuccess: () => {\n void queryClient.invalidateQueries({ queryKey: [QK, 'looks'] });\n },\n });\n};\n\nexport const useUpdateLook = () => {\n const queryClient = useQueryClient();\n const { apiGatewayUrl } = useCoolAndLovely();\n return useMutation({\n mutationFn: async ({ id, input }: { id: string; input: CooUpdateLookInput }) => {\n const data = await coolQuery<{ cooUpdateLook: CooLook }>(\n `mutation CooUpdateLook($id: ID!, $input: CooUpdateLookInput!) {\n cooUpdateLook(id: $id, input: $input) { ${LOOK_FIELDS} }\n }`,\n { id, input },\n apiGatewayUrl\n );\n return data.cooUpdateLook;\n },\n onSuccess: (look) => {\n void queryClient.invalidateQueries({ queryKey: [QK, 'looks'] });\n void queryClient.invalidateQueries({ queryKey: [QK, 'look', look.id] });\n },\n });\n};\n\nexport const usePublishLook = () => {\n const queryClient = useQueryClient();\n const { apiGatewayUrl } = useCoolAndLovely();\n return useMutation({\n mutationFn: async (id: string) => {\n const data = await coolQuery<{ cooPublishLook: CooLook }>(\n `mutation CooPublishLook($id: ID!) { cooPublishLook(id: $id) { ${LOOK_FIELDS} } }`,\n { id },\n apiGatewayUrl\n );\n return data.cooPublishLook;\n },\n onSuccess: (look) => {\n void queryClient.invalidateQueries({ queryKey: [QK, 'looks'] });\n void queryClient.invalidateQueries({ queryKey: [QK, 'look', look.id] });\n },\n });\n};\n\nexport const useLikeLook = () => {\n const queryClient = useQueryClient();\n const { apiGatewayUrl } = useCoolAndLovely();\n return useMutation({\n mutationFn: async (id: string) => {\n const data = await coolQuery<{ cooLikeLook: CooLook }>(\n `mutation CooLikeLook($id: ID!) { cooLikeLook(id: $id) { ${LOOK_FIELDS} } }`,\n { id },\n apiGatewayUrl\n );\n return data.cooLikeLook;\n },\n onSuccess: (look) => {\n void queryClient.invalidateQueries({ queryKey: [QK, 'looks'] });\n void queryClient.invalidateQueries({ queryKey: [QK, 'look', look.id] });\n },\n });\n};\n\nexport const useDeleteLook = () => {\n const queryClient = useQueryClient();\n const { apiGatewayUrl } = useCoolAndLovely();\n return useMutation({\n mutationFn: async (id: string) => {\n const data = await coolQuery<{ cooDeleteLook: boolean }>(\n `mutation CooDeleteLook($id: ID!) { cooDeleteLook(id: $id) }`,\n { id },\n apiGatewayUrl\n );\n return data.cooDeleteLook;\n },\n onSuccess: () => {\n void queryClient.invalidateQueries({ queryKey: [QK, 'looks'] });\n },\n });\n};\n\n// ===========================================================================\n// Collaborations\n// ===========================================================================\n\nexport interface ListCollaborationsArgs {\n brandId?: string;\n creatorId?: string;\n status?: CooCollaborationStatus;\n}\n\nexport const useCollaborations = (args: ListCollaborationsArgs = {}) => {\n const { apiGatewayUrl } = useCoolAndLovely();\n return useQuery({\n queryKey: [QK, 'collaborations', args],\n queryFn: async () => {\n const data = await coolQuery<{ cooListCollaborations: CooCollaboration[] }>(\n `query CooListCollaborations($brandId: ID, $creatorId: ID, $status: CooCollaborationStatus) {\n cooListCollaborations(brandId: $brandId, creatorId: $creatorId, status: $status) {\n ${COLLABORATION_FIELDS}\n brand { id name handle }\n }\n }`,\n { brandId: args.brandId, creatorId: args.creatorId, status: args.status },\n apiGatewayUrl\n );\n return data.cooListCollaborations;\n },\n });\n};\n\nexport const useCollaboration = (id: string | undefined) => {\n const { apiGatewayUrl } = useCoolAndLovely();\n return useQuery({\n queryKey: [QK, 'collaboration', id],\n queryFn: async () => {\n const data = await coolQuery<{ cooCollaboration: CooCollaboration | null }>(\n `query CooCollaboration($id: ID!) {\n cooCollaboration(id: $id) {\n ${COLLABORATION_FIELDS}\n brand { id name handle }\n looks { ${LOOK_FIELDS} }\n }\n }`,\n { id },\n apiGatewayUrl\n );\n return data.cooCollaboration;\n },\n enabled: Boolean(id),\n });\n};\n\nexport const useCreateCollaboration = () => {\n const queryClient = useQueryClient();\n const { apiGatewayUrl } = useCoolAndLovely();\n return useMutation({\n mutationFn: async (input: CooCreateCollaborationInput) => {\n const data = await coolQuery<{ cooCreateCollaboration: CooCollaboration }>(\n `mutation CooCreateCollaboration($input: CooCreateCollaborationInput!) {\n cooCreateCollaboration(input: $input) { ${COLLABORATION_FIELDS} }\n }`,\n { input },\n apiGatewayUrl\n );\n return data.cooCreateCollaboration;\n },\n onSuccess: () => {\n void queryClient.invalidateQueries({ queryKey: [QK, 'collaborations'] });\n },\n });\n};\n\nexport const useTransitionCollaboration = () => {\n const queryClient = useQueryClient();\n const { apiGatewayUrl } = useCoolAndLovely();\n return useMutation({\n mutationFn: async ({ id, status }: { id: string; status: CooCollaborationStatus }) => {\n const data = await coolQuery<{ cooTransitionCollaboration: CooCollaboration }>(\n `mutation CooTransitionCollaboration($id: ID!, $status: CooCollaborationStatus!) {\n cooTransitionCollaboration(id: $id, status: $status) { ${COLLABORATION_FIELDS} }\n }`,\n { id, status },\n apiGatewayUrl\n );\n return data.cooTransitionCollaboration;\n },\n onSuccess: (collab) => {\n void queryClient.invalidateQueries({ queryKey: [QK, 'collaborations'] });\n void queryClient.invalidateQueries({ queryKey: [QK, 'collaboration', collab.id] });\n },\n });\n};\n\n// ===========================================================================\n// Wardrobe (self-scoped)\n// ===========================================================================\n\nexport interface ListWardrobeArgs {\n category?: CooStyleCategory;\n source?: CooWardrobeSource;\n}\n\nexport const useWardrobeItems = (args: ListWardrobeArgs = {}) => {\n const { apiGatewayUrl } = useCoolAndLovely();\n return useQuery({\n queryKey: [QK, 'wardrobe', args],\n queryFn: async () => {\n const data = await coolQuery<{ cooListWardrobeItems: CooWardrobeItem[] }>(\n `query CooListWardrobeItems($category: CooStyleCategory, $source: CooWardrobeSource) {\n cooListWardrobeItems(category: $category, source: $source) { ${WARDROBE_FIELDS} }\n }`,\n { category: args.category, source: args.source },\n apiGatewayUrl\n );\n return data.cooListWardrobeItems;\n },\n });\n};\n\nexport const useCreateWardrobeItem = () => {\n const queryClient = useQueryClient();\n const { apiGatewayUrl } = useCoolAndLovely();\n return useMutation({\n mutationFn: async (input: CooCreateWardrobeItemInput) => {\n const data = await coolQuery<{ cooCreateWardrobeItem: CooWardrobeItem }>(\n `mutation CooCreateWardrobeItem($input: CooCreateWardrobeItemInput!) {\n cooCreateWardrobeItem(input: $input) { ${WARDROBE_FIELDS} }\n }`,\n { input },\n apiGatewayUrl\n );\n return data.cooCreateWardrobeItem;\n },\n onSuccess: () => {\n void queryClient.invalidateQueries({ queryKey: [QK, 'wardrobe'] });\n },\n });\n};\n\nexport const useUpdateWardrobeItem = () => {\n const queryClient = useQueryClient();\n const { apiGatewayUrl } = useCoolAndLovely();\n return useMutation({\n mutationFn: async ({ id, input }: { id: string; input: CooUpdateWardrobeItemInput }) => {\n const data = await coolQuery<{ cooUpdateWardrobeItem: CooWardrobeItem }>(\n `mutation CooUpdateWardrobeItem($id: ID!, $input: CooUpdateWardrobeItemInput!) {\n cooUpdateWardrobeItem(id: $id, input: $input) { ${WARDROBE_FIELDS} }\n }`,\n { id, input },\n apiGatewayUrl\n );\n return data.cooUpdateWardrobeItem;\n },\n onSuccess: () => {\n void queryClient.invalidateQueries({ queryKey: [QK, 'wardrobe'] });\n },\n });\n};\n\nexport const useLogWardrobeWear = () => {\n const queryClient = useQueryClient();\n const { apiGatewayUrl } = useCoolAndLovely();\n return useMutation({\n mutationFn: async (id: string) => {\n const data = await coolQuery<{ cooLogWardrobeWear: CooWardrobeItem }>(\n `mutation CooLogWardrobeWear($id: ID!) {\n cooLogWardrobeWear(id: $id) { ${WARDROBE_FIELDS} }\n }`,\n { id },\n apiGatewayUrl\n );\n return data.cooLogWardrobeWear;\n },\n onSuccess: () => {\n void queryClient.invalidateQueries({ queryKey: [QK, 'wardrobe'] });\n },\n });\n};\n\nexport const useRemoveWardrobeItem = () => {\n const queryClient = useQueryClient();\n const { apiGatewayUrl } = useCoolAndLovely();\n return useMutation({\n mutationFn: async (id: string) => {\n const data = await coolQuery<{ cooRemoveWardrobeItem: boolean }>(\n `mutation CooRemoveWardrobeItem($id: ID!) { cooRemoveWardrobeItem(id: $id) }`,\n { id },\n apiGatewayUrl\n );\n return data.cooRemoveWardrobeItem;\n },\n onSuccess: () => {\n void queryClient.invalidateQueries({ queryKey: [QK, 'wardrobe'] });\n },\n });\n};\n\n// ===========================================================================\n// Style Profile (self-scoped)\n// ===========================================================================\n\nexport const useMyStyleProfile = () => {\n const { apiGatewayUrl } = useCoolAndLovely();\n return useQuery({\n queryKey: [QK, 'my-style-profile'],\n queryFn: async () => {\n const data = await coolQuery<{ cooMyStyleProfile: CooStyleProfile | null }>(\n `query CooMyStyleProfile { cooMyStyleProfile { ${PROFILE_FIELDS} } }`,\n {},\n apiGatewayUrl\n );\n return data.cooMyStyleProfile;\n },\n });\n};\n\nexport const useUpsertStyleProfile = () => {\n const queryClient = useQueryClient();\n const { apiGatewayUrl } = useCoolAndLovely();\n return useMutation({\n mutationFn: async (input: CooUpsertStyleProfileInput) => {\n const data = await coolQuery<{ cooUpsertStyleProfile: CooStyleProfile }>(\n `mutation CooUpsertStyleProfile($input: CooUpsertStyleProfileInput!) {\n cooUpsertStyleProfile(input: $input) { ${PROFILE_FIELDS} }\n }`,\n { input },\n apiGatewayUrl\n );\n return data.cooUpsertStyleProfile;\n },\n onSuccess: () => {\n void queryClient.invalidateQueries({ queryKey: [QK, 'my-style-profile'] });\n },\n });\n};\n\n// ===========================================================================\n// Lookbooks\n// ===========================================================================\n\nexport const useLookbooks = (ownerId?: string) => {\n const { apiGatewayUrl } = useCoolAndLovely();\n return useQuery({\n queryKey: [QK, 'lookbooks', ownerId],\n queryFn: async () => {\n const data = await coolQuery<{ cooListLookbooks: CooLookbook[] }>(\n `query CooListLookbooks($ownerId: ID) {\n cooListLookbooks(ownerId: $ownerId) { ${LOOKBOOK_FIELDS} }\n }`,\n { ownerId },\n apiGatewayUrl\n );\n return data.cooListLookbooks;\n },\n });\n};\n\nexport const useCreateLookbook = () => {\n const queryClient = useQueryClient();\n const { apiGatewayUrl } = useCoolAndLovely();\n return useMutation({\n mutationFn: async (input: CooCreateLookbookInput) => {\n const data = await coolQuery<{ cooCreateLookbook: CooLookbook }>(\n `mutation CooCreateLookbook($input: CooCreateLookbookInput!) {\n cooCreateLookbook(input: $input) { ${LOOKBOOK_FIELDS} }\n }`,\n { input },\n apiGatewayUrl\n );\n return data.cooCreateLookbook;\n },\n onSuccess: () => {\n void queryClient.invalidateQueries({ queryKey: [QK, 'lookbooks'] });\n },\n });\n};\n\nexport const useRemoveLookbookEntry = () => {\n const queryClient = useQueryClient();\n const { apiGatewayUrl } = useCoolAndLovely();\n return useMutation({\n mutationFn: async (id: string) => {\n const data = await coolQuery<{ cooRemoveLookbookEntry: boolean }>(\n `mutation CooRemoveLookbookEntry($id: ID!) { cooRemoveLookbookEntry(id: $id) }`,\n { id },\n apiGatewayUrl\n );\n return data.cooRemoveLookbookEntry;\n },\n onSuccess: () => {\n void queryClient.invalidateQueries({ queryKey: [QK, 'lookbook'] });\n },\n });\n};\n\nexport const useLookbook = (id: string | undefined) => {\n const { apiGatewayUrl } = useCoolAndLovely();\n return useQuery({\n queryKey: [QK, 'lookbook', id],\n queryFn: async () => {\n const data = await coolQuery<{ cooLookbook: CooLookbook | null }>(\n `query CooLookbook($id: ID!) {\n cooLookbook(id: $id) {\n ${LOOKBOOK_FIELDS}\n entries { id lookbookId lookId styleItemId note position createdAt updatedAt }\n }\n }`,\n { id },\n apiGatewayUrl\n );\n return data.cooLookbook;\n },\n enabled: Boolean(id),\n });\n};\n"],"mappings":";;;;;;AA0DA,IAAM,IAAK,iBAML,IAAY,OAChB,GACA,GACA,MACmB;CACnB,IAAM,IAAW,MAAM,EAAoB;EACzC,SAAS;EACT;EACA;EACA;EACA,gBAAgB;EACjB,CAAC;AAEF,KAAI,EAAS,QAAQ,OACnB,OAAU,MAAM,EAAS,OAAO,IAAI,WAAW,yBAAyB;AAE1E,KAAI,CAAC,EAAS,KACZ,OAAU,MAAM,wCAAwC;AAU1D,QAHI,iBAAiB,KAAK,EAAM,IAC9B,GAAgC,EAE3B,EAAS;GAOZ,IAAe,6IAKf,IAAoB,wHAKpB,IAAoB,qKAMpB,IAAc,0KAMd,IAAuB,+JAKvB,IAAkB,6JAKlB,IAAiB,iIAKjB,IAAkB,+GAeX,KAAa,IAAuB,EAAE,KAAK;CACtD,IAAM,EAAE,qBAAkB,GAAkB;AAC5C,QAAO,EAAS;EACd,UAAU;GAAC;GAAI;GAAU;GAAK;EAC9B,SAAS,aACM,MAAM,EACjB;;sBAEc,EAAa;;;YAI3B;GACE,QAAQ,EAAK;GACb,UAAU,EAAK;GACf,YAAY,EAAK,cAAc;IAAE,OAAO;IAAI,QAAQ;IAAG;GACxD,EACD,EACD,EACW;EAEf,CAAC;GAGS,KAAY,MAA2B;CAClD,IAAM,EAAE,qBAAkB,GAAkB;AAC5C,QAAO,EAAS;EACd,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AAkB;AAC5C,QAAO,EAAY;EACjB,YAAY,OAAO,OACJ,MAAM,EACjB;+CACuC,EAAgB;YAEvD,EAAE,UAAO,EACT,EACD,EACW;EAEd,iBAAiB;AACV,KAAY,kBAAkB,EAAE,UAAU,CAAC,GAAI,YAAY,EAAE,CAAC;;EAEtE,CAAC;GAGS,UAA+B;CAC1C,IAAM,IAAc,GAAgB,EAC9B,EAAE,qBAAkB,GAAkB;AAC5C,QAAO,EAAY;EACjB,YAAY,OAAO,OACJ,MAAM,EACjB,iFACA,EAAE,OAAI,EACN,EACD,EACW;EAEd,iBAAiB;AACV,KAAY,kBAAkB,EAAE,UAAU,CAAC,GAAI,WAAW,EAAE,CAAC;;EAErE,CAAC;GAGS,KAAe,MAA2B;CACrD,IAAM,EAAE,qBAAkB,GAAkB;AAC5C,QAAO,EAAS;EACd,UAAU;GAAC;GAAI;GAAY;GAAG;EAC9B,SAAS,aACM,MAAM,EACjB;;cAEM,EAAgB;;;YAItB,EAAE,OAAI,EACN,EACD,EACW;EAEd,SAAS,EAAQ;EAClB,CAAC"}
|
|
@@ -98,7 +98,7 @@ function x() {
|
|
|
98
98
|
children: "Storefront details"
|
|
99
99
|
}), /* @__PURE__ */ _("p", {
|
|
100
100
|
className: "text-xs text-text-secondary",
|
|
101
|
-
children: "
|
|
101
|
+
children: "Name your storefront and tell shoppers what your brand stands for."
|
|
102
102
|
})] })]
|
|
103
103
|
}),
|
|
104
104
|
/* @__PURE__ */ v("div", {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BrandFormPage.js","names":[],"sources":["../../../../src/coolandlovely/pages/brands/BrandFormPage.tsx"],"sourcesContent":["/**\n * Brand Create / Edit Page\n * @module coolandlovely/pages/brands\n *\n * Drives `cooCreateBrand` (new) and `cooUpdateBrand` (edit). The route param\n * `brandId` distinguishes the two modes.\n */\n\nimport { useEffect, useState } from 'react';\nimport { useParams } from 'react-router-dom';\nimport { ArrowLeft, Loader2, Save, Store } from 'lucide-react';\nimport { GlassCard } from '@burdenoff/fe-libs/ui';\nimport { PageLayout } from '../../components/PageLayout';\nimport { LoadingView, ErrorView } from '../../components/StateViews';\nimport { TextField, TextAreaField } from '../../components/Field';\nimport { useCoolAndLovely } from '../../context/CoolAndLovelyContext';\nimport { useBrand, useCreateBrand, useUpdateBrand } from '../../hooks';\nimport { parseCsv } from '../../utils/formatters';\n\ninterface FormState {\n name: string;\n handle: string;\n tagline: string;\n bio: string;\n aesthetics: string;\n tags: string;\n websiteUrl: string;\n}\n\nconst EMPTY: FormState = {\n name: '',\n handle: '',\n tagline: '',\n bio: '',\n aesthetics: '',\n tags: '',\n websiteUrl: '',\n};\n\nexport function BrandFormPage() {\n const { brandId } = useParams<{ brandId: string }>();\n const isEdit = Boolean(brandId);\n const { navigateTo } = useCoolAndLovely();\n\n const existing = useBrand(isEdit ? brandId : undefined);\n const createBrand = useCreateBrand();\n const updateBrand = useUpdateBrand();\n\n const [form, setForm] = useState<FormState>(EMPTY);\n const [errors, setErrors] = useState<Partial<Record<keyof FormState, string>>>({});\n\n useEffect(() => {\n if (isEdit && existing.data) {\n const b = existing.data;\n setForm({\n name: b.name,\n handle: b.handle,\n tagline: b.tagline ?? '',\n bio: b.bio ?? '',\n aesthetics: b.aesthetics.join(', '),\n tags: b.tags.join(', '),\n websiteUrl: b.websiteUrl ?? '',\n });\n }\n }, [isEdit, existing.data]);\n\n const setField = <K extends keyof FormState>(key: K, value: FormState[K]) =>\n setForm((f) => ({ ...f, [key]: value }));\n\n const mutation = isEdit ? updateBrand : createBrand;\n\n const validate = (): boolean => {\n const next: Partial<Record<keyof FormState, string>> = {};\n if (!form.name.trim()) next.name = 'Name is required';\n if (!isEdit && !form.handle.trim()) next.handle = 'Handle is required';\n setErrors(next);\n return Object.keys(next).length === 0;\n };\n\n const handleSubmit = (e: React.FormEvent) => {\n e.preventDefault();\n if (!validate()) return;\n\n if (isEdit && brandId) {\n updateBrand.mutate(\n {\n id: brandId,\n input: {\n name: form.name.trim(),\n tagline: form.tagline.trim() || undefined,\n bio: form.bio.trim() || undefined,\n aesthetics: parseCsv(form.aesthetics),\n tags: parseCsv(form.tags),\n websiteUrl: form.websiteUrl.trim() || undefined,\n },\n },\n { onSuccess: () => navigateTo(`/brands/${brandId}`) }\n );\n } else {\n createBrand.mutate(\n {\n name: form.name.trim(),\n handle: form.handle.trim(),\n tagline: form.tagline.trim() || undefined,\n bio: form.bio.trim() || undefined,\n aesthetics: parseCsv(form.aesthetics),\n tags: parseCsv(form.tags),\n websiteUrl: form.websiteUrl.trim() || undefined,\n },\n { onSuccess: (brand) => navigateTo(`/brands/${brand.id}`) }\n );\n }\n };\n\n if (isEdit && existing.isLoading) {\n return (\n <PageLayout title=\"Edit brand\">\n <LoadingView label=\"Loading brand…\" />\n </PageLayout>\n );\n }\n\n if (isEdit && (existing.isError || !existing.data)) {\n return (\n <PageLayout title=\"Edit brand\">\n <ErrorView title=\"Brand not found\" onRetry={() => void existing.refetch()} />\n </PageLayout>\n );\n }\n\n return (\n <PageLayout\n title={isEdit ? 'Edit brand' : 'New brand'}\n description={isEdit ? 'Update this storefront' : 'Launch a new storefront on the platform'}\n actions={\n <button\n type=\"button\"\n onClick={() => navigateTo(isEdit && brandId ? `/brands/${brandId}` : '/brands')}\n 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\"\n >\n <ArrowLeft className=\"h-4 w-4\" /> Cancel\n </button>\n }\n >\n <form onSubmit={handleSubmit} className=\"mx-auto max-w-2xl\">\n <GlassCard treatment=\"plain\" className=\"p-6\">\n <div className=\"mb-6 flex items-center gap-3\">\n <div className=\"flex h-11 w-11 items-center justify-center rounded-lg bg-accent-purple-subtle text-text-primary\">\n <Store className=\"h-5 w-5\" />\n </div>\n <div>\n <h2 className=\"text-base font-semibold text-text-primary\">Storefront details</h2>\n <p className=\"text-xs text-text-secondary\">\n Imagery (logo/cover) is attached via the workspace files service.\n </p>\n </div>\n </div>\n\n <div className=\"grid grid-cols-1 gap-4 sm:grid-cols-2\">\n <TextField\n id=\"name\"\n label=\"Brand name\"\n value={form.name}\n onChange={(v) => setField('name', v)}\n placeholder=\"Aurora Atelier\"\n required\n error={errors.name}\n />\n <TextField\n id=\"handle\"\n label=\"Handle\"\n value={form.handle}\n onChange={(v) => setField('handle', v)}\n placeholder=\"aurora-atelier\"\n required={!isEdit}\n hint={isEdit ? 'Handle cannot be changed after creation' : 'Unique per workspace'}\n error={errors.handle}\n />\n </div>\n\n <TextField\n id=\"tagline\"\n label=\"Tagline\"\n value={form.tagline}\n onChange={(v) => setField('tagline', v)}\n placeholder=\"Quiet luxury, loud ideas\"\n className=\"mt-4\"\n />\n\n <TextAreaField\n id=\"bio\"\n label=\"Bio\"\n value={form.bio}\n onChange={(v) => setField('bio', v)}\n placeholder=\"Tell shoppers what your brand stands for…\"\n rows={4}\n className=\"mt-4\"\n />\n\n <div className=\"mt-4 grid grid-cols-1 gap-4 sm:grid-cols-2\">\n <TextField\n id=\"aesthetics\"\n label=\"Aesthetics\"\n value={form.aesthetics}\n onChange={(v) => setField('aesthetics', v)}\n placeholder=\"minimal, Y2K, coastal\"\n hint=\"Comma-separated descriptors\"\n />\n <TextField\n id=\"tags\"\n label=\"Tags\"\n value={form.tags}\n onChange={(v) => setField('tags', v)}\n placeholder=\"sustainable, handmade\"\n hint=\"Comma-separated\"\n />\n </div>\n\n <TextField\n id=\"websiteUrl\"\n label=\"Website\"\n type=\"url\"\n value={form.websiteUrl}\n onChange={(v) => setField('websiteUrl', v)}\n placeholder=\"https://example.com\"\n className=\"mt-4\"\n />\n\n {mutation.isError && (\n <p className=\"mt-4 rounded-lg bg-status-error-bg-subtle px-3 py-2 text-sm text-status-error-text\">\n {mutation.error instanceof Error ? mutation.error.message : 'Something went wrong'}\n </p>\n )}\n\n <div className=\"mt-6 flex justify-end gap-2\">\n <button\n type=\"submit\"\n disabled={mutation.isPending}\n className=\"inline-flex items-center gap-1.5 rounded-lg bg-action-primary-bg px-5 py-2 text-sm font-medium text-action-primary-text transition-colors hover:bg-action-primary-bg/90 disabled:opacity-50\"\n >\n {mutation.isPending ? (\n <Loader2 className=\"h-4 w-4 animate-spin\" />\n ) : (\n <Save className=\"h-4 w-4\" />\n )}\n {isEdit ? 'Save changes' : 'Create brand'}\n </button>\n </div>\n </GlassCard>\n </form>\n </PageLayout>\n );\n}\n"],"mappings":";;;;;;;;;;;;;AA6BA,IAAM,IAAmB;CACvB,MAAM;CACN,QAAQ;CACR,SAAS;CACT,KAAK;CACL,YAAY;CACZ,MAAM;CACN,YAAY;CACb;AAED,SAAgB,IAAgB;CAC9B,IAAM,EAAE,eAAY,GAAgC,EAC9C,IAAS,EAAQ,GACjB,EAAE,kBAAe,GAAkB,EAEnC,IAAW,EAAS,IAAS,IAAU,KAAA,EAAU,EACjD,IAAc,GAAgB,EAC9B,IAAc,GAAgB,EAE9B,CAAC,GAAM,KAAW,EAAoB,EAAM,EAC5C,CAAC,GAAQ,KAAa,EAAmD,EAAE,CAAC;AAElF,SAAgB;AACd,MAAI,KAAU,EAAS,MAAM;GAC3B,IAAM,IAAI,EAAS;AACnB,KAAQ;IACN,MAAM,EAAE;IACR,QAAQ,EAAE;IACV,SAAS,EAAE,WAAW;IACtB,KAAK,EAAE,OAAO;IACd,YAAY,EAAE,WAAW,KAAK,KAAK;IACnC,MAAM,EAAE,KAAK,KAAK,KAAK;IACvB,YAAY,EAAE,cAAc;IAC7B,CAAC;;IAEH,CAAC,GAAQ,EAAS,KAAK,CAAC;CAE3B,IAAM,KAAuC,GAAQ,MACnD,GAAS,OAAO;EAAE,GAAG;GAAI,IAAM;EAAO,EAAE,EAEpC,IAAW,IAAS,IAAc,GAElC,UAA0B;EAC9B,IAAM,IAAiD,EAAE;AAIzD,SAHK,EAAK,KAAK,MAAM,KAAE,EAAK,OAAO,qBAC/B,CAAC,KAAU,CAAC,EAAK,OAAO,MAAM,KAAE,EAAK,SAAS,uBAClD,EAAU,EAAK,EAC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,OAAO,EAAK;OACZ,WAAW,MAAM,EAAS,QAAQ,EAAE;OACpC,aAAY;OACZ,MAAK;OACL,CAAA,CACE;;KAEN,kBAAC,GAAD;MACE,IAAG;MACH,OAAM;MACN,MAAK;MACL,OAAO,EAAK;MACZ,WAAW,MAAM,EAAS,cAAc,EAAE;MAC1C,aAAY;MACZ,WAAU;MACV,CAAA;KAED,EAAS,WACR,kBAAC,KAAD;MAAG,WAAU;gBACV,EAAS,iBAAiB,QAAQ,EAAS,MAAM,UAAU;MAC1D,CAAA;KAGN,kBAAC,OAAD;MAAK,WAAU;gBACb,kBAAC,UAAD;OACE,MAAK;OACL,UAAU,EAAS;OACnB,WAAU;iBAHZ,CAKG,EAAS,YACR,kBAAC,GAAD,EAAS,WAAU,wBAAyB,CAAA,GAE5C,kBAAC,GAAD,EAAM,WAAU,WAAY,CAAA,EAE7B,IAAS,iBAAiB,eACpB;;MACL,CAAA;KACI;;GACP,CAAA;EACI,CAAA"}
|
|
1
|
+
{"version":3,"file":"BrandFormPage.js","names":[],"sources":["../../../../src/coolandlovely/pages/brands/BrandFormPage.tsx"],"sourcesContent":["/**\n * Brand Create / Edit Page\n * @module coolandlovely/pages/brands\n *\n * Drives `cooCreateBrand` (new) and `cooUpdateBrand` (edit). The route param\n * `brandId` distinguishes the two modes.\n */\n\nimport { useEffect, useState } from 'react';\nimport { useParams } from 'react-router-dom';\nimport { ArrowLeft, Loader2, Save, Store } from 'lucide-react';\nimport { GlassCard } from '@burdenoff/fe-libs/ui';\nimport { PageLayout } from '../../components/PageLayout';\nimport { LoadingView, ErrorView } from '../../components/StateViews';\nimport { TextField, TextAreaField } from '../../components/Field';\nimport { useCoolAndLovely } from '../../context/CoolAndLovelyContext';\nimport { useBrand, useCreateBrand, useUpdateBrand } from '../../hooks';\nimport { parseCsv } from '../../utils/formatters';\n\ninterface FormState {\n name: string;\n handle: string;\n tagline: string;\n bio: string;\n aesthetics: string;\n tags: string;\n websiteUrl: string;\n}\n\nconst EMPTY: FormState = {\n name: '',\n handle: '',\n tagline: '',\n bio: '',\n aesthetics: '',\n tags: '',\n websiteUrl: '',\n};\n\nexport function BrandFormPage() {\n const { brandId } = useParams<{ brandId: string }>();\n const isEdit = Boolean(brandId);\n const { navigateTo } = useCoolAndLovely();\n\n const existing = useBrand(isEdit ? brandId : undefined);\n const createBrand = useCreateBrand();\n const updateBrand = useUpdateBrand();\n\n const [form, setForm] = useState<FormState>(EMPTY);\n const [errors, setErrors] = useState<Partial<Record<keyof FormState, string>>>({});\n\n useEffect(() => {\n if (isEdit && existing.data) {\n const b = existing.data;\n setForm({\n name: b.name,\n handle: b.handle,\n tagline: b.tagline ?? '',\n bio: b.bio ?? '',\n aesthetics: b.aesthetics.join(', '),\n tags: b.tags.join(', '),\n websiteUrl: b.websiteUrl ?? '',\n });\n }\n }, [isEdit, existing.data]);\n\n const setField = <K extends keyof FormState>(key: K, value: FormState[K]) =>\n setForm((f) => ({ ...f, [key]: value }));\n\n const mutation = isEdit ? updateBrand : createBrand;\n\n const validate = (): boolean => {\n const next: Partial<Record<keyof FormState, string>> = {};\n if (!form.name.trim()) next.name = 'Name is required';\n if (!isEdit && !form.handle.trim()) next.handle = 'Handle is required';\n setErrors(next);\n return Object.keys(next).length === 0;\n };\n\n const handleSubmit = (e: React.FormEvent) => {\n e.preventDefault();\n if (!validate()) return;\n\n if (isEdit && brandId) {\n updateBrand.mutate(\n {\n id: brandId,\n input: {\n name: form.name.trim(),\n tagline: form.tagline.trim() || undefined,\n bio: form.bio.trim() || undefined,\n aesthetics: parseCsv(form.aesthetics),\n tags: parseCsv(form.tags),\n websiteUrl: form.websiteUrl.trim() || undefined,\n },\n },\n { onSuccess: () => navigateTo(`/brands/${brandId}`) }\n );\n } else {\n createBrand.mutate(\n {\n name: form.name.trim(),\n handle: form.handle.trim(),\n tagline: form.tagline.trim() || undefined,\n bio: form.bio.trim() || undefined,\n aesthetics: parseCsv(form.aesthetics),\n tags: parseCsv(form.tags),\n websiteUrl: form.websiteUrl.trim() || undefined,\n },\n { onSuccess: (brand) => navigateTo(`/brands/${brand.id}`) }\n );\n }\n };\n\n if (isEdit && existing.isLoading) {\n return (\n <PageLayout title=\"Edit brand\">\n <LoadingView label=\"Loading brand…\" />\n </PageLayout>\n );\n }\n\n if (isEdit && (existing.isError || !existing.data)) {\n return (\n <PageLayout title=\"Edit brand\">\n <ErrorView title=\"Brand not found\" onRetry={() => void existing.refetch()} />\n </PageLayout>\n );\n }\n\n return (\n <PageLayout\n title={isEdit ? 'Edit brand' : 'New brand'}\n description={isEdit ? 'Update this storefront' : 'Launch a new storefront on the platform'}\n actions={\n <button\n type=\"button\"\n onClick={() => navigateTo(isEdit && brandId ? `/brands/${brandId}` : '/brands')}\n 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\"\n >\n <ArrowLeft className=\"h-4 w-4\" /> Cancel\n </button>\n }\n >\n <form onSubmit={handleSubmit} className=\"mx-auto max-w-2xl\">\n <GlassCard treatment=\"plain\" className=\"p-6\">\n <div className=\"mb-6 flex items-center gap-3\">\n <div className=\"flex h-11 w-11 items-center justify-center rounded-lg bg-accent-purple-subtle text-text-primary\">\n <Store className=\"h-5 w-5\" />\n </div>\n <div>\n <h2 className=\"text-base font-semibold text-text-primary\">Storefront details</h2>\n <p className=\"text-xs text-text-secondary\">\n Name your storefront and tell shoppers what your brand stands for.\n </p>\n </div>\n </div>\n\n <div className=\"grid grid-cols-1 gap-4 sm:grid-cols-2\">\n <TextField\n id=\"name\"\n label=\"Brand name\"\n value={form.name}\n onChange={(v) => setField('name', v)}\n placeholder=\"Aurora Atelier\"\n required\n error={errors.name}\n />\n <TextField\n id=\"handle\"\n label=\"Handle\"\n value={form.handle}\n onChange={(v) => setField('handle', v)}\n placeholder=\"aurora-atelier\"\n required={!isEdit}\n hint={isEdit ? 'Handle cannot be changed after creation' : 'Unique per workspace'}\n error={errors.handle}\n />\n </div>\n\n <TextField\n id=\"tagline\"\n label=\"Tagline\"\n value={form.tagline}\n onChange={(v) => setField('tagline', v)}\n placeholder=\"Quiet luxury, loud ideas\"\n className=\"mt-4\"\n />\n\n <TextAreaField\n id=\"bio\"\n label=\"Bio\"\n value={form.bio}\n onChange={(v) => setField('bio', v)}\n placeholder=\"Tell shoppers what your brand stands for…\"\n rows={4}\n className=\"mt-4\"\n />\n\n <div className=\"mt-4 grid grid-cols-1 gap-4 sm:grid-cols-2\">\n <TextField\n id=\"aesthetics\"\n label=\"Aesthetics\"\n value={form.aesthetics}\n onChange={(v) => setField('aesthetics', v)}\n placeholder=\"minimal, Y2K, coastal\"\n hint=\"Comma-separated descriptors\"\n />\n <TextField\n id=\"tags\"\n label=\"Tags\"\n value={form.tags}\n onChange={(v) => setField('tags', v)}\n placeholder=\"sustainable, handmade\"\n hint=\"Comma-separated\"\n />\n </div>\n\n <TextField\n id=\"websiteUrl\"\n label=\"Website\"\n type=\"url\"\n value={form.websiteUrl}\n onChange={(v) => setField('websiteUrl', v)}\n placeholder=\"https://example.com\"\n className=\"mt-4\"\n />\n\n {mutation.isError && (\n <p className=\"mt-4 rounded-lg bg-status-error-bg-subtle px-3 py-2 text-sm text-status-error-text\">\n {mutation.error instanceof Error ? mutation.error.message : 'Something went wrong'}\n </p>\n )}\n\n <div className=\"mt-6 flex justify-end gap-2\">\n <button\n type=\"submit\"\n disabled={mutation.isPending}\n className=\"inline-flex items-center gap-1.5 rounded-lg bg-action-primary-bg px-5 py-2 text-sm font-medium text-action-primary-text transition-colors hover:bg-action-primary-bg/90 disabled:opacity-50\"\n >\n {mutation.isPending ? (\n <Loader2 className=\"h-4 w-4 animate-spin\" />\n ) : (\n <Save className=\"h-4 w-4\" />\n )}\n {isEdit ? 'Save changes' : 'Create brand'}\n </button>\n </div>\n </GlassCard>\n </form>\n </PageLayout>\n );\n}\n"],"mappings":";;;;;;;;;;;;;AA6BA,IAAM,IAAmB;CACvB,MAAM;CACN,QAAQ;CACR,SAAS;CACT,KA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