@flamingo-stack/openframe-frontend-core 0.0.244 → 0.0.245
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/{chunk-DV3YZWGN.cjs → chunk-3TDLFCCS.cjs} +33 -20
- package/dist/chunk-3TDLFCCS.cjs.map +1 -0
- package/dist/{chunk-ORJREQ2W.js → chunk-4XLJWX2N.js} +4 -4
- package/dist/{chunk-P5C732SC.js → chunk-7ZHFCEJH.js} +6 -6
- package/dist/{chunk-EJ7J4QAD.cjs → chunk-BKPS6M2F.cjs} +12 -12
- package/dist/{chunk-EJ7J4QAD.cjs.map → chunk-BKPS6M2F.cjs.map} +1 -1
- package/dist/{chunk-EPXROXYC.cjs → chunk-CZITXP77.cjs} +645 -713
- package/dist/chunk-CZITXP77.cjs.map +1 -0
- package/dist/{chunk-Z6GGYZDR.cjs → chunk-DUZBTUXF.cjs} +27 -27
- package/dist/{chunk-Z6GGYZDR.cjs.map → chunk-DUZBTUXF.cjs.map} +1 -1
- package/dist/{chunk-M7DPUWAL.js → chunk-FRRMXLU5.js} +120 -188
- package/dist/chunk-FRRMXLU5.js.map +1 -0
- package/dist/chunk-GIDH6UL4.js +287 -0
- package/dist/chunk-GIDH6UL4.js.map +1 -0
- package/dist/{chunk-PTSAF7T2.js → chunk-JJV3XGCY.js} +2 -2
- package/dist/{chunk-APGMNHPY.js → chunk-MKVKVJQQ.js} +32 -19
- package/dist/chunk-MKVKVJQQ.js.map +1 -0
- package/dist/chunk-ML2ROCYA.cjs +287 -0
- package/dist/chunk-ML2ROCYA.cjs.map +1 -0
- package/dist/{chunk-STKMIMLP.cjs → chunk-MP5HOP7N.cjs} +12 -12
- package/dist/{chunk-STKMIMLP.cjs.map → chunk-MP5HOP7N.cjs.map} +1 -1
- package/dist/{chunk-NKGNRFSS.js → chunk-SEVJT2HP.js} +8 -8
- package/dist/{chunk-FSS2MIEA.cjs → chunk-SGJBUL2Y.cjs} +20 -3
- package/dist/chunk-SGJBUL2Y.cjs.map +1 -0
- package/dist/{chunk-WD2MZVJI.js → chunk-V35PZSUA.js} +5 -5
- package/dist/{chunk-LJGBFD52.js → chunk-VAUI3CND.js} +18 -1
- package/dist/chunk-VAUI3CND.js.map +1 -0
- package/dist/{chunk-OB45JHDY.cjs → chunk-VFKQMAUF.cjs} +3 -3
- package/dist/{chunk-OB45JHDY.cjs.map → chunk-VFKQMAUF.cjs.map} +1 -1
- package/dist/{chunk-RJC3L5DT.cjs → chunk-VXP553WT.cjs} +7 -7
- package/dist/{chunk-RJC3L5DT.cjs.map → chunk-VXP553WT.cjs.map} +1 -1
- package/dist/components/chat/chat-message-list.d.ts.map +1 -1
- package/dist/components/chat/hooks/use-chat-card-item.d.ts.map +1 -1
- package/dist/components/chat/index.cjs +6 -16
- package/dist/components/chat/index.cjs.map +1 -1
- package/dist/components/chat/index.js +5 -15
- package/dist/components/chat/types/entities/content-ref.d.ts +5 -20
- package/dist/components/chat/types/entities/content-ref.d.ts.map +1 -1
- package/dist/components/chat/utils/index.d.ts +0 -1
- package/dist/components/chat/utils/index.d.ts.map +1 -1
- package/dist/components/contact/index.cjs +7 -7
- package/dist/components/contact/index.js +6 -6
- package/dist/components/faq/faq-section.d.ts +7 -1
- package/dist/components/faq/faq-section.d.ts.map +1 -1
- package/dist/components/faq/index.cjs +3 -3
- package/dist/components/faq/index.js +2 -2
- package/dist/components/features/index.cjs +6 -6
- package/dist/components/features/index.js +5 -5
- package/dist/components/features/policy-configuration-panel.d.ts.map +1 -1
- package/dist/components/index.cjs +87 -93
- package/dist/components/index.cjs.map +1 -1
- package/dist/components/index.d.ts +1 -0
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/index.js +31 -37
- package/dist/components/index.js.map +1 -1
- package/dist/components/navigation/index.cjs +6 -6
- package/dist/components/navigation/index.js +5 -5
- package/dist/components/onboarding-guides/index.cjs +30 -30
- package/dist/components/onboarding-guides/index.cjs.map +1 -1
- package/dist/components/onboarding-guides/index.js +11 -11
- package/dist/components/related-content/index.cjs +26 -0
- package/dist/components/related-content/index.cjs.map +1 -0
- package/dist/components/related-content/index.d.ts +2 -0
- package/dist/components/related-content/index.d.ts.map +1 -0
- package/dist/components/related-content/index.js +26 -0
- package/dist/components/related-content/index.js.map +1 -0
- package/dist/components/related-content/related-content-section.d.ts +149 -0
- package/dist/components/related-content/related-content-section.d.ts.map +1 -0
- package/dist/components/tickets/index.cjs +73 -73
- package/dist/components/tickets/index.cjs.map +1 -1
- package/dist/components/tickets/index.js +15 -15
- package/dist/components/ui/index.cjs +9 -19
- package/dist/components/ui/index.cjs.map +1 -1
- package/dist/components/ui/index.js +13 -23
- package/dist/embed-shims/index.cjs +3 -3
- package/dist/embed-shims/index.cjs.map +1 -1
- package/dist/embed-shims/index.js +5 -5
- package/dist/index.cjs +17 -11
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +55 -49
- package/dist/types/content-ref.d.ts +35 -0
- package/dist/types/content-ref.d.ts.map +1 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/utils/content-ref-groups.d.ts +58 -0
- package/dist/utils/content-ref-groups.d.ts.map +1 -0
- package/dist/utils/extract-items.d.ts +18 -0
- package/dist/utils/extract-items.d.ts.map +1 -0
- package/dist/utils/index.cjs +81 -0
- package/dist/utils/index.cjs.map +1 -1
- package/dist/utils/index.d.ts +4 -1
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +74 -1
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/list-url.d.ts +6 -0
- package/dist/utils/list-url.d.ts.map +1 -1
- package/dist/utils/suggestion-url.d.ts +26 -0
- package/dist/utils/suggestion-url.d.ts.map +1 -0
- package/package.json +7 -1
- package/src/components/chat/chat-message-list.tsx +49 -74
- package/src/components/chat/hooks/use-chat-card-item.ts +3 -38
- package/src/components/chat/types/entities/content-ref.ts +5 -21
- package/src/components/chat/utils/index.ts +0 -12
- package/src/components/faq/faq-section.tsx +69 -24
- package/src/components/features/policy-configuration-panel.tsx +0 -1
- package/src/components/index.ts +1 -0
- package/src/components/related-content/index.ts +9 -0
- package/src/components/related-content/related-content-section.tsx +630 -0
- package/src/types/content-ref.ts +34 -0
- package/src/types/index.ts +1 -0
- package/src/utils/content-ref-groups.ts +89 -0
- package/src/utils/extract-items.ts +48 -0
- package/src/utils/index.ts +16 -1
- package/src/utils/list-url.ts +9 -0
- package/src/utils/suggestion-url.ts +39 -0
- package/dist/chunk-APGMNHPY.js.map +0 -1
- package/dist/chunk-DV3YZWGN.cjs.map +0 -1
- package/dist/chunk-EPXROXYC.cjs.map +0 -1
- package/dist/chunk-FSS2MIEA.cjs.map +0 -1
- package/dist/chunk-LJGBFD52.js.map +0 -1
- package/dist/chunk-M7DPUWAL.js.map +0 -1
- package/dist/components/chat/utils/history-merge.d.ts +0 -92
- package/dist/components/chat/utils/history-merge.d.ts.map +0 -1
- package/src/components/chat/__tests__/chat-message-list.test.tsx +0 -92
- package/src/components/chat/utils/__tests__/history-merge.test.ts +0 -339
- package/src/components/chat/utils/history-merge.ts +0 -255
- /package/dist/{chunk-ORJREQ2W.js.map → chunk-4XLJWX2N.js.map} +0 -0
- /package/dist/{chunk-P5C732SC.js.map → chunk-7ZHFCEJH.js.map} +0 -0
- /package/dist/{chunk-PTSAF7T2.js.map → chunk-JJV3XGCY.js.map} +0 -0
- /package/dist/{chunk-NKGNRFSS.js.map → chunk-SEVJT2HP.js.map} +0 -0
- /package/dist/{chunk-WD2MZVJI.js.map → chunk-V35PZSUA.js.map} +0 -0
|
@@ -1,4 +1,24 @@
|
|
|
1
1
|
"use client";
|
|
2
|
+
import {
|
|
3
|
+
ToolIcon,
|
|
4
|
+
dotColorByVariant,
|
|
5
|
+
getSmallPlatformIcon,
|
|
6
|
+
progressColorByVariant,
|
|
7
|
+
toolLabels,
|
|
8
|
+
useAutoLimitTags,
|
|
9
|
+
useCopyToClipboard,
|
|
10
|
+
useDebounce,
|
|
11
|
+
useHorizontalScrollbar,
|
|
12
|
+
useHumanitySignals,
|
|
13
|
+
useImageEdgeColor,
|
|
14
|
+
useLgUp,
|
|
15
|
+
useLocalStorage,
|
|
16
|
+
useMdUp,
|
|
17
|
+
useNearViewport,
|
|
18
|
+
useOgPlaceholder,
|
|
19
|
+
useOnboardingState,
|
|
20
|
+
useToast
|
|
21
|
+
} from "./chunk-UECRKCKH.js";
|
|
2
22
|
import {
|
|
3
23
|
useChatRuntime,
|
|
4
24
|
useRequiredChatRuntime
|
|
@@ -9,6 +29,12 @@ import {
|
|
|
9
29
|
import {
|
|
10
30
|
dynamic
|
|
11
31
|
} from "./chunk-EL5YVPD5.js";
|
|
32
|
+
import {
|
|
33
|
+
init_next_navigation,
|
|
34
|
+
usePathname,
|
|
35
|
+
useRouter,
|
|
36
|
+
useSearchParams
|
|
37
|
+
} from "./chunk-PLJLE4A4.js";
|
|
12
38
|
import {
|
|
13
39
|
Button,
|
|
14
40
|
Checkbox,
|
|
@@ -30,32 +56,6 @@ import {
|
|
|
30
56
|
init_next_link,
|
|
31
57
|
next_link_default
|
|
32
58
|
} from "./chunk-OHPI2HRK.js";
|
|
33
|
-
import {
|
|
34
|
-
ToolIcon,
|
|
35
|
-
dotColorByVariant,
|
|
36
|
-
getSmallPlatformIcon,
|
|
37
|
-
progressColorByVariant,
|
|
38
|
-
toolLabels,
|
|
39
|
-
useAutoLimitTags,
|
|
40
|
-
useCopyToClipboard,
|
|
41
|
-
useDebounce,
|
|
42
|
-
useHorizontalScrollbar,
|
|
43
|
-
useHumanitySignals,
|
|
44
|
-
useImageEdgeColor,
|
|
45
|
-
useLgUp,
|
|
46
|
-
useLocalStorage,
|
|
47
|
-
useMdUp,
|
|
48
|
-
useNearViewport,
|
|
49
|
-
useOgPlaceholder,
|
|
50
|
-
useOnboardingState,
|
|
51
|
-
useToast
|
|
52
|
-
} from "./chunk-UECRKCKH.js";
|
|
53
|
-
import {
|
|
54
|
-
init_next_navigation,
|
|
55
|
-
usePathname,
|
|
56
|
-
useRouter,
|
|
57
|
-
useSearchParams
|
|
58
|
-
} from "./chunk-PLJLE4A4.js";
|
|
59
59
|
import {
|
|
60
60
|
BashIcon,
|
|
61
61
|
ClickUpIcon,
|
|
@@ -4397,15 +4397,12 @@ var ChatMessageList = forwardRef13(
|
|
|
4397
4397
|
onLoadMoreRef.current = onLoadMore;
|
|
4398
4398
|
const isFetchingRef = useRef6(isFetchingNextPage);
|
|
4399
4399
|
isFetchingRef.current = isFetchingNextPage;
|
|
4400
|
-
const dialogIdRef = useRef6(dialogId);
|
|
4401
|
-
dialogIdRef.current = dialogId;
|
|
4402
4400
|
const prevRenderRef = useRef6({ dialogId: void 0, messageCount: 0, lastMessageId: void 0 });
|
|
4403
|
-
const
|
|
4401
|
+
const prependRef = useRef6({ firstMessageId: void 0, firstMessageContent: void 0, scrollHeight: 0 });
|
|
4404
4402
|
useEffect6(() => {
|
|
4405
4403
|
if (!autoScroll) return;
|
|
4406
4404
|
const dialogChanged = dialogId !== prevRenderRef.current.dialogId;
|
|
4407
4405
|
const prevCount = prevRenderRef.current.messageCount;
|
|
4408
|
-
const prevLastId = prevRenderRef.current.lastMessageId;
|
|
4409
4406
|
const newCount = messages.length;
|
|
4410
4407
|
const currentLastId = messages[messages.length - 1]?.id;
|
|
4411
4408
|
prevRenderRef.current = { dialogId, messageCount: newCount, lastMessageId: currentLastId };
|
|
@@ -4418,8 +4415,7 @@ var ChatMessageList = forwardRef13(
|
|
|
4418
4415
|
return;
|
|
4419
4416
|
}
|
|
4420
4417
|
if (newCount > prevCount) {
|
|
4421
|
-
const
|
|
4422
|
-
const newSlice = prevLastIdx >= 0 ? messages.slice(prevLastIdx + 1) : messages.slice(prevCount);
|
|
4418
|
+
const newSlice = messages.slice(prevCount);
|
|
4423
4419
|
const hasNewUser = newSlice.some((m) => m.role === "user");
|
|
4424
4420
|
if (hasNewUser) {
|
|
4425
4421
|
void scrollToBottom({ animation: "instant", ignoreEscapes: true });
|
|
@@ -4443,17 +4439,34 @@ var ChatMessageList = forwardRef13(
|
|
|
4443
4439
|
}, [autoScroll, messages, dialogId, scrollToBottom, contentRef]);
|
|
4444
4440
|
useLayoutEffect3(() => {
|
|
4445
4441
|
const el = scrollRef.current;
|
|
4446
|
-
|
|
4447
|
-
|
|
4448
|
-
|
|
4449
|
-
|
|
4442
|
+
if (!el) {
|
|
4443
|
+
prependRef.current = { firstMessageId: void 0, firstMessageContent: void 0, scrollHeight: 0 };
|
|
4444
|
+
return;
|
|
4445
|
+
}
|
|
4446
|
+
const currentFirstId = messages[0]?.id;
|
|
4447
|
+
const currentFirstContent = messages[0]?.content;
|
|
4448
|
+
const prevFirstId = prependRef.current.firstMessageId;
|
|
4449
|
+
const prevHeight = prependRef.current.scrollHeight;
|
|
4450
|
+
if (currentFirstId !== prevFirstId) {
|
|
4451
|
+
if (prevFirstId && prevHeight > 0) {
|
|
4452
|
+
const prevIdx = messages.findIndex((m) => m.id === prevFirstId);
|
|
4453
|
+
if (prevIdx > 0) {
|
|
4454
|
+
const addedHeight = el.scrollHeight - prevHeight;
|
|
4455
|
+
if (addedHeight > 0) el.scrollTop += addedHeight;
|
|
4456
|
+
}
|
|
4457
|
+
}
|
|
4458
|
+
prependRef.current = {
|
|
4459
|
+
firstMessageId: currentFirstId,
|
|
4460
|
+
firstMessageContent: currentFirstContent,
|
|
4461
|
+
scrollHeight: el.scrollHeight
|
|
4462
|
+
};
|
|
4450
4463
|
return;
|
|
4451
4464
|
}
|
|
4452
|
-
|
|
4453
|
-
if (
|
|
4454
|
-
|
|
4455
|
-
|
|
4456
|
-
}, [messages,
|
|
4465
|
+
prependRef.current.scrollHeight = el.scrollHeight;
|
|
4466
|
+
if (currentFirstContent !== prependRef.current.firstMessageContent) {
|
|
4467
|
+
prependRef.current.firstMessageContent = currentFirstContent;
|
|
4468
|
+
}
|
|
4469
|
+
}, [messages, scrollRef]);
|
|
4457
4470
|
const messageElsRef = useRef6(/* @__PURE__ */ new Map());
|
|
4458
4471
|
const refCallbacksRef = useRef6(/* @__PURE__ */ new Map());
|
|
4459
4472
|
const getRegisterMessageEl = (id) => {
|
|
@@ -4525,14 +4538,6 @@ var ChatMessageList = forwardRef13(
|
|
|
4525
4538
|
const entry = entries[0];
|
|
4526
4539
|
if (!entry) return;
|
|
4527
4540
|
if (entry.isIntersecting && !isFetchingRef.current) {
|
|
4528
|
-
const el = scrollRef.current;
|
|
4529
|
-
if (el) {
|
|
4530
|
-
loadOlderAnchorRef.current = {
|
|
4531
|
-
dialogId: dialogIdRef.current,
|
|
4532
|
-
scrollHeight: el.scrollHeight,
|
|
4533
|
-
scrollTop: el.scrollTop
|
|
4534
|
-
};
|
|
4535
|
-
}
|
|
4536
4541
|
onLoadMoreRef.current?.();
|
|
4537
4542
|
}
|
|
4538
4543
|
},
|
|
@@ -4540,7 +4545,7 @@ var ChatMessageList = forwardRef13(
|
|
|
4540
4545
|
);
|
|
4541
4546
|
observer.observe(sentinelElement);
|
|
4542
4547
|
return () => observer.disconnect();
|
|
4543
|
-
}, [hasNextPage,
|
|
4548
|
+
}, [hasNextPage, scrollRef]);
|
|
4544
4549
|
useImperativeHandle2(ref, () => scrollRef.current, [scrollRef]);
|
|
4545
4550
|
if (isLoading) {
|
|
4546
4551
|
return /* @__PURE__ */ jsx26(
|
|
@@ -17127,6 +17132,9 @@ function scrollElementIntoView(target, options = {}) {
|
|
|
17127
17132
|
|
|
17128
17133
|
// src/utils/list-url.ts
|
|
17129
17134
|
var ALIASES = { blog_post_existing: "blog_post" };
|
|
17135
|
+
function canonicalContentRefType(contentRefType) {
|
|
17136
|
+
return ALIASES[contentRefType] ?? contentRefType;
|
|
17137
|
+
}
|
|
17130
17138
|
var BUILDERS = {
|
|
17131
17139
|
roadmap_item: (ids, b) => `${b}/api/roadmap?task_ids=${ids.join(",")}`,
|
|
17132
17140
|
delivery_item: (ids, b) => `${b}/api/delivery?task_ids=${ids.join(",")}`,
|
|
@@ -17151,6 +17159,60 @@ function buildListUrl(contentRefType, ids, base = "") {
|
|
|
17151
17159
|
return fn ? fn(ids, base) : null;
|
|
17152
17160
|
}
|
|
17153
17161
|
|
|
17162
|
+
// src/utils/content-ref-groups.ts
|
|
17163
|
+
var CONTENT_REF_GROUPS = {
|
|
17164
|
+
investor_update: { label: "Investor Updates", order: 1, layout: "grid", gridSize: "default" },
|
|
17165
|
+
product_release: { label: "Product Releases", order: 2, layout: "list", gridSize: "lg" },
|
|
17166
|
+
podcast: { label: "Podcasts", order: 3, layout: "list", gridSize: "default" },
|
|
17167
|
+
webinar: { label: "Webinars", order: 4, layout: "list", gridSize: "default" },
|
|
17168
|
+
case_study: { label: "Case Studies", order: 5, layout: "grid", gridSize: "default" },
|
|
17169
|
+
event: { label: "Events", order: 6, layout: "list", gridSize: "default" },
|
|
17170
|
+
blog_post_existing: { label: "Blog Posts", order: 7, layout: "grid", gridSize: "default" },
|
|
17171
|
+
customer_interview: { label: "Customer Interviews", order: 8, layout: "grid", gridSize: "default" },
|
|
17172
|
+
onboarding_guide: { label: "Onboarding Guides", order: 9, layout: "list", gridSize: "default" }
|
|
17173
|
+
};
|
|
17174
|
+
function getContentRefLabel(type) {
|
|
17175
|
+
return CONTENT_REF_GROUPS[type]?.label ?? null;
|
|
17176
|
+
}
|
|
17177
|
+
function getContentRefLabelOrTitleCase(type) {
|
|
17178
|
+
return CONTENT_REF_GROUPS[type]?.label ?? type.replace(/_/g, " ").replace(/\b\w/g, (ch) => ch.toUpperCase());
|
|
17179
|
+
}
|
|
17180
|
+
function orderContentRefTypes(present) {
|
|
17181
|
+
const presentSet = new Set(present);
|
|
17182
|
+
const registeredInOrder = Object.entries(CONTENT_REF_GROUPS).sort(([, a], [, b]) => a.order - b.order).map(([type]) => type).filter((type) => presentSet.has(type));
|
|
17183
|
+
const unregistered = [...presentSet].filter((type) => !CONTENT_REF_GROUPS[type]);
|
|
17184
|
+
return [...registeredInOrder, ...unregistered];
|
|
17185
|
+
}
|
|
17186
|
+
|
|
17187
|
+
// src/utils/extract-items.ts
|
|
17188
|
+
function extractItems(data) {
|
|
17189
|
+
if (!data || typeof data !== "object") return [];
|
|
17190
|
+
const obj = data;
|
|
17191
|
+
if (Array.isArray(obj.items)) return obj.items;
|
|
17192
|
+
if (Array.isArray(obj.posts)) return obj.posts;
|
|
17193
|
+
if (Array.isArray(obj.campaigns)) return obj.campaigns;
|
|
17194
|
+
if (Array.isArray(obj.completed) || Array.isArray(obj.inProgress)) {
|
|
17195
|
+
const completed = Array.isArray(obj.completed) ? obj.completed : [];
|
|
17196
|
+
const inProgress = Array.isArray(obj.inProgress) ? obj.inProgress : [];
|
|
17197
|
+
return [...completed, ...inProgress];
|
|
17198
|
+
}
|
|
17199
|
+
if (Array.isArray(obj.data)) return obj.data;
|
|
17200
|
+
if (Array.isArray(data)) return data;
|
|
17201
|
+
return [];
|
|
17202
|
+
}
|
|
17203
|
+
function extractItemId(type, item) {
|
|
17204
|
+
if (!item || typeof item !== "object") return null;
|
|
17205
|
+
const obj = item;
|
|
17206
|
+
if (type === "roadmap_item" || type === "delivery_item" || type === "internal_task") {
|
|
17207
|
+
const ext = obj.external_id;
|
|
17208
|
+
if (typeof ext === "string") return ext;
|
|
17209
|
+
}
|
|
17210
|
+
const id = obj.id;
|
|
17211
|
+
if (typeof id === "string") return id;
|
|
17212
|
+
if (typeof id === "number") return String(id);
|
|
17213
|
+
return null;
|
|
17214
|
+
}
|
|
17215
|
+
|
|
17154
17216
|
// src/utils/content-href.ts
|
|
17155
17217
|
var DEFAULT_CONTENT_SUFFIXES = {
|
|
17156
17218
|
onboarding_guide: "onboarding-guides",
|
|
@@ -23837,7 +23899,6 @@ var CategorySection = ({
|
|
|
23837
23899
|
/* @__PURE__ */ jsx195(
|
|
23838
23900
|
Button,
|
|
23839
23901
|
{
|
|
23840
|
-
type: "button",
|
|
23841
23902
|
variant: "transparent",
|
|
23842
23903
|
onClick: (e) => {
|
|
23843
23904
|
e.stopPropagation();
|
|
@@ -36485,33 +36546,6 @@ init_next_navigation();
|
|
|
36485
36546
|
|
|
36486
36547
|
// src/components/chat/hooks/use-chat-card-item.ts
|
|
36487
36548
|
import { useQuery } from "@tanstack/react-query";
|
|
36488
|
-
function extractItems(data) {
|
|
36489
|
-
if (!data || typeof data !== "object") return [];
|
|
36490
|
-
const obj = data;
|
|
36491
|
-
if (Array.isArray(obj.items)) return obj.items;
|
|
36492
|
-
if (Array.isArray(obj.posts)) return obj.posts;
|
|
36493
|
-
if (Array.isArray(obj.campaigns)) return obj.campaigns;
|
|
36494
|
-
if (Array.isArray(obj.completed) || Array.isArray(obj.inProgress)) {
|
|
36495
|
-
const completed = Array.isArray(obj.completed) ? obj.completed : [];
|
|
36496
|
-
const inProgress = Array.isArray(obj.inProgress) ? obj.inProgress : [];
|
|
36497
|
-
return [...completed, ...inProgress];
|
|
36498
|
-
}
|
|
36499
|
-
if (Array.isArray(obj.data)) return obj.data;
|
|
36500
|
-
if (Array.isArray(data)) return data;
|
|
36501
|
-
return [];
|
|
36502
|
-
}
|
|
36503
|
-
function extractItemId(type, item) {
|
|
36504
|
-
if (!item || typeof item !== "object") return null;
|
|
36505
|
-
const obj = item;
|
|
36506
|
-
if (type === "roadmap_item" || type === "delivery_item" || type === "internal_task") {
|
|
36507
|
-
const ext = obj.external_id;
|
|
36508
|
-
if (typeof ext === "string") return ext;
|
|
36509
|
-
}
|
|
36510
|
-
const id = obj.id;
|
|
36511
|
-
if (typeof id === "string") return id;
|
|
36512
|
-
if (typeof id === "number") return String(id);
|
|
36513
|
-
return null;
|
|
36514
|
-
}
|
|
36515
36549
|
function useChatCardItem(type, id) {
|
|
36516
36550
|
const runtime = useRequiredChatRuntime();
|
|
36517
36551
|
const url = runtime.endpoints.buildListUrl(type, [id]);
|
|
@@ -42061,110 +42095,6 @@ function extractIncompleteMessageState(lastMessage) {
|
|
|
42061
42095
|
};
|
|
42062
42096
|
}
|
|
42063
42097
|
|
|
42064
|
-
// src/components/chat/utils/history-merge.ts
|
|
42065
|
-
var SYNTHETIC_REALTIME_ID_PREFIXES = ["assistant-", "user-", "error-"];
|
|
42066
|
-
function isSyntheticRealtimeId(id) {
|
|
42067
|
-
return SYNTHETIC_REALTIME_ID_PREFIXES.some((prefix) => id.startsWith(prefix));
|
|
42068
|
-
}
|
|
42069
|
-
function flattenMessagePagesChronological(pages) {
|
|
42070
|
-
if (!pages) return [];
|
|
42071
|
-
return [...pages].reverse().flatMap((page) => [...page.messages].reverse());
|
|
42072
|
-
}
|
|
42073
|
-
function maxPersistedStreamSeq(pages) {
|
|
42074
|
-
let max = 0;
|
|
42075
|
-
if (!pages) return max;
|
|
42076
|
-
for (const page of pages) {
|
|
42077
|
-
for (const msg of page.messages) {
|
|
42078
|
-
const seq = msg.lastChunkStreamSeq;
|
|
42079
|
-
if (typeof seq === "number" && seq > max) max = seq;
|
|
42080
|
-
}
|
|
42081
|
-
}
|
|
42082
|
-
return max;
|
|
42083
|
-
}
|
|
42084
|
-
function mergeHistoryWithRealtime(input) {
|
|
42085
|
-
const {
|
|
42086
|
-
processedHistory,
|
|
42087
|
-
rawHistoryIds,
|
|
42088
|
-
existingMessages,
|
|
42089
|
-
streamingMessageId,
|
|
42090
|
-
historyFetchedAt,
|
|
42091
|
-
historyMaxStreamSeq = 0,
|
|
42092
|
-
realtimeSeenStreamSeq = 0
|
|
42093
|
-
} = input;
|
|
42094
|
-
if (processedHistory.length === 0) return existingMessages;
|
|
42095
|
-
const processedIds = new Set(processedHistory.map((m) => m.id));
|
|
42096
|
-
const seqCoverageKnown = realtimeSeenStreamSeq > 0 && historyMaxStreamSeq > 0;
|
|
42097
|
-
const historyCoversRealtime = seqCoverageKnown ? historyMaxStreamSeq >= realtimeSeenStreamSeq : null;
|
|
42098
|
-
const trailing = processedHistory[processedHistory.length - 1];
|
|
42099
|
-
const historyTrailingAssistant = trailing?.role === "assistant" ? trailing : null;
|
|
42100
|
-
const historyBatchId = historyTrailingAssistant && Array.isArray(historyTrailingAssistant.content) ? historyTrailingAssistant.content.find((s) => s.type === "approval_batch")?.data?.approvalRequestId ?? null : null;
|
|
42101
|
-
let processedToUse = processedHistory;
|
|
42102
|
-
const pinnedSyntheticIds = /* @__PURE__ */ new Set();
|
|
42103
|
-
const droppedSyntheticIds = /* @__PURE__ */ new Set();
|
|
42104
|
-
if (historyBatchId) {
|
|
42105
|
-
const batchTwins = existingMessages.filter(
|
|
42106
|
-
(m) => m.role === "assistant" && Array.isArray(m.content) && m.content.some(
|
|
42107
|
-
(s) => s.type === "approval_batch" && s.data?.approvalRequestId === historyBatchId
|
|
42108
|
-
)
|
|
42109
|
-
);
|
|
42110
|
-
const existingWithSameBatch = batchTwins.find((m) => m.id === streamingMessageId) ?? batchTwins[batchTwins.length - 1];
|
|
42111
|
-
if (existingWithSameBatch && Array.isArray(existingWithSameBatch.content)) {
|
|
42112
|
-
const histSize = Array.isArray(historyTrailingAssistant?.content) ? historyTrailingAssistant.content.length : 0;
|
|
42113
|
-
const realtimeSize = existingWithSameBatch.content.length;
|
|
42114
|
-
if (existingWithSameBatch.id === streamingMessageId || realtimeSize > histSize) {
|
|
42115
|
-
processedToUse = processedHistory.slice(0, -1);
|
|
42116
|
-
pinnedSyntheticIds.add(existingWithSameBatch.id);
|
|
42117
|
-
} else {
|
|
42118
|
-
droppedSyntheticIds.add(existingWithSameBatch.id);
|
|
42119
|
-
}
|
|
42120
|
-
}
|
|
42121
|
-
}
|
|
42122
|
-
const realtimeMessages = existingMessages.filter((m) => {
|
|
42123
|
-
if (pinnedSyntheticIds.has(m.id)) return true;
|
|
42124
|
-
if (droppedSyntheticIds.has(m.id)) return false;
|
|
42125
|
-
if (processedIds.has(m.id)) return false;
|
|
42126
|
-
if (rawHistoryIds?.has(m.id)) return false;
|
|
42127
|
-
if (m.role === "user" && m.id.startsWith("optimistic-") && typeof m.content === "string") {
|
|
42128
|
-
const canBeInSnapshot = (m.timestamp?.getTime() ?? 0) <= historyFetchedAt;
|
|
42129
|
-
return !(canBeInSnapshot && processedToUse.some((pm) => pm.role === "user" && pm.content === m.content));
|
|
42130
|
-
}
|
|
42131
|
-
if (isSyntheticRealtimeId(m.id) && m.id !== streamingMessageId) {
|
|
42132
|
-
const covered = historyCoversRealtime !== null ? historyCoversRealtime : (m.timestamp?.getTime() ?? 0) <= historyFetchedAt;
|
|
42133
|
-
if (covered) return false;
|
|
42134
|
-
}
|
|
42135
|
-
return true;
|
|
42136
|
-
});
|
|
42137
|
-
return [...processedToUse, ...realtimeMessages];
|
|
42138
|
-
}
|
|
42139
|
-
function computeHistoryPrepend(processedHistory, existingMessages) {
|
|
42140
|
-
const existingIds = new Set(existingMessages.map((m) => m.id));
|
|
42141
|
-
const newMessages = [];
|
|
42142
|
-
let boundaryMessageIndex = -1;
|
|
42143
|
-
for (let i = 0; i < processedHistory.length; i++) {
|
|
42144
|
-
if (existingIds.has(processedHistory[i].id)) {
|
|
42145
|
-
boundaryMessageIndex = i;
|
|
42146
|
-
break;
|
|
42147
|
-
}
|
|
42148
|
-
newMessages.push(processedHistory[i]);
|
|
42149
|
-
}
|
|
42150
|
-
let boundaryMessageId;
|
|
42151
|
-
let boundaryUpdates;
|
|
42152
|
-
if (boundaryMessageIndex >= 0) {
|
|
42153
|
-
const boundaryMessage = processedHistory[boundaryMessageIndex];
|
|
42154
|
-
const existingBoundary = existingMessages.find((m) => m.id === boundaryMessage.id);
|
|
42155
|
-
if (existingBoundary) {
|
|
42156
|
-
const existingContent = JSON.stringify(existingBoundary.content);
|
|
42157
|
-
const newContent = JSON.stringify(boundaryMessage.content);
|
|
42158
|
-
if (existingContent !== newContent) {
|
|
42159
|
-
boundaryMessageId = boundaryMessage.id;
|
|
42160
|
-
boundaryUpdates = { content: boundaryMessage.content };
|
|
42161
|
-
}
|
|
42162
|
-
}
|
|
42163
|
-
}
|
|
42164
|
-
if (newMessages.length === 0 && !boundaryUpdates) return null;
|
|
42165
|
-
return { newMessages, boundaryMessageId, boundaryUpdates };
|
|
42166
|
-
}
|
|
42167
|
-
|
|
42168
42098
|
// src/components/chat/utils/chip-action-class.ts
|
|
42169
42099
|
var CHIP_ACTION_BUTTON_CLASS = "text-[11px] font-medium text-ods-text-secondary hover:text-ods-text-primary bg-transparent hover:bg-ods-card-hover border border-ods-border rounded-md px-2 py-1 transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ods-focus";
|
|
42170
42100
|
|
|
@@ -43675,6 +43605,8 @@ export {
|
|
|
43675
43605
|
applyProxyAuth,
|
|
43676
43606
|
setEmbedAuthAdapter,
|
|
43677
43607
|
embedAuthedFetch,
|
|
43608
|
+
extractItems,
|
|
43609
|
+
extractItemId,
|
|
43678
43610
|
useChatCardItem,
|
|
43679
43611
|
SOURCE_ICON_NAMES,
|
|
43680
43612
|
getSourceIconName,
|
|
@@ -43743,11 +43675,6 @@ export {
|
|
|
43743
43675
|
useNatsChatAdapter,
|
|
43744
43676
|
useUnifiedChat,
|
|
43745
43677
|
extractIncompleteMessageState,
|
|
43746
|
-
SYNTHETIC_REALTIME_ID_PREFIXES,
|
|
43747
|
-
flattenMessagePagesChronological,
|
|
43748
|
-
maxPersistedStreamSeq,
|
|
43749
|
-
mergeHistoryWithRealtime,
|
|
43750
|
-
computeHistoryPrepend,
|
|
43751
43678
|
CHIP_ACTION_BUTTON_CLASS,
|
|
43752
43679
|
chatChipClass,
|
|
43753
43680
|
clickupTaskUrl,
|
|
@@ -43853,7 +43780,12 @@ export {
|
|
|
43853
43780
|
TICKET_STATUS_OPTIONS,
|
|
43854
43781
|
OPENFRAME_DEV_SECTIONS,
|
|
43855
43782
|
scrollElementIntoView,
|
|
43783
|
+
canonicalContentRefType,
|
|
43856
43784
|
buildListUrl,
|
|
43785
|
+
CONTENT_REF_GROUPS,
|
|
43786
|
+
getContentRefLabel,
|
|
43787
|
+
getContentRefLabelOrTitleCase,
|
|
43788
|
+
orderContentRefTypes,
|
|
43857
43789
|
DEFAULT_CONTENT_SUFFIXES,
|
|
43858
43790
|
makeComposeContentUrl,
|
|
43859
43791
|
buildDefaultHref,
|
|
@@ -44096,4 +44028,4 @@ export {
|
|
|
44096
44028
|
LogsList,
|
|
44097
44029
|
assets
|
|
44098
44030
|
};
|
|
44099
|
-
//# sourceMappingURL=chunk-
|
|
44031
|
+
//# sourceMappingURL=chunk-FRRMXLU5.js.map
|