ai12z 3.16.1-alpha.4 → 3.16.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (153) hide show
  1. package/dist/cjs/ai12z-beacon.cjs.entry.js +4 -4
  2. package/dist/cjs/ai12z-bot.cjs.entry.js +21 -14
  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 +14 -14
  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 +21 -21
  11. package/dist/cjs/ai12z-search-panel.cjs.entry.js +1 -1
  12. package/dist/cjs/{beacon-B9ZWQpG6.js → beacon-Bhd49ADQ.js} +26 -10
  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 -16
  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 +12 -5
  30. package/dist/collection/components/ai12z-cta/ai12z-cta.js +1 -1
  31. package/dist/collection/components/ai12z-cta/components/Chat.js +5 -5
  32. package/dist/collection/components/ai12z-knowledge-box/ai12z-knowledge-box.js +15 -15
  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 +11 -11
  35. package/dist/collection/utils/beacon.js +25 -9
  36. package/dist/collection/utils/ctaHelpers.js +0 -16
  37. package/dist/collection/utils/utils.js +4 -4
  38. package/dist/components/ai12z-beacon.js +1 -1
  39. package/dist/components/ai12z-bot.js +1 -1
  40. package/dist/components/ai12z-chat-message.js +1 -1
  41. package/dist/components/ai12z-chat.js +1 -1
  42. package/dist/components/ai12z-container.js +1 -1
  43. package/dist/components/ai12z-cta.js +1 -1
  44. package/dist/components/ai12z-form.js +1 -1
  45. package/dist/components/ai12z-inline-search.js +1 -1
  46. package/dist/components/ai12z-input-form.js +1 -1
  47. package/dist/components/ai12z-knowledge-box.js +1 -1
  48. package/dist/components/ai12z-search-panel.js +1 -1
  49. package/dist/components/audio-recorder.js +1 -1
  50. package/dist/components/dynamic-form.js +1 -1
  51. package/dist/components/index.js +1 -1
  52. package/dist/components/interaction-buttons.js +1 -1
  53. package/dist/components/item-list.js +1 -1
  54. package/dist/components/{p-yMwHPq7E.js → p-9LYL2tKU.js} +1 -1
  55. package/dist/components/{p-DRL0IYV2.js → p-BO2WmSX3.js} +1 -1
  56. package/dist/components/{p-DZ5YGUeY.js → p-BRLTYejK.js} +1 -1
  57. package/dist/components/p-B_GRAsXZ.js +1 -0
  58. package/dist/components/{p-BblvvyaD.js → p-BeRVlX-3.js} +1 -1
  59. package/dist/components/{p-C5vYK3Om.js → p-BjX5cCOG.js} +1 -1
  60. package/dist/components/{p-CVJPxD1X.js → p-CAK1__lu.js} +2 -2
  61. package/dist/components/p-CHrTVomR.js +31 -0
  62. package/dist/components/p-CMc63lZp.js +1 -0
  63. package/dist/components/p-CO7OM6cu.js +1 -0
  64. package/dist/components/{p-2TKoA-vX.js → p-CWoExQML.js} +1 -1
  65. package/dist/components/p-CYh3so8v.js +1 -0
  66. package/dist/components/p-CnIXGAt8.js +1 -0
  67. package/dist/components/{p-D_u0brDS.js → p-Cywgam3s.js} +1 -1
  68. package/dist/components/p-DKF8ThBg.js +1 -0
  69. package/dist/components/{p-DjYUZbG5.js → p-DOynMJxg.js} +1 -1
  70. package/dist/components/{p-fFDvCr1L.js → p-DURIlC18.js} +1 -1
  71. package/dist/components/{p-zx_1qRzz.js → p-Dc7unp-V.js} +1 -1
  72. package/dist/components/{p-q7LAuIXC.js → p-Dcj3Mokc.js} +1 -1
  73. package/dist/components/{p-CrAK1XF4.js → p-DxKyMupy.js} +1 -1
  74. package/dist/components/p-HTPyCRCK.js +1 -0
  75. package/dist/components/{p-6PZtsZH1.js → p-UVgSZ7fz.js} +1 -1
  76. package/dist/components/{p-OAsYsTgR.js → p-fVj5IyS0.js} +1 -1
  77. package/dist/components/privacy-modal.js +1 -1
  78. package/dist/components/search-results-page.js +1 -1
  79. package/dist/esm/ai12z-beacon.entry.js +4 -4
  80. package/dist/esm/ai12z-bot.entry.js +21 -14
  81. package/dist/esm/ai12z-category_2.entry.js +3 -3
  82. package/dist/esm/ai12z-chat-message.entry.js +13 -13
  83. package/dist/esm/ai12z-chat_2.entry.js +14 -14
  84. package/dist/esm/ai12z-container.entry.js +3 -3
  85. package/dist/esm/ai12z-cta.entry.js +6 -6
  86. package/dist/esm/ai12z-form.entry.js +2 -2
  87. package/dist/esm/ai12z-inline-search.entry.js +2 -2
  88. package/dist/esm/ai12z-knowledge-box.entry.js +21 -21
  89. package/dist/esm/ai12z-search-panel.entry.js +1 -1
  90. package/dist/esm/{beacon-CTeIOnFW.js → beacon-BLOfGU2-.js} +26 -10
  91. package/dist/esm/chat-avatar_6.entry.js +1 -1
  92. package/dist/esm/{ctaHelpers-BxYDDl6j.js → ctaHelpers-GH6upqgA.js} +1 -1
  93. package/dist/esm/dynamic-form.entry.js +1 -1
  94. package/dist/esm/{index-BSAVvAU7.js → index-CjSLTZFw.js} +1 -1
  95. package/dist/esm/index.js +11 -11
  96. package/dist/esm/item-list.entry.js +2 -2
  97. package/dist/esm/{keyboard-shortcuts-Iro3156u.js → keyboard-shortcuts-DNhwh88a.js} +2 -2
  98. package/dist/esm/{parseHelper-D_HyZ-hh.js → parseHelper-B4cZLEeX.js} +1 -1
  99. package/dist/esm/{processCarouselData-MkXYTDY2.js → processCarouselData-CgoPoIF_.js} +1 -1
  100. package/dist/esm/{reCaptchaHelpers-M2SfYLz1.js → reCaptchaHelpers-O2ugKpWf.js} +1 -1
  101. package/dist/esm/search-results-page.entry.js +16 -16
  102. package/dist/esm/{socket-service-DBZCOxQR.js → socket-service-B6aew9Me.js} +1 -1
  103. package/dist/esm/{styleSheetRegistry-CxLH9Q0z.js → styleSheetRegistry-DxStYIoa.js} +1 -1
  104. package/dist/esm/{surveyHelpers-B_IO8diu.js → surveyHelpers-Cbq2vpWj.js} +1 -1
  105. package/dist/esm/{utils-CgIk6Jbn.js → utils-qg8o2dBJ.js} +4 -4
  106. package/dist/library/index.esm.js +1 -1
  107. package/dist/library/library.esm.js +1 -1
  108. package/dist/library/p-03851cc8.entry.js +1 -0
  109. package/dist/library/{p-ae810ce7.entry.js → p-2d8497d9.entry.js} +1 -1
  110. package/dist/library/{p-c60d1052.entry.js → p-4a41a902.entry.js} +2 -2
  111. package/dist/library/{p-4594fac4.entry.js → p-4e8c0e1b.entry.js} +1 -1
  112. package/dist/library/p-516bf868.entry.js +1 -0
  113. package/dist/library/p-65d17a5b.entry.js +1 -0
  114. package/dist/library/{p-07ac3aeb.entry.js → p-751e9420.entry.js} +1 -1
  115. package/dist/library/p-CTRVp5uQ.js +1 -0
  116. package/dist/library/{p-Dwtvt1Ju.js → p-CZBOULiw.js} +1 -1
  117. package/dist/library/{p-CGdgvo_b.js → p-CrPwKEk_.js} +1 -1
  118. package/dist/library/{p-BnkN4SP7.js → p-Cwv5wtEw.js} +1 -1
  119. package/dist/library/{p-D85u0uEM.js → p-CzTa5Msf.js} +1 -1
  120. package/dist/library/p-D5HnlfHT.js +1 -0
  121. package/dist/library/{p-BpnISGA6.js → p-DPxJK7tl.js} +1 -1
  122. package/dist/library/{p-C9xkKjGV.js → p-DheNz53W.js} +1 -1
  123. package/dist/library/{p-DCiuGcUL.js → p-DkZf86Si.js} +1 -1
  124. package/dist/library/{p-Jb6LBYBH.js → p-FOOni1Nh.js} +1 -1
  125. package/dist/library/{p-CCEJFtl1.js → p-TJudQcMS.js} +4 -4
  126. package/dist/library/{p-aa6b173e.entry.js → p-ad825010.entry.js} +1 -1
  127. package/dist/library/p-b01d3dff.entry.js +1 -0
  128. package/dist/library/{p-758ccdb5.entry.js → p-bb534b71.entry.js} +1 -1
  129. package/dist/library/{p-338a8f28.entry.js → p-d45bc8fa.entry.js} +1 -1
  130. package/dist/library/p-d4e410ff.entry.js +1 -0
  131. package/dist/library/{p-5903cc93.entry.js → p-eb4f0ea7.entry.js} +1 -1
  132. package/dist/library/p-f1b93099.entry.js +1 -0
  133. package/dist/library/{p-e18997fc.entry.js → p-f5bb347f.entry.js} +1 -1
  134. package/dist/types/utils/beacon.d.ts +2 -2
  135. package/dist/types/utils/ctaHelpers.d.ts +0 -1
  136. package/dist/types/utils/utils.d.ts +3 -3
  137. package/package.json +2 -2
  138. package/dist/components/p-C-IKmqII.js +0 -1
  139. package/dist/components/p-CX6EbMog.js +0 -1
  140. package/dist/components/p-Cmj8wElU.js +0 -1
  141. package/dist/components/p-CvPbldU0.js +0 -1
  142. package/dist/components/p-DVnjJHuQ.js +0 -1
  143. package/dist/components/p-Db3MSI1b.js +0 -1
  144. package/dist/components/p-Dy72Ri-1.js +0 -1
  145. package/dist/components/p-SMXYqOvq.js +0 -31
  146. package/dist/library/p-324fbc31.entry.js +0 -1
  147. package/dist/library/p-759e5580.entry.js +0 -1
  148. package/dist/library/p-952d0734.entry.js +0 -1
  149. package/dist/library/p-AtKfoKg4.js +0 -1
  150. package/dist/library/p-BXxt773d.js +0 -1
  151. package/dist/library/p-b3d39c03.entry.js +0 -1
  152. package/dist/library/p-da1f61b5.entry.js +0 -1
  153. package/dist/library/p-f922f9f3.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-B9ZWQpG6.js');
