@burdenoff/microfe-headshotmarketing 2026.1029.6 → 2026.1030.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. package/dist/generated/wspace-operations.d.ts +2 -0
  2. package/dist/generated/wspace-operations.d.ts.map +1 -1
  3. package/dist/generated/wspace-operations.js +2 -0
  4. package/dist/generated/wspace-operations.js.map +1 -1
  5. package/dist/headshotmarketing/pages/ads/AdCampaignsPage.d.ts.map +1 -1
  6. package/dist/headshotmarketing/pages/ads/AdCampaignsPage.js +474 -386
  7. package/dist/headshotmarketing/pages/ads/AdCampaignsPage.js.map +1 -1
  8. package/dist/headshotmarketing/pages/ads/AdPlatformConnectionsSection.d.ts.map +1 -1
  9. package/dist/headshotmarketing/pages/ads/AdPlatformConnectionsSection.js +94 -94
  10. package/dist/headshotmarketing/pages/ads/AdPlatformConnectionsSection.js.map +1 -1
  11. package/dist/headshotmarketing/pages/ads/AudiencesPage.d.ts.map +1 -1
  12. package/dist/headshotmarketing/pages/ads/AudiencesPage.js +448 -339
  13. package/dist/headshotmarketing/pages/ads/AudiencesPage.js.map +1 -1
  14. package/dist/headshotmarketing/pages/ads/CreateAdCampaignPage.d.ts +7 -0
  15. package/dist/headshotmarketing/pages/ads/CreateAdCampaignPage.d.ts.map +1 -1
  16. package/dist/headshotmarketing/pages/ads/CreateAdCampaignPage.js +463 -446
  17. package/dist/headshotmarketing/pages/ads/CreateAdCampaignPage.js.map +1 -1
  18. package/dist/headshotmarketing/pages/ads/adCampaignStepper.d.ts +53 -0
  19. package/dist/headshotmarketing/pages/ads/adCampaignStepper.d.ts.map +1 -0
  20. package/dist/headshotmarketing/pages/ads/adCampaignStepper.js +151 -0
  21. package/dist/headshotmarketing/pages/ads/adCampaignStepper.js.map +1 -0
  22. package/dist/headshotmarketing/pages/ads/audienceDetails.d.ts +31 -0
  23. package/dist/headshotmarketing/pages/ads/audienceDetails.d.ts.map +1 -0
  24. package/dist/headshotmarketing/pages/ads/audienceDetails.js +64 -0
  25. package/dist/headshotmarketing/pages/ads/audienceDetails.js.map +1 -0
  26. package/dist/headshotmarketing/types/index.d.ts +14 -1
  27. package/dist/headshotmarketing/types/index.d.ts.map +1 -1
  28. package/dist/headshotmarketing/utils/adsMapper.d.ts +6 -1
  29. package/dist/headshotmarketing/utils/adsMapper.d.ts.map +1 -1
  30. package/dist/headshotmarketing/utils/adsMapper.js +27 -11
  31. package/dist/headshotmarketing/utils/adsMapper.js.map +1 -1
  32. package/dist/utils/pageContext.d.ts +60 -15
  33. package/dist/utils/pageContext.d.ts.map +1 -1
  34. package/dist/utils/pageContext.js +77 -57
  35. package/dist/utils/pageContext.js.map +1 -1
  36. package/package.json +1 -1
@@ -1,21 +1,21 @@
1
1
  import { useCreateHeadshotmarketingAdPlatformConnectionMutation as e, useDeleteHeadshotmarketingAdPlatformConnectionMutation as t, useHeadshotmarketingAdPlatformConnectionsListQuery as n } from "../../../generated/wspace-operations.js";
2
2
  import { formatDate as r } from "../../utils/helpers.js";
3
- import { HeadshotmarketingAdPlatform as i } from "../../../generated/wspace-types.js";
4
- import { StatusBadge as ee } from "../../components/StatusBadge.js";
3
+ import { HeadshotmarketingAdPlatform as ee } from "../../../generated/wspace-types.js";
4
+ import { StatusBadge as i } from "../../components/StatusBadge.js";
5
5
  import { Modal as a } from "../../components/Modal.js";
6
6
  import { ConfirmDeleteDialog as o } from "../../components/ConfirmDeleteDialog.js";
7
7
  import "../../components/index.js";
8
- import { AD_CONNECT_PROVIDERS as s, WEBHOOK_PLATFORMS as c, adPlatformLabel as l, buildWebhookAdConnectionInput as u, describeConnectionContext as d, validateAdConnectValues as te, validateWebhookUrl as ne } from "./adConnect.js";
9
- import { useAdPlatformConnect as re } from "./useAdPlatformConnect.js";
10
- import { useState as f } from "react";
11
- import { Link2 as p, Loader2 as m, Plug as h, Trash2 as g, Webhook as _ } from "lucide-react";
12
- import { jsx as v, jsxs as y } from "react/jsx-runtime";
8
+ import { AD_CONNECT_PROVIDERS as s, WEBHOOK_PLATFORMS as c, adPlatformLabel as l, buildWebhookAdConnectionInput as u, describeConnectionContext as d, validateAdConnectValues as f, validateWebhookUrl as te } from "./adConnect.js";
9
+ import { useAdPlatformConnect as ne } from "./useAdPlatformConnect.js";
10
+ import { useState as p } from "react";
11
+ import { Link2 as re, Loader2 as ie, Plug as ae, Trash2 as m, Webhook as h } from "lucide-react";
12
+ import { jsx as g, jsxs as _ } from "react/jsx-runtime";
13
13
  //#region src/headshotmarketing/pages/ads/AdPlatformConnectionsSection.tsx
