@8wave/ai-elements 0.124.0-beta.9 → 0.124.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (95) hide show
  1. package/dist/_chunks/{PkFilePreview-D_piCsAW.js → PkFilePreview-BwHe4-m1.js} +368 -346
  2. package/dist/_chunks/PkFilePreview-BwHe4-m1.js.map +1 -0
  3. package/dist/_chunks/{PkFilePreviewDialog-Bq0ipzrJ.js → PkFilePreviewDialog-LWxNgkzk.js} +2 -2
  4. package/dist/_chunks/{PkFilePreviewDialog-Bq0ipzrJ.js.map → PkFilePreviewDialog-LWxNgkzk.js.map} +1 -1
  5. package/dist/_chunks/{PkStreamingMarkdown-CHwrLP75.js → PkStreamingMarkdown-BvgO6aHe.js} +2 -2
  6. package/dist/_chunks/{PkStreamingMarkdown-CHwrLP75.js.map → PkStreamingMarkdown-BvgO6aHe.js.map} +1 -1
  7. package/dist/_chunks/{PkToolChatFile-DO4zjMJr.js → PkToolChatFile-OuaeZTxw.js} +62 -54
  8. package/dist/_chunks/PkToolChatFile-OuaeZTxw.js.map +1 -0
  9. package/dist/_chunks/{PkToolShowArtifact-B2-3-k2F.js → PkToolShowArtifact-BqgW3E6D.js} +2 -2
  10. package/dist/_chunks/{PkToolShowArtifact-B2-3-k2F.js.map → PkToolShowArtifact-BqgW3E6D.js.map} +1 -1
  11. package/dist/_chunks/{PkToolShowContactForm-DbOZHB_G.js → PkToolShowContactForm-DDDXopZp.js} +2 -2
  12. package/dist/_chunks/{PkToolShowContactForm-DbOZHB_G.js.map → PkToolShowContactForm-DDDXopZp.js.map} +1 -1
  13. package/dist/_chunks/{PkToolShowForm-o2LuWDNq.js → PkToolShowForm-D2LZ8Kkl.js} +3 -3
  14. package/dist/_chunks/{PkToolShowForm-o2LuWDNq.js.map → PkToolShowForm-D2LZ8Kkl.js.map} +1 -1
  15. package/dist/_chunks/{PkToolShowSources-CUNneZCp.js → PkToolShowSources-DA4SOt-H.js} +2 -2
  16. package/dist/_chunks/{PkToolShowSources-CUNneZCp.js.map → PkToolShowSources-DA4SOt-H.js.map} +1 -1
  17. package/dist/_chunks/excelNumberFormat-CIbRUEwQ.js +543 -0
  18. package/dist/_chunks/excelNumberFormat-CIbRUEwQ.js.map +1 -0
  19. package/dist/_chunks/{utils-BHvRrCzW.js → utils-euH8esYP.js} +7 -6
  20. package/dist/_chunks/utils-euH8esYP.js.map +1 -0
  21. package/dist/ai-elements.es.js +8 -8
  22. package/dist-vue/PkChatbot.js +1 -1
  23. package/dist-vue/PkChatbotEmptyState.js +1 -1
  24. package/dist-vue/PkChatbotInput.js +1 -1
  25. package/dist-vue/PkChatbotMessages.js +1 -1
  26. package/dist-vue/PkChatbotStepPayload.js +1 -1
  27. package/dist-vue/PkChatbotStepToolDetail.js +1 -1
  28. package/dist-vue/PkChatbotSteps.js +1 -1
  29. package/dist-vue/PkChatbotViewChat.js +1 -1
  30. package/dist-vue/PkChatbotViewConversations.js +1 -1
  31. package/dist-vue/_chunks/{PkChatbot-DQssgXm3.js → PkChatbot-BRttF7Lo.js} +5 -5
  32. package/dist-vue/_chunks/{PkChatbot-DQssgXm3.js.map → PkChatbot-BRttF7Lo.js.map} +1 -1
  33. package/dist-vue/_chunks/{PkChatbotEmptyState-B6qxJAPT.js → PkChatbotEmptyState-CLOH5Z2d.js} +2 -2
  34. package/dist-vue/_chunks/{PkChatbotEmptyState-B6qxJAPT.js.map → PkChatbotEmptyState-CLOH5Z2d.js.map} +1 -1
  35. package/dist-vue/_chunks/{PkChatbotInput-Bk8OS1xU.js → PkChatbotInput-BK7f1jFE.js} +2 -2
  36. package/dist-vue/_chunks/{PkChatbotInput-Bk8OS1xU.js.map → PkChatbotInput-BK7f1jFE.js.map} +1 -1
  37. package/dist-vue/_chunks/{PkChatbotMessages-D4LJZxv7.js → PkChatbotMessages-Ck0ofhtK.js} +14 -14
  38. package/dist-vue/_chunks/{PkChatbotMessages-D4LJZxv7.js.map → PkChatbotMessages-Ck0ofhtK.js.map} +1 -1
  39. package/dist-vue/_chunks/{PkChatbotStepPayload-_0WRbSR6.js → PkChatbotStepPayload-D682n3VR.js} +2 -2
  40. package/dist-vue/_chunks/{PkChatbotStepPayload-_0WRbSR6.js.map → PkChatbotStepPayload-D682n3VR.js.map} +1 -1
  41. package/dist-vue/_chunks/{PkChatbotStepToolDetail-DiaervF2.js → PkChatbotStepToolDetail-D5c8rqj9.js} +3 -3
  42. package/dist-vue/_chunks/{PkChatbotStepToolDetail-DiaervF2.js.map → PkChatbotStepToolDetail-D5c8rqj9.js.map} +1 -1
  43. package/dist-vue/_chunks/{PkChatbotSteps-BqL-ClgI.js → PkChatbotSteps-CtKRHqaG.js} +5 -5
  44. package/dist-vue/_chunks/{PkChatbotSteps-BqL-ClgI.js.map → PkChatbotSteps-CtKRHqaG.js.map} +1 -1
  45. package/dist-vue/_chunks/{PkChatbotViewChat-BfVLCU_j.js → PkChatbotViewChat-D8depeWQ.js} +6 -6
  46. package/dist-vue/_chunks/{PkChatbotViewChat-BfVLCU_j.js.map → PkChatbotViewChat-D8depeWQ.js.map} +1 -1
  47. package/dist-vue/_chunks/{PkChatbotViewConversations-C32O6SsT.js → PkChatbotViewConversations-B-dmLi-8.js} +2 -2
  48. package/dist-vue/_chunks/{PkChatbotViewConversations-C32O6SsT.js.map → PkChatbotViewConversations-B-dmLi-8.js.map} +1 -1
  49. package/dist-vue/_chunks/PkFilePreview-B54Dp_Rs.js +1149 -0
  50. package/dist-vue/_chunks/PkFilePreview-B54Dp_Rs.js.map +1 -0
  51. package/dist-vue/_chunks/{PkFilePreviewDialog-BSvgiM9A.js → PkFilePreviewDialog-QDPoZh1v.js} +2 -2
  52. package/dist-vue/_chunks/{PkFilePreviewDialog-BSvgiM9A.js.map → PkFilePreviewDialog-QDPoZh1v.js.map} +1 -1
  53. package/dist-vue/_chunks/{PkStreamingMarkdown-Dk3iXhTm.js → PkStreamingMarkdown-qnKwvrCg.js} +2 -2
  54. package/dist-vue/_chunks/{PkStreamingMarkdown-Dk3iXhTm.js.map → PkStreamingMarkdown-qnKwvrCg.js.map} +1 -1
  55. package/dist-vue/_chunks/PkToolChatFile-i0rHgFxB.js +227 -0
  56. package/dist-vue/_chunks/PkToolChatFile-i0rHgFxB.js.map +1 -0
  57. package/dist-vue/_chunks/{PkToolShowArtifact-BtCGilTJ.js → PkToolShowArtifact-Dh4ogn6A.js} +2 -2
  58. package/dist-vue/_chunks/{PkToolShowArtifact-BtCGilTJ.js.map → PkToolShowArtifact-Dh4ogn6A.js.map} +1 -1
  59. package/dist-vue/_chunks/{PkToolShowContactForm-BZNIeJpf.js → PkToolShowContactForm-BGTI1sio.js} +2 -2
  60. package/dist-vue/_chunks/{PkToolShowContactForm-BZNIeJpf.js.map → PkToolShowContactForm-BGTI1sio.js.map} +1 -1
  61. package/dist-vue/_chunks/{PkToolShowDiagram-KD4MfVkP.js → PkToolShowDiagram-xef3wJb0.js} +2 -2
  62. package/dist-vue/_chunks/{PkToolShowDiagram-KD4MfVkP.js.map → PkToolShowDiagram-xef3wJb0.js.map} +1 -1
  63. package/dist-vue/_chunks/{PkToolShowForm-Dtfpi58S.js → PkToolShowForm-Crg4Kl6v.js} +3 -3
  64. package/dist-vue/_chunks/{PkToolShowForm-Dtfpi58S.js.map → PkToolShowForm-Crg4Kl6v.js.map} +1 -1
  65. package/dist-vue/_chunks/{PkToolShowImageGallery-DnS04nTs.js → PkToolShowImageGallery-D9hdGBHK.js} +2 -2
  66. package/dist-vue/_chunks/{PkToolShowImageGallery-DnS04nTs.js.map → PkToolShowImageGallery-D9hdGBHK.js.map} +1 -1
  67. package/dist-vue/_chunks/{PkToolShowProductList-BlFKAtqQ.js → PkToolShowProductList-SC5aKDCw.js} +2 -2
  68. package/dist-vue/_chunks/{PkToolShowProductList-BlFKAtqQ.js.map → PkToolShowProductList-SC5aKDCw.js.map} +1 -1
  69. package/dist-vue/_chunks/{PkToolShowSources-DM177ZlR.js → PkToolShowSources-Bf9_JwFL.js} +2 -2
  70. package/dist-vue/_chunks/{PkToolShowSources-DM177ZlR.js.map → PkToolShowSources-Bf9_JwFL.js.map} +1 -1
  71. package/dist-vue/_chunks/{PkToolShowVideo-DQdVpaWT.js → PkToolShowVideo-C2ITZDNo.js} +2 -2
  72. package/dist-vue/_chunks/{PkToolShowVideo-DQdVpaWT.js.map → PkToolShowVideo-C2ITZDNo.js.map} +1 -1
  73. package/dist-vue/_chunks/{PkToolShowWebPages-Cx2Ft_wN.js → PkToolShowWebPages-BrefGxKQ.js} +2 -2
  74. package/dist-vue/_chunks/{PkToolShowWebPages-Cx2Ft_wN.js.map → PkToolShowWebPages-BrefGxKQ.js.map} +1 -1
  75. package/dist-vue/_chunks/excelNumberFormat-COn5tHoH.js +543 -0
  76. package/dist-vue/_chunks/excelNumberFormat-COn5tHoH.js.map +1 -0
  77. package/dist-vue/_chunks/{utils-BuxgMuKv.js → utils-B0PnU1Rk.js} +7 -6
  78. package/dist-vue/_chunks/utils-B0PnU1Rk.js.map +1 -0
  79. package/dist-vue/composables.js +1 -1
  80. package/dist-vue/index.js +21 -21
  81. package/dist-vue/index.js.map +1 -1
  82. package/dist-vue/packages/components/src/chat/excelNumberFormat.d.ts +34 -0
  83. package/dist-vue/packages/components/src/chat/useChatFilePreview.d.ts +20 -0
  84. package/dist-vue/packages/components/src/chat/utils.d.ts +2 -0
  85. package/dist-vue/packages/models/src/schema/SpreadsheetPreview.d.ts +26 -0
  86. package/dist-vue/packages/models/src/schema/WordPreview.d.ts +11 -0
  87. package/package.json +1 -1
  88. package/dist/_chunks/PkFilePreview-D_piCsAW.js.map +0 -1
  89. package/dist/_chunks/PkToolChatFile-DO4zjMJr.js.map +0 -1
  90. package/dist/_chunks/utils-BHvRrCzW.js.map +0 -1
  91. package/dist-vue/_chunks/PkFilePreview-jeqvHDm7.js +0 -1127
  92. package/dist-vue/_chunks/PkFilePreview-jeqvHDm7.js.map +0 -1
  93. package/dist-vue/_chunks/PkToolChatFile-Bnj-YFLh.js +0 -219
  94. package/dist-vue/_chunks/PkToolChatFile-Bnj-YFLh.js.map +0 -1
  95. package/dist-vue/_chunks/utils-BuxgMuKv.js.map +0 -1
