@coveops/abi 1.0.1 → 1.0.2

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.
@@ -1 +1 @@
1
- import{p as e,b as t}from"./p-d6d34d34.js";(()=>{const t=import.meta.url,a={};return""!==t&&(a.resourcesUrl=new URL(".",t).href),e(a)})().then((e=>t([["p-03b6e905",[[1,"faq-popup-component",{result:[32]}]]],["p-dd8b0f76",[[0,"results-manager"]]],["p-1fd19815",[[1,"sample-component",{pagerState:[32],statusState:[32]}]]],["p-50003f11",[[1,"standalone-searchbox-listener",null,[[8,"header/searchbox/query","handleStandaloneSearchbox"]]]]],["p-3303b27f",[[1,"strip-html-component",{result:[32]}]]]],e)));
1
+ import{p as e,b as t}from"./p-d6d34d34.js";(()=>{const t=import.meta.url,a={};return""!==t&&(a.resourcesUrl=new URL(".",t).href),e(a)})().then((e=>t([["p-cd8cdf0e",[[1,"faq-popup-component",{result:[32]}]]],["p-dd8b0f76",[[0,"results-manager"]]],["p-1fd19815",[[1,"sample-component",{pagerState:[32],statusState:[32]}]]],["p-50003f11",[[1,"standalone-searchbox-listener",null,[[8,"header/searchbox/query","handleStandaloneSearchbox"]]]]],["p-3303b27f",[[1,"strip-html-component",{result:[32]}]]]],e)));
@@ -1 +1 @@
1
- import{w as e}from"./p-38555fec.js";!async function(){await e();const r=document.querySelector("#search"),a=document.querySelector("#searchbox"),o="https://platform.cloud.coveo.com",c="anheuserbuschinbevprod",n="x0ae66480-c272-44bf-bb26-0e89dc2c0239";await r.initialize({accessToken:n,organizationId:c,platformUrl:o,preprocessRequest:(e,r,a)=>{if("searchApiFetch"==r&&"search"==(null==a?void 0:a.method)){e.url+="&viewAllContent=1";var o=JSON.parse(e.body);o.context={user_country_snow:"CZ"},e.body=JSON.stringify(o)}return e}}),r.executeFirstSearch(),await a.initialize({accessToken:n,organizationId:c,platformUrl:o,preprocessRequest:(e,r,a)=>{if("searchApiFetch"==r&&"search"==(null==a?void 0:a.method)){e.url+="&viewAllContent=1";var o=JSON.parse(e.body);o.context={user_country_snow:"CZ"};var c=new CustomEvent("header/searchbox/query",{detail:o.q||""});window.dispatchEvent(c),e.body=JSON.stringify(o)}return e},analytics:{enabled:!1}})}();
1
+ import{w as e}from"./p-38555fec.js";!async function(){await e();const a=document.querySelector("#search"),r=document.querySelector("#searchbox"),o="https://platform.cloud.coveo.com",c="anheuserbuschinbevprod",n="xf75e8727-ecce-4f14-afea-19a62c17334c";await a.initialize({accessToken:n,organizationId:c,platformUrl:o,preprocessRequest:(e,a,r)=>{if("searchApiFetch"==a&&"search"==(null==r?void 0:r.method)){e.url+="&viewAllContent=1";var o=JSON.parse(e.body);o.context={user_country_snow:"CZ"},e.body=JSON.stringify(o)}return e}}),a.executeFirstSearch(),await r.initialize({accessToken:n,organizationId:c,platformUrl:o,preprocessRequest:(e,a,r)=>{if("searchApiFetch"==a&&"search"==(null==r?void 0:r.method)){e.url+="&viewAllContent=1";var o=JSON.parse(e.body);o.context={user_country_snow:"CZ"};var c=new CustomEvent("header/searchbox/query",{detail:o.q||""});window.dispatchEvent(c),e.body=JSON.stringify(o)}return e},analytics:{enabled:!1}})}();
@@ -0,0 +1 @@
1
+ import{r as t,h as i,g as o,H as s}from"./p-d6d34d34.js";import{i as e,F as n}from"./p-ddacae1a.js";import{r as d}from"./p-b83bab81.js";import"./p-d20ee37c.js";const h=class{constructor(i){t(this,i),this.closeFAQModal=()=>{this.modalElement.setAttribute("is-open","false"),this.modalElement.querySelector("#btn-done").removeEventListener("click",this.closeFAQModal)}}async connectedCallback(){var t;try{this.bindings=await e(this.host),this.result=await d(this.host),this.modalElement=null===(t=this.bindings)||void 0===t?void 0:t.interfaceElement.querySelector("#faq-modal"),this.result&&localStorage.getItem(`visited-${this.result.title}`)&&this.host.classList.add("visited-title")}catch(t){console.error(t),this.host.remove()}}openFAQModal(t){var i,o,s,e,d,h,a;if(this.bindings){const{logClickEvent:i}=n(this.bindings.engine);this.bindings.engine.dispatch(i({evt:"documentQuickview",result:t}))}this.modalElement.source=this.host;const l=this.modalElement.querySelector("[slot=body]");l.innerHTML="";const r=document.createElement("table"),c=document.createElement("tr");c.className="question-row",c.innerHTML="<td>Question: </td> <td>"+((null===(i=this.result)||void 0===i?void 0:i.title)||"")+'</td><div id="faq-modal-close-button"><svg width="48" height="49" viewBox="0 0 48 49" fill="black" xmlns="http://www.w3.org/2000/svg"><rect y="0.5" width="48" height="48" rx="24" fill="white"/><path fill-rule="evenodd" clip-rule="evenodd" d="M22.5382 24.5L15 16.9618L16.4618 15.5L24 23.0382L31.5382 15.5L33 16.9618L25.4618 24.5L33 32.0382L31.5382 33.5L24 25.9618L16.4618 33.5L15 32.0382L22.5382 24.5Z" fill="#17171A"/></svg></div>',r.appendChild(c);const v=document.createElement("tr"),u=document.createElement("td");u.innerText="Answer:",v.appendChild(u);const m=document.createElement("td");if(null===(s=null===(o=this.result)||void 0===o?void 0:o.raw)||void 0===s?void 0:s.answer){let t=null===(d=null===(e=this.result)||void 0===e?void 0:e.raw)||void 0===d?void 0:d.answer;try{var p=(new DOMParser).parseFromString(t,"text/html"),w="";Array.from(p.children).forEach((t=>{var i;t.querySelectorAll("a").forEach((t=>{t.href.startsWith(window.location.origin)&&t.href.indexOf("/sites/")>-1&&(t.href=t.href.replace(window.location.origin,"https://anheuserbuschinbev.sharepoint.com")),t.href.startsWith(window.location.origin)&&t.href.match(/:.:\/./)&&(t.href=t.href.replace(window.location.origin,"https://anheuserbuschinbev.sharepoint.com"))})),t.querySelectorAll("img").forEach((t=>{t.src.startsWith(window.location.origin)&&t.src.indexOf("/sites/")>-1&&(t.src=t.src.replace(window.location.origin,"https://anheuserbuschinbev.sharepoint.com")),t.src.startsWith(window.location.origin)&&t.src.match(/:.:\/./)&&(t.src=t.src.replace(window.location.origin,"https://anheuserbuschinbev.sharepoint.com"))})),w+=null===(i=t.querySelector("body"))||void 0===i?void 0:i.innerHTML})),m.innerHTML=w}catch(i){console.log(i),m.innerHTML=t}}if(v.appendChild(m),r.appendChild(v),null===(h=this.result)||void 0===h?void 0:h.raw.category){const t=document.createElement("tr");t.innerHTML="<td> Category: </td><td>"+this.result.raw.category+"</td>",r.appendChild(t)}if(null===(a=this.result)||void 0===a?void 0:a.raw.newmoreinfo){const t=document.createElement("tr"),i=this.result.raw.newmoreinfo;t.innerHTML='<td> Link: </td><td> <a href="'+i+'" target="_blank">'+i+"</a> </td>",r.appendChild(t)}l.appendChild(r),this.modalElement.querySelector("#faq-modal-close-button").addEventListener("click",this.closeFAQModal),this.modalElement.setAttribute("is-open","true"),this.result&&localStorage.setItem(`visited-${this.result.title}`,"true"),this.host.classList.add("visited-title")}render(){if(this.result)return i(s,{className:"clickable-host",onClick:()=>this.openFAQModal(this.result)},this.result.title)}get host(){return o(this)}};h.style="b{color:var(--atomic-primary)}:host{color:#CAA144 !important;font-size:1.7rem !important;max-height:unset !important;line-height:normal !important}";export{h as faq_popup_component}