ai12z 3.16.1-alpha.2 → 3.16.1-alpha.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (227) hide show
  1. package/dist/cjs/ai12z-beacon.cjs.entry.js +35 -0
  2. package/dist/cjs/ai12z-bot.cjs.entry.js +117 -55
  3. package/dist/cjs/ai12z-category_2.cjs.entry.js +7 -7
  4. package/dist/cjs/ai12z-chat-message.cjs.entry.js +4 -4
  5. package/dist/cjs/ai12z-chat_2.cjs.entry.js +23 -19
  6. package/dist/cjs/ai12z-container.cjs.entry.js +4 -4
  7. package/dist/cjs/ai12z-cta.cjs.entry.js +11 -5
  8. package/dist/cjs/ai12z-form.cjs.entry.js +3 -3
  9. package/dist/cjs/ai12z-inline-search.cjs.entry.js +5 -5
  10. package/dist/cjs/ai12z-knowledge-box.cjs.entry.js +7 -7
  11. package/dist/cjs/ai12z-search-panel.cjs.entry.js +4 -4
  12. package/dist/cjs/ai12z-spinner.cjs.entry.js +1 -1
  13. package/dist/cjs/beacon-BXbtC1CF.js +233 -0
  14. package/dist/cjs/bodyScrollLock-C7gKTAfx.js +69 -0
  15. package/dist/cjs/chat-avatar_6.cjs.entry.js +12 -12
  16. package/dist/cjs/chatbot-history_2.cjs.entry.js +1 -1
  17. package/dist/cjs/{ctaHelpers-DUPj5SnE.js → ctaHelpers-CmoXzyRy.js} +1 -1
  18. package/dist/cjs/dynamic-form.cjs.entry.js +2 -2
  19. package/dist/cjs/image-uploader_2.cjs.entry.js +1 -1
  20. package/dist/cjs/{index-CKLC7f4y.js → index-DbNk7qkZ.js} +1 -1
  21. package/dist/cjs/index.cjs.js +14 -10
  22. package/dist/cjs/item-list.cjs.entry.js +2 -2
  23. package/dist/cjs/{keyboard-shortcuts-BWprLtLj.js → keyboard-shortcuts-BpiAXzLW.js} +2 -2
  24. package/dist/cjs/library.cjs.js +1 -1
  25. package/dist/cjs/loader.cjs.js +1 -1
  26. package/dist/cjs/{parseHelper-5fRVefLm.js → parseHelper-CbA81TvP.js} +1 -1
  27. package/dist/cjs/{processCarouselData-kCVPE4mw.js → processCarouselData-Dl_WYwVE.js} +1 -1
  28. package/dist/cjs/{reCaptchaHelpers-sfktrnTF.js → reCaptchaHelpers-mbTvATH6.js} +1 -1
  29. package/dist/cjs/search-results-page.cjs.entry.js +14 -14
  30. package/dist/cjs/{socket-service-5mM7NSYN.js → socket-service-Cx-4DSqu.js} +1 -1
  31. package/dist/cjs/{styleSheetRegistry-CaWjqgX7.js → styleSheetRegistry-BmpJ3hCP.js} +1 -1
  32. package/dist/cjs/{surveyHelpers-DohugkWP.js → surveyHelpers-DFh4q1hj.js} +1 -1
  33. package/dist/cjs/{utils-7C5_GnyF.js → utils-C2m26j54.js} +19 -2
  34. package/dist/collection/collection-manifest.json +1 -0
  35. package/dist/collection/components/ai12z-beacon/ai12z-beacon.js +74 -0
  36. package/dist/collection/components/ai12z-bot/ai12z-bot.js +47 -6
  37. package/dist/collection/components/ai12z-bot/chat-history.js +1 -1
  38. package/dist/collection/components/ai12z-bot/components/hamburger-menu/hamburger-menu.js +4 -4
  39. package/dist/collection/components/ai12z-bot/components/interaction-buttons/interaction-buttons.js +5 -5
  40. package/dist/collection/components/ai12z-bot/components/liveagent-chat/liveagent-chat.js +1 -1
  41. package/dist/collection/components/ai12z-bot/components/typing-indicator/typing-indicator.js +1 -1
  42. package/dist/collection/components/ai12z-container/ai12z-container.js +1 -1
  43. package/dist/collection/components/ai12z-cta/ai12z-cta.css +2 -1
  44. package/dist/collection/components/ai12z-cta/ai12z-cta.js +6 -0
  45. package/dist/collection/components/ai12z-cta/components/Chat.js +6 -2
  46. package/dist/collection/components/ai12z-cta/components/DynamicForm.js +1 -1
  47. package/dist/collection/components/ai12z-cta/components/audiorecorder/audio-recorder.js +4 -4
  48. package/dist/collection/components/ai12z-form/ai12z-form.js +1 -1
  49. package/dist/collection/components/ai12z-inline-search/ai12z-inline-search.js +3 -3
  50. package/dist/collection/components/ai12z-knowledge-box/ai12z-knowledge-box.js +2 -2
  51. package/dist/collection/components/ai12z-knowledge-box/components/ai12z-chat-message.js +2 -2
  52. package/dist/collection/components/ai12z-search-panel/ai12z-search-panel.js +3 -3
  53. package/dist/collection/components/ai12z-search-panel/search-results-view.js +10 -10
  54. package/dist/collection/components/input/ImageUploader.js +1 -1
  55. package/dist/collection/components/input/Input.js +9 -9
  56. package/dist/collection/components/spinner/Spinner.js +1 -1
  57. package/dist/collection/index.js +1 -0
  58. package/dist/collection/utils/beacon.js +231 -0
  59. package/dist/collection/utils/bodyScrollLock.js +65 -0
  60. package/dist/collection/utils/ctaHelpers.js +16 -0
  61. package/dist/collection/utils/liveagents/chateventbus.js +16 -0
  62. package/dist/collection/utils/liveagents/providers/salesforce.js +8 -2
  63. package/dist/collection/utils/utils.js +17 -2
  64. package/dist/components/ai12z-beacon.d.ts +11 -0
  65. package/dist/components/ai12z-beacon.js +1 -0
  66. package/dist/components/ai12z-bot.js +1 -1
  67. package/dist/components/ai12z-category.js +1 -1
  68. package/dist/components/ai12z-chat-message.js +1 -1
  69. package/dist/components/ai12z-chat.js +1 -1
  70. package/dist/components/ai12z-container.js +1 -1
  71. package/dist/components/ai12z-cta.js +1 -1
  72. package/dist/components/ai12z-form.js +1 -1
  73. package/dist/components/ai12z-inline-search.js +1 -1
  74. package/dist/components/ai12z-input-form.js +1 -1
  75. package/dist/components/ai12z-knowledge-box.js +1 -1
  76. package/dist/components/ai12z-search-panel.js +1 -1
  77. package/dist/components/ai12z-spinner.js +1 -1
  78. package/dist/components/audio-recorder.js +1 -1
  79. package/dist/components/chat-avatar.js +1 -1
  80. package/dist/components/chatbot-history.js +1 -1
  81. package/dist/components/delete-confirmation-modal.js +1 -1
  82. package/dist/components/dynamic-form.js +1 -1
  83. package/dist/components/hamburger-menu.js +1 -1
  84. package/dist/components/image-uploader.js +1 -1
  85. package/dist/components/index.js +1 -1
  86. package/dist/components/interaction-buttons.js +1 -1
  87. package/dist/components/item-list.js +1 -1
  88. package/dist/components/keyboard-shortcuts-dialog.js +1 -1
  89. package/dist/components/live-agent-chat.js +1 -1
  90. package/dist/components/{p-DQKllbP7.js → p-2TKoA-vX.js} +1 -1
  91. package/dist/components/{p-BBkc2Zz3.js → p-6PZtsZH1.js} +1 -1
  92. package/dist/components/{p-BugQD-4q.js → p-7D8UwFfY.js} +1 -1
  93. package/dist/components/p-BMfSdozn.js +1 -0
  94. package/dist/components/{p-Cv-HbFj1.js → p-BblvvyaD.js} +1 -1
  95. package/dist/components/p-BxPHrPiR.js +1 -0
  96. package/dist/components/p-C5vYK3Om.js +1 -0
  97. package/dist/components/{p-C3hnDJ1x.js → p-C7Fh_H3H.js} +1 -1
  98. package/dist/components/p-CVJPxD1X.js +2 -0
  99. package/dist/components/{p-COOdy5C-.js → p-ClSkLu41.js} +1 -1
  100. package/dist/components/{p-C0caR14R.js → p-CrAK1XF4.js} +1 -1
  101. package/dist/components/p-CuvuE2zX.js +1 -0
  102. package/dist/components/{p-DndtP5Bd.js → p-CxxCQyur.js} +1 -1
  103. package/dist/components/{p-tEjcbjhZ.js → p-CztWNvRK.js} +1 -1
  104. package/dist/components/{p-9ZSKFUQq.js → p-D-0m820g.js} +1 -1
  105. package/dist/components/p-DBojmc3T.js +1 -0
  106. package/dist/components/p-DLOQS_dm.js +1 -0
  107. package/dist/components/{p-DvJUX5RM.js → p-DRL0IYV2.js} +1 -1
  108. package/dist/components/{p-BHZ4-nkE.js → p-DZ5YGUeY.js} +1 -1
  109. package/dist/components/{p-CcfettiK.js → p-D_3pXSAZ.js} +1 -1
  110. package/dist/components/{p-DiUq1_cL.js → p-D_u0brDS.js} +1 -1
  111. package/dist/components/{p-C2pbHN4a.js → p-DjYUZbG5.js} +1 -1
  112. package/dist/components/{p-BGqU6S_C.js → p-DmCL0aBr.js} +1 -1
  113. package/dist/components/p-DvxYmlU_.js +1 -0
  114. package/dist/components/p-FQgYAFAZ.js +1 -0
  115. package/dist/components/p-SMXYqOvq.js +31 -0
  116. package/dist/components/{p-DEkZRvM1.js → p-SoJiujnW.js} +1 -1
  117. package/dist/components/{p-k5IjpIIA.js → p-c6Z5KXDQ.js} +1 -1
  118. package/dist/components/{p-C3JmvA9z.js → p-fFDvCr1L.js} +1 -1
  119. package/dist/components/p-kJpnWRAF.js +1 -0
  120. package/dist/components/p-nxQB8VYC.js +1 -0
  121. package/dist/components/{p-NQcpUWMC.js → p-q7LAuIXC.js} +1 -1
  122. package/dist/components/{p-De--d4FT.js → p-rVmRQ8bG.js} +1 -1
  123. package/dist/components/p-vww9WgTo.js +1 -0
  124. package/dist/components/{p-hbJqzZAj.js → p-yMwHPq7E.js} +1 -1
  125. package/dist/components/{p-BOiNZwPJ.js → p-zx_1qRzz.js} +1 -1
  126. package/dist/components/privacy-modal.js +1 -1
  127. package/dist/components/search-results-page.js +1 -1
  128. package/dist/components/typing-indicator.js +1 -1
  129. package/dist/esm/{SearchResult-C3g6BSvv.js → SearchResult-BVGx7wDE.js} +1 -1
  130. package/dist/esm/ai12z-beacon.entry.js +33 -0
  131. package/dist/esm/ai12z-bot.entry.js +117 -55
  132. package/dist/esm/ai12z-category_2.entry.js +11 -11
  133. package/dist/esm/ai12z-chat-message.entry.js +5 -5
  134. package/dist/esm/ai12z-chat_2.entry.js +25 -21
  135. package/dist/esm/ai12z-container.entry.js +5 -5
  136. package/dist/esm/ai12z-cta.entry.js +14 -8
  137. package/dist/esm/ai12z-form.entry.js +5 -5
  138. package/dist/esm/ai12z-inline-search.entry.js +7 -7
  139. package/dist/esm/ai12z-knowledge-box.entry.js +8 -8
  140. package/dist/esm/ai12z-search-panel.entry.js +6 -6
  141. package/dist/esm/ai12z-spinner.entry.js +2 -2
  142. package/dist/esm/{app-store-BSQPOUME.js → app-store-DvKLN4Xd.js} +1 -1
  143. package/dist/esm/beacon-BZXo_E7d.js +230 -0
  144. package/dist/esm/bodyScrollLock-DvxYmlU_.js +67 -0
  145. package/dist/esm/chat-avatar_6.entry.js +14 -14
  146. package/dist/esm/chatbot-history_2.entry.js +2 -2
  147. package/dist/esm/{ctaHelpers-BOdS23pG.js → ctaHelpers-DcnA0MVw.js} +1 -1
  148. package/dist/esm/dynamic-form.entry.js +3 -3
  149. package/dist/esm/image-uploader_2.entry.js +2 -2
  150. package/dist/esm/{index-CZVgVfgd.js → index-CaCfv0ky.js} +1 -1
  151. package/dist/esm/{index-B9OPtxv2.js → index-DrTyKvbY.js} +1 -1
  152. package/dist/esm/index.js +18 -15
  153. package/dist/esm/item-list.entry.js +3 -3
  154. package/dist/esm/{keyboard-shortcuts-9ySnK42C.js → keyboard-shortcuts-BVIafjUQ.js} +2 -2
  155. package/dist/esm/library.js +3 -3
  156. package/dist/esm/loader.js +3 -3
  157. package/dist/esm/{logger-C0PEnW3T.js → logger-DuhlzN1_.js} +1 -1
  158. package/dist/esm/{parseHelper-TNZZ7pZJ.js → parseHelper-D4mtBh2Q.js} +2 -2
  159. package/dist/esm/{processCarouselData-BbqNSwni.js → processCarouselData-BMYrhEs4.js} +1 -1
  160. package/dist/esm/{reCaptchaHelpers-BRdKn-CM.js → reCaptchaHelpers-YIcqZyYx.js} +1 -1
  161. package/dist/esm/{scriptStyleLoader-_-YNtQPs.js → scriptStyleLoader-C_wSk9Fd.js} +1 -1
  162. package/dist/esm/search-results-page.entry.js +16 -16
  163. package/dist/esm/{socket-service-BaSfS-C4.js → socket-service-CRKef4T3.js} +2 -2
  164. package/dist/esm/{styleSheetRegistry-BccKic5X.js → styleSheetRegistry-DdPFpNJm.js} +1 -1
  165. package/dist/esm/{surveyHelpers-BeCs_jb6.js → surveyHelpers-D4TSNF8Y.js} +1 -1
  166. package/dist/esm/{utils-C75qrx0v.js → utils-ChO9VTBD.js} +19 -4
  167. package/dist/library/index.esm.js +1 -1
  168. package/dist/library/library.esm.js +1 -1
  169. package/dist/library/{p-ac9bbba9.entry.js → p-25f8585a.entry.js} +1 -1
  170. package/dist/library/{p-03e6c526.entry.js → p-2a0e8794.entry.js} +1 -1
  171. package/dist/library/{p-6c81c334.entry.js → p-556f02ab.entry.js} +2 -2
  172. package/dist/library/{p-21e30d74.entry.js → p-64e9659d.entry.js} +1 -1
  173. package/dist/library/p-84a3e86b.entry.js +1 -0
  174. package/dist/library/{p-48be863a.entry.js → p-8adc93e4.entry.js} +1 -1
  175. package/dist/library/{p-cd6d00c7.entry.js → p-90267282.entry.js} +1 -1
  176. package/dist/library/{p-09ccce13.entry.js → p-959d6f61.entry.js} +1 -1
  177. package/dist/library/{p-0a6d1461.entry.js → p-997e2c97.entry.js} +1 -1
  178. package/dist/library/{p-4b1b23ad.entry.js → p-9f812fb1.entry.js} +1 -1
  179. package/dist/library/{p-C33Bq1u3.js → p-BBQFikkr.js} +1 -1
  180. package/dist/library/{p-CVoJ6Qcc.js → p-BMrTd5IO.js} +1 -1
  181. package/dist/library/{p-CfHNdl7N.js → p-BSPqAtmB.js} +1 -1
  182. package/dist/library/{p-CZ_3jJSY.js → p-BioRZgoO.js} +1 -1
  183. package/dist/library/{p-CqE4eXes.js → p-BuRbL6gW.js} +1 -1
  184. package/dist/library/{p-SsXpfHmP.js → p-BxgpzgHw.js} +1 -1
  185. package/dist/library/p-C6mjQOfZ.js +1 -0
  186. package/dist/library/p-CQ3w1XSQ.js +1 -0
  187. package/dist/library/{p-BdtAdObU.js → p-CkHXycsT.js} +1 -1
  188. package/dist/library/{p-C7riVXol.js → p-D-02FHEk.js} +5 -5
  189. package/dist/library/{p-D5B5YlEl.js → p-DSFLm9UF.js} +1 -1
  190. package/dist/library/{p-DginFHFR.js → p-DjDuNItZ.js} +1 -1
  191. package/dist/library/{p-B9OPtxv2.js → p-DrTyKvbY.js} +1 -1
  192. package/dist/library/p-DvxYmlU_.js +1 -0
  193. package/dist/library/{p-CsG0EN7R.js → p-DxK9sK4Q.js} +1 -1
  194. package/dist/library/{p-B18nLcR3.js → p-Xl3fPHSq.js} +1 -1
  195. package/dist/library/{p-_4Q98Hn5.js → p-_n0zqQUg.js} +1 -1
  196. package/dist/library/{p-d39e26f2.entry.js → p-a7d3d165.entry.js} +1 -1
  197. package/dist/library/{p-4f5c680e.entry.js → p-c86ab9a1.entry.js} +1 -1
  198. package/dist/library/p-cca4ab89.entry.js +1 -0
  199. package/dist/library/p-d0537df4.entry.js +1 -0
  200. package/dist/library/{p-b744339c.entry.js → p-d4d66d5a.entry.js} +1 -1
  201. package/dist/library/{p-74379d4c.entry.js → p-d6e75352.entry.js} +1 -1
  202. package/dist/library/{p-d20ffcd1.entry.js → p-e068fafd.entry.js} +1 -1
  203. package/dist/library/p-e455d89a.entry.js +1 -0
  204. package/dist/types/components/ai12z-beacon/ai12z-beacon.d.ts +8 -0
  205. package/dist/types/components/ai12z-bot/ai12z-bot.d.ts +1 -0
  206. package/dist/types/components.d.ts +29 -0
  207. package/dist/types/index.d.ts +1 -0
  208. package/dist/types/utils/beacon.d.ts +62 -0
  209. package/dist/types/utils/bodyScrollLock.d.ts +12 -0
  210. package/dist/types/utils/ctaHelpers.d.ts +1 -0
  211. package/dist/types/utils/liveagents/chateventbus.d.ts +16 -0
  212. package/dist/types/utils/utils.d.ts +13 -0
  213. package/package.json +4 -3
  214. package/dist/components/p-B8jSr9lW.js +0 -1
  215. package/dist/components/p-C5rVF0zE.js +0 -2
  216. package/dist/components/p-CGQBDC3e.js +0 -31
  217. package/dist/components/p-CfmVopBG.js +0 -1
  218. package/dist/components/p-D-mcIUO8.js +0 -1
  219. package/dist/components/p-DlmdK220.js +0 -1
  220. package/dist/components/p-GhhnA1Fw.js +0 -1
  221. package/dist/components/p-Q3uBgncp.js +0 -1
  222. package/dist/components/p-ZQeNPv0R.js +0 -1
  223. package/dist/components/p-jD70af30.js +0 -1
  224. package/dist/library/p-1174b3f9.entry.js +0 -1
  225. package/dist/library/p-8f41d206.entry.js +0 -1
  226. package/dist/library/p-97c4b33d.entry.js +0 -1
  227. package/dist/library/p-C7dGy5Bg.js +0 -1
