ai12z 3.13.1-alpha.9 → 3.13.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 (162) hide show
  1. package/dist/cjs/ai12z-bot.cjs.entry.js +259 -49
  2. package/dist/cjs/ai12z-category_2.cjs.entry.js +13 -8
  3. package/dist/cjs/ai12z-chat-message.cjs.entry.js +22 -4
  4. package/dist/cjs/ai12z-chat_2.cjs.entry.js +10 -9
  5. package/dist/cjs/ai12z-container.cjs.entry.js +4 -4
  6. package/dist/cjs/ai12z-cta.cjs.entry.js +4 -4
  7. package/dist/cjs/ai12z-form.cjs.entry.js +2 -2
  8. package/dist/cjs/ai12z-inline-search.cjs.entry.js +2 -2
  9. package/dist/cjs/ai12z-knowledge-box.cjs.entry.js +27 -16
  10. package/dist/cjs/ai12z-search-panel.cjs.entry.js +1 -1
  11. package/dist/cjs/{botHelpers-aCoootcN.js → botHelpers-D5Dj7TRA.js} +103 -0
  12. package/dist/cjs/chat-avatar_6.cjs.entry.js +2 -2
  13. package/dist/cjs/{ctaHelpers-CDVojcwO.js → ctaHelpers-_6HvZZie.js} +1 -1
  14. package/dist/cjs/dynamic-form.cjs.entry.js +1 -1
  15. package/dist/cjs/{index-BxQS1tNc.js → index-C-xyfB2W.js} +1 -1
  16. package/dist/cjs/index.cjs.js +11 -11
  17. package/dist/cjs/item-list.cjs.entry.js +2 -2
  18. package/dist/cjs/{keyboard-shortcuts-Cr_wfa5f.js → keyboard-shortcuts-CwJb0TM7.js} +2 -2
  19. package/dist/cjs/library.cjs.js +1 -1
  20. package/dist/cjs/loader.cjs.js +1 -1
  21. package/dist/cjs/{logger-DX9yB2Q4.js → logger-B_JTV5L8.js} +18 -0
  22. package/dist/cjs/{parseHelper-BpdC7wTC.js → parseHelper-Cp45LpWl.js} +18 -16
  23. package/dist/cjs/{processCarouselData-ByvOv0xP.js → processCarouselData-YEoGs649.js} +1 -1
  24. package/dist/cjs/{reCaptchaHelpers-BUylaRCH.js → reCaptchaHelpers-C5ato8kF.js} +1 -1
  25. package/dist/cjs/search-results-page.cjs.entry.js +4 -4
  26. package/dist/cjs/{socket-service-C523Ww7_.js → socket-service-L0xv4YGT.js} +1 -1
  27. package/dist/cjs/{surveyHelpers-Bmju2R9I.js → surveyHelpers-D4qhA3pY.js} +1 -1
  28. package/dist/cjs/{utils-CVz8XUlb.js → utils-BAJarpnb.js} +21 -0
  29. package/dist/collection/components/ai12z-bot/ai12z-bot.js +178 -35
  30. package/dist/collection/components/ai12z-cta/components/audiorecorder/audio-recorder.js +9 -5
  31. package/dist/collection/components/ai12z-knowledge-box/ai12z-knowledge-box.js +23 -12
  32. package/dist/collection/components/ai12z-knowledge-box/components/ai12z-chat-message.css +31 -20
  33. package/dist/collection/components/ai12z-knowledge-box/components/ai12z-chat-message.js +20 -2
  34. package/dist/collection/utils/botHelpers/botHelpers.js +102 -0
  35. package/dist/collection/utils/cookieService.js +5 -5
  36. package/dist/collection/utils/liveagents/liveagent-event-handler.js +21 -0
  37. package/dist/collection/utils/liveagents/liveagent-types.js +10 -0
  38. package/dist/collection/utils/liveagents/providers/salesforce.js +42 -1
  39. package/dist/collection/utils/logger.js +18 -0
  40. package/dist/collection/utils/parseHelper/parseHelper.js +17 -15
  41. package/dist/collection/utils/utils.js +20 -0
  42. package/dist/components/ai12z-bot.js +1 -1
  43. package/dist/components/ai12z-chat-message.js +1 -1
  44. package/dist/components/ai12z-chat.js +1 -1
  45. package/dist/components/ai12z-container.js +1 -1
  46. package/dist/components/ai12z-cta.js +1 -1
  47. package/dist/components/ai12z-form.js +1 -1
  48. package/dist/components/ai12z-inline-search.js +1 -1
  49. package/dist/components/ai12z-input-form.js +1 -1
  50. package/dist/components/ai12z-knowledge-box.js +1 -1
  51. package/dist/components/ai12z-search-panel.js +1 -1
  52. package/dist/components/audio-recorder.js +1 -1
  53. package/dist/components/dynamic-form.js +1 -1
  54. package/dist/components/index.js +1 -1
  55. package/dist/components/interaction-buttons.js +1 -1
  56. package/dist/components/item-list.js +1 -1
  57. package/dist/components/live-agent-chat.js +1 -1
  58. package/dist/components/{p-C4ilYMno.js → p-5UYwpNzl.js} +1 -1
  59. package/dist/components/p-B3lv_O-6.js +1 -0
  60. package/dist/components/p-BCJzelr9.js +1 -0
  61. package/dist/components/{p-CwnTHnZf.js → p-BP8ig03d.js} +1 -1
  62. package/dist/components/{p-BP6Jn1lu.js → p-BhV62IFF.js} +1 -1
  63. package/dist/components/{p-CaH9Ymzc.js → p-Bo3Ig8oX.js} +1 -1
  64. package/dist/components/{p-Bpy-iS4w.js → p-C2wKkcYa.js} +1 -1
  65. package/dist/components/{p-j5szDGnG.js → p-CKAp10SJ.js} +1 -1
  66. package/dist/components/{p-B6Gxgouv.js → p-CLdlCTTp.js} +1 -1
  67. package/dist/components/p-D2lp8C5d.js +1 -0
  68. package/dist/components/{p-wPsaNmmK.js → p-D2nUK4Pa.js} +1 -1
  69. package/dist/components/{p-gNCBIxiZ.js → p-DA32xa7d.js} +1 -1
  70. package/dist/components/p-DJ68HDol.js +2 -0
  71. package/dist/components/{p-bubyF0x5.js → p-DKxaam7U.js} +1 -1
  72. package/dist/components/p-DPq7OOGr.js +1 -0
  73. package/dist/components/p-DT0Uarfg.js +1 -0
  74. package/dist/components/{p-DL3CHat9.js → p-DUaZgAhA.js} +6 -6
  75. package/dist/components/p-DmqUTHP1.js +1 -0
  76. package/dist/components/{p-jCB_VqUs.js → p-DsZWeAcM.js} +1 -1
  77. package/dist/components/{p-CL_K1Dih.js → p-Gr6Q2s96.js} +1 -1
  78. package/dist/components/{p-DByZf3r3.js → p-J--erGbY.js} +1 -1
  79. package/dist/components/{p-7x2_R-zS.js → p-ha1wIlZ-.js} +1 -1
  80. package/dist/components/{p-RvNPq6Up.js → p-q7YWDP9B.js} +1 -1
  81. package/dist/components/p-zVXADzTq.js +1 -0
  82. package/dist/components/privacy-modal.js +1 -1
  83. package/dist/components/search-results-page.js +1 -1
  84. package/dist/esm/ai12z-bot.entry.js +259 -49
  85. package/dist/esm/ai12z-category_2.entry.js +13 -8
  86. package/dist/esm/ai12z-chat-message.entry.js +22 -4
  87. package/dist/esm/ai12z-chat_2.entry.js +10 -9
  88. package/dist/esm/ai12z-container.entry.js +4 -4
  89. package/dist/esm/ai12z-cta.entry.js +4 -4
  90. package/dist/esm/ai12z-form.entry.js +2 -2
  91. package/dist/esm/ai12z-inline-search.entry.js +2 -2
  92. package/dist/esm/ai12z-knowledge-box.entry.js +27 -16
  93. package/dist/esm/ai12z-search-panel.entry.js +1 -1
  94. package/dist/esm/{botHelpers-BWLdDS2K.js → botHelpers-B_moTKAE.js} +103 -1
  95. package/dist/esm/chat-avatar_6.entry.js +2 -2
  96. package/dist/esm/{ctaHelpers-BXvoRqqx.js → ctaHelpers-BhM8KbEY.js} +1 -1
  97. package/dist/esm/dynamic-form.entry.js +1 -1
  98. package/dist/esm/{index-CZfZjCO0.js → index-BQKLwW-C.js} +1 -1
  99. package/dist/esm/index.js +11 -11
  100. package/dist/esm/item-list.entry.js +2 -2
  101. package/dist/esm/{keyboard-shortcuts-CezVCRCu.js → keyboard-shortcuts-Bd3LDe9j.js} +2 -2
  102. package/dist/esm/library.js +1 -1
  103. package/dist/esm/loader.js +1 -1
  104. package/dist/esm/{logger-ccneRP0V.js → logger-DUcx64Gz.js} +18 -0
  105. package/dist/esm/{parseHelper-Ca0Lw8Gk.js → parseHelper-9rP0JS7J.js} +18 -16
  106. package/dist/esm/{processCarouselData-BDK8axMD.js → processCarouselData-Bf2pDFsV.js} +1 -1
  107. package/dist/esm/{reCaptchaHelpers-Bd8WIVu1.js → reCaptchaHelpers-CUcgfdqX.js} +1 -1
  108. package/dist/esm/search-results-page.entry.js +4 -4
  109. package/dist/esm/{socket-service-CLI8XKKm.js → socket-service-B1OMbkCM.js} +1 -1
  110. package/dist/esm/{surveyHelpers-DEIialTy.js → surveyHelpers-CvrZlir1.js} +1 -1
  111. package/dist/esm/{utils-8tG8vLAn.js → utils-BTLjNTwP.js} +21 -1
  112. package/dist/library/index.esm.js +1 -1
  113. package/dist/library/library.esm.js +1 -1
  114. package/dist/library/{p-edf8746e.entry.js → p-014d5664.entry.js} +1 -1
  115. package/dist/library/{p-d328e131.entry.js → p-0641ba91.entry.js} +2 -2
  116. package/dist/library/p-07f11cb8.entry.js +1 -0
  117. package/dist/library/p-29cd4edc.entry.js +1 -0
  118. package/dist/library/{p-fae5aad1.entry.js → p-2d262192.entry.js} +1 -1
  119. package/dist/library/{p-a88e1732.entry.js → p-60d5d99f.entry.js} +1 -1
  120. package/dist/library/{p-34dcf0b5.entry.js → p-6f3727d3.entry.js} +1 -1
  121. package/dist/library/{p-8c4f21d4.entry.js → p-7f0e306c.entry.js} +1 -1
  122. package/dist/library/p-806bfb3d.entry.js +1 -0
  123. package/dist/library/{p-c162480c.entry.js → p-83a71da9.entry.js} +1 -1
  124. package/dist/library/{p-4be3d508.entry.js → p-94bf0c7f.entry.js} +1 -1
  125. package/dist/library/{p-IDk3me0F.js → p-BZ_koFpE.js} +1 -1
  126. package/dist/library/p-B_moTKAE.js +1 -0
  127. package/dist/library/{p-DW4PI5Zc.js → p-Bbow4UZX.js} +1 -1
  128. package/dist/library/{p-B7876s97.js → p-C1eU4fpM.js} +1 -1
  129. package/dist/library/p-CnadO0kA.js +1 -0
  130. package/dist/library/{p-UtuwTD5A.js → p-D5m1leH0.js} +3 -3
  131. package/dist/library/{p-C4XvRI9N.js → p-DAGa-uHD.js} +1 -1
  132. package/dist/library/{p-CReCHrDw.js → p-DoBD_KPG.js} +1 -1
  133. package/dist/library/{p-DAX4SVfK.js → p-NAKC5NP9.js} +1 -1
  134. package/dist/library/{p-afde8785.entry.js → p-cd764f70.entry.js} +1 -1
  135. package/dist/library/p-d3a2acee.entry.js +1 -0
  136. package/dist/library/p-dc131a5c.entry.js +1 -0
  137. package/dist/library/{p-BuH1bMtz.js → p-y3Go1NSi.js} +1 -1
  138. package/dist/types/components/ai12z-bot/ai12z-bot.d.ts +8 -0
  139. package/dist/types/components/ai12z-knowledge-box/components/ai12z-chat-message.d.ts +1 -0
  140. package/dist/types/utils/botHelpers/botHelpers.d.ts +8 -0
  141. package/dist/types/utils/cookieService.d.ts +3 -0
  142. package/dist/types/utils/liveagents/liveagent-event-handler.d.ts +6 -0
  143. package/dist/types/utils/liveagents/liveagent-types.d.ts +8 -0
  144. package/dist/types/utils/liveagents/providers/salesforce.d.ts +5 -0
  145. package/dist/types/utils/parseHelper/parseHelper.d.ts +2 -2
  146. package/dist/types/utils/utils.d.ts +6 -0
  147. package/package.json +2 -2
  148. package/dist/components/p-19dJOtRv.js +0 -1
  149. package/dist/components/p-BaLExOvk.js +0 -2
  150. package/dist/components/p-CRKgC1st.js +0 -1
  151. package/dist/components/p-DOfDD2pn.js +0 -1
  152. package/dist/components/p-DR3Hz-qA.js +0 -1
  153. package/dist/components/p-Dd5OBDa4.js +0 -1
  154. package/dist/components/p-i9uqNkVJ.js +0 -1
  155. package/dist/library/p-0b90dbe7.entry.js +0 -1
  156. package/dist/library/p-1e3599a5.entry.js +0 -1
  157. package/dist/library/p-1ef873b3.entry.js +0 -1
  158. package/dist/library/p-63cf17d4.entry.js +0 -1
  159. package/dist/library/p-6c58b381.entry.js +0 -1
  160. package/dist/library/p-BWLdDS2K.js +0 -1
  161. package/dist/library/p-CJhIAnky.js +0 -1
  162. /package/dist/library/{p-Dxm5eEMi.js → p-8-Jaom_c.js} +0 -0
