@coveops/abi 0.1.0

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 (90) hide show
  1. package/.env.example +24 -0
  2. package/README.md +34 -0
  3. package/coveo.deploy.json +30 -0
  4. package/deployment.esbuild.mjs +54 -0
  5. package/dist/abi/abi.css +1 -0
  6. package/dist/abi/abi.esm.js +1 -0
  7. package/dist/abi/index.esm.js +1 -0
  8. package/dist/abi/p-0ae1e588.js +2 -0
  9. package/dist/abi/p-38555fec.js +1 -0
  10. package/dist/abi/p-424e40eb.entry.js +1 -0
  11. package/dist/abi/p-4da5a336.js +18 -0
  12. package/dist/abi/p-941f664c.entry.js +1 -0
  13. package/dist/abi/p-e5564016.entry.js +50 -0
  14. package/dist/bundle/index.css +1 -0
  15. package/dist/bundle/index.html +61 -0
  16. package/dist/bundle/index.js +673 -0
  17. package/dist/cjs/abi.cjs.js +19 -0
  18. package/dist/cjs/atomic-7321a250.js +7 -0
  19. package/dist/cjs/faq-popup-component.cjs.entry.js +106 -0
  20. package/dist/cjs/index-39c8295a.js +1753 -0
  21. package/dist/cjs/index-bea59ea1.js +1093 -0
  22. package/dist/cjs/index.cjs.js +18 -0
  23. package/dist/cjs/loader.cjs.js +21 -0
  24. package/dist/cjs/results-manager.cjs.entry.js +40 -0
  25. package/dist/cjs/sample-component.cjs.entry.js +146 -0
  26. package/dist/collection/collection-manifest.json +19 -0
  27. package/dist/collection/components/faq-popup-component/faq-popup-component.css +15 -0
  28. package/dist/collection/components/faq-popup-component/faq-popup-component.js +78 -0
  29. package/dist/collection/components/results-manager/results-manager.js +45 -0
  30. package/dist/collection/components/sample-component/sample-component.css +10 -0
  31. package/dist/collection/components/sample-component/sample-component.js +102 -0
  32. package/dist/collection/index.js +15 -0
  33. package/dist/collection/utils/atomic.js +3 -0
  34. package/dist/components/index.d.ts +57 -0
  35. package/dist/components/index.js +2999 -0
  36. package/dist/esm/abi.js +17 -0
  37. package/dist/esm/atomic-0e957d02.js +5 -0
  38. package/dist/esm/faq-popup-component.entry.js +102 -0
  39. package/dist/esm/index-51334f26.js +1065 -0
  40. package/dist/esm/index-9483cecb.js +1749 -0
  41. package/dist/esm/index.js +16 -0
  42. package/dist/esm/loader.js +17 -0
  43. package/dist/esm/polyfills/core-js.js +11 -0
  44. package/dist/esm/polyfills/css-shim.js +1 -0
  45. package/dist/esm/polyfills/dom.js +79 -0
  46. package/dist/esm/polyfills/es5-html-element.js +1 -0
  47. package/dist/esm/polyfills/index.js +34 -0
  48. package/dist/esm/polyfills/system.js +6 -0
  49. package/dist/esm/results-manager.entry.js +36 -0
  50. package/dist/esm/sample-component.entry.js +142 -0
  51. package/dist/index.cjs.js +1 -0
  52. package/dist/index.js +1 -0
  53. package/dist/loader/cdn.js +3 -0
  54. package/dist/loader/index.cjs.js +3 -0
  55. package/dist/loader/index.d.ts +12 -0
  56. package/dist/loader/index.es2017.js +3 -0
  57. package/dist/loader/index.js +4 -0
  58. package/dist/loader/package.json +10 -0
  59. package/dist/types/components/faq-popup-component/faq-popup-component.d.ts +10 -0
  60. package/dist/types/components/results-manager/results-manager.d.ts +8 -0
  61. package/dist/types/components/sample-component/sample-component.d.ts +25 -0
  62. package/dist/types/components.d.ts +63 -0
  63. package/dist/types/html.d.ts +4 -0
  64. package/dist/types/index.d.ts +1 -0
  65. package/dist/types/stencil-public-runtime.d.ts +1565 -0
  66. package/dist/types/utils/atomic.d.ts +1 -0
  67. package/package.json +31 -0
  68. package/src/components/faq-popup-component/faq-popup-component.css +15 -0
  69. package/src/components/faq-popup-component/faq-popup-component.tsx +102 -0
  70. package/src/components/results-manager/AppTemplate.html +44 -0
  71. package/src/components/results-manager/DocumentsTemplate.html +37 -0
  72. package/src/components/results-manager/ELearningTemplate.html +81 -0
  73. package/src/components/results-manager/FAQTemplate.html +73 -0
  74. package/src/components/results-manager/KATemplate.html +84 -0
  75. package/src/components/results-manager/MediaTemplate.html +40 -0
  76. package/src/components/results-manager/PeopleTemplate.html +74 -0
  77. package/src/components/results-manager/QuickLinksTemplate.html +51 -0
  78. package/src/components/results-manager/SitePagesTemplate.html +69 -0
  79. package/src/components/results-manager/results-manager.tsx +64 -0
  80. package/src/components/results-manager/template-1.html +67 -0
  81. package/src/components/sample-component/sample-component.css +10 -0
  82. package/src/components/sample-component/sample-component.tsx +157 -0
  83. package/src/components.d.ts +63 -0
  84. package/src/html.d.ts +4 -0
  85. package/src/index.ts +20 -0
  86. package/src/pages/index.html +137 -0
  87. package/src/style/index.css +12 -0
  88. package/src/utils/atomic.ts +3 -0
  89. package/stencil.config.ts +63 -0
  90. package/tsconfig.json +19 -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,5 @@