@@ -0,0 +1,35 @@
1
+ 'use strict';
2
+
3
+ var index = require('./index-v8T1EJAJ.js');
4
+ var beacon = require('./beacon-BXbtC1CF.js');
5
+ require('./utils-C2m26j54.js');
6
+
7
+ const Ai12zBeacon = class {
8
+ constructor(hostRef) {
9
+ index.registerInstance(this, hostRef);
10
+ this.dataKey = index.Env.DATA_KEY || "";
11
+ this.dataMode = index.Env.DATA_MODE || "prod";
12
+ }
13
+ componentWillLoad() {
14
+ this.initializeBeacon();
15
+ }
16
+ onDataKeyChange() {
17
+ this.initializeBeacon();
18
+ }
19
+ initializeBeacon() {
20
+ if (!this.dataKey) {
21
+ return;
22
+ }
23
+ beacon.initBeacon(this.dataKey);
24
+ }
25
+ render() {
26
+ return index.h(index.Host, { key: '0c87acbc61ff504f2cc6406be2e255e92f9e3220', hidden: true });
27
+ }
28
+ static get watchers() { return {
29
+ "dataKey": [{
30
+ "onDataKeyChange": 0
31
+ }]
32
+ }; }
33
+ };
34
+
35
+ exports.ai12z_beacon = Ai12zBeacon;
@@ -2,19 +2,21 @@
2
2
 