@@ -2,19 +2,19 @@
2
2
 
3
3
  var index = require('./index-Ct2DwlDF.js');
4
4
  var responseAdapter = require('./response-adapter-CKKyyhMj.js');
5
- var processCarouselData = require('./processCarouselData-ByvOv0xP.js');
6
- var logger$1 = require('./logger-DX9yB2Q4.js');
7
- var utils = require('./utils-CVz8XUlb.js');
8
- var index$1 = require('./index-BxQS1tNc.js');
5
+ var processCarouselData = require('./processCarouselData-YEoGs649.js');
6
+ var logger$1 = require('./logger-B_JTV5L8.js');
7
+ var utils = require('./utils-BAJarpnb.js');
8
+ var index$1 = require('./index-C-xyfB2W.js');
9
9
  var globalStore = require('./global-store-R6x06KvJ.js');
10
- var reCaptchaHelpers = require('./reCaptchaHelpers-BUylaRCH.js');
11
- var botHelpers = require('./botHelpers-aCoootcN.js');
12
- var surveyHelpers = require('./surveyHelpers-Bmju2R9I.js');
10
+ var reCaptchaHelpers = require('./reCaptchaHelpers-C5ato8kF.js');
11
+ var botHelpers = require('./botHelpers-D5Dj7TRA.js');
12
+ var surveyHelpers = require('./surveyHelpers-D4qhA3pY.js');
13
13
  var scriptStyleLoader = require('./scriptStyleLoader-8VXGYoY8.js');
14
- var keyboardShortcuts = require('./keyboard-shortcuts-Cr_wfa5f.js');
15
- var ctaHelpers = require('./ctaHelpers-CDVojcwO.js');
14
+ var keyboardShortcuts = require('./keyboard-shortcuts-CwJb0TM7.js');
15
+ var ctaHelpers = require('./ctaHelpers-_6HvZZie.js');
16
16
  var appStore = require('./app-store-D249GRTi.js');
17
- var parseHelper = require('./parseHelper-BpdC7wTC.js');
17
+ var parseHelper = require('./parseHelper-Cp45LpWl.js');
18
18
  require('./_commonjsHelpers-MBWFX2dn.js');
19
19
 
20
20
  // ILiveAgentProvider.ts
@@ -22,6 +22,16 @@ const envMode = index.Env.DATA_MODE || "prod";
22
22
  // Additional methods can be added as needed for more functionality
23
23
  // This interface defines the contract for a Live Agent provider, allowing for chat management and message handling.
24
24
  // Implementations of this interface would handle the specifics of interacting with a live chat service.
25
+ /**
26
+ * Thrown when a resumed live-agent session is rejected with HTTP 401 or 403,
27
+ * indicating the stored access token has expired or been revoked.
28
+ */
29
+ class LiveAgentAuthExpiredError extends Error {
30
+ constructor(message = "Live agent session authentication has expired") {
31
+ super(message);
32
+ this.name = "LiveAgentAuthExpiredError";
33
+ }
34
+ }
25
35
 