5
- require('./utils-C2m26j54.js');
4
+ var beacon = require('./beacon-Bhd49ADQ.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-B9ZWQpG6.js');
17
+ var parseHelper = require('./parseHelper-B8pslVtS.js');
18
+ var beacon = require('./beacon-Bhd49ADQ.js');
19
19
  var bodyScrollLock = require('./bodyScrollLock-C7gKTAfx.js');
20
20
  require('./_commonjsHelpers-MBWFX2dn.js');
21
21
 
@@ -1321,7 +1321,6 @@ const Ai12zBot = class {
1321
1321
  ];
1322
1322
  if (this.messages.length === 2) {
1323
1323
  this.visitorID = utils.getOrCreateVisitorId();
1324
- beacon.setConversationId(this.dataKey, this.conversationId);
1325
1324
  }
1326
1325
  this.checkHistory();
1327
1326
  setTimeout(() => {
@@ -1808,7 +1807,7 @@ const Ai12zBot = class {
1808
1807
  this.timestamp = utils.formatTimestamp(new Date());
1809
1808
  this.updateScreenSize();
1810
1809
  await this.configBot();
1811
- beacon.initBeacon(this.dataKey);
1810
+ beacon.initBeacon(this.dataKey, this.dataMode);
1812
1811
  this.visitorID = "ai12z-" + localStorage.getItem(`ai12z-visitorId`);
1813
1812
  // Now safely read state with valid pId
1814
1813
  this.hydrateStateFromStorage();
@@ -2262,6 +2261,11 @@ const Ai12zBot = class {
2262
2261
  this.currentDomId = id;
2263
2262
  if (idChanged)
2264
2263
  this.messages = [...this.messages];
2264
+ // capture once, before handleEndResponse mutates this.messages
2265
+ const isFirstExchange = this.messages.length === 2;
2266
+ if (isFirstExchange) {
2267
+ beacon.setConversationId(this.dataKey, this.dataMode, data.conversationId);
2268
+ }
2265
2269
  if (!orphaned) {
2266
2270
  this.messageReceived.emit({ data, domId: this.currentDomId });
2267
2271
  }
@@ -2338,7 +2342,7 @@ const Ai12zBot = class {
2338
2342
  isOpened: this.isOpened,
2339
2343
  isExpanded: this.isExpanded,
2340
2344
  });
2341
- if (this.visitorID && this.messages.length === 2) {
2345
+ if (this.visitorID && isFirstExchange) {
2342
2346
  const sessionKey = botHelpers.getBotStateKey(this.botSettings.pId, (_f = this.botSettings._id) === null || _f === void 0 ? void 0 : _f.$oid);
2343
2347
  sessionStorage.setItem(sessionKey, JSON.stringify({
2344
2348
  isMinimized: this.isMinimized,
@@ -2729,7 +2733,7 @@ const Ai12zBot = class {
2729
2733
  this.autoScrollTimer = setTimeout(() => this.scrollToBottom(), 60);
2730
2734
  }
2731
2735
  checkLiveAgentMode() {
2732
- var _a, _b, _c, _d;
2736
+ var _a, _b, _c, _d, _f, _g, _h, _j, _k, _l;
2733
2737
  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;
2734
2738
  /**
2735
2739
  * Check if live agent is enabled
@@ -2739,7 +2743,10 @@ const Ai12zBot = class {
2739
2743
  * and there is a conversation history to refer to.
2740
2744
  * This prevents the live agent from being connected immediately when the chat is opened.
2741
2745
  */
2742
- this.isLiveAgentEnabled = isLiveAgentConfigured && this.messages.length > 1;
2746
+ 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;
2747
+ 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;
2748
+ const withinHours = bh && tz ? botHelpers.checkBusinessHours(bh, tz) : true;
2749
+ this.isLiveAgentEnabled = isLiveAgentConfigured && this.messages.length > 1 && withinHours;
2743
2750
  }
2744
2751
  openEndLiveAgentDialog() {
2745
2752
  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-B9ZWQpG6.js');
14
+ var beacon = require('./beacon-Bhd49ADQ.js');
15
15
  require('./_commonjsHelpers-MBWFX2dn.js');
16
16
  require('./logger-2ZBZCKdM.js');
17
17
  require('./response-adapter-CKKyyhMj.js');
@@ -400,6 +400,9 @@ const MyChat = class {
400
400
  }
401
401
  this.scrollToLatestBubble();
402
402
  this.isProcessingEndResponse = true;
403
+ if (this.chats.length === 2) {
404
+ beacon.setConversationId(this.apiKey, this.env, event.detail.conversationId);
405
+ }
403
406
  // const idx = this.chats.findIndex(item => item.id === this.aiMessageId)
404
407
  requestAnimationFrame(async () => {
405
408
  var _a, _b, _c, _d;
@@ -455,9 +458,6 @@ const MyChat = class {
455
458
  });
456
459
  // ✅ Common cleanup
457
460
  this.conversationId = event.detail.conversationId;
458
- if (this.chats.length === 2) {
459
- beacon.setConversationId(this.apiKey, this.conversationId);
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 = "";
463
463
  }
@@ -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: '0ffe4268143c465bfd5b0ef098680d355aa49527' }, index.h("ul", { key: '2ca1aaa847f8cd9a184a70bbd833f75d148cbd18', 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: '9786756a0b61d0f64e57dd3518dd48f6531345ae', 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-B9ZWQpG6.js');
8
+ var reCaptchaHelpers = require('./reCaptchaHelpers-Djq71pt4.js');
9
+ var ctaHelpers = require('./ctaHelpers-DL-PGlAx.js');
10
+ var beacon = require('./beacon-Bhd49ADQ.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,16 +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-B9ZWQpG6.js');
13
+ var beacon = require('./beacon-Bhd49ADQ.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)}}`;
@@ -45,15 +45,15 @@ const Ai12zKnowledgeBox = class {
45
45
  }, 1000);
46
46
  };
47
47
  this.updateResponseContent = (htmlContent) => {
48
- var _a, _b;
48
+ var _a, _b, _c, _d, _e, _f, _g, _h;
49
49
  const newTodo = {
50
50
  id: this.domId,
51
51
  answer: htmlContent,
52
- title: (_a = this.kbSettings.title) !== null && _a !== void 0 ? _a : this.question,
53
- relevanceScore: this.searchResults["relevanceScore"],
54
- isRelevance: this.kbSettings.relevanceScore,
55
- insightId: this.searchResults["insightId"],
56
- 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,
57
57
  };
58
58
  this.items = this.items.map(item => (item.id === this.domId ? newTodo : item));
59
59
  this.currentStreamingText = htmlContent; // set final answer
@@ -300,7 +300,7 @@ const Ai12zKnowledgeBox = class {
300
300
  });
301
301
  }
302
302
  getResults(type) {
303
- var _a, _b;
303
+ var _a, _b, _c, _d;
304
304
  // console.log("Getting results for question:", this.question)
305
305
  try {
306
306
  if (this.question) {
@@ -311,9 +311,9 @@ const Ai12zKnowledgeBox = class {
311
311
  answer: " ",
312
312
  title: "",
313
313
  relevanceScore: "",
314
- isRelevance: this.kbSettings.relevanceScore,
314
+ isRelevance: (_a = this.kbSettings) === null || _a === void 0 ? void 0 : _a.relevanceScore,
315
315
  insightId: "",
316
- 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,
317
317
  };
318
318
  if (type === "add" || (this.items && this.items.length === 0)) {
319
319
  this.socket.off("response");
@@ -326,7 +326,7 @@ const Ai12zKnowledgeBox = class {
326
326
  const updatedId = this.items[0].id;
327
327
  this.items = [...this.items, newTodo];
328
328
  this.items = this.items.filter(item => item.id !== updatedId);
329
- 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}`)) {
330
330
  this.el.shadowRoot.querySelector(`#${updatedId}`).innerHTML = "";
331
331
  this.el.shadowRoot.querySelector(`#${updatedId}`).setAttribute("data-bubbleText", "");
332
332
  }
@@ -383,7 +383,7 @@ const Ai12zKnowledgeBox = class {
383
383
  // `setConversationId` is idempotent and will no-op if already stored
384
384
  try {
385
385
  // Call asynchronously, don't await to avoid blocking UI
386
- void beacon.setConversationId(this.dataKey, this.questionId);
386
+ void beacon.setConversationId(this.dataKey, this.dataMode, this.questionId);
387
387
  }
388
388
  catch (e) {
389
389
  console.error("Failed to set beacon conversation id:", e);
@@ -418,7 +418,7 @@ const Ai12zKnowledgeBox = class {
418
418
  await this.getConfig();
419
419
  // initialize beacon asynchronously so slow/blocked beacon endpoints
420
420
  // don't delay component rendering
421
- void beacon.initBeacon(this.dataKey);
421
+ void beacon.initBeacon(this.dataKey, this.dataMode);
422
422
  const w = window;
423
423
  if (!w.ai12z)
424
424
  w.ai12z = {};
@@ -612,7 +612,7 @@ const Ai12zKnowledgeBox = class {
612
612
  }
613
613
  render() {
614
614
  var _a, _b;
615
- return (index.h("div", { key: 'b2671211acc966388e020bf7f8ef62dfdbab9193', 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 => {
616
616
  var _a, _b, _c, _d;
617
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: () => {
618
618
  var _a;
@@ -632,8 +632,8 @@ const Ai12zKnowledgeBox = class {
632
632
  projectId: (_a = this.kbSettings) === null || _a === void 0 ? void 0 : _a.pId,
633
633
  questionText: this.question,
634
634
  });
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["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: '7ddf7c77ec816cb0029efc0978ea041bb8022a7b', 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 }))));
637
637
  }
638
638
  static get assetsDirs() { return ["assets"]; }
639
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}`;
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var utils = require('./utils-C2m26j54.js');
3
+ var utils = require('./utils-BsCPba57.js');
4
4
 
5
5
  const SUPPORTED_ENGINES = [
6
6
  "chatgpt",
@@ -85,6 +85,7 @@ const ENGINE_MAP = [
85
85
  { engine: "you", hosts: ["you.com"] },
86
86
  ];
87
87
  function detectEngine() {
88
+ var _a;
88
89
  const referrerUrl = getReferrerUrl();
89
90
  const hostname = referrerUrl === null || referrerUrl === void 0 ? void 0 : referrerUrl.hostname.toLowerCase();
90
91
  const currentHostname = window.location.hostname.toLowerCase();
@@ -107,6 +108,16 @@ function detectEngine() {
107
108
  // allow only a conservative charset for engine classification
108
109
  return /^[a-z0-9_.-]+$/.test(s) ? s : null;
109
110
  };
111
+ const sanitizeHostnameForEngine = (hostname) => {
112
+ if (!hostname)
113
+ return null;
114
+ const value = hostname.toLowerCase().trim();
115
+ // Don't truncate hostnames.
116
+ // Reject values that are too long or contain unexpected characters.
117
+ if (value.length > 253)
118
+ return null;
119
+ return /^[a-z0-9_.:-]+$/.test(value) ? value : null;
120
+ };
110
121
  const utmSource = sanitizeUtmForEngine(rawUtmSource);
111
122
  if (utmSource) {
112
123
  // If utm matches a supported engine, return that engine; otherwise
@@ -115,7 +126,7 @@ function detectEngine() {
115
126
  // the sentinel "other".
116
127
  return SUPPORTED_ENGINES.includes(utmSource) ? utmSource : utmSource;
117
128
  }
118
- return hostname && !isInternalReferrer ? hostname : "direct";
129
+ return hostname && !isInternalReferrer ? (_a = sanitizeHostnameForEngine(hostname)) !== null && _a !== void 0 ? _a : "direct" : "direct";
119
130
  }
120
131
  function inferEngineType(engine, explicitType) {
121
132
  return ENGINE_TYPE_MAP[engine];
@@ -152,10 +163,15 @@ async function waitForPendingBeacon(timeoutMs = 10000) {
152
163
  return sessionStorage.getItem("ai12zBeaconId");
153
164
  }
154
165
  // Hosts for which beacon creation and conversation setting should be disabled.
155
- let excludedBeaconHosts = ["ai12z.net"];
166
+ const excludedBeaconHosts = ["ai12z.net"];
167
+ const allowedBeaconHosts = ["docs.ai12z.net"];
156
168
  function isHostExcluded() {
157
169
  try {
158
170
  const hostname = window.location.hostname.toLowerCase();
171
+ // Explicitly allow docs.ai12z.net
172
+ if (allowedBeaconHosts.includes(hostname)) {
173
+ return false;
174
+ }
159
175
  return excludedBeaconHosts.some(h => h && (hostname === h || hostname.endsWith(`.${h}`)));
160
176
  }
161
177
  catch (_a) {
@@ -238,7 +254,7 @@ function buildBeacon() {
238
254
  },
239
255
  };
240
256
  }
241
- async function ensureBeacon(apiKey, force = false) {
257
+ async function ensureBeacon(apiKey, env, force = false) {
242
258
  const existingBeaconId = sessionStorage.getItem("ai12zBeaconId");
243
259
  // If host is excluded, do not create or return a beacon id
244
260
  if (isHostExcluded()) {
@@ -266,7 +282,7 @@ async function ensureBeacon(apiKey, force = false) {
266
282
  return sessionStorage.getItem("ai12zBeaconId");
267
283
  }
268
284
  try {
269
- const response = await utils.createBeacon({
285
+ const response = await utils.createBeacon(env, {
270
286
  apiKey,
271
287
  beacon: buildBeacon(),
272
288
  });
@@ -279,15 +295,15 @@ async function ensureBeacon(apiKey, force = false) {
279
295
  throw e;
280
296
  }
281
297
  }
282
- async function initBeacon(apiKey) {
298
+ async function initBeacon(apiKey, env) {
283
299
  try {
284
- await ensureBeacon(apiKey);
300
+ await ensureBeacon(apiKey, env);
285
301
  }
286
302
  catch (e) {
287
303
  console.error("Failed to initialize beacon:", e);
288
304
  }
289
305
  }
290
- async function setConversationId(apiKey, conversationId) {
306
+ async function setConversationId(apiKey, env, conversationId) {
291
307
  if (!conversationId) {
292
308
  return;
293
309
  }
@@ -301,11 +317,11 @@ async function setConversationId(apiKey, conversationId) {
301
317
  }
302
318
  try {
303
319
  // Force beacon creation if it doesn't already exist
304
- const beaconId = await ensureBeacon(apiKey, true);
320
+ const beaconId = await ensureBeacon(apiKey, env, true);
305
321
  if (!beaconId) {
306
322
  return;
307
323
  }
308
- await utils.setBeaconConversation({
324
+ await utils.setBeaconConversation(env, {
309
325
  apiKey,
310
326
  beaconId,
311
327
  conversationId,
@@ -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 analyticsService = require('./analyticsService-CkAva47S.js');
6
6
  var logger$1 = require('./logger-2ZBZCKdM.js');
7
7
 
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var utils = require('./utils-C2m26j54.js');
3
+ var utils = require('./utils-BsCPba57.js');
4
4
 
5
5
  // Utility: Generate UUID
6
6
  function generateUUID() {