ai12z 3.16.1-alpha.3 → 3.16.1-alpha.5

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.
Files changed (154) hide show
  1. package/dist/cjs/ai12z-beacon.cjs.entry.js +4 -4
  2. package/dist/cjs/ai12z-bot.cjs.entry.js +30 -19
  3. package/dist/cjs/ai12z-category_2.cjs.entry.js +3 -3
  4. package/dist/cjs/ai12z-chat-message.cjs.entry.js +13 -13
  5. package/dist/cjs/ai12z-chat_2.cjs.entry.js +12 -12
  6. package/dist/cjs/ai12z-container.cjs.entry.js +3 -3
  7. package/dist/cjs/ai12z-cta.cjs.entry.js +6 -6
  8. package/dist/cjs/ai12z-form.cjs.entry.js +2 -2
  9. package/dist/cjs/ai12z-inline-search.cjs.entry.js +2 -2
  10. package/dist/cjs/ai12z-knowledge-box.cjs.entry.js +38 -33
  11. package/dist/cjs/ai12z-search-panel.cjs.entry.js +1 -1
  12. package/dist/cjs/beacon-CHsypFIj.js +321 -0
  13. package/dist/cjs/chat-avatar_6.cjs.entry.js +1 -1
  14. package/dist/cjs/{ctaHelpers-CmoXzyRy.js → ctaHelpers-DL-PGlAx.js} +1 -1
  15. package/dist/cjs/dynamic-form.cjs.entry.js +1 -1
  16. package/dist/cjs/{index-DbNk7qkZ.js → index-CHyfwy-h.js} +1 -1
  17. package/dist/cjs/index.cjs.js +11 -11
  18. package/dist/cjs/item-list.cjs.entry.js +2 -2
  19. package/dist/cjs/{keyboard-shortcuts-BpiAXzLW.js → keyboard-shortcuts-BfEhZKK-.js} +2 -2
  20. package/dist/cjs/{parseHelper-CbA81TvP.js → parseHelper-B8pslVtS.js} +1 -1
  21. package/dist/cjs/{processCarouselData-Dl_WYwVE.js → processCarouselData-DVJtwUsv.js} +1 -1
  22. package/dist/cjs/{reCaptchaHelpers-mbTvATH6.js → reCaptchaHelpers-Djq71pt4.js} +1 -1
  23. package/dist/cjs/search-results-page.cjs.entry.js +16 -14
  24. package/dist/cjs/{socket-service-Cx-4DSqu.js → socket-service-Dqfi4_qU.js} +1 -1
  25. package/dist/cjs/{styleSheetRegistry-BmpJ3hCP.js → styleSheetRegistry-CsHfoS0d.js} +1 -1
  26. package/dist/cjs/{surveyHelpers-DFh4q1hj.js → surveyHelpers-D0AfNAN8.js} +1 -1
  27. package/dist/cjs/{utils-C2m26j54.js → utils-BsCPba57.js} +4 -4
  28. package/dist/collection/components/ai12z-beacon/ai12z-beacon.js +2 -2
  29. package/dist/collection/components/ai12z-bot/ai12z-bot.js +21 -10
  30. package/dist/collection/components/ai12z-cta/ai12z-cta.js +1 -1
  31. package/dist/collection/components/ai12z-cta/components/Chat.js +3 -3
  32. package/dist/collection/components/ai12z-knowledge-box/ai12z-knowledge-box.js +33 -28
  33. package/dist/collection/components/ai12z-knowledge-box/components/ai12z-chat-message.js +11 -11
  34. package/dist/collection/components/ai12z-search-panel/search-results-view.js +12 -10
  35. package/dist/collection/utils/beacon.js +148 -60
  36. package/dist/collection/utils/utils.js +4 -4
  37. package/dist/components/ai12z-beacon.js +1 -1
  38. package/dist/components/ai12z-bot.js +1 -1
  39. package/dist/components/ai12z-chat-message.js +1 -1
  40. package/dist/components/ai12z-chat.js +1 -1
  41. package/dist/components/ai12z-container.js +1 -1
  42. package/dist/components/ai12z-cta.js +1 -1
  43. package/dist/components/ai12z-form.js +1 -1
  44. package/dist/components/ai12z-inline-search.js +1 -1
  45. package/dist/components/ai12z-input-form.js +1 -1
  46. package/dist/components/ai12z-knowledge-box.js +1 -1
  47. package/dist/components/ai12z-search-panel.js +1 -1
  48. package/dist/components/audio-recorder.js +1 -1
  49. package/dist/components/dynamic-form.js +1 -1
  50. package/dist/components/index.js +1 -1
  51. package/dist/components/interaction-buttons.js +1 -1
  52. package/dist/components/item-list.js +1 -1
  53. package/dist/components/p--yAsbu4H.js +1 -0
  54. package/dist/components/p-6FdpADZf.js +1 -0
  55. package/dist/components/{p-yMwHPq7E.js → p-9LYL2tKU.js} +1 -1
  56. package/dist/components/{p-DRL0IYV2.js → p-BO2WmSX3.js} +1 -1
  57. package/dist/components/{p-DZ5YGUeY.js → p-BRLTYejK.js} +1 -1
  58. package/dist/components/p-BVqv7Ldi.js +1 -0
  59. package/dist/components/{p-BblvvyaD.js → p-BeRVlX-3.js} +1 -1
  60. package/dist/components/{p-C5vYK3Om.js → p-BjX5cCOG.js} +1 -1
  61. package/dist/components/{p-CVJPxD1X.js → p-CAK1__lu.js} +2 -2
  62. package/dist/components/p-CHrTVomR.js +31 -0
  63. package/dist/components/{p-2TKoA-vX.js → p-CWoExQML.js} +1 -1
  64. package/dist/components/p-Caiprvn4.js +1 -0
  65. package/dist/components/p-CfANO9-0.js +1 -0
  66. package/dist/components/{p-D_u0brDS.js → p-Cywgam3s.js} +1 -1
  67. package/dist/components/{p-DjYUZbG5.js → p-DOynMJxg.js} +1 -1
  68. package/dist/components/{p-fFDvCr1L.js → p-DURIlC18.js} +1 -1
  69. package/dist/components/{p-zx_1qRzz.js → p-Dc7unp-V.js} +1 -1
  70. package/dist/components/{p-q7LAuIXC.js → p-Dcj3Mokc.js} +1 -1
  71. package/dist/components/{p-BxPHrPiR.js → p-Dcm7MWBo.js} +1 -1
  72. package/dist/components/p-Di0FiI3Q.js +1 -0
  73. package/dist/components/{p-CrAK1XF4.js → p-DxKyMupy.js} +1 -1
  74. package/dist/components/{p-6PZtsZH1.js → p-UVgSZ7fz.js} +1 -1
  75. package/dist/components/p-tcK5_WYS.js +1 -0
  76. package/dist/components/privacy-modal.js +1 -1
  77. package/dist/components/search-results-page.js +1 -1
  78. package/dist/esm/ai12z-beacon.entry.js +4 -4
  79. package/dist/esm/ai12z-bot.entry.js +30 -19
  80. package/dist/esm/ai12z-category_2.entry.js +3 -3
  81. package/dist/esm/ai12z-chat-message.entry.js +13 -13
  82. package/dist/esm/ai12z-chat_2.entry.js +12 -12
  83. package/dist/esm/ai12z-container.entry.js +3 -3
  84. package/dist/esm/ai12z-cta.entry.js +6 -6
  85. package/dist/esm/ai12z-form.entry.js +2 -2
  86. package/dist/esm/ai12z-inline-search.entry.js +2 -2
  87. package/dist/esm/ai12z-knowledge-box.entry.js +38 -33
  88. package/dist/esm/ai12z-search-panel.entry.js +1 -1
  89. package/dist/esm/beacon-CvlGzRRz.js +318 -0
  90. package/dist/esm/chat-avatar_6.entry.js +1 -1
  91. package/dist/esm/{ctaHelpers-DcnA0MVw.js → ctaHelpers-GH6upqgA.js} +1 -1
  92. package/dist/esm/dynamic-form.entry.js +1 -1
  93. package/dist/esm/{index-CaCfv0ky.js → index-CjSLTZFw.js} +1 -1
  94. package/dist/esm/index.js +11 -11
  95. package/dist/esm/item-list.entry.js +2 -2
  96. package/dist/esm/{keyboard-shortcuts-BVIafjUQ.js → keyboard-shortcuts-DNhwh88a.js} +2 -2
  97. package/dist/esm/{parseHelper-D4mtBh2Q.js → parseHelper-B4cZLEeX.js} +1 -1
  98. package/dist/esm/{processCarouselData-BMYrhEs4.js → processCarouselData-CgoPoIF_.js} +1 -1
  99. package/dist/esm/{reCaptchaHelpers-YIcqZyYx.js → reCaptchaHelpers-O2ugKpWf.js} +1 -1
  100. package/dist/esm/search-results-page.entry.js +16 -14
  101. package/dist/esm/{socket-service-CRKef4T3.js → socket-service-B6aew9Me.js} +1 -1
  102. package/dist/esm/{styleSheetRegistry-DdPFpNJm.js → styleSheetRegistry-DxStYIoa.js} +1 -1
  103. package/dist/esm/{surveyHelpers-D4TSNF8Y.js → surveyHelpers-Cbq2vpWj.js} +1 -1
  104. package/dist/esm/{utils-ChO9VTBD.js → utils-qg8o2dBJ.js} +5 -5
  105. package/dist/library/index.esm.js +1 -1
  106. package/dist/library/library.esm.js +1 -1
  107. package/dist/library/p-16b01d52.entry.js +1 -0
  108. package/dist/library/{p-997e2c97.entry.js → p-2d8497d9.entry.js} +1 -1
  109. package/dist/library/{p-556f02ab.entry.js → p-4a41a902.entry.js} +2 -2
  110. package/dist/library/{p-c86ab9a1.entry.js → p-4e8c0e1b.entry.js} +1 -1
  111. package/dist/library/p-58b00a22.entry.js +1 -0
  112. package/dist/library/p-6e1f9c89.entry.js +1 -0
  113. package/dist/library/{p-90267282.entry.js → p-751e9420.entry.js} +1 -1
  114. package/dist/library/p-BNcQ63DZ.js +1 -0
  115. package/dist/library/{p-Xl3fPHSq.js → p-CZBOULiw.js} +1 -1
  116. package/dist/library/{p-BuRbL6gW.js → p-CrPwKEk_.js} +1 -1
  117. package/dist/library/{p-DxK9sK4Q.js → p-Cwv5wtEw.js} +1 -1
  118. package/dist/library/{p-BioRZgoO.js → p-CzTa5Msf.js} +1 -1
  119. package/dist/library/p-D5HnlfHT.js +1 -0
  120. package/dist/library/{p-CkHXycsT.js → p-DPxJK7tl.js} +1 -1
  121. package/dist/library/{p-DSFLm9UF.js → p-DheNz53W.js} +1 -1
  122. package/dist/library/{p-BSPqAtmB.js → p-DkZf86Si.js} +1 -1
  123. package/dist/library/{p-DjDuNItZ.js → p-FOOni1Nh.js} +1 -1
  124. package/dist/library/{p-D-02FHEk.js → p-TJudQcMS.js} +2 -2
  125. package/dist/library/{p-d4d66d5a.entry.js → p-ad825010.entry.js} +1 -1
  126. package/dist/library/p-b277fee9.entry.js +1 -0
  127. package/dist/library/{p-e068fafd.entry.js → p-bb534b71.entry.js} +1 -1
  128. package/dist/library/p-cbf75654.entry.js +1 -0
  129. package/dist/library/p-ceb2e683.entry.js +1 -0
  130. package/dist/library/{p-a7d3d165.entry.js → p-d45bc8fa.entry.js} +1 -1
  131. package/dist/library/{p-2a0e8794.entry.js → p-eb4f0ea7.entry.js} +1 -1
  132. package/dist/library/{p-959d6f61.entry.js → p-f5bb347f.entry.js} +1 -1
  133. package/dist/types/components/ai12z-knowledge-box/ai12z-knowledge-box.d.ts +1 -1
  134. package/dist/types/utils/beacon.d.ts +6 -4
  135. package/dist/types/utils/utils.d.ts +2 -2
  136. package/package.json +2 -2
  137. package/dist/cjs/beacon-BXbtC1CF.js +0 -233
  138. package/dist/components/p-BMfSdozn.js +0 -1
  139. package/dist/components/p-CuvuE2zX.js +0 -1
  140. package/dist/components/p-CxxCQyur.js +0 -1
  141. package/dist/components/p-D-0m820g.js +0 -1
  142. package/dist/components/p-DLOQS_dm.js +0 -1
  143. package/dist/components/p-FQgYAFAZ.js +0 -1
  144. package/dist/components/p-SMXYqOvq.js +0 -31
  145. package/dist/components/p-vww9WgTo.js +0 -1
  146. package/dist/esm/beacon-BZXo_E7d.js +0 -230
  147. package/dist/library/p-84a3e86b.entry.js +0 -1
  148. package/dist/library/p-8adc93e4.entry.js +0 -1
  149. package/dist/library/p-C6mjQOfZ.js +0 -1
  150. package/dist/library/p-CQ3w1XSQ.js +0 -1
  151. package/dist/library/p-cca4ab89.entry.js +0 -1
  152. package/dist/library/p-d0537df4.entry.js +0 -1
  153. package/dist/library/p-d6e75352.entry.js +0 -1
  154. package/dist/library/p-e455d89a.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-BXbtC1CF.js');
