@burdenoff/microfe-tours 2026.513.2 → 2026.516.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.
@@ -1,17 +1,206 @@
1
1
  import { useToursContext as e } from "../providers/ToursProvider.js";
2
- import { useTourLifecycle as t } from "../hooks/useTourLifecycle.js";
3
- import { useToursPermissionAccess as n } from "../hooks/useToursPermissionAccess.js";
4
- import { TOUR_PERMISSIONS as r } from "../../constants/permissions.js";
5
- import { useToursI18n as i } from "../i18n.js";
6
- import { useTourBuilder as a } from "../hooks/useTourBuilder.js";
7
- import { useEffect as o, useRef as s, useState as c } from "react";
8
- import { PermissionGate as l } from "@burdenoff/fe-libs/shared/components";
9
- import { ArrowLeft as u, BarChart3 as d, Calendar as f, Eye as p, LayoutTemplate as m, ListOrdered as h, Save as g } from "lucide-react";
10
- import { Fragment as _, jsx as v, jsxs as y } from "react/jsx-runtime";
11
- import { useNavigate as b, useParams as x } from "react-router-dom";
2
+ import { useGetPlatformProductsForToursQuery as t } from "../../generated/global-operations.js";
3
+ import { useTourLifecycle as n } from "../hooks/useTourLifecycle.js";
4
+ import { useToursPermissionAccess as r } from "../hooks/useToursPermissionAccess.js";
5
+ import { TOUR_PERMISSIONS as i } from "../../constants/permissions.js";
6
+ import { useToursI18n as a } from "../i18n.js";
7
+ import { useTourBuilder as o } from "../hooks/useTourBuilder.js";
8
+ import { useEffect as s, useMemo as c, useRef as l, useState as u } from "react";
9
+ import { PermissionGate as d } from "@burdenoff/fe-libs/shared/components";
10
+ import { ArrowLeft as f, BarChart3 as p, Calendar as ee, Eye as te, LayoutTemplate as ne, ListOrdered as m, Save as h } from "lucide-react";
11
+ import { Fragment as g, jsx as _, jsxs as v } from "react/jsx-runtime";
12
+ import { useNavigate as re, useParams as ie } from "react-router-dom";
12
13
  //#region src/tours/pages/TourBuilderPage.tsx
