@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,19 @@
1
+ 'use strict';
2
+
3
+ const index = require('./index-bea59ea1.js');
4
+
5
+ /*
6
+ Stencil Client Patch Browser v2.17.3 | MIT Licensed | https://stenciljs.com
7
+ */
8
+ const patchBrowser = () => {
9
+ const importMeta = (typeof document === 'undefined' ? new (require('u' + 'rl').URL)('file:' + __filename).href : (document.currentScript && document.currentScript.src || new URL('abi.cjs.js', document.baseURI).href));
10
+ const opts = {};
11
+ if (importMeta !== '') {
12
+ opts.resourcesUrl = new URL('.', importMeta).href;
13
+ }
14
+ return index.promiseResolve(opts);
15
+ };
16
+
17
+ patchBrowser().then(options => {
18
+ return index.bootstrapLazy([["faq-popup-component.cjs",[[1,"faq-popup-component",{"result":[32]}]]],["results-manager.cjs",[[0,"results-manager"]]],["sample-component.cjs",[[1,"sample-component",{"pagerState":[32],"statusState":[32]}]]]], options);
19
+ });
@@ -0,0 +1,7 @@
1
+ 'use strict';
2
+
3
+ function waitForAtomic() {
4
+ return customElements.whenDefined("atomic-search-interface");
5
+ }
6
+
7
+ exports.waitForAtomic = waitForAtomic;
@@ -0,0 +1,113 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ const index$1 = require('./index-bea59ea1.js');
6
+ const index = require('./index-daa118f5.js');
7
+
8
+ class MissingResultParentError extends Error {
9
+ constructor(elementName) {
10
+ super(`The "${elementName}" element must be the child of an "atomic-result" element.`);
11
+ }
12
+ }
13
+ const resultContextEventName = 'atomic/resolveResult';
14
+ /**
15
+ * Retrieves `Result` on a rendered `atomic-result`.
16
+ *
17
+ * 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.
18
+ *
19
+ * 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).
20
+ *
21
+ * @param element The element that the event is dispatched to, which must be the child of a rendered "atomic-result".
22
+ * @returns A promise that resolves on initialization of the parent "atomic-result" element, or rejects when there is no parent "atomic-result" element.
23
+ */
24
+ function resultContext(element) {
25
+ return new Promise((resolve, reject) => {
26
+ const event = index.buildCustomEvent(resultContextEventName, (result) => {
27
+ return resolve(result);
28
+ });
29
+ element.dispatchEvent(event);
30
+ if (!index.closest(element, 'atomic-result')) {
31
+ reject(new MissingResultParentError(element.nodeName.toLowerCase()));
32
+ }
33
+ });
34
+ }
35
+
36
+ const faqPopupComponentCss = "b{color:var(--atomic-primary)}";
37
+
38
+ const FaqPopupComponent = class {
39
+ constructor(hostRef) {
40
+ index$1.registerInstance(this, hostRef);
41
+ this.closeFAQModal = () => {
42
+ this.modalElement.setAttribute('is-open', 'false');
43
+ this.modalElement.querySelector('#btn-done').removeEventListener('click', this.closeFAQModal);
44
+ };
45
+ }
46
+ // We recommended fetching the result context using the `connectedCallback` lifecycle method
47
+ // with async/await. Using `componentWillLoad` will hang the parent `atomic-search-interface` initialization.
48
+ async connectedCallback() {
49
+ var _a;
50
+ try {
51
+ this.bindings = await index.initializeBindings(this.host);
52
+ this.result = await resultContext(this.host);
53
+ this.modalElement = (_a = this.bindings) === null || _a === void 0 ? void 0 : _a.interfaceElement.querySelector('#faq-modal');
54
+ }
55
+ catch (error) {
56
+ console.error(error);
57
+ this.host.remove();
58
+ }
59
+ }
60
+ openFAQModal(result) {
61
+ var _a, _b, _c, _d;
62
+ if (this.bindings) {
63
+ const { logClickEvent } = index.Fde(this.bindings.engine);
64
+ const logClickPayload = {
65
+ evt: 'documentQuickview',
66
+ result: result,
67
+ };
68
+ this.bindings.engine.dispatch(logClickEvent(logClickPayload));
69
+ }
70
+ this.modalElement.source = this.host;
71
+ this.modalElement.querySelector('[slot=header]').children[0].innerHTML = 'Question: ' + (((_a = this.result) === null || _a === void 0 ? void 0 : _a.title) || '');
72
+ // Get the body slot
73
+ const bodySlot = this.modalElement.querySelector('[slot=body]');
74
+ // Clear any existing content
75
+ bodySlot.innerHTML = '';
76
+ const answerElement = document.createElement('div');
77
+ answerElement.style.display = 'flex';
78
+ answerElement.style.gap = '16px';
79
+ // Create the answer title element and set its text
80
+ const answerTitleElement = document.createElement('div');
81
+ answerTitleElement.innerText = 'Answer:';
82
+ answerElement.appendChild(answerTitleElement);
83
+ // Get the answer from the result object
84
+ const answerContent = ((_b = this.result) === null || _b === void 0 ? void 0 : _b.raw.answer) || '';
85
+ // Create a new element to contain the answer content
86
+ const answerContentElement = document.createElement('div');
87
+ answerContentElement.innerHTML = answerContent;
88
+ // Append the answer content element to the answer element
89
+ answerElement.appendChild(answerContentElement);
90
+ // Now, the answer element has the title and the content properly appended
91
+ bodySlot.appendChild(answerElement);
92
+ // Create and append the category element
93
+ const categoryElement = document.createElement('div');
94
+ categoryElement.innerHTML = 'Category: ' + (((_c = this.result) === null || _c === void 0 ? void 0 : _c.raw.category) || '');
95
+ bodySlot.appendChild(categoryElement);
96
+ const linkElement = document.createElement('div');
97
+ const linkUrl = ((_d = this.result) === null || _d === void 0 ? void 0 : _d.raw.newmoreinfo) || '';
98
+ linkElement.innerHTML = `Link: <a href="${linkUrl}" target="_blank">${linkUrl}</a>`;
99
+ bodySlot.appendChild(linkElement);
100
+ this.modalElement.querySelector('#faq-modal-close').addEventListener('click', this.closeFAQModal);
101
+ this.modalElement.setAttribute('is-open', 'true');
102
+ }
103
+ render() {
104
+ if (!this.result) {
105
+ return;
106
+ }
107
+ return (index$1.h(index$1.Host, { className: "clickable-host", onClick: () => this.openFAQModal(this.result) }, this.result.title));
108
+ }
109
+ get host() { return index$1.getElement(this); }
110
+ };
111
+ FaqPopupComponent.style = faqPopupComponentCss;
112
+
113
+ exports.faq_popup_component = FaqPopupComponent;