@burdenoff/fe-libs 2026.527.2 → 2026.527.4

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 (161) hide show
  1. package/dist/button/Button.js +18 -16
  2. package/dist/chrome/AccountSwitcher.js +10 -7
  3. package/dist/chrome/AutoBreadcrumbs.js +2 -0
  4. package/dist/chrome/Breadcrumbs.js +2 -0
  5. package/dist/chrome/CommandPalette.js +5 -3
  6. package/dist/chrome/ContextSwitcher.js +90 -338
  7. package/dist/chrome/DynamicFooter.js +7 -7
  8. package/dist/chrome/Footer.js +5 -5
  9. package/dist/chrome/GeographySwitcher.js +3 -3
  10. package/dist/chrome/GlobalSearch.js +73 -448
  11. package/dist/chrome/HeaderBar.js +6 -1
  12. package/dist/chrome/LanguagePickerSheet.js +1 -1
  13. package/dist/chrome/LanguageSwitcher.js +2 -2
  14. package/dist/chrome/NotificationCenter.js +69 -694
  15. package/dist/chrome/PanelTabs.js +7 -4
  16. package/dist/chrome/PluginContextMenuTarget.js +1 -1
  17. package/dist/chrome/ProductPickerSheet.js +4 -4
  18. package/dist/chrome/ProductSideNav.js +1 -1
  19. package/dist/chrome/ProductSwitcher.js +3 -3
  20. package/dist/chrome/ProfileSwitcher.js +13 -8
  21. package/dist/chrome/ShortcutHelpDialog.js +2 -1
  22. package/dist/chrome/SideNavigation.js +75 -239
  23. package/dist/chrome/Sidebar.js +1 -0
  24. package/dist/chrome/contextSwitcher/EmptyState.js +32 -0
  25. package/dist/chrome/contextSwitcher/OrganizationList.js +34 -0
  26. package/dist/chrome/contextSwitcher/ProjectList.js +34 -0
  27. package/dist/chrome/contextSwitcher/SearchInput.js +50 -0
  28. package/dist/chrome/contextSwitcher/TabButton.js +9 -0
  29. package/dist/chrome/contextSwitcher/TriggerButton.js +38 -0
  30. package/dist/chrome/contextSwitcher/WorkspaceList.js +34 -0
  31. package/dist/chrome/contextSwitcher/icons.js +58 -0
  32. package/dist/chrome/contextSwitcher/useIsMobile.js +11 -0
  33. package/dist/chrome/globalSearch/AdvancedFiltersPanel.js +253 -0
  34. package/dist/chrome/globalSearch/CategoryTabs.js +28 -0
  35. package/dist/chrome/globalSearch/ResultsList.js +58 -0
  36. package/dist/chrome/globalSearch/SearchInput.js +28 -0
  37. package/dist/chrome/globalSearch/SearchModeBar.js +36 -0
  38. package/dist/chrome/globalSearch/useAdvancedFilters.js +78 -0
  39. package/dist/chrome/globalSearch/utils.js +22 -0
  40. package/dist/chrome/notificationCenter/BellButton.js +27 -0
  41. package/dist/chrome/notificationCenter/NotificationCardItem.js +129 -0
  42. package/dist/chrome/notificationCenter/NotificationFilters.js +67 -0
  43. package/dist/chrome/notificationCenter/NotificationFooter.js +23 -0
  44. package/dist/chrome/notificationCenter/NotificationHeader.js +75 -0
  45. package/dist/chrome/notificationCenter/NotificationList.js +75 -0
  46. package/dist/chrome/notificationCenter/NotificationPanel.js +19 -0
  47. package/dist/chrome/notificationCenter/SkeletonCard.js +18 -0
  48. package/dist/chrome/notificationCenter/constants.js +93 -0
  49. package/dist/chrome/notificationCenter/gql.js +58 -0
  50. package/dist/chrome/notificationCenter/useNotificationCenter.js +149 -0
  51. package/dist/chrome/notificationCenter/usePanelChrome.js +36 -0
  52. package/dist/chrome/sideNavigation/CollapseToggle.js +29 -0
  53. package/dist/chrome/sideNavigation/MobileActionsBar.js +25 -0
  54. package/dist/chrome/sideNavigation/NavItemRenderer.js +79 -0
  55. package/dist/chrome/sideNavigation/SidebarHeader.js +29 -0
  56. package/dist/chrome/sideNavigation/helpers.js +19 -0
  57. package/dist/chrome/sideNavigation/useSideNavigationState.js +45 -0
  58. package/dist/form/Checkbox.js +17 -15
  59. package/dist/form/FormDescription.js +9 -10
  60. package/dist/form/FormField.js +11 -12
  61. package/dist/form/FormLabel.js +13 -13
  62. package/dist/form/FormMessage.js +10 -11
  63. package/dist/form/Input.js +11 -10
  64. package/dist/form/Radio.js +25 -21
  65. package/dist/form/Select.js +81 -66
  66. package/dist/form/Textarea.js +10 -9
  67. package/dist/shared/components/AccessDenied.js +8 -4
  68. package/dist/shared/components/AppErrorBoundary.js +2 -0
  69. package/dist/shared/components/ContextConversationWidget.js +173 -767
  70. package/dist/shared/components/ErrorFallback.js +3 -0
  71. package/dist/shared/components/PWAInstallBanner.js +8 -4
  72. package/dist/shared/components/RequireAuth.js +4 -4
  73. package/dist/shared/components/SSORedirectGuard.js +1 -1
  74. package/dist/shared/components/contextConversationWidget/Composer.js +66 -0
  75. package/dist/shared/components/contextConversationWidget/MessageItem.js +124 -0
  76. package/dist/shared/components/contextConversationWidget/MessageList.js +32 -0
  77. package/dist/shared/components/contextConversationWidget/NoWorkspaceCard.js +19 -0
  78. package/dist/shared/components/contextConversationWidget/PendingAttachmentsBar.js +28 -0
  79. package/dist/shared/components/contextConversationWidget/ReplyBanner.js +32 -0
  80. package/dist/shared/components/contextConversationWidget/WidgetHeader.js +70 -0
  81. package/dist/shared/components/contextConversationWidget/queries.js +197 -0
  82. package/dist/shared/components/contextConversationWidget/types.js +10 -0
  83. package/dist/shared/components/contextConversationWidget/useAttachmentUpload.js +57 -0
  84. package/dist/shared/components/contextConversationWidget/useConversationSubscriptions.js +26 -0
  85. package/dist/shared/components/contextConversationWidget/useMessageActions.js +34 -0
  86. package/dist/shared/components/contextConversationWidget/useSendMessage.js +45 -0
  87. package/dist/shared/components/contextConversationWidget/useWidgetMessages.js +44 -0
  88. package/dist/shared/components/contextConversationWidget/utils.js +56 -0
  89. package/dist/shared/feature-flags/FeatureFlagProvider.js +21 -21
  90. package/dist/shared/geography/GeographyProvider.js +20 -20
  91. package/dist/shared/graphql/GatewayContext.js +1 -1
  92. package/dist/shared/motion/MotionList.js +1 -1
  93. package/dist/shared/pages/AiPage.js +3 -3
  94. package/dist/shared/pages/SearchPage.js +293 -1071
  95. package/dist/shared/pages/searchPage/ActiveFilterChips.js +176 -0
  96. package/dist/shared/pages/searchPage/FiltersPanel.js +329 -0
  97. package/dist/shared/pages/searchPage/ResultsList.js +119 -0
  98. package/dist/shared/pages/searchPage/ResultsStatus.js +32 -0
  99. package/dist/shared/pages/searchPage/SearchInput.js +31 -0
  100. package/dist/shared/pages/searchPage/SearchPagination.js +37 -0
  101. package/dist/shared/pages/searchPage/SearchToolbar.js +58 -0
  102. package/dist/shared/pages/searchPage/constants.js +155 -0
  103. package/dist/shared/pages/searchPage/utils.js +24 -0
  104. package/dist/shared/plugins/PluginRuntimeProvider.js +1 -1
  105. package/dist/shared/providers/shell/ActiveContextProvider.js +12 -12
  106. package/dist/shared/providers/shell/AppShellContext.js +1 -1
  107. package/dist/shared/providers/shell/AuthProvider.js +130 -384
  108. package/dist/shared/providers/shell/AuthTokenProvider.js +6 -6
  109. package/dist/shared/providers/shell/ContextManagerProvider.js +1 -1
  110. package/dist/shared/providers/shell/FeatureFlagsProvider.js +5 -5
  111. package/dist/shared/providers/shell/GlobalUiProvider.js +17 -17
  112. package/dist/shared/providers/shell/I18nProvider.js +15 -15
  113. package/dist/shared/providers/shell/PageConversationContextProvider.js +14 -14
  114. package/dist/shared/providers/shell/PermissionProvider.js +16 -16
  115. package/dist/shared/providers/shell/ShellUiProvider.js +13 -13
  116. package/dist/shared/providers/shell/ThemeProvider.js +9 -9
  117. package/dist/shared/providers/shell/authProvider/bridgeStateSync.js +34 -0
  118. package/dist/shared/providers/shell/authProvider/jwt.js +13 -0
  119. package/dist/shared/providers/shell/authProvider/ssoRelay.js +38 -0
  120. package/dist/shared/providers/shell/authProvider/useAuthActions.js +170 -0
  121. package/dist/shared/providers/shell/authProvider/useBridgeInitialization.js +86 -0
  122. package/dist/shared/providers/shell/authProvider/useRemoteSLO.js +32 -0
  123. package/dist/shared/providers/shell/authProvider/useStorageSync.js +35 -0
  124. package/dist/shared/providers/shell/authProvider/useTokenExpiryTimer.js +37 -0
  125. package/dist/shared/tours/TourPlayer.js +1 -0
  126. package/dist/shared/tours/TourPlayerProvider.js +1 -1
  127. package/dist/shared/tours/TourTooltip.js +3 -0
  128. package/dist/shared/tours/TourTrigger.js +86 -259
  129. package/dist/shared/tours/ToursContext.js +108 -398
  130. package/dist/shared/tours/tourTrigger/DesktopTourDropdown.js +48 -0
  131. package/dist/shared/tours/tourTrigger/MobileTourSheet.js +68 -0
  132. package/dist/shared/tours/tourTrigger/TourListItemDesktop.js +36 -0
  133. package/dist/shared/tours/tourTrigger/TourListItemMobile.js +47 -0
  134. package/dist/shared/tours/tourTrigger/TourStatusChip.js +30 -0
  135. package/dist/shared/tours/tourTrigger/TourTriggerButton.js +22 -0
  136. package/dist/shared/tours/toursContext/errors.js +18 -0
  137. package/dist/shared/tours/toursContext/gql.js +152 -0
  138. package/dist/shared/tours/toursContext/route.js +20 -0
  139. package/dist/shared/tours/toursContext/session.js +19 -0
  140. package/dist/shared/tours/toursContext/useIdleReady.js +18 -0
  141. package/dist/shared/tours/toursContext/useTourMutations.js +118 -0
  142. package/dist/shared-events.js +3 -3
  143. package/dist/shared-hooks.js +1 -1
  144. package/dist/storage/SaveToFilesButton.js +3 -3
  145. package/dist/storage/SaveToFilesDialog.js +1 -1
  146. package/dist/tag/TagBadge.js +1 -1
  147. package/dist/tag/TagsWidget.js +81 -226
  148. package/dist/tag/tagsWidget/AddTagTrigger.js +14 -0
  149. package/dist/tag/tagsWidget/TagBadgeList.js +17 -0
  150. package/dist/tag/tagsWidget/TagSearchPopover.js +80 -0
  151. package/dist/tag/tagsWidget/operations.js +64 -0
  152. package/dist/tag/tagsWidget/useVocabResolver.js +30 -0
  153. package/dist/ui/card.js +44 -39
  154. package/dist/ui/dropdown-menu.js +82 -66
  155. package/dist/ui/input.js +10 -10
  156. package/dist/ui/label.js +13 -11
  157. package/dist/ui/select.js +80 -66
  158. package/dist/ui/table.js +61 -54
  159. package/dist/ui/textarea.js +9 -9
  160. package/dist/ui/tooltip.js +13 -11
  161. package/package.json +1 -1
