ai12z 3.7.1-alpha.2 → 3.7.1-alpha.3
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-f536d432.js → ai12z-bot-ef183250.js} +4 -7
- package/dist/cjs/ai12z-bot-ef183250.js.map +1 -0
- package/dist/cjs/ai12z-bot.cjs.entry.js +2 -2
- package/dist/cjs/ai12z-chat_2.cjs.entry.js +1 -1
- package/dist/cjs/{endResponseHelper-aedf327c.js → endResponseHelper-d17497f0.js} +25 -12
- package/dist/cjs/{endResponseHelper-aedf327c.js.map → endResponseHelper-d17497f0.js.map} +1 -1
- package/dist/cjs/index.cjs.js +2 -2
- package/dist/collection/components/ai12z-bot/ai12z-bot.js +2 -5
- package/dist/collection/components/ai12z-bot/ai12z-bot.js.map +1 -1
- package/dist/collection/utils/endResponseHelper.js +24 -11
- package/dist/collection/utils/endResponseHelper.js.map +1 -1
- package/dist/esm/{ai12z-bot-60210b29.js → ai12z-bot-f0e74a1e.js} +4 -7
- package/dist/esm/ai12z-bot-f0e74a1e.js.map +1 -0
- package/dist/esm/ai12z-bot.entry.js +2 -2
- package/dist/esm/ai12z-chat_2.entry.js +1 -1
- package/dist/esm/{endResponseHelper-0a8350cd.js → endResponseHelper-ca69e161.js} +25 -12
- package/dist/esm/{endResponseHelper-0a8350cd.js.map → endResponseHelper-ca69e161.js.map} +1 -1
- package/dist/esm/index.js +2 -2
- package/dist/library/index.esm.js +1 -1
- package/dist/library/library.esm.js +1 -1
- package/dist/library/{p-1a65f5ce.js → p-1d7b52c4.js} +2 -2
- package/dist/library/p-1d7b52c4.js.map +1 -0
- package/dist/library/{p-28b7f8c0.entry.js → p-4119ec5c.entry.js} +2 -2
- package/dist/library/p-86ea805d.entry.js +2 -0
- package/dist/library/{p-a1af8611.js → p-c3c93ba2.js} +2 -2
- package/dist/library/{p-a1af8611.js.map → p-c3c93ba2.js.map} +1 -1
- package/package.json +2 -2
- package/dist/cjs/ai12z-bot-f536d432.js.map +0 -1
- package/dist/esm/ai12z-bot-60210b29.js.map +0 -1
- package/dist/library/p-1a65f5ce.js.map +0 -1
- package/dist/library/p-4626e0e6.entry.js +0 -2
- /package/dist/library/{p-28b7f8c0.entry.js.map → p-4119ec5c.entry.js.map} +0 -0
- /package/dist/library/{p-4626e0e6.entry.js.map → p-86ea805d.entry.js.map} +0 -0
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
const ai12zBot = require('./ai12z-bot-
|
|
5
|
+
const ai12zBot = require('./ai12z-bot-ef183250.js');
|
|
6
6
|
require('./index-171f7ecf.js');
|
|
7
7
|
require('./index-286c64af.js');
|
|
8
8
|
require('./showdown-f472e772.js');
|
|
9
9
|
require('./_commonjsHelpers-b3309d7b.js');
|
|
10
|
-
require('./endResponseHelper-
|
|
10
|
+
require('./endResponseHelper-d17497f0.js');
|
|
11
11
|
require('./utils-c2476e6d.js');
|
|
12
12
|
require('./logger-63779020.js');
|
|
13
13
|
require('./index-a6822246.js');
|
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
const index = require('./index-171f7ecf.js');
|
|
6
6
|
const showdown = require('./showdown-f472e772.js');
|
|
7
|
-
const endResponseHelper = require('./endResponseHelper-
|
|
7
|
+
const endResponseHelper = require('./endResponseHelper-d17497f0.js');
|
|
8
8
|
const utils = require('./utils-c2476e6d.js');
|
|
9
9
|
const index$1 = require('./index-a6822246.js');
|
|
10
10
|
const socketService = require('./socket-service-ab6fc33e.js');
|
|
@@ -58551,7 +58551,6 @@ async function renderSurvey(options) {
|
|
|
58551
58551
|
|
|
58552
58552
|
async function handleEndResponse(params) {
|
|
58553
58553
|
var _a;
|
|
58554
|
-
console.log("Handling end response with params:");
|
|
58555
58554
|
const { data, currentDomId, setMessages, setSurveyDomId, config, setButtons, inputType } = params;
|
|
58556
58555
|
try {
|
|
58557
58556
|
const converter = new showdown.showdown.Converter();
|
|
@@ -58578,7 +58577,6 @@ async function handleEndResponse(params) {
|
|
|
58578
58577
|
}
|
|
58579
58578
|
async function handleControlTypes(finalHtml, data, currentDomId, setMessages, controlMatches, config, setSurveyDomId, inputType) {
|
|
58580
58579
|
if (controlMatches.length === 0) {
|
|
58581
|
-
console.log("No control matches found in the final HTML.");
|
|
58582
58580
|
await handleRegularContent(finalHtml, currentDomId, config);
|
|
58583
58581
|
}
|
|
58584
58582
|
else if (controlMatches.length > 0) {
|
|
@@ -58586,27 +58584,42 @@ async function handleControlTypes(finalHtml, data, currentDomId, setMessages, co
|
|
|
58586
58584
|
await handleMultipleControls(finalHtml, data, currentDomId, setMessages, config, setSurveyDomId, inputType);
|
|
58587
58585
|
}
|
|
58588
58586
|
}
|
|
58589
|
-
async function handleFormControl(
|
|
58587
|
+
async function handleFormControl(data, config, setSurveyDomId, inputType, setMessages, output, currentDomId, index) {
|
|
58590
58588
|
var _a, _b, _c;
|
|
58591
|
-
console.log("Handling form control", currentDomId);
|
|
58592
58589
|
const newSurveyDomId = `surveyElement-${utils.generateUUID()}`;
|
|
58593
58590
|
if (setSurveyDomId) {
|
|
58594
58591
|
setSurveyDomId(newSurveyDomId);
|
|
58595
58592
|
}
|
|
58596
|
-
|
|
58597
|
-
|
|
58593
|
+
let newCtrlMessage;
|
|
58594
|
+
if (index !== 0) {
|
|
58595
|
+
if (inputType === "bot") {
|
|
58596
|
+
// Create new control message
|
|
58597
|
+
newCtrlMessage = utils.generateMessage(config.conversationId);
|
|
58598
|
+
setMessages(newCtrlMessage);
|
|
58599
|
+
}
|
|
58600
|
+
else if (inputType === "cta") {
|
|
58601
|
+
newCtrlMessage = config.getUpdatedChat("", data);
|
|
58602
|
+
setMessages(newCtrlMessage);
|
|
58603
|
+
}
|
|
58604
|
+
// Wait for DOM render
|
|
58605
|
+
await waitForElementRender(`#${newCtrlMessage.id}`, config.element);
|
|
58606
|
+
}
|
|
58607
|
+
const formHtml = `<div id=${newSurveyDomId} style="width:${((_a = config.controlSettings) === null || _a === void 0 ? void 0 : _a.botVersion) === "v1" ? "330px" : "100%"}" class="survey-container"></div>`;
|
|
58608
|
+
(_b = config.updateConversations) === null || _b === void 0 ? void 0 : _b.call(config, formHtml, data);
|
|
58609
|
+
// const formHtml = finalHtml.replace(
|
|
58610
|
+
// RegExp(/\[[^>]*]/gm),
|
|
58611
|
+
// `<div id=${newSurveyDomId} style="width:${config.controlSettings?.botVersion === "v1" ? "330px" : "100%"}" class="survey-container"></div>`
|
|
58612
|
+
// )
|
|
58613
|
+
const element = config.element.shadowRoot.querySelector(`#${index === 0 ? currentDomId : newCtrlMessage.id}`);
|
|
58598
58614
|
if (element) {
|
|
58599
58615
|
element["style"].width = "100%";
|
|
58600
58616
|
element.parentElement["style"].width = "100%";
|
|
58601
58617
|
element.innerHTML = formHtml;
|
|
58602
58618
|
// config.getUpdatedChat?.(formHtml, data)(null)
|
|
58603
|
-
(_b = config.updateConversations) === null || _b === void 0 ? void 0 : _b.call(config, formHtml, data);
|
|
58604
58619
|
// Filter data by agentDataId if available
|
|
58605
58620
|
if (output.agentDataId && ((_c = data.controls) === null || _c === void 0 ? void 0 : _c.length) > 0) {
|
|
58606
58621
|
const filteredItems = data.controls.filter(item => item.agent_data_id === output.agentDataId);
|
|
58607
|
-
console.log("Filtered Items for Form Control:", filteredItems);
|
|
58608
58622
|
data.controlData = filteredItems.length > 0 ? filteredItems[0] : null;
|
|
58609
|
-
console.log(`✅ Filtered ${filteredItems.length} items for agentDataId: ${output.agentDataId}`);
|
|
58610
58623
|
}
|
|
58611
58624
|
}
|
|
58612
58625
|
// Render the survey
|
|
@@ -58647,10 +58660,9 @@ async function handleMultipleControls(finalHtml, data, currentDomId, setMessages
|
|
|
58647
58660
|
}
|
|
58648
58661
|
}
|
|
58649
58662
|
if (output.type === 'control' && output.controlType) {
|
|
58650
|
-
console.log(`Processing control of type: ${output.controlType}`);
|
|
58651
58663
|
switch (output.controlType) {
|
|
58652
58664
|
case "form":
|
|
58653
|
-
await handleFormControl(
|
|
58665
|
+
await handleFormControl(data, config, setSurveyDomId, inputType, setMessages, output, currentDomId, index);
|
|
58654
58666
|
break;
|
|
58655
58667
|
case "carousel":
|
|
58656
58668
|
case "list":
|
|
@@ -58717,6 +58729,7 @@ async function handleRegularContent(finalHtml, currentDomId, config) {
|
|
|
58717
58729
|
element.innerHTML = finalHtml;
|
|
58718
58730
|
config.checkHighlightcode(currentDomId);
|
|
58719
58731
|
(_a = config.updateConversations) === null || _a === void 0 ? void 0 : _a.call(config, finalHtml, {});
|
|
58732
|
+
config.addEventListeners(`#${currentDomId}`);
|
|
58720
58733
|
}
|
|
58721
58734
|
}
|
|
58722
58735
|
// Helper function to wait for element to render
|
|
@@ -58741,4 +58754,4 @@ exports.hljs = hljs$1;
|
|
|
58741
58754
|
exports.processChatData = processChatData;
|
|
58742
58755
|
exports.renderSurvey = renderSurvey;
|
|
58743
58756
|
|
|
58744
|
-
//# sourceMappingURL=endResponseHelper-
|
|
58757
|
+
//# sourceMappingURL=endResponseHelper-d17497f0.js.map
|