@8wave/ai-elements 0.119.0-beta.48 → 0.119.0-beta.49
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-xnhBbPf5.js → PkStreamingMarkdown-pEgm7m-B.js} +4 -4
- package/dist/_chunks/PkStreamingMarkdown-pEgm7m-B.js.map +1 -0
- package/dist/_chunks/{PkToolShowArtifact-DPt1qDUk.js → PkToolShowArtifact-D6ZTw5vh.js} +2 -2
- package/dist/_chunks/{PkToolShowArtifact-DPt1qDUk.js.map → PkToolShowArtifact-D6ZTw5vh.js.map} +1 -1
- package/dist/_chunks/{PkToolShowContactForm-OdC7bsXd.js → PkToolShowContactForm-CW7gKQ7h.js} +2 -2
- package/dist/_chunks/{PkToolShowContactForm-OdC7bsXd.js.map → PkToolShowContactForm-CW7gKQ7h.js.map} +1 -1
- package/dist/_chunks/{PkToolShowForm-uFmaQoI1.js → PkToolShowForm-D_2FmDwq.js} +2 -2
- package/dist/_chunks/{PkToolShowForm-uFmaQoI1.js.map → PkToolShowForm-D_2FmDwq.js.map} +1 -1
- package/dist/_chunks/{PkToolShowSources-BlpCKc4N.js → PkToolShowSources-DyzheirE.js} +2 -2
- package/dist/_chunks/{PkToolShowSources-BlpCKc4N.js.map → PkToolShowSources-DyzheirE.js.map} +1 -1
- package/dist/ai-elements.es.js +1172 -1170
- 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/PkChatbotViewConversations.js +1 -1
- package/dist-vue/_chunks/{PkChatbot-DXwMfwN4.js → PkChatbot-viqlDa9r.js} +5 -5
- package/dist-vue/_chunks/{PkChatbot-DXwMfwN4.js.map → PkChatbot-viqlDa9r.js.map} +1 -1
- package/dist-vue/_chunks/{PkChatbotEmptyState-Dve5Ci2Y.js → PkChatbotEmptyState-B-2GZ2ZU.js} +2 -2
- package/dist-vue/_chunks/{PkChatbotEmptyState-Dve5Ci2Y.js.map → PkChatbotEmptyState-B-2GZ2ZU.js.map} +1 -1
- package/dist-vue/_chunks/{PkChatbotInput-DiCxEime.js → PkChatbotInput-D4bT_1be.js} +2 -2
- package/dist-vue/_chunks/{PkChatbotInput-DiCxEime.js.map → PkChatbotInput-D4bT_1be.js.map} +1 -1
- package/dist-vue/_chunks/{PkChatbotMessages-CTp0NkY2.js → PkChatbotMessages-BgcGen7D.js} +14 -14
- package/dist-vue/_chunks/{PkChatbotMessages-CTp0NkY2.js.map → PkChatbotMessages-BgcGen7D.js.map} +1 -1
- package/dist-vue/_chunks/{PkChatbotStepPayload-B1o2DbQz.js → PkChatbotStepPayload-CzCHmvUG.js} +2 -2
- package/dist-vue/_chunks/{PkChatbotStepPayload-B1o2DbQz.js.map → PkChatbotStepPayload-CzCHmvUG.js.map} +1 -1
- package/dist-vue/_chunks/{PkChatbotStepToolDetail-DpYV0KLn.js → PkChatbotStepToolDetail-qSHrVOGO.js} +3 -3
- package/dist-vue/_chunks/{PkChatbotStepToolDetail-DpYV0KLn.js.map → PkChatbotStepToolDetail-qSHrVOGO.js.map} +1 -1
- package/dist-vue/_chunks/{PkChatbotSteps-BPon4zjv.js → PkChatbotSteps-dgj6C2hA.js} +5 -5
- package/dist-vue/_chunks/{PkChatbotSteps-BPon4zjv.js.map → PkChatbotSteps-dgj6C2hA.js.map} +1 -1
- package/dist-vue/_chunks/{PkChatbotViewChat-dJE2iHPN.js → PkChatbotViewChat-BtbE6V2u.js} +173 -173
- package/dist-vue/_chunks/PkChatbotViewChat-BtbE6V2u.js.map +1 -0
- package/dist-vue/_chunks/{PkChatbotViewConversations-DcEcJgwV.js → PkChatbotViewConversations-Cw9fL47_.js} +2 -2
- package/dist-vue/_chunks/{PkChatbotViewConversations-DcEcJgwV.js.map → PkChatbotViewConversations-Cw9fL47_.js.map} +1 -1
- package/dist-vue/_chunks/{PkStreamingMarkdown-CqT_orLj.js → PkStreamingMarkdown-DXoUbGsP.js} +2 -2
- package/dist-vue/_chunks/{PkStreamingMarkdown-CqT_orLj.js.map → PkStreamingMarkdown-DXoUbGsP.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolShowArtifact-Qfkz64NY.js → PkToolShowArtifact-BRtz1x7K.js} +2 -2
- package/dist-vue/_chunks/{PkToolShowArtifact-Qfkz64NY.js.map → PkToolShowArtifact-BRtz1x7K.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolShowContactForm-CRLEkYSE.js → PkToolShowContactForm-D0CR80e2.js} +2 -2
- package/dist-vue/_chunks/{PkToolShowContactForm-CRLEkYSE.js.map → PkToolShowContactForm-D0CR80e2.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolShowDiagram-j4FJ34Ta.js → PkToolShowDiagram-CYpqqWLo.js} +2 -2
- package/dist-vue/_chunks/{PkToolShowDiagram-j4FJ34Ta.js.map → PkToolShowDiagram-CYpqqWLo.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolShowForm-DdFBwLMf.js → PkToolShowForm-BIsu4XhQ.js} +3 -3
- package/dist-vue/_chunks/{PkToolShowForm-DdFBwLMf.js.map → PkToolShowForm-BIsu4XhQ.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolShowImageGallery-CxlOwuTJ.js → PkToolShowImageGallery-DkEv-6Nu.js} +2 -2
- package/dist-vue/_chunks/{PkToolShowImageGallery-CxlOwuTJ.js.map → PkToolShowImageGallery-DkEv-6Nu.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolShowProductList-dfd3vmhl.js → PkToolShowProductList-Dr2mQqsb.js} +2 -2
- package/dist-vue/_chunks/{PkToolShowProductList-dfd3vmhl.js.map → PkToolShowProductList-Dr2mQqsb.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolShowSources-B8Euk3rp.js → PkToolShowSources-CxUDh6cC.js} +2 -2
- package/dist-vue/_chunks/{PkToolShowSources-B8Euk3rp.js.map → PkToolShowSources-CxUDh6cC.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolShowVideo-C84UrvZ7.js → PkToolShowVideo-Bh1oagOm.js} +2 -2
- package/dist-vue/_chunks/{PkToolShowVideo-C84UrvZ7.js.map → PkToolShowVideo-Bh1oagOm.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolShowWebPages-CzzuVQqL.js → PkToolShowWebPages-ilQ1qTEC.js} +2 -2
- package/dist-vue/_chunks/{PkToolShowWebPages-CzzuVQqL.js.map → PkToolShowWebPages-ilQ1qTEC.js.map} +1 -1
- package/dist-vue/_chunks/{utils-7oPvmwwu.js → utils-Bopp5IPf.js} +4 -4
- package/dist-vue/_chunks/utils-Bopp5IPf.js.map +1 -0
- package/dist-vue/composables.js +3 -1
- package/dist-vue/composables.js.map +1 -1
- package/dist-vue/index.js +20 -20
- package/dist-vue/index.js.map +1 -1
- package/dist-vue/locales.js +2 -0
- package/package.json +1 -1
- package/dist/_chunks/PkStreamingMarkdown-xnhBbPf5.js.map +0 -1
- package/dist-vue/_chunks/PkChatbotViewChat-dJE2iHPN.js.map +0 -1
- package/dist-vue/_chunks/utils-7oPvmwwu.js.map +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { C as e, Ct as t, Dt as n, L as r, O as i, St as a, X as o, b as s, g as c, h as l, it as u, m as d, mt as f, v as p, wt as m, x as h } from "./vue.runtime.esm-bundler-DKVd2gci.js";
|
|
2
|
-
import { t as g } from "./PkStreamingMarkdown-
|
|
2
|
+
import { t as g } from "./PkStreamingMarkdown-pEgm7m-B.js";
|
|
3
3
|
import { i as _ } from "./dist-DxtbpUdI.js";
|
|
4
4
|
import { t as v } from "./VvButtonLocalized-DV-zbH9b.js";
|
|
5
5
|
//#region ../../packages/components/src/chat/PkCode.vue?vue&type=script&setup=true&lang.ts
|
|
@@ -93,4 +93,4 @@ var x = { class: "border border-surface-3 rounded-xl w-full overflow-hidden" },
|
|
|
93
93
|
//#endregion
|
|
94
94
|
export { E as default };
|
|
95
95
|
|
|
96
|
-
//# sourceMappingURL=PkToolShowArtifact-
|
|
96
|
+
//# sourceMappingURL=PkToolShowArtifact-D6ZTw5vh.js.map
|
package/dist/_chunks/{PkToolShowArtifact-DPt1qDUk.js.map → PkToolShowArtifact-D6ZTw5vh.js.map}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PkToolShowArtifact-DPt1qDUk.js","names":["$attrs","_hoisted_1","_openBlock","_createElementBlock","_normalizeClass","_createTextVNode","_createElementVNode","_sfc_main","$t","__unplugin_components_0","_openBlock","_createElementBlock","_createElementVNode","_toDisplayString","_createVNode","_unref","_createBlock","PkCode","PkStreamingMarkdown","_normalizeClass","_sfc_main","defineComponent","init_shared_esm_bundler","toDisplayString","openBlock","init_runtime_core_esm_bundler","unref","watch","createTextVNode","createBlock","createBaseVNode","init_reactivity_esm_bundler","computed","ref","createElementBlock","normalizeClass","createVNode","PkStreamingMarkdown_default","useClipboard","VvButtonLocalized","_hoisted_1$1","PkCode_default","props","__props","highlightedHtml","hasCode","highlight","hljs","result","_ctx","_cache","_hoisted_1","_hoisted_2","_hoisted_3","_hoisted_4","_hoisted_5","PkToolShowArtifact_default","toolPart","artifactTypeLabel","languageLabel","isCodeType","isMarkdownType","codeLanguage","_component_VvButton","copied","copy"],"sources":["../../../../packages/components/src/chat/PkCode.vue","../../../../packages/components/src/chat/PkCode.vue","../../../../packages/components/src/chat/PkToolShowArtifact.vue","../../../../packages/components/src/chat/PkToolShowArtifact.vue"],"sourcesContent":["<script setup lang=\"ts\">\n import { computed, ref, watch } from 'vue'\n\n defineOptions({\n inheritAttrs: false,\n })\n\n const props = defineProps<{\n code: unknown\n language: string\n line?: boolean\n }>()\n\n const highlightedHtml = ref('')\n\n const hasCode = computed(() => {\n if (typeof props.code === 'string') {\n return props.code\n }\n return JSON.stringify(props.code, null, 2)\n })\n\n async function highlight() {\n const hljs = (await import('highlight.js/lib/common')).default\n try {\n const result = props.language\n ? hljs.highlight(hasCode.value, { language: props.language })\n : hljs.highlightAuto(hasCode.value)\n highlightedHtml.value = result.value\n } catch {\n highlightedHtml.value = hasCode.value\n .replace(/&/g, '&')\n .replace(/</g, '<')\n .replace(/>/g, '>')\n }\n }\n\n watch(hasCode, highlight, { immediate: true })\n</script>\n\n<template>\n <pre\n :class=\"\n $attrs.class\n ? $attrs.class\n : 'font-mono leading-snug text-smaller bg-surface-1'\n \">\n <code :class=\"['hljs', line ? 'whitespace-pre-line' : 'whitespace-pre', language]\" v-html=\"highlightedHtml\"></code>\n </pre>\n</template>\n","<script setup lang=\"ts\">\n import { computed, ref, watch } from 'vue'\n\n defineOptions({\n inheritAttrs: false,\n })\n\n const props = defineProps<{\n code: unknown\n language: string\n line?: boolean\n }>()\n\n const highlightedHtml = ref('')\n\n const hasCode = computed(() => {\n if (typeof props.code === 'string') {\n return props.code\n }\n return JSON.stringify(props.code, null, 2)\n })\n\n async function highlight() {\n const hljs = (await import('highlight.js/lib/common')).default\n try {\n const result = props.language\n ? hljs.highlight(hasCode.value, { language: props.language })\n : hljs.highlightAuto(hasCode.value)\n highlightedHtml.value = result.value\n } catch {\n highlightedHtml.value = hasCode.value\n .replace(/&/g, '&')\n .replace(/</g, '<')\n .replace(/>/g, '>')\n }\n }\n\n watch(hasCode, highlight, { immediate: true })\n</script>\n\n<template>\n <pre\n :class=\"\n $attrs.class\n ? $attrs.class\n : 'font-mono leading-snug text-smaller bg-surface-1'\n \">\n <code :class=\"['hljs', line ? 'whitespace-pre-line' : 'whitespace-pre', language]\" v-html=\"highlightedHtml\"></code>\n </pre>\n</template>\n","<script setup lang=\"ts\">\n import { computed } from 'vue'\n import { useClipboard } from '@vueuse/core'\n import PkCode from './PkCode.vue'\n import PkStreamingMarkdown from './PkStreamingMarkdown.vue'\n\n const { copy, copied } = useClipboard()\n\n const props = defineProps<{\n part: unknown\n }>()\n\n const toolPart = computed(() => {\n const part = props.part as {\n input?: {\n title: string\n content: string\n artifactType: string\n language?: string\n }\n }\n return part\n })\n\n const artifactTypeLabel = computed(() => {\n const labels: Record<string, string> = {\n code: 'Code',\n document: 'Document',\n markdown: 'Markdown',\n json: 'JSON',\n xml: 'XML',\n csv: 'CSV',\n html: 'HTML',\n yaml: 'YAML',\n sql: 'SQL',\n text: 'Text',\n }\n if (!toolPart.value.input?.artifactType) {\n return 'Artifact'\n }\n return labels[toolPart.value.input.artifactType] || 'Artifact'\n })\n\n const languageLabel = computed(() => {\n if (!toolPart.value.input?.language) {\n return ''\n }\n return ` (${toolPart.value.input.language})`\n })\n\n const isCodeType = computed(() => {\n return (\n toolPart.value.input?.artifactType === 'code' ||\n toolPart.value.input?.artifactType === 'json' ||\n toolPart.value.input?.artifactType === 'xml' ||\n toolPart.value.input?.artifactType === 'yaml' ||\n toolPart.value.input?.artifactType === 'html' ||\n toolPart.value.input?.artifactType === 'sql'\n )\n })\n\n const isMarkdownType = computed(() => {\n return toolPart.value.input?.artifactType === 'markdown'\n })\n\n const codeLanguage = computed(() => {\n if (toolPart.value.input?.language) {\n return toolPart.value.input.language\n }\n // Map artifact types to highlight.js languages\n const languageMap: Record<string, string> = {\n json: 'json',\n xml: 'xml',\n yaml: 'yaml',\n html: 'html',\n sql: 'sql',\n }\n if (!toolPart.value.input?.artifactType) {\n return 'plaintext'\n }\n return languageMap[toolPart.value.input.artifactType] || 'plaintext'\n })\n</script>\n\n<template>\n <div class=\"border border-surface-3 rounded-xl w-full overflow-hidden\">\n <div\n class=\"px-sm py-6 font-bold bg-surface-1 text-12 border-b border-surface-3 text-word-3 flex justify-between items-center\">\n <div class=\"flex flex-col items-start gap-4\">\n <span>{{ toolPart?.input?.title }}</span>\n <span class=\"text-10 opacity-60 font-normal\">\n {{ artifactTypeLabel }}{{ languageLabel }}\n </span>\n </div>\n <VvButton\n :icon=\"copied ? 'ri:check-line' : 'ri:file-copy-line'\"\n :label=\"copied ? $t('action.copied') : $t('action.copy')\"\n modifiers=\"action-quiet-small\"\n :title=\"$t('action.copy')\"\n class=\"shrink-0\"\n @click=\"copy(toolPart?.input?.content || '')\" />\n </div>\n <div class=\"px-sm py-10 bg-surface\">\n <PkCode\n v-if=\"isCodeType\"\n :code=\"toolPart?.input?.content\"\n :language=\"codeLanguage\" />\n <PkStreamingMarkdown\n v-else-if=\"isMarkdownType\"\n :markdown=\"toolPart?.input?.content\"\n class=\"wysiwyg text-word-2\" />\n <pre\n v-else\n class=\"text-word-2 whitespace-pre-wrap break-words\"\n :class=\"{\n italic:\n toolPart?.input?.artifactType === 'document' ||\n toolPart?.input?.artifactType === 'text',\n }\"\n >{{ toolPart?.input?.content }}</pre>\n </div>\n </div>\n</template>\n","<script setup lang=\"ts\">\n import { computed } from 'vue'\n import { useClipboard } from '@vueuse/core'\n import PkCode from './PkCode.vue'\n import PkStreamingMarkdown from './PkStreamingMarkdown.vue'\n\n const { copy, copied } = useClipboard()\n\n const props = defineProps<{\n part: unknown\n }>()\n\n const toolPart = computed(() => {\n const part = props.part as {\n input?: {\n title: string\n content: string\n artifactType: string\n language?: string\n }\n }\n return part\n })\n\n const artifactTypeLabel = computed(() => {\n const labels: Record<string, string> = {\n code: 'Code',\n document: 'Document',\n markdown: 'Markdown',\n json: 'JSON',\n xml: 'XML',\n csv: 'CSV',\n html: 'HTML',\n yaml: 'YAML',\n sql: 'SQL',\n text: 'Text',\n }\n if (!toolPart.value.input?.artifactType) {\n return 'Artifact'\n }\n return labels[toolPart.value.input.artifactType] || 'Artifact'\n })\n\n const languageLabel = computed(() => {\n if (!toolPart.value.input?.language) {\n return ''\n }\n return ` (${toolPart.value.input.language})`\n })\n\n const isCodeType = computed(() => {\n return (\n toolPart.value.input?.artifactType === 'code' ||\n toolPart.value.input?.artifactType === 'json' ||\n toolPart.value.input?.artifactType === 'xml' ||\n toolPart.value.input?.artifactType === 'yaml' ||\n toolPart.value.input?.artifactType === 'html' ||\n toolPart.value.input?.artifactType === 'sql'\n )\n })\n\n const isMarkdownType = computed(() => {\n return toolPart.value.input?.artifactType === 'markdown'\n })\n\n const codeLanguage = computed(() => {\n if (toolPart.value.input?.language) {\n return toolPart.value.input.language\n }\n // Map artifact types to highlight.js languages\n const languageMap: Record<string, string> = {\n json: 'json',\n xml: 'xml',\n yaml: 'yaml',\n html: 'html',\n sql: 'sql',\n }\n if (!toolPart.value.input?.artifactType) {\n return 'plaintext'\n }\n return languageMap[toolPart.value.input.artifactType] || 'plaintext'\n })\n</script>\n\n<template>\n <div class=\"border border-surface-3 rounded-xl w-full overflow-hidden\">\n <div\n class=\"px-sm py-6 font-bold bg-surface-1 text-12 border-b border-surface-3 text-word-3 flex justify-between items-center\">\n <div class=\"flex flex-col items-start gap-4\">\n <span>{{ toolPart?.input?.title }}</span>\n <span class=\"text-10 opacity-60 font-normal\">\n {{ artifactTypeLabel }}{{ languageLabel }}\n </span>\n </div>\n <VvButton\n :icon=\"copied ? 'ri:check-line' : 'ri:file-copy-line'\"\n :label=\"copied ? $t('action.copied') : $t('action.copy')\"\n modifiers=\"action-quiet-small\"\n :title=\"$t('action.copy')\"\n class=\"shrink-0\"\n @click=\"copy(toolPart?.input?.content || '')\" />\n </div>\n <div class=\"px-sm py-10 bg-surface\">\n <PkCode\n v-if=\"isCodeType\"\n :code=\"toolPart?.input?.content\"\n :language=\"codeLanguage\" />\n <PkStreamingMarkdown\n v-else-if=\"isMarkdownType\"\n :markdown=\"toolPart?.input?.content\"\n class=\"wysiwyg text-word-2\" />\n <pre\n v-else\n class=\"text-word-2 whitespace-pre-wrap break-words\"\n :class=\"{\n italic:\n toolPart?.input?.artifactType === 'document' ||\n toolPart?.input?.artifactType === 'text',\n }\"\n >{{ toolPart?.input?.content }}</pre>\n </div>\n </div>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;EAOI,IAAM0C,IAAQC,GA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+BC,GAAA;;IAD1B,MAAMwC,EAAA,OAAU,OAAO;IACvB,UAAUK,EAAA;GAEA,GAAA,MAAA,GAAA,CAAA,QAAA,UAAA,CAAA,KAAAD,EAAA,SADfnD,EAAA,GAAAM,EAGkCE,GAAA;;IAD7B,UAAUuC,EAAA,OAAU,OAAO;IAC5B,OAAM;GACV/C,GAAAA,MAAAA,GAAAA,CAAAA,UAAAA,CAAAA,MAAAA,EAAA,GAAAC,EAQyC,OAAA;;IANrC,OAAKQ,EAAA,CAAC,+CAA6C,EAAA,QACWsC,EAAA,OAAU,OAAO,iBAAY,cAA2CA,EAAA,OAAU,OAAO,iBAAY,OAAA,CAAA,CAAA;GAK/J,GAAA5C,EAAA4C,EAAA,OAAU,OAAO,OAAO,GAAA,CAAA,EAAA,CAAA,CAAA,CAAA"}
|
|
1
|
+
{"version":3,"file":"PkToolShowArtifact-D6ZTw5vh.js","names":["$attrs","_hoisted_1","_openBlock","_createElementBlock","_normalizeClass","_createTextVNode","_createElementVNode","_sfc_main","$t","__unplugin_components_0","_openBlock","_createElementBlock","_createElementVNode","_toDisplayString","_createVNode","_unref","_createBlock","PkCode","PkStreamingMarkdown","_normalizeClass","_sfc_main","defineComponent","init_shared_esm_bundler","toDisplayString","openBlock","init_runtime_core_esm_bundler","unref","watch","createTextVNode","createBlock","createBaseVNode","init_reactivity_esm_bundler","computed","ref","createElementBlock","normalizeClass","createVNode","PkStreamingMarkdown_default","useClipboard","VvButtonLocalized","_hoisted_1$1","PkCode_default","props","__props","highlightedHtml","hasCode","highlight","hljs","result","_ctx","_cache","_hoisted_1","_hoisted_2","_hoisted_3","_hoisted_4","_hoisted_5","PkToolShowArtifact_default","toolPart","artifactTypeLabel","languageLabel","isCodeType","isMarkdownType","codeLanguage","_component_VvButton","copied","copy"],"sources":["../../../../packages/components/src/chat/PkCode.vue","../../../../packages/components/src/chat/PkCode.vue","../../../../packages/components/src/chat/PkToolShowArtifact.vue","../../../../packages/components/src/chat/PkToolShowArtifact.vue"],"sourcesContent":["<script setup lang=\"ts\">\n import { computed, ref, watch } from 'vue'\n\n defineOptions({\n inheritAttrs: false,\n })\n\n const props = defineProps<{\n code: unknown\n language: string\n line?: boolean\n }>()\n\n const highlightedHtml = ref('')\n\n const hasCode = computed(() => {\n if (typeof props.code === 'string') {\n return props.code\n }\n return JSON.stringify(props.code, null, 2)\n })\n\n async function highlight() {\n const hljs = (await import('highlight.js/lib/common')).default\n try {\n const result = props.language\n ? hljs.highlight(hasCode.value, { language: props.language })\n : hljs.highlightAuto(hasCode.value)\n highlightedHtml.value = result.value\n } catch {\n highlightedHtml.value = hasCode.value\n .replace(/&/g, '&')\n .replace(/</g, '<')\n .replace(/>/g, '>')\n }\n }\n\n watch(hasCode, highlight, { immediate: true })\n</script>\n\n<template>\n <pre\n :class=\"\n $attrs.class\n ? $attrs.class\n : 'font-mono leading-snug text-smaller bg-surface-1'\n \">\n <code :class=\"['hljs', line ? 'whitespace-pre-line' : 'whitespace-pre', language]\" v-html=\"highlightedHtml\"></code>\n </pre>\n</template>\n","<script setup lang=\"ts\">\n import { computed, ref, watch } from 'vue'\n\n defineOptions({\n inheritAttrs: false,\n })\n\n const props = defineProps<{\n code: unknown\n language: string\n line?: boolean\n }>()\n\n const highlightedHtml = ref('')\n\n const hasCode = computed(() => {\n if (typeof props.code === 'string') {\n return props.code\n }\n return JSON.stringify(props.code, null, 2)\n })\n\n async function highlight() {\n const hljs = (await import('highlight.js/lib/common')).default\n try {\n const result = props.language\n ? hljs.highlight(hasCode.value, { language: props.language })\n : hljs.highlightAuto(hasCode.value)\n highlightedHtml.value = result.value\n } catch {\n highlightedHtml.value = hasCode.value\n .replace(/&/g, '&')\n .replace(/</g, '<')\n .replace(/>/g, '>')\n }\n }\n\n watch(hasCode, highlight, { immediate: true })\n</script>\n\n<template>\n <pre\n :class=\"\n $attrs.class\n ? $attrs.class\n : 'font-mono leading-snug text-smaller bg-surface-1'\n \">\n <code :class=\"['hljs', line ? 'whitespace-pre-line' : 'whitespace-pre', language]\" v-html=\"highlightedHtml\"></code>\n </pre>\n</template>\n","<script setup lang=\"ts\">\n import { computed } from 'vue'\n import { useClipboard } from '@vueuse/core'\n import PkCode from './PkCode.vue'\n import PkStreamingMarkdown from './PkStreamingMarkdown.vue'\n\n const { copy, copied } = useClipboard()\n\n const props = defineProps<{\n part: unknown\n }>()\n\n const toolPart = computed(() => {\n const part = props.part as {\n input?: {\n title: string\n content: string\n artifactType: string\n language?: string\n }\n }\n return part\n })\n\n const artifactTypeLabel = computed(() => {\n const labels: Record<string, string> = {\n code: 'Code',\n document: 'Document',\n markdown: 'Markdown',\n json: 'JSON',\n xml: 'XML',\n csv: 'CSV',\n html: 'HTML',\n yaml: 'YAML',\n sql: 'SQL',\n text: 'Text',\n }\n if (!toolPart.value.input?.artifactType) {\n return 'Artifact'\n }\n return labels[toolPart.value.input.artifactType] || 'Artifact'\n })\n\n const languageLabel = computed(() => {\n if (!toolPart.value.input?.language) {\n return ''\n }\n return ` (${toolPart.value.input.language})`\n })\n\n const isCodeType = computed(() => {\n return (\n toolPart.value.input?.artifactType === 'code' ||\n toolPart.value.input?.artifactType === 'json' ||\n toolPart.value.input?.artifactType === 'xml' ||\n toolPart.value.input?.artifactType === 'yaml' ||\n toolPart.value.input?.artifactType === 'html' ||\n toolPart.value.input?.artifactType === 'sql'\n )\n })\n\n const isMarkdownType = computed(() => {\n return toolPart.value.input?.artifactType === 'markdown'\n })\n\n const codeLanguage = computed(() => {\n if (toolPart.value.input?.language) {\n return toolPart.value.input.language\n }\n // Map artifact types to highlight.js languages\n const languageMap: Record<string, string> = {\n json: 'json',\n xml: 'xml',\n yaml: 'yaml',\n html: 'html',\n sql: 'sql',\n }\n if (!toolPart.value.input?.artifactType) {\n return 'plaintext'\n }\n return languageMap[toolPart.value.input.artifactType] || 'plaintext'\n })\n</script>\n\n<template>\n <div class=\"border border-surface-3 rounded-xl w-full overflow-hidden\">\n <div\n class=\"px-sm py-6 font-bold bg-surface-1 text-12 border-b border-surface-3 text-word-3 flex justify-between items-center\">\n <div class=\"flex flex-col items-start gap-4\">\n <span>{{ toolPart?.input?.title }}</span>\n <span class=\"text-10 opacity-60 font-normal\">\n {{ artifactTypeLabel }}{{ languageLabel }}\n </span>\n </div>\n <VvButton\n :icon=\"copied ? 'ri:check-line' : 'ri:file-copy-line'\"\n :label=\"copied ? $t('action.copied') : $t('action.copy')\"\n modifiers=\"action-quiet-small\"\n :title=\"$t('action.copy')\"\n class=\"shrink-0\"\n @click=\"copy(toolPart?.input?.content || '')\" />\n </div>\n <div class=\"px-sm py-10 bg-surface\">\n <PkCode\n v-if=\"isCodeType\"\n :code=\"toolPart?.input?.content\"\n :language=\"codeLanguage\" />\n <PkStreamingMarkdown\n v-else-if=\"isMarkdownType\"\n :markdown=\"toolPart?.input?.content\"\n class=\"wysiwyg text-word-2\" />\n <pre\n v-else\n class=\"text-word-2 whitespace-pre-wrap break-words\"\n :class=\"{\n italic:\n toolPart?.input?.artifactType === 'document' ||\n toolPart?.input?.artifactType === 'text',\n }\"\n >{{ toolPart?.input?.content }}</pre>\n </div>\n </div>\n</template>\n","<script setup lang=\"ts\">\n import { computed } from 'vue'\n import { useClipboard } from '@vueuse/core'\n import PkCode from './PkCode.vue'\n import PkStreamingMarkdown from './PkStreamingMarkdown.vue'\n\n const { copy, copied } = useClipboard()\n\n const props = defineProps<{\n part: unknown\n }>()\n\n const toolPart = computed(() => {\n const part = props.part as {\n input?: {\n title: string\n content: string\n artifactType: string\n language?: string\n }\n }\n return part\n })\n\n const artifactTypeLabel = computed(() => {\n const labels: Record<string, string> = {\n code: 'Code',\n document: 'Document',\n markdown: 'Markdown',\n json: 'JSON',\n xml: 'XML',\n csv: 'CSV',\n html: 'HTML',\n yaml: 'YAML',\n sql: 'SQL',\n text: 'Text',\n }\n if (!toolPart.value.input?.artifactType) {\n return 'Artifact'\n }\n return labels[toolPart.value.input.artifactType] || 'Artifact'\n })\n\n const languageLabel = computed(() => {\n if (!toolPart.value.input?.language) {\n return ''\n }\n return ` (${toolPart.value.input.language})`\n })\n\n const isCodeType = computed(() => {\n return (\n toolPart.value.input?.artifactType === 'code' ||\n toolPart.value.input?.artifactType === 'json' ||\n toolPart.value.input?.artifactType === 'xml' ||\n toolPart.value.input?.artifactType === 'yaml' ||\n toolPart.value.input?.artifactType === 'html' ||\n toolPart.value.input?.artifactType === 'sql'\n )\n })\n\n const isMarkdownType = computed(() => {\n return toolPart.value.input?.artifactType === 'markdown'\n })\n\n const codeLanguage = computed(() => {\n if (toolPart.value.input?.language) {\n return toolPart.value.input.language\n }\n // Map artifact types to highlight.js languages\n const languageMap: Record<string, string> = {\n json: 'json',\n xml: 'xml',\n yaml: 'yaml',\n html: 'html',\n sql: 'sql',\n }\n if (!toolPart.value.input?.artifactType) {\n return 'plaintext'\n }\n return languageMap[toolPart.value.input.artifactType] || 'plaintext'\n })\n</script>\n\n<template>\n <div class=\"border border-surface-3 rounded-xl w-full overflow-hidden\">\n <div\n class=\"px-sm py-6 font-bold bg-surface-1 text-12 border-b border-surface-3 text-word-3 flex justify-between items-center\">\n <div class=\"flex flex-col items-start gap-4\">\n <span>{{ toolPart?.input?.title }}</span>\n <span class=\"text-10 opacity-60 font-normal\">\n {{ artifactTypeLabel }}{{ languageLabel }}\n </span>\n </div>\n <VvButton\n :icon=\"copied ? 'ri:check-line' : 'ri:file-copy-line'\"\n :label=\"copied ? $t('action.copied') : $t('action.copy')\"\n modifiers=\"action-quiet-small\"\n :title=\"$t('action.copy')\"\n class=\"shrink-0\"\n @click=\"copy(toolPart?.input?.content || '')\" />\n </div>\n <div class=\"px-sm py-10 bg-surface\">\n <PkCode\n v-if=\"isCodeType\"\n :code=\"toolPart?.input?.content\"\n :language=\"codeLanguage\" />\n <PkStreamingMarkdown\n v-else-if=\"isMarkdownType\"\n :markdown=\"toolPart?.input?.content\"\n class=\"wysiwyg text-word-2\" />\n <pre\n v-else\n class=\"text-word-2 whitespace-pre-wrap break-words\"\n :class=\"{\n italic:\n toolPart?.input?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CAACR,EAAA,OAAU,OAAO,WAAO,EAAA;;;;;GAE7C7C,CAAAA,CAAAA,CAAAA,GAAAA,EAkBM,OAlBN2C,GAkBM,CAhBQK,EAAA,SADVlD,EAAA,GAAAM,EAG+BC,GAAA;;IAD1B,MAAMwC,EAAA,OAAU,OAAO;IACvB,UAAUK,EAAA;GAEA,GAAA,MAAA,GAAA,CAAA,QAAA,UAAA,CAAA,KAAAD,EAAA,SADfnD,EAAA,GAAAM,EAGkCE,GAAA;;IAD7B,UAAUuC,EAAA,OAAU,OAAO;IAC5B,OAAM;GACV/C,GAAAA,MAAAA,GAAAA,CAAAA,UAAAA,CAAAA,MAAAA,EAAA,GAAAC,EAQyC,OAAA;;IANrC,OAAKQ,EAAA,CAAC,+CAA6C,EAAA,QACWsC,EAAA,OAAU,OAAO,iBAAY,cAA2CA,EAAA,OAAU,OAAO,iBAAY,OAAA,CAAA,CAAA;GAK/J,GAAA5C,EAAA4C,EAAA,OAAU,OAAO,OAAO,GAAA,CAAA,EAAA,CAAA,CAAA,CAAA"}
|
package/dist/_chunks/{PkToolShowContactForm-OdC7bsXd.js → PkToolShowContactForm-CW7gKQ7h.js}
RENAMED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { _ as e, b as t, d as n } from "./zod-Dd1GFq_6.js";
|
|
2
2
|
import { $ as r, C as i, Ct as a, Dt as o, L as s, O as c, St as l, X as u, _ as d, b as f, ct as p, d as m, g as h, h as g, it as _, m as v, r as y, t as b, v as x, x as S, z as ee } from "./vue.runtime.esm-bundler-DKVd2gci.js";
|
|
3
3
|
import { r as C } from "./vue-i18n-CooVjJjT.js";
|
|
4
|
-
import { t as w } from "./PkStreamingMarkdown-
|
|
4
|
+
import { t as w } from "./PkStreamingMarkdown-pEgm7m-B.js";
|
|
5
5
|
import { t as T } from "./src-CggZ5M7x.js";
|
|
6
6
|
import { m as E, t as D } from "./index.es-dTcgyeM4.js";
|
|
7
7
|
import { t as O } from "./VvButtonLocalized-DV-zbH9b.js";
|
|
@@ -155,4 +155,4 @@ var M = { class: "border border-surface-3 rounded-xl w-full overflow-hidden bg-s
|
|
|
155
155
|
//#endregion
|
|
156
156
|
export { K as default };
|
|
157
157
|
|
|
158
|
-
//# sourceMappingURL=PkToolShowContactForm-
|
|
158
|
+
//# sourceMappingURL=PkToolShowContactForm-CW7gKQ7h.js.map
|
package/dist/_chunks/{PkToolShowContactForm-OdC7bsXd.js.map → PkToolShowContactForm-CW7gKQ7h.js.map}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PkToolShowContactForm-OdC7bsXd.js","names":["z.object","z.string","z.email","useForm","__unplugin_components_0","__unplugin_components_1","__unplugin_components_2","_openBlock","_createElementBlock","_createElementVNode","_createVNode","_toDisplayString","_unref","_Transition","_withCtx","_Fragment","_renderList","_createCommentVNode","_isRef","_createBlock","_createTextVNode","PkStreamingMarkdown","_sfc_main","object","string","email","withCtx","defineComponent","init_shared_esm_bundler","toDisplayString","openBlock","init_runtime_core_esm_bundler","unref","watch","createCommentVNode","createTextVNode","isRef","Fragment","createBlock","createBaseVNode","init_reactivity_esm_bundler","computed","init_runtime_dom_esm_bundler","Transition","createElementBlock","createVNode","renderList","useI18n","PkStreamingMarkdown_default","formatPhoneNumber","xr","Ae","VvButtonLocalized","useLocalizedString","useSafeLocalStorage","Se","_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","PkToolShowContactForm_default","__emit","$t","props","__props","toolPart","input","prefilled","value","field","localSubmitted","LeadFormSchema","emit","newInput","submitted","isSubmitted","submitLead","data","privacyNotice","_component_VvIcon","_component_VvAlert","_component_VvButton","VvForm","formData","_cache","$event","VvFormField"],"sources":["../../../../packages/components/src/chat/PkToolShowContactForm.vue","../../../../packages/components/src/chat/PkToolShowContactForm.vue"],"sourcesContent":["<script setup lang=\"ts\">\n import { computed, watch } from 'vue'\n import { useI18n } from 'vue-i18n'\n import { useForm } from '@volverjs/form-vue'\n import * as z from 'zod'\n import { useSafeLocalStorage, useLocalizedString } from 'composables'\n import type { LocalizedString } from 'models'\n import { formatPhoneNumber } from 'utils'\n import PkStreamingMarkdown from './PkStreamingMarkdown.vue'\n\n const { t: $t } = useI18n({ useScope: 'global' })\n\n const props = defineProps<{\n part: unknown\n submitted?: boolean\n loading?: boolean\n error?: string\n readonly?: boolean\n privacyPolicyNotice?: LocalizedString\n /**\n * A conversation read back (the chat logs): the card is the record\n * of the form the agent showed, its prefilled values as text. Nothing\n * in the part says whether the visitor sent it, only the contacts do.\n */\n record?: boolean\n }>()\n\n const toolPart = computed(() => {\n const part = props.part as {\n type: string\n toolCallId: string\n input?: {\n name: string\n email: string\n phone?: string\n conversationContext?: Record<string, unknown>\n }\n }\n return part\n })\n\n const input = computed(() => toolPart.value.input)\n\n const prefilled = computed(() =>\n (\n [\n { name: 'name', label: $t('label.name') },\n { name: 'email', label: $t('label.email') },\n { name: 'phone', label: $t('label.phone') },\n ] as const\n )\n .map((field) => {\n const value = input.value?.[field.name]?.trim()\n return {\n ...field,\n // Written as the contacts page writes it\n value:\n field.name === 'phone' && value\n ? formatPhoneNumber(value) || value\n : value,\n }\n })\n .filter((field) => field.value),\n )\n\n const localSubmitted = useSafeLocalStorage<boolean>(\n computed(\n () =>\n `${toolPart.value.toolCallId}-${toolPart.value.type}-submitted`,\n ),\n false,\n )\n\n const LeadFormSchema = z.object({\n name: z.string().min(1).max(255).default(''),\n email: z.email().max(255).default(''),\n phone: z\n .string()\n .max(50)\n .regex(/^[+0-9\\s\\-.()]*$/, $t('validation.invalidPhoneNumber'))\n .optional(),\n })\n\n const emit = defineEmits<{\n submit: [data: Record<string, unknown>]\n }>()\n\n const { VvForm, VvFormField, formData } = useForm(LeadFormSchema, {\n lazyLoad: true,\n })\n\n // Pre-populate form with input values\n watch(\n input,\n (newInput) => {\n formData.value = {\n name: newInput?.name || '',\n email: newInput?.email || '',\n phone: newInput?.phone || '',\n }\n },\n { immediate: true },\n )\n\n watch(\n () => props.submitted,\n (submitted) => {\n if (submitted) {\n localSubmitted.value = true\n }\n },\n { immediate: true },\n )\n\n const isSubmitted = computed(() => {\n return props.submitted || localSubmitted.value\n })\n\n const submitLead = async (data: Record<string, unknown>): Promise<void> => {\n emit('submit', { ...data, metadata: input.value?.conversationContext })\n }\n\n const privacyNotice = useLocalizedString(\n () => props.privacyPolicyNotice,\n 'message.defaultPrivacyPolicyNotice',\n )\n</script>\n\n<template>\n <div\n class=\"border border-surface-3 rounded-xl w-full overflow-hidden bg-surface\">\n <div\n class=\"px-sm py-6 bg-surface-1 min-h-40 text-12 border-b border-surface-3 text-word-3 flex items-center gap-8 min-h-40\">\n <VvIcon name=\"ri:send-plane-2-line\" class=\"text-16\" />\n <strong class=\"font-bold\">{{ $t('label.contactUs') }}</strong>\n </div>\n\n <Transition mode=\"out-in\">\n <div v-if=\"record\" class=\"p-sm flex flex-col gap-sm text-14\">\n <p class=\"text-word-2\">\n {{\n prefilled.length\n ? $t('message.contactFormRecordPrefilled')\n : $t('message.contactFormRecord')\n }}\n </p>\n <dl\n v-if=\"prefilled.length\"\n class=\"flex flex-wrap gap-x-lg gap-y-sm\">\n <div\n v-for=\"field in prefilled\"\n :key=\"field.name\"\n class=\"flex flex-col gap-4 min-w-0\">\n <dt class=\"text-12 text-word-3\">{{ field.label }}</dt>\n <dd class=\"text-word-1 break-words\">\n {{ field.value }}\n </dd>\n </div>\n </dl>\n </div>\n <div v-else-if=\"!isSubmitted\" class=\"p-sm\">\n <VvForm v-model=\"formData\" :readonly @submit=\"submitLead\">\n <VvFormField\n name=\"name\"\n type=\"text\"\n :label=\"$t('label.name')\"\n :placeholder=\"$t('placeholder.name')\"\n icon=\"ri:user-line\"\n modifiers=\"compact\"\n class=\"mb-md\" />\n <VvFormField\n name=\"email\"\n type=\"email\"\n :label=\"$t('label.email')\"\n :placeholder=\"$t('placeholder.email')\"\n icon=\"ri:mail-line\"\n modifiers=\"compact\"\n class=\"mb-md\" />\n <VvFormField\n name=\"phone\"\n type=\"tel\"\n :label=\"$t('label.phone')\"\n :placeholder=\"$t('placeholder.phone')\"\n icon=\"ri:phone-line\"\n class=\"mb-md\"\n modifiers=\"compact\" />\n\n <!-- A send that failed says so: the reason reached the\n card and was never drawn -->\n <VvAlert v-if=\"error\" modifiers=\"danger\" class=\"mb-md\">\n {{ error }}\n </VvAlert>\n\n <div class=\"flex justify-between items-center gap-16 mt-xs\">\n <div\n class=\"text-smaller text-word-3 flex items-center gap-8\">\n <VvIcon\n name=\"ri:shield-check-line\"\n class=\"text-16 shrink-0\" />\n <PkStreamingMarkdown\n :markdown=\"privacyNotice\"\n class=\"wysiwyg\" />\n </div>\n <!-- The library's default button is the brand, and in\n the chat the brand is the agent's color, as on the\n rest of the card: `primary` drew it neutral dark -->\n <VvButton\n type=\"submit\"\n :loading\n :disabled=\"loading || readonly\"\n icon-position=\"right\"\n class=\"shrink-0\"\n :label=\"$t('action.submit')\" />\n </div>\n </VvForm>\n </div>\n <div v-else class=\"p-sm\">\n <!-- One confirmation row across every tool card: a green\n check, the title in weight, the body quiet. The check is\n the outcome, so it alone carries the colour (DESIGN.md). -->\n <div class=\"flex items-center gap-sm\">\n <VvIcon name=\"ri:check-line\" class=\"text-16 text-success\" />\n <div>\n <strong class=\"font-medium block text-word-1\">\n {{ $t('message.leadSubmittedTitle') }}\n </strong>\n <p class=\"text-word-3\">\n {{ $t('message.leadSubmittedMessage') }}\n </p>\n </div>\n </div>\n </div>\n </Transition>\n </div>\n</template>\n","<script setup lang=\"ts\">\n import { computed, watch } from 'vue'\n import { useI18n } from 'vue-i18n'\n import { useForm } from '@volverjs/form-vue'\n import * as z from 'zod'\n import { useSafeLocalStorage, useLocalizedString } from 'composables'\n import type { LocalizedString } from 'models'\n import { formatPhoneNumber } from 'utils'\n import PkStreamingMarkdown from './PkStreamingMarkdown.vue'\n\n const { t: $t } = useI18n({ useScope: 'global' })\n\n const props = defineProps<{\n part: unknown\n submitted?: boolean\n loading?: boolean\n error?: string\n readonly?: boolean\n privacyPolicyNotice?: LocalizedString\n /**\n * A conversation read back (the chat logs): the card is the record\n * of the form the agent showed, its prefilled values as text. Nothing\n * in the part says whether the visitor sent it, only the contacts do.\n */\n record?: boolean\n }>()\n\n const toolPart = computed(() => {\n const part = props.part as {\n type: string\n toolCallId: string\n input?: {\n name: string\n email: string\n phone?: string\n conversationContext?: Record<string, unknown>\n }\n }\n return part\n })\n\n const input = computed(() => toolPart.value.input)\n\n const prefilled = computed(() =>\n (\n [\n { name: 'name', label: $t('label.name') },\n { name: 'email', label: $t('label.email') },\n { name: 'phone', label: $t('label.phone') },\n ] as const\n )\n .map((field) => {\n const value = input.value?.[field.name]?.trim()\n return {\n ...field,\n // Written as the contacts page writes it\n value:\n field.name === 'phone' && value\n ? formatPhoneNumber(value) || value\n : value,\n }\n })\n .filter((field) => field.value),\n )\n\n const localSubmitted = useSafeLocalStorage<boolean>(\n computed(\n () =>\n `${toolPart.value.toolCallId}-${toolPart.value.type}-submitted`,\n ),\n false,\n )\n\n const LeadFormSchema = z.object({\n name: z.string().min(1).max(255).default(''),\n email: z.email().max(255).default(''),\n phone: z\n .string()\n .max(50)\n .regex(/^[+0-9\\s\\-.()]*$/, $t('validation.invalidPhoneNumber'))\n .optional(),\n })\n\n const emit = defineEmits<{\n submit: [data: Record<string, unknown>]\n }>()\n\n const { VvForm, VvFormField, formData } = useForm(LeadFormSchema, {\n lazyLoad: true,\n })\n\n // Pre-populate form with input values\n watch(\n input,\n (newInput) => {\n formData.value = {\n name: newInput?.name || '',\n email: newInput?.email || '',\n phone: newInput?.phone || '',\n }\n },\n { immediate: true },\n )\n\n watch(\n () => props.submitted,\n (submitted) => {\n if (submitted) {\n localSubmitted.value = true\n }\n },\n { immediate: true },\n )\n\n const isSubmitted = computed(() => {\n return props.submitted || localSubmitted.value\n })\n\n const submitLead = async (data: Record<string, unknown>): Promise<void> => {\n emit('submit', { ...data, metadata: input.value?.conversationContext })\n }\n\n const privacyNotice = useLocalizedString(\n () => props.privacyPolicyNotice,\n 'message.defaultPrivacyPolicyNotice',\n )\n</script>\n\n<template>\n <div\n class=\"border border-surface-3 rounded-xl w-full overflow-hidden bg-surface\">\n <div\n class=\"px-sm py-6 bg-surface-1 min-h-40 text-12 border-b border-surface-3 text-word-3 flex items-center gap-8 min-h-40\">\n <VvIcon name=\"ri:send-plane-2-line\" class=\"text-16\" />\n <strong class=\"font-bold\">{{ $t('label.contactUs') }}</strong>\n </div>\n\n <Transition mode=\"out-in\">\n <div v-if=\"record\" class=\"p-sm flex flex-col gap-sm text-14\">\n <p class=\"text-word-2\">\n {{\n prefilled.length\n ? $t('message.contactFormRecordPrefilled')\n : $t('message.contactFormRecord')\n }}\n </p>\n <dl\n v-if=\"prefilled.length\"\n class=\"flex flex-wrap gap-x-lg gap-y-sm\">\n <div\n v-for=\"field in prefilled\"\n :key=\"field.name\"\n class=\"flex flex-col gap-4 min-w-0\">\n <dt class=\"text-12 text-word-3\">{{ field.label }}</dt>\n <dd class=\"text-word-1 break-words\">\n {{ field.value }}\n </dd>\n </div>\n </dl>\n </div>\n <div v-else-if=\"!isSubmitted\" class=\"p-sm\">\n <VvForm v-model=\"formData\" :readonly @submit=\"submitLead\">\n <VvFormField\n name=\"name\"\n type=\"text\"\n :label=\"$t('label.name')\"\n :placeholder=\"$t('placeholder.name')\"\n icon=\"ri:user-line\"\n modifiers=\"compact\"\n class=\"mb-md\" />\n <VvFormField\n name=\"email\"\n type=\"email\"\n :label=\"$t('label.email')\"\n :placeholder=\"$t('placeholder.email')\"\n icon=\"ri:mail-line\"\n modifiers=\"compact\"\n class=\"mb-md\" />\n <VvFormField\n name=\"phone\"\n type=\"tel\"\n :label=\"$t('label.phone')\"\n :placeholder=\"$t('placeholder.phone')\"\n icon=\"ri:phone-line\"\n class=\"mb-md\"\n modifiers=\"compact\" />\n\n <!-- A send that failed says so: the reason reached the\n card and was never drawn -->\n <VvAlert v-if=\"error\" modifiers=\"danger\" class=\"mb-md\">\n {{ error }}\n </VvAlert>\n\n <div class=\"flex justify-between items-center gap-16 mt-xs\">\n <div\n class=\"text-smaller text-word-3 flex items-center gap-8\">\n <VvIcon\n name=\"ri:shield-check-line\"\n class=\"text-16 shrink-0\" />\n <PkStreamingMarkdown\n :markdown=\"privacyNotice\"\n class=\"wysiwyg\" />\n </div>\n <!-- The library's default button is the brand, and in\n the chat the brand is the agent's color, as on the\n rest of the card: `primary` drew it neutral dark -->\n <VvButton\n type=\"submit\"\n :loading\n :disabled=\"loading || readonly\"\n icon-position=\"right\"\n class=\"shrink-0\"\n :label=\"$t('action.submit')\" />\n </div>\n </VvForm>\n </div>\n <div v-else class=\"p-sm\">\n <!-- One confirmation row across every tool card: a green\n check, the title in weight, the body quiet. The check is\n the outcome, so it alone carries the colour (DESIGN.md). -->\n <div class=\"flex items-center gap-sm\">\n <VvIcon name=\"ri:check-line\" class=\"text-16 text-success\" />\n <div>\n <strong class=\"font-medium block text-word-1\">\n {{ $t('message.leadSubmittedTitle') }}\n </strong>\n <p class=\"text-word-3\">\n {{ $t('message.leadSubmittedMessage') }}\n </p>\n </div>\n </div>\n </div>\n </Transition>\n </div>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAUI,IAAM,EAAE,GAAGyE,MAAO1B,EAAQ,EAAE,UAAU,SAAS,CAAC,GAE1C2B,IAAQC,GAeRC,IAAWnC,QACAiC,EAAM,IAWtB,GAEKG,IAAQpC,QAAemC,EAAS,MAAM,KAAK,GAE3CE,IAAYrC,QAEV;GACI;IAAE,MAAM;IAAQ,OAAOgC,EAAG,YAAY;GAAE;GACxC;IAAE,MAAM;IAAS,OAAOA,EAAG,aAAa;GAAE;GAC1C;IAAE,MAAM;IAAS,OAAOA,EAAG,aAAa;GAAE;EAC9C,CAAC,CAEA,KAAK,MAAU;GACZ,IAAMM,IAAQF,EAAM,QAAQG,EAAM,K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AAA,CAAAA,GAAAA,EAMmCkF,GAAA;OAL/B,MAAK;OACJ,SAAAjB,EAAA;OACA,UAAUA,EAAA,WAAWA,EAAA;OACtB,iBAAc;OACd,OAAM;OACL,OAAO/D,EAAA6D,CAAA,CAAE,CAAA,eAAA;;;;;;;;IAI1BlE,GAAAA,GAAAA,CAAAA,cAAAA,UAAAA,CAAAA,CAAAA,CAAAA,EAWqB,CAAA"}
|
|
1
|
+
{"version":3,"file":"PkToolShowContactForm-CW7gKQ7h.js","names":["z.object","z.string","z.email","useForm","__unplugin_components_0","__unplugin_components_1","__unplugin_components_2","_openBlock","_createElementBlock","_createElementVNode","_createVNode","_toDisplayString","_unref","_Transition","_withCtx","_Fragment","_renderList","_createCommentVNode","_isRef","_createBlock","_createTextVNode","PkStreamingMarkdown","_sfc_main","object","string","email","withCtx","defineComponent","init_shared_esm_bundler","toDisplayString","openBlock","init_runtime_core_esm_bundler","unref","watch","createCommentVNode","createTextVNode","isRef","Fragment","createBlock","createBaseVNode","init_reactivity_esm_bundler","computed","init_runtime_dom_esm_bundler","Transition","createElementBlock","createVNode","renderList","useI18n","PkStreamingMarkdown_default","formatPhoneNumber","xr","Ae","VvButtonLocalized","useLocalizedString","useSafeLocalStorage","Se","_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","PkToolShowContactForm_default","__emit","$t","props","__props","toolPart","input","prefilled","value","field","localSubmitted","LeadFormSchema","emit","newInput","submitted","isSubmitted","submitLead","data","privacyNotice","_component_VvIcon","_component_VvAlert","_component_VvButton","VvForm","formData","_cache","$event","VvFormField"],"sources":["../../../../packages/components/src/chat/PkToolShowContactForm.vue","../../../../packages/components/src/chat/PkToolShowContactForm.vue"],"sourcesContent":["<script setup lang=\"ts\">\n import { computed, watch } from 'vue'\n import { useI18n } from 'vue-i18n'\n import { useForm } from '@volverjs/form-vue'\n import * as z from 'zod'\n import { useSafeLocalStorage, useLocalizedString } from 'composables'\n import type { LocalizedString } from 'models'\n import { formatPhoneNumber } from 'utils'\n import PkStreamingMarkdown from './PkStreamingMarkdown.vue'\n\n const { t: $t } = useI18n({ useScope: 'global' })\n\n const props = defineProps<{\n part: unknown\n submitted?: boolean\n loading?: boolean\n error?: string\n readonly?: boolean\n privacyPolicyNotice?: LocalizedString\n /**\n * A conversation read back (the chat logs): the card is the record\n * of the form the agent showed, its prefilled values as text. Nothing\n * in the part says whether the visitor sent it, only the contacts do.\n */\n record?: boolean\n }>()\n\n const toolPart = computed(() => {\n const part = props.part as {\n type: string\n toolCallId: string\n input?: {\n name: string\n email: string\n phone?: string\n conversationContext?: Record<string, unknown>\n }\n }\n return part\n })\n\n const input = computed(() => toolPart.value.input)\n\n const prefilled = computed(() =>\n (\n [\n { name: 'name', label: $t('label.name') },\n { name: 'email', label: $t('label.email') },\n { name: 'phone', label: $t('label.phone') },\n ] as const\n )\n .map((field) => {\n const value = input.value?.[field.name]?.trim()\n return {\n ...field,\n // Written as the contacts page writes it\n value:\n field.name === 'phone' && value\n ? formatPhoneNumber(value) || value\n : value,\n }\n })\n .filter((field) => field.value),\n )\n\n const localSubmitted = useSafeLocalStorage<boolean>(\n computed(\n () =>\n `${toolPart.value.toolCallId}-${toolPart.value.type}-submitted`,\n ),\n false,\n )\n\n const LeadFormSchema = z.object({\n name: z.string().min(1).max(255).default(''),\n email: z.email().max(255).default(''),\n phone: z\n .string()\n .max(50)\n .regex(/^[+0-9\\s\\-.()]*$/, $t('validation.invalidPhoneNumber'))\n .optional(),\n })\n\n const emit = defineEmits<{\n submit: [data: Record<string, unknown>]\n }>()\n\n const { VvForm, VvFormField, formData } = useForm(LeadFormSchema, {\n lazyLoad: true,\n })\n\n // Pre-populate form with input values\n watch(\n input,\n (newInput) => {\n formData.value = {\n name: newInput?.name || '',\n email: newInput?.email || '',\n phone: newInput?.phone || '',\n }\n },\n { immediate: true },\n )\n\n watch(\n () => props.submitted,\n (submitted) => {\n if (submitted) {\n localSubmitted.value = true\n }\n },\n { immediate: true },\n )\n\n const isSubmitted = computed(() => {\n return props.submitted || localSubmitted.value\n })\n\n const submitLead = async (data: Record<string, unknown>): Promise<void> => {\n emit('submit', { ...data, metadata: input.value?.conversationContext })\n }\n\n const privacyNotice = useLocalizedString(\n () => props.privacyPolicyNotice,\n 'message.defaultPrivacyPolicyNotice',\n )\n</script>\n\n<template>\n <div\n class=\"border border-surface-3 rounded-xl w-full overflow-hidden bg-surface\">\n <div\n class=\"px-sm py-6 bg-surface-1 min-h-40 text-12 border-b border-surface-3 text-word-3 flex items-center gap-8 min-h-40\">\n <VvIcon name=\"ri:send-plane-2-line\" class=\"text-16\" />\n <strong class=\"font-bold\">{{ $t('label.contactUs') }}</strong>\n </div>\n\n <Transition mode=\"out-in\">\n <div v-if=\"record\" class=\"p-sm flex flex-col gap-sm text-14\">\n <p class=\"text-word-2\">\n {{\n prefilled.length\n ? $t('message.contactFormRecordPrefilled')\n : $t('message.contactFormRecord')\n }}\n </p>\n <dl\n v-if=\"prefilled.length\"\n class=\"flex flex-wrap gap-x-lg gap-y-sm\">\n <div\n v-for=\"field in prefilled\"\n :key=\"field.name\"\n class=\"flex flex-col gap-4 min-w-0\">\n <dt class=\"text-12 text-word-3\">{{ field.label }}</dt>\n <dd class=\"text-word-1 break-words\">\n {{ field.value }}\n </dd>\n </div>\n </dl>\n </div>\n <div v-else-if=\"!isSubmitted\" class=\"p-sm\">\n <VvForm v-model=\"formData\" :readonly @submit=\"submitLead\">\n <VvFormField\n name=\"name\"\n type=\"text\"\n :label=\"$t('label.name')\"\n :placeholder=\"$t('placeholder.name')\"\n icon=\"ri:user-line\"\n modifiers=\"compact\"\n class=\"mb-md\" />\n <VvFormField\n name=\"email\"\n type=\"email\"\n :label=\"$t('label.email')\"\n :placeholder=\"$t('placeholder.email')\"\n icon=\"ri:mail-line\"\n modifiers=\"compact\"\n class=\"mb-md\" />\n <VvFormField\n name=\"phone\"\n type=\"tel\"\n :label=\"$t('label.phone')\"\n :placeholder=\"$t('placeholder.phone')\"\n icon=\"ri:phone-line\"\n class=\"mb-md\"\n modifiers=\"compact\" />\n\n <!-- A send that failed says so: the reason reached the\n card and was never drawn -->\n <VvAlert v-if=\"error\" modifiers=\"danger\" class=\"mb-md\">\n {{ error }}\n </VvAlert>\n\n <div class=\"flex justify-between items-center gap-16 mt-xs\">\n <div\n class=\"text-smaller text-word-3 flex items-center gap-8\">\n <VvIcon\n name=\"ri:shield-check-line\"\n class=\"text-16 shrink-0\" />\n <PkStreamingMarkdown\n :markdown=\"privacyNotice\"\n class=\"wysiwyg\" />\n </div>\n <!-- The library's default button is the brand, and in\n the chat the brand is the agent's color, as on the\n rest of the card: `primary` drew it neutral dark -->\n <VvButton\n type=\"submit\"\n :loading\n :disabled=\"loading || readonly\"\n icon-position=\"right\"\n class=\"shrink-0\"\n :label=\"$t('action.submit')\" />\n </div>\n </VvForm>\n </div>\n <div v-else class=\"p-sm\">\n <!-- One confirmation row across every tool card: a green\n check, the title in weight, the body quiet. The check is\n the outcome, so it alone carries the colour (DESIGN.md). -->\n <div class=\"flex items-center gap-sm\">\n <VvIcon name=\"ri:check-line\" class=\"text-16 text-success\" />\n <div>\n <strong class=\"font-medium block text-word-1\">\n {{ $t('message.leadSubmittedTitle') }}\n </strong>\n <p class=\"text-word-3\">\n {{ $t('message.leadSubmittedMessage') }}\n </p>\n </div>\n </div>\n </div>\n </Transition>\n </div>\n</template>\n","<script setup lang=\"ts\">\n import { computed, watch } from 'vue'\n import { useI18n } from 'vue-i18n'\n import { useForm } from '@volverjs/form-vue'\n import * as z from 'zod'\n import { useSafeLocalStorage, useLocalizedString } from 'composables'\n import type { LocalizedString } from 'models'\n import { formatPhoneNumber } from 'utils'\n import PkStreamingMarkdown from './PkStreamingMarkdown.vue'\n\n const { t: $t } = useI18n({ useScope: 'global' })\n\n const props = defineProps<{\n part: unknown\n submitted?: boolean\n loading?: boolean\n error?: string\n readonly?: boolean\n privacyPolicyNotice?: LocalizedString\n /**\n * A conversation read back (the chat logs): the card is the record\n * of the form the agent showed, its prefilled values as text. Nothing\n * in the part says whether the visitor sent it, only the contacts do.\n */\n record?: boolean\n }>()\n\n const toolPart = computed(() => {\n const part = props.part as {\n type: string\n toolCallId: string\n input?: {\n name: string\n email: string\n phone?: string\n conversationContext?: Record<string, unknown>\n }\n }\n return part\n })\n\n const input = computed(() => toolPart.value.input)\n\n const prefilled = computed(() =>\n (\n [\n { name: 'name', label: $t('label.name') },\n { name: 'email', label: $t('label.email') },\n { name: 'phone', label: $t('label.phone') },\n ] as const\n )\n .map((field) => {\n const value = input.value?.[field.name]?.trim()\n return {\n ...field,\n // Written as the contacts page writes it\n value:\n field.name === 'phone' && value\n ? formatPhoneNumber(value) || value\n : value,\n }\n })\n .filter((field) => field.value),\n )\n\n const localSubmitted = useSafeLocalStorage<boolean>(\n computed(\n () =>\n `${toolPart.value.toolCallId}-${toolPart.value.type}-submitted`,\n ),\n false,\n )\n\n const LeadFormSchema = z.object({\n name: z.string().min(1).max(255).default(''),\n email: z.email().max(255).default(''),\n phone: z\n .string()\n .max(50)\n .regex(/^[+0-9\\s\\-.()]*$/, $t('validation.invalidPhoneNumber'))\n .optional(),\n })\n\n const emit = defineEmits<{\n submit: [data: Record<string, unknown>]\n }>()\n\n const { VvForm, VvFormField, formData } = useForm(LeadFormSchema, {\n lazyLoad: true,\n })\n\n // Pre-populate form with input values\n watch(\n input,\n (newInput) => {\n formData.value = {\n name: newInput?.name || '',\n email: newInput?.email || '',\n phone: newInput?.phone || '',\n }\n },\n { immediate: true },\n )\n\n watch(\n () => props.submitted,\n (submitted) => {\n if (submitted) {\n localSubmitted.value = true\n }\n },\n { immediate: true },\n )\n\n const isSubmitted = computed(() => {\n return props.submitted || localSubmitted.value\n })\n\n const submitLead = async (data: Record<string, unknown>): Promise<void> => {\n emit('submit', { ...data, metadata: input.value?.conversationContext })\n }\n\n const privacyNotice = useLocalizedString(\n () => props.privacyPolicyNotice,\n 'message.defaultPrivacyPolicyNotice',\n )\n</script>\n\n<template>\n <div\n class=\"border border-surface-3 rounded-xl w-full overflow-hidden bg-surface\">\n <div\n class=\"px-sm py-6 bg-surface-1 min-h-40 text-12 border-b border-surface-3 text-word-3 flex items-center gap-8 min-h-40\">\n <VvIcon name=\"ri:send-plane-2-line\" class=\"text-16\" />\n <strong class=\"font-bold\">{{ $t('label.contactUs') }}</strong>\n </div>\n\n <Transition mode=\"out-in\">\n <div v-if=\"record\" class=\"p-sm flex flex-col gap-sm text-14\">\n <p class=\"text-word-2\">\n {{\n prefilled.length\n ? $t('message.contactFormRecordPrefilled')\n : $t('message.contactFormRecord')\n }}\n </p>\n <dl\n v-if=\"prefilled.length\"\n class=\"flex flex-wrap gap-x-lg gap-y-sm\">\n <div\n v-for=\"field in prefilled\"\n :key=\"field.name\"\n class=\"flex flex-col gap-4 min-w-0\">\n <dt class=\"text-12 text-word-3\">{{ field.label }}</dt>\n <dd class=\"text-word-1 break-words\">\n {{ field.value }}\n </dd>\n </div>\n </dl>\n </div>\n <div v-else-if=\"!isSubmitted\" class=\"p-sm\">\n <VvForm v-model=\"formData\" :readonly @submit=\"submitLead\">\n <VvFormField\n name=\"name\"\n type=\"text\"\n :label=\"$t('label.name')\"\n :placeholder=\"$t('placeholder.name')\"\n icon=\"ri:user-line\"\n modifiers=\"compact\"\n class=\"mb-md\" />\n <VvFormField\n name=\"email\"\n type=\"email\"\n :label=\"$t('label.email')\"\n :placeholder=\"$t('placeholder.email')\"\n icon=\"ri:mail-line\"\n modifiers=\"compact\"\n class=\"mb-md\" />\n <VvFormField\n name=\"phone\"\n type=\"tel\"\n :label=\"$t('label.phone')\"\n :placeholder=\"$t('placeholder.phone')\"\n icon=\"ri:phone-line\"\n class=\"mb-md\"\n modifiers=\"compact\" />\n\n <!-- A send that failed says so: the reason reached the\n card and was never drawn -->\n <VvAlert v-if=\"error\" modifiers=\"danger\" class=\"mb-md\">\n {{ error }}\n </VvAlert>\n\n <div class=\"flex justify-between items-center gap-16 mt-xs\">\n <div\n class=\"text-smaller text-word-3 flex items-center gap-8\">\n <VvIcon\n name=\"ri:shield-check-line\"\n class=\"text-16 shrink-0\" />\n <PkStreamingMarkdown\n :markdown=\"privacyNotice\"\n class=\"wysiwyg\" />\n </div>\n <!-- The library's default button is the brand, and in\n the chat the brand is the agent's color, as on the\n rest of the card: `primary` drew it neutral dark -->\n <VvButton\n type=\"submit\"\n :loading\n :disabled=\"loading || readonly\"\n icon-position=\"right\"\n class=\"shrink-0\"\n :label=\"$t('action.submit')\" />\n </div>\n </VvForm>\n </div>\n <div v-else class=\"p-sm\">\n <!-- One confirmation row across every tool card: a green\n check, the title in weight, the body quiet. The check is\n the outcome, so it alone carries the colour (DESIGN.md). -->\n <div class=\"flex items-center gap-sm\">\n <VvIcon name=\"ri:check-line\" class=\"text-16 text-success\" />\n <div>\n <strong class=\"font-medium block text-word-1\">\n {{ $t('message.leadSubmittedTitle') }}\n </strong>\n <p class=\"text-word-3\">\n {{ $t('message.leadSubmittedMessage') }}\n </p>\n </div>\n </div>\n </div>\n </Transition>\n </div>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAUI,IAAM,EAAE,GAAGyE,MAAO1B,EAAQ,EAAE,UAAU,SAAS,CAAC,GAE1C2B,IAAQC,GAeRC,IAAWnC,QACAiC,EAAM,IAWtB,GAEKG,IAAQpC,QAAemC,EAAS,MAAM,KAAK,GAE3CE,IAAYrC,QAEV;GACI;IAAE,MAAM;IAAQ,OAAOgC,EAAG,YAAY;GAAE;GACxC;IAAE,MAAM;IAAS,OAAOA,EAAG,aAAa;GAAE;GAC1C;IAAE,MAAM;IAAS,OAAOA,EAAG,aAAa;GAAE;EAC9C,CAAC,CAEA,KAAK,MAAU;GACZ,IAAMM,IAAQF,EAAM,QAAQG,EAAM,KAAK,EAAE,KAAK;GAC9C,OAAO;IACH,GAAGA;IAEH,OACIA,EAA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AjB,EAAA;OACA,UAAUA,EAAA,WAAWA,EAAA;OACtB,iBAAc;OACd,OAAM;OACL,OAAO/D,EAAA6D,CAAA,CAAE,CAAA,eAAA;;;;;;;;IAI1BlE,GAAAA,GAAAA,CAAAA,cAAAA,UAAAA,CAAAA,CAAAA,CAAAA,EAWqB,CAAA"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { $ as e, B as t, C as n, Ct as r, Dt as i, Et as a, G as o, K as s, L as c, M as l, O as u, St as d, X as f, _ as p, b as m, d as h, ft as ee, g, h as _, it as v, j as y, l as te, m as b, mt as x, r as S, u as C, v as w, wt as ne, x as T, y as E, z as D } from "./vue.runtime.esm-bundler-DKVd2gci.js";
|
|
2
2
|
import { r as re } from "./vue-i18n-CooVjJjT.js";
|
|
3
|
-
import { l as ie, t as ae, u as oe } from "./PkStreamingMarkdown-
|
|
3
|
+
import { l as ie, t as ae, u as oe } from "./PkStreamingMarkdown-pEgm7m-B.js";
|
|
4
4
|
import { g as O } from "./Agent-DU38SnNd.js";
|
|
5
5
|
import { c as k, f as se, o as A, p as j, s as M, t as ce } from "./index.es-dTcgyeM4.js";
|
|
6
6
|
import { t as le } from "./VvButtonLocalized-DV-zbH9b.js";
|
|
@@ -379,4 +379,4 @@ var fe = {
|
|
|
379
379
|
//#endregion
|
|
380
380
|
export { z as default };
|
|
381
381
|
|
|
382
|
-
//# sourceMappingURL=PkToolShowForm-
|
|
382
|
+
//# sourceMappingURL=PkToolShowForm-D_2FmDwq.js.map
|