@burdenoff/microfe-coolandlovely 2026.1102.1 → 2026.1102.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (46) hide show
  1. package/README.md +15 -0
  2. package/dist/coolandlovely/CoolAndLovelyRoot.d.ts.map +1 -1
  3. package/dist/coolandlovely/CoolAndLovelyRoot.js +8 -0
  4. package/dist/coolandlovely/CoolAndLovelyRoot.js.map +1 -1
  5. package/dist/coolandlovely/CoolAndLovelyRoutes.d.ts.map +1 -1
  6. package/dist/coolandlovely/CoolAndLovelyRoutes.js +20 -16
  7. package/dist/coolandlovely/CoolAndLovelyRoutes.js.map +1 -1
  8. package/dist/coolandlovely/hooks/useContextNavigation.d.ts +3 -0
  9. package/dist/coolandlovely/hooks/useContextNavigation.d.ts.map +1 -0
  10. package/dist/coolandlovely/hooks/useContextNavigation.js +31 -0
  11. package/dist/coolandlovely/hooks/useContextNavigation.js.map +1 -0
  12. package/dist/coolandlovely/hooks/useCoolAndLovelyApi.d.ts.map +1 -1
  13. package/dist/coolandlovely/hooks/useCoolAndLovelyApi.js +1 -1
  14. package/dist/coolandlovely/hooks/useCoolAndLovelyApi.js.map +1 -1
  15. package/dist/coolandlovely/hooks/useCreatorMarketplace.d.ts +118 -0
  16. package/dist/coolandlovely/hooks/useCreatorMarketplace.d.ts.map +1 -0
  17. package/dist/coolandlovely/hooks/useCreatorMarketplace.js +120 -0
  18. package/dist/coolandlovely/hooks/useCreatorMarketplace.js.map +1 -0
  19. package/dist/coolandlovely/hooks/usePriceApi.d.ts.map +1 -1
  20. package/dist/coolandlovely/pages/collaborations/CollaborationDetailPage.d.ts.map +1 -1
  21. package/dist/coolandlovely/pages/collaborations/CollaborationDetailPage.js +139 -121
  22. package/dist/coolandlovely/pages/collaborations/CollaborationDetailPage.js.map +1 -1
  23. package/dist/coolandlovely/pages/collaborations/CollaborationFormPage.d.ts.map +1 -1
  24. package/dist/coolandlovely/pages/collaborations/CollaborationFormPage.js +140 -137
  25. package/dist/coolandlovely/pages/collaborations/CollaborationFormPage.js.map +1 -1
  26. package/dist/coolandlovely/pages/collaborations/CollaborationsListPage.d.ts.map +1 -1
  27. package/dist/coolandlovely/pages/collaborations/CollaborationsListPage.js +104 -95
  28. package/dist/coolandlovely/pages/collaborations/CollaborationsListPage.js.map +1 -1
  29. package/dist/coolandlovely/pages/commerce/CreatorEarningsPage.d.ts.map +1 -1
  30. package/dist/coolandlovely/pages/commerce/CreatorEarningsPage.js +49 -40
  31. package/dist/coolandlovely/pages/commerce/CreatorEarningsPage.js.map +1 -1
  32. package/dist/coolandlovely/pages/marketplace/CreatorMarketplacePage.d.ts +2 -0
  33. package/dist/coolandlovely/pages/marketplace/CreatorMarketplacePage.d.ts.map +1 -0
  34. package/dist/coolandlovely/pages/marketplace/CreatorMarketplacePage.js +714 -0
  35. package/dist/coolandlovely/pages/marketplace/CreatorMarketplacePage.js.map +1 -0
  36. package/dist/coolandlovely/types/index.d.ts +5 -0
  37. package/dist/coolandlovely/types/index.d.ts.map +1 -1
  38. package/dist/generated/wspace-operations.d.ts +649 -0
  39. package/dist/generated/wspace-operations.d.ts.map +1 -1
  40. package/dist/generated/wspace-operations.js +141 -7
  41. package/dist/generated/wspace-operations.js.map +1 -1
  42. package/dist/generated/wspace-types.d.ts +315 -1
  43. package/dist/generated/wspace-types.d.ts.map +1 -1
  44. package/dist/generated/wspace-types.js +7 -1
  45. package/dist/generated/wspace-types.js.map +1 -1
  46. package/package.json +1 -1
