@coveops/abi 0.3.2 → 0.4.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.
Files changed (62) hide show
  1. package/dist/abi/abi.css +1 -12
  2. package/dist/abi/abi.esm.js +1 -129
  3. package/dist/abi/index.esm.js +1 -16
  4. package/dist/abi/p-0ae1e588.js +2 -0
  5. package/dist/abi/p-27bd9f1c.entry.js +1 -0
  6. package/dist/abi/p-38555fec.js +1 -0
  7. package/dist/abi/p-63fd8dcd.js +66 -0
  8. package/dist/abi/p-e04b6a2c.entry.js +1 -0
  9. package/dist/abi/p-fc39046e.entry.js +1 -0
  10. package/dist/bundle/index.css +1 -0
  11. package/dist/bundle/index.html +61 -0
  12. package/dist/bundle/index.js +832 -0
  13. package/dist/cjs/abi.cjs.js +19 -0
  14. package/dist/cjs/atomic-7321a250.js +7 -0
  15. package/dist/cjs/faq-popup-component.cjs.entry.js +113 -0
  16. package/dist/cjs/index-bea59ea1.js +1093 -0
  17. package/dist/cjs/index-daa118f5.js +1816 -0
  18. package/dist/cjs/index.cjs.js +18 -0
  19. package/dist/cjs/loader.cjs.js +21 -0
  20. package/dist/cjs/results-manager.cjs.entry.js +40 -0
  21. package/dist/cjs/sample-component.cjs.entry.js +86 -0
  22. package/dist/collection/collection-manifest.json +19 -0
  23. package/dist/collection/components/faq-popup-component/faq-popup-component.css +15 -0
  24. package/dist/{abi/faq-popup-component.entry.js → collection/components/faq-popup-component/faq-popup-component.js} +19 -14
  25. package/dist/collection/components/results-manager/results-manager.js +45 -0
  26. package/dist/collection/components/sample-component/sample-component.css +10 -0
  27. package/dist/collection/components/sample-component/sample-component.js +102 -0
  28. package/dist/collection/index.js +15 -0
  29. package/dist/collection/utils/atomic.js +3 -0
  30. package/dist/components/index.js +3006 -0
  31. package/dist/esm/abi.js +17 -0
  32. package/dist/esm/faq-popup-component.entry.js +109 -0
  33. package/dist/esm/index-51334f26.js +1065 -0
  34. package/dist/esm/index-77ebb3d5.js +1809 -0
  35. package/dist/esm/index.js +16 -0
  36. package/dist/esm/loader.js +17 -0
  37. package/dist/esm/polyfills/core-js.js +11 -0
  38. package/dist/esm/polyfills/css-shim.js +1 -0
  39. package/dist/esm/polyfills/dom.js +79 -0
  40. package/dist/esm/polyfills/es5-html-element.js +1 -0
  41. package/dist/esm/polyfills/index.js +34 -0
  42. package/dist/esm/polyfills/system.js +6 -0
  43. package/dist/{abi → esm}/results-manager.entry.js +1 -1
  44. package/dist/{abi → esm}/sample-component.entry.js +2 -2
  45. package/dist/index.cjs.js +1 -0
  46. package/dist/index.js +1 -0
  47. package/dist/loader/cdn.js +3 -0
  48. package/dist/loader/index.cjs.js +3 -0
  49. package/dist/loader/index.d.ts +12 -0
  50. package/dist/loader/index.es2017.js +3 -0
  51. package/dist/loader/index.js +4 -0
  52. package/dist/loader/package.json +10 -0
  53. package/package.json +2 -2
  54. package/src/pages/index.html +0 -37
  55. package/src/style/index.css +42 -0
  56. package/dist/abi/app-globals-0f993ce5.js +0 -3
  57. package/dist/abi/css-shim-04165e59.js +0 -4
  58. package/dist/abi/dom-26e7cb2c.js +0 -73
  59. package/dist/abi/index-54dd422f.js +0 -3064
  60. package/dist/abi/index-d57e5124.js +0 -4179
  61. package/dist/abi/shadow-css-1257b266.js +0 -387
  62. /package/dist/{abi → esm}/atomic-0e957d02.js +0 -0