@@ -5,460 +5,170 @@ import { useActiveContext as n } from "../providers/shell/ActiveContextProvider.
5
5
  import { useAppShell as r } from "../providers/shell/AppShellContext.js";
6
6
  import { useLogger as i } from "../logger/useLogger.js";
7
7
  import "../../shared-logger.js";
8
- import { detectDeviceType as a } from "./types.js";
9
- import { isTourVisibleForContext as o } from "./routeCatalog.js";
10
- import { withTourProgressStatus as s } from "./progress.js";
11
- import { createContext as c, useCallback as l, useContext as u, useEffect as d, useMemo as f, useRef as p, useState as m } from "react";
12
- import { jsx as ee } from "react/jsx-runtime";
13
- import { gql as h } from "@apollo/client/core";
14
- import { useLocation as te } from "react-router-dom";
8
+ import { isTourVisibleForContext as a } from "./routeCatalog.js";
9
+ import { GET_TOURS_FOR_CONTEXT as o, GET_TOURS_FOR_CONTEXT_WITHOUT_PROGRESS as s } from "./toursContext/gql.js";
10
+ import { isMyProgressFieldMissingError as c, isTeardownInvariant as l } from "./toursContext/errors.js";
11
+ import { normalizeDeviceType as u } from "./toursContext/session.js";
12
+ import { deriveRouteContext as d } from "./toursContext/route.js";
13
+ import { useIdleReady as ee } from "./toursContext/useIdleReady.js";
14
+ import { useTourMutations as te } from "./toursContext/useTourMutations.js";
15
+ import { createContext as f, use as p, useCallback as m, useEffect as h, useMemo as g, useRef as _, useState as v } from "react";
16
+ import { jsx as ne } from "react/jsx-runtime";
17
+ import { useLocation as y } from "react-router-dom";
15
18
  //#region src/shared/tours/ToursContext.tsx