@@ -3,7 +3,7 @@ import { n as t } from "./useChatbotStore-DcvdWkgq.js";
3
3
  import "./src-nb8MU1sh.js";
4
4
  import { t as n } from "./markdown-BiG_7-9D.js";
5
5
  import { r } from "./message-DuibQyHy.js";
6
- import { j as i } from "./utils-BuxgMuKv.js";
6
+ import { j as i } from "./utils-B0PnU1Rk.js";
7
7
  import { t as a } from "./useDialogConfirm-fn7iV-iE.js";
8
8
  import { t as o } from "./PkRelativeTime-CZF5CYHv.js";
9
9
  import { t as s } from "./chatbotProfileContext-b-nve-mR.js";
@@ -223,4 +223,4 @@ var se = { class: "flex flex-col flex-1 min-h-0 relative" }, ce = {
223
223
  });
224
224
  export { j as i, O as n, A as r, U as t };
225
225
 
226
- //# sourceMappingURL=PkChatbotViewConversations-C32O6SsT.js.map
226
+ //# sourceMappingURL=PkChatbotViewConversations-B-dmLi-8.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"PkChatbotViewConversations-C32O6SsT.js","names":["__unplugin_components_0","__unplugin_components_1","__unplugin_components_2","__unplugin_components_3","__unplugin_components_4","__unplugin_components_5","_openBlock","_createElementBlock","_unref","_createElementVNode","_Fragment","_renderList","_normalizeClass","_createVNode","_toDisplayString","_isRef","_withCtx","_createBlock","_createCommentVNode","PkRelativeTime","_mergeProps","_createTextVNode","_withModifiers","_sfc_main","VvButtonLocalized","useChatbotStore","stripMarkdown","localizeSummaryLabels","useDialogConfirm","PkRelativeTime_default","ChatbotProfileContextKey","getConversationPreview","conversation","getTextPart","message","DAY_MS","groupConversationsByDate","startOfToday","buckets","conversations","time","items","key","useConversationActions","editingId","ref","editingTitle","startEdit","fallbackTitle","confirmEdit","trimmed","actions","id","cancelEdit","onRenameKeydown","event","openDialogConfirm","_hoisted_1","_hoisted_2","_hoisted_3","_hoisted_4","_hoisted_5","_hoisted_6","_hoisted_7","_hoisted_8","_hoisted_9","_hoisted_10","_hoisted_11","_hoisted_12","_hoisted_13","_hoisted_14","_hoisted_15","_hoisted_16","_hoisted_17","_hoisted_18","_hoisted_19","_hoisted_20","PkChatbotViewConversations_default","defineComponent","props","__props","$t","useI18n","store","storeToRefs","startEditConversation","handleDelete","openConversation","navigate","isCurrentConversation","localChatId","getLastMessage","messages","m","role","profile","inject","canEraseConversations","computed","isErasingConversations","handleEraseAll","eraseConversations","startNewChat","_component_VvIcon","VvIcon","_component_VvButton","_component_VvInputText","VvInputText","_component_VvButtonGroup","VvButtonGroup","_component_VvDropdownAction","VvDropdownAction","_component_VvDropdown","VvDropdown","openBlock","createElementBlock","unref","isLoadingConversations","createElementVNode","Fragment","renderList","i","normalizeClass","_cache","createVNode","toDisplayString","isRef","$event","withCtx","runningChatIds","createBlock","createCommentVNode","mergeProps","createTextVNode","withModifiers"],"sources":["../../../../packages/composable/src/chatbot/useConversationActions.ts","../../../../packages/components/src/chat/PkChatbotViewConversations.vue","../../../../packages/components/src/chat/PkChatbotViewConversations.vue"],"sourcesContent":["import { ref } from 'vue'\nimport type { Chat as Conversation } from 'models'\nimport { getTextPart, stripMarkdown } from 'utils'\nimport { useDialogConfirm } from '../useDialogConfirm'\n\n/**\n * Single-line preview for a conversation: explicit title, otherwise the\n * first user message. Used as list label and as search haystack.\n */\nexport function getConversationPreview(conversation: Conversation): string {\n return (\n stripMarkdown(conversation.title) ||\n stripMarkdown(\n getTextPart(\n // The list endpoint isn't Zod-parsed: don't trust the\n // declared types at runtime\n conversation.messages?.find(\n (message) => message.role === 'user',\n ),\n ),\n ) ||\n ''\n )\n}\n\nconst DAY_MS = 86_400_000\n\n/**\n * Date sections of the conversation lists (PkChatSidebar,\n * PkChatSearchDialog), newest first: today, yesterday, the last 7 and 30\n * days, older. Keeps the order of the input and drops the empty sections.\n */\nexport function groupConversationsByDate(conversations: Conversation[]) {\n const startOfToday = new Date().setHours(0, 0, 0, 0)\n const buckets = {\n today: [] as Conversation[],\n yesterday: [] as Conversation[],\n last7Days: [] as Conversation[],\n last30Days: [] as Conversation[],\n older: [] as Conversation[],\n }\n for (const conversation of conversations) {\n // lastMessageAt is typed as Date but arrives as an ISO string at\n // runtime (the chatbot API client doesn't parse through Zod)\n const time = conversation.lastMessageAt\n ? new Date(conversation.lastMessageAt).getTime()\n : 0\n if (time >= startOfToday) {\n buckets.today.push(conversation)\n } else if (time >= startOfToday - DAY_MS) {\n buckets.yesterday.push(conversation)\n } else if (time >= startOfToday - 7 * DAY_MS) {\n buckets.last7Days.push(conversation)\n } else if (time >= startOfToday - 30 * DAY_MS) {\n buckets.last30Days.push(conversation)\n } else {\n buckets.older.push(conversation)\n }\n }\n return (Object.entries(buckets) as [keyof typeof buckets, Conversation[]][])\n .filter(([, items]) => items.length > 0)\n .map(([key, items]) => ({ key, items }))\n}\n\n/**\n * Inline-rename and delete-with-confirm state shared by the conversation\n * lists (PkChatbotViewConversations, PkChatSidebar). Renames are optimistic:\n * on failure the next conversations load reconciles with the server state.\n */\nexport function useConversationActions(actions: {\n renameChatTitle: (chatId: string, title: string) => Promise<unknown>\n deleteChat: (chatId: string) => Promise<unknown>\n}) {\n const editingId = ref<string | null>(null)\n const editingTitle = ref('')\n\n const startEdit = (conversation: Conversation, fallbackTitle = '') => {\n editingId.value = conversation.id\n editingTitle.value = stripMarkdown(conversation.title) || fallbackTitle\n }\n\n const confirmEdit = async (id: string) => {\n const trimmed = editingTitle.value.trim()\n editingId.value = null\n if (trimmed && trimmed.length <= 255) {\n try {\n await actions.renameChatTitle(id, trimmed)\n } catch {\n // Revert optimistically: reload will pick up server state\n }\n }\n }\n\n const cancelEdit = () => {\n editingId.value = null\n }\n\n const onRenameKeydown = (event: KeyboardEvent, id: string) => {\n if (event.key === 'Enter') {\n event.preventDefault()\n confirmEdit(id)\n } else if (event.key === 'Escape') {\n event.preventDefault()\n cancelEdit()\n }\n }\n\n const { openDialogConfirm } = useDialogConfirm()\n const requestDelete = async (id: string) => {\n try {\n const proceed = await openDialogConfirm()\n if (!proceed) {\n return\n }\n await actions.deleteChat(id)\n } catch {\n // Silently fail: next load will reconcile\n }\n }\n\n return {\n editingId,\n editingTitle,\n startEdit,\n confirmEdit,\n cancelEdit,\n onRenameKeydown,\n requestDelete,\n }\n}\n","<script setup lang=\"ts\">\n import { computed, inject, ref } from 'vue'\n import { storeToRefs } from 'pinia'\n import { useI18n } from 'vue-i18n'\n import type { Chat as Conversation, UIChatMessage } from 'models'\n import { stripMarkdown, getTextPart } from 'utils'\n import {\n useChatbotStore,\n useConversationActions,\n useDialogConfirm,\n } from 'composables'\n import PkRelativeTime from '../PkRelativeTime.vue'\n import { localizeSummaryLabels } from './utils'\n import { ChatbotProfileContextKey } from './chatbotProfileContext'\n\n const props = defineProps<{ agentId: string }>()\n\n const { t: $t } = useI18n({ useScope: 'global' })\n\n const store = useChatbotStore(props.agentId)\n const {\n conversations,\n isLoadingConversations,\n localChatId,\n runningChatIds,\n } = storeToRefs(store)\n const { navigate, startNewChat, renameChatTitle, deleteChat } = store\n\n const {\n editingId,\n editingTitle,\n startEdit: startEditConversation,\n confirmEdit,\n cancelEdit,\n onRenameKeydown,\n requestDelete: handleDelete,\n } = useConversationActions({ renameChatTitle, deleteChat })\n\n const openConversation = (id: string) => {\n if (editingId.value) {\n return\n }\n localChatId.value = id\n navigate('chat')\n }\n\n const isCurrentConversation = (conversation: Conversation) => {\n return localChatId.value === conversation.id\n }\n\n const getLastMessage = (\n messages: UIChatMessage[],\n role: 'user' | 'assistant',\n ) => {\n return stripMarkdown(\n getTextPart(messages.filter((m) => m.role === role).slice(-1)[0]) ||\n '',\n )\n }\n\n const startEdit = (conversation: Conversation) => {\n startEditConversation(\n conversation,\n getLastMessage(conversation.messages, 'assistant'),\n )\n }\n\n const { openDialogConfirm } = useDialogConfirm()\n\n // GDPR B.3 — bulk \"delete my conversations\", available to anonymous\n // sessions too (the host wires the endpoint through the profile context).\n // Hidden when the host application owns the session (external token or\n // host-session mode): the endpoint erases ALL conversations of the\n // session's user platform-wide, an account-scoped action that belongs to\n // the host, not to an embedded widget. Same gating as sign-out and\n // manage-profile in PkChatbotViewProfile.\n const profile = inject(ChatbotProfileContextKey, undefined)\n const canEraseConversations = computed(\n () =>\n !!profile?.eraseConversations &&\n !(profile.isExternalAuth?.value ?? false),\n )\n const isErasingConversations = ref(false)\n const handleEraseAll = async () => {\n const eraseConversations = profile?.eraseConversations\n if (!eraseConversations || !canEraseConversations.value) {\n return\n }\n const proceed = await openDialogConfirm({\n title: $t('confirmTitle.deleteMyConversations'),\n questionLabel: $t('message.deleteMyConversationsConfirm'),\n })\n if (!proceed) {\n return\n }\n isErasingConversations.value = true\n try {\n await eraseConversations()\n conversations.value = []\n startNewChat()\n } catch {\n // Same policy as single delete: fail silently and reconcile\n // with the server state\n store.loadConversations(props.agentId)\n } finally {\n isErasingConversations.value = false\n }\n }\n</script>\n\n<template>\n <div class=\"flex flex-col flex-1 min-h-0 relative\">\n <!-- Loading skeleton -->\n <div\n v-if=\"isLoadingConversations && conversations.length === 0\"\n class=\"vv-item-group vv-item-group--fill\">\n <div class=\"vv-item-group__list\">\n <div\n v-for=\"i in 5\"\n :key=\"i\"\n class=\"vv-item vv-item--roomy vv-item--plain\">\n <div class=\"vv-item__entry\">\n <div class=\"flex flex-col gap-6 flex-1 min-w-0\">\n <div\n class=\"vv-skeleton h-16 rounded\"\n :class=\"i % 2 ? 'w-192' : 'w-128'\">\n <div class=\"vv-skeleton__item\" />\n </div>\n <div class=\"vv-skeleton h-12 rounded\">\n <div class=\"vv-skeleton__item\" />\n </div>\n <div class=\"vv-skeleton h-12 rounded w-160\">\n <div class=\"vv-skeleton__item\" />\n </div>\n </div>\n </div>\n </div>\n </div>\n </div>\n\n <!-- Empty state -->\n <div\n v-else-if=\"conversations.length === 0\"\n class=\"flex flex-col flex-1 items-center justify-center gap-12 p-24 text-center\">\n <div\n class=\"w-64 h-64 rounded-full bg-surface-1 border border-surface-3 flex items-center justify-center\">\n <VvIcon name=\"ri:chat-3-line\" class=\"w-28 h-28 text-word-4\" />\n </div>\n <div class=\"flex flex-col gap-4\">\n <strong class=\"text-16 font-semibold text-word-1\">\n {{ $t('message.noConversations') }}\n </strong>\n <span class=\"text-14 text-word-3 leading-relaxed\">\n {{ $t('message.noConversationsHint') }}\n </span>\n </div>\n <VvButton\n modifiers=\"primary rounded\"\n icon=\"ri:add-line\"\n class=\"mt-8\"\n :label=\"$t('action.startNewChat')\"\n @click=\"startNewChat()\" />\n </div>\n\n <!-- Conversation list. The row is a container, not a button: the menu\n and the rename field are siblings of the entry, because a button\n cannot legally contain other controls (Firefox and Safari drop\n them from the accessibility tree). -->\n <div v-else class=\"vv-item-group vv-item-group--fill\">\n <ul\n class=\"vv-item-group__list overflow-y-auto pb-64 light-scrollbar\">\n <li\n v-for=\"conversation in conversations\"\n :key=\"conversation.id\"\n class=\"vv-item vv-item--roomy\"\n :class=\"{\n 'vv-item--current': isCurrentConversation(conversation),\n }\">\n <div\n v-if=\"editingId === conversation.id\"\n class=\"flex flex-1 items-center gap-8 min-w-0 px-md py-12\">\n <VvInputText\n v-model=\"editingTitle\"\n class=\"flex-1 mb-0\"\n modifiers=\"compact\"\n autofocus\n select-on-focus\n :maxlength=\"255\"\n :aria-label=\"$t('placeholder.insert')\"\n :placeholder=\"$t('placeholder.insert')\"\n @keydown=\"\n onRenameKeydown($event, conversation.id)\n \" />\n <VvButtonGroup modifiers=\"compact\">\n <VvButton\n icon=\"ri:save-line\"\n :title=\"$t('action.save')\"\n modifiers=\"action-quiet-small\"\n @click=\"confirmEdit(conversation.id)\" />\n <VvButton\n icon=\"ri:close-line\"\n :title=\"$t('action.cancel')\"\n modifiers=\"action-quiet-small\"\n @click=\"cancelEdit()\" />\n </VvButtonGroup>\n </div>\n <template v-else>\n <button\n type=\"button\"\n class=\"vv-item__entry\"\n :aria-current=\"\n isCurrentConversation(conversation)\n ? 'true'\n : undefined\n \"\n @click=\"openConversation(conversation.id)\">\n <div class=\"min-w-0 flex-1\">\n <div class=\"flex items-center gap-8\">\n <strong\n class=\"vv-item__title font-medium flex-1\">\n {{\n stripMarkdown(conversation.title) ||\n getLastMessage(\n conversation.messages,\n 'assistant',\n )\n }}\n </strong>\n <VvIcon\n v-if=\"\n runningChatIds.includes(\n conversation.id,\n )\n \"\n name=\"loading-loop\"\n role=\"img\"\n :title=\"\n $t('label.answeringInBackground')\n \"\n :aria-label=\"\n $t('label.answeringInBackground')\n \"\n class=\"w-16 h-16 shrink-0 text-word-3\" />\n <PkRelativeTime\n class=\"text-word-4 text-smaller shrink-0\"\n :date=\"conversation.lastMessageAt\" />\n </div>\n <span class=\"text-12 text-word-4 line-clamp-2\">\n {{\n stripMarkdown(\n localizeSummaryLabels(\n conversation.summary,\n $t,\n ),\n ) ||\n getLastMessage(\n conversation.messages,\n 'user',\n )\n }}\n </span>\n </div>\n </button>\n <div class=\"vv-item__actions\">\n <VvDropdown\n v-bind=\"{\n placement: 'bottom-end',\n modifiers: 'menu',\n flip: true,\n offset: 3,\n strategy: 'fixed',\n }\">\n <VvButton\n icon=\"ri:more-2-fill\"\n :title=\"$t('action.moreActions')\"\n modifiers=\"action-quiet-small\" />\n <template #items>\n <VvDropdownAction\n @click=\"startEdit(conversation)\">\n <VvIcon name=\"ri:pencil-line\" />\n {{ $t('action.renameChat') }}\n </VvDropdownAction>\n <VvDropdownAction\n @click=\"handleDelete(conversation.id)\">\n <VvIcon name=\"ri:delete-bin-line\" />\n {{ $t('action.delete') }}\n </VvDropdownAction>\n </template>\n </VvDropdown>\n </div>\n </template>\n </li>\n </ul>\n </div>\n\n <!-- Sticky \"new chat\" CTA (hidden on empty state, which has its own CTA) -->\n <div\n v-if=\"conversations.length > 0\"\n class=\"absolute bottom-0 left-0 right-0 flex flex-col items-center gap-4 px-16 pb-16 pt-32 pointer-events-none\"\n :style=\"{\n background:\n 'linear-gradient(to top, var(--color-surface) 55%, transparent)',\n }\">\n <VvButton\n class=\"text-14 pointer-events-auto\"\n modifiers=\"primary rounded\"\n icon=\"ri:add-line\"\n :label=\"$t('action.startNewChat')\"\n @click.stop=\"startNewChat()\" />\n <VvButton\n v-if=\"canEraseConversations\"\n class=\"text-12 pointer-events-auto\"\n modifiers=\"action-quiet-danger\"\n icon=\"ri:delete-bin-line\"\n :loading=\"isErasingConversations\"\n :disabled=\"isErasingConversations\"\n :label=\"$t('action.deleteMyConversations')\"\n @click.stop=\"handleEraseAll()\" />\n </div>\n </div>\n</template>\n","<script setup lang=\"ts\">\n import { computed, inject, ref } from 'vue'\n import { storeToRefs } from 'pinia'\n import { useI18n } from 'vue-i18n'\n import type { Chat as Conversation, UIChatMessage } from 'models'\n import { stripMarkdown, getTextPart } from 'utils'\n import {\n useChatbotStore,\n useConversationActions,\n useDialogConfirm,\n } from 'composables'\n import PkRelativeTime from '../PkRelativeTime.vue'\n import { localizeSummaryLabels } from './utils'\n import { ChatbotProfileContextKey } from './chatbotProfileContext'\n\n const props = defineProps<{ agentId: string }>()\n\n const { t: $t } = useI18n({ useScope: 'global' })\n\n const store = useChatbotStore(props.agentId)\n const {\n conversations,\n isLoadingConversations,\n localChatId,\n runningChatIds,\n } = storeToRefs(store)\n const { navigate, startNewChat, renameChatTitle, deleteChat } = store\n\n const {\n editingId,\n editingTitle,\n startEdit: startEditConversation,\n confirmEdit,\n cancelEdit,\n onRenameKeydown,\n requestDelete: handleDelete,\n } = useConversationActions({ renameChatTitle, deleteChat })\n\n const openConversation = (id: string) => {\n if (editingId.value) {\n return\n }\n localChatId.value = id\n navigate('chat')\n }\n\n const isCurrentConversation = (conversation: Conversation) => {\n return localChatId.value === conversation.id\n }\n\n const getLastMessage = (\n messages: UIChatMessage[],\n role: 'user' | 'assistant',\n ) => {\n return stripMarkdown(\n getTextPart(messages.filter((m) => m.role === role).slice(-1)[0]) ||\n '',\n )\n }\n\n const startEdit = (conversation: Conversation) => {\n startEditConversation(\n conversation,\n getLastMessage(conversation.messages, 'assistant'),\n )\n }\n\n const { openDialogConfirm } = useDialogConfirm()\n\n // GDPR B.3 — bulk \"delete my conversations\", available to anonymous\n // sessions too (the host wires the endpoint through the profile context).\n // Hidden when the host application owns the session (external token or\n // host-session mode): the endpoint erases ALL conversations of the\n // session's user platform-wide, an account-scoped action that belongs to\n // the host, not to an embedded widget. Same gating as sign-out and\n // manage-profile in PkChatbotViewProfile.\n const profile = inject(ChatbotProfileContextKey, undefined)\n const canEraseConversations = computed(\n () =>\n !!profile?.eraseConversations &&\n !(profile.isExternalAuth?.value ?? false),\n )\n const isErasingConversations = ref(false)\n const handleEraseAll = async () => {\n const eraseConversations = profile?.eraseConversations\n if (!eraseConversations || !canEraseConversations.value) {\n return\n }\n const proceed = await openDialogConfirm({\n title: $t('confirmTitle.deleteMyConversations'),\n questionLabel: $t('message.deleteMyConversationsConfirm'),\n })\n if (!proceed) {\n return\n }\n isErasingConversations.value = true\n try {\n await eraseConversations()\n conversations.value = []\n startNewChat()\n } catch {\n // Same policy as single delete: fail silently and reconcile\n // with the server state\n store.loadConversations(props.agentId)\n } finally {\n isErasingConversations.value = false\n }\n }\n</script>\n\n<template>\n <div class=\"flex flex-col flex-1 min-h-0 relative\">\n <!-- Loading skeleton -->\n <div\n v-if=\"isLoadingConversations && conversations.length === 0\"\n class=\"vv-item-group vv-item-group--fill\">\n <div class=\"vv-item-group__list\">\n <div\n v-for=\"i in 5\"\n :key=\"i\"\n class=\"vv-item vv-item--roomy vv-item--plain\">\n <div class=\"vv-item__entry\">\n <div class=\"flex flex-col gap-6 flex-1 min-w-0\">\n <div\n class=\"vv-skeleton h-16 rounded\"\n :class=\"i % 2 ? 'w-192' : 'w-128'\">\n <div class=\"vv-skeleton__item\" />\n </div>\n <div class=\"vv-skeleton h-12 rounded\">\n <div class=\"vv-skeleton__item\" />\n </div>\n <div class=\"vv-skeleton h-12 rounded w-160\">\n <div class=\"vv-skeleton__item\" />\n </div>\n </div>\n </div>\n </div>\n </div>\n </div>\n\n <!-- Empty state -->\n <div\n v-else-if=\"conversations.length === 0\"\n class=\"flex flex-col flex-1 items-center justify-center gap-12 p-24 text-center\">\n <div\n class=\"w-64 h-64 rounded-full bg-surface-1 border border-surface-3 flex items-center justify-center\">\n <VvIcon name=\"ri:chat-3-line\" class=\"w-28 h-28 text-word-4\" />\n </div>\n <div class=\"flex flex-col gap-4\">\n <strong class=\"text-16 font-semibold text-word-1\">\n {{ $t('message.noConversations') }}\n </strong>\n <span class=\"text-14 text-word-3 leading-relaxed\">\n {{ $t('message.noConversationsHint') }}\n </span>\n </div>\n <VvButton\n modifiers=\"primary rounded\"\n icon=\"ri:add-line\"\n class=\"mt-8\"\n :label=\"$t('action.startNewChat')\"\n @click=\"startNewChat()\" />\n </div>\n\n <!-- Conversation list. The row is a container, not a button: the menu\n and the rename field are siblings of the entry, because a button\n cannot legally contain other controls (Firefox and Safari drop\n them from the accessibility tree). -->\n <div v-else class=\"vv-item-group vv-item-group--fill\">\n <ul\n class=\"vv-item-group__list overflow-y-auto pb-64 light-scrollbar\">\n <li\n v-for=\"conversation in conversations\"\n :key=\"conversation.id\"\n class=\"vv-item vv-item--roomy\"\n :class=\"{\n 'vv-item--current': isCurrentConversation(conversation),\n }\">\n <div\n v-if=\"editingId === conversation.id\"\n class=\"flex flex-1 items-center gap-8 min-w-0 px-md py-12\">\n <VvInputText\n v-model=\"editingTitle\"\n class=\"flex-1 mb-0\"\n modifiers=\"compact\"\n autofocus\n select-on-focus\n :maxlength=\"255\"\n :aria-label=\"$t('placeholder.insert')\"\n :placeholder=\"$t('placeholder.insert')\"\n @keydown=\"\n onRenameKeydown($event, conversation.id)\n \" />\n <VvButtonGroup modifiers=\"compact\">\n <VvButton\n icon=\"ri:save-line\"\n :title=\"$t('action.save')\"\n modifiers=\"action-quiet-small\"\n @click=\"confirmEdit(conversation.id)\" />\n <VvButton\n icon=\"ri:close-line\"\n :title=\"$t('action.cancel')\"\n modifiers=\"action-quiet-small\"\n @click=\"cancelEdit()\" />\n </VvButtonGroup>\n </div>\n <template v-else>\n <button\n type=\"button\"\n class=\"vv-item__entry\"\n :aria-current=\"\n isCurrentConversation(conversation)\n ? 'true'\n : undefined\n \"\n @click=\"openConversation(conversation.id)\">\n <div class=\"min-w-0 flex-1\">\n <div class=\"flex items-center gap-8\">\n <strong\n class=\"vv-item__title font-medium flex-1\">\n {{\n stripMarkdown(conversation.title) ||\n getLastMessage(\n conversation.messages,\n 'assistant',\n )\n }}\n </strong>\n <VvIcon\n v-if=\"\n runningChatIds.includes(\n conversation.id,\n )\n \"\n name=\"loading-loop\"\n role=\"img\"\n :title=\"\n $t('label.answeringInBackground')\n \"\n :aria-label=\"\n $t('label.answeringInBackground')\n \"\n class=\"w-16 h-16 shrink-0 text-word-3\" />\n <PkRelativeTime\n class=\"text-word-4 text-smaller shrink-0\"\n :date=\"conversation.lastMessageAt\" />\n </div>\n <span class=\"text-12 text-word-4 line-clamp-2\">\n {{\n stripMarkdown(\n localizeSummaryLabels(\n conversation.summary,\n $t,\n ),\n ) ||\n getLastMessage(\n conversation.messages,\n 'user',\n )\n }}\n </span>\n </div>\n </button>\n <div class=\"vv-item__actions\">\n <VvDropdown\n v-bind=\"{\n placement: 'bottom-end',\n modifiers: 'menu',\n flip: true,\n offset: 3,\n strategy: 'fixed',\n }\">\n <VvButton\n icon=\"ri:more-2-fill\"\n :title=\"$t('action.moreActions')\"\n modifiers=\"action-quiet-small\" />\n <template #items>\n <VvDropdownAction\n @click=\"startEdit(conversation)\">\n <VvIcon name=\"ri:pencil-line\" />\n {{ $t('action.renameChat') }}\n </VvDropdownAction>\n <VvDropdownAction\n @click=\"handleDelete(conversation.id)\">\n <VvIcon name=\"ri:delete-bin-line\" />\n {{ $t('action.delete') }}\n </VvDropdownAction>\n </template>\n </VvDropdown>\n </div>\n </template>\n </li>\n </ul>\n </div>\n\n <!-- Sticky \"new chat\" CTA (hidden on empty state, which has its own CTA) -->\n <div\n v-if=\"conversations.length > 0\"\n class=\"absolute bottom-0 left-0 right-0 flex flex-col items-center gap-4 px-16 pb-16 pt-32 pointer-events-none\"\n :style=\"{\n background:\n 'linear-gradient(to top, var(--color-surface) 55%, transparent)',\n }\">\n <VvButton\n class=\"text-14 pointer-events-auto\"\n modifiers=\"primary rounded\"\n icon=\"ri:add-line\"\n :label=\"$t('action.startNewChat')\"\n @click.stop=\"startNewChat()\" />\n <VvButton\n v-if=\"canEraseConversations\"\n class=\"text-12 pointer-events-auto\"\n modifiers=\"action-quiet-danger\"\n icon=\"ri:delete-bin-line\"\n :loading=\"isErasingConversations\"\n :disabled=\"isErasingConversations\"\n :label=\"$t('action.deleteMyConversations')\"\n @click.stop=\"handleEraseAll()\" />\n </div>\n </div>\n</template>\n"],"mappings":";;;;;;;;;;;;;;AASA,SAAgB+B,EAAuB,GAAoC;CACvE,OACIL,EAAcM,EAAa,KAAK,KAChCN,EACIO,EAGID,EAAa,UAAU,MAClB,MAAYE,EAAQ,SAAS,MAClC,CACJ,CACJ,KACA;AAER;AAEA,IAAMC,IAAS;AAOf,SAAgBC,EAAyB,GAA+B;CACpE,IAAMC,qBAAe,IAAI,KAAK,EAAA,CAAE,SAAS,GAAG,GAAG,GAAG,CAAC,GAC7CC,IAAU;EACZ,OAAO,CAAC;EACR,WAAW,CAAC;EACZ,WAAW,CAAC;EACZ,YAAY,CAAC;EACb,OAAO,CAAC;CACZ;CACA,KAAK,IAAMN,KAAgBO,GAAe;EAGtC,IAAMC,IAAOR,EAAa,gBACpB,IAAI,KAAKA,EAAa,aAAa,CAAC,CAAC,QAAQ,IAC7C;EACN,AAAIQ,KAAQH,IACRC,EAAQ,MAAM,KAAKN,CAAY,IACxBQ,KAAQH,IAAeF,IAC9BG,EAAQ,UAAU,KAAKN,CAAY,IAC5BQ,KAAQH,IAAe,IAAIF,IAClCG,EAAQ,UAAU,KAAKN,CAAY,IAC5BQ,KAAQH,IAAe,KAAKF,IACnCG,EAAQ,WAAW,KAAKN,CAAY,IAEpCM,EAAQ,MAAM,KAAKN,CAAY;CAEvC;CACA,OAAQ,OAAO,QAAQM,CAAO,CAAC,CAC1B,QA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,SAAM,KAD9BjC,EAAA,GAAAC,EAsBM,OAtBNqE,IAsBM,CAfF/D,EAKmC4F,GAAA;IAJ/B,OAAM;IACN,WAAU;IACV,MAAK;IACJ,OAAOjG,EAAAyE,CAAA,CAAE,CAAA,qBAAA;IACT,SAAK,AAAA0C,EAAA,OAAArG,GAAA,MAAOd,EAAA8F,CAAA,CAAY,CAAA,GAAA,CAAA,MAAA,CAAA;G,wBAEnBL,EAAA,SADV3F,EAAA,GAAAW,EAQqCwF,GAAA;;IANjC,OAAM;IACN,WAAU;IACV,MAAK;IACJ,SAASN,EAAA;IACT,UAAUA,EAAA;IACV,OAAO3F,EAAAyE,CAAA,CAAE,CAAA,8BAAA;IACT,SAAK,AAAA0C,EAAA,OAAArG,GAAA,MAAO8E,GAAc,GAAA,CAAA,MAAA,CAAA"}
1
+ {"version":3,"file":"PkChatbotViewConversations-B-dmLi-8.js","names":["__unplugin_components_0","__unplugin_components_1","__unplugin_components_2","__unplugin_components_3","__unplugin_components_4","__unplugin_components_5","_openBlock","_createElementBlock","_unref","_createElementVNode","_Fragment","_renderList","_normalizeClass","_createVNode","_toDisplayString","_isRef","_withCtx","_createBlock","_createCommentVNode","PkRelativeTime","_mergeProps","_createTextVNode","_withModifiers","_sfc_main","VvButtonLocalized","useChatbotStore","stripMarkdown","localizeSummaryLabels","useDialogConfirm","PkRelativeTime_default","ChatbotProfileContextKey","getConversationPreview","conversation","getTextPart","message","DAY_MS","groupConversationsByDate","startOfToday","buckets","conversations","time","items","key","useConversationActions","editingId","ref","editingTitle","startEdit","fallbackTitle","confirmEdit","trimmed","actions","id","cancelEdit","onRenameKeydown","event","openDialogConfirm","_hoisted_1","_hoisted_2","_hoisted_3","_hoisted_4","_hoisted_5","_hoisted_6","_hoisted_7","_hoisted_8","_hoisted_9","_hoisted_10","_hoisted_11","_hoisted_12","_hoisted_13","_hoisted_14","_hoisted_15","_hoisted_16","_hoisted_17","_hoisted_18","_hoisted_19","_hoisted_20","PkChatbotViewConversations_default","defineComponent","props","__props","$t","useI18n","store","storeToRefs","startEditConversation","handleDelete","openConversation","navigate","isCurrentConversation","localChatId","getLastMessage","messages","m","role","profile","inject","canEraseConversations","computed","isErasingConversations","handleEraseAll","eraseConversations","startNewChat","_component_VvIcon","VvIcon","_component_VvButton","_component_VvInputText","VvInputText","_component_VvButtonGroup","VvButtonGroup","_component_VvDropdownAction","VvDropdownAction","_component_VvDropdown","VvDropdown","openBlock","createElementBlock","unref","isLoadingConversations","createElementVNode","Fragment","renderList","i","normalizeClass","_cache","createVNode","toDisplayString","isRef","$event","withCtx","runningChatIds","createBlock","createCommentVNode","mergeProps","createTextVNode","withModifiers"],"sources":["../../../../packages/composable/src/chatbot/useConversationActions.ts","../../../../packages/components/src/chat/PkChatbotViewConversations.vue","../../../../packages/components/src/chat/PkChatbotViewConversations.vue"],"sourcesContent":["import { ref } from 'vue'\nimport type { Chat as Conversation } from 'models'\nimport { getTextPart, stripMarkdown } from 'utils'\nimport { useDialogConfirm } from '../useDialogConfirm'\n\n/**\n * Single-line preview for a conversation: explicit title, otherwise the\n * first user message. Used as list label and as search haystack.\n */\nexport function getConversationPreview(conversation: Conversation): string {\n return (\n stripMarkdown(conversation.title) ||\n stripMarkdown(\n getTextPart(\n // The list endpoint isn't Zod-parsed: don't trust the\n // declared types at runtime\n conversation.messages?.find(\n (message) => message.role === 'user',\n ),\n ),\n ) ||\n ''\n )\n}\n\nconst DAY_MS = 86_400_000\n\n/**\n * Date sections of the conversation lists (PkChatSidebar,\n * PkChatSearchDialog), newest first: today, yesterday, the last 7 and 30\n * days, older. Keeps the order of the input and drops the empty sections.\n */\nexport function groupConversationsByDate(conversations: Conversation[]) {\n const startOfToday = new Date().setHours(0, 0, 0, 0)\n const buckets = {\n today: [] as Conversation[],\n yesterday: [] as Conversation[],\n last7Days: [] as Conversation[],\n last30Days: [] as Conversation[],\n older: [] as Conversation[],\n }\n for (const conversation of conversations) {\n // lastMessageAt is typed as Date but arrives as an ISO string at\n // runtime (the chatbot API client doesn't parse through Zod)\n const time = conversation.lastMessageAt\n ? new Date(conversation.lastMessageAt).getTime()\n : 0\n if (time >= startOfToday) {\n buckets.today.push(conversation)\n } else if (time >= startOfToday - DAY_MS) {\n buckets.yesterday.push(conversation)\n } else if (time >= startOfToday - 7 * DAY_MS) {\n buckets.last7Days.push(conversation)\n } else if (time >= startOfToday - 30 * DAY_MS) {\n buckets.last30Days.push(conversation)\n } else {\n buckets.older.push(conversation)\n }\n }\n return (Object.entries(buckets) as [keyof typeof buckets, Conversation[]][])\n .filter(([, items]) => items.length > 0)\n .map(([key, items]) => ({ key, items }))\n}\n\n/**\n * Inline-rename and delete-with-confirm state shared by the conversation\n * lists (PkChatbotViewConversations, PkChatSidebar). Renames are optimistic:\n * on failure the next conversations load reconciles with the server state.\n */\nexport function useConversationActions(actions: {\n renameChatTitle: (chatId: string, title: string) => Promise<unknown>\n deleteChat: (chatId: string) => Promise<unknown>\n}) {\n const editingId = ref<string | null>(null)\n const editingTitle = ref('')\n\n const startEdit = (conversation: Conversation, fallbackTitle = '') => {\n editingId.value = conversation.id\n editingTitle.value = stripMarkdown(conversation.title) || fallbackTitle\n }\n\n const confirmEdit = async (id: string) => {\n const trimmed = editingTitle.value.trim()\n editingId.value = null\n if (trimmed && trimmed.length <= 255) {\n try {\n await actions.renameChatTitle(id, trimmed)\n } catch {\n // Revert optimistically: reload will pick up server state\n }\n }\n }\n\n const cancelEdit = () => {\n editingId.value = null\n }\n\n const onRenameKeydown = (event: KeyboardEvent, id: string) => {\n if (event.key === 'Enter') {\n event.preventDefault()\n confirmEdit(id)\n } else if (event.key === 'Escape') {\n event.preventDefault()\n cancelEdit()\n }\n }\n\n const { openDialogConfirm } = useDialogConfirm()\n const requestDelete = async (id: string) => {\n try {\n const proceed = await openDialogConfirm()\n if (!proceed) {\n return\n }\n await actions.deleteChat(id)\n } catch {\n // Silently fail: next load will reconcile\n }\n }\n\n return {\n editingId,\n editingTitle,\n startEdit,\n confirmEdit,\n cancelEdit,\n onRenameKeydown,\n requestDelete,\n }\n}\n","<script setup lang=\"ts\">\n import { computed, inject, ref } from 'vue'\n import { storeToRefs } from 'pinia'\n import { useI18n } from 'vue-i18n'\n import type { Chat as Conversation, UIChatMessage } from 'models'\n import { stripMarkdown, getTextPart } from 'utils'\n import {\n useChatbotStore,\n useConversationActions,\n useDialogConfirm,\n } from 'composables'\n import PkRelativeTime from '../PkRelativeTime.vue'\n import { localizeSummaryLabels } from './utils'\n import { ChatbotProfileContextKey } from './chatbotProfileContext'\n\n const props = defineProps<{ agentId: string }>()\n\n const { t: $t } = useI18n({ useScope: 'global' })\n\n const store = useChatbotStore(props.agentId)\n const {\n conversations,\n isLoadingConversations,\n localChatId,\n runningChatIds,\n } = storeToRefs(store)\n const { navigate, startNewChat, renameChatTitle, deleteChat } = store\n\n const {\n editingId,\n editingTitle,\n startEdit: startEditConversation,\n confirmEdit,\n cancelEdit,\n onRenameKeydown,\n requestDelete: handleDelete,\n } = useConversationActions({ renameChatTitle, deleteChat })\n\n const openConversation = (id: string) => {\n if (editingId.value) {\n return\n }\n localChatId.value = id\n navigate('chat')\n }\n\n const isCurrentConversation = (conversation: Conversation) => {\n return localChatId.value === conversation.id\n }\n\n const getLastMessage = (\n messages: UIChatMessage[],\n role: 'user' | 'assistant',\n ) => {\n return stripMarkdown(\n getTextPart(messages.filter((m) => m.role === role).slice(-1)[0]) ||\n '',\n )\n }\n\n const startEdit = (conversation: Conversation) => {\n startEditConversation(\n conversation,\n getLastMessage(conversation.messages, 'assistant'),\n )\n }\n\n const { openDialogConfirm } = useDialogConfirm()\n\n // GDPR B.3 — bulk \"delete my conversations\", available to anonymous\n // sessions too (the host wires the endpoint through the profile context).\n // Hidden when the host application owns the session (external token or\n // host-session mode): the endpoint erases ALL conversations of the\n // session's user platform-wide, an account-scoped action that belongs to\n // the host, not to an embedded widget. Same gating as sign-out and\n // manage-profile in PkChatbotViewProfile.\n const profile = inject(ChatbotProfileContextKey, undefined)\n const canEraseConversations = computed(\n () =>\n !!profile?.eraseConversations &&\n !(profile.isExternalAuth?.value ?? false),\n )\n const isErasingConversations = ref(false)\n const handleEraseAll = async () => {\n const eraseConversations = profile?.eraseConversations\n if (!eraseConversations || !canEraseConversations.value) {\n return\n }\n const proceed = await openDialogConfirm({\n title: $t('confirmTitle.deleteMyConversations'),\n questionLabel: $t('message.deleteMyConversationsConfirm'),\n })\n if (!proceed) {\n return\n }\n isErasingConversations.value = true\n try {\n await eraseConversations()\n conversations.value = []\n startNewChat()\n } catch {\n // Same policy as single delete: fail silently and reconcile\n // with the server state\n store.loadConversations(props.agentId)\n } finally {\n isErasingConversations.value = false\n }\n }\n</script>\n\n<template>\n <div class=\"flex flex-col flex-1 min-h-0 relative\">\n <!-- Loading skeleton -->\n <div\n v-if=\"isLoadingConversations && conversations.length === 0\"\n class=\"vv-item-group vv-item-group--fill\">\n <div class=\"vv-item-group__list\">\n <div\n v-for=\"i in 5\"\n :key=\"i\"\n class=\"vv-item vv-item--roomy vv-item--plain\">\n <div class=\"vv-item__entry\">\n <div class=\"flex flex-col gap-6 flex-1 min-w-0\">\n <div\n class=\"vv-skeleton h-16 rounded\"\n :class=\"i % 2 ? 'w-192' : 'w-128'\">\n <div class=\"vv-skeleton__item\" />\n </div>\n <div class=\"vv-skeleton h-12 rounded\">\n <div class=\"vv-skeleton__item\" />\n </div>\n <div class=\"vv-skeleton h-12 rounded w-160\">\n <div class=\"vv-skeleton__item\" />\n </div>\n </div>\n </div>\n </div>\n </div>\n </div>\n\n <!-- Empty state -->\n <div\n v-else-if=\"conversations.length === 0\"\n class=\"flex flex-col flex-1 items-center justify-center gap-12 p-24 text-center\">\n <div\n class=\"w-64 h-64 rounded-full bg-surface-1 border border-surface-3 flex items-center justify-center\">\n <VvIcon name=\"ri:chat-3-line\" class=\"w-28 h-28 text-word-4\" />\n </div>\n <div class=\"flex flex-col gap-4\">\n <strong class=\"text-16 font-semibold text-word-1\">\n {{ $t('message.noConversations') }}\n </strong>\n <span class=\"text-14 text-word-3 leading-relaxed\">\n {{ $t('message.noConversationsHint') }}\n </span>\n </div>\n <VvButton\n modifiers=\"primary rounded\"\n icon=\"ri:add-line\"\n class=\"mt-8\"\n :label=\"$t('action.startNewChat')\"\n @click=\"startNewChat()\" />\n </div>\n\n <!-- Conversation list. The row is a container, not a button: the menu\n and the rename field are siblings of the entry, because a button\n cannot legally contain other controls (Firefox and Safari drop\n them from the accessibility tree). -->\n <div v-else class=\"vv-item-group vv-item-group--fill\">\n <ul\n class=\"vv-item-group__list overflow-y-auto pb-64 light-scrollbar\">\n <li\n v-for=\"conversation in conversations\"\n :key=\"conversation.id\"\n class=\"vv-item vv-item--roomy\"\n :class=\"{\n 'vv-item--current': isCurrentConversation(conversation),\n }\">\n <div\n v-if=\"editingId === conversation.id\"\n class=\"flex flex-1 items-center gap-8 min-w-0 px-md py-12\">\n <VvInputText\n v-model=\"editingTitle\"\n class=\"flex-1 mb-0\"\n modifiers=\"compact\"\n autofocus\n select-on-focus\n :maxlength=\"255\"\n :aria-label=\"$t('placeholder.insert')\"\n :placeholder=\"$t('placeholder.insert')\"\n @keydown=\"\n onRenameKeydown($event, conversation.id)\n \" />\n <VvButtonGroup modifiers=\"compact\">\n <VvButton\n icon=\"ri:save-line\"\n :title=\"$t('action.save')\"\n modifiers=\"action-quiet-small\"\n @click=\"confirmEdit(conversation.id)\" />\n <VvButton\n icon=\"ri:close-line\"\n :title=\"$t('action.cancel')\"\n modifiers=\"action-quiet-small\"\n @click=\"cancelEdit()\" />\n </VvButtonGroup>\n </div>\n <template v-else>\n <button\n type=\"button\"\n class=\"vv-item__entry\"\n :aria-current=\"\n isCurrentConversation(conversation)\n ? 'true'\n : undefined\n \"\n @click=\"openConversation(conversation.id)\">\n <div class=\"min-w-0 flex-1\">\n <div class=\"flex items-center gap-8\">\n <strong\n class=\"vv-item__title font-medium flex-1\">\n {{\n stripMarkdown(conversation.title) ||\n getLastMessage(\n conversation.messages,\n 'assistant',\n )\n }}\n </strong>\n <VvIcon\n v-if=\"\n runningChatIds.includes(\n conversation.id,\n )\n \"\n name=\"loading-loop\"\n role=\"img\"\n :title=\"\n $t('label.answeringInBackground')\n \"\n :aria-label=\"\n $t('label.answeringInBackground')\n \"\n class=\"w-16 h-16 shrink-0 text-word-3\" />\n <PkRelativeTime\n class=\"text-word-4 text-smaller shrink-0\"\n :date=\"conversation.lastMessageAt\" />\n </div>\n <span class=\"text-12 text-word-4 line-clamp-2\">\n {{\n stripMarkdown(\n localizeSummaryLabels(\n conversation.summary,\n $t,\n ),\n ) ||\n getLastMessage(\n conversation.messages,\n 'user',\n )\n }}\n </span>\n </div>\n </button>\n <div class=\"vv-item__actions\">\n <VvDropdown\n v-bind=\"{\n placement: 'bottom-end',\n modifiers: 'menu',\n flip: true,\n offset: 3,\n strategy: 'fixed',\n }\">\n <VvButton\n icon=\"ri:more-2-fill\"\n :title=\"$t('action.moreActions')\"\n modifiers=\"action-quiet-small\" />\n <template #items>\n <VvDropdownAction\n @click=\"startEdit(conversation)\">\n <VvIcon name=\"ri:pencil-line\" />\n {{ $t('action.renameChat') }}\n </VvDropdownAction>\n <VvDropdownAction\n @click=\"handleDelete(conversation.id)\">\n <VvIcon name=\"ri:delete-bin-line\" />\n {{ $t('action.delete') }}\n </VvDropdownAction>\n </template>\n </VvDropdown>\n </div>\n </template>\n </li>\n </ul>\n </div>\n\n <!-- Sticky \"new chat\" CTA (hidden on empty state, which has its own CTA) -->\n <div\n v-if=\"conversations.length > 0\"\n class=\"absolute bottom-0 left-0 right-0 flex flex-col items-center gap-4 px-16 pb-16 pt-32 pointer-events-none\"\n :style=\"{\n background:\n 'linear-gradient(to top, var(--color-surface) 55%, transparent)',\n }\">\n <VvButton\n class=\"text-14 pointer-events-auto\"\n modifiers=\"primary rounded\"\n icon=\"ri:add-line\"\n :label=\"$t('action.startNewChat')\"\n @click.stop=\"startNewChat()\" />\n <VvButton\n v-if=\"canEraseConversations\"\n class=\"text-12 pointer-events-auto\"\n modifiers=\"action-quiet-danger\"\n icon=\"ri:delete-bin-line\"\n :loading=\"isErasingConversations\"\n :disabled=\"isErasingConversations\"\n :label=\"$t('action.deleteMyConversations')\"\n @click.stop=\"handleEraseAll()\" />\n </div>\n </div>\n</template>\n","<script setup lang=\"ts\">\n import { computed, inject, ref } from 'vue'\n import { storeToRefs } from 'pinia'\n import { useI18n } from 'vue-i18n'\n import type { Chat as Conversation, UIChatMessage } from 'models'\n import { stripMarkdown, getTextPart } from 'utils'\n import {\n useChatbotStore,\n useConversationActions,\n useDialogConfirm,\n } from 'composables'\n import PkRelativeTime from '../PkRelativeTime.vue'\n import { localizeSummaryLabels } from './utils'\n import { ChatbotProfileContextKey } from './chatbotProfileContext'\n\n const props = defineProps<{ agentId: string }>()\n\n const { t: $t } = useI18n({ useScope: 'global' })\n\n const store = useChatbotStore(props.agentId)\n const {\n conversations,\n isLoadingConversations,\n localChatId,\n runningChatIds,\n } = storeToRefs(store)\n const { navigate, startNewChat, renameChatTitle, deleteChat } = store\n\n const {\n editingId,\n editingTitle,\n startEdit: startEditConversation,\n confirmEdit,\n cancelEdit,\n onRenameKeydown,\n requestDelete: handleDelete,\n } = useConversationActions({ renameChatTitle, deleteChat })\n\n const openConversation = (id: string) => {\n if (editingId.value) {\n return\n }\n localChatId.value = id\n navigate('chat')\n }\n\n const isCurrentConversation = (conversation: Conversation) => {\n return localChatId.value === conversation.id\n }\n\n const getLastMessage = (\n messages: UIChatMessage[],\n role: 'user' | 'assistant',\n ) => {\n return stripMarkdown(\n getTextPart(messages.filter((m) => m.role === role).slice(-1)[0]) ||\n '',\n )\n }\n\n const startEdit = (conversation: Conversation) => {\n startEditConversation(\n conversation,\n getLastMessage(conversation.messages, 'assistant'),\n )\n }\n\n const { openDialogConfirm } = useDialogConfirm()\n\n // GDPR B.3 — bulk \"delete my conversations\", available to anonymous\n // sessions too (the host wires the endpoint through the profile context).\n // Hidden when the host application owns the session (external token or\n // host-session mode): the endpoint erases ALL conversations of the\n // session's user platform-wide, an account-scoped action that belongs to\n // the host, not to an embedded widget. Same gating as sign-out and\n // manage-profile in PkChatbotViewProfile.\n const profile = inject(ChatbotProfileContextKey, undefined)\n const canEraseConversations = computed(\n () =>\n !!profile?.eraseConversations &&\n !(profile.isExternalAuth?.value ?? false),\n )\n const isErasingConversations = ref(false)\n const handleEraseAll = async () => {\n const eraseConversations = profile?.eraseConversations\n if (!eraseConversations || !canEraseConversations.value) {\n return\n }\n const proceed = await openDialogConfirm({\n title: $t('confirmTitle.deleteMyConversations'),\n questionLabel: $t('message.deleteMyConversationsConfirm'),\n })\n if (!proceed) {\n return\n }\n isErasingConversations.value = true\n try {\n await eraseConversations()\n conversations.value = []\n startNewChat()\n } catch {\n // Same policy as single delete: fail silently and reconcile\n // with the server state\n store.loadConversations(props.agentId)\n } finally {\n isErasingConversations.value = false\n }\n }\n</script>\n\n<template>\n <div class=\"flex flex-col flex-1 min-h-0 relative\">\n <!-- Loading skeleton -->\n <div\n v-if=\"isLoadingConversations && conversations.length === 0\"\n class=\"vv-item-group vv-item-group--fill\">\n <div class=\"vv-item-group__list\">\n <div\n v-for=\"i in 5\"\n :key=\"i\"\n class=\"vv-item vv-item--roomy vv-item--plain\">\n <div class=\"vv-item__entry\">\n <div class=\"flex flex-col gap-6 flex-1 min-w-0\">\n <div\n class=\"vv-skeleton h-16 rounded\"\n :class=\"i % 2 ? 'w-192' : 'w-128'\">\n <div class=\"vv-skeleton__item\" />\n </div>\n <div class=\"vv-skeleton h-12 rounded\">\n <div class=\"vv-skeleton__item\" />\n </div>\n <div class=\"vv-skeleton h-12 rounded w-160\">\n <div class=\"vv-skeleton__item\" />\n </div>\n </div>\n </div>\n </div>\n </div>\n </div>\n\n <!-- Empty state -->\n <div\n v-else-if=\"conversations.length === 0\"\n class=\"flex flex-col flex-1 items-center justify-center gap-12 p-24 text-center\">\n <div\n class=\"w-64 h-64 rounded-full bg-surface-1 border border-surface-3 flex items-center justify-center\">\n <VvIcon name=\"ri:chat-3-line\" class=\"w-28 h-28 text-word-4\" />\n </div>\n <div class=\"flex flex-col gap-4\">\n <strong class=\"text-16 font-semibold text-word-1\">\n {{ $t('message.noConversations') }}\n </strong>\n <span class=\"text-14 text-word-3 leading-relaxed\">\n {{ $t('message.noConversationsHint') }}\n </span>\n </div>\n <VvButton\n modifiers=\"primary rounded\"\n icon=\"ri:add-line\"\n class=\"mt-8\"\n :label=\"$t('action.startNewChat')\"\n @click=\"startNewChat()\" />\n </div>\n\n <!-- Conversation list. The row is a container, not a button: the menu\n and the rename field are siblings of the entry, because a button\n cannot legally contain other controls (Firefox and Safari drop\n them from the accessibility tree). -->\n <div v-else class=\"vv-item-group vv-item-group--fill\">\n <ul\n class=\"vv-item-group__list overflow-y-auto pb-64 light-scrollbar\">\n <li\n v-for=\"conversation in conversations\"\n :key=\"conversation.id\"\n class=\"vv-item vv-item--roomy\"\n :class=\"{\n 'vv-item--current': isCurrentConversation(conversation),\n }\">\n <div\n v-if=\"editingId === conversation.id\"\n class=\"flex flex-1 items-center gap-8 min-w-0 px-md py-12\">\n <VvInputText\n v-model=\"editingTitle\"\n class=\"flex-1 mb-0\"\n modifiers=\"compact\"\n autofocus\n select-on-focus\n :maxlength=\"255\"\n :aria-label=\"$t('placeholder.insert')\"\n :placeholder=\"$t('placeholder.insert')\"\n @keydown=\"\n onRenameKeydown($event, conversation.id)\n \" />\n <VvButtonGroup modifiers=\"compact\">\n <VvButton\n icon=\"ri:save-line\"\n :title=\"$t('action.save')\"\n modifiers=\"action-quiet-small\"\n @click=\"confirmEdit(conversation.id)\" />\n <VvButton\n icon=\"ri:close-line\"\n :title=\"$t('action.cancel')\"\n modifiers=\"action-quiet-small\"\n @click=\"cancelEdit()\" />\n </VvButtonGroup>\n </div>\n <template v-else>\n <button\n type=\"button\"\n class=\"vv-item__entry\"\n :aria-current=\"\n isCurrentConversation(conversation)\n ? 'true'\n : undefined\n \"\n @click=\"openConversation(conversation.id)\">\n <div class=\"min-w-0 flex-1\">\n <div class=\"flex items-center gap-8\">\n <strong\n class=\"vv-item__title font-medium flex-1\">\n {{\n stripMarkdown(conversation.title) ||\n getLastMessage(\n conversation.messages,\n 'assistant',\n )\n }}\n </strong>\n <VvIcon\n v-if=\"\n runningChatIds.includes(\n conversation.id,\n )\n \"\n name=\"loading-loop\"\n role=\"img\"\n :title=\"\n $t('label.answeringInBackground')\n \"\n :aria-label=\"\n $t('label.answeringInBackground')\n \"\n class=\"w-16 h-16 shrink-0 text-word-3\" />\n <PkRelativeTime\n class=\"text-word-4 text-smaller shrink-0\"\n :date=\"conversation.lastMessageAt\" />\n </div>\n <span class=\"text-12 text-word-4 line-clamp-2\">\n {{\n stripMarkdown(\n localizeSummaryLabels(\n conversation.summary,\n $t,\n ),\n ) ||\n getLastMessage(\n conversation.messages,\n 'user',\n )\n }}\n </span>\n </div>\n </button>\n <div class=\"vv-item__actions\">\n <VvDropdown\n v-bind=\"{\n placement: 'bottom-end',\n modifiers: 'menu',\n flip: true,\n offset: 3,\n strategy: 'fixed',\n }\">\n <VvButton\n icon=\"ri:more-2-fill\"\n :title=\"$t('action.moreActions')\"\n modifiers=\"action-quiet-small\" />\n <template #items>\n <VvDropdownAction\n @click=\"startEdit(conversation)\">\n <VvIcon name=\"ri:pencil-line\" />\n {{ $t('action.renameChat') }}\n </VvDropdownAction>\n <VvDropdownAction\n @click=\"handleDelete(conversation.id)\">\n <VvIcon name=\"ri:delete-bin-line\" />\n {{ $t('action.delete') }}\n </VvDropdownAction>\n </template>\n </VvDropdown>\n </div>\n </template>\n </li>\n </ul>\n </div>\n\n <!-- Sticky \"new chat\" CTA (hidden on empty state, which has its own CTA) -->\n <div\n v-if=\"conversations.length > 0\"\n class=\"absolute bottom-0 left-0 right-0 flex flex-col items-center gap-4 px-16 pb-16 pt-32 pointer-events-none\"\n :style=\"{\n background:\n 'linear-gradient(to top, var(--color-surface) 55%, transparent)',\n }\">\n <VvButton\n class=\"text-14 pointer-events-auto\"\n modifiers=\"primary rounded\"\n icon=\"ri:add-line\"\n :label=\"$t('action.startNewChat')\"\n @click.stop=\"startNewChat()\" />\n <VvButton\n v-if=\"canEraseConversations\"\n class=\"text-12 pointer-events-auto\"\n modifiers=\"action-quiet-danger\"\n icon=\"ri:delete-bin-line\"\n :loading=\"isErasingConversations\"\n :disabled=\"isErasingConversations\"\n :label=\"$t('action.deleteMyConversations')\"\n @click.stop=\"handleEraseAll()\" />\n </div>\n </div>\n</template>\n"],"mappings":";;;;;;;;;;;;;;AASA,SAAgB+B,EAAuB,GAAoC;CACvE,OACIL,EAAcM,EAAa,KAAK,KAChCN,EACIO,EAGID,EAAa,UAAU,MAClB,MAAYE,EAAQ,SAAS,MAClC,CACJ,CACJ,KACA;AAER;AAEA,IAAMC,IAAS;AAOf,SAAgBC,EAAyB,GAA+B;CACpE,IAAMC,qBAAe,IAAI,KAAK,EAAA,CAAE,SAAS,GAAG,GAAG,GAAG,CAAC,GAC7CC,IAAU;EACZ,OAAO,CAAC;EACR,WAAW,CAAC;EACZ,WAAW,CAAC;EACZ,YAAY,CAAC;EACb,OAAO,CAAC;CACZ;CACA,KAAK,IAAMN,KAAgBO,GAAe;EAGtC,IAAMC,IAAOR,EAAa,gBACpB,IAAI,KAAKA,EAAa,aAAa,CAAC,CAAC,QAAQ,IAC7C;EACN,AAAIQ,KAAQH,IACRC,EAAQ,MAAM,KAAKN,CAAY,IACxBQ,KAAQH,IAAeF,IAC9BG,EAAQ,UAAU,KAAKN,CAAY,IAC5BQ,KAAQH,IAAe,IAAIF,IAClCG,EAAQ,UAAU,KAAKN,CAAY,IAC5BQ,KAAQH,IAAe,KAAKF,IACnCG,EAAQ,WAAW,KAAKN,CAAY,IAEpCM,EAAQ,MAAM,KAAKN,CAAY;CAEvC;CACA,OAAQ,OAAO,QAAQM,CAAO,CAAC,CAC1B,QAAQ,GAAGG,OAAWA,EAAM,SAAS,CAAC,CAAC,CACvC,KAAK,CAACC,GAAKD,QAAY;EAAE;EAAK;CAAM,EAAE;AAC/C;AAOA,SAAgBE,EAAuB,GAGpC;C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