@@ -0,0 +1,714 @@
1
+ import { useCoolAndLovely as e } from "../../context/CoolAndLovelyContext.js";
2
+ import { PageLayout as t } from "../../components/PageLayout.js";
3
+ import "../../context/index.js";
4
+ import { useTr as n } from "../../hooks/useTr.js";
5
+ import { StatusBadge as r } from "../../components/StatusBadge.js";
6
+ import { ErrorView as i, LoadingView as a } from "../../components/StateViews.js";
7
+ import { formatPrice as o } from "../../utils/formatters.js";
8
+ import { ActorName as s } from "../../components/ActorName.js";
9
+ import { useContextNavigation as c } from "../../hooks/useContextNavigation.js";
10
+ import { CooCollaborationStatus as l, CooCreatorServiceRole as u, CooProposalDirection as d } from "../../../generated/wspace-types.js";
11
+ import { useArchiveCreatorOffer as f, useCreateCreatorOffer as p, useCreatorInbox as m, useCreatorOffer as h, useCreatorOffers as g, useProposalBrands as _, useProposeCreatorOffer as v, usePublishCreatorOffer as y, useRespondToCreatorProposal as b, useUpdateCreatorOffer as x } from "../../hooks/useCreatorMarketplace.js";
12
+ import { useState as S } from "react";
13
+ import { Fragment as C, jsx as w, jsxs as T } from "react/jsx-runtime";
14
+ import { Button as E, Dialog as D, DialogContent as O, DialogDescription as k, DialogTitle as A, GlassCard as j, Pagination as M } from "@burdenoff/fe-libs/ui";
15
+ import { clearGraphqlFetchResponseCache as N } from "@burdenoff/fe-libs/shared/graphql/fetch";
16
+ import { isQuotaExhaustedError as P } from "@burdenoff/fe-libs/shared/utils";
17
+ import { PermissionProvider as F, usePermission as I, usePermissionLoading as L } from "@burdenoff/fe-libs/shared/providers/shell";
18
+ //#region src/coolandlovely/pages/marketplace/CreatorMarketplacePage.tsx
19
+ var R = "w-full rounded-lg border border-border-seam bg-bg-surface px-3 py-2 text-text-primary";
20
+ function z({ label: e, children: t }) {
21
+ return /* @__PURE__ */ T("label", {
22
+ className: "grid min-w-0 gap-1.5 text-sm text-text-primary",
23
+ children: [/* @__PURE__ */ w("span", { children: e }), t]
24
+ });
25
+ }
26
+ function B({ error: e }) {
27
+ return e ? /* @__PURE__ */ w("p", {
28
+ role: "alert",
29
+ className: "text-sm text-status-error-text",
30
+ children: e.message
31
+ }) : null;
32
+ }
33
+ function V({ page: e, hasMore: t, loading: n, onChange: r }) {
34
+ return /* @__PURE__ */ w(M, {
35
+ page: e + 1,
36
+ pageSize: 20,
37
+ hasNextPage: t,
38
+ hasPreviousPage: e > 0,
39
+ loading: n,
40
+ onPageChange: (e) => r(e - 1)
41
+ });
42
+ }
43
+ function H({ offer: e, tr: t }) {
44
+ return /* @__PURE__ */ T("div", {
45
+ className: "space-y-2 text-sm text-text-secondary",
46
+ children: [
47
+ /* @__PURE__ */ w("p", { children: {
48
+ [u.Creator]: t("coolandlovely.marketplace.creator", "Creator"),
49
+ [u.Stylist]: t("coolandlovely.marketplace.stylist", "Stylist"),
50
+ [u.Photographer]: t("coolandlovely.marketplace.photographer", "Photographer")
51
+ }[e.role] }),
52
+ /* @__PURE__ */ w("p", {
53
+ className: "font-semibold text-text-primary",
54
+ children: o(e.compensation, e.currency)
55
+ }),
56
+ /* @__PURE__ */ w("p", { children: t("coolandlovely.marketplace.delivery", "Delivery within {{days}} days of the agreed start", { days: e.deliveryDays }) }),
57
+ /* @__PURE__ */ w("ul", {
58
+ className: "list-inside list-disc break-words",
59
+ children: e.deliverables.map((e) => /* @__PURE__ */ w("li", { children: e }, e))
60
+ })
61
+ ]
62
+ });
63
+ }
64
+ function U({ offer: e, onClose: t, tr: n }) {
65
+ let r = p(), i = x(), a = e ? i : r, [o, s] = S(e?.title ?? ""), [c, l] = S(e?.summary ?? ""), [d, f] = S(e?.role ?? u.Creator), [m, h] = S(() => e?.deliverables.join("\n") ?? ""), [g, _] = S(() => String(e?.compensation ?? 0)), [v, y] = S(e?.currency ?? "USD"), [b, C] = S(() => String(e?.deliveryDays ?? 7)), [j, M] = S("");
66
+ return /* @__PURE__ */ w(D, {
67
+ open: !0,
68
+ onOpenChange: (e) => {
69
+ !e && !a.isPending && t();
70
+ },
71
+ children: /* @__PURE__ */ T(O, {
72
+ className: "max-h-[85dvh] overflow-y-auto",
73
+ children: [
74
+ /* @__PURE__ */ w(A, { children: e ? n("coolandlovely.marketplace.editOffer", "Edit service offer") : n("coolandlovely.marketplace.newOffer", "New service offer") }),
75
+ /* @__PURE__ */ w(k, { children: n("coolandlovely.marketplace.editorHelp", "New offers start private. Changes apply to future proposals; existing agreed quotes stay unchanged.") }),
76
+ /* @__PURE__ */ T("form", {
77
+ onSubmit: (a) => {
78
+ if (a.preventDefault(), o.trim().length < 3) {
79
+ M(n("coolandlovely.marketplace.invalidTitle", "Enter at least three title characters after removing surrounding spaces."));
80
+ return;
81
+ }
82
+ let s = m.split("\n").map((e) => e.trim()).filter(Boolean);
83
+ if (s.length < 1 || s.length > 20 || s.some((e) => e.length > 500) || new Set(s).size !== s.length) {
84
+ M(n("coolandlovely.marketplace.deliverableValidation", "Enter 1–20 different deliverables, one per line, with at most 500 characters each."));
85
+ return;
86
+ }
87
+ let l = Number(g), u = Number(b);
88
+ if (!g.trim() || !b.trim() || !Number.isFinite(l) || l < 0 || l > 1e6 || !Number.isInteger(u) || u < 1 || u > 365) {
89
+ M(n("coolandlovely.marketplace.invalidFeeOrDays", "Enter a valid non-negative fee and delivery time from 1 to 365 whole days."));
90
+ return;
91
+ }
92
+ M("");
93
+ let f = {
94
+ title: o.trim(),
95
+ summary: c.trim() || null,
96
+ role: d,
97
+ deliverables: s,
98
+ compensation: l,
99
+ currency: v.trim().toUpperCase(),
100
+ deliveryDays: u
101
+ };
102
+ e ? i.mutate({
103
+ id: e.id,
104
+ input: f
105
+ }, { onSuccess: t }) : r.mutate({ input: f }, { onSuccess: t });
106
+ },
107
+ className: "grid gap-4",
108
+ children: [
109
+ /* @__PURE__ */ T("fieldset", {
110
+ disabled: a.isPending,
111
+ className: "grid min-w-0 gap-4",
112
+ children: [
113
+ /* @__PURE__ */ w(z, {
114
+ label: n("coolandlovely.marketplace.offerTitle", "Offer title"),
115
+ children: /* @__PURE__ */ w("input", {
116
+ className: R,
117
+ required: !0,
118
+ minLength: 3,
119
+ maxLength: 160,
120
+ value: o,
121
+ onChange: (e) => s(e.target.value)
122
+ })
123
+ }),
124
+ /* @__PURE__ */ w(z, {
125
+ label: n("coolandlovely.marketplace.summary", "Summary"),
126
+ children: /* @__PURE__ */ w("textarea", {
127
+ className: R,
128
+ maxLength: 2e3,
129
+ value: c,
130
+ onChange: (e) => l(e.target.value)
131
+ })
132
+ }),
133
+ /* @__PURE__ */ w(z, {
134
+ label: n("coolandlovely.marketplace.role", "Service role"),
135
+ children: /* @__PURE__ */ T("select", {
136
+ className: R,
137
+ value: d,
138
+ onChange: (e) => {
139
+ let t = Object.values(u).find((t) => t === e.target.value);
140
+ t && f(t);
141
+ },
142
+ children: [
143
+ /* @__PURE__ */ w("option", {
144
+ value: u.Creator,
145
+ children: n("coolandlovely.marketplace.creator", "Creator")
146
+ }),
147
+ /* @__PURE__ */ w("option", {
148
+ value: u.Stylist,
149
+ children: n("coolandlovely.marketplace.stylist", "Stylist")
150
+ }),
151
+ /* @__PURE__ */ w("option", {
152
+ value: u.Photographer,
153
+ children: n("coolandlovely.marketplace.photographer", "Photographer")
154
+ })
155
+ ]
156
+ })
157
+ }),
158
+ /* @__PURE__ */ w(z, {
159
+ label: n("coolandlovely.marketplace.deliverables", "Deliverables, one per line"),
160
+ children: /* @__PURE__ */ w("textarea", {
161
+ className: R,
162
+ required: !0,
163
+ rows: 4,
164
+ value: m,
165
+ onChange: (e) => h(e.target.value)
166
+ })
167
+ }),
168
+ /* @__PURE__ */ T("div", {
169
+ className: "grid gap-4 sm:grid-cols-2",
170
+ children: [/* @__PURE__ */ w(z, {
171
+ label: n("coolandlovely.marketplace.fee", "Service fee"),
172
+ children: /* @__PURE__ */ w("input", {
173
+ className: R,
174
+ type: "number",
175
+ required: !0,
176
+ min: 0,
177
+ max: 1e6,
178
+ step: "0.01",
179
+ value: g,
180
+ onChange: (e) => _(e.target.value)
181
+ })
182
+ }), /* @__PURE__ */ w(z, {
183
+ label: n("coolandlovely.marketplace.currency", "Currency"),
184
+ children: /* @__PURE__ */ w("input", {
185
+ className: R,
186
+ required: !0,
187
+ pattern: "[A-Za-z]{3}",
188
+ maxLength: 3,
189
+ value: v,
190
+ onChange: (e) => y(e.target.value.toUpperCase())
191
+ })
192
+ })]
193
+ }),
194
+ /* @__PURE__ */ w(z, {
195
+ label: n("coolandlovely.marketplace.days", "Delivery days"),
196
+ children: /* @__PURE__ */ w("input", {
197
+ className: R,
198
+ type: "number",
199
+ required: !0,
200
+ min: 1,
201
+ max: 365,
202
+ step: 1,
203
+ value: b,
204
+ onChange: (e) => C(e.target.value)
205
+ })
206
+ })
207
+ ]
208
+ }),
209
+ j && /* @__PURE__ */ w("p", {
210
+ role: "alert",
211
+ className: "text-sm text-status-error-text",
212
+ children: j
213
+ }),
214
+ /* @__PURE__ */ w(B, { error: a.error }),
215
+ /* @__PURE__ */ T("div", {
216
+ className: "flex flex-wrap justify-end gap-2",
217
+ children: [/* @__PURE__ */ w(E, {
218
+ type: "button",
219
+ variant: "outline",
220
+ disabled: a.isPending,
221
+ onClick: t,
222
+ children: n("coolandlovely.common.cancel", "Cancel")
223
+ }), /* @__PURE__ */ w(E, {
224
+ type: "submit",
225
+ disabled: a.isPending,
226
+ children: a.isPending ? n("coolandlovely.common.saving", "Saving…") : n("coolandlovely.common.save", "Save offer")
227
+ })]
228
+ })
229
+ ]
230
+ })
231
+ ]
232
+ })
233
+ });
234
+ }
235
+ function W({ offer: e, onOfferReloaded: t, onClose: n, onQuota: r, onSent: o, tr: c }) {
236
+ let [l, u] = S(0), d = _(l, !0), f = h(e.id), p = v(), [m, g] = S(""), [y, b] = S(""), [x, j] = S(""), [M, F] = S(!1), [I, L] = S(!1), U = async () => {
237
+ L(!0), N();
238
+ try {
239
+ let e = await f.refetch();
240
+ if (e.isSuccess) {
241
+ let n = e.data;
242
+ n?.isPublished ? (t(n), p.reset(), F(!1)) : F(!0);
243
+ }
244
+ } finally {
245
+ L(!1);
246
+ }
247
+ };
248
+ return /* @__PURE__ */ w(D, {
249
+ open: !0,
250
+ onOpenChange: (e) => {
251
+ !e && !p.isPending && n();
252
+ },
253
+ children: /* @__PURE__ */ T(O, {
254
+ className: "max-h-[85dvh] overflow-y-auto",
255
+ children: [
256
+ /* @__PURE__ */ w(A, { children: c("coolandlovely.marketplace.sendProposal", "Propose a collaboration") }),
257
+ /* @__PURE__ */ w(k, { children: c("coolandlovely.marketplace.proposalHelp", "Review this quote before sending. Sending or accepting a proposal does not charge you or pay the creator.") }),
258
+ /* @__PURE__ */ w("h3", {
259
+ className: "break-words font-semibold text-text-primary",
260
+ children: e.title
261
+ }),
262
+ /* @__PURE__ */ w("p", {
263
+ className: "text-sm text-text-secondary",
264
+ children: /* @__PURE__ */ w(s, { id: e.creatorId })
265
+ }),
266
+ /* @__PURE__ */ w(H, {
267
+ offer: e,
268
+ tr: c
269
+ }),
270
+ /* @__PURE__ */ w(E, {
271
+ variant: "outline",
272
+ disabled: p.isPending || I,
273
+ onClick: () => void U(),
274
+ children: I ? c("coolandlovely.common.loading", "Loading…") : c("coolandlovely.marketplace.reloadOffer", "Reload offer")
275
+ }),
276
+ f.isError && /* @__PURE__ */ w(B, { error: f.error }),
277
+ M ? /* @__PURE__ */ w("p", {
278
+ role: "alert",
279
+ className: "text-status-error-text",
280
+ children: c("coolandlovely.marketplace.unavailable", "This offer is no longer published. Close this proposal and choose another offer.")
281
+ }) : /* @__PURE__ */ T("form", {
282
+ onSubmit: (t) => {
283
+ t.preventDefault(), p.mutate({ input: {
284
+ rateCardId: e.id,
285
+ rateCardRevision: e.revision,
286
+ brandId: m,
287
+ title: y.trim(),
288
+ brief: x.trim() || null
289
+ } }, {
290
+ onSuccess: o,
291
+ onError: (e) => {
292
+ P(e) && r();
293
+ }
294
+ });
295
+ },
296
+ className: "grid gap-4",
297
+ children: [
298
+ /* @__PURE__ */ T("fieldset", {
299
+ disabled: p.isPending || I,
300
+ className: "grid min-w-0 gap-4",
301
+ children: [
302
+ d.isLoading ? /* @__PURE__ */ w(a, {}) : d.isError ? /* @__PURE__ */ w(i, { onRetry: () => void d.refetch() }) : /* @__PURE__ */ T(C, { children: [
303
+ /* @__PURE__ */ w(z, {
304
+ label: c("coolandlovely.marketplace.yourBrand", "Your brand"),
305
+ children: /* @__PURE__ */ T("select", {
306
+ className: R,
307
+ required: !0,
308
+ value: m,
309
+ onChange: (e) => g(e.target.value),
310
+ children: [/* @__PURE__ */ w("option", {
311
+ value: "",
312
+ children: c("coolandlovely.marketplace.chooseBrand", "Choose a brand you own")
313
+ }), d.data?.items.map((e) => /* @__PURE__ */ w("option", {
314
+ value: e.id,
315
+ children: e.name
316
+ }, e.id))]
317
+ })
318
+ }),
319
+ !d.data?.items.length && /* @__PURE__ */ w("p", {
320
+ className: "text-sm text-text-secondary",
321
+ children: c("coolandlovely.marketplace.noBrands", "You need a brand you own in this workspace before sending a proposal.")
322
+ }),
323
+ /* @__PURE__ */ w(V, {
324
+ page: l,
325
+ hasMore: d.data?.pageInfo.hasMore ?? !1,
326
+ loading: d.isFetching,
327
+ onChange: (e) => {
328
+ u(e), g("");
329
+ }
330
+ })
331
+ ] }),
332
+ /* @__PURE__ */ w(z, {
333
+ label: c("coolandlovely.marketplace.campaign", "Campaign title"),
334
+ children: /* @__PURE__ */ w("input", {
335
+ className: R,
336
+ required: !0,
337
+ minLength: 3,
338
+ maxLength: 160,
339
+ value: y,
340
+ onChange: (e) => b(e.target.value)
341
+ })
342
+ }),
343
+ /* @__PURE__ */ w(z, {
344
+ label: c("coolandlovely.marketplace.brief", "Campaign brief"),
345
+ children: /* @__PURE__ */ w("textarea", {
346
+ className: R,
347
+ maxLength: 5e3,
348
+ value: x,
349
+ onChange: (e) => j(e.target.value)
350
+ })
351
+ })
352
+ ]
353
+ }),
354
+ /* @__PURE__ */ w(B, { error: p.error }),
355
+ /* @__PURE__ */ w(E, {
356
+ type: "submit",
357
+ disabled: p.isPending || I || !m || d.isError,
358
+ children: p.isPending ? c("coolandlovely.marketplace.sending", "Sending…") : c("coolandlovely.marketplace.submitProposal", "Send reviewed proposal")
359
+ })
360
+ ]
361
+ })
362
+ ]
363
+ })
364
+ });
365
+ }
366
+ function G({ proposal: t, canUpdate: n, received: i, navigate: a, tr: c }) {
367
+ let { currentUser: u } = e(), d = b(), [f, p] = S(null), m = i && (!t.rateCardId || t.creatorId === u?.id), h = t.status === l.Proposed, g = h || t.status === l.Accepted || t.status === l.InProgress;
368
+ return /* @__PURE__ */ T(j, {
369
+ className: "min-w-0 space-y-3 p-4",
370
+ children: [
371
+ /* @__PURE__ */ T("div", {
372
+ className: "flex flex-wrap justify-between gap-2",
373
+ children: [/* @__PURE__ */ w("h2", {
374
+ className: "break-words font-semibold text-text-primary",
375
+ children: t.title
376
+ }), /* @__PURE__ */ w(r, { status: t.status })]
377
+ }),
378
+ /* @__PURE__ */ T("p", {
379
+ className: "text-sm text-text-secondary",
380
+ children: [
381
+ t.brand?.name,
382
+ " · ",
383
+ /* @__PURE__ */ w(s, { id: t.creatorId })
384
+ ]
385
+ }),
386
+ t.rateCardTitle && /* @__PURE__ */ w("p", {
387
+ className: "break-words text-sm text-text-secondary",
388
+ children: t.rateCardTitle
389
+ }),
390
+ /* @__PURE__ */ w("p", {
391
+ className: "font-semibold text-text-primary",
392
+ children: o(t.compensation, t.currency)
393
+ }),
394
+ /* @__PURE__ */ w("ul", {
395
+ className: "list-inside list-disc break-words text-sm text-text-secondary",
396
+ children: t.quotedDeliverables.map((e) => /* @__PURE__ */ w("li", { children: e }, e))
397
+ }),
398
+ t.quotedDeliveryDays != null && /* @__PURE__ */ w("p", {
399
+ className: "text-sm text-text-secondary",
400
+ children: c("coolandlovely.marketplace.delivery", "Delivery within {{days}} days of the agreed start", { days: t.quotedDeliveryDays })
401
+ }),
402
+ t.brief && /* @__PURE__ */ w("p", {
403
+ className: "whitespace-pre-wrap break-words text-sm text-text-secondary",
404
+ children: t.brief
405
+ }),
406
+ /* @__PURE__ */ T("div", {
407
+ className: "flex flex-wrap gap-2",
408
+ children: [
409
+ n && h && m && /* @__PURE__ */ T(C, { children: [/* @__PURE__ */ w(E, {
410
+ disabled: d.isPending,
411
+ onClick: () => p(l.Accepted),
412
+ children: c("coolandlovely.marketplace.accept", "Accept proposal")
413
+ }), /* @__PURE__ */ w(E, {
414
+ variant: "outline",
415
+ disabled: d.isPending,
416
+ onClick: () => p(l.Declined),
417
+ children: c("coolandlovely.marketplace.decline", "Decline")
418
+ })] }),
419
+ n && g && /* @__PURE__ */ w(E, {
420
+ variant: "outline",
421
+ disabled: d.isPending,
422
+ onClick: () => p(l.Cancelled),
423
+ children: c("coolandlovely.marketplace.withdraw", "Cancel collaboration")
424
+ }),
425
+ /* @__PURE__ */ w(E, {
426
+ variant: "outline",
427
+ onClick: () => a(`/collaborations/${t.id}`),
428
+ children: c("coolandlovely.marketplace.openCollaboration", "Open collaboration")
429
+ })
430
+ ]
431
+ }),
432
+ /* @__PURE__ */ w(D, {
433
+ open: f !== null,
434
+ onOpenChange: (e) => {
435
+ e || (p(null), d.reset());
436
+ },
437
+ children: /* @__PURE__ */ T(O, { children: [
438
+ /* @__PURE__ */ w(A, { children: c("coolandlovely.marketplace.confirmResponse", "Confirm proposal response") }),
439
+ /* @__PURE__ */ w(k, { children: c("coolandlovely.marketplace.confirmResponseDescription", "Confirm {{status}} for “{{title}}”. This changes collaboration status and does not initiate payment.", {
440
+ status: f ?? "",
441
+ title: t.title
442
+ }) }),
443
+ /* @__PURE__ */ w(E, {
444
+ disabled: d.isPending,
445
+ onClick: () => {
446
+ f && d.mutate({
447
+ id: t.id,
448
+ status: f
449
+ }, { onSuccess: () => p(null) });
450
+ },
451
+ children: c("coolandlovely.marketplace.confirmResponseAction", "Confirm response")
452
+ }),
453
+ /* @__PURE__ */ w(B, { error: d.error })
454
+ ] })
455
+ })
456
+ ]
457
+ });
458
+ }
459
+ function K({ offer: t, mine: n, canCreate: i, canUpdate: a, onEdit: o, onPropose: c, onArchive: l, tr: u }) {
460
+ let { currentUser: d } = e(), f = y();
461
+ return /* @__PURE__ */ T(j, {
462
+ className: "min-w-0 space-y-3 p-4",
463
+ children: [
464
+ /* @__PURE__ */ w("h2", {
465
+ className: "break-words text-lg font-semibold text-text-primary",
466
+ children: t.title
467
+ }),
468
+ /* @__PURE__ */ w("p", {
469
+ className: "text-sm text-text-secondary",
470
+ children: /* @__PURE__ */ w(s, { id: t.creatorId })
471
+ }),
472
+ t.summary && /* @__PURE__ */ w("p", {
473
+ className: "whitespace-pre-wrap break-words text-sm text-text-secondary",
474
+ children: t.summary
475
+ }),
476
+ /* @__PURE__ */ w(H, {
477
+ offer: t,
478
+ tr: u
479
+ }),
480
+ /* @__PURE__ */ w("div", {
481
+ className: "flex flex-wrap gap-2",
482
+ children: n ? /* @__PURE__ */ T(C, { children: [/* @__PURE__ */ w(r, { status: t.isPublished ? "published" : "draft" }), a && /* @__PURE__ */ T(C, { children: [
483
+ /* @__PURE__ */ w(E, {
484
+ variant: "outline",
485
+ onClick: () => o(t),
486
+ children: u("coolandlovely.common.edit", "Edit")
487
+ }),
488
+ /* @__PURE__ */ w(E, {
489
+ variant: "outline",
490
+ disabled: f.isPending,
491
+ onClick: () => f.mutate({
492
+ id: t.id,
493
+ published: !t.isPublished
494
+ }),
495
+ children: t.isPublished ? u("coolandlovely.marketplace.unpublish", "Unpublish") : u("coolandlovely.marketplace.publish", "Publish offer")
496
+ }),
497
+ /* @__PURE__ */ w(E, {
498
+ variant: "outline",
499
+ onClick: () => l(t),
500
+ children: u("coolandlovely.marketplace.archive", "Archive offer")
501
+ })
502
+ ] })] }) : i && t.creatorId !== d?.id && /* @__PURE__ */ w(E, {
503
+ onClick: () => c(t),
504
+ children: u("coolandlovely.marketplace.sendProposal", "Propose a collaboration")
505
+ })
506
+ }),
507
+ /* @__PURE__ */ w(B, { error: f.error })
508
+ ]
509
+ });
510
+ }
511
+ function q({ tab: e, onTab: t, direction: n, onDirection: r, canCreate: i, onNew: a, tr: o }) {
512
+ let s = {
513
+ published: o("coolandlovely.marketplace.browse", "Browse offers"),
514
+ mine: o("coolandlovely.marketplace.mine", "My offers"),
515
+ inbox: o("coolandlovely.marketplace.inbox", "Proposal inbox")
516
+ };
517
+ return /* @__PURE__ */ T(C, { children: [
518
+ /* @__PURE__ */ w("div", {
519
+ className: "mb-5 flex flex-wrap gap-2",
520
+ "aria-label": o("coolandlovely.marketplace.sections", "Marketplace sections"),
521
+ children: [
522
+ "published",
523
+ "mine",
524
+ "inbox"
525
+ ].map((n) => /* @__PURE__ */ w(E, {
526
+ variant: e === n ? "default" : "outline",
527
+ "aria-pressed": e === n,
528
+ onClick: () => t(n),
529
+ children: s[n]
530
+ }, n))
531
+ }),
532
+ e === "mine" && /* @__PURE__ */ T("div", {
533
+ className: "mb-5 flex flex-wrap items-center justify-between gap-3",
534
+ children: [/* @__PURE__ */ w("p", {
535
+ className: "text-sm text-text-secondary",
536
+ children: o("coolandlovely.marketplace.capacity", "Keep up to 20 active offers, including drafts. Archive an offer to free a slot; existing quotes remain available.")
537
+ }), i && /* @__PURE__ */ w(E, {
538
+ onClick: a,
539
+ children: o("coolandlovely.marketplace.newOffer", "New service offer")
540
+ })]
541
+ }),
542
+ e === "inbox" && /* @__PURE__ */ w("div", {
543
+ className: "mb-5 flex flex-wrap gap-2",
544
+ children: [d.Received, d.Sent].map((e) => /* @__PURE__ */ w(E, {
545
+ variant: n === e ? "default" : "outline",
546
+ "aria-pressed": n === e,
547
+ onClick: () => r(e),
548
+ children: e === d.Received ? o("coolandlovely.marketplace.received", "Received") : o("coolandlovely.marketplace.sent", "Sent")
549
+ }, e))
550
+ })
551
+ ] });
552
+ }
553
+ function J({ open: e, onClose: t, onBilling: n, tr: r }) {
554
+ return /* @__PURE__ */ w(D, {
555
+ open: e,
556
+ onOpenChange: (e) => {
557
+ e || t();
558
+ },
559
+ children: /* @__PURE__ */ T(O, { children: [
560
+ /* @__PURE__ */ w(A, { children: r("coolandlovely.marketplace.quotaTitle", "Collaboration allowance reached") }),
561
+ /* @__PURE__ */ w(k, { children: r("coolandlovely.marketplace.quotaDescription", "Your current plan has no remaining collaboration allowance. Review billing to manage your plan or available add-ons.") }),
562
+ /* @__PURE__ */ T("div", {
563
+ className: "flex flex-wrap justify-end gap-2",
564
+ children: [/* @__PURE__ */ w(E, {
565
+ variant: "outline",
566
+ onClick: t,
567
+ children: r("coolandlovely.common.dismiss", "Dismiss")
568
+ }), /* @__PURE__ */ w(E, {
569
+ onClick: n,
570
+ children: r("coolandlovely.marketplace.viewBilling", "View Billing")
571
+ })]
572
+ })
573
+ ] })
574
+ });
575
+ }
576
+ function Y({ tab: e, direction: t, page: n, onPage: r, onRefresh: o, offers: s, inbox: c, canCreate: l, canUpdate: u, onEdit: f, onPropose: p, onArchive: m, navigate: h, tr: g }) {
577
+ let _ = e === "inbox" ? c : s;
578
+ return _.isLoading ? /* @__PURE__ */ w(a, {}) : _.isError ? /* @__PURE__ */ w(i, { onRetry: o }) : /* @__PURE__ */ T(C, { children: [
579
+ _.data?.items.length === 0 && /* @__PURE__ */ w("p", {
580
+ className: "py-10 text-center text-text-secondary",
581
+ children: e === "inbox" ? g("coolandlovely.marketplace.noProposals", "No proposals in this view yet.") : g("coolandlovely.marketplace.noOffers", "No offers in this view yet.")
582
+ }),
583
+ /* @__PURE__ */ w("div", {
584
+ className: "grid gap-4 lg:grid-cols-2",
585
+ children: e === "inbox" ? c.data?.items.map((e) => /* @__PURE__ */ w(G, {
586
+ proposal: e,
587
+ received: t === d.Received,
588
+ canUpdate: u,
589
+ navigate: h,
590
+ tr: g
591
+ }, e.id)) : s.data?.items.map((t) => /* @__PURE__ */ w(K, {
592
+ offer: t,
593
+ mine: e === "mine",
594
+ canCreate: l,
595
+ canUpdate: u,
596
+ onEdit: f,
597
+ onPropose: p,
598
+ onArchive: m,
599
+ tr: g
600
+ }, t.id))
601
+ }),
602
+ /* @__PURE__ */ w(V, {
603
+ page: n,
604
+ hasMore: _.data?.pageInfo.hasMore ?? !1,
605
+ loading: _.isFetching,
606
+ onChange: r
607
+ })
608
+ ] });
609
+ }
610
+ function X() {
611
+ let e = n(), r = c(), i = I("coolandlovely-collaboration:create"), a = I("coolandlovely-collaboration:update"), o = L(), [s, l] = S("published"), [u, p] = S(0), [h, _] = S(d.Received), [v, y] = S(null), [b, x] = S(null), [C, j] = S(null), [M, P] = S(!1), F = g(s === "mine" ? "mine" : "published", u, s !== "inbox"), R = m(h, u, s === "inbox"), z = f(), V = s === "inbox" ? R : F, H = () => {
612
+ N(), V.refetch();
613
+ };
614
+ return /* @__PURE__ */ T(t, {
615
+ title: e("coolandlovely.marketplace.title", "Creator marketplace"),
616
+ description: e("coolandlovely.marketplace.description", "Discover services in this workspace, publish your offers and manage personal brand proposals. Quotes preserve the terms reviewed when sent."),
617
+ actions: /* @__PURE__ */ w(E, {
618
+ variant: "outline",
619
+ disabled: V.isFetching,
620
+ onClick: H,
621
+ children: e("coolandlovely.common.refresh", "Refresh")
622
+ }),
623
+ children: [
624
+ /* @__PURE__ */ w(q, {
625
+ tab: s,
626
+ onTab: (e) => {
627
+ l(e), p(0);
628
+ },
629
+ direction: h,
630
+ onDirection: (e) => {
631
+ _(e), p(0);
632
+ },
633
+ canCreate: i && !o,
634
+ onNew: () => y("new"),
635
+ tr: e
636
+ }),
637
+ /* @__PURE__ */ w(Y, {
638
+ tab: s,
639
+ direction: h,
640
+ page: u,
641
+ onPage: p,
642
+ onRefresh: H,
643
+ offers: F,
644
+ inbox: R,
645
+ canCreate: i && !o,
646
+ canUpdate: a && !o,
647
+ onEdit: y,
648
+ onPropose: x,
649
+ onArchive: (e) => {
650
+ z.reset(), j(e);
651
+ },
652
+ navigate: r,
653
+ tr: e
654
+ }),
655
+ v && /* @__PURE__ */ w(U, {
656
+ offer: v === "new" ? void 0 : v,
657
+ onClose: () => y(null),
658
+ tr: e
659
+ }, v === "new" ? "new" : v.id),
660
+ b && /* @__PURE__ */ w(W, {
661
+ offer: b,
662
+ onOfferReloaded: x,
663
+ onClose: () => x(null),
664
+ onSent: () => {
665
+ x(null), l("inbox"), _(d.Sent), p(0);
666
+ },
667
+ onQuota: () => {
668
+ x(null), P(!0);
669
+ },
670
+ tr: e
671
+ }, b.id),
672
+ /* @__PURE__ */ w(J, {
673
+ open: M,
674
+ onClose: () => P(!1),
675
+ onBilling: () => {
676
+ P(!1), r("/billing", !0);
677
+ },
678
+ tr: e
679
+ }),
680
+ C && /* @__PURE__ */ w(D, {
681
+ open: !0,
682
+ onOpenChange: (e) => {
683
+ !e && !z.isPending && j(null);
684
+ },
685
+ children: /* @__PURE__ */ T(O, { children: [
686
+ /* @__PURE__ */ w(A, { children: e("coolandlovely.marketplace.archive", "Archive offer") }),
687
+ /* @__PURE__ */ w(k, { children: e("coolandlovely.marketplace.archiveHelp", "This offer will disappear from discovery and your active offers. Existing proposal quotes stay unchanged.") }),
688
+ /* @__PURE__ */ w("p", {
689
+ className: "break-words text-text-primary",
690
+ children: C.title
691
+ }),
692
+ /* @__PURE__ */ w(B, { error: z.error }),
693
+ /* @__PURE__ */ w(E, {
694
+ disabled: z.isPending,
695
+ onClick: () => z.mutate({ id: C.id }, { onSuccess: () => j(null) }),
696
+ children: e("coolandlovely.marketplace.confirmArchive", "Confirm archive")
697
+ })
698
+ ] })
699
+ })
700
+ ]
701
+ });
702
+ }
703
+ function Z() {
704
+ let { workspaceId: t } = e();
705
+ return /* @__PURE__ */ w(F, {
706
+ scopeId: t ?? null,
707
+ gateway: "workspace",
708
+ children: /* @__PURE__ */ w(X, {})
709
+ });
710
+ }
711
+ //#endregion
712
+ export { Z as CreatorMarketplacePage };
713
+
714
+ //# sourceMappingURL=CreatorMarketplacePage.js.map