3
3
  var index = require('./index-v8T1EJAJ.js');
4
4
  var responseAdapter = require('./response-adapter-CKKyyhMj.js');
5
- var processCarouselData = require('./processCarouselData-kCVPE4mw.js');
6
- var logger$1 = require('./logger-2ZBZCKdM.js');
7
- var utils = require('./utils-7C5_GnyF.js');
8
- var index$1 = require('./index-CKLC7f4y.js');
5
+ var processCarouselData = require('./processCarouselData-Dl_WYwVE.js');
6
+ var logger$2 = require('./logger-2ZBZCKdM.js');
7
+ var utils = require('./utils-C2m26j54.js');
8
+ var index$1 = require('./index-DbNk7qkZ.js');
9
9
  var globalStore = require('./global-store-R6x06KvJ.js');
10
- var reCaptchaHelpers = require('./reCaptchaHelpers-sfktrnTF.js');
10
+ var reCaptchaHelpers = require('./reCaptchaHelpers-mbTvATH6.js');
11
11
  var botHelpers = require('./botHelpers-D5Dj7TRA.js');
12
- var surveyHelpers = require('./surveyHelpers-DohugkWP.js');
12
+ var surveyHelpers = require('./surveyHelpers-DFh4q1hj.js');
13
13
  var scriptStyleLoader = require('./scriptStyleLoader-D-bqKqSb.js');
14
- var keyboardShortcuts = require('./keyboard-shortcuts-BWprLtLj.js');
15
- var ctaHelpers = require('./ctaHelpers-DUPj5SnE.js');
14
+ var keyboardShortcuts = require('./keyboard-shortcuts-BpiAXzLW.js');
15
+ var ctaHelpers = require('./ctaHelpers-CmoXzyRy.js');
16
16
  var appStore = require('./app-store-BtkiHvcw.js');
17
- var parseHelper = require('./parseHelper-5fRVefLm.js');
17
+ var parseHelper = require('./parseHelper-CbA81TvP.js');
18
+ var beacon = require('./beacon-BXbtC1CF.js');
19
+ var bodyScrollLock = require('./bodyScrollLock-C7gKTAfx.js');
18
20
  require('./_commonjsHelpers-MBWFX2dn.js');
19
21
 
20
22
  // ILiveAgentProvider.ts
@@ -33,6 +35,22 @@ class LiveAgentAuthExpiredError extends Error {
33
35
  }
34
36
  }
35
37
 