5
- require('./utils-C2m26j54.js');
4
+ var beacon = require('./beacon-CHsypFIj.js');
5
+ require('./utils-BsCPba57.js');
6
6
 
7
7
  const Ai12zBeacon = class {
8
8
  constructor(hostRef) {
@@ -20,10 +20,10 @@ const Ai12zBeacon = class {
20
20
  if (!this.dataKey) {
21
21
  return;
22
22
  }
23
- beacon.initBeacon(this.dataKey);
23
+ beacon.initBeacon(this.dataKey, this.dataMode);
24
24
  }
25
25
  render() {
26
- return index.h(index.Host, { key: '0c87acbc61ff504f2cc6406be2e255e92f9e3220', hidden: true });
26
+ return index.h(index.Host, { key: '48ca1fb76f87618fc7b03fd60e923a16a6cdf87f', hidden: true });
27
27
  }
28
28
  static get watchers() { return {
29
29
  "dataKey": [{
@@ -2,20 +2,20 @@
2
2
 
3
3
  var index = require('./index-v8T1EJAJ.js');
4
4
  var responseAdapter = require('./response-adapter-CKKyyhMj.js');
5
- var processCarouselData = require('./processCarouselData-Dl_WYwVE.js');
5
+ var processCarouselData = require('./processCarouselData-DVJtwUsv.js');
6
6
  var logger$2 = require('./logger-2ZBZCKdM.js');
7
- var utils = require('./utils-C2m26j54.js');
8
- var index$1 = require('./index-DbNk7qkZ.js');
7
+ var utils = require('./utils-BsCPba57.js');
8
+ var index$1 = require('./index-CHyfwy-h.js');
9
9
  var globalStore = require('./global-store-R6x06KvJ.js');
10
- var reCaptchaHelpers = require('./reCaptchaHelpers-mbTvATH6.js');
10
+ var reCaptchaHelpers = require('./reCaptchaHelpers-Djq71pt4.js');
11
11
  var botHelpers = require('./botHelpers-D5Dj7TRA.js');
12
- var surveyHelpers = require('./surveyHelpers-DFh4q1hj.js');
12
+ var surveyHelpers = require('./surveyHelpers-D0AfNAN8.js');
13
13
  var scriptStyleLoader = require('./scriptStyleLoader-D-bqKqSb.js');
14
- var keyboardShortcuts = require('./keyboard-shortcuts-BpiAXzLW.js');
15
- var ctaHelpers = require('./ctaHelpers-CmoXzyRy.js');
14
+ var keyboardShortcuts = require('./keyboard-shortcuts-BfEhZKK-.js');
15
+ var ctaHelpers = require('./ctaHelpers-DL-PGlAx.js');
16
16
  var appStore = require('./app-store-BtkiHvcw.js');
17
- var parseHelper = require('./parseHelper-CbA81TvP.js');
18
- var beacon = require('./beacon-BXbtC1CF.js');
17
+ var parseHelper = require('./parseHelper-B8pslVtS.js');
18
+ var beacon = require('./beacon-CHsypFIj.js');
19
19
  var bodyScrollLock = require('./bodyScrollLock-C7gKTAfx.js');
20
20
  require('./_commonjsHelpers-MBWFX2dn.js');
21
21
 
@@ -1231,10 +1231,11 @@ const Ai12zBot = class {
1231
1231
  }
1232
1232
  };
1233
1233
  this.handleMessage = (data, aiMessageId) => {
1234
+ var _a;
1234
1235
  const converter = new processCarouselData.showdown.Converter();
1235
1236
  // const aiMessageBubble = document.getElementById(aiMessageId);
1236
1237
  // const aiMessageBubble = await waitForElement(`#${aiMessageId}`, this.el)
1237
- const aiMessageBubble = this.el.shadowRoot.querySelector(`#${aiMessageId}`);
1238
+ const aiMessageBubble = (_a = this.el.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector(`#${aiMessageId}`);
1238
1239
  if (!aiMessageBubble) {
1239
1240
  console.error(`Message bubble with ID ${aiMessageId} not found.`);
1240
1241
  return;
@@ -1258,6 +1259,7 @@ const Ai12zBot = class {
1258
1259
  }
1259
1260
  };
1260
1261
  this.handleSend = async (eleValue, options = {}) => {
1262
+ var _a;
1261
1263
  const { isHide = false, isLiveChatEnded = false } = options;
1262
1264
  this.emptyMessageError = false;
1263
1265
  this.surveyDomId = "";
@@ -1319,7 +1321,6 @@ const Ai12zBot = class {
1319
1321
  ];
1320
1322
  if (this.messages.length === 2) {
1321
1323
  this.visitorID = utils.getOrCreateVisitorId();
1322
- beacon.setConversationId(this.dataKey, this.conversationId);
1323
1324
  }
1324
1325
  this.checkHistory();
1325
1326
  setTimeout(() => {
@@ -1348,7 +1349,7 @@ const Ai12zBot = class {
1348
1349
  }
1349
1350
  }
1350
1351
  // this.invokeSocket()
1351
- const parent = this.el.shadowRoot.querySelector("#previewContainer");
1352
+ const parent = (_a = this.el.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector("#previewContainer");
1352
1353
  if (parent) {
1353
1354
  parent.innerHTML = "";
1354
1355
  }
@@ -1405,6 +1406,7 @@ const Ai12zBot = class {
1405
1406
  this.scheduleAutoScroll();
1406
1407
  };
1407
1408
  this.addEventMessage = (_message) => {
1409
+ var _a;
1408
1410
  const agentEventMessages = this.liveAgentEventHandler.addAgentEventMessage([
1409
1411
  {
1410
1412
  text: _message,
@@ -1416,7 +1418,7 @@ const Ai12zBot = class {
1416
1418
  }
1417
1419
  }
1418
1420
  if (agentEventMessages && this.currentDomId) {
1419
- const currentDomElement = this.el.shadowRoot.querySelector(`#${this.currentDomId}`);
1421
+ const currentDomElement = (_a = this.el.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector(`#${this.currentDomId}`);
1420
1422
  if (currentDomElement) {
1421
1423
  // Append the agent event messages to the current message bubble
1422
1424
  currentDomElement.parentNode.appendChild(agentEventMessages);
@@ -1805,7 +1807,7 @@ const Ai12zBot = class {
1805
1807
  this.timestamp = utils.formatTimestamp(new Date());
1806
1808
  this.updateScreenSize();
1807
1809
  await this.configBot();
1808
- beacon.initBeacon(this.dataKey);
1810
+ beacon.initBeacon(this.dataKey, this.dataMode);
1809
1811
  this.visitorID = "ai12z-" + localStorage.getItem(`ai12z-visitorId`);
1810
1812
  // Now safely read state with valid pId
1811
1813
  this.hydrateStateFromStorage();
@@ -1887,6 +1889,7 @@ const Ai12zBot = class {
1887
1889
  }
1888
1890
  }
1889
1891
  componentDidLoad() {
1892
+ var _a;
1890
1893
  globalStore.setBotElement(this.el); // register globally
1891
1894
  if (typeof window !== "undefined" && !window.Handlebars) {
1892
1895
  window.Handlebars = index$1.Handlebars;
@@ -1901,7 +1904,7 @@ const Ai12zBot = class {
1901
1904
  var ai12zChat = window["ai12z"] = {}
1902
1905
  `;
1903
1906
  document.head.appendChild(ai12zHeading);
1904
- this.el.shadowRoot.appendChild(ai12zHeading);
1907
+ (_a = this.el.shadowRoot) === null || _a === void 0 ? void 0 : _a.appendChild(ai12zHeading);
1905
1908
  // ✅ Initialize asset loader if not already done (configBot may have initialized it)
1906
1909
  if (!this.assetLoader) {
1907
1910
  this.initializeAssetLoader();
@@ -2201,7 +2204,8 @@ const Ai12zBot = class {
2201
2204
  hideSpinner(chatData) {
2202
2205
  // Logic for hiding the spinner (assumed to return a Promise if async is needed)
2203
2206
  return new Promise(resolve => {
2204
- const renderedBubble = this.el.shadowRoot.querySelector(`#${chatData.id}`);
2207
+ var _a;
2208
+ const renderedBubble = (_a = this.el.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector(`#${chatData.id}`);
2205
2209
  if (renderedBubble) {
2206
2210
  const spinner = renderedBubble.querySelector("#spinner");
2207
2211
  if (spinner) {
@@ -2327,6 +2331,9 @@ const Ai12zBot = class {
2327
2331
  }
2328
2332
  // ✅ Common cleanup
2329
2333
  this.conversationId = data.conversationId;
2334
+ if (this.messages.length === 2) {
2335
+ beacon.setConversationId(this.dataKey, this.dataMode, this.conversationId);
2336
+ }
2330
2337
  // this.saveConversation()
2331
2338
  ctaHelpers.saveConversation((_b = this.botSettings) === null || _b === void 0 ? void 0 : _b.pId, this.messages, this.conversationId, (_d = (_c = this.botSettings._id) === null || _c === void 0 ? void 0 : _c.$oid) !== null && _d !== void 0 ? _d : "", this.visitorID, "bot", {
2332
2339
  isMinimized: this.isMinimized,
@@ -2458,7 +2465,8 @@ const Ai12zBot = class {
2458
2465
  }
2459
2466
  }
2460
2467
  addEventListeners(msgId) {
2461
- const container = this.el.shadowRoot.querySelector(msgId);
2468
+ var _a;
2469
+ const container = (_a = this.el.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector(msgId);
2462
2470
  if (container) {
2463
2471
  this.buttons.forEach(button => {
2464
2472
  const buttonElement = container.querySelector(`#${button.id}`);
@@ -2723,7 +2731,7 @@ const Ai12zBot = class {
2723
2731
  this.autoScrollTimer = setTimeout(() => this.scrollToBottom(), 60);
2724
2732
  }
2725
2733
  checkLiveAgentMode() {
2726
- var _a, _b, _c, _d;
2734
+ var _a, _b, _c, _d, _f, _g, _h, _j, _k, _l;
2727
2735
  const isLiveAgentConfigured = ((_b = (_a = this.botSettings) === null || _a === void 0 ? void 0 : _a.liveagent) === null || _b === void 0 ? void 0 : _b.providers) && Object.keys((_d = (_c = this.botSettings) === null || _c === void 0 ? void 0 : _c.liveagent) === null || _d === void 0 ? void 0 : _d.providers).length > 0;
2728
2736
  /**
2729
2737
  * Check if live agent is enabled
@@ -2733,7 +2741,10 @@ const Ai12zBot = class {
2733
2741
  * and there is a conversation history to refer to.
2734
2742
  * This prevents the live agent from being connected immediately when the chat is opened.
2735
2743
  */
2736
- this.isLiveAgentEnabled = isLiveAgentConfigured && this.messages.length > 1;
2744
+ const bh = (_h = (_g = (_f = this.botSettings) === null || _f === void 0 ? void 0 : _f.liveagent) === null || _g === void 0 ? void 0 : _g.businessHours) !== null && _h !== void 0 ? _h : null;
2745
+ const tz = (_l = (_k = (_j = this.botSettings) === null || _j === void 0 ? void 0 : _j.liveagent) === null || _k === void 0 ? void 0 : _k.timezone) !== null && _l !== void 0 ? _l : null;
2746
+ const withinHours = bh && tz ? botHelpers.checkBusinessHours(bh, tz) : true;
2747
+ this.isLiveAgentEnabled = isLiveAgentConfigured && this.messages.length > 1 && withinHours;
2737
2748
  }
2738
2749
  openEndLiveAgentDialog() {
2739
2750
  this.isToggled = false;
@@ -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-C2m26j54.js');
5
+ var utils = require('./utils-BsCPba57.js');
6
6
  var _commonjsHelpers = require('./_commonjsHelpers-MBWFX2dn.js');
7
7
  var appStore = require('./app-store-BtkiHvcw.js');
8
- var parseHelper = require('./parseHelper-CbA81TvP.js');
9
- require('./ctaHelpers-CmoXzyRy.js');
8
+ var parseHelper = require('./parseHelper-B8pslVtS.js');
9
+ require('./ctaHelpers-DL-PGlAx.js');
10
10
  require('./logger-2ZBZCKdM.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)}`;
@@ -2,8 +2,8 @@
2
2
 
3
3
  var index = require('./index-v8T1EJAJ.js');
4
4
  var botHelpers = require('./botHelpers-D5Dj7TRA.js');
5
- var styleSheetRegistry = require('./styleSheetRegistry-BmpJ3hCP.js');
6
- require('./utils-C2m26j54.js');
5
+ var styleSheetRegistry = require('./styleSheetRegistry-CsHfoS0d.js');
6
+ require('./utils-BsCPba57.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
 
@@ -55,10 +55,18 @@ const Ai12zChatMessage = class {
55
55
  botHelpers.initializeScript(event.detail.id, this.mainObject);
56
56
  }
57
57
  componentWillLoad() {
58
+ var _a, _b;
58
59
  this.loadScriptsSequentially();
60
+ // Adopt customCSS in this shadow root using the shared CSSStyleSheet
61
+ // already constructed by the parent knowledge-box (zero extra fetches).
62
+ if ((_a = this.kbSettings) === null || _a === void 0 ? void 0 : _a.customCSS) {
63
+ styleSheetRegistry.adoptStyleSheet(this.kbSettings.customCSS, this.el.shadowRoot);
64
+ }
65
+ if ((_b = this.kbSettings) === null || _b === void 0 ? void 0 : _b.customJS) {
66
+ styleSheetRegistry.loadScriptOnce(this.kbSettings.customJS, this.el.shadowRoot);
67
+ }
59
68
  }
60
69
  componentDidLoad() {
61
- var _a, _b;
62
70
  // Initialise the ai12z global exactly once; never overwrite an existing value.
63
71
  if (!window["ai12z"]) {
64
72
  window["ai12z"] = {};
@@ -67,14 +75,6 @@ const Ai12zChatMessage = class {
67
75
  ai12zHeading.text = `var ai12zChat = window["ai12z"] = {}`;
68
76
  this.el.shadowRoot.appendChild(ai12zHeading);
69
77
  this.checkOverflow();
70
- // Adopt customCSS in this shadow root using the shared CSSStyleSheet
71
- // already constructed by the parent knowledge-box (zero extra fetches).
72
- if ((_a = this.kbSettings) === null || _a === void 0 ? void 0 : _a.customCSS) {
73
- styleSheetRegistry.adoptStyleSheet(this.kbSettings.customCSS, this.el.shadowRoot);
74
- }
75
- if ((_b = this.kbSettings) === null || _b === void 0 ? void 0 : _b.customJS) {
76
- styleSheetRegistry.loadScriptOnce(this.kbSettings.customJS, this.el.shadowRoot);
77
- }
78
78
  }
79
79
  async loadScriptsSequentially() {
80
80
  try {
@@ -156,9 +156,9 @@ const Ai12zChatMessage = class {
156
156
  render() {
157
157
  var _a, _b, _c, _d;
158
158
  const lineClamp = (_b = (_a = this.kbSettings) === null || _a === void 0 ? void 0 : _a.numberOfLines) !== null && _b !== void 0 ? _b : 10;
159
- return (index.h("div", { key: '9ca973f77573d9d8c35819187627bf138467adb6', class: "chat-message" }, index.h("div", { key: 'e93fe238107177d064eea2f8473a62c98f4296b2', ref: (el) => this.messageRef = el, class: { 'message-text': true, "custom-line-clamp": !this.isExpanded && !this.isCollapsing && this.showButton }, style: {
159
+ return (index.h("div", { key: '678e7290618485a7a59f60642a2a7774c84ff87e', class: "chat-message" }, index.h("div", { key: '6b47a9bfeec40b41d1dcbbe026f3553f5950815e', ref: (el) => this.messageRef = el, class: { 'message-text': true, "custom-line-clamp": !this.isExpanded && !this.isCollapsing && this.showButton }, style: {
160
160
  "--line-clamp": `${lineClamp}`,
161
- }, innerHTML: this.text, onClick: this.showButton ? this.toggleExpand : undefined }), !this.isExpanded && this.showButton && this.canExpand && index.h("div", { key: 'dfee9acb322edeeccb2a2922f7cda8428ebbbc77', class: "fade-overlay" }), this.showButton && this.canExpand && index.h("button", { key: '703b97095285eb0748bdc89ca806c460f34c0e73', 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 ? index.h("svg", { width: "1em", height: "1em", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round" }, index.h("polyline", { points: "6 9 12 15 18 9" })) : index.h("svg", { width: "1em", height: "1em", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round" }, index.h("polyline", { points: "18 15 12 9 6 15" })))));
161
+ }, innerHTML: this.text, onClick: this.showButton ? this.toggleExpand : undefined }), !this.isExpanded && this.showButton && this.canExpand && index.h("div", { key: 'dc643873c5d998735c11d318dd65adf974abf4be', class: "fade-overlay" }), this.showButton && this.canExpand && index.h("button", { key: '7bbd87c7c71796a4b7e43d290536c13fc39254cc', 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 ? index.h("svg", { width: "1em", height: "1em", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round" }, index.h("polyline", { points: "6 9 12 15 18 9" })) : index.h("svg", { width: "1em", height: "1em", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round" }, index.h("polyline", { points: "18 15 12 9 6 15" })))));
162
162
  }
163
163
  get el() { return index.getElement(this); }
164
164
  static get watchers() { return {
@@ -1,17 +1,17 @@
1
1
  'use strict';
2
2
 
3
3
  var index = require('./index-v8T1EJAJ.js');
4
- var processCarouselData = require('./processCarouselData-Dl_WYwVE.js');
5
- var parseHelper = require('./parseHelper-CbA81TvP.js');
6
- var utils = require('./utils-C2m26j54.js');
7
- var ctaHelpers = require('./ctaHelpers-CmoXzyRy.js');
8
- var index$1 = require('./index-DbNk7qkZ.js');
9
- var socketService = require('./socket-service-Cx-4DSqu.js');
10
- var surveyHelpers = require('./surveyHelpers-DFh4q1hj.js');
11
- var keyboardShortcuts = require('./keyboard-shortcuts-BpiAXzLW.js');
4
+ var processCarouselData = require('./processCarouselData-DVJtwUsv.js');
5
+ var parseHelper = require('./parseHelper-B8pslVtS.js');
6
+ var utils = require('./utils-BsCPba57.js');
7
+ var ctaHelpers = require('./ctaHelpers-DL-PGlAx.js');
8
+ var index$1 = require('./index-CHyfwy-h.js');
9
+ var socketService = require('./socket-service-Dqfi4_qU.js');
10
+ var surveyHelpers = require('./surveyHelpers-D0AfNAN8.js');
11
+ var keyboardShortcuts = require('./keyboard-shortcuts-BfEhZKK-.js');
12
12
  var analyticsService = require('./analyticsService-CkAva47S.js');
13
13
  var botHelpers = require('./botHelpers-D5Dj7TRA.js');
14
- var beacon = require('./beacon-BXbtC1CF.js');
14
+ var beacon = require('./beacon-CHsypFIj.js');
15
15
  require('./_commonjsHelpers-MBWFX2dn.js');
16
16
  require('./logger-2ZBZCKdM.js');
17
17
  require('./response-adapter-CKKyyhMj.js');
@@ -456,7 +456,7 @@ const MyChat = class {
456
456
  // ✅ Common cleanup
457
457
  this.conversationId = event.detail.conversationId;
458
458
  if (this.chats.length === 2) {
459
- beacon.setConversationId(this.apiKey, this.conversationId);
459
+ beacon.setConversationId(this.apiKey, this.env, this.conversationId);
460
460
  }
461
461
  ctaHelpers.saveConversation(this.getProjectId(), this.chats, this.conversationId, (_d = (_c = (_b = this.settings) === null || _b === void 0 ? void 0 : _b._id) === null || _c === void 0 ? void 0 : _c.$oid) !== null && _d !== void 0 ? _d : "", "ai12z-cta-history", "search");
462
462
  this.aiMessageId = "";
@@ -1142,7 +1142,7 @@ const MyChat = class {
1142
1142
  render() {
1143
1143
  var _a;
1144
1144
  const email = "";
1145
- return (index.h("div", { key: '7f55750f55253ad15662a90c60415379eab1dbf5' }, index.h("ul", { key: 'd957e635cd6f1c0179eda2e65f3cf25386c4d4b8', id: "main-content", tabindex: "-1", class: {
1145
+ return (index.h("div", { key: 'f831dd4187ff1bf14c6d841cef5497e2f1286649' }, index.h("ul", { key: '408075b0d4bb3131c867c020dcc3e00b16cc22c2', id: "main-content", tabindex: "-1", class: {
1146
1146
  "chat-list": true,
1147
1147
  "custom-list": this.componentType === "search",
1148
1148
  // "custom-chat-top-height": this.componentType === "search",
@@ -1209,7 +1209,7 @@ const MyChat = class {
1209
1209
  projectId: this.getProjectId(),
1210
1210
  questionText: analyticsService.getQuestionText(this.chats, chat.insightId) || "",
1211
1211
  }), class: "chat-thumbs-up", "aria-label": "Thumbs Down", tabindex: "0" }, index.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" }, index.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" }))), index.h("button", { class: "copy-btn", tabindex: "0", "aria-label": "Send Email" }, index.h("a", { href: `mailto:${email}?subject=${encodeURIComponent((_e = this.chats[idx - 1]) === null || _e === void 0 ? void 0 : _e.message)}&body=${encodeURIComponent(this.removeHtmlTags(chat.clipboard))}`, target: "_blank", "aria-label": "Send Email" }, index.h("svg", { viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", stroke: "currentColor", "stroke-width": "0.3", class: "w-6 h-6" }, index.h("path", { "fill-rule": "evenodd", "clip-rule": "evenodd", d: "M3.75 5.25L3 6V18L3.75 18.75H20.25L21 18V6L20.25 5.25H3.75ZM4.5 7.6955V17.25H19.5V7.69525L11.9999 14.5136L4.5 7.6955ZM18.3099 6.75H5.68986L11.9999 12.4864L18.3099 6.75Z", fill: "currentColor" }), " "))))))));
1212
- }), index.h("div", { key: '3df0615a75073d76ef5097a2eb2642d18b9f4a02', class: "scroll-bottom" }))));
1212
+ }), index.h("div", { key: 'd1bb0335acf2e6aa3e732a3733b1a20cbf9b0180', class: "scroll-bottom" }))));
1213
1213
  }
1214
1214
  get element() { return index.getElement(this); }
1215
1215
  static get watchers() { return {
@@ -1,10 +1,10 @@
1
1
  'use strict';
2
2
 
3
3
  var index = require('./index-v8T1EJAJ.js');
4
- var utils = require('./utils-C2m26j54.js');
5
- var processCarouselData = require('./processCarouselData-Dl_WYwVE.js');
4
+ var utils = require('./utils-BsCPba57.js');
5
+ var processCarouselData = require('./processCarouselData-DVJtwUsv.js');
6
6
  var botHelpers = require('./botHelpers-D5Dj7TRA.js');
7
- var index$1 = require('./index-DbNk7qkZ.js');
7
+ var index$1 = require('./index-CHyfwy-h.js');
8
8
  require('./_commonjsHelpers-MBWFX2dn.js');
9
9
 
10
10
  /*! @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,13 +1,13 @@
1
1
  'use strict';
2
2
 
3
3
  var index = require('./index-v8T1EJAJ.js');
4
- var utils = require('./utils-C2m26j54.js');
4
+ var utils = require('./utils-BsCPba57.js');
5
5
  var SearchResult = require('./SearchResult-CvTJr55G.js');
6
- var socketService = require('./socket-service-Cx-4DSqu.js');
6
+ var socketService = require('./socket-service-Dqfi4_qU.js');
7
7
  var globalStore = require('./global-store-R6x06KvJ.js');
8
- var reCaptchaHelpers = require('./reCaptchaHelpers-mbTvATH6.js');
9
- var ctaHelpers = require('./ctaHelpers-CmoXzyRy.js');
10
- var beacon = require('./beacon-BXbtC1CF.js');
8
+ var reCaptchaHelpers = require('./reCaptchaHelpers-Djq71pt4.js');
9
+ var ctaHelpers = require('./ctaHelpers-DL-PGlAx.js');
10
+ var beacon = require('./beacon-CHsypFIj.js');
11
11
  var appStore = require('./app-store-BtkiHvcw.js');
12
12
  var bodyScrollLock = require('./bodyScrollLock-C7gKTAfx.js');
13
13
  require('./response-adapter-CKKyyhMj.js');
@@ -344,7 +344,7 @@ const Ai12zCta = class {
344
344
  appStore.setParentComponentState("cta", this.dataKey, this.dataMode);
345
345
  await this.configCtaSettings();
346
346
  // Initialize global beacon for session tracking
347
- beacon.initBeacon(this.dataKey);
347
+ beacon.initBeacon(this.dataKey, this.dataMode);
348
348
  // console.log("componentWillLoad ai12z-cta.tsx")
349
349
  // this.socket = this.socketService.getSocket()
350
350
  // this.socketService = SocketService.createInstance(this.dataMode)
@@ -1,8 +1,8 @@
1
1
  'use strict';
2
2
 
3
3
  var index = require('./index-v8T1EJAJ.js');
4
- var utils = require('./utils-C2m26j54.js');
5
- var surveyHelpers = require('./surveyHelpers-DFh4q1hj.js');
4
+ var utils = require('./utils-BsCPba57.js');
5
+ var surveyHelpers = require('./surveyHelpers-D0AfNAN8.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-C2m26j54.js');
4
+ var utils = require('./utils-BsCPba57.js');
5
5
  var SearchResult = require('./SearchResult-CvTJr55G.js');
6
- var socketService = require('./socket-service-Cx-4DSqu.js');
6
+ var socketService = require('./socket-service-Dqfi4_qU.js');
7
7
  require('./response-adapter-CKKyyhMj.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,15 +1,16 @@
1
1
  'use strict';
2
2
 
3
3
  var index = require('./index-v8T1EJAJ.js');
4
- var utils = require('./utils-C2m26j54.js');
5
- var styleSheetRegistry = require('./styleSheetRegistry-BmpJ3hCP.js');
4
+ var utils = require('./utils-BsCPba57.js');
5
+ var styleSheetRegistry = require('./styleSheetRegistry-CsHfoS0d.js');
6
6
  var responseAdapter = require('./response-adapter-CKKyyhMj.js');
7
- var processCarouselData = require('./processCarouselData-Dl_WYwVE.js');
7
+ var processCarouselData = require('./processCarouselData-DVJtwUsv.js');
8
8
  var globalStore = require('./global-store-R6x06KvJ.js');
9
- var index$1 = require('./index-DbNk7qkZ.js');
10
- var surveyHelpers = require('./surveyHelpers-DFh4q1hj.js');
9
+ var index$1 = require('./index-CHyfwy-h.js');
10
+ var surveyHelpers = require('./surveyHelpers-D0AfNAN8.js');
11
11
  var botHelpers = require('./botHelpers-D5Dj7TRA.js');
12
12
  var analyticsService = require('./analyticsService-CkAva47S.js');
13
+ var beacon = require('./beacon-CHsypFIj.js');
13
14
  require('./_commonjsHelpers-MBWFX2dn.js');
14
15
 
15
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)}}`;
@@ -44,15 +45,15 @@ const Ai12zKnowledgeBox = class {
44
45
  }, 1000);
45
46
  };
46
47
  this.updateResponseContent = (htmlContent) => {
47
- var _a, _b;
48
+ var _a, _b, _c, _d, _e, _f, _g, _h;
48
49
  const newTodo = {
49
50
  id: this.domId,
50
51
  answer: htmlContent,
51
- title: (_a = this.kbSettings.title) !== null && _a !== void 0 ? _a : this.question,
52
- relevanceScore: this.searchResults["relevanceScore"],
53
- isRelevance: this.kbSettings.relevanceScore,
54
- insightId: this.searchResults["insightId"],
55
- thumbsUpDown: (_b = this.kbSettings.showMessageIcons) !== null && _b !== void 0 ? _b : true,
52
+ title: (_b = (_a = this.kbSettings) === null || _a === void 0 ? void 0 : _a.title) !== null && _b !== void 0 ? _b : this.question,
53
+ relevanceScore: (_d = (_c = this.searchResults) === null || _c === void 0 ? void 0 : _c["relevanceScore"]) !== null && _d !== void 0 ? _d : "",
54
+ isRelevance: (_e = this.kbSettings) === null || _e === void 0 ? void 0 : _e.relevanceScore,
55
+ insightId: (_f = this.searchResults) === null || _f === void 0 ? void 0 : _f["insightId"],
56
+ thumbsUpDown: (_h = (_g = this.kbSettings) === null || _g === void 0 ? void 0 : _g.showMessageIcons) !== null && _h !== void 0 ? _h : true,
56
57
  };
57
58
  this.items = this.items.map(item => (item.id === this.domId ? newTodo : item));
58
59
  this.currentStreamingText = htmlContent; // set final answer
@@ -299,7 +300,7 @@ const Ai12zKnowledgeBox = class {
299
300
  });
300
301
  }
301
302
  getResults(type) {
302
- var _a, _b;
303
+ var _a, _b, _c, _d;
303
304
  // console.log("Getting results for question:", this.question)
304
305
  try {
305
306
  if (this.question) {
@@ -310,9 +311,9 @@ const Ai12zKnowledgeBox = class {
310
311
  answer: " ",
311
312
  title: "",
312
313
  relevanceScore: "",
313
- isRelevance: this.kbSettings.relevanceScore,
314
+ isRelevance: (_a = this.kbSettings) === null || _a === void 0 ? void 0 : _a.relevanceScore,
314
315
  insightId: "",
315
- thumbsUpDown: (_a = this.kbSettings.showMessageIcons) !== null && _a !== void 0 ? _a : true,
316
+ thumbsUpDown: (_c = (_b = this.kbSettings) === null || _b === void 0 ? void 0 : _b.showMessageIcons) !== null && _c !== void 0 ? _c : true,
316
317
  };
317
318
  if (type === "add" || (this.items && this.items.length === 0)) {
318
319
  this.socket.off("response");
@@ -325,7 +326,7 @@ const Ai12zKnowledgeBox = class {
325
326
  const updatedId = this.items[0].id;
326
327
  this.items = [...this.items, newTodo];
327
328
  this.items = this.items.filter(item => item.id !== updatedId);
328
- if ((_b = this.el.shadowRoot) === null || _b === void 0 ? void 0 : _b.querySelector(`#${updatedId}`)) {
329
+ if ((_d = this.el.shadowRoot) === null || _d === void 0 ? void 0 : _d.querySelector(`#${updatedId}`)) {
329
330
  this.el.shadowRoot.querySelector(`#${updatedId}`).innerHTML = "";
330
331
  this.el.shadowRoot.querySelector(`#${updatedId}`).setAttribute("data-bubbleText", "");
331
332
  }
@@ -364,6 +365,7 @@ const Ai12zKnowledgeBox = class {
364
365
  this.handleMessage(messageData, `${this.domId}`); // Use the unique ID to handle messages
365
366
  });
366
367
  this.socket.on(endEvent, async (rawData) => {
368
+ var _a, _b;
367
369
  const data = protocol === "v2" ? responseAdapter.adaptCompleteToLegacy(rawData) : rawData;
368
370
  this.isStreaming = false;
369
371
  this.messageReceived.emit({ data, domId: this.domId });
@@ -374,6 +376,19 @@ const Ai12zKnowledgeBox = class {
374
376
  this.isLoading = false;
375
377
  this.searchResults = data;
376
378
  this.error = null;
379
+ // Save conversation id from response for later use
380
+ this.questionId = (_b = (_a = data.conversationId) !== null && _a !== void 0 ? _a : data.conversation_id) !== null && _b !== void 0 ? _b : this.questionId;
381
+ // If this is the very first conversation, inform the beacon util
382
+ if (this.questionId) {
383
+ // `setConversationId` is idempotent and will no-op if already stored
384
+ try {
385
+ // Call asynchronously, don't await to avoid blocking UI
386
+ void beacon.setConversationId(this.dataKey, this.dataMode, this.questionId);
387
+ }
388
+ catch (e) {
389
+ console.error("Failed to set beacon conversation id:", e);
390
+ }
391
+ }
377
392
  const controlMatches = finalHtml.match(/\[control[^\]]*\]/g) || [];
378
393
  if (finalHtml.indexOf("[control") > -1 && controlMatches.length > 0) {
379
394
  this.showButton = false;
@@ -385,19 +400,6 @@ const Ai12zKnowledgeBox = class {
385
400
  }
386
401
  });
387
402
  }
388
- // invokeSurvey = chat => {
389
- // const formModel = chat.controlData.form_model
390
- // const survey = new window["Survey"].Model(formModel)
391
- // const domELe = this.element.shadowRoot.querySelector(`#${this.domId}`).shadowRoot.querySelector(`#${this.surveyDomId}`)
392
- // if (domELe) {
393
- // survey.render(domELe)
394
- // // window["jQuery"](domELe).Survey({ model: survey })
395
- // } else {
396
- // console.error("Survey Element not found")
397
- // }
398
- // survey.showCompletedPage = false
399
- // survey.onComplete.add(this.alertResults)
400
- // }
401
403
  addEventListeners(msgId) {
402
404
  const container = this.el.shadowRoot.querySelector(msgId);
403
405
  if (container) {
@@ -410,10 +412,13 @@ const Ai12zKnowledgeBox = class {
410
412
  });
411
413
  }
412
414
  }
413
- componentWillLoad() {
415
+ async componentWillLoad() {
414
416
  styleSheetRegistry.adoptStyleSheet(`https://cdn.ai12z.net/assets/bot/${index.Env.CDN_PATH}/tailwind.min.css`, this.el.shadowRoot);
415
417
  this.socketConnection();
416
- this.getConfig();
418
+ await this.getConfig();
419
+ // initialize beacon asynchronously so slow/blocked beacon endpoints
420
+ // don't delay component rendering
421
+ void beacon.initBeacon(this.dataKey, this.dataMode);
417
422
  const w = window;
418
423
  if (!w.ai12z)
419
424
  w.ai12z = {};
@@ -607,7 +612,7 @@ const Ai12zKnowledgeBox = class {
607
612
  }
608
613
  render() {
609
614
  var _a, _b;
610
- return (index.h("div", { key: 'c31a4219d05067e80e11380affc8be5808d8d505', class: "ai12z-kb-wrapper" }, this.error ? index.h("p", { class: "ai12z-suggest-error-msg" }, "Error please try again!") : null, this.items.map(item => {
615
+ return (index.h("div", { key: '9d747b9e61054dd6ca9c0ccbe0395375fd500344', class: "ai12z-kb-wrapper" }, this.error ? index.h("p", { class: "ai12z-suggest-error-msg" }, "Error please try again!") : null, this.items.map(item => {
611
616
  var _a, _b, _c, _d;
612
617
  return (index.h("div", { class: "prose max-w-none ai12z-suggest-container" }, index.h("div", null, index.h("div", null, index.h("div", { class: "flex flex-row gap-1" }, index.h("div", { class: "flex items-center gap-2 mb-3", style: { width: "90%" } }, ((_a = this.kbSettings) === null || _a === void 0 ? void 0 : _a.showTitle) && (index.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" : "") }, index.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) && (index.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 && (index.h("div", null, index.h("button", { id: `thumbsUp_${item.insightId}`, onClick: () => {
613
618
  var _a;
@@ -627,8 +632,8 @@ const Ai12zKnowledgeBox = class {
627
632
  projectId: (_a = this.kbSettings) === null || _a === void 0 ? void 0 : _a.pId,
628
633
  questionText: this.question,
629
634
  });
630
- }, class: "chat-thumbs-down", "aria-label": "Thumbs Down" }, index.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" }, index.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 && (index.h("div", null, ((_d = this.searchResults) === null || _d === void 0 ? void 0 : _d.controlType) !== "form" && (index.h("ai12z-chat-message", { id: item.id, text: this.currentStreamingText, kbSettings: this.kbSettings, "show-button": this.showButton, streaming: this.isStreaming && item.id === this.domId })), index.h("div", { class: { "ai12z-suggest-relevance": true, "ai12z-suggest-hide": !item["isRelevance"] } }, index.h("a", { href: "" }, item["relevanceScore"])), index.h("div", { class: "custom-privacy" }, index.h("slot", { name: "custom-privacy" })))), this.isLoading && (index.h("div", { class: "w-full rounded-md", id: "spinner" }, index.h("div", { class: "flex animate-pulse space-x-4" }, index.h("div", { class: "flex-1 space-y-3 py-1" }, index.h("div", { class: "h-4 rounded bg-gray-200" }), index.h("div", { class: "space-y-3" }, index.h("div", { class: "grid grid-cols-3 gap-4" }, index.h("div", { class: "col-span-2 h-4 rounded bg-gray-200" }), index.h("div", { class: "col-span-1 h-4 rounded bg-gray-200" })), index.h("div", { class: "h-4 rounded bg-gray-200" })))))))));
631
- }), ((_a = this.kbSettings) === null || _a === void 0 ? void 0 : _a.questionType) === "staticHtml" && this.items.length === 0 && this.welcomeReady && (index.h("div", { key: 'd893adcba892e17f3ed2d155d84faa2e2453178b', class: "ai12z-suggest-answer", innerHTML: (_b = this.kbSettings.welcome) === null || _b === void 0 ? void 0 : _b.message }))));
635
+ }, class: "chat-thumbs-down", "aria-label": "Thumbs Down" }, index.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" }, index.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 && (index.h("div", null, ((_d = this.searchResults) === null || _d === void 0 ? void 0 : _d.controlType) !== "form" && (index.h("ai12z-chat-message", { id: item.id, text: this.currentStreamingText, kbSettings: this.kbSettings, "show-button": this.showButton, streaming: this.isStreaming && item.id === this.domId })), index.h("div", { class: { "ai12z-suggest-relevance": true, "ai12z-suggest-hide": !item["isRelevance"] } }, index.h("a", { href: "" }, item === null || item === void 0 ? void 0 : item["relevanceScore"])), index.h("div", { class: "custom-privacy" }, index.h("slot", { name: "custom-privacy" })))), this.isLoading && (index.h("div", { class: "w-full rounded-md", id: "spinner" }, index.h("div", { class: "flex animate-pulse space-x-4" }, index.h("div", { class: "flex-1 space-y-3 py-1" }, index.h("div", { class: "h-4 rounded bg-gray-200" }), index.h("div", { class: "space-y-3" }, index.h("div", { class: "grid grid-cols-3 gap-4" }, index.h("div", { class: "col-span-2 h-4 rounded bg-gray-200" }), index.h("div", { class: "col-span-1 h-4 rounded bg-gray-200" })), index.h("div", { class: "h-4 rounded bg-gray-200" })))))))));
636
+ }), ((_a = this.kbSettings) === null || _a === void 0 ? void 0 : _a.questionType) === "staticHtml" && this.items.length === 0 && this.welcomeReady && (index.h("div", { key: 'a3f629f01085a549c76ca8c19baaf93431e4b255', class: "ai12z-suggest-answer", innerHTML: (_b = this.kbSettings.welcome) === null || _b === void 0 ? void 0 : _b.message }))));
632
637
  }
633
638
  static get assetsDirs() { return ["assets"]; }
634
639
  get el() { return index.getElement(this); }
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  var index = require('./index-v8T1EJAJ.js');
4
- var utils = require('./utils-C2m26j54.js');
4
+ var utils = require('./utils-BsCPba57.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}`;