ai12z 3.15.1-alpha.3 → 3.15.1

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.
@@ -1653,9 +1653,7 @@ const Ai12zBot = class {
1653
1653
  this.botSettings = Object.assign(Object.assign({}, this.botSettings), settings);
1654
1654
  }
1655
1655
  async componentWillLoad() {
1656
- utils.checkStatus(this.dataKey, this.dataMode).then(enable => {
1657
- this.canRender = enable;
1658
- });
1656
+ this.canRender = await utils.checkStatus(this.dataKey, this.dataMode);
1659
1657
  this.checkCustomSlot();
1660
1658
  this.timestamp = utils.formatTimestamp(new Date());
1661
1659
  this.updateScreenSize();
@@ -55,10 +55,18 @@ const Ai12zChatMessage = class {
55
55
  botHelpers.initializeScript(event.detail.id, this.mainObject);
56
56
  }
57
57
  componentWillLoad() {
58
+ var _a, _b;
58
59
  this.loadScriptsSequentially();
60
+ // Adopt customCSS in this shadow root using the shared CSSStyleSheet
61
+ // already constructed by the parent knowledge-box (zero extra fetches).
62
+ if ((_a = this.kbSettings) === null || _a === void 0 ? void 0 : _a.customCSS) {
63
+ styleSheetRegistry.adoptStyleSheet(this.kbSettings.customCSS, this.el.shadowRoot);
64
+ }
65
+ if ((_b = this.kbSettings) === null || _b === void 0 ? void 0 : _b.customJS) {
66
+ styleSheetRegistry.loadScriptOnce(this.kbSettings.customJS, this.el.shadowRoot);
67
+ }
59
68
  }
60
69
  componentDidLoad() {
61
- var _a, _b;
62
70
  // Initialise the ai12z global exactly once; never overwrite an existing value.
63
71
  if (!window["ai12z"]) {
64
72
  window["ai12z"] = {};
@@ -67,14 +75,6 @@ const Ai12zChatMessage = class {
67
75
  ai12zHeading.text = `var ai12zChat = window["ai12z"] = {}`;
68
76
  this.el.shadowRoot.appendChild(ai12zHeading);
69
77
  this.checkOverflow();
70
- // Adopt customCSS in this shadow root using the shared CSSStyleSheet
71
- // already constructed by the parent knowledge-box (zero extra fetches).
72
- if ((_a = this.kbSettings) === null || _a === void 0 ? void 0 : _a.customCSS) {
73
- styleSheetRegistry.adoptStyleSheet(this.kbSettings.customCSS, this.el.shadowRoot);
74
- }
75
- if ((_b = this.kbSettings) === null || _b === void 0 ? void 0 : _b.customJS) {
76
- styleSheetRegistry.loadScriptOnce(this.kbSettings.customJS, this.el.shadowRoot);
77
- }
78
78
  }
79
79
  async loadScriptsSequentially() {
80
80
  try {
@@ -156,9 +156,9 @@ const Ai12zChatMessage = class {
156
156
  render() {
157
157
  var _a, _b, _c, _d;
158
158
  const lineClamp = (_b = (_a = this.kbSettings) === null || _a === void 0 ? void 0 : _a.numberOfLines) !== null && _b !== void 0 ? _b : 10;
159
- return (index.h("div", { key: '2d24739583f2f73daa28590c6c121531cf6ab4ce', class: "chat-message" }, index.h("div", { key: '9e8ca0a62a0de746f367164ff51ea9b9a22e93a0', ref: (el) => this.messageRef = el, class: { 'message-text': true, "custom-line-clamp": !this.isExpanded && !this.isCollapsing && this.showButton }, style: {
159
+ return (index.h("div", { key: '54f51ffb7c06bbb20fc1088c0fb63a8669d7ba45', class: "chat-message" }, index.h("div", { key: '281bc75361bcfadb4611eefeb9697d525b9e2d27', ref: (el) => this.messageRef = el, class: { 'message-text': true, "custom-line-clamp": !this.isExpanded && !this.isCollapsing && this.showButton }, style: {
160
160
  "--line-clamp": `${lineClamp}`,
161
- }, innerHTML: this.text, onClick: this.showButton ? this.toggleExpand : undefined }), !this.isExpanded && this.showButton && this.canExpand && index.h("div", { key: '12f386a03fc84f97d2e585ea21cf4f8d31964c34', class: "fade-overlay" }), this.showButton && this.canExpand && index.h("button", { key: '1633be8cd35334eae64f75d7ce5fd87b30054849', class: "show-more-btn", onClick: this.toggleExpand }, this.isExpanded ? (((_c = this.kbSettings) === null || _c === void 0 ? void 0 : _c.showLessButtonLabel) || "Show less") : (((_d = this.kbSettings) === null || _d === void 0 ? void 0 : _d.showMoreButtonLabel) || "Show more"), this.isExpanded ? index.h("svg", { width: "1em", height: "1em", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round" }, index.h("polyline", { points: "6 9 12 15 18 9" })) : index.h("svg", { width: "1em", height: "1em", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round" }, index.h("polyline", { points: "18 15 12 9 6 15" })))));
161
+ }, innerHTML: this.text, onClick: this.showButton ? this.toggleExpand : undefined }), !this.isExpanded && this.showButton && this.canExpand && index.h("div", { key: 'd6e262dbca0934b97fafb3dd7723b3b9333d8e10', class: "fade-overlay" }), this.showButton && this.canExpand && index.h("button", { key: 'e1e711b71656763ecdeb1cb6f73166528f023914', class: "show-more-btn", onClick: this.toggleExpand }, this.isExpanded ? (((_c = this.kbSettings) === null || _c === void 0 ? void 0 : _c.showLessButtonLabel) || "Show less") : (((_d = this.kbSettings) === null || _d === void 0 ? void 0 : _d.showMoreButtonLabel) || "Show more"), this.isExpanded ? index.h("svg", { width: "1em", height: "1em", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round" }, index.h("polyline", { points: "6 9 12 15 18 9" })) : index.h("svg", { width: "1em", height: "1em", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round" }, index.h("polyline", { points: "18 15 12 9 6 15" })))));
162
162
  }
163
163
  get el() { return index.getElement(this); }
164
164
  static get watchers() { return {
@@ -333,9 +333,7 @@ const Ai12zCta = class {
333
333
  this.formSubmitted.emit(event.detail.data);
334
334
  }
335
335
  async componentWillLoad() {
336
- utils.checkStatus(this.dataKey, this.dataMode).then(enable => {
337
- this.canRender = enable;
338
- });
336
+ this.canRender = await utils.checkStatus(this.dataKey, this.dataMode);
339
337
  utils.insertStyles(`https://cdn.ai12z.net/assets/bot/v2/tailwind.min.css`, this.el);
340
338
  appStore.setParentComponentState("cta", this.dataKey, this.dataMode);
341
339
  await this.configCtaSettings();
@@ -706,9 +706,7 @@ export class Ai12zBot {
706
706
  this.botSettings = Object.assign(Object.assign({}, this.botSettings), settings);
707
707
  }
708
708
  async componentWillLoad() {
709
- checkStatus(this.dataKey, this.dataMode).then(enable => {
710
- this.canRender = enable;
711
- });
709
+ this.canRender = await checkStatus(this.dataKey, this.dataMode);
712
710
  this.checkCustomSlot();
713
711
  this.timestamp = formatTimestamp(new Date());
714
712
  this.updateScreenSize();
@@ -313,9 +313,7 @@ export class Ai12zCta {
313
313
  this.formSubmitted.emit(event.detail.data);
314
314
  }
315
315
  async componentWillLoad() {
316
- checkStatus(this.dataKey, this.dataMode).then(enable => {
317
- this.canRender = enable;
318
- });
316
+ this.canRender = await checkStatus(this.dataKey, this.dataMode);
319
317
  insertStyles(`https://cdn.ai12z.net/assets/bot/v2/tailwind.min.css`, this.el);
320
318
  setParentComponentState("cta", this.dataKey, this.dataMode);
321
319
  await this.configCtaSettings();
@@ -48,10 +48,18 @@ export class Ai12zChatMessage {
48
48
  initializeScriptHelper(event.detail.id, this.mainObject);
49
49
  }
50
50
  componentWillLoad() {
51
+ var _a, _b;
51
52
  this.loadScriptsSequentially();
53
+ // Adopt customCSS in this shadow root using the shared CSSStyleSheet
54
+ // already constructed by the parent knowledge-box (zero extra fetches).
55
+ if ((_a = this.kbSettings) === null || _a === void 0 ? void 0 : _a.customCSS) {
56
+ adoptStyleSheet(this.kbSettings.customCSS, this.el.shadowRoot);
57
+ }
58
+ if ((_b = this.kbSettings) === null || _b === void 0 ? void 0 : _b.customJS) {
59
+ loadScriptOnce(this.kbSettings.customJS, this.el.shadowRoot);
60
+ }
52
61
  }
53
62
  componentDidLoad() {
54
- var _a, _b;
55
63
  // Initialise the ai12z global exactly once; never overwrite an existing value.
56
64
  if (!window["ai12z"]) {
57
65
  window["ai12z"] = {};
@@ -60,14 +68,6 @@ export class Ai12zChatMessage {
60
68
  ai12zHeading.text = `var ai12zChat = window["ai12z"] = {}`;
61
69
  this.el.shadowRoot.appendChild(ai12zHeading);
62
70
  this.checkOverflow();
63
- // Adopt customCSS in this shadow root using the shared CSSStyleSheet
64
- // already constructed by the parent knowledge-box (zero extra fetches).
65
- if ((_a = this.kbSettings) === null || _a === void 0 ? void 0 : _a.customCSS) {
66
- adoptStyleSheet(this.kbSettings.customCSS, this.el.shadowRoot);
67
- }
68
- if ((_b = this.kbSettings) === null || _b === void 0 ? void 0 : _b.customJS) {
69
- loadScriptOnce(this.kbSettings.customJS, this.el.shadowRoot);
70
- }
71
71
  }
72
72
  async loadScriptsSequentially() {
73
73
  try {
@@ -149,9 +149,9 @@ export class Ai12zChatMessage {
149
149
  render() {
150
150
  var _a, _b, _c, _d;
151
151
  const lineClamp = (_b = (_a = this.kbSettings) === null || _a === void 0 ? void 0 : _a.numberOfLines) !== null && _b !== void 0 ? _b : 10;
152
- return (h("div", { key: '2d24739583f2f73daa28590c6c121531cf6ab4ce', class: "chat-message" }, h("div", { key: '9e8ca0a62a0de746f367164ff51ea9b9a22e93a0', ref: (el) => this.messageRef = el, class: { 'message-text': true, "custom-line-clamp": !this.isExpanded && !this.isCollapsing && this.showButton }, style: {
152
+ return (h("div", { key: '54f51ffb7c06bbb20fc1088c0fb63a8669d7ba45', class: "chat-message" }, h("div", { key: '281bc75361bcfadb4611eefeb9697d525b9e2d27', ref: (el) => this.messageRef = el, class: { 'message-text': true, "custom-line-clamp": !this.isExpanded && !this.isCollapsing && this.showButton }, style: {
153
153
  "--line-clamp": `${lineClamp}`,
154
- }, innerHTML: this.text, onClick: this.showButton ? this.toggleExpand : undefined }), !this.isExpanded && this.showButton && this.canExpand && h("div", { key: '12f386a03fc84f97d2e585ea21cf4f8d31964c34', class: "fade-overlay" }), this.showButton && this.canExpand && h("button", { key: '1633be8cd35334eae64f75d7ce5fd87b30054849', class: "show-more-btn", onClick: this.toggleExpand }, this.isExpanded ? (((_c = this.kbSettings) === null || _c === void 0 ? void 0 : _c.showLessButtonLabel) || "Show less") : (((_d = this.kbSettings) === null || _d === void 0 ? void 0 : _d.showMoreButtonLabel) || "Show more"), this.isExpanded ? h("svg", { width: "1em", height: "1em", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round" }, h("polyline", { points: "6 9 12 15 18 9" })) : h("svg", { width: "1em", height: "1em", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round" }, h("polyline", { points: "18 15 12 9 6 15" })))));
154
+ }, innerHTML: this.text, onClick: this.showButton ? this.toggleExpand : undefined }), !this.isExpanded && this.showButton && this.canExpand && h("div", { key: 'd6e262dbca0934b97fafb3dd7723b3b9333d8e10', class: "fade-overlay" }), this.showButton && this.canExpand && h("button", { key: 'e1e711b71656763ecdeb1cb6f73166528f023914', class: "show-more-btn", onClick: this.toggleExpand }, this.isExpanded ? (((_c = this.kbSettings) === null || _c === void 0 ? void 0 : _c.showLessButtonLabel) || "Show less") : (((_d = this.kbSettings) === null || _d === void 0 ? void 0 : _d.showMoreButtonLabel) || "Show more"), this.isExpanded ? h("svg", { width: "1em", height: "1em", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round" }, h("polyline", { points: "6 9 12 15 18 9" })) : h("svg", { width: "1em", height: "1em", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round" }, h("polyline", { points: "18 15 12 9 6 15" })))));
155
155
  }
156
156
  static get is() { return "ai12z-chat-message"; }
157
157
  static get encapsulation() { return "shadow"; }
@@ -1 +1 @@
1
- import{A as o,d as r}from"./p-BuetJrTJ.js";const s=o,t=r;export{s as Ai12zBot,t as defineCustomElement}
1
+ import{A as o,d as s}from"./p-T7hfVn0q.js";const p=o,r=s;export{p as Ai12zBot,r as defineCustomElement}
@@ -1 +1 @@
1
- import{A as o,d as s}from"./p-BRhucqU_.js";const p=o,r=s;export{p as Ai12zChatMessage,r as defineCustomElement}
1
+ import{A as o,d as s}from"./p-CLtV90Um.js";const t=o,m=s;export{t as Ai12zChatMessage,m as defineCustomElement}
@@ -1 +1 @@
1
- import{A as s,d as o}from"./p-JjsXw6fP.js";const p=s,r=o;export{p as Ai12zCta,r as defineCustomElement}
1
+ import{A as o,d as s}from"./p-c9R9wdZM.js";const p=o,r=s;export{p as Ai12zCta,r as defineCustomElement}
@@ -1 +1 @@
1
- import{A as o,d as r}from"./p-DrX20dxC.js";const s=o,p=r;export{s as Ai12zKnowledgeBox,p as defineCustomElement}
1
+ import{A as o,d as s}from"./p-DU8l3fUF.js";const p=o,r=s;export{p as Ai12zKnowledgeBox,r as defineCustomElement}
@@ -1 +1 @@
1
- import{g as e}from"./p-ZGVz1_9H.js";export{a as getAssetPath,r as render,s as setAssetPath,b as setNonce,c as setPlatformOptions}from"./p-ZGVz1_9H.js";export{A as Ai12zBot}from"./p-BuetJrTJ.js";export{A as Ai12zCta}from"./p-JjsXw6fP.js";export{A as Ai12zKnowledgeBox}from"./p-DrX20dxC.js";export{S as Ai12zSearchPanel}from"./p-BmUFHK-0.js";export{S as Ai12zSearchResultsPage}from"./p-C81g_cTG.js";export{A as Ai12zInlineSearch}from"./p-BNi-pmSE.js";export{A as Ai12zForm}from"./p-C9rXDQ8C.js";export{A as Ai12zContainer}from"./p-BvLFdH7U.js";e();
1
+ import{g as e}from"./p-ZGVz1_9H.js";export{a as getAssetPath,r as render,s as setAssetPath,b as setNonce,c as setPlatformOptions}from"./p-ZGVz1_9H.js";export{A as Ai12zBot}from"./p-T7hfVn0q.js";export{A as Ai12zCta}from"./p-c9R9wdZM.js";export{A as Ai12zKnowledgeBox}from"./p-DU8l3fUF.js";export{S as Ai12zSearchPanel}from"./p-BmUFHK-0.js";export{S as Ai12zSearchResultsPage}from"./p-C81g_cTG.js";export{A as Ai12zInlineSearch}from"./p-BNi-pmSE.js";export{A as Ai12zForm}from"./p-C9rXDQ8C.js";export{A as Ai12zContainer}from"./p-BvLFdH7U.js";e();