@burdenoff/microfe-headshotmarketing 2026.719.1 → 2026.723.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,92 +2,93 @@ import { useCreateHeadshotmarketingAdCreativeMutation as e, useDeleteHeadshotmar
2
2
  import { cn as i, formatNumber as a, formatPercentage as o } from "../../utils/helpers.js";
3
3
  import { HeadshotmarketingAdCreativeStatus as s, HeadshotmarketingAdCreativeType as c } from "../../../generated/wspace-types.js";
4
4
  import { toAdCreativeModel as l } from "../../utils/adsMapper.js";
5
- import { PageLayout as ee } from "../../components/PageLayout.js";
6
- import { StatusBadge as te } from "../../components/StatusBadge.js";
7
- import { EmptyState as ne } from "../../components/EmptyState.js";
8
- import { FilterBar as re } from "../../components/FilterBar.js";
9
- import { Modal as u } from "../../components/Modal.js";
10
- import { QueryStateBoundary as ie } from "../../components/QueryStateBoundary.js";
11
- import { Pagination as ae } from "../../components/Pagination.js";
5
+ import { PageLayout as u } from "../../components/PageLayout.js";
6
+ import { StatusBadge as ee } from "../../components/StatusBadge.js";
7
+ import { EmptyState as te } from "../../components/EmptyState.js";
8
+ import { FilterBar as ne } from "../../components/FilterBar.js";
9
+ import { Modal as d } from "../../components/Modal.js";
10
+ import { QueryStateBoundary as re } from "../../components/QueryStateBoundary.js";
11
+ import { Pagination as ie } from "../../components/Pagination.js";
12
12
  import "../../components/index.js";
13
- import { useHeadshotmarketingBootstrap as oe } from "../../hooks/useHeadshotmarketingBootstrap.js";
14
- import { usePagination as se } from "../../hooks/usePagination.js";
15
- import { useEffect as d, useMemo as f, useRef as ce, useState as p } from "react";
16
- import { ExternalLink as le, Eye as m, Image as h, Layers as g, MoreHorizontal as _, Pencil as v, Plus as ue, Smartphone as y, Trash2 as de, Type as b, UploadCloud as fe, Video as x } from "lucide-react";
13
+ import { useHeadshotmarketingBootstrap as ae } from "../../hooks/useHeadshotmarketingBootstrap.js";
14
+ import { usePagination as oe } from "../../hooks/usePagination.js";
15
+ import { useEffect as f, useMemo as p, useRef as se, useState as m } from "react";
16
+ import { ExternalLink as ce, Eye as h, Image as g, Layers as _, MoreHorizontal as v, Pencil as y, Plus as le, Smartphone as b, Trash2 as ue, Type as x, UploadCloud as de, Video as fe } from "lucide-react";
17
17
  import { useExclusiveMenu as S } from "@burdenoff/fe-libs/shared/hooks";
18
18
  import { Fragment as C, jsx as w, jsxs as T } from "react/jsx-runtime";
19
19
  import { EmphasisPanel as pe, PagePurpose as me } from "@burdenoff/fe-libs/ui";
20
20
  import { useSaveToFiles as he } from "@burdenoff/fe-libs/storage";
21
21
  //#region src/headshotmarketing/pages/ads/AdCreativesPage.tsx
22
22
  var ge = {
23
- image: h,
24
- video: x,
25
- carousel: g,
26
- text: b,
27
- responsive: y
23
+ image: g,
24
+ video: fe,
25
+ carousel: _,
26
+ text: x,
27
+ responsive: b
28
28
  }, _e = {
29
29
  image: "bg-status-info-bg text-status-info-text",
30
30
  video: "bg-[var(--color-accent-soft)] text-action-primary-bg",
31
31
  carousel: "bg-status-warning-bg text-status-warning-text",
32
32
  text: "bg-bg-sunken text-text-secondary",
33
33
  responsive: "bg-status-success-bg text-status-success-text"
34
- }, E = {
34
+ }, ve = {
35
35
  image: c.Image,
36
36
  video: c.Video,
37
37
  carousel: c.Carousel,
38
38
  text: c.Text,
39
39
  responsive: c.Responsive
40
- }, D = {
40
+ }, ye = {
41
41
  active: s.Active,
42
42
  paused: s.Paused,
43
43
  pending_review: s.PendingReview,
44
44
  rejected: s.Rejected
45
45
  };
46
- function O(e) {
47
- return E[e] ?? c.Image;
46
+ function be(e) {
47
+ return ve[e] ?? c.Image;
48
48
  }
49
- function ve(e) {
50
- return D[e] ?? s.PendingReview;
49
+ function xe(e) {
50
+ return ye[e] ?? s.PendingReview;
51
51
  }
52
- function ye(e) {
52
+ function Se(e) {
53
53
  return e.startsWith("image/") ? "image" : e.startsWith("video/") ? "video" : "text";
54
54
  }
55
- var k = {
55
+ var E = {
56
56
  name: "",
57
57
  type: "image",
58
58
  headline: "",
59
59
  body: "",
60
60
  callToAction: "Learn More",
61
61
  destinationUrl: "",
62
- status: "pending_review"
63
- }, A = () => {
64
- let { data: s, refetch: c } = oe(), [m, g] = p(""), [_, v] = p(""), [y, de] = p("all"), [b, x] = p("all"), [S, A] = p(null), [M, xe] = p(!1), [N, P] = p(k), [F, I] = p(null), [L, R] = p(null), [z, B] = p(null), [V, H] = p(null), [U, W] = p(null), [G, K] = p(null), q = ce(null), J = se({ initialPageSize: 12 }), { limit: Se, offset: Ce, setPage: we, setTotal: Te } = J;
65
- d(() => {
66
- let e = setTimeout(() => v(m), 300);
62
+ status: "pending_review",
63
+ adCampaignId: ""
64
+ }, D = () => {
65
+ let { data: s, refetch: c } = ae(), [h, _] = m(""), [v, y] = m(""), [b, ue] = m("all"), [x, fe] = m("all"), [S, D] = m(null), [k, A] = m(!1), [j, M] = m(E), [N, P] = m(null), [F, I] = m(null), [L, R] = m(null), [z, we] = m(null), [B, V] = m(null), [H, U] = m(null), W = se(null), G = oe({ initialPageSize: 12 }), { limit: Te, offset: Ee, setPage: De, setTotal: Oe } = G;
66
+ f(() => {
67
+ let e = setTimeout(() => y(h), 300);
67
68
  return () => clearTimeout(e);
68
- }, [m]), d(() => {
69
- we(1);
69
+ }, [h]), f(() => {
70
+ De(1);
70
71
  }, [
71
- _,
72
- y,
72
+ v,
73
73
  b,
74
- we
74
+ x,
75
+ De
75
76
  ]);
76
- let { data: Y, loading: Ee, error: De, refetch: Oe } = n({
77
+ let { data: K, loading: ke, error: Ae, refetch: je } = n({
77
78
  variables: {
78
- limit: Se,
79
- offset: Ce,
80
- search: _ || null,
81
- status: D[b] ?? null,
82
- type: E[y] ?? null
79
+ limit: Te,
80
+ offset: Ee,
81
+ search: v || null,
82
+ status: ye[x] ?? null,
83
+ type: ve[b] ?? null
83
84
  },
84
85
  errorPolicy: "all",
85
86
  notifyOnNetworkStatusChange: !0
86
- }), X = Y?.headshotmarketingAdCreatives.total ?? 0;
87
- d(() => {
88
- Te(X);
89
- }, [X, Te]);
90
- let ke = f(() => (Y?.headshotmarketingAdCreatives.items ?? []).map((e) => l(e)), [Y?.headshotmarketingAdCreatives.items]), Z = f(() => {
87
+ }), q = K?.headshotmarketingAdCreatives.total ?? 0;
88
+ f(() => {
89
+ Oe(q);
90
+ }, [q, Oe]);
91
+ let Me = p(() => (K?.headshotmarketingAdCreatives.items ?? []).map((e) => l(e)), [K?.headshotmarketingAdCreatives.items]), J = p(() => {
91
92
  let e = (s?.headshotmarketingAdCreatives.items ?? []).map((e) => l(e)), t = e.filter((e) => e.status === "active").length, n = e.reduce((e, t) => e + t.performance.impressions, 0), r = e.filter((e) => e.performance.impressions > 0), i = r.length > 0 ? r.reduce((e, t) => e + t.performance.ctr, 0) / r.length : 0;
92
93
  return {
93
94
  total: e.length,
@@ -95,32 +96,36 @@ var k = {
95
96
  totalImpressions: n,
96
97
  avgCtr: i
97
98
  };
98
- }, [s?.headshotmarketingAdCreatives.items]), { save: Ae, isPending: je } = he(), [Me, { loading: Ne }] = e(), [Pe, { loading: Fe }] = r(), [Ie, { loading: Le }] = t(), Q = async () => {
99
- await Promise.all([Oe(), c()]);
100
- }, $ = () => {
101
- xe(!1), P(k), I(null), L && URL.revokeObjectURL(L), R(null), q.current && (q.current.value = "");
102
- }, Re = () => {
103
- K(null), P(k), I(null), R(null), xe(!0);
104
- }, ze = (e) => {
105
- if (L && URL.revokeObjectURL(L), !e) {
106
- I(null), R(null);
99
+ }, [s?.headshotmarketingAdCreatives.items]), Y = p(() => s?.headshotmarketingAdCampaigns.items ?? [], [s?.headshotmarketingAdCampaigns.items]), { save: Ne, isPending: Pe } = he(), [Fe, { loading: Ie }] = e(), [Le, { loading: X }] = r(), [Re, { loading: ze }] = t(), Z = async () => {
100
+ await Promise.all([je(), c()]);
101
+ }, Q = () => {
102
+ A(!1), M(E), P(null), F && URL.revokeObjectURL(F), I(null), W.current && (W.current.value = "");
103
+ }, Be = () => {
104
+ U(null), M(E), P(null), I(null), A(!0);
105
+ }, Ve = (e) => {
106
+ if (F && URL.revokeObjectURL(F), !e) {
107
+ P(null), I(null);
107
108
  return;
108
109
  }
109
- I(e), R(e.type.startsWith("image/") ? URL.createObjectURL(e) : null), P((t) => ({
110
+ P(e), I(e.type.startsWith("image/") ? URL.createObjectURL(e) : null), M((t) => ({
110
111
  ...t,
111
112
  name: t.name || e.name.replace(/\.[^.]+$/, ""),
112
- type: ye(e.type)
113
+ type: Se(e.type)
113
114
  }));
114
- }, Be = async () => {
115
- if (!N.name.trim()) {
116
- K("Creative name is required.");
115
+ }, He = async () => {
116
+ if (!j.name.trim()) {
117
+ U("Creative name is required.");
118
+ return;
119
+ }
120
+ if (!j.adCampaignId) {
121
+ U("An ad campaign is required — select one, or create an ad campaign first.");
117
122
  return;
118
123
  }
119
- K(null);
124
+ U(null);
120
125
  try {
121
126
  let e = [], t = {};
122
- if (F) {
123
- let e = F, n = await Ae({
127
+ if (N) {
128
+ let e = N, n = await Ne({
124
129
  source: {
125
130
  kind: "blob",
126
131
  getBlob: async () => ({
@@ -135,21 +140,22 @@ var k = {
135
140
  });
136
141
  t.fileId = n.id, t.fileName = n.name;
137
142
  }
138
- await Me({ variables: { input: {
139
- name: N.name.trim(),
140
- type: O(N.type),
141
- headline: N.headline || null,
142
- body: N.body || null,
143
- callToAction: N.callToAction || null,
144
- destinationUrl: N.destinationUrl || null,
143
+ await Fe({ variables: { input: {
144
+ adCampaignId: j.adCampaignId,
145
+ name: j.name.trim(),
146
+ type: be(j.type),
147
+ headline: j.headline || null,
148
+ body: j.body || null,
149
+ callToAction: j.callToAction || null,
150
+ destinationUrl: j.destinationUrl || null,
145
151
  mediaUrls: e,
146
152
  metadata: Object.keys(t).length > 0 ? t : null
147
- } } }), $(), await Q();
153
+ } } }), Q(), await Z();
148
154
  } catch (e) {
149
- K(e instanceof Error ? e.message : "Failed to upload creative.");
155
+ U(e instanceof Error ? e.message : "Failed to upload creative.");
150
156
  }
151
- }, Ve = (e) => {
152
- A(null), K(null), B({
157
+ }, Ue = (e) => {
158
+ D(null), U(null), R({
153
159
  id: e.id,
154
160
  form: {
155
161
  name: e.name,
@@ -161,47 +167,47 @@ var k = {
161
167
  status: e.status
162
168
  }
163
169
  });
164
- }, He = async () => {
165
- if (z) {
166
- if (!z.form.name.trim()) {
167
- K("Creative name is required.");
170
+ }, We = async () => {
171
+ if (L) {
172
+ if (!L.form.name.trim()) {
173
+ U("Creative name is required.");
168
174
  return;
169
175
  }
170
- K(null);
176
+ U(null);
171
177
  try {
172
- await Pe({ variables: {
173
- id: z.id,
178
+ await Le({ variables: {
179
+ id: L.id,
174
180
  input: {
175
- name: z.form.name.trim(),
176
- type: O(z.form.type),
177
- headline: z.form.headline || null,
178
- body: z.form.body || null,
179
- callToAction: z.form.callToAction || null,
180
- destinationUrl: z.form.destinationUrl || null,
181
- status: ve(z.form.status)
181
+ name: L.form.name.trim(),
182
+ type: be(L.form.type),
183
+ headline: L.form.headline || null,
184
+ body: L.form.body || null,
185
+ callToAction: L.form.callToAction || null,
186
+ destinationUrl: L.form.destinationUrl || null,
187
+ status: xe(L.form.status)
182
188
  }
183
- } }), B(null), await Q();
189
+ } }), R(null), await Z();
184
190
  } catch (e) {
185
- K(e instanceof Error ? e.message : "Failed to save creative.");
191
+ U(e instanceof Error ? e.message : "Failed to save creative.");
186
192
  }
187
193
  }
188
- }, Ue = async () => {
189
- if (U) {
190
- K(null);
194
+ }, Ge = async () => {
195
+ if (B) {
196
+ U(null);
191
197
  try {
192
- await Ie({ variables: { id: U.id } }), W(null), await Q();
198
+ await Re({ variables: { id: B.id } }), V(null), await Z();
193
199
  } catch (e) {
194
- K(e instanceof Error ? e.message : "Failed to delete creative.");
200
+ U(e instanceof Error ? e.message : "Failed to delete creative.");
195
201
  }
196
202
  }
197
- }, We = je || Ne;
198
- return /* @__PURE__ */ T(ee, {
203
+ }, $ = Pe || Ie;
204
+ return /* @__PURE__ */ T(u, {
199
205
  title: "Ad Creatives",
200
206
  description: "Manage your advertising creative assets",
201
207
  actions: /* @__PURE__ */ T("button", {
202
- onClick: Re,
208
+ onClick: Be,
203
209
  className: "inline-flex items-center gap-2 rounded-md bg-foreground px-4 py-2 text-sm font-medium text-background hover:bg-foreground/90",
204
- children: [/* @__PURE__ */ w(ue, { className: "h-4 w-4" }), "Upload Creative"]
210
+ children: [/* @__PURE__ */ w(le, { className: "h-4 w-4" }), "Upload Creative"]
205
211
  }),
206
212
  children: [
207
213
  /* @__PURE__ */ w(me, { children: "Your library of ad creatives — images, videos, carousels and copy. Keep every asset and its real performance (impressions, CTR) in one place so you can quickly see what's resonating and reuse your best creative across campaigns." }),
@@ -213,38 +219,38 @@ var k = {
213
219
  children: "Total Creatives"
214
220
  }), /* @__PURE__ */ w("p", {
215
221
  className: "text-2xl font-semibold text-text-primary",
216
- children: a(Z.total)
222
+ children: a(J.total)
217
223
  })] }),
218
224
  /* @__PURE__ */ T("div", { children: [/* @__PURE__ */ w("p", {
219
225
  className: "text-xs text-text-secondary",
220
226
  children: "Active"
221
227
  }), /* @__PURE__ */ w("p", {
222
228
  className: "text-2xl font-semibold text-text-primary",
223
- children: a(Z.active)
229
+ children: a(J.active)
224
230
  })] }),
225
231
  /* @__PURE__ */ T("div", { children: [/* @__PURE__ */ w("p", {
226
232
  className: "text-xs text-text-secondary",
227
233
  children: "Impressions"
228
234
  }), /* @__PURE__ */ w("p", {
229
235
  className: "text-2xl font-semibold text-text-primary",
230
- children: a(Z.totalImpressions)
236
+ children: a(J.totalImpressions)
231
237
  })] }),
232
238
  /* @__PURE__ */ T("div", { children: [/* @__PURE__ */ w("p", {
233
239
  className: "text-xs text-text-secondary",
234
240
  children: "Avg CTR"
235
241
  }), /* @__PURE__ */ w("p", {
236
242
  className: "text-2xl font-semibold text-text-primary",
237
- children: o(Z.avgCtr)
243
+ children: o(J.avgCtr)
238
244
  })] })
239
245
  ]
240
246
  }) }),
241
- /* @__PURE__ */ w(re, {
242
- searchValue: m,
243
- onSearchChange: g,
247
+ /* @__PURE__ */ w(ne, {
248
+ searchValue: h,
249
+ onSearchChange: _,
244
250
  searchPlaceholder: "Search creatives...",
245
251
  filters: /* @__PURE__ */ T(C, { children: [/* @__PURE__ */ T("select", {
246
- value: y,
247
- onChange: (e) => de(e.target.value),
252
+ value: b,
253
+ onChange: (e) => ue(e.target.value),
248
254
  className: "rounded-md border border-border-seam bg-gloss-card shadow-pop px-3 py-2 text-sm text-text-primary",
249
255
  children: [
250
256
  /* @__PURE__ */ w("option", {
@@ -273,8 +279,8 @@ var k = {
273
279
  })
274
280
  ]
275
281
  }), /* @__PURE__ */ T("select", {
276
- value: b,
277
- onChange: (e) => x(e.target.value),
282
+ value: x,
283
+ onChange: (e) => fe(e.target.value),
278
284
  className: "rounded-md border border-border-seam bg-gloss-card shadow-pop px-3 py-2 text-sm text-text-primary",
279
285
  children: [
280
286
  /* @__PURE__ */ w("option", {
@@ -300,91 +306,91 @@ var k = {
300
306
  ]
301
307
  })] })
302
308
  }),
303
- G && !M && !z && /* @__PURE__ */ w("div", {
309
+ H && !k && !L && /* @__PURE__ */ w("div", {
304
310
  role: "alert",
305
311
  className: "rounded-lg border border-status-error-border/30 bg-status-error-bg/10 px-4 py-3 text-sm text-status-error-text",
306
- children: G
312
+ children: H
307
313
  }),
308
- /* @__PURE__ */ w(ie, {
309
- loading: Ee,
310
- error: De,
311
- onRetry: Oe,
312
- hasData: !!Y,
313
- children: ke.length === 0 ? /* @__PURE__ */ w(ne, {
314
- illustration: X === 0 ? "empty-files" : "empty-search",
315
- title: X === 0 ? "No creatives yet" : "No creatives match your filters",
316
- description: X === 0 ? "Upload images, videos or copy to build your ad creative library." : "Try a different search term, type or status.",
317
- action: X === 0 ? /* @__PURE__ */ T("button", {
318
- onClick: Re,
314
+ /* @__PURE__ */ w(re, {
315
+ loading: ke,
316
+ error: Ae,
317
+ onRetry: je,
318
+ hasData: !!K,
319
+ children: Me.length === 0 ? /* @__PURE__ */ w(te, {
320
+ illustration: q === 0 ? "empty-files" : "empty-search",
321
+ title: q === 0 ? "No creatives yet" : "No creatives match your filters",
322
+ description: q === 0 ? "Upload images, videos or copy to build your ad creative library." : "Try a different search term, type or status.",
323
+ action: q === 0 ? /* @__PURE__ */ T("button", {
324
+ onClick: Be,
319
325
  className: "inline-flex items-center gap-2 rounded-md bg-action-primary-bg px-4 py-2 text-sm font-medium text-action-primary-text hover:bg-action-primary-bg/90",
320
- children: [/* @__PURE__ */ w(ue, { className: "h-4 w-4" }), "Upload Creative"]
326
+ children: [/* @__PURE__ */ w(le, { className: "h-4 w-4" }), "Upload Creative"]
321
327
  }) : void 0
322
328
  }) : /* @__PURE__ */ T(C, { children: [/* @__PURE__ */ w("div", {
323
329
  className: "grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4",
324
- children: ke.map((e) => /* @__PURE__ */ w(be, {
330
+ children: Me.map((e) => /* @__PURE__ */ w(Ce, {
325
331
  creative: e,
326
332
  menuOpen: S === e.id,
327
- onToggleMenu: () => A(S === e.id ? null : e.id),
328
- onCloseMenu: () => A(null),
329
- onPreview: () => H(e),
330
- onEdit: () => Ve(e),
333
+ onToggleMenu: () => D(S === e.id ? null : e.id),
334
+ onCloseMenu: () => D(null),
335
+ onPreview: () => we(e),
336
+ onEdit: () => Ue(e),
331
337
  onDelete: () => {
332
- A(null), W(e);
338
+ D(null), V(e);
333
339
  }
334
340
  }, e.id))
335
- }), /* @__PURE__ */ w(ae, {
336
- page: J.page,
337
- pageSize: J.pageSize,
338
- total: J.total,
339
- onPageChange: J.setPage,
340
- onPageSizeChange: J.setPageSize,
341
+ }), /* @__PURE__ */ w(ie, {
342
+ page: G.page,
343
+ pageSize: G.pageSize,
344
+ total: G.total,
345
+ onPageChange: G.setPage,
346
+ onPageSizeChange: G.setPageSize,
341
347
  pageSizeOptions: [
342
348
  12,
343
349
  24,
344
350
  48
345
351
  ],
346
- disabled: Ee,
352
+ disabled: ke,
347
353
  hideWhenSinglePage: !0
348
354
  })] })
349
355
  }),
350
- /* @__PURE__ */ w(u, {
351
- open: M,
352
- onClose: $,
356
+ /* @__PURE__ */ w(d, {
357
+ open: k,
358
+ onClose: Q,
353
359
  title: "Upload Creative",
354
360
  description: "Add a new creative asset to your library",
355
361
  size: "lg",
356
362
  footer: /* @__PURE__ */ T(C, { children: [/* @__PURE__ */ w("button", {
357
- onClick: $,
363
+ onClick: Q,
358
364
  className: "rounded-md border border-border-subtle px-4 py-2 text-sm font-medium text-text-primary hover:bg-bg-sunken",
359
365
  children: "Cancel"
360
366
  }), /* @__PURE__ */ w("button", {
361
- onClick: Be,
362
- disabled: We,
367
+ onClick: He,
368
+ disabled: $,
363
369
  className: "rounded-md bg-foreground px-4 py-2 text-sm font-medium text-background hover:bg-foreground/90 disabled:opacity-60",
364
- children: We ? "Uploading..." : "Upload Creative"
370
+ children: $ ? "Uploading..." : "Upload Creative"
365
371
  })] }),
366
372
  children: /* @__PURE__ */ T("div", {
367
373
  className: "space-y-4",
368
374
  children: [
369
375
  /* @__PURE__ */ T("div", { children: [/* @__PURE__ */ w("input", {
370
- ref: q,
376
+ ref: W,
371
377
  type: "file",
372
378
  accept: "image/*,video/*",
373
379
  className: "sr-only",
374
- onChange: (e) => ze(e.target.files?.[0] ?? null)
380
+ onChange: (e) => Ve(e.target.files?.[0] ?? null)
375
381
  }), /* @__PURE__ */ T("button", {
376
382
  type: "button",
377
- onClick: () => q.current?.click(),
383
+ onClick: () => W.current?.click(),
378
384
  className: "flex w-full flex-col items-center justify-center gap-2 rounded-lg border border-dashed border-border-subtle bg-bg-sunken/40 px-4 py-6 text-center transition-colors hover:border-foreground/40",
379
385
  children: [
380
- L ? /* @__PURE__ */ w("img", {
381
- src: L,
386
+ F ? /* @__PURE__ */ w("img", {
387
+ src: F,
382
388
  alt: "Selected creative preview",
383
389
  className: "max-h-40 rounded-md object-contain"
384
- }) : /* @__PURE__ */ w(fe, { className: "h-8 w-8 text-text-secondary" }),
390
+ }) : /* @__PURE__ */ w(de, { className: "h-8 w-8 text-text-secondary" }),
385
391
  /* @__PURE__ */ w("span", {
386
392
  className: "text-sm font-medium text-text-primary",
387
- children: F ? F.name : "Click to select a file"
393
+ children: N ? N.name : "Click to select a file"
388
394
  }),
389
395
  /* @__PURE__ */ w("span", {
390
396
  className: "text-xs text-text-secondary",
@@ -399,9 +405,9 @@ var k = {
399
405
  children: "Name"
400
406
  }), /* @__PURE__ */ w("input", {
401
407
  type: "text",
402
- value: N.name,
403
- onChange: (e) => P({
404
- ...N,
408
+ value: j.name,
409
+ onChange: (e) => M({
410
+ ...j,
405
411
  name: e.target.value
406
412
  }),
407
413
  placeholder: "e.g., Spring Promo Hero",
@@ -410,9 +416,9 @@ var k = {
410
416
  className: "mb-1.5 block text-sm font-medium text-text-primary",
411
417
  children: "Type"
412
418
  }), /* @__PURE__ */ T("select", {
413
- value: N.type,
414
- onChange: (e) => P({
415
- ...N,
419
+ value: j.type,
420
+ onChange: (e) => M({
421
+ ...j,
416
422
  type: e.target.value
417
423
  }),
418
424
  className: "w-full rounded-md border border-border-subtle bg-bg-surface px-4 py-2.5 text-sm text-text-primary focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)]",
@@ -440,14 +446,40 @@ var k = {
440
446
  ]
441
447
  })] })]
442
448
  }),
449
+ /* @__PURE__ */ T("div", { children: [
450
+ /* @__PURE__ */ w("label", {
451
+ className: "mb-1.5 block text-sm font-medium text-text-primary",
452
+ children: "Ad Campaign"
453
+ }),
454
+ /* @__PURE__ */ T("select", {
455
+ value: j.adCampaignId,
456
+ onChange: (e) => M({
457
+ ...j,
458
+ adCampaignId: e.target.value
459
+ }),
460
+ disabled: Y.length === 0,
461
+ className: "w-full rounded-md border border-border-subtle bg-bg-surface px-4 py-2.5 text-sm text-text-primary focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)] disabled:cursor-not-allowed disabled:opacity-60",
462
+ children: [/* @__PURE__ */ w("option", {
463
+ value: "",
464
+ children: Y.length === 0 ? "No ad campaigns yet — create one first" : "Select an ad campaign"
465
+ }), Y.map((e) => /* @__PURE__ */ w("option", {
466
+ value: e.id,
467
+ children: e.name
468
+ }, e.id))]
469
+ }),
470
+ /* @__PURE__ */ w("p", {
471
+ className: "mt-1 text-xs text-text-secondary",
472
+ children: "Every creative belongs to an ad campaign so its performance rolls up correctly."
473
+ })
474
+ ] }),
443
475
  /* @__PURE__ */ T("div", { children: [/* @__PURE__ */ w("label", {
444
476
  className: "mb-1.5 block text-sm font-medium text-text-primary",
445
477
  children: "Headline"
446
478
  }), /* @__PURE__ */ w("input", {
447
479
  type: "text",
448
- value: N.headline,
449
- onChange: (e) => P({
450
- ...N,
480
+ value: j.headline,
481
+ onChange: (e) => M({
482
+ ...j,
451
483
  headline: e.target.value
452
484
  }),
453
485
  className: "w-full rounded-md border border-border-subtle bg-bg-surface px-4 py-2.5 text-sm text-text-primary focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)]"
@@ -459,9 +491,9 @@ var k = {
459
491
  children: "Call to Action"
460
492
  }), /* @__PURE__ */ w("input", {
461
493
  type: "text",
462
- value: N.callToAction,
463
- onChange: (e) => P({
464
- ...N,
494
+ value: j.callToAction,
495
+ onChange: (e) => M({
496
+ ...j,
465
497
  callToAction: e.target.value
466
498
  }),
467
499
  className: "w-full rounded-md border border-border-subtle bg-bg-surface px-4 py-2.5 text-sm text-text-primary focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)]"
@@ -470,38 +502,38 @@ var k = {
470
502
  children: "Destination URL"
471
503
  }), /* @__PURE__ */ w("input", {
472
504
  type: "url",
473
- value: N.destinationUrl,
474
- onChange: (e) => P({
475
- ...N,
505
+ value: j.destinationUrl,
506
+ onChange: (e) => M({
507
+ ...j,
476
508
  destinationUrl: e.target.value
477
509
  }),
478
510
  placeholder: "https://",
479
511
  className: "w-full rounded-md border border-border-subtle bg-bg-surface px-4 py-2.5 text-sm text-text-primary focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)]"
480
512
  })] })]
481
513
  }),
482
- G && /* @__PURE__ */ w("p", {
514
+ H && /* @__PURE__ */ w("p", {
483
515
  className: "text-sm text-status-error-text",
484
- children: G
516
+ children: H
485
517
  })
486
518
  ]
487
519
  })
488
520
  }),
489
- /* @__PURE__ */ w(u, {
490
- open: z !== null,
491
- onClose: () => B(null),
521
+ /* @__PURE__ */ w(d, {
522
+ open: L !== null,
523
+ onClose: () => R(null),
492
524
  title: "Edit Creative",
493
525
  size: "lg",
494
526
  footer: /* @__PURE__ */ T(C, { children: [/* @__PURE__ */ w("button", {
495
- onClick: () => B(null),
527
+ onClick: () => R(null),
496
528
  className: "rounded-md border border-border-subtle px-4 py-2 text-sm font-medium text-text-primary hover:bg-bg-sunken",
497
529
  children: "Cancel"
498
530
  }), /* @__PURE__ */ w("button", {
499
- onClick: He,
500
- disabled: Fe,
531
+ onClick: We,
532
+ disabled: X,
501
533
  className: "rounded-md bg-foreground px-4 py-2 text-sm font-medium text-background hover:bg-foreground/90 disabled:opacity-60",
502
- children: Fe ? "Saving..." : "Save Changes"
534
+ children: X ? "Saving..." : "Save Changes"
503
535
  })] }),
504
- children: z && /* @__PURE__ */ T("div", {
536
+ children: L && /* @__PURE__ */ T("div", {
505
537
  className: "space-y-4",
506
538
  children: [
507
539
  /* @__PURE__ */ T("div", {
@@ -511,11 +543,11 @@ var k = {
511
543
  children: "Name"
512
544
  }), /* @__PURE__ */ w("input", {
513
545
  type: "text",
514
- value: z.form.name,
515
- onChange: (e) => B({
516
- ...z,
546
+ value: L.form.name,
547
+ onChange: (e) => R({
548
+ ...L,
517
549
  form: {
518
- ...z.form,
550
+ ...L.form,
519
551
  name: e.target.value
520
552
  }
521
553
  }),
@@ -524,11 +556,11 @@ var k = {
524
556
  className: "mb-1.5 block text-sm font-medium text-text-primary",
525
557
  children: "Status"
526
558
  }), /* @__PURE__ */ T("select", {
527
- value: z.form.status,
528
- onChange: (e) => B({
529
- ...z,
559
+ value: L.form.status,
560
+ onChange: (e) => R({
561
+ ...L,
530
562
  form: {
531
- ...z.form,
563
+ ...L.form,
532
564
  status: e.target.value
533
565
  }
534
566
  }),
@@ -558,11 +590,11 @@ var k = {
558
590
  children: "Headline"
559
591
  }), /* @__PURE__ */ w("input", {
560
592
  type: "text",
561
- value: z.form.headline,
562
- onChange: (e) => B({
563
- ...z,
593
+ value: L.form.headline,
594
+ onChange: (e) => R({
595
+ ...L,
564
596
  form: {
565
- ...z.form,
597
+ ...L.form,
566
598
  headline: e.target.value
567
599
  }
568
600
  }),
@@ -572,11 +604,11 @@ var k = {
572
604
  className: "mb-1.5 block text-sm font-medium text-text-primary",
573
605
  children: "Body"
574
606
  }), /* @__PURE__ */ w("textarea", {
575
- value: z.form.body,
576
- onChange: (e) => B({
577
- ...z,
607
+ value: L.form.body,
608
+ onChange: (e) => R({
609
+ ...L,
578
610
  form: {
579
- ...z.form,
611
+ ...L.form,
580
612
  body: e.target.value
581
613
  }
582
614
  }),
@@ -590,11 +622,11 @@ var k = {
590
622
  children: "Call to Action"
591
623
  }), /* @__PURE__ */ w("input", {
592
624
  type: "text",
593
- value: z.form.callToAction,
594
- onChange: (e) => B({
595
- ...z,
625
+ value: L.form.callToAction,
626
+ onChange: (e) => R({
627
+ ...L,
596
628
  form: {
597
- ...z.form,
629
+ ...L.form,
598
630
  callToAction: e.target.value
599
631
  }
600
632
  }),
@@ -604,46 +636,46 @@ var k = {
604
636
  children: "Destination URL"
605
637
  }), /* @__PURE__ */ w("input", {
606
638
  type: "url",
607
- value: z.form.destinationUrl,
608
- onChange: (e) => B({
609
- ...z,
639
+ value: L.form.destinationUrl,
640
+ onChange: (e) => R({
641
+ ...L,
610
642
  form: {
611
- ...z.form,
643
+ ...L.form,
612
644
  destinationUrl: e.target.value
613
645
  }
614
646
  }),
615
647
  className: "w-full rounded-md border border-border-subtle bg-bg-surface px-4 py-2.5 text-sm text-text-primary focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)]"
616
648
  })] })]
617
649
  }),
618
- G && /* @__PURE__ */ w("p", {
650
+ H && /* @__PURE__ */ w("p", {
619
651
  className: "text-sm text-status-error-text",
620
- children: G
652
+ children: H
621
653
  })
622
654
  ]
623
655
  })
624
656
  }),
625
- /* @__PURE__ */ w(u, {
626
- open: V !== null,
627
- onClose: () => H(null),
628
- title: V?.name ?? "Creative Preview",
629
- description: V?.headline,
657
+ /* @__PURE__ */ w(d, {
658
+ open: z !== null,
659
+ onClose: () => we(null),
660
+ title: z?.name ?? "Creative Preview",
661
+ description: z?.headline,
630
662
  size: "lg",
631
- children: V && /* @__PURE__ */ T("div", {
663
+ children: z && /* @__PURE__ */ T("div", {
632
664
  className: "space-y-4",
633
665
  children: [
634
666
  /* @__PURE__ */ w("div", {
635
667
  className: "flex min-h-[12rem] items-center justify-center rounded-lg border border-border-subtle bg-bg-sunken/40 p-4",
636
- children: V.mediaUrl ? V.type === "video" ? /* @__PURE__ */ w("video", {
637
- src: V.mediaUrl,
668
+ children: z.mediaUrl ? z.type === "video" ? /* @__PURE__ */ w("video", {
669
+ src: z.mediaUrl,
638
670
  controls: !0,
639
671
  className: "max-h-80 rounded-md"
640
672
  }) : /* @__PURE__ */ w("img", {
641
- src: V.mediaUrl,
642
- alt: V.name,
673
+ src: z.mediaUrl,
674
+ alt: z.name,
643
675
  className: "max-h-80 rounded-md object-contain"
644
676
  }) : /* @__PURE__ */ T("div", {
645
677
  className: "flex flex-col items-center gap-2 text-text-secondary",
646
- children: [/* @__PURE__ */ w(ge[V.type] ?? h, { className: "h-12 w-12" }), /* @__PURE__ */ w("span", {
678
+ children: [/* @__PURE__ */ w(ge[z.type] ?? g, { className: "h-12 w-12" }), /* @__PURE__ */ w("span", {
647
679
  className: "text-xs",
648
680
  children: "No media preview available"
649
681
  })]
@@ -653,65 +685,65 @@ var k = {
653
685
  className: "flex flex-wrap items-center gap-2",
654
686
  children: [
655
687
  /* @__PURE__ */ w("span", {
656
- className: i("rounded-full px-2.5 py-0.5 text-xs font-medium capitalize", _e[V.type]),
657
- children: V.type
688
+ className: i("rounded-full px-2.5 py-0.5 text-xs font-medium capitalize", _e[z.type]),
689
+ children: z.type
658
690
  }),
659
- /* @__PURE__ */ w(te, { status: V.status }),
660
- V.callToAction && /* @__PURE__ */ T("span", {
691
+ /* @__PURE__ */ w(ee, { status: z.status }),
692
+ z.callToAction && /* @__PURE__ */ T("span", {
661
693
  className: "text-xs text-text-secondary",
662
- children: ["CTA: ", V.callToAction]
694
+ children: ["CTA: ", z.callToAction]
663
695
  })
664
696
  ]
665
697
  }),
666
- V.description && /* @__PURE__ */ w("p", {
698
+ z.description && /* @__PURE__ */ w("p", {
667
699
  className: "text-sm text-text-secondary",
668
- children: V.description
700
+ children: z.description
669
701
  }),
670
- V.landingPageUrl && /* @__PURE__ */ T("a", {
671
- href: V.landingPageUrl,
702
+ z.landingPageUrl && /* @__PURE__ */ T("a", {
703
+ href: z.landingPageUrl,
672
704
  target: "_blank",
673
705
  rel: "noreferrer",
674
706
  className: "inline-flex items-center gap-1.5 text-sm text-action-primary-bg hover:underline",
675
- children: [/* @__PURE__ */ w(le, { className: "h-3.5 w-3.5" }), V.landingPageUrl]
707
+ children: [/* @__PURE__ */ w(ce, { className: "h-3.5 w-3.5" }), z.landingPageUrl]
676
708
  }),
677
- V.performance.impressions > 0 && /* @__PURE__ */ T("div", {
709
+ z.performance.impressions > 0 && /* @__PURE__ */ T("div", {
678
710
  className: "grid grid-cols-2 gap-3 sm:grid-cols-4",
679
711
  children: [
680
- /* @__PURE__ */ w(j, {
712
+ /* @__PURE__ */ w(O, {
681
713
  label: "Impressions",
682
- value: a(V.performance.impressions)
714
+ value: a(z.performance.impressions)
683
715
  }),
684
- /* @__PURE__ */ w(j, {
716
+ /* @__PURE__ */ w(O, {
685
717
  label: "Clicks",
686
- value: a(V.performance.clicks)
718
+ value: a(z.performance.clicks)
687
719
  }),
688
- /* @__PURE__ */ w(j, {
720
+ /* @__PURE__ */ w(O, {
689
721
  label: "CTR",
690
- value: o(V.performance.ctr)
722
+ value: o(z.performance.ctr)
691
723
  }),
692
- /* @__PURE__ */ w(j, {
724
+ /* @__PURE__ */ w(O, {
693
725
  label: "Conversions",
694
- value: a(V.performance.conversions)
726
+ value: a(z.performance.conversions)
695
727
  })
696
728
  ]
697
729
  })
698
730
  ]
699
731
  })
700
732
  }),
701
- /* @__PURE__ */ w(u, {
702
- open: U !== null,
703
- onClose: () => W(null),
733
+ /* @__PURE__ */ w(d, {
734
+ open: B !== null,
735
+ onClose: () => V(null),
704
736
  title: "Delete Creative",
705
737
  size: "sm",
706
738
  footer: /* @__PURE__ */ T(C, { children: [/* @__PURE__ */ w("button", {
707
- onClick: () => W(null),
739
+ onClick: () => V(null),
708
740
  className: "rounded-md border border-border-subtle px-4 py-2 text-sm font-medium text-text-primary hover:bg-bg-sunken",
709
741
  children: "Cancel"
710
742
  }), /* @__PURE__ */ w("button", {
711
- onClick: Ue,
712
- disabled: Le,
743
+ onClick: Ge,
744
+ disabled: ze,
713
745
  className: "rounded-md bg-status-error-text px-4 py-2 text-sm font-medium text-background hover:opacity-90 disabled:opacity-60",
714
- children: Le ? "Deleting..." : "Delete"
746
+ children: ze ? "Deleting..." : "Delete"
715
747
  })] }),
716
748
  children: /* @__PURE__ */ T("p", {
717
749
  className: "text-sm text-text-secondary",
@@ -720,7 +752,7 @@ var k = {
720
752
  " ",
721
753
  /* @__PURE__ */ w("span", {
722
754
  className: "font-semibold text-text-primary",
723
- children: U?.name
755
+ children: B?.name
724
756
  }),
725
757
  "? This action cannot be undone."
726
758
  ]
@@ -728,7 +760,7 @@ var k = {
728
760
  })
729
761
  ]
730
762
  });
731
- }, j = ({ label: e, value: t }) => /* @__PURE__ */ T("div", {
763
+ }, O = ({ label: e, value: t }) => /* @__PURE__ */ T("div", {
732
764
  className: "rounded-md bg-bg-sunken/50 py-2 text-center",
733
765
  children: [/* @__PURE__ */ w("p", {
734
766
  className: "text-sm font-bold text-text-primary",
@@ -737,9 +769,9 @@ var k = {
737
769
  className: "text-[10px] text-text-secondary",
738
770
  children: e
739
771
  })]
740
- }), be = ({ creative: e, menuOpen: t, onToggleMenu: n, onCloseMenu: r, onPreview: s, onEdit: c, onDelete: l }) => {
772
+ }), Ce = ({ creative: e, menuOpen: t, onToggleMenu: n, onCloseMenu: r, onPreview: s, onEdit: c, onDelete: l }) => {
741
773
  S(`ad-creative-${e.id}`, t, r);
742
- let ee = ge[e.type] || h;
774
+ let u = ge[e.type] || g;
743
775
  return /* @__PURE__ */ T("div", {
744
776
  className: "overflow-hidden rounded-lg border border-border-seam bg-gloss-card shadow-pop transition-colors hover:border-foreground/30",
745
777
  children: [/* @__PURE__ */ T("button", {
@@ -751,9 +783,9 @@ var k = {
751
783
  src: e.mediaUrl,
752
784
  alt: e.name,
753
785
  className: "h-full w-full object-cover"
754
- }) : /* @__PURE__ */ w(ee, { className: "h-12 w-12 text-text-secondary/40" }), /* @__PURE__ */ w("div", {
786
+ }) : /* @__PURE__ */ w(u, { className: "h-12 w-12 text-text-secondary/40" }), /* @__PURE__ */ w("div", {
755
787
  className: "absolute right-2 top-2",
756
- children: /* @__PURE__ */ w(te, { status: e.status })
788
+ children: /* @__PURE__ */ w(ee, { status: e.status })
757
789
  })]
758
790
  }), /* @__PURE__ */ T("div", {
759
791
  className: "space-y-3 p-4",
@@ -802,7 +834,7 @@ var k = {
802
834
  children: [/* @__PURE__ */ T("button", {
803
835
  onClick: s,
804
836
  className: "inline-flex items-center gap-1 text-xs text-text-secondary hover:text-text-primary",
805
- children: [/* @__PURE__ */ w(m, { className: "h-3 w-3" }), "Preview"]
837
+ children: [/* @__PURE__ */ w(h, { className: "h-3 w-3" }), "Preview"]
806
838
  }), /* @__PURE__ */ T("div", {
807
839
  className: "relative",
808
840
  children: [/* @__PURE__ */ w("button", {
@@ -811,7 +843,7 @@ var k = {
811
843
  "aria-expanded": t,
812
844
  "aria-label": "Creative actions",
813
845
  className: "text-text-secondary hover:text-text-primary",
814
- children: /* @__PURE__ */ w(_, { className: "h-4 w-4" })
846
+ children: /* @__PURE__ */ w(v, { className: "h-4 w-4" })
815
847
  }), t && /* @__PURE__ */ T("div", {
816
848
  role: "menu",
817
849
  className: "absolute bottom-6 right-0 z-20 w-36 rounded-md border border-border-seam bg-gloss-card py-1 shadow-lg",
@@ -819,12 +851,12 @@ var k = {
819
851
  role: "menuitem",
820
852
  onClick: c,
821
853
  className: "flex w-full items-center gap-2 px-4 py-2 text-left text-sm text-text-primary hover:bg-bg-sunken",
822
- children: [/* @__PURE__ */ w(v, { className: "h-3.5 w-3.5" }), "Edit"]
854
+ children: [/* @__PURE__ */ w(y, { className: "h-3.5 w-3.5" }), "Edit"]
823
855
  }), /* @__PURE__ */ T("button", {
824
856
  role: "menuitem",
825
857
  onClick: l,
826
858
  className: "flex w-full items-center gap-2 px-4 py-2 text-left text-sm text-status-error-text hover:bg-bg-sunken",
827
- children: [/* @__PURE__ */ w(de, { className: "h-3.5 w-3.5" }), "Delete"]
859
+ children: [/* @__PURE__ */ w(ue, { className: "h-3.5 w-3.5" }), "Delete"]
828
860
  })]
829
861
  })]
830
862
  })]
@@ -834,6 +866,6 @@ var k = {
834
866
  });
835
867
  };
836
868
  //#endregion
837
- export { A as AdCreativesPage };
869
+ export { D as AdCreativesPage };
838
870
 
839
871
  //# sourceMappingURL=AdCreativesPage.js.map