@burdenoff/fe-libs 2026.1003.4 → 2026.1004.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.
- package/dist/shared/graphql/client.d.ts.map +1 -1
- package/dist/shared/graphql/client.js +153 -140
- package/dist/shared/providers/AppShellProvider.d.ts +2 -0
- package/dist/shared/providers/AppShellProvider.d.ts.map +1 -1
- package/dist/shared/providers/AppShellProvider.js +154 -147
- package/dist/shared/providers/shell/MultiGatewayProvider.d.ts.map +1 -1
- package/dist/shared/providers/shell/MultiGatewayProvider.js +6 -0
- package/dist/shared/tours/TourPermissionsBoundary.d.ts +7 -0
- package/dist/shared/tours/TourPermissionsBoundary.d.ts.map +1 -0
- package/dist/shared/tours/TourPermissionsBoundary.js +17 -0
- package/dist/shared/tours/TourPlayerProvider.d.ts +1 -1
- package/dist/shared/tours/TourPlayerProvider.d.ts.map +1 -1
- package/dist/shared/tours/TourPlayerProvider.js +52 -51
- package/dist/shared/tours/TourTrigger.js +30 -26
- package/dist/shared/tours/ToursContext.d.ts +4 -1
- package/dist/shared/tours/ToursContext.d.ts.map +1 -1
- package/dist/shared/tours/ToursContext.js +100 -80
- package/dist/shared/tours/permissions.d.ts +9 -0
- package/dist/shared/tours/permissions.d.ts.map +1 -0
- package/dist/shared/tours/permissions.js +7 -0
- package/dist/shared/tours/progress.d.ts +6 -1
- package/dist/shared/tours/progress.d.ts.map +1 -1
- package/dist/shared/tours/progress.js +11 -1
- package/dist/shared/tours/routeCatalog.d.ts.map +1 -1
- package/dist/shared/tours/routeCatalog.js +51 -0
- package/dist/shared/tours/tourTrigger/DesktopTourDropdown.d.ts +2 -0
- package/dist/shared/tours/tourTrigger/DesktopTourDropdown.d.ts.map +1 -1
- package/dist/shared/tours/tourTrigger/DesktopTourDropdown.js +32 -31
- package/dist/shared/tours/tourTrigger/MobileTourSheet.d.ts +2 -0
- package/dist/shared/tours/tourTrigger/MobileTourSheet.d.ts.map +1 -1
- package/dist/shared/tours/tourTrigger/MobileTourSheet.js +42 -41
- package/dist/shared/tours/tourTrigger/TourLoadError.d.ts +4 -0
- package/dist/shared/tours/tourTrigger/TourLoadError.d.ts.map +1 -0
- package/dist/shared/tours/tourTrigger/TourLoadError.js +21 -0
- package/dist/shared/tours/toursContext/gql.d.ts.map +1 -1
- package/dist/shared/tours/toursContext/gql.js +2 -0
- package/dist/shared/tours/toursContext/progressWriteQueue.d.ts +6 -0
- package/dist/shared/tours/toursContext/progressWriteQueue.d.ts.map +1 -0
- package/dist/shared/tours/toursContext/progressWriteQueue.js +19 -0
- package/dist/shared/tours/toursContext/useTourMutations.d.ts.map +1 -1
- package/dist/shared/tours/toursContext/useTourMutations.js +155 -73
- package/dist/shared/tours/types.d.ts +4 -0
- package/dist/shared/tours/types.d.ts.map +1 -1
- package/dist/shared/tours/useTourPlayer.d.ts +1 -0
- package/dist/shared/tours/useTourPlayer.d.ts.map +1 -1
- package/dist/shared/tours/useTourPlayer.js +152 -141
- package/dist/shared-tours.js +9 -9
- package/dist/shared.js +9 -9
- package/package.json +2 -2
|
@@ -5,64 +5,65 @@ import { createContext as r, use as i, useEffect as a } from "react";
|
|
|
5
5
|
import { Fragment as o, jsx as s, jsxs as c } from "react/jsx-runtime";
|
|
6
6
|
//#region src/shared/tours/TourPlayerProvider.tsx
|
|
7
7
|
var l = r(null);
|
|
8
|
-
function u({ children: r,
|
|
9
|
-
let
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
8
|
+
function u({ children: r, scopeKey: i, onTourStart: a, onTourComplete: u, onTourSkip: f, onStepChange: p, onStepComplete: m, zIndex: h = 9998 }) {
|
|
9
|
+
let g = e({
|
|
10
|
+
scopeKey: i,
|
|
11
|
+
onTourStart: a,
|
|
12
|
+
onTourComplete: u,
|
|
13
|
+
onTourSkip: f,
|
|
14
|
+
onStepChange: p,
|
|
15
|
+
onStepComplete: m
|
|
16
|
+
}), _ = {
|
|
17
|
+
isPlaying: g.isPlaying,
|
|
18
|
+
currentTour: g.currentTour,
|
|
19
|
+
currentStepIndex: g.currentStepIndex,
|
|
20
|
+
isPaused: g.isPaused,
|
|
21
|
+
isCompleted: g.isCompleted,
|
|
22
|
+
isSkipped: g.isSkipped,
|
|
23
|
+
currentStep: g.currentStep,
|
|
24
|
+
totalSteps: g.totalSteps,
|
|
25
|
+
progress: g.progress,
|
|
26
|
+
canGoNext: g.canGoNext,
|
|
27
|
+
canGoPrevious: g.canGoPrevious,
|
|
28
|
+
startTour: g.startTour,
|
|
29
|
+
stopTour: g.stopTour,
|
|
30
|
+
nextStep: g.nextStep,
|
|
31
|
+
previousStep: g.previousStep,
|
|
32
|
+
goToStep: g.goToStep,
|
|
33
|
+
pauseTour: g.pauseTour,
|
|
34
|
+
resumeTour: g.resumeTour,
|
|
35
|
+
skipTour: g.skipTour,
|
|
36
|
+
completeTour: g.completeTour
|
|
36
37
|
};
|
|
37
38
|
return /* @__PURE__ */ c(l.Provider, {
|
|
38
|
-
value:
|
|
39
|
-
children: [r,
|
|
39
|
+
value: _,
|
|
40
|
+
children: [r, g.isPlaying && !g.isPaused && g.currentStep && /* @__PURE__ */ c(o, { children: [
|
|
40
41
|
/* @__PURE__ */ s(t, {
|
|
41
|
-
targetRect:
|
|
42
|
-
zIndex:
|
|
42
|
+
targetRect: g.targetRect,
|
|
43
|
+
zIndex: h
|
|
43
44
|
}),
|
|
44
45
|
/* @__PURE__ */ s(n, {
|
|
45
|
-
step:
|
|
46
|
-
stepIndex:
|
|
47
|
-
totalSteps:
|
|
48
|
-
onNext:
|
|
49
|
-
onPrevious:
|
|
50
|
-
onSkip:
|
|
51
|
-
onComplete:
|
|
52
|
-
canGoNext:
|
|
53
|
-
canGoPrevious:
|
|
54
|
-
isLastStep:
|
|
55
|
-
placement:
|
|
56
|
-
targetRect:
|
|
46
|
+
step: g.currentStep,
|
|
47
|
+
stepIndex: g.currentStepIndex,
|
|
48
|
+
totalSteps: g.totalSteps,
|
|
49
|
+
onNext: g.nextStep,
|
|
50
|
+
onPrevious: g.previousStep,
|
|
51
|
+
onSkip: g.skipTour,
|
|
52
|
+
onComplete: g.completeTour,
|
|
53
|
+
canGoNext: g.canGoNext,
|
|
54
|
+
canGoPrevious: g.canGoPrevious,
|
|
55
|
+
isLastStep: g.isLastStep,
|
|
56
|
+
placement: g.currentStep.placement,
|
|
57
|
+
targetRect: g.targetRect
|
|
57
58
|
}),
|
|
58
59
|
/* @__PURE__ */ s(d, {
|
|
59
|
-
onNext:
|
|
60
|
-
onPrevious:
|
|
61
|
-
onSkip:
|
|
62
|
-
onComplete:
|
|
63
|
-
canGoNext:
|
|
64
|
-
canGoPrevious:
|
|
65
|
-
isLastStep:
|
|
60
|
+
onNext: g.nextStep,
|
|
61
|
+
onPrevious: g.previousStep,
|
|
62
|
+
onSkip: g.skipTour,
|
|
63
|
+
onComplete: g.completeTour,
|
|
64
|
+
canGoNext: g.canGoNext,
|
|
65
|
+
canGoPrevious: g.canGoPrevious,
|
|
66
|
+
isLastStep: g.isLastStep
|
|
66
67
|
})
|
|
67
68
|
] })]
|
|
68
69
|
});
|
|
@@ -47,7 +47,7 @@ function O({ actions: e }) {
|
|
|
47
47
|
function k({ pathname: i, navigateTo: a, actions: o }) {
|
|
48
48
|
let [v, y] = h(!1), [b, T] = h(!1), [D, O] = h(null), k = m(null), A = m(null);
|
|
49
49
|
t("header-help", v, d(() => y(!1), []));
|
|
50
|
-
let { pageTours: j, productId: M, moduleId: N, pageId: P, loading: F } = s(),
|
|
50
|
+
let { pageTours: j, productId: M, moduleId: N, pageId: P, loading: F, error: I, refetch: L } = s(), R = n(), z = !!a, B = e()?.pageAccessDenied ?? !1;
|
|
51
51
|
f(() => {
|
|
52
52
|
let e = () => {
|
|
53
53
|
T(window.innerWidth < 768);
|
|
@@ -66,23 +66,23 @@ function k({ pathname: i, navigateTo: a, actions: o }) {
|
|
|
66
66
|
};
|
|
67
67
|
return v && document.addEventListener("keydown", e), () => document.removeEventListener("keydown", e);
|
|
68
68
|
}, [v]);
|
|
69
|
-
let
|
|
69
|
+
let V = (e) => {
|
|
70
70
|
y(!1);
|
|
71
71
|
let t = E(e, i, {
|
|
72
72
|
productId: M ?? "",
|
|
73
73
|
moduleId: N,
|
|
74
74
|
pageId: P
|
|
75
|
-
},
|
|
75
|
+
}, z);
|
|
76
76
|
if (t.type === "navigate") {
|
|
77
77
|
O(e.id), a?.(t.targetPath);
|
|
78
78
|
return;
|
|
79
79
|
}
|
|
80
80
|
t.type !== "ignore" && window.setTimeout(() => {
|
|
81
|
-
|
|
81
|
+
R(e);
|
|
82
82
|
}, S);
|
|
83
|
-
},
|
|
83
|
+
}, H = (e) => {
|
|
84
84
|
y(!1), e.onClick?.();
|
|
85
|
-
},
|
|
85
|
+
}, U = p(() => ({
|
|
86
86
|
productId: M ?? "",
|
|
87
87
|
moduleId: N,
|
|
88
88
|
pageId: P
|
|
@@ -90,40 +90,40 @@ function k({ pathname: i, navigateTo: a, actions: o }) {
|
|
|
90
90
|
N,
|
|
91
91
|
P,
|
|
92
92
|
M
|
|
93
|
-
]),
|
|
94
|
-
let n = r(e,
|
|
93
|
+
]), W = p(() => j.filter((e) => w(e, M)).sort((e, t) => {
|
|
94
|
+
let n = r(e, U) - r(t, U);
|
|
95
95
|
if (n !== 0) return n;
|
|
96
96
|
let i = (t.priority ?? 0) - (e.priority ?? 0);
|
|
97
97
|
return i === 0 ? (e.displayOrder ?? 0) - (t.displayOrder ?? 0) : i;
|
|
98
98
|
}), [
|
|
99
|
-
|
|
99
|
+
U,
|
|
100
100
|
M,
|
|
101
101
|
j
|
|
102
102
|
]);
|
|
103
103
|
f(() => {
|
|
104
104
|
if (!D) return;
|
|
105
|
-
let e =
|
|
105
|
+
let e = W.find((e) => e.id === D);
|
|
106
106
|
if (!e) {
|
|
107
107
|
O(null);
|
|
108
108
|
return;
|
|
109
109
|
}
|
|
110
|
-
let t = E(e, i,
|
|
110
|
+
let t = E(e, i, U, z);
|
|
111
111
|
if (t.type === "navigate") return;
|
|
112
112
|
if (t.type === "ignore") {
|
|
113
113
|
O(null);
|
|
114
114
|
return;
|
|
115
115
|
}
|
|
116
116
|
let n = window.setTimeout(() => {
|
|
117
|
-
|
|
117
|
+
R(e), O(null);
|
|
118
118
|
}, C);
|
|
119
119
|
return () => window.clearTimeout(n);
|
|
120
120
|
}, [
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
121
|
+
W,
|
|
122
|
+
z,
|
|
123
|
+
U,
|
|
124
124
|
i,
|
|
125
125
|
D,
|
|
126
|
-
|
|
126
|
+
R
|
|
127
127
|
]), f(() => {
|
|
128
128
|
if (!D) return;
|
|
129
129
|
let e = window.setTimeout(() => {
|
|
@@ -131,34 +131,38 @@ function k({ pathname: i, navigateTo: a, actions: o }) {
|
|
|
131
131
|
}, x);
|
|
132
132
|
return () => window.clearTimeout(e);
|
|
133
133
|
}, [D]);
|
|
134
|
-
let
|
|
134
|
+
let G = W.length > 0, K = B;
|
|
135
135
|
return f(() => {
|
|
136
|
-
|
|
137
|
-
}, [
|
|
136
|
+
K && v && y(!1);
|
|
137
|
+
}, [K, v]), K ? null : /* @__PURE__ */ _("div", {
|
|
138
138
|
className: "relative",
|
|
139
139
|
children: [
|
|
140
140
|
/* @__PURE__ */ g(c, {
|
|
141
141
|
ref: k,
|
|
142
142
|
isOpen: v,
|
|
143
|
-
hasTours:
|
|
143
|
+
hasTours: G,
|
|
144
144
|
onClick: () => y(!v)
|
|
145
145
|
}),
|
|
146
146
|
v && b && /* @__PURE__ */ g(l, {
|
|
147
147
|
ref: A,
|
|
148
148
|
loading: F,
|
|
149
|
-
|
|
149
|
+
error: I,
|
|
150
|
+
onRetry: L,
|
|
151
|
+
tours: W,
|
|
150
152
|
onClose: () => y(!1),
|
|
151
|
-
onStartTour:
|
|
153
|
+
onStartTour: V,
|
|
152
154
|
actions: o,
|
|
153
|
-
onAction:
|
|
155
|
+
onAction: H
|
|
154
156
|
}),
|
|
155
157
|
v && !b && /* @__PURE__ */ g(u, {
|
|
156
158
|
ref: A,
|
|
157
159
|
loading: F,
|
|
158
|
-
|
|
159
|
-
|
|
160
|
+
error: I,
|
|
161
|
+
onRetry: L,
|
|
162
|
+
tours: W,
|
|
163
|
+
onStartTour: V,
|
|
160
164
|
actions: o,
|
|
161
|
-
onAction:
|
|
165
|
+
onAction: H
|
|
162
166
|
})
|
|
163
167
|
]
|
|
164
168
|
});
|
|
@@ -2,6 +2,7 @@ import { ReactNode } from 'react';
|
|
|
2
2
|
import { Tour } from './types';
|
|
3
3
|
import { TrackEventType, TrackEventOptions } from './toursContext/useTourMutations';
|
|
4
4
|
export interface ToursContextValue {
|
|
5
|
+
progressScopeKey?: string;
|
|
5
6
|
tours: Tour[];
|
|
6
7
|
pageTours: Tour[];
|
|
7
8
|
loading: boolean;
|
|
@@ -23,8 +24,10 @@ export interface ToursProviderProps {
|
|
|
23
24
|
getPageIdFromPath?: (pathname: string) => string | undefined;
|
|
24
25
|
/** Disable automatic tour bootstrap for the current route tree */
|
|
25
26
|
disabled?: boolean;
|
|
27
|
+
/** Wait for workspace selection before loading workspace-scoped progress. */
|
|
28
|
+
requireWorkspace?: boolean;
|
|
26
29
|
}
|
|
27
|
-
export declare function ToursProvider({ children, defaultPageId, getPageIdFromPath, disabled, }: ToursProviderProps): import("react/jsx-runtime").JSX.Element;
|
|
30
|
+
export declare function ToursProvider({ children, defaultPageId, getPageIdFromPath, disabled, requireWorkspace, }: ToursProviderProps): import("react/jsx-runtime").JSX.Element;
|
|
28
31
|
export declare function useToursContext(): ToursContextValue;
|
|
29
32
|
export declare function useSafeToursContext(): ToursContextValue;
|
|
30
33
|
export declare function useTours(): {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ToursContext.d.ts","sourceRoot":"","sources":["../../../src/shared/tours/ToursContext.tsx"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,
|
|
1
|
+
{"version":3,"file":"ToursContext.d.ts","sourceRoot":"","sources":["../../../src/shared/tours/ToursContext.tsx"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EASL,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AASf,OAAO,EAAE,KAAK,IAAI,EAAE,MAAM,SAAS,CAAC;AAOpC,OAAO,EAEL,KAAK,cAAc,EACnB,KAAK,iBAAiB,EACvB,MAAM,iCAAiC,CAAC;AAEzC,MAAM,WAAW,iBAAiB;IAChC,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,KAAK,EAAE,IAAI,EAAE,CAAC;IACd,SAAS,EAAE,IAAI,EAAE,CAAC;IAClB,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,EAAE,KAAK,GAAG,IAAI,CAAC;IACpB,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,aAAa,EAAE,CACb,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,SAAS,GAAG,WAAW,GAAG,SAAS,EAC3C,MAAM,CAAC,EAAE,MAAM,KACZ,OAAO,CAAC,IAAI,CAAC,CAAC;IACnB,oBAAoB,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACxE,UAAU,EAAE,CACV,SAAS,EAAE,cAAc,EACzB,MAAM,EAAE,MAAM,EACd,OAAO,CAAC,EAAE,iBAAiB,KACxB,OAAO,CAAC,IAAI,CAAC,CAAC;IACnB,aAAa,EAAE,IAAI,GAAG,IAAI,CAAC;IAC3B,SAAS,EAAE,MAAM,GAAG,SAAS,CAAC;IAC9B,QAAQ,EAAE,MAAM,GAAG,SAAS,CAAC;IAC7B,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC;CAC5B;AAID,MAAM,WAAW,kBAAkB;IACjC,QAAQ,EAAE,SAAS,CAAC;IACpB,0EAA0E;IAC1E,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,yEAAyE;IACzE,iBAAiB,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,MAAM,GAAG,SAAS,CAAC;IAC7D,kEAAkE;IAClE,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,6EAA6E;IAC7E,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC5B;AAED,wBAAgB,aAAa,CAAC,EAC5B,QAAQ,EACR,aAAsB,EACtB,iBAAiB,EACjB,QAAgB,EAChB,gBAAwB,GACzB,EAAE,kBAAkB,2CAsVpB;AAED,wBAAgB,eAAe,IAAI,iBAAiB,CAMnD;AAED,wBAAgB,mBAAmB,IAAI,iBAAiB,CAmBvD;AAED,wBAAgB,QAAQ;;;;mBA3ZP,IAAI;4BAET,MAAM,UACN,SAAS,GAAG,WAAW,GAAG,SAAS,WAClC,MAAM,KACZ,OAAO,CAAC,IAAI,CAAC;EA+ZnB;AAED,wBAAgB,gBAAgB,IAAI,IAAI,GAAG,IAAI,CAG9C"}
|
|
@@ -3,34 +3,36 @@ import "../../shared-graphql.js";
|
|
|
3
3
|
import { useAppShell as t } from "../providers/shell/AppShellContext.js";
|
|
4
4
|
import { useAuth as n } from "../providers/shell/AuthProvider.js";
|
|
5
5
|
import { useActiveContext as r } from "../providers/shell/ActiveContextProvider.js";
|
|
6
|
-
import {
|
|
6
|
+
import { useSafePermissions as i } from "../providers/shell/PermissionProvider.js";
|
|
7
|
+
import { useLogger as a } from "../logger/useLogger.js";
|
|
7
8
|
import "../../shared-logger.js";
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
9
|
+
import { isTourAllowedByPermissions as o } from "./permissions.js";
|
|
10
|
+
import { isTourVisibleForContext as s } from "./routeCatalog.js";
|
|
11
|
+
import { GET_TOURS_FOR_CONTEXT as c, GET_TOURS_FOR_CONTEXT_WITHOUT_PROGRESS as l } from "./toursContext/gql.js";
|
|
12
|
+
import { isMyProgressFieldMissingError as u, isTeardownInvariant as d } from "./toursContext/errors.js";
|
|
13
|
+
import { normalizeDeviceType as ee } from "./toursContext/session.js";
|
|
14
|
+
import { deriveRouteContext as te } from "./toursContext/route.js";
|
|
15
|
+
import { useIdleReady as ne } from "./toursContext/useIdleReady.js";
|
|
16
|
+
import { useTourMutations as re } from "./toursContext/useTourMutations.js";
|
|
17
|
+
import { createContext as f, use as p, useCallback as m, useEffect as h, useLayoutEffect as ie, useMemo as g, useRef as _, useState as v } from "react";
|
|
18
|
+
import { jsx as ae } from "react/jsx-runtime";
|
|
19
|
+
import { useLocation as oe } from "react-router";
|
|
18
20
|
//#region src/shared/tours/ToursContext.tsx
|
|
19
|
-
var
|
|
20
|
-
function
|
|
21
|
-
let C =
|
|
21
|
+
var y = f(null);
|
|
22
|
+
function b({ children: f, defaultPageId: p = "home", getPageIdFromPath: b, disabled: x = !1, requireWorkspace: S = !1 }) {
|
|
23
|
+
let C = oe(), w = e("global"), { workspaceId: se } = r(), { user: T } = n(), E = i(), { productSlug: D } = t(), O = a("ToursContext"), k = se ?? void 0, A = x || S && !k || C.pathname.startsWith("/devportal"), { moduleId: j, pageId: M } = g(() => te(C.pathname, D, p, b), [
|
|
22
24
|
p,
|
|
23
|
-
|
|
25
|
+
b,
|
|
24
26
|
C.pathname,
|
|
25
27
|
D
|
|
26
|
-
]), [N, P] = v([]), [F, I] = v(!1), [L, R] = v(null), z =
|
|
27
|
-
h(() => (
|
|
28
|
-
|
|
28
|
+
]), [N, P] = v([]), [F, I] = v(!1), [L, R] = v(null), z = ne(), B = _([]), ce = _(0), V = _(/* @__PURE__ */ new Map()), H = _(void 0), U = _(!1), W = _(!0), G = _(0), K = _(!0);
|
|
29
|
+
h(() => (W.current = !0, () => {
|
|
30
|
+
W.current = !1;
|
|
29
31
|
}), []);
|
|
30
|
-
let
|
|
32
|
+
let q = m(async (e = !1) => {
|
|
31
33
|
if (!z && !e) return;
|
|
32
34
|
if (A) {
|
|
33
|
-
|
|
35
|
+
W.current && (P([]), I(!1), R(null));
|
|
34
36
|
return;
|
|
35
37
|
}
|
|
36
38
|
if (!w) return;
|
|
@@ -39,17 +41,17 @@ function x({ children: f, defaultPageId: p = "home", getPageIdFromPath: x, disab
|
|
|
39
41
|
workspaceId: k,
|
|
40
42
|
moduleId: j,
|
|
41
43
|
pageId: M
|
|
42
|
-
}), n =
|
|
44
|
+
}), n = ee(), r = [
|
|
43
45
|
D,
|
|
44
46
|
j ?? "",
|
|
45
47
|
M ?? "",
|
|
46
48
|
k,
|
|
47
49
|
n,
|
|
48
|
-
|
|
50
|
+
T?.id ?? "anonymous"
|
|
49
51
|
].join("::");
|
|
50
|
-
if (!e &&
|
|
51
|
-
|
|
52
|
-
let i = ++
|
|
52
|
+
if (!e && U.current && H.current === r) return;
|
|
53
|
+
W.current && (I(!0), R(null));
|
|
54
|
+
let i = ++G.current;
|
|
53
55
|
try {
|
|
54
56
|
let e = { context: {
|
|
55
57
|
productId: D,
|
|
@@ -57,38 +59,53 @@ function x({ children: f, defaultPageId: p = "home", getPageIdFromPath: x, disab
|
|
|
57
59
|
pageId: M,
|
|
58
60
|
workspaceId: k,
|
|
59
61
|
deviceType: n
|
|
60
|
-
} }, a = "network-only",
|
|
62
|
+
} }, a = "network-only", o, s = K.current ? c : l;
|
|
61
63
|
try {
|
|
62
|
-
|
|
63
|
-
query:
|
|
64
|
+
o = await w.query({
|
|
65
|
+
query: s,
|
|
64
66
|
variables: e,
|
|
65
67
|
fetchPolicy: a,
|
|
66
|
-
errorPolicy: "none"
|
|
68
|
+
errorPolicy: "none",
|
|
69
|
+
context: {
|
|
70
|
+
queryDeduplication: !1,
|
|
71
|
+
requiredWorkspaceAuth: !!k,
|
|
72
|
+
requiredWorkspaceId: k
|
|
73
|
+
}
|
|
67
74
|
});
|
|
68
|
-
let n =
|
|
69
|
-
|
|
70
|
-
query:
|
|
75
|
+
let n = o.errors;
|
|
76
|
+
s === c && n?.some((e) => u(e)) && (K.current = !1, t.warn("[ToursContext] Gateway returned a Tour.myProgress validation error — falling back to query without progress chips until the backend field is published."), o = await w.query({
|
|
77
|
+
query: l,
|
|
71
78
|
variables: e,
|
|
72
79
|
fetchPolicy: a,
|
|
73
|
-
errorPolicy: "none"
|
|
80
|
+
errorPolicy: "none",
|
|
81
|
+
context: {
|
|
82
|
+
queryDeduplication: !1,
|
|
83
|
+
requiredWorkspaceAuth: !!k,
|
|
84
|
+
requiredWorkspaceId: k
|
|
85
|
+
}
|
|
74
86
|
}));
|
|
75
87
|
} catch (n) {
|
|
76
|
-
if (
|
|
77
|
-
query:
|
|
88
|
+
if (s === c && u(n)) K.current = !1, t.warn("[ToursContext] Gateway does not expose Tour.myProgress yet — falling back to query without progress chips until the backend field is published."), o = await w.query({
|
|
89
|
+
query: l,
|
|
78
90
|
variables: e,
|
|
79
91
|
fetchPolicy: a,
|
|
80
|
-
errorPolicy: "none"
|
|
92
|
+
errorPolicy: "none",
|
|
93
|
+
context: {
|
|
94
|
+
queryDeduplication: !1,
|
|
95
|
+
requiredWorkspaceAuth: !!k,
|
|
96
|
+
requiredWorkspaceId: k
|
|
97
|
+
}
|
|
81
98
|
});
|
|
82
99
|
else throw n;
|
|
83
100
|
}
|
|
84
|
-
let d = (
|
|
85
|
-
|
|
101
|
+
let d = (o.data?.toursForContext ?? []).filter((e, t, n) => n.findIndex((t) => t.id === e.id) === t);
|
|
102
|
+
W.current && i === G.current && (P(d), H.current = r, U.current = !0);
|
|
86
103
|
} catch (e) {
|
|
87
|
-
if (!
|
|
104
|
+
if (!W.current || i !== G.current || d(e)) return;
|
|
88
105
|
let n = e instanceof Error ? e : /* @__PURE__ */ Error("Failed to fetch tours");
|
|
89
106
|
t.error("Failed to fetch tours for context", n), R(n), P([]);
|
|
90
107
|
} finally {
|
|
91
|
-
|
|
108
|
+
W.current && i === G.current && I(!1);
|
|
92
109
|
}
|
|
93
110
|
}, [
|
|
94
111
|
z,
|
|
@@ -99,76 +116,79 @@ function x({ children: f, defaultPageId: p = "home", getPageIdFromPath: x, disab
|
|
|
99
116
|
M,
|
|
100
117
|
D,
|
|
101
118
|
k,
|
|
102
|
-
|
|
103
|
-
]),
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
}, [
|
|
107
|
-
|
|
108
|
-
}, [
|
|
119
|
+
T?.id
|
|
120
|
+
]), J = `${T?.id ?? ""}:${k ?? ""}`, [le, ue] = v(J);
|
|
121
|
+
le !== J && (ue(J), P([]), I(!0), R(null)), ie(() => (B.current = [], U.current = !1, H.current = void 0, G.current += 1, V.current.clear(), () => {
|
|
122
|
+
G.current += 1;
|
|
123
|
+
}), [J]), h(() => {
|
|
124
|
+
q();
|
|
125
|
+
}, [q]), h(() => {
|
|
109
126
|
B.current = N;
|
|
110
127
|
}, [N]);
|
|
111
|
-
let
|
|
112
|
-
|
|
113
|
-
}, [
|
|
128
|
+
let Y = m(() => {
|
|
129
|
+
q(!0);
|
|
130
|
+
}, [q]), X = g(() => N.filter((e) => o(e, E)), [N, E]), Z = g(() => X.filter((e) => e.isActive && e.steps?.length > 0 && s(e, {
|
|
114
131
|
productId: D,
|
|
115
132
|
moduleId: j,
|
|
116
133
|
pageId: M
|
|
117
134
|
})).sort((e, t) => (t.priority ?? 0) - (e.priority ?? 0)), [
|
|
118
|
-
|
|
135
|
+
X,
|
|
119
136
|
j,
|
|
120
137
|
M,
|
|
121
138
|
D
|
|
122
|
-
]),
|
|
139
|
+
]), Q = g(() => z ? Z.find((e) => e.triggerType === "AUTO_FIRST_VISIT" || e.triggerType === "AUTO_ALWAYS") ?? null : null, [Z, z]), { trackProgress: $, recordStepCompletion: de, trackEvent: fe } = re({
|
|
123
140
|
globalClient: w,
|
|
124
|
-
userId:
|
|
141
|
+
userId: T?.id,
|
|
125
142
|
productSlug: D,
|
|
126
143
|
moduleId: j,
|
|
127
144
|
pageId: M,
|
|
128
145
|
workspaceId: k,
|
|
129
146
|
setAllTours: P,
|
|
130
147
|
allToursRef: B,
|
|
131
|
-
progressMutationVersionRef:
|
|
132
|
-
latestProgressMutationByTourRef:
|
|
133
|
-
}),
|
|
134
|
-
|
|
135
|
-
|
|
148
|
+
progressMutationVersionRef: ce,
|
|
149
|
+
latestProgressMutationByTourRef: V
|
|
150
|
+
}), pe = g(() => ({
|
|
151
|
+
progressScopeKey: `${T?.id ?? ""}:${k ?? ""}`,
|
|
152
|
+
tours: X,
|
|
153
|
+
pageTours: Z,
|
|
136
154
|
loading: F,
|
|
137
155
|
error: L,
|
|
138
|
-
refetch:
|
|
139
|
-
trackProgress:
|
|
140
|
-
recordStepCompletion:
|
|
141
|
-
trackEvent:
|
|
142
|
-
autoStartTour:
|
|
156
|
+
refetch: Y,
|
|
157
|
+
trackProgress: $,
|
|
158
|
+
recordStepCompletion: de,
|
|
159
|
+
trackEvent: fe,
|
|
160
|
+
autoStartTour: Q,
|
|
143
161
|
productId: D,
|
|
144
162
|
moduleId: j,
|
|
145
163
|
pageId: M
|
|
146
164
|
}), [
|
|
147
|
-
N,
|
|
148
165
|
X,
|
|
166
|
+
T?.id,
|
|
167
|
+
k,
|
|
168
|
+
Q,
|
|
149
169
|
L,
|
|
150
170
|
F,
|
|
151
171
|
j,
|
|
152
172
|
M,
|
|
153
|
-
|
|
173
|
+
Z,
|
|
154
174
|
D,
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
175
|
+
de,
|
|
176
|
+
Y,
|
|
177
|
+
fe,
|
|
178
|
+
$
|
|
159
179
|
]);
|
|
160
|
-
return /* @__PURE__ */
|
|
161
|
-
value:
|
|
180
|
+
return /* @__PURE__ */ ae(y.Provider, {
|
|
181
|
+
value: pe,
|
|
162
182
|
children: f
|
|
163
183
|
});
|
|
164
184
|
}
|
|
165
|
-
function
|
|
166
|
-
let e = p(
|
|
185
|
+
function x() {
|
|
186
|
+
let e = p(y);
|
|
167
187
|
if (!e) throw Error("useToursContext must be used within a ToursProvider");
|
|
168
188
|
return e;
|
|
169
189
|
}
|
|
170
|
-
function
|
|
171
|
-
return p(
|
|
190
|
+
function S() {
|
|
191
|
+
return p(y) || {
|
|
172
192
|
tours: [],
|
|
173
193
|
pageTours: [],
|
|
174
194
|
loading: !1,
|
|
@@ -183,8 +203,8 @@ function C() {
|
|
|
183
203
|
pageId: void 0
|
|
184
204
|
};
|
|
185
205
|
}
|
|
186
|
-
function
|
|
187
|
-
let e =
|
|
206
|
+
function C() {
|
|
207
|
+
let e = x();
|
|
188
208
|
return {
|
|
189
209
|
tours: e.pageTours,
|
|
190
210
|
loading: e.loading,
|
|
@@ -193,8 +213,8 @@ function w() {
|
|
|
193
213
|
trackProgress: e.trackProgress
|
|
194
214
|
};
|
|
195
215
|
}
|
|
196
|
-
function
|
|
197
|
-
return
|
|
216
|
+
function w() {
|
|
217
|
+
return x().autoStartTour;
|
|
198
218
|
}
|
|
199
219
|
//#endregion
|
|
200
|
-
export {
|
|
220
|
+
export { b as ToursProvider, w as useAutoStartTour, S as useSafeToursContext, C as useTours, x as useToursContext };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Tour } from './types';
|
|
2
|
+
interface TourPermissions {
|
|
3
|
+
isLoading: boolean;
|
|
4
|
+
hasPermission: (permission: string) => boolean;
|
|
5
|
+
}
|
|
6
|
+
/** Tour targeting is guidance; the gateway still authorizes every product action. */
|
|
7
|
+
export declare function isTourAllowedByPermissions(tour: Pick<Tour, 'triggerConfig'>, permissions: TourPermissions | null): boolean;
|
|
8
|
+
export {};
|
|
9
|
+
//# sourceMappingURL=permissions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"permissions.d.ts","sourceRoot":"","sources":["../../../src/shared/tours/permissions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAEpC,UAAU,eAAe;IACvB,SAAS,EAAE,OAAO,CAAC;IACnB,aAAa,EAAE,CAAC,UAAU,EAAE,MAAM,KAAK,OAAO,CAAC;CAChD;AAED,qFAAqF;AACrF,wBAAgB,0BAA0B,CACxC,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,eAAe,CAAC,EACjC,WAAW,EAAE,eAAe,GAAG,IAAI,GAClC,OAAO,CAYT"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
//#region src/shared/tours/permissions.ts
|
|
2
|
+
function e(e, t) {
|
|
3
|
+
let n = e.triggerConfig?.requiredPermissions;
|
|
4
|
+
return n === void 0 ? !0 : !Array.isArray(n) || n.some((e) => typeof e != "string" || !e.trim()) ? !1 : n.length === 0 ? !0 : !t || t.isLoading ? !1 : n.every((e) => t.hasPermission(e));
|
|
5
|
+
}
|
|
6
|
+
//#endregion
|
|
7
|
+
export { e as isTourAllowedByPermissions };
|
|
@@ -1,7 +1,12 @@
|
|
|
1
|
-
import { TourUserStatus, TourUserProgressSummary } from './types';
|
|
1
|
+
import { TourStep, TourUserStatus, TourUserProgressSummary } from './types';
|
|
2
2
|
export interface TourProgressCarrier {
|
|
3
3
|
id: string;
|
|
4
4
|
myProgress?: TourUserProgressSummary | null;
|
|
5
5
|
}
|
|
6
6
|
export declare function withTourProgressStatus<T extends TourProgressCarrier>(tours: readonly T[], tourId: string, status: TourUserStatus): T[];
|
|
7
|
+
/** Resume only an unfinished tour, using persisted step IDs that still exist. */
|
|
8
|
+
export declare function tourResumeStepIndex(tour: {
|
|
9
|
+
steps: readonly Pick<TourStep, 'id'>[];
|
|
10
|
+
myProgress?: TourUserProgressSummary | null;
|
|
11
|
+
}): number;
|
|
7
12
|
//# sourceMappingURL=progress.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"progress.d.ts","sourceRoot":"","sources":["../../../src/shared/tours/progress.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,uBAAuB,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"progress.d.ts","sourceRoot":"","sources":["../../../src/shared/tours/progress.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,cAAc,EAAE,uBAAuB,EAAE,MAAM,SAAS,CAAC;AAEjF,MAAM,WAAW,mBAAmB;IAClC,EAAE,EAAE,MAAM,CAAC;IACX,UAAU,CAAC,EAAE,uBAAuB,GAAG,IAAI,CAAC;CAC7C;AAED,wBAAgB,sBAAsB,CAAC,CAAC,SAAS,mBAAmB,EAClE,KAAK,EAAE,SAAS,CAAC,EAAE,EACnB,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,cAAc,GACrB,CAAC,EAAE,CAkBL;AAED,iFAAiF;AACjF,wBAAgB,mBAAmB,CAAC,IAAI,EAAE;IACxC,KAAK,EAAE,SAAS,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,EAAE,CAAC;IACvC,UAAU,CAAC,EAAE,uBAAuB,GAAG,IAAI,CAAC;CAC7C,GAAG,MAAM,CAQT"}
|
|
@@ -3,10 +3,20 @@ function e(e, t, n) {
|
|
|
3
3
|
return e.map((e) => e.id === t ? {
|
|
4
4
|
...e,
|
|
5
5
|
myProgress: {
|
|
6
|
+
...e.myProgress,
|
|
7
|
+
...n === "IN_PROGRESS" && e.myProgress?.status !== "IN_PROGRESS" ? {
|
|
8
|
+
completedSteps: [],
|
|
9
|
+
currentStepId: null
|
|
10
|
+
} : {},
|
|
6
11
|
id: e.myProgress?.id ?? `optimistic-${t}`,
|
|
7
12
|
status: n
|
|
8
13
|
}
|
|
9
14
|
} : e);
|
|
10
15
|
}
|
|
16
|
+
function t(e) {
|
|
17
|
+
if (e.myProgress?.status !== "IN_PROGRESS") return 0;
|
|
18
|
+
let t = e.myProgress.completedSteps, n = new Set(Array.isArray(t) ? t.filter((e) => typeof e == "string") : []), r = e.steps.findIndex((e) => !n.has(e.id));
|
|
19
|
+
return Math.max(0, r);
|
|
20
|
+
}
|
|
11
21
|
//#endregion
|
|
12
|
-
export { e as withTourProgressStatus };
|
|
22
|
+
export { t as tourResumeStepIndex, e as withTourProgressStatus };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"routeCatalog.d.ts","sourceRoot":"","sources":["../../../src/shared/tours/routeCatalog.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,qBAAqB;IACpC,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB;AAED,MAAM,WAAW,qBAAqB;IACpC,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,mBAAmB;IAClC,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,iBAAiB;IAChC,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CACxB;AAED,MAAM,WAAW,kBAAkB;IACjC,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;IACpC,MAAM,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;CACnC;
|
|
1
|
+
{"version":3,"file":"routeCatalog.d.ts","sourceRoot":"","sources":["../../../src/shared/tours/routeCatalog.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,qBAAqB;IACpC,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB;AAED,MAAM,WAAW,qBAAqB;IACpC,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,mBAAmB;IAClC,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,iBAAiB;IAChC,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CACxB;AAED,MAAM,WAAW,kBAAkB;IACjC,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;IACpC,MAAM,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;CACnC;AAi6BD,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAGtD;AAED;;;GAGG;AACH,wBAAgB,wBAAwB,CACtC,SAAS,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,EACpC,OAAO,EAAE,SAAS,qBAAqB,EAAE,GACxC,MAAM,IAAI,CAkCZ;AAED,wBAAgB,mBAAmB,CACjC,SAAS,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GACnC,qBAAqB,EAAE,CAQzB;AAED,wBAAgB,mBAAmB,CACjC,SAAS,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GACnC,qBAAqB,EAAE,CAezB;AAED,wBAAgB,iBAAiB,CAC/B,SAAS,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,EACpC,QAAQ,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAClC,mBAAmB,EAAE,CAWvB;AAED,wBAAgB,qBAAqB,CACnC,IAAI,EAAE,iBAAiB,GACtB,MAAM,GAAG,SAAS,CAyBpB;AAED,wBAAgB,uBAAuB,CACrC,IAAI,EAAE,iBAAiB,EACvB,OAAO,EAAE,kBAAkB,GAC1B,OAAO,CAyBT;AAED,wBAAgB,kBAAkB,CAChC,IAAI,EAAE,iBAAiB,EACvB,OAAO,EAAE,kBAAkB,GAC1B,MAAM,CAKR"}
|