@athenaintel/react 0.9.17 → 0.9.18
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/index.cjs +207 -26
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +16 -4
- package/dist/index.js +207 -26
- package/dist/index.js.map +1 -1
- package/package.json +10 -9
package/dist/index.d.ts
CHANGED
|
@@ -48,10 +48,8 @@ export declare interface AssetPanelState {
|
|
|
48
48
|
autoOpenedAssets: Map<string, number>;
|
|
49
49
|
registerAssetPanelHost: () => void;
|
|
50
50
|
unregisterAssetPanelHost: () => void;
|
|
51
|
-
openAsset: (assetId: string, meta?:
|
|
52
|
-
|
|
53
|
-
type?: AssetType;
|
|
54
|
-
}) => void;
|
|
51
|
+
openAsset: (assetId: string, meta?: AssetTabMeta) => void;
|
|
52
|
+
updateTabMeta: (assetId: string, meta: AssetTabMeta) => void;
|
|
55
53
|
closeTab: (assetId: string) => void;
|
|
56
54
|
setActiveTab: (assetId: string) => void;
|
|
57
55
|
setViewMode: (mode: ViewMode) => void;
|
|
@@ -67,6 +65,13 @@ export declare interface AssetTab {
|
|
|
67
65
|
id: string;
|
|
68
66
|
name: string | null;
|
|
69
67
|
type: AssetType;
|
|
68
|
+
embedSearchParams: Record<string, string> | null;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
declare interface AssetTabMeta {
|
|
72
|
+
name?: string | null;
|
|
73
|
+
type?: AssetType;
|
|
74
|
+
embedSearchParams?: Record<string, string> | null;
|
|
70
75
|
}
|
|
71
76
|
|
|
72
77
|
export declare type AssetType = 'presentation' | 'spreadsheet' | 'document' | 'notebook' | 'unknown';
|
|
@@ -146,6 +151,8 @@ export declare interface AthenaCitationLinkMetadata {
|
|
|
146
151
|
assetId: string;
|
|
147
152
|
assetIds: string[];
|
|
148
153
|
assetType: AssetType | null;
|
|
154
|
+
assetName: string | null;
|
|
155
|
+
embedSearchParams: Record<string, string>;
|
|
149
156
|
}
|
|
150
157
|
|
|
151
158
|
/**
|
|
@@ -586,6 +593,8 @@ export declare interface ParsedAthenaCitationLink {
|
|
|
586
593
|
assetId: string;
|
|
587
594
|
assetIds: string[];
|
|
588
595
|
assetType: AssetType | null;
|
|
596
|
+
assetName: string | null;
|
|
597
|
+
embedSearchParams: Record<string, string>;
|
|
589
598
|
}
|
|
590
599
|
|
|
591
600
|
declare interface QuoteContextValue {
|
|
@@ -1018,12 +1027,15 @@ export declare function useAssetEmbed(assetId: string | null, options?: UseAsset
|
|
|
1018
1027
|
export declare interface UseAssetEmbedOptions {
|
|
1019
1028
|
readOnly?: boolean;
|
|
1020
1029
|
expiresInSeconds?: number;
|
|
1030
|
+
embedSearchParams?: Record<string, string> | null;
|
|
1021
1031
|
}
|
|
1022
1032
|
|
|
1023
1033
|
export declare interface UseAssetEmbedResult {
|
|
1024
1034
|
embedUrl: string | null;
|
|
1025
1035
|
isLoading: boolean;
|
|
1026
1036
|
error: string | null;
|
|
1037
|
+
assetTitle: string | null;
|
|
1038
|
+
assetType: AssetType | null;
|
|
1027
1039
|
}
|
|
1028
1040
|
|
|
1029
1041
|
export declare const useAssetPanelStore: UseBoundStore<Omit<StoreApi<AssetPanelState>, "setState" | "persist"> & {
|
package/dist/index.js
CHANGED
|
@@ -58878,17 +58878,39 @@ const useAssetPanelStore = create()(
|
|
|
58878
58878
|
const existing = s.tabs.find((t) => t.id === assetId);
|
|
58879
58879
|
if (existing) {
|
|
58880
58880
|
const tabs = meta ? s.tabs.map(
|
|
58881
|
-
(t) => t.id === assetId ? {
|
|
58881
|
+
(t) => t.id === assetId ? {
|
|
58882
|
+
...t,
|
|
58883
|
+
name: meta.name ?? t.name,
|
|
58884
|
+
type: meta.type ?? t.type,
|
|
58885
|
+
embedSearchParams: meta.embedSearchParams ?? t.embedSearchParams
|
|
58886
|
+
} : t
|
|
58882
58887
|
) : s.tabs;
|
|
58883
58888
|
return { isOpen: true, tabs, activeTabId: assetId };
|
|
58884
58889
|
}
|
|
58885
58890
|
const newTab = {
|
|
58886
58891
|
id: assetId,
|
|
58887
58892
|
name: (meta == null ? void 0 : meta.name) ?? null,
|
|
58888
|
-
type: (meta == null ? void 0 : meta.type) ?? "unknown"
|
|
58893
|
+
type: (meta == null ? void 0 : meta.type) ?? "unknown",
|
|
58894
|
+
embedSearchParams: (meta == null ? void 0 : meta.embedSearchParams) ?? null
|
|
58889
58895
|
};
|
|
58890
58896
|
return { isOpen: true, tabs: [...s.tabs, newTab], activeTabId: assetId };
|
|
58891
58897
|
}),
|
|
58898
|
+
updateTabMeta: (assetId, meta) => set2((s) => {
|
|
58899
|
+
const existing = s.tabs.find((t) => t.id === assetId);
|
|
58900
|
+
if (!existing) {
|
|
58901
|
+
return {};
|
|
58902
|
+
}
|
|
58903
|
+
return {
|
|
58904
|
+
tabs: s.tabs.map(
|
|
58905
|
+
(t) => t.id === assetId ? {
|
|
58906
|
+
...t,
|
|
58907
|
+
name: meta.name ?? t.name,
|
|
58908
|
+
type: meta.type ?? t.type,
|
|
58909
|
+
embedSearchParams: meta.embedSearchParams ?? t.embedSearchParams
|
|
58910
|
+
} : t
|
|
58911
|
+
)
|
|
58912
|
+
};
|
|
58913
|
+
}),
|
|
58892
58914
|
closeTab: (assetId) => set2((s) => {
|
|
58893
58915
|
var _a2;
|
|
58894
58916
|
const tabs = s.tabs.filter((t) => t.id !== assetId);
|
|
@@ -58946,13 +58968,43 @@ const ASSET_TYPE_ALIASES = {
|
|
|
58946
58968
|
super_document: "document"
|
|
58947
58969
|
};
|
|
58948
58970
|
const isAthenaSpacesPath = (url) => url.pathname.replace(/\/+$/, "") === "/dashboard/spaces";
|
|
58949
|
-
const normalizeAssetType = (value) => {
|
|
58971
|
+
const normalizeAssetType$1 = (value) => {
|
|
58950
58972
|
if (!value) {
|
|
58951
58973
|
return null;
|
|
58952
58974
|
}
|
|
58953
58975
|
const normalizedValue = value.trim().replace(/^athena\//, "").toLowerCase().replace(/-/g, "_");
|
|
58954
58976
|
return ASSET_TYPE_ALIASES[normalizedValue] ?? null;
|
|
58955
58977
|
};
|
|
58978
|
+
const isLikelyAssetId = (value) => !!value && /^(asset|thread|project|collection)_[a-z0-9-]+$/i.test(value.trim());
|
|
58979
|
+
const sanitizeDisplayName = (value) => {
|
|
58980
|
+
if (!value) {
|
|
58981
|
+
return null;
|
|
58982
|
+
}
|
|
58983
|
+
const trimmedValue = value.trim();
|
|
58984
|
+
if (!trimmedValue) {
|
|
58985
|
+
return null;
|
|
58986
|
+
}
|
|
58987
|
+
if (trimmedValue.startsWith('"') && trimmedValue.endsWith('"') || trimmedValue.startsWith("'") && trimmedValue.endsWith("'")) {
|
|
58988
|
+
return trimmedValue.slice(1, -1).trim() || null;
|
|
58989
|
+
}
|
|
58990
|
+
return trimmedValue;
|
|
58991
|
+
};
|
|
58992
|
+
const getCitationDisplayName = ({
|
|
58993
|
+
assetName,
|
|
58994
|
+
linkText
|
|
58995
|
+
}) => {
|
|
58996
|
+
const sanitizedAssetName = sanitizeDisplayName(assetName);
|
|
58997
|
+
const sanitizedLinkText = sanitizeDisplayName(linkText);
|
|
58998
|
+
const genericLinkTextPattern = /^(this|that|the)\s+asset$/i;
|
|
58999
|
+
if (sanitizedAssetName && !isLikelyAssetId(sanitizedAssetName)) {
|
|
59000
|
+
return sanitizedAssetName;
|
|
59001
|
+
}
|
|
59002
|
+
if (sanitizedLinkText && !genericLinkTextPattern.test(sanitizedLinkText)) {
|
|
59003
|
+
return sanitizedLinkText;
|
|
59004
|
+
}
|
|
59005
|
+
return sanitizedAssetName ?? sanitizedLinkText;
|
|
59006
|
+
};
|
|
59007
|
+
const getEmbedSearchParams = (url) => Object.fromEntries(url.searchParams.entries());
|
|
58956
59008
|
const getOrigin = (value) => {
|
|
58957
59009
|
if (!value) {
|
|
58958
59010
|
return null;
|
|
@@ -59034,7 +59086,11 @@ const parseAthenaCitationLink = ({
|
|
|
59034
59086
|
url,
|
|
59035
59087
|
assetId,
|
|
59036
59088
|
assetIds,
|
|
59037
|
-
assetType: normalizeAssetType(
|
|
59089
|
+
assetType: normalizeAssetType$1(
|
|
59090
|
+
url.searchParams.get("asset_type") ?? url.searchParams.get("assetType") ?? url.searchParams.get("type")
|
|
59091
|
+
),
|
|
59092
|
+
assetName: sanitizeDisplayName(url.searchParams.get("name")),
|
|
59093
|
+
embedSearchParams: getEmbedSearchParams(url)
|
|
59038
59094
|
};
|
|
59039
59095
|
};
|
|
59040
59096
|
const isAthenaCitationUrl = ({
|
|
@@ -59082,12 +59138,19 @@ const useAthenaLinkClickHandler = () => {
|
|
|
59082
59138
|
const citationMetadata = citationLink ? {
|
|
59083
59139
|
assetId: citationLink.assetId,
|
|
59084
59140
|
assetIds: citationLink.assetIds,
|
|
59085
|
-
assetType: citationLink.assetType
|
|
59141
|
+
assetType: citationLink.assetType,
|
|
59142
|
+
assetName: citationLink.assetName,
|
|
59143
|
+
embedSearchParams: citationLink.embedSearchParams
|
|
59086
59144
|
} : null;
|
|
59087
59145
|
const openInAssetPanel = citationLink ? () => {
|
|
59146
|
+
const displayName = getCitationDisplayName({
|
|
59147
|
+
assetName: citationLink.assetName,
|
|
59148
|
+
linkText: trimmedLinkText
|
|
59149
|
+
});
|
|
59088
59150
|
openAsset(citationLink.assetId, {
|
|
59089
|
-
name:
|
|
59090
|
-
type: citationLink.assetType ?? void 0
|
|
59151
|
+
name: displayName ?? void 0,
|
|
59152
|
+
type: citationLink.assetType ?? void 0,
|
|
59153
|
+
embedSearchParams: citationLink.embedSearchParams
|
|
59091
59154
|
});
|
|
59092
59155
|
} : void 0;
|
|
59093
59156
|
const context2 = {
|
|
@@ -63527,6 +63590,12 @@ function extractAssetId(result) {
|
|
|
63527
63590
|
if (typeof id === "string" && id.startsWith("asset_")) return id;
|
|
63528
63591
|
return null;
|
|
63529
63592
|
}
|
|
63593
|
+
function extractAssetTitle(result) {
|
|
63594
|
+
const data = normalizeResult(result);
|
|
63595
|
+
if (!data) return null;
|
|
63596
|
+
const title = data.assetTitle ?? data.asset_title ?? data.title ?? data.name;
|
|
63597
|
+
return typeof title === "string" && title.trim().length > 0 ? title.trim() : null;
|
|
63598
|
+
}
|
|
63530
63599
|
function resetAssetAutoOpen() {
|
|
63531
63600
|
useAssetPanelStore.getState().resetAutoOpen();
|
|
63532
63601
|
}
|
|
@@ -64246,6 +64315,7 @@ const OpenAssetToolUIImpl = ({
|
|
|
64246
64315
|
const typedArgs = args;
|
|
64247
64316
|
const argsAssetId = (typedArgs == null ? void 0 : typedArgs.asset_id) ?? (typedArgs == null ? void 0 : typedArgs.assetId) ?? "";
|
|
64248
64317
|
const resultAssetId = extractAssetId(result);
|
|
64318
|
+
const resultAssetTitle = extractAssetTitle(result);
|
|
64249
64319
|
const assetId = resultAssetId ?? (argsAssetId.startsWith("asset_") ? argsAssetId : null);
|
|
64250
64320
|
const isRunning = (status == null ? void 0 : status.type) === "running";
|
|
64251
64321
|
const isComplete = (status == null ? void 0 : status.type) === "complete" || !status;
|
|
@@ -64257,10 +64327,10 @@ const OpenAssetToolUIImpl = ({
|
|
|
64257
64327
|
if (isComplete && !isCancelled && assetId && !wasCompleteAtMount.current) {
|
|
64258
64328
|
const store = useAssetPanelStore.getState();
|
|
64259
64329
|
if (store.markAutoOpened(assetId)) {
|
|
64260
|
-
store.openAsset(assetId);
|
|
64330
|
+
store.openAsset(assetId, { name: resultAssetTitle ?? void 0 });
|
|
64261
64331
|
}
|
|
64262
64332
|
}
|
|
64263
|
-
}, [isComplete, isCancelled, assetId]);
|
|
64333
|
+
}, [isComplete, isCancelled, assetId, resultAssetTitle]);
|
|
64264
64334
|
return /* @__PURE__ */ jsx(
|
|
64265
64335
|
ToolCard,
|
|
64266
64336
|
{
|
|
@@ -64276,7 +64346,7 @@ const OpenAssetToolUIImpl = ({
|
|
|
64276
64346
|
"button",
|
|
64277
64347
|
{
|
|
64278
64348
|
type: "button",
|
|
64279
|
-
onClick: () => openAsset(assetId),
|
|
64349
|
+
onClick: () => openAsset(assetId, { name: resultAssetTitle ?? void 0 }),
|
|
64280
64350
|
className: "flex items-center gap-1.5 rounded-md border border-border/60 px-3 py-1.5 text-xs font-medium text-muted-foreground transition-colors hover:bg-muted/50 hover:text-foreground",
|
|
64281
64351
|
children: [
|
|
64282
64352
|
/* @__PURE__ */ jsx(ExternalLink, { className: "size-3" }),
|
|
@@ -65201,14 +65271,67 @@ const AthenaUserMessage = ({
|
|
|
65201
65271
|
children: /* @__PURE__ */ jsx("div", { className: "aui-user-message-content wrap-break-word rounded-2xl bg-muted px-4 py-2.5 text-foreground", children: /* @__PURE__ */ jsx(MessagePrimitiveParts, { components: { Text: TextComponent } }) })
|
|
65202
65272
|
}
|
|
65203
65273
|
);
|
|
65274
|
+
const EMBED_ASSET_TYPE_ALIASES = {
|
|
65275
|
+
document: "document",
|
|
65276
|
+
image: "document",
|
|
65277
|
+
notebook: "notebook",
|
|
65278
|
+
pdf: "document",
|
|
65279
|
+
powerpoint_deck: "presentation",
|
|
65280
|
+
presentation: "presentation",
|
|
65281
|
+
puck_presentation: "presentation",
|
|
65282
|
+
sheet: "spreadsheet",
|
|
65283
|
+
spreadsheet: "spreadsheet",
|
|
65284
|
+
super_document: "document"
|
|
65285
|
+
};
|
|
65204
65286
|
const embedCache = /* @__PURE__ */ new Map();
|
|
65287
|
+
const normalizeAssetType = (value) => {
|
|
65288
|
+
if (!value) {
|
|
65289
|
+
return null;
|
|
65290
|
+
}
|
|
65291
|
+
const normalizedValue = value.trim().replace(/^athena\//, "").toLowerCase().replace(/-/g, "_");
|
|
65292
|
+
return EMBED_ASSET_TYPE_ALIASES[normalizedValue] ?? null;
|
|
65293
|
+
};
|
|
65294
|
+
const getEmbedSearchParamsCacheKey = (embedSearchParams) => {
|
|
65295
|
+
if (!embedSearchParams || Object.keys(embedSearchParams).length === 0) {
|
|
65296
|
+
return "{}";
|
|
65297
|
+
}
|
|
65298
|
+
const sortedEntries = Object.entries(embedSearchParams).sort(
|
|
65299
|
+
([left], [right]) => left.localeCompare(right)
|
|
65300
|
+
);
|
|
65301
|
+
return JSON.stringify(Object.fromEntries(sortedEntries));
|
|
65302
|
+
};
|
|
65303
|
+
const appendEmbedSearchParams = ({
|
|
65304
|
+
embedUrl,
|
|
65305
|
+
embedSearchParams
|
|
65306
|
+
}) => {
|
|
65307
|
+
if (!embedSearchParams || Object.keys(embedSearchParams).length === 0) {
|
|
65308
|
+
return embedUrl;
|
|
65309
|
+
}
|
|
65310
|
+
const url = new URL(embedUrl);
|
|
65311
|
+
for (const [key, value] of Object.entries(embedSearchParams)) {
|
|
65312
|
+
if (!value) {
|
|
65313
|
+
continue;
|
|
65314
|
+
}
|
|
65315
|
+
url.searchParams.set(key, value);
|
|
65316
|
+
}
|
|
65317
|
+
return url.toString();
|
|
65318
|
+
};
|
|
65205
65319
|
function useAssetEmbed(assetId, options = {
|
|
65206
65320
|
backendUrl: ""
|
|
65207
65321
|
}) {
|
|
65208
|
-
const {
|
|
65322
|
+
const {
|
|
65323
|
+
readOnly = false,
|
|
65324
|
+
expiresInSeconds = 60 * 60 * 24 * 30,
|
|
65325
|
+
backendUrl,
|
|
65326
|
+
apiKey,
|
|
65327
|
+
token,
|
|
65328
|
+
embedSearchParams
|
|
65329
|
+
} = options;
|
|
65209
65330
|
const [embedUrl, setEmbedUrl] = useState(null);
|
|
65210
65331
|
const [isLoading, setIsLoading] = useState(false);
|
|
65211
65332
|
const [error2, setError] = useState(null);
|
|
65333
|
+
const [assetTitle, setAssetTitle] = useState(null);
|
|
65334
|
+
const [assetType, setAssetType] = useState(null);
|
|
65212
65335
|
const abortRef = useRef(null);
|
|
65213
65336
|
useEffect(() => {
|
|
65214
65337
|
var _a2;
|
|
@@ -65216,14 +65339,18 @@ function useAssetEmbed(assetId, options = {
|
|
|
65216
65339
|
setEmbedUrl(null);
|
|
65217
65340
|
setIsLoading(false);
|
|
65218
65341
|
setError(null);
|
|
65342
|
+
setAssetTitle(null);
|
|
65343
|
+
setAssetType(null);
|
|
65219
65344
|
return;
|
|
65220
65345
|
}
|
|
65221
|
-
const cacheKey = `${assetId}:${readOnly}:${token ?? apiKey ?? "anon"}`;
|
|
65346
|
+
const cacheKey = `${assetId}:${readOnly}:${token ?? apiKey ?? "anon"}:${getEmbedSearchParamsCacheKey(embedSearchParams)}`;
|
|
65222
65347
|
const cached = embedCache.get(cacheKey);
|
|
65223
65348
|
if (cached && cached.expiresAt > Date.now() / 1e3) {
|
|
65224
65349
|
setEmbedUrl(cached.url);
|
|
65225
65350
|
setIsLoading(false);
|
|
65226
65351
|
setError(null);
|
|
65352
|
+
setAssetTitle(cached.assetTitle);
|
|
65353
|
+
setAssetType(cached.assetType);
|
|
65227
65354
|
return;
|
|
65228
65355
|
}
|
|
65229
65356
|
const apiBaseUrl = backendUrl.replace(/\/api\/assistant-ui\/?$/, "");
|
|
@@ -65231,11 +65358,14 @@ function useAssetEmbed(assetId, options = {
|
|
|
65231
65358
|
(_a2 = abortRef.current) == null ? void 0 : _a2.abort();
|
|
65232
65359
|
const controller = new AbortController();
|
|
65233
65360
|
abortRef.current = controller;
|
|
65361
|
+
setEmbedUrl(null);
|
|
65234
65362
|
setIsLoading(true);
|
|
65235
65363
|
setError(null);
|
|
65364
|
+
setAssetTitle(null);
|
|
65365
|
+
setAssetType(null);
|
|
65236
65366
|
const headers = { "Content-Type": "application/json" };
|
|
65237
65367
|
if (token) {
|
|
65238
|
-
headers
|
|
65368
|
+
headers.Authorization = `Bearer ${token}`;
|
|
65239
65369
|
} else if (apiKey) {
|
|
65240
65370
|
headers["X-API-KEY"] = apiKey;
|
|
65241
65371
|
}
|
|
@@ -65255,17 +65385,31 @@ function useAssetEmbed(assetId, options = {
|
|
|
65255
65385
|
}
|
|
65256
65386
|
return res.json();
|
|
65257
65387
|
}).then((data) => {
|
|
65258
|
-
|
|
65259
|
-
|
|
65388
|
+
const resolvedAssetType = normalizeAssetType(data.athena_converted_type) ?? normalizeAssetType(data.athena_original_type);
|
|
65389
|
+
const resolvedEmbedUrl = appendEmbedSearchParams({
|
|
65390
|
+
embedUrl: data.embed_url,
|
|
65391
|
+
embedSearchParams
|
|
65392
|
+
});
|
|
65393
|
+
embedCache.set(cacheKey, {
|
|
65394
|
+
url: resolvedEmbedUrl,
|
|
65395
|
+
expiresAt: data.expires_at,
|
|
65396
|
+
assetTitle: data.title ?? null,
|
|
65397
|
+
assetType: resolvedAssetType
|
|
65398
|
+
});
|
|
65399
|
+
setEmbedUrl(resolvedEmbedUrl);
|
|
65400
|
+
setAssetTitle(data.title ?? null);
|
|
65401
|
+
setAssetType(resolvedAssetType);
|
|
65260
65402
|
setIsLoading(false);
|
|
65261
65403
|
}).catch((err) => {
|
|
65262
|
-
if (err.name === "AbortError")
|
|
65404
|
+
if (err.name === "AbortError") {
|
|
65405
|
+
return;
|
|
65406
|
+
}
|
|
65263
65407
|
setError(err.message);
|
|
65264
65408
|
setIsLoading(false);
|
|
65265
65409
|
});
|
|
65266
65410
|
return () => controller.abort();
|
|
65267
|
-
}, [assetId, readOnly, expiresInSeconds, backendUrl, apiKey, token]);
|
|
65268
|
-
return { embedUrl, isLoading, error: error2 };
|
|
65411
|
+
}, [assetId, readOnly, expiresInSeconds, backendUrl, apiKey, token, embedSearchParams]);
|
|
65412
|
+
return { embedUrl, isLoading, error: error2, assetTitle, assetType };
|
|
65269
65413
|
}
|
|
65270
65414
|
const ASSET_TYPE_CONFIG = {
|
|
65271
65415
|
presentation: { icon: Presentation, label: "Presentation" },
|
|
@@ -65275,13 +65419,28 @@ const ASSET_TYPE_CONFIG = {
|
|
|
65275
65419
|
unknown: { icon: File$1, label: "Asset" }
|
|
65276
65420
|
};
|
|
65277
65421
|
const AssetIframe = memo(
|
|
65278
|
-
({ tabId, tabName }) => {
|
|
65422
|
+
({ tabId, tabName, tabType, embedSearchParams }) => {
|
|
65279
65423
|
const { backendUrl, apiKey, token } = useAthenaConfig();
|
|
65280
|
-
const { embedUrl, isLoading, error: error2 } = useAssetEmbed(tabId, {
|
|
65424
|
+
const { embedUrl, isLoading, error: error2, assetTitle, assetType } = useAssetEmbed(tabId, {
|
|
65281
65425
|
backendUrl,
|
|
65282
65426
|
apiKey,
|
|
65283
|
-
token
|
|
65427
|
+
token,
|
|
65428
|
+
embedSearchParams
|
|
65284
65429
|
});
|
|
65430
|
+
useEffect(() => {
|
|
65431
|
+
if (!assetTitle && !assetType) {
|
|
65432
|
+
return;
|
|
65433
|
+
}
|
|
65434
|
+
const nextName = assetTitle ?? tabName;
|
|
65435
|
+
const nextType = assetType ?? tabType;
|
|
65436
|
+
if (nextName === tabName && nextType === tabType) {
|
|
65437
|
+
return;
|
|
65438
|
+
}
|
|
65439
|
+
useAssetPanelStore.getState().updateTabMeta(tabId, {
|
|
65440
|
+
name: nextName ?? void 0,
|
|
65441
|
+
type: nextType
|
|
65442
|
+
});
|
|
65443
|
+
}, [assetTitle, assetType, tabId, tabName, tabType]);
|
|
65285
65444
|
if (isLoading) {
|
|
65286
65445
|
return /* @__PURE__ */ jsx("div", { className: "flex h-full items-center justify-center", children: /* @__PURE__ */ jsxs("div", { className: "text-center", children: [
|
|
65287
65446
|
/* @__PURE__ */ jsx(LoaderCircle, { className: "mx-auto size-6 animate-spin text-muted-foreground" }),
|
|
@@ -65343,7 +65502,7 @@ const PanelContent = ({
|
|
|
65343
65502
|
return /* @__PURE__ */ jsx(
|
|
65344
65503
|
"div",
|
|
65345
65504
|
{
|
|
65346
|
-
className:
|
|
65505
|
+
className: cn("flex-1 overflow-hidden", isTiled && gridClass, isTiled && "gap-px bg-border/60"),
|
|
65347
65506
|
children: tabs.map((tab) => {
|
|
65348
65507
|
const isActive2 = tab.id === activeTabId;
|
|
65349
65508
|
const config2 = ASSET_TYPE_CONFIG[tab.type];
|
|
@@ -65366,7 +65525,15 @@ const PanelContent = ({
|
|
|
65366
65525
|
}
|
|
65367
65526
|
)
|
|
65368
65527
|
] }),
|
|
65369
|
-
/* @__PURE__ */ jsx("div", { className: "flex-1 overflow-hidden", children: /* @__PURE__ */ jsx(
|
|
65528
|
+
/* @__PURE__ */ jsx("div", { className: "flex-1 overflow-hidden", children: /* @__PURE__ */ jsx(
|
|
65529
|
+
AssetIframe,
|
|
65530
|
+
{
|
|
65531
|
+
tabId: tab.id,
|
|
65532
|
+
tabName: tab.name,
|
|
65533
|
+
tabType: tab.type,
|
|
65534
|
+
embedSearchParams: tab.embedSearchParams
|
|
65535
|
+
}
|
|
65536
|
+
) })
|
|
65370
65537
|
]
|
|
65371
65538
|
},
|
|
65372
65539
|
tab.id
|
|
@@ -65376,7 +65543,15 @@ const PanelContent = ({
|
|
|
65376
65543
|
"div",
|
|
65377
65544
|
{
|
|
65378
65545
|
className: isActive2 ? "h-full w-full" : "hidden",
|
|
65379
|
-
children: /* @__PURE__ */ jsx(
|
|
65546
|
+
children: /* @__PURE__ */ jsx(
|
|
65547
|
+
AssetIframe,
|
|
65548
|
+
{
|
|
65549
|
+
tabId: tab.id,
|
|
65550
|
+
tabName: tab.name,
|
|
65551
|
+
tabType: tab.type,
|
|
65552
|
+
embedSearchParams: tab.embedSearchParams
|
|
65553
|
+
}
|
|
65554
|
+
)
|
|
65380
65555
|
},
|
|
65381
65556
|
tab.id
|
|
65382
65557
|
);
|
|
@@ -65394,7 +65569,10 @@ const TabBar = () => {
|
|
|
65394
65569
|
return /* @__PURE__ */ jsxs(
|
|
65395
65570
|
"div",
|
|
65396
65571
|
{
|
|
65397
|
-
className:
|
|
65572
|
+
className: cn(
|
|
65573
|
+
"group flex max-w-[180px] shrink-0 cursor-pointer items-center gap-1.5 border-r border-border/40 px-3 py-1.5 text-xs",
|
|
65574
|
+
isActive2 ? "border-b-2 border-b-primary bg-background text-foreground" : "text-muted-foreground hover:bg-background/50 hover:text-foreground"
|
|
65575
|
+
),
|
|
65398
65576
|
onClick: () => setActiveTab(tab.id),
|
|
65399
65577
|
children: [
|
|
65400
65578
|
/* @__PURE__ */ jsx(TypeIcon, { className: "size-3 shrink-0" }),
|
|
@@ -65436,7 +65614,10 @@ const PanelHeader = ({ fullscreen }) => {
|
|
|
65436
65614
|
"button",
|
|
65437
65615
|
{
|
|
65438
65616
|
onClick: () => setViewMode(isTiled ? "tabs" : "tiled"),
|
|
65439
|
-
className:
|
|
65617
|
+
className: cn(
|
|
65618
|
+
"flex size-7 items-center justify-center rounded-lg transition-colors",
|
|
65619
|
+
isTiled ? "bg-primary/10 text-primary" : "text-muted-foreground hover:bg-accent hover:text-foreground"
|
|
65620
|
+
),
|
|
65440
65621
|
title: isTiled ? "Switch to tabs" : "Tile all assets",
|
|
65441
65622
|
children: isTiled ? /* @__PURE__ */ jsx(Layers, { className: "size-3.5" }) : /* @__PURE__ */ jsx(LayoutGrid, { className: "size-3.5" })
|
|
65442
65623
|
}
|