@@ -0,0 +1,17 @@
1
+ import { p as promiseResolve, b as bootstrapLazy } from './index-51334f26.js';
2
+
3
+ /*
4
+ Stencil Client Patch Browser v2.17.3 | MIT Licensed | https://stenciljs.com
5
+ */
6
+ const patchBrowser = () => {
7
+ const importMeta = import.meta.url;
8
+ const opts = {};
9
+ if (importMeta !== '') {
10
+ opts.resourcesUrl = new URL('.', importMeta).href;
11
+ }
12
+ return promiseResolve(opts);
13
+ };
14
+
15
+ patchBrowser().then(options => {
16
+ return bootstrapLazy([["faq-popup-component",[[1,"faq-popup-component",{"result":[32]}]]],["results-manager",[[0,"results-manager"]]],["sample-component",[[1,"sample-component",{"pagerState":[32],"statusState":[32]}]]]], options);
17
+ });
@@ -0,0 +1,109 @@
1
+ import { r as registerInstance, h, g as getElement, H as Host } from './index-51334f26.js';
2
+ import { b as buildCustomEvent, c as closest, i as initializeBindings, F as Fde } from './index-77ebb3d5.js';
3
+
4
+ class MissingResultParentError extends Error {
5
+ constructor(elementName) {
6
+ super(`The "${elementName}" element must be the child of an "atomic-result" element.`);
7
+ }
8
+ }
9
+ const resultContextEventName = 'atomic/resolveResult';
10
+ /**
11
+ * Retrieves `Result` on a rendered `atomic-result`.
12
+ *
13
+ * This method is useful for building custom result template elements, see [Create a Result List](https://docs.coveo.com/en/atomic/latest/usage/create-a-result-list/) for more information.
14
+ *
15
+ * You should use the method in the [connectedCallback lifecycle method](https://developer.mozilla.org/en-US/docs/Web/Web_Components/Using_custom_elements#using_the_lifecycle_callbacks).
16
+ *
17
+ * @param element The element that the event is dispatched to, which must be the child of a rendered "atomic-result".
18
+ * @returns A promise that resolves on initialization of the parent "atomic-result" element, or rejects when there is no parent "atomic-result" element.
19
+ */
20
+ function resultContext(element) {
21
+ return new Promise((resolve, reject) => {
22
+ const event = buildCustomEvent(resultContextEventName, (result) => {
23
+ return resolve(result);
24
+ });
25
+ element.dispatchEvent(event);
26
+ if (!closest(element, 'atomic-result')) {
27
+ reject(new MissingResultParentError(element.nodeName.toLowerCase()));
28
+ }
29
+ });
30
+ }
31
+
32
+ const faqPopupComponentCss = "b{color:var(--atomic-primary)}";
33
+
34
+ const FaqPopupComponent = class {
35
+ constructor(hostRef) {
36
+ registerInstance(this, hostRef);
37
+ this.closeFAQModal = () => {
38
+ this.modalElement.setAttribute('is-open', 'false');
39
+ this.modalElement.querySelector('#btn-done').removeEventListener('click', this.closeFAQModal);
40
+ };
41
+ }
42
+ // We recommended fetching the result context using the `connectedCallback` lifecycle method
43
+ // with async/await. Using `componentWillLoad` will hang the parent `atomic-search-interface` initialization.
44
+ async connectedCallback() {
45
+ var _a;
46
+ try {
47
+ this.bindings = await initializeBindings(this.host);
48
+ this.result = await resultContext(this.host);
49
+ this.modalElement = (_a = this.bindings) === null || _a === void 0 ? void 0 : _a.interfaceElement.querySelector('#faq-modal');
50
+ }
51
+ catch (error) {
52
+ console.error(error);
53
+ this.host.remove();
54
+ }
55
+ }
56
+ openFAQModal(result) {
57
+ var _a, _b, _c, _d;
58
+ if (this.bindings) {
59
+ const { logClickEvent } = Fde(this.bindings.engine);
60
+ const logClickPayload = {
61
+ evt: 'documentQuickview',
62
+ result: result,
63
+ };
64
+ this.bindings.engine.dispatch(logClickEvent(logClickPayload));
65
+ }
66
+ this.modalElement.source = this.host;
67
+ this.modalElement.querySelector('[slot=header]').children[0].innerHTML = 'Question: ' + (((_a = this.result) === null || _a === void 0 ? void 0 : _a.title) || '');
68
+ // Get the body slot
69
+ const bodySlot = this.modalElement.querySelector('[slot=body]');
70
+ // Clear any existing content
71
+ bodySlot.innerHTML = '';
72
+ const answerElement = document.createElement('div');
73
+ answerElement.style.display = 'flex';
74
+ answerElement.style.gap = '16px';
75
+ // Create the answer title element and set its text
76
+ const answerTitleElement = document.createElement('div');
77
+ answerTitleElement.innerText = 'Answer:';
78
+ answerElement.appendChild(answerTitleElement);
79
+ // Get the answer from the result object
80
+ const answerContent = ((_b = this.result) === null || _b === void 0 ? void 0 : _b.raw.answer) || '';
81
+ // Create a new element to contain the answer content
82
+ const answerContentElement = document.createElement('div');
83
+ answerContentElement.innerHTML = answerContent;
84
+ // Append the answer content element to the answer element
85
+ answerElement.appendChild(answerContentElement);
86
+ // Now, the answer element has the title and the content properly appended
87
+ bodySlot.appendChild(answerElement);
88
+ // Create and append the category element
89
+ const categoryElement = document.createElement('div');
90
+ categoryElement.innerHTML = 'Category: ' + (((_c = this.result) === null || _c === void 0 ? void 0 : _c.raw.category) || '');
91
+ bodySlot.appendChild(categoryElement);
92
+ const linkElement = document.createElement('div');
93
+ const linkUrl = ((_d = this.result) === null || _d === void 0 ? void 0 : _d.raw.newmoreinfo) || '';
94
+ linkElement.innerHTML = `Link: <a href="${linkUrl}" target="_blank">${linkUrl}</a>`;
95
+ bodySlot.appendChild(linkElement);
96
+ this.modalElement.querySelector('#faq-modal-close').addEventListener('click', this.closeFAQModal);
97
+ this.modalElement.setAttribute('is-open', 'true');
98
+ }
99
+ render() {
100
+ if (!this.result) {
101
+ return;
102
+ }
103
+ return (h(Host, { className: "clickable-host", onClick: () => this.openFAQModal(this.result) }, this.result.title));
104
+ }
105
+ get host() { return getElement(this); }
106
+ };
107
+ FaqPopupComponent.style = faqPopupComponentCss;
108
+
109
+ export { FaqPopupComponent as faq_popup_component };