@8wave/ai-elements 0.118.0 → 0.119.0-beta.12
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/{PkStreamingMarkdown--CcBvs19.js → PkStreamingMarkdown-Bry3y6Ru.js} +789 -780
- package/dist/_chunks/PkStreamingMarkdown-Bry3y6Ru.js.map +1 -0
- package/dist/_chunks/{PkToolShowArtifact-BVGN7hV2.js → PkToolShowArtifact-CfJLe8vD.js} +2 -2
- package/dist/_chunks/{PkToolShowArtifact-BVGN7hV2.js.map → PkToolShowArtifact-CfJLe8vD.js.map} +1 -1
- package/dist/_chunks/{PkToolShowContactForm-Blrwqpl0.js → PkToolShowContactForm-CQQ6p4bJ.js} +2 -2
- package/dist/_chunks/{PkToolShowContactForm-Blrwqpl0.js.map → PkToolShowContactForm-CQQ6p4bJ.js.map} +1 -1
- package/dist/_chunks/{PkToolShowForm-BpGHaN6x.js → PkToolShowForm-CGAc1O6K.js} +4 -4
- package/dist/_chunks/{PkToolShowForm-BpGHaN6x.js.map → PkToolShowForm-CGAc1O6K.js.map} +1 -1
- package/dist/_chunks/{PkToolShowSources-8c9RvGV1.js → PkToolShowSources-BJ-XFrLD.js} +3 -3
- package/dist/_chunks/{PkToolShowSources-8c9RvGV1.js.map → PkToolShowSources-BJ-XFrLD.js.map} +1 -1
- package/dist/_chunks/{markdown-c59ir6tw.js → markdown-DpoAzJSk.js} +64 -61
- package/dist/_chunks/markdown-DpoAzJSk.js.map +1 -0
- package/dist/ai-elements.es.js +1944 -1865
- package/dist/ai-elements.es.js.map +1 -1
- package/dist-vue/PkChatbot.js +1 -1
- package/dist-vue/PkChatbotEmptyState.js +1 -1
- package/dist-vue/PkChatbotInput.js +1 -1
- package/dist-vue/PkChatbotMessages.js +1 -1
- package/dist-vue/PkChatbotStepPayload.js +1 -1
- package/dist-vue/PkChatbotStepToolDetail.js +1 -1
- package/dist-vue/PkChatbotSteps.js +1 -1
- package/dist-vue/PkChatbotViewChat.js +1 -1
- package/dist-vue/PkChatbotViewFiles.js +1 -1
- package/dist-vue/PkChatbotViewProfile.js +1 -1
- package/dist-vue/_chunks/{Document-B-oyVh7v.js → Document-CV-RJu_p.js} +64 -61
- package/dist-vue/_chunks/Document-CV-RJu_p.js.map +1 -0
- package/dist-vue/_chunks/PkAvatar-BTqu8tn9.js +44 -0
- package/dist-vue/_chunks/PkAvatar-BTqu8tn9.js.map +1 -0
- package/dist-vue/_chunks/PkChatbot-CcNC2r_E.js +276 -0
- package/dist-vue/_chunks/PkChatbot-CcNC2r_E.js.map +1 -0
- package/dist-vue/_chunks/{PkChatbotEmptyState-D2dhInfG.js → PkChatbotEmptyState-Toj4CqXV.js} +3 -3
- package/dist-vue/_chunks/{PkChatbotEmptyState-D2dhInfG.js.map → PkChatbotEmptyState-Toj4CqXV.js.map} +1 -1
- package/dist-vue/_chunks/{PkChatbotInput-CQdxFbBR.js → PkChatbotInput-BfZqRpQ2.js} +2 -2
- package/dist-vue/_chunks/{PkChatbotInput-CQdxFbBR.js.map → PkChatbotInput-BfZqRpQ2.js.map} +1 -1
- package/dist-vue/_chunks/{PkChatbotMessages-coscJcpy.js → PkChatbotMessages-B6qYZsMZ.js} +283 -283
- package/dist-vue/_chunks/{PkChatbotMessages-coscJcpy.js.map → PkChatbotMessages-B6qYZsMZ.js.map} +1 -1
- package/dist-vue/_chunks/{PkChatbotStepPayload-DnqFluQZ.js → PkChatbotStepPayload-D0eoPBQ8.js} +2 -2
- package/dist-vue/_chunks/{PkChatbotStepPayload-DnqFluQZ.js.map → PkChatbotStepPayload-D0eoPBQ8.js.map} +1 -1
- package/dist-vue/_chunks/{PkChatbotStepToolDetail-BMslY_BG.js → PkChatbotStepToolDetail-CMx4cw1D.js} +3 -3
- package/dist-vue/_chunks/{PkChatbotStepToolDetail-BMslY_BG.js.map → PkChatbotStepToolDetail-CMx4cw1D.js.map} +1 -1
- package/dist-vue/_chunks/{PkChatbotSteps-7FT6Ju6_.js → PkChatbotSteps-DeZQhGRU.js} +38 -38
- package/dist-vue/_chunks/{PkChatbotSteps-7FT6Ju6_.js.map → PkChatbotSteps-DeZQhGRU.js.map} +1 -1
- package/dist-vue/_chunks/{PkChatbotViewChat-Cko-Cw6c.js → PkChatbotViewChat--Q90F_Kg.js} +7 -7
- package/dist-vue/_chunks/PkChatbotViewChat--Q90F_Kg.js.map +1 -0
- package/dist-vue/_chunks/{PkChatbotViewFiles-gqCumfod.js → PkChatbotViewFiles-CA20TBFY.js} +2 -2
- package/dist-vue/_chunks/{PkChatbotViewFiles-gqCumfod.js.map → PkChatbotViewFiles-CA20TBFY.js.map} +1 -1
- package/dist-vue/_chunks/{PkChatbotViewProfile-B57VRVaO.js → PkChatbotViewProfile-CyzRxE3D.js} +2 -2
- package/dist-vue/_chunks/{PkChatbotViewProfile-B57VRVaO.js.map → PkChatbotViewProfile-CyzRxE3D.js.map} +1 -1
- package/dist-vue/_chunks/{PkStreamingMarkdown-BtyWXY2k.js → PkStreamingMarkdown-C55Fi0Pd.js} +2 -2
- package/dist-vue/_chunks/{PkStreamingMarkdown-BtyWXY2k.js.map → PkStreamingMarkdown-C55Fi0Pd.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolShowArtifact-Ritx54_X.js → PkToolShowArtifact-z1qTnFkA.js} +2 -2
- package/dist-vue/_chunks/{PkToolShowArtifact-Ritx54_X.js.map → PkToolShowArtifact-z1qTnFkA.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolShowContactForm-D30IsZGy.js → PkToolShowContactForm-BjNpnv6y.js} +2 -2
- package/dist-vue/_chunks/{PkToolShowContactForm-D30IsZGy.js.map → PkToolShowContactForm-BjNpnv6y.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolShowDiagram-PEozSAqU.js → PkToolShowDiagram-CqkabP0e.js} +2 -2
- package/dist-vue/_chunks/{PkToolShowDiagram-PEozSAqU.js.map → PkToolShowDiagram-CqkabP0e.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolShowForm-ZmdM9J9x.js → PkToolShowForm-CZFWZub7.js} +5 -5
- package/dist-vue/_chunks/{PkToolShowForm-ZmdM9J9x.js.map → PkToolShowForm-CZFWZub7.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolShowImageGallery-Dkjf7Tw_.js → PkToolShowImageGallery-CkfXP_lD.js} +2 -2
- package/dist-vue/_chunks/{PkToolShowImageGallery-Dkjf7Tw_.js.map → PkToolShowImageGallery-CkfXP_lD.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolShowProductList-CsHYM8vl.js → PkToolShowProductList-De-PtmD-.js} +2 -2
- package/dist-vue/_chunks/{PkToolShowProductList-CsHYM8vl.js.map → PkToolShowProductList-De-PtmD-.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolShowSources-CKZkcPLA.js → PkToolShowSources-CSN7S0zo.js} +3 -3
- package/dist-vue/_chunks/{PkToolShowSources-CKZkcPLA.js.map → PkToolShowSources-CSN7S0zo.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolShowVideo-CKm1fVQs.js → PkToolShowVideo-B_Q93E2y.js} +2 -2
- package/dist-vue/_chunks/{PkToolShowVideo-CKm1fVQs.js.map → PkToolShowVideo-B_Q93E2y.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolShowWebPages-DLEC9cuh.js → PkToolShowWebPages-D3CdjJUc.js} +2 -2
- package/dist-vue/_chunks/{PkToolShowWebPages-DLEC9cuh.js.map → PkToolShowWebPages-D3CdjJUc.js.map} +1 -1
- package/dist-vue/_chunks/{utils-fxHiCnzf.js → utils-CwIMEuAv.js} +41 -32
- package/dist-vue/_chunks/utils-CwIMEuAv.js.map +1 -0
- package/dist-vue/apps/web-component/src/composables/useChatbotAgent.d.ts +1 -4
- package/dist-vue/composables.js +188 -115
- package/dist-vue/composables.js.map +1 -1
- package/dist-vue/index.js +4008 -3983
- package/dist-vue/index.js.map +1 -1
- package/dist-vue/locales.js +4 -0
- package/dist-vue/packages/components/src/chat/PkAvatar.d.ts +7 -0
- package/dist-vue/packages/components/src/chat/utils.d.ts +10 -0
- package/dist-vue/packages/models/src/schema/Document.d.ts +25 -0
- package/dist-vue/packages/models/src/schema/Notification.d.ts +2 -0
- package/dist-vue/packages/models/src/schema/Platform.d.ts +72 -0
- package/dist-vue/style.css +1 -1
- package/package.json +1 -1
- package/dist/_chunks/PkStreamingMarkdown--CcBvs19.js.map +0 -1
- package/dist/_chunks/markdown-c59ir6tw.js.map +0 -1
- package/dist-vue/_chunks/Document-B-oyVh7v.js.map +0 -1
- package/dist-vue/_chunks/PkAvatar-ZgCsoO-p.js +0 -42
- package/dist-vue/_chunks/PkAvatar-ZgCsoO-p.js.map +0 -1
- package/dist-vue/_chunks/PkChatbot-Cm45hwYw.js +0 -275
- package/dist-vue/_chunks/PkChatbot-Cm45hwYw.js.map +0 -1
- package/dist-vue/_chunks/PkChatbotViewChat-Cko-Cw6c.js.map +0 -1
- package/dist-vue/_chunks/utils-fxHiCnzf.js.map +0 -1
package/dist-vue/_chunks/{PkChatbotViewFiles-gqCumfod.js.map → PkChatbotViewFiles-CA20TBFY.js.map}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PkChatbotViewFiles-gqCumfod.js","names":["__unplugin_components_0","__unplugin_components_1","_openBlock","_createElementBlock","_unref","_createElementVNode","_Fragment","_renderList","_normalizeClass","_createVNode","_toDisplayString","_createBlock","_sfc_main","isImageMime","fileIconForMime","isInlineViewable","useChatbotStore","useDialogConfirm","useImageFallback","useFileRow","useI18n","thumbUrl","urls","file","canShowImage","inline","download","iso","locale","useUserFileKind","isSpreadsheet","t","_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","PkChatbotViewFiles_default","defineComponent","props","__props","$t","store","storeToRefs","deletingId","ref","handleExclude","openDialogConfirm","removeConfirm","_component_VvIcon","VvIcon","_component_VvButton","VvButton","openBlock","createElementBlock","unref","isLoadingChatFiles","chatFiles","createElementVNode","Fragment","renderList","i","_cache","normalizeClass","createVNode","toDisplayString","openFile","showThumb","onThumbError","createBlock","formatDate","kindNote","removeLabel"],"sources":["../../../../packages/composable/src/useFileRow.ts","../../../../packages/components/src/chat/PkChatbotViewFiles.vue","../../../../packages/components/src/chat/PkChatbotViewFiles.vue"],"sourcesContent":["import { useI18n } from 'vue-i18n'\nimport { isImageMime, isInlineViewable } from 'models'\nimport { useImageFallback } from './useImageFallback'\n\n/** Minimal shape a file-list row needs for the shared display helpers. */\nexport interface FileRowLike {\n documentId: string\n mimeType: string | null\n}\n\n/**\n * Shared display logic for the user-files list rows, used by both the in-app\n * table (PjUserFilesTable) and the embedded widget (PkChatbotViewFiles). The two\n * surfaces differ only in how they build URLs (authenticated store vs widget API\n * client), so the URL builders are injected.\n *\n * - `view(id, inline)` → opens/downloads the original file.\n * - `preview(id)` → small resized blob for the row thumbnail.\n */\nexport function useFileRow(urls: {\n view: (documentId: string, inline: boolean) => string\n preview: (documentId: string) => string\n}) {\n const { locale } = useI18n({ useScope: 'global' })\n\n // Image rows show a thumbnail; if it fails to load (auth/redirect, or the\n // preview isn't generated yet) we fall back to the file-type icon.\n const { canShowImage, onImageError } = useImageFallback()\n const thumbUrl = (file: FileRowLike): string =>\n urls.preview(file.documentId)\n const showThumb = (file: FileRowLike): boolean =>\n isImageMime(file.mimeType) && canShowImage(thumbUrl(file))\n const onThumbError = (file: FileRowLike): void => {\n onImageError(thumbUrl(file))\n }\n\n // Name click previews images/PDF inline; an explicit download forces an\n // attachment (inline=false → download SAS).\n const openFile = (file: FileRowLike, download = false): void => {\n const inline = !download && isInlineViewable(file.mimeType)\n window.open(urls.view(file.documentId, inline), '_blank', 'noopener')\n }\n\n const formatDate = (iso: string): string =>\n new Date(iso).toLocaleDateString(locale.value, {\n year: 'numeric',\n month: 'short',\n day: 'numeric',\n })\n\n return { showThumb, thumbUrl, onThumbError, openFile, formatDate }\n}\n\n/** What tells a spreadsheet row apart from a KB document. */\nexport interface FileKindLike {\n kind?: 'document' | 'spreadsheet'\n sourceAttachmentId?: string | null\n}\n\n/**\n * The wording that depends on what a \"My files\" row is. A KB document is a\n * copy of the upload: removing it only takes it out of the assistant's reach.\n * A spreadsheet is the chat attachment itself and never enters the KB: its row\n * says so, and removing it deletes it from its chat with every version the\n * assistant wrote of it.\n */\nexport function useUserFileKind() {\n const { t } = useI18n({ useScope: 'global' })\n\n const isSpreadsheet = (file: FileKindLike): boolean =>\n file.kind === 'spreadsheet'\n\n /** A short note for the row; undefined for a KB document. */\n const kindNote = (file: FileKindLike): string | undefined => {\n if (!isSpreadsheet(file)) {\n return undefined\n }\n return file.sourceAttachmentId\n ? t('userFiles.spreadsheetVersion')\n : t('userFiles.spreadsheetInChatOnly')\n }\n\n const removeLabel = (file: FileKindLike): string =>\n isSpreadsheet(file)\n ? t('userFiles.deleteSpreadsheet')\n : t('userFiles.exclude')\n\n /** The options of the confirmation dialog before removing the file. */\n const removeConfirm = (file: FileKindLike) =>\n isSpreadsheet(file)\n ? {\n title: t('confirmTitle.deleteSpreadsheet'),\n questionLabel: t('userFiles.deleteSpreadsheetConfirm'),\n }\n : {\n title: t('confirmTitle.excludeUserFile'),\n questionLabel: t('userFiles.excludeConfirm'),\n }\n\n return { isSpreadsheet, kindNote, removeLabel, removeConfirm }\n}\n","<script setup lang=\"ts\">\n import { ref } from 'vue'\n import { storeToRefs } from 'pinia'\n import { useI18n } from 'vue-i18n'\n import { fileIconForMime } from 'models'\n import {\n useChatbotStore,\n useDialogConfirm,\n useFileRow,\n useUserFileKind,\n type ChatbotFile,\n } from 'composables'\n\n const props = defineProps<{ agentId: string }>()\n\n const { t: $t } = useI18n({ useScope: 'global' })\n const { openDialogConfirm } = useDialogConfirm()\n\n const store = useChatbotStore(props.agentId)\n const { chatFiles, isLoadingChatFiles } = storeToRefs(store)\n const { showThumb, thumbUrl, onThumbError, openFile, formatDate } =\n useFileRow({\n view: store.getChatFileUrl,\n preview: store.getChatFilePreviewUrl,\n })\n const { kindNote, removeLabel, removeConfirm } = useUserFileKind()\n\n const deletingId = ref<string | null>(null)\n\n const handleExclude = async (file: ChatbotFile) => {\n const proceed = await openDialogConfirm(removeConfirm(file))\n if (!proceed) {\n return\n }\n deletingId.value = file.documentId\n try {\n await store.deleteChatFile(file.documentId)\n } catch {\n // surfaced by the host's error handling\n } finally {\n deletingId.value = null\n }\n }\n</script>\n\n<template>\n <div class=\"flex flex-col flex-1 min-h-0 relative\">\n <!-- Loading skeleton, shaped like the rows it replaces -->\n <div\n v-if=\"isLoadingChatFiles && chatFiles.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 4\"\n :key=\"i\"\n class=\"vv-item vv-item--roomy vv-item--plain\">\n <div class=\"vv-item__entry\">\n <div class=\"vv-skeleton w-36 h-36 shrink-0 rounded-md\">\n <div class=\"vv-skeleton__item\" />\n </div>\n <div class=\"flex flex-col gap-6 flex-1 min-w-0\">\n <div\n class=\"vv-skeleton h-14 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 w-96\">\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=\"chatFiles.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\n name=\"ri:folder-open-line\"\n class=\"w-28 h-28 text-word-4\" />\n </div>\n <span class=\"text-14 text-word-3 leading-relaxed\">\n {{ $t('userFiles.chatFilesEmpty') }}\n </span>\n </div>\n\n <!-- File list -->\n <div v-else class=\"vv-item-group vv-item-group--fill\">\n <ul\n class=\"pk-chatbot-files vv-item-group__list overflow-y-auto light-scrollbar\">\n <li\n v-for=\"file in chatFiles\"\n :key=\"file.documentId\"\n class=\"vv-item vv-item--roomy\">\n <button\n type=\"button\"\n class=\"vv-item__entry\"\n :title=\"$t('userFiles.open')\"\n @click=\"openFile(file)\">\n <span class=\"pk-chatbot-files__icon\">\n <img\n v-if=\"showThumb(file)\"\n :src=\"thumbUrl(file)\"\n loading=\"lazy\"\n decoding=\"async\"\n alt=\"\"\n class=\"pk-chatbot-files__thumb\"\n @error=\"onThumbError(file)\" />\n <VvIcon\n v-else\n :name=\"fileIconForMime(file.mimeType)\" />\n </span>\n <span class=\"flex flex-col min-w-0 flex-1\">\n <span class=\"vv-item__title\">\n {{ file.name || $t('userFiles.untitled') }}\n </span>\n <span class=\"text-12 text-word-3\">\n {{\n [formatDate(file.createdAt), kindNote(file)]\n .filter(Boolean)\n .join(' · ')\n }}\n </span>\n </span>\n </button>\n <div class=\"vv-item__actions pk-chatbot-files__actions\">\n <VvButton\n modifiers=\"action-quiet-small\"\n icon=\"ri:download-line\"\n :title=\"$t('action.download')\"\n @click=\"openFile(file, true)\" />\n <VvButton\n modifiers=\"action-quiet-small\"\n icon=\"ri:delete-bin-line\"\n :title=\"removeLabel(file)\"\n :loading=\"deletingId === file.documentId\"\n :disabled=\"deletingId === file.documentId\"\n @click=\"handleExclude(file)\" />\n </div>\n </li>\n </ul>\n </div>\n </div>\n</template>\n\n<style lang=\"scss\">\n // The list and its rows come from `vv-item-group` and `vv-item`; what is\n // left here is the file tile and the pair of row actions.\n .pk-chatbot-files {\n // The box exists to clip a thumbnail and to keep the labels of rows\n // with and without one on the same left edge: with a file icon in it\n // there is nothing to draw, so it stays transparent.\n &__icon {\n display: flex;\n align-items: center;\n justify-content: center;\n width: var(--spacing-36);\n height: var(--spacing-36);\n flex-shrink: 0;\n border-radius: var(--rounded-md);\n color: var(--color-word-3);\n overflow: hidden;\n\n svg {\n width: var(--spacing-20);\n height: var(--spacing-20);\n }\n }\n\n &__thumb {\n width: 100%;\n height: 100%;\n object-fit: cover;\n }\n\n &__actions {\n gap: var(--spacing-2);\n }\n }\n</style>\n","<script setup lang=\"ts\">\n import { ref } from 'vue'\n import { storeToRefs } from 'pinia'\n import { useI18n } from 'vue-i18n'\n import { fileIconForMime } from 'models'\n import {\n useChatbotStore,\n useDialogConfirm,\n useFileRow,\n useUserFileKind,\n type ChatbotFile,\n } from 'composables'\n\n const props = defineProps<{ agentId: string }>()\n\n const { t: $t } = useI18n({ useScope: 'global' })\n const { openDialogConfirm } = useDialogConfirm()\n\n const store = useChatbotStore(props.agentId)\n const { chatFiles, isLoadingChatFiles } = storeToRefs(store)\n const { showThumb, thumbUrl, onThumbError, openFile, formatDate } =\n useFileRow({\n view: store.getChatFileUrl,\n preview: store.getChatFilePreviewUrl,\n })\n const { kindNote, removeLabel, removeConfirm } = useUserFileKind()\n\n const deletingId = ref<string | null>(null)\n\n const handleExclude = async (file: ChatbotFile) => {\n const proceed = await openDialogConfirm(removeConfirm(file))\n if (!proceed) {\n return\n }\n deletingId.value = file.documentId\n try {\n await store.deleteChatFile(file.documentId)\n } catch {\n // surfaced by the host's error handling\n } finally {\n deletingId.value = null\n }\n }\n</script>\n\n<template>\n <div class=\"flex flex-col flex-1 min-h-0 relative\">\n <!-- Loading skeleton, shaped like the rows it replaces -->\n <div\n v-if=\"isLoadingChatFiles && chatFiles.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 4\"\n :key=\"i\"\n class=\"vv-item vv-item--roomy vv-item--plain\">\n <div class=\"vv-item__entry\">\n <div class=\"vv-skeleton w-36 h-36 shrink-0 rounded-md\">\n <div class=\"vv-skeleton__item\" />\n </div>\n <div class=\"flex flex-col gap-6 flex-1 min-w-0\">\n <div\n class=\"vv-skeleton h-14 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 w-96\">\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=\"chatFiles.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\n name=\"ri:folder-open-line\"\n class=\"w-28 h-28 text-word-4\" />\n </div>\n <span class=\"text-14 text-word-3 leading-relaxed\">\n {{ $t('userFiles.chatFilesEmpty') }}\n </span>\n </div>\n\n <!-- File list -->\n <div v-else class=\"vv-item-group vv-item-group--fill\">\n <ul\n class=\"pk-chatbot-files vv-item-group__list overflow-y-auto light-scrollbar\">\n <li\n v-for=\"file in chatFiles\"\n :key=\"file.documentId\"\n class=\"vv-item vv-item--roomy\">\n <button\n type=\"button\"\n class=\"vv-item__entry\"\n :title=\"$t('userFiles.open')\"\n @click=\"openFile(file)\">\n <span class=\"pk-chatbot-files__icon\">\n <img\n v-if=\"showThumb(file)\"\n :src=\"thumbUrl(file)\"\n loading=\"lazy\"\n decoding=\"async\"\n alt=\"\"\n class=\"pk-chatbot-files__thumb\"\n @error=\"onThumbError(file)\" />\n <VvIcon\n v-else\n :name=\"fileIconForMime(file.mimeType)\" />\n </span>\n <span class=\"flex flex-col min-w-0 flex-1\">\n <span class=\"vv-item__title\">\n {{ file.name || $t('userFiles.untitled') }}\n </span>\n <span class=\"text-12 text-word-3\">\n {{\n [formatDate(file.createdAt), kindNote(file)]\n .filter(Boolean)\n .join(' · ')\n }}\n </span>\n </span>\n </button>\n <div class=\"vv-item__actions pk-chatbot-files__actions\">\n <VvButton\n modifiers=\"action-quiet-small\"\n icon=\"ri:download-line\"\n :title=\"$t('action.download')\"\n @click=\"openFile(file, true)\" />\n <VvButton\n modifiers=\"action-quiet-small\"\n icon=\"ri:delete-bin-line\"\n :title=\"removeLabel(file)\"\n :loading=\"deletingId === file.documentId\"\n :disabled=\"deletingId === file.documentId\"\n @click=\"handleExclude(file)\" />\n </div>\n </li>\n </ul>\n </div>\n </div>\n</template>\n\n<style lang=\"scss\">\n // The list and its rows come from `vv-item-group` and `vv-item`; what is\n // left here is the file tile and the pair of row actions.\n .pk-chatbot-files {\n // The box exists to clip a thumbnail and to keep the labels of rows\n // with and without one on the same left edge: with a file icon in it\n // there is nothing to draw, so it stays transparent.\n &__icon {\n display: flex;\n align-items: center;\n justify-content: center;\n width: var(--spacing-36);\n height: var(--spacing-36);\n flex-shrink: 0;\n border-radius: var(--rounded-md);\n color: var(--color-word-3);\n overflow: hidden;\n\n svg {\n width: var(--spacing-20);\n height: var(--spacing-20);\n }\n }\n\n &__thumb {\n width: 100%;\n height: 100%;\n object-fit: cover;\n }\n\n &__actions {\n gap: var(--spacing-2);\n }\n }\n</style>\n"],"mappings":";;;;;;;;;AAmBA,SAAgBmB,EAAW,GAGxB;CACC,IAAM,EAAE,cAAWC,EAAQ,EAAE,UAAU,SAAS,CAAC,GAI3C,EAAE,iBAAc,oBAAiBF,EAAiB,GAClDG,KAAY,MACdC,EAAK,QAAQC,EAAK,UAAU;CAqBhC,OAAO;EAAE,YApBU,MACfV,EAAYU,EAAK,QAAQ,KAAKC,EAAaH,EAASE,CAAI,CAAC;EAmBzC;EAAU,eAlBR,MAA4B;GAC9C,EAAaF,EAASE,CAAI,CAAC;EAC/B;EAgB4C,WAZ1B,GAAmB,IAAW,OAAgB;GAC5D,IAAME,IAAS,CAACC,KAAYX,EAAiBQ,EAAK,QAAQ;GAC1D,OAAO,KAAKD,EAAK,KAAKC,EAAK,YAAYE,CAAM,GAAG,UAAU,UAAU;EACxE;EASsD,aAPlC,MAChB,IAAI,KAAKE,CAAG,CAAC,CAAC,mBAAmBC,EAAO,OAAO;GAC3C,MAAM;GACN,OAAO;GACP,KAAK;EACT,CAAC;CAE4D;AACrE;AAeA,SAAgBC,IAAkB;CAC9B,IAAM,EAAE,SAAMT,EAAQ,EAAE,UAAU,SAAS,CAAC,GAE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AA,SAAAA,SAAAA,CAAAA,GAAAA,EAMmCsD,GAAA;IAL/B,WAAU;IACV,MAAK;IACJ,OAAO3D,EAAAgF,CAAA,CAAW,CAAC7D,CAAI;IACvB,SAASiC,EAAA,UAAejC,EAAK;IAC7B,UAAUiC,EAAA,UAAejC,EAAK;IAC9B,UAAK,MAAEmC,EAAcnC,CAAI"}
|
|
1
|
+
{"version":3,"file":"PkChatbotViewFiles-CA20TBFY.js","names":["__unplugin_components_0","__unplugin_components_1","_openBlock","_createElementBlock","_unref","_createElementVNode","_Fragment","_renderList","_normalizeClass","_createVNode","_toDisplayString","_createBlock","_sfc_main","isImageMime","fileIconForMime","isInlineViewable","useChatbotStore","useDialogConfirm","useImageFallback","useFileRow","useI18n","thumbUrl","urls","file","canShowImage","inline","download","iso","locale","useUserFileKind","isSpreadsheet","t","_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","PkChatbotViewFiles_default","defineComponent","props","__props","$t","store","storeToRefs","deletingId","ref","handleExclude","openDialogConfirm","removeConfirm","_component_VvIcon","VvIcon","_component_VvButton","VvButton","openBlock","createElementBlock","unref","isLoadingChatFiles","chatFiles","createElementVNode","Fragment","renderList","i","_cache","normalizeClass","createVNode","toDisplayString","openFile","showThumb","onThumbError","createBlock","formatDate","kindNote","removeLabel"],"sources":["../../../../packages/composable/src/useFileRow.ts","../../../../packages/components/src/chat/PkChatbotViewFiles.vue","../../../../packages/components/src/chat/PkChatbotViewFiles.vue"],"sourcesContent":["import { useI18n } from 'vue-i18n'\nimport { isImageMime, isInlineViewable } from 'models'\nimport { useImageFallback } from './useImageFallback'\n\n/** Minimal shape a file-list row needs for the shared display helpers. */\nexport interface FileRowLike {\n documentId: string\n mimeType: string | null\n}\n\n/**\n * Shared display logic for the user-files list rows, used by both the in-app\n * table (PjUserFilesTable) and the embedded widget (PkChatbotViewFiles). The two\n * surfaces differ only in how they build URLs (authenticated store vs widget API\n * client), so the URL builders are injected.\n *\n * - `view(id, inline)` → opens/downloads the original file.\n * - `preview(id)` → small resized blob for the row thumbnail.\n */\nexport function useFileRow(urls: {\n view: (documentId: string, inline: boolean) => string\n preview: (documentId: string) => string\n}) {\n const { locale } = useI18n({ useScope: 'global' })\n\n // Image rows show a thumbnail; if it fails to load (auth/redirect, or the\n // preview isn't generated yet) we fall back to the file-type icon.\n const { canShowImage, onImageError } = useImageFallback()\n const thumbUrl = (file: FileRowLike): string =>\n urls.preview(file.documentId)\n const showThumb = (file: FileRowLike): boolean =>\n isImageMime(file.mimeType) && canShowImage(thumbUrl(file))\n const onThumbError = (file: FileRowLike): void => {\n onImageError(thumbUrl(file))\n }\n\n // Name click previews images/PDF inline; an explicit download forces an\n // attachment (inline=false → download SAS).\n const openFile = (file: FileRowLike, download = false): void => {\n const inline = !download && isInlineViewable(file.mimeType)\n window.open(urls.view(file.documentId, inline), '_blank', 'noopener')\n }\n\n const formatDate = (iso: string): string =>\n new Date(iso).toLocaleDateString(locale.value, {\n year: 'numeric',\n month: 'short',\n day: 'numeric',\n })\n\n return { showThumb, thumbUrl, onThumbError, openFile, formatDate }\n}\n\n/** What tells a spreadsheet row apart from a KB document. */\nexport interface FileKindLike {\n kind?: 'document' | 'spreadsheet'\n sourceAttachmentId?: string | null\n}\n\n/**\n * The wording that depends on what a \"My files\" row is. A KB document is a\n * copy of the upload: removing it only takes it out of the assistant's reach.\n * A spreadsheet is the chat attachment itself and never enters the KB: its row\n * says so, and removing it deletes it from its chat with every version the\n * assistant wrote of it.\n */\nexport function useUserFileKind() {\n const { t } = useI18n({ useScope: 'global' })\n\n const isSpreadsheet = (file: FileKindLike): boolean =>\n file.kind === 'spreadsheet'\n\n /** A short note for the row; undefined for a KB document. */\n const kindNote = (file: FileKindLike): string | undefined => {\n if (!isSpreadsheet(file)) {\n return undefined\n }\n return file.sourceAttachmentId\n ? t('userFiles.spreadsheetVersion')\n : t('userFiles.spreadsheetInChatOnly')\n }\n\n const removeLabel = (file: FileKindLike): string =>\n isSpreadsheet(file)\n ? t('userFiles.deleteSpreadsheet')\n : t('userFiles.exclude')\n\n /** The options of the confirmation dialog before removing the file. */\n const removeConfirm = (file: FileKindLike) =>\n isSpreadsheet(file)\n ? {\n title: t('confirmTitle.deleteSpreadsheet'),\n questionLabel: t('userFiles.deleteSpreadsheetConfirm'),\n }\n : {\n title: t('confirmTitle.excludeUserFile'),\n questionLabel: t('userFiles.excludeConfirm'),\n }\n\n return { isSpreadsheet, kindNote, removeLabel, removeConfirm }\n}\n","<script setup lang=\"ts\">\n import { ref } from 'vue'\n import { storeToRefs } from 'pinia'\n import { useI18n } from 'vue-i18n'\n import { fileIconForMime } from 'models'\n import {\n useChatbotStore,\n useDialogConfirm,\n useFileRow,\n useUserFileKind,\n type ChatbotFile,\n } from 'composables'\n\n const props = defineProps<{ agentId: string }>()\n\n const { t: $t } = useI18n({ useScope: 'global' })\n const { openDialogConfirm } = useDialogConfirm()\n\n const store = useChatbotStore(props.agentId)\n const { chatFiles, isLoadingChatFiles } = storeToRefs(store)\n const { showThumb, thumbUrl, onThumbError, openFile, formatDate } =\n useFileRow({\n view: store.getChatFileUrl,\n preview: store.getChatFilePreviewUrl,\n })\n const { kindNote, removeLabel, removeConfirm } = useUserFileKind()\n\n const deletingId = ref<string | null>(null)\n\n const handleExclude = async (file: ChatbotFile) => {\n const proceed = await openDialogConfirm(removeConfirm(file))\n if (!proceed) {\n return\n }\n deletingId.value = file.documentId\n try {\n await store.deleteChatFile(file.documentId)\n } catch {\n // surfaced by the host's error handling\n } finally {\n deletingId.value = null\n }\n }\n</script>\n\n<template>\n <div class=\"flex flex-col flex-1 min-h-0 relative\">\n <!-- Loading skeleton, shaped like the rows it replaces -->\n <div\n v-if=\"isLoadingChatFiles && chatFiles.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 4\"\n :key=\"i\"\n class=\"vv-item vv-item--roomy vv-item--plain\">\n <div class=\"vv-item__entry\">\n <div class=\"vv-skeleton w-36 h-36 shrink-0 rounded-md\">\n <div class=\"vv-skeleton__item\" />\n </div>\n <div class=\"flex flex-col gap-6 flex-1 min-w-0\">\n <div\n class=\"vv-skeleton h-14 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 w-96\">\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=\"chatFiles.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\n name=\"ri:folder-open-line\"\n class=\"w-28 h-28 text-word-4\" />\n </div>\n <span class=\"text-14 text-word-3 leading-relaxed\">\n {{ $t('userFiles.chatFilesEmpty') }}\n </span>\n </div>\n\n <!-- File list -->\n <div v-else class=\"vv-item-group vv-item-group--fill\">\n <ul\n class=\"pk-chatbot-files vv-item-group__list overflow-y-auto light-scrollbar\">\n <li\n v-for=\"file in chatFiles\"\n :key=\"file.documentId\"\n class=\"vv-item vv-item--roomy\">\n <button\n type=\"button\"\n class=\"vv-item__entry\"\n :title=\"$t('userFiles.open')\"\n @click=\"openFile(file)\">\n <span class=\"pk-chatbot-files__icon\">\n <img\n v-if=\"showThumb(file)\"\n :src=\"thumbUrl(file)\"\n loading=\"lazy\"\n decoding=\"async\"\n alt=\"\"\n class=\"pk-chatbot-files__thumb\"\n @error=\"onThumbError(file)\" />\n <VvIcon\n v-else\n :name=\"fileIconForMime(file.mimeType)\" />\n </span>\n <span class=\"flex flex-col min-w-0 flex-1\">\n <span class=\"vv-item__title\">\n {{ file.name || $t('userFiles.untitled') }}\n </span>\n <span class=\"text-12 text-word-3\">\n {{\n [formatDate(file.createdAt), kindNote(file)]\n .filter(Boolean)\n .join(' · ')\n }}\n </span>\n </span>\n </button>\n <div class=\"vv-item__actions pk-chatbot-files__actions\">\n <VvButton\n modifiers=\"action-quiet-small\"\n icon=\"ri:download-line\"\n :title=\"$t('action.download')\"\n @click=\"openFile(file, true)\" />\n <VvButton\n modifiers=\"action-quiet-small\"\n icon=\"ri:delete-bin-line\"\n :title=\"removeLabel(file)\"\n :loading=\"deletingId === file.documentId\"\n :disabled=\"deletingId === file.documentId\"\n @click=\"handleExclude(file)\" />\n </div>\n </li>\n </ul>\n </div>\n </div>\n</template>\n\n<style lang=\"scss\">\n // The list and its rows come from `vv-item-group` and `vv-item`; what is\n // left here is the file tile and the pair of row actions.\n .pk-chatbot-files {\n // The box exists to clip a thumbnail and to keep the labels of rows\n // with and without one on the same left edge: with a file icon in it\n // there is nothing to draw, so it stays transparent.\n &__icon {\n display: flex;\n align-items: center;\n justify-content: center;\n width: var(--spacing-36);\n height: var(--spacing-36);\n flex-shrink: 0;\n border-radius: var(--rounded-md);\n color: var(--color-word-3);\n overflow: hidden;\n\n svg {\n width: var(--spacing-20);\n height: var(--spacing-20);\n }\n }\n\n &__thumb {\n width: 100%;\n height: 100%;\n object-fit: cover;\n }\n\n &__actions {\n gap: var(--spacing-2);\n }\n }\n</style>\n","<script setup lang=\"ts\">\n import { ref } from 'vue'\n import { storeToRefs } from 'pinia'\n import { useI18n } from 'vue-i18n'\n import { fileIconForMime } from 'models'\n import {\n useChatbotStore,\n useDialogConfirm,\n useFileRow,\n useUserFileKind,\n type ChatbotFile,\n } from 'composables'\n\n const props = defineProps<{ agentId: string }>()\n\n const { t: $t } = useI18n({ useScope: 'global' })\n const { openDialogConfirm } = useDialogConfirm()\n\n const store = useChatbotStore(props.agentId)\n const { chatFiles, isLoadingChatFiles } = storeToRefs(store)\n const { showThumb, thumbUrl, onThumbError, openFile, formatDate } =\n useFileRow({\n view: store.getChatFileUrl,\n preview: store.getChatFilePreviewUrl,\n })\n const { kindNote, removeLabel, removeConfirm } = useUserFileKind()\n\n const deletingId = ref<string | null>(null)\n\n const handleExclude = async (file: ChatbotFile) => {\n const proceed = await openDialogConfirm(removeConfirm(file))\n if (!proceed) {\n return\n }\n deletingId.value = file.documentId\n try {\n await store.deleteChatFile(file.documentId)\n } catch {\n // surfaced by the host's error handling\n } finally {\n deletingId.value = null\n }\n }\n</script>\n\n<template>\n <div class=\"flex flex-col flex-1 min-h-0 relative\">\n <!-- Loading skeleton, shaped like the rows it replaces -->\n <div\n v-if=\"isLoadingChatFiles && chatFiles.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 4\"\n :key=\"i\"\n class=\"vv-item vv-item--roomy vv-item--plain\">\n <div class=\"vv-item__entry\">\n <div class=\"vv-skeleton w-36 h-36 shrink-0 rounded-md\">\n <div class=\"vv-skeleton__item\" />\n </div>\n <div class=\"flex flex-col gap-6 flex-1 min-w-0\">\n <div\n class=\"vv-skeleton h-14 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 w-96\">\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=\"chatFiles.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\n name=\"ri:folder-open-line\"\n class=\"w-28 h-28 text-word-4\" />\n </div>\n <span class=\"text-14 text-word-3 leading-relaxed\">\n {{ $t('userFiles.chatFilesEmpty') }}\n </span>\n </div>\n\n <!-- File list -->\n <div v-else class=\"vv-item-group vv-item-group--fill\">\n <ul\n class=\"pk-chatbot-files vv-item-group__list overflow-y-auto light-scrollbar\">\n <li\n v-for=\"file in chatFiles\"\n :key=\"file.documentId\"\n class=\"vv-item vv-item--roomy\">\n <button\n type=\"button\"\n class=\"vv-item__entry\"\n :title=\"$t('userFiles.open')\"\n @click=\"openFile(file)\">\n <span class=\"pk-chatbot-files__icon\">\n <img\n v-if=\"showThumb(file)\"\n :src=\"thumbUrl(file)\"\n loading=\"lazy\"\n decoding=\"async\"\n alt=\"\"\n class=\"pk-chatbot-files__thumb\"\n @error=\"onThumbError(file)\" />\n <VvIcon\n v-else\n :name=\"fileIconForMime(file.mimeType)\" />\n </span>\n <span class=\"flex flex-col min-w-0 flex-1\">\n <span class=\"vv-item__title\">\n {{ file.name || $t('userFiles.untitled') }}\n </span>\n <span class=\"text-12 text-word-3\">\n {{\n [formatDate(file.createdAt), kindNote(file)]\n .filter(Boolean)\n .join(' · ')\n }}\n </span>\n </span>\n </button>\n <div class=\"vv-item__actions pk-chatbot-files__actions\">\n <VvButton\n modifiers=\"action-quiet-small\"\n icon=\"ri:download-line\"\n :title=\"$t('action.download')\"\n @click=\"openFile(file, true)\" />\n <VvButton\n modifiers=\"action-quiet-small\"\n icon=\"ri:delete-bin-line\"\n :title=\"removeLabel(file)\"\n :loading=\"deletingId === file.documentId\"\n :disabled=\"deletingId === file.documentId\"\n @click=\"handleExclude(file)\" />\n </div>\n </li>\n </ul>\n </div>\n </div>\n</template>\n\n<style lang=\"scss\">\n // The list and its rows come from `vv-item-group` and `vv-item`; what is\n // left here is the file tile and the pair of row actions.\n .pk-chatbot-files {\n // The box exists to clip a thumbnail and to keep the labels of rows\n // with and without one on the same left edge: with a file icon in it\n // there is nothing to draw, so it stays transparent.\n &__icon {\n display: flex;\n align-items: center;\n justify-content: center;\n width: var(--spacing-36);\n height: var(--spacing-36);\n flex-shrink: 0;\n border-radius: var(--rounded-md);\n color: var(--color-word-3);\n overflow: hidden;\n\n svg {\n width: var(--spacing-20);\n height: var(--spacing-20);\n }\n }\n\n &__thumb {\n width: 100%;\n height: 100%;\n object-fit: cover;\n }\n\n &__actions {\n g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,MAAAA,EAAA,GAAAS,EAE6CkD,GAAA;;IAAxC,MAAMzD,EAAAU,CAAA,CAAe,CAACS,EAAK,QAAQ;GAE5ClB,GAAAA,MAAAA,GAAAA,CAAAA,MAAAA,CAAAA,EAAAA,CAAAA,GAAAA,EAWO,QAXPwC,GAWO,CAVHxC,EAEO,QAFPyC,GAEOpC,EADAa,EAAK,QAAQnB,EAAAiD,CAAA,CAAE,CAAA,oBAAA,CAAA,GAAA,CAAA,GAEtBhD,EAMO,QANP0C,GAMOrC,EAAA,CAJEN,EAAA8E,CAAA,CAAU,CAAC3D,EAAK,SAAS,GAAGnB,EAAA+E,CAAA,CAAQ,CAAC5D,CAAI,CAAA,CAAA,CAA4C,OAAO,OAAO,CAAA,CAA2C,KAAI,KAAA,CAAA,GAAA,CAAA,CAAA,CAAA,CAAA,GAAA,GAAAmB,CAAA,GAOnKrC,EAaM,OAbN2C,GAaM,CAZFvC,EAIoCsD,GAAA;IAHhC,WAAU;IACV,MAAK;IACJ,OAAO3D,EAAAiD,CAAA,CAAE,CAAA,iBAAA;IACT,UAAK,MAAEjD,EAAA0E,CAAA,CAAQ,CAACvD,GAAI,EAAA;GACzBd,GAAAA,MAAAA,GAAAA,CAAAA,SAAAA,SAAAA,CAAAA,GAAAA,EAMmCsD,GAAA;IAL/B,WAAU;IACV,MAAK;IACJ,OAAO3D,EAAAgF,CAAA,CAAW,CAAC7D,CAAI;IACvB,SAASiC,EAAA,UAAejC,EAAK;IAC7B,UAAUiC,EAAA,UAAejC,EAAK;IAC9B,UAAK,MAAEmC,EAAcnC,CAAI"}
|
package/dist-vue/_chunks/{PkChatbotViewProfile-B57VRVaO.js → PkChatbotViewProfile-CyzRxE3D.js}
RENAMED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { n as e } from "./useChatbotStore-rtl-oKqU.js";
|
|
2
|
-
import { t } from "./PkAvatar-
|
|
2
|
+
import { t } from "./PkAvatar-BTqu8tn9.js";
|
|
3
3
|
import { t as n } from "./chatbotProfileContext-CgnFhNPn.js";
|
|
4
4
|
import { VvAlert as r, VvButton as i, VvIcon as a } from "@volverjs/ui-vue/components";
|
|
5
5
|
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";
|
|
@@ -83,4 +83,4 @@ var x = { class: "flex flex-col flex-1 min-h-0 overflow-y-auto" }, S = { class:
|
|
|
83
83
|
//#endregion
|
|
84
84
|
export { N as t };
|
|
85
85
|
|
|
86
|
-
//# sourceMappingURL=PkChatbotViewProfile-
|
|
86
|
+
//# sourceMappingURL=PkChatbotViewProfile-CyzRxE3D.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PkChatbotViewProfile-B57VRVaO.js","names":["__unplugin_components_0","__unplugin_components_1","__unplugin_components_2","_openBlock","_createElementBlock","_createElementVNode","_createVNode","PkAvatar","_unref","_toDisplayString","_createCommentVNode","_createBlock","_renderSlot","_sfc_main","useChatbotStore","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","VvButton","openBlock","createElementBlock","createElementVNode","createVNode","PkAvatar_default","unref","agentInterface","toDisplayString","createCommentVNode","createBlock","renderSlot","_ctx"],"sources":["../../../../packages/components/src/chat/PkChatbotViewProfile.vue","../../../../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 modifiers=\"surface ring\"\n class=\"w-64 h-64\"\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","<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 modifiers=\"surface ring\"\n class=\"w-64 h-64\"\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,IAAM8B,IAAQC,GAER,EAAE,GAAGC,MAAOC,EAAQ,EAAE,UAAU,SAAS,CAAC,GAE1CC,IAAQpB,EAAgBgB,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,QAAQ;IAC1B,SAASW,GAAO;KACZ,EAAa,QACTA,aAAiB,QAAQA,EAAM,UAAUhB,EAAG,eAAe;IACnE,UAAU;KACN,EAAa,QAAQ;IACzB;GARqB;EASzB;;;GAIA,OAAA7B,EAAA,GAAAC,EAsEM,OAtENY,GAsEM;IApEFX,EAmBM,OAnBNY,GAmBM,CAjBFX,EAIqDC,GAAA;KAHjD,WAAU;KACV,OAAM;KACL,MAAMgC,EAAA,OAAM,QAAQ/B,EAAA2B,CAAA;K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M;KACN,MAAK;KACJ,SAAST,EAAA;KACT,UAAUA,EAAA;KACV,OAAOpC,EAAAwB,CAAA,CAAE,CAAA,gBAAA;KACT,SAAOe;;;;;;IAGhBnC,EAAQsD,EAAA,QAAA,SAAA"}
|
|
1
|
+
{"version":3,"file":"PkChatbotViewProfile-CyzRxE3D.js","names":["__unplugin_components_0","__unplugin_components_1","__unplugin_components_2","_openBlock","_createElementBlock","_createElementVNode","_createVNode","PkAvatar","_unref","_toDisplayString","_createCommentVNode","_createBlock","_renderSlot","_sfc_main","useChatbotStore","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","VvButton","openBlock","createElementBlock","createElementVNode","createVNode","PkAvatar_default","unref","agentInterface","toDisplayString","createCommentVNode","createBlock","renderSlot","_ctx"],"sources":["../../../../packages/components/src/chat/PkChatbotViewProfile.vue","../../../../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 modifiers=\"surface ring\"\n class=\"w-64 h-64\"\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","<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 modifiers=\"surface ring\"\n class=\"w-64 h-64\"\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')\"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"./src-DCfvejyT.js";
|
|
4
4
|
import { i as r, n as i } from "./url-validation-9DstIfq2.js";
|
|
5
5
|
import { n as a } from "./useShortUrlResolver-DI8ycJiO.js";
|
|
6
|
-
import {
|
|
6
|
+
import { d as o } from "./utils-CwIMEuAv.js";
|
|
7
7
|
import { computed as s, createElementBlock as c, defineComponent as l, inject as u, nextTick as d, onBeforeUnmount as f, onMounted as p, openBlock as ee, provide as m, ref as h, toRef as te, useTemplateRef as ne, watch as g } from "vue";
|
|
8
8
|
import { useI18n as re } from "vue-i18n";
|
|
9
9
|
import { refThrottled as ie } from "@vueuse/core";
|
|
@@ -3401,4 +3401,4 @@ var ka = ["innerHTML"], Aa = 100, ja = /* @__PURE__ */ l({
|
|
|
3401
3401
|
//#endregion
|
|
3402
3402
|
export { wa as n, Oa as r, ja as t };
|
|
3403
3403
|
|
|
3404
|
-
//# sourceMappingURL=PkStreamingMarkdown-
|
|
3404
|
+
//# sourceMappingURL=PkStreamingMarkdown-C55Fi0Pd.js.map
|