26
36
  class EventBus {
27
37
  constructor() {
@@ -133,6 +143,10 @@ class SalesforceLiveAgentProvider {
133
143
  if (conversationResponse.ok) {
134
144
  this.sessionContext.conversationId = conversationId;
135
145
  ChatEventBus.emit("liveAgentReady", undefined);
146
+ ChatEventBus.emit("AGENT_SESSION_INFO", {
147
+ sessionId: this.sessionContext.accessToken,
148
+ conversationId: this.sessionContext.conversationId,
149
+ });
136
150
  // console.log(this.sessionContext?.initialMessages)
137
151
  // Send initial message to the agent here need to format the message properly
138
152
  // Iterate the initialmessages and create a user friendly display message with contact user: for user input and bot: as bot response
@@ -442,6 +456,43 @@ class SalesforceLiveAgentProvider {
442
456
  async startChat(startChatOptions) {
443
457
  await this.initialize(startChatOptions);
444
458
  }
459
+ /**
460
+ * Resumes an existing live agent session using a stored access token and conversation ID.
461
+ * Skips authentication and conversation creation — only reconnects the SSE listener.
462
+ */
463
+ async resumeChat(startChatOptions) {
464
+ var _a, _b, _c;
465
+ if (!(startChatOptions === null || startChatOptions === void 0 ? void 0 : startChatOptions.sessionId) || !(startChatOptions === null || startChatOptions === void 0 ? void 0 : startChatOptions.conversationId)) {
466
+ throw new Error("resumeChat requires sessionId (accessToken) and conversationId");
467
+ }
468
+ this.configSettings = (startChatOptions === null || startChatOptions === void 0 ? void 0 : startChatOptions.config) || this.configSettings;
469
+ if (!((_a = this.configSettings) === null || _a === void 0 ? void 0 : _a.instanceUrl) || !((_b = this.configSettings) === null || _b === void 0 ? void 0 : _b.orgId) || !((_c = this.configSettings) === null || _c === void 0 ? void 0 : _c.messagingChannelId)) {
470
+ throw new Error("Missing required configuration settings for resuming Salesforce Live Agent session");
471
+ }
472
+ this.sessionContext = {
473
+ accessToken: startChatOptions.sessionId,
474
+ conversationId: startChatOptions.conversationId,
475
+ userId: startChatOptions.userId || "",
476
+ isActive: true,
477
+ lastMessageReadTime: 0,
478
+ };
479
+ // Probe the session before declaring it ready
480
+ const probeUrl = new URL(`${this.configSettings.instanceUrl}/iamessage/api/v2/conversation/${this.sessionContext.conversationId}/entries`);
481
+ probeUrl.searchParams.set("limit", "1");
482
+ probeUrl.searchParams.set("direction", "FromEnd");
483
+ const probeRes = await fetch(probeUrl.toString(), {
484
+ method: "GET",
485
+ headers: { Authorization: `Bearer ${this.sessionContext.accessToken}` },
486
+ });
487
+ if (probeRes.status === 401 || probeRes.status === 403) {
488
+ throw new LiveAgentAuthExpiredError();
489
+ }
490
+ if (!probeRes.ok) {
491
+ throw new Error(`Session probe failed: ${probeRes.status} ${probeRes.statusText}`);
492
+ }
493
+ ChatEventBus.emit("liveAgentReady", undefined);
494
+ this.listenToMessages();
495
+ }
445
496
  /**
446
497
  *
447
498
  * @param sendMessageOptions
@@ -687,6 +738,27 @@ class LiveAgentEventHandler {
687
738
  throw error;
688
739
  }
689
740
  }
741
+ /**
742
+ * Resumes an existing live agent session (e.g. after a page reload) using stored
743
+ * session credentials. Authentication and conversation creation are skipped;
744
+ * only the SSE listener is reconnected.
745
+ */
746
+ async resumeLiveAgentSession(name = "salesforce", chatOptions) {
747
+ try {
748
+ this.logger.debug("Resuming Live Agent session", name, " --- ", chatOptions);
749
+ this.liveAgentProvider = LiveAgentProvider.getProvider(name);
750
+ if (this.liveAgentProvider.resumeChat) {
751
+ await this.liveAgentProvider.resumeChat(chatOptions);
752
+ }
753
+ else {
754
+ throw new Error(`Provider '${name}' does not support session resume`);
755
+ }
756
+ }
757
+ catch (error) {
758
+ this.logger.error("Error resuming Live Agent session:", error);
759
+ throw error;
760
+ }
761
+ }
690
762
  }
691
763
 
692
764
  function isRecord(value) {
@@ -732,7 +804,7 @@ function setCookie(name, value, options = {}) {
732
804
  let cookie = `${name}=${encodeURIComponent(value)}`;
733
805
  if (domain) {
734
806
  if (!/^[a-zA-Z0-9._-]+$/.test(domain)) {
735
- console.warn('AI12Z: Invalid cookie domain characters');
807
+ console.warn("AI12Z: Invalid cookie domain characters");
736
808
  return false;
737
809
  }
738
810
  cookie += `; Domain=${domain}`;
@@ -797,12 +869,12 @@ function getValidCookieDomain(subDomain) {
797
869
  if (typeof window === "undefined") {
798
870
  return undefined;
799
871
  }
800
- const bare = subDomain.replace(/^\./, '');
872
+ const bare = subDomain.replace(/^\./, "");
801
873
  const currentHost = window.location.hostname;
802
- if (currentHost === bare || currentHost.endsWith('.' + bare)) {
874
+ if (currentHost === bare || currentHost.endsWith("." + bare)) {
803
875
  return subDomain;
804
876
  }
805
- console.warn('AI12Z: subDomain does not match current host');
877
+ console.warn("AI12Z: subDomain does not match current host");
806
878
  return undefined;
807
879
  }
808
880
  /**
@@ -811,7 +883,7 @@ function getValidCookieDomain(subDomain) {
811
883
  * @param options - Optional path and domain (must match original cookie)
812
884
  */
813
885
  function deleteJsonCookie(name, options = {}) {
814
- const { path = '/', domain } = options;
886
+ const { path = "/", domain } = options;
815
887
  if (typeof document === "undefined") {
816
888
  return;
817
889
  }
@@ -822,6 +894,18 @@ const ai12zBotCss = () => `:host{font-family:var(--ai12zBot-v2-font-family) !imp
822
894
 
823
895
  const ai12zChatbotCss = () => `:host{--wes-c-icon-color:#fff;--fab-bottom:26px;--xsf-ai12z-zindex-isexpanded-10:20020;--ai-toolbar-icon-color:#2095ae;--xsf-ai12z-zindex-0:19979;--xsf-ai12z-zindex-10:19989;--xsf-ai12z-fab-bottom:26px}.modal-overlay{position:absolute;height:100%;width:100%;z-index:var(--xsf-ai12z-zindex-0);background-color:#2e2e2e99}.layout{pointer-events:none;position:fixed;inset:0;height:100dvh;width:99dvw;justify-content:flex-end;grid-template-rows:auto 1fr auto;grid-template-areas:"left toolbar right" "left main right" "left footer right";padding-top:96px;transition-property:grid-template-columns, padding-top;z-index:19979}.layout.is-open .modal{pointer-events:auto}.layout.is-expanded ai12z-bot{pointer-events:auto}.layout.is-open.is-expanded .modal{border-top-left-radius:0.75rem;border-top-right-radius:0.75rem;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);z-index:var(--xsf-ai12z-zindex-isexpanded-10)}.layout.is-open .user-input-fieldset{background-image:none;padding:0px;background:none}.layout.is-expanded .user-input-fieldset{border-top-left-radius:0.75rem;border-top-right-radius:0.75rem}.layout.is-open .grow-wrap>.textarea,.layout.is-open .grow-wrap>button,.layout.is-open .grow-wrap:after{border-color:var(--ai12zBot-v2-searchbar-open-border-color);}.layout.is-expanded .grow-wrap:after{display:none}.layout.is-open.is-expanded .user-input{z-index:var(--xsf-ai12z-zindex-isexpanded-10)}.layout.is-open .user-input{z-index:var(--xsf-ai12z-zindex-10)}.text-body2{font-size:16px;line-height:1.5;letter-spacing:-0.12px;font-weight:400}.modal-toolbar-icon{color:var(--ai12zBot-v2-toolbar-icon-color, inherit);width:1rem;height:1rem}.search-flex{flex:1 1 0%}.show-grid{display:grid}.hide-title{padding:0px;opacity:0;height:0px}.user-msg{background-color:var(--ai12zBot-v2-user-bubble-background);color:var(--ai12zBot-v2-user-bubble-font-color)}.text-body4{font-size:var(--ai12zBot-v2-timestamp-font-size);line-height:1.5;letter-spacing:0.03px;font-weight:400;color:var(--ai12zBot-v2-timestamp-font-color)}.isContent{background:var(--ai12zBot-v2-content-background);padding:10px}.default-botAvatar{color:var(--ai12zBot-v2-default-avatar-color)}.searchform{opacity:1;transform:none}.user-input{margin-left:auto;margin-right:auto;width:100%;max-width:840px;min-width:340px;grid-area:footer}.main{margin-left:auto;margin-right:auto;width:100%;max-width:840px;min-width:340px;margin-top:7px}.heading{color:var(--ai12zBot-v2-title-color)}.dropdown-item-button{display:flex;width:100%;cursor:pointer;align-items:center;-moz-column-gap:8px;column-gap:8px;border-radius:0.25rem;--tw-border-opacity:1;--tw-bg-opacity:1;background-color:var(--ai12zBot-v2-dropdown-bgcolor);padding:8px 24px;font-weight:500;--tw-text-opacity:1;color:var(--ai12zBot-v2-dropdown-font-color);transition-property:color, background-color, border-color, text-decoration-color, fill, stroke;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:75ms}.helptext{padding:0px;opacity:0;height:0px}.minimize-input{transform:translateY(calc(-100% - 4px))}.ai-text-caption{font-size:12px;line-height:1.5;letter-spacing:0.2px;font-weight:400}.fab>button{background:var(--ai12zBot-v2-fab-button-background);}.user-input-fieldset{background:var(--ai12zBot-v2-searchbar-background)}.return-text-color{color:rgb(255, 255, 255)}.ai-minimize-icon svg{fill:currentColor;height:1em;width:1em}.hide-form{opacity:0;transform:none}.show-form{opacity:1;transform:none}.ai-minimize-icon{color:var(--wes-c-icon-color, inherit)}.fab{bottom:var(--fab-bottom, 30px)}.text-body1{font-size:var(--ai12zBot-v2-title-font-size);line-height:1.5;letter-spacing:-0.12px;font-weight:400}#message-submit{margin-right:6px;margin-bottom:7px;background-color:var(--ai12zBot-v2-searchbar-submit-bgcolor)}.ai-icon{color:var(--ai12zBot-v2-searchbar-submit-color);font-size:24px;width:1.5rem;height:1.5rem}.plus-icon{color:var(--ai12zBot-v2-searchbar-plus-icon-color);font-size:24px;width:1.5rem;height:1.5rem}.grow-wrap>.textarea,.grow-wrap:after{min-height:48px;align-content:center;border-radius:1.5rem;border-width:1px;border-style:solid;border:1px solid var(--ai12zBot-v2-searchbar-border-color);--tw-bg-opacity:1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1));padding:8px 48px;text-indent:2px;font-size:16px;line-height:1.5;letter-spacing:-0.12px;font-weight:400;--tw-text-opacity:1;color:rgb(46 46 46 / var(--tw-text-opacity, 1));--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);--tw-ring-inset:inset;--tw-ring-offset-width:0px;transition-property:all;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:0.15s}.grow-wrap>.textarea,.grow-wrap:after{grid-area:1 / 1 / 2 / 2}.modal{position:relative;grid-column:span 1 / span 1;grid-column-start:2;grid-row:span 3 / span 3;grid-row-start:1;display:grid;border-top-left-radius:0;border-top-right-radius:0;background-position:center;box-shadow:0 16px 32px -4px #18181829, 0 12px 24px -4px #18181814;background-image:var(--ai12zBot-v2-modal-backgroundImage);background-repeat:no-repeat;background-size:100vw 100vh;grid-template-columns:subgrid;grid-template-rows:subgrid;z-index:var(--xsf-ai12z-zindex-10);transition:0.3sease-out;transition-property:grid-template-columns}.dropdown-menu{pointer-events:none;opacity:0;z-index:10;background-color:var(--ai12zBot-v2-dropdown-bgcolor);transform:translateY(-10px);transition:opacity 0.3s ease, transform 0.3s ease}.dropdown-menu.show{pointer-events:auto;opacity:1;pointer-events:auto;transform:translateY(0);background-color:var(--ai12zBot-v2-dropdown-bgcolor)}.copy-btn{color:var(--ai12zBot-v2-copy-btn-color)}.thumbs-up{fill:var(--ai12zBot-v2-feedback-selected);width:1.5rem}.thumbs-down{fill:var( --ai12zBot-v2-feedback-selected);width:1.5rem}.chat-thumbs-up{color:var(--ai12zBot-v2-feedback-color)}.thumbs-container{justify-content:flex-start;align-items:center}.back-btn svg{fill:var(--ai12zBot-v2-back-button-color)}.dropdown-item{background-color:var(--ai12zBot-v2-dropdown-bgcolor)}button:focus-visible{outline:2px solid var(--ai12zBot-v2-focus-visible-color, #0A2A43);outline-offset:2px}button.bot-btn-primary:focus-visible{outline:2px solid var(--ai12zBot-v2-focus-visible-color-primary, var(--ai12zBot-v2-focus-visible-color, #0A2A43));outline-offset:2px}button.bot-btn-secondary:focus-visible{outline:2px solid var(--ai12zBot-v2-focus-visible-color-secondary, var(--ai12zBot-v2-focus-visible-color, #0A2A43))}.bot-name{color:var(--ai12zBot-v2-fab-name-color, var(--ai12zBot-v2-bot-name-color));font-weight:var(--ai12zBot-v2-fab-font-weight, var(--ai12zBot-v2-bot-name-font-weight))}.ai12z-link{color:var(--ai12zBot-v2-link-color);text-decoration:underline}.ai12z-link:hover{color:var(--ai12zBot-v2-link-hover-color);text-decoration:underline}.toolbar{height:52px;border:#fff;grid-area:toolbar}.skip-link{position:absolute;left:-999px;top:auto;width:1px;height:1px;overflow:hidden}.skip-link:focus{left:10px;top:10px;width:auto;height:auto;z-index:1000}.enter-tip{font-size:12px;color:#666;margin-left:10px}.skip-links.hidden{position:absolute;left:-9999px;}.skip-links.visible{left:auto;position:static;}.error-message-container{margin-top:0.25rem}.error-msg{color:#dc2626;font-size:0.75rem;display:block;animation:slideIn 0.2s ease-out}.ai12z-form-honeypot{position:absolute;left:-10000px;top:auto;width:1px;height:1px;overflow:hidden}@keyframes slideIn{from{opacity:0;transform:translateY(-4px)}to{opacity:1;transform:translateY(0)}}@media (min-width: 1024px){.modal{background-size:80vw 100vh}}@media (min-width: 1024px){.layout.is-expanded{grid-template-columns:1fr minmax(340px, 80dvw) 1fr !important}}@media (min-width: 768px){.layout.is-expanded{-moz-column-gap:48px;column-gap:48px}}@media (max-width: 767px){.layout.is-open{padding-top:0px !important;grid-template-columns:0fr minmax(340px, 1fr) 0fr !important}}@media (max-width: 767px){.fab{right:30px;bottom:var(--xsf-ai12z-fab-bottom, 26px)}}`;
824
896
 
897
+ var __rest = (undefined && undefined.__rest) || function (s, e) {
898
+ var t = {};
899
+ for (var p in s)
900
+ if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
901
+ t[p] = s[p];
902
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
903
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
904
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
905
+ t[p[i]] = s[p[i]];
906
+ }
907
+ return t;
908
+ };
825
909
  const Ai12zBot = class {
826
910
  constructor(hostRef) {
827
911
  index.registerInstance(this, hostRef);
@@ -893,6 +977,10 @@ const Ai12zBot = class {
893
977
  this.isRendered = false; // Flag to track if the component has been rendered
894
978
  this.showShortcutsDialog = false; // Keyboard shortcuts help dialog
895
979
  this.showLiveAgentEndDialog = false;
980
+ this.liveAgentSessionId = "";
981
+ this.liveAgentConversationId = "";
982
+ this.liveAgentProviderName = "salesforce";
983
+ this.liveAgentListenersRegistered = false;
896
984
  this.shortcuts = keyboardShortcuts.DEFAULT_SHORTCUTS;
897
985
  this.announceMessage = ""; // For accessibility announcements
898
986
  this.messageRefs = [];
@@ -1081,6 +1169,7 @@ const Ai12zBot = class {
1081
1169
  if (this.isLiveAgent) {
1082
1170
  this.messages = this.messages.slice(0, -1);
1083
1171
  this.liveAgentEventHandler.sendMessage({ sessionId: "", message: this.inputEl.value });
1172
+ this.updateBotState();
1084
1173
  if (this.inputEl.value) {
1085
1174
  this.inputEl.value = "";
1086
1175
  }
@@ -1108,7 +1197,7 @@ const Ai12zBot = class {
1108
1197
  // Get the last message in the messages array
1109
1198
  const lastMessage = this.messages[this.messages.length - 1];
1110
1199
  // check if last message is from user or agent
1111
- if (!lastMessage.sender || lastMessage.sender === null) {
1200
+ if (!lastMessage.sender || lastMessage.sender === null || lastMessage.type === "system") {
1112
1201
  // Generate a new temporary message object
1113
1202
  const tempMsg = utils.generateMessage(this.conversationId);
1114
1203
  // Generate a unique ID for the new message
@@ -1140,6 +1229,7 @@ const Ai12zBot = class {
1140
1229
  aiMessageBubble.setAttribute("data-bubbleText", bubbleText);
1141
1230
  let html = converter.makeHtml(bubbleText);
1142
1231
  this.updateConversations(html, message[0]);
1232
+ this.updateBotState();
1143
1233
  }
1144
1234
  setTimeout(() => {
1145
1235
  this.scrollToBottom();
@@ -1187,6 +1277,8 @@ const Ai12zBot = class {
1187
1277
  this.handleAgentError = () => {
1188
1278
  this.addEventMessage("Something went wrong with Live Agent, please try again later");
1189
1279
  this.isLiveAgent = false;
1280
+ this.liveAgentSessionId = "";
1281
+ this.liveAgentConversationId = "";
1190
1282
  this.isTypingIndicatorVisible = false;
1191
1283
  this.liveAgentEventHandler.disconnectLiveAgent();
1192
1284
  this.clearEvents();
@@ -1201,6 +1293,8 @@ const Ai12zBot = class {
1201
1293
  this.announce("Live agent chat ended");
1202
1294
  }
1203
1295
  this.isLiveAgent = false;
1296
+ this.liveAgentSessionId = "";
1297
+ this.liveAgentConversationId = "";
1204
1298
  this.isTypingIndicatorVisible = false;
1205
1299
  this.liveAgentButtonText = "Talk to a Live Agent";
1206
1300
  this.clearEvents();
@@ -1211,19 +1305,28 @@ const Ai12zBot = class {
1211
1305
  if (this.isLiveAgentEnabled && this.currentDomId === "") {
1212
1306
  this.currentDomId = this.messages[this.messages.length - 1].id;
1213
1307
  }
1214
- const agentEventMessages = this.liveAgentEventHandler.addAgentEventMessage(event);
1215
- if (agentEventMessages) {
1216
- // If the "Finding a live agent..." placeholder is still in the DOM, remove it then append new message
1217
- this.removeFindingAgentPlaceholder();
1218
- const currentDomElement = this.el.shadowRoot.querySelector(`#${this.currentDomId}`);
1219
- if (currentDomElement) {
1220
- currentDomElement.parentNode.appendChild(agentEventMessages);
1221
- }
1222
- if (this.inputEl) {
1223
- this.inputEl.value = "";
1224
- }
1225
- this.currentDomId = "";
1308
+ // Persist each system event into this.messages so they survive page reload
1309
+ const systemMessages = event.map((evt) => ({
1310
+ id: evt.id || `system-${utils.generateUUID()}`,
1311
+ text: evt.text || "",
1312
+ type: "system",
1313
+ isUser: false,
1314
+ isLoading: false,
1315
+ timestamp: new Date(),
1316
+ images: [],
1317
+ conversationId: this.conversationId,
1318
+ formModel: {},
1319
+ surveyDomId: "",
1320
+ sender: evt.sender || null,
1321
+ }));
1322
+ this.messages = [...this.messages, ...systemMessages];
1323
+ this.updateBotState();
1324
+ // If the "Finding a live agent..." placeholder is still in the DOM, remove it then append new message
1325
+ this.removeFindingAgentPlaceholder();
1326
+ if (this.inputEl) {
1327
+ this.inputEl.value = "";
1226
1328
  }
1329
+ this.currentDomId = "";
1227
1330
  }
1228
1331
  };
1229
1332
  this.handleAgentSessionCreated = () => {
@@ -1237,6 +1340,12 @@ const Ai12zBot = class {
1237
1340
  this.inputEl = inputEl;
1238
1341
  });
1239
1342
  };
1343
+ this.handleAgentSessionInfo = (info) => {
1344
+ this.liveAgentSessionId = (info === null || info === void 0 ? void 0 : info.sessionId) || "";
1345
+ this.liveAgentConversationId = (info === null || info === void 0 ? void 0 : info.conversationId) || "";
1346
+ this.isLiveAgent = true;
1347
+ this.updateBotState();
1348
+ };
1240
1349
  this.toggleBot = _e => {
1241
1350
  // e.stopPropagation()
1242
1351
  this.isToggled = !this.isToggled;
@@ -1274,6 +1383,7 @@ const Ai12zBot = class {
1274
1383
  this.showWelcomeScreen = true;
1275
1384
  this.toggleBot(e);
1276
1385
  this.showHistory = false;
1386
+ this.updateBotState();
1277
1387
  break;
1278
1388
  }
1279
1389
  };
@@ -1507,11 +1617,56 @@ const Ai12zBot = class {
1507
1617
  if (!botState.newChat) {
1508
1618
  this.messages = [...(botState.messages || [])];
1509
1619
  }
1620
+ // Restore live agent session identifiers so they can be used for recovery
1621
+ if (botState.isLiveAgent && botState.liveAgentSessionId && botState.liveAgentConversationId) {
1622
+ this.isLiveAgent = botState.isLiveAgent || true;
1623
+ this.liveAgentSessionId = botState.liveAgentSessionId;
1624
+ this.liveAgentConversationId = botState.liveAgentConversationId;
1625
+ this.liveAgentProviderName = botState.liveAgentProviderName || "salesforce";
1626
+ this.liveAgentButtonText = "End Live Agent chat";
1627
+ // Schedule reconnection after the component has finished loading
1628
+ setTimeout(() => this.recoverLiveAgentSession(), 0);
1629
+ }
1510
1630
  setTimeout(() => {
1511
1631
  this.scrollToBottom();
1512
1632
  }, 100);
1513
1633
  }
1514
1634
  }
1635
+ async recoverLiveAgentSession() {
1636
+ var _a, _b, _c, _d, _f, _g;
1637
+ const liveAgentProviderNames = Object.keys((_c = (_b = (_a = this.botSettings) === null || _a === void 0 ? void 0 : _a.liveagent) === null || _b === void 0 ? void 0 : _b.providers) !== null && _c !== void 0 ? _c : {});
1638
+ if (liveAgentProviderNames.length === 0 || !this.liveAgentSessionId || !this.liveAgentConversationId) {
1639
+ return;
1640
+ }
1641
+ // const providerName = liveAgentProviderNames[0] as import("../../utils/liveagents/liveagent-factory-services").LiveAgentProviderType
1642
+ const liveAgentConfig = (_g = (_f = (_d = this.botSettings) === null || _d === void 0 ? void 0 : _d.liveagent) === null || _f === void 0 ? void 0 : _f.providers[this.liveAgentProviderName]) !== null && _g !== void 0 ? _g : null;
1643
+ if (!liveAgentConfig) {
1644
+ return;
1645
+ }
1646
+ try {
1647
+ this.registerLiveAgentListeners();
1648
+ await this.liveAgentEventHandler.resumeLiveAgentSession(this.liveAgentProviderName, {
1649
+ sessionId: this.liveAgentSessionId,
1650
+ conversationId: this.liveAgentConversationId,
1651
+ userId: this.visitorID,
1652
+ config: liveAgentConfig,
1653
+ });
1654
+ }
1655
+ catch (err) {
1656
+ if (err instanceof LiveAgentAuthExpiredError) {
1657
+ this.addEventMessage("Your live agent session has expired. Please reconnect.");
1658
+ this.announce("Live agent session expired");
1659
+ }
1660
+ else {
1661
+ console.warn("AI12Z: Failed to recover live agent session, ending gracefully:", err);
1662
+ }
1663
+ this.isLiveAgent = false;
1664
+ this.liveAgentSessionId = "";
1665
+ this.liveAgentConversationId = "";
1666
+ this.liveAgentButtonText = "Talk to a Live Agent";
1667
+ this.clearEvents();
1668
+ }
1669
+ }
1515
1670
  componentDidLoad() {
1516
1671
  globalStore.setBotElement(this.el); // register globally
1517
1672
  if (typeof window !== "undefined" && !window.Handlebars) {
@@ -1926,6 +2081,15 @@ const Ai12zBot = class {
1926
2081
  this.isConnectingLiveAgent = false;
1927
2082
  }
1928
2083
  }
2084
+ if (data.liveAgent && !this.isLiveAgent && !this.isConnectingLiveAgent) {
2085
+ this.isConnectingLiveAgent = true;
2086
+ try {
2087
+ await this.connectLiveChat();
2088
+ }
2089
+ finally {
2090
+ this.isConnectingLiveAgent = false;
2091
+ }
2092
+ }
1929
2093
  // ✅ Common cleanup
1930
2094
  this.conversationId = data.conversationId;
1931
2095
  // this.saveConversation()
@@ -2299,8 +2463,8 @@ const Ai12zBot = class {
2299
2463
  }
2300
2464
  }
2301
2465
  checkLiveAgentMode() {
2302
- var _a, _b;
2303
- const isLiveAgentConfigured = ((_a = this.botSettings) === null || _a === void 0 ? void 0 : _a.liveagent) && Object.keys((_b = this.botSettings) === null || _b === void 0 ? void 0 : _b.liveagent).length > 0;
2466
+ var _a, _b, _c, _d;
2467
+ 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;
2304
2468
  /**
2305
2469
  * Check if live agent is enabled
2306
2470
  * If live agent is configured and there are more than one messages in the chat,
@@ -2333,8 +2497,10 @@ const Ai12zBot = class {
2333
2497
  var _a, _b, _c, _d;
2334
2498
  this.liveAgentEventHandler.disconnectLiveAgent();
2335
2499
  this.isLiveAgent = false;
2500
+ this.liveAgentSessionId = "";
2501
+ this.liveAgentConversationId = "";
2336
2502
  this.liveAgentButtonText = "Talk to a Live Agent";
2337
- this.sendMessage((_b = (_a = this.botSettings) === null || _a === void 0 ? void 0 : _a.llmMessageOnDisconnect) !== null && _b !== void 0 ? _b : "The live agent has been disconnected. Please do not initiate the live agent directive again.", (_d = (_c = this.botSettings) === null || _c === void 0 ? void 0 : _c.userMessageOnDisconnect) !== null && _d !== void 0 ? _d : "The live agent has ended the conversation.", { isLiveChatEnded: true });
2503
+ this.sendMessage(((_a = this.botSettings) === null || _a === void 0 ? void 0 : _a.llmMessageOnDisconnect) !== "" ? (_b = this.botSettings) === null || _b === void 0 ? void 0 : _b.llmMessageOnDisconnect : "The live agent has been disconnected. Please do not initiate the live agent directive again.", ((_c = this.botSettings) === null || _c === void 0 ? void 0 : _c.userMessageOnDisconnect) !== "" ? (_d = this.botSettings) === null || _d === void 0 ? void 0 : _d.userMessageOnDisconnect : "The live agent has ended the conversation.", { isLiveChatEnded: true });
2338
2504
  this.announce("Live agent chat ended");
2339
2505
  this.clearEvents();
2340
2506
  }
@@ -2350,6 +2516,9 @@ const Ai12zBot = class {
2350
2516
  }
2351
2517
  }
2352
2518
  registerLiveAgentListeners() {
2519
+ if (this.liveAgentListenersRegistered)
2520
+ return;
2521
+ this.liveAgentListenersRegistered = true;
2353
2522
  ChatEventBus.on("FINDING_AGENT", this.findingAgent);
2354
2523
  ChatEventBus.on("AGENT_EVENT", this.agentEventHandler);
2355
2524
  ChatEventBus.on("TYPING_STARTED", this.handleTypingStarted);
@@ -2357,8 +2526,10 @@ const Ai12zBot = class {
2357
2526
  ChatEventBus.on("AGENT_MESSAGE", this.agentMessageCreated);
2358
2527
  ChatEventBus.on("AGENT_ERROR", this.handleAgentError);
2359
2528
  ChatEventBus.on("CONVERSATION_CLOSED", this.handleAgentConversationEnded);
2529
+ ChatEventBus.on("AGENT_SESSION_INFO", this.handleAgentSessionInfo);
2360
2530
  }
2361
2531
  clearEvents() {
2532
+ this.liveAgentListenersRegistered = false;
2362
2533
  ChatEventBus.off("FINDING_AGENT", this.findingAgent);
2363
2534
  ChatEventBus.off("AGENT_EVENT", this.agentEventHandler);
2364
2535
  ChatEventBus.off("AGENT_MESSAGE", this.agentMessageCreated);
@@ -2367,12 +2538,13 @@ const Ai12zBot = class {
2367
2538
  ChatEventBus.off("TYPING_STARTED", this.handleTypingStarted);
2368
2539
  ChatEventBus.off("TYPING_STOPPED", this.handleTypingStopped);
2369
2540
  ChatEventBus.off("AGENT_SESSION_CREATED", this.handleAgentSessionCreated);
2541
+ ChatEventBus.off("AGENT_SESSION_INFO", this.handleAgentSessionInfo);
2370
2542
  }
2371
2543
  async connectLiveChat() {
2372
- var _a, _b, _c, _d, _f, _g, _h;
2544
+ var _a, _b, _c, _d, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u;
2373
2545
  this.announce("Connecting to live agent");
2374
2546
  this.clearEvents();
2375
- const liveAgentProviderNames = Object.keys((_b = (_a = this.botSettings) === null || _a === void 0 ? void 0 : _a.liveagent) !== null && _b !== void 0 ? _b : {});
2547
+ const liveAgentProviderNames = Object.keys((_c = (_b = (_a = this.botSettings) === null || _a === void 0 ? void 0 : _a.liveagent) === null || _b === void 0 ? void 0 : _b.providers) !== null && _c !== void 0 ? _c : {});
2376
2548
  if (liveAgentProviderNames.length === 0) {
2377
2549
  console.error("No live agent provider found in bot settings");
2378
2550
  this.announce("Live agent is not configured");
@@ -2381,7 +2553,9 @@ const Ai12zBot = class {
2381
2553
  if (liveAgentProviderNames.length > 1) {
2382
2554
  console.warn("Multiple live agent providers found, using the first one");
2383
2555
  }
2384
- let liveAgentSettings = (_d = (_c = this.botSettings) === null || _c === void 0 ? void 0 : _c.liveagent[liveAgentProviderNames[0]]) !== null && _d !== void 0 ? _d : null;
2556
+ let liveAgentSettings = (_h = (_g = (_f = (_d = this.botSettings) === null || _d === void 0 ? void 0 : _d.liveagent) === null || _f === void 0 ? void 0 : _f.providers) === null || _g === void 0 ? void 0 : _g[liveAgentProviderNames[0]]) !== null && _h !== void 0 ? _h : null;
2557
+ let liveAgentBusinessHours = (_l = (_k = (_j = this.botSettings) === null || _j === void 0 ? void 0 : _j.liveagent) === null || _k === void 0 ? void 0 : _k.businessHours) !== null && _l !== void 0 ? _l : null;
2558
+ let liveAgentTimezone = (_p = (_o = (_m = this.botSettings) === null || _m === void 0 ? void 0 : _m.liveagent) === null || _o === void 0 ? void 0 : _o.timezone) !== null && _p !== void 0 ? _p : null;
2385
2559
  if (!liveAgentSettings) {
2386
2560
  console.error("No live agent settings found for the provider", liveAgentProviderNames[0]);
2387
2561
  this.announce("Live agent settings are unavailable");
@@ -2404,6 +2578,27 @@ const Ai12zBot = class {
2404
2578
  messageHistory: messageHistory,
2405
2579
  extraPrechatFormDetails,
2406
2580
  };
2581
+ this.liveAgentProviderName = liveAgentProviderNames[0];
2582
+ if (liveAgentBusinessHours && liveAgentTimezone) {
2583
+ let isWithinBusinessHours;
2584
+ try {
2585
+ isWithinBusinessHours = botHelpers.checkBusinessHours(liveAgentBusinessHours, liveAgentTimezone);
2586
+ }
2587
+ catch (e) {
2588
+ console.error("AI12Z: unexpected error evaluating business hours — blocking live agent connection", e);
2589
+ this.announce("Unexpected error evaluating business hours. Live agent connection blocked.");
2590
+ this.addEventMessage("Unexpected error evaluating business hours. Please try again later.");
2591
+ this.isTypingIndicatorVisible = false;
2592
+ return;
2593
+ }
2594
+ if (!isWithinBusinessHours) {
2595
+ const outsideHoursMsg = (_r = (_q = liveAgentSettings.config) === null || _q === void 0 ? void 0 : _q.outsideBusinessHoursMessage) !== null && _r !== void 0 ? _r : "Our live agents are currently offline. Please try again during our business hours.";
2596
+ this.addEventMessage(outsideHoursMsg);
2597
+ this.announce("Live agents are currently offline");
2598
+ this.isTypingIndicatorVisible = false;
2599
+ return;
2600
+ }
2601
+ }
2407
2602
  if (liveAgentProviderNames[0] === "liveagent") {
2408
2603
  if (!this.liveAgentRef) {
2409
2604
  this.isTypingIndicatorVisible = false;
@@ -2419,7 +2614,7 @@ const Ai12zBot = class {
2419
2614
  else {
2420
2615
  // Coerce to number; enforce minimum of 5 s to prevent misconfigured values;
2421
2616
  // fall back to 30 s when unset, non-numeric, or below the minimum.
2422
- const rawWait = Number((_f = liveAgentSettings === null || liveAgentSettings === void 0 ? void 0 : liveAgentSettings.config) === null || _f === void 0 ? void 0 : _f.maxWaitTime);
2617
+ const rawWait = Number((_s = liveAgentSettings === null || liveAgentSettings === void 0 ? void 0 : liveAgentSettings.config) === null || _s === void 0 ? void 0 : _s.maxWaitTime);
2423
2618
  const waitSeconds = Number.isFinite(rawWait) && rawWait >= 5 ? rawWait : 300;
2424
2619
  const timeoutMs = waitSeconds * 1000;
2425
2620
  // Step 1: register all listeners before connecting so no events are missed
@@ -2431,6 +2626,9 @@ const Ai12zBot = class {
2431
2626
  catch (err) {
2432
2627
  console.error("Live agent connection error:", err);
2433
2628
  this.isTypingIndicatorVisible = false;
2629
+ this.liveAgentSessionId = "";
2630
+ this.liveAgentConversationId = "";
2631
+ this.updateBotState();
2434
2632
  this.addEventMessage("Issue connecting to live agent. Please try again later.");
2435
2633
  this.announce("Issue connecting to live agent. Please try again later.");
2436
2634
  this.liveAgentEventHandler.disconnectLiveAgent();
@@ -2454,13 +2652,16 @@ const Ai12zBot = class {
2454
2652
  }
2455
2653
  catch (error) {
2456
2654
  // --- FAILURE LOGIC (TIMEOUT) ---
2655
+ this.liveAgentSessionId = "";
2656
+ this.liveAgentConversationId = "";
2457
2657
  this.isLiveAgent = false;
2458
2658
  this.isTypingIndicatorVisible = false;
2459
- const timeoutMsg = (_h = (_g = liveAgentSettings.config) === null || _g === void 0 ? void 0 : _g.maxWaitMessage) !== null && _h !== void 0 ? _h : "Sorry, no agents are available at the moment.";
2659
+ const timeoutMsg = (_u = (_t = liveAgentSettings.config) === null || _t === void 0 ? void 0 : _t.maxWaitMessage) !== null && _u !== void 0 ? _u : "Sorry, no agents are available at the moment.";
2460
2660
  this.removeFindingAgentPlaceholder();
2461
2661
  this.addEventMessage(timeoutMsg);
2462
2662
  this.liveAgentEventHandler.disconnectLiveAgent();
2463
2663
  this.clearEvents();
2664
+ this.updateBotState();
2464
2665
  this.announce("Agents are not available at this time.");
2465
2666
  // console.warn("Connection failed:", error.message)
2466
2667
  }
@@ -2514,6 +2715,10 @@ const Ai12zBot = class {
2514
2715
  projectId: (_c = this.botSettings) === null || _c === void 0 ? void 0 : _c.pId,
2515
2716
  configId: (_d = this.botSettings) === null || _d === void 0 ? void 0 : _d._id.$oid,
2516
2717
  newChat: this.messages.length === 0 ? true : false,
2718
+ isLiveAgent: this.isLiveAgent,
2719
+ liveAgentProviderName: this.liveAgentProviderName,
2720
+ liveAgentSessionId: this.liveAgentSessionId,
2721
+ liveAgentConversationId: this.liveAgentConversationId,
2517
2722
  };
2518
2723
  if (this.messages.length === 0) {
2519
2724
  this.conversationId = "";
@@ -2521,7 +2726,8 @@ const Ai12zBot = class {
2521
2726
  try {
2522
2727
  sessionStorage.setItem(sessionKey, JSON.stringify(newState));
2523
2728
  if (this.botSettings.cookies && getValidCookieDomain(this.botSettings.subDomain)) {
2524
- setJsonCookie(sessionKey, newState, { domain: this.botSettings.subDomain });
2729
+ const cookieState = __rest(newState, ["liveAgentSessionId", "liveAgentConversationId"]);
2730
+ setJsonCookie(sessionKey, cookieState, { domain: this.botSettings.subDomain });
2525
2731
  }
2526
2732
  }
2527
2733
  catch (error) {
@@ -2536,7 +2742,7 @@ const Ai12zBot = class {
2536
2742
  }
2537
2743
  }
2538
2744
  render() {
2539
- var _a, _b, _c, _d, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _w;
2745
+ var _a, _b, _c, _d, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _w, _x, _y;
2540
2746
  if (!this.canRender) {
2541
2747
  return (index.h(index.Host, null, index.h("span", { style: { display: "none" } }, "Failed to load ai12z bot control due to insufficient fund")));
2542
2748
  }
@@ -2550,7 +2756,7 @@ const Ai12zBot = class {
2550
2756
  display: this.isExpanded && this.isOpened ? "grid" : "none",
2551
2757
  opacity: this.isExpanded && this.isOpened ? "1" : "0",
2552
2758
  pointerEvents: this.isExpanded && this.isOpened ? "all" : "none",
2553
- } }), index.h("div", { class: "modal", "data-testid": "modal", "aria-hidden": "false", role: "dialog", "aria-modal": "true", tabindex: "-1", style: { display: this.isOpened ? "grid" : "none", opacity: this.isOpened ? "1" : "0", transform: this.isOpened ? "none" : "translateY(100%)" } }, index.h("header", { role: "banner" }, index.h("div", { class: "flex bg-white overflow-hidden border-b border-gray-90 border-solid md:pl-3 pl-4 justify-end md:rounded-t-xl items-center toolbar" }, index.h("div", { class: "flex gap-1 toolbar-overflow-actions" }, this.isLiveAgentEnabled && ((_g = (_f = this.botSettings) === null || _f === void 0 ? void 0 : _f.liveagent) === null || _g === void 0 ? void 0 : _g.liveagent) && (index.h("live-agent-chat", { config: (_j = (_h = this.botSettings) === null || _h === void 0 ? void 0 : _h.liveagent) === null || _j === void 0 ? void 0 : _j.liveagent, ref: el => (this.liveAgentRef = el) })), !this.showHistory && (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", tabindex: "0", "aria-label": "options menu", "aria-haspopup": "menu", "aria-expanded": this.isToggled ? "true" : "false", "aria-controls": "dropdown-menu", onClick: e => {
2759
+ } }), index.h("div", { class: "modal", "data-testid": "modal", "aria-hidden": "false", role: "dialog", "aria-modal": "true", tabindex: "-1", style: { display: this.isOpened ? "grid" : "none", opacity: this.isOpened ? "1" : "0", transform: this.isOpened ? "none" : "translateY(100%)" } }, index.h("header", { role: "banner" }, index.h("div", { class: "flex bg-white overflow-hidden border-b border-gray-90 border-solid md:pl-3 pl-4 justify-end md:rounded-t-xl items-center toolbar" }, index.h("div", { class: "flex gap-1 toolbar-overflow-actions" }, this.isLiveAgentEnabled && ((_h = (_g = (_f = this.botSettings) === null || _f === void 0 ? void 0 : _f.liveagent) === null || _g === void 0 ? void 0 : _g.providers) === null || _h === void 0 ? void 0 : _h.liveagent) && (index.h("live-agent-chat", { config: (_l = (_k = (_j = this.botSettings) === null || _j === void 0 ? void 0 : _j.liveagent) === null || _k === void 0 ? void 0 : _k.providers) === null || _l === void 0 ? void 0 : _l.liveagent, ref: el => (this.liveAgentRef = el) })), !this.showHistory && (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", tabindex: "0", "aria-label": "options menu", "aria-haspopup": "menu", "aria-expanded": this.isToggled ? "true" : "false", "aria-controls": "dropdown-menu", onClick: e => {
2554
2760
  e.preventDefault();
2555
2761
  e.stopPropagation();
2556
2762
  this.toggleBot(e);
@@ -2569,7 +2775,7 @@ const Ai12zBot = class {
2569
2775
  this.handleLiveAgentToolbarAction();
2570
2776
  }, onToggledChange: event => {
2571
2777
  this.isToggled = event.detail;
2572
- } })), ((_k = this.botSettings) === null || _k === void 0 ? void 0 : _k.botLogo) && index.h("img", { src: (_l = this.botSettings) === null || _l === void 0 ? void 0 : _l.botLogo, class: "w-8 h-8 rounded-lg", alt: "Bot Logo" }), index.h("h2", { class: "flex-1 pl-2 heading text-body1" }, (_m = this.botSettings) === null || _m === void 0 ? void 0 : _m.botName), index.h("div", { class: "buttons flex gap-2 p-[10px]" }, this.isLiveAgent && (index.h("button", { "aria-label": "End Live Agent", title: "End Live Agent", onClick: () => this.openEndLiveAgentDialog() }, index.h("svg", { xmlns: "http://www.w3.org/2000/svg", height: "24px", viewBox: "0 -960 960 960", width: "24px", fill: "#151313" }, index.h("path", { d: "m136-304-92-90q-12-12-12-28t12-28q88-95 203-142.5T480-640q118 0 232.5 47.5T916-450q12 12 12 28t-12 28l-92 90q-11 11-25.5 12t-26.5-8l-116-88q-8-6-12-14t-4-18v-114q-38-12-78-19t-82-7q-42 0-82 7t-78 19v114q0 10-4 18t-12 14l-116 88q-12 9-26.5 8T136-304Zm104-198q-29 15-56 34.5T128-424l40 40 72-56v-62Zm480 2v60l72 56 40-38q-29-26-56-45t-56-33Zm-480-2Zm480 2Z" })))), this.messages.length > 0 && (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", tabindex: "0", onClick: e => {
2778
+ } })), ((_m = this.botSettings) === null || _m === void 0 ? void 0 : _m.botLogo) && index.h("img", { src: (_o = this.botSettings) === null || _o === void 0 ? void 0 : _o.botLogo, class: "w-8 h-8 rounded-lg", alt: "Bot Logo" }), index.h("h2", { class: "flex-1 pl-2 heading text-body1" }, (_p = this.botSettings) === null || _p === void 0 ? void 0 : _p.botName), index.h("div", { class: "buttons flex gap-2 p-[10px]" }, this.isLiveAgent && (index.h("button", { "aria-label": "End Live Agent", title: "End Live Agent", onClick: () => this.openEndLiveAgentDialog() }, index.h("svg", { xmlns: "http://www.w3.org/2000/svg", height: "24px", viewBox: "0 -960 960 960", width: "24px", fill: "#151313" }, index.h("path", { d: "m136-304-92-90q-12-12-12-28t12-28q88-95 203-142.5T480-640q118 0 232.5 47.5T916-450q12 12 12 28t-12 28l-92 90q-11 11-25.5 12t-26.5-8l-116-88q-8-6-12-14t-4-18v-114q-38-12-78-19t-82-7q-42 0-82 7t-78 19v114q0 10-4 18t-12 14l-116 88q-12 9-26.5 8T136-304Zm104-198q-29 15-56 34.5T128-424l40 40 72-56v-62Zm480 2v60l72 56 40-38q-29-26-56-45t-56-33Zm-480-2Zm480 2Z" })))), this.messages.length > 0 && (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", tabindex: "0", onClick: e => {
2573
2779
  e.preventDefault();
2574
2780
  this.messages = [...[]];
2575
2781
  // this.conversationId = ""
@@ -2597,12 +2803,16 @@ const Ai12zBot = class {
2597
2803
  this.updateBotState();
2598
2804
  this.announce("Chat minimized");
2599
2805
  this.minimize.emit("minimize");
2600
- } }, index.h("i", { class: "block wes-icon--loading text-body2 modal-toolbar-icon", title: "Minimize Bot" }, index.h("svg", { viewBox: "0 0 26 26", xmlns: "http://www.w3.org/2000/svg", fill: "currentColor", "aria-hidden": "true" }, index.h("path", { "fill-rule": "evenodd", "clip-rule": "evenodd", d: "M25 24.25C25 24.65 24.65 25 24.25 25H1.75C1.35 25 1 24.65 1 24.25V22.75C1 22.35 1.35 22 1.75 22H24.25C24.65 22 25 22.35 25 22.75V24.25Z" }))))))), index.h("div", { class: "flex-1 flex flex-col main", role: "main", "aria-labelledby": "chat-main-heading", id: "main-content", tabindex: "-1" }, index.h("h1", { id: "chat-main-heading", class: "sr-only" }, "Chat"), index.h("div", { class: "h-full flex flex-col chat-body" }, index.h("div", { class: "px-5 flex-[1_1_0] min-h-[calc(100%-1px)] flex flex-col gap-y-3 @md:px-3 messages-container", role: "region", "aria-labelledby": "messages-region-heading" }, index.h("h2", { id: "messages-region-heading", class: "sr-only" }, "Messages"), this.showWelcomeScreen && index.h("div", { class: "@md:px-6 pb-3 @md:pb-7 @md:pt-8 pt-5 text-display5", innerHTML: (_p = (_o = this.botSettings) === null || _o === void 0 ? void 0 : _o.welcome) === null || _p === void 0 ? void 0 : _p.message }), this.messages.length > 0 &&
2806
+ } }, index.h("i", { class: "block wes-icon--loading text-body2 modal-toolbar-icon", title: "Minimize Bot" }, index.h("svg", { viewBox: "0 0 26 26", xmlns: "http://www.w3.org/2000/svg", fill: "currentColor", "aria-hidden": "true" }, index.h("path", { "fill-rule": "evenodd", "clip-rule": "evenodd", d: "M25 24.25C25 24.65 24.65 25 24.25 25H1.75C1.35 25 1 24.65 1 24.25V22.75C1 22.35 1.35 22 1.75 22H24.25C24.65 22 25 22.35 25 22.75V24.25Z" }))))))), index.h("div", { class: "flex-1 flex flex-col main", role: "main", "aria-labelledby": "chat-main-heading", id: "main-content", tabindex: "-1" }, index.h("h1", { id: "chat-main-heading", class: "sr-only" }, "Chat"), index.h("div", { class: "h-full flex flex-col chat-body" }, index.h("div", { class: "px-5 flex-[1_1_0] min-h-[calc(100%-1px)] flex flex-col gap-y-3 @md:px-3 messages-container", role: "region", "aria-labelledby": "messages-region-heading" }, index.h("h2", { id: "messages-region-heading", class: "sr-only" }, "Messages"), this.showWelcomeScreen && index.h("div", { class: "@md:px-6 pb-3 @md:pb-7 @md:pt-8 pt-5 text-display5", innerHTML: (_r = (_q = this.botSettings) === null || _q === void 0 ? void 0 : _q.welcome) === null || _r === void 0 ? void 0 : _r.message }), this.messages.length > 0 &&
2601
2807
  !this.showHistory &&
2602
2808
  this.messages.map((message, idx) => {
2603
- var _a, _b, _c, _d;
2604
2809
  // const showAvatar = !message.isUser && (idx === this.messages.length - 1 || this.messages[idx + 1]?.isUser === true)
2605
2810
  // const email = ""
2811
+ var _a, _b, _c, _d;
2812
+ // Render system event messages (e.g. "Agent has joined the chat") as a centered banner
2813
+ if (message.type === "system") {
2814
+ return (index.h("div", { class: "flex justify-center pb-3 message-item", role: "listitem", tabindex: -1, ref: el => (this.messageRefs[idx] = el), "aria-label": message.text }, index.h("span", { class: "text-[10px] font-medium text-gray-500 tracking-wide border-b border-gray-200 py-1 px-3 text-center" }, message.text)));
2815
+ }
2606
2816
  return (index.h("div", { class: `flex pb-3 gap-x-2 @md:gap-x-3
2607
2817
  ${message.isUser ? "self-end" : ""}
2608
2818
  ${message.isUser ? "justify-end" : ""} end-user-message message-item`, style: { opacity: "1", transform: "none" }, role: "listitem", tabindex: idx === this.focusedIndex ? 0 : -1, onKeyDown: e => this.handleMessageKeyNav(e, idx), ref: el => (this.messageRefs[idx] = el), "aria-label": `Message from ${message.isUser ? "User" : "Bot"}` }, message.isUser && !message.isHide && (index.h("div", { class: "flex flex-col items-end" }, index.h("div", { "data-testid": "message", class: "break-words @md:text-body2 box-border @md:pr-4 flex-1 rounded-lg py-2 px-4 user-msg text-body3", innerHTML: message.text, id: message.id, "aria-live": "polite", "aria-atomic": "false", "aria-label": message.text, role: "log" }, (_a = message === null || message === void 0 ? void 0 : message.images) === null || _a === void 0 ? void 0 : _a.map(img => {
@@ -2615,7 +2825,7 @@ const Ai12zBot = class {
2615
2825
  "opacity-90": !this.isProse,
2616
2826
  "max-w-full break-words @md:text-body2 box-border @md:pr-4 flex-1 rounded-lg text-gray-30 pr-2 text-body3": true,
2617
2827
  }, innerHTML: message.text, id: message.id }, message.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" }))))))), message.text !== "" && message.showIcon && ((_c = this.botSettings.showMessageIcons) !== null && _c !== void 0 ? _c : true) && (index.h("interaction-buttons", { message: message, chatArray: this.messages, currentIndex: idx, dataKey: this.dataKey, dataMode: this.dataMode, voice: this.voice, voiceType: this.voiceType, source: "bot", conversationId: this.conversationId, projectId: ((_d = this.botSettings) === null || _d === void 0 ? void 0 : _d.pId) || "" })), index.h("div", { class: "text-gray-30 pt-2 text-body4" }, this.botSettings.botName, " \u2022 ", message.timestamp)))));
2618
- }), this.showHistory && (index.h("chatbot-history", { chatList: this.conversationHistory, botName: (_q = this.botSettings) === null || _q === void 0 ? void 0 : _q.botName, styles: this.customStyle, scripts: this.customJS })), index.h("div", { class: "h-px pt-2px", style: { overflowAnchor: "auto" } })), index.h("div", { role: "status", "aria-live": "polite", "aria-atomic": "true", class: "sr-only" }, this.announceMessage)))), index.h("form", { "data-testid": "user-input", class: `relative pointer-events-auto ${this.isOpened ? "p-2.5" : ""} searchform user-input`, "aria-label": "Message Area", "aria-hidden": "false", style: { opacity: !this.isMinimized ? "1" : "0", transform: "translateX(0)", pointerEvents: !this.isMinimized ? "auto" : "none" } }, !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 => {
2828
+ }), this.showHistory && (index.h("chatbot-history", { chatList: this.conversationHistory, botName: (_s = this.botSettings) === null || _s === void 0 ? void 0 : _s.botName, styles: this.customStyle, scripts: this.customJS })), index.h("div", { class: "h-px pt-2px", style: { overflowAnchor: "auto" } })), index.h("div", { role: "status", "aria-live": "polite", "aria-atomic": "true", class: "sr-only" }, this.announceMessage)))), index.h("form", { "data-testid": "user-input", class: `relative pointer-events-auto ${this.isOpened ? "p-2.5" : ""} searchform user-input`, "aria-label": "Message Area", "aria-hidden": "false", style: { opacity: !this.isMinimized ? "1" : "0", transform: "translateX(0)", pointerEvents: !this.isMinimized ? "auto" : "none" } }, !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 => {
2619
2829
  e.preventDefault();
2620
2830
  this.isMinimized = !this.isMinimized;
2621
2831
  this.isOpened = !this.isMinimized;
@@ -2647,12 +2857,12 @@ const Ai12zBot = class {
2647
2857
  .filter(Boolean)
2648
2858
  .join(" "), "aria-placeholder": this.isLiveAgent
2649
2859
  ? "Type a message to the agent..."
2650
- : ((_r = this.botSettings) === null || _r === void 0 ? void 0 : _r.botPlaceholderText) !== ""
2651
- ? (_s = this.botSettings) === null || _s === void 0 ? void 0 : _s.botPlaceholderText
2652
- : "Ask me anything", "aria-label": "Type your message here", class: `resize-none overflow-hidden text-ellipsis focus:outline-none w-full custom-input ${this.hideAllButtons ? "hidden" : ""}`, "data-testid": "user-input-textarea", rows: this.rowCount, name: "userMessage", placeholder: this.isLiveAgent
2653
- ? "Type a message to the agent..."
2654
2860
  : ((_t = this.botSettings) === null || _t === void 0 ? void 0 : _t.botPlaceholderText) !== ""
2655
2861
  ? (_u = this.botSettings) === null || _u === void 0 ? void 0 : _u.botPlaceholderText
2862
+ : "Ask me anything", "aria-label": "Type your message here", class: `resize-none overflow-hidden text-ellipsis focus:outline-none w-full custom-input ${this.hideAllButtons ? "hidden" : ""}`, "data-testid": "user-input-textarea", rows: this.rowCount, name: "userMessage", placeholder: this.isLiveAgent
2863
+ ? "Type a message to the agent..."
2864
+ : ((_w = this.botSettings) === null || _w === void 0 ? void 0 : _w.botPlaceholderText) !== ""
2865
+ ? (_x = this.botSettings) === null || _x === void 0 ? void 0 : _x.botPlaceholderText
2656
2866
  : "Ask me anything", ref: el => (this.inputEl = el), onKeyUp: _e => {
2657
2867
  this.adjustHeight();
2658
2868
  }, onKeyDown: e => {
@@ -2714,8 +2924,8 @@ const Ai12zBot = class {
2714
2924
  }, onClick: () => {
2715
2925
  this.openChat();
2716
2926
  }
2717
- }, this.isBot && index.h("slot", { name: "bot" }), !this.isBot && (index.h("button", { class: "rounded-full flex cursor-pointer items-center pr-[14px] md:gap-x-3 focus:outline focus:outline-2 focus:outline-offset-2 focus:outline-blue-focused bot-btn-primary", tabindex: "0", "aria-label": "open Bot" }, index.h("div", { class: "w-10 h-10 flex items-center justify-center bg-white rounded-full border relative" }, this.botSettings.botLaunchIcon && index.h("img", { src: this.botSettings.botLaunchIcon, alt: "bot icon", class: "w-8 h-8 rounded-lg" }), !this.botSettings.botLaunchIcon && (index.h("svg", { viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", stroke: "#2095ae", "aria-hidden": "true" }, index.h("g", { "stroke-width": "0" }), index.h("g", { "stroke-linecap": "round", "stroke-linejoin": "round" }), index.h("g", null, " ", index.h("path", { d: "M21 12C21 16.9706 16.9706 21 12 21C7.02944 21 3 16.9706 3 12C3 7.02944 7.02944 3 12 3C16.9706 3 21 7.02944 21 12Z", stroke: "#2095ae", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round" }), " ")))), index.h("span", { class: "bot-name" }, " ", (_w = this.botSettings) === null || _w === void 0 ? void 0 :
2718
- _w.botName, " ")))))), index.h("keyboard-shortcuts-dialog", { show: this.showShortcutsDialog, shortcuts: this.shortcuts, onCloseDialog: () => {
2927
+ }, this.isBot && index.h("slot", { name: "bot" }), !this.isBot && (index.h("button", { class: "rounded-full flex cursor-pointer items-center pr-[14px] md:gap-x-3 focus:outline focus:outline-2 focus:outline-offset-2 focus:outline-blue-focused bot-btn-primary", tabindex: "0", "aria-label": "open Bot" }, index.h("div", { class: "w-10 h-10 flex items-center justify-center bg-white rounded-full border relative" }, this.botSettings.botLaunchIcon && index.h("img", { src: this.botSettings.botLaunchIcon, alt: "bot icon", class: "w-8 h-8 rounded-lg" }), !this.botSettings.botLaunchIcon && (index.h("svg", { viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", stroke: "#2095ae", "aria-hidden": "true" }, index.h("g", { "stroke-width": "0" }), index.h("g", { "stroke-linecap": "round", "stroke-linejoin": "round" }), index.h("g", null, " ", index.h("path", { d: "M21 12C21 16.9706 16.9706 21 12 21C7.02944 21 3 16.9706 3 12C3 7.02944 7.02944 3 12 3C16.9706 3 21 7.02944 21 12Z", stroke: "#2095ae", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round" }), " ")))), index.h("span", { class: "bot-name" }, " ", (_y = this.botSettings) === null || _y === void 0 ? void 0 :
2928
+ _y.botName, " ")))))), index.h("keyboard-shortcuts-dialog", { show: this.showShortcutsDialog, shortcuts: this.shortcuts, onCloseDialog: () => {
2719
2929
  this.showShortcutsDialog = false;
2720
2930
  } }), index.h("delete-confirmation-modal", { show: this.showLiveAgentEndDialog, dialogTitle: "End live agent chat?", message: "You are about to end the current live agent conversation. You can continue chatting with the bot after ending it.", confirmButtonText: "End", onConfirmDelete: () => {
2721
2931
  this.confirmEndLiveAgent();