@coveops/abi 1.0.2 → 1.0.4

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 (32) hide show
  1. package/dist/abi/abi.css +1 -1
  2. package/dist/abi/abi.esm.js +1 -1
  3. package/dist/abi/index.esm.js +1 -1
  4. package/dist/abi/{p-1fd19815.entry.js → p-53221f92.entry.js} +1 -1
  5. package/dist/abi/p-7f068cc3.entry.js +1 -0
  6. package/dist/abi/p-8c974da8.entry.js +1 -0
  7. package/dist/abi/{p-ddacae1a.js → p-b984457f.js} +2 -2
  8. package/dist/bundle/index.css +1 -1
  9. package/dist/bundle/index.html +3 -1
  10. package/dist/bundle/index.js +17 -17
  11. package/dist/cjs/faq-popup-component.cjs.entry.js +2 -4
  12. package/dist/cjs/{index-8f6652e1.js → index-20ac4bdb.js} +2 -1
  13. package/dist/cjs/index.cjs.js +4 -1
  14. package/dist/cjs/sample-component.cjs.entry.js +1 -1
  15. package/dist/cjs/standalone-searchbox-listener.cjs.entry.js +7 -6
  16. package/dist/collection/components/faq-popup-component/faq-popup-component.js +1 -3
  17. package/dist/collection/components/standalone-searchbox-listener/standalone-searchbox-listener.js +7 -6
  18. package/dist/collection/index.js +3 -0
  19. package/dist/components/index.js +12 -10
  20. package/dist/esm/faq-popup-component.entry.js +2 -4
  21. package/dist/esm/{index-886ab6f0.js → index-4e0bf5cd.js} +2 -2
  22. package/dist/esm/index.js +4 -1
  23. package/dist/esm/sample-component.entry.js +1 -1
  24. package/dist/esm/standalone-searchbox-listener.entry.js +7 -6
  25. package/package.json +1 -1
  26. package/src/components/faq-popup-component/faq-popup-component.tsx +1 -3
  27. package/src/components/standalone-searchbox-listener/standalone-searchbox-listener.tsx +5 -2
  28. package/src/index.ts +7 -0
  29. package/src/pages/index.html +3 -1
  30. package/src/style/index.css +23 -1
  31. package/dist/abi/p-50003f11.entry.js +0 -1
  32. package/dist/abi/p-cd8cdf0e.entry.js +0 -1