38
+ /**
39
+ * Reduce a raw AGENT_ERROR reason to a fixed telemetry bucket. The raw text is
40
+ * untrusted upstream output and must not be re-logged or rendered by consumers
41
+ * — log the bucket instead. The emit site in salesforce.ts already records the
42
+ * full reason once (work items #4020, #4021).
43
+ */
44
+ function categorizeAgentErrorReason(reason) {
45
+ if (!reason)
46
+ return "unknown";
47
+ if (reason === "transport")
48
+ return "transport";
49
+ const status = /\b([1-5]\d{2})\b/.exec(reason);
50
+ if (status)
51
+ return `upstream_${status[1][0]}xx`;
52
+ return "upstream_other";
53
+ }
36
54
  class EventBus {
37
55
  constructor() {
38
56
  this.events = new Map();
@@ -54,8 +72,8 @@ class EventBus {
54
72
  }
55
73
  const ChatEventBus = new EventBus();
56
74
 
57
- const logger = new logger$1.Logger("SalesforceLiveAgentProvider", {
58
- logLevel: logger$1.LogLevel.Info, // Set to Debug for detailed logs",
75
+ const logger$1 = new logger$2.Logger("SalesforceLiveAgentProvider", {
76
+ logLevel: logger$2.LogLevel.Info, // Set to Debug for detailed logs",
59
77
  remoteLoggingUrl: "",
60
78
  });
61
79
  /**
@@ -86,12 +104,12 @@ class SalesforceLiveAgentProvider {
86
104
  },
87
105
  });
88
106
  if (!availabilityRes.ok) {
89
- logger.warn(`Agent availability check failed: ${availabilityRes.status} ${availabilityRes.statusText}`);
107
+ logger$1.warn(`Agent availability check failed: ${availabilityRes.status} ${availabilityRes.statusText}`);
90
108
  ChatEventBus.emit("AGENT_UNAVAILABLE", { reason: "request_error" });
91
109
  return false;
92
110
  }
93
111
  const availabilityData = await availabilityRes.json();
94
- logger.debug("Agent availability check result:", availabilityData);
112
+ logger$1.debug("Agent availability check result:", availabilityData);
95
113
  const entries = (_c = availabilityData === null || availabilityData === void 0 ? void 0 : availabilityData.conversationEntries) !== null && _c !== void 0 ? _c : [];
96
114
  const routingEntry = entries.find((e) => e.entryType === "RoutingResult");
97
115
  if (routingEntry) {
@@ -102,20 +120,20 @@ class SalesforceLiveAgentProvider {
102
120
  entryPayload = JSON.parse(entryPayload);
103
121
  }
104
122
  catch (_d) {
105
- logger.warn("Failed to parse RoutingResult entryPayload");
123
+ logger$1.warn("Failed to parse RoutingResult entryPayload");
106
124
  }
107
125
  }
108
126
  const failureReason = entryPayload === null || entryPayload === void 0 ? void 0 : entryPayload.failureReason;
109
127
  if (failureReason) {
110
- logger.warn("Routing failed with reason:", failureReason);
128
+ logger$1.warn("Routing failed with reason:", failureReason);
111
129
  ChatEventBus.emit("AGENT_UNAVAILABLE", { reason: failureReason });
112
130
  return false;
113
131
  }
114
- logger.debug("Agent routed successfully");
132
+ logger$1.debug("Agent routed successfully");
115
133
  return true;
116
134
  }
117
135
  // conversationEntries is empty — routing hasn't completed yet, retry
118
- logger.debug(`No RoutingResult yet (entries: ${entries.length}), retrying in ${POLL_INTERVAL_MS}ms…`);
136
+ logger$1.debug(`No RoutingResult yet (entries: ${entries.length}), retrying in ${POLL_INTERVAL_MS}ms…`);
119
137
  // await new Promise(resolve => setTimeout(resolve, POLL_INTERVAL_MS))
120
138
  await new Promise((resolve, reject) => {
121
139
  const t = setTimeout(resolve, POLL_INTERVAL_MS);
@@ -123,7 +141,7 @@ class SalesforceLiveAgentProvider {
123
141
  }).catch(() => null);
124
142
  }
125
143
  // Timed out — no routing result arrived within the window
126
- logger.warn("Timed out waiting for MIAW routing result");
144
+ logger$1.warn("Timed out waiting for MIAW routing result");
127
145
  ChatEventBus.emit("AGENT_UNAVAILABLE", { reason: "timeout" });
128
146
  return false;
129
147
  };
@@ -239,13 +257,13 @@ class SalesforceLiveAgentProvider {
239
257
  this.sendMessage({ isNewSession: true, sessionId: ((_m = this.sessionContext) === null || _m === void 0 ? void 0 : _m.sessionId) || "", message: formatInitialMessages });
240
258
  }
241
259
  if (await this.checkAgentAvailability(this.sessionContext.conversationId || "")) {
242
- logger.debug("Agent is available, starting to listen to messages");
260
+ logger$1.debug("Agent is available, starting to listen to messages");
243
261
  this.listenToMessages();
244
262
  }
245
263
  else {
246
264
  // AGENT_UNAVAILABLE (with reason: failureReason | "timeout" | "request_error")
247
265
  // was already emitted by checkAgentAvailability
248
- logger.warn("No agent assigned — skipping SSE listener setup");
266
+ logger$1.warn("No agent assigned — skipping SSE listener setup");
249
267
  }
250
268
  }
251
269
  }
@@ -255,7 +273,7 @@ class SalesforceLiveAgentProvider {
255
273
  */
256
274
  async initialize(startChatOptions) {
257
275
  var _a, _b, _c;
258
- logger.debug("Initializing Salesforce Live Agent Provider");
276
+ logger$1.debug("Initializing Salesforce Live Agent Provider");
259
277
  if (!this.configSettings) {
260
278
  this.configSettings = (startChatOptions === null || startChatOptions === void 0 ? void 0 : startChatOptions.config) || this.configSettings;
261
279
  }
@@ -279,7 +297,7 @@ class SalesforceLiveAgentProvider {
279
297
  await this.startSession();
280
298
  }
281
299
  catch (error) {
282
- logger.error("Error initializing Salesforce Live Agent Provider:", error);
300
+ logger$1.error("Error initializing Salesforce Live Agent Provider:", error);
283
301
  throw error;
284
302
  }
285
303
  }
@@ -304,7 +322,7 @@ class SalesforceLiveAgentProvider {
304
322
  }
305
323
  handleParticipantChange(event) {
306
324
  try {
307
- logger.debug("Participant change event received:", event.data);
325
+ logger$1.debug("Participant change event received:", event.data);
308
326
  if (!event.data)
309
327
  return;
310
328
  // Parse the event data
@@ -350,7 +368,7 @@ class SalesforceLiveAgentProvider {
350
368
  }
351
369
  }
352
370
  catch (error) {
353
- logger.error("Error handling participant change event:", error);
371
+ logger$1.error("Error handling participant change event:", error);
354
372
  // Handle error appropriately, e.g., log it or notify the user
355
373
  }
356
374
  }
@@ -381,7 +399,7 @@ class SalesforceLiveAgentProvider {
381
399
  * This is to prevent processing messages that are not relevant to the agent's response
382
400
  */
383
401
  if (((_b = (_a = data === null || data === void 0 ? void 0 : data.conversationEntry) === null || _a === void 0 ? void 0 : _a.sender) === null || _b === void 0 ? void 0 : _b.role) === "EndUser") {
384
- logger.debug("Ignoring message from EndUser role");
402
+ logger$1.debug("Ignoring message from EndUser role");
385
403
  return;
386
404
  }
387
405
  const entryPayload = JSON.parse(data.conversationEntry.entryPayload);
@@ -393,7 +411,7 @@ class SalesforceLiveAgentProvider {
393
411
  }
394
412
  }
395
413
  catch (error) {
396
- logger.error("Error handling participant message event:", error);
414
+ logger$1.error("Error handling participant message event:", error);
397
415
  // Handle error appropriately, e.g., log it or notify the user
398
416
  }
399
417
  }
@@ -413,7 +431,7 @@ class SalesforceLiveAgentProvider {
413
431
  // Parse the event data
414
432
  const data = JSON.parse(event.data);
415
433
  const entryPayload = JSON.parse(data.conversationEntry.entryPayload);
416
- logger.debug("Session status changed:", entryPayload === null || entryPayload === void 0 ? void 0 : entryPayload.sessionStatus);
434
+ logger$1.debug("Session status changed:", entryPayload === null || entryPayload === void 0 ? void 0 : entryPayload.sessionStatus);
417
435
  if ((entryPayload === null || entryPayload === void 0 ? void 0 : entryPayload.sessionStatus) === "Active") {
418
436
  ChatEventBus.emit("AGENT_SESSION_CREATED", true);
419
437
  }
@@ -431,13 +449,13 @@ class SalesforceLiveAgentProvider {
431
449
  }
432
450
  }
433
451
  catch (error) {
434
- logger.error("Error handling session status change event:", error);
452
+ logger$1.error("Error handling session status change event:", error);
435
453
  // Handle error appropriately, e.g., log it or notify the user
436
454
  }
437
455
  }
438
456
  listenToMessages() {
439
457
  var _a, _b, _c, _d;
440
- logger.debug("Listening to messages from Salesforce Live Agent");
458
+ logger$1.debug("Listening to messages from Salesforce Live Agent");
441
459
  // this.endpointSSE = "http://localhost:5050"
442
460
  // Close any existing connection before opening a new one (e.g. on resume)
443
461
  // so we don't leak a dangling SSE stream.
@@ -446,7 +464,7 @@ class SalesforceLiveAgentProvider {
446
464
  withCredentials: true,
447
465
  });
448
466
  if (!eventSource) {
449
- logger.error("Failed to create EventSource");
467
+ logger$1.error("Failed to create EventSource");
450
468
  throw new Error("Failed to create EventSource");
451
469
  }
452
470
  this.eventSource = eventSource;
@@ -460,32 +478,34 @@ class SalesforceLiveAgentProvider {
460
478
  // `upstream_error` event — see below — which is the preferred, unambiguous
461
479
  // channel; this stays as a defensive fallback.)
462
480
  const data = event === null || event === void 0 ? void 0 : event.data;
463
- logger.error(typeof data === "string" && data ? `❌ SSE server error frame: ${data}` : "❌ SSE Error: Connection lost or error occurred");
464
- ChatEventBus.emit("AGENT_ERROR", true);
481
+ logger$1.error(typeof data === "string" && data ? `❌ SSE server error frame: ${data}` : "❌ SSE Error: Connection lost or error occurred");
482
+ ChatEventBus.emit("AGENT_ERROR", {
483
+ reason: typeof data === "string" && data ? data : "transport",
484
+ });
465
485
  // Optionally, you can close the EventSource if needed
466
486
  eventSource.close();
467
487
  };
468
488
  eventSource.onopen = () => {
469
- logger.debug("✅ SSE Connection Established");
489
+ logger$1.debug("✅ SSE Connection Established");
470
490
  // ChatEventBus.emit("liveAgentReady", undefined)
471
491
  };
472
492
  const handleSSEMessage = (event) => {
473
493
  var _a, _b;
474
494
  try {
475
495
  const parsedEventData = JSON.parse(event.data);
476
- logger.debug("📡 Message Received on entrytype:", (_a = parsedEventData === null || parsedEventData === void 0 ? void 0 : parsedEventData.conversationEntry) === null || _a === void 0 ? void 0 : _a.entryType, " --- ", event.data);
496
+ logger$1.debug("📡 Message Received on entrytype:", (_a = parsedEventData === null || parsedEventData === void 0 ? void 0 : parsedEventData.conversationEntry) === null || _a === void 0 ? void 0 : _a.entryType, " --- ", event.data);
477
497
  // Handle incoming messages if needed
478
498
  switch ((_b = parsedEventData === null || parsedEventData === void 0 ? void 0 : parsedEventData.conversationEntry) === null || _b === void 0 ? void 0 : _b.entryType) {
479
499
  case "RoutingResult":
480
500
  case "RoutingWorkResult":
481
- logger.debug("Conversation Routing Result:", event.data);
501
+ logger$1.debug("Conversation Routing Result:", event.data);
482
502
  // Handle conversation routing result if needed
483
503
  // ChatEventBus.emit("AGENT_SESSION_CREATED", true)
484
504
  ChatEventBus.emit("FINDING_AGENT", event.data);
485
505
  // ChatEventBus.emit("AGENT_EVENT", [])
486
506
  break;
487
507
  case "ParticipantChanged":
488
- logger.debug("Conversation ParticipantChanged event received:", event === null || event === void 0 ? void 0 : event.data);
508
+ logger$1.debug("Conversation ParticipantChanged event received:", event === null || event === void 0 ? void 0 : event.data);
489
509
  // Check if the participant joining is an AGENT, not the user
490
510
  // ChatEventBus.emit("AGENT_SESSION_CREATED", true)
491
511
  this.handleParticipantChange(event);
@@ -499,7 +519,7 @@ class SalesforceLiveAgentProvider {
499
519
  break;
500
520
  case "DeliveryAcknowledgement":
501
521
  case "ReadAcknowledgement":
502
- logger.debug("Conversation event received:", event === null || event === void 0 ? void 0 : event.data);
522
+ logger$1.debug("Conversation event received:", event === null || event === void 0 ? void 0 : event.data);
503
523
  // Handle conversation close if needed
504
524
  // ChatEventBus.emit("AGENT_EVENT", event.data)
505
525
  break;
@@ -507,29 +527,29 @@ class SalesforceLiveAgentProvider {
507
527
  ChatEventBus.emit("TYPING_STARTED", true);
508
528
  break;
509
529
  case "TypingStoppedIndicator":
510
- logger.debug("Typing indicator received:", event.data);
530
+ logger$1.debug("Typing indicator received:", event.data);
511
531
  // Handle typing indicator if needed
512
532
  ChatEventBus.emit("TYPING_STOPPED", true);
513
533
  break;
514
534
  case "StreamingToken":
515
- logger.debug("Streaming token received", event.data);
535
+ logger$1.debug("Streaming token received", event.data);
516
536
  // Handle streaming token if needed
517
537
  // ChatEventBus.emit("streamingTokenReceived", event.data)
518
538
  break;
519
539
  case "ProgressIndicator":
520
- logger.debug("Progress indicator received", event.data);
540
+ logger$1.debug("Progress indicator received", event.data);
521
541
  // Handle progress indicator if needed
522
542
  // ChatEventBus.emit("progressIndicatorReceived", event.data)
523
543
  break;
524
544
  case "SessionStatusChanged":
525
- logger.debug("Session status changed event received", event.data);
545
+ logger$1.debug("Session status changed event received", event.data);
526
546
  // Handle session status change if needed
527
547
  this.handleSessionStatusChange(event);
528
548
  break;
529
549
  }
530
550
  }
531
551
  catch (e) {
532
- logger.error("Failed to parse event data:", e);
552
+ logger$1.error("Failed to parse event data:", e);
533
553
  return;
534
554
  }
535
555
  };
@@ -568,8 +588,12 @@ class SalesforceLiveAgentProvider {
568
588
  // so the specific status is logged and the user is notified. NOTE: the data is
569
589
  // plain text ("upstream returned 503"), so do NOT JSON.parse it.
570
590
  eventSource.addEventListener("upstream_error", (event) => {
571
- logger.error("❌ Live agent SSE upstream error:", event.data);
572
- ChatEventBus.emit("AGENT_ERROR", true);
591
+ logger$1.error("❌ Live agent SSE upstream error:", event.data);
592
+ ChatEventBus.emit("AGENT_ERROR", {
593
+ reason: typeof event.data === "string" && event.data
594
+ ? event.data
595
+ : "upstream_error",
596
+ });
573
597
  eventSource.close();
574
598
  });
575
599
  }
@@ -716,7 +740,7 @@ class SalesforceLiveAgentProvider {
716
740
  setTimeout(poll, 5000);
717
741
  }
718
742
  catch (err) {
719
- logger.error("Error on Polling", err.toString());
743
+ logger$1.error("Error on Polling", err.toString());
720
744
  reject(err);
721
745
  }
722
746
  };
@@ -731,7 +755,7 @@ class SalesforceLiveAgentProvider {
731
755
  * It checks the session context to determine if the session is active.
732
756
  */
733
757
  async isChatActive(sessionId) {
734
- logger.debug("sessionId", sessionId);
758
+ logger$1.debug("sessionId", sessionId);
735
759
  if (!this.sessionContext)
736
760
  return false;
737
761
  return this.sessionContext.isActive;
@@ -758,7 +782,7 @@ class SalesforceLiveAgentProvider {
758
782
  },
759
783
  });
760
784
  if (!(res === null || res === void 0 ? void 0 : res.ok)) {
761
- logger.warn(`Failed to end the chat`);
785
+ logger$1.warn(`Failed to end the chat`);
762
786
  }
763
787
  }
764
788
  }
@@ -770,7 +794,7 @@ class SalesforceLiveAgentProvider {
770
794
  * It returns an array of messages from the session context.
771
795
  */
772
796
  async getTranscript(sessionId) {
773
- logger.debug("sessionId", sessionId);
797
+ logger$1.debug("sessionId", sessionId);
774
798
  if (!this.sessionContext)
775
799
  return [];
776
800
  return this.sessionContext.initialMessages || [];
@@ -795,8 +819,8 @@ LiveAgentProvider.provider = "salesforce";
795
819
  /** Refactor the below to code to handle the liveagent events and integrate with the chat system ai12z-bot.tsx */
796
820
  class LiveAgentEventHandler {
797
821
  constructor() {
798
- this.logger = new logger$1.Logger("LiveAgentEventHandler", {
799
- logLevel: logger$1.LogLevel.Warn, // Set log level based on environment or configuration
822
+ this.logger = new logger$2.Logger("LiveAgentEventHandler", {
823
+ logLevel: logger$2.LogLevel.Warn, // Set log level based on environment or configuration
800
824
  });
801
825
  /**
802
826
  * Called when the `messageReceived` event is emitted.
@@ -1042,6 +1066,7 @@ var __rest = (undefined && undefined.__rest) || function (s, e) {
1042
1066
  }
1043
1067
  return t;
1044
1068
  };
1069
+ const logger = new logger$2.Logger("Ai12zBot");
1045
1070
  const Ai12zBot = class {
1046
1071
  constructor(hostRef) {
1047
1072
  index.registerInstance(this, hostRef);
@@ -1294,6 +1319,7 @@ const Ai12zBot = class {
1294
1319
  ];
1295
1320
  if (this.messages.length === 2) {
1296
1321
  this.visitorID = utils.getOrCreateVisitorId();
1322
+ beacon.setConversationId(this.dataKey, this.conversationId);
1297
1323
  }
1298
1324
  this.checkHistory();
1299
1325
  setTimeout(() => {
@@ -1416,7 +1442,12 @@ const Ai12zBot = class {
1416
1442
  this.handleTypingStopped = (_status) => {
1417
1443
  this.isTypingIndicatorVisible = false;
1418
1444
  };
1419
- this.handleAgentError = () => {
1445
+ this.handleAgentError = (payload) => {
1446
+ // Log only the bucketed category: the raw reason is untrusted upstream text
1447
+ // and is already recorded once at the emit site (salesforce.ts), so keeping
1448
+ // it out of this path avoids shipping it to console-capturing RUM tools and
1449
+ // avoids double-logging. Warn level is suppressed in production bundles.
1450
+ logger.warn("Live Agent error category:", categorizeAgentErrorReason(payload === null || payload === void 0 ? void 0 : payload.reason));
1420
1451
  this.addEventMessage("Something went wrong with Live Agent, please try again later");
1421
1452
  this.isLiveAgent = false;
1422
1453
  this.liveAgentSessionId = "";
@@ -1554,6 +1585,7 @@ const Ai12zBot = class {
1554
1585
  this.loadConversation();
1555
1586
  break;
1556
1587
  case "end":
1588
+ this.syncBodyScrollLock(false);
1557
1589
  this.messages = [...[]];
1558
1590
  this.conversationId = "";
1559
1591
  this.isOpened = false;
@@ -1660,6 +1692,7 @@ const Ai12zBot = class {
1660
1692
  return (activeElement === null || activeElement === void 0 ? void 0 : activeElement.tagName) === "TEXTAREA" || (activeElement === null || activeElement === void 0 ? void 0 : activeElement.tagName) === "INPUT";
1661
1693
  }
1662
1694
  handleNewConversation() {
1695
+ this.syncBodyScrollLock(true);
1663
1696
  // Clear messages and start a new conversation
1664
1697
  this.messages = [];
1665
1698
  this.conversationId = "";
@@ -1739,11 +1772,13 @@ const Ai12zBot = class {
1739
1772
  this.openChat((_a = options === null || options === void 0 ? void 0 : options.expanded) !== null && _a !== void 0 ? _a : false);
1740
1773
  }
1741
1774
  if (type === "minimize" && this.isOpened) {
1775
+ this.syncBodyScrollLock(false);
1742
1776
  this.minimizeChat();
1743
1777
  }
1744
1778
  this.checkHistory();
1745
1779
  if (type === "close") {
1746
1780
  // this.isChatOpen = false
1781
+ this.syncBodyScrollLock(false);
1747
1782
  this.searchResults = {};
1748
1783
  this.surveyDomId = "";
1749
1784
  this.showWelcomeScreen = true;
@@ -1751,6 +1786,7 @@ const Ai12zBot = class {
1751
1786
  // this.saveConversation()
1752
1787
  this.messages = [...[]];
1753
1788
  this.conversationId = "";
1789
+ this.isOpened = false;
1754
1790
  this.close.emit("close");
1755
1791
  this.announce("Chat closed");
1756
1792
  clearInterval(this.timer);
@@ -1769,6 +1805,7 @@ const Ai12zBot = class {
1769
1805
  this.timestamp = utils.formatTimestamp(new Date());
1770
1806
  this.updateScreenSize();
1771
1807
  await this.configBot();
1808
+ beacon.initBeacon(this.dataKey);
1772
1809
  this.visitorID = "ai12z-" + localStorage.getItem(`ai12z-visitorId`);
1773
1810
  // Now safely read state with valid pId
1774
1811
  this.hydrateStateFromStorage();
@@ -1791,6 +1828,9 @@ const Ai12zBot = class {
1791
1828
  if (botState) {
1792
1829
  this.isOpened = botState.isOpened;
1793
1830
  this.isMinimized = botState.isMinimized;
1831
+ if (this.isOpened) {
1832
+ this.syncBodyScrollLock(true, false);
1833
+ }
1794
1834
  this.isExpanded = botState.isExpanded;
1795
1835
  this.conversationId = botState.conversationId;
1796
1836
  if (!botState.newChat) {
@@ -1922,6 +1962,10 @@ const Ai12zBot = class {
1922
1962
  // Remove event listener when component is destroyed
1923
1963
  document.removeEventListener("click", this.handleClickOutside.bind(this));
1924
1964
  window.removeEventListener("resize", this.updateScreenSize);
1965
+ // A debounced auto-scroll may still be pending; cancel it so it cannot
1966
+ // fire scrollToBottom() against a torn-down component.
1967
+ if (this.autoScrollTimer)
1968
+ clearTimeout(this.autoScrollTimer);
1925
1969
  }
1926
1970
  handleClickOutside(event) {
1927
1971
  // Check if the clicked target is outside the menu
@@ -1972,8 +2016,17 @@ const Ai12zBot = class {
1972
2016
  this.announceMessage = "";
1973
2017
  }, 1000);
1974
2018
  }
2019
+ syncBodyScrollLock(shouldOpen, wasOpen = this.isOpened) {
2020
+ if (shouldOpen && !wasOpen) {
2021
+ bodyScrollLock.bodyScrollLock.acquire("ai12z-bot");
2022
+ }
2023
+ if (!shouldOpen && wasOpen) {
2024
+ bodyScrollLock.bodyScrollLock.release("ai12z-bot");
2025
+ }
2026
+ }
1975
2027
  openChat(expanded = false) {
1976
2028
  var _a, _b;
2029
+ this.syncBodyScrollLock(true);
1977
2030
  this.unreadCount = 0;
1978
2031
  // document.title = `Chat opened – ${this.originalTitle}`
1979
2032
  index.ai12zManager.setActive("bot");
@@ -2633,7 +2686,8 @@ const Ai12zBot = class {
2633
2686
  // this.socket.off('response');
2634
2687
  }
2635
2688
  scrollToBottom() {
2636
- const container = this.el.shadowRoot.querySelector(".chat-body");
2689
+ var _a;
2690
+ const container = (_a = this.el.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector(".chat-body");
2637
2691
  if (container) {
2638
2692
  container.scroll({
2639
2693
  top: container.scrollHeight,
@@ -3003,6 +3057,7 @@ const Ai12zBot = class {
3003
3057
  this.isAnimated = true;
3004
3058
  this.updateBotState();
3005
3059
  }, "aria-label": "Collapse Bot to Side Panel", "aria-expanded": this.isExpanded ? "true" : "false", "aria-controls": "settings-panel" }, index.h("i", { class: "wes-block wes-icon--loading wes-text-body2 modal-toolbar-icon", title: "Collapse Bot to Side Panel" }, this.isExpanded && (index.h("svg", { viewBox: "0 0 32 32", xmlns: "http://www.w3.org/2000/svg", fill: "currentColor", "aria-hidden": "true" }, index.h("path", { "fill-rule": "evenodd", "clip-rule": "evenodd", d: "M18.215 14.7076H27.692C28.3074 14.7076 28.492 14.0307 27.9997 13.5383L24.9843 10.4614L30.5228 4.86149C30.8305 4.5538 30.8305 3.99995 30.5228 3.69226L28.2459 1.41536C27.9382 1.16921 27.4459 1.16921 27.0767 1.4769L21.5381 7.01532L18.3997 3.99995C17.9073 3.50765 17.2304 3.69226 17.2304 4.30764V13.7845C17.2304 14.2153 17.7843 14.7076 18.215 14.7076ZM13.7847 17.2308H4.30766C3.69227 17.2308 3.50765 17.9077 3.99996 18.4L7.01537 21.4769L1.47686 27.0769C1.16917 27.3846 1.16917 27.9384 1.47686 28.2461L3.75381 30.523C4.0615 30.8307 4.55381 30.8307 4.92305 30.523L10.5231 24.923L13.6616 27.9384C14.0924 28.4923 14.7693 28.3076 14.7693 27.6923V18.2769C14.7693 17.8462 14.2154 17.2308 13.7847 17.2308Z" }))), !this.isExpanded && (index.h("svg", { viewBox: "0 0 32 32", xmlns: "http://www.w3.org/2000/svg", fill: "currentColor", "aria-hidden": "true" }, index.h("path", { "fill-rule": "evenodd", "clip-rule": "evenodd", d: "M30.0308 1.23071H20.4923C19.8769 1.23071 19.6923 1.78455 20.1846 2.27686L23.2 5.29222L17.6615 10.8306C17.3538 11.1383 17.3538 11.6306 17.6615 11.9999L19.9384 14.2768C20.2461 14.5845 20.7384 14.5845 21.1077 14.2768L26.7077 8.67681L29.7231 11.6922C30.2154 12.1845 30.7692 11.9999 30.7692 11.3845V1.90763C30.7692 1.5384 30.4 1.23071 30.0308 1.23071ZM2.15379 30.7692H11.6307C12.2461 30.7692 12.4307 30.0923 11.9384 29.6L8.92303 26.5231L14.4615 20.9231C14.7692 20.6154 14.7692 20.0616 14.4615 19.7539L12.1846 17.477C11.8769 17.1693 11.3846 17.1693 11.0153 17.477L5.47687 23.0154L2.39995 20C1.8461 19.5077 1.23071 19.6923 1.23071 20.3077V29.7846C1.23071 30.2153 1.72302 30.7692 2.15379 30.7692Z" }))))), index.h("button", { class: "rounded-full flex items-center justify-center disabled:cursor-not-allowed bg-transparent hover:bg-blue-95 disabled:bg-transparent disabled:hover:bg-transparent h-6 w-6 bot-btn-primary", "data-testid": "modal-minimize", tabindex: "0", "aria-label": "Minimize", onClick: () => {
3060
+ this.syncBodyScrollLock(false);
3006
3061
  this.isOpened = false;
3007
3062
  // this.isContent = false
3008
3063
  this.isContent = this.isExpanded && this.botSettings.isExpanded ? true : false;
@@ -3039,10 +3094,13 @@ const Ai12zBot = class {
3039
3094
  opacity: !this.isMinimized ? "1" : "0",
3040
3095
  transform: "translateX(0)",
3041
3096
  pointerEvents: !this.isMinimized ? "auto" : "none",
3042
- } }, !this.isOpened && (index.h("div", { class: `absolute right-4 md:right-0 border-2 border-white border-solid rounded-full ${this.isContent ? "" : "top-0"} minimize-input` }, index.h("button", { class: "rounded-full flex items-center justify-center disabled:cursor-not-allowed bg-gray-500 bg-opacity-60 hover:bg-opacity-80 h-5 w-5 bot-btn-primary", "aria-label": "Minimize Bot", tabindex: "0", onClick: e => {
3097
+ } }, !this.isOpened && (index.h("div", { class: `absolute right-4 md:right-0 border-2 border-white border-solid rounded-full ${this.isContent ? "" : "top-0"} minimize-input` }, index.h("button", { class: "rounded-full flex items-center justify-center disabled:cursor-not-allowed bg-gray-500 bg-opacity-60 hover:bg-opacity-80 h-5 w-5 bot-btn-primary", "aria-label": "Minimized to fab Bot", tabindex: "0", onClick: e => {
3043
3098
  e.preventDefault();
3044
- this.isMinimized = !this.isMinimized;
3045
- this.isOpened = !this.isMinimized;
3099
+ const nextMinimized = !this.isMinimized;
3100
+ const nextOpened = !nextMinimized;
3101
+ this.syncBodyScrollLock(nextOpened);
3102
+ this.isMinimized = nextMinimized;
3103
+ this.isOpened = nextOpened;
3046
3104
  this.updateBotState();
3047
3105
  } }, index.h("i", { class: "block ai-minimize-icon ai-text-caption", title: "Minimize Bot" }, index.h("svg", { xmlns: "http://www.w3.org/2000/svg", height: "52", width: "52", viewBox: "0 0 520 520", fill: "#fff", "aria-hidden": "true" }, index.h("path", { d: "M500 275c0 8-7 15-15 15H35c-8 0-15-7-15-15v-30c0-8 7-15 15-15h450c8 0 15 7 15 15z" })))))), index.h("fieldset", { class: `flex flex-col @md:mx-0 @md:rounded-t-xl transition-colors ${this.isMinimized && !this.isExpanded ? "" : "p-4 user-input-fieldset"}` }, !this.isExpanded && this.isOpened && this.messages.length === 0 && (index.h("privacy-modal", { show: this.showPrivacy, message: this.botSettings.privacyTemplate })), index.h("div", { class: "flex-1 align-bottom" }, index.h("div", { "aria-hidden": this.isTypingIndicatorVisible ? "false" : "true", class: `flex items-center justify-center w-full ${this.isTypingIndicatorVisible ? "h-12 opacity-100" : "h-0 opacity-0 pointer-events-none"}` }, index.h("typing-indicator", null)), index.h("div", { class: "grow-wrap show-grid after:whitespace-pre-wrap after:invisible relative", "data-replicated-value": "", "aria-disabled": "false" }, this.botSettings.imageUpload && (index.h("div", { "aria-disabled": "true", class: `absolute flex items-center left-0 bottom-0 h-full pl-4 pr-2 ${this.hideAllButtons ? "hidden" : ""} agent-input-icon` }, index.h("button", { class: "plus-icon bot-btn-primary", tabindex: "0", "aria-label": "Add Image", onClick: e => {
3048
3106
  e.stopPropagation();
@@ -3082,6 +3140,7 @@ const Ai12zBot = class {
3082
3140
  }, onKeyDown: e => {
3083
3141
  this.handleKeyDown(e);
3084
3142
  if (e.key === "Enter" && !e.shiftKey) {
3143
+ this.syncBodyScrollLock(true);
3085
3144
  this.isOpened = true;
3086
3145
  }
3087
3146
  }, onPaste: e => {
@@ -3115,16 +3174,19 @@ const Ai12zBot = class {
3115
3174
  }, 3000);
3116
3175
  return;
3117
3176
  }
3177
+ this.syncBodyScrollLock(true);
3118
3178
  this.isOpened = true;
3119
3179
  this.handleSend((_b = this.inputEl) === null || _b === void 0 ? void 0 : _b.value);
3120
3180
  } }, index.h("i", { class: "block ai-icon text-body1", title: "Send Message" }, index.h("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 16 16", fill: "currentColor", class: "size-6", "aria-hidden": "true" }, index.h("path", { "fill-rule": "evenodd", d: "M8 14a.75.75 0 0 1-.75-.75V4.56L4.03 7.78a.75.75 0 0 1-1.06-1.06l4.5-4.5a.75.75 0 0 1 1.06 0l4.5 4.5a.75.75 0 0 1-1.06 1.06L8.75 4.56v8.69A.75.75 0 0 1 8 14Z", "clip-rule": "evenodd" }))))), this.isStreaming && (index.h("button", { class: "text-white transition rounded-full p-1.5 self-center btn-bg-color bot-btn-primary", "aria-label": "Stop Streaming", tabindex: "0", id: "message-submit",
3121
3181
  // type="submit"
3122
3182
  onClick: e => {
3123
3183
  e.preventDefault();
3184
+ this.syncBodyScrollLock(true);
3124
3185
  this.isOpened = true;
3125
3186
  this.stopResponse();
3126
3187
  } }, index.h("i", { class: "block text-body1", title: "Stop Streaming" }, index.h("svg", { width: "20", height: "20", viewBox: "0 0 20 20", fill: "currentColor", xmlns: "http://www.w3.org/2000/svg", class: "size-6", "aria-hidden": "true" }, index.h("path", { d: "M4.5 5.75C4.5 5.05964 5.05964 4.5 5.75 4.5H14.25C14.9404 4.5 15.5 5.05964 15.5 5.75V14.25C15.5 14.9404 14.9404 15.5 14.25 15.5H5.75C5.05964 15.5 4.5 14.9404 4.5 14.25V5.75Z" }))))))), this.isExpanded && !this.isOpened && index.h("privacy-modal", { show: this.showPrivacy, message: this.botSettings.privacyTemplate }), this.messages.length === 0 && (index.h("div", { id: "input-enter-tip", role: "tooltip", class: "enter-tip" }, "Tip: Press Enter to send, Shift+Enter for new line")), this.emptyMessageError && (index.h("div", { class: "error-message-container" }, index.h("span", { id: "empty-message-error", class: "error-msg", role: "alert" }, "Message cannot be empty. Please enter a message to send."))), this.showErrorMessage && index.h("p", { class: "error-msg", innerHTML: this.errorMessage }), this.botSettings.buttons && this.botSettings.buttons.length > 0 && !this.isOpened && (index.h("div", { class: "bot-buttons-container flex flex-wrap gap-2 mt-2.5 mb-1" }, this.botSettings.buttons.map((button, index$1) => (index.h("button", { key: index$1, class: "px-4 py-2 ai12z-btn", onClick: e => {
3127
3188
  e.preventDefault();
3189
+ this.syncBodyScrollLock(true);
3128
3190
  this.isOpened = true;
3129
3191
  this.isContent = false;
3130
3192
  this.handleSend(button.label);
@@ -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-7C5_GnyF.js');
5
+ var utils = require('./utils-C2m26j54.js');
6
6
  var _commonjsHelpers = require('./_commonjsHelpers-MBWFX2dn.js');
7
7
  var appStore = require('./app-store-BtkiHvcw.js');
8
- var parseHelper = require('./parseHelper-5fRVefLm.js');
9
- require('./ctaHelpers-DUPj5SnE.js');
8
+ var parseHelper = require('./parseHelper-CbA81TvP.js');
9
+ require('./ctaHelpers-CmoXzyRy.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)}`;
@@ -6669,17 +6669,17 @@ const AudioRecorder = class {
6669
6669
  render() {
6670
6670
  const minutes = Math.floor(this.time / 60);
6671
6671
  const seconds = this.time % 60;
6672
- return (index.h("div", { key: 'b73747279b29f4a1caf317a5d0f00da382315346', class: "flex w-full" }, (this.isRecording || this.isProcessing) && (index.h("div", { key: '534a01d1be9ae431f46029615db42c87a2587f36', class: `relative flex items-center w-full rounded-full` }, this.isRecording && (index.h("button", { key: '862cdaa52da77d810a441853181c06f3a26da726', "aria-label": "Cancel Recording", onClick: e => {
6672
+ return (index.h("div", { key: '5626c6e1b72ed0acfc37fbf49f42ee1f623b5386', class: "flex w-full" }, (this.isRecording || this.isProcessing) && (index.h("div", { key: '7eadd53123bab1262c427f7f2e22d62b150dcac0', class: `relative flex items-center w-full rounded-full` }, this.isRecording && (index.h("button", { key: 'f42b43d4c6c613d7739e1048d319913e12aa6333', "aria-label": "Cancel Recording", onClick: e => {
6673
6673
  e.preventDefault();
6674
6674
  this.stopRecording("cancel");
6675
- }, class: "w-10 h-10 rounded-full flex items-center justify-center text-white" }, "\u274C")), index.h("div", { key: '62495256b25dc06fe0653702ae080e33c7745c8c', id: "mic", style: { width: "100%" } }), this.isRecording && !this.isProcessing ? (index.h("div", { class: "ml-auto text-blue-600 font-semibold" }, String(minutes).padStart(2, "0"), ":", String(seconds).padStart(2, "0"))) : null, (this.isRecording || this.isProcessing) && (index.h("button", { key: '036e203205dfc398ed7152f796fc43d7b1bad24a', "aria-label": "Confirm Recording", disabled: this.isProcessing, onClick: e => {
6675
+ }, class: "w-10 h-10 rounded-full flex items-center justify-center text-white" }, "\u274C")), index.h("div", { key: '7884f7722100fe4284d5557b3c234b0cb2dae5a8', id: "mic", style: { width: "100%" } }), this.isRecording && !this.isProcessing ? (index.h("div", { class: "ml-auto text-blue-600 font-semibold" }, String(minutes).padStart(2, "0"), ":", String(seconds).padStart(2, "0"))) : null, (this.isRecording || this.isProcessing) && (index.h("button", { key: 'b3d675595adc6c7d0bc8efa2f6cd09e7493dffde', "aria-label": "Confirm Recording", disabled: this.isProcessing, onClick: e => {
6676
6676
  e.preventDefault();
6677
6677
  if (!this.isProcessing)
6678
6678
  this.stopRecording("stop");
6679
- }, class: `w-10 h-10 ml-2 rounded-full flex items-center justify-center ${this.isProcessing ? "cursor-not-allowed" : "text-blue-600"}` }, this.isProcessing ? (index.h("svg", { class: "activity-spinner", viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg" }, index.h("line", { x1: "12", y1: "2", x2: "12", y2: "5", "stroke-width": "2", "stroke-linecap": "round", style: { "--n": "0" } }), index.h("line", { x1: "16.24", y1: "3.76", x2: "14.12", y2: "5.88", "stroke-width": "2", "stroke-linecap": "round", style: { "--n": "1" } }), index.h("line", { x1: "19", y1: "7.76", x2: "16.24", y2: "9.24", "stroke-width": "2", "stroke-linecap": "round", style: { "--n": "2" } }), index.h("line", { x1: "20", y1: "12", x2: "17", y2: "12", "stroke-width": "2", "stroke-linecap": "round", style: { "--n": "3" } }), index.h("line", { x1: "19", y1: "16.24", x2: "16.24", y2: "14.76", "stroke-width": "2", "stroke-linecap": "round", style: { "--n": "4" } }), index.h("line", { x1: "16.24", y1: "20.24", x2: "14.12", y2: "18.12", "stroke-width": "2", "stroke-linecap": "round", style: { "--n": "5" } }), index.h("line", { x1: "12", y1: "22", x2: "12", y2: "19", "stroke-width": "2", "stroke-linecap": "round", style: { "--n": "6" } }), index.h("line", { x1: "7.76", y1: "20.24", x2: "9.88", y2: "18.12", "stroke-width": "2", "stroke-linecap": "round", style: { "--n": "7" } }), index.h("line", { x1: "5", y1: "16.24", x2: "7.76", y2: "14.76", "stroke-width": "2", "stroke-linecap": "round", style: { "--n": "8" } }), index.h("line", { x1: "4", y1: "12", x2: "7", y2: "12", "stroke-width": "2", "stroke-linecap": "round", style: { "--n": "9" } }), index.h("line", { x1: "5", y1: "7.76", x2: "7.76", y2: "9.24", "stroke-width": "2", "stroke-linecap": "round", style: { "--n": "10" } }), index.h("line", { x1: "7.76", y1: "3.76", x2: "9.88", y2: "5.88", "stroke-width": "2", "stroke-linecap": "round", style: { "--n": "11" } }))) : (index.h("span", { class: "text-blue-600 font-sans" }, "\u2714")))))), !this.isRecording && !this.isProcessing && (index.h("button", { key: 'ad24a6225403a8983100667054aa45f3ed5c24a8', "aria-label": "Start Recording", title: "Start Recording", onClick: e => {
6679
+ }, class: `w-10 h-10 ml-2 rounded-full flex items-center justify-center ${this.isProcessing ? "cursor-not-allowed" : "text-blue-600"}` }, this.isProcessing ? (index.h("svg", { class: "activity-spinner", viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg" }, index.h("line", { x1: "12", y1: "2", x2: "12", y2: "5", "stroke-width": "2", "stroke-linecap": "round", style: { "--n": "0" } }), index.h("line", { x1: "16.24", y1: "3.76", x2: "14.12", y2: "5.88", "stroke-width": "2", "stroke-linecap": "round", style: { "--n": "1" } }), index.h("line", { x1: "19", y1: "7.76", x2: "16.24", y2: "9.24", "stroke-width": "2", "stroke-linecap": "round", style: { "--n": "2" } }), index.h("line", { x1: "20", y1: "12", x2: "17", y2: "12", "stroke-width": "2", "stroke-linecap": "round", style: { "--n": "3" } }), index.h("line", { x1: "19", y1: "16.24", x2: "16.24", y2: "14.76", "stroke-width": "2", "stroke-linecap": "round", style: { "--n": "4" } }), index.h("line", { x1: "16.24", y1: "20.24", x2: "14.12", y2: "18.12", "stroke-width": "2", "stroke-linecap": "round", style: { "--n": "5" } }), index.h("line", { x1: "12", y1: "22", x2: "12", y2: "19", "stroke-width": "2", "stroke-linecap": "round", style: { "--n": "6" } }), index.h("line", { x1: "7.76", y1: "20.24", x2: "9.88", y2: "18.12", "stroke-width": "2", "stroke-linecap": "round", style: { "--n": "7" } }), index.h("line", { x1: "5", y1: "16.24", x2: "7.76", y2: "14.76", "stroke-width": "2", "stroke-linecap": "round", style: { "--n": "8" } }), index.h("line", { x1: "4", y1: "12", x2: "7", y2: "12", "stroke-width": "2", "stroke-linecap": "round", style: { "--n": "9" } }), index.h("line", { x1: "5", y1: "7.76", x2: "7.76", y2: "9.24", "stroke-width": "2", "stroke-linecap": "round", style: { "--n": "10" } }), index.h("line", { x1: "7.76", y1: "3.76", x2: "9.88", y2: "5.88", "stroke-width": "2", "stroke-linecap": "round", style: { "--n": "11" } }))) : (index.h("span", { class: "text-blue-600 font-sans" }, "\u2714")))))), !this.isRecording && !this.isProcessing && (index.h("button", { key: '411d1cda58be052173e846d685a6c45196443d71', "aria-label": "Start Recording", title: "Start Recording", onClick: e => {
6680
6680
  e.preventDefault();
6681
6681
  this.startRecording();
6682
- }, class: `flex ${this.componentType === "search" || this.componentType === "cta" ? "p-1.5 mr-0.5 self-center mt-0.5" : "w-10 h-8 p-0 mt-4"}` }, index.h("svg", { key: '7e1b80a53b24d446cdf9bf77512d2bdea8a29450', xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 20 20", class: `w-5 h-5 translate-y-[0.5px] ${this.componentType === "search" || this.componentType === "cta" ? "mic-icon" : "mic-botIcon"}` }, index.h("path", { key: '73917f2f7ffc7f6c243394797ffe83944279bc27', d: "M7 4a3 3 0 016 0v6a3 3 0 11-6 0V4z" }), index.h("path", { key: 'bc2e12c016990bdbb1aaeee292e612e11d7993c8', d: "M5.5 9.643a.75.75 0 00-1.5 0V10c0 3.06 2.29 5.585 5.25 5.954V17.5h-1.5a.75.75 0 000 1.5h4.5a.75.75 0 000-1.5h-1.5v-1.546A6.001 6.001 0 0016 10v-.357a.75.75 0 00-1.5 0V10a4.5 4.5 0 01-9 0v-.357z" }))))));
6682
+ }, class: `flex ${this.componentType === "search" || this.componentType === "cta" ? "p-1.5 mr-0.5 self-center mt-0.5" : "w-10 h-8 p-0 mt-4"}` }, index.h("svg", { key: '6de627834c92b3a29ef269eb8dd381dbb4bcb48b', xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 20 20", class: `w-5 h-5 translate-y-[0.5px] ${this.componentType === "search" || this.componentType === "cta" ? "mic-icon" : "mic-botIcon"}` }, index.h("path", { key: '194062cca39e2828f6bfd5fc21aec8a88d67b64f', d: "M7 4a3 3 0 016 0v6a3 3 0 11-6 0V4z" }), index.h("path", { key: 'aad6fd0e90339c57ade1ffd7f394a5cff3390aaa', d: "M5.5 9.643a.75.75 0 00-1.5 0V10c0 3.06 2.29 5.585 5.25 5.954V17.5h-1.5a.75.75 0 000 1.5h4.5a.75.75 0 000-1.5h-1.5v-1.546A6.001 6.001 0 0016 10v-.357a.75.75 0 00-1.5 0V10a4.5 4.5 0 01-9 0v-.357z" }))))));
6683
6683
  }
6684
6684
  get element() { return index.getElement(this); }
6685
6685
  };