@8wave/ai-elements 0.126.0-beta.36 → 0.126.0-beta.37
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/_chunks/{PkChatbotFilePreview-Cw3va5vW.js → PkChatbotFilePreview-CLUH7cTq.js} +2 -2
- package/dist/_chunks/{PkChatbotFilePreview-Cw3va5vW.js.map → PkChatbotFilePreview-CLUH7cTq.js.map} +1 -1
- package/dist/_chunks/{PkEditorRadioButtons-CY0D_EkU.js → PkEditorRadioButtons-YSngp-Wn.js} +2 -2
- package/dist/_chunks/{PkEditorRadioButtons-CY0D_EkU.js.map → PkEditorRadioButtons-YSngp-Wn.js.map} +1 -1
- package/dist/_chunks/{PkFilePreview-D4TgY0T9.js → PkFilePreview-BHqmp1EW.js} +5 -5
- package/dist/_chunks/{PkFilePreview-D4TgY0T9.js.map → PkFilePreview-BHqmp1EW.js.map} +1 -1
- package/dist/_chunks/{PkFilePreviewDialog-8H1GeV91.js → PkFilePreviewDialog-BHAgVlKs.js} +3 -3
- package/dist/_chunks/{PkFilePreviewDialog-8H1GeV91.js.map → PkFilePreviewDialog-BHAgVlKs.js.map} +1 -1
- package/dist/_chunks/{PkHeldImage-B6UYQ8Ox.js → PkHeldImage-WGwFM77v.js} +2 -2
- package/dist/_chunks/{PkHeldImage-B6UYQ8Ox.js.map → PkHeldImage-WGwFM77v.js.map} +1 -1
- package/dist/_chunks/{PkImageEditorDialog-BqHjVX97.js → PkImageEditorDialog-BDwL39Du.js} +18 -18
- package/dist/_chunks/{PkImageEditorDialog-BqHjVX97.js.map → PkImageEditorDialog-BDwL39Du.js.map} +1 -1
- package/dist/_chunks/{PkLazyImg-D3XOz-dS.js → PkLazyImg-DL7hxjyy.js} +2 -2
- package/dist/_chunks/{PkLazyImg-D3XOz-dS.js.map → PkLazyImg-DL7hxjyy.js.map} +1 -1
- package/dist/_chunks/{PkSelectionActions-BxUXWFNK.js → PkSelectionActions-DLsZ8-gW.js} +2 -2
- package/dist/_chunks/{PkSelectionActions-BxUXWFNK.js.map → PkSelectionActions-DLsZ8-gW.js.map} +1 -1
- package/dist/_chunks/{PkToolChatFile-CSBzfuyE.js → PkToolChatFile-62j1S0Pq.js} +3 -3
- package/dist/_chunks/{PkToolChatFile-CSBzfuyE.js.map → PkToolChatFile-62j1S0Pq.js.map} +1 -1
- package/dist/_chunks/{PkToolRequestGeolocation-DNzNRszE.js → PkToolRequestGeolocation-B9EM_K6O.js} +2 -2
- package/dist/_chunks/{PkToolRequestGeolocation-DNzNRszE.js.map → PkToolRequestGeolocation-B9EM_K6O.js.map} +1 -1
- package/dist/_chunks/{PkToolRequestOAuthConnection-BDxYXz4s.js → PkToolRequestOAuthConnection-CfjfqCHX.js} +3 -3
- package/dist/_chunks/{PkToolRequestOAuthConnection-BDxYXz4s.js.map → PkToolRequestOAuthConnection-CfjfqCHX.js.map} +1 -1
- package/dist/_chunks/{PkToolShareDocument-Kq7SFbw5.js → PkToolShareDocument-CYBU4LPO.js} +3 -3
- package/dist/_chunks/{PkToolShareDocument-Kq7SFbw5.js.map → PkToolShareDocument-CYBU4LPO.js.map} +1 -1
- package/dist/_chunks/{PkToolShowArtifact-d5tKvM01.js → PkToolShowArtifact-I_QZS7Pf.js} +2 -2
- package/dist/_chunks/{PkToolShowArtifact-d5tKvM01.js.map → PkToolShowArtifact-I_QZS7Pf.js.map} +1 -1
- package/dist/_chunks/{PkToolShowCalendarEvent-fMI-paCP.js → PkToolShowCalendarEvent-js9lh-cX.js} +3 -3
- package/dist/_chunks/{PkToolShowCalendarEvent-fMI-paCP.js.map → PkToolShowCalendarEvent-js9lh-cX.js.map} +1 -1
- package/dist/_chunks/{PkToolShowChart-lLXuHRJu.js → PkToolShowChart-BalU3bxm.js} +3 -3
- package/dist/_chunks/{PkToolShowChart-lLXuHRJu.js.map → PkToolShowChart-BalU3bxm.js.map} +1 -1
- package/dist/_chunks/{PkToolShowComparison-CKSqPgJo.js → PkToolShowComparison-DeO7cMeF.js} +3 -3
- package/dist/_chunks/{PkToolShowComparison-CKSqPgJo.js.map → PkToolShowComparison-DeO7cMeF.js.map} +1 -1
- package/dist/_chunks/{PkToolShowContactForm-Bni1QzXV.js → PkToolShowContactForm-BeJ5GR6t.js} +5 -5
- package/dist/_chunks/{PkToolShowContactForm-Bni1QzXV.js.map → PkToolShowContactForm-BeJ5GR6t.js.map} +1 -1
- package/dist/_chunks/{PkToolShowDiagram-DWVSCu33.js → PkToolShowDiagram-j3TTzZ5I.js} +3 -3
- package/dist/_chunks/{PkToolShowDiagram-DWVSCu33.js.map → PkToolShowDiagram-j3TTzZ5I.js.map} +1 -1
- package/dist/_chunks/{PkToolShowEmail-D6Mw24jB.js → PkToolShowEmail-CQ4uyty9.js} +3 -3
- package/dist/_chunks/{PkToolShowEmail-D6Mw24jB.js.map → PkToolShowEmail-CQ4uyty9.js.map} +1 -1
- package/dist/_chunks/{PkToolShowForm-CFXtO0j4.js → PkToolShowForm-B9VDoS_W.js} +15 -15
- package/dist/_chunks/{PkToolShowForm-CFXtO0j4.js.map → PkToolShowForm-B9VDoS_W.js.map} +1 -1
- package/dist/_chunks/{PkToolShowImageGallery-Ci_Kg44s.js → PkToolShowImageGallery-DFuc5IJ1.js} +3 -3
- package/dist/_chunks/{PkToolShowImageGallery-Ci_Kg44s.js.map → PkToolShowImageGallery-DFuc5IJ1.js.map} +1 -1
- package/dist/_chunks/{PkToolShowLocation-DV0puCbD.js → PkToolShowLocation-PThC5tCV.js} +3 -3
- package/dist/_chunks/{PkToolShowLocation-DV0puCbD.js.map → PkToolShowLocation-PThC5tCV.js.map} +1 -1
- package/dist/_chunks/{PkToolShowMessage-Bq2dbSy1.js → PkToolShowMessage-9mlI4IQ6.js} +3 -3
- package/dist/_chunks/{PkToolShowMessage-Bq2dbSy1.js.map → PkToolShowMessage-9mlI4IQ6.js.map} +1 -1
- package/dist/_chunks/{PkToolShowProductList-BWWzkWWA.js → PkToolShowProductList-C2EJKYOV.js} +4 -4
- package/dist/_chunks/{PkToolShowProductList-BWWzkWWA.js.map → PkToolShowProductList-C2EJKYOV.js.map} +1 -1
- package/dist/_chunks/{PkToolShowQrCode-DZkJIyMF.js → PkToolShowQrCode-DQiVo4Vh.js} +3 -3
- package/dist/_chunks/{PkToolShowQrCode-DZkJIyMF.js.map → PkToolShowQrCode-DQiVo4Vh.js.map} +1 -1
- package/dist/_chunks/{PkToolShowSources-Dv7hbDyy.js → PkToolShowSources-BL3DnfcN.js} +3 -3
- package/dist/_chunks/{PkToolShowSources-Dv7hbDyy.js.map → PkToolShowSources-BL3DnfcN.js.map} +1 -1
- package/dist/_chunks/{PkToolShowSuggestedReply-B_dRrZfj.js → PkToolShowSuggestedReply-DLgtjBJ1.js} +2 -2
- package/dist/_chunks/{PkToolShowSuggestedReply-B_dRrZfj.js.map → PkToolShowSuggestedReply-DLgtjBJ1.js.map} +1 -1
- package/dist/_chunks/{PkToolShowVideo-DLgQjTq_.js → PkToolShowVideo-DcWXDcOZ.js} +3 -3
- package/dist/_chunks/{PkToolShowVideo-DLgQjTq_.js.map → PkToolShowVideo-DcWXDcOZ.js.map} +1 -1
- package/dist/_chunks/{PkToolShowWeather-HElfkyLV.js → PkToolShowWeather-DLT47oC6.js} +2 -2
- package/dist/_chunks/{PkToolShowWeather-HElfkyLV.js.map → PkToolShowWeather-DLT47oC6.js.map} +1 -1
- package/dist/_chunks/{PkToolShowWebPages-XxcYBQpr.js → PkToolShowWebPages-CPqMC6qt.js} +4 -4
- package/dist/_chunks/{PkToolShowWebPages-XxcYBQpr.js.map → PkToolShowWebPages-CPqMC6qt.js.map} +1 -1
- package/dist/_chunks/{VvButtonLocalized-BgY-V26j.js → VvButtonLocalized-D_gumqSJ.js} +2 -2
- package/dist/_chunks/{VvButtonLocalized-BgY-V26j.js.map → VvButtonLocalized-D_gumqSJ.js.map} +1 -1
- package/dist/_chunks/{VvCheckbox.es-KisDJtH_.js → VvCheckbox.es-D44kGZc-.js} +2 -2
- package/dist/_chunks/{VvCheckbox.es-KisDJtH_.js.map → VvCheckbox.es-D44kGZc-.js.map} +1 -1
- package/dist/_chunks/{VvCheckboxGroup.es-CIVHYElp.js → VvCheckboxGroup.es-Da5Vuel0.js} +2 -2
- package/dist/_chunks/{VvCheckboxGroup.es-CIVHYElp.js.map → VvCheckboxGroup.es-Da5Vuel0.js.map} +1 -1
- package/dist/_chunks/{VvCombobox.es-DybZ6U_6.js → VvCombobox.es-BJzmLeTh.js} +467 -403
- package/dist/_chunks/VvCombobox.es-BJzmLeTh.js.map +1 -0
- package/dist/_chunks/{VvInputText.es-DFSPWDcH.js → VvInputText.es-CHcdm2K-.js} +280 -218
- package/dist/_chunks/VvInputText.es-CHcdm2K-.js.map +1 -0
- package/dist/_chunks/{VvRadio.es-vrNSXb3X.js → VvRadio.es-B3IskaN4.js} +2 -2
- package/dist/_chunks/{VvRadio.es-vrNSXb3X.js.map → VvRadio.es-B3IskaN4.js.map} +1 -1
- package/dist/_chunks/{VvRadioGroup.es-DalxMbrj.js → VvRadioGroup.es-CBivcD0v.js} +2 -2
- package/dist/_chunks/{VvRadioGroup.es-DalxMbrj.js.map → VvRadioGroup.es-CBivcD0v.js.map} +1 -1
- package/dist/_chunks/{VvSelect.es-D55xq4Lw.js → VvSelect.es-CAVvkyxB.js} +2 -2
- package/dist/_chunks/{VvSelect.es-D55xq4Lw.js.map → VvSelect.es-CAVvkyxB.js.map} +1 -1
- package/dist/_chunks/{VvTextarea.es-BOhkaXfY.js → VvTextarea.es-CgvZOWO4.js} +446 -384
- package/dist/_chunks/VvTextarea.es-CgvZOWO4.js.map +1 -0
- package/dist/_chunks/{index.es-BYhSukum.js → index.es-CEYwDeKz.js} +126 -66
- package/dist/_chunks/index.es-CEYwDeKz.js.map +1 -0
- package/dist/_chunks/{index.es-CPvSmI-B.js → index.es-DDdkqLT6.js} +10 -10
- package/dist/_chunks/{index.es-CPvSmI-B.js.map → index.es-DDdkqLT6.js.map} +1 -1
- package/dist/ai-elements.es.js +377 -376
- package/dist/ai-elements.es.js.map +1 -1
- package/dist-vue/PkChatbot.js +1 -1
- package/dist-vue/PkChatbotAuth.js +1 -1
- package/dist-vue/PkChatbotFeedbackForm.js +1 -1
- package/dist-vue/PkChatbotMessages.js +1 -1
- package/dist-vue/PkChatbotViewChat.js +1 -1
- package/dist-vue/PkChatbotViewConversations.js +1 -1
- package/dist-vue/PkChatbotViewProfile.js +1 -1
- package/dist-vue/_chunks/PkChatbot-aCgj2DMu.js +326 -0
- package/dist-vue/_chunks/PkChatbot-aCgj2DMu.js.map +1 -0
- package/dist-vue/_chunks/{PkChatbotAuth-449QUBoC.js → PkChatbotAuth-C5agN8ht.js} +2 -2
- package/dist-vue/_chunks/{PkChatbotAuth-449QUBoC.js.map → PkChatbotAuth-C5agN8ht.js.map} +1 -1
- package/dist-vue/_chunks/{PkChatbotFeedbackForm-DdQQlAr1.js → PkChatbotFeedbackForm-DjsLxYjT.js} +2 -2
- package/dist-vue/_chunks/{PkChatbotFeedbackForm-DdQQlAr1.js.map → PkChatbotFeedbackForm-DjsLxYjT.js.map} +1 -1
- package/dist-vue/_chunks/{PkChatbotMessages-_-h-egX7.js → PkChatbotMessages-CG3UZYcP.js} +3 -3
- package/dist-vue/_chunks/{PkChatbotMessages-_-h-egX7.js.map → PkChatbotMessages-CG3UZYcP.js.map} +1 -1
- package/dist-vue/_chunks/{PkChatbotViewChat-Bg-Op2Oe.js → PkChatbotViewChat-IU3HJpxG.js} +3 -3
- package/dist-vue/_chunks/{PkChatbotViewChat-Bg-Op2Oe.js.map → PkChatbotViewChat-IU3HJpxG.js.map} +1 -1
- package/dist-vue/_chunks/PkChatbotViewConversations-4zGrp7Fo.js +197 -0
- package/dist-vue/_chunks/PkChatbotViewConversations-4zGrp7Fo.js.map +1 -0
- package/dist-vue/_chunks/PkChatbotViewProfile-BrZ7oiUY.js +85 -0
- package/dist-vue/_chunks/PkChatbotViewProfile-BrZ7oiUY.js.map +1 -0
- package/dist-vue/_chunks/{PkFilePreview-DydUI1G2.js → PkFilePreview-WqS-s3vk.js} +2 -2
- package/dist-vue/_chunks/{PkFilePreview-DydUI1G2.js.map → PkFilePreview-WqS-s3vk.js.map} +1 -1
- package/dist-vue/_chunks/{PkFilePreviewDialog-BuG1whsJ.js → PkFilePreviewDialog-BIaTAK05.js} +2 -2
- package/dist-vue/_chunks/{PkFilePreviewDialog-BuG1whsJ.js.map → PkFilePreviewDialog-BIaTAK05.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolShowContactForm-D0lDC69x.js → PkToolShowContactForm-DFufPNnQ.js} +2 -2
- package/dist-vue/_chunks/{PkToolShowContactForm-D0lDC69x.js.map → PkToolShowContactForm-DFufPNnQ.js.map} +1 -1
- package/dist-vue/_chunks/{index.es-CwEgvvQD.js → index.es-BmedAjkp.js} +2 -2
- package/dist-vue/_chunks/{index.es-CwEgvvQD.js.map → index.es-BmedAjkp.js.map} +1 -1
- package/dist-vue/composables.js +8 -6
- package/dist-vue/composables.js.map +1 -1
- package/dist-vue/index.js +10 -10
- package/dist-vue/locales.js +20 -16
- package/dist-vue/packages/components/src/chat/PkChatbot.d.ts +7 -7
- package/package.json +2 -2
- package/dist/_chunks/VvCombobox.es-DybZ6U_6.js.map +0 -1
- package/dist/_chunks/VvInputText.es-DFSPWDcH.js.map +0 -1
- package/dist/_chunks/VvTextarea.es-BOhkaXfY.js.map +0 -1
- package/dist/_chunks/index.es-BYhSukum.js.map +0 -1
- package/dist-vue/_chunks/PkChatbot-CFJmT4nN.js +0 -299
- package/dist-vue/_chunks/PkChatbot-CFJmT4nN.js.map +0 -1
- package/dist-vue/_chunks/PkChatbotViewConversations--smzyxqN.js +0 -226
- package/dist-vue/_chunks/PkChatbotViewConversations--smzyxqN.js.map +0 -1
- package/dist-vue/_chunks/PkChatbotViewProfile-Cn7IQfnQ.js +0 -86
- package/dist-vue/_chunks/PkChatbotViewProfile-Cn7IQfnQ.js.map +0 -1
- package/dist-vue/_chunks/chatbotProfileContext-b-nve-mR.js +0 -5
- package/dist-vue/_chunks/chatbotProfileContext-b-nve-mR.js.map +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"PkChatbotViewConversations--smzyxqN.js","names":["_openBlock","_createElementBlock","_unref","_createElementVNode","_Fragment","_renderList","_normalizeClass","_createVNode","_toDisplayString","_isRef","_withCtx","_createBlock","PkRelativeTime","_mergeProps","_createTextVNode","_withModifiers","VvButtonLocalized","useChatbotStore","useDialogConfirm","stripMarkdown","getTextPart","PkRelativeTime_default","localizeSummaryLabels","ChatbotProfileContextKey","getConversationPreview","conversation","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"],"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 class=\"vv-item-group__list overflow-y-auto pb-64\">\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-3 text-smaller shrink-0\"\n :date=\"conversation.lastMessageAt\" />\n </div>\n <span class=\"text-12 text-word-3 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,SAAgBwB,EAAuB,GAAoC;CACvE,OACIL,EAAcM,EAAa,KAAK,KAChCN,EACIC,EAGIK,EAAa,UAAU,MAClB,MAAYC,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,IAAML,KAAgBM,GAAe;EA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BAETlE,EAImB+F,GAAA,EAHd,UAAK,MAAEpG,EAAA4E,EAAA,CAAY,CAACrD,EAAa,EAAE,E;KACpC,SAAAf,QAAoC,CAApCH,EAAoCwF,GAAA,EAA5B,MAAK,qBAAoB,CAAA,GAAGjF,EAAA,MACpCN,EAAGN,EAAAuE,CAAA,CAAE,CAAA,eAAA,CAAA,GAAA,CAAA,C;;;IAbb,SAAA/D,QAGqC,CAHrCH,EAGqC0F,GAAA;KAFjC,MAAK;KACJ,OAAO/F,EAAAuE,CAAA,CAAE,CAAA,oBAAA;KACV,WAAU;;;G,sCAsB5BvE,EAAA6B,CAAA,CAAa,CAAC,SAAM,KAD9B/B,EAAA,GAAAC,EAsBM,OAtBNmE,IAsBM,CAfF7D,EAKmC0F,GAAA;IAJ/B,OAAM;IACN,WAAU;IACV,MAAK;IACJ,OAAO/F,EAAAuE,CAAA,CAAE,CAAA,qBAAA;IACT,SAAK,AAAA0C,EAAA,OAAApG,GAAA,MAAOb,EAAA4F,CAAA,CAAY,CAAA,GAAA,CAAA,MAAA,CAAA;G,wBAEnBL,EAAA,SADVzF,EAAA,GAAAW,EAQqCsF,GAAA;;IANjC,OAAM;IACN,WAAU;IACV,MAAK;IACJ,SAASN,EAAA;IACT,UAAUA,EAAA;IACV,OAAOzF,EAAAuE,CAAA,CAAE,CAAA,8BAAA;IACT,SAAK,AAAA0C,EAAA,OAAApG,GAAA,MAAO6E,GAAc,GAAA,CAAA,MAAA,CAAA"}
|
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
import { t as e } from "./VvButtonLocalized-C-vx25u4.js";
|
|
2
|
-
import { n as t } from "./useChatbotStore-Hb5EjISl.js";
|
|
3
|
-
import { t as n } from "./PkAvatar-DwtZWSW4.js";
|
|
4
|
-
import { t as r } from "./chatbotProfileContext-b-nve-mR.js";
|
|
5
|
-
import { VvAlert as i, VvIcon as a } from "@volverjs/ui-vue/components";
|
|
6
|
-
import { computed as o, createBlock as s, createCommentVNode as c, createElementBlock as l, createElementVNode as u, createVNode as d, defineComponent as f, inject as p, openBlock as m, ref as h, renderSlot as g, toDisplayString as _, unref as v } from "vue";
|
|
7
|
-
import { useI18n as y } from "vue-i18n";
|
|
8
|
-
import { storeToRefs as b } from "pinia";
|
|
9
|
-
// ../../packages/components/src/chat/PkChatbotViewProfile.vue?vue&type=script&setup=true&lang.ts
|
|
10
|
-
var x = { class: "flex flex-col flex-1 min-h-0 overflow-y-auto" }, S = { class: "flex flex-col items-center gap-sm pt-lg px-lg pb-md bg-surface-1 border-b border-surface-3" }, C = { class: "flex flex-col items-center gap-6 text-center" }, w = {
|
|
11
|
-
key: 0,
|
|
12
|
-
class: "text-16 font-semibold text-word-1 leading-tight"
|
|
13
|
-
}, T = {
|
|
14
|
-
key: 1,
|
|
15
|
-
class: "text-12 text-word-3 leading-none"
|
|
16
|
-
}, E = { class: "flex flex-col gap-sm p-md flex-1" }, D = ["href"], O = { class: "w-40 h-40 rounded-lg bg-surface-2 border border-surface-3 flex items-center justify-center shrink-0" }, k = { class: "flex flex-col flex-1 min-w-0 gap-1" }, A = { class: "text-14 font-medium text-word-1 leading-tight" }, j = { class: "text-12 text-word-3 leading-tight" }, M = {
|
|
17
|
-
key: 0,
|
|
18
|
-
class: "px-md py-sm"
|
|
19
|
-
}, N = /* @__PURE__ */ f({
|
|
20
|
-
__name: "PkChatbotViewProfile",
|
|
21
|
-
props: { agentId: {} },
|
|
22
|
-
setup(f) {
|
|
23
|
-
let N = f, { t: P } = y({ useScope: "global" }), F = t(N.agentId), { name: I, agentInterface: L } = b(F), R = p(r, void 0), z = o(() => R?.user.value ?? null), B = o(() => R?.canManageProfile.value ?? !1), V = o(() => R?.profileUrl.value), H = o(() => R?.isExternalAuth?.value ?? !1), U = h(!1), W = h();
|
|
24
|
-
async function G() {
|
|
25
|
-
if (R) {
|
|
26
|
-
U.value = !0;
|
|
27
|
-
try {
|
|
28
|
-
await R.signOut();
|
|
29
|
-
} catch (e) {
|
|
30
|
-
W.value = e instanceof Error ? e.message : P("message.error");
|
|
31
|
-
} finally {
|
|
32
|
-
U.value = !1;
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
return (t, r) => {
|
|
37
|
-
let o = i, f = a, p = e;
|
|
38
|
-
return m(), l("div", x, [
|
|
39
|
-
u("div", S, [d(n, {
|
|
40
|
-
class: "w-64 h-64",
|
|
41
|
-
"aria-hidden": "true",
|
|
42
|
-
name: z.value?.name ?? v(I),
|
|
43
|
-
"img-src": z.value?.image ?? v(L)?.logo
|
|
44
|
-
}, null, 8, ["name", "img-src"]), u("div", C, [z.value?.name ?? v(I) ? (m(), l("strong", w, _(z.value?.name ?? v(I)), 1)) : c("", !0), z.value?.email ? (m(), l("span", T, _(z.value.email), 1)) : c("", !0)])]),
|
|
45
|
-
u("div", E, [W.value ? (m(), s(o, {
|
|
46
|
-
key: 0,
|
|
47
|
-
modifiers: "danger",
|
|
48
|
-
content: W.value
|
|
49
|
-
}, null, 8, ["content"])) : c("", !0), B.value && V.value && !H.value ? (m(), l("a", {
|
|
50
|
-
key: 1,
|
|
51
|
-
href: V.value,
|
|
52
|
-
target: "_blank",
|
|
53
|
-
rel: "noopener noreferrer",
|
|
54
|
-
class: "flex items-center gap-12 p-12 rounded-lg border border-surface-3 hover:border-surface-5 hover:bg-surface-1 transition-colors cursor-pointer no-underline"
|
|
55
|
-
}, [
|
|
56
|
-
u("div", O, [d(f, {
|
|
57
|
-
name: "ri:user-settings-line",
|
|
58
|
-
class: "w-20 h-20 text-word-2"
|
|
59
|
-
})]),
|
|
60
|
-
u("div", k, [u("span", A, _(v(P)("action.manageProfile")), 1), u("span", j, _(v(P)("label.manageProfileDescription")), 1)]),
|
|
61
|
-
d(f, {
|
|
62
|
-
name: "ri:arrow-right-s-line",
|
|
63
|
-
class: "w-16 h-16 text-word-4 shrink-0"
|
|
64
|
-
})
|
|
65
|
-
], 8, D)) : c("", !0)]),
|
|
66
|
-
H.value ? c("", !0) : (m(), l("div", M, [d(p, {
|
|
67
|
-
modifiers: "secondary-danger",
|
|
68
|
-
class: "w-full",
|
|
69
|
-
icon: "ri:logout-box-line",
|
|
70
|
-
loading: U.value,
|
|
71
|
-
disabled: U.value,
|
|
72
|
-
label: v(P)("action.signOut"),
|
|
73
|
-
onClick: G
|
|
74
|
-
}, null, 8, [
|
|
75
|
-
"loading",
|
|
76
|
-
"disabled",
|
|
77
|
-
"label"
|
|
78
|
-
])])),
|
|
79
|
-
g(t.$slots, "default")
|
|
80
|
-
]);
|
|
81
|
-
};
|
|
82
|
-
}
|
|
83
|
-
});
|
|
84
|
-
export { N as t };
|
|
85
|
-
|
|
86
|
-
//# sourceMappingURL=PkChatbotViewProfile-Cn7IQfnQ.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"PkChatbotViewProfile-Cn7IQfnQ.js","names":["_openBlock","_createElementBlock","_createElementVNode","_createVNode","PkAvatar","_unref","_toDisplayString","_createBlock","_renderSlot","VvButtonLocalized","useChatbotStore","PkAvatar_default","ChatbotProfileContextKey","_hoisted_1","_hoisted_2","_hoisted_3","_hoisted_4","_hoisted_5","_hoisted_6","_hoisted_7","_hoisted_8","_hoisted_9","_hoisted_10","_hoisted_11","_hoisted_12","PkChatbotViewProfile_default","defineComponent","props","__props","$t","useI18n","store","agentName","storeToRefs","profile","inject","user","computed","canManage","profileUrl","isExternalAuth","isSigningOut","ref","errorMessage","onSignOut","error","_component_VvAlert","VvAlert","_component_VvIcon","VvIcon","_component_VvButton","openBlock","createElementBlock","createElementVNode","createVNode","unref","agentInterface","toDisplayString","createCommentVNode","createBlock","renderSlot","_ctx"],"sources":["../../../../packages/components/src/chat/PkChatbotViewProfile.vue"],"sourcesContent":["<script setup lang=\"ts\">\n import { computed, inject, ref } from 'vue'\n import { storeToRefs } from 'pinia'\n import { useI18n } from 'vue-i18n'\n import { useChatbotStore } from 'composables'\n import PkAvatar from './PkAvatar.vue'\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 { name: agentName, agentInterface } = storeToRefs(store)\n\n const profile = inject(ChatbotProfileContextKey, undefined)\n const user = computed(() => profile?.user.value ?? null)\n const canManage = computed(() => profile?.canManageProfile.value ?? false)\n const profileUrl = computed(() => profile?.profileUrl.value)\n // External token mode: the host owns the auth lifecycle, so the widget\n // offers no sign-out nor profile management (the main site is not\n // accessible to externally authenticated users).\n const isExternalAuth = computed(\n () => profile?.isExternalAuth?.value ?? false,\n )\n\n const isSigningOut = ref(false)\n const errorMessage = ref<string>()\n\n async function onSignOut() {\n if (!profile) {\n return\n }\n isSigningOut.value = true\n try {\n await profile.signOut()\n } catch (error) {\n errorMessage.value =\n error instanceof Error ? error.message : $t('message.error')\n } finally {\n isSigningOut.value = false\n }\n }\n</script>\n\n<template>\n <div class=\"flex flex-col flex-1 min-h-0 overflow-y-auto\">\n <!-- Hero: user identity -->\n <div\n class=\"flex flex-col items-center gap-sm pt-lg px-lg pb-md bg-surface-1 border-b border-surface-3\">\n <PkAvatar\n class=\"w-64 h-64\"\n aria-hidden=\"true\"\n :name=\"user?.name ?? agentName\"\n :img-src=\"user?.image ?? agentInterface?.logo\" />\n <div class=\"flex flex-col items-center gap-6 text-center\">\n <strong\n v-if=\"user?.name ?? agentName\"\n class=\"text-16 font-semibold text-word-1 leading-tight\">\n {{ user?.name ?? agentName }}\n </strong>\n <span\n v-if=\"user?.email\"\n class=\"text-12 text-word-3 leading-none\">\n {{ user.email }}\n </span>\n </div>\n </div>\n\n <!-- Actions -->\n <div class=\"flex flex-col gap-sm p-md flex-1\">\n <VvAlert\n v-if=\"errorMessage\"\n modifiers=\"danger\"\n :content=\"errorMessage\" />\n\n <!-- Manage profile link card -->\n <a\n v-if=\"canManage && profileUrl && !isExternalAuth\"\n :href=\"profileUrl\"\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n class=\"flex items-center gap-12 p-12 rounded-lg border border-surface-3 hover:border-surface-5 hover:bg-surface-1 transition-colors cursor-pointer no-underline\">\n <div\n class=\"w-40 h-40 rounded-lg bg-surface-2 border border-surface-3 flex items-center justify-center shrink-0\">\n <VvIcon\n name=\"ri:user-settings-line\"\n class=\"w-20 h-20 text-word-2\" />\n </div>\n <div class=\"flex flex-col flex-1 min-w-0 gap-1\">\n <span class=\"text-14 font-medium text-word-1 leading-tight\">\n {{ $t('action.manageProfile') }}\n </span>\n <span class=\"text-12 text-word-3 leading-tight\">\n {{ $t('label.manageProfileDescription') }}\n </span>\n </div>\n <VvIcon\n name=\"ri:arrow-right-s-line\"\n class=\"w-16 h-16 text-word-4 shrink-0\" />\n </a>\n </div>\n\n <!-- Footer: sign out -->\n <div v-if=\"!isExternalAuth\" class=\"px-md py-sm\">\n <VvButton\n modifiers=\"secondary-danger\"\n class=\"w-full\"\n icon=\"ri:logout-box-line\"\n :loading=\"isSigningOut\"\n :disabled=\"isSigningOut\"\n :label=\"$t('action.signOut')\"\n @click=\"onSignOut\" />\n </div>\n\n <slot />\n </div>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;EAQI,IAAM2B,IAAQC,GAER,EAAE,GAAGC,MAAOC,EAAQ,EAAE,UAAU,SAAS,CAAC,GAE1CC,IAAQrB,EAAgBiB,EAAM,OAAO,GACrC,EAAE,MAAMK,GAAW,sBAAmBC,EAAYF,CAAK,GAEvDG,IAAUC,EAAOvB,GAA0B,KAAA,CAAS,GACpDwB,IAAOC,QAAeH,GAAS,KAAK,SAAS,IAAI,GACjDI,IAAYD,QAAeH,GAAS,iBAAiB,SAAS,EAAK,GACnEK,IAAaF,QAAeH,GAAS,WAAW,KAAK,GAIrDM,IAAiBH,QACbH,GAAS,gBAAgB,SAAS,EAC5C,GAEMO,IAAeC,EAAI,EAAK,GACxBC,IAAeD,EAAY;EAEjC,eAAeE,IAAY;GACvB,IAAKV,GAGL;MAAa,QAAQ;IACrB,IAAI;KACA,MAAMA,EAAQ,QAA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AAM;;;IAKNR,EAAA,Q,aAAZxC,EAAA,GAAAC,EASM,OATNuB,GASM,CARFrB,EAOyB+C,GAAA;KANrB,WAAU;KACV,OAAM;KACN,MAAK;KACJ,SAAST,EAAA;KACT,UAAUA,EAAA;KACV,OAAOpC,EAAAwB,CAAA,CAAE,CAAA,gBAAA;KACT,SAAOe;;;;;;IAGhBpC,EAAQqD,EAAA,QAAA,SAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"chatbotProfileContext-b-nve-mR.js","names":["ChatbotProfileContextKey"],"sources":["../../../../packages/components/src/chat/chatbotProfileContext.ts"],"sourcesContent":["import type { ComputedRef, InjectionKey } from 'vue'\n\n/**\n * Profile management context provided by the host widget\n * (apps/web-component) and injected by `PkChatbot` / `PkChatbotViewProfile`.\n *\n * Keeping it injectable (rather than prop-drilled) lets the shared chat\n * components stay decoupled from the better-auth client: the widget owns the\n * auth client and exposes only the high-level actions the profile panel needs.\n * When the context is absent (e.g. anonymous session, or a host that doesn't\n * wire it up) the profile panel falls back to a read-only stub.\n */\n\nexport interface ChatbotProfileUser {\n id: string\n name?: string | null\n email?: string | null\n image?: string | null\n isAnonymous?: boolean | null\n}\n\nexport interface ChatbotProfileContext {\n /** The authenticated, non-anonymous user, or null. */\n user: ComputedRef<ChatbotProfileUser | null>\n /** Whether the profile panel should be reachable / rendered. */\n canManageProfile: ComputedRef<boolean>\n /**\n * Whether the agent has at least one auth method enabled, so the chat can\n * offer a voluntary sign-in to anonymous users (`auth` view, filled by\n * the host through the `view-auth` slot).\n */\n canSignIn?: ComputedRef<boolean>\n /**\n * URL of the profile management page on the main site, or undefined when\n * the installation did not say where its app is: no link then.\n */\n profileUrl: ComputedRef<string | undefined>\n /**\n * External token mode: the host application owns the auth lifecycle, so\n * the widget offers no sign-out nor profile management affordances.\n * Defaults to false when absent.\n */\n isExternalAuth?: ComputedRef<boolean>\n signOut: () => Promise<void>\n /**\n * GDPR B.3 — erases ALL conversations of the current session's user,\n * anonymous sessions included. When the backend deletes the (PII-free)\n * anonymous account along with them, `accountDeleted` is true and the\n * host has already cleared its session cookies.\n */\n eraseConversations?: () => Promise<{ accountDeleted: boolean }>\n}\n\nexport const ChatbotProfileContextKey: InjectionKey<ChatbotProfileContext> =\n Symbol('chatbotProfileContext')\n"],"mappings":";AAqDA,IAAaA,IACT,OAAO,uBAAuB"}
|