ai12z 3.17.2 → 3.18.1-alpha.0
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-beacon.cjs.entry.js +2 -2
- package/dist/cjs/ai12z-bot.cjs.entry.js +100 -13
- package/dist/cjs/ai12z-category_2.cjs.entry.js +3 -3
- package/dist/cjs/ai12z-chat-message.cjs.entry.js +3 -3
- package/dist/cjs/ai12z-chat_2.cjs.entry.js +10 -10
- package/dist/cjs/ai12z-container.cjs.entry.js +4 -4
- package/dist/cjs/ai12z-cta.cjs.entry.js +5 -5
- package/dist/cjs/ai12z-form.cjs.entry.js +2 -2
- package/dist/cjs/ai12z-inline-search.cjs.entry.js +2 -2
- package/dist/cjs/ai12z-knowledge-box.cjs.entry.js +7 -7
- package/dist/cjs/ai12z-search-panel.cjs.entry.js +1 -1
- package/dist/cjs/{beacon-BfQLEgoi.js → beacon-JlWjtnTj.js} +1 -1
- package/dist/cjs/{botHelpers-CKQb1s6M.js → botHelpers-AxnPKelf.js} +7 -0
- package/dist/cjs/chat-avatar_6.cjs.entry.js +1 -1
- package/dist/cjs/{ctaHelpers-CdztrD6A.js → ctaHelpers-DUkpEv0V.js} +1 -1
- package/dist/cjs/dynamic-form.cjs.entry.js +1 -1
- package/dist/cjs/{index-B6xfVjPU.js → index-DrVymXMa.js} +1 -1
- package/dist/cjs/index.cjs.js +12 -12
- package/dist/cjs/item-list.cjs.entry.js +2 -2
- package/dist/cjs/{keyboard-shortcuts-CBUd9KfQ.js → keyboard-shortcuts-g_HyNYT-.js} +2 -2
- package/dist/cjs/library.cjs.js +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/{parseHelper-BvuQUuJ4.js → parseHelper-CNiHFgWF.js} +1 -1
- package/dist/cjs/{processCarouselData-BXglENd8.js → processCarouselData-BPxsH6Ck.js} +1 -1
- package/dist/cjs/{reCaptchaHelpers-DIDQT22p.js → reCaptchaHelpers-C8v6BB6z.js} +1 -1
- package/dist/cjs/search-results-page.cjs.entry.js +5 -5
- package/dist/cjs/{socket-service-Z-_NrATj.js → socket-service-Bcv9pRTP.js} +1 -1
- package/dist/cjs/{styleSheetRegistry-kcL2qS1d.js → styleSheetRegistry-Cv84KUXj.js} +1 -1
- package/dist/cjs/{surveyHelpers-B9t5lxy4.js → surveyHelpers-DpChOjp8.js} +1 -1
- package/dist/cjs/{utils-DZMolZh2.js → utils-kaVdO3ki.js} +23 -1
- package/dist/collection/components/ai12z-bot/ai12z-bot.js +113 -6
- package/dist/collection/utils/botHelpers/botHelpers.js +6 -0
- package/dist/collection/utils/utils.js +22 -1
- package/dist/components/ai12z-beacon.js +1 -1
- 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-dG64_Rr_.js → p-B12AFpEW.js} +1 -1
- package/dist/components/{p-jdVWMDxz.js → p-BCSUz8VU.js} +1 -1
- package/dist/components/{p-M51H23z5.js → p-BbcOl4b9.js} +1 -1
- package/dist/components/p-BcMpGTRl.js +1 -0
- package/dist/components/{p-BO_7DTeV.js → p-BeHgjKno.js} +1 -1
- package/dist/components/{p-D338smYm.js → p-BeQb-NnR.js} +1 -1
- package/dist/components/p-BicP0-s0.js +1 -0
- package/dist/components/{p-B7Ac5jb8.js → p-BwPrqQp6.js} +1 -1
- package/dist/components/{p-BLKO6yGt.js → p-C0jem-ly.js} +1 -1
- package/dist/components/{p-C4oEgA5E.js → p-CB1q68t3.js} +1 -1
- package/dist/components/{p-BJOnT4k4.js → p-C_JPcL6x.js} +1 -1
- package/dist/components/{p-CTvP5Cqt.js → p-CaFmjtsi.js} +1 -1
- package/dist/components/p-Ce6pOFBE.js +1 -0
- package/dist/{library/p-DsLiOXw0.js → components/p-Cq4AwCwr.js} +1 -1
- package/dist/components/{p-Rn8Rp9Oa.js → p-DEz3XSJ-.js} +1 -1
- package/dist/components/p-DKR021JM.js +1 -0
- package/dist/components/p-DPKJirdj.js +1 -0
- package/dist/components/{p-DM33B5uU.js → p-D_3qXJcI.js} +1 -1
- package/dist/components/{p-D1NOmiJo.js → p-DfKwQvja.js} +1 -1
- package/dist/components/{p-CFedR60q.js → p-Dj7c4LRG.js} +1 -1
- package/dist/components/{p-CNxI_jB-.js → p-Dp7_8HKH.js} +1 -1
- package/dist/components/{p-BqU2KPcS.js → p-RfWHp6O2.js} +1 -1
- package/dist/components/p-o0KfLH-y.js +31 -0
- package/dist/components/{p-BswGpAXe.js → p-vXHMCBxR.js} +1 -1
- package/dist/components/privacy-modal.js +1 -1
- package/dist/components/search-results-page.js +1 -1
- package/dist/esm/ai12z-beacon.entry.js +2 -2
- package/dist/esm/ai12z-bot.entry.js +100 -13
- package/dist/esm/ai12z-category_2.entry.js +3 -3
- package/dist/esm/ai12z-chat-message.entry.js +3 -3
- package/dist/esm/ai12z-chat_2.entry.js +10 -10
- package/dist/esm/ai12z-container.entry.js +4 -4
- package/dist/esm/ai12z-cta.entry.js +5 -5
- 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 +7 -7
- package/dist/esm/ai12z-search-panel.entry.js +1 -1
- package/dist/esm/{beacon-C0Ad7xGT.js → beacon-CCcNZqoa.js} +1 -1
- package/dist/esm/{botHelpers-DsLiOXw0.js → botHelpers-CE9IBQYw.js} +7 -1
- package/dist/esm/chat-avatar_6.entry.js +1 -1
- package/dist/esm/{ctaHelpers-BR4Wkzb6.js → ctaHelpers-CT2ErlJl.js} +1 -1
- package/dist/esm/dynamic-form.entry.js +1 -1
- package/dist/esm/{index-iGNmMrHg.js → index-DUiyv997.js} +1 -1
- package/dist/esm/index.js +12 -12
- package/dist/esm/item-list.entry.js +2 -2
- package/dist/esm/{keyboard-shortcuts-Cak0eDzv.js → keyboard-shortcuts-aKnwuXq8.js} +2 -2
- package/dist/esm/library.js +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/esm/{parseHelper-C_LKn-sc.js → parseHelper-C0fbw-JE.js} +1 -1
- package/dist/esm/{processCarouselData-B7i3efGJ.js → processCarouselData-QBQI4AFj.js} +1 -1
- package/dist/esm/{reCaptchaHelpers-DEmc4GB4.js → reCaptchaHelpers-cGrPI_7D.js} +1 -1
- package/dist/esm/search-results-page.entry.js +5 -5
- package/dist/esm/{socket-service-F6OgCDGw.js → socket-service-CM_mMRg5.js} +1 -1
- package/dist/esm/{styleSheetRegistry-Cc4gpdwH.js → styleSheetRegistry-B-PmRS4D.js} +1 -1
- package/dist/esm/{surveyHelpers-r2cdPqIu.js → surveyHelpers-BUZmHEX3.js} +1 -1
- package/dist/esm/{utils-H9mScQCk.js → utils-D3nP2AJo.js} +23 -2
- package/dist/library/index.esm.js +1 -1
- package/dist/library/library.esm.js +1 -1
- package/dist/library/{p-26ae3f92.entry.js → p-03149eb5.entry.js} +1 -1
- package/dist/library/p-06d0815f.entry.js +1 -0
- package/dist/library/{p-f0da6325.entry.js → p-1f8b0fbc.entry.js} +1 -1
- package/dist/library/{p-acaf89a9.entry.js → p-337a0c14.entry.js} +1 -1
- package/dist/library/{p-011b77dd.entry.js → p-373ee8b7.entry.js} +1 -1
- package/dist/library/{p-c580c2ec.entry.js → p-45cd9109.entry.js} +1 -1
- package/dist/library/{p-399cbd12.entry.js → p-54dbd259.entry.js} +1 -1
- package/dist/library/{p-cee8f0d9.entry.js → p-737bda98.entry.js} +1 -1
- package/dist/library/{p-3fc2b8d9.entry.js → p-93ff1644.entry.js} +1 -1
- package/dist/library/{p-61d61d51.entry.js → p-98a862a9.entry.js} +1 -1
- package/dist/library/{p-27e7129a.entry.js → p-9a040257.entry.js} +1 -1
- package/dist/library/{p-9AKYJrv1.js → p-B2dL-v75.js} +1 -1
- package/dist/library/{p-B6xjvrgl.js → p-C2ldkXu_.js} +1 -1
- package/dist/library/{p-9aFvbubk.js → p-CDW50yj6.js} +1 -1
- package/dist/{components/p-CC6xbinS.js → library/p-CE9IBQYw.js} +1 -1
- package/dist/library/{p-C2x1hKSJ.js → p-CJ4MotJl.js} +1 -1
- package/dist/library/{p-B2BmbdIq.js → p-D1m3N8c7.js} +1 -1
- package/dist/library/{p-BD0OHkts.js → p-Dd_HpGgX.js} +2 -2
- package/dist/library/p-DmAaiJIq.js +1 -0
- package/dist/library/{p-DQtdNy5d.js → p-EFsTeS2j.js} +1 -1
- package/dist/library/{p-C7iZqaK3.js → p-PFgBCUAH.js} +1 -1
- package/dist/library/{p-8421d322.entry.js → p-a007abdf.entry.js} +1 -1
- package/dist/library/{p-901079eb.entry.js → p-cfbe4ffd.entry.js} +1 -1
- package/dist/library/{p-5d06fa91.entry.js → p-e3879503.entry.js} +1 -1
- package/dist/library/{p-DNiRApIn.js → p-eXNri847.js} +1 -1
- package/dist/library/{p-cc717ebf.entry.js → p-f2e28f1b.entry.js} +1 -1
- package/dist/library/{p-uabJ4_3U.js → p-nuQI4tUs.js} +1 -1
- package/dist/types/components/ai12z-bot/ai12z-bot.d.ts +6 -0
- package/dist/types/components.d.ts +2 -0
- package/dist/types/utils/botHelpers/botHelpers.d.ts +1 -0
- package/dist/types/utils/utils.d.ts +5 -0
- package/package.json +2 -2
- package/dist/components/p-BLStO0nm.js +0 -1
- package/dist/components/p-BVEbp8i6.js +0 -1
- package/dist/components/p-BqsAwiBV.js +0 -1
- package/dist/components/p-C0ycOUZ8.js +0 -1
- package/dist/components/p-CdRaSl47.js +0 -1
- package/dist/components/p-djQQf6su.js +0 -31
- package/dist/library/p-CKY1nbED.js +0 -1
- package/dist/library/p-d70f0bde.entry.js +0 -1
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var index = require('./index-v8T1EJAJ.js');
|
|
4
|
-
var beacon = require('./beacon-
|
|
5
|
-
require('./utils-
|
|
4
|
+
var beacon = require('./beacon-JlWjtnTj.js');
|
|
5
|
+
require('./utils-kaVdO3ki.js');
|
|
6
6
|
|
|
7
7
|
const Ai12zBeacon = class {
|
|
8
8
|
constructor(hostRef) {
|
|
@@ -2,20 +2,20 @@
|
|
|
2
2
|
|
|
3
3
|
var index = require('./index-v8T1EJAJ.js');
|
|
4
4
|
var responseAdapter = require('./response-adapter-BSZc0N1k.js');
|
|
5
|
-
var processCarouselData = require('./processCarouselData-
|
|
5
|
+
var processCarouselData = require('./processCarouselData-BPxsH6Ck.js');
|
|
6
6
|
var logger$2 = require('./logger-D--BUQGx.js');
|
|
7
|
-
var utils = require('./utils-
|
|
8
|
-
var index$1 = require('./index-
|
|
7
|
+
var utils = require('./utils-kaVdO3ki.js');
|
|
8
|
+
var index$1 = require('./index-DrVymXMa.js');
|
|
9
9
|
var globalStore = require('./global-store-R6x06KvJ.js');
|
|
10
|
-
var reCaptchaHelpers = require('./reCaptchaHelpers-
|
|
11
|
-
var botHelpers = require('./botHelpers-
|
|
12
|
-
var surveyHelpers = require('./surveyHelpers-
|
|
10
|
+
var reCaptchaHelpers = require('./reCaptchaHelpers-C8v6BB6z.js');
|
|
11
|
+
var botHelpers = require('./botHelpers-AxnPKelf.js');
|
|
12
|
+
var surveyHelpers = require('./surveyHelpers-DpChOjp8.js');
|
|
13
13
|
var scriptStyleLoader = require('./scriptStyleLoader-D-bqKqSb.js');
|
|
14
|
-
var keyboardShortcuts = require('./keyboard-shortcuts-
|
|
15
|
-
var ctaHelpers = require('./ctaHelpers-
|
|
14
|
+
var keyboardShortcuts = require('./keyboard-shortcuts-g_HyNYT-.js');
|
|
15
|
+
var ctaHelpers = require('./ctaHelpers-DUkpEv0V.js');
|
|
16
16
|
var appStore = require('./app-store-BtkiHvcw.js');
|
|
17
|
-
var parseHelper = require('./parseHelper-
|
|
18
|
-
var beacon = require('./beacon-
|
|
17
|
+
var parseHelper = require('./parseHelper-CNiHFgWF.js');
|
|
18
|
+
var beacon = require('./beacon-JlWjtnTj.js');
|
|
19
19
|
var bodyScrollLock = require('./bodyScrollLock-C7gKTAfx.js');
|
|
20
20
|
require('./_commonjsHelpers-MBWFX2dn.js');
|
|
21
21
|
|
|
@@ -1093,6 +1093,7 @@ const Ai12zBot = class {
|
|
|
1093
1093
|
// private originalTitle: string = document.title
|
|
1094
1094
|
this.unreadCount = 0;
|
|
1095
1095
|
this.hasPersistedConversationId = false;
|
|
1096
|
+
this.tokenExpiresAtMs = null;
|
|
1096
1097
|
this.liveAgentButtonText = "Talk to a Live Agent";
|
|
1097
1098
|
this.isLiveAgentEnabled = false;
|
|
1098
1099
|
this.isTypingIndicatorVisible = false;
|
|
@@ -1148,6 +1149,7 @@ const Ai12zBot = class {
|
|
|
1148
1149
|
this.liveAgentListenersRegistered = false;
|
|
1149
1150
|
this.shortcuts = keyboardShortcuts.DEFAULT_SHORTCUTS;
|
|
1150
1151
|
this.announceMessage = ""; // For accessibility announcements
|
|
1152
|
+
this.token = "";
|
|
1151
1153
|
this.messageRefs = [];
|
|
1152
1154
|
// Replace your existing handlePaste method with this enhanced version
|
|
1153
1155
|
this.handlePaste = (event) => {
|
|
@@ -1262,11 +1264,19 @@ const Ai12zBot = class {
|
|
|
1262
1264
|
this.handleSend = async (eleValue, options = {}) => {
|
|
1263
1265
|
var _a, _b;
|
|
1264
1266
|
const { isHide = false, isLiveChatEnded = false } = options;
|
|
1265
|
-
const
|
|
1267
|
+
const queryText = typeof this.query === "string" ? this.query.trim() : "";
|
|
1268
|
+
const displayText = typeof eleValue === "string" ? eleValue.trim() : "";
|
|
1269
|
+
const inputText = ((_a = this.inputEl) === null || _a === void 0 ? void 0 : _a.value.trim()) || "";
|
|
1270
|
+
const resolvedQuery = queryText || displayText || inputText;
|
|
1271
|
+
const resolvedDisplayText = displayText || (!isHide ? resolvedQuery : "");
|
|
1266
1272
|
if (!resolvedQuery && this.imagesBase64List.length === 0) {
|
|
1267
1273
|
this.showEmptyMessageValidation();
|
|
1268
1274
|
return;
|
|
1269
1275
|
}
|
|
1276
|
+
if (!isHide && !resolvedDisplayText && this.imagesBase64List.length === 0) {
|
|
1277
|
+
this.showEmptyMessageValidation();
|
|
1278
|
+
return;
|
|
1279
|
+
}
|
|
1270
1280
|
this.emptyMessageError = false;
|
|
1271
1281
|
this.surveyDomId = "";
|
|
1272
1282
|
this.announce("Message sent successfully");
|
|
@@ -1274,7 +1284,7 @@ const Ai12zBot = class {
|
|
|
1274
1284
|
this.questionCounter = this.questionCounter + 1;
|
|
1275
1285
|
localStorage.setItem(`ai12z-bot-data`, JSON.stringify({ qCounter: this.questionCounter }));
|
|
1276
1286
|
}
|
|
1277
|
-
const inputValue =
|
|
1287
|
+
const inputValue = resolvedDisplayText;
|
|
1278
1288
|
if (this.inputEl) {
|
|
1279
1289
|
this.inputEl.value = inputValue;
|
|
1280
1290
|
}
|
|
@@ -1808,6 +1818,14 @@ const Ai12zBot = class {
|
|
|
1808
1818
|
this.botSettings = Object.assign(Object.assign({}, this.botSettings), settings);
|
|
1809
1819
|
}
|
|
1810
1820
|
async componentWillLoad() {
|
|
1821
|
+
if (this.botType === "geobot") {
|
|
1822
|
+
const sessionData = await utils.validateSession(this.dataMode);
|
|
1823
|
+
if (!(sessionData === null || sessionData === void 0 ? void 0 : sessionData.authenticated)) {
|
|
1824
|
+
this.canRender = false;
|
|
1825
|
+
return;
|
|
1826
|
+
}
|
|
1827
|
+
this.updateGeobotSession(sessionData);
|
|
1828
|
+
}
|
|
1811
1829
|
this.canRender = await utils.checkStatus(this.dataKey, this.dataMode);
|
|
1812
1830
|
this.checkCustomSlot();
|
|
1813
1831
|
this.timestamp = utils.formatTimestamp(new Date());
|
|
@@ -2106,6 +2124,7 @@ const Ai12zBot = class {
|
|
|
2106
2124
|
apiKey: this.dataKey,
|
|
2107
2125
|
configId: this.configId,
|
|
2108
2126
|
configType: "bot",
|
|
2127
|
+
botType: this.botType,
|
|
2109
2128
|
};
|
|
2110
2129
|
try {
|
|
2111
2130
|
const data = await utils.getConfig(payload, this.dataMode);
|
|
@@ -2551,11 +2570,52 @@ const Ai12zBot = class {
|
|
|
2551
2570
|
});
|
|
2552
2571
|
}
|
|
2553
2572
|
}
|
|
2573
|
+
handleGeobotSessionError(message, code) {
|
|
2574
|
+
this.errorMessage = message;
|
|
2575
|
+
this.showErrorMessage = true;
|
|
2576
|
+
this.announce(message);
|
|
2577
|
+
this.errored.emit({ message, code });
|
|
2578
|
+
}
|
|
2579
|
+
updateGeobotSession(sessionData) {
|
|
2580
|
+
var _a, _b;
|
|
2581
|
+
this.token = (_a = sessionData === null || sessionData === void 0 ? void 0 : sessionData.token) !== null && _a !== void 0 ? _a : "";
|
|
2582
|
+
this.tokenExpiresAtMs = (_b = sessionData === null || sessionData === void 0 ? void 0 : sessionData.expires_at) !== null && _b !== void 0 ? _b : null;
|
|
2583
|
+
}
|
|
2584
|
+
async ensureFreshGeobotToken() {
|
|
2585
|
+
if (this.botType !== "geobot") {
|
|
2586
|
+
return true;
|
|
2587
|
+
}
|
|
2588
|
+
if (this.token && !botHelpers.isTokenExpired(this.token, this.tokenExpiresAtMs)) {
|
|
2589
|
+
return true;
|
|
2590
|
+
}
|
|
2591
|
+
const sessionData = await utils.validateSession(this.dataMode);
|
|
2592
|
+
if (!(sessionData === null || sessionData === void 0 ? void 0 : sessionData.authenticated) || !(sessionData === null || sessionData === void 0 ? void 0 : sessionData.token)) {
|
|
2593
|
+
this.updateGeobotSession();
|
|
2594
|
+
this.handleGeobotSessionError("Your session has expired. Please sign in again to continue.", "SESSION_EXPIRED");
|
|
2595
|
+
return false;
|
|
2596
|
+
}
|
|
2597
|
+
this.updateGeobotSession(sessionData);
|
|
2598
|
+
return true;
|
|
2599
|
+
}
|
|
2554
2600
|
async socketConnection() {
|
|
2555
2601
|
const protocol = utils.getBackendProtocol(this.dataMode);
|
|
2556
2602
|
let a12z_EndPoint = utils.getEndpoint(this.dataMode);
|
|
2557
2603
|
this.socket = responseAdapter.lookup(a12z_EndPoint, {
|
|
2558
2604
|
transports: protocol === "v2" ? ["websocket", "polling"] : ["polling"],
|
|
2605
|
+
auth: async (cb) => {
|
|
2606
|
+
const valid = await this.ensureFreshGeobotToken();
|
|
2607
|
+
if (!valid) {
|
|
2608
|
+
cb({
|
|
2609
|
+
bot_type: this.botType,
|
|
2610
|
+
token: undefined,
|
|
2611
|
+
});
|
|
2612
|
+
return;
|
|
2613
|
+
}
|
|
2614
|
+
cb({
|
|
2615
|
+
bot_type: this.botType,
|
|
2616
|
+
token: this.token,
|
|
2617
|
+
});
|
|
2618
|
+
},
|
|
2559
2619
|
});
|
|
2560
2620
|
await new Promise((resolve, reject) => {
|
|
2561
2621
|
let settled = false;
|
|
@@ -2616,6 +2676,33 @@ const Ai12zBot = class {
|
|
|
2616
2676
|
this.announce("Unable to connect to chat server. Please try again.");
|
|
2617
2677
|
console.error("Connection error:", error);
|
|
2618
2678
|
});
|
|
2679
|
+
this.socket.on("error", error => {
|
|
2680
|
+
const errorMessage = "Sorry, Something went wrong. Please try again.";
|
|
2681
|
+
const lastMessage = this.messages[this.messages.length - 1];
|
|
2682
|
+
this.errored.emit(error);
|
|
2683
|
+
this.announce("An error occurred with the chat server. Please try again.");
|
|
2684
|
+
console.error("Socket error:", error);
|
|
2685
|
+
this.isStreaming = false;
|
|
2686
|
+
if (lastMessage === null || lastMessage === void 0 ? void 0 : lastMessage.isLoading) {
|
|
2687
|
+
lastMessage.text = errorMessage;
|
|
2688
|
+
lastMessage.isLoading = false;
|
|
2689
|
+
this.messages = [...this.messages];
|
|
2690
|
+
return;
|
|
2691
|
+
}
|
|
2692
|
+
// If the last message was not loading, optionally handle the error differently
|
|
2693
|
+
this.messages = [...this.messages, {
|
|
2694
|
+
text: errorMessage,
|
|
2695
|
+
isUser: false,
|
|
2696
|
+
id: `chatbot-${utils.generateUUID()}`,
|
|
2697
|
+
timestamp: "",
|
|
2698
|
+
isLoading: false,
|
|
2699
|
+
images: [],
|
|
2700
|
+
conversationId: this.conversationId,
|
|
2701
|
+
formModel: {},
|
|
2702
|
+
surveyDomId: "",
|
|
2703
|
+
}
|
|
2704
|
+
];
|
|
2705
|
+
});
|
|
2619
2706
|
this.socket.on("disconnect", () => {
|
|
2620
2707
|
// console.log("Disconnected from Socket.IO server")
|
|
2621
2708
|
this.socket.off("response");
|
|
@@ -2631,7 +2718,7 @@ const Ai12zBot = class {
|
|
|
2631
2718
|
if (protocol === "v2") {
|
|
2632
2719
|
eventName = "query";
|
|
2633
2720
|
const beaconId = sessionStorage.getItem("ai12zBeaconId");
|
|
2634
|
-
data = Object.assign({ query: this.query !== "" ? this.query : this.inputEl.value, conversation_id: this.conversationId || "", base64_images: ((_a = this.imagesBase64List) === null || _a === void 0 ? void 0 : _a.length) > 0 ? this.imagesBase64List : undefined, beacon_id: this.botSettings.disableBeacon ? "" : beaconId !== null && beaconId !== void 0 ? beaconId : "" }, (this.botSettings.disableBeacon || beaconId ? {} : { beacon_data: beacon.buildBeacon() }));
|
|
2721
|
+
data = Object.assign({ query: this.query !== "" ? this.query : this.inputEl.value, botType: this.botType, conversation_id: this.conversationId || "", base64_images: ((_a = this.imagesBase64List) === null || _a === void 0 ? void 0 : _a.length) > 0 ? this.imagesBase64List : undefined, beacon_id: this.botSettings.disableBeacon ? "" : beaconId !== null && beaconId !== void 0 ? beaconId : "" }, (this.botSettings.disableBeacon || beaconId ? {} : { beacon_data: beacon.buildBeacon() }));
|
|
2635
2722
|
}
|
|
2636
2723
|
else {
|
|
2637
2724
|
eventName = "evaluate_query";
|
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
var index = require('./index-v8T1EJAJ.js');
|
|
4
4
|
var SearchResult = require('./SearchResult-CvTJr55G.js');
|
|
5
|
-
var utils = require('./utils-
|
|
5
|
+
var utils = require('./utils-kaVdO3ki.js');
|
|
6
6
|
var _commonjsHelpers = require('./_commonjsHelpers-MBWFX2dn.js');
|
|
7
7
|
var appStore = require('./app-store-BtkiHvcw.js');
|
|
8
|
-
var parseHelper = require('./parseHelper-
|
|
9
|
-
require('./ctaHelpers-
|
|
8
|
+
var parseHelper = require('./parseHelper-CNiHFgWF.js');
|
|
9
|
+
require('./ctaHelpers-DUkpEv0V.js');
|
|
10
10
|
require('./logger-D--BUQGx.js');
|
|
11
11
|
|
|
12
12
|
const categoryCss = () => `ai12z-category{font-family:var(--ai12z-font-family) !important;font-size:var(--ai12z-search-font-size, var(--ai12z-font-size)) !important}.custom-title{font-size:var(--ai12z-category-font-size);color:var(--ai12z-category-font-color)}`;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var index = require('./index-v8T1EJAJ.js');
|
|
4
|
-
var botHelpers = require('./botHelpers-
|
|
5
|
-
var styleSheetRegistry = require('./styleSheetRegistry-
|
|
6
|
-
require('./utils-
|
|
4
|
+
var botHelpers = require('./botHelpers-AxnPKelf.js');
|
|
5
|
+
var styleSheetRegistry = require('./styleSheetRegistry-Cv84KUXj.js');
|
|
6
|
+
require('./utils-kaVdO3ki.js');
|
|
7
7
|
|
|
8
8
|
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}`;
|
|
9
9
|
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var index = require('./index-v8T1EJAJ.js');
|
|
4
|
-
var processCarouselData = require('./processCarouselData-
|
|
5
|
-
var parseHelper = require('./parseHelper-
|
|
6
|
-
var utils = require('./utils-
|
|
7
|
-
var ctaHelpers = require('./ctaHelpers-
|
|
8
|
-
var index$1 = require('./index-
|
|
9
|
-
var socketService = require('./socket-service-
|
|
10
|
-
var surveyHelpers = require('./surveyHelpers-
|
|
11
|
-
var keyboardShortcuts = require('./keyboard-shortcuts-
|
|
4
|
+
var processCarouselData = require('./processCarouselData-BPxsH6Ck.js');
|
|
5
|
+
var parseHelper = require('./parseHelper-CNiHFgWF.js');
|
|
6
|
+
var utils = require('./utils-kaVdO3ki.js');
|
|
7
|
+
var ctaHelpers = require('./ctaHelpers-DUkpEv0V.js');
|
|
8
|
+
var index$1 = require('./index-DrVymXMa.js');
|
|
9
|
+
var socketService = require('./socket-service-Bcv9pRTP.js');
|
|
10
|
+
var surveyHelpers = require('./surveyHelpers-DpChOjp8.js');
|
|
11
|
+
var keyboardShortcuts = require('./keyboard-shortcuts-g_HyNYT-.js');
|
|
12
12
|
var analyticsService = require('./analyticsService-CkAva47S.js');
|
|
13
|
-
var botHelpers = require('./botHelpers-
|
|
14
|
-
var beacon = require('./beacon-
|
|
13
|
+
var botHelpers = require('./botHelpers-AxnPKelf.js');
|
|
14
|
+
var beacon = require('./beacon-JlWjtnTj.js');
|
|
15
15
|
require('./_commonjsHelpers-MBWFX2dn.js');
|
|
16
16
|
require('./logger-D--BUQGx.js');
|
|
17
17
|
require('./response-adapter-BSZc0N1k.js');
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var index = require('./index-v8T1EJAJ.js');
|
|
4
|
-
var utils = require('./utils-
|
|
5
|
-
var processCarouselData = require('./processCarouselData-
|
|
6
|
-
var botHelpers = require('./botHelpers-
|
|
7
|
-
var index$1 = require('./index-
|
|
4
|
+
var utils = require('./utils-kaVdO3ki.js');
|
|
5
|
+
var processCarouselData = require('./processCarouselData-BPxsH6Ck.js');
|
|
6
|
+
var botHelpers = require('./botHelpers-AxnPKelf.js');
|
|
7
|
+
var index$1 = require('./index-DrVymXMa.js');
|
|
8
8
|
var purify_es = require('./purify.es-B7Ashs9w.js');
|
|
9
9
|
require('./_commonjsHelpers-MBWFX2dn.js');
|
|
10
10
|
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var index = require('./index-v8T1EJAJ.js');
|
|
4
|
-
var utils = require('./utils-
|
|
4
|
+
var utils = require('./utils-kaVdO3ki.js');
|
|
5
5
|
var SearchResult = require('./SearchResult-CvTJr55G.js');
|
|
6
|
-
var socketService = require('./socket-service-
|
|
6
|
+
var socketService = require('./socket-service-Bcv9pRTP.js');
|
|
7
7
|
var globalStore = require('./global-store-R6x06KvJ.js');
|
|
8
|
-
var reCaptchaHelpers = require('./reCaptchaHelpers-
|
|
9
|
-
var ctaHelpers = require('./ctaHelpers-
|
|
10
|
-
var beacon = require('./beacon-
|
|
8
|
+
var reCaptchaHelpers = require('./reCaptchaHelpers-C8v6BB6z.js');
|
|
9
|
+
var ctaHelpers = require('./ctaHelpers-DUkpEv0V.js');
|
|
10
|
+
var beacon = require('./beacon-JlWjtnTj.js');
|
|
11
11
|
var appStore = require('./app-store-BtkiHvcw.js');
|
|
12
12
|
var bodyScrollLock = require('./bodyScrollLock-C7gKTAfx.js');
|
|
13
13
|
var purify_es = require('./purify.es-B7Ashs9w.js');
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var index = require('./index-v8T1EJAJ.js');
|
|
4
|
-
var utils = require('./utils-
|
|
5
|
-
var surveyHelpers = require('./surveyHelpers-
|
|
4
|
+
var utils = require('./utils-kaVdO3ki.js');
|
|
5
|
+
var surveyHelpers = require('./surveyHelpers-DpChOjp8.js');
|
|
6
6
|
var scriptStyleLoader = require('./scriptStyleLoader-D-bqKqSb.js');
|
|
7
7
|
|
|
8
8
|
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,9 +1,9 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var index = require('./index-v8T1EJAJ.js');
|
|
4
|
-
var utils = require('./utils-
|
|
4
|
+
var utils = require('./utils-kaVdO3ki.js');
|
|
5
5
|
var SearchResult = require('./SearchResult-CvTJr55G.js');
|
|
6
|
-
var socketService = require('./socket-service-
|
|
6
|
+
var socketService = require('./socket-service-Bcv9pRTP.js');
|
|
7
7
|
require('./response-adapter-BSZc0N1k.js');
|
|
8
8
|
|
|
9
9
|
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,16 +1,16 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var index = require('./index-v8T1EJAJ.js');
|
|
4
|
-
var utils = require('./utils-
|
|
5
|
-
var styleSheetRegistry = require('./styleSheetRegistry-
|
|
4
|
+
var utils = require('./utils-kaVdO3ki.js');
|
|
5
|
+
var styleSheetRegistry = require('./styleSheetRegistry-Cv84KUXj.js');
|
|
6
6
|
var responseAdapter = require('./response-adapter-BSZc0N1k.js');
|
|
7
|
-
var processCarouselData = require('./processCarouselData-
|
|
7
|
+
var processCarouselData = require('./processCarouselData-BPxsH6Ck.js');
|
|
8
8
|
var globalStore = require('./global-store-R6x06KvJ.js');
|
|
9
|
-
var index$1 = require('./index-
|
|
10
|
-
var surveyHelpers = require('./surveyHelpers-
|
|
11
|
-
var botHelpers = require('./botHelpers-
|
|
9
|
+
var index$1 = require('./index-DrVymXMa.js');
|
|
10
|
+
var surveyHelpers = require('./surveyHelpers-DpChOjp8.js');
|
|
11
|
+
var botHelpers = require('./botHelpers-AxnPKelf.js');
|
|
12
12
|
var analyticsService = require('./analyticsService-CkAva47S.js');
|
|
13
|
-
var beacon = require('./beacon-
|
|
13
|
+
var beacon = require('./beacon-JlWjtnTj.js');
|
|
14
14
|
require('./_commonjsHelpers-MBWFX2dn.js');
|
|
15
15
|
|
|
16
16
|
const ai12zKnowledgeBoxCss = () => `:host{font-family:var(--ai12z-knowledge-box-font-family) !important;font-size:var(--ai12z-knowledge-box-font-size) !important;color:var(--ai12z-knowledge-box-font-color, black);text-align:var(--ai12z-knowledge-box-text-align, left)}.ai12z-kb-wrapper{background-color:var(--ai12z-knowledge-box-bg-color)}.ai12z-suggest-container{padding:32px 32px 32px 32px;flex:none}.ai12z-suggest-answer{font-size:var(--ai12z-knowledge-box-font-size)}.ai12z-suggest-title{font-weight:700}.ai12z-suggest-align{float:left}.ai12z-suggest-relevance{text-align:end}.ai12z-suggest-error-msg{color:rgb(239 68 68)}.ai12z-suggest-hide{display:none}.ai12z-suggest-thumbs{margin-left:90%}.ai12z-suggest-thumbs-up{fill:var(--ai12z-feedback-selected);width:24px}.ai12z-suggest-thumbs-down{fill:var(--ai12z-feedback-selected);width:24px}.not-allowed{cursor:not-allowed}.ai12zBtn{background-color:var(--ai12z-knowledge-box-button-bgcolor);color:var(--ai12z-knowledge-box-button-color) !important;padding:5px 10px;border:none;border-radius:5px;cursor:pointer;text-decoration:none !important;margin:5px}.custom-privacy{color:var(--ai12z-knowledge-box-privacy-color);text-align:center;font-size:var(--ai12z-knowledge-box-privacy-font-size);margin-top:10px}button:focus-visible{outline:2px solid var(--ai12z-knowledge-box-focus-visible-color, #0A2A43);outline-offset:2px}button.kb-btn-primary:focus-visible{outline:2px solid var(--ai12z-knowledge-box-focus-visible-color-primary, --ai12z-knowledge-box-focus-visible-color);outline-offset:2px}button.kb-btn-secondary:focus-visible{outline:2px solid var(--ai12z-knowledge-box-focus-visible-color-secondary, --ai12z-knowledge-box-focus-visible-color)}.diamond-icon{color:var(--ai12z-knowledge-box-icon-color, #a5e6e6);width:28px;height:28px;transform-origin:center;}.diamond-icon.loading{animation:rotate 2s linear infinite}@keyframes rotate{from{transform:rotate(0deg)}to{transform:rotate(360deg)}}`;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var index = require('./index-v8T1EJAJ.js');
|
|
4
|
-
var utils = require('./utils-
|
|
4
|
+
var utils = require('./utils-kaVdO3ki.js');
|
|
5
5
|
var SearchResult = require('./SearchResult-CvTJr55G.js');
|
|
6
6
|
|
|
7
7
|
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:20px;padding-top:20px}.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:896px;justify-content:space-between;-moz-column-gap:24px;column-gap:24px}.cta-search-container-two{display:flex;min-width:0px;-moz-column-gap:16px;column-gap:16px}.cta-search-container-three{min-width:0px;flex:1 1 auto}.cta-search-text{font-weight:600;line-height:24px;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:4px;display:flex;font-size:var(--ai12z-search-result-description-font-size);line-height:16px;line-height:20px;color:var(--ai12z-search-result-description-color)}.cta-search-list-arrow{display:flex;align-items:center;flex-shrink:0;-moz-column-gap:16px;column-gap:16px}.custom-icon-width{width:64px}.results-icon svg{width:24px;height:24px}`;
|
|
@@ -366,11 +366,18 @@ function getMinutes(time) {
|
|
|
366
366
|
}
|
|
367
367
|
return hours * 60 + minutes;
|
|
368
368
|
}
|
|
369
|
+
function isTokenExpired(token, expiresAtMs) {
|
|
370
|
+
if (!token || !expiresAtMs) {
|
|
371
|
+
return true;
|
|
372
|
+
}
|
|
373
|
+
return Date.now() >= expiresAtMs;
|
|
374
|
+
}
|
|
369
375
|
|
|
370
376
|
exports.checkBusinessHours = checkBusinessHours;
|
|
371
377
|
exports.getBotStateFromSession = getBotStateFromSession;
|
|
372
378
|
exports.getBotStateKey = getBotStateKey;
|
|
373
379
|
exports.initializeScript = initializeScript;
|
|
380
|
+
exports.isTokenExpired = isTokenExpired;
|
|
374
381
|
exports.loadScript = loadScript;
|
|
375
382
|
exports.loadStyle = loadStyle;
|
|
376
383
|
exports.processTemplateData = processTemplateData;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var index = require('./index-v8T1EJAJ.js');
|
|
4
|
-
var utils = require('./utils-
|
|
4
|
+
var utils = require('./utils-kaVdO3ki.js');
|
|
5
5
|
var analyticsService = require('./analyticsService-CkAva47S.js');
|
|
6
6
|
var logger$1 = require('./logger-D--BUQGx.js');
|
|
7
7
|
|