ai12z 3.14.2 → 3.15.1-alpha.0

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.
@@ -55,18 +55,10 @@ const Ai12zChatMessage = class {
55
55
  botHelpers.initializeScript(event.detail.id, this.mainObject);
56
56
  }
57
57
  componentWillLoad() {
58
- var _a, _b;
59
58
  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
- }
68
59
  }
69
60
  componentDidLoad() {
61
+ var _a, _b;
70
62
  // Initialise the ai12z global exactly once; never overwrite an existing value.
71
63
  if (!window["ai12z"]) {
72
64
  window["ai12z"] = {};
@@ -75,6 +67,14 @@ const Ai12zChatMessage = class {
75
67
  ai12zHeading.text = `var ai12zChat = window["ai12z"] = {}`;
76
68
  this.el.shadowRoot.appendChild(ai12zHeading);
77
69
  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: '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: {
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: {
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: '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" })))));
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" })))));
162
162
  }
163
163
  get el() { return index.getElement(this); }
164
164
  static get watchers() { return {
@@ -333,6 +333,9 @@ 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
339
  utils.insertStyles(`https://cdn.ai12z.net/assets/bot/v2/tailwind.min.css`, this.el);
337
340
  appStore.setParentComponentState("cta", this.dataKey, this.dataMode);
338
341
  await this.configCtaSettings();
@@ -394,16 +397,16 @@ const Ai12zCta = class {
394
397
  ctaHelpers.setLocalData(`ai12z-cta-data`, { qCounter: this.questionCounter });
395
398
  }, (_a = this.ctaSettings) === null || _a === void 0 ? void 0 : _a.autoResetTimer);
396
399
  }
397
- connectedCallback() {
398
- //this.parseMyObjectProp(this.myObject);
399
- utils.checkStatus(this.dataKey, this.dataMode).then(enable => {
400
- this.canRender = enable;
401
- // if (!enable) {
402
- // console.log("ai12z canRender", this.canRender)
403
- // }
404
- });
405
- // this.configCtaSettings()
406
- }
400
+ // connectedCallback() {
401
+ // //this.parseMyObjectProp(this.myObject);
402
+ // checkStatus(this.dataKey, this.dataMode).then(enable => {
403
+ // this.canRender = enable
404
+ // // if (!enable) {
405
+ // // console.log("ai12z canRender", this.canRender)
406
+ // // }
407
+ // })
408
+ // // this.configCtaSettings()
409
+ // }
407
410
  async configCtaSettings() {
408
411
  const payload = {
409
412
  apiKey: this.dataKey,
@@ -313,6 +313,9 @@ 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
319
  insertStyles(`https://cdn.ai12z.net/assets/bot/v2/tailwind.min.css`, this.el);
317
320
  setParentComponentState("cta", this.dataKey, this.dataMode);
318
321
  await this.configCtaSettings();
@@ -374,16 +377,16 @@ export class Ai12zCta {
374
377
  setLocalData(`ai12z-cta-data`, { qCounter: this.questionCounter });
375
378
  }, (_a = this.ctaSettings) === null || _a === void 0 ? void 0 : _a.autoResetTimer);
376
379
  }
377
- connectedCallback() {
378
- //this.parseMyObjectProp(this.myObject);
379
- checkStatus(this.dataKey, this.dataMode).then(enable => {
380
- this.canRender = enable;
381
- // if (!enable) {
382
- // console.log("ai12z canRender", this.canRender)
383
- // }
384
- });
385
- // this.configCtaSettings()
386
- }
380
+ // connectedCallback() {
381
+ // //this.parseMyObjectProp(this.myObject);
382
+ // checkStatus(this.dataKey, this.dataMode).then(enable => {
383
+ // this.canRender = enable
384
+ // // if (!enable) {
385
+ // // console.log("ai12z canRender", this.canRender)
386
+ // // }
387
+ // })
388
+ // // this.configCtaSettings()
389
+ // }
387
390
  async configCtaSettings() {
388
391
  const payload = {
389
392
  apiKey: this.dataKey,
@@ -48,18 +48,10 @@ export class Ai12zChatMessage {
48
48
  initializeScriptHelper(event.detail.id, this.mainObject);
49
49
  }
50
50
  componentWillLoad() {
51
- var _a, _b;
52
51
  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
- }
61
52
  }
62
53
  componentDidLoad() {
54
+ var _a, _b;
63
55
  // Initialise the ai12z global exactly once; never overwrite an existing value.
64
56
  if (!window["ai12z"]) {
65
57
  window["ai12z"] = {};
@@ -68,6 +60,14 @@ export class Ai12zChatMessage {
68
60
  ai12zHeading.text = `var ai12zChat = window["ai12z"] = {}`;
69
61
  this.el.shadowRoot.appendChild(ai12zHeading);
70
62
  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: '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: {
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: {
153
153
  "--line-clamp": `${lineClamp}`,
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" })))));
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" })))));
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 s}from"./p-m0Ed3g6I.js";const m=o,p=s;export{m as Ai12zChatMessage,p as defineCustomElement}
1
+ import{A as o,d as s}from"./p-C_wQhGjc.js";const p=o,r=s;export{p as Ai12zChatMessage,r as defineCustomElement}
@@ -1 +1 @@
1
- import{A as s,d as o}from"./p-BaXs0IIw.js";const a=s,p=o;export{a as Ai12zCta,p as defineCustomElement}
1
+ import{A as o,d as s}from"./p-GOKCEufe.js";const p=o,r=s;export{p as Ai12zCta,r as defineCustomElement}
@@ -1 +1 @@
1
- import{A as o,d as s}from"./p-mBjDeFh_.js";const m=o,p=s;export{m as Ai12zKnowledgeBox,p as defineCustomElement}
1
+ import{A as o,d as s}from"./p-BP6_06aA.js";const a=o,p=s;export{a as Ai12zKnowledgeBox,p 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-B9IJbo4G.js";export{A as Ai12zCta}from"./p-BaXs0IIw.js";export{A as Ai12zKnowledgeBox}from"./p-mBjDeFh_.js";export{S as Ai12zSearchPanel}from"./p-AQ1MS6Ps.js";export{S as Ai12zSearchResultsPage}from"./p-BwqXbNCx.js";export{A as Ai12zInlineSearch}from"./p-BwpiW24r.js";export{A as Ai12zForm}from"./p-Ci85xHWQ.js";export{A as Ai12zContainer}from"./p-DkRAkHLI.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-B9IJbo4G.js";export{A as Ai12zCta}from"./p-GOKCEufe.js";export{A as Ai12zKnowledgeBox}from"./p-BP6_06aA.js";export{S as Ai12zSearchPanel}from"./p-AQ1MS6Ps.js";export{S as Ai12zSearchResultsPage}from"./p-BwqXbNCx.js";export{A as Ai12zInlineSearch}from"./p-BwpiW24r.js";export{A as Ai12zForm}from"./p-Ci85xHWQ.js";export{A as Ai12zContainer}from"./p-DkRAkHLI.js";e();