@burdenoff/microfe-tours 2026.519.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.
Files changed (52) hide show
  1. package/dist/index.js +2 -1
  2. package/dist/tours/ToursAdminRoot.d.ts.map +1 -1
  3. package/dist/tours/ToursAdminRoot.js +23 -20
  4. package/dist/tours/ToursAdminRoot.js.map +1 -1
  5. package/dist/tours/ToursUserRoot.d.ts.map +1 -1
  6. package/dist/tours/ToursUserRoot.js +25 -22
  7. package/dist/tours/ToursUserRoot.js.map +1 -1
  8. package/dist/tours/hooks/useMediaLibrary.js +3 -3
  9. package/dist/tours/hooks/useTourBuilder.js +10 -10
  10. package/dist/tours/hooks/useTourLifecycle.js +3 -3
  11. package/dist/tours/i18n.d.ts +13 -1
  12. package/dist/tours/i18n.d.ts.map +1 -1
  13. package/dist/tours/i18n.js +12 -0
  14. package/dist/tours/i18n.js.map +1 -1
  15. package/dist/tours/index.d.ts +1 -0
  16. package/dist/tours/index.d.ts.map +1 -1
  17. package/dist/tours/index.js +1 -0
  18. package/dist/tours/pages/AnalyticsDashboardPage.d.ts.map +1 -1
  19. package/dist/tours/pages/AnalyticsDashboardPage.js +5 -5
  20. package/dist/tours/pages/AnalyticsDashboardPage.js.map +1 -1
  21. package/dist/tours/pages/MediaLibraryPage.d.ts.map +1 -1
  22. package/dist/tours/pages/MediaLibraryPage.js +97 -96
  23. package/dist/tours/pages/MediaLibraryPage.js.map +1 -1
  24. package/dist/tours/pages/SchedulerPage.d.ts.map +1 -1
  25. package/dist/tours/pages/SchedulerPage.js +129 -126
  26. package/dist/tours/pages/SchedulerPage.js.map +1 -1
  27. package/dist/tours/pages/StepEditorPage.d.ts.map +1 -1
  28. package/dist/tours/pages/StepEditorPage.js +133 -128
  29. package/dist/tours/pages/StepEditorPage.js.map +1 -1
  30. package/dist/tours/pages/SystemAnalyticsPage.d.ts.map +1 -1
  31. package/dist/tours/pages/SystemAnalyticsPage.js +3 -3
  32. package/dist/tours/pages/SystemAnalyticsPage.js.map +1 -1
  33. package/dist/tours/pages/TemplateLibraryPage.d.ts.map +1 -1
  34. package/dist/tours/pages/TemplateLibraryPage.js +97 -94
  35. package/dist/tours/pages/TemplateLibraryPage.js.map +1 -1
  36. package/dist/tours/pages/TourBuilderPage.d.ts.map +1 -1
  37. package/dist/tours/pages/TourBuilderPage.js +645 -467
  38. package/dist/tours/pages/TourBuilderPage.js.map +1 -1
  39. package/dist/tours/pages/TourPreviewPage.d.ts.map +1 -1
  40. package/dist/tours/pages/TourPreviewPage.js +20 -18
  41. package/dist/tours/pages/TourPreviewPage.js.map +1 -1
  42. package/dist/tours/pages/ToursListPage.js +14 -14
  43. package/dist/tours/pages/ToursListPage.js.map +1 -1
  44. package/dist/tours/store/toursStore.d.ts +1 -0
  45. package/dist/tours/store/toursStore.d.ts.map +1 -1
  46. package/dist/tours/store/toursStore.js +14 -0
  47. package/dist/tours/store/toursStore.js.map +1 -1
  48. package/dist/tours/telemetry.d.ts +9 -0
  49. package/dist/tours/telemetry.d.ts.map +1 -0
  50. package/dist/tours/telemetry.js +19 -0
  51. package/dist/tours/telemetry.js.map +1 -0
  52. package/package.json +1 -1
