@burdenoff/microfe-tours 2026.523.1 → 2026.523.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.
@@ -3,17 +3,51 @@ import { useGetPlatformProductsForToursQuery as t } from "../../generated/global
3
3
  import { useTourLifecycle as n } from "../hooks/useTourLifecycle.js";
4
4
  import { useToursPermissionAccess as r } from "../hooks/useToursPermissionAccess.js";
5
5
  import { TOUR_PERMISSIONS as i } from "../../constants/permissions.js";
6
- import { useToursI18n as a } from "../i18n.js";
7
- import { emitToursApiFailed as o } from "../telemetry.js";
8
- import { useTourBuilder as s } from "../hooks/useTourBuilder.js";
9
- import { useEffect as c, useMemo as l, useRef as u, useState as d } from "react";
10
- import { PermissionGate as f } from "@burdenoff/fe-libs/shared/components";
11
- import { ArrowLeft as ee, BarChart3 as te, Calendar as ne, Eye as re, LayoutTemplate as ie, ListOrdered as ae, Save as oe } from "lucide-react";
12
- import { Fragment as se, jsx as p, jsxs as m } from "react/jsx-runtime";
13
- import { useNavigate as h, useParams as g } from "react-router-dom";
14
- import { useEventBus as _ } from "@burdenoff/fe-libs/shared/events";
6
+ import { useToursI18n as ee } from "../i18n.js";
7
+ import { emitToursApiFailed as a } from "../telemetry.js";
8
+ import { useTourBuilder as te } from "../hooks/useTourBuilder.js";
9
+ import { useEffect as o, useMemo as s, useRef as ne, useState as c } from "react";
10
+ import { PermissionGate as l } from "@burdenoff/fe-libs/shared/components";
11
+ import { ArrowLeft as re, BarChart3 as ie, Calendar as ae, Eye as oe, LayoutTemplate as se, ListOrdered as ce, Save as le, Sparkles as ue } from "lucide-react";
12
+ import { Fragment as de, jsx as u, jsxs as d } from "react/jsx-runtime";
13
+ import { useNavigate as fe, useParams as pe } from "react-router-dom";
14
+ import { useGatewayClient as f } from "@burdenoff/fe-libs/shared/graphql";
15
+ import { useEventBus as me } from "@burdenoff/fe-libs/shared/events";
16
+ import { gql as p } from "@apollo/client/core";
15
17
  //#region src/tours/pages/TourBuilderPage.tsx
