@aikaara/chat-sdk 1.1.11 → 1.1.12
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.
- package/dist/{MountTenant-yt49Vwda.cjs → MountTenant-7d7zBiaX.cjs} +2 -2
- package/dist/{MountTenant-CVNm4jMc.mjs → MountTenant-BV9DnGNT.mjs} +21 -6
- package/dist/cdn/aikaara-chat.iife.js +2 -2
- package/dist/headless.cjs +1 -1
- package/dist/headless.mjs +2 -2
- package/dist/index.cjs +1 -1
- package/dist/index.mjs +2 -2
- package/dist/ui.cjs +1 -1
- package/dist/ui.d.ts +4 -2
- package/dist/ui.mjs +1 -1
- package/package.json +1 -1
|
@@ -742,7 +742,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
742
742
|
<span class="message"></span>
|
|
743
743
|
<button class="dismiss">Dismiss</button>
|
|
744
744
|
</div>
|
|
745
|
-
`,this.container=this.shadow.querySelector(".banner"),this.shadow.querySelector(".dismiss")?.addEventListener("click",()=>this.hide())}show(e,t){const r=this.container.querySelector(".message");r&&(r.textContent=e),this.container.classList.add("visible"),this.dismissTimer&&clearTimeout(this.dismissTimer),t&&(this.dismissTimer=setTimeout(()=>this.hide(),t))}hide(){this.container.classList.remove("visible"),this.dismissTimer&&(clearTimeout(this.dismissTimer),this.dismissTimer=null)}}const Jr=new Map;function Kl(l){const e=Jr.get(l);if(e)return e;const t=new Promise((r,o)=>{const n=document.querySelector(`script[data-aikaara-src="${CSS.escape(l)}"]`);if(n){n.dataset.aikaaraReady==="1"?r():(n.addEventListener("load",()=>r(),{once:!0}),n.addEventListener("error",()=>o(new Error(`Failed to load ${l}`)),{once:!0}));return}const i=document.createElement("script");i.src=l,i.async=!0,i.crossOrigin="anonymous",i.dataset.aikaaraSrc=l,i.addEventListener("load",()=>{i.dataset.aikaaraReady="1",r()},{once:!0}),i.addEventListener("error",()=>{Jr.delete(l),o(new Error(`Failed to load ${l}`))},{once:!0}),document.head.appendChild(i)});return Jr.set(l,t),t}function Ld(l,e=5e3){return new Promise((t,r)=>{const o=setTimeout(()=>r(new Error(`Custom element <${l}> not registered within ${e}ms`)),e);customElements.whenDefined(l).then(()=>{clearTimeout(o),t()})})}function jd(l){const e=`template:${l}`,t=window.__aikaara_descriptor__?.components?.[e];return t&&t.kind==="iife-element"?{render:t.tag,scriptUrl:t.scriptUrl,props:t.props}:window.__aikaara_descriptor__?.templates?.[l]}class Yl extends HTMLElement{shadow;payloadData=null;innerMessage="";renderGen=0;static get observedAttributes(){return["content-type","template-id","message-id"]}constructor(){super(),this.shadow=this.attachShadow({mode:"open"})}connectedCallback(){this.render(),this.addEventListener("template-action",()=>{this.dataset.consumed="true"})}attributeChangedCallback(){this.render()}setPayload(e,t){this.payloadData=e,t!==void 0&&(this.innerMessage=t),this.render()}setConsumedValues(e){this.querySelectorAll("aikaara-option-list").forEach(t=>{const r=t,o=r.getName?.();o&&e[o]
|
|
745
|
+
`,this.container=this.shadow.querySelector(".banner"),this.shadow.querySelector(".dismiss")?.addEventListener("click",()=>this.hide())}show(e,t){const r=this.container.querySelector(".message");r&&(r.textContent=e),this.container.classList.add("visible"),this.dismissTimer&&clearTimeout(this.dismissTimer),t&&(this.dismissTimer=setTimeout(()=>this.hide(),t))}hide(){this.container.classList.remove("visible"),this.dismissTimer&&(clearTimeout(this.dismissTimer),this.dismissTimer=null)}}const Jr=new Map;function Kl(l){const e=Jr.get(l);if(e)return e;const t=new Promise((r,o)=>{const n=document.querySelector(`script[data-aikaara-src="${CSS.escape(l)}"]`);if(n){n.dataset.aikaaraReady==="1"?r():(n.addEventListener("load",()=>r(),{once:!0}),n.addEventListener("error",()=>o(new Error(`Failed to load ${l}`)),{once:!0}));return}const i=document.createElement("script");i.src=l,i.async=!0,i.crossOrigin="anonymous",i.dataset.aikaaraSrc=l,i.addEventListener("load",()=>{i.dataset.aikaaraReady="1",r()},{once:!0}),i.addEventListener("error",()=>{Jr.delete(l),o(new Error(`Failed to load ${l}`))},{once:!0}),document.head.appendChild(i)});return Jr.set(l,t),t}function Ld(l,e=5e3){return new Promise((t,r)=>{const o=setTimeout(()=>r(new Error(`Custom element <${l}> not registered within ${e}ms`)),e);customElements.whenDefined(l).then(()=>{clearTimeout(o),t()})})}function jd(l){const e=`template:${l}`,t=window.__aikaara_descriptor__?.components?.[e];return t&&t.kind==="iife-element"?{render:t.tag,scriptUrl:t.scriptUrl,props:t.props}:window.__aikaara_descriptor__?.templates?.[l]}class Yl extends HTMLElement{shadow;payloadData=null;innerMessage="";renderGen=0;_consumedValues=null;static get observedAttributes(){return["content-type","template-id","message-id"]}constructor(){super(),this.shadow=this.attachShadow({mode:"open"})}connectedCallback(){this.render(),this.addEventListener("template-action",()=>{this.dataset.consumed="true",this._applyConsumedToChildren()})}attributeChangedCallback(){this.render()}setPayload(e,t){this.payloadData=e,t!==void 0&&(this.innerMessage=t),this.render()}setConsumedValues(e){this._consumedValues=e,this._applyConsumedToChildren()}_applyConsumedToChildren(){if(this._consumedValues){const e=this._consumedValues;this.querySelectorAll("aikaara-option-list").forEach(t=>{const r=t,o=r.getName?.();o&&e[o]?.length&&r.setPreSelected?.(e[o])})}this.querySelectorAll("aikaara-submit-action, aikaara-modal-action, aikaara-link-button").forEach(e=>{e.style.display="none"})}render(){const e=this.getAttribute("content-type")??"",t=this.getAttribute("template-id")??"";for(this.renderGen+=1,this.shadow.innerHTML=`
|
|
746
746
|
<style>
|
|
747
747
|
:host { display: block; }
|
|
748
748
|
::slotted(*) { display: block; }
|
|
@@ -756,7 +756,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
756
756
|
}
|
|
757
757
|
</style>
|
|
758
758
|
<slot></slot>
|
|
759
|
-
`;this.firstChild;)this.removeChild(this.firstChild);if(!e)return;const r=t?jd(t):void 0,o=r?.render??(t?`aikaara-template-${t}`:`aikaara-template-${e}`);if(r?.scriptUrl&&!customElements.get(o)&&Kl(r.scriptUrl).then(()=>Ld(o)).then(()=>this.render()).catch(n=>console.warn(`[aikaara-template-renderer] failed to lazy-load ${r.scriptUrl}`,n)),customElements.get(o)){const n=document.createElement(o);if(r?.props){for(const[i,s]of Object.entries(r.props))if(typeof n[i]=="function")try{n[i](s)}catch(a){console.warn(`[aikaara-template-renderer] props.${i} threw on <${o}>`,a)}}n.setPayload?.(this.payloadData,this.innerMessage),this.appendChild(n);return}if(Array.isArray(this.payloadData)){const n=this.payloadData;if(n.length>0&&n.every(s=>s&&typeof s=="object"&&!Array.isArray(s)&&!("type"in s)&&!("data"in s)&&typeof s.message=="string")){const s=document.createElement("aikaara-option-list");s.setPayload({name:"quick-reply",type:"button",options:n.map(a=>{const c=typeof a.title=="string"?a.title:"",u=a.message;return{label:c||u,value:u}})}),this.appendChild(s);return}for(const s of n)this.mountField(s)}else if(this.payloadData&&typeof this.payloadData=="object"){const n=this.payloadData;typeof n.message=="string"&&(n.okLabel||n.action||n.ok)&&this.mountModal(n)}}mountField(e){if(!e||typeof e!="object")return;const t=e.type??e.data?.type;if(t==="link"){this.mountLinkButton(e);return}const r=e.data;if(r){if(t==="checkbox"||t==="radio"||t==="button"){const o=document.createElement("aikaara-option-list");o.setPayload({name:r.name??"",title:r.title,options:r.options??[],type:t}),this.appendChild(o);return}if(t==="submit"){const o=document.createElement("aikaara-submit-action"),n=this.getAttribute("message-id")??void 0;o.setPayload({name:r.name??"Submit",action:r.action??{message:r.name??"Submit"},messageId:n}),this.appendChild(o);return}t==="modal"&&this.mountModal({message:r.message??"",okLabel:r.okLabel,cancelLabel:r.cancelLabel,action:r.action})}}mountLinkButton(e){const t=this.renderGen;Promise.resolve().then(()=>require("./AikaaraLinkButton-VDNx7RfC.cjs")).then(({registerAikaaraLinkButton:r,AikaaraLinkButton:o})=>{if(t!==this.renderGen)return;r();const n=document.createElement("aikaara-link-button");n.setPayload({name:e.name??"Open",url:e.url??"",openLinkInNewTab:e.openLinkInNewTab,orderId:e.orderId,extra:Ud(e),messageId:this.getAttribute("message-id")??void 0}),this.appendChild(n)})}mountModal(e){const t=document.createElement("aikaara-modal-action");t.setPayload(e),this.appendChild(t)}}const Nd=new Set(["type","url","name","openLinkInNewTab","orderId"]);function Ud(l){const e={};for(const[t,r]of Object.entries(l))Nd.has(t)||(e[t]=r);return e}class Ql extends HTMLElement{shadow;static get observedAttributes(){return["text","subtext"]}constructor(){super(),this.shadow=this.attachShadow({mode:"open"})}connectedCallback(){this.render()}attributeChangedCallback(){this.render()}render(){const e=this.getAttribute("text")??this.textContent??"",t=this.getAttribute("subtext")??"";this.shadow.innerHTML=`
|
|
759
|
+
`;this.firstChild;)this.removeChild(this.firstChild);if(!e)return;const r=t?jd(t):void 0,o=r?.render??(t?`aikaara-template-${t}`:`aikaara-template-${e}`);if(r?.scriptUrl&&!customElements.get(o)&&Kl(r.scriptUrl).then(()=>Ld(o)).then(()=>this.render()).catch(n=>console.warn(`[aikaara-template-renderer] failed to lazy-load ${r.scriptUrl}`,n)),customElements.get(o)){const n=document.createElement(o);if(r?.props){for(const[i,s]of Object.entries(r.props))if(typeof n[i]=="function")try{n[i](s)}catch(a){console.warn(`[aikaara-template-renderer] props.${i} threw on <${o}>`,a)}}n.setPayload?.(this.payloadData,this.innerMessage),this.appendChild(n);return}if(Array.isArray(this.payloadData)){const n=this.payloadData;if(n.length>0&&n.every(s=>s&&typeof s=="object"&&!Array.isArray(s)&&!("type"in s)&&!("data"in s)&&typeof s.message=="string")){const s=document.createElement("aikaara-option-list");s.setPayload({name:"quick-reply",type:"button",options:n.map(a=>{const c=typeof a.title=="string"?a.title:"",u=a.message;return{label:c||u,value:u}})}),this.appendChild(s);return}for(const s of n)this.mountField(s)}else if(this.payloadData&&typeof this.payloadData=="object"){const n=this.payloadData;typeof n.message=="string"&&(n.okLabel||n.action||n.ok)&&this.mountModal(n)}this.dataset.consumed==="true"&&this._applyConsumedToChildren()}mountField(e){if(!e||typeof e!="object")return;const t=e.type??e.data?.type;if(t==="link"){this.mountLinkButton(e);return}const r=e.data;if(r){if(t==="checkbox"||t==="radio"||t==="button"){const o=document.createElement("aikaara-option-list");o.setPayload({name:r.name??"",title:r.title,options:r.options??[],type:t}),this.appendChild(o);return}if(t==="submit"){const o=document.createElement("aikaara-submit-action"),n=this.getAttribute("message-id")??void 0;o.setPayload({name:r.name??"Submit",action:r.action??{message:r.name??"Submit"},messageId:n}),this.appendChild(o);return}t==="modal"&&this.mountModal({message:r.message??"",okLabel:r.okLabel,cancelLabel:r.cancelLabel,action:r.action})}}mountLinkButton(e){const t=this.renderGen;Promise.resolve().then(()=>require("./AikaaraLinkButton-VDNx7RfC.cjs")).then(({registerAikaaraLinkButton:r,AikaaraLinkButton:o})=>{if(t!==this.renderGen)return;r();const n=document.createElement("aikaara-link-button");n.setPayload({name:e.name??"Open",url:e.url??"",openLinkInNewTab:e.openLinkInNewTab,orderId:e.orderId,extra:Ud(e),messageId:this.getAttribute("message-id")??void 0}),this.appendChild(n)})}mountModal(e){const t=document.createElement("aikaara-modal-action");t.setPayload(e),this.appendChild(t)}}const Nd=new Set(["type","url","name","openLinkInNewTab","orderId"]);function Ud(l){const e={};for(const[t,r]of Object.entries(l))Nd.has(t)||(e[t]=r);return e}class Ql extends HTMLElement{shadow;static get observedAttributes(){return["text","subtext"]}constructor(){super(),this.shadow=this.attachShadow({mode:"open"})}connectedCallback(){this.render()}attributeChangedCallback(){this.render()}render(){const e=this.getAttribute("text")??this.textContent??"",t=this.getAttribute("subtext")??"";this.shadow.innerHTML=`
|
|
760
760
|
<style>
|
|
761
761
|
:host {
|
|
762
762
|
display: flex;
|
|
@@ -14328,6 +14328,9 @@ class yd extends HTMLElement {
|
|
|
14328
14328
|
// stale buttons stacked next to the freshly-mounted tenant tag — the
|
|
14329
14329
|
// 3-Pay-Now bug on myfinancials.
|
|
14330
14330
|
renderGen = 0;
|
|
14331
|
+
// Submitted field values from history replay. Stored here so render()
|
|
14332
|
+
// can re-apply them when connectedCallback fires and re-creates children.
|
|
14333
|
+
_consumedValues = null;
|
|
14331
14334
|
static get observedAttributes() {
|
|
14332
14335
|
return ["content-type", "template-id", "message-id"];
|
|
14333
14336
|
}
|
|
@@ -14336,7 +14339,7 @@ class yd extends HTMLElement {
|
|
|
14336
14339
|
}
|
|
14337
14340
|
connectedCallback() {
|
|
14338
14341
|
this.render(), this.addEventListener("template-action", () => {
|
|
14339
|
-
this.dataset.consumed = "true";
|
|
14342
|
+
this.dataset.consumed = "true", this._applyConsumedToChildren();
|
|
14340
14343
|
});
|
|
14341
14344
|
}
|
|
14342
14345
|
attributeChangedCallback() {
|
|
@@ -14347,13 +14350,24 @@ class yd extends HTMLElement {
|
|
|
14347
14350
|
}
|
|
14348
14351
|
/**
|
|
14349
14352
|
* Forward previously-submitted form values to child option lists so they
|
|
14350
|
-
* render pre-selected and locked.
|
|
14351
|
-
*
|
|
14353
|
+
* render pre-selected and locked. Values are stored so render() can
|
|
14354
|
+
* re-apply them if connectedCallback fires and re-creates the children.
|
|
14352
14355
|
*/
|
|
14353
14356
|
setConsumedValues(e) {
|
|
14354
|
-
this.
|
|
14355
|
-
|
|
14356
|
-
|
|
14357
|
+
this._consumedValues = e, this._applyConsumedToChildren();
|
|
14358
|
+
}
|
|
14359
|
+
_applyConsumedToChildren() {
|
|
14360
|
+
if (this._consumedValues) {
|
|
14361
|
+
const e = this._consumedValues;
|
|
14362
|
+
this.querySelectorAll("aikaara-option-list").forEach((t) => {
|
|
14363
|
+
const r = t, o = r.getName?.();
|
|
14364
|
+
o && e[o]?.length && r.setPreSelected?.(e[o]);
|
|
14365
|
+
});
|
|
14366
|
+
}
|
|
14367
|
+
this.querySelectorAll(
|
|
14368
|
+
"aikaara-submit-action, aikaara-modal-action, aikaara-link-button"
|
|
14369
|
+
).forEach((e) => {
|
|
14370
|
+
e.style.display = "none";
|
|
14357
14371
|
});
|
|
14358
14372
|
}
|
|
14359
14373
|
render() {
|
|
@@ -14411,6 +14425,7 @@ class yd extends HTMLElement {
|
|
|
14411
14425
|
const n = this.payloadData;
|
|
14412
14426
|
typeof n.message == "string" && (n.okLabel || n.action || n.ok) && this.mountModal(n);
|
|
14413
14427
|
}
|
|
14428
|
+
this.dataset.consumed === "true" && this._applyConsumedToChildren();
|
|
14414
14429
|
}
|
|
14415
14430
|
mountField(e) {
|
|
14416
14431
|
if (!e || typeof e != "object") return;
|
|
@@ -742,7 +742,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
742
742
|
<span class="message"></span>
|
|
743
743
|
<button class="dismiss">Dismiss</button>
|
|
744
744
|
</div>
|
|
745
|
-
`,this.container=this.shadow.querySelector(".banner"),this.shadow.querySelector(".dismiss")?.addEventListener("click",()=>this.hide())}show(e,t){const r=this.container.querySelector(".message");r&&(r.textContent=e),this.container.classList.add("visible"),this.dismissTimer&&clearTimeout(this.dismissTimer),t&&(this.dismissTimer=setTimeout(()=>this.hide(),t))}hide(){this.container.classList.remove("visible"),this.dismissTimer&&(clearTimeout(this.dismissTimer),this.dismissTimer=null)}}const mo=new Map;function jl(l){const e=mo.get(l);if(e)return e;const t=new Promise((r,o)=>{const n=document.querySelector(`script[data-aikaara-src="${CSS.escape(l)}"]`);if(n){n.dataset.aikaaraReady==="1"?r():(n.addEventListener("load",()=>r(),{once:!0}),n.addEventListener("error",()=>o(new Error(`Failed to load ${l}`)),{once:!0}));return}const i=document.createElement("script");i.src=l,i.async=!0,i.crossOrigin="anonymous",i.dataset.aikaaraSrc=l,i.addEventListener("load",()=>{i.dataset.aikaaraReady="1",r()},{once:!0}),i.addEventListener("error",()=>{mo.delete(l),o(new Error(`Failed to load ${l}`))},{once:!0}),document.head.appendChild(i)});return mo.set(l,t),t}function md(l,e=5e3){return new Promise((t,r)=>{const o=setTimeout(()=>r(new Error(`Custom element <${l}> not registered within ${e}ms`)),e);customElements.whenDefined(l).then(()=>{clearTimeout(o),t()})})}function gd(l){const e=`template:${l}`,t=window.__aikaara_descriptor__?.components?.[e];return t&&t.kind==="iife-element"?{render:t.tag,scriptUrl:t.scriptUrl,props:t.props}:window.__aikaara_descriptor__?.templates?.[l]}class bd extends HTMLElement{shadow;payloadData=null;innerMessage="";renderGen=0;static get observedAttributes(){return["content-type","template-id","message-id"]}constructor(){super(),this.shadow=this.attachShadow({mode:"open"})}connectedCallback(){this.render(),this.addEventListener("template-action",()=>{this.dataset.consumed="true"})}attributeChangedCallback(){this.render()}setPayload(e,t){this.payloadData=e,t!==void 0&&(this.innerMessage=t),this.render()}setConsumedValues(e){this.querySelectorAll("aikaara-option-list").forEach(t=>{const r=t,o=r.getName?.();o&&e[o]
|
|
745
|
+
`,this.container=this.shadow.querySelector(".banner"),this.shadow.querySelector(".dismiss")?.addEventListener("click",()=>this.hide())}show(e,t){const r=this.container.querySelector(".message");r&&(r.textContent=e),this.container.classList.add("visible"),this.dismissTimer&&clearTimeout(this.dismissTimer),t&&(this.dismissTimer=setTimeout(()=>this.hide(),t))}hide(){this.container.classList.remove("visible"),this.dismissTimer&&(clearTimeout(this.dismissTimer),this.dismissTimer=null)}}const mo=new Map;function jl(l){const e=mo.get(l);if(e)return e;const t=new Promise((r,o)=>{const n=document.querySelector(`script[data-aikaara-src="${CSS.escape(l)}"]`);if(n){n.dataset.aikaaraReady==="1"?r():(n.addEventListener("load",()=>r(),{once:!0}),n.addEventListener("error",()=>o(new Error(`Failed to load ${l}`)),{once:!0}));return}const i=document.createElement("script");i.src=l,i.async=!0,i.crossOrigin="anonymous",i.dataset.aikaaraSrc=l,i.addEventListener("load",()=>{i.dataset.aikaaraReady="1",r()},{once:!0}),i.addEventListener("error",()=>{mo.delete(l),o(new Error(`Failed to load ${l}`))},{once:!0}),document.head.appendChild(i)});return mo.set(l,t),t}function md(l,e=5e3){return new Promise((t,r)=>{const o=setTimeout(()=>r(new Error(`Custom element <${l}> not registered within ${e}ms`)),e);customElements.whenDefined(l).then(()=>{clearTimeout(o),t()})})}function gd(l){const e=`template:${l}`,t=window.__aikaara_descriptor__?.components?.[e];return t&&t.kind==="iife-element"?{render:t.tag,scriptUrl:t.scriptUrl,props:t.props}:window.__aikaara_descriptor__?.templates?.[l]}class bd extends HTMLElement{shadow;payloadData=null;innerMessage="";renderGen=0;_consumedValues=null;static get observedAttributes(){return["content-type","template-id","message-id"]}constructor(){super(),this.shadow=this.attachShadow({mode:"open"})}connectedCallback(){this.render(),this.addEventListener("template-action",()=>{this.dataset.consumed="true",this._applyConsumedToChildren()})}attributeChangedCallback(){this.render()}setPayload(e,t){this.payloadData=e,t!==void 0&&(this.innerMessage=t),this.render()}setConsumedValues(e){this._consumedValues=e,this._applyConsumedToChildren()}_applyConsumedToChildren(){if(this._consumedValues){const e=this._consumedValues;this.querySelectorAll("aikaara-option-list").forEach(t=>{const r=t,o=r.getName?.();o&&e[o]?.length&&r.setPreSelected?.(e[o])})}this.querySelectorAll("aikaara-submit-action, aikaara-modal-action, aikaara-link-button").forEach(e=>{e.style.display="none"})}render(){const e=this.getAttribute("content-type")??"",t=this.getAttribute("template-id")??"";for(this.renderGen+=1,this.shadow.innerHTML=`
|
|
746
746
|
<style>
|
|
747
747
|
:host { display: block; }
|
|
748
748
|
::slotted(*) { display: block; }
|
|
@@ -756,7 +756,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
756
756
|
}
|
|
757
757
|
</style>
|
|
758
758
|
<slot></slot>
|
|
759
|
-
`;this.firstChild;)this.removeChild(this.firstChild);if(!e)return;const r=t?gd(t):void 0,o=r?.render??(t?`aikaara-template-${t}`:`aikaara-template-${e}`);if(r?.scriptUrl&&!customElements.get(o)&&jl(r.scriptUrl).then(()=>md(o)).then(()=>this.render()).catch(n=>console.warn(`[aikaara-template-renderer] failed to lazy-load ${r.scriptUrl}`,n)),customElements.get(o)){const n=document.createElement(o);if(r?.props){for(const[i,s]of Object.entries(r.props))if(typeof n[i]=="function")try{n[i](s)}catch(a){console.warn(`[aikaara-template-renderer] props.${i} threw on <${o}>`,a)}}n.setPayload?.(this.payloadData,this.innerMessage),this.appendChild(n);return}if(Array.isArray(this.payloadData)){const n=this.payloadData;if(n.length>0&&n.every(s=>s&&typeof s=="object"&&!Array.isArray(s)&&!("type"in s)&&!("data"in s)&&typeof s.message=="string")){const s=document.createElement("aikaara-option-list");s.setPayload({name:"quick-reply",type:"button",options:n.map(a=>{const c=typeof a.title=="string"?a.title:"",u=a.message;return{label:c||u,value:u}})}),this.appendChild(s);return}for(const s of n)this.mountField(s)}else if(this.payloadData&&typeof this.payloadData=="object"){const n=this.payloadData;typeof n.message=="string"&&(n.okLabel||n.action||n.ok)&&this.mountModal(n)}}mountField(e){if(!e||typeof e!="object")return;const t=e.type??e.data?.type;if(t==="link"){this.mountLinkButton(e);return}const r=e.data;if(r){if(t==="checkbox"||t==="radio"||t==="button"){const o=document.createElement("aikaara-option-list");o.setPayload({name:r.name??"",title:r.title,options:r.options??[],type:t}),this.appendChild(o);return}if(t==="submit"){const o=document.createElement("aikaara-submit-action"),n=this.getAttribute("message-id")??void 0;o.setPayload({name:r.name??"Submit",action:r.action??{message:r.name??"Submit"},messageId:n}),this.appendChild(o);return}t==="modal"&&this.mountModal({message:r.message??"",okLabel:r.okLabel,cancelLabel:r.cancelLabel,action:r.action})}}mountLinkButton(e){const t=this.renderGen;Promise.resolve().then(()=>af).then(({registerAikaaraLinkButton:r,AikaaraLinkButton:o})=>{if(t!==this.renderGen)return;r();const n=document.createElement("aikaara-link-button");n.setPayload({name:e.name??"Open",url:e.url??"",openLinkInNewTab:e.openLinkInNewTab,orderId:e.orderId,extra:vd(e),messageId:this.getAttribute("message-id")??void 0}),this.appendChild(n)})}mountModal(e){const t=document.createElement("aikaara-modal-action");t.setPayload(e),this.appendChild(t)}}const yd=new Set(["type","url","name","openLinkInNewTab","orderId"]);function vd(l){const e={};for(const[t,r]of Object.entries(l))yd.has(t)||(e[t]=r);return e}class wd extends HTMLElement{shadow;static get observedAttributes(){return["text","subtext"]}constructor(){super(),this.shadow=this.attachShadow({mode:"open"})}connectedCallback(){this.render()}attributeChangedCallback(){this.render()}render(){const e=this.getAttribute("text")??this.textContent??"",t=this.getAttribute("subtext")??"";this.shadow.innerHTML=`
|
|
759
|
+
`;this.firstChild;)this.removeChild(this.firstChild);if(!e)return;const r=t?gd(t):void 0,o=r?.render??(t?`aikaara-template-${t}`:`aikaara-template-${e}`);if(r?.scriptUrl&&!customElements.get(o)&&jl(r.scriptUrl).then(()=>md(o)).then(()=>this.render()).catch(n=>console.warn(`[aikaara-template-renderer] failed to lazy-load ${r.scriptUrl}`,n)),customElements.get(o)){const n=document.createElement(o);if(r?.props){for(const[i,s]of Object.entries(r.props))if(typeof n[i]=="function")try{n[i](s)}catch(a){console.warn(`[aikaara-template-renderer] props.${i} threw on <${o}>`,a)}}n.setPayload?.(this.payloadData,this.innerMessage),this.appendChild(n);return}if(Array.isArray(this.payloadData)){const n=this.payloadData;if(n.length>0&&n.every(s=>s&&typeof s=="object"&&!Array.isArray(s)&&!("type"in s)&&!("data"in s)&&typeof s.message=="string")){const s=document.createElement("aikaara-option-list");s.setPayload({name:"quick-reply",type:"button",options:n.map(a=>{const c=typeof a.title=="string"?a.title:"",u=a.message;return{label:c||u,value:u}})}),this.appendChild(s);return}for(const s of n)this.mountField(s)}else if(this.payloadData&&typeof this.payloadData=="object"){const n=this.payloadData;typeof n.message=="string"&&(n.okLabel||n.action||n.ok)&&this.mountModal(n)}this.dataset.consumed==="true"&&this._applyConsumedToChildren()}mountField(e){if(!e||typeof e!="object")return;const t=e.type??e.data?.type;if(t==="link"){this.mountLinkButton(e);return}const r=e.data;if(r){if(t==="checkbox"||t==="radio"||t==="button"){const o=document.createElement("aikaara-option-list");o.setPayload({name:r.name??"",title:r.title,options:r.options??[],type:t}),this.appendChild(o);return}if(t==="submit"){const o=document.createElement("aikaara-submit-action"),n=this.getAttribute("message-id")??void 0;o.setPayload({name:r.name??"Submit",action:r.action??{message:r.name??"Submit"},messageId:n}),this.appendChild(o);return}t==="modal"&&this.mountModal({message:r.message??"",okLabel:r.okLabel,cancelLabel:r.cancelLabel,action:r.action})}}mountLinkButton(e){const t=this.renderGen;Promise.resolve().then(()=>af).then(({registerAikaaraLinkButton:r,AikaaraLinkButton:o})=>{if(t!==this.renderGen)return;r();const n=document.createElement("aikaara-link-button");n.setPayload({name:e.name??"Open",url:e.url??"",openLinkInNewTab:e.openLinkInNewTab,orderId:e.orderId,extra:vd(e),messageId:this.getAttribute("message-id")??void 0}),this.appendChild(n)})}mountModal(e){const t=document.createElement("aikaara-modal-action");t.setPayload(e),this.appendChild(t)}}const yd=new Set(["type","url","name","openLinkInNewTab","orderId"]);function vd(l){const e={};for(const[t,r]of Object.entries(l))yd.has(t)||(e[t]=r);return e}class wd extends HTMLElement{shadow;static get observedAttributes(){return["text","subtext"]}constructor(){super(),this.shadow=this.attachShadow({mode:"open"})}connectedCallback(){this.render()}attributeChangedCallback(){this.render()}render(){const e=this.getAttribute("text")??this.textContent??"",t=this.getAttribute("subtext")??"";this.shadow.innerHTML=`
|
|
760
760
|
<style>
|
|
761
761
|
:host {
|
|
762
762
|
display: flex;
|
package/dist/headless.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./MountTenant-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./MountTenant-7d7zBiaX.cjs");class s extends e.EventEmitter{registration=null;pendingEdits=[];constructor(t){super(),this.setupListeners(t)}registerForm(t){this.registration=t;const i=this.pendingEdits.filter(r=>r.entity_type===t.entityType&&String(r.entity_id)===String(t.entityId));if(i.length>0){for(const r of i)t.onFieldUpdate(r.fields),this.emit("edit:applied",{entityType:r.entity_type,entityId:r.entity_id,fields:r.fields});this.pendingEdits=this.pendingEdits.filter(r=>!(r.entity_type===t.entityType&&String(r.entity_id)===String(t.entityId)))}}unregisterForm(t,i){this.registration?.entityType===t&&String(this.registration?.entityId)===String(i)&&(this.registration=null)}get currentForm(){return this.registration}pushFieldUpdates(t,i,r){this.registration&&this.registration.entityType===t&&String(this.registration.entityId)===String(i)?(this.registration.onFieldUpdate(r),this.emit("edit:applied",{entityType:t,entityId:i,fields:r})):(this.pendingEdits.push({action:"edit_entity",entity_type:t,entity_id:i,fields:r}),this.emit("edit:pending",{entityType:t,entityId:i,fields:r}))}async requestSave(){if(!this.registration)return{success:!1,error:"No form registered"};try{return await this.registration.onSave(),this.emit("save:success",{entityType:this.registration.entityType,entityId:this.registration.entityId}),{success:!0}}catch(t){const i=t instanceof Error?t.message:"Save failed";return this.emit("save:error",{entityType:this.registration.entityType,entityId:this.registration.entityId,error:i}),{success:!1,error:i}}}async requestTest(t){if(!this.registration?.onTest)return{success:!1,error:"Current form does not support testing"};try{return await this.registration.onTest(t),{success:!0}}catch(i){return{success:!1,error:i instanceof Error?i.message:"Test failed"}}}setupListeners(t){t.on("action:edit_entity",i=>{this.pushFieldUpdates(i.entity_type,i.entity_id,i.fields)}),t.on("action:save_entity",i=>{this.requestSave()}),t.on("action:test_tool",i=>{this.emit("test:triggered",{toolId:i.tool_id,parameters:i.parameters}),this.requestTest(i.parameters)})}}exports.ActionCableClient=e.ActionCableClient;exports.AikaaraChatClient=e.AikaaraChatClient;exports.ApiClient=e.ApiClient;exports.ChannelSubscription=e.ChannelSubscription;exports.ConnectionManager=e.ConnectionManager;exports.ConversationManager=e.ConversationManager;exports.EventEmitter=e.EventEmitter;exports.MessageStore=e.MessageStore;exports.SessionAuthAdapter=e.SessionAuthAdapter;exports.SsoExchangeAdapter=e.SsoExchangeAdapter;exports.TiledeskTransport=e.TiledeskTransport;exports.TokenDiscoveryError=e.TokenDiscoveryError;exports.TokenDiscoveryReader=e.TokenDiscoveryReader;exports.clearPersistedConversationId=e.clearPersistedConversationId;exports.collectSsoCredentials=e.collectSsoCredentials;exports.createFetchUploadAdapter=e.createFetchUploadAdapter;exports.createPresigned3StepUploadAdapter=e.createPresigned3StepUploadAdapter;exports.createTiledeskHistoryAdapter=e.createTiledeskHistoryAdapter;exports.discoverToken=e.discoverToken;exports.extractTiledeskFileEnvelope=e.extractTiledeskFileEnvelope;exports.inferTiledeskRole=e.inferTiledeskRole;exports.isTiledeskSelfEcho=e.isTiledeskSelfEcho;exports.mountFromSlug=e.mountFromSlug;exports.mountTenantWidget=e.mount;exports.parseTiledeskTemplate=e.parseTiledeskTemplate;exports.FormBridge=s;
|
package/dist/headless.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { E as s } from "./MountTenant-
|
|
2
|
-
import { A as p, b as l, k as g, C as c, l as h, m as y, M as u, S as m, n as f, T, o as S, p as _, q as v, s as E, t as C, u as F, v as k, w as A, x as I, y as x, z as U, B as q, D as M, F as b } from "./MountTenant-
|
|
1
|
+
import { E as s } from "./MountTenant-BV9DnGNT.mjs";
|
|
2
|
+
import { A as p, b as l, k as g, C as c, l as h, m as y, M as u, S as m, n as f, T, o as S, p as _, q as v, s as E, t as C, u as F, v as k, w as A, x as I, y as x, z as U, B as q, D as M, F as b } from "./MountTenant-BV9DnGNT.mjs";
|
|
3
3
|
class a extends s {
|
|
4
4
|
registration = null;
|
|
5
5
|
pendingEdits = [];
|
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./MountTenant-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./MountTenant-7d7zBiaX.cjs"),s=require("./headless.cjs");function l(a){e.registerComponents();const t=document.createElement("aikaara-chat-widget"),i={baseUrl:"base-url",userToken:"user-token",apiKey:"api-key",title:"title",subtitle:"subtitle",theme:"theme",primaryColor:"primary-color",position:"position",width:"width",height:"height",placeholder:"placeholder",welcomeMessage:"welcome-message",avatarUrl:"avatar-url"};for(const[o,n]of Object.entries(i)){const r=a[o];r!=null&&t.setAttribute(n,String(r))}return t.configure(a),document.body.appendChild(t),t}function d(){const a=document.querySelector("aikaara-chat-widget");a&&a.remove()}exports.ActionCableClient=e.ActionCableClient;exports.AikaaraChatBubble=e.AikaaraChatBubble;exports.AikaaraChatClient=e.AikaaraChatClient;exports.AikaaraChatHeader=e.AikaaraChatHeader;exports.AikaaraChatInput=e.AikaaraChatInput;exports.AikaaraChatWidget=e.AikaaraChatWidget;exports.AikaaraErrorBanner=e.AikaaraErrorBanner;exports.AikaaraMessageBubble=e.AikaaraMessageBubble;exports.AikaaraMessageList=e.AikaaraMessageList;exports.AikaaraStreamingMessage=e.AikaaraStreamingMessage;exports.AikaaraTypingIndicator=e.AikaaraTypingIndicator;exports.ApiClient=e.ApiClient;exports.ChannelSubscription=e.ChannelSubscription;exports.ConnectionManager=e.ConnectionManager;exports.ConversationManager=e.ConversationManager;exports.EventEmitter=e.EventEmitter;exports.MessageStore=e.MessageStore;exports.SessionAuthAdapter=e.SessionAuthAdapter;exports.SsoExchangeAdapter=e.SsoExchangeAdapter;exports.TiledeskTransport=e.TiledeskTransport;exports.TokenDiscoveryError=e.TokenDiscoveryError;exports.TokenDiscoveryReader=e.TokenDiscoveryReader;exports.clearPersistedConversationId=e.clearPersistedConversationId;exports.collectSsoCredentials=e.collectSsoCredentials;exports.createFetchUploadAdapter=e.createFetchUploadAdapter;exports.createPresigned3StepUploadAdapter=e.createPresigned3StepUploadAdapter;exports.createTiledeskHistoryAdapter=e.createTiledeskHistoryAdapter;exports.discoverToken=e.discoverToken;exports.extractTiledeskFileEnvelope=e.extractTiledeskFileEnvelope;exports.inferTiledeskRole=e.inferTiledeskRole;exports.isTiledeskSelfEcho=e.isTiledeskSelfEcho;exports.mountFromSlug=e.mountFromSlug;exports.mountTenantWidget=e.mount;exports.parseTiledeskTemplate=e.parseTiledeskTemplate;exports.registerComponents=e.registerComponents;exports.FormBridge=s.FormBridge;exports.mount=l;exports.unmount=d;
|
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { r as o } from "./MountTenant-
|
|
2
|
-
import { A as u, a as m, b as k, c as g, d as h, e as A, f as C, g as T, h as b, i as v, j as f, k as y, C as S, l as w, m as E, E as M, M as x, S as B, n as F, T as U, o as D, p as I, q as j, s as q, t as H, u as P, v as R, w as W, x as z, y as K, z as L, B as O, D as G, F as J } from "./MountTenant-
|
|
1
|
+
import { r as o } from "./MountTenant-BV9DnGNT.mjs";
|
|
2
|
+
import { A as u, a as m, b as k, c as g, d as h, e as A, f as C, g as T, h as b, i as v, j as f, k as y, C as S, l as w, m as E, E as M, M as x, S as B, n as F, T as U, o as D, p as I, q as j, s as q, t as H, u as P, v as R, w as W, x as z, y as K, z as L, B as O, D as G, F as J } from "./MountTenant-BV9DnGNT.mjs";
|
|
3
3
|
import { FormBridge as Q } from "./headless.mjs";
|
|
4
4
|
function l(e) {
|
|
5
5
|
o();
|
package/dist/ui.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("./MountTenant-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("./MountTenant-7d7zBiaX.cjs");exports.AikaaraChat=a.AikaaraChat;exports.AikaaraChatBubble=a.AikaaraChatBubble;exports.AikaaraChatHeader=a.AikaaraChatHeader;exports.AikaaraChatInput=a.AikaaraChatInput;exports.AikaaraChatWidget=a.AikaaraChatWidget;exports.AikaaraComparePlans=a.AikaaraComparePlans;exports.AikaaraErrorBanner=a.AikaaraErrorBanner;exports.AikaaraLinkModal=a.AikaaraLinkModal;exports.AikaaraMessageBubble=a.AikaaraMessageBubble;exports.AikaaraMessageList=a.AikaaraMessageList;exports.AikaaraModalAction=a.AikaaraModalAction;exports.AikaaraOptionList=a.AikaaraOptionList;exports.AikaaraSchemaForm=a.AikaaraSchemaForm;exports.AikaaraSmartEditModal=a.AikaaraSmartEditModal;exports.AikaaraStreamingMessage=a.AikaaraStreamingMessage;exports.AikaaraSubmitAction=a.AikaaraSubmitAction;exports.AikaaraSystemPill=a.AikaaraSystemPill;exports.AikaaraTemplateRenderer=a.AikaaraTemplateRenderer;exports.AikaaraTypingIndicator=a.AikaaraTypingIndicator;exports.registerComponents=a.registerComponents;
|
package/dist/ui.d.ts
CHANGED
|
@@ -532,6 +532,7 @@ export declare class AikaaraTemplateRenderer extends HTMLElement {
|
|
|
532
532
|
private payloadData;
|
|
533
533
|
private innerMessage;
|
|
534
534
|
private renderGen;
|
|
535
|
+
private _consumedValues;
|
|
535
536
|
static get observedAttributes(): string[];
|
|
536
537
|
constructor();
|
|
537
538
|
connectedCallback(): void;
|
|
@@ -539,10 +540,11 @@ export declare class AikaaraTemplateRenderer extends HTMLElement {
|
|
|
539
540
|
setPayload(payload: unknown, innerMessage?: string): void;
|
|
540
541
|
/**
|
|
541
542
|
* Forward previously-submitted form values to child option lists so they
|
|
542
|
-
* render pre-selected and locked.
|
|
543
|
-
*
|
|
543
|
+
* render pre-selected and locked. Values are stored so render() can
|
|
544
|
+
* re-apply them if connectedCallback fires and re-creates the children.
|
|
544
545
|
*/
|
|
545
546
|
setConsumedValues(values: Record<string, string[]>): void;
|
|
547
|
+
private _applyConsumedToChildren;
|
|
546
548
|
private render;
|
|
547
549
|
private mountField;
|
|
548
550
|
/**
|
package/dist/ui.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { G as i, a as s, c as e, d as t, e as A, H as k, f as n, I as o, g as m, h as d, J as l, K as g, L as h, N as p, i as C, O as M, P as b, Q as c, j as S, r as u } from "./MountTenant-
|
|
1
|
+
import { G as i, a as s, c as e, d as t, e as A, H as k, f as n, I as o, g as m, h as d, J as l, K as g, L as h, N as p, i as C, O as M, P as b, Q as c, j as S, r as u } from "./MountTenant-BV9DnGNT.mjs";
|
|
2
2
|
export {
|
|
3
3
|
i as AikaaraChat,
|
|
4
4
|
s as AikaaraChatBubble,
|