@@ -3,15 +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 { 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";
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";
13
17
  //#region src/tours/pages/TourBuilderPage.tsx
14
- var y = 250, b = [
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 = [
15
51
  {
16
52
  productId: "vibecontrols",
17
53
  moduleId: "dashboard",
@@ -167,40 +203,115 @@ var y = 250, b = [
167
203
  pageLabel: "Sandbox",
168
204
  path: "/sandbox",
169
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"
170
281
  }
171
282
  ];
172
- function x(e) {
283
+ function h(e) {
173
284
  return e?.trim() || void 0;
174
285
  }
175
- function S(e) {
176
- let t = x(e);
177
- return t ? b.filter((e) => e.productId === t) : [];
286
+ function g(e) {
287
+ let t = h(e);
288
+ return t ? m.filter((e) => e.productId === t) : [];
178
289
  }
179
- function C(e) {
290
+ function ve(e) {
180
291
  let t = /* @__PURE__ */ new Map();
181
- for (let n of S(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, {
182
293
  moduleId: n.moduleId,
183
294
  label: n.moduleLabel,
184
295
  path: n.path
185
296
  });
186
297
  return [...t.values()];
187
298
  }
188
- function w(e, t) {
189
- let n = x(t);
190
- return n ? S(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) => ({
191
302
  pageId: e.pageId,
192
303
  label: e.pageLabel,
193
304
  path: e.path
194
305
  })) : [];
195
306
  }
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({
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({
198
309
  variables: {
199
- limit: y,
310
+ limit: he,
200
311
  offset: 0
201
312
  },
202
313
  fetchPolicy: "cache-and-network"
203
- }), [R, z] = u({
314
+ }), [M, N] = c({
204
315
  name: "",
205
316
  description: "",
206
317
  productId: "",
@@ -213,525 +324,592 @@ function T() {
213
324
  displayOrder: 1,
214
325
  startDate: "",
215
326
  endDate: ""
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);
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);
224
335
  return;
225
336
  }
226
- V(q.length > 0 && !J.has(R.productId));
337
+ F(q.length > 0 && !J.has(M.productId));
227
338
  }, [
228
- R.productId,
339
+ M.productId,
229
340
  J,
230
341
  q.length,
231
- L
232
- ]), s(() => {
233
- if (!R.productId || !R.moduleId) {
234
- U(!1);
342
+ j
343
+ ]), o(() => {
344
+ if (!M.productId || !M.moduleId) {
345
+ L(!1);
235
346
  return;
236
347
  }
237
- U(Y.length === 0 || !X.has(R.moduleId));
348
+ L(Y.length === 0 || !X.has(M.moduleId));
238
349
  }, [
239
- R.moduleId,
240
- R.productId,
350
+ M.moduleId,
351
+ M.productId,
241
352
  X,
242
353
  Y.length
243
- ]), s(() => {
244
- if (!R.productId || !R.pageId) {
245
- G(!1);
354
+ ]), o(() => {
355
+ if (!M.productId || !M.pageId) {
356
+ z(!1);
246
357
  return;
247
358
  }
248
- G(Z.length === 0 || !Q.has(R.pageId));
359
+ z(Z.length === 0 || !Q.has(M.pageId));
249
360
  }, [
250
- R.pageId,
251
- R.productId,
361
+ M.pageId,
362
+ M.productId,
252
363
  Q,
253
364
  Z.length
254
365
  ]);
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) => {
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) => {
256
367
  e.preventDefault();
257
368
  try {
258
- x && x !== "new" ? await j(x, R) : await ce(R);
259
- } catch (e) {
260
- console.error("Failed to save tour:", e);
369
+ m && m !== "new" ? await we(m, M) : await Ce(M);
370
+ } catch {
371
+ a(v, "tour.save", g);
261
372
  }
262
- }, pe = () => {
263
- S(`${T}/list`);
373
+ }, ke = () => {
374
+ h(`${_}/list`);
264
375
  }, $ = (e) => {
265
376
  if (!e) return "";
266
377
  let t = new Date(e);
267
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
+ }
268
416
  };
269
- return /* @__PURE__ */ v("div", {
417
+ return /* @__PURE__ */ d("div", {
270
418
  className: "space-y-4 sm:space-y-6 p-3 sm:p-6 max-w-4xl mx-auto",
271
- children: [/* @__PURE__ */ v("div", {
272
- className: "flex items-center gap-4",
273
- children: [/* @__PURE__ */ _("button", {
274
- onClick: pe,
275
- className: "p-2 hover:bg-accent rounded-md",
276
- "aria-label": b("tourBuilder.goBack"),
277
- children: /* @__PURE__ */ _(f, { size: 20 })
278
- }), /* @__PURE__ */ v("div", {
279
- className: "flex-1",
280
- children: [/* @__PURE__ */ _("h1", {
281
- className: "text-xl sm:text-2xl font-bold text-foreground",
282
- children: b(x && x !== "new" ? "tourBuilder.titleEdit" : "tourBuilder.titleCreate")
283
- }), /* @__PURE__ */ _("p", {
284
- className: "text-sm text-muted-foreground",
285
- children: b("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
+ })]
286
436
  })]
287
- })]
288
- }), /* @__PURE__ */ v("form", {
289
- onSubmit: fe,
290
- className: "space-y-6",
291
- children: [
292
- /* @__PURE__ */ v("div", {
293
- className: "border border-border rounded-md p-4 sm:p-6 bg-card",
294
- children: [/* @__PURE__ */ _("h2", {
295
- className: "text-lg font-semibold mb-4",
296
- children: b("tourBuilder.sectionBasicInfo")
297
- }), /* @__PURE__ */ v("div", {
298
- className: "space-y-4",
299
- children: [
300
- /* @__PURE__ */ v("div", { children: [/* @__PURE__ */ _("label", {
301
- className: "block text-sm font-medium mb-2",
302
- htmlFor: "tour-name",
303
- children: b("tourBuilder.labelName")
304
- }), /* @__PURE__ */ _("input", {
305
- id: "tour-name",
306
- type: "text",
307
- value: R.name || "",
308
- onChange: (e) => z({
309
- ...R,
310
- name: e.target.value
311
- }),
312
- className: "w-full px-3 py-2 border border-border rounded-md bg-background text-foreground",
313
- required: !0
314
- })] }),
315
- /* @__PURE__ */ v("div", { children: [/* @__PURE__ */ _("label", {
316
- className: "block text-sm font-medium mb-2",
317
- htmlFor: "tour-description",
318
- children: b("tourBuilder.labelDescription")
319
- }), /* @__PURE__ */ _("textarea", {
320
- id: "tour-description",
321
- value: R.description || "",
322
- onChange: (e) => z({
323
- ...R,
324
- description: e.target.value
325
- }),
326
- rows: 3,
327
- className: "w-full px-3 py-2 border border-border rounded-md bg-background text-foreground"
328
- })] }),
329
- /* @__PURE__ */ v("div", { children: [
330
- /* @__PURE__ */ _("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", {
331
493
  className: "block text-sm font-medium mb-2",
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
- },
355
- className: "w-full px-3 py-2 border border-border rounded-md bg-background text-foreground",
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",
494
+ htmlFor: "tour-name",
495
+ children: p("tourBuilder.labelName")
496
+ }), /* @__PURE__ */ u("input", {
497
+ id: "tour-name",
387
498
  type: "text",
388
- value: R.productId || "",
389
- onChange: (e) => z({
390
- ...R,
391
- productId: e.target.value,
392
- moduleId: void 0,
393
- pageId: void 0
499
+ value: M.name || "",
500
+ onChange: (e) => N({
501
+ ...M,
502
+ name: e.target.value
394
503
  }),
395
- className: "mt-2 w-full px-3 py-2 border border-border rounded-md bg-background text-foreground",
396
- placeholder: "vibecontrols",
504
+ className: "w-full px-3 py-2 border border-border rounded-md bg-background text-foreground",
397
505
  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", {
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", {
404
523
  className: "block text-sm font-medium mb-2",
405
- htmlFor: "module-id",
406
- children: "Module ID"
524
+ htmlFor: "product-id",
525
+ children: p("tourBuilder.labelProductId")
407
526
  }),
408
- /* @__PURE__ */ v("select", {
409
- id: "module-id",
410
- value: H ? "__custom__" : R.moduleId || "",
527
+ /* @__PURE__ */ d("select", {
528
+ id: "product-id",
529
+ value: P ? "__custom__" : M.productId || "",
411
530
  onChange: (e) => {
412
531
  if (e.target.value === "__custom__") {
413
- U(!0), z({
414
- ...R,
415
- moduleId: "",
532
+ F(!0), N({
533
+ ...M,
534
+ productId: "",
535
+ moduleId: void 0,
416
536
  pageId: void 0
417
537
  });
418
538
  return;
419
539
  }
420
- U(!1), G(!1), z({
421
- ...R,
422
- 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,
423
544
  pageId: void 0
424
545
  });
425
546
  },
426
547
  className: "w-full px-3 py-2 border border-border rounded-md bg-background text-foreground",
427
- disabled: !R.productId,
548
+ required: !0,
428
549
  children: [
429
- /* @__PURE__ */ _("option", {
550
+ /* @__PURE__ */ u("option", {
430
551
  value: "",
431
- children: "All modules"
552
+ children: "Select product"
432
553
  }),
433
- Y.map((e) => /* @__PURE__ */ v("option", {
434
- 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,
435
560
  children: [
436
- e.label,
561
+ e.name,
437
562
  " (",
438
- e.moduleId,
563
+ e.slug,
439
564
  ")"
440
565
  ]
441
- }, e.moduleId)),
442
- ue ? /* @__PURE__ */ v("option", {
443
- value: R.moduleId,
444
- children: ["Current: ", R.moduleId]
566
+ }, e.id)),
567
+ Te ? /* @__PURE__ */ d("option", {
568
+ value: M.productId,
569
+ children: ["Current: ", M.productId]
445
570
  }) : null,
446
- /* @__PURE__ */ _("option", {
571
+ /* @__PURE__ */ u("option", {
447
572
  value: "__custom__",
448
- children: "Custom module ID"
573
+ children: "Custom product slug"
449
574
  })
450
575
  ]
451
576
  }),
452
- H ? /* @__PURE__ */ _("input", {
453
- id: "module-id-custom",
577
+ P ? /* @__PURE__ */ u("input", {
578
+ id: "product-id-custom",
454
579
  type: "text",
455
- value: R.moduleId || "",
456
- onChange: (e) => z({
457
- ...R,
458
- 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,
459
585
  pageId: void 0
460
586
  }),
461
587
  className: "mt-2 w-full px-3 py-2 border border-border rounded-md bg-background text-foreground",
462
- placeholder: "vibecontrols"
588
+ placeholder: "vibecontrols",
589
+ required: !0
463
590
  }) : 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: ""
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
478
616
  });
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"
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
492
652
  }),
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
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"
519
661
  }),
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
- ] })]
524
- }),
525
- /* @__PURE__ */ v("label", {
526
- className: "flex items-center gap-3 cursor-pointer",
527
- children: [/* @__PURE__ */ _("input", {
528
- type: "checkbox",
529
- checked: R.isActive ?? !0,
530
- onChange: (e) => z({
531
- ...R,
532
- isActive: e.target.checked
533
- }),
534
- className: "w-4 h-4 rounded"
535
- }), /* @__PURE__ */ _("span", {
536
- className: "text-sm font-medium",
537
- children: "Active"
538
- })]
539
- })
540
- ]
541
- })]
542
- }),
543
- /* @__PURE__ */ v("div", {
544
- className: "border border-border rounded-md p-4 sm:p-6 bg-card",
545
- children: [/* @__PURE__ */ _("h2", {
546
- className: "text-lg font-semibold mb-4",
547
- children: b("tourBuilder.sectionTriggerSettings")
548
- }), /* @__PURE__ */ v("div", {
549
- className: "space-y-4",
550
- children: [
551
- /* @__PURE__ */ v("div", { children: [/* @__PURE__ */ _("label", {
552
- className: "block text-sm font-medium mb-2",
553
- htmlFor: "trigger-type",
554
- children: b("tourBuilder.labelTriggerType")
555
- }), /* @__PURE__ */ v("select", {
556
- id: "trigger-type",
557
- value: R.triggerType || "MANUAL",
558
- onChange: (e) => z({
559
- ...R,
560
- 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
+ ] })]
561
716
  }),
562
- className: "w-full px-3 py-2 border border-border rounded-md bg-background text-foreground",
563
- children: [
564
- /* @__PURE__ */ _("option", {
565
- value: "MANUAL",
566
- children: b("tourBuilder.triggerManual")
567
- }),
568
- /* @__PURE__ */ _("option", {
569
- value: "AUTO_FIRST_VISIT",
570
- children: b("tourBuilder.triggerAutoFirstVisit")
571
- }),
572
- /* @__PURE__ */ _("option", {
573
- value: "AUTO_ALWAYS",
574
- children: b("tourBuilder.triggerAutoAlways")
575
- }),
576
- /* @__PURE__ */ _("option", {
577
- value: "ON_EVENT",
578
- children: b("tourBuilder.triggerOnEvent")
579
- }),
580
- /* @__PURE__ */ _("option", {
581
- value: "SCHEDULED",
582
- children: b("tourBuilder.triggerScheduled")
583
- })
584
- ]
585
- })] }),
586
- /* @__PURE__ */ v("div", { children: [/* @__PURE__ */ _("label", {
587
- className: "block text-sm font-medium mb-2",
588
- htmlFor: "priority",
589
- children: b("tourBuilder.labelPriority")
590
- }), /* @__PURE__ */ _("input", {
591
- id: "priority",
592
- type: "number",
593
- min: "1",
594
- max: "100",
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
- },
603
- className: "w-full px-3 py-2 border border-border rounded-md bg-background text-foreground"
604
- })] }),
605
- /* @__PURE__ */ v("div", {
606
- className: "grid grid-cols-1 gap-4 sm:grid-cols-2",
607
- children: [/* @__PURE__ */ v("div", { children: [/* @__PURE__ */ _("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", {
608
744
  className: "block text-sm font-medium mb-2",
609
- htmlFor: "tour-start-date",
610
- children: "Start Date"
611
- }), /* @__PURE__ */ _("input", {
612
- id: "tour-start-date",
613
- type: "datetime-local",
614
- value: $(R.startDate),
615
- onChange: (e) => z({
616
- ...R,
617
- 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
618
753
  }),
619
- className: "w-full px-3 py-2 border border-border rounded-md bg-background text-foreground"
620
- })] }), /* @__PURE__ */ v("div", { children: [/* @__PURE__ */ _("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", {
621
779
  className: "block text-sm font-medium mb-2",
622
- htmlFor: "tour-end-date",
623
- children: "End Date"
624
- }), /* @__PURE__ */ _("input", {
625
- id: "tour-end-date",
626
- type: "datetime-local",
627
- value: $(R.endDate),
628
- onChange: (e) => z({
629
- ...R,
630
- endDate: e.target.value ? new Date(e.target.value).toISOString() : void 0
631
- }),
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
+ },
632
795
  className: "w-full px-3 py-2 border border-border rounded-md bg-background text-foreground"
633
- })] })]
634
- })
635
- ]
636
- })]
637
- }),
638
- P && /* @__PURE__ */ v("div", {
639
- className: "border border-destructive rounded-md p-4 bg-destructive/10",
640
- children: [/* @__PURE__ */ _("h3", {
641
- className: "font-semibold text-destructive mb-2",
642
- children: b("tourBuilder.errorTitle")
643
- }), /* @__PURE__ */ _("p", {
644
- className: "text-sm text-destructive",
645
- children: P.message
646
- })]
647
- }),
648
- N.length > 0 && /* @__PURE__ */ v("div", {
649
- className: "border border-destructive rounded-md p-4 bg-destructive/10",
650
- children: [/* @__PURE__ */ _("h3", {
651
- className: "font-semibold text-destructive mb-2",
652
- children: b("tourBuilder.validationErrorsTitle")
653
- }), /* @__PURE__ */ _("ul", {
654
- className: "list-disc list-inside space-y-1",
655
- children: N.map((e, t) => /* @__PURE__ */ _("li", {
656
- className: "text-sm text-destructive",
657
- children: e.message
658
- }, t))
659
- })]
660
- }),
661
- /* @__PURE__ */ v("div", {
662
- className: "flex flex-wrap gap-3",
663
- children: [/* @__PURE__ */ _(d, {
664
- permission: D ? i.TOUR_CREATE : i.TOUR_UPDATE,
665
- children: /* @__PURE__ */ v("button", {
666
- type: "submit",
667
- disabled: M || !se,
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",
669
- children: [/* @__PURE__ */ _(h, { size: 20 }), b(M ? "tourBuilder.saving" : x && x !== "new" ? "tourBuilder.updateTour" : "tourBuilder.createAndAddSteps")]
670
- })
671
- }), x && x !== "new" && /* @__PURE__ */ v(g, { children: [
672
- /* @__PURE__ */ v("button", {
673
- type: "button",
674
- onClick: () => S(`${T}/${x}/steps`),
675
- className: "px-4 py-2 bg-secondary text-secondary-foreground rounded-md hover:bg-secondary/80 flex items-center gap-2",
676
- children: [
677
- /* @__PURE__ */ _(m, { size: 20 }),
678
- b("tourBuilder.editSteps"),
679
- k?.steps && k.steps.length > 0 && /* @__PURE__ */ _("span", {
680
- className: "ml-1 px-2 py-0.5 text-xs bg-primary/20 rounded-full",
681
- children: k.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
+ })] })]
682
826
  })
683
827
  ]
684
- }),
685
- /* @__PURE__ */ v("button", {
686
- type: "button",
687
- onClick: () => S(`${T}/${x}/preview`),
688
- className: "px-4 py-2 border border-border rounded-md hover:bg-accent flex items-center gap-2",
689
- children: [/* @__PURE__ */ _(te, { size: 20 }), b("tourBuilder.preview")]
690
- }),
691
- /* @__PURE__ */ v("button", {
692
- type: "button",
693
- onClick: () => S(`${T}/${x}/analytics`),
694
- className: "px-4 py-2 border border-border rounded-md hover:bg-accent flex items-center gap-2",
695
- children: [/* @__PURE__ */ _(p, { size: 20 }), b("tourBuilder.analytics")]
696
- }),
697
- /* @__PURE__ */ v("button", {
698
- type: "button",
699
- onClick: () => S(`${T}/${x}/schedule`),
700
- className: "px-4 py-2 border border-border rounded-md hover:bg-accent flex items-center gap-2",
701
- children: [/* @__PURE__ */ _(ee, { size: 20 }), "Schedule"]
702
- }),
703
- /* @__PURE__ */ _(d, {
704
- permission: i.TOUR_TEMPLATE_CREATE,
705
- children: /* @__PURE__ */ v("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", {
706
884
  type: "button",
707
- onClick: async () => {
708
- if (!x || x === "new") return;
709
- let e = `${R.name || k?.name || "Tour"} Template`, t = window.prompt("Template name", e);
710
- if (!t) return;
711
- let n = window.prompt("Template category (ONBOARDING, FEATURE_ANNOUNCEMENT, HELP, CUSTOM)", "ONBOARDING") || "ONBOARDING";
712
- try {
713
- await F(x, {
714
- name: t,
715
- description: R.description,
716
- category: n,
717
- isPublic: !1
718
- }), S(`${T}/templates`);
719
- } catch (e) {
720
- console.error("Failed to save template:", e);
721
- }
722
- },
723
- disabled: !oe,
724
- className: "px-4 py-2 border border-border rounded-md hover:bg-accent flex items-center gap-2 disabled:opacity-50",
725
- children: [/* @__PURE__ */ _(ne, { 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
+ })
726
904
  })
727
- })
728
- ] })]
729
- })
730
- ]
731
- })]
905
+ ] })]
906
+ })
907
+ ]
908
+ })
909
+ ]
732
910
  });
733
911
  }
734
912
  //#endregion
735
- export { T as TourBuilderPage };
913
+ export { _ as TourBuilderPage };
736
914
 
737
915
  //# sourceMappingURL=TourBuilderPage.js.map