1
+ function waitForAtomic() {
2
+ return customElements.whenDefined("atomic-search-interface");
3
+ }
4
+
5
+ export { waitForAtomic as w };
@@ -0,0 +1,102 @@
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 } from './index-9483cecb.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
+ console.log("this.result", this.result, this.modalElement, this.bindings);
51
+ }
52
+ catch (error) {
53
+ console.error(error);
54
+ this.host.remove();
55
+ }
56
+ }
57
+ openFAQModal() {
58
+ var _a, _b, _c, _d;
59
+ this.modalElement.source = this.host;
60
+ this.modalElement.querySelector('[slot=header]').children[0].innerHTML = 'Question: ' + (((_a = this.result) === null || _a === void 0 ? void 0 : _a.title) || '');
61
+ // Get the body slot
62
+ const bodySlot = this.modalElement.querySelector('[slot=body]');
63
+ // Clear any existing content
64
+ bodySlot.innerHTML = '';
65
+ const answerElement = document.createElement('div');
66
+ answerElement.style.display = 'flex';
67
+ answerElement.style.gap = '16px';
68
+ // Create the answer title element and set its text
69
+ const answerTitleElement = document.createElement('div');
70
+ answerTitleElement.innerText = 'Answer:';
71
+ answerElement.appendChild(answerTitleElement);
72
+ // Get the answer from the result object
73
+ const answerContent = ((_b = this.result) === null || _b === void 0 ? void 0 : _b.raw.answer) || '';
74
+ // Create a new element to contain the answer content
75
+ const answerContentElement = document.createElement('div');
76
+ answerContentElement.innerHTML = answerContent;
77
+ // Append the answer content element to the answer element
78
+ answerElement.appendChild(answerContentElement);
79
+ // Now, the answer element has the title and the content properly appended
80
+ bodySlot.appendChild(answerElement);
81
+ // Create and append the category element
82
+ const categoryElement = document.createElement('div');
83
+ categoryElement.innerHTML = 'Category: ' + (((_c = this.result) === null || _c === void 0 ? void 0 : _c.raw.category) || '');
84
+ bodySlot.appendChild(categoryElement);
85
+ const linkElement = document.createElement('div');
86
+ const linkUrl = ((_d = this.result) === null || _d === void 0 ? void 0 : _d.raw.newmoreinfo) || '';
87
+ linkElement.innerHTML = `Link: <a href="${linkUrl}" target="_blank">${linkUrl}</a>`;
88
+ bodySlot.appendChild(linkElement);
89
+ this.modalElement.querySelector('#faq-modal-close').addEventListener('click', this.closeFAQModal);
90
+ this.modalElement.setAttribute('is-open', 'true');
91
+ }
92
+ render() {
93
+ if (!this.result) {
94
+ return;
95
+ }
96
+ return (h(Host, { className: "clickable-host", onClick: () => this.openFAQModal() }, this.result.title));
97
+ }
98
+ get host() { return getElement(this); }
99
+ };
100
+ FaqPopupComponent.style = faqPopupComponentCss;
101
+
102
+ export { FaqPopupComponent as faq_popup_component };