14
- var b = "w-full rounded-md border border-border-subtle bg-bg-surface px-3 py-2 text-sm text-text-primary placeholder:text-text-secondary focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)]", x = "inline-flex items-center gap-2 rounded-md border border-border-seam bg-gloss-card px-3 py-1.5 text-xs font-medium text-text-primary hover:bg-bg-sunken disabled:opacity-60", S = "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 disabled:opacity-60";
15
- function C(e, t) {
14
+ var v = "w-full rounded-md border border-border-subtle bg-bg-surface px-3 py-2 text-sm text-text-primary placeholder:text-text-secondary focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)]", y = "inline-flex items-center gap-2 rounded-md border border-border-seam bg-gloss-card px-3 py-1.5 text-xs font-medium text-text-primary hover:bg-bg-sunken disabled:opacity-60", b = "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 disabled:opacity-60";
15
+ function x(e, t) {
16
16
  return e instanceof Error && e.message ? e.message : t;
17
17
  }
18
- function w(e) {
18
+ function oe(e) {
19
19
  if (!e) return "";
20
20
  try {
21
21
  return new URL(e).host;
@@ -23,11 +23,11 @@ function w(e) {
23
23
  return e;
24
24
  }
25
25
  }
26
- var T = () => {
27
- let { data: T, loading: E, error: D, refetch: O } = n({
26
+ var S = () => {
27
+ let { data: S, loading: C, error: w, refetch: T } = n({
28
28
  variables: { pagination: { limit: 100 } },
29
29
  fetchPolicy: "cache-and-network"
30
- }), [ie, { loading: k }] = e(), [ae, { loading: oe }] = t(), { connecting: A, error: j, clearError: M, connect: N } = re(() => O()), [P, F] = f(null), [I, L] = f({}), [R, z] = f({}), [B, V] = f(!1), [H, U] = f(i.FacebookAds), [W, G] = f(""), [K, q] = f(null), [J, Y] = f(null), [se, X] = f(null), [Z, Q] = f(null), $ = T?.headshotmarketingAdPlatformConnections.items ?? [], ce = (e) => {
30
+ }), [E, { loading: D }] = e(), [O, { loading: k }] = t(), { connecting: A, error: j, clearError: M, connect: N } = ne(() => T()), [P, F] = p(null), [I, L] = p({}), [R, z] = p({}), [B, V] = p(!1), [H, U] = p(ee.FacebookAds), [W, G] = p(""), [K, q] = p(null), [J, Y] = p(null), [se, X] = p(null), [Z, Q] = p(null), $ = S?.headshotmarketingAdPlatformConnections.items ?? [], ce = (e) => {
31
31
  if (M(), Q(null), e.fields.length === 0) {
32
32
  N(e, {}).then((t) => {
33
33
  t && Q(`${e.label} connected.`);
@@ -37,7 +37,7 @@ var T = () => {
37
37
  L({}), z({}), F(e);
38
38
  }, le = (e) => {
39
39
  if (e.preventDefault(), !P) return;
40
- let t = te(P, I);
40
+ let t = f(P, I);
41
41
  if (!t.ok) {
42
42
  z(t.errors);
43
43
  return;
@@ -48,130 +48,130 @@ var T = () => {
48
48
  });
49
49
  }, ue = async (e) => {
50
50
  e.preventDefault();
51
- let t = ne(W);
51
+ let t = te(W);
52
52
  if (t) {
53
53
  q(t);
54
54
  return;
55
55
  }
56
56
  q(null);
57
57
  try {
58
- await ie({ variables: { input: u({
58
+ await E({ variables: { input: u({
59
59
  platform: H,
60
60
  webhookUrl: W
61
- }) } }), V(!1), G(""), Q(`${l(H)} webhook relay added.`), await O();
61
+ }) } }), V(!1), G(""), M(), Q(`${l(H)} webhook relay added.`), await T();
62
62
  } catch (e) {
63
- q(C(e, "Could not add the webhook relay."));
63
+ q(x(e, "Could not add the webhook relay."));
64
64
  }
65
65
  }, de = async () => {
66
66
  if (J) {
67
67
  X(null);
68
68
  try {
69
- if (!(await ae({ variables: { id: J.id } })).data?.deleteHeadshotmarketingAdPlatformConnection) {
70
- X("The connection was already removed."), await O();
69
+ if (!(await O({ variables: { id: J.id } })).data?.deleteHeadshotmarketingAdPlatformConnection) {
70
+ X("The connection was already removed."), await T();
71
71
  return;
72
72
  }
73
- Q(`${l(J.platform)} disconnected.`), Y(null), await O();
73
+ M(), Q(`${l(J.platform)} disconnected.`), Y(null), await T();
74
74
  } catch (e) {
75
- X(C(e, "Could not disconnect."));
75
+ X(x(e, "Could not disconnect."));
76
76
  }
77
77
  }
78
78
  };
79
- return /* @__PURE__ */ y("section", {
79
+ return /* @__PURE__ */ _("section", {
80
80
  "aria-labelledby": "ad-platform-connections-heading",
81
81
  "data-testid": "ad-platform-connections",
82
82
  className: "rounded-lg border border-border-seam bg-gloss-card p-5 shadow-pop",
83
83
  children: [
84
- /* @__PURE__ */ y("div", {
84
+ /* @__PURE__ */ _("div", {
85
85
  className: "mb-4 flex flex-wrap items-start justify-between gap-3",
86
- children: [/* @__PURE__ */ y("div", {
86
+ children: [/* @__PURE__ */ _("div", {
87
87
  className: "min-w-0",
88
- children: [/* @__PURE__ */ y("h3", {
88
+ children: [/* @__PURE__ */ _("h3", {
89
89
  id: "ad-platform-connections-heading",
90
90
  className: "flex items-center gap-2 text-sm font-semibold text-text-primary",
91
- children: [/* @__PURE__ */ v(h, { className: "h-4 w-4 text-text-secondary" }), "Ad platform connections"]
92
- }), /* @__PURE__ */ v("p", {
91
+ children: [/* @__PURE__ */ g(ae, { className: "h-4 w-4 text-text-secondary" }), "Ad platform connections"]
92
+ }), /* @__PURE__ */ g("p", {
93
93
  className: "mt-1 text-xs text-text-secondary",
94
94
  children: "Connect an ad account to push budgets and read status and spend back. Sign-in tokens stay with the integrations service and are never shown here."
95
95
  })]
96
- }), /* @__PURE__ */ y("button", {
96
+ }), /* @__PURE__ */ _("button", {
97
97
  type: "button",
98
98
  onClick: () => {
99
99
  q(null), V(!0);
100
100
  },
101
- className: x,
102
- children: [/* @__PURE__ */ v(_, { className: "h-3.5 w-3.5" }), "Add webhook relay"]
101
+ className: y,
102
+ children: [/* @__PURE__ */ g(h, { className: "h-3.5 w-3.5" }), "Add webhook relay"]
103
103
  })]
104
104
  }),
105
- /* @__PURE__ */ v("div", {
105
+ /* @__PURE__ */ g("div", {
106
106
  className: "grid grid-cols-1 gap-3 sm:grid-cols-2 lg:grid-cols-4",
107
107
  children: s.map((e) => {
108
108
  let t = A === e.platform, n = $.filter((t) => t.platform === e.platform && t.mode === "API" && t.status === "CONNECTED").length;
109
- return /* @__PURE__ */ y("div", {
109
+ return /* @__PURE__ */ _("div", {
110
110
  className: "flex flex-col justify-between rounded-lg border border-border-subtle bg-bg-surface p-4",
111
- children: [/* @__PURE__ */ y("div", { children: [
112
- /* @__PURE__ */ v("p", {
111
+ children: [/* @__PURE__ */ _("div", { children: [
112
+ /* @__PURE__ */ g("p", {
113
113
  className: "text-sm font-medium text-text-primary",
114
114
  children: e.label
115
115
  }),
116
- /* @__PURE__ */ v("p", {
116
+ /* @__PURE__ */ g("p", {
117
117
  className: "mt-1 text-xs text-text-secondary",
118
118
  children: e.description
119
119
  }),
120
- n > 0 && /* @__PURE__ */ y("p", {
120
+ n > 0 && /* @__PURE__ */ _("p", {
121
121
  className: "mt-2 text-xs font-medium text-status-success-text",
122
122
  children: [n, " connected"]
123
123
  })
124
- ] }), /* @__PURE__ */ y("button", {
124
+ ] }), /* @__PURE__ */ _("button", {
125
125
  type: "button",
126
126
  onClick: () => ce(e),
127
127
  disabled: A !== null,
128
- className: `${x} mt-3 self-start`,
129
- children: [t ? /* @__PURE__ */ v(m, { className: "h-3.5 w-3.5 animate-spin" }) : /* @__PURE__ */ v(p, { className: "h-3.5 w-3.5" }), t ? "Connecting…" : `Connect ${e.label}`]
128
+ className: `${y} mt-3 self-start`,
129
+ children: [t ? /* @__PURE__ */ g(ie, { className: "h-3.5 w-3.5 animate-spin" }) : /* @__PURE__ */ g(re, { className: "h-3.5 w-3.5" }), t ? "Connecting…" : `Connect ${e.label}`]
130
130
  })]
131
131
  }, e.platform);
132
132
  })
133
133
  }),
134
- j && /* @__PURE__ */ v("p", {
134
+ j && /* @__PURE__ */ g("p", {
135
135
  role: "alert",
136
136
  className: "mt-3 text-sm text-status-error-text",
137
137
  children: j
138
138
  }),
139
- Z && !j && /* @__PURE__ */ v("p", {
139
+ Z && !j && /* @__PURE__ */ g("p", {
140
140
  role: "status",
141
141
  className: "mt-3 text-sm text-status-success-text",
142
142
  children: Z
143
143
  }),
144
- /* @__PURE__ */ y("div", {
144
+ /* @__PURE__ */ _("div", {
145
145
  className: "mt-5",
146
146
  children: [
147
- /* @__PURE__ */ v("h4", {
147
+ /* @__PURE__ */ g("h4", {
148
148
  className: "mb-2 text-xs font-semibold uppercase tracking-wide text-text-secondary",
149
149
  children: "Connected"
150
150
  }),
151
- D && !T && /* @__PURE__ */ y("p", {
151
+ w && !S && /* @__PURE__ */ _("p", {
152
152
  role: "alert",
153
153
  className: "text-sm text-status-error-text",
154
- children: ["Could not load connections: ", D.message]
154
+ children: ["Could not load connections: ", w.message]
155
155
  }),
156
- E && !T && /* @__PURE__ */ v("p", {
156
+ C && !S && /* @__PURE__ */ g("p", {
157
157
  className: "text-sm text-text-secondary",
158
158
  children: "Loading connections…"
159
159
  }),
160
- T && $.length === 0 && /* @__PURE__ */ v("p", {
160
+ S && $.length === 0 && /* @__PURE__ */ g("p", {
161
161
  className: "text-sm text-text-secondary",
162
162
  children: "No ad platforms connected yet."
163
163
  }),
164
- $.length > 0 && /* @__PURE__ */ v("ul", {
164
+ $.length > 0 && /* @__PURE__ */ g("ul", {
165
165
  className: "divide-y divide-border-subtle text-sm",
166
166
  children: $.map((e) => {
167
- let t = e.mode === "WEBHOOK" ? w(e.webhookUrl) : d(e.metadata);
168
- return /* @__PURE__ */ y("li", {
167
+ let t = e.mode === "WEBHOOK" ? oe(e.webhookUrl) : d(e.metadata);
168
+ return /* @__PURE__ */ _("li", {
169
169
  className: "flex flex-wrap items-center justify-between gap-2 py-2",
170
- children: [/* @__PURE__ */ y("div", {
170
+ children: [/* @__PURE__ */ _("div", {
171
171
  className: "min-w-0",
172
- children: [/* @__PURE__ */ y("p", {
172
+ children: [/* @__PURE__ */ _("p", {
173
173
  className: "font-medium text-text-primary",
174
- children: [l(e.platform), /* @__PURE__ */ y("span", {
174
+ children: [l(e.platform), /* @__PURE__ */ _("span", {
175
175
  className: "ml-2 text-xs font-normal text-text-secondary",
176
176
  children: [
177
177
  e.mode === "API" ? "Native API" : "Webhook relay",
@@ -179,20 +179,20 @@ var T = () => {
179
179
  r(e.createdAt, "relative")
180
180
  ]
181
181
  })]
182
- }), t && /* @__PURE__ */ v("p", {
182
+ }), t && /* @__PURE__ */ g("p", {
183
183
  className: "mt-0.5 break-all text-xs text-text-secondary",
184
184
  children: t
185
185
  })]
186
- }), /* @__PURE__ */ y("div", {
186
+ }), /* @__PURE__ */ _("div", {
187
187
  className: "flex shrink-0 items-center gap-2",
188
- children: [/* @__PURE__ */ v(ee, { status: e.status.toLowerCase() }), /* @__PURE__ */ y("button", {
188
+ children: [/* @__PURE__ */ g(i, { status: e.status.toLowerCase() }), /* @__PURE__ */ _("button", {
189
189
  type: "button",
190
190
  onClick: () => {
191
191
  X(null), Y(e);
192
192
  },
193
193
  "aria-label": `Disconnect ${l(e.platform)}`,
194
- className: x,
195
- children: [/* @__PURE__ */ v(g, { className: "h-3.5 w-3.5" }), "Disconnect"]
194
+ className: y,
195
+ children: [/* @__PURE__ */ g(m, { className: "h-3.5 w-3.5" }), "Disconnect"]
196
196
  })]
197
197
  })]
198
198
  }, e.id);
@@ -200,17 +200,17 @@ var T = () => {
200
200
  })
201
201
  ]
202
202
  }),
203
- /* @__PURE__ */ v(a, {
203
+ /* @__PURE__ */ g(a, {
204
204
  open: P !== null,
205
205
  onClose: () => F(null),
206
206
  title: P ? `Connect ${P.label}` : "",
207
207
  size: "sm",
208
- children: P && /* @__PURE__ */ y("form", {
208
+ children: P && /* @__PURE__ */ _("form", {
209
209
  onSubmit: le,
210
210
  className: "space-y-4",
211
211
  noValidate: !0,
212
212
  children: [
213
- /* @__PURE__ */ y("p", {
213
+ /* @__PURE__ */ _("p", {
214
214
  className: "text-sm text-text-secondary",
215
215
  children: [
216
216
  "Tell us which account to sync, then sign in with",
@@ -219,13 +219,13 @@ var T = () => {
219
219
  " in the popup."
220
220
  ]
221
221
  }),
222
- P.fields.map((e) => /* @__PURE__ */ y("div", { children: [
223
- /* @__PURE__ */ v("label", {
222
+ P.fields.map((e) => /* @__PURE__ */ _("div", { children: [
223
+ /* @__PURE__ */ g("label", {
224
224
  htmlFor: `ad-connect-${e.key}`,
225
225
  className: "mb-1 block text-xs font-medium text-text-secondary",
226
226
  children: e.label
227
227
  }),
228
- /* @__PURE__ */ v("input", {
228
+ /* @__PURE__ */ g("input", {
229
229
  id: `ad-connect-${e.key}`,
230
230
  value: I[e.key] ?? "",
231
231
  onChange: (t) => L((n) => ({
@@ -235,100 +235,100 @@ var T = () => {
235
235
  placeholder: e.placeholder,
236
236
  "aria-invalid": !!R[e.key],
237
237
  "aria-describedby": `ad-connect-${e.key}-help`,
238
- className: b
238
+ className: v
239
239
  }),
240
- /* @__PURE__ */ v("p", {
240
+ /* @__PURE__ */ g("p", {
241
241
  id: `ad-connect-${e.key}-help`,
242
242
  className: R[e.key] ? "mt-1 text-xs text-status-error-text" : "mt-1 text-xs text-text-secondary",
243
243
  children: R[e.key] ?? e.help
244
244
  })
245
245
  ] }, e.key)),
246
- /* @__PURE__ */ y("div", {
246
+ /* @__PURE__ */ _("div", {
247
247
  className: "flex justify-end gap-2",
248
- children: [/* @__PURE__ */ v("button", {
248
+ children: [/* @__PURE__ */ g("button", {
249
249
  type: "button",
250
250
  onClick: () => F(null),
251
- className: x,
251
+ className: y,
252
252
  children: "Cancel"
253
- }), /* @__PURE__ */ v("button", {
253
+ }), /* @__PURE__ */ g("button", {
254
254
  type: "submit",
255
- className: S,
255
+ className: b,
256
256
  children: "Continue to sign-in"
257
257
  })]
258
258
  })
259
259
  ]
260
260
  })
261
261
  }),
262
- /* @__PURE__ */ v(a, {
262
+ /* @__PURE__ */ g(a, {
263
263
  open: B,
264
264
  onClose: () => V(!1),
265
265
  title: "Add webhook relay",
266
266
  size: "sm",
267
- children: /* @__PURE__ */ y("form", {
267
+ children: /* @__PURE__ */ _("form", {
268
268
  onSubmit: (e) => void ue(e),
269
269
  className: "space-y-4",
270
270
  noValidate: !0,
271
271
  children: [
272
- /* @__PURE__ */ v("p", {
272
+ /* @__PURE__ */ g("p", {
273
273
  className: "text-sm text-text-secondary",
274
274
  children: "Budget changes are posted to this URL, and the relay can post metrics back in. It must be a public https address."
275
275
  }),
276
- /* @__PURE__ */ y("div", { children: [/* @__PURE__ */ v("label", {
276
+ /* @__PURE__ */ _("div", { children: [/* @__PURE__ */ g("label", {
277
277
  htmlFor: "ad-webhook-platform",
278
278
  className: "mb-1 block text-xs font-medium text-text-secondary",
279
279
  children: "Platform"
280
- }), /* @__PURE__ */ v("select", {
280
+ }), /* @__PURE__ */ g("select", {
281
281
  id: "ad-webhook-platform",
282
282
  value: H,
283
283
  onChange: (e) => U(e.target.value),
284
- className: b,
285
- children: c.map((e) => /* @__PURE__ */ v("option", {
284
+ className: v,
285
+ children: c.map((e) => /* @__PURE__ */ g("option", {
286
286
  value: e,
287
287
  children: l(e)
288
288
  }, e))
289
289
  })] }),
290
- /* @__PURE__ */ y("div", { children: [/* @__PURE__ */ v("label", {
290
+ /* @__PURE__ */ _("div", { children: [/* @__PURE__ */ g("label", {
291
291
  htmlFor: "ad-webhook-url",
292
292
  className: "mb-1 block text-xs font-medium text-text-secondary",
293
293
  children: "Relay URL"
294
- }), /* @__PURE__ */ v("input", {
294
+ }), /* @__PURE__ */ g("input", {
295
295
  id: "ad-webhook-url",
296
296
  type: "url",
297
297
  value: W,
298
298
  onChange: (e) => G(e.target.value),
299
299
  placeholder: "https://hooks.example.com/ads",
300
300
  "aria-invalid": !!K,
301
- className: b
301
+ className: v
302
302
  })] }),
303
- K && /* @__PURE__ */ v("p", {
303
+ K && /* @__PURE__ */ g("p", {
304
304
  role: "alert",
305
305
  className: "text-sm text-status-error-text",
306
306
  children: K
307
307
  }),
308
- /* @__PURE__ */ y("div", {
308
+ /* @__PURE__ */ _("div", {
309
309
  className: "flex justify-end gap-2",
310
- children: [/* @__PURE__ */ v("button", {
310
+ children: [/* @__PURE__ */ g("button", {
311
311
  type: "button",
312
312
  onClick: () => V(!1),
313
- disabled: k,
314
- className: x,
313
+ disabled: D,
314
+ className: y,
315
315
  children: "Cancel"
316
- }), /* @__PURE__ */ v("button", {
316
+ }), /* @__PURE__ */ g("button", {
317
317
  type: "submit",
318
- disabled: k,
319
- className: S,
320
- children: k ? "Adding…" : "Add relay"
318
+ disabled: D,
319
+ className: b,
320
+ children: D ? "Adding…" : "Add relay"
321
321
  })]
322
322
  })
323
323
  ]
324
324
  })
325
325
  }),
326
- /* @__PURE__ */ v(o, {
326
+ /* @__PURE__ */ g(o, {
327
327
  open: J !== null,
328
328
  onClose: () => Y(null),
329
329
  title: "Disconnect ad platform",
330
330
  message: J ? `Disconnect ${l(J.platform)} (${J.mode === "API" ? "native API" : "webhook relay"})? Budget pushes and status sync through it stop, and an OAuth sign-in is revoked.` : "",
331
- deleting: oe,
331
+ deleting: k,
332
332
  error: se,
333
333
  onConfirm: () => void de(),
334
334
  confirmLabel: "Disconnect"
@@ -337,6 +337,6 @@ var T = () => {
337
337
  });
338
338
  };
339
339
  //#endregion
340
- export { T as AdPlatformConnectionsSection };
340
+ export { S as AdPlatformConnectionsSection };
341
341
 
342
342
  //# sourceMappingURL=AdPlatformConnectionsSection.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"AdPlatformConnectionsSection.js","names":[],"sources":["../../../../src/headshotmarketing/pages/ads/AdPlatformConnectionsSection.tsx"],"sourcesContent":["/**\n * Ad platform connections (BOFF-10246)\n *\n * Lets a workspace connect Meta, Google Ads and LinkedIn Ads through the same\n * OAuth popup the social accounts use, binding each authorised connection as\n * an API-mode ad connection with the sync context the backend needs (Google:\n * customer ids; LinkedIn: ad account and currency). It also lists existing\n * connections, disconnects them, and adds/removes WEBHOOK relays for platforms\n * that post metrics in instead. Every state shown comes from the backend.\n *\n * @module headshotmarketing/pages/ads\n */\n\nimport { useState, type FC, type FormEvent } from \"react\";\nimport { Link2, Loader2, Plug, Trash2, Webhook } from \"lucide-react\";\nimport {\n useCreateHeadshotmarketingAdPlatformConnectionMutation,\n useDeleteHeadshotmarketingAdPlatformConnectionMutation,\n useHeadshotmarketingAdPlatformConnectionsListQuery,\n type HeadshotmarketingAdPlatformConnectionsListQuery,\n} from \"../../../generated/wspace-operations\";\nimport { HeadshotmarketingAdPlatform } from \"../../../generated/wspace-types\";\nimport { ConfirmDeleteDialog, Modal, StatusBadge } from \"../../components\";\nimport { formatDate } from \"../../utils/helpers\";\nimport {\n AD_CONNECT_PROVIDERS,\n WEBHOOK_PLATFORMS,\n adPlatformLabel,\n buildWebhookAdConnectionInput,\n describeConnectionContext,\n validateAdConnectValues,\n validateWebhookUrl,\n type AdConnectProvider,\n type AdConnectValues,\n} from \"./adConnect\";\nimport { useAdPlatformConnect } from \"./useAdPlatformConnect\";\n\ntype ConnectionRow =\n HeadshotmarketingAdPlatformConnectionsListQuery[\"headshotmarketingAdPlatformConnections\"][\"items\"][number];\n\nconst INPUT_CLASS =\n \"w-full rounded-md border border-border-subtle bg-bg-surface px-3 py-2 text-sm text-text-primary placeholder:text-text-secondary focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)]\";\nconst SECONDARY_BUTTON =\n \"inline-flex items-center gap-2 rounded-md border border-border-seam bg-gloss-card px-3 py-1.5 text-xs font-medium text-text-primary hover:bg-bg-sunken disabled:opacity-60\";\nconst PRIMARY_BUTTON =\n \"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 disabled:opacity-60\";\n\nfunction errorMessage(err: unknown, fallback: string): string {\n return err instanceof Error && err.message ? err.message : fallback;\n}\n\nfunction webhookHost(url?: string | null): string {\n if (!url) return \"\";\n try {\n return new URL(url).host;\n } catch {\n return url;\n }\n}\n\nexport const AdPlatformConnectionsSection: FC = () => {\n const { data, loading, error, refetch } =\n useHeadshotmarketingAdPlatformConnectionsListQuery({\n variables: { pagination: { limit: 100 } },\n fetchPolicy: \"cache-and-network\",\n });\n const [createConnection, { loading: creatingWebhook }] =\n useCreateHeadshotmarketingAdPlatformConnectionMutation();\n const [deleteConnection, { loading: deleting }] =\n useDeleteHeadshotmarketingAdPlatformConnectionMutation();\n\n const {\n connecting,\n error: connectError,\n clearError,\n connect,\n } = useAdPlatformConnect(() => refetch());\n\n // Context dialog for providers that need ids before the popup opens.\n const [contextProvider, setContextProvider] =\n useState<AdConnectProvider | null>(null);\n const [contextValues, setContextValues] = useState<AdConnectValues>({});\n const [contextErrors, setContextErrors] = useState<\n Partial<Record<string, string>>\n >({});\n\n // Webhook relay dialog.\n const [webhookOpen, setWebhookOpen] = useState(false);\n const [webhookPlatform, setWebhookPlatform] =\n useState<HeadshotmarketingAdPlatform>(\n HeadshotmarketingAdPlatform.FacebookAds,\n );\n const [webhookUrl, setWebhookUrl] = useState(\"\");\n const [webhookError, setWebhookError] = useState<string | null>(null);\n\n // Disconnect confirmation.\n const [pendingDelete, setPendingDelete] = useState<ConnectionRow | null>(\n null,\n );\n const [deleteError, setDeleteError] = useState<string | null>(null);\n const [notice, setNotice] = useState<string | null>(null);\n\n const connections: ConnectionRow[] =\n data?.headshotmarketingAdPlatformConnections.items ?? [];\n\n const startConnect = (provider: AdConnectProvider): void => {\n clearError();\n setNotice(null);\n if (provider.fields.length === 0) {\n void connect(provider, {}).then((ok) => {\n if (ok) setNotice(`${provider.label} connected.`);\n });\n return;\n }\n setContextValues({});\n setContextErrors({});\n setContextProvider(provider);\n };\n\n const submitContext = (event: FormEvent): void => {\n event.preventDefault();\n if (!contextProvider) return;\n const result = validateAdConnectValues(contextProvider, contextValues);\n if (!result.ok) {\n setContextErrors(result.errors);\n return;\n }\n const provider = contextProvider;\n setContextProvider(null);\n // Still inside the submit gesture, so the popup is not blocked.\n void connect(provider, result.metadata).then((ok) => {\n if (ok) setNotice(`${provider.label} connected.`);\n });\n };\n\n const submitWebhook = async (event: FormEvent): Promise<void> => {\n event.preventDefault();\n const problem = validateWebhookUrl(webhookUrl);\n if (problem) {\n setWebhookError(problem);\n return;\n }\n setWebhookError(null);\n try {\n await createConnection({\n variables: {\n input: buildWebhookAdConnectionInput({\n platform: webhookPlatform,\n webhookUrl,\n }),\n },\n });\n setWebhookOpen(false);\n setWebhookUrl(\"\");\n setNotice(`${adPlatformLabel(webhookPlatform)} webhook relay added.`);\n await refetch();\n } catch (err) {\n setWebhookError(errorMessage(err, \"Could not add the webhook relay.\"));\n }\n };\n\n const confirmDelete = async (): Promise<void> => {\n if (!pendingDelete) return;\n setDeleteError(null);\n try {\n const res = await deleteConnection({\n variables: { id: pendingDelete.id },\n });\n if (!res.data?.deleteHeadshotmarketingAdPlatformConnection) {\n setDeleteError(\"The connection was already removed.\");\n await refetch();\n return;\n }\n setNotice(`${adPlatformLabel(pendingDelete.platform)} disconnected.`);\n setPendingDelete(null);\n await refetch();\n } catch (err) {\n setDeleteError(errorMessage(err, \"Could not disconnect.\"));\n }\n };\n\n return (\n <section\n aria-labelledby=\"ad-platform-connections-heading\"\n data-testid=\"ad-platform-connections\"\n className=\"rounded-lg border border-border-seam bg-gloss-card p-5 shadow-pop\"\n >\n <div className=\"mb-4 flex flex-wrap items-start justify-between gap-3\">\n <div className=\"min-w-0\">\n <h3\n id=\"ad-platform-connections-heading\"\n className=\"flex items-center gap-2 text-sm font-semibold text-text-primary\"\n >\n <Plug className=\"h-4 w-4 text-text-secondary\" />\n Ad platform connections\n </h3>\n <p className=\"mt-1 text-xs text-text-secondary\">\n Connect an ad account to push budgets and read status and spend\n back. Sign-in tokens stay with the integrations service and are\n never shown here.\n </p>\n </div>\n <button\n type=\"button\"\n onClick={() => {\n setWebhookError(null);\n setWebhookOpen(true);\n }}\n className={SECONDARY_BUTTON}\n >\n <Webhook className=\"h-3.5 w-3.5\" />\n Add webhook relay\n </button>\n </div>\n\n <div className=\"grid grid-cols-1 gap-3 sm:grid-cols-2 lg:grid-cols-4\">\n {AD_CONNECT_PROVIDERS.map((provider) => {\n const isConnecting = connecting === provider.platform;\n const live = connections.filter(\n (c) =>\n c.platform === provider.platform &&\n c.mode === \"API\" &&\n c.status === \"CONNECTED\",\n ).length;\n return (\n <div\n key={provider.platform}\n className=\"flex flex-col justify-between rounded-lg border border-border-subtle bg-bg-surface p-4\"\n >\n <div>\n <p className=\"text-sm font-medium text-text-primary\">\n {provider.label}\n </p>\n <p className=\"mt-1 text-xs text-text-secondary\">\n {provider.description}\n </p>\n {live > 0 && (\n <p className=\"mt-2 text-xs font-medium text-status-success-text\">\n {live} connected\n </p>\n )}\n </div>\n <button\n type=\"button\"\n onClick={() => startConnect(provider)}\n disabled={connecting !== null}\n className={`${SECONDARY_BUTTON} mt-3 self-start`}\n >\n {isConnecting ? (\n <Loader2 className=\"h-3.5 w-3.5 animate-spin\" />\n ) : (\n <Link2 className=\"h-3.5 w-3.5\" />\n )}\n {isConnecting ? \"Connecting…\" : `Connect ${provider.label}`}\n </button>\n </div>\n );\n })}\n </div>\n\n {connectError && (\n <p role=\"alert\" className=\"mt-3 text-sm text-status-error-text\">\n {connectError}\n </p>\n )}\n {notice && !connectError && (\n <p role=\"status\" className=\"mt-3 text-sm text-status-success-text\">\n {notice}\n </p>\n )}\n\n <div className=\"mt-5\">\n <h4 className=\"mb-2 text-xs font-semibold uppercase tracking-wide text-text-secondary\">\n Connected\n </h4>\n {error && !data && (\n <p role=\"alert\" className=\"text-sm text-status-error-text\">\n Could not load connections: {error.message}\n </p>\n )}\n {loading && !data && (\n <p className=\"text-sm text-text-secondary\">Loading connections…</p>\n )}\n {data && connections.length === 0 && (\n <p className=\"text-sm text-text-secondary\">\n No ad platforms connected yet.\n </p>\n )}\n {connections.length > 0 && (\n <ul className=\"divide-y divide-border-subtle text-sm\">\n {connections.map((connection) => {\n const detail =\n connection.mode === \"WEBHOOK\"\n ? webhookHost(connection.webhookUrl)\n : describeConnectionContext(connection.metadata);\n return (\n <li\n key={connection.id}\n className=\"flex flex-wrap items-center justify-between gap-2 py-2\"\n >\n <div className=\"min-w-0\">\n <p className=\"font-medium text-text-primary\">\n {adPlatformLabel(connection.platform)}\n <span className=\"ml-2 text-xs font-normal text-text-secondary\">\n {connection.mode === \"API\"\n ? \"Native API\"\n : \"Webhook relay\"}\n {\" · added \"}\n {formatDate(connection.createdAt, \"relative\")}\n </span>\n </p>\n {detail && (\n <p className=\"mt-0.5 break-all text-xs text-text-secondary\">\n {detail}\n </p>\n )}\n </div>\n <div className=\"flex shrink-0 items-center gap-2\">\n <StatusBadge status={connection.status.toLowerCase()} />\n <button\n type=\"button\"\n onClick={() => {\n setDeleteError(null);\n setPendingDelete(connection);\n }}\n aria-label={`Disconnect ${adPlatformLabel(connection.platform)}`}\n className={SECONDARY_BUTTON}\n >\n <Trash2 className=\"h-3.5 w-3.5\" />\n Disconnect\n </button>\n </div>\n </li>\n );\n })}\n </ul>\n )}\n </div>\n\n <Modal\n open={contextProvider !== null}\n onClose={() => setContextProvider(null)}\n title={contextProvider ? `Connect ${contextProvider.label}` : \"\"}\n size=\"sm\"\n >\n {contextProvider && (\n <form onSubmit={submitContext} className=\"space-y-4\" noValidate>\n <p className=\"text-sm text-text-secondary\">\n Tell us which account to sync, then sign in with{\" \"}\n {contextProvider.label} in the popup.\n </p>\n {contextProvider.fields.map((field) => (\n <div key={field.key}>\n <label\n htmlFor={`ad-connect-${field.key}`}\n className=\"mb-1 block text-xs font-medium text-text-secondary\"\n >\n {field.label}\n </label>\n <input\n id={`ad-connect-${field.key}`}\n value={contextValues[field.key] ?? \"\"}\n onChange={(e) =>\n setContextValues((prev) => ({\n ...prev,\n [field.key]: e.target.value,\n }))\n }\n placeholder={field.placeholder}\n aria-invalid={Boolean(contextErrors[field.key])}\n aria-describedby={`ad-connect-${field.key}-help`}\n className={INPUT_CLASS}\n />\n <p\n id={`ad-connect-${field.key}-help`}\n className={\n contextErrors[field.key]\n ? \"mt-1 text-xs text-status-error-text\"\n : \"mt-1 text-xs text-text-secondary\"\n }\n >\n {contextErrors[field.key] ?? field.help}\n </p>\n </div>\n ))}\n <div className=\"flex justify-end gap-2\">\n <button\n type=\"button\"\n onClick={() => setContextProvider(null)}\n className={SECONDARY_BUTTON}\n >\n Cancel\n </button>\n <button type=\"submit\" className={PRIMARY_BUTTON}>\n Continue to sign-in\n </button>\n </div>\n </form>\n )}\n </Modal>\n\n <Modal\n open={webhookOpen}\n onClose={() => setWebhookOpen(false)}\n title=\"Add webhook relay\"\n size=\"sm\"\n >\n <form\n onSubmit={(e) => void submitWebhook(e)}\n className=\"space-y-4\"\n noValidate\n >\n <p className=\"text-sm text-text-secondary\">\n Budget changes are posted to this URL, and the relay can post\n metrics back in. It must be a public https address.\n </p>\n <div>\n <label\n htmlFor=\"ad-webhook-platform\"\n className=\"mb-1 block text-xs font-medium text-text-secondary\"\n >\n Platform\n </label>\n <select\n id=\"ad-webhook-platform\"\n value={webhookPlatform}\n onChange={(e) =>\n setWebhookPlatform(\n e.target.value as HeadshotmarketingAdPlatform,\n )\n }\n className={INPUT_CLASS}\n >\n {WEBHOOK_PLATFORMS.map((platform) => (\n <option key={platform} value={platform}>\n {adPlatformLabel(platform)}\n </option>\n ))}\n </select>\n </div>\n <div>\n <label\n htmlFor=\"ad-webhook-url\"\n className=\"mb-1 block text-xs font-medium text-text-secondary\"\n >\n Relay URL\n </label>\n <input\n id=\"ad-webhook-url\"\n type=\"url\"\n value={webhookUrl}\n onChange={(e) => setWebhookUrl(e.target.value)}\n placeholder=\"https://hooks.example.com/ads\"\n aria-invalid={Boolean(webhookError)}\n className={INPUT_CLASS}\n />\n </div>\n {webhookError && (\n <p role=\"alert\" className=\"text-sm text-status-error-text\">\n {webhookError}\n </p>\n )}\n <div className=\"flex justify-end gap-2\">\n <button\n type=\"button\"\n onClick={() => setWebhookOpen(false)}\n disabled={creatingWebhook}\n className={SECONDARY_BUTTON}\n >\n Cancel\n </button>\n <button\n type=\"submit\"\n disabled={creatingWebhook}\n className={PRIMARY_BUTTON}\n >\n {creatingWebhook ? \"Adding…\" : \"Add relay\"}\n </button>\n </div>\n </form>\n </Modal>\n\n <ConfirmDeleteDialog\n open={pendingDelete !== null}\n onClose={() => setPendingDelete(null)}\n title=\"Disconnect ad platform\"\n message={\n pendingDelete\n ? `Disconnect ${adPlatformLabel(pendingDelete.platform)} (${\n pendingDelete.mode === \"API\" ? \"native API\" : \"webhook relay\"\n })? Budget pushes and status sync through it stop, and an OAuth sign-in is revoked.`\n : \"\"\n }\n deleting={deleting}\n error={deleteError}\n onConfirm={() => void confirmDelete()}\n confirmLabel=\"Disconnect\"\n />\n </section>\n );\n};\n"],"mappings":";;;;;;;;;;;;;AAwCA,IAAM,IACJ,wMACI,IACJ,8KACI,IACJ;AAEF,SAAS,EAAa,GAAc,GAA0B;AAC5D,QAAO,aAAe,SAAS,EAAI,UAAU,EAAI,UAAU;;AAG7D,SAAS,EAAY,GAA6B;AAChD,KAAI,CAAC,EAAK,QAAO;AACjB,KAAI;AACF,SAAO,IAAI,IAAI,EAAI,CAAC;SACd;AACN,SAAO;;;AAIX,IAAa,UAAyC;CACpD,IAAM,EAAE,SAAM,YAAS,UAAO,eAC5B,EAAmD;EACjD,WAAW,EAAE,YAAY,EAAE,OAAO,KAAK,EAAE;EACzC,aAAa;EACd,CAAC,EACE,CAAC,IAAkB,EAAE,SAAS,OAClC,GAAwD,EACpD,CAAC,IAAkB,EAAE,SAAS,QAClC,GAAwD,EAEpD,EACJ,eACA,OAAO,GACP,eACA,eACE,SAA2B,GAAS,CAAC,EAGnC,C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EN,kBAAC,OAAD;OAAK,WAAU;iBAAf,CACE,kBAAC,UAAD;QACE,MAAK;QACL,eAAe,EAAe,GAAM;QACpC,UAAU;QACV,WAAW;kBACZ;QAEQ,CAAA,EACT,kBAAC,UAAD;QACE,MAAK;QACL,UAAU;QACV,WAAW;kBAEV,IAAkB,YAAY;QACxB,CAAA,CACL;;MACD;;IACD,CAAA;GAER,kBAAC,GAAD;IACE,MAAM,MAAkB;IACxB,eAAe,EAAiB,KAAK;IACrC,OAAM;IACN,SACE,IACI,cAAc,EAAgB,EAAc,SAAS,CAAC,IACpD,EAAc,SAAS,QAAQ,eAAe,gBAC/C,sFACD;IAEI;IACV,OAAO;IACP,iBAAiB,KAAK,IAAe;IACrC,cAAa;IACb,CAAA;GACM"}
1
+ {"version":3,"file":"AdPlatformConnectionsSection.js","names":[],"sources":["../../../../src/headshotmarketing/pages/ads/AdPlatformConnectionsSection.tsx"],"sourcesContent":["/**\n * Ad platform connections (BOFF-10246)\n *\n * Lets a workspace connect Meta, Google Ads and LinkedIn Ads through the same\n * OAuth popup the social accounts use, binding each authorised connection as\n * an API-mode ad connection with the sync context the backend needs (Google:\n * customer ids; LinkedIn: ad account and currency). It also lists existing\n * connections, disconnects them, and adds/removes WEBHOOK relays for platforms\n * that post metrics in instead. Every state shown comes from the backend.\n *\n * @module headshotmarketing/pages/ads\n */\n\nimport { useState, type FC, type FormEvent } from \"react\";\nimport { Link2, Loader2, Plug, Trash2, Webhook } from \"lucide-react\";\nimport {\n useCreateHeadshotmarketingAdPlatformConnectionMutation,\n useDeleteHeadshotmarketingAdPlatformConnectionMutation,\n useHeadshotmarketingAdPlatformConnectionsListQuery,\n type HeadshotmarketingAdPlatformConnectionsListQuery,\n} from \"../../../generated/wspace-operations\";\nimport { HeadshotmarketingAdPlatform } from \"../../../generated/wspace-types\";\nimport { ConfirmDeleteDialog, Modal, StatusBadge } from \"../../components\";\nimport { formatDate } from \"../../utils/helpers\";\nimport {\n AD_CONNECT_PROVIDERS,\n WEBHOOK_PLATFORMS,\n adPlatformLabel,\n buildWebhookAdConnectionInput,\n describeConnectionContext,\n validateAdConnectValues,\n validateWebhookUrl,\n type AdConnectProvider,\n type AdConnectValues,\n} from \"./adConnect\";\nimport { useAdPlatformConnect } from \"./useAdPlatformConnect\";\n\ntype ConnectionRow =\n HeadshotmarketingAdPlatformConnectionsListQuery[\"headshotmarketingAdPlatformConnections\"][\"items\"][number];\n\nconst INPUT_CLASS =\n \"w-full rounded-md border border-border-subtle bg-bg-surface px-3 py-2 text-sm text-text-primary placeholder:text-text-secondary focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)]\";\nconst SECONDARY_BUTTON =\n \"inline-flex items-center gap-2 rounded-md border border-border-seam bg-gloss-card px-3 py-1.5 text-xs font-medium text-text-primary hover:bg-bg-sunken disabled:opacity-60\";\nconst PRIMARY_BUTTON =\n \"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 disabled:opacity-60\";\n\nfunction errorMessage(err: unknown, fallback: string): string {\n return err instanceof Error && err.message ? err.message : fallback;\n}\n\nfunction webhookHost(url?: string | null): string {\n if (!url) return \"\";\n try {\n return new URL(url).host;\n } catch {\n return url;\n }\n}\n\nexport const AdPlatformConnectionsSection: FC = () => {\n const { data, loading, error, refetch } =\n useHeadshotmarketingAdPlatformConnectionsListQuery({\n variables: { pagination: { limit: 100 } },\n fetchPolicy: \"cache-and-network\",\n });\n const [createConnection, { loading: creatingWebhook }] =\n useCreateHeadshotmarketingAdPlatformConnectionMutation();\n const [deleteConnection, { loading: deleting }] =\n useDeleteHeadshotmarketingAdPlatformConnectionMutation();\n\n const {\n connecting,\n error: connectError,\n clearError,\n connect,\n } = useAdPlatformConnect(() => refetch());\n\n // Context dialog for providers that need ids before the popup opens.\n const [contextProvider, setContextProvider] =\n useState<AdConnectProvider | null>(null);\n const [contextValues, setContextValues] = useState<AdConnectValues>({});\n const [contextErrors, setContextErrors] = useState<\n Partial<Record<string, string>>\n >({});\n\n // Webhook relay dialog.\n const [webhookOpen, setWebhookOpen] = useState(false);\n const [webhookPlatform, setWebhookPlatform] =\n useState<HeadshotmarketingAdPlatform>(\n HeadshotmarketingAdPlatform.FacebookAds,\n );\n const [webhookUrl, setWebhookUrl] = useState(\"\");\n const [webhookError, setWebhookError] = useState<string | null>(null);\n\n // Disconnect confirmation.\n const [pendingDelete, setPendingDelete] = useState<ConnectionRow | null>(\n null,\n );\n const [deleteError, setDeleteError] = useState<string | null>(null);\n const [notice, setNotice] = useState<string | null>(null);\n\n const connections: ConnectionRow[] =\n data?.headshotmarketingAdPlatformConnections.items ?? [];\n\n const startConnect = (provider: AdConnectProvider): void => {\n clearError();\n setNotice(null);\n if (provider.fields.length === 0) {\n void connect(provider, {}).then((ok) => {\n if (ok) setNotice(`${provider.label} connected.`);\n });\n return;\n }\n setContextValues({});\n setContextErrors({});\n setContextProvider(provider);\n };\n\n const submitContext = (event: FormEvent): void => {\n event.preventDefault();\n if (!contextProvider) return;\n const result = validateAdConnectValues(contextProvider, contextValues);\n if (!result.ok) {\n setContextErrors(result.errors);\n return;\n }\n const provider = contextProvider;\n setContextProvider(null);\n // Still inside the submit gesture, so the popup is not blocked.\n void connect(provider, result.metadata).then((ok) => {\n if (ok) setNotice(`${provider.label} connected.`);\n });\n };\n\n const submitWebhook = async (event: FormEvent): Promise<void> => {\n event.preventDefault();\n const problem = validateWebhookUrl(webhookUrl);\n if (problem) {\n setWebhookError(problem);\n return;\n }\n setWebhookError(null);\n try {\n await createConnection({\n variables: {\n input: buildWebhookAdConnectionInput({\n platform: webhookPlatform,\n webhookUrl,\n }),\n },\n });\n setWebhookOpen(false);\n setWebhookUrl(\"\");\n clearError();\n setNotice(`${adPlatformLabel(webhookPlatform)} webhook relay added.`);\n await refetch();\n } catch (err) {\n setWebhookError(errorMessage(err, \"Could not add the webhook relay.\"));\n }\n };\n\n const confirmDelete = async (): Promise<void> => {\n if (!pendingDelete) return;\n setDeleteError(null);\n try {\n const res = await deleteConnection({\n variables: { id: pendingDelete.id },\n });\n if (!res.data?.deleteHeadshotmarketingAdPlatformConnection) {\n setDeleteError(\"The connection was already removed.\");\n await refetch();\n return;\n }\n clearError();\n setNotice(`${adPlatformLabel(pendingDelete.platform)} disconnected.`);\n setPendingDelete(null);\n await refetch();\n } catch (err) {\n setDeleteError(errorMessage(err, \"Could not disconnect.\"));\n }\n };\n\n return (\n <section\n aria-labelledby=\"ad-platform-connections-heading\"\n data-testid=\"ad-platform-connections\"\n className=\"rounded-lg border border-border-seam bg-gloss-card p-5 shadow-pop\"\n >\n <div className=\"mb-4 flex flex-wrap items-start justify-between gap-3\">\n <div className=\"min-w-0\">\n <h3\n id=\"ad-platform-connections-heading\"\n className=\"flex items-center gap-2 text-sm font-semibold text-text-primary\"\n >\n <Plug className=\"h-4 w-4 text-text-secondary\" />\n Ad platform connections\n </h3>\n <p className=\"mt-1 text-xs text-text-secondary\">\n Connect an ad account to push budgets and read status and spend\n back. Sign-in tokens stay with the integrations service and are\n never shown here.\n </p>\n </div>\n <button\n type=\"button\"\n onClick={() => {\n setWebhookError(null);\n setWebhookOpen(true);\n }}\n className={SECONDARY_BUTTON}\n >\n <Webhook className=\"h-3.5 w-3.5\" />\n Add webhook relay\n </button>\n </div>\n\n <div className=\"grid grid-cols-1 gap-3 sm:grid-cols-2 lg:grid-cols-4\">\n {AD_CONNECT_PROVIDERS.map((provider) => {\n const isConnecting = connecting === provider.platform;\n const live = connections.filter(\n (c) =>\n c.platform === provider.platform &&\n c.mode === \"API\" &&\n c.status === \"CONNECTED\",\n ).length;\n return (\n <div\n key={provider.platform}\n className=\"flex flex-col justify-between rounded-lg border border-border-subtle bg-bg-surface p-4\"\n >\n <div>\n <p className=\"text-sm font-medium text-text-primary\">\n {provider.label}\n </p>\n <p className=\"mt-1 text-xs text-text-secondary\">\n {provider.description}\n </p>\n {live > 0 && (\n <p className=\"mt-2 text-xs font-medium text-status-success-text\">\n {live} connected\n </p>\n )}\n </div>\n <button\n type=\"button\"\n onClick={() => startConnect(provider)}\n disabled={connecting !== null}\n className={`${SECONDARY_BUTTON} mt-3 self-start`}\n >\n {isConnecting ? (\n <Loader2 className=\"h-3.5 w-3.5 animate-spin\" />\n ) : (\n <Link2 className=\"h-3.5 w-3.5\" />\n )}\n {isConnecting ? \"Connecting…\" : `Connect ${provider.label}`}\n </button>\n </div>\n );\n })}\n </div>\n\n {connectError && (\n <p role=\"alert\" className=\"mt-3 text-sm text-status-error-text\">\n {connectError}\n </p>\n )}\n {notice && !connectError && (\n <p role=\"status\" className=\"mt-3 text-sm text-status-success-text\">\n {notice}\n </p>\n )}\n\n <div className=\"mt-5\">\n <h4 className=\"mb-2 text-xs font-semibold uppercase tracking-wide text-text-secondary\">\n Connected\n </h4>\n {error && !data && (\n <p role=\"alert\" className=\"text-sm text-status-error-text\">\n Could not load connections: {error.message}\n </p>\n )}\n {loading && !data && (\n <p className=\"text-sm text-text-secondary\">Loading connections…</p>\n )}\n {data && connections.length === 0 && (\n <p className=\"text-sm text-text-secondary\">\n No ad platforms connected yet.\n </p>\n )}\n {connections.length > 0 && (\n <ul className=\"divide-y divide-border-subtle text-sm\">\n {connections.map((connection) => {\n const detail =\n connection.mode === \"WEBHOOK\"\n ? webhookHost(connection.webhookUrl)\n : describeConnectionContext(connection.metadata);\n return (\n <li\n key={connection.id}\n className=\"flex flex-wrap items-center justify-between gap-2 py-2\"\n >\n <div className=\"min-w-0\">\n <p className=\"font-medium text-text-primary\">\n {adPlatformLabel(connection.platform)}\n <span className=\"ml-2 text-xs font-normal text-text-secondary\">\n {connection.mode === \"API\"\n ? \"Native API\"\n : \"Webhook relay\"}\n {\" · added \"}\n {formatDate(connection.createdAt, \"relative\")}\n </span>\n </p>\n {detail && (\n <p className=\"mt-0.5 break-all text-xs text-text-secondary\">\n {detail}\n </p>\n )}\n </div>\n <div className=\"flex shrink-0 items-center gap-2\">\n <StatusBadge status={connection.status.toLowerCase()} />\n <button\n type=\"button\"\n onClick={() => {\n setDeleteError(null);\n setPendingDelete(connection);\n }}\n aria-label={`Disconnect ${adPlatformLabel(connection.platform)}`}\n className={SECONDARY_BUTTON}\n >\n <Trash2 className=\"h-3.5 w-3.5\" />\n Disconnect\n </button>\n </div>\n </li>\n );\n })}\n </ul>\n )}\n </div>\n\n <Modal\n open={contextProvider !== null}\n onClose={() => setContextProvider(null)}\n title={contextProvider ? `Connect ${contextProvider.label}` : \"\"}\n size=\"sm\"\n >\n {contextProvider && (\n <form onSubmit={submitContext} className=\"space-y-4\" noValidate>\n <p className=\"text-sm text-text-secondary\">\n Tell us which account to sync, then sign in with{\" \"}\n {contextProvider.label} in the popup.\n </p>\n {contextProvider.fields.map((field) => (\n <div key={field.key}>\n <label\n htmlFor={`ad-connect-${field.key}`}\n className=\"mb-1 block text-xs font-medium text-text-secondary\"\n >\n {field.label}\n </label>\n <input\n id={`ad-connect-${field.key}`}\n value={contextValues[field.key] ?? \"\"}\n onChange={(e) =>\n setContextValues((prev) => ({\n ...prev,\n [field.key]: e.target.value,\n }))\n }\n placeholder={field.placeholder}\n aria-invalid={Boolean(contextErrors[field.key])}\n aria-describedby={`ad-connect-${field.key}-help`}\n className={INPUT_CLASS}\n />\n <p\n id={`ad-connect-${field.key}-help`}\n className={\n contextErrors[field.key]\n ? \"mt-1 text-xs text-status-error-text\"\n : \"mt-1 text-xs text-text-secondary\"\n }\n >\n {contextErrors[field.key] ?? field.help}\n </p>\n </div>\n ))}\n <div className=\"flex justify-end gap-2\">\n <button\n type=\"button\"\n onClick={() => setContextProvider(null)}\n className={SECONDARY_BUTTON}\n >\n Cancel\n </button>\n <button type=\"submit\" className={PRIMARY_BUTTON}>\n Continue to sign-in\n </button>\n </div>\n </form>\n )}\n </Modal>\n\n <Modal\n open={webhookOpen}\n onClose={() => setWebhookOpen(false)}\n title=\"Add webhook relay\"\n size=\"sm\"\n >\n <form\n onSubmit={(e) => void submitWebhook(e)}\n className=\"space-y-4\"\n noValidate\n >\n <p className=\"text-sm text-text-secondary\">\n Budget changes are posted to this URL, and the relay can post\n metrics back in. It must be a public https address.\n </p>\n <div>\n <label\n htmlFor=\"ad-webhook-platform\"\n className=\"mb-1 block text-xs font-medium text-text-secondary\"\n >\n Platform\n </label>\n <select\n id=\"ad-webhook-platform\"\n value={webhookPlatform}\n onChange={(e) =>\n setWebhookPlatform(\n e.target.value as HeadshotmarketingAdPlatform,\n )\n }\n className={INPUT_CLASS}\n >\n {WEBHOOK_PLATFORMS.map((platform) => (\n <option key={platform} value={platform}>\n {adPlatformLabel(platform)}\n </option>\n ))}\n </select>\n </div>\n <div>\n <label\n htmlFor=\"ad-webhook-url\"\n className=\"mb-1 block text-xs font-medium text-text-secondary\"\n >\n Relay URL\n </label>\n <input\n id=\"ad-webhook-url\"\n type=\"url\"\n value={webhookUrl}\n onChange={(e) => setWebhookUrl(e.target.value)}\n placeholder=\"https://hooks.example.com/ads\"\n aria-invalid={Boolean(webhookError)}\n className={INPUT_CLASS}\n />\n </div>\n {webhookError && (\n <p role=\"alert\" className=\"text-sm text-status-error-text\">\n {webhookError}\n </p>\n )}\n <div className=\"flex justify-end gap-2\">\n <button\n type=\"button\"\n onClick={() => setWebhookOpen(false)}\n disabled={creatingWebhook}\n className={SECONDARY_BUTTON}\n >\n Cancel\n </button>\n <button\n type=\"submit\"\n disabled={creatingWebhook}\n className={PRIMARY_BUTTON}\n >\n {creatingWebhook ? \"Adding…\" : \"Add relay\"}\n </button>\n </div>\n </form>\n </Modal>\n\n <ConfirmDeleteDialog\n open={pendingDelete !== null}\n onClose={() => setPendingDelete(null)}\n title=\"Disconnect ad platform\"\n message={\n pendingDelete\n ? `Disconnect ${adPlatformLabel(pendingDelete.platform)} (${\n pendingDelete.mode === \"API\" ? \"native API\" : \"webhook relay\"\n })? Budget pushes and status sync through it stop, and an OAuth sign-in is revoked.`\n : \"\"\n }\n deleting={deleting}\n error={deleteError}\n onConfirm={() => void confirmDelete()}\n confirmLabel=\"Disconnect\"\n />\n </section>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A,CACE,kBAAC,SAAD;OACE,SAAQ;OACR,WAAU;iBACX;OAEO,CAAA,EACR,kBAAC,UAAD;OACE,IAAG;OACH,OAAO;OACP,WAAW,MACT,EACE,EAAE,OAAO,MACV;OAEH,WAAW;iBAEV,EAAkB,KAAK,MACtB,kBAAC,UAAD;QAAuB,OAAO;kBAC3B,EAAgB,EAAS;QACnB,EAFI,EAEJ,CACT;OACK,CAAA,CACL,EAAA,CAAA;MACN,kBAAC,OAAD,EAAA,UAAA,CACE,kBAAC,SAAD;OACE,SAAQ;OACR,WAAU;iBACX;OAEO,CAAA,EACR,kBAAC,SAAD;OACE,IAAG;OACH,MAAK;OACL,OAAO;OACP,WAAW,MAAM,EAAc,EAAE,OAAO,MAAM;OAC9C,aAAY;OACZ,gBAAc,EAAQ;OACtB,WAAW;OACX,CAAA,CACE,EAAA,CAAA;MACL,KACC,kBAAC,KAAD;OAAG,MAAK;OAAQ,WAAU;iBACvB;OACC,CAAA;MAEN,kBAAC,OAAD;OAAK,WAAU;iBAAf,CACE,kBAAC,UAAD;QACE,MAAK;QACL,eAAe,EAAe,GAAM;QACpC,UAAU;QACV,WAAW;kBACZ;QAEQ,CAAA,EACT,kBAAC,UAAD;QACE,MAAK;QACL,UAAU;QACV,WAAW;kBAEV,IAAkB,YAAY;QACxB,CAAA,CACL;;MACD;;IACD,CAAA;GAER,kBAAC,GAAD;IACE,MAAM,MAAkB;IACxB,eAAe,EAAiB,KAAK;IACrC,OAAM;IACN,SACE,IACI,cAAc,EAAgB,EAAc,SAAS,CAAC,IACpD,EAAc,SAAS,QAAQ,eAAe,gBAC/C,sFACD;IAEI;IACV,OAAO;IACP,iBAAiB,KAAK,IAAe;IACrC,cAAa;IACb,CAAA;GACM"}
@@ -1 +1 @@
1
- {"version":3,"file":"AudiencesPage.d.ts","sourceRoot":"","sources":["../../../../src/headshotmarketing/pages/ads/AudiencesPage.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAgC,KAAK,EAAE,EAAE,MAAM,OAAO,CAAC;AA8F9D,eAAO,MAAM,aAAa,EAAE,EAwa3B,CAAC"}
1
+ {"version":3,"file":"AudiencesPage.d.ts","sourceRoot":"","sources":["../../../../src/headshotmarketing/pages/ads/AudiencesPage.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAgC,KAAK,EAAE,EAAE,MAAM,OAAO,CAAC;AA4F9D,eAAO,MAAM,aAAa,EAAE,EAkZ3B,CAAC"}