13
- function S() {
14
- let { tr: S } = i(), { tourId: C } = x(), w = b(), { basePath: T = "/" } = e(), { hasPermission: E } = n(), D = !C || C === "new", O = E(r.TOUR_CREATE), k = E(r.TOUR_UPDATE), A = E(r.TOUR_TEMPLATE_CREATE), j = D ? O : k, { tour: M, loadTour: N, createTour: P, updateTour: F, saving: I, validationErrors: L, error: R } = a(C), { saveAsTemplate: z } = t(), [B, V] = c({
14
+ var y = 250, b = [
15
+ {
16
+ productId: "vibecontrols",
17
+ moduleId: "dashboard",
18
+ moduleLabel: "Dashboard",
19
+ pageId: "dashboard",
20
+ pageLabel: "Dashboard",
21
+ path: "/dashboard",
22
+ isModuleHome: !0
23
+ },
24
+ {
25
+ productId: "vibecontrols",
26
+ moduleId: "vibecontrols",
27
+ moduleLabel: "VibeControls",
28
+ pageId: "home",
29
+ pageLabel: "Overview",
30
+ path: "/vibecontrols",
31
+ isModuleHome: !0
32
+ },
33
+ {
34
+ productId: "vibecontrols",
35
+ moduleId: "vibecontrols",
36
+ moduleLabel: "VibeControls",
37
+ pageId: "agents",
38
+ pageLabel: "Targets & Agents",
39
+ path: "/vibecontrols/agents"
40
+ },
41
+ {
42
+ productId: "vibecontrols",
43
+ moduleId: "vibecontrols",
44
+ moduleLabel: "VibeControls",
45
+ pageId: "vibes",
46
+ pageLabel: "Vibes",
47
+ path: "/vibecontrols/vibes"
48
+ },
49
+ {
50
+ productId: "vibecontrols",
51
+ moduleId: "vibecontrols",
52
+ moduleLabel: "VibeControls",
53
+ pageId: "sessions",
54
+ pageLabel: "Sessions",
55
+ path: "/vibecontrols/sessions"
56
+ },
57
+ {
58
+ productId: "vibecontrols",
59
+ moduleId: "vibecontrols",
60
+ moduleLabel: "VibeControls",
61
+ pageId: "ai",
62
+ pageLabel: "AI",
63
+ path: "/vibecontrols/ai"
64
+ },
65
+ {
66
+ productId: "vibecontrols",
67
+ moduleId: "vibecontrols",
68
+ moduleLabel: "VibeControls",
69
+ pageId: "catalogs",
70
+ pageLabel: "Catalogs",
71
+ path: "/vibecontrols/catalogs"
72
+ },
73
+ {
74
+ productId: "vibecontrols",
75
+ moduleId: "vibecontrols",
76
+ moduleLabel: "VibeControls",
77
+ pageId: "components",
78
+ pageLabel: "Components",
79
+ path: "/vibecontrols/components"
80
+ },
81
+ {
82
+ productId: "vibecontrols",
83
+ moduleId: "vibecontrols",
84
+ moduleLabel: "VibeControls",
85
+ pageId: "templates",
86
+ pageLabel: "Templates",
87
+ path: "/vibecontrols/templates"
88
+ },
89
+ {
90
+ productId: "vibecontrols",
91
+ moduleId: "vibecontrols",
92
+ moduleLabel: "VibeControls",
93
+ pageId: "actions",
94
+ pageLabel: "Actions",
95
+ path: "/vibecontrols/actions"
96
+ },
97
+ {
98
+ productId: "vibecontrols",
99
+ moduleId: "vibecontrols",
100
+ moduleLabel: "VibeControls",
101
+ pageId: "vibedeck",
102
+ pageLabel: "Decks",
103
+ path: "/vibecontrols/vibedeck"
104
+ },
105
+ {
106
+ productId: "vibecontrols",
107
+ moduleId: "vibecontrols",
108
+ moduleLabel: "VibeControls",
109
+ pageId: "calendar",
110
+ pageLabel: "Calendar",
111
+ path: "/vibecontrols/calendar"
112
+ },
113
+ {
114
+ productId: "vibecontrols",
115
+ moduleId: "vibecontrols",
116
+ moduleLabel: "VibeControls",
117
+ pageId: "tunnels",
118
+ pageLabel: "Tunnels",
119
+ path: "/vibecontrols/tunnels"
120
+ },
121
+ {
122
+ productId: "vibecontrols",
123
+ moduleId: "vibecontrols",
124
+ moduleLabel: "VibeControls",
125
+ pageId: "analytics",
126
+ pageLabel: "Analytics",
127
+ path: "/vibecontrols/analytics"
128
+ },
129
+ {
130
+ productId: "vibecontrols",
131
+ moduleId: "vibecontrols",
132
+ moduleLabel: "VibeControls",
133
+ pageId: "audit",
134
+ pageLabel: "Audit Log",
135
+ path: "/vibecontrols/audit"
136
+ },
137
+ {
138
+ productId: "vibecontrols",
139
+ moduleId: "vibecontrols",
140
+ moduleLabel: "VibeControls",
141
+ pageId: "health",
142
+ pageLabel: "Health",
143
+ path: "/vibecontrols/health"
144
+ },
145
+ {
146
+ productId: "vibecontrols",
147
+ moduleId: "vibecontrols",
148
+ moduleLabel: "VibeControls",
149
+ pageId: "settings",
150
+ pageLabel: "Settings",
151
+ path: "/vibecontrols/settings"
152
+ },
153
+ {
154
+ productId: "vibecontrols",
155
+ moduleId: "scheduler",
156
+ moduleLabel: "Scheduler",
157
+ pageId: "scheduler",
158
+ pageLabel: "Scheduler",
159
+ path: "/scheduler",
160
+ isModuleHome: !0
161
+ },
162
+ {
163
+ productId: "vibecontrols",
164
+ moduleId: "sandbox",
165
+ moduleLabel: "Sandbox",
166
+ pageId: "sandbox",
167
+ pageLabel: "Sandbox",
168
+ path: "/sandbox",
169
+ isModuleHome: !0
170
+ }
171
+ ];
172
+ function x(e) {
173
+ return e?.trim() || void 0;
174
+ }
175
+ function S(e) {
176
+ let t = x(e);
177
+ return t ? b.filter((e) => e.productId === t) : [];
178
+ }
179
+ function C(e) {
180
+ let t = /* @__PURE__ */ new Map();
181
+ for (let n of S(e)) (!t.get(n.moduleId) || n.isModuleHome) && t.set(n.moduleId, {
182
+ moduleId: n.moduleId,
183
+ label: n.moduleLabel,
184
+ path: n.path
185
+ });
186
+ return [...t.values()];
187
+ }
188
+ function w(e, t) {
189
+ let n = x(t);
190
+ return n ? S(e).filter((e) => e.moduleId === n).map((e) => ({
191
+ pageId: e.pageId,
192
+ label: e.pageLabel,
193
+ path: e.path
194
+ })) : [];
195
+ }
196
+ function T() {
197
+ let { tr: b } = a(), { tourId: x } = ie(), S = re(), { basePath: T = "/" } = e(), { hasPermission: E } = r(), D = !x || x === "new", O = E(i.TOUR_CREATE), ae = E(i.TOUR_UPDATE), oe = E(i.TOUR_TEMPLATE_CREATE), se = D ? O : ae, { tour: k, loadTour: A, createTour: ce, updateTour: j, saving: M, validationErrors: N, error: P } = o(x), { saveAsTemplate: F } = n(), { data: I, loading: L } = t({
198
+ variables: {
199
+ limit: y,
200
+ offset: 0
201
+ },
202
+ fetchPolicy: "cache-and-network"
203
+ }), [R, z] = u({
15
204
  name: "",
16
205
  description: "",
17
206
  productId: "",
@@ -24,144 +213,326 @@ function S() {
24
213
  displayOrder: 1,
25
214
  startDate: "",
26
215
  endDate: ""
27
- }), H = s(!1);
28
- o(() => {
29
- C && C !== "new" && (H.current = !1, N(C));
30
- }, [C, N]), o(() => {
31
- M && !H.current && (V(M), H.current = !0);
32
- }, [M]);
33
- let U = async (e) => {
216
+ }), [B, V] = u(!1), [H, U] = u(!1), [W, G] = u(!1), K = l(!1), q = c(() => [...I?.platformProducts.items ?? []].sort((e, t) => e.name.localeCompare(t.name)), [I]), J = c(() => new Set(q.map((e) => e.slug)), [q]), Y = c(() => C(R.productId), [R.productId]), X = c(() => new Set(Y.map((e) => e.moduleId)), [Y]), Z = c(() => w(R.productId, R.moduleId), [R.moduleId, R.productId]), Q = c(() => new Set(Z.map((e) => e.pageId)), [Z]);
217
+ s(() => {
218
+ x && x !== "new" && (K.current = !1, A(x));
219
+ }, [x, A]), s(() => {
220
+ k && !K.current && (z(k), K.current = !0);
221
+ }, [k]), s(() => {
222
+ if (!R.productId || L) {
223
+ V(!1);
224
+ return;
225
+ }
226
+ V(q.length > 0 && !J.has(R.productId));
227
+ }, [
228
+ R.productId,
229
+ J,
230
+ q.length,
231
+ L
232
+ ]), s(() => {
233
+ if (!R.productId || !R.moduleId) {
234
+ U(!1);
235
+ return;
236
+ }
237
+ U(Y.length === 0 || !X.has(R.moduleId));
238
+ }, [
239
+ R.moduleId,
240
+ R.productId,
241
+ X,
242
+ Y.length
243
+ ]), s(() => {
244
+ if (!R.productId || !R.pageId) {
245
+ G(!1);
246
+ return;
247
+ }
248
+ G(Z.length === 0 || !Q.has(R.pageId));
249
+ }, [
250
+ R.pageId,
251
+ R.productId,
252
+ Q,
253
+ Z.length
254
+ ]);
255
+ let le = !!(R.productId && !B && !J.has(R.productId)), ue = !!(R.moduleId && !H && !X.has(R.moduleId)), de = !!(R.pageId && !W && !Q.has(R.pageId)), fe = async (e) => {
34
256
  e.preventDefault();
35
257
  try {
36
- C && C !== "new" ? await F(C, B) : await P(B);
258
+ x && x !== "new" ? await j(x, R) : await ce(R);
37
259
  } catch (e) {
38
260
  console.error("Failed to save tour:", e);
39
261
  }
40
- }, W = () => {
41
- w(`${T}/list`);
42
- }, G = (e) => {
262
+ }, pe = () => {
263
+ S(`${T}/list`);
264
+ }, $ = (e) => {
43
265
  if (!e) return "";
44
266
  let t = new Date(e);
45
267
  return Number.isNaN(t.getTime()) ? "" : (/* @__PURE__ */ new Date(t.getTime() - t.getTimezoneOffset() * 6e4)).toISOString().slice(0, 16);
46
268
  };
47
- return /* @__PURE__ */ y("div", {
269
+ return /* @__PURE__ */ v("div", {
48
270
  className: "space-y-4 sm:space-y-6 p-3 sm:p-6 max-w-4xl mx-auto",
49
- children: [/* @__PURE__ */ y("div", {
271
+ children: [/* @__PURE__ */ v("div", {
50
272
  className: "flex items-center gap-4",
51
- children: [/* @__PURE__ */ v("button", {
52
- onClick: W,
273
+ children: [/* @__PURE__ */ _("button", {
274
+ onClick: pe,
53
275
  className: "p-2 hover:bg-accent rounded-md",
54
- "aria-label": S("tourBuilder.goBack"),
55
- children: /* @__PURE__ */ v(u, { size: 20 })
56
- }), /* @__PURE__ */ y("div", {
276
+ "aria-label": b("tourBuilder.goBack"),
277
+ children: /* @__PURE__ */ _(f, { size: 20 })
278
+ }), /* @__PURE__ */ v("div", {
57
279
  className: "flex-1",
58
- children: [/* @__PURE__ */ v("h1", {
280
+ children: [/* @__PURE__ */ _("h1", {
59
281
  className: "text-xl sm:text-2xl font-bold text-foreground",
60
- children: S(C && C !== "new" ? "tourBuilder.titleEdit" : "tourBuilder.titleCreate")
61
- }), /* @__PURE__ */ v("p", {
282
+ children: b(x && x !== "new" ? "tourBuilder.titleEdit" : "tourBuilder.titleCreate")
283
+ }), /* @__PURE__ */ _("p", {
62
284
  className: "text-sm text-muted-foreground",
63
- children: S("tourBuilder.subtitle")
285
+ children: b("tourBuilder.subtitle")
64
286
  })]
65
287
  })]
66
- }), /* @__PURE__ */ y("form", {
67
- onSubmit: U,
288
+ }), /* @__PURE__ */ v("form", {
289
+ onSubmit: fe,
68
290
  className: "space-y-6",
69
291
  children: [
70
- /* @__PURE__ */ y("div", {
292
+ /* @__PURE__ */ v("div", {
71
293
  className: "border border-border rounded-md p-4 sm:p-6 bg-card",
72
- children: [/* @__PURE__ */ v("h2", {
294
+ children: [/* @__PURE__ */ _("h2", {
73
295
  className: "text-lg font-semibold mb-4",
74
- children: S("tourBuilder.sectionBasicInfo")
75
- }), /* @__PURE__ */ y("div", {
296
+ children: b("tourBuilder.sectionBasicInfo")
297
+ }), /* @__PURE__ */ v("div", {
76
298
  className: "space-y-4",
77
299
  children: [
78
- /* @__PURE__ */ y("div", { children: [/* @__PURE__ */ v("label", {
300
+ /* @__PURE__ */ v("div", { children: [/* @__PURE__ */ _("label", {
79
301
  className: "block text-sm font-medium mb-2",
80
302
  htmlFor: "tour-name",
81
- children: S("tourBuilder.labelName")
82
- }), /* @__PURE__ */ v("input", {
303
+ children: b("tourBuilder.labelName")
304
+ }), /* @__PURE__ */ _("input", {
83
305
  id: "tour-name",
84
306
  type: "text",
85
- value: B.name || "",
86
- onChange: (e) => V({
87
- ...B,
307
+ value: R.name || "",
308
+ onChange: (e) => z({
309
+ ...R,
88
310
  name: e.target.value
89
311
  }),
90
312
  className: "w-full px-3 py-2 border border-border rounded-md bg-background text-foreground",
91
313
  required: !0
92
314
  })] }),
93
- /* @__PURE__ */ y("div", { children: [/* @__PURE__ */ v("label", {
315
+ /* @__PURE__ */ v("div", { children: [/* @__PURE__ */ _("label", {
94
316
  className: "block text-sm font-medium mb-2",
95
317
  htmlFor: "tour-description",
96
- children: S("tourBuilder.labelDescription")
97
- }), /* @__PURE__ */ v("textarea", {
318
+ children: b("tourBuilder.labelDescription")
319
+ }), /* @__PURE__ */ _("textarea", {
98
320
  id: "tour-description",
99
- value: B.description || "",
100
- onChange: (e) => V({
101
- ...B,
321
+ value: R.description || "",
322
+ onChange: (e) => z({
323
+ ...R,
102
324
  description: e.target.value
103
325
  }),
104
326
  rows: 3,
105
327
  className: "w-full px-3 py-2 border border-border rounded-md bg-background text-foreground"
106
328
  })] }),
107
- /* @__PURE__ */ y("div", { children: [/* @__PURE__ */ v("label", {
108
- className: "block text-sm font-medium mb-2",
109
- htmlFor: "product-id",
110
- children: S("tourBuilder.labelProductId")
111
- }), /* @__PURE__ */ v("input", {
112
- id: "product-id",
113
- type: "text",
114
- value: B.productId || "",
115
- onChange: (e) => V({
116
- ...B,
117
- productId: e.target.value
118
- }),
119
- className: "w-full px-3 py-2 border border-border rounded-md bg-background text-foreground",
120
- required: !0
121
- })] }),
122
- /* @__PURE__ */ y("div", {
123
- className: "grid grid-cols-1 gap-4 sm:grid-cols-2",
124
- children: [/* @__PURE__ */ y("div", { children: [/* @__PURE__ */ v("label", {
329
+ /* @__PURE__ */ v("div", { children: [
330
+ /* @__PURE__ */ _("label", {
125
331
  className: "block text-sm font-medium mb-2",
126
- htmlFor: "module-id",
127
- children: "Module ID"
128
- }), /* @__PURE__ */ v("input", {
129
- id: "module-id",
130
- type: "text",
131
- value: B.moduleId || "",
132
- onChange: (e) => V({
133
- ...B,
134
- moduleId: e.target.value || void 0
135
- }),
332
+ htmlFor: "product-id",
333
+ children: b("tourBuilder.labelProductId")
334
+ }),
335
+ /* @__PURE__ */ v("select", {
336
+ id: "product-id",
337
+ value: B ? "__custom__" : R.productId || "",
338
+ onChange: (e) => {
339
+ if (e.target.value === "__custom__") {
340
+ V(!0), z({
341
+ ...R,
342
+ productId: "",
343
+ moduleId: void 0,
344
+ pageId: void 0
345
+ });
346
+ return;
347
+ }
348
+ V(!1), U(!1), G(!1), z({
349
+ ...R,
350
+ productId: e.target.value,
351
+ moduleId: void 0,
352
+ pageId: void 0
353
+ });
354
+ },
136
355
  className: "w-full px-3 py-2 border border-border rounded-md bg-background text-foreground",
137
- placeholder: "vibecontrols"
138
- })] }), /* @__PURE__ */ y("div", { children: [/* @__PURE__ */ v("label", {
139
- className: "block text-sm font-medium mb-2",
140
- htmlFor: "page-id",
141
- children: "Page ID"
142
- }), /* @__PURE__ */ v("input", {
143
- id: "page-id",
356
+ required: !0,
357
+ children: [
358
+ /* @__PURE__ */ _("option", {
359
+ value: "",
360
+ children: "Select product"
361
+ }),
362
+ L ? /* @__PURE__ */ _("option", {
363
+ disabled: !0,
364
+ children: "Loading products..."
365
+ }) : null,
366
+ q.map((e) => /* @__PURE__ */ v("option", {
367
+ value: e.slug,
368
+ children: [
369
+ e.name,
370
+ " (",
371
+ e.slug,
372
+ ")"
373
+ ]
374
+ }, e.id)),
375
+ le ? /* @__PURE__ */ v("option", {
376
+ value: R.productId,
377
+ children: ["Current: ", R.productId]
378
+ }) : null,
379
+ /* @__PURE__ */ _("option", {
380
+ value: "__custom__",
381
+ children: "Custom product slug"
382
+ })
383
+ ]
384
+ }),
385
+ B ? /* @__PURE__ */ _("input", {
386
+ id: "product-id-custom",
144
387
  type: "text",
145
- value: B.pageId || "",
146
- onChange: (e) => V({
147
- ...B,
148
- pageId: e.target.value || void 0
388
+ value: R.productId || "",
389
+ onChange: (e) => z({
390
+ ...R,
391
+ productId: e.target.value,
392
+ moduleId: void 0,
393
+ pageId: void 0
149
394
  }),
150
- className: "w-full px-3 py-2 border border-border rounded-md bg-background text-foreground",
151
- placeholder: "agents"
152
- })] })]
395
+ className: "mt-2 w-full px-3 py-2 border border-border rounded-md bg-background text-foreground",
396
+ placeholder: "vibecontrols",
397
+ required: !0
398
+ }) : null
399
+ ] }),
400
+ /* @__PURE__ */ v("div", {
401
+ className: "grid grid-cols-1 gap-4 sm:grid-cols-2",
402
+ children: [/* @__PURE__ */ v("div", { children: [
403
+ /* @__PURE__ */ _("label", {
404
+ className: "block text-sm font-medium mb-2",
405
+ htmlFor: "module-id",
406
+ children: "Module ID"
407
+ }),
408
+ /* @__PURE__ */ v("select", {
409
+ id: "module-id",
410
+ value: H ? "__custom__" : R.moduleId || "",
411
+ onChange: (e) => {
412
+ if (e.target.value === "__custom__") {
413
+ U(!0), z({
414
+ ...R,
415
+ moduleId: "",
416
+ pageId: void 0
417
+ });
418
+ return;
419
+ }
420
+ U(!1), G(!1), z({
421
+ ...R,
422
+ moduleId: e.target.value || void 0,
423
+ pageId: void 0
424
+ });
425
+ },
426
+ className: "w-full px-3 py-2 border border-border rounded-md bg-background text-foreground",
427
+ disabled: !R.productId,
428
+ children: [
429
+ /* @__PURE__ */ _("option", {
430
+ value: "",
431
+ children: "All modules"
432
+ }),
433
+ Y.map((e) => /* @__PURE__ */ v("option", {
434
+ value: e.moduleId,
435
+ children: [
436
+ e.label,
437
+ " (",
438
+ e.moduleId,
439
+ ")"
440
+ ]
441
+ }, e.moduleId)),
442
+ ue ? /* @__PURE__ */ v("option", {
443
+ value: R.moduleId,
444
+ children: ["Current: ", R.moduleId]
445
+ }) : null,
446
+ /* @__PURE__ */ _("option", {
447
+ value: "__custom__",
448
+ children: "Custom module ID"
449
+ })
450
+ ]
451
+ }),
452
+ H ? /* @__PURE__ */ _("input", {
453
+ id: "module-id-custom",
454
+ type: "text",
455
+ value: R.moduleId || "",
456
+ onChange: (e) => z({
457
+ ...R,
458
+ moduleId: e.target.value || void 0,
459
+ pageId: void 0
460
+ }),
461
+ className: "mt-2 w-full px-3 py-2 border border-border rounded-md bg-background text-foreground",
462
+ placeholder: "vibecontrols"
463
+ }) : null
464
+ ] }), /* @__PURE__ */ v("div", { children: [
465
+ /* @__PURE__ */ _("label", {
466
+ className: "block text-sm font-medium mb-2",
467
+ htmlFor: "page-id",
468
+ children: "Page ID"
469
+ }),
470
+ /* @__PURE__ */ v("select", {
471
+ id: "page-id",
472
+ value: W ? "__custom__" : R.pageId || "",
473
+ onChange: (e) => {
474
+ if (e.target.value === "__custom__") {
475
+ G(!0), z({
476
+ ...R,
477
+ pageId: ""
478
+ });
479
+ return;
480
+ }
481
+ G(!1), z({
482
+ ...R,
483
+ pageId: e.target.value || void 0
484
+ });
485
+ },
486
+ className: "w-full px-3 py-2 border border-border rounded-md bg-background text-foreground",
487
+ disabled: !R.productId,
488
+ children: [
489
+ /* @__PURE__ */ _("option", {
490
+ value: "",
491
+ children: "All pages"
492
+ }),
493
+ Z.map((e) => /* @__PURE__ */ v("option", {
494
+ value: e.pageId,
495
+ children: [
496
+ e.label,
497
+ " (",
498
+ e.pageId,
499
+ ")"
500
+ ]
501
+ }, e.pageId)),
502
+ de ? /* @__PURE__ */ v("option", {
503
+ value: R.pageId,
504
+ children: ["Current: ", R.pageId]
505
+ }) : null,
506
+ /* @__PURE__ */ _("option", {
507
+ value: "__custom__",
508
+ children: "Custom page ID"
509
+ })
510
+ ]
511
+ }),
512
+ W ? /* @__PURE__ */ _("input", {
513
+ id: "page-id-custom",
514
+ type: "text",
515
+ value: R.pageId || "",
516
+ onChange: (e) => z({
517
+ ...R,
518
+ pageId: e.target.value || void 0
519
+ }),
520
+ className: "mt-2 w-full px-3 py-2 border border-border rounded-md bg-background text-foreground",
521
+ placeholder: "agents"
522
+ }) : null
523
+ ] })]
153
524
  }),
154
- /* @__PURE__ */ y("label", {
525
+ /* @__PURE__ */ v("label", {
155
526
  className: "flex items-center gap-3 cursor-pointer",
156
- children: [/* @__PURE__ */ v("input", {
527
+ children: [/* @__PURE__ */ _("input", {
157
528
  type: "checkbox",
158
- checked: B.isActive ?? !0,
159
- onChange: (e) => V({
160
- ...B,
529
+ checked: R.isActive ?? !0,
530
+ onChange: (e) => z({
531
+ ...R,
161
532
  isActive: e.target.checked
162
533
  }),
163
534
  className: "w-4 h-4 rounded"
164
- }), /* @__PURE__ */ v("span", {
535
+ }), /* @__PURE__ */ _("span", {
165
536
  className: "text-sm font-medium",
166
537
  children: "Active"
167
538
  })]
@@ -169,90 +540,93 @@ function S() {
169
540
  ]
170
541
  })]
171
542
  }),
172
- /* @__PURE__ */ y("div", {
543
+ /* @__PURE__ */ v("div", {
173
544
  className: "border border-border rounded-md p-4 sm:p-6 bg-card",
174
- children: [/* @__PURE__ */ v("h2", {
545
+ children: [/* @__PURE__ */ _("h2", {
175
546
  className: "text-lg font-semibold mb-4",
176
- children: S("tourBuilder.sectionTriggerSettings")
177
- }), /* @__PURE__ */ y("div", {
547
+ children: b("tourBuilder.sectionTriggerSettings")
548
+ }), /* @__PURE__ */ v("div", {
178
549
  className: "space-y-4",
179
550
  children: [
180
- /* @__PURE__ */ y("div", { children: [/* @__PURE__ */ v("label", {
551
+ /* @__PURE__ */ v("div", { children: [/* @__PURE__ */ _("label", {
181
552
  className: "block text-sm font-medium mb-2",
182
553
  htmlFor: "trigger-type",
183
- children: S("tourBuilder.labelTriggerType")
184
- }), /* @__PURE__ */ y("select", {
554
+ children: b("tourBuilder.labelTriggerType")
555
+ }), /* @__PURE__ */ v("select", {
185
556
  id: "trigger-type",
186
- value: B.triggerType || "MANUAL",
187
- onChange: (e) => V({
188
- ...B,
557
+ value: R.triggerType || "MANUAL",
558
+ onChange: (e) => z({
559
+ ...R,
189
560
  triggerType: e.target.value
190
561
  }),
191
562
  className: "w-full px-3 py-2 border border-border rounded-md bg-background text-foreground",
192
563
  children: [
193
- /* @__PURE__ */ v("option", {
564
+ /* @__PURE__ */ _("option", {
194
565
  value: "MANUAL",
195
- children: S("tourBuilder.triggerManual")
566
+ children: b("tourBuilder.triggerManual")
196
567
  }),
197
- /* @__PURE__ */ v("option", {
568
+ /* @__PURE__ */ _("option", {
198
569
  value: "AUTO_FIRST_VISIT",
199
- children: S("tourBuilder.triggerAutoFirstVisit")
570
+ children: b("tourBuilder.triggerAutoFirstVisit")
200
571
  }),
201
- /* @__PURE__ */ v("option", {
572
+ /* @__PURE__ */ _("option", {
202
573
  value: "AUTO_ALWAYS",
203
- children: S("tourBuilder.triggerAutoAlways")
574
+ children: b("tourBuilder.triggerAutoAlways")
204
575
  }),
205
- /* @__PURE__ */ v("option", {
576
+ /* @__PURE__ */ _("option", {
206
577
  value: "ON_EVENT",
207
- children: S("tourBuilder.triggerOnEvent")
578
+ children: b("tourBuilder.triggerOnEvent")
208
579
  }),
209
- /* @__PURE__ */ v("option", {
580
+ /* @__PURE__ */ _("option", {
210
581
  value: "SCHEDULED",
211
- children: S("tourBuilder.triggerScheduled")
582
+ children: b("tourBuilder.triggerScheduled")
212
583
  })
213
584
  ]
214
585
  })] }),
215
- /* @__PURE__ */ y("div", { children: [/* @__PURE__ */ v("label", {
586
+ /* @__PURE__ */ v("div", { children: [/* @__PURE__ */ _("label", {
216
587
  className: "block text-sm font-medium mb-2",
217
588
  htmlFor: "priority",
218
- children: S("tourBuilder.labelPriority")
219
- }), /* @__PURE__ */ v("input", {
589
+ children: b("tourBuilder.labelPriority")
590
+ }), /* @__PURE__ */ _("input", {
220
591
  id: "priority",
221
592
  type: "number",
222
593
  min: "1",
223
594
  max: "100",
224
- value: B.priority || 50,
225
- onChange: (e) => V({
226
- ...B,
227
- priority: parseInt(e.target.value)
228
- }),
595
+ value: R.priority || 50,
596
+ onChange: (e) => {
597
+ let t = Number.parseInt(e.target.value, 10) || 50;
598
+ z({
599
+ ...R,
600
+ priority: t
601
+ });
602
+ },
229
603
  className: "w-full px-3 py-2 border border-border rounded-md bg-background text-foreground"
230
604
  })] }),
231
- /* @__PURE__ */ y("div", {
605
+ /* @__PURE__ */ v("div", {
232
606
  className: "grid grid-cols-1 gap-4 sm:grid-cols-2",
233
- children: [/* @__PURE__ */ y("div", { children: [/* @__PURE__ */ v("label", {
607
+ children: [/* @__PURE__ */ v("div", { children: [/* @__PURE__ */ _("label", {
234
608
  className: "block text-sm font-medium mb-2",
235
609
  htmlFor: "tour-start-date",
236
610
  children: "Start Date"
237
- }), /* @__PURE__ */ v("input", {
611
+ }), /* @__PURE__ */ _("input", {
238
612
  id: "tour-start-date",
239
613
  type: "datetime-local",
240
- value: G(B.startDate),
241
- onChange: (e) => V({
242
- ...B,
614
+ value: $(R.startDate),
615
+ onChange: (e) => z({
616
+ ...R,
243
617
  startDate: e.target.value ? new Date(e.target.value).toISOString() : void 0
244
618
  }),
245
619
  className: "w-full px-3 py-2 border border-border rounded-md bg-background text-foreground"
246
- })] }), /* @__PURE__ */ y("div", { children: [/* @__PURE__ */ v("label", {
620
+ })] }), /* @__PURE__ */ v("div", { children: [/* @__PURE__ */ _("label", {
247
621
  className: "block text-sm font-medium mb-2",
248
622
  htmlFor: "tour-end-date",
249
623
  children: "End Date"
250
- }), /* @__PURE__ */ v("input", {
624
+ }), /* @__PURE__ */ _("input", {
251
625
  id: "tour-end-date",
252
626
  type: "datetime-local",
253
- value: G(B.endDate),
254
- onChange: (e) => V({
255
- ...B,
627
+ value: $(R.endDate),
628
+ onChange: (e) => z({
629
+ ...R,
256
630
  endDate: e.target.value ? new Date(e.target.value).toISOString() : void 0
257
631
  }),
258
632
  className: "w-full px-3 py-2 border border-border rounded-md bg-background text-foreground"
@@ -261,94 +635,94 @@ function S() {
261
635
  ]
262
636
  })]
263
637
  }),
264
- R && /* @__PURE__ */ y("div", {
638
+ P && /* @__PURE__ */ v("div", {
265
639
  className: "border border-destructive rounded-md p-4 bg-destructive/10",
266
- children: [/* @__PURE__ */ v("h3", {
640
+ children: [/* @__PURE__ */ _("h3", {
267
641
  className: "font-semibold text-destructive mb-2",
268
- children: S("tourBuilder.errorTitle")
269
- }), /* @__PURE__ */ v("p", {
642
+ children: b("tourBuilder.errorTitle")
643
+ }), /* @__PURE__ */ _("p", {
270
644
  className: "text-sm text-destructive",
271
- children: R.message
645
+ children: P.message
272
646
  })]
273
647
  }),
274
- L.length > 0 && /* @__PURE__ */ y("div", {
648
+ N.length > 0 && /* @__PURE__ */ v("div", {
275
649
  className: "border border-destructive rounded-md p-4 bg-destructive/10",
276
- children: [/* @__PURE__ */ v("h3", {
650
+ children: [/* @__PURE__ */ _("h3", {
277
651
  className: "font-semibold text-destructive mb-2",
278
- children: S("tourBuilder.validationErrorsTitle")
279
- }), /* @__PURE__ */ v("ul", {
652
+ children: b("tourBuilder.validationErrorsTitle")
653
+ }), /* @__PURE__ */ _("ul", {
280
654
  className: "list-disc list-inside space-y-1",
281
- children: L.map((e, t) => /* @__PURE__ */ v("li", {
655
+ children: N.map((e, t) => /* @__PURE__ */ _("li", {
282
656
  className: "text-sm text-destructive",
283
657
  children: e.message
284
658
  }, t))
285
659
  })]
286
660
  }),
287
- /* @__PURE__ */ y("div", {
661
+ /* @__PURE__ */ v("div", {
288
662
  className: "flex flex-wrap gap-3",
289
- children: [/* @__PURE__ */ v(l, {
290
- permission: D ? r.TOUR_CREATE : r.TOUR_UPDATE,
291
- children: /* @__PURE__ */ y("button", {
663
+ children: [/* @__PURE__ */ _(d, {
664
+ permission: D ? i.TOUR_CREATE : i.TOUR_UPDATE,
665
+ children: /* @__PURE__ */ v("button", {
292
666
  type: "submit",
293
- disabled: I || !j,
667
+ disabled: M || !se,
294
668
  className: "flex-1 min-w-[200px] px-4 py-2 bg-primary text-primary-foreground rounded-md hover:bg-primary/90 disabled:opacity-50 flex items-center justify-center gap-2",
295
- children: [/* @__PURE__ */ v(g, { size: 20 }), S(I ? "tourBuilder.saving" : C && C !== "new" ? "tourBuilder.updateTour" : "tourBuilder.createAndAddSteps")]
669
+ children: [/* @__PURE__ */ _(h, { size: 20 }), b(M ? "tourBuilder.saving" : x && x !== "new" ? "tourBuilder.updateTour" : "tourBuilder.createAndAddSteps")]
296
670
  })
297
- }), C && C !== "new" && /* @__PURE__ */ y(_, { children: [
298
- /* @__PURE__ */ y("button", {
671
+ }), x && x !== "new" && /* @__PURE__ */ v(g, { children: [
672
+ /* @__PURE__ */ v("button", {
299
673
  type: "button",
300
- onClick: () => w(`${T}/${C}/steps`),
674
+ onClick: () => S(`${T}/${x}/steps`),
301
675
  className: "px-4 py-2 bg-secondary text-secondary-foreground rounded-md hover:bg-secondary/80 flex items-center gap-2",
302
676
  children: [
303
- /* @__PURE__ */ v(h, { size: 20 }),
304
- S("tourBuilder.editSteps"),
305
- M?.steps && M.steps.length > 0 && /* @__PURE__ */ v("span", {
677
+ /* @__PURE__ */ _(m, { size: 20 }),
678
+ b("tourBuilder.editSteps"),
679
+ k?.steps && k.steps.length > 0 && /* @__PURE__ */ _("span", {
306
680
  className: "ml-1 px-2 py-0.5 text-xs bg-primary/20 rounded-full",
307
- children: M.steps.length
681
+ children: k.steps.length
308
682
  })
309
683
  ]
310
684
  }),
311
- /* @__PURE__ */ y("button", {
685
+ /* @__PURE__ */ v("button", {
312
686
  type: "button",
313
- onClick: () => w(`${T}/${C}/preview`),
687
+ onClick: () => S(`${T}/${x}/preview`),
314
688
  className: "px-4 py-2 border border-border rounded-md hover:bg-accent flex items-center gap-2",
315
- children: [/* @__PURE__ */ v(p, { size: 20 }), S("tourBuilder.preview")]
689
+ children: [/* @__PURE__ */ _(te, { size: 20 }), b("tourBuilder.preview")]
316
690
  }),
317
- /* @__PURE__ */ y("button", {
691
+ /* @__PURE__ */ v("button", {
318
692
  type: "button",
319
- onClick: () => w(`${T}/${C}/analytics`),
693
+ onClick: () => S(`${T}/${x}/analytics`),
320
694
  className: "px-4 py-2 border border-border rounded-md hover:bg-accent flex items-center gap-2",
321
- children: [/* @__PURE__ */ v(d, { size: 20 }), S("tourBuilder.analytics")]
695
+ children: [/* @__PURE__ */ _(p, { size: 20 }), b("tourBuilder.analytics")]
322
696
  }),
323
- /* @__PURE__ */ y("button", {
697
+ /* @__PURE__ */ v("button", {
324
698
  type: "button",
325
- onClick: () => w(`${T}/${C}/schedule`),
699
+ onClick: () => S(`${T}/${x}/schedule`),
326
700
  className: "px-4 py-2 border border-border rounded-md hover:bg-accent flex items-center gap-2",
327
- children: [/* @__PURE__ */ v(f, { size: 20 }), "Schedule"]
701
+ children: [/* @__PURE__ */ _(ee, { size: 20 }), "Schedule"]
328
702
  }),
329
- /* @__PURE__ */ v(l, {
330
- permission: r.TOUR_TEMPLATE_CREATE,
331
- children: /* @__PURE__ */ y("button", {
703
+ /* @__PURE__ */ _(d, {
704
+ permission: i.TOUR_TEMPLATE_CREATE,
705
+ children: /* @__PURE__ */ v("button", {
332
706
  type: "button",
333
707
  onClick: async () => {
334
- if (!C || C === "new") return;
335
- let e = `${B.name || M?.name || "Tour"} Template`, t = window.prompt("Template name", e);
708
+ if (!x || x === "new") return;
709
+ let e = `${R.name || k?.name || "Tour"} Template`, t = window.prompt("Template name", e);
336
710
  if (!t) return;
337
711
  let n = window.prompt("Template category (ONBOARDING, FEATURE_ANNOUNCEMENT, HELP, CUSTOM)", "ONBOARDING") || "ONBOARDING";
338
712
  try {
339
- await z(C, {
713
+ await F(x, {
340
714
  name: t,
341
- description: B.description,
715
+ description: R.description,
342
716
  category: n,
343
717
  isPublic: !1
344
- }), w(`${T}/templates`);
718
+ }), S(`${T}/templates`);
345
719
  } catch (e) {
346
720
  console.error("Failed to save template:", e);
347
721
  }
348
722
  },
349
- disabled: !A,
723
+ disabled: !oe,
350
724
  className: "px-4 py-2 border border-border rounded-md hover:bg-accent flex items-center gap-2 disabled:opacity-50",
351
- children: [/* @__PURE__ */ v(m, { size: 20 }), "Save as Template"]
725
+ children: [/* @__PURE__ */ _(ne, { size: 20 }), "Save as Template"]
352
726
  })
353
727
  })
354
728
  ] })]
@@ -358,6 +732,6 @@ function S() {
358
732
  });
359
733
  }
360
734
  //#endregion
361
- export { S as TourBuilderPage };
735
+ export { T as TourBuilderPage };
362
736
 
363
737
  //# sourceMappingURL=TourBuilderPage.js.map