@burdenoff/fe-libs 2026.1023.4 → 2026.1023.6
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/chrome/CommandPalette.d.ts +25 -2
- package/dist/chrome/CommandPalette.js +70 -57
- package/dist/chrome/GlobalSearch.js +74 -73
- package/dist/chrome/NotificationCenter.js +76 -71
- package/dist/chrome/index.d.ts +1 -1
- package/dist/chrome.js +40 -40
- package/dist/shared/assistant/createSandboxAssistantTransport.js +1 -1
- package/dist/shared/assistant/pageContextKeys.d.ts +14 -1
- package/dist/shared/assistant/pageContextKeys.js +11 -2
- package/dist/shared/assistant/ui/voice/VoiceMiniController.js +1 -1
- package/dist/shared/hooks/shell/globalSearchError.d.ts +11 -0
- package/dist/shared/hooks/shell/globalSearchError.js +10 -0
- package/dist/shared/hooks/shell/useGlobalSearch.d.ts +2 -0
- package/dist/shared/hooks/shell/useGlobalSearch.js +48 -38
- package/dist/shared/navigation/inAppPath.d.ts +33 -0
- package/dist/shared/navigation/inAppPath.js +32 -0
- package/dist/shared-assistant.js +297 -297
- package/dist/shell-native/deep-link-context.js +2 -1
- package/dist/shell-native/deep-link.d.ts +2 -6
- package/dist/shell-native/deep-link.js +19 -26
- package/dist/shell-native.js +3 -2
- package/package.json +1 -1
package/dist/chrome.js
CHANGED
|
@@ -9,43 +9,43 @@ import { PluginFooterStrip as d } from "./chrome/PluginFooterStrip.js";
|
|
|
9
9
|
import { DEFAULT_FOOTER_COLUMNS as f, DEFAULT_SOCIAL_LINKS as p, Footer as m } from "./chrome/Footer.js";
|
|
10
10
|
import { SideNavigation as h } from "./chrome/SideNavigation.js";
|
|
11
11
|
import { GlobalSearch as g } from "./chrome/GlobalSearch.js";
|
|
12
|
-
import {
|
|
13
|
-
import { Breadcrumbs as
|
|
14
|
-
import { NavLink as
|
|
15
|
-
import { Tabs as
|
|
16
|
-
import { Sidebar as
|
|
17
|
-
import { ProfileSwitcher as
|
|
18
|
-
import { ProductSwitcher as
|
|
19
|
-
import { LanguageSwitcher as
|
|
20
|
-
import { ContextSwitcher as
|
|
21
|
-
import { GeographySwitcher as
|
|
22
|
-
import { PushOptInToggle as
|
|
23
|
-
import { NotificationCenter as
|
|
24
|
-
import { LanguagePickerSheet as
|
|
25
|
-
import { ProductPickerSheet as
|
|
26
|
-
import { AccountSwitcher as
|
|
27
|
-
import { firstProjectOfWorkspace as
|
|
28
|
-
import { resolveSwitchTarget as
|
|
29
|
-
import { useContextSwitchController as
|
|
30
|
-
import { AutoBreadcrumbs as
|
|
31
|
-
import { NavCustomizeDialog as
|
|
32
|
-
import { PersonaSimulationPill as
|
|
33
|
-
import { ProductSideNav as
|
|
34
|
-
import { BrandMark as
|
|
35
|
-
import { DynamicFooter as
|
|
36
|
-
import { PanelTabs as
|
|
37
|
-
import { PanelContainer as
|
|
38
|
-
import { StatusBar as
|
|
39
|
-
import { PluginRoutes as
|
|
40
|
-
import { PluginSettingsPage as
|
|
41
|
-
import { PluginToolbar as
|
|
42
|
-
import { PluginWidgetGrid as
|
|
43
|
-
import { PluginContextMenuTarget as
|
|
44
|
-
import { selectMobileTabs as
|
|
45
|
-
import { useMobileTabBarVisible as
|
|
46
|
-
import { MobileTabBar as
|
|
47
|
-
import { NativeTopBar as
|
|
48
|
-
import { SwipeNavigation as
|
|
49
|
-
import { NativePageTransition as
|
|
50
|
-
import { findNavTitle as
|
|
51
|
-
export {
|
|
12
|
+
import { COMMAND_PALETTE_HELP_SHORTCUT as _, COMMAND_PALETTE_SHORTCUT as v, CommandPalette as y } from "./chrome/CommandPalette.js";
|
|
13
|
+
import { Breadcrumbs as b } from "./chrome/Breadcrumbs.js";
|
|
14
|
+
import { NavLink as x } from "./chrome/NavLink.js";
|
|
15
|
+
import { Tabs as S } from "./chrome/Tabs.js";
|
|
16
|
+
import { Sidebar as C } from "./chrome/Sidebar.js";
|
|
17
|
+
import { ProfileSwitcher as w } from "./chrome/ProfileSwitcher.js";
|
|
18
|
+
import { ProductSwitcher as T } from "./chrome/ProductSwitcher.js";
|
|
19
|
+
import { LanguageSwitcher as E } from "./chrome/LanguageSwitcher.js";
|
|
20
|
+
import { ContextSwitcher as D } from "./chrome/ContextSwitcher.js";
|
|
21
|
+
import { GeographySwitcher as O } from "./chrome/GeographySwitcher.js";
|
|
22
|
+
import { PushOptInToggle as k } from "./chrome/notificationCenter/PushOptInToggle.js";
|
|
23
|
+
import { NotificationCenter as A } from "./chrome/NotificationCenter.js";
|
|
24
|
+
import { LanguagePickerSheet as j } from "./chrome/LanguagePickerSheet.js";
|
|
25
|
+
import { ProductPickerSheet as M } from "./chrome/ProductPickerSheet.js";
|
|
26
|
+
import { AccountSwitcher as N } from "./chrome/AccountSwitcher.js";
|
|
27
|
+
import { firstProjectOfWorkspace as P, switchOrganization as F, switchWorkspace as I } from "./chrome/contextSwitcher/contextSwitch.js";
|
|
28
|
+
import { resolveSwitchTarget as L, sectionLandingRule as R } from "./chrome/contextSwitcher/resolveSwitchTarget.js";
|
|
29
|
+
import { useContextSwitchController as z } from "./chrome/contextSwitcher/useContextSwitchController.js";
|
|
30
|
+
import { AutoBreadcrumbs as B, registerBreadcrumbName as V, unregisterBreadcrumbName as H } from "./chrome/AutoBreadcrumbs.js";
|
|
31
|
+
import { NavCustomizeDialog as U } from "./chrome/NavCustomizeDialog.js";
|
|
32
|
+
import { PersonaSimulationPill as W, PersonaSurfaceControls as G } from "./chrome/PersonaSurfaceControls.js";
|
|
33
|
+
import { ProductSideNav as K } from "./chrome/ProductSideNav.js";
|
|
34
|
+
import { BrandMark as q } from "./chrome/BrandMark.js";
|
|
35
|
+
import { DynamicFooter as J } from "./chrome/DynamicFooter.js";
|
|
36
|
+
import { PanelTabs as Y } from "./chrome/PanelTabs.js";
|
|
37
|
+
import { PanelContainer as X } from "./chrome/PanelContainer.js";
|
|
38
|
+
import { StatusBar as Z } from "./chrome/StatusBar.js";
|
|
39
|
+
import { PluginRoutes as Q } from "./chrome/PluginRoutes.js";
|
|
40
|
+
import { PluginSettingsPage as $ } from "./chrome/PluginSettingsPage.js";
|
|
41
|
+
import { PluginToolbar as ee } from "./chrome/PluginToolbar.js";
|
|
42
|
+
import { PluginWidgetGrid as te } from "./chrome/PluginWidgetGrid.js";
|
|
43
|
+
import { PluginContextMenuTarget as ne } from "./chrome/PluginContextMenuTarget.js";
|
|
44
|
+
import { selectMobileTabs as re } from "./chrome/mobileTabBar/selectTabs.js";
|
|
45
|
+
import { useMobileTabBarVisible as ie } from "./chrome/mobileTabBar/useMobileTabBarVisible.js";
|
|
46
|
+
import { MobileTabBar as ae } from "./chrome/MobileTabBar.js";
|
|
47
|
+
import { NativeTopBar as oe } from "./chrome/NativeTopBar.js";
|
|
48
|
+
import { SwipeNavigation as se } from "./chrome/SwipeNavigation.js";
|
|
49
|
+
import { NativePageTransition as ce } from "./chrome/NativePageTransition.js";
|
|
50
|
+
import { findNavTitle as le, useNativeTopBarTitle as ue } from "./chrome/nativeTopBarTitle.js";
|
|
51
|
+
export { N as AccountSwitcher, s as AppShellLayout, B as AutoBreadcrumbs, q as BrandMark, b as Breadcrumbs, _ as COMMAND_PALETTE_HELP_SHORTCUT, v as COMMAND_PALETTE_SHORTCUT, y as CommandPalette, D as ContextSwitcher, f as DEFAULT_FOOTER_COLUMNS, p as DEFAULT_SOCIAL_LINKS, J as DynamicFooter, m as Footer, u as FooterBar, O as GeographySwitcher, g as GlobalSearch, l as HeaderBar, j as LanguagePickerSheet, E as LanguageSwitcher, ae as MobileTabBar, n as NAV_MORE_ID_PREFIX, ce as NativePageTransition, oe as NativeTopBar, U as NavCustomizeDialog, x as NavLink, A as NotificationCenter, c as PageHeader, X as PanelContainer, Y as PanelTabs, W as PersonaSimulationPill, G as PersonaSurfaceControls, ne as PluginContextMenuTarget, d as PluginFooterStrip, Q as PluginRoutes, $ as PluginSettingsPage, ee as PluginToolbar, te as PluginWidgetGrid, M as ProductPickerSheet, K as ProductSideNav, T as ProductSwitcher, w as ProfileSwitcher, k as PushOptInToggle, t as ShortcutHelpDialog, h as SideNavigation, C as Sidebar, Z as StatusBar, se as SwipeNavigation, S as Tabs, e as ThemePreferences, r as applyNavVisibility, i as applyPermissionFilter, a as applySurfaceVisibility, le as findNavTitle, P as firstProjectOfWorkspace, o as isItemEffectivelyShown, V as registerBreadcrumbName, L as resolveSwitchTarget, R as sectionLandingRule, re as selectMobileTabs, F as switchOrganization, I as switchWorkspace, H as unregisterBreadcrumbName, z as useContextSwitchController, ie as useMobileTabBarVisible, ue as useNativeTopBarTitle };
|
|
@@ -11,7 +11,7 @@ import { assistantUsageLedger as _, hasPendingUsageReports as v, reportUsageWith
|
|
|
11
11
|
var S = 42e4, C = 400, w = 2e3, T = 5e3;
|
|
12
12
|
function E() {
|
|
13
13
|
return typeof window > "u" ? {} : {
|
|
14
|
-
currentUrl: window.location.
|
|
14
|
+
currentUrl: `${window.location.origin}${window.location.pathname}`,
|
|
15
15
|
currentPage: window.location.pathname.split("/").filter(Boolean).slice(0, 3).join("/") || "home",
|
|
16
16
|
viewportSize: `${window.innerWidth}x${window.innerHeight}`
|
|
17
17
|
};
|
|
@@ -35,9 +35,22 @@ export type AssistantPageContextKey = (typeof ASSISTANT_MODEL_CONTEXT_KEYS)[numb
|
|
|
35
35
|
export declare const ASSISTANT_PAGE_CONTEXT_KEYS: readonly AssistantPageContextKey[];
|
|
36
36
|
/** Whether the sandbox reads `key` from `pageContext`. */
|
|
37
37
|
export declare function isAssistantPageContextKey(key: string): key is AssistantPageContextKey;
|
|
38
|
+
/**
|
|
39
|
+
* `currentUrl` without the parts that carry credentials (G87): the query string,
|
|
40
|
+
* the fragment, and any `user:password@` userinfo.
|
|
41
|
+
*
|
|
42
|
+
* Straight after sign-in a shell URL holds live tokens in its `#sso=` fragment,
|
|
43
|
+
* and share links hold bearer tokens in their query string. Hosts are expected
|
|
44
|
+
* to send origin + path already; this is the backstop for one that forwards
|
|
45
|
+
* `window.location.href`. The cut is unconditional rather than a deny-list of
|
|
46
|
+
* parameter names, so a new token parameter cannot slip past it.
|
|
47
|
+
*/
|
|
48
|
+
export declare function credentialFreeContextUrl(value: string): string;
|
|
38
49
|
/**
|
|
39
50
|
* The part of a host's page context that goes on the wire: only allow-listed
|
|
40
|
-
* keys, with their values untouched
|
|
51
|
+
* keys, with their values untouched — except `currentUrl`, which loses its
|
|
52
|
+
* query string, fragment and userinfo (`credentialFreeContextUrl`).
|
|
53
|
+
* `undefined` stays `undefined`, so a turn
|
|
41
54
|
* with no context still produces the body it always did; a context with no
|
|
42
55
|
* allow-listed key becomes `{}`, which the sandbox treats as "no context".
|
|
43
56
|
*
|
|
@@ -37,10 +37,19 @@ function i(e) {
|
|
|
37
37
|
return r.has(e);
|
|
38
38
|
}
|
|
39
39
|
function a(e) {
|
|
40
|
+
let t = e.split(/[?#]/, 1)[0] ?? "", n;
|
|
41
|
+
try {
|
|
42
|
+
n = new URL(t);
|
|
43
|
+
} catch {
|
|
44
|
+
return t;
|
|
45
|
+
}
|
|
46
|
+
return n.username === "" && n.password === "" ? t : `${n.origin}${n.pathname}`;
|
|
47
|
+
}
|
|
48
|
+
function o(e) {
|
|
40
49
|
if (e === void 0) return;
|
|
41
50
|
let t = {};
|
|
42
|
-
for (let [n, i] of Object.entries(e)) r.has(n) && (t[n] = i);
|
|
51
|
+
for (let [n, i] of Object.entries(e)) r.has(n) && (t[n] = n === "currentUrl" && typeof i == "string" ? a(i) : i);
|
|
43
52
|
return t;
|
|
44
53
|
}
|
|
45
54
|
//#endregion
|
|
46
|
-
export { e as ASSISTANT_MODEL_CONTEXT_KEYS, n as ASSISTANT_PAGE_CONTEXT_KEYS, t as ASSISTANT_REDACTED_CONTEXT_ID_KEYS, a as filterAssistantPageContext, i as isAssistantPageContextKey };
|
|
55
|
+
export { e as ASSISTANT_MODEL_CONTEXT_KEYS, n as ASSISTANT_PAGE_CONTEXT_KEYS, t as ASSISTANT_REDACTED_CONTEXT_ID_KEYS, a as credentialFreeContextUrl, o as filterAssistantPageContext, i as isAssistantPageContextKey };
|
|
@@ -28,7 +28,7 @@ var f = " self-stretch justify-end pb-8.5 [container-type:size] [@container_(min
|
|
|
28
28
|
rotating: v
|
|
29
29
|
})]
|
|
30
30
|
}), p === "mic-error" ? /* @__PURE__ */ u("p", {
|
|
31
|
-
className: "
|
|
31
|
+
className: "break-words text-xs text-status-warning",
|
|
32
32
|
role: "alert",
|
|
33
33
|
"data-testid": "assistant-voice-mini-error",
|
|
34
34
|
children: b
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Why a search could not run. `search()` throws it so the search UI shows an
|
|
3
|
+
* error instead of an empty "No results found" that hides a backend outage.
|
|
4
|
+
* `reason` is `NO_WORKSPACE_CONTEXT` without an active workspace, `UNAVAILABLE`
|
|
5
|
+
* when the search request failed; `detail` keeps the backend message for logs.
|
|
6
|
+
*/
|
|
7
|
+
export declare class GlobalSearchError extends Error {
|
|
8
|
+
readonly reason: "NO_WORKSPACE_CONTEXT" | "UNAVAILABLE";
|
|
9
|
+
readonly detail: string;
|
|
10
|
+
constructor(reason: "NO_WORKSPACE_CONTEXT" | "UNAVAILABLE", detail: string);
|
|
11
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
//#region src/shared/hooks/shell/globalSearchError.ts
|
|
2
|
+
var e = class extends Error {
|
|
3
|
+
reason;
|
|
4
|
+
detail;
|
|
5
|
+
constructor(e, t) {
|
|
6
|
+
super(e === "NO_WORKSPACE_CONTEXT" ? "Select a workspace to search it." : "Search is unavailable right now. Try again in a moment."), this.name = "GlobalSearchError", this.reason = e, this.detail = t;
|
|
7
|
+
}
|
|
8
|
+
};
|
|
9
|
+
//#endregion
|
|
10
|
+
export { e as GlobalSearchError };
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { SearchResult, SearchResponse } from '../../types';
|
|
2
|
+
import { GlobalSearchError } from './globalSearchError';
|
|
3
|
+
export { GlobalSearchError };
|
|
2
4
|
export type MetadataOperator = 'EQUALS' | 'NOT_EQUALS' | 'CONTAINS' | 'STARTS_WITH';
|
|
3
5
|
/** Metadata condition for filtering search results */
|
|
4
6
|
export interface MetadataCondition {
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { graphqlFetch as e } from "../../graphql/fetch.js";
|
|
2
2
|
import { useActiveContext as t } from "../../providers/shell/ActiveContextProvider.js";
|
|
3
|
-
import {
|
|
3
|
+
import { GlobalSearchError as n } from "./globalSearchError.js";
|
|
4
|
+
import { useCallback as r, useRef as i, useState as a } from "react";
|
|
4
5
|
//#region src/shared/hooks/shell/useGlobalSearch.ts
|
|
5
|
-
var
|
|
6
|
+
var o = "\n query GlobalSearch(\n $query: String!\n $searchMode: GraphSearchMode\n $entityTypes: [String!]\n $excludeEntityTypes: [String!]\n $productSources: [String!]\n $workspaceId: ID\n $projectId: ID\n $createdBy: ID\n $updatedBy: ID\n $dateRange: GraphDateRangeInput\n $updatedDateRange: GraphDateRangeInput\n $metadataConditions: [GraphMetadataConditionInput!]\n $tagFilter: GraphTagFilterInput\n $excludeIds: [ID!]\n $sortBy: GraphSearchSortBy\n $limit: Int\n $offset: Int\n ) {\n globalSearch(\n query: $query\n searchMode: $searchMode\n entityTypes: $entityTypes\n excludeEntityTypes: $excludeEntityTypes\n productSources: $productSources\n workspaceId: $workspaceId\n projectId: $projectId\n createdBy: $createdBy\n updatedBy: $updatedBy\n dateRange: $dateRange\n updatedDateRange: $updatedDateRange\n metadataConditions: $metadataConditions\n tagFilter: $tagFilter\n excludeIds: $excludeIds\n sortBy: $sortBy\n limit: $limit\n offset: $offset\n ) {\n results {\n entityId\n entityType\n productSource\n title\n description\n score\n workspaceId\n projectId\n createdBy\n updatedBy\n metadata\n }\n total\n hasMore\n facets {\n byType { type count }\n byProduct { product count }\n byWorkspace { workspaceId count }\n }\n searchTimeMs\n }\n }\n", s = {
|
|
6
7
|
workspaces: ["workspace"],
|
|
7
8
|
projects: ["project"],
|
|
8
9
|
members: ["member", "user"],
|
|
@@ -151,16 +152,16 @@ var a = "\n query GlobalSearch(\n $query: String!\n $searchMode: GraphSea
|
|
|
151
152
|
"ecoalertthreshold"
|
|
152
153
|
]
|
|
153
154
|
};
|
|
154
|
-
function
|
|
155
|
-
if (e) return
|
|
155
|
+
function c(e) {
|
|
156
|
+
if (e) return s[e];
|
|
156
157
|
}
|
|
157
|
-
var
|
|
158
|
+
var l = new Set([
|
|
158
159
|
"datatable",
|
|
159
160
|
"scheduledjob",
|
|
160
161
|
"eventregistration",
|
|
161
162
|
"variable"
|
|
162
163
|
]);
|
|
163
|
-
function
|
|
164
|
+
function u(e, t) {
|
|
164
165
|
if (t?.productSource !== "module-workflow") return;
|
|
165
166
|
let n = t.metadata?.workflowId;
|
|
166
167
|
switch (e) {
|
|
@@ -171,8 +172,8 @@ function l(e, t) {
|
|
|
171
172
|
default: return;
|
|
172
173
|
}
|
|
173
174
|
}
|
|
174
|
-
function
|
|
175
|
-
let i =
|
|
175
|
+
function d(e, t, n, r) {
|
|
176
|
+
let i = u(e.toLowerCase(), r);
|
|
176
177
|
if (i) return i;
|
|
177
178
|
switch (e.toLowerCase()) {
|
|
178
179
|
case "agent": return `/vibecontrols/agents/${t}`;
|
|
@@ -241,8 +242,8 @@ function u(e, t, n, r) {
|
|
|
241
242
|
default: return `/entities/${e}/${t}`;
|
|
242
243
|
}
|
|
243
244
|
}
|
|
244
|
-
function
|
|
245
|
-
if (t === "module-workflow" &&
|
|
245
|
+
function f(e, t) {
|
|
246
|
+
if (t === "module-workflow" && l.has(e.toLowerCase())) return "workflows";
|
|
246
247
|
switch (e.toLowerCase()) {
|
|
247
248
|
case "workspace": return "workspaces";
|
|
248
249
|
case "project": return "projects";
|
|
@@ -302,35 +303,35 @@ function d(e, t) {
|
|
|
302
303
|
default: return e;
|
|
303
304
|
}
|
|
304
305
|
}
|
|
305
|
-
var
|
|
306
|
-
function
|
|
307
|
-
let [
|
|
306
|
+
var p = 20;
|
|
307
|
+
function m() {
|
|
308
|
+
let [s, l] = a(!1), u = i(null), { workspaceId: m } = t(), h = r(async (t, n, r) => {
|
|
308
309
|
let i = t.trim();
|
|
309
310
|
if (!i) return {
|
|
310
311
|
results: [],
|
|
311
312
|
total: 0,
|
|
312
313
|
hasMore: !1
|
|
313
314
|
};
|
|
314
|
-
if (!
|
|
315
|
+
if (!m) return console.warn("[useGlobalSearch] No workspace context available — search requires an active workspace"), {
|
|
315
316
|
results: [],
|
|
316
317
|
total: 0,
|
|
317
318
|
hasMore: !1,
|
|
318
319
|
error: "NO_WORKSPACE_CONTEXT"
|
|
319
320
|
};
|
|
320
|
-
|
|
321
|
-
let
|
|
322
|
-
|
|
321
|
+
u.current && u.current.abort();
|
|
322
|
+
let a = new AbortController();
|
|
323
|
+
u.current = a, l(!0);
|
|
323
324
|
try {
|
|
324
|
-
let t = n ?
|
|
325
|
+
let t = n ? c(n) : r?.entityTypes, s = await e({
|
|
325
326
|
gateway: "workspace",
|
|
326
|
-
query:
|
|
327
|
+
query: o,
|
|
327
328
|
variables: {
|
|
328
329
|
query: i,
|
|
329
330
|
searchMode: r?.searchMode ?? "PARTIAL",
|
|
330
331
|
entityTypes: t ?? void 0,
|
|
331
332
|
excludeEntityTypes: r?.excludeEntityTypes ?? void 0,
|
|
332
333
|
productSources: r?.productSources ?? void 0,
|
|
333
|
-
workspaceId:
|
|
334
|
+
workspaceId: m,
|
|
334
335
|
projectId: r?.projectId ?? void 0,
|
|
335
336
|
createdBy: r?.createdBy ?? void 0,
|
|
336
337
|
updatedBy: r?.updatedBy ?? void 0,
|
|
@@ -340,27 +341,27 @@ function p() {
|
|
|
340
341
|
tagFilter: r?.tagFilter ?? void 0,
|
|
341
342
|
excludeIds: r?.excludeIds ?? void 0,
|
|
342
343
|
sortBy: r?.sortBy ?? void 0,
|
|
343
|
-
limit: r?.limit ??
|
|
344
|
+
limit: r?.limit ?? p,
|
|
344
345
|
offset: r?.offset ?? 0
|
|
345
346
|
},
|
|
346
347
|
workspaceToken: !0,
|
|
347
|
-
workspaceId:
|
|
348
|
-
signal:
|
|
348
|
+
workspaceId: m,
|
|
349
|
+
signal: a.signal
|
|
349
350
|
});
|
|
350
|
-
if (
|
|
351
|
+
if (s.errors?.length) return console.warn("[useGlobalSearch] GraphQL errors:", JSON.stringify(s.errors)), {
|
|
351
352
|
results: [],
|
|
352
353
|
total: 0,
|
|
353
354
|
hasMore: !1,
|
|
354
|
-
error:
|
|
355
|
+
error: s.errors.map((e) => e.message).join("; ")
|
|
355
356
|
};
|
|
356
|
-
let l =
|
|
357
|
+
let l = s.data?.globalSearch, u = (l?.results ?? []).map((e) => ({
|
|
357
358
|
id: e.entityId,
|
|
358
359
|
title: e.title,
|
|
359
360
|
description: e.description ?? void 0,
|
|
360
|
-
category:
|
|
361
|
+
category: f(e.entityType, e.productSource),
|
|
361
362
|
entityType: e.entityType,
|
|
362
363
|
productSource: e.productSource,
|
|
363
|
-
href:
|
|
364
|
+
href: d(e.entityType, e.entityId, e.workspaceId, {
|
|
364
365
|
productSource: e.productSource,
|
|
365
366
|
metadata: e.metadata
|
|
366
367
|
}),
|
|
@@ -380,27 +381,36 @@ function p() {
|
|
|
380
381
|
byWorkspace: l.facets.byWorkspace ?? []
|
|
381
382
|
} : void 0;
|
|
382
383
|
return {
|
|
383
|
-
results:
|
|
384
|
-
total: l?.total ??
|
|
384
|
+
results: u,
|
|
385
|
+
total: l?.total ?? u.length,
|
|
385
386
|
hasMore: l?.hasMore ?? !1,
|
|
386
387
|
facets: h,
|
|
387
388
|
searchTimeMs: l?.searchTimeMs ?? void 0
|
|
388
389
|
};
|
|
389
390
|
} catch (e) {
|
|
390
|
-
return e instanceof DOMException && e.name === "AbortError"
|
|
391
|
+
return e instanceof DOMException && e.name === "AbortError" ? {
|
|
391
392
|
results: [],
|
|
392
393
|
total: 0,
|
|
393
394
|
hasMore: !1
|
|
394
|
-
}
|
|
395
|
+
} : (console.warn("[useGlobalSearch] Search failed:", e), {
|
|
396
|
+
results: [],
|
|
397
|
+
total: 0,
|
|
398
|
+
hasMore: !1,
|
|
399
|
+
error: e instanceof Error ? e.message : String(e)
|
|
400
|
+
});
|
|
395
401
|
} finally {
|
|
396
|
-
|
|
402
|
+
u.current === a && l(!1);
|
|
397
403
|
}
|
|
398
|
-
}, [
|
|
404
|
+
}, [m]);
|
|
399
405
|
return {
|
|
400
|
-
searchFull:
|
|
401
|
-
search:
|
|
402
|
-
|
|
406
|
+
searchFull: h,
|
|
407
|
+
search: r(async (e, t, r) => {
|
|
408
|
+
let i = await h(e, t, r);
|
|
409
|
+
if (i.error) throw new n(i.error === "NO_WORKSPACE_CONTEXT" ? "NO_WORKSPACE_CONTEXT" : "UNAVAILABLE", i.error);
|
|
410
|
+
return i.results;
|
|
411
|
+
}, [h]),
|
|
412
|
+
isSearching: s
|
|
403
413
|
};
|
|
404
414
|
}
|
|
405
415
|
//#endregion
|
|
406
|
-
export {
|
|
416
|
+
export { m as useGlobalSearch };
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Same-origin, in-app navigation helpers with no native dependency, so the
|
|
3
|
+
* shell chrome (statically imported by microfrontends) can use them without
|
|
4
|
+
* pulling `@capacitor/*` in. `shell-native` deep links share `isSafeInAppPath`.
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* True for a same-origin, in-app path: `/x`, `/x?y#z`. Refuses protocol-relative
|
|
8
|
+
* (`//host`, `/\host`) and anything that is not a rooted path, so a deep link or
|
|
9
|
+
* a notification payload can never steer the page to another origin.
|
|
10
|
+
*/
|
|
11
|
+
export declare function isSafeInAppPath(path: string): boolean;
|
|
12
|
+
/**
|
|
13
|
+
* The in-app path a link points at, or null when it leaves the app: a rooted
|
|
14
|
+
* path is taken as is; an absolute URL only when its origin is `origin`.
|
|
15
|
+
*/
|
|
16
|
+
export declare function toInAppPath(url: string, origin: string): string | null;
|
|
17
|
+
/** The window members in-app navigation uses (a seam for tests). */
|
|
18
|
+
export interface InAppNavigationWindow {
|
|
19
|
+
location: {
|
|
20
|
+
origin: string;
|
|
21
|
+
};
|
|
22
|
+
history: {
|
|
23
|
+
pushState: (data: unknown, unused: string, url?: string | null) => void;
|
|
24
|
+
};
|
|
25
|
+
dispatchEvent: (event: Event) => boolean;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Navigate inside the app without a reload: push the path and announce it with
|
|
29
|
+
* `popstate`, which React Router's browser history and `ActiveContextProvider`
|
|
30
|
+
* (for `?org/workspace/project/tenant`) both listen to. Returns false, and does
|
|
31
|
+
* nothing, when `url` leaves the app — the caller then opens it in a new tab.
|
|
32
|
+
*/
|
|
33
|
+
export declare function navigateInApp(url: string, win?: InAppNavigationWindow | undefined): boolean;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
//#region src/shared/navigation/inAppPath.ts
|
|
2
|
+
function e(e) {
|
|
3
|
+
if (typeof e != "string" || !e.startsWith("/") || e.startsWith("//") || e.startsWith("/\\")) return !1;
|
|
4
|
+
for (let t = 0; t < e.length; t += 1) {
|
|
5
|
+
let n = e.charCodeAt(t);
|
|
6
|
+
if (n < 32 || n === 127) return !1;
|
|
7
|
+
}
|
|
8
|
+
return !0;
|
|
9
|
+
}
|
|
10
|
+
function t(t, n) {
|
|
11
|
+
if (typeof t != "string" || t.length === 0) return null;
|
|
12
|
+
if (t.startsWith("/")) return e(t) ? t : null;
|
|
13
|
+
let r;
|
|
14
|
+
try {
|
|
15
|
+
r = new URL(t);
|
|
16
|
+
} catch {
|
|
17
|
+
return null;
|
|
18
|
+
}
|
|
19
|
+
if (r.origin !== n) return null;
|
|
20
|
+
let i = `${r.pathname || "/"}${r.search}${r.hash}`;
|
|
21
|
+
return e(i) ? i : null;
|
|
22
|
+
}
|
|
23
|
+
function n(e, n = globalThis.window) {
|
|
24
|
+
if (!n) return !1;
|
|
25
|
+
let r = t(e, n.location.origin);
|
|
26
|
+
if (r === null) return !1;
|
|
27
|
+
n.history.pushState(null, "", r);
|
|
28
|
+
let i = typeof PopStateEvent == "function" ? new PopStateEvent("popstate", { state: null }) : new Event("popstate");
|
|
29
|
+
return n.dispatchEvent(i), !0;
|
|
30
|
+
}
|
|
31
|
+
//#endregion
|
|
32
|
+
export { e as isSafeInAppPath, n as navigateInApp };
|