@athenaintel/react 0.59.0 → 0.60.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/README.md +124 -20
- package/dist/agent-runtime/src/client-tool-bridge.cjs +20 -2
- package/dist/agent-runtime/src/client-tool-bridge.cjs.map +1 -1
- package/dist/agent-runtime/src/client-tool-bridge.d.ts +9 -4
- package/dist/agent-runtime/src/client-tool-bridge.js +20 -2
- package/dist/agent-runtime/src/client-tool-bridge.js.map +1 -1
- package/dist/agent-runtime/src/client-tools.cjs.map +1 -1
- package/dist/agent-runtime/src/client-tools.d.ts +9 -0
- package/dist/agent-runtime/src/client-tools.js.map +1 -1
- package/dist/agent-runtime/src/composer-markdown.cjs +0 -16
- package/dist/agent-runtime/src/composer-markdown.cjs.map +1 -1
- package/dist/agent-runtime/src/composer-markdown.js +1 -17
- package/dist/agent-runtime/src/composer-markdown.js.map +1 -1
- package/dist/agent-runtime/src/named-agents.js +1 -1
- package/dist/agent-runtime/src/offline-status.cjs.map +1 -1
- package/dist/agent-runtime/src/offline-status.d.ts +27 -0
- package/dist/agent-runtime/src/offline-status.js.map +1 -1
- package/dist/agent-runtime/src/tool-metadata.cjs +7 -0
- package/dist/agent-runtime/src/tool-metadata.cjs.map +1 -1
- package/dist/agent-runtime/src/tool-metadata.js +7 -0
- package/dist/agent-runtime/src/tool-metadata.js.map +1 -1
- package/dist/chat/AthenaChat.cjs +17 -5
- package/dist/chat/AthenaChat.cjs.map +1 -1
- package/dist/chat/AthenaChat.js +18 -6
- package/dist/chat/AthenaChat.js.map +1 -1
- package/dist/chat/StatewireClientToolBridge.cjs +69 -1
- package/dist/chat/StatewireClientToolBridge.cjs.map +1 -1
- package/dist/chat/StatewireClientToolBridge.d.ts +14 -1
- package/dist/chat/StatewireClientToolBridge.js +70 -2
- package/dist/chat/StatewireClientToolBridge.js.map +1 -1
- package/dist/chat/StatewireClientToolConsentCard.cjs +65 -0
- package/dist/chat/StatewireClientToolConsentCard.cjs.map +1 -0
- package/dist/chat/StatewireClientToolConsentCard.d.ts +24 -0
- package/dist/chat/StatewireClientToolConsentCard.js +65 -0
- package/dist/chat/StatewireClientToolConsentCard.js.map +1 -0
- package/dist/chat/client-tool-write-consent.cjs +111 -0
- package/dist/chat/client-tool-write-consent.cjs.map +1 -0
- package/dist/chat/client-tool-write-consent.d.ts +71 -0
- package/dist/chat/client-tool-write-consent.js +111 -0
- package/dist/chat/client-tool-write-consent.js.map +1 -0
- package/dist/chat/statewire-client-tools.cjs +30 -5
- package/dist/chat/statewire-client-tools.cjs.map +1 -1
- package/dist/chat/statewire-client-tools.d.ts +34 -2
- package/dist/chat/statewire-client-tools.js +30 -5
- package/dist/chat/statewire-client-tools.js.map +1 -1
- package/dist/chat-ui/index.cjs +2 -0
- package/dist/chat-ui/index.cjs.map +1 -1
- package/dist/chat-ui/index.d.ts +1 -0
- package/dist/chat-ui/index.js +2 -0
- package/dist/chat-ui/index.js.map +1 -1
- package/dist/chat-ui/mentions/mention-chip.cjs +9 -3
- package/dist/chat-ui/mentions/mention-chip.cjs.map +1 -1
- package/dist/chat-ui/mentions/mention-chip.js +9 -3
- package/dist/chat-ui/mentions/mention-chip.js.map +1 -1
- package/dist/chat-ui/mentions/suggestions/components/mention-icon.cjs +18 -2
- package/dist/chat-ui/mentions/suggestions/components/mention-icon.cjs.map +1 -1
- package/dist/chat-ui/mentions/suggestions/components/mention-icon.d.ts +10 -1
- package/dist/chat-ui/mentions/suggestions/components/mention-icon.js +19 -3
- package/dist/chat-ui/mentions/suggestions/components/mention-icon.js.map +1 -1
- package/dist/chat-ui/mentions/suggestions/data/api-client.cjs +9 -0
- package/dist/chat-ui/mentions/suggestions/data/api-client.cjs.map +1 -1
- package/dist/chat-ui/mentions/suggestions/data/api-client.d.ts +6 -0
- package/dist/chat-ui/mentions/suggestions/data/api-client.js +9 -0
- package/dist/chat-ui/mentions/suggestions/data/api-client.js.map +1 -1
- package/dist/chat-ui/mentions/suggestions/data/sources/asset-type-icon-names.generated.cjs +89 -0
- package/dist/chat-ui/mentions/suggestions/data/sources/asset-type-icon-names.generated.cjs.map +1 -0
- package/dist/chat-ui/mentions/suggestions/data/sources/asset-type-icon-names.generated.d.ts +8 -0
- package/dist/chat-ui/mentions/suggestions/data/sources/asset-type-icon-names.generated.js +89 -0
- package/dist/chat-ui/mentions/suggestions/data/sources/asset-type-icon-names.generated.js.map +1 -0
- package/dist/chat-ui/mentions/suggestions/data/sources/asset-type-icons.cjs +153 -116
- package/dist/chat-ui/mentions/suggestions/data/sources/asset-type-icons.cjs.map +1 -1
- package/dist/chat-ui/mentions/suggestions/data/sources/asset-type-icons.d.ts +58 -12
- package/dist/chat-ui/mentions/suggestions/data/sources/asset-type-icons.js +154 -117
- package/dist/chat-ui/mentions/suggestions/data/sources/asset-type-icons.js.map +1 -1
- package/dist/chat-ui/mentions/suggestions/data/sources/index.cjs +38 -6
- package/dist/chat-ui/mentions/suggestions/data/sources/index.cjs.map +1 -1
- package/dist/chat-ui/mentions/suggestions/data/sources/index.js +40 -8
- package/dist/chat-ui/mentions/suggestions/data/sources/index.js.map +1 -1
- package/dist/chat-ui/mentions/use-asset-icon-app-url.cjs +13 -0
- package/dist/chat-ui/mentions/use-asset-icon-app-url.cjs.map +1 -0
- package/dist/chat-ui/mentions/use-asset-icon-app-url.d.ts +9 -0
- package/dist/chat-ui/mentions/use-asset-icon-app-url.js +13 -0
- package/dist/chat-ui/mentions/use-asset-icon-app-url.js.map +1 -0
- package/dist/chat-ui/statewire.cjs +4 -0
- package/dist/chat-ui/statewire.cjs.map +1 -1
- package/dist/chat-ui/statewire.d.ts +2 -0
- package/dist/chat-ui/statewire.js +4 -0
- package/dist/chat-ui/statewire.js.map +1 -1
- package/dist/collab/client.cjs +24 -1
- package/dist/collab/client.cjs.map +1 -1
- package/dist/collab/client.d.ts +16 -0
- package/dist/collab/client.js +24 -1
- package/dist/collab/client.js.map +1 -1
- package/dist/composer/attached-references.js +1 -1
- package/dist/composer/staged-message-metadata.cjs +12 -0
- package/dist/composer/staged-message-metadata.cjs.map +1 -0
- package/dist/composer/staged-message-metadata.d.ts +15 -0
- package/dist/composer/staged-message-metadata.js +12 -0
- package/dist/composer/staged-message-metadata.js.map +1 -0
- package/dist/data/athena-request.cjs +2 -0
- package/dist/data/athena-request.cjs.map +1 -1
- package/dist/data/athena-request.js +2 -0
- package/dist/data/athena-request.js.map +1 -1
- package/dist/index.cjs +5 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +6 -2
- package/dist/index.js +6 -1
- package/dist/index.js.map +1 -1
- package/dist/provider/AthenaProvider.cjs +26 -6
- package/dist/provider/AthenaProvider.cjs.map +1 -1
- package/dist/provider/AthenaProvider.d.ts +8 -1
- package/dist/provider/AthenaProvider.js +27 -7
- package/dist/provider/AthenaProvider.js.map +1 -1
- package/dist/react/package.json.cjs +1 -1
- package/dist/react/package.json.js +1 -1
- package/dist/references/src/anchors/parse.cjs +11 -1
- package/dist/references/src/anchors/parse.cjs.map +1 -1
- package/dist/references/src/anchors/parse.js +11 -1
- package/dist/references/src/anchors/parse.js.map +1 -1
- package/dist/references/src/anchors/schemas.d.ts +1 -0
- package/dist/references/src/anchors/serialize.cjs +1 -0
- package/dist/references/src/anchors/serialize.cjs.map +1 -1
- package/dist/references/src/anchors/serialize.js +1 -0
- package/dist/references/src/anchors/serialize.js.map +1 -1
- package/dist/references/src/anchors/types.cjs.map +1 -1
- package/dist/references/src/anchors/types.d.ts +9 -0
- package/dist/references/src/anchors/types.js.map +1 -1
- package/dist/references/src/schemas.d.ts +2 -0
- package/dist/runtime/useAthenaStatewireRuntime.cjs +6 -8
- package/dist/runtime/useAthenaStatewireRuntime.cjs.map +1 -1
- package/dist/runtime/useAthenaStatewireRuntime.js +6 -8
- package/dist/runtime/useAthenaStatewireRuntime.js.map +1 -1
- package/dist/threads/statewire-thread-list.cjs +14 -2
- package/dist/threads/statewire-thread-list.cjs.map +1 -1
- package/dist/threads/statewire-thread-list.d.ts +11 -2
- package/dist/threads/statewire-thread-list.js +14 -2
- package/dist/threads/statewire-thread-list.js.map +1 -1
- package/dist/tools/drive-tool-uis.cjs +8 -4
- package/dist/tools/drive-tool-uis.cjs.map +1 -1
- package/dist/tools/drive-tool-uis.d.ts +5 -4
- package/dist/tools/drive-tool-uis.js +9 -5
- package/dist/tools/drive-tool-uis.js.map +1 -1
- package/dist/version.cjs +4 -0
- package/dist/version.cjs.map +1 -1
- package/dist/version.d.ts +9 -0
- package/dist/version.js +4 -0
- package/dist/version.js.map +1 -1
- package/dist/workbench/live-desktop-api.cjs +2 -1
- package/dist/workbench/live-desktop-api.cjs.map +1 -1
- package/dist/workbench/live-desktop-api.js +2 -1
- package/dist/workbench/live-desktop-api.js.map +1 -1
- package/dist/workbench/session-workspace-api.cjs +7 -2
- package/dist/workbench/session-workspace-api.cjs.map +1 -1
- package/dist/workbench/session-workspace-api.d.ts +10 -0
- package/dist/workbench/session-workspace-api.js +7 -2
- package/dist/workbench/session-workspace-api.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,133 +1,170 @@
|
|
|
1
|
-
|
|
1
|
+
import { athenaLinkAppUrl } from "../../../../../lib/athena-urls.js";
|
|
2
|
+
import { ASSET_TYPE_ICON_NAMES, DEFAULT_ASSET_TYPE_ICON } from "./asset-type-icon-names.generated.js";
|
|
3
|
+
let hostIconBasePath = null;
|
|
2
4
|
function configureAssetIconBasePath({
|
|
3
5
|
basePath
|
|
4
6
|
}) {
|
|
5
|
-
|
|
7
|
+
hostIconBasePath = basePath ? basePath.replace(/\/*$/, "/") : null;
|
|
8
|
+
}
|
|
9
|
+
function currentPageOrigin() {
|
|
10
|
+
return typeof window === "undefined" ? null : window.location.origin;
|
|
11
|
+
}
|
|
12
|
+
function assetIconAppUrl({
|
|
13
|
+
appUrl,
|
|
14
|
+
backendUrl,
|
|
15
|
+
pageOrigin = currentPageOrigin()
|
|
16
|
+
}) {
|
|
17
|
+
if (!appUrl) return null;
|
|
18
|
+
return athenaLinkAppUrl({ appUrl, backendUrl: backendUrl ?? "", pageOrigin });
|
|
19
|
+
}
|
|
20
|
+
function athenaAppAssetIconBasePath({
|
|
21
|
+
appUrl
|
|
22
|
+
}) {
|
|
23
|
+
if (!(appUrl == null ? void 0 : appUrl.trim())) return null;
|
|
24
|
+
try {
|
|
25
|
+
const base = new URL("/assets/icons/files/", appUrl);
|
|
26
|
+
return base.protocol === "https:" || base.protocol === "http:" ? base.toString() : null;
|
|
27
|
+
} catch {
|
|
28
|
+
return null;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
const FILES_DIR = "files/";
|
|
32
|
+
function iconUrl({
|
|
33
|
+
icon,
|
|
34
|
+
appUrl
|
|
35
|
+
}) {
|
|
36
|
+
const appBasePath = athenaAppAssetIconBasePath({ appUrl });
|
|
37
|
+
if (/^ic[-_]/.test(icon)) {
|
|
38
|
+
const basePath = hostIconBasePath ?? appBasePath;
|
|
39
|
+
return basePath ? `${basePath}${icon}.svg` : void 0;
|
|
40
|
+
}
|
|
41
|
+
const filesBasePath = appBasePath ?? hostIconBasePath;
|
|
42
|
+
if (!filesBasePath) return void 0;
|
|
43
|
+
return filesBasePath.endsWith(`/${FILES_DIR}`) ? `${filesBasePath.slice(0, -FILES_DIR.length)}apps/${icon}.svg` : `${filesBasePath}${icon}.svg`;
|
|
44
|
+
}
|
|
45
|
+
function assetTypeIconName(assetType) {
|
|
46
|
+
const key = assetType == null ? void 0 : assetType.toLowerCase();
|
|
47
|
+
return key && Object.hasOwn(ASSET_TYPE_ICON_NAMES, key) ? ASSET_TYPE_ICON_NAMES[key] ?? DEFAULT_ASSET_TYPE_ICON : DEFAULT_ASSET_TYPE_ICON;
|
|
48
|
+
}
|
|
49
|
+
function assetTypeToThumb(assetType, { appUrl } = {}) {
|
|
50
|
+
return iconUrl({ icon: assetTypeIconName(assetType), appUrl });
|
|
51
|
+
}
|
|
52
|
+
const EMAIL_ASSET_TYPES = /* @__PURE__ */ new Set([
|
|
53
|
+
"email",
|
|
54
|
+
"email_draft",
|
|
55
|
+
"email_message",
|
|
56
|
+
"live_email_thread"
|
|
57
|
+
]);
|
|
58
|
+
function isEmailAssetType(assetType) {
|
|
59
|
+
return !!assetType && EMAIL_ASSET_TYPES.has(assetType.toLowerCase());
|
|
60
|
+
}
|
|
61
|
+
function recordOf(value) {
|
|
62
|
+
return value && typeof value === "object" && !Array.isArray(value) ? value : null;
|
|
63
|
+
}
|
|
64
|
+
const LANE_PREFIX = /^paragon_/;
|
|
65
|
+
const LANE_SUFFIX = /_(direct(_v\d+)?|paragon|live)$/;
|
|
66
|
+
function mailboxLogo(metadata) {
|
|
67
|
+
var _a, _b, _c;
|
|
68
|
+
const record = recordOf(metadata);
|
|
69
|
+
if (!record) return null;
|
|
70
|
+
const provider = ((_a = recordOf(record.liveAsset)) == null ? void 0 : _a.provider) ?? ((_b = recordOf(record.email)) == null ? void 0 : _b.provider) ?? ((_c = recordOf(record.email_draft)) == null ? void 0 : _c.provider);
|
|
71
|
+
if (typeof provider !== "string") return null;
|
|
72
|
+
const name = provider.trim().toLowerCase().replace(LANE_PREFIX, "").replace(LANE_SUFFIX, "");
|
|
73
|
+
if (name === "gmail" || name === "google") return "gmail";
|
|
74
|
+
if (name === "outlook" || name === "microsoft_graph") return "outlook";
|
|
75
|
+
return null;
|
|
76
|
+
}
|
|
77
|
+
function emailProviderThumb({
|
|
78
|
+
assetType,
|
|
79
|
+
metadata,
|
|
80
|
+
appUrl
|
|
81
|
+
}) {
|
|
82
|
+
if (!isEmailAssetType(assetType)) return void 0;
|
|
83
|
+
const logo = mailboxLogo(metadata);
|
|
84
|
+
return logo ? iconUrl({ icon: logo, appUrl }) : void 0;
|
|
6
85
|
}
|
|
7
|
-
const ASSET_TYPE_ICON_FILE = {
|
|
8
|
-
// Documents
|
|
9
|
-
folder: "ic-folder",
|
|
10
|
-
txt: "ic-txt",
|
|
11
|
-
document: "ic-word",
|
|
12
|
-
word_document: "ic-word",
|
|
13
|
-
markdown: "ic-md",
|
|
14
|
-
pdf: "ic-pdf",
|
|
15
|
-
html: "ic-html",
|
|
16
|
-
web_page: "ic-html",
|
|
17
|
-
yaml: "ic-yaml",
|
|
18
|
-
json: "ic-json",
|
|
19
|
-
// Spreadsheets
|
|
20
|
-
spreadsheet: "ic-excel",
|
|
21
|
-
table: "ic-table",
|
|
22
|
-
// Media
|
|
23
|
-
image: "ic-img",
|
|
24
|
-
audio: "ic-audio",
|
|
25
|
-
video: "ic-video",
|
|
26
|
-
voice_memo: "ic-voice_memo",
|
|
27
|
-
// Presentations: the deck under its canonical `presentation` type, its
|
|
28
|
-
// pre-2026-09-21 spelling (still on the wire and in persisted references)
|
|
29
|
-
// and the pre-split label; plus the raw upload.
|
|
30
|
-
powerpoint_deck: "ic-power_point",
|
|
31
|
-
presentation: "ic-power_point",
|
|
32
|
-
presentation_pptx_studio: "ic-power_point",
|
|
33
|
-
pptx: "ic-power_point",
|
|
34
|
-
// Email & Calendar
|
|
35
|
-
email: "ic-mail",
|
|
36
|
-
email_message: "ic-mail",
|
|
37
|
-
live_email_thread: "ic-mail",
|
|
38
|
-
live_calendar_event: "ic-mail",
|
|
39
|
-
// Code
|
|
40
|
-
python: "ic-py",
|
|
41
|
-
javascript: "ic-js",
|
|
42
|
-
typescript: "ic-code",
|
|
43
|
-
jsx: "ic-code",
|
|
44
|
-
tsx: "ic-code",
|
|
45
|
-
css: "ic-code",
|
|
46
|
-
java: "ic-code",
|
|
47
|
-
c: "ic-code",
|
|
48
|
-
cpp: "ic-code",
|
|
49
|
-
csharp: "ic-code",
|
|
50
|
-
ruby: "ic-code",
|
|
51
|
-
go: "ic-code",
|
|
52
|
-
swift: "ic-code",
|
|
53
|
-
php: "ic-code",
|
|
54
|
-
rust: "ic-code",
|
|
55
|
-
vue: "ic-code",
|
|
56
|
-
// Structured data
|
|
57
|
-
database: "ic-snippet",
|
|
58
|
-
schema: "ic-schema",
|
|
59
|
-
catalog: "ic-db",
|
|
60
|
-
drive: "ic-db",
|
|
61
|
-
query_snippet: "ic-snippet",
|
|
62
|
-
semantic_model: "ic-db",
|
|
63
|
-
dataset: "ic-db",
|
|
64
|
-
// Meetings & Calls
|
|
65
|
-
meeting: "ic-meeting",
|
|
66
|
-
video_session: "ic-meeting",
|
|
67
|
-
phone_call: "ic-phonecall",
|
|
68
|
-
// Sessions & Devices
|
|
69
|
-
session: "ic-session",
|
|
70
|
-
browse_session: "ic-html",
|
|
71
|
-
computer: "ic-computer",
|
|
72
|
-
desktop_session: "ic-desktop_session",
|
|
73
|
-
mobile_session: "ic-mobile_session",
|
|
74
|
-
// Projects & Profiles
|
|
75
|
-
project: "ic-project",
|
|
76
|
-
browse_profile: "ic-profile",
|
|
77
|
-
// Workflows & Automation
|
|
78
|
-
aop: "ic-flow",
|
|
79
|
-
playbook: "ic-playbook",
|
|
80
|
-
policy: "ic-policy",
|
|
81
|
-
transform_project: "ic-transform_project",
|
|
82
|
-
// Collections & Notebooks
|
|
83
|
-
collection: "ic-collection",
|
|
84
|
-
notebook: "ic-notebook",
|
|
85
|
-
// UI & Apps
|
|
86
|
-
user_interface: "ic-app",
|
|
87
|
-
application: "ic-application",
|
|
88
|
-
canvas: "ic-canvas",
|
|
89
|
-
dashboard: "ic-dashboard",
|
|
90
|
-
figure: "ic_figure",
|
|
91
|
-
// People & Companies
|
|
92
|
-
person: "ic-person",
|
|
93
|
-
company: "ic-company",
|
|
94
|
-
// Misc
|
|
95
|
-
prompt: "ic-ai",
|
|
96
|
-
skill: "ic-skill",
|
|
97
|
-
spaces: "ic-spaces",
|
|
98
|
-
secret: "ic-secret",
|
|
99
|
-
photoshop: "ic-pts",
|
|
100
|
-
illustrator: "ic-ai",
|
|
101
|
-
// Google Drive / SharePoint / Salesforce
|
|
102
|
-
gdrive_folder: "ic-folder",
|
|
103
|
-
gdrive_file: "ic-file",
|
|
104
|
-
salesforce_record: "ic-db",
|
|
105
|
-
salesforce_file: "ic-db"
|
|
106
|
-
};
|
|
107
86
|
const ASSET_TYPE_LUCIDE_FALLBACK = {
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
image: "image",
|
|
111
|
-
video: "video",
|
|
87
|
+
aop: "workflow",
|
|
88
|
+
application: "layout-grid",
|
|
112
89
|
audio: "headphones",
|
|
113
|
-
|
|
90
|
+
automation: "zap",
|
|
91
|
+
browse_profile: "globe",
|
|
92
|
+
browse_session: "globe",
|
|
93
|
+
canvas: "palette",
|
|
94
|
+
catalog: "database",
|
|
95
|
+
collab_agent: "bot",
|
|
96
|
+
collab_source: "database",
|
|
97
|
+
collab_toolkit: "package",
|
|
98
|
+
collection: "library",
|
|
99
|
+
computer: "monitor",
|
|
100
|
+
dashboard: "layout-dashboard",
|
|
114
101
|
database: "database",
|
|
115
|
-
|
|
102
|
+
design_system: "palette",
|
|
103
|
+
desktop_session: "monitor",
|
|
104
|
+
device: "smartphone",
|
|
105
|
+
document: "file-text",
|
|
106
|
+
drive: "hard-drive",
|
|
107
|
+
email: "mail",
|
|
108
|
+
email_draft: "mail",
|
|
109
|
+
email_message: "mail",
|
|
110
|
+
environment: "server",
|
|
111
|
+
figure: "chart-bar",
|
|
112
|
+
folder: "folder",
|
|
113
|
+
gdrive_folder: "folder",
|
|
114
|
+
generic_doc: "file-text",
|
|
115
|
+
image: "image",
|
|
116
|
+
json: "file-code",
|
|
117
|
+
lakehouse_namespace: "database",
|
|
118
|
+
lakehouse_sync: "workflow",
|
|
119
|
+
lakehouse_table: "table",
|
|
120
|
+
live_calendar_event: "calendar",
|
|
121
|
+
live_email_thread: "mail",
|
|
122
|
+
markdown: "file-text",
|
|
116
123
|
meeting: "video",
|
|
117
|
-
|
|
124
|
+
mobile_session: "smartphone",
|
|
125
|
+
notebook: "book-open",
|
|
126
|
+
olympus_drive: "hard-drive",
|
|
127
|
+
pdf: "file-text",
|
|
128
|
+
person: "user",
|
|
129
|
+
phone_call: "phone",
|
|
130
|
+
playbook: "book-open",
|
|
131
|
+
policy: "check-square",
|
|
132
|
+
powerpoint_deck: "presentation",
|
|
133
|
+
pptx: "presentation",
|
|
134
|
+
presentation: "presentation",
|
|
135
|
+
presentation_pptx_studio: "presentation",
|
|
136
|
+
project: "folder-kanban",
|
|
137
|
+
python: "file-code",
|
|
138
|
+
query_snippet: "database",
|
|
139
|
+
script: "file-code",
|
|
140
|
+
secret: "key",
|
|
141
|
+
semantic_model: "database",
|
|
142
|
+
session: "message-square",
|
|
143
|
+
skill: "sparkles",
|
|
144
|
+
spreadsheet: "sheet",
|
|
145
|
+
table: "table",
|
|
146
|
+
transform_project: "workflow",
|
|
147
|
+
txt: "file-text",
|
|
148
|
+
user_interface: "layout",
|
|
149
|
+
video: "video",
|
|
150
|
+
video_session: "video",
|
|
151
|
+
voice_memo: "mic",
|
|
152
|
+
web_page: "globe",
|
|
153
|
+
word_document: "file-text",
|
|
154
|
+
yaml: "file-code"
|
|
118
155
|
};
|
|
119
|
-
function assetTypeToThumb(assetType) {
|
|
120
|
-
if (!iconBasePath) return void 0;
|
|
121
|
-
const name = (assetType ? ASSET_TYPE_ICON_FILE[assetType.toLowerCase()] : void 0) ?? "ic-file";
|
|
122
|
-
return `${iconBasePath}${name}.svg`;
|
|
123
|
-
}
|
|
124
156
|
function assetTypeToIcon(assetType) {
|
|
125
|
-
|
|
126
|
-
|
|
157
|
+
const key = assetType == null ? void 0 : assetType.toLowerCase();
|
|
158
|
+
if (!key || !Object.hasOwn(ASSET_TYPE_LUCIDE_FALLBACK, key)) return "file";
|
|
159
|
+
return ASSET_TYPE_LUCIDE_FALLBACK[key] ?? "file";
|
|
127
160
|
}
|
|
128
161
|
export {
|
|
162
|
+
assetIconAppUrl,
|
|
129
163
|
assetTypeToIcon,
|
|
130
164
|
assetTypeToThumb,
|
|
131
|
-
|
|
165
|
+
athenaAppAssetIconBasePath,
|
|
166
|
+
configureAssetIconBasePath,
|
|
167
|
+
emailProviderThumb,
|
|
168
|
+
isEmailAssetType
|
|
132
169
|
};
|
|
133
170
|
//# sourceMappingURL=asset-type-icons.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"asset-type-icons.js","sources":["../../../../../../src/chat-ui/mentions/suggestions/data/sources/asset-type-icons.ts"],"sourcesContent":["/**\n * Maps Athena asset types to SVG icon file names.\n *\n * The SVG files are bundled by the host app, which declares where they are\n * served from via `configureAssetIconBasePath`. Hosts that don't bundle them\n * fall back to the Lucide icons carried on every menu item.\n */\n\nlet iconBasePath: string | null = null;\n\n/**\n * Point the mention UI at the host's copy of the asset-type SVGs.\n * `basePath` is resolved against the host document; a trailing \"/\" is added\n * when the caller omits it.\n */\nexport function configureAssetIconBasePath({\n basePath,\n}: {\n basePath: string | null;\n}): void {\n iconBasePath = basePath ? basePath.replace(/\\/*$/, \"/\") : basePath;\n}\n\nconst ASSET_TYPE_ICON_FILE: Record<string, string> = {\n // Documents\n folder: \"ic-folder\",\n txt: \"ic-txt\",\n document: \"ic-word\",\n word_document: \"ic-word\",\n markdown: \"ic-md\",\n pdf: \"ic-pdf\",\n html: \"ic-html\",\n web_page: \"ic-html\",\n yaml: \"ic-yaml\",\n json: \"ic-json\",\n\n // Spreadsheets\n spreadsheet: \"ic-excel\",\n table: \"ic-table\",\n\n // Media\n image: \"ic-img\",\n audio: \"ic-audio\",\n video: \"ic-video\",\n voice_memo: \"ic-voice_memo\",\n\n // Presentations: the deck under its canonical `presentation` type, its\n // pre-2026-09-21 spelling (still on the wire and in persisted references)\n // and the pre-split label; plus the raw upload.\n powerpoint_deck: \"ic-power_point\",\n presentation: \"ic-power_point\",\n presentation_pptx_studio: \"ic-power_point\",\n pptx: \"ic-power_point\",\n\n // Email & Calendar\n email: \"ic-mail\",\n email_message: \"ic-mail\",\n live_email_thread: \"ic-mail\",\n live_calendar_event: \"ic-mail\",\n\n // Code\n python: \"ic-py\",\n javascript: \"ic-js\",\n typescript: \"ic-code\",\n jsx: \"ic-code\",\n tsx: \"ic-code\",\n css: \"ic-code\",\n java: \"ic-code\",\n c: \"ic-code\",\n cpp: \"ic-code\",\n csharp: \"ic-code\",\n ruby: \"ic-code\",\n go: \"ic-code\",\n swift: \"ic-code\",\n php: \"ic-code\",\n rust: \"ic-code\",\n vue: \"ic-code\",\n\n // Structured data\n database: \"ic-snippet\",\n schema: \"ic-schema\",\n catalog: \"ic-db\",\n drive: \"ic-db\",\n query_snippet: \"ic-snippet\",\n semantic_model: \"ic-db\",\n dataset: \"ic-db\",\n\n // Meetings & Calls\n meeting: \"ic-meeting\",\n video_session: \"ic-meeting\",\n phone_call: \"ic-phonecall\",\n\n // Sessions & Devices\n session: \"ic-session\",\n browse_session: \"ic-html\",\n computer: \"ic-computer\",\n desktop_session: \"ic-desktop_session\",\n mobile_session: \"ic-mobile_session\",\n\n // Projects & Profiles\n project: \"ic-project\",\n browse_profile: \"ic-profile\",\n\n // Workflows & Automation\n aop: \"ic-flow\",\n playbook: \"ic-playbook\",\n policy: \"ic-policy\",\n transform_project: \"ic-transform_project\",\n\n // Collections & Notebooks\n collection: \"ic-collection\",\n notebook: \"ic-notebook\",\n\n // UI & Apps\n user_interface: \"ic-app\",\n application: \"ic-application\",\n canvas: \"ic-canvas\",\n dashboard: \"ic-dashboard\",\n figure: \"ic_figure\",\n\n // People & Companies\n person: \"ic-person\",\n company: \"ic-company\",\n\n // Misc\n prompt: \"ic-ai\",\n skill: \"ic-skill\",\n spaces: \"ic-spaces\",\n secret: \"ic-secret\",\n photoshop: \"ic-pts\",\n illustrator: \"ic-ai\",\n\n // Google Drive / SharePoint / Salesforce\n gdrive_folder: \"ic-folder\",\n gdrive_file: \"ic-file\",\n salesforce_record: \"ic-db\",\n salesforce_file: \"ic-db\",\n};\n\nconst ASSET_TYPE_LUCIDE_FALLBACK: Record<string, string> = {\n folder: \"folder\",\n spreadsheet: \"sheet\",\n image: \"image\",\n video: \"video\",\n audio: \"headphones\",\n email: \"mail\",\n database: \"database\",\n project: \"folder-kanban\",\n meeting: \"video\",\n user_interface: \"layout\",\n};\n\n/**\n * Get the SVG thumbnail URL for an Athena asset type, or undefined when the\n * host app does not bundle the icon files.\n */\nexport function assetTypeToThumb(\n assetType: string | null | undefined,\n): string | undefined {\n if (!iconBasePath) return undefined;\n const name: string =\n (assetType ? ASSET_TYPE_ICON_FILE[assetType.toLowerCase()] : undefined) ??\n \"ic-file\";\n return `${iconBasePath}${name}.svg`;\n}\n\n/**\n * Get Lucide icon name fallback for an asset type.\n * Used when thumbnailUrl can't load.\n */\nexport function assetTypeToIcon(assetType: string | null | undefined): string {\n if (!assetType) return \"file\";\n return ASSET_TYPE_LUCIDE_FALLBACK[assetType.toLowerCase()] ?? \"file\";\n}\n"],"names":[],"mappings":"AAQA,IAAI,eAA8B;AAO3B,SAAS,2BAA2B;AAAA,EACzC;AACF,GAES;AACP,iBAAe,WAAW,SAAS,QAAQ,QAAQ,GAAG,IAAI;AAC5D;AAEA,MAAM,uBAA+C;AAAA;AAAA,EAEnD,QAAQ;AAAA,EACR,KAAK;AAAA,EACL,UAAU;AAAA,EACV,eAAe;AAAA,EACf,UAAU;AAAA,EACV,KAAK;AAAA,EACL,MAAM;AAAA,EACN,UAAU;AAAA,EACV,MAAM;AAAA,EACN,MAAM;AAAA;AAAA,EAGN,aAAa;AAAA,EACb,OAAO;AAAA;AAAA,EAGP,OAAO;AAAA,EACP,OAAO;AAAA,EACP,OAAO;AAAA,EACP,YAAY;AAAA;AAAA;AAAA;AAAA,EAKZ,iBAAiB;AAAA,EACjB,cAAc;AAAA,EACd,0BAA0B;AAAA,EAC1B,MAAM;AAAA;AAAA,EAGN,OAAO;AAAA,EACP,eAAe;AAAA,EACf,mBAAmB;AAAA,EACnB,qBAAqB;AAAA;AAAA,EAGrB,QAAQ;AAAA,EACR,YAAY;AAAA,EACZ,YAAY;AAAA,EACZ,KAAK;AAAA,EACL,KAAK;AAAA,EACL,KAAK;AAAA,EACL,MAAM;AAAA,EACN,GAAG;AAAA,EACH,KAAK;AAAA,EACL,QAAQ;AAAA,EACR,MAAM;AAAA,EACN,IAAI;AAAA,EACJ,OAAO;AAAA,EACP,KAAK;AA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,UAAW,QAAO;AACvB,SAAO,2BAA2B,UAAU,YAAA,CAAa,KAAK;AAChE;"}
|
|
1
|
+
{"version":3,"file":"asset-type-icons.js","sources":["../../../../../../src/chat-ui/mentions/suggestions/data/sources/asset-type-icons.ts"],"sourcesContent":["/**\n * Athena's asset-type icons: the SVG Olympus draws for each asset type.\n *\n * The type → icon table is Olympus's own: `ASSET_TYPE_ICON_NAMES`\n * (`asset-type-icon-names.generated.ts`), generated from its\n * `AthenaTypeToThumb` by Olympus's parity test, which writes the same table\n * into `@athenaintel/sheets` and fails when either drifts. So the `@` menu, the\n * mention chips and the drive cards draw the icon Olympus draws for every type.\n *\n * Where the SVGs load from:\n * - type glyphs (`ic-…`): a host's own copy when it names one with\n * `configureAssetIconBasePath` (the Chrome extension), else the Athena web\n * app the chat talks to (`appUrl`, the provider's: `useAssetIconAppUrl`),\n * which serves the public files Olympus draws at `<appUrl>/assets/icons/files/`;\n * - brand logos (Power BI, Slack, Gmail, Outlook) sit in `apps/` beside them:\n * from that app when the chat names one (a host's copy may carry only the\n * glyphs), else beside the host's copy.\n *\n * With neither there is no SVG, and callers draw the type's Lucide icon\n * (`assetTypeToIcon`). `MentionIcon`, the chips and the drive cards also fall\n * back to it when an SVG cannot load (a strict CSP, offline).\n */\n\nimport { athenaLinkAppUrl } from \"../../../../../lib/athena-urls\";\nimport {\n ASSET_TYPE_ICON_NAMES,\n DEFAULT_ASSET_TYPE_ICON,\n} from \"./asset-type-icon-names.generated\";\n\nlet hostIconBasePath: string | null = null;\n\n/**\n * Point the asset-type icons at the host's own copy of Olympus's\n * `assets/icons/files/` SVGs. `basePath` is resolved against the host\n * document; a trailing \"/\" is added when the caller omits it. `null` drops the\n * host copy: the icons then load from the Athena web app the chat talks to.\n */\nexport function configureAssetIconBasePath({\n basePath,\n}: {\n basePath: string | null;\n}): void {\n hostIconBasePath = basePath ? basePath.replace(/\\/*$/, \"/\") : null;\n}\n\nfunction currentPageOrigin(): string | null {\n return typeof window === \"undefined\" ? null : window.location.origin;\n}\n\n/**\n * The Athena web app whose icons a chat draws: the provider's `appUrl`,\n * except in an app a computer serves, where Marathon's `/_athena/auth` mints\n * `appUrl` as the app's own origin (which serves no Athena icons) and the\n * deployment's frontend serves them, as for \"Open in Athena\" links\n * (`athenaLinkAppUrl`). Null without an `appUrl`.\n */\nexport function assetIconAppUrl({\n appUrl,\n backendUrl,\n pageOrigin = currentPageOrigin(),\n}: {\n appUrl: string | null | undefined;\n backendUrl: string | null | undefined;\n pageOrigin?: string | null;\n}): string | null {\n if (!appUrl) return null;\n return athenaLinkAppUrl({ appUrl, backendUrl: backendUrl ?? \"\", pageOrigin });\n}\n\n/** Where the Athena web app at `appUrl` serves the asset-type SVGs; null for an unusable URL. */\nexport function athenaAppAssetIconBasePath({\n appUrl,\n}: {\n appUrl: string | null | undefined;\n}): string | null {\n if (!appUrl?.trim()) return null;\n try {\n const base = new URL(\"/assets/icons/files/\", appUrl);\n return base.protocol === \"https:\" || base.protocol === \"http:\"\n ? base.toString()\n : null;\n } catch {\n return null;\n }\n}\n\nconst FILES_DIR = \"files/\";\n\n/** An icon's URL, from the host's copy or the chat's Athena web app (see the module doc). */\nfunction iconUrl({\n icon,\n appUrl,\n}: {\n icon: string;\n appUrl: string | null | undefined;\n}): string | undefined {\n const appBasePath = athenaAppAssetIconBasePath({ appUrl });\n if (/^ic[-_]/.test(icon)) {\n const basePath = hostIconBasePath ?? appBasePath;\n return basePath ? `${basePath}${icon}.svg` : undefined;\n }\n const filesBasePath = appBasePath ?? hostIconBasePath;\n if (!filesBasePath) return undefined;\n return filesBasePath.endsWith(`/${FILES_DIR}`)\n ? `${filesBasePath.slice(0, -FILES_DIR.length)}apps/${icon}.svg`\n : `${filesBasePath}${icon}.svg`;\n}\n\nfunction assetTypeIconName(assetType: string | null | undefined): string {\n const key = assetType?.toLowerCase();\n return key && Object.hasOwn(ASSET_TYPE_ICON_NAMES, key)\n ? (ASSET_TYPE_ICON_NAMES[key] ?? DEFAULT_ASSET_TYPE_ICON)\n : DEFAULT_ASSET_TYPE_ICON;\n}\n\n/**\n * The SVG URL of an asset type's icon, the one Olympus draws. `appUrl` is the\n * Athena web app the chat talks to (`useAssetIconAppUrl`); undefined when\n * neither it nor a host copy (`configureAssetIconBasePath`) is available.\n */\nexport function assetTypeToThumb(\n assetType: string | null | undefined,\n { appUrl }: { appUrl?: string | null } = {},\n): string | undefined {\n return iconUrl({ icon: assetTypeIconName(assetType), appUrl });\n}\n\nconst EMAIL_ASSET_TYPES: ReadonlySet<string> = new Set([\n \"email\",\n \"email_draft\",\n \"email_message\",\n \"live_email_thread\",\n]);\n\n/** Whether rows of this type can draw their mailbox's logo (`emailProviderThumb`). */\nexport function isEmailAssetType(assetType: string | null | undefined): boolean {\n return !!assetType && EMAIL_ASSET_TYPES.has(assetType.toLowerCase());\n}\n\nfunction recordOf(value: unknown): Record<string, unknown> | null {\n return value && typeof value === \"object\" && !Array.isArray(value)\n ? (value as Record<string, unknown>)\n : null;\n}\n\nconst LANE_PREFIX = /^paragon_/;\nconst LANE_SUFFIX = /_(direct(_v\\d+)?|paragon|live)$/;\n\n/** Gmail or Outlook, from the provider an email asset records; null for any other or none. */\nfunction mailboxLogo(metadata: unknown): \"gmail\" | \"outlook\" | null {\n const record = recordOf(metadata);\n if (!record) return null;\n const provider: unknown =\n recordOf(record.liveAsset)?.provider ??\n recordOf(record.email)?.provider ??\n recordOf(record.email_draft)?.provider;\n if (typeof provider !== \"string\") return null;\n const name = provider.trim().toLowerCase().replace(LANE_PREFIX, \"\").replace(LANE_SUFFIX, \"\");\n if (name === \"gmail\" || name === \"google\") return \"gmail\";\n if (name === \"outlook\" || name === \"microsoft_graph\") return \"outlook\";\n return null;\n}\n\n/**\n * The Gmail or Outlook logo for an email asset whose mailbox provider its\n * metadata records (`liveAsset.provider`, the `email` block agora writes\n * beside it, or a draft's `email_draft` block), as Olympus draws it;\n * undefined otherwise, for the type's mail icon.\n */\nexport function emailProviderThumb({\n assetType,\n metadata,\n appUrl,\n}: {\n assetType: string | null | undefined;\n metadata: unknown;\n /** The Athena web app the chat talks to (`useAssetIconAppUrl`). */\n appUrl?: string | null;\n}): string | undefined {\n if (!isEmailAssetType(assetType)) return undefined;\n const logo = mailboxLogo(metadata);\n return logo ? iconUrl({ icon: logo, appUrl }) : undefined;\n}\n\n/**\n * The Lucide icon (a `MentionIcon` name) drawn for an asset type when its SVG\n * is not available: no icon source, or the SVG failed to load.\n */\nconst ASSET_TYPE_LUCIDE_FALLBACK: Record<string, string> = {\n aop: \"workflow\",\n application: \"layout-grid\",\n audio: \"headphones\",\n automation: \"zap\",\n browse_profile: \"globe\",\n browse_session: \"globe\",\n canvas: \"palette\",\n catalog: \"database\",\n collab_agent: \"bot\",\n collab_source: \"database\",\n collab_toolkit: \"package\",\n collection: \"library\",\n computer: \"monitor\",\n dashboard: \"layout-dashboard\",\n database: \"database\",\n design_system: \"palette\",\n desktop_session: \"monitor\",\n device: \"smartphone\",\n document: \"file-text\",\n drive: \"hard-drive\",\n email: \"mail\",\n email_draft: \"mail\",\n email_message: \"mail\",\n environment: \"server\",\n figure: \"chart-bar\",\n folder: \"folder\",\n gdrive_folder: \"folder\",\n generic_doc: \"file-text\",\n image: \"image\",\n json: \"file-code\",\n lakehouse_namespace: \"database\",\n lakehouse_sync: \"workflow\",\n lakehouse_table: \"table\",\n live_calendar_event: \"calendar\",\n live_email_thread: \"mail\",\n markdown: \"file-text\",\n meeting: \"video\",\n mobile_session: \"smartphone\",\n notebook: \"book-open\",\n olympus_drive: \"hard-drive\",\n pdf: \"file-text\",\n person: \"user\",\n phone_call: \"phone\",\n playbook: \"book-open\",\n policy: \"check-square\",\n powerpoint_deck: \"presentation\",\n pptx: \"presentation\",\n presentation: \"presentation\",\n presentation_pptx_studio: \"presentation\",\n project: \"folder-kanban\",\n python: \"file-code\",\n query_snippet: \"database\",\n script: \"file-code\",\n secret: \"key\",\n semantic_model: \"database\",\n session: \"message-square\",\n skill: \"sparkles\",\n spreadsheet: \"sheet\",\n table: \"table\",\n transform_project: \"workflow\",\n txt: \"file-text\",\n user_interface: \"layout\",\n video: \"video\",\n video_session: \"video\",\n voice_memo: \"mic\",\n web_page: \"globe\",\n word_document: \"file-text\",\n yaml: \"file-code\",\n};\n\n/** The Lucide icon name for an asset type, drawn when its SVG is not available. */\nexport function assetTypeToIcon(assetType: string | null | undefined): string {\n const key = assetType?.toLowerCase();\n if (!key || !Object.hasOwn(ASSET_TYPE_LUCIDE_FALLBACK, key)) return \"file\";\n return ASSET_TYPE_LUCIDE_FALLBACK[key] ?? \"file\";\n}\n\n"],"names":[],"mappings":";;AA6BA,IAAI,mBAAkC;AAQ/B,SAAS,2BAA2B;AAAA,EACzC;AACF,GAES;AACP,qBAAmB,WAAW,SAAS,QAAQ,QAAQ,GAAG,IAAI;AAChE;AAEA,SAAS,oBAAmC;AAC1C,SAAO,OAAO,WAAW,cAAc,OAAO,OAAO,SAAS;AAChE;AASO,SAAS,gBAAgB;AAAA,EAC9B;AAAA,EACA;AAAA,EACA,aAAa,kBAAA;AACf,GAIkB;AAChB,MAAI,CAAC,OAAQ,QAAO;AACpB,SAAO,iBAAiB,EAAE,QAAQ,YAAY,cAAc,IAAI,YAAY;AAC9E;AAGO,SAAS,2BAA2B;AAAA,EACzC;AACF,GAEkB;AAChB,MAAI,EAAC,iCAAQ,QAAQ,QAAO;AAC5B,MAAI;AACF,UAAM,OAAO,IAAI,IAAI,wBAAwB,MAAM;AACnD,WAAO,KAAK,aAAa,YAAY,KAAK,aAAa,UACnD,KAAK,aACL;AAAA,EACN,QAAQ;AACN,WAAO;AAAA,EACT;AACF;AAEA,MAAM,YAAY;AAGlB,SAAS,QAAQ;AAAA,EACf;AAAA,EACA;AACF,GAGuB;AACrB,QAAM,cAAc,2BAA2B,EAAE,QAAQ;AACzD,MAAI,UAAU,KAAK,IAAI,GAAG;AACxB,UAAM,WAAW,oBAAoB;AACrC,WAAO,WAAW,GAAG,QAAQ,GAAG,IAAI,SAAS;AAAA,EAC/C;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AS;AAAA,EACT,OAAO;AAAA,EACP,aAAa;AAAA,EACb,OAAO;AAAA,EACP,mBAAmB;AAAA,EACnB,KAAK;AAAA,EACL,gBAAgB;AAAA,EAChB,OAAO;AAAA,EACP,eAAe;AAAA,EACf,YAAY;AAAA,EACZ,UAAU;AAAA,EACV,eAAe;AAAA,EACf,MAAM;AACR;AAGO,SAAS,gBAAgB,WAA8C;AAC5E,QAAM,MAAM,uCAAW;AACvB,MAAI,CAAC,OAAO,CAAC,OAAO,OAAO,4BAA4B,GAAG,EAAG,QAAO;AACpE,SAAO,2BAA2B,GAAG,KAAK;AAC5C;"}
|
|
@@ -4,14 +4,21 @@ const types = require("../types.cjs");
|
|
|
4
4
|
const apiClient = require("../api-client.cjs");
|
|
5
5
|
const filterItems = require("../utils/filter-items.cjs");
|
|
6
6
|
const assetTypeIcons = require("./asset-type-icons.cjs");
|
|
7
|
-
function
|
|
7
|
+
function assetDisplayType(asset) {
|
|
8
|
+
return asset.athenaOriginalType || asset.athenaConvertedType;
|
|
9
|
+
}
|
|
10
|
+
function assetToMenuItem({
|
|
11
|
+
asset,
|
|
12
|
+
metadata,
|
|
13
|
+
appUrl
|
|
14
|
+
}) {
|
|
8
15
|
const isFolder = asset.athenaOriginalType === "folder";
|
|
9
|
-
const displayType = asset
|
|
16
|
+
const displayType = assetDisplayType(asset);
|
|
10
17
|
return {
|
|
11
18
|
id: asset.id,
|
|
12
19
|
name: asset.title || "Untitled",
|
|
13
20
|
type: isFolder ? "folder" : "asset",
|
|
14
|
-
thumbnailUrl: assetTypeIcons.assetTypeToThumb(displayType),
|
|
21
|
+
thumbnailUrl: assetTypeIcons.emailProviderThumb({ assetType: displayType, metadata, appUrl }) ?? assetTypeIcons.assetTypeToThumb(displayType, { appUrl }),
|
|
15
22
|
fallbackIcon: assetTypeIcons.assetTypeToIcon(displayType),
|
|
16
23
|
navigatesToScope: isFolder ? asset.id : void 0,
|
|
17
24
|
visibleInScopes: /* @__PURE__ */ new Set(),
|
|
@@ -23,6 +30,31 @@ function assetToMenuItem(asset) {
|
|
|
23
30
|
}
|
|
24
31
|
};
|
|
25
32
|
}
|
|
33
|
+
const EMAIL_METADATA_TIMEOUT_MS = 2e3;
|
|
34
|
+
async function readEmailMetadata(auth, assets) {
|
|
35
|
+
const assetIds = assets.filter((asset) => assetTypeIcons.isEmailAssetType(assetDisplayType(asset))).map((asset) => asset.id);
|
|
36
|
+
if (!assetIds.length) return /* @__PURE__ */ new Map();
|
|
37
|
+
try {
|
|
38
|
+
const data = await apiClient.fetchGraphQL(
|
|
39
|
+
auth,
|
|
40
|
+
apiClient.MENTION_EMAIL_METADATA_QUERY,
|
|
41
|
+
{ assetIds },
|
|
42
|
+
typeof AbortSignal.timeout === "function" ? { signal: AbortSignal.timeout(EMAIL_METADATA_TIMEOUT_MS) } : {}
|
|
43
|
+
);
|
|
44
|
+
return new Map(
|
|
45
|
+
(data.getAssetsByIds ?? []).map((row) => [row.id, row.athenaMetadata])
|
|
46
|
+
);
|
|
47
|
+
} catch {
|
|
48
|
+
return /* @__PURE__ */ new Map();
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
async function assetsToMenuItems(auth, assets) {
|
|
52
|
+
const metadata = await readEmailMetadata(auth, assets);
|
|
53
|
+
const appUrl = assetTypeIcons.assetIconAppUrl({ appUrl: auth.appUrl, backendUrl: auth.backendUrl }) ?? void 0;
|
|
54
|
+
return assets.map(
|
|
55
|
+
(asset) => assetToMenuItem({ asset, metadata: metadata.get(asset.id), appUrl })
|
|
56
|
+
);
|
|
57
|
+
}
|
|
26
58
|
async function querySimpleSearch(auth, opts) {
|
|
27
59
|
var _a, _b;
|
|
28
60
|
const searchRequest = {
|
|
@@ -42,7 +74,7 @@ async function querySimpleSearch(auth, opts) {
|
|
|
42
74
|
const data = await apiClient.fetchGraphQL(auth, apiClient.SIMPLE_SEARCH_QUERY, { input });
|
|
43
75
|
const assets = ((_b = data.simpleSearch) == null ? void 0 : _b.assets) || [];
|
|
44
76
|
return {
|
|
45
|
-
items: assets
|
|
77
|
+
items: await assetsToMenuItems(auth, assets),
|
|
46
78
|
hasMore: assets.length === opts.limit
|
|
47
79
|
};
|
|
48
80
|
}
|
|
@@ -157,7 +189,7 @@ const fetchFavorites = async (context) => {
|
|
|
157
189
|
}
|
|
158
190
|
});
|
|
159
191
|
const assets = data.getPaginatedAssetsForWorkspace || [];
|
|
160
|
-
const items = assets
|
|
192
|
+
const items = await assetsToMenuItems(sourceConfig.auth, assets);
|
|
161
193
|
return {
|
|
162
194
|
items,
|
|
163
195
|
pagination: { hasMore: assets.length === limit }
|
|
@@ -200,7 +232,7 @@ const fetchFolderContents = async (context) => {
|
|
|
200
232
|
const assets = rawAssets.filter(
|
|
201
233
|
(a) => a.athenaConvertedType !== "catalog" && a.athenaOriginalType !== "catalog"
|
|
202
234
|
);
|
|
203
|
-
const items = assets
|
|
235
|
+
const items = await assetsToMenuItems(sourceConfig.auth, assets);
|
|
204
236
|
return {
|
|
205
237
|
items,
|
|
206
238
|
pagination: {
|