@burdenoff/microfe-tours 2026.830.1 → 2026.918.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.
- package/dist/tours/ToursAdminRoot.js +28 -27
- package/dist/tours/ToursAdminRoot.js.map +1 -1
- package/dist/tours/ToursAdminRoutes.js +56 -55
- package/dist/tours/ToursAdminRoutes.js.map +1 -1
- package/dist/tours/ToursUserRoot.js +34 -29
- package/dist/tours/ToursUserRoot.js.map +1 -1
- package/dist/tours/ToursUserRoutes.js +33 -33
- package/dist/tours/ToursUserRoutes.js.map +1 -1
- package/dist/tours/components/MarkdownEditor.js +85 -80
- package/dist/tours/components/MarkdownEditor.js.map +1 -1
- package/dist/tours/components/RouteHelpers.js +47 -42
- package/dist/tours/components/RouteHelpers.js.map +1 -1
- package/dist/tours/components/ToursAdminNavRegistrar.js +32 -27
- package/dist/tours/components/ToursAdminNavRegistrar.js.map +1 -1
- package/dist/tours/hooks/useStepSequencer.js +45 -36
- package/dist/tours/hooks/useStepSequencer.js.map +1 -1
- package/dist/tours/hooks/useTourBuilder.js +106 -93
- package/dist/tours/hooks/useTourBuilder.js.map +1 -1
- package/dist/tours/hooks/useTourPreview.js +51 -41
- package/dist/tours/hooks/useTourPreview.js.map +1 -1
- package/dist/tours/hooks/useToursList.js +28 -27
- package/dist/tours/hooks/useToursList.js.map +1 -1
- package/dist/tours/i18n.js +187 -5
- package/dist/tours/i18n.js.map +1 -1
- package/dist/tours/pages/AnalyticsDashboardPage.js +108 -109
- package/dist/tours/pages/AnalyticsDashboardPage.js.map +1 -1
- package/dist/tours/pages/MediaLibraryPage.js +58 -61
- package/dist/tours/pages/MediaLibraryPage.js.map +1 -1
- package/dist/tours/pages/MyToursPage.js +5 -5
- package/dist/tours/pages/MyToursProgressPage.js +5 -5
- package/dist/tours/pages/SchedulerPage.js +78 -81
- package/dist/tours/pages/SchedulerPage.js.map +1 -1
- package/dist/tours/pages/StepEditorPage.js +32 -32
- package/dist/tours/pages/StepEditorPage.js.map +1 -1
- package/dist/tours/pages/SystemAnalyticsPage.js +75 -79
- package/dist/tours/pages/SystemAnalyticsPage.js.map +1 -1
- package/dist/tours/pages/TemplateLibraryPage.js +8 -8
- package/dist/tours/pages/TourBuilderPage.js +295 -279
- package/dist/tours/pages/TourBuilderPage.js.map +1 -1
- package/dist/tours/pages/TourPreviewPage.js +6 -6
- package/dist/tours/pages/ToursListPage.js +155 -155
- package/dist/tours/pages/ToursListPage.js.map +1 -1
- package/dist/tours/store/toursStore.js +11 -7
- package/dist/tours/store/toursStore.js.map +1 -1
- package/dist/tours/utils/index.js +32 -19
- package/dist/tours/utils/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,53 +1,62 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { useTr as e } from "../i18n.js";
|
|
2
|
+
import { useToursStore as t } from "../store/toursStore.js";
|
|
3
|
+
import { useCallback as n } from "react";
|
|
3
4
|
//#region src/tours/hooks/useStepSequencer.ts
|
|
4
|
-
function
|
|
5
|
-
let { stepSequence:
|
|
5
|
+
function r() {
|
|
6
|
+
let r = e(), { stepSequence: i, selectedStep: a, setSelectedStep: o, addStep: s, removeStep: c, updateStep: l, reorderSteps: u } = t();
|
|
6
7
|
return {
|
|
7
|
-
steps:
|
|
8
|
-
selectedStep:
|
|
9
|
-
selectStep:
|
|
10
|
-
createStep:
|
|
11
|
-
|
|
12
|
-
title: e?.title || "New Step",
|
|
8
|
+
steps: i,
|
|
9
|
+
selectedStep: a,
|
|
10
|
+
selectStep: o,
|
|
11
|
+
createStep: n((e) => {
|
|
12
|
+
s({
|
|
13
|
+
title: e?.title || r("stepEditor.newStep", "New Step"),
|
|
13
14
|
content: e?.content || "",
|
|
14
15
|
targetSelector: e?.targetSelector || "",
|
|
15
16
|
placement: e?.placement || "AUTO",
|
|
16
|
-
stepOrder:
|
|
17
|
+
stepOrder: i.length + 1,
|
|
17
18
|
...e
|
|
18
19
|
});
|
|
19
|
-
}, [a, n.length]),
|
|
20
|
-
deleteStep: t((e) => {
|
|
21
|
-
o(e), r?.id === e && i(null);
|
|
22
20
|
}, [
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
21
|
+
s,
|
|
22
|
+
i.length,
|
|
23
|
+
r
|
|
26
24
|
]),
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
}, [
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
t
|
|
25
|
+
deleteStep: n((e) => {
|
|
26
|
+
c(e), a?.id === e && o(null);
|
|
27
|
+
}, [
|
|
28
|
+
c,
|
|
29
|
+
a,
|
|
30
|
+
o
|
|
31
|
+
]),
|
|
32
|
+
updateStepField: n((e, t, n) => {
|
|
33
|
+
l(e, { [t]: n });
|
|
34
|
+
}, [l]),
|
|
35
|
+
setStepSelector: n((e, t, n) => {
|
|
36
|
+
n === "mobile" ? l(e, { targetSelectorMobile: t }) : n === "tablet" ? l(e, { targetSelectorTablet: t }) : n === "desktop" ? l(e, { targetSelectorDesktop: t }) : l(e, { targetSelector: t });
|
|
37
|
+
}, [l]),
|
|
38
|
+
setStepPlacement: n((e, t) => {
|
|
39
|
+
l(e, { placement: t });
|
|
40
|
+
}, [l]),
|
|
41
|
+
moveStep: n((e, t) => {
|
|
42
|
+
u(e, t);
|
|
43
|
+
}, [u]),
|
|
44
|
+
duplicateStep: n((e) => {
|
|
45
|
+
let t = i.find((t) => t.id === e);
|
|
46
|
+
t && s({
|
|
42
47
|
...t,
|
|
43
48
|
id: void 0,
|
|
44
|
-
title: `${t.title} (Copy)`,
|
|
45
|
-
stepOrder:
|
|
49
|
+
title: `${t.title} ${r("stepEditor.copySuffix", "(Copy)")}`,
|
|
50
|
+
stepOrder: i.length
|
|
46
51
|
});
|
|
47
|
-
}, [
|
|
52
|
+
}, [
|
|
53
|
+
i,
|
|
54
|
+
s,
|
|
55
|
+
r
|
|
56
|
+
])
|
|
48
57
|
};
|
|
49
58
|
}
|
|
50
59
|
//#endregion
|
|
51
|
-
export {
|
|
60
|
+
export { r as useStepSequencer };
|
|
52
61
|
|
|
53
62
|
//# sourceMappingURL=useStepSequencer.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useStepSequencer.js","names":[],"sources":["../../../src/tours/hooks/useStepSequencer.ts"],"sourcesContent":["import { useCallback } from 'react';\nimport { useToursStore } from '../store/toursStore';\nimport type { TourStep, StepPlacement } from '../types';\n\n/**\n * Hook for step sequencer functionality\n * Manages step creation, reordering, and editing locally.\n * Steps are persisted to backend via useTourBuilder.syncSteps()\n */\nexport function useStepSequencer() {\n const {\n stepSequence,\n selectedStep,\n setSelectedStep,\n addStep,\n removeStep,\n updateStep,\n reorderSteps,\n } = useToursStore();\n\n /**\n * Create new step\n */\n const createStep = useCallback(\n (stepData?: Partial<TourStep>) => {\n const newStep: Partial<TourStep> = {\n title: stepData?.title || 'New Step',\n content: stepData?.content || '',\n targetSelector: stepData?.targetSelector || '',\n placement: stepData?.placement || 'AUTO',\n stepOrder: stepSequence.length + 1,\n ...stepData,\n };\n addStep(newStep);\n },\n [addStep, stepSequence.length]\n );\n\n /**\n * Delete step\n */\n const deleteStep = useCallback(\n (stepId: string) => {\n removeStep(stepId);\n if (selectedStep?.id === stepId) {\n setSelectedStep(null);\n }\n },\n [removeStep, selectedStep, setSelectedStep]\n );\n\n /**\n * Update step field\n */\n const updateStepField = useCallback(\n (stepId: string, field: keyof TourStep, value: unknown) => {\n updateStep(stepId, { [field]: value });\n },\n [updateStep]\n );\n\n /**\n * Set step target selector\n */\n const setStepSelector = useCallback(\n (stepId: string, selector: string, deviceType?: 'mobile' | 'tablet' | 'desktop') => {\n if (deviceType === 'mobile') {\n updateStep(stepId, { targetSelectorMobile: selector });\n } else if (deviceType === 'tablet') {\n updateStep(stepId, { targetSelectorTablet: selector });\n } else if (deviceType === 'desktop') {\n updateStep(stepId, { targetSelectorDesktop: selector });\n } else {\n updateStep(stepId, { targetSelector: selector });\n }\n },\n [updateStep]\n );\n\n /**\n * Set step placement\n */\n const setStepPlacement = useCallback(\n (stepId: string, placement: StepPlacement) => {\n updateStep(stepId, { placement });\n },\n [updateStep]\n );\n\n /**\n * Move step\n */\n const moveStep = useCallback(\n (fromIndex: number, toIndex: number) => {\n reorderSteps(fromIndex, toIndex);\n },\n [reorderSteps]\n );\n\n /**\n * Duplicate step\n */\n const duplicateStep = useCallback(\n (stepId: string) => {\n const step = stepSequence.find((s) => s.id === stepId);\n if (step) {\n const duplicatedStep: Partial<TourStep> = {\n ...step,\n id: undefined,\n title: `${step.title} (Copy)`,\n stepOrder: stepSequence.length,\n };\n addStep(duplicatedStep);\n }\n },\n [stepSequence, addStep]\n );\n\n return {\n steps: stepSequence,\n selectedStep,\n selectStep: setSelectedStep,\n createStep,\n deleteStep,\n updateStepField,\n setStepSelector,\n setStepPlacement,\n moveStep,\n duplicateStep,\n };\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"useStepSequencer.js","names":[],"sources":["../../../src/tours/hooks/useStepSequencer.ts"],"sourcesContent":["import { useCallback } from 'react';\nimport { useToursStore } from '../store/toursStore';\nimport { useTr } from '../i18n';\nimport type { TourStep, StepPlacement } from '../types';\n\n/**\n * Hook for step sequencer functionality\n * Manages step creation, reordering, and editing locally.\n * Steps are persisted to backend via useTourBuilder.syncSteps()\n */\nexport function useStepSequencer() {\n const tr = useTr();\n const {\n stepSequence,\n selectedStep,\n setSelectedStep,\n addStep,\n removeStep,\n updateStep,\n reorderSteps,\n } = useToursStore();\n\n /**\n * Create new step\n */\n const createStep = useCallback(\n (stepData?: Partial<TourStep>) => {\n const newStep: Partial<TourStep> = {\n title: stepData?.title || tr('stepEditor.newStep', 'New Step'),\n content: stepData?.content || '',\n targetSelector: stepData?.targetSelector || '',\n placement: stepData?.placement || 'AUTO',\n stepOrder: stepSequence.length + 1,\n ...stepData,\n };\n addStep(newStep);\n },\n [addStep, stepSequence.length, tr]\n );\n\n /**\n * Delete step\n */\n const deleteStep = useCallback(\n (stepId: string) => {\n removeStep(stepId);\n if (selectedStep?.id === stepId) {\n setSelectedStep(null);\n }\n },\n [removeStep, selectedStep, setSelectedStep]\n );\n\n /**\n * Update step field\n */\n const updateStepField = useCallback(\n (stepId: string, field: keyof TourStep, value: unknown) => {\n updateStep(stepId, { [field]: value });\n },\n [updateStep]\n );\n\n /**\n * Set step target selector\n */\n const setStepSelector = useCallback(\n (stepId: string, selector: string, deviceType?: 'mobile' | 'tablet' | 'desktop') => {\n if (deviceType === 'mobile') {\n updateStep(stepId, { targetSelectorMobile: selector });\n } else if (deviceType === 'tablet') {\n updateStep(stepId, { targetSelectorTablet: selector });\n } else if (deviceType === 'desktop') {\n updateStep(stepId, { targetSelectorDesktop: selector });\n } else {\n updateStep(stepId, { targetSelector: selector });\n }\n },\n [updateStep]\n );\n\n /**\n * Set step placement\n */\n const setStepPlacement = useCallback(\n (stepId: string, placement: StepPlacement) => {\n updateStep(stepId, { placement });\n },\n [updateStep]\n );\n\n /**\n * Move step\n */\n const moveStep = useCallback(\n (fromIndex: number, toIndex: number) => {\n reorderSteps(fromIndex, toIndex);\n },\n [reorderSteps]\n );\n\n /**\n * Duplicate step\n */\n const duplicateStep = useCallback(\n (stepId: string) => {\n const step = stepSequence.find((s) => s.id === stepId);\n if (step) {\n const duplicatedStep: Partial<TourStep> = {\n ...step,\n id: undefined,\n title: `${step.title} ${tr('stepEditor.copySuffix', '(Copy)')}`,\n stepOrder: stepSequence.length,\n };\n addStep(duplicatedStep);\n }\n },\n [stepSequence, addStep, tr]\n );\n\n return {\n steps: stepSequence,\n selectedStep,\n selectStep: setSelectedStep,\n createStep,\n deleteStep,\n updateStepField,\n setStepSelector,\n setStepPlacement,\n moveStep,\n duplicateStep,\n };\n}\n"],"mappings":";;;;AAUA,SAAgB,IAAmB;CACjC,IAAM,IAAK,G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AAK,MAAM,GAAG,EAAG,yBAAyB,SAAS;IAC7D,WAAW,EAAa;IACzB,CACsB;KAG3B;GAAC;GAAc;GAAS;GAAG,CAC5B;EAaA"}
|
|
@@ -1,117 +1,128 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
1
|
+
import { useTr as e } from "../i18n.js";
|
|
2
|
+
import { useToursContext as t } from "../providers/ToursProvider.js";
|
|
3
|
+
import { useToursStore as n } from "../store/toursStore.js";
|
|
4
|
+
import { CreateTourDocument as r, DeleteTourDocument as i, GetTourDocument as a, SyncTourStepsDocument as o, UpdateTourDocument as s } from "../../generated/global-operations.js";
|
|
5
|
+
import { useCallback as c, useState as l } from "react";
|
|
6
|
+
import { useNavigate as u } from "react-router";
|
|
7
|
+
import { useGatewayClient as d } from "@burdenoff/fe-libs/shared/graphql";
|
|
7
8
|
//#region src/tours/hooks/useTourBuilder.ts
|
|
8
|
-
function
|
|
9
|
-
let
|
|
10
|
-
|
|
9
|
+
function f(f) {
|
|
10
|
+
let m = e(), h = d("global"), g = u(), { basePath: _ = "/" } = t(), [v, y] = l(null), [b, x] = l(!1), [S, C] = l(!1), [w, T] = l(!1), { selectedTour: E, stepSequence: D, isDirty: O, validationErrors: k, setSelectedTour: A, updateStepSequence: j, validateTour: M, setDirty: N, notifyToursListChanged: P } = n(), F = c(async (e) => {
|
|
11
|
+
x(!0), y(null);
|
|
11
12
|
try {
|
|
12
|
-
let t = await
|
|
13
|
-
query:
|
|
13
|
+
let t = await h.query({
|
|
14
|
+
query: a,
|
|
14
15
|
variables: { id: e },
|
|
15
16
|
fetchPolicy: "network-only"
|
|
16
17
|
});
|
|
17
18
|
if (t.error) throw t.error;
|
|
18
19
|
let { data: n } = t;
|
|
19
|
-
n?.tour && (
|
|
20
|
+
n?.tour && (A(n.tour), j(n.tour.steps || []));
|
|
20
21
|
} catch (e) {
|
|
21
|
-
|
|
22
|
+
y(e instanceof Error ? e : Error(m("tourBuilder.errorLoadTour", "Failed to load tour")));
|
|
22
23
|
} finally {
|
|
23
|
-
|
|
24
|
+
x(!1);
|
|
24
25
|
}
|
|
25
26
|
}, [
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
27
|
+
h,
|
|
28
|
+
A,
|
|
29
|
+
j,
|
|
30
|
+
m
|
|
31
|
+
]), I = c(async (e) => {
|
|
32
|
+
C(!0), y(null);
|
|
31
33
|
try {
|
|
32
|
-
let t = e.slug || (e.name || "tour").toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-|-$/g, ""),
|
|
34
|
+
let t = e.slug || (e.name || "tour").toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-|-$/g, ""), n = {
|
|
33
35
|
name: e.name || "",
|
|
34
36
|
slug: t,
|
|
35
37
|
productId: e.productId || "workspaces",
|
|
36
|
-
description:
|
|
37
|
-
moduleId:
|
|
38
|
-
pageId:
|
|
38
|
+
description: p(e.description),
|
|
39
|
+
moduleId: p(e.moduleId),
|
|
40
|
+
pageId: p(e.pageId),
|
|
39
41
|
status: e.status || "DRAFT",
|
|
40
42
|
isActive: e.isActive ?? !0,
|
|
41
43
|
triggerType: e.triggerType || "MANUAL",
|
|
42
44
|
triggerConfig: e.triggerConfig,
|
|
43
45
|
priority: e.priority ?? 50,
|
|
44
46
|
displayOrder: e.displayOrder ?? 1,
|
|
45
|
-
startDate:
|
|
46
|
-
endDate:
|
|
47
|
+
startDate: p(e.startDate),
|
|
48
|
+
endDate: p(e.endDate),
|
|
47
49
|
mobileConfig: e.mobileConfig,
|
|
48
50
|
tabletConfig: e.tabletConfig,
|
|
49
51
|
desktopConfig: e.desktopConfig
|
|
50
|
-
}, i = (await
|
|
51
|
-
mutation:
|
|
52
|
-
variables: { input:
|
|
52
|
+
}, i = (await h.mutate({
|
|
53
|
+
mutation: r,
|
|
54
|
+
variables: { input: n }
|
|
53
55
|
})).data;
|
|
54
|
-
return i?.createTour ? (
|
|
56
|
+
return i?.createTour ? (A(i.createTour), P(), g(`${_}/${i.createTour.id}/steps`), i.createTour) : null;
|
|
55
57
|
} catch (e) {
|
|
56
|
-
throw
|
|
58
|
+
throw y(e instanceof Error ? e : Error(m("tourBuilder.errorCreateTour", "Failed to create tour"))), e;
|
|
57
59
|
} finally {
|
|
58
|
-
|
|
60
|
+
C(!1);
|
|
59
61
|
}
|
|
60
62
|
}, [
|
|
61
|
-
p,
|
|
62
63
|
h,
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
64
|
+
_,
|
|
65
|
+
g,
|
|
66
|
+
P,
|
|
67
|
+
A,
|
|
68
|
+
m
|
|
69
|
+
]), L = c(async (e, t) => {
|
|
70
|
+
C(!0), y(null);
|
|
68
71
|
try {
|
|
69
72
|
let n = {
|
|
70
73
|
name: t.name,
|
|
71
74
|
slug: t.slug,
|
|
72
|
-
description:
|
|
73
|
-
productId:
|
|
74
|
-
moduleId:
|
|
75
|
-
pageId:
|
|
75
|
+
description: p(t.description),
|
|
76
|
+
productId: p(t.productId),
|
|
77
|
+
moduleId: p(t.moduleId),
|
|
78
|
+
pageId: p(t.pageId),
|
|
76
79
|
status: t.status,
|
|
77
80
|
isActive: t.isActive,
|
|
78
81
|
triggerType: t.triggerType,
|
|
79
82
|
triggerConfig: t.triggerConfig,
|
|
80
83
|
priority: t.priority,
|
|
81
84
|
displayOrder: t.displayOrder,
|
|
82
|
-
startDate:
|
|
83
|
-
endDate:
|
|
85
|
+
startDate: p(t.startDate),
|
|
86
|
+
endDate: p(t.endDate),
|
|
84
87
|
mobileConfig: t.mobileConfig,
|
|
85
88
|
tabletConfig: t.tabletConfig,
|
|
86
89
|
desktopConfig: t.desktopConfig
|
|
87
|
-
}, r = (await
|
|
88
|
-
mutation:
|
|
90
|
+
}, r = (await h.mutate({
|
|
91
|
+
mutation: s,
|
|
89
92
|
variables: {
|
|
90
93
|
id: e,
|
|
91
94
|
input: n
|
|
92
95
|
}
|
|
93
96
|
})).data;
|
|
94
|
-
return r?.updateTour ? (
|
|
97
|
+
return r?.updateTour ? (P(), r.updateTour) : null;
|
|
95
98
|
} catch (e) {
|
|
96
|
-
throw
|
|
99
|
+
throw y(e instanceof Error ? e : Error(m("tourBuilder.errorUpdateTour", "Failed to update tour"))), e;
|
|
97
100
|
} finally {
|
|
98
|
-
|
|
101
|
+
C(!1);
|
|
99
102
|
}
|
|
100
|
-
}, [
|
|
101
|
-
|
|
103
|
+
}, [
|
|
104
|
+
h,
|
|
105
|
+
P,
|
|
106
|
+
m
|
|
107
|
+
]), R = c(async (e) => {
|
|
108
|
+
T(!0), y(null);
|
|
102
109
|
try {
|
|
103
|
-
let t = (await
|
|
104
|
-
mutation:
|
|
110
|
+
let t = (await h.mutate({
|
|
111
|
+
mutation: i,
|
|
105
112
|
variables: { id: e }
|
|
106
113
|
})).data;
|
|
107
|
-
return t?.deleteTour &&
|
|
114
|
+
return t?.deleteTour && P(), t?.deleteTour ?? !1;
|
|
108
115
|
} catch (e) {
|
|
109
|
-
throw
|
|
116
|
+
throw y(e instanceof Error ? e : Error(m("tourBuilder.errorDeleteTour", "Failed to delete tour"))), e;
|
|
110
117
|
} finally {
|
|
111
|
-
|
|
118
|
+
T(!1);
|
|
112
119
|
}
|
|
113
|
-
}, [
|
|
114
|
-
|
|
120
|
+
}, [
|
|
121
|
+
h,
|
|
122
|
+
P,
|
|
123
|
+
m
|
|
124
|
+
]), z = c(async (e, t) => {
|
|
125
|
+
C(!0), y(null);
|
|
115
126
|
try {
|
|
116
127
|
let n = t.map((e, t) => ({
|
|
117
128
|
id: e.id?.startsWith("temp_") ? void 0 : e.id,
|
|
@@ -130,65 +141,67 @@ function d(d) {
|
|
|
130
141
|
waitForEvent: e.waitForEvent,
|
|
131
142
|
waitForTimeout: e.waitForTimeout,
|
|
132
143
|
skipConditions: e.skipConditions
|
|
133
|
-
})), r = (await
|
|
134
|
-
mutation:
|
|
144
|
+
})), r = (await h.mutate({
|
|
145
|
+
mutation: o,
|
|
135
146
|
variables: {
|
|
136
147
|
tourId: e,
|
|
137
148
|
steps: n
|
|
138
149
|
}
|
|
139
150
|
})).data;
|
|
140
|
-
return r?.syncTourSteps ? (
|
|
151
|
+
return r?.syncTourSteps ? (j(r.syncTourSteps), N(!1), r.syncTourSteps) : null;
|
|
141
152
|
} catch (e) {
|
|
142
|
-
throw
|
|
153
|
+
throw y(e instanceof Error ? e : Error(m("tourBuilder.errorSyncSteps", "Failed to sync steps"))), e;
|
|
143
154
|
} finally {
|
|
144
|
-
|
|
155
|
+
C(!1);
|
|
145
156
|
}
|
|
146
157
|
}, [
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
158
|
+
h,
|
|
159
|
+
j,
|
|
160
|
+
N,
|
|
161
|
+
m
|
|
150
162
|
]);
|
|
151
163
|
return {
|
|
152
|
-
tour:
|
|
153
|
-
steps:
|
|
154
|
-
isDirty:
|
|
155
|
-
validationErrors:
|
|
156
|
-
saving:
|
|
157
|
-
loading:
|
|
158
|
-
deleting:
|
|
159
|
-
error:
|
|
160
|
-
loadTour:
|
|
161
|
-
createTour:
|
|
162
|
-
updateTour:
|
|
163
|
-
deleteTour:
|
|
164
|
-
syncSteps:
|
|
165
|
-
saveTour:
|
|
166
|
-
if (
|
|
167
|
-
if (!
|
|
168
|
-
if (
|
|
164
|
+
tour: E,
|
|
165
|
+
steps: D,
|
|
166
|
+
isDirty: O,
|
|
167
|
+
validationErrors: k,
|
|
168
|
+
saving: S,
|
|
169
|
+
loading: b,
|
|
170
|
+
deleting: w,
|
|
171
|
+
error: v,
|
|
172
|
+
loadTour: F,
|
|
173
|
+
createTour: I,
|
|
174
|
+
updateTour: L,
|
|
175
|
+
deleteTour: R,
|
|
176
|
+
syncSteps: z,
|
|
177
|
+
saveTour: c(async () => {
|
|
178
|
+
if (M().length > 0) throw Error(m("tourBuilder.errorValidationFailed", "Validation failed"));
|
|
179
|
+
if (!E) throw Error(m("tourBuilder.errorNoTourSelected", "No tour selected"));
|
|
180
|
+
if (E.id && !E.id.startsWith("temp_")) await L(E.id, E);
|
|
169
181
|
else {
|
|
170
|
-
let e = await
|
|
171
|
-
e &&
|
|
182
|
+
let e = await I(E);
|
|
183
|
+
e && O && D.length > 0 && await z(e.id, D);
|
|
172
184
|
return;
|
|
173
185
|
}
|
|
174
|
-
|
|
186
|
+
O && E.id && await z(E.id, D);
|
|
175
187
|
}, [
|
|
176
|
-
w,
|
|
177
|
-
T,
|
|
178
188
|
E,
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
189
|
+
D,
|
|
190
|
+
O,
|
|
191
|
+
M,
|
|
192
|
+
I,
|
|
193
|
+
L,
|
|
194
|
+
z,
|
|
195
|
+
m
|
|
183
196
|
])
|
|
184
197
|
};
|
|
185
198
|
}
|
|
186
|
-
function
|
|
199
|
+
function p(e) {
|
|
187
200
|
if (typeof e != "string") return e;
|
|
188
201
|
let t = e.trim();
|
|
189
202
|
return t.length > 0 ? t : void 0;
|
|
190
203
|
}
|
|
191
204
|
//#endregion
|
|
192
|
-
export {
|
|
205
|
+
export { f as useTourBuilder };
|
|
193
206
|
|
|
194
207
|
//# sourceMappingURL=useTourBuilder.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useTourBuilder.js","names":[],"sources":["../../../src/tours/hooks/useTourBuilder.ts"],"sourcesContent":["import { useState, useCallback } from 'react';\nimport { useGatewayClient } from '@burdenoff/fe-libs/shared/graphql';\nimport { useNavigate } from 'react-router';\nimport { useToursStore } from '../store/toursStore';\nimport { useToursContext } from '../providers/ToursProvider';\nimport type { Tour, TourStep } from '../types';\nimport type { TourStatus, TourTriggerType, TourStepPlacement } from '../../generated/global-types';\nimport {\n CreateTourDocument,\n UpdateTourDocument,\n DeleteTourDocument,\n GetTourDocument,\n SyncTourStepsDocument,\n} from '../../generated/global-operations';\nimport type {\n GetTourQuery,\n GetTourQueryVariables,\n CreateTourMutation,\n CreateTourMutationVariables,\n UpdateTourMutation,\n UpdateTourMutationVariables,\n DeleteTourMutation,\n DeleteTourMutationVariables,\n SyncTourStepsMutation,\n SyncTourStepsMutationVariables,\n} from '../../generated/global-operations';\n\n/**\n * Hook for tour builder functionality\n * Manages tour creation, editing, and step synchronization\n * Uses the gateway client from fe-libs\n */\nexport function useTourBuilder(tourId?: string) {\n const globalClient = useGatewayClient('global');\n const navigate = useNavigate();\n const { basePath = '/' } = useToursContext();\n\n const [error, setError] = useState<Error | null>(null);\n const [loading, setLoading] = useState(false);\n const [saving, setSaving] = useState(false);\n const [deleting, setDeleting] = useState(false);\n\n const {\n selectedTour,\n stepSequence,\n isDirty,\n validationErrors,\n setSelectedTour,\n updateStepSequence,\n validateTour,\n setDirty,\n notifyToursListChanged,\n } = useToursStore();\n\n /**\n * Load tour data\n */\n const loadTour = useCallback(\n async (id: string) => {\n setLoading(true);\n setError(null);\n\n try {\n const result = await globalClient.query<GetTourQuery, GetTourQueryVariables>({\n query: GetTourDocument,\n variables: { id },\n fetchPolicy: 'network-only',\n });\n\n if (result.error) {\n throw result.error;\n }\n\n const { data } = result;\n\n if (data?.tour) {\n setSelectedTour(data.tour as Tour);\n updateStepSequence((data.tour.steps || []) as TourStep[]);\n }\n } catch (err) {\n setError(err instanceof Error ? err : new Error('Failed to load tour'));\n } finally {\n setLoading(false);\n }\n },\n [globalClient, setSelectedTour, updateStepSequence]\n );\n\n /**\n * Create new tour\n */\n const createTour = useCallback(\n async (input: Partial<Tour>) => {\n setSaving(true);\n setError(null);\n\n try {\n // Generate slug from name if not provided\n const slug =\n input.slug ||\n (input.name || 'tour')\n .toLowerCase()\n .replace(/[^a-z0-9]+/g, '-')\n .replace(/^-|-$/g, '');\n\n const createInput = {\n name: input.name || '',\n slug,\n productId: input.productId || 'workspaces',\n description: normalizeOptionalString(input.description),\n moduleId: normalizeOptionalString(input.moduleId),\n pageId: normalizeOptionalString(input.pageId),\n status: (input.status || 'DRAFT') as TourStatus,\n isActive: input.isActive ?? true,\n triggerType: (input.triggerType || 'MANUAL') as TourTriggerType,\n triggerConfig: input.triggerConfig,\n priority: input.priority ?? 50,\n displayOrder: input.displayOrder ?? 1,\n startDate: normalizeOptionalString(input.startDate),\n endDate: normalizeOptionalString(input.endDate),\n mobileConfig: input.mobileConfig,\n tabletConfig: input.tabletConfig,\n desktopConfig: input.desktopConfig,\n };\n\n const result = await globalClient.mutate<CreateTourMutation, CreateTourMutationVariables>({\n mutation: CreateTourDocument,\n variables: { input: createInput },\n });\n\n const data = result.data;\n\n if (data?.createTour) {\n setSelectedTour(data.createTour as Tour);\n notifyToursListChanged();\n\n // Navigate to step editor\n const editPath = `${basePath}/${data.createTour.id}/steps`;\n navigate(editPath);\n\n return data.createTour;\n }\n\n return null;\n } catch (err) {\n setError(err instanceof Error ? err : new Error('Failed to create tour'));\n throw err;\n } finally {\n setSaving(false);\n }\n },\n [globalClient, basePath, navigate, notifyToursListChanged, setSelectedTour]\n );\n\n /**\n * Update existing tour\n */\n const updateTour = useCallback(\n async (id: string, input: Partial<Tour>) => {\n setSaving(true);\n setError(null);\n\n try {\n const updateInput = {\n name: input.name,\n slug: input.slug,\n description: normalizeOptionalString(input.description),\n productId: normalizeOptionalString(input.productId),\n moduleId: normalizeOptionalString(input.moduleId),\n pageId: normalizeOptionalString(input.pageId),\n status: input.status as TourStatus | undefined,\n isActive: input.isActive,\n triggerType: input.triggerType as TourTriggerType | undefined,\n triggerConfig: input.triggerConfig,\n priority: input.priority,\n displayOrder: input.displayOrder,\n startDate: normalizeOptionalString(input.startDate),\n endDate: normalizeOptionalString(input.endDate),\n mobileConfig: input.mobileConfig,\n tabletConfig: input.tabletConfig,\n desktopConfig: input.desktopConfig,\n };\n\n const result = await globalClient.mutate<UpdateTourMutation, UpdateTourMutationVariables>({\n mutation: UpdateTourDocument,\n variables: { id, input: updateInput },\n });\n\n const data = result.data;\n\n if (data?.updateTour) {\n notifyToursListChanged();\n return data.updateTour;\n }\n\n return null;\n } catch (err) {\n setError(err instanceof Error ? err : new Error('Failed to update tour'));\n throw err;\n } finally {\n setSaving(false);\n }\n },\n [globalClient, notifyToursListChanged]\n );\n\n /**\n * Delete tour\n */\n const deleteTour = useCallback(\n async (id: string) => {\n setDeleting(true);\n setError(null);\n\n try {\n const result = await globalClient.mutate<DeleteTourMutation, DeleteTourMutationVariables>({\n mutation: DeleteTourDocument,\n variables: { id },\n });\n\n const data = result.data;\n\n if (data?.deleteTour) {\n notifyToursListChanged();\n }\n\n return data?.deleteTour ?? false;\n } catch (err) {\n setError(err instanceof Error ? err : new Error('Failed to delete tour'));\n throw err;\n } finally {\n setDeleting(false);\n }\n },\n [globalClient, notifyToursListChanged]\n );\n\n /**\n * Sync tour steps\n */\n const syncSteps = useCallback(\n async (tourIdParam: string, steps: TourStep[]) => {\n setSaving(true);\n setError(null);\n\n try {\n const stepsInput = steps.map((s, index) => ({\n id: s.id?.startsWith('temp_') ? undefined : s.id,\n title: s.title,\n content: s.content,\n stepOrder: s.stepOrder ?? index + 1,\n targetSelector: s.targetSelector || '',\n placement: (s.placement || 'BOTTOM') as TourStepPlacement,\n targetSelectorMobile: s.targetSelectorMobile,\n targetSelectorTablet: s.targetSelectorTablet,\n targetSelectorDesktop: s.targetSelectorDesktop,\n customData: s.customData,\n actions: s.actions,\n requireInteraction: s.requireInteraction,\n waitForSelector: s.waitForSelector,\n waitForEvent: s.waitForEvent,\n waitForTimeout: s.waitForTimeout,\n skipConditions: s.skipConditions,\n }));\n\n const result = await globalClient.mutate<\n SyncTourStepsMutation,\n SyncTourStepsMutationVariables\n >({\n mutation: SyncTourStepsDocument,\n variables: { tourId: tourIdParam, steps: stepsInput },\n });\n\n const data = result.data;\n\n if (data?.syncTourSteps) {\n updateStepSequence(data.syncTourSteps as TourStep[]);\n setDirty(false);\n return data.syncTourSteps;\n }\n\n return null;\n } catch (err) {\n setError(err instanceof Error ? err : new Error('Failed to sync steps'));\n throw err;\n } finally {\n setSaving(false);\n }\n },\n [globalClient, updateStepSequence, setDirty]\n );\n\n /**\n * Save tour with validation\n */\n const saveTour = useCallback(async () => {\n const errors = validateTour();\n if (errors.length > 0) {\n throw new Error('Validation failed');\n }\n\n if (!selectedTour) {\n throw new Error('No tour selected');\n }\n\n // Update tour metadata\n if (selectedTour.id && !selectedTour.id.startsWith('temp_')) {\n await updateTour(selectedTour.id, selectedTour);\n } else {\n const created = await createTour(selectedTour);\n if (created && isDirty && stepSequence.length > 0) {\n await syncSteps(created.id, stepSequence);\n }\n return;\n }\n\n // Sync steps\n if (isDirty && selectedTour.id) {\n await syncSteps(selectedTour.id, stepSequence);\n }\n }, [selectedTour, stepSequence, isDirty, validateTour, createTour, updateTour, syncSteps]);\n\n return {\n tour: selectedTour,\n steps: stepSequence,\n isDirty,\n validationErrors,\n saving,\n loading,\n deleting,\n error,\n loadTour,\n createTour,\n updateTour,\n deleteTour,\n syncSteps,\n saveTour,\n };\n}\n\nfunction normalizeOptionalString(value: unknown): string | undefined {\n if (typeof value !== 'string') {\n return value as string | undefined;\n }\n\n const normalized = value.trim();\n return normalized.length > 0 ? normalized : undefined;\n}\n"],"mappings":";;;;;;;AAgCA,SAAgB,EAAe,GAAiB;CAC9C,IAAM,IAAe,EAAiB,SAAS,EACzC,IAAW,GAAa,EACxB,EAAE,cAAW,QAAQ,GAAiB,EAEtC,CAAC,GAAO,KAAY,EAAuB,KAAK,EAChD,CAAC,GAAS,KAAc,EAAS,GAAM,EACvC,CAAC,GAAQ,KAAa,EAAS,GAAM,EACrC,CAAC,GAAU,KAAe,EAAS,GAAM,EAEzC,EACJ,iBACA,iBACA,YACA,qBACA,oBACA,uBACA,iBACA,aACA,8BACE,GAAe,EAKb,IAAW,EACf,OAAO,MAAe;AAEpB,EADA,EAAW,GAAK,EAChB,EAAS,KAAK;AAEd,MAAI;GACF,IAAM,IAAS,MAAM,EAAa,MAA2C;IAC3E,OAAO;IACP,WAAW,EAAE,OAAI;IACjB,aAAa;IACd,CAAC;AAE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EAAa;AAE3C;;AAIF,GAAI,KAAW,EAAa,MAC1B,MAAM,EAAU,EAAa,IAAI,EAAa;KAE/C;GAAC;GAAc;GAAc;GAAS;GAAc;GAAY;GAAY;GAAU,CAAC;EAiBzF;;AAGH,SAAS,EAAwB,GAAoC;AACnE,KAAI,OAAO,KAAU,SACnB,QAAO;CAGT,IAAM,IAAa,EAAM,MAAM;AAC/B,QAAO,EAAW,SAAS,IAAI,IAAa,KAAA"}
|
|
1
|
+
{"version":3,"file":"useTourBuilder.js","names":[],"sources":["../../../src/tours/hooks/useTourBuilder.ts"],"sourcesContent":["import { useState, useCallback } from 'react';\nimport { useGatewayClient } from '@burdenoff/fe-libs/shared/graphql';\nimport { useNavigate } from 'react-router';\nimport { useToursStore } from '../store/toursStore';\nimport { useToursContext } from '../providers/ToursProvider';\nimport { useTr } from '../i18n';\nimport type { Tour, TourStep } from '../types';\nimport type { TourStatus, TourTriggerType, TourStepPlacement } from '../../generated/global-types';\nimport {\n CreateTourDocument,\n UpdateTourDocument,\n DeleteTourDocument,\n GetTourDocument,\n SyncTourStepsDocument,\n} from '../../generated/global-operations';\nimport type {\n GetTourQuery,\n GetTourQueryVariables,\n CreateTourMutation,\n CreateTourMutationVariables,\n UpdateTourMutation,\n UpdateTourMutationVariables,\n DeleteTourMutation,\n DeleteTourMutationVariables,\n SyncTourStepsMutation,\n SyncTourStepsMutationVariables,\n} from '../../generated/global-operations';\n\n/**\n * Hook for tour builder functionality\n * Manages tour creation, editing, and step synchronization\n * Uses the gateway client from fe-libs\n */\nexport function useTourBuilder(_tourId?: string) {\n const tr = useTr();\n const globalClient = useGatewayClient('global');\n const navigate = useNavigate();\n const { basePath = '/' } = useToursContext();\n\n const [error, setError] = useState<Error | null>(null);\n const [loading, setLoading] = useState(false);\n const [saving, setSaving] = useState(false);\n const [deleting, setDeleting] = useState(false);\n\n const {\n selectedTour,\n stepSequence,\n isDirty,\n validationErrors,\n setSelectedTour,\n updateStepSequence,\n validateTour,\n setDirty,\n notifyToursListChanged,\n } = useToursStore();\n\n /**\n * Load tour data\n */\n const loadTour = useCallback(\n async (id: string) => {\n setLoading(true);\n setError(null);\n\n try {\n const result = await globalClient.query<GetTourQuery, GetTourQueryVariables>({\n query: GetTourDocument,\n variables: { id },\n fetchPolicy: 'network-only',\n });\n\n if (result.error) {\n throw result.error;\n }\n\n const { data } = result;\n\n if (data?.tour) {\n setSelectedTour(data.tour as Tour);\n updateStepSequence((data.tour.steps || []) as TourStep[]);\n }\n } catch (err) {\n setError(\n err instanceof Error\n ? err\n : new Error(tr('tourBuilder.errorLoadTour', 'Failed to load tour'))\n );\n } finally {\n setLoading(false);\n }\n },\n [globalClient, setSelectedTour, updateStepSequence, tr]\n );\n\n /**\n * Create new tour\n */\n const createTour = useCallback(\n async (input: Partial<Tour>) => {\n setSaving(true);\n setError(null);\n\n try {\n // Generate slug from name if not provided\n const slug =\n input.slug ||\n (input.name || 'tour')\n .toLowerCase()\n .replace(/[^a-z0-9]+/g, '-')\n .replace(/^-|-$/g, '');\n\n const createInput = {\n name: input.name || '',\n slug,\n productId: input.productId || 'workspaces',\n description: normalizeOptionalString(input.description),\n moduleId: normalizeOptionalString(input.moduleId),\n pageId: normalizeOptionalString(input.pageId),\n status: (input.status || 'DRAFT') as TourStatus,\n isActive: input.isActive ?? true,\n triggerType: (input.triggerType || 'MANUAL') as TourTriggerType,\n triggerConfig: input.triggerConfig,\n priority: input.priority ?? 50,\n displayOrder: input.displayOrder ?? 1,\n startDate: normalizeOptionalString(input.startDate),\n endDate: normalizeOptionalString(input.endDate),\n mobileConfig: input.mobileConfig,\n tabletConfig: input.tabletConfig,\n desktopConfig: input.desktopConfig,\n };\n\n const result = await globalClient.mutate<CreateTourMutation, CreateTourMutationVariables>({\n mutation: CreateTourDocument,\n variables: { input: createInput },\n });\n\n const data = result.data;\n\n if (data?.createTour) {\n setSelectedTour(data.createTour as Tour);\n notifyToursListChanged();\n\n // Navigate to step editor\n const editPath = `${basePath}/${data.createTour.id}/steps`;\n navigate(editPath);\n\n return data.createTour;\n }\n\n return null;\n } catch (err) {\n setError(\n err instanceof Error\n ? err\n : new Error(tr('tourBuilder.errorCreateTour', 'Failed to create tour'))\n );\n throw err;\n } finally {\n setSaving(false);\n }\n },\n [globalClient, basePath, navigate, notifyToursListChanged, setSelectedTour, tr]\n );\n\n /**\n * Update existing tour\n */\n const updateTour = useCallback(\n async (id: string, input: Partial<Tour>) => {\n setSaving(true);\n setError(null);\n\n try {\n const updateInput = {\n name: input.name,\n slug: input.slug,\n description: normalizeOptionalString(input.description),\n productId: normalizeOptionalString(input.productId),\n moduleId: normalizeOptionalString(input.moduleId),\n pageId: normalizeOptionalString(input.pageId),\n status: input.status as TourStatus | undefined,\n isActive: input.isActive,\n triggerType: input.triggerType as TourTriggerType | undefined,\n triggerConfig: input.triggerConfig,\n priority: input.priority,\n displayOrder: input.displayOrder,\n startDate: normalizeOptionalString(input.startDate),\n endDate: normalizeOptionalString(input.endDate),\n mobileConfig: input.mobileConfig,\n tabletConfig: input.tabletConfig,\n desktopConfig: input.desktopConfig,\n };\n\n const result = await globalClient.mutate<UpdateTourMutation, UpdateTourMutationVariables>({\n mutation: UpdateTourDocument,\n variables: { id, input: updateInput },\n });\n\n const data = result.data;\n\n if (data?.updateTour) {\n notifyToursListChanged();\n return data.updateTour;\n }\n\n return null;\n } catch (err) {\n setError(\n err instanceof Error\n ? err\n : new Error(tr('tourBuilder.errorUpdateTour', 'Failed to update tour'))\n );\n throw err;\n } finally {\n setSaving(false);\n }\n },\n [globalClient, notifyToursListChanged, tr]\n );\n\n /**\n * Delete tour\n */\n const deleteTour = useCallback(\n async (id: string) => {\n setDeleting(true);\n setError(null);\n\n try {\n const result = await globalClient.mutate<DeleteTourMutation, DeleteTourMutationVariables>({\n mutation: DeleteTourDocument,\n variables: { id },\n });\n\n const data = result.data;\n\n if (data?.deleteTour) {\n notifyToursListChanged();\n }\n\n return data?.deleteTour ?? false;\n } catch (err) {\n setError(\n err instanceof Error\n ? err\n : new Error(tr('tourBuilder.errorDeleteTour', 'Failed to delete tour'))\n );\n throw err;\n } finally {\n setDeleting(false);\n }\n },\n [globalClient, notifyToursListChanged, tr]\n );\n\n /**\n * Sync tour steps\n */\n const syncSteps = useCallback(\n async (tourIdParam: string, steps: TourStep[]) => {\n setSaving(true);\n setError(null);\n\n try {\n const stepsInput = steps.map((s, index) => ({\n id: s.id?.startsWith('temp_') ? undefined : s.id,\n title: s.title,\n content: s.content,\n stepOrder: s.stepOrder ?? index + 1,\n targetSelector: s.targetSelector || '',\n placement: (s.placement || 'BOTTOM') as TourStepPlacement,\n targetSelectorMobile: s.targetSelectorMobile,\n targetSelectorTablet: s.targetSelectorTablet,\n targetSelectorDesktop: s.targetSelectorDesktop,\n customData: s.customData,\n actions: s.actions,\n requireInteraction: s.requireInteraction,\n waitForSelector: s.waitForSelector,\n waitForEvent: s.waitForEvent,\n waitForTimeout: s.waitForTimeout,\n skipConditions: s.skipConditions,\n }));\n\n const result = await globalClient.mutate<\n SyncTourStepsMutation,\n SyncTourStepsMutationVariables\n >({\n mutation: SyncTourStepsDocument,\n variables: { tourId: tourIdParam, steps: stepsInput },\n });\n\n const data = result.data;\n\n if (data?.syncTourSteps) {\n updateStepSequence(data.syncTourSteps as TourStep[]);\n setDirty(false);\n return data.syncTourSteps;\n }\n\n return null;\n } catch (err) {\n setError(\n err instanceof Error\n ? err\n : new Error(tr('tourBuilder.errorSyncSteps', 'Failed to sync steps'))\n );\n throw err;\n } finally {\n setSaving(false);\n }\n },\n [globalClient, updateStepSequence, setDirty, tr]\n );\n\n /**\n * Save tour with validation\n */\n const saveTour = useCallback(async () => {\n const errors = validateTour();\n if (errors.length > 0) {\n throw new Error(tr('tourBuilder.errorValidationFailed', 'Validation failed'));\n }\n\n if (!selectedTour) {\n throw new Error(tr('tourBuilder.errorNoTourSelected', 'No tour selected'));\n }\n\n // Update tour metadata\n if (selectedTour.id && !selectedTour.id.startsWith('temp_')) {\n await updateTour(selectedTour.id, selectedTour);\n } else {\n const created = await createTour(selectedTour);\n if (created && isDirty && stepSequence.length > 0) {\n await syncSteps(created.id, stepSequence);\n }\n return;\n }\n\n // Sync steps\n if (isDirty && selectedTour.id) {\n await syncSteps(selectedTour.id, stepSequence);\n }\n }, [selectedTour, stepSequence, isDirty, validateTour, createTour, updateTour, syncSteps, tr]);\n\n return {\n tour: selectedTour,\n steps: stepSequence,\n isDirty,\n validationErrors,\n saving,\n loading,\n deleting,\n error,\n loadTour,\n createTour,\n updateTour,\n deleteTour,\n syncSteps,\n saveTour,\n };\n}\n\nfunction normalizeOptionalString(value: unknown): string | undefined {\n if (typeof value !== 'string') {\n return value as string | undefined;\n }\n\n const normalized = value.trim();\n return normalized.length > 0 ? normalized : undefined;\n}\n"],"mappings":";;;;;;;;AAiCA,SAAgB,EAAe,GAAkB;CAC/C,IAAM,IAAK,GAAO,EACZ,IAAe,EAAiB,SAAS,EACzC,IAAW,GAAa,EACxB,EAAE,cAAW,QAAQ,GAAiB,EAEtC,CAAC,GAAO,KAAY,EAAuB,KAAK,EAChD,CAAC,GAAS,KAAc,EAAS,GAAM,EACvC,CAAC,GAAQ,KAAa,EAAS,GAAM,EACrC,CAAC,GAAU,KAAe,EAAS,GAAM,EAEzC,EACJ,iBACA,iBACA,YACA,qBACA,oBACA,uBACA,iBACA,aACA,8BACE,GAAe,EAKb,IAAW,EACf,OAAO,MAAe;AAEpB,EADA,EAAW,GAAK,EAChB,EAAS,KAAK;AAEd,MAAI;GACF,IAAM,IAAS,MAAM,EAAa,MAA2C;IAC3E,OAAO;IACP,WAAW,EAAE,OAAI;IACjB,aAAa;IACd,CAAC;AAEF,OAAI,EAAO,MACT,OAAM,EAAO;GAGf,IAAM,EAAE,YAAS;AAEjB,GAAI,GAAM,SACR,EAAgB,EAAK,KAAa,EAClC,EAAoB,EAAK,KAAK,SAAS,EAAE,CAAgB;WAEpD,GAAK;AACZ,KACE,aAAe,QACX,IACI,MAAM,EAAG,6BAA6B,sBAAsB,CAAC,CACt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;GAAY;GAAY;GAAW;GAAG,CAAC;EAiB7F;;AAGH,SAAS,EAAwB,GAAoC;AACnE,KAAI,OAAO,KAAU,SACnB,QAAO;CAGT,IAAM,IAAa,EAAM,MAAM;AAC/B,QAAO,EAAW,SAAS,IAAI,IAAa,KAAA"}
|
|
@@ -1,22 +1,23 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { useTr as e } from "../i18n.js";
|
|
2
|
+
import { useToursStore as t } from "../store/toursStore.js";
|
|
3
|
+
import { useCallback as n, useMemo as r, useState as i } from "react";
|
|
3
4
|
//#region src/tours/hooks/useTourPreview.ts
|
|
4
|
-
function
|
|
5
|
-
let [
|
|
6
|
-
|
|
7
|
-
}, []),
|
|
8
|
-
|
|
9
|
-
}, []),
|
|
10
|
-
|
|
11
|
-
}, [
|
|
12
|
-
|
|
13
|
-
}, [
|
|
14
|
-
e >= 0 && e <
|
|
15
|
-
}, [
|
|
16
|
-
|
|
17
|
-
}, [
|
|
5
|
+
function a(a) {
|
|
6
|
+
let o = e(), [s, c] = i(!1), [l, u] = i(0), [d, f] = i(null), { devicePreview: p, setDevicePreview: m } = t(), h = r(() => a?.steps ?? [], [a?.steps]), g = h[l], _ = n(() => {
|
|
7
|
+
c(!0), u(0);
|
|
8
|
+
}, []), v = n(() => {
|
|
9
|
+
c(!1), u(0);
|
|
10
|
+
}, []), y = n(() => {
|
|
11
|
+
l < h.length - 1 && u((e) => e + 1);
|
|
12
|
+
}, [l, h.length]), b = n(() => {
|
|
13
|
+
l > 0 && u((e) => e - 1);
|
|
14
|
+
}, [l]), x = n((e) => {
|
|
15
|
+
e >= 0 && e < h.length && u(e);
|
|
16
|
+
}, [h.length]), S = n((e) => {
|
|
17
|
+
m(e);
|
|
18
|
+
}, [m]), C = n(() => {
|
|
18
19
|
let e = [], t = [];
|
|
19
|
-
if (!
|
|
20
|
+
if (!a) return e.push(o("tourPreview.errorNoTour", "No tour selected")), f({
|
|
20
21
|
valid: !1,
|
|
21
22
|
errors: e,
|
|
22
23
|
warnings: t
|
|
@@ -25,13 +26,21 @@ function i(i) {
|
|
|
25
26
|
errors: e,
|
|
26
27
|
warnings: t
|
|
27
28
|
};
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
29
|
+
h.length === 0 && e.push(o("tourPreview.errorNoSteps", "Tour has no steps")), h.forEach((n, r) => {
|
|
30
|
+
let i = r + 1;
|
|
31
|
+
n.placement !== "CENTER" && !n.targetSelector && e.push(o("tourPreview.errorStepNoSelector", "Step {{number}} has no selector", { number: i })), (!n.content || n.content.trim() === "") && t.push(o("tourPreview.warningStepEmptyContent", "Step {{number}} has empty content", { number: i })), p === "mobile" && !n.targetSelectorMobile && !n.targetSelector && t.push(o("tourPreview.warningStepNoMobileSelector", "Step {{number}} has no mobile selector", { number: i })), p === "tablet" && !n.targetSelectorTablet && !n.targetSelector && t.push(o("tourPreview.warningStepNoTabletSelector", "Step {{number}} has no tablet selector", { number: i })), p === "desktop" && !n.targetSelectorDesktop && !n.targetSelector && t.push(o("tourPreview.warningStepNoDesktopSelector", "Step {{number}} has no desktop selector", { number: i })), n.media && n.media.length > 0 && n.media.forEach((n, r) => {
|
|
32
|
+
let a = r + 1;
|
|
33
|
+
n.media.cdnUrl || e.push(o("tourPreview.errorStepMediaNoUrl", "Step {{number}}, media {{mediaNumber}} has no URL", {
|
|
34
|
+
number: i,
|
|
35
|
+
mediaNumber: a
|
|
36
|
+
})), n.media.type === "IMAGE" && !n.media.altText && t.push(o("tourPreview.warningStepMediaMissingAlt", "Step {{number}}, media {{mediaNumber}} missing alt text", {
|
|
37
|
+
number: i,
|
|
38
|
+
mediaNumber: a
|
|
39
|
+
}));
|
|
31
40
|
});
|
|
32
41
|
});
|
|
33
42
|
let n = e.length === 0;
|
|
34
|
-
return
|
|
43
|
+
return f({
|
|
35
44
|
valid: n,
|
|
36
45
|
errors: e,
|
|
37
46
|
warnings: t
|
|
@@ -41,30 +50,31 @@ function i(i) {
|
|
|
41
50
|
warnings: t
|
|
42
51
|
};
|
|
43
52
|
}, [
|
|
44
|
-
|
|
53
|
+
a,
|
|
54
|
+
h,
|
|
45
55
|
p,
|
|
46
|
-
|
|
47
|
-
]),
|
|
56
|
+
o
|
|
57
|
+
]), w = n(async () => a ? `${window.location.origin}/tours/${a.id}/preview` : null, [a]);
|
|
48
58
|
return {
|
|
49
|
-
isPreviewActive:
|
|
50
|
-
currentStepIndex:
|
|
51
|
-
currentStep:
|
|
52
|
-
devicePreview:
|
|
53
|
-
validationResults:
|
|
54
|
-
totalSteps:
|
|
55
|
-
canGoNext:
|
|
56
|
-
canGoPrevious:
|
|
57
|
-
startPreview:
|
|
58
|
-
stopPreview:
|
|
59
|
-
nextStep:
|
|
60
|
-
previousStep:
|
|
61
|
-
goToStep:
|
|
62
|
-
changeDevice:
|
|
63
|
-
validateForPreview:
|
|
64
|
-
generatePreviewLink:
|
|
59
|
+
isPreviewActive: s,
|
|
60
|
+
currentStepIndex: l,
|
|
61
|
+
currentStep: g,
|
|
62
|
+
devicePreview: p,
|
|
63
|
+
validationResults: d,
|
|
64
|
+
totalSteps: h.length,
|
|
65
|
+
canGoNext: l < h.length - 1,
|
|
66
|
+
canGoPrevious: l > 0,
|
|
67
|
+
startPreview: _,
|
|
68
|
+
stopPreview: v,
|
|
69
|
+
nextStep: y,
|
|
70
|
+
previousStep: b,
|
|
71
|
+
goToStep: x,
|
|
72
|
+
changeDevice: S,
|
|
73
|
+
validateForPreview: C,
|
|
74
|
+
generatePreviewLink: w
|
|
65
75
|
};
|
|
66
76
|
}
|
|
67
77
|
//#endregion
|
|
68
|
-
export {
|
|
78
|
+
export { a as useTourPreview };
|
|
69
79
|
|
|
70
80
|
//# sourceMappingURL=useTourPreview.js.map
|