package/dist/esm/index.js CHANGED
@@ -6,7 +6,7 @@ async function main() {
6
6
  const searchBox = document.querySelector("#searchbox");
7
7
  const platformUrl = "https://platform.cloud.coveo.com";
8
8
  const organizationId = "anheuserbuschinbevprod";
9
- const accessToken = "xf75e8727-ecce-4f14-afea-19a62c17334c";
9
+ const accessToken = "x7e95c452-b717-4459-a9a1-a808b74c2242";
10
10
  await searchInterface.initialize({
11
11
  accessToken,
12
12
  organizationId,
@@ -24,6 +24,9 @@ async function main() {
24
24
  }
25
25
  });
26
26
  searchInterface.executeFirstSearch();
27
+ searchInterface.i18n.addResourceBundle('en', 'translation', {
28
+ 'no-results-for': 'No results for {{query}}'
29
+ });
27
30
  await searchBox.initialize({
28
31
  accessToken,
29
32
  organizationId,
@@ -1,5 +1,5 @@
1
1
  import { r as registerInstance, h, g as getElement, f as forceUpdate } from './index-3c594d24.js';
2
- import { i as initializeBindings, n as nw, D as DI } from './index-886ab6f0.js';
2
+ import { i as initializeBindings, n as nw, D as DI } from './index-4e0bf5cd.js';
3
3
  import { w as waitForAtomic } from './atomic-0e957d02.js';
4
4
  import './headless.esm-085e70ed-c4dfb380.js';
5
5
 
@@ -1,5 +1,5 @@
1
1
  import { r as registerInstance, h, g as getElement, H as Host } from './index-3c594d24.js';
2
- import { i as initializeBindings, f as fce, m as mde, $ as $ce } from './index-886ab6f0.js';
2
+ import { i as initializeBindings, f as fce, a as nce, m as mde, $ as $ce } from './index-4e0bf5cd.js';
3
3
  import { w as waitForAtomic } from './atomic-0e957d02.js';
4
4
  import './headless.esm-085e70ed-c4dfb380.js';
5
5
 
@@ -19,15 +19,16 @@ const StandaloneSearchboxListener = class {
19
19
  }
20
20
  }
21
21
  async handleStandaloneSearchbox(ev) {
22
- var _a, _b, _c, _d, _e, _f, _g;
23
- debugger;
22
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
24
23
  let queryActionCreator = fce((_a = this.bindings) === null || _a === void 0 ? void 0 : _a.engine);
25
24
  (_c = (_b = this.bindings) === null || _b === void 0 ? void 0 : _b.engine) === null || _c === void 0 ? void 0 : _c.dispatch(queryActionCreator.updateQuery({
26
25
  q: ev.detail
27
26
  }));
28
- let analyticsActionCreator = mde((_d = this.bindings) === null || _d === void 0 ? void 0 : _d.engine);
29
- let searchActionCreator = $ce((_e = this.bindings) === null || _e === void 0 ? void 0 : _e.engine);
30
- (_g = (_f = this.bindings) === null || _f === void 0 ? void 0 : _f.engine) === null || _g === void 0 ? void 0 : _g.dispatch(searchActionCreator.executeSearch(analyticsActionCreator.logSearchboxSubmit()));
27
+ let paginationActionCreator = nce((_d = this.bindings) === null || _d === void 0 ? void 0 : _d.engine);
28
+ (_f = (_e = this.bindings) === null || _e === void 0 ? void 0 : _e.engine) === null || _f === void 0 ? void 0 : _f.dispatch(paginationActionCreator.updatePage(1));
29
+ let analyticsActionCreator = mde((_g = this.bindings) === null || _g === void 0 ? void 0 : _g.engine);
30
+ let searchActionCreator = $ce((_h = this.bindings) === null || _h === void 0 ? void 0 : _h.engine);
31
+ (_k = (_j = this.bindings) === null || _j === void 0 ? void 0 : _j.engine) === null || _k === void 0 ? void 0 : _k.dispatch(searchActionCreator.executeSearch(analyticsActionCreator.logSearchboxSubmit()));
31
32
  }
32
33
  render() {
33
34
  return (h(Host, null));
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@coveops/abi",
3
3
  "description": "Abi project",
4
- "version": "1.0.2",
4
+ "version": "1.0.4",
5
5
  "private": false,
6
6
  "main": "dist/index.cjs.js",
7
7
  "module": "dist/index.js",
@@ -62,7 +62,7 @@ export class FaqPopupComponent {
62
62
 
63
63
  const questionElement = document.createElement("tr");
64
64
  questionElement.className = "question-row";
65
- questionElement.innerHTML = '<td>Question: </td> <td>' + (this.result?.title || '') + '</td>'
65
+ questionElement.innerHTML = '<td>Question: <a href="https://anheuserbuschinbev.sharepoint.com" autofocus="true" style="display:none;"></a></td> <td>' + (this.result?.title || '') + '</td>'
66
66
  +'<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>';
67
67
 
68
68
  tableEl.appendChild(questionElement);
@@ -76,14 +76,12 @@ export class FaqPopupComponent {
76
76
 
77
77
  // Create a new element to contain the answer content
78
78
  const answerContentElement = document.createElement('td');
79
- debugger;
80
79
  if(this.result?.raw?.answer) {
81
80
  let value = this.result?.raw?.answer as string;
82
81
  try {
83
82
  var els = new DOMParser().parseFromString(value,'text/html');
84
83
  var html = '';
85
84
  Array.from(els.children).forEach(el => {
86
- debugger;
87
85
  el.querySelectorAll('a').forEach(a => {
88
86
  if (a.href.startsWith(window.location.origin) && a.href.indexOf('/sites/') > -1) {
89
87
  a.href = a.href.replace(window.location.origin, 'https://anheuserbuschinbev.sharepoint.com');
@@ -1,7 +1,7 @@
1
1
  import { Bindings, initializeBindings } from "@coveo/atomic";
2
2
  import { Component, Element, h, Host, Listen } from "@stencil/core";
3
3
  import { waitForAtomic } from "../../utils/atomic";
4
- import { loadQueryActions, loadSearchActions, loadSearchAnalyticsActions } from "@coveo/headless";
4
+ import { loadPaginationActions, loadQueryActions, loadSearchActions, loadSearchAnalyticsActions } from "@coveo/headless";
5
5
 
6
6
  @Component({
7
7
  tag: "standalone-searchbox-listener",
@@ -27,13 +27,16 @@ export class StandaloneSearchboxListener {
27
27
 
28
28
  @Listen('header/searchbox/query', { target: 'window' })
29
29
  async handleStandaloneSearchbox(ev: CustomEvent) {
30
- debugger;
31
30
  let queryActionCreator = loadQueryActions(this.bindings?.engine!);
32
31
  this.bindings?.engine?.dispatch(
33
32
  queryActionCreator.updateQuery({
34
33
  q: ev.detail
35
34
  })
36
35
  );
36
+ let paginationActionCreator = loadPaginationActions(this.bindings?.engine!);
37
+ this.bindings?.engine?.dispatch(
38
+ paginationActionCreator.updatePage(1)
39
+ );
37
40
  let analyticsActionCreator = loadSearchAnalyticsActions(this.bindings?.engine!);
38
41
  let searchActionCreator = loadSearchActions(this.bindings?.engine!);
39
42
  this.bindings?.engine?.dispatch(
package/src/index.ts CHANGED
@@ -30,6 +30,13 @@ async function main() {
30
30
 
31
31
  searchInterface.executeFirstSearch();
32
32
 
33
+ searchInterface.i18n.addResourceBundle('en', 'translation', {
34
+ 'no-results-for': 'No results for {{query}}'
35
+ });
36
+
37
+
38
+
39
+
33
40
  await searchBox.initialize({
34
41
  accessToken,
35
42
  organizationId,
@@ -41,7 +41,7 @@
41
41
  </atomic-search-interface>
42
42
  </section>
43
43
  <section>
44
- <atomic-search-interface id="search" fields-to-include='[
44
+ <atomic-search-interface search-hub="communityCoveo" id="search" fields-to-include='[
45
45
  "sfcaseid", "sfppcustomlinkcpplinkurlc", "sfcaseppstatus", "sfcaseppstatusc", "sfcasestatus",
46
46
  "sfppcustomlinkcppiconc", "sfcasenumber", "sfcaseppprocessc", "sfppleaveabsencecppactiontypec",
47
47
  "sfppleaveabsencecppactionreasonc", "sfppleaveabsencecppenddatecfq", "sfppleaveabsencecppenddatecfy",
@@ -90,7 +90,9 @@
90
90
  <atomic-layout-section section="results">
91
91
  <results-manager></results-manager>
92
92
  <atomic-query-error></atomic-query-error>
93
+ <div class="align">
93
94
  <atomic-no-results></atomic-no-results>
95
+ </div>
94
96
  </atomic-layout-section>
95
97
  <atomic-layout-section section="pagination">
96
98
  <atomic-pager></atomic-pager>
@@ -115,4 +115,26 @@ atomic-search-box::part(query-suggestion-text) {
115
115
  font-size: 1.3rem !important
116
116
  }
117
117
 
118
-
118
+ atomic-no-results::part(icon){
119
+ display: none;
120
+ }
121
+ atomic-no-results::part(search-tips){
122
+ display: none;
123
+ }
124
+ atomic-no-results::part(no-results){
125
+ font-size: 1.3rem !important;
126
+ padding-bottom: -5px !important;;
127
+ }
128
+ atomic-no-results::part(cancel-button){
129
+ margin-right: auto !important;
130
+ background-color: white !important;
131
+ color: #CAA144 !important;
132
+ padding-top: 0px !important;
133
+ padding-left: 0px !important;
134
+ font-size: 1rem !important;
135
+ margin-top:0px !important;
136
+ }
137
+ .align{
138
+ display: flex !important;
139
+ align-items: start !important;
140
+ }
@@ -1 +0,0 @@
1
- import{r as s,h as o,g as t,H as a}from"./p-d6d34d34.js";import{i,f as l,m as n,$ as d}from"./p-ddacae1a.js";import{w as e}from"./p-38555fec.js";import"./p-d20ee37c.js";const r=class{constructor(o){s(this,o)}async connectedCallback(){try{await e(),this.bindings=await i(this.host)}catch(s){console.error(s)}}async handleStandaloneSearchbox(s){var o,t,a,i,e,r,c;let h=l(null===(o=this.bindings)||void 0===o?void 0:o.engine);null===(a=null===(t=this.bindings)||void 0===t?void 0:t.engine)||void 0===a||a.dispatch(h.updateQuery({q:s.detail}));let v=n(null===(i=this.bindings)||void 0===i?void 0:i.engine),u=d(null===(e=this.bindings)||void 0===e?void 0:e.engine);null===(c=null===(r=this.bindings)||void 0===r?void 0:r.engine)||void 0===c||c.dispatch(u.executeSearch(v.logSearchboxSubmit()))}render(){return o(a,null)}get host(){return t(this)}};r.style="";export{r as standalone_searchbox_listener}
@@ -1 +0,0 @@
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}