16
- var g = h`
17
- fragment ToursCoreFields on Tour {
18
- id
19
- context {
20
- workspaceId
21
- }
22
- name
23
- slug
24
- description
25
- productId
26
- moduleId
27
- pageId
28
- status
29
- isActive
30
- triggerType
31
- triggerConfig
32
- mobileConfig
33
- tabletConfig
34
- desktopConfig
35
- priority
36
- displayOrder
37
- }
38
- `, _ = h`
39
- fragment ToursStepFields on Tour {
40
- steps {
41
- id
42
- tourId
43
- title
44
- content
45
- stepOrder
46
- targetSelector
47
- placement
48
- targetSelectorMobile
49
- targetSelectorTablet
50
- targetSelectorDesktop
51
- customData
52
- actions
53
- requireInteraction
54
- waitForSelector
55
- waitForEvent
56
- waitForTimeout
57
- skipConditions
58
- media {
59
- id
60
- position
61
- mediaId
62
- media {
63
- id
64
- name
65
- type
66
- cdnUrl
67
- mimeType
68
- altText
69
- caption
70
- }
71
- }
72
- }
73
- }
74
- `, v = h`
75
- ${g}
76
- ${_}
77
- query GetToursForContext($context: TourContextInput!) {
78
- toursForContext(context: $context) {
79
- ...ToursCoreFields
80
- myProgress {
81
- id
82
- status
83
- }
84
- ...ToursStepFields
85
- }
86
- }
87
- `, y = h`
88
- ${g}
89
- ${_}
90
- query GetToursForContextFallback($context: TourContextInput!) {
91
- toursForContext(context: $context) {
92
- ...ToursCoreFields
93
- ...ToursStepFields
94
- }
95
- }
96
- `;
97
- function b(e) {
98
- let t = e instanceof Error || typeof e == "object" && e && "message" in e && typeof e.message == "string" ? e.message : "";
99
- return t.includes("myProgress") ? t.includes("Cannot query field") || t.includes("Unknown field") : !1;
100
- }
101
- var ne = h`
102
- mutation StartTour($tourId: ID!, $userId: ID!, $deviceType: DeviceType) {
103
- startTour(tourId: $tourId, userId: $userId, deviceType: $deviceType) {
104
- id
105
- tourId
106
- userId
107
- status
108
- currentStepId
109
- completedSteps
110
- startedAt
111
- completedAt
112
- lastViewedAt
113
- }
114
- }
115
- `, re = h`
116
- mutation CompleteTour($tourId: ID!, $userId: ID!) {
117
- completeTour(tourId: $tourId, userId: $userId) {
118
- id
119
- tourId
120
- userId
121
- status
122
- currentStepId
123
- completedSteps
124
- startedAt
125
- completedAt
126
- lastViewedAt
127
- }
128
- }
129
- `, ie = h`
130
- mutation SkipTour($tourId: ID!, $userId: ID!) {
131
- skipTour(tourId: $tourId, userId: $userId) {
132
- id
133
- tourId
134
- userId
135
- status
136
- currentStepId
137
- completedSteps
138
- startedAt
139
- completedAt
140
- lastViewedAt
141
- }
142
- }
143
- `, ae = h`
144
- mutation CompleteStep($tourId: ID!, $stepId: ID!, $userId: ID!) {
145
- completeStep(tourId: $tourId, stepId: $stepId, userId: $userId) {
146
- id
147
- tourId
148
- userId
149
- status
150
- currentStepId
151
- completedSteps
152
- startedAt
153
- completedAt
154
- lastViewedAt
155
- }
156
- }
157
- `, oe = h`
158
- mutation TrackTourEvent($input: RecordTourAnalyticsInput!) {
159
- trackTourEvent(input: $input) {
160
- id
161
- tourId
162
- eventType
163
- stepId
164
- stepOrder
165
- timestamp
166
- }
167
- }
168
- `, x = [
169
- "The client has been stopped",
170
- "QueryManager stopped",
171
- "This Apollo Client has been destroyed",
172
- "aborted"
173
- ];
174
- function se(e) {
175
- if (!(e instanceof Error)) return !1;
176
- let t = e.message;
177
- return e.name === "InvariantError" || t.startsWith("Invariant Violation") ? x.some((e) => t.includes(e)) : !1;
178
- }
179
- function S(e, t) {
180
- let n = e.split("/").filter(Boolean);
181
- return n.length === 0 ? t : n[0];
182
- }
183
- function C() {
184
- let e = a();
185
- return e === "mobile" ? "MOBILE" : e === "tablet" ? "TABLET" : "DESKTOP";
186
- }
187
- function ce() {
188
- let e = "bf-tour-session-id";
189
- try {
190
- let t = sessionStorage.getItem(e);
191
- if (t) return t;
192
- let n = typeof crypto < "u" && typeof crypto.randomUUID == "function" ? crypto.randomUUID() : `tour-session-${Date.now()}-${Math.random().toString(36).slice(2)}`;
193
- return sessionStorage.setItem(e, n), n;
194
- } catch {
195
- return `tour-session-${Date.now()}-${Math.random().toString(36).slice(2)}`;
196
- }
197
- }
198
- function le(e, t, n, r) {
199
- let i = e.split("/").filter(Boolean), a = r ? r(e) : S(e, n);
200
- return i.length === 0 ? {
201
- moduleId: t,
202
- pageId: a
203
- } : i[0] === t ? {
204
- moduleId: t,
205
- pageId: i[1] ?? n
206
- } : {
207
- moduleId: i[0],
208
- pageId: a
209
- };
210
- }
211
- var w = c(null);
212
- function T({ children: a, defaultPageId: c = "home", getPageIdFromPath: u, disabled: h = !1 }) {
213
- let g = te(), _ = e("global"), { workspaceId: x } = n(), { user: S } = t(), { productSlug: T } = r(), E = i("ToursContext"), D = x ?? void 0, O = h || g.pathname.startsWith("/devportal"), { moduleId: k, pageId: A } = f(() => le(g.pathname, T, c, u), [
214
- c,
215
- u,
216
- g.pathname,
217
- T
218
- ]), [j, M] = m([]), [N, P] = m(!1), [F, I] = m(null), [L, ue] = m(!1);
219
- d(() => {
220
- let e = () => ue(!0);
221
- if (typeof window < "u" && "requestIdleCallback" in window) {
222
- let t = window.requestIdleCallback(e, { timeout: 2e3 });
223
- return () => {
224
- window.cancelIdleCallback?.(t);
225
- };
226
- }
227
- let t = setTimeout(e, 500);
228
- return () => clearTimeout(t);
229
- }, []);
230
- let R = p([]), z = p(0), B = p(/* @__PURE__ */ new Map()), V = p(void 0), H = p(!1), U = p(!0), W = p(0), G = p(!0);
231
- d(() => (U.current = !0, () => {
19
+ var b = f(null);
20
+ function x({ children: f, defaultPageId: p = "home", getPageIdFromPath: x, disabled: S = !1 }) {
21
+ let C = y(), w = e("global"), { workspaceId: T } = n(), { user: E } = t(), { productSlug: D } = r(), O = i("ToursContext"), k = T ?? void 0, A = S || C.pathname.startsWith("/devportal"), { moduleId: j, pageId: M } = g(() => d(C.pathname, D, p, x), [
22
+ p,
23
+ x,
24
+ C.pathname,
25
+ D
26
+ ]), [N, P] = v([]), [F, I] = v(!1), [L, R] = v(null), z = ee(), B = _([]), re = _(0), ie = _(/* @__PURE__ */ new Map()), V = _(void 0), H = _(!1), U = _(!0), W = _(0), G = _(!0);
27
+ h(() => (U.current = !0, () => {
232
28
  U.current = !1;
233
29
  }), []);
234
- let K = l(async (e = !1) => {
235
- if (!L && !e) return;
236
- if (O) {
237
- U.current && (M([]), P(!1), I(null));
30
+ let K = m(async (e = !1) => {
31
+ if (!z && !e) return;
32
+ if (A) {
33
+ U.current && (P([]), I(!1), R(null));
238
34
  return;
239
35
  }
240
- if (!_) return;
241
- let t = E.child("fetch", {
242
- productSlug: T,
243
- workspaceId: D,
244
- moduleId: k,
245
- pageId: A
246
- }), n = C(), r = [
247
- T,
248
- k ?? "",
249
- A ?? "",
36
+ if (!w) return;
37
+ let t = O.child("fetch", {
38
+ productSlug: D,
39
+ workspaceId: k,
40
+ moduleId: j,
41
+ pageId: M
42
+ }), n = u(), r = [
250
43
  D,
44
+ j ?? "",
45
+ M ?? "",
46
+ k,
251
47
  n,
252
- S?.id ?? "anonymous"
48
+ E?.id ?? "anonymous"
253
49
  ].join("::");
254
50
  if (!e && H.current && V.current === r) return;
255
- U.current && (P(!0), I(null));
51
+ U.current && (I(!0), R(null));
256
52
  let i = ++W.current;
257
53
  try {
258
54
  let e = { context: {
259
- productId: T,
260
- moduleId: k,
261
- pageId: A,
262
- workspaceId: D,
55
+ productId: D,
56
+ moduleId: j,
57
+ pageId: M,
58
+ workspaceId: k,
263
59
  deviceType: n
264
- } }, a = "network-only", o, s = G.current ? v : y;
60
+ } }, a = "network-only", l, u = G.current ? o : s;
265
61
  try {
266
- o = await _.query({
267
- query: s,
62
+ l = await w.query({
63
+ query: u,
268
64
  variables: e,
269
65
  fetchPolicy: a,
270
66
  errorPolicy: "none"
271
67
  });
272
- let n = o.errors;
273
- s === v && n?.some((e) => b(e)) && (G.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 _.query({
274
- query: y,
68
+ let n = l.errors;
69
+ u === o && n?.some((e) => c(e)) && (G.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."), l = await w.query({
70
+ query: s,
275
71
  variables: e,
276
72
  fetchPolicy: a,
277
73
  errorPolicy: "none"
278
74
  }));
279
75
  } catch (n) {
280
- if (s === v && b(n)) G.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 _.query({
281
- query: y,
76
+ if (u === o && c(n)) G.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."), l = await w.query({
77
+ query: s,
282
78
  variables: e,
283
79
  fetchPolicy: a,
284
80
  errorPolicy: "none"
285
81
  });
286
82
  else throw n;
287
83
  }
288
- let c = (o.data?.toursForContext ?? []).filter((e, t, n) => n.findIndex((t) => t.id === e.id) === t);
289
- U.current && i === W.current && (M(c), V.current = r, H.current = !0);
84
+ let d = (l.data?.toursForContext ?? []).filter((e, t, n) => n.findIndex((t) => t.id === e.id) === t);
85
+ U.current && i === W.current && (P(d), V.current = r, H.current = !0);
290
86
  } catch (e) {
291
- if (!U.current || i !== W.current || se(e)) return;
87
+ if (!U.current || i !== W.current || l(e)) return;
292
88
  let n = e instanceof Error ? e : /* @__PURE__ */ Error("Failed to fetch tours");
293
- t.error("Failed to fetch tours for context", n), I(n), M([]);
89
+ t.error("Failed to fetch tours for context", n), R(n), P([]);
294
90
  } finally {
295
- U.current && i === W.current && P(!1);
91
+ U.current && i === W.current && I(!1);
296
92
  }
297
93
  }, [
298
- L,
299
- O,
300
- _,
301
- E,
302
- k,
94
+ z,
303
95
  A,
304
- T,
96
+ w,
97
+ O,
98
+ j,
99
+ M,
305
100
  D,
306
- S?.id
307
- ]), q = p(S?.id);
308
- d(() => {
309
- q.current !== S?.id && (q.current = S?.id, H.current = !1, V.current = void 0, U.current && M([]));
310
- }, [S?.id]), d(() => {
101
+ k,
102
+ E?.id
103
+ ]), q = _(E?.id);
104
+ h(() => {
105
+ q.current !== E?.id && (q.current = E?.id, H.current = !1, V.current = void 0, U.current && P([]));
106
+ }, [E?.id]), h(() => {
311
107
  K();
312
- }, [K]), d(() => {
313
- R.current = j;
314
- }, [j]);
315
- let J = l(() => {
108
+ }, [K]), h(() => {
109
+ B.current = N;
110
+ }, [N]);
111
+ let J = m(() => {
316
112
  K(!0);
317
- }, [K]), Y = f(() => j.filter((e) => e.isActive && e.steps?.length > 0 && o(e, {
318
- productId: T,
319
- moduleId: k,
320
- pageId: A
113
+ }, [K]), Y = g(() => N.filter((e) => e.isActive && e.steps?.length > 0 && a(e, {
114
+ productId: D,
115
+ moduleId: j,
116
+ pageId: M
321
117
  })).sort((e, t) => (t.priority ?? 0) - (e.priority ?? 0)), [
118
+ N,
322
119
  j,
323
- k,
324
- A,
325
- T
326
- ]), X = f(() => L ? Y.find((e) => e.triggerType === "AUTO_FIRST_VISIT" || e.triggerType === "AUTO_ALWAYS") ?? null : null, [Y, L]), Z = l(async (e, t, n) => {
327
- if (!_ || !S?.id) return;
328
- let r = t === "started" ? "IN_PROGRESS" : t === "completed" ? "COMPLETED" : "SKIPPED", i = R.current.find((t) => t.id === e)?.myProgress, a = z.current + 1;
329
- z.current = a, B.current.set(e, a), M((t) => {
330
- let n = s(t, e, r);
331
- return R.current = n, n;
332
- });
333
- try {
334
- if (t === "started") {
335
- await _.mutate({
336
- mutation: ne,
337
- variables: {
338
- tourId: e,
339
- userId: S.id,
340
- deviceType: C()
341
- }
342
- });
343
- return;
344
- }
345
- if (t === "completed") {
346
- await _.mutate({
347
- mutation: re,
348
- variables: {
349
- tourId: e,
350
- userId: S.id
351
- }
352
- });
353
- return;
354
- }
355
- await _.mutate({
356
- mutation: ie,
357
- variables: {
358
- tourId: e,
359
- userId: S.id
360
- }
361
- });
362
- } catch {
363
- if (B.current.get(e) !== a) return;
364
- M((t) => {
365
- let n = t.map((t) => t.id === e ? {
366
- ...t,
367
- myProgress: i
368
- } : t);
369
- return R.current = n, n;
370
- });
371
- } finally {
372
- B.current.get(e) === a && B.current.delete(e);
373
- }
374
- }, [_, S?.id]), Q = l(async (e, t) => {
375
- if (!(!_ || !S?.id || !t)) try {
376
- await _.mutate({
377
- mutation: ae,
378
- variables: {
379
- tourId: e,
380
- stepId: t,
381
- userId: S.id
382
- }
383
- });
384
- } catch {}
385
- }, [_, S?.id]), $ = l(async (e, t, n) => {
386
- if (!(!_ || !S?.id)) try {
387
- await _.mutate({
388
- mutation: oe,
389
- variables: { input: {
390
- tourId: t,
391
- userId: S.id,
392
- sessionId: ce(),
393
- eventType: e,
394
- stepId: n?.stepId,
395
- stepOrder: n?.stepOrder,
396
- productId: T,
397
- moduleId: k,
398
- pageId: A,
399
- deviceType: C(),
400
- userAgent: typeof navigator < "u" ? navigator.userAgent : void 0,
401
- duration: n?.duration,
402
- metadata: n?.metadata,
403
- context: D ? {
404
- workspaceId: D,
405
- productId: T,
406
- moduleId: k,
407
- pageId: A
408
- } : {
409
- productId: T,
410
- moduleId: k,
411
- pageId: A
412
- }
413
- } }
414
- });
415
- } catch {}
416
- }, [
417
- _,
418
- k,
419
- A,
420
- T,
421
- S?.id,
120
+ M,
422
121
  D
423
- ]), de = f(() => ({
424
- tours: j,
122
+ ]), X = g(() => z ? Y.find((e) => e.triggerType === "AUTO_FIRST_VISIT" || e.triggerType === "AUTO_ALWAYS") ?? null : null, [Y, z]), { trackProgress: Z, recordStepCompletion: Q, trackEvent: $ } = te({
123
+ globalClient: w,
124
+ userId: E?.id,
125
+ productSlug: D,
126
+ moduleId: j,
127
+ pageId: M,
128
+ workspaceId: k,
129
+ setAllTours: P,
130
+ allToursRef: B,
131
+ progressMutationVersionRef: re,
132
+ latestProgressMutationByTourRef: ie
133
+ }), ae = g(() => ({
134
+ tours: N,
425
135
  pageTours: Y,
426
- loading: N,
427
- error: F,
136
+ loading: F,
137
+ error: L,
428
138
  refetch: J,
429
139
  trackProgress: Z,
430
140
  recordStepCompletion: Q,
431
141
  trackEvent: $,
432
142
  autoStartTour: X,
433
- productId: T,
434
- moduleId: k,
435
- pageId: A
143
+ productId: D,
144
+ moduleId: j,
145
+ pageId: M
436
146
  }), [
437
- j,
147
+ N,
438
148
  X,
149
+ L,
439
150
  F,
440
- N,
441
- k,
442
- A,
151
+ j,
152
+ M,
443
153
  Y,
444
- T,
154
+ D,
445
155
  Q,
446
156
  J,
447
157
  $,
448
158
  Z
449
159
  ]);
450
- return /* @__PURE__ */ ee(w.Provider, {
451
- value: de,
452
- children: a
160
+ return /* @__PURE__ */ ne(b.Provider, {
161
+ value: ae,
162
+ children: f
453
163
  });
454
164
  }
455
- function E() {
456
- let e = u(w);
165
+ function S() {
166
+ let e = p(b);
457
167
  if (!e) throw Error("useToursContext must be used within a ToursProvider");
458
168
  return e;
459
169
  }
460
- function D() {
461
- return u(w) || {
170
+ function C() {
171
+ return p(b) || {
462
172
  tours: [],
463
173
  pageTours: [],
464
174
  loading: !1,
@@ -473,8 +183,8 @@ function D() {
473
183
  pageId: void 0
474
184
  };
475
185
  }
476
- function O() {
477
- let e = E();
186
+ function w() {
187
+ let e = S();
478
188
  return {
479
189
  tours: e.pageTours,
480
190
  loading: e.loading,
@@ -483,8 +193,8 @@ function O() {
483
193
  trackProgress: e.trackProgress
484
194
  };
485
195
  }
486
- function k() {
487
- return E().autoStartTour;
196
+ function T() {
197
+ return S().autoStartTour;
488
198
  }
489
199
  //#endregion
490
- export { T as ToursProvider, k as useAutoStartTour, D as useSafeToursContext, O as useTours, E as useToursContext };
200
+ export { x as ToursProvider, T as useAutoStartTour, C as useSafeToursContext, w as useTours, S as useToursContext };
@@ -0,0 +1,48 @@
1
+ import { TourListItemDesktop as e } from "./TourListItemDesktop.js";
2
+ import { forwardRef as t } from "react";
3
+ import { Sparkles as n } from "lucide-react";
4
+ import { jsx as r, jsxs as i } from "react/jsx-runtime";
5
+ //#region src/shared/tours/tourTrigger/DesktopTourDropdown.tsx
6
+ var a = t(function({ loading: t, tours: a, onStartTour: o }, s) {
7
+ return /* @__PURE__ */ i("div", {
8
+ ref: s,
9
+ className: "absolute right-0 top-full mt-2 w-80 bg-bg-surface rounded-lg shadow-xl border border-border-subtle z-50 animate-in fade-in slide-in-from-top-2 duration-200",
10
+ children: [
11
+ /* @__PURE__ */ i("div", {
12
+ className: "flex items-center gap-2 px-4 py-3 border-b border-border-subtle",
13
+ children: [/* @__PURE__ */ r(n, { className: "size-4 text-action-primary-bg" }), /* @__PURE__ */ r("h3", {
14
+ className: "font-medium text-text-primary",
15
+ children: "Product Tours"
16
+ })]
17
+ }),
18
+ /* @__PURE__ */ r("div", {
19
+ className: "max-h-80 overflow-y-auto",
20
+ children: t ? /* @__PURE__ */ r("div", {
21
+ className: "flex items-center justify-center py-6",
22
+ children: /* @__PURE__ */ r("div", { className: "animate-spin rounded-full size-5 border-2 border-action-primary-bg border-t-transparent" })
23
+ }) : a.length > 0 ? /* @__PURE__ */ r("div", {
24
+ className: "p-2",
25
+ children: a.map((t) => /* @__PURE__ */ r(e, {
26
+ tour: t,
27
+ onStart: o
28
+ }, t.id))
29
+ }) : /* @__PURE__ */ r("div", {
30
+ className: "text-center py-6 px-4",
31
+ children: /* @__PURE__ */ r("p", {
32
+ className: "text-sm text-text-secondary",
33
+ children: "No tours available for this page"
34
+ })
35
+ })
36
+ }),
37
+ a.length > 0 && /* @__PURE__ */ r("div", {
38
+ className: "px-4 py-2 border-t border-border-subtle bg-bg-muted/50 rounded-b-lg",
39
+ children: /* @__PURE__ */ r("p", {
40
+ className: "text-xs text-text-tertiary text-center",
41
+ children: "Click a tour to start the guided walkthrough"
42
+ })
43
+ })
44
+ ]
45
+ });
46
+ });
47
+ //#endregion
48
+ export { a as DesktopTourDropdown };