16
- var v = 250, y = [
18
+ var he = 250, ge = p`
19
+ mutation SeedVibeControlsUserTours {
20
+ seedVibeControlsUserTours {
21
+ productId
22
+ workspaceId
23
+ createdCount
24
+ updatedCount
25
+ totalCount
26
+ tours {
27
+ tourId
28
+ slug
29
+ name
30
+ action
31
+ stepCount
32
+ }
33
+ }
34
+ }
35
+ `;
36
+ function _e(e) {
37
+ if (!e || typeof e != "object") return null;
38
+ let t = e, n = t.error;
39
+ if (n instanceof Error) return n.message;
40
+ let r = t.errors;
41
+ if (!Array.isArray(r) || r.length === 0) return null;
42
+ let i = r.map((e) => {
43
+ if (e instanceof Error) return e.message;
44
+ if (!e || typeof e != "object") return null;
45
+ let t = e.message;
46
+ return typeof t == "string" ? t : null;
47
+ }).filter((e) => !!e);
48
+ return i.length > 0 ? i.join("; ") : "Seed mutation returned errors.";
49
+ }
50
+ var m = [
17
51
  {
18
52
  productId: "vibecontrols",
19
53
  moduleId: "dashboard",
@@ -169,40 +203,115 @@ var v = 250, y = [
169
203
  pageLabel: "Sandbox",
170
204
  path: "/sandbox",
171
205
  isModuleHome: !0
206
+ },
207
+ {
208
+ productId: "vibecontrols",
209
+ moduleId: "support",
210
+ moduleLabel: "Support",
211
+ pageId: "tickets",
212
+ pageLabel: "Tickets",
213
+ path: "/support/tickets",
214
+ isModuleHome: !0
215
+ },
216
+ {
217
+ productId: "vibecontrols",
218
+ moduleId: "support",
219
+ moduleLabel: "Support",
220
+ pageId: "knowledge-base",
221
+ pageLabel: "Knowledge Base",
222
+ path: "/support/kb"
223
+ },
224
+ {
225
+ productId: "vibecontrols",
226
+ moduleId: "notifications",
227
+ moduleLabel: "Notifications",
228
+ pageId: "center",
229
+ pageLabel: "Notification Center",
230
+ path: "/notifications/center",
231
+ isModuleHome: !0
232
+ },
233
+ {
234
+ productId: "vibecontrols",
235
+ moduleId: "notifications",
236
+ moduleLabel: "Notifications",
237
+ pageId: "history",
238
+ pageLabel: "History",
239
+ path: "/notifications/history"
240
+ },
241
+ {
242
+ productId: "vibecontrols",
243
+ moduleId: "notifications",
244
+ moduleLabel: "Notifications",
245
+ pageId: "preferences",
246
+ pageLabel: "Preferences",
247
+ path: "/notifications/preferences"
248
+ },
249
+ {
250
+ productId: "vibecontrols",
251
+ moduleId: "conversations",
252
+ moduleLabel: "Conversations",
253
+ pageId: "home",
254
+ pageLabel: "All Conversations",
255
+ path: "/conversations",
256
+ isModuleHome: !0
257
+ },
258
+ {
259
+ productId: "vibecontrols",
260
+ moduleId: "conversations",
261
+ moduleLabel: "Conversations",
262
+ pageId: "list",
263
+ pageLabel: "Conversation List",
264
+ path: "/conversations/list"
265
+ },
266
+ {
267
+ productId: "vibecontrols",
268
+ moduleId: "conversations",
269
+ moduleLabel: "Conversations",
270
+ pageId: "new",
271
+ pageLabel: "New Conversation",
272
+ path: "/conversations/new"
273
+ },
274
+ {
275
+ productId: "vibecontrols",
276
+ moduleId: "conversations",
277
+ moduleLabel: "Conversations",
278
+ pageId: "settings",
279
+ pageLabel: "Settings",
280
+ path: "/conversations/settings"
172
281
  }
173
282
  ];
174
- function b(e) {
283
+ function h(e) {
175
284
  return e?.trim() || void 0;
176
285
  }
177
- function x(e) {
178
- let t = b(e);
179
- return t ? y.filter((e) => e.productId === t) : [];
286
+ function g(e) {
287
+ let t = h(e);
288
+ return t ? m.filter((e) => e.productId === t) : [];
180
289
  }
181
- function ce(e) {
290
+ function ve(e) {
182
291
  let t = /* @__PURE__ */ new Map();
183
- for (let n of x(e)) (!t.get(n.moduleId) || n.isModuleHome) && t.set(n.moduleId, {
292
+ for (let n of g(e)) (!t.get(n.moduleId) || n.isModuleHome) && t.set(n.moduleId, {
184
293
  moduleId: n.moduleId,
185
294
  label: n.moduleLabel,
186
295
  path: n.path
187
296
  });
188
297
  return [...t.values()];
189
298
  }
190
- function le(e, t) {
191
- let n = b(t);
192
- return n ? x(e).filter((e) => e.moduleId === n).map((e) => ({
299
+ function ye(e, t) {
300
+ let n = h(t);
301
+ return n ? g(e).filter((e) => e.moduleId === n).map((e) => ({
193
302
  pageId: e.pageId,
194
303
  label: e.pageLabel,
195
304
  path: e.path
196
305
  })) : [];
197
306
  }
198
- function S() {
199
- let { tr: y } = a(), { tourId: b } = g(), x = h(), S = e(), { basePath: C = "/" } = S, w = _(), { hasPermission: T } = r(), E = !b || b === "new", ue = T(i.TOUR_CREATE), de = T(i.TOUR_UPDATE), fe = T(i.TOUR_TEMPLATE_CREATE), pe = E ? ue : de, { tour: D, loadTour: O, createTour: k, updateTour: A, saving: j, validationErrors: M, error: N } = s(b), { saveAsTemplate: P } = n(), { data: F, loading: I } = t({
307
+ function _() {
308
+ let { tr: p } = ee(), { tourId: m } = pe(), h = fe(), g = e(), { basePath: _ = "/" } = g, v = me(), be = f("global"), { hasPermission: y } = r(), b = !m || m === "new", x = y(i.TOUR_CREATE), S = y(i.TOUR_UPDATE), xe = y(i.TOUR_TEMPLATE_CREATE), Se = b ? x : S, C = x && S, { tour: w, loadTour: T, createTour: Ce, updateTour: we, saving: E, validationErrors: D, error: O } = te(m), { saveAsTemplate: k } = n(), { data: A, loading: j } = t({
200
309
  variables: {
201
- limit: v,
310
+ limit: he,
202
311
  offset: 0
203
312
  },
204
313
  fetchPolicy: "cache-and-network"
205
- }), [L, R] = d({
314
+ }), [M, N] = c({
206
315
  name: "",
207
316
  description: "",
208
317
  productId: "",
@@ -215,525 +324,592 @@ function S() {
215
324
  displayOrder: 1,
216
325
  startDate: "",
217
326
  endDate: ""
218
- }), [z, B] = d(!1), [V, H] = d(!1), [U, W] = d(!1), G = u(!1), K = l(() => [...F?.platformProducts.items ?? []].sort((e, t) => e.name.localeCompare(t.name)), [F]), q = l(() => new Set(K.map((e) => e.slug)), [K]), J = l(() => ce(L.productId), [L.productId]), Y = l(() => new Set(J.map((e) => e.moduleId)), [J]), X = l(() => le(L.productId, L.moduleId), [L.moduleId, L.productId]), Z = l(() => new Set(X.map((e) => e.pageId)), [X]);
219
- c(() => {
220
- b && b !== "new" && (G.current = !1, O(b));
221
- }, [b, O]), c(() => {
222
- D && !G.current && (R(D), G.current = !0);
223
- }, [D]), c(() => {
224
- if (!L.productId || I) {
225
- B(!1);
327
+ }), [P, F] = c(!1), [I, L] = c(!1), [R, z] = c(!1), [B, V] = c(!1), [H, U] = c(null), [W, G] = c(null), K = ne(!1), q = s(() => [...A?.platformProducts.items ?? []].sort((e, t) => e.name.localeCompare(t.name)), [A]), J = s(() => new Set(q.map((e) => e.slug)), [q]), Y = s(() => ve(M.productId), [M.productId]), X = s(() => new Set(Y.map((e) => e.moduleId)), [Y]), Z = s(() => ye(M.productId, M.moduleId), [M.moduleId, M.productId]), Q = s(() => new Set(Z.map((e) => e.pageId)), [Z]);
328
+ o(() => {
329
+ m && m !== "new" && (K.current = !1, T(m));
330
+ }, [m, T]), o(() => {
331
+ w && !K.current && (N(w), K.current = !0);
332
+ }, [w]), o(() => {
333
+ if (!M.productId || j) {
334
+ F(!1);
226
335
  return;
227
336
  }
228
- B(K.length > 0 && !q.has(L.productId));
337
+ F(q.length > 0 && !J.has(M.productId));
229
338
  }, [
230
- L.productId,
231
- q,
232
- K.length,
233
- I
234
- ]), c(() => {
235
- if (!L.productId || !L.moduleId) {
236
- H(!1);
339
+ M.productId,
340
+ J,
341
+ q.length,
342
+ j
343
+ ]), o(() => {
344
+ if (!M.productId || !M.moduleId) {
345
+ L(!1);
237
346
  return;
238
347
  }
239
- H(J.length === 0 || !Y.has(L.moduleId));
348
+ L(Y.length === 0 || !X.has(M.moduleId));
240
349
  }, [
241
- L.moduleId,
242
- L.productId,
243
- Y,
244
- J.length
245
- ]), c(() => {
246
- if (!L.productId || !L.pageId) {
247
- W(!1);
350
+ M.moduleId,
351
+ M.productId,
352
+ X,
353
+ Y.length
354
+ ]), o(() => {
355
+ if (!M.productId || !M.pageId) {
356
+ z(!1);
248
357
  return;
249
358
  }
250
- W(X.length === 0 || !Z.has(L.pageId));
359
+ z(Z.length === 0 || !Q.has(M.pageId));
251
360
  }, [
252
- L.pageId,
253
- L.productId,
254
- Z,
255
- X.length
361
+ M.pageId,
362
+ M.productId,
363
+ Q,
364
+ Z.length
256
365
  ]);
257
- let me = !!(L.productId && !z && !q.has(L.productId)), he = !!(L.moduleId && !V && !Y.has(L.moduleId)), ge = !!(L.pageId && !U && !Z.has(L.pageId)), _e = async (e) => {
366
+ let Te = !!(M.productId && !P && !J.has(M.productId)), Ee = !!(M.moduleId && !I && !X.has(M.moduleId)), De = !!(M.pageId && !R && !Q.has(M.pageId)), Oe = async (e) => {
258
367
  e.preventDefault();
259
368
  try {
260
- b && b !== "new" ? await A(b, L) : await k(L);
369
+ m && m !== "new" ? await we(m, M) : await Ce(M);
261
370
  } catch {
262
- o(w, "tour.save", S);
371
+ a(v, "tour.save", g);
263
372
  }
264
- }, Q = () => {
265
- x(`${C}/list`);
373
+ }, ke = () => {
374
+ h(`${_}/list`);
266
375
  }, $ = (e) => {
267
376
  if (!e) return "";
268
377
  let t = new Date(e);
269
378
  return Number.isNaN(t.getTime()) ? "" : (/* @__PURE__ */ new Date(t.getTime() - t.getTimezoneOffset() * 6e4)).toISOString().slice(0, 16);
379
+ }, Ae = async () => {
380
+ if (!m || m === "new") return;
381
+ let e = `${M.name || w?.name || "Tour"} Template`, t = window.prompt("Template name", e);
382
+ if (!t) return;
383
+ let n = window.prompt("Template category (ONBOARDING, FEATURE_ANNOUNCEMENT, HELP, CUSTOM)", "ONBOARDING") || "ONBOARDING";
384
+ try {
385
+ await k(m, {
386
+ name: t,
387
+ description: M.description,
388
+ category: n,
389
+ isPublic: !1
390
+ }), h(`${_}/templates`);
391
+ } catch {
392
+ a(v, "template.save", g);
393
+ }
394
+ }, je = async () => {
395
+ if (window.confirm(p("tourBuilder.seedVibeControls.confirm"))) {
396
+ V(!0), U(null), G(null);
397
+ try {
398
+ let e = await be.mutate({ mutation: ge }), t = _e(e);
399
+ if (t) throw Error(t);
400
+ let n = e.data?.seedVibeControlsUserTours;
401
+ if (!n) throw Error("Seed mutation returned no result.");
402
+ U(n);
403
+ } catch (e) {
404
+ let t = e instanceof Error ? e.message : p("tourBuilder.seedVibeControls.error");
405
+ G(t), v.emit("tours.api.failed", {
406
+ route: "/tours",
407
+ operation: "tour.seed_vibecontrols_user_tours",
408
+ errorMessage: t,
409
+ productId: g.productId,
410
+ workspaceId: g.workspaceId
411
+ }, { component: "microfe-tours" });
412
+ } finally {
413
+ V(!1);
414
+ }
415
+ }
270
416
  };
271
- return /* @__PURE__ */ m("div", {
417
+ return /* @__PURE__ */ d("div", {
272
418
  className: "space-y-4 sm:space-y-6 p-3 sm:p-6 max-w-4xl mx-auto",
273
- children: [/* @__PURE__ */ m("div", {
274
- className: "flex items-center gap-4",
275
- children: [/* @__PURE__ */ p("button", {
276
- onClick: Q,
277
- className: "p-2 hover:bg-accent rounded-md",
278
- "aria-label": y("tourBuilder.goBack"),
279
- children: /* @__PURE__ */ p(ee, { size: 20 })
280
- }), /* @__PURE__ */ m("div", {
281
- className: "flex-1",
282
- children: [/* @__PURE__ */ p("h1", {
283
- className: "text-xl sm:text-2xl font-bold text-foreground",
284
- children: y(b && b !== "new" ? "tourBuilder.titleEdit" : "tourBuilder.titleCreate")
285
- }), /* @__PURE__ */ p("p", {
286
- className: "text-sm text-muted-foreground",
287
- children: y("tourBuilder.subtitle")
419
+ children: [
420
+ /* @__PURE__ */ d("div", {
421
+ className: "flex items-center gap-4",
422
+ children: [/* @__PURE__ */ u("button", {
423
+ onClick: ke,
424
+ className: "p-2 hover:bg-accent rounded-md",
425
+ "aria-label": p("tourBuilder.goBack"),
426
+ children: /* @__PURE__ */ u(re, { size: 20 })
427
+ }), /* @__PURE__ */ d("div", {
428
+ className: "flex-1",
429
+ children: [/* @__PURE__ */ u("h1", {
430
+ className: "text-xl sm:text-2xl font-bold text-foreground",
431
+ children: p(m && m !== "new" ? "tourBuilder.titleEdit" : "tourBuilder.titleCreate")
432
+ }), /* @__PURE__ */ u("p", {
433
+ className: "text-sm text-muted-foreground",
434
+ children: p("tourBuilder.subtitle")
435
+ })]
288
436
  })]
289
- })]
290
- }), /* @__PURE__ */ m("form", {
291
- onSubmit: _e,
292
- className: "space-y-6",
293
- children: [
294
- /* @__PURE__ */ m("div", {
295
- className: "border border-border rounded-md p-4 sm:p-6 bg-card",
296
- children: [/* @__PURE__ */ p("h2", {
297
- className: "text-lg font-semibold mb-4",
298
- children: y("tourBuilder.sectionBasicInfo")
299
- }), /* @__PURE__ */ m("div", {
300
- className: "space-y-4",
301
- children: [
302
- /* @__PURE__ */ m("div", { children: [/* @__PURE__ */ p("label", {
303
- className: "block text-sm font-medium mb-2",
304
- htmlFor: "tour-name",
305
- children: y("tourBuilder.labelName")
306
- }), /* @__PURE__ */ p("input", {
307
- id: "tour-name",
308
- type: "text",
309
- value: L.name || "",
310
- onChange: (e) => R({
311
- ...L,
312
- name: e.target.value
313
- }),
314
- className: "w-full px-3 py-2 border border-border rounded-md bg-background text-foreground",
315
- required: !0
316
- })] }),
317
- /* @__PURE__ */ m("div", { children: [/* @__PURE__ */ p("label", {
318
- className: "block text-sm font-medium mb-2",
319
- htmlFor: "tour-description",
320
- children: y("tourBuilder.labelDescription")
321
- }), /* @__PURE__ */ p("textarea", {
322
- id: "tour-description",
323
- value: L.description || "",
324
- onChange: (e) => R({
325
- ...L,
326
- description: e.target.value
327
- }),
328
- rows: 3,
329
- className: "w-full px-3 py-2 border border-border rounded-md bg-background text-foreground"
330
- })] }),
331
- /* @__PURE__ */ m("div", { children: [
332
- /* @__PURE__ */ p("label", {
437
+ }),
438
+ b ? /* @__PURE__ */ d("div", {
439
+ className: "rounded-md border border-border bg-card p-4 sm:p-6",
440
+ children: [
441
+ /* @__PURE__ */ d("div", {
442
+ className: "flex flex-col gap-4 sm:flex-row sm:items-start sm:justify-between",
443
+ children: [/* @__PURE__ */ d("div", {
444
+ className: "space-y-1",
445
+ children: [/* @__PURE__ */ u("h2", {
446
+ className: "text-lg font-semibold text-foreground",
447
+ children: p("tourBuilder.seedVibeControls.title")
448
+ }), /* @__PURE__ */ u("p", {
449
+ className: "text-sm text-muted-foreground",
450
+ children: p("tourBuilder.seedVibeControls.description")
451
+ })]
452
+ }), /* @__PURE__ */ d("button", {
453
+ type: "button",
454
+ onClick: () => void je(),
455
+ disabled: B || !C,
456
+ className: "inline-flex min-h-11 items-center justify-center gap-2 rounded-md border border-border bg-secondary px-4 py-2 text-sm font-medium text-secondary-foreground hover:bg-secondary/80 disabled:cursor-not-allowed disabled:opacity-50",
457
+ children: [/* @__PURE__ */ u(ue, { size: 18 }), p(B ? "tourBuilder.seedVibeControls.loading" : "tourBuilder.seedVibeControls.button")]
458
+ })]
459
+ }),
460
+ C ? null : /* @__PURE__ */ u("p", {
461
+ className: "mt-3 text-sm text-muted-foreground",
462
+ children: p("tourBuilder.seedVibeControls.permissionHint")
463
+ }),
464
+ W ? /* @__PURE__ */ u("p", {
465
+ className: "mt-3 text-sm text-destructive",
466
+ children: W
467
+ }) : null,
468
+ H ? /* @__PURE__ */ u("div", {
469
+ className: "mt-3 rounded-md border border-border bg-background p-3 text-sm text-muted-foreground",
470
+ children: p("tourBuilder.seedVibeControls.result", {
471
+ totalCount: H.totalCount,
472
+ productId: H.productId,
473
+ workspaceId: H.workspaceId,
474
+ createdCount: H.createdCount,
475
+ updatedCount: H.updatedCount
476
+ })
477
+ }) : null
478
+ ]
479
+ }) : null,
480
+ /* @__PURE__ */ d("form", {
481
+ onSubmit: Oe,
482
+ className: "space-y-6",
483
+ children: [
484
+ /* @__PURE__ */ d("div", {
485
+ className: "border border-border rounded-md p-4 sm:p-6 bg-card",
486
+ children: [/* @__PURE__ */ u("h2", {
487
+ className: "text-lg font-semibold mb-4",
488
+ children: p("tourBuilder.sectionBasicInfo")
489
+ }), /* @__PURE__ */ d("div", {
490
+ className: "space-y-4",
491
+ children: [
492
+ /* @__PURE__ */ d("div", { children: [/* @__PURE__ */ u("label", {
333
493
  className: "block text-sm font-medium mb-2",
334
- htmlFor: "product-id",
335
- children: y("tourBuilder.labelProductId")
336
- }),
337
- /* @__PURE__ */ m("select", {
338
- id: "product-id",
339
- value: z ? "__custom__" : L.productId || "",
340
- onChange: (e) => {
341
- if (e.target.value === "__custom__") {
342
- B(!0), R({
343
- ...L,
344
- productId: "",
345
- moduleId: void 0,
346
- pageId: void 0
347
- });
348
- return;
349
- }
350
- B(!1), H(!1), W(!1), R({
351
- ...L,
352
- productId: e.target.value,
353
- moduleId: void 0,
354
- pageId: void 0
355
- });
356
- },
357
- className: "w-full px-3 py-2 border border-border rounded-md bg-background text-foreground",
358
- required: !0,
359
- children: [
360
- /* @__PURE__ */ p("option", {
361
- value: "",
362
- children: "Select product"
363
- }),
364
- I ? /* @__PURE__ */ p("option", {
365
- disabled: !0,
366
- children: "Loading products..."
367
- }) : null,
368
- K.map((e) => /* @__PURE__ */ m("option", {
369
- value: e.slug,
370
- children: [
371
- e.name,
372
- " (",
373
- e.slug,
374
- ")"
375
- ]
376
- }, e.id)),
377
- me ? /* @__PURE__ */ m("option", {
378
- value: L.productId,
379
- children: ["Current: ", L.productId]
380
- }) : null,
381
- /* @__PURE__ */ p("option", {
382
- value: "__custom__",
383
- children: "Custom product slug"
384
- })
385
- ]
386
- }),
387
- z ? /* @__PURE__ */ p("input", {
388
- id: "product-id-custom",
494
+ htmlFor: "tour-name",
495
+ children: p("tourBuilder.labelName")
496
+ }), /* @__PURE__ */ u("input", {
497
+ id: "tour-name",
389
498
  type: "text",
390
- value: L.productId || "",
391
- onChange: (e) => R({
392
- ...L,
393
- productId: e.target.value,
394
- moduleId: void 0,
395
- pageId: void 0
499
+ value: M.name || "",
500
+ onChange: (e) => N({
501
+ ...M,
502
+ name: e.target.value
396
503
  }),
397
- className: "mt-2 w-full px-3 py-2 border border-border rounded-md bg-background text-foreground",
398
- placeholder: "vibecontrols",
504
+ className: "w-full px-3 py-2 border border-border rounded-md bg-background text-foreground",
399
505
  required: !0
400
- }) : null
401
- ] }),
402
- /* @__PURE__ */ m("div", {
403
- className: "grid grid-cols-1 gap-4 sm:grid-cols-2",
404
- children: [/* @__PURE__ */ m("div", { children: [
405
- /* @__PURE__ */ p("label", {
506
+ })] }),
507
+ /* @__PURE__ */ d("div", { children: [/* @__PURE__ */ u("label", {
508
+ className: "block text-sm font-medium mb-2",
509
+ htmlFor: "tour-description",
510
+ children: p("tourBuilder.labelDescription")
511
+ }), /* @__PURE__ */ u("textarea", {
512
+ id: "tour-description",
513
+ value: M.description || "",
514
+ onChange: (e) => N({
515
+ ...M,
516
+ description: e.target.value
517
+ }),
518
+ rows: 3,
519
+ className: "w-full px-3 py-2 border border-border rounded-md bg-background text-foreground"
520
+ })] }),
521
+ /* @__PURE__ */ d("div", { children: [
522
+ /* @__PURE__ */ u("label", {
406
523
  className: "block text-sm font-medium mb-2",
407
- htmlFor: "module-id",
408
- children: "Module ID"
524
+ htmlFor: "product-id",
525
+ children: p("tourBuilder.labelProductId")
409
526
  }),
410
- /* @__PURE__ */ m("select", {
411
- id: "module-id",
412
- value: V ? "__custom__" : L.moduleId || "",
527
+ /* @__PURE__ */ d("select", {
528
+ id: "product-id",
529
+ value: P ? "__custom__" : M.productId || "",
413
530
  onChange: (e) => {
414
531
  if (e.target.value === "__custom__") {
415
- H(!0), R({
416
- ...L,
417
- moduleId: "",
532
+ F(!0), N({
533
+ ...M,
534
+ productId: "",
535
+ moduleId: void 0,
418
536
  pageId: void 0
419
537
  });
420
538
  return;
421
539
  }
422
- H(!1), W(!1), R({
423
- ...L,
424
- moduleId: e.target.value || void 0,
540
+ F(!1), L(!1), z(!1), N({
541
+ ...M,
542
+ productId: e.target.value,
543
+ moduleId: void 0,
425
544
  pageId: void 0
426
545
  });
427
546
  },
428
547
  className: "w-full px-3 py-2 border border-border rounded-md bg-background text-foreground",
429
- disabled: !L.productId,
548
+ required: !0,
430
549
  children: [
431
- /* @__PURE__ */ p("option", {
550
+ /* @__PURE__ */ u("option", {
432
551
  value: "",
433
- children: "All modules"
552
+ children: "Select product"
434
553
  }),
435
- J.map((e) => /* @__PURE__ */ m("option", {
436
- value: e.moduleId,
554
+ j ? /* @__PURE__ */ u("option", {
555
+ disabled: !0,
556
+ children: "Loading products..."
557
+ }) : null,
558
+ q.map((e) => /* @__PURE__ */ d("option", {
559
+ value: e.slug,
437
560
  children: [
438
- e.label,
561
+ e.name,
439
562
  " (",
440
- e.moduleId,
563
+ e.slug,
441
564
  ")"
442
565
  ]
443
- }, e.moduleId)),
444
- he ? /* @__PURE__ */ m("option", {
445
- value: L.moduleId,
446
- children: ["Current: ", L.moduleId]
566
+ }, e.id)),
567
+ Te ? /* @__PURE__ */ d("option", {
568
+ value: M.productId,
569
+ children: ["Current: ", M.productId]
447
570
  }) : null,
448
- /* @__PURE__ */ p("option", {
571
+ /* @__PURE__ */ u("option", {
449
572
  value: "__custom__",
450
- children: "Custom module ID"
573
+ children: "Custom product slug"
451
574
  })
452
575
  ]
453
576
  }),
454
- V ? /* @__PURE__ */ p("input", {
455
- id: "module-id-custom",
577
+ P ? /* @__PURE__ */ u("input", {
578
+ id: "product-id-custom",
456
579
  type: "text",
457
- value: L.moduleId || "",
458
- onChange: (e) => R({
459
- ...L,
460
- moduleId: e.target.value || void 0,
580
+ value: M.productId || "",
581
+ onChange: (e) => N({
582
+ ...M,
583
+ productId: e.target.value,
584
+ moduleId: void 0,
461
585
  pageId: void 0
462
586
  }),
463
587
  className: "mt-2 w-full px-3 py-2 border border-border rounded-md bg-background text-foreground",
464
- placeholder: "vibecontrols"
588
+ placeholder: "vibecontrols",
589
+ required: !0
465
590
  }) : null
466
- ] }), /* @__PURE__ */ m("div", { children: [
467
- /* @__PURE__ */ p("label", {
468
- className: "block text-sm font-medium mb-2",
469
- htmlFor: "page-id",
470
- children: "Page ID"
471
- }),
472
- /* @__PURE__ */ m("select", {
473
- id: "page-id",
474
- value: U ? "__custom__" : L.pageId || "",
475
- onChange: (e) => {
476
- if (e.target.value === "__custom__") {
477
- W(!0), R({
478
- ...L,
479
- pageId: ""
591
+ ] }),
592
+ /* @__PURE__ */ d("div", {
593
+ className: "grid grid-cols-1 gap-4 sm:grid-cols-2",
594
+ children: [/* @__PURE__ */ d("div", { children: [
595
+ /* @__PURE__ */ u("label", {
596
+ className: "block text-sm font-medium mb-2",
597
+ htmlFor: "module-id",
598
+ children: "Module ID"
599
+ }),
600
+ /* @__PURE__ */ d("select", {
601
+ id: "module-id",
602
+ value: I ? "__custom__" : M.moduleId || "",
603
+ onChange: (e) => {
604
+ if (e.target.value === "__custom__") {
605
+ L(!0), N({
606
+ ...M,
607
+ moduleId: "",
608
+ pageId: void 0
609
+ });
610
+ return;
611
+ }
612
+ L(!1), z(!1), N({
613
+ ...M,
614
+ moduleId: e.target.value || void 0,
615
+ pageId: void 0
480
616
  });
481
- return;
482
- }
483
- W(!1), R({
484
- ...L,
485
- pageId: e.target.value || void 0
486
- });
487
- },
488
- className: "w-full px-3 py-2 border border-border rounded-md bg-background text-foreground",
489
- disabled: !L.productId,
490
- children: [
491
- /* @__PURE__ */ p("option", {
492
- value: "",
493
- children: "All pages"
617
+ },
618
+ className: "w-full px-3 py-2 border border-border rounded-md bg-background text-foreground",
619
+ disabled: !M.productId,
620
+ children: [
621
+ /* @__PURE__ */ u("option", {
622
+ value: "",
623
+ children: "All modules"
624
+ }),
625
+ Y.map((e) => /* @__PURE__ */ d("option", {
626
+ value: e.moduleId,
627
+ children: [
628
+ e.label,
629
+ " (",
630
+ e.moduleId,
631
+ ")"
632
+ ]
633
+ }, e.moduleId)),
634
+ Ee ? /* @__PURE__ */ d("option", {
635
+ value: M.moduleId,
636
+ children: ["Current: ", M.moduleId]
637
+ }) : null,
638
+ /* @__PURE__ */ u("option", {
639
+ value: "__custom__",
640
+ children: "Custom module ID"
641
+ })
642
+ ]
643
+ }),
644
+ I ? /* @__PURE__ */ u("input", {
645
+ id: "module-id-custom",
646
+ type: "text",
647
+ value: M.moduleId || "",
648
+ onChange: (e) => N({
649
+ ...M,
650
+ moduleId: e.target.value || void 0,
651
+ pageId: void 0
494
652
  }),
495
- X.map((e) => /* @__PURE__ */ m("option", {
496
- value: e.pageId,
497
- children: [
498
- e.label,
499
- " (",
500
- e.pageId,
501
- ")"
502
- ]
503
- }, e.pageId)),
504
- ge ? /* @__PURE__ */ m("option", {
505
- value: L.pageId,
506
- children: ["Current: ", L.pageId]
507
- }) : null,
508
- /* @__PURE__ */ p("option", {
509
- value: "__custom__",
510
- children: "Custom page ID"
511
- })
512
- ]
513
- }),
514
- U ? /* @__PURE__ */ p("input", {
515
- id: "page-id-custom",
516
- type: "text",
517
- value: L.pageId || "",
518
- onChange: (e) => R({
519
- ...L,
520
- pageId: e.target.value || void 0
653
+ className: "mt-2 w-full px-3 py-2 border border-border rounded-md bg-background text-foreground",
654
+ placeholder: "vibecontrols"
655
+ }) : null
656
+ ] }), /* @__PURE__ */ d("div", { children: [
657
+ /* @__PURE__ */ u("label", {
658
+ className: "block text-sm font-medium mb-2",
659
+ htmlFor: "page-id",
660
+ children: "Page ID"
521
661
  }),
522
- className: "mt-2 w-full px-3 py-2 border border-border rounded-md bg-background text-foreground",
523
- placeholder: "agents"
524
- }) : null
525
- ] })]
526
- }),
527
- /* @__PURE__ */ m("label", {
528
- className: "flex items-center gap-3 cursor-pointer",
529
- children: [/* @__PURE__ */ p("input", {
530
- type: "checkbox",
531
- checked: L.isActive ?? !0,
532
- onChange: (e) => R({
533
- ...L,
534
- isActive: e.target.checked
535
- }),
536
- className: "w-4 h-4 rounded"
537
- }), /* @__PURE__ */ p("span", {
538
- className: "text-sm font-medium",
539
- children: "Active"
540
- })]
541
- })
542
- ]
543
- })]
544
- }),
545
- /* @__PURE__ */ m("div", {
546
- className: "border border-border rounded-md p-4 sm:p-6 bg-card",
547
- children: [/* @__PURE__ */ p("h2", {
548
- className: "text-lg font-semibold mb-4",
549
- children: y("tourBuilder.sectionTriggerSettings")
550
- }), /* @__PURE__ */ m("div", {
551
- className: "space-y-4",
552
- children: [
553
- /* @__PURE__ */ m("div", { children: [/* @__PURE__ */ p("label", {
554
- className: "block text-sm font-medium mb-2",
555
- htmlFor: "trigger-type",
556
- children: y("tourBuilder.labelTriggerType")
557
- }), /* @__PURE__ */ m("select", {
558
- id: "trigger-type",
559
- value: L.triggerType || "MANUAL",
560
- onChange: (e) => R({
561
- ...L,
562
- triggerType: e.target.value
662
+ /* @__PURE__ */ d("select", {
663
+ id: "page-id",
664
+ value: R ? "__custom__" : M.pageId || "",
665
+ onChange: (e) => {
666
+ if (e.target.value === "__custom__") {
667
+ z(!0), N({
668
+ ...M,
669
+ pageId: ""
670
+ });
671
+ return;
672
+ }
673
+ z(!1), N({
674
+ ...M,
675
+ pageId: e.target.value || void 0
676
+ });
677
+ },
678
+ className: "w-full px-3 py-2 border border-border rounded-md bg-background text-foreground",
679
+ disabled: !M.productId,
680
+ children: [
681
+ /* @__PURE__ */ u("option", {
682
+ value: "",
683
+ children: "All pages"
684
+ }),
685
+ Z.map((e) => /* @__PURE__ */ d("option", {
686
+ value: e.pageId,
687
+ children: [
688
+ e.label,
689
+ " (",
690
+ e.pageId,
691
+ ")"
692
+ ]
693
+ }, e.pageId)),
694
+ De ? /* @__PURE__ */ d("option", {
695
+ value: M.pageId,
696
+ children: ["Current: ", M.pageId]
697
+ }) : null,
698
+ /* @__PURE__ */ u("option", {
699
+ value: "__custom__",
700
+ children: "Custom page ID"
701
+ })
702
+ ]
703
+ }),
704
+ R ? /* @__PURE__ */ u("input", {
705
+ id: "page-id-custom",
706
+ type: "text",
707
+ value: M.pageId || "",
708
+ onChange: (e) => N({
709
+ ...M,
710
+ pageId: e.target.value || void 0
711
+ }),
712
+ className: "mt-2 w-full px-3 py-2 border border-border rounded-md bg-background text-foreground",
713
+ placeholder: "agents"
714
+ }) : null
715
+ ] })]
563
716
  }),
564
- className: "w-full px-3 py-2 border border-border rounded-md bg-background text-foreground",
565
- children: [
566
- /* @__PURE__ */ p("option", {
567
- value: "MANUAL",
568
- children: y("tourBuilder.triggerManual")
569
- }),
570
- /* @__PURE__ */ p("option", {
571
- value: "AUTO_FIRST_VISIT",
572
- children: y("tourBuilder.triggerAutoFirstVisit")
573
- }),
574
- /* @__PURE__ */ p("option", {
575
- value: "AUTO_ALWAYS",
576
- children: y("tourBuilder.triggerAutoAlways")
577
- }),
578
- /* @__PURE__ */ p("option", {
579
- value: "ON_EVENT",
580
- children: y("tourBuilder.triggerOnEvent")
581
- }),
582
- /* @__PURE__ */ p("option", {
583
- value: "SCHEDULED",
584
- children: y("tourBuilder.triggerScheduled")
585
- })
586
- ]
587
- })] }),
588
- /* @__PURE__ */ m("div", { children: [/* @__PURE__ */ p("label", {
589
- className: "block text-sm font-medium mb-2",
590
- htmlFor: "priority",
591
- children: y("tourBuilder.labelPriority")
592
- }), /* @__PURE__ */ p("input", {
593
- id: "priority",
594
- type: "number",
595
- min: "1",
596
- max: "100",
597
- value: L.priority || 50,
598
- onChange: (e) => {
599
- let t = Number.parseInt(e.target.value, 10) || 50;
600
- R({
601
- ...L,
602
- priority: t
603
- });
604
- },
605
- className: "w-full px-3 py-2 border border-border rounded-md bg-background text-foreground"
606
- })] }),
607
- /* @__PURE__ */ m("div", {
608
- className: "grid grid-cols-1 gap-4 sm:grid-cols-2",
609
- children: [/* @__PURE__ */ m("div", { children: [/* @__PURE__ */ p("label", {
717
+ /* @__PURE__ */ d("label", {
718
+ className: "flex items-center gap-3 cursor-pointer",
719
+ children: [/* @__PURE__ */ u("input", {
720
+ type: "checkbox",
721
+ checked: M.isActive ?? !0,
722
+ onChange: (e) => N({
723
+ ...M,
724
+ isActive: e.target.checked
725
+ }),
726
+ className: "w-4 h-4 rounded"
727
+ }), /* @__PURE__ */ u("span", {
728
+ className: "text-sm font-medium",
729
+ children: "Active"
730
+ })]
731
+ })
732
+ ]
733
+ })]
734
+ }),
735
+ /* @__PURE__ */ d("div", {
736
+ className: "border border-border rounded-md p-4 sm:p-6 bg-card",
737
+ children: [/* @__PURE__ */ u("h2", {
738
+ className: "text-lg font-semibold mb-4",
739
+ children: p("tourBuilder.sectionTriggerSettings")
740
+ }), /* @__PURE__ */ d("div", {
741
+ className: "space-y-4",
742
+ children: [
743
+ /* @__PURE__ */ d("div", { children: [/* @__PURE__ */ u("label", {
610
744
  className: "block text-sm font-medium mb-2",
611
- htmlFor: "tour-start-date",
612
- children: "Start Date"
613
- }), /* @__PURE__ */ p("input", {
614
- id: "tour-start-date",
615
- type: "datetime-local",
616
- value: $(L.startDate),
617
- onChange: (e) => R({
618
- ...L,
619
- startDate: e.target.value ? new Date(e.target.value).toISOString() : void 0
745
+ htmlFor: "trigger-type",
746
+ children: p("tourBuilder.labelTriggerType")
747
+ }), /* @__PURE__ */ d("select", {
748
+ id: "trigger-type",
749
+ value: M.triggerType || "MANUAL",
750
+ onChange: (e) => N({
751
+ ...M,
752
+ triggerType: e.target.value
620
753
  }),
621
- className: "w-full px-3 py-2 border border-border rounded-md bg-background text-foreground"
622
- })] }), /* @__PURE__ */ m("div", { children: [/* @__PURE__ */ p("label", {
754
+ className: "w-full px-3 py-2 border border-border rounded-md bg-background text-foreground",
755
+ children: [
756
+ /* @__PURE__ */ u("option", {
757
+ value: "MANUAL",
758
+ children: p("tourBuilder.triggerManual")
759
+ }),
760
+ /* @__PURE__ */ u("option", {
761
+ value: "AUTO_FIRST_VISIT",
762
+ children: p("tourBuilder.triggerAutoFirstVisit")
763
+ }),
764
+ /* @__PURE__ */ u("option", {
765
+ value: "AUTO_ALWAYS",
766
+ children: p("tourBuilder.triggerAutoAlways")
767
+ }),
768
+ /* @__PURE__ */ u("option", {
769
+ value: "ON_EVENT",
770
+ children: p("tourBuilder.triggerOnEvent")
771
+ }),
772
+ /* @__PURE__ */ u("option", {
773
+ value: "SCHEDULED",
774
+ children: p("tourBuilder.triggerScheduled")
775
+ })
776
+ ]
777
+ })] }),
778
+ /* @__PURE__ */ d("div", { children: [/* @__PURE__ */ u("label", {
623
779
  className: "block text-sm font-medium mb-2",
624
- htmlFor: "tour-end-date",
625
- children: "End Date"
626
- }), /* @__PURE__ */ p("input", {
627
- id: "tour-end-date",
628
- type: "datetime-local",
629
- value: $(L.endDate),
630
- onChange: (e) => R({
631
- ...L,
632
- endDate: e.target.value ? new Date(e.target.value).toISOString() : void 0
633
- }),
780
+ htmlFor: "priority",
781
+ children: p("tourBuilder.labelPriority")
782
+ }), /* @__PURE__ */ u("input", {
783
+ id: "priority",
784
+ type: "number",
785
+ min: "1",
786
+ max: "100",
787
+ value: M.priority || 50,
788
+ onChange: (e) => {
789
+ let t = Number.parseInt(e.target.value, 10) || 50;
790
+ N({
791
+ ...M,
792
+ priority: t
793
+ });
794
+ },
634
795
  className: "w-full px-3 py-2 border border-border rounded-md bg-background text-foreground"
635
- })] })]
636
- })
637
- ]
638
- })]
639
- }),
640
- N && /* @__PURE__ */ m("div", {
641
- className: "border border-destructive rounded-md p-4 bg-destructive/10",
642
- children: [/* @__PURE__ */ p("h3", {
643
- className: "font-semibold text-destructive mb-2",
644
- children: y("tourBuilder.errorTitle")
645
- }), /* @__PURE__ */ p("p", {
646
- className: "text-sm text-destructive",
647
- children: N.message
648
- })]
649
- }),
650
- M.length > 0 && /* @__PURE__ */ m("div", {
651
- className: "border border-destructive rounded-md p-4 bg-destructive/10",
652
- children: [/* @__PURE__ */ p("h3", {
653
- className: "font-semibold text-destructive mb-2",
654
- children: y("tourBuilder.validationErrorsTitle")
655
- }), /* @__PURE__ */ p("ul", {
656
- className: "list-disc list-inside space-y-1",
657
- children: M.map((e, t) => /* @__PURE__ */ p("li", {
658
- className: "text-sm text-destructive",
659
- children: e.message
660
- }, t))
661
- })]
662
- }),
663
- /* @__PURE__ */ m("div", {
664
- className: "flex flex-wrap gap-3",
665
- children: [/* @__PURE__ */ p(f, {
666
- permission: E ? i.TOUR_CREATE : i.TOUR_UPDATE,
667
- children: /* @__PURE__ */ m("button", {
668
- type: "submit",
669
- disabled: j || !pe,
670
- 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",
671
- children: [/* @__PURE__ */ p(oe, { size: 20 }), y(j ? "tourBuilder.saving" : b && b !== "new" ? "tourBuilder.updateTour" : "tourBuilder.createAndAddSteps")]
672
- })
673
- }), b && b !== "new" && /* @__PURE__ */ m(se, { children: [
674
- /* @__PURE__ */ m("button", {
675
- type: "button",
676
- onClick: () => x(`${C}/${b}/steps`),
677
- className: "px-4 py-2 bg-secondary text-secondary-foreground rounded-md hover:bg-secondary/80 flex items-center gap-2",
678
- children: [
679
- /* @__PURE__ */ p(ae, { size: 20 }),
680
- y("tourBuilder.editSteps"),
681
- D?.steps && D.steps.length > 0 && /* @__PURE__ */ p("span", {
682
- className: "ml-1 px-2 py-0.5 text-xs bg-primary/20 rounded-full",
683
- children: D.steps.length
796
+ })] }),
797
+ /* @__PURE__ */ d("div", {
798
+ className: "grid grid-cols-1 gap-4 sm:grid-cols-2",
799
+ children: [/* @__PURE__ */ d("div", { children: [/* @__PURE__ */ u("label", {
800
+ className: "block text-sm font-medium mb-2",
801
+ htmlFor: "tour-start-date",
802
+ children: "Start Date"
803
+ }), /* @__PURE__ */ u("input", {
804
+ id: "tour-start-date",
805
+ type: "datetime-local",
806
+ value: $(M.startDate),
807
+ onChange: (e) => N({
808
+ ...M,
809
+ startDate: e.target.value ? new Date(e.target.value).toISOString() : void 0
810
+ }),
811
+ className: "w-full px-3 py-2 border border-border rounded-md bg-background text-foreground"
812
+ })] }), /* @__PURE__ */ d("div", { children: [/* @__PURE__ */ u("label", {
813
+ className: "block text-sm font-medium mb-2",
814
+ htmlFor: "tour-end-date",
815
+ children: "End Date"
816
+ }), /* @__PURE__ */ u("input", {
817
+ id: "tour-end-date",
818
+ type: "datetime-local",
819
+ value: $(M.endDate),
820
+ onChange: (e) => N({
821
+ ...M,
822
+ endDate: e.target.value ? new Date(e.target.value).toISOString() : void 0
823
+ }),
824
+ className: "w-full px-3 py-2 border border-border rounded-md bg-background text-foreground"
825
+ })] })]
684
826
  })
685
827
  ]
686
- }),
687
- /* @__PURE__ */ m("button", {
688
- type: "button",
689
- onClick: () => x(`${C}/${b}/preview`),
690
- className: "px-4 py-2 border border-border rounded-md hover:bg-accent flex items-center gap-2",
691
- children: [/* @__PURE__ */ p(re, { size: 20 }), y("tourBuilder.preview")]
692
- }),
693
- /* @__PURE__ */ m("button", {
694
- type: "button",
695
- onClick: () => x(`${C}/${b}/analytics`),
696
- className: "px-4 py-2 border border-border rounded-md hover:bg-accent flex items-center gap-2",
697
- children: [/* @__PURE__ */ p(te, { size: 20 }), y("tourBuilder.analytics")]
698
- }),
699
- /* @__PURE__ */ m("button", {
700
- type: "button",
701
- onClick: () => x(`${C}/${b}/schedule`),
702
- className: "px-4 py-2 border border-border rounded-md hover:bg-accent flex items-center gap-2",
703
- children: [/* @__PURE__ */ p(ne, { size: 20 }), "Schedule"]
704
- }),
705
- /* @__PURE__ */ p(f, {
706
- permission: i.TOUR_TEMPLATE_CREATE,
707
- children: /* @__PURE__ */ m("button", {
828
+ })]
829
+ }),
830
+ O && /* @__PURE__ */ d("div", {
831
+ className: "border border-destructive rounded-md p-4 bg-destructive/10",
832
+ children: [/* @__PURE__ */ u("h3", {
833
+ className: "font-semibold text-destructive mb-2",
834
+ children: p("tourBuilder.errorTitle")
835
+ }), /* @__PURE__ */ u("p", {
836
+ className: "text-sm text-destructive",
837
+ children: O.message
838
+ })]
839
+ }),
840
+ D.length > 0 && /* @__PURE__ */ d("div", {
841
+ className: "border border-destructive rounded-md p-4 bg-destructive/10",
842
+ children: [/* @__PURE__ */ u("h3", {
843
+ className: "font-semibold text-destructive mb-2",
844
+ children: p("tourBuilder.validationErrorsTitle")
845
+ }), /* @__PURE__ */ u("ul", {
846
+ className: "list-disc list-inside space-y-1",
847
+ children: D.map((e, t) => /* @__PURE__ */ u("li", {
848
+ className: "text-sm text-destructive",
849
+ children: e.message
850
+ }, t))
851
+ })]
852
+ }),
853
+ /* @__PURE__ */ d("div", {
854
+ className: "flex flex-wrap gap-3",
855
+ children: [/* @__PURE__ */ u(l, {
856
+ permission: b ? i.TOUR_CREATE : i.TOUR_UPDATE,
857
+ children: /* @__PURE__ */ d("button", {
858
+ type: "submit",
859
+ disabled: E || !Se,
860
+ 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",
861
+ children: [/* @__PURE__ */ u(le, { size: 20 }), p(E ? "tourBuilder.saving" : m && m !== "new" ? "tourBuilder.updateTour" : "tourBuilder.createAndAddSteps")]
862
+ })
863
+ }), m && m !== "new" && /* @__PURE__ */ d(de, { children: [
864
+ /* @__PURE__ */ d("button", {
865
+ type: "button",
866
+ onClick: () => h(`${_}/${m}/steps`),
867
+ className: "px-4 py-2 bg-secondary text-secondary-foreground rounded-md hover:bg-secondary/80 flex items-center gap-2",
868
+ children: [
869
+ /* @__PURE__ */ u(ce, { size: 20 }),
870
+ p("tourBuilder.editSteps"),
871
+ w?.steps && w.steps.length > 0 && /* @__PURE__ */ u("span", {
872
+ className: "ml-1 px-2 py-0.5 text-xs bg-primary/20 rounded-full",
873
+ children: w.steps.length
874
+ })
875
+ ]
876
+ }),
877
+ /* @__PURE__ */ d("button", {
878
+ type: "button",
879
+ onClick: () => h(`${_}/${m}/preview`),
880
+ className: "px-4 py-2 border border-border rounded-md hover:bg-accent flex items-center gap-2",
881
+ children: [/* @__PURE__ */ u(oe, { size: 20 }), p("tourBuilder.preview")]
882
+ }),
883
+ /* @__PURE__ */ d("button", {
708
884
  type: "button",
709
- onClick: async () => {
710
- if (!b || b === "new") return;
711
- let e = `${L.name || D?.name || "Tour"} Template`, t = window.prompt("Template name", e);
712
- if (!t) return;
713
- let n = window.prompt("Template category (ONBOARDING, FEATURE_ANNOUNCEMENT, HELP, CUSTOM)", "ONBOARDING") || "ONBOARDING";
714
- try {
715
- await P(b, {
716
- name: t,
717
- description: L.description,
718
- category: n,
719
- isPublic: !1
720
- }), x(`${C}/templates`);
721
- } catch {
722
- o(w, "template.save", S);
723
- }
724
- },
725
- disabled: !fe,
726
- className: "px-4 py-2 border border-border rounded-md hover:bg-accent flex items-center gap-2 disabled:opacity-50",
727
- children: [/* @__PURE__ */ p(ie, { size: 20 }), "Save as Template"]
885
+ onClick: () => h(`${_}/${m}/analytics`),
886
+ className: "px-4 py-2 border border-border rounded-md hover:bg-accent flex items-center gap-2",
887
+ children: [/* @__PURE__ */ u(ie, { size: 20 }), p("tourBuilder.analytics")]
888
+ }),
889
+ /* @__PURE__ */ d("button", {
890
+ type: "button",
891
+ onClick: () => h(`${_}/${m}/schedule`),
892
+ className: "px-4 py-2 border border-border rounded-md hover:bg-accent flex items-center gap-2",
893
+ children: [/* @__PURE__ */ u(ae, { size: 20 }), "Schedule"]
894
+ }),
895
+ /* @__PURE__ */ u(l, {
896
+ permission: i.TOUR_TEMPLATE_CREATE,
897
+ children: /* @__PURE__ */ d("button", {
898
+ type: "button",
899
+ onClick: Ae,
900
+ disabled: !xe,
901
+ className: "px-4 py-2 border border-border rounded-md hover:bg-accent flex items-center gap-2 disabled:opacity-50",
902
+ children: [/* @__PURE__ */ u(se, { size: 20 }), "Save as Template"]
903
+ })
728
904
  })
729
- })
730
- ] })]
731
- })
732
- ]
733
- })]
905
+ ] })]
906
+ })
907
+ ]
908
+ })
909
+ ]
734
910
  });
735
911
  }
736
912
  //#endregion
737
- export { S as TourBuilderPage };
913
+ export { _ as TourBuilderPage };
738
914
 
739
915
  //# sourceMappingURL=TourBuilderPage.js.map