ai12z 3.13.3 → 3.14.2
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/cjs/ai12z-bot.cjs.entry.js +107 -19
- package/dist/cjs/ai12z-chat-message.cjs.entry.js +17 -46
- package/dist/cjs/ai12z-knowledge-box.cjs.entry.js +14 -60
- package/dist/cjs/index.cjs.js +1 -0
- package/dist/cjs/styleSheetRegistry-7aecMygn.js +175 -0
- package/dist/collection/components/ai12z-bot/ai12z-bot.js +32 -13
- package/dist/collection/components/ai12z-knowledge-box/ai12z-knowledge-box.js +15 -61
- package/dist/collection/components/ai12z-knowledge-box/components/ai12z-chat-message.js +16 -46
- package/dist/collection/utils/liveagents/providers/salesforce.js +75 -6
- package/dist/collection/utils/styleSheetRegistry.js +169 -0
- package/dist/components/ai12z-bot.js +1 -1
- package/dist/components/ai12z-chat-message.js +1 -1
- package/dist/components/ai12z-chat.js +1 -1
- package/dist/components/ai12z-container.js +1 -1
- package/dist/components/ai12z-cta.js +1 -1
- package/dist/components/ai12z-form.js +1 -1
- package/dist/components/ai12z-inline-search.js +1 -1
- package/dist/components/ai12z-input-form.js +1 -1
- package/dist/components/ai12z-knowledge-box.js +1 -1
- package/dist/components/ai12z-search-panel.js +1 -1
- package/dist/components/audio-recorder.js +1 -1
- package/dist/components/dynamic-form.js +1 -1
- package/dist/components/index.js +1 -1
- package/dist/components/interaction-buttons.js +1 -1
- package/dist/components/item-list.js +1 -1
- package/dist/components/{p-DKxaam7U.js → p-3j2aDKYq.js} +1 -1
- package/dist/components/{p-BP8ig03d.js → p-AQ1MS6Ps.js} +1 -1
- package/dist/components/p-B9IJbo4G.js +1 -0
- package/dist/components/{p-DsZWeAcM.js → p-BWMhH2R1.js} +1 -1
- package/dist/components/{p-5UYwpNzl.js → p-BaXs0IIw.js} +1 -1
- package/dist/components/{p-Gr6Q2s96.js → p-Bnj1LjUJ.js} +1 -1
- package/dist/components/p-BwpiW24r.js +1 -0
- package/dist/components/{p-Bo3Ig8oX.js → p-BwqXbNCx.js} +1 -1
- package/dist/components/{p-D2nUK4Pa.js → p-COqFEHJ7.js} +1 -1
- package/dist/components/{p-DA32xa7d.js → p-Ci85xHWQ.js} +1 -1
- package/dist/components/{p-DUaZgAhA.js → p-CrfXJRIo.js} +1 -1
- package/dist/components/{p-DJ68HDol.js → p-DkRAkHLI.js} +2 -2
- package/dist/components/{p-ha1wIlZ-.js → p-Dubjoiw6.js} +1 -1
- package/dist/components/{p-C2wKkcYa.js → p-DvtUY5FW.js} +1 -1
- package/dist/components/{p-J--erGbY.js → p-dQEvevXk.js} +1 -1
- package/dist/{library/p-DAGa-uHD.js → components/p-g36mIk7k.js} +1 -1
- package/dist/components/p-m0Ed3g6I.js +1 -0
- package/dist/components/p-mBjDeFh_.js +1 -0
- package/dist/components/{p-q7YWDP9B.js → p-pOVc-eI8.js} +1 -1
- package/dist/components/{p-BCJzelr9.js → p-qwKoi5kn.js} +1 -1
- package/dist/components/{p-CKAp10SJ.js → p-xTOLReQF.js} +1 -1
- package/dist/components/privacy-modal.js +1 -1
- package/dist/components/search-results-page.js +1 -1
- package/dist/esm/ai12z-bot.entry.js +115 -27
- package/dist/esm/ai12z-category_2.entry.js +3 -3
- package/dist/esm/ai12z-chat-message.entry.js +17 -46
- package/dist/esm/ai12z-chat_2.entry.js +8 -8
- package/dist/esm/ai12z-container.entry.js +3 -3
- package/dist/esm/ai12z-cta.entry.js +4 -4
- package/dist/esm/ai12z-form.entry.js +2 -2
- package/dist/esm/ai12z-inline-search.entry.js +2 -2
- package/dist/esm/ai12z-knowledge-box.entry.js +18 -64
- package/dist/esm/ai12z-search-panel.entry.js +1 -1
- package/dist/esm/chat-avatar_6.entry.js +1 -1
- package/dist/esm/{ctaHelpers-BhM8KbEY.js → ctaHelpers-DrH6S5iU.js} +1 -1
- package/dist/esm/dynamic-form.entry.js +1 -1
- package/dist/esm/{index-BQKLwW-C.js → index-VWr-8RG8.js} +1 -1
- package/dist/esm/index.js +10 -9
- package/dist/esm/item-list.entry.js +2 -2
- package/dist/esm/{keyboard-shortcuts-Bd3LDe9j.js → keyboard-shortcuts-BhKv64FZ.js} +2 -2
- package/dist/esm/{parseHelper-9rP0JS7J.js → parseHelper-kOGOndOe.js} +1 -1
- package/dist/esm/{processCarouselData-Bf2pDFsV.js → processCarouselData-DX152a4X.js} +1 -1
- package/dist/esm/{reCaptchaHelpers-CUcgfdqX.js → reCaptchaHelpers-DUpCzUFb.js} +1 -1
- package/dist/esm/search-results-page.entry.js +4 -4
- package/dist/esm/{socket-service-B1OMbkCM.js → socket-service-D_h5x8Gr.js} +1 -1
- package/dist/esm/styleSheetRegistry-Bfi9VkqK.js +172 -0
- package/dist/esm/{surveyHelpers-CvrZlir1.js → surveyHelpers-D-00eWjv.js} +1 -1
- package/dist/esm/{utils-BTLjNTwP.js → utils-DK_Yhmpx.js} +1 -1
- package/dist/library/index.esm.js +1 -1
- package/dist/library/library.esm.js +1 -1
- package/dist/library/{p-cd764f70.entry.js → p-11c1f91d.entry.js} +1 -1
- package/dist/library/{p-806bfb3d.entry.js → p-1d382046.entry.js} +1 -1
- package/dist/library/{p-0641ba91.entry.js → p-252bb713.entry.js} +2 -2
- package/dist/library/p-25a678ca.entry.js +1 -0
- package/dist/library/p-53edf210.entry.js +1 -0
- package/dist/library/p-646a7eae.entry.js +1 -0
- package/dist/library/p-675d0243.entry.js +1 -0
- package/dist/library/{p-60d5d99f.entry.js → p-6ea05db1.entry.js} +1 -1
- package/dist/library/{p-7f0e306c.entry.js → p-7154a204.entry.js} +1 -1
- package/dist/library/{p-07f11cb8.entry.js → p-72a5eaf2.entry.js} +1 -1
- package/dist/library/{p-2d262192.entry.js → p-8f238b3f.entry.js} +1 -1
- package/dist/library/p-9cffb6fa.entry.js +1 -0
- package/dist/library/{p-y3Go1NSi.js → p-BCkDiHIY.js} +1 -1
- package/dist/{components/p-BhV62IFF.js → library/p-By1gJKXA.js} +1 -1
- package/dist/library/{p-Bbow4UZX.js → p-C0wNDqKO.js} +1 -1
- package/dist/library/p-C3yxqbFh.js +1 -0
- package/dist/library/p-CwZwG6gL.js +1 -0
- package/dist/library/{p-D5m1leH0.js → p-D1IPrgJe.js} +3 -3
- package/dist/library/{p-NAKC5NP9.js → p-KSKiM1sy.js} +1 -1
- package/dist/library/{p-C1eU4fpM.js → p-TJuczvVq.js} +1 -1
- package/dist/library/{p-CnadO0kA.js → p-ZyOWOLs5.js} +1 -1
- package/dist/library/{p-94bf0c7f.entry.js → p-cbfc9f73.entry.js} +1 -1
- package/dist/library/{p-014d5664.entry.js → p-d8506e43.entry.js} +1 -1
- package/dist/library/{p-BZ_koFpE.js → p-n8ydBHE4.js} +1 -1
- package/dist/types/components/ai12z-bot/ai12z-bot.d.ts +1 -0
- package/dist/types/components/ai12z-knowledge-box/ai12z-knowledge-box.d.ts +0 -3
- package/dist/types/components/ai12z-knowledge-box/components/ai12z-chat-message.d.ts +0 -2
- package/dist/types/utils/liveagents/providers/salesforce.d.ts +2 -0
- package/dist/types/utils/styleSheetRegistry.d.ts +40 -0
- package/package.json +2 -2
- package/dist/components/p-B3lv_O-6.js +0 -1
- package/dist/components/p-CLdlCTTp.js +0 -1
- package/dist/components/p-DT0Uarfg.js +0 -1
- package/dist/components/p-zVXADzTq.js +0 -1
- package/dist/library/p-29cd4edc.entry.js +0 -1
- package/dist/library/p-6f3727d3.entry.js +0 -1
- package/dist/library/p-83a71da9.entry.js +0 -1
- package/dist/library/p-DoBD_KPG.js +0 -1
- package/dist/library/p-d3a2acee.entry.js +0 -1
- package/dist/library/p-dc131a5c.entry.js +0 -1
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { r as registerInstance, h, d as getElement } from './index-BNpVu1WU.js';
|
|
2
2
|
import { i as initializeScript } from './botHelpers-B_moTKAE.js';
|
|
3
|
-
import {
|
|
3
|
+
import { a as adoptStyleSheet, l as loadScriptOnce } from './styleSheetRegistry-Bfi9VkqK.js';
|
|
4
|
+
import './utils-DK_Yhmpx.js';
|
|
4
5
|
|
|
5
6
|
const ai12zChatMessageCss = () => `.show-more-btn{background:none;color:var(--ai12z-knowledge-box-show-more-color, #4a8aff);font-size:16px;cursor:pointer;font-weight:500;border-radius:6px;transition:color 0.2s ease, background 0.2s ease;border:1px solid var(--ai12z-knowledge-box-show-more-border, blue);padding:10px;border-radius:20px;align-items:center;justify-content:center;margin:auto;display:block;z-index:20;position:relative;width:30%}.show-more-btn:hover{color:var(--ai12z-knowledge-box-show-more-hover-color, #1a73e8);background:rgba(74, 138, 255, 0.08)}.show-more-btn:active{background:rgba(74, 138, 255, 0.15)}.show-more-btn svg{vertical-align:middle;gap:5px;transition:transform 0.3s ease-in-out;display:inline-block;margin-left:10px;font-size:20}.message-text{line-height:1.55;font-size:15px;color:var(--ai12z-knowledge-box-text-color, #1e1e1e);transition:max-height 0.5s cubic-bezier(0.4, 0, 0.2, 1);overflow:hidden}.fade-overlay{position:absolute;bottom:0;left:0;right:0;height:100px;z-index:10;pointer-events:none;opacity:1;transition:opacity 0.3s ease-in-out;background:linear-gradient( to bottom, rgba(255, 255, 255, 0) 0%, var(--ai12z-knowledge-box-bg-color, #ffffff) 85% )}.chat-message{position:relative;}.custom-line-clamp{overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:var(--line-clamp);line-clamp:var(--line-clamp)}.ai12z-form-honeypot{position:absolute;left:-10000px;top:auto;width:1px;height:1px;overflow:hidden}.ai12zBtn{background-color:var(--ai12z-knowledge-box-primary-color);color:white;padding:5px 10px;border:none;border-radius:5px;cursor:pointer;text-decoration:none;margin:5px}`;
|
|
6
7
|
|
|
@@ -53,69 +54,39 @@ const Ai12zChatMessage = class {
|
|
|
53
54
|
}
|
|
54
55
|
componentWillLoad() {
|
|
55
56
|
var _a, _b;
|
|
57
|
+
this.loadScriptsSequentially();
|
|
58
|
+
// Adopt customCSS in this shadow root using the shared CSSStyleSheet
|
|
59
|
+
// already constructed by the parent knowledge-box (zero extra fetches).
|
|
56
60
|
if ((_a = this.kbSettings) === null || _a === void 0 ? void 0 : _a.customCSS) {
|
|
57
|
-
|
|
61
|
+
adoptStyleSheet(this.kbSettings.customCSS, this.el.shadowRoot);
|
|
58
62
|
}
|
|
59
63
|
if ((_b = this.kbSettings) === null || _b === void 0 ? void 0 : _b.customJS) {
|
|
60
|
-
|
|
64
|
+
loadScriptOnce(this.kbSettings.customJS, this.el.shadowRoot);
|
|
61
65
|
}
|
|
62
|
-
this.loadScriptsSequentially();
|
|
63
66
|
}
|
|
64
67
|
componentDidLoad() {
|
|
65
|
-
//
|
|
68
|
+
// Initialise the ai12z global exactly once; never overwrite an existing value.
|
|
66
69
|
if (!window["ai12z"]) {
|
|
67
70
|
window["ai12z"] = {};
|
|
68
71
|
}
|
|
69
72
|
const ai12zHeading = document.createElement("script");
|
|
70
|
-
ai12zHeading.text = `
|
|
71
|
-
var ai12zChat = window["ai12z"] = {}
|
|
72
|
-
`;
|
|
73
|
-
document.head.appendChild(ai12zHeading);
|
|
73
|
+
ai12zHeading.text = `var ai12zChat = window["ai12z"] = {}`;
|
|
74
74
|
this.el.shadowRoot.appendChild(ai12zHeading);
|
|
75
75
|
this.checkOverflow();
|
|
76
|
-
this.injectCustomAssets();
|
|
77
|
-
}
|
|
78
|
-
injectCustomAssets() {
|
|
79
|
-
var _a, _b;
|
|
80
|
-
if ((_a = this.kbSettings) === null || _a === void 0 ? void 0 : _a.customCSS) {
|
|
81
|
-
insertStyles(this.kbSettings.customCSS, this.el);
|
|
82
|
-
}
|
|
83
|
-
if ((_b = this.kbSettings) === null || _b === void 0 ? void 0 : _b.customJS) {
|
|
84
|
-
this.loadScript(this.kbSettings.customJS).catch(err => console.warn('customJS load failed:', err));
|
|
85
|
-
}
|
|
86
76
|
}
|
|
87
77
|
async loadScriptsSequentially() {
|
|
88
78
|
try {
|
|
89
|
-
//
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
await
|
|
93
|
-
|
|
94
|
-
await
|
|
95
|
-
// 6. Load Survey UI
|
|
96
|
-
await this.loadScript(`${this.surveyCDNPath}/survey-js-ui@2.3.4/survey-js-ui.min.js`);
|
|
97
|
-
// console.log("All Survey.js scripts loaded successfully")
|
|
79
|
+
// Survey.js scripts are loaded into shadowRoot exactly once
|
|
80
|
+
// (loadScriptOnce deduplicates across all component instances).
|
|
81
|
+
await loadScriptOnce(`${this.surveyCDNPath}/survey-core@2.3.4/survey.core.min.js`, this.el.shadowRoot);
|
|
82
|
+
await loadScriptOnce(`${this.surveyCDNPath}/survey-core@2.3.4/survey.i18n.min.js`, this.el.shadowRoot);
|
|
83
|
+
await loadScriptOnce(`${this.surveyCDNPath}/survey-core@2.3.4/themes/index.min.js`, this.el.shadowRoot);
|
|
84
|
+
await loadScriptOnce(`${this.surveyCDNPath}/survey-js-ui@2.3.4/survey-js-ui.min.js`, this.el.shadowRoot);
|
|
98
85
|
}
|
|
99
86
|
catch (error) {
|
|
100
87
|
console.error("Failed to load Survey.js scripts:", error);
|
|
101
88
|
}
|
|
102
89
|
}
|
|
103
|
-
loadScript(src) {
|
|
104
|
-
return new Promise((resolve, reject) => {
|
|
105
|
-
if (document.querySelector(`script[src="${src}"]`)) {
|
|
106
|
-
resolve();
|
|
107
|
-
return;
|
|
108
|
-
}
|
|
109
|
-
const script = document.createElement("script");
|
|
110
|
-
script.src = src;
|
|
111
|
-
script.async = false;
|
|
112
|
-
script.onload = () => resolve();
|
|
113
|
-
script.onerror = () => reject(new Error(`Failed to load script: ${src}`));
|
|
114
|
-
// Load in document head for global access
|
|
115
|
-
// document.head.appendChild(script)
|
|
116
|
-
this.el.shadowRoot.appendChild(script);
|
|
117
|
-
});
|
|
118
|
-
}
|
|
119
90
|
onTextChange() {
|
|
120
91
|
// if (!this.isExpanded && !this.streaming) {
|
|
121
92
|
// this.updateCollapsedHeight();
|
|
@@ -183,9 +154,9 @@ const Ai12zChatMessage = class {
|
|
|
183
154
|
render() {
|
|
184
155
|
var _a, _b, _c, _d;
|
|
185
156
|
const lineClamp = (_b = (_a = this.kbSettings) === null || _a === void 0 ? void 0 : _a.numberOfLines) !== null && _b !== void 0 ? _b : 10;
|
|
186
|
-
return (h("div", { key: '
|
|
157
|
+
return (h("div", { key: '54f51ffb7c06bbb20fc1088c0fb63a8669d7ba45', class: "chat-message" }, h("div", { key: '281bc75361bcfadb4611eefeb9697d525b9e2d27', ref: (el) => this.messageRef = el, class: { 'message-text': true, "custom-line-clamp": !this.isExpanded && !this.isCollapsing && this.showButton }, style: {
|
|
187
158
|
"--line-clamp": `${lineClamp}`,
|
|
188
|
-
}, innerHTML: this.text, onClick: this.showButton ? this.toggleExpand : undefined }), !this.isExpanded && this.showButton && this.canExpand && h("div", { key: '
|
|
159
|
+
}, innerHTML: this.text, onClick: this.showButton ? this.toggleExpand : undefined }), !this.isExpanded && this.showButton && this.canExpand && h("div", { key: 'd6e262dbca0934b97fafb3dd7723b3b9333d8e10', class: "fade-overlay" }), this.showButton && this.canExpand && h("button", { key: 'e1e711b71656763ecdeb1cb6f73166528f023914', class: "show-more-btn", onClick: this.toggleExpand }, this.isExpanded ? (((_c = this.kbSettings) === null || _c === void 0 ? void 0 : _c.showLessButtonLabel) || "Show less") : (((_d = this.kbSettings) === null || _d === void 0 ? void 0 : _d.showMoreButtonLabel) || "Show more"), this.isExpanded ? h("svg", { width: "1em", height: "1em", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round" }, h("polyline", { points: "6 9 12 15 18 9" })) : h("svg", { width: "1em", height: "1em", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round" }, h("polyline", { points: "18 15 12 9 6 15" })))));
|
|
189
160
|
}
|
|
190
161
|
get el() { return getElement(this); }
|
|
191
162
|
static get watchers() { return {
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { r as registerInstance, a as createEvent, E as Env, h, d as getElement } from './index-BNpVu1WU.js';
|
|
2
|
-
import { s as showdown, p as processChatData } from './processCarouselData-
|
|
3
|
-
import { e as ensureMessageId, p as parseArgsWithJson5 } from './parseHelper-
|
|
4
|
-
import { u as updateAnchorTags,
|
|
5
|
-
import { s as saveConversation } from './ctaHelpers-
|
|
6
|
-
import { H as Handlebars } from './index-
|
|
7
|
-
import { S as SocketService } from './socket-service-
|
|
8
|
-
import { r as renderSurvey } from './surveyHelpers-
|
|
9
|
-
import { w as waitForElementRender, h as handleEndResponse, D as DEFAULT_SHORTCUTS } from './keyboard-shortcuts-
|
|
2
|
+
import { s as showdown, p as processChatData } from './processCarouselData-DX152a4X.js';
|
|
3
|
+
import { e as ensureMessageId, p as parseArgsWithJson5 } from './parseHelper-kOGOndOe.js';
|
|
4
|
+
import { u as updateAnchorTags, f as updateButtonEvents, l as getMetaInfo, k as generateUUID, m as getAudioContent, n as debounce } from './utils-DK_Yhmpx.js';
|
|
5
|
+
import { s as saveConversation } from './ctaHelpers-DrH6S5iU.js';
|
|
6
|
+
import { H as Handlebars } from './index-VWr-8RG8.js';
|
|
7
|
+
import { S as SocketService } from './socket-service-D_h5x8Gr.js';
|
|
8
|
+
import { r as renderSurvey } from './surveyHelpers-D-00eWjv.js';
|
|
9
|
+
import { w as waitForElementRender, h as handleEndResponse, D as DEFAULT_SHORTCUTS } from './keyboard-shortcuts-BhKv64FZ.js';
|
|
10
10
|
import { t as trackFeedbackAnalytics, g as getQuestionText } from './analyticsService-ChFVg77w.js';
|
|
11
11
|
import { l as loadStyle, a as loadScript } from './botHelpers-B_moTKAE.js';
|
|
12
12
|
import './_commonjsHelpers-Dj2_voLF.js';
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { r as registerInstance, a as createEvent, E as Env, e as ai12zManager, h, d as getElement } from './index-BNpVu1WU.js';
|
|
2
|
-
import {
|
|
3
|
-
import { s as showdown, p as processChatData } from './processCarouselData-
|
|
2
|
+
import { k as generateUUID, N as getKBContent, O as getWidgetContentByType } from './utils-DK_Yhmpx.js';
|
|
3
|
+
import { s as showdown, p as processChatData } from './processCarouselData-DX152a4X.js';
|
|
4
4
|
import { i as initializeScript, p as processTemplateData, r as renderTemplateData } from './botHelpers-B_moTKAE.js';
|
|
5
|
-
import { H as Handlebars } from './index-
|
|
5
|
+
import { H as Handlebars } from './index-VWr-8RG8.js';
|
|
6
6
|
import './_commonjsHelpers-Dj2_voLF.js';
|
|
7
7
|
|
|
8
8
|
/*! @license DOMPurify 3.3.3 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.3.3/LICENSE */
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { r as registerInstance, a as createEvent, E as Env, e as ai12zManager, h, f as Host, d as getElement } from './index-BNpVu1WU.js';
|
|
2
|
-
import {
|
|
2
|
+
import { P as search, e as insertStyles, J as checkStatus, L as getConfig, p as sendFeedback } from './utils-DK_Yhmpx.js';
|
|
3
3
|
import { S as SearchResult } from './SearchResult-zLaEhc3L.js';
|
|
4
|
-
import { S as SocketService } from './socket-service-
|
|
4
|
+
import { S as SocketService } from './socket-service-D_h5x8Gr.js';
|
|
5
5
|
import { b as setCtaElement } from './global-store-odmyXuxx.js';
|
|
6
|
-
import { e as executeRecaptcha } from './reCaptchaHelpers-
|
|
7
|
-
import { d as detectLanguage, l as loadLanguageFile, a as getConversationHistory, f as filterConversationHistoryByProjectAndConfig, b as setLocalData, r as removeLastMessage, v as validateFormInput, c as createChatMessage, g as generateUUID, u as updateChatHistory, i as isMaxQuestionsReached, e as clearTimer, h as isOutsideClick, j as createAutoResetTimer, k as insertCustomJS, m as insertCustomCSS, n as isMac } from './ctaHelpers-
|
|
6
|
+
import { e as executeRecaptcha } from './reCaptchaHelpers-DUpCzUFb.js';
|
|
7
|
+
import { d as detectLanguage, l as loadLanguageFile, a as getConversationHistory, f as filterConversationHistoryByProjectAndConfig, b as setLocalData, r as removeLastMessage, v as validateFormInput, c as createChatMessage, g as generateUUID, u as updateChatHistory, i as isMaxQuestionsReached, e as clearTimer, h as isOutsideClick, j as createAutoResetTimer, k as insertCustomJS, m as insertCustomCSS, n as isMac } from './ctaHelpers-DrH6S5iU.js';
|
|
8
8
|
import { a as setParentComponentState } from './app-store-DYN4CiXV.js';
|
|
9
9
|
import './response-adapter-SyQT2Pr3.js';
|
|
10
10
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { r as registerInstance, a as createEvent, E as Env, h, d as getElement } from './index-BNpVu1WU.js';
|
|
2
|
-
import {
|
|
3
|
-
import { r as renderSurvey } from './surveyHelpers-
|
|
2
|
+
import { Q as getFormByKeyName } from './utils-DK_Yhmpx.js';
|
|
3
|
+
import { r as renderSurvey } from './surveyHelpers-D-00eWjv.js';
|
|
4
4
|
import { c as createScriptStyleLoader } from './scriptStyleLoader-DXBxSLgN.js';
|
|
5
5
|
|
|
6
6
|
const ai12zFormCss = () => `.ai12z-form-wrapper{width:100%}.ai12z-form-status,.ai12z-form-error{font-size:14px;margin-bottom:8px}.ai12z-form-error{color:#b91c1c}.ai12z-form-container{width:100%}.ai12z-form-honeypot{position:absolute;left:-10000px;top:auto;width:1px;height:1px;overflow:hidden}@keyframes ai12z-form-spin{to{transform:rotate(360deg)}}@keyframes ai12z-form-bounce{0%,80%,100%{opacity:0.35;transform:translateY(0)}40%{opacity:1;transform:translateY(-3px)}}`;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { r as registerInstance, a as createEvent, E as Env, h, d as getElement } from './index-BNpVu1WU.js';
|
|
2
|
-
import {
|
|
2
|
+
import { k as generateUUID, P as search, e as insertStyles, p as sendFeedback } from './utils-DK_Yhmpx.js';
|
|
3
3
|
import { S as SearchResult } from './SearchResult-zLaEhc3L.js';
|
|
4
|
-
import { S as SocketService } from './socket-service-
|
|
4
|
+
import { S as SocketService } from './socket-service-D_h5x8Gr.js';
|
|
5
5
|
import './response-adapter-SyQT2Pr3.js';
|
|
6
6
|
|
|
7
7
|
const ai12zInlineSearchCss = () => `:host{font-family:var(--ai12z-font-family) !important;font-size:var(--ai12z-font-size) !important;color:var(--ai12z-font-color, black);text-align:var(--ai12z-text-align, left)}`;
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { r as registerInstance, a as createEvent, E as Env, e as ai12zManager, h, d as getElement } from './index-BNpVu1WU.js';
|
|
2
|
-
import { s as submitForm,
|
|
2
|
+
import { s as submitForm, p as sendFeedback, L as getConfig, f as updateButtonEvents, k as generateUUID, c as getEndpoint, l as getMetaInfo, h as splitContentMultiple, b as getBackendProtocol } from './utils-DK_Yhmpx.js';
|
|
3
|
+
import { l as loadScriptOnce, a as adoptStyleSheet } from './styleSheetRegistry-Bfi9VkqK.js';
|
|
3
4
|
import { b as adaptCompleteToLegacy, l as lookup } from './response-adapter-SyQT2Pr3.js';
|
|
4
|
-
import { s as showdown, p as processChatData } from './processCarouselData-
|
|
5
|
+
import { s as showdown, p as processChatData } from './processCarouselData-DX152a4X.js';
|
|
5
6
|
import { c as setKnowledgeBoxElement } from './global-store-odmyXuxx.js';
|
|
6
|
-
import { H as Handlebars } from './index-
|
|
7
|
-
import { r as renderSurvey } from './surveyHelpers-
|
|
7
|
+
import { H as Handlebars } from './index-VWr-8RG8.js';
|
|
8
|
+
import { r as renderSurvey } from './surveyHelpers-D-00eWjv.js';
|
|
8
9
|
import { p as processTemplateData, r as renderTemplateData } from './botHelpers-B_moTKAE.js';
|
|
9
10
|
import { t as trackFeedbackAnalytics } from './analyticsService-ChFVg77w.js';
|
|
10
11
|
import './_commonjsHelpers-Dj2_voLF.js';
|
|
@@ -36,7 +37,6 @@ const Ai12zKnowledgeBox = class {
|
|
|
36
37
|
this.welcomeReady = true;
|
|
37
38
|
this.cdnPath = "https://cdn.ai12z.net/assets/kb";
|
|
38
39
|
this.initializeScript = id => {
|
|
39
|
-
console.log("Initializing script for ID:", id);
|
|
40
40
|
setTimeout(() => {
|
|
41
41
|
this.initializeScripts.emit({ id });
|
|
42
42
|
}, 1000);
|
|
@@ -238,7 +238,7 @@ const Ai12zKnowledgeBox = class {
|
|
|
238
238
|
};
|
|
239
239
|
getConfig(payload, this.dataMode)
|
|
240
240
|
.then(async (data) => {
|
|
241
|
-
var _a, _b, _c, _d, _e
|
|
241
|
+
var _a, _b, _c, _d, _e;
|
|
242
242
|
if (data) {
|
|
243
243
|
this.kbSettings = data;
|
|
244
244
|
switch ((_a = this.kbSettings) === null || _a === void 0 ? void 0 : _a.questionType) {
|
|
@@ -258,10 +258,10 @@ const Ai12zKnowledgeBox = class {
|
|
|
258
258
|
this.addEventListeners(`.ai12z-kb-wrapper`);
|
|
259
259
|
const welcomeLoads = [];
|
|
260
260
|
if ((_d = this.kbSettings.welcome) === null || _d === void 0 ? void 0 : _d.scripts) {
|
|
261
|
-
welcomeLoads.push(
|
|
261
|
+
welcomeLoads.push(loadScriptOnce(this.kbSettings.welcome.scripts, this.el.shadowRoot));
|
|
262
262
|
}
|
|
263
263
|
if ((_e = this.kbSettings.welcome) === null || _e === void 0 ? void 0 : _e.styles) {
|
|
264
|
-
welcomeLoads.push(
|
|
264
|
+
welcomeLoads.push(adoptStyleSheet(this.kbSettings.welcome.styles, this.el.shadowRoot));
|
|
265
265
|
}
|
|
266
266
|
if (welcomeLoads.length > 0) {
|
|
267
267
|
await Promise.all(welcomeLoads);
|
|
@@ -283,18 +283,10 @@ const Ai12zKnowledgeBox = class {
|
|
|
283
283
|
document.head.appendChild(linkEl);
|
|
284
284
|
}
|
|
285
285
|
if (this.kbSettings.customCSS) {
|
|
286
|
-
|
|
286
|
+
adoptStyleSheet(this.kbSettings.customCSS, this.el.shadowRoot);
|
|
287
287
|
}
|
|
288
288
|
if (this.kbSettings.customJS) {
|
|
289
|
-
|
|
290
|
-
console.warn("[ai12z] Blocked customJS injection: URL must use HTTPS.", this.kbSettings.customJS);
|
|
291
|
-
}
|
|
292
|
-
else {
|
|
293
|
-
const scriptEl = document.createElement("script");
|
|
294
|
-
scriptEl.setAttribute("type", "text/javascript");
|
|
295
|
-
scriptEl.setAttribute("src", this.kbSettings.customJS);
|
|
296
|
-
(_f = this.el.shadowRoot) === null || _f === void 0 ? void 0 : _f.appendChild(scriptEl);
|
|
297
|
-
}
|
|
289
|
+
loadScriptOnce(this.kbSettings.customJS, this.el.shadowRoot);
|
|
298
290
|
}
|
|
299
291
|
}
|
|
300
292
|
})
|
|
@@ -304,49 +296,6 @@ const Ai12zKnowledgeBox = class {
|
|
|
304
296
|
this.errored.emit(error);
|
|
305
297
|
});
|
|
306
298
|
}
|
|
307
|
-
insertStyles(linkURL) {
|
|
308
|
-
const linkEl = document.createElement("link");
|
|
309
|
-
linkEl.setAttribute("rel", "stylesheet");
|
|
310
|
-
linkEl.setAttribute("href", linkURL);
|
|
311
|
-
const shadowRoot = this.el.shadowRoot;
|
|
312
|
-
if (shadowRoot) {
|
|
313
|
-
shadowRoot.appendChild(linkEl);
|
|
314
|
-
}
|
|
315
|
-
}
|
|
316
|
-
insertStylesAsync(linkURL) {
|
|
317
|
-
return new Promise(resolve => {
|
|
318
|
-
const shadowRoot = this.el.shadowRoot;
|
|
319
|
-
if (!shadowRoot) {
|
|
320
|
-
resolve();
|
|
321
|
-
return;
|
|
322
|
-
}
|
|
323
|
-
const linkEl = document.createElement("link");
|
|
324
|
-
linkEl.setAttribute("rel", "stylesheet");
|
|
325
|
-
linkEl.setAttribute("href", linkURL);
|
|
326
|
-
linkEl.addEventListener("load", () => resolve());
|
|
327
|
-
linkEl.addEventListener("error", () => resolve());
|
|
328
|
-
shadowRoot.appendChild(linkEl);
|
|
329
|
-
});
|
|
330
|
-
}
|
|
331
|
-
insertScriptAsync(scriptURL) {
|
|
332
|
-
if (!isValidHttpsUrl(scriptURL)) {
|
|
333
|
-
console.warn("[ai12z] Blocked script injection: URL must use HTTPS.", scriptURL);
|
|
334
|
-
return Promise.resolve();
|
|
335
|
-
}
|
|
336
|
-
return new Promise(resolve => {
|
|
337
|
-
const shadowRoot = this.el.shadowRoot;
|
|
338
|
-
if (!shadowRoot) {
|
|
339
|
-
resolve();
|
|
340
|
-
return;
|
|
341
|
-
}
|
|
342
|
-
const scriptEl = document.createElement("script");
|
|
343
|
-
scriptEl.setAttribute("type", "text/javascript");
|
|
344
|
-
scriptEl.setAttribute("src", scriptURL);
|
|
345
|
-
scriptEl.addEventListener("load", () => resolve());
|
|
346
|
-
scriptEl.addEventListener("error", () => resolve());
|
|
347
|
-
shadowRoot.appendChild(scriptEl);
|
|
348
|
-
});
|
|
349
|
-
}
|
|
350
299
|
getResults(type) {
|
|
351
300
|
var _a, _b;
|
|
352
301
|
// console.log("Getting results for question:", this.question)
|
|
@@ -460,9 +409,14 @@ const Ai12zKnowledgeBox = class {
|
|
|
460
409
|
}
|
|
461
410
|
}
|
|
462
411
|
componentWillLoad() {
|
|
463
|
-
|
|
412
|
+
adoptStyleSheet(`https://cdn.ai12z.net/assets/bot/v2/tailwind.min.css`, this.el.shadowRoot);
|
|
464
413
|
this.socketConnection();
|
|
465
414
|
this.getConfig();
|
|
415
|
+
const w = window;
|
|
416
|
+
if (!w.ai12z)
|
|
417
|
+
w.ai12z = {};
|
|
418
|
+
if (!w.ai12zChat)
|
|
419
|
+
w.ai12zChat = w.ai12z;
|
|
466
420
|
}
|
|
467
421
|
disconnectedCallback() {
|
|
468
422
|
if (this.socket) {
|
|
@@ -651,7 +605,7 @@ const Ai12zKnowledgeBox = class {
|
|
|
651
605
|
}
|
|
652
606
|
render() {
|
|
653
607
|
var _a, _b;
|
|
654
|
-
return (h("div", { key: '
|
|
608
|
+
return (h("div", { key: 'f26a34215a56acd7d3f393a4f0d23727c74ba40a', class: "ai12z-kb-wrapper" }, this.error ? h("p", { class: "ai12z-suggest-error-msg" }, "Error please try again!") : null, this.items.map(item => {
|
|
655
609
|
var _a, _b, _c, _d;
|
|
656
610
|
return (h("div", { class: "prose max-w-none ai12z-suggest-container" }, h("div", null, h("div", null, h("div", { class: "flex flex-row gap-1" }, h("div", { class: "flex items-center gap-2 mb-3", style: { width: "90%" } }, ((_a = this.kbSettings) === null || _a === void 0 ? void 0 : _a.showTitle) && (h("svg", { width: "28", height: "28", viewBox: "0 0 48 48", fill: "currentColor", xmlns: "http://www.w3.org/2000/svg", class: "diamond-icon" + (this.isLoading && !this.finalResponse ? " loading" : "") }, h("path", { d: "M24 2c-3 8-8 13-16 16 8 3 13 8 16 16 3-8 8-13 16-16-8-3-13-8-16-16z" }))), ((_b = this.kbSettings) === null || _b === void 0 ? void 0 : _b.showTitle) && (h("h5", { class: "text-lg font-semibold text-gray-800 m-0" }, !this.finalResponse ? "Generating..." : (_c = this.kbSettings.title) !== null && _c !== void 0 ? _c : "AI Overview"))), item.thumbsUpDown && !this.isLoading && (h("div", null, h("button", { id: `thumbsUp_${item.insightId}`, onClick: () => {
|
|
657
611
|
var _a;
|
|
@@ -672,7 +626,7 @@ const Ai12zKnowledgeBox = class {
|
|
|
672
626
|
questionText: this.question,
|
|
673
627
|
});
|
|
674
628
|
}, class: "chat-thumbs-down", "aria-label": "Thumbs Down" }, h("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", "stroke-width": "1.5", stroke: "currentColor", class: "w-6 h-6" }, h("path", { "stroke-linecap": "round", "stroke-linejoin": "round", d: "M7.498 15.25H4.372c-1.026 0-1.945-.694-2.054-1.715a12.137 12.137 0 0 1-.068-1.285c0-2.848.992-5.464 2.649-7.521C5.287 4.247 5.886 4 6.504 4h4.016a4.5 4.5 0 0 1 1.423.23l3.114 1.04a4.5 4.5 0 0 0 1.423.23h1.294M7.498 15.25c.618 0 .991.724.725 1.282A7.471 7.471 0 0 0 7.5 19.75 2.25 2.25 0 0 0 9.75 22a.75.75 0 0 0 .75-.75v-.633c0-.573.11-1.14.322-1.672.304-.76.93-1.33 1.653-1.715a9.04 9.04 0 0 0 2.86-2.4c.498-.634 1.226-1.08 2.032-1.08h.384m-10.253 1.5H9.7m8.075-9.75c.01.05.027.1.05.148.593 1.2.925 2.55.925 3.977 0 1.487-.36 2.89-.999 4.125m.023-8.25c-.076-.365.183-.75.575-.75h.908c.889 0 1.713.518 1.972 1.368.339 1.11.521 2.287.521 3.507 0 1.553-.295 3.036-.831 4.398-.306.774-1.086 1.227-1.918 1.227h-1.053c-.472 0-.745-.556-.5-.96a8.95 8.95 0 0 0 .303-.54" }))))))), !this.isLoading && (h("div", null, ((_d = this.searchResults) === null || _d === void 0 ? void 0 : _d.controlType) !== "form" && (h("ai12z-chat-message", { id: item.id, text: this.currentStreamingText, kbSettings: this.kbSettings, "show-button": this.showButton, streaming: this.isStreaming && item.id === this.domId })), h("div", { class: { "ai12z-suggest-relevance": true, "ai12z-suggest-hide": !item["isRelevance"] } }, h("a", { href: "" }, item["relevanceScore"])), h("div", { class: "custom-privacy" }, h("slot", { name: "custom-privacy" })))), this.isLoading && (h("div", { class: "w-full rounded-md", id: "spinner" }, h("div", { class: "flex animate-pulse space-x-4" }, h("div", { class: "flex-1 space-y-3 py-1" }, h("div", { class: "h-4 rounded bg-gray-200" }), h("div", { class: "space-y-3" }, h("div", { class: "grid grid-cols-3 gap-4" }, h("div", { class: "col-span-2 h-4 rounded bg-gray-200" }), h("div", { class: "col-span-1 h-4 rounded bg-gray-200" })), h("div", { class: "h-4 rounded bg-gray-200" })))))))));
|
|
675
|
-
}), ((_a = this.kbSettings) === null || _a === void 0 ? void 0 : _a.questionType) === "staticHtml" && this.items.length === 0 && this.welcomeReady && (h("div", { key: '
|
|
629
|
+
}), ((_a = this.kbSettings) === null || _a === void 0 ? void 0 : _a.questionType) === "staticHtml" && this.items.length === 0 && this.welcomeReady && (h("div", { key: '340c562562715563715e5a103019dd19458c994f', class: "ai12z-suggest-answer", innerHTML: (_b = this.kbSettings.welcome) === null || _b === void 0 ? void 0 : _b.message }))));
|
|
676
630
|
}
|
|
677
631
|
static get assetsDirs() { return ["assets"]; }
|
|
678
632
|
get el() { return getElement(this); }
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { r as registerInstance, E as Env, h, d as getElement } from './index-BNpVu1WU.js';
|
|
2
|
-
import {
|
|
2
|
+
import { e as insertStyles, P as search } from './utils-DK_Yhmpx.js';
|
|
3
3
|
import { S as SearchResult } from './SearchResult-zLaEhc3L.js';
|
|
4
4
|
|
|
5
5
|
const ai12zSearchPanelCss = () => `:host{display:block;width:100%;font-family:var(--ai12z-font-family);font-size:var(--ai12z-font-size)}.input-focus-color{border:1px solid var(--ai12z-search-panel-focus-color)}.search-btn-bg-color{background-color:var(--ai12z-search-panel-button-bgcolor)}.input-border{border-bottom:1px solid var(--ai12z-search-panel-input-border-color)}.search-container{background-color:var(--ai12z-search-panel-bg)}.search-icon svg{width:20px;height:20px;color:var(--ai12z-search-panel-icon-color);}.search-input::-moz-placeholder{color:#999}.search-input::placeholder{color:#999}.search-results{width:100%;text-align:left}.cta-search-results{border-top-width:1px;border-bottom-width:0px;border-color:rgb(243 244 246)}.cta-search-results-list{position:relative;padding-bottom:1.25rem;padding-top:1.25rem}.cta-search-results-list:hover{background-color:var(--ai12z-hover-bg-color)}.cta-search-container{margin-left:auto;margin-right:auto;display:flex;max-width:56rem;justify-content:space-between;-moz-column-gap:1.5rem;column-gap:1.5rem}.cta-search-container-two{display:flex;min-width:0px;-moz-column-gap:1rem;column-gap:1rem}.cta-search-container-three{min-width:0px;flex:1 1 auto}.cta-search-text{font-weight:600;line-height:1.5rem;font-size:var(--ai12z-search-result-title-font-size);color:var(--ai12z-search-result-title-color)}.cta-search-text-position{position:absolute;left:0px;right:0px;top:-1px;bottom:0px}.cta-search-description{margin-top:0.25rem;display:flex;font-size:var(--ai12z-search-result-description-font-size);line-height:1rem;line-height:1.25rem;color:var(--ai12z-search-result-description-color)}.cta-search-list-arrow{display:flex;align-items:center;flex-shrink:0;-moz-column-gap:1rem;column-gap:1rem}.custom-icon-width{width:4rem}.results-icon svg{width:1.5rem;height:1.5rem}`;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { r as registerInstance, h, a as createEvent, d as getElement } from './index-BNpVu1WU.js';
|
|
2
|
-
import {
|
|
2
|
+
import { p as sendFeedback, r as removeHtmlTags, m as getAudioContent, q as base64ToBlob, e as insertStyles } from './utils-DK_Yhmpx.js';
|
|
3
3
|
import { t as trackFeedbackAnalytics } from './analyticsService-ChFVg77w.js';
|
|
4
4
|
import { L as Logger, a as LogLevel } from './logger-DUcx64Gz.js';
|
|
5
5
|
|