@coveo/atomic 3.33.9-pre.d5d9a75465 → 3.33.9-pre.eac38e190d
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.
- package/dist/atomic/_atomic.esm.js +1 -1
- package/dist/atomic/atomic.esm.js.map +1 -1
- package/dist/atomic/components/_index.d.ts +2 -0
- package/dist/atomic/components/_index.js +1 -0
- package/dist/atomic/components/analytics-config.js +1 -1
- package/dist/atomic/components/atomic-category-facet.js +1 -1
- package/dist/atomic/components/atomic-facet.js +1 -1
- package/dist/atomic/components/atomic-field-condition.js +1 -1
- package/dist/atomic/components/atomic-field-condition.js.map +1 -1
- package/dist/atomic/components/atomic-format-currency.js +1 -1
- package/dist/atomic/components/atomic-format-number.js +1 -1
- package/dist/atomic/components/atomic-format-unit.js +1 -1
- package/dist/atomic/components/atomic-insight-result-children-template.js +1 -1
- package/dist/atomic/components/atomic-insight-result-children-template.js.map +1 -1
- package/dist/atomic/components/atomic-insight-result-template.js +1 -1
- package/dist/atomic/components/atomic-insight-result-template.js.map +1 -1
- package/dist/atomic/components/atomic-numeric-facet.js +1 -1
- package/dist/atomic/components/atomic-quickview-modal2.js +1 -1
- package/dist/atomic/components/atomic-quickview.js +1 -1
- package/dist/atomic/components/atomic-recs-result-template.js +1 -1
- package/dist/atomic/components/atomic-recs-result-template.js.map +1 -1
- package/dist/atomic/components/atomic-relevance-inspector.d.ts +11 -0
- package/dist/atomic/components/atomic-relevance-inspector.js +53 -0
- package/dist/atomic/components/atomic-relevance-inspector.js.map +1 -0
- package/dist/atomic/components/atomic-result-children-template.js +1 -1
- package/dist/atomic/components/atomic-result-children-template.js.map +1 -1
- package/dist/atomic/components/atomic-result-children.js +1 -1
- package/dist/atomic/components/atomic-result-fields-list.js +1 -1
- package/dist/atomic/components/atomic-result-link.js +1 -1
- package/dist/atomic/components/atomic-result-list.js +1 -1
- package/dist/atomic/components/atomic-result-table-placeholder2.js +1 -1
- package/dist/atomic/components/atomic-result-template.js +1 -1
- package/dist/atomic/components/atomic-result-template.js.map +1 -1
- package/dist/atomic/components/atomic-search-box-query-suggestions2.js +1 -1
- package/dist/atomic/components/atomic-search-box-recent-queries2.js +1 -1
- package/dist/atomic/components/atomic-search-box.js +3 -3
- package/dist/atomic/components/atomic-smart-snippet-feedback-modal2.js +2 -2
- package/dist/atomic/components/atomic-sort-dropdown.js +2 -2
- package/dist/atomic/components/atomic-sort-expression.js +1 -1
- package/dist/atomic/components/atomic-tab-manager.js +1 -1
- package/dist/atomic/components/components/search/atomic-search-interface/atomic-search-interface.js +23 -1
- package/dist/atomic/components/components/search/index.js +0 -1
- package/dist/atomic/components/components/search/lazy-index.js +0 -1
- package/dist/atomic/components/global/environment.js +1 -1
- package/dist/atomic/components/index.js.map +1 -1
- package/dist/atomic/components/{result-template-common.js → stencil-result-template-common.js} +1 -1
- package/dist/atomic/{p-7709fba4.js.map → components/stencil-result-template-common.js.map} +1 -1
- package/dist/atomic/{p-7709fba4.js → p-037276de.js} +1 -1
- package/dist/atomic/p-037276de.js.map +1 -0
- package/dist/atomic/{p-e1d6f5e9.entry.js → p-20019654.entry.js} +2 -2
- package/dist/atomic/{p-b05d54e3.entry.js → p-30411cd4.entry.js} +2 -2
- package/dist/atomic/{p-aa911e35.entry.js → p-3e38aea6.entry.js} +2 -2
- package/dist/atomic/{p-250f34d4.entry.js → p-41f1e5eb.entry.js} +2 -2
- package/dist/atomic/p-41f1e5eb.entry.js.map +1 -0
- package/dist/atomic/{p-e296615c.entry.js → p-44ef70b6.entry.js} +2 -2
- package/dist/atomic/{p-80fc1821.entry.js → p-4ae14373.entry.js} +2 -2
- package/dist/atomic/{p-5a710350.entry.js → p-4b9a166f.entry.js} +2 -2
- package/dist/atomic/{p-d1795580.entry.js → p-4c1fcc83.entry.js} +2 -2
- package/dist/atomic/p-4c1fcc83.entry.js.map +1 -0
- package/dist/atomic/{p-78bb2db9.entry.js → p-516b8165.entry.js} +2 -2
- package/dist/atomic/{p-dcba2119.entry.js → p-62afcf79.entry.js} +2 -2
- package/dist/atomic/{p-c4fa1ab6.entry.js → p-72b04d5a.entry.js} +2 -2
- package/dist/atomic/{p-ef5ba5ae.entry.js → p-74822069.entry.js} +2 -2
- package/dist/atomic/{p-ab44a3c9.entry.js → p-8103bad3.entry.js} +2 -2
- package/dist/atomic/{p-f2467a39.entry.js → p-8acb1466.entry.js} +2 -2
- package/dist/atomic/{p-285ab4c8.js → p-a8a8d6fb.js} +2 -2
- package/dist/atomic/{p-c865f044.entry.js → p-aa616502.entry.js} +2 -2
- package/dist/atomic/{p-2c221588.entry.js → p-b4ad3036.entry.js} +2 -2
- package/dist/atomic/{p-2caf7109.entry.js → p-b7cd0342.entry.js} +2 -2
- package/dist/atomic/{p-c499f3ea.entry.js → p-bcdd5726.entry.js} +2 -2
- package/dist/atomic/{p-0b5efb51.entry.js → p-cabafd0e.entry.js} +2 -2
- package/dist/atomic/p-cabafd0e.entry.js.map +1 -0
- package/dist/atomic/{p-d6e04719.entry.js → p-cc64ece5.entry.js} +2 -2
- package/dist/atomic/p-cc64ece5.entry.js.map +1 -0
- package/dist/atomic/{p-5f2d62d9.entry.js → p-d2d22ab2.entry.js} +2 -2
- package/dist/atomic/p-d8028950.entry.js +2 -0
- package/dist/atomic/p-d8028950.entry.js.map +1 -0
- package/dist/atomic/{p-f71b14b2.entry.js → p-daf18eeb.entry.js} +2 -2
- package/dist/atomic/p-daf18eeb.entry.js.map +1 -0
- package/dist/atomic/{p-47d35e28.entry.js → p-df1d50c8.entry.js} +2 -2
- package/dist/atomic/{p-bc8e7f18.entry.js → p-dfc385b7.entry.js} +2 -2
- package/dist/atomic/{p-ca3dc59b.entry.js → p-e3edbf14.entry.js} +2 -2
- package/dist/atomic/{p-fa11d674.entry.js → p-f073a78d.entry.js} +2 -2
- package/dist/atomic/{p-a4d277c7.entry.js → p-f7452dae.entry.js} +2 -2
- package/dist/atomic/p-f7452dae.entry.js.map +1 -0
- package/dist/cjs/_loader.cjs.js +1 -1
- package/dist/cjs/{analytics-config-b07b3db7.js → analytics-config-a05ccd20.js} +2 -2
- package/dist/cjs/{analytics-config-b07b3db7.js.map → analytics-config-a05ccd20.js.map} +1 -1
- package/dist/cjs/atomic-category-facet.cjs.entry.js +1 -1
- package/dist/cjs/atomic-facet.cjs.entry.js +1 -1
- package/dist/cjs/atomic-field-condition.cjs.entry.js +2 -2
- package/dist/cjs/atomic-field-condition.cjs.entry.js.map +1 -1
- package/dist/cjs/atomic-format-currency.cjs.entry.js +1 -1
- package/dist/cjs/atomic-format-number.cjs.entry.js +1 -1
- package/dist/cjs/atomic-format-unit.cjs.entry.js +1 -1
- package/dist/cjs/atomic-insight-interface.cjs.entry.js +1 -1
- package/dist/cjs/atomic-insight-result-children-template.cjs.entry.js +4 -4
- package/dist/cjs/atomic-insight-result-children-template.cjs.entry.js.map +1 -1
- package/dist/cjs/atomic-insight-result-template.cjs.entry.js +4 -4
- package/dist/cjs/atomic-insight-result-template.cjs.entry.js.map +1 -1
- package/dist/cjs/atomic-numeric-facet.cjs.entry.js +1 -1
- package/dist/cjs/atomic-quickview-modal.cjs.entry.js +1 -1
- package/dist/cjs/atomic-quickview.cjs.entry.js +1 -1
- package/dist/cjs/atomic-recs-interface.cjs.entry.js +1 -1
- package/dist/cjs/atomic-recs-result-template.cjs.entry.js +4 -4
- package/dist/cjs/atomic-recs-result-template.cjs.entry.js.map +1 -1
- package/dist/cjs/atomic-relevance-inspector.cjs.entry.js +38 -0
- package/dist/cjs/atomic-relevance-inspector.cjs.entry.js.map +1 -0
- package/dist/cjs/atomic-result-children-template.cjs.entry.js +3 -3
- package/dist/cjs/atomic-result-children-template.cjs.entry.js.map +1 -1
- package/dist/cjs/atomic-result-children.cjs.entry.js +1 -1
- package/dist/cjs/atomic-result-fields-list.cjs.entry.js +1 -1
- package/dist/cjs/atomic-result-link.cjs.entry.js +1 -1
- package/dist/cjs/atomic-result-list.cjs.entry.js +1 -1
- package/dist/cjs/atomic-result-placeholder_8.cjs.entry.js +1 -1
- package/dist/cjs/atomic-result-template.cjs.entry.js +3 -3
- package/dist/cjs/atomic-result-template.cjs.entry.js.map +1 -1
- package/dist/cjs/atomic-search-box-query-suggestions_2.cjs.entry.js +2 -2
- package/dist/cjs/atomic-search-box.cjs.entry.js +3 -3
- package/dist/cjs/atomic-smart-snippet-feedback-modal.cjs.entry.js +2 -2
- package/dist/cjs/atomic-sort-dropdown.cjs.entry.js +2 -2
- package/dist/cjs/atomic-sort-expression.cjs.entry.js +1 -1
- package/dist/cjs/atomic-tab-manager.cjs.entry.js +1 -1
- package/dist/cjs/atomic.cjs.js +1 -1
- package/dist/cjs/index-757bc886.js +4 -0
- package/dist/cjs/{result-template-common-88359dad.js → stencil-result-template-common-ade85eec.js} +1 -1
- package/dist/cjs/stencil-result-template-common-ade85eec.js.map +1 -0
- package/dist/cjs/version.cjs.js +1 -1
- package/dist/esm/_loader.js +1 -1
- package/dist/esm/{analytics-config-17834ebb.js → analytics-config-3d4371d2.js} +2 -2
- package/dist/esm/{analytics-config-17834ebb.js.map → analytics-config-3d4371d2.js.map} +1 -1
- package/dist/esm/atomic-category-facet.entry.js +1 -1
- package/dist/esm/atomic-facet.entry.js +1 -1
- package/dist/esm/atomic-field-condition.entry.js +1 -1
- package/dist/esm/atomic-field-condition.entry.js.map +1 -1
- package/dist/esm/atomic-format-currency.entry.js +1 -1
- package/dist/esm/atomic-format-number.entry.js +1 -1
- package/dist/esm/atomic-format-unit.entry.js +1 -1
- package/dist/esm/atomic-insight-interface.entry.js +1 -1
- package/dist/esm/atomic-insight-result-children-template.entry.js +1 -1
- package/dist/esm/atomic-insight-result-children-template.entry.js.map +1 -1
- package/dist/esm/atomic-insight-result-template.entry.js +1 -1
- package/dist/esm/atomic-insight-result-template.entry.js.map +1 -1
- package/dist/esm/atomic-numeric-facet.entry.js +1 -1
- package/dist/esm/atomic-quickview-modal.entry.js +1 -1
- package/dist/esm/atomic-quickview.entry.js +1 -1
- package/dist/esm/atomic-recs-interface.entry.js +1 -1
- package/dist/esm/atomic-recs-result-template.entry.js +1 -1
- package/dist/esm/atomic-recs-result-template.entry.js.map +1 -1
- package/dist/esm/atomic-relevance-inspector.entry.js +34 -0
- package/dist/esm/atomic-relevance-inspector.entry.js.map +1 -0
- package/dist/esm/atomic-result-children-template.entry.js +1 -1
- package/dist/esm/atomic-result-children-template.entry.js.map +1 -1
- package/dist/esm/atomic-result-children.entry.js +1 -1
- package/dist/esm/atomic-result-fields-list.entry.js +1 -1
- package/dist/esm/atomic-result-link.entry.js +1 -1
- package/dist/esm/atomic-result-list.entry.js +1 -1
- package/dist/esm/atomic-result-placeholder_8.entry.js +1 -1
- package/dist/esm/atomic-result-template.entry.js +1 -1
- package/dist/esm/atomic-result-template.entry.js.map +1 -1
- package/dist/esm/atomic-search-box-query-suggestions_2.entry.js +2 -2
- package/dist/esm/atomic-search-box.entry.js +3 -3
- package/dist/esm/atomic-smart-snippet-feedback-modal.entry.js +2 -2
- package/dist/esm/atomic-sort-dropdown.entry.js +2 -2
- package/dist/esm/atomic-sort-expression.entry.js +1 -1
- package/dist/esm/atomic-tab-manager.entry.js +1 -1
- package/dist/esm/atomic.js +1 -1
- package/dist/esm/index-3f35faca.js +4 -0
- package/dist/esm/{result-template-common-ac9fecab.js → stencil-result-template-common-dca78ff5.js} +1 -1
- package/dist/esm/stencil-result-template-common-dca78ff5.js.map +1 -0
- package/dist/esm/version.js +1 -1
- package/dist/types/components/common/result-templates/result-template-common.d.ts +1 -18
- package/dist/types/components/common/result-templates/result-template-controller.d.ts +26 -0
- package/dist/types/components/common/result-templates/stencil-result-template-common.d.ts +24 -0
- package/dist/types/components/insight/result-templates/atomic-insight-result-children-template/atomic-insight-result-children-template.d.ts +1 -1
- package/dist/types/components/search/atomic-relevance-inspector/atomic-relevance-inspector.d.ts +8 -18
- package/dist/types/components/search/atomic-search-interface/atomic-search-interface.d.ts +4 -1
- package/dist/types/components/search/index.d.ts +0 -1
- package/dist/types/components/search/result-templates/atomic-result-children-template/atomic-result-children-template.d.ts +1 -1
- package/dist/types/components.d.ts +53 -0
- package/docs/atomic-docs.json +88 -1
- package/package.json +1 -1
- package/dist/atomic/components/components/search/atomic-relevance-inspector/atomic-relevance-inspector.js +0 -100
- package/dist/atomic/components/result-template-common.js.map +0 -1
- package/dist/atomic/p-0b5efb51.entry.js.map +0 -1
- package/dist/atomic/p-250f34d4.entry.js.map +0 -1
- package/dist/atomic/p-a4d277c7.entry.js.map +0 -1
- package/dist/atomic/p-d1795580.entry.js.map +0 -1
- package/dist/atomic/p-d6e04719.entry.js.map +0 -1
- package/dist/atomic/p-f71b14b2.entry.js.map +0 -1
- package/dist/cjs/result-template-common-88359dad.js.map +0 -1
- package/dist/esm/result-template-common-ac9fecab.js.map +0 -1
- /package/dist/atomic/{p-e1d6f5e9.entry.js.map → p-20019654.entry.js.map} +0 -0
- /package/dist/atomic/{p-b05d54e3.entry.js.map → p-30411cd4.entry.js.map} +0 -0
- /package/dist/atomic/{p-aa911e35.entry.js.map → p-3e38aea6.entry.js.map} +0 -0
- /package/dist/atomic/{p-e296615c.entry.js.map → p-44ef70b6.entry.js.map} +0 -0
- /package/dist/atomic/{p-80fc1821.entry.js.map → p-4ae14373.entry.js.map} +0 -0
- /package/dist/atomic/{p-5a710350.entry.js.map → p-4b9a166f.entry.js.map} +0 -0
- /package/dist/atomic/{p-78bb2db9.entry.js.map → p-516b8165.entry.js.map} +0 -0
- /package/dist/atomic/{p-dcba2119.entry.js.map → p-62afcf79.entry.js.map} +0 -0
- /package/dist/atomic/{p-c4fa1ab6.entry.js.map → p-72b04d5a.entry.js.map} +0 -0
- /package/dist/atomic/{p-ef5ba5ae.entry.js.map → p-74822069.entry.js.map} +0 -0
- /package/dist/atomic/{p-ab44a3c9.entry.js.map → p-8103bad3.entry.js.map} +0 -0
- /package/dist/atomic/{p-f2467a39.entry.js.map → p-8acb1466.entry.js.map} +0 -0
- /package/dist/atomic/{p-285ab4c8.js.map → p-a8a8d6fb.js.map} +0 -0
- /package/dist/atomic/{p-c865f044.entry.js.map → p-aa616502.entry.js.map} +0 -0
- /package/dist/atomic/{p-2c221588.entry.js.map → p-b4ad3036.entry.js.map} +0 -0
- /package/dist/atomic/{p-2caf7109.entry.js.map → p-b7cd0342.entry.js.map} +0 -0
- /package/dist/atomic/{p-c499f3ea.entry.js.map → p-bcdd5726.entry.js.map} +0 -0
- /package/dist/atomic/{p-5f2d62d9.entry.js.map → p-d2d22ab2.entry.js.map} +0 -0
- /package/dist/atomic/{p-47d35e28.entry.js.map → p-df1d50c8.entry.js.map} +0 -0
- /package/dist/atomic/{p-bc8e7f18.entry.js.map → p-dfc385b7.entry.js.map} +0 -0
- /package/dist/atomic/{p-ca3dc59b.entry.js.map → p-e3edbf14.entry.js.map} +0 -0
- /package/dist/atomic/{p-fa11d674.entry.js.map → p-f073a78d.entry.js.map} +0 -0
@@ -20,6 +20,7 @@ import { InsightResultAttachToCaseEvent } from "./components/insight/atomic-insi
|
|
20
20
|
import { RecommendationEngine, InteractiveResult as RecsInteractiveResult, LogLevel as RecsLogLevel, Result as RecsResult, ResultTemplate as RecsResultTemplate, ResultTemplateCondition as RecsResultTemplateCondition } from "@coveo/headless/recommendation";
|
21
21
|
import { RecsInitializationOptions } from "./components/recommendations/atomic-recs-interface/atomic-recs-interface";
|
22
22
|
import { RecsStore } from "./components/recommendations/atomic-recs-interface/store";
|
23
|
+
import { Bindings } from "./components/search/atomic-search-interface/atomic-search-interface";
|
23
24
|
import { SearchStore } from "./components/search/atomic-search-interface/store";
|
24
25
|
import { RedirectionPayload } from "./components/common/search-box/redirection-payload";
|
25
26
|
import { AriaLabelGenerator } from "./components/search/search-box-suggestions/atomic-search-box-instant-results/atomic-search-box-instant-results";
|
@@ -39,6 +40,7 @@ export { InsightResultAttachToCaseEvent } from "./components/insight/atomic-insi
|
|
39
40
|
export { RecommendationEngine, InteractiveResult as RecsInteractiveResult, LogLevel as RecsLogLevel, Result as RecsResult, ResultTemplate as RecsResultTemplate, ResultTemplateCondition as RecsResultTemplateCondition } from "@coveo/headless/recommendation";
|
40
41
|
export { RecsInitializationOptions } from "./components/recommendations/atomic-recs-interface/atomic-recs-interface";
|
41
42
|
export { RecsStore } from "./components/recommendations/atomic-recs-interface/store";
|
43
|
+
export { Bindings } from "./components/search/atomic-search-interface/atomic-search-interface";
|
42
44
|
export { SearchStore } from "./components/search/atomic-search-interface/store";
|
43
45
|
export { RedirectionPayload } from "./components/common/search-box/redirection-payload";
|
44
46
|
export { AriaLabelGenerator } from "./components/search/search-box-suggestions/atomic-search-box-instant-results/atomic-search-box-instant-results";
|
@@ -1836,6 +1838,16 @@ export namespace Components {
|
|
1836
1838
|
*/
|
1837
1839
|
"collapseFacetsAfter": number;
|
1838
1840
|
}
|
1841
|
+
/**
|
1842
|
+
* The `atomic-relevance-inspector` component is used internally to offer insight on search page relevance, as well as information to help troubleshoot issues during development.
|
1843
|
+
*/
|
1844
|
+
interface AtomicRelevanceInspector {
|
1845
|
+
/**
|
1846
|
+
* The Atomic interface bindings, namely the headless search engine and i18n instances.
|
1847
|
+
*/
|
1848
|
+
"bindings": Bindings;
|
1849
|
+
"open": boolean;
|
1850
|
+
}
|
1839
1851
|
/**
|
1840
1852
|
* The `atomic-result` component is used internally by the `atomic-result-list` component.
|
1841
1853
|
*/
|
@@ -2853,6 +2865,10 @@ export interface AtomicQuickviewModalCustomEvent<T> extends CustomEvent<T> {
|
|
2853
2865
|
detail: T;
|
2854
2866
|
target: HTMLAtomicQuickviewModalElement;
|
2855
2867
|
}
|
2868
|
+
export interface AtomicRelevanceInspectorCustomEvent<T> extends CustomEvent<T> {
|
2869
|
+
detail: T;
|
2870
|
+
target: HTMLAtomicRelevanceInspectorElement;
|
2871
|
+
}
|
2856
2872
|
export interface AtomicSearchBoxCustomEvent<T> extends CustomEvent<T> {
|
2857
2873
|
detail: T;
|
2858
2874
|
target: HTMLAtomicSearchBoxElement;
|
@@ -3684,6 +3700,26 @@ declare global {
|
|
3684
3700
|
prototype: HTMLAtomicRefineToggleElement;
|
3685
3701
|
new (): HTMLAtomicRefineToggleElement;
|
3686
3702
|
};
|
3703
|
+
interface HTMLAtomicRelevanceInspectorElementEventMap {
|
3704
|
+
"atomic/relevanceInspector/close": any;
|
3705
|
+
}
|
3706
|
+
/**
|
3707
|
+
* The `atomic-relevance-inspector` component is used internally to offer insight on search page relevance, as well as information to help troubleshoot issues during development.
|
3708
|
+
*/
|
3709
|
+
interface HTMLAtomicRelevanceInspectorElement extends Components.AtomicRelevanceInspector, HTMLStencilElement {
|
3710
|
+
addEventListener<K extends keyof HTMLAtomicRelevanceInspectorElementEventMap>(type: K, listener: (this: HTMLAtomicRelevanceInspectorElement, ev: AtomicRelevanceInspectorCustomEvent<HTMLAtomicRelevanceInspectorElementEventMap[K]>) => any, options?: boolean | AddEventListenerOptions): void;
|
3711
|
+
addEventListener<K extends keyof DocumentEventMap>(type: K, listener: (this: Document, ev: DocumentEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
|
3712
|
+
addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
|
3713
|
+
addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
|
3714
|
+
removeEventListener<K extends keyof HTMLAtomicRelevanceInspectorElementEventMap>(type: K, listener: (this: HTMLAtomicRelevanceInspectorElement, ev: AtomicRelevanceInspectorCustomEvent<HTMLAtomicRelevanceInspectorElementEventMap[K]>) => any, options?: boolean | EventListenerOptions): void;
|
3715
|
+
removeEventListener<K extends keyof DocumentEventMap>(type: K, listener: (this: Document, ev: DocumentEventMap[K]) => any, options?: boolean | EventListenerOptions): void;
|
3716
|
+
removeEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, options?: boolean | EventListenerOptions): void;
|
3717
|
+
removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
|
3718
|
+
}
|
3719
|
+
var HTMLAtomicRelevanceInspectorElement: {
|
3720
|
+
prototype: HTMLAtomicRelevanceInspectorElement;
|
3721
|
+
new (): HTMLAtomicRelevanceInspectorElement;
|
3722
|
+
};
|
3687
3723
|
/**
|
3688
3724
|
* The `atomic-result` component is used internally by the `atomic-result-list` component.
|
3689
3725
|
*/
|
@@ -4455,6 +4491,7 @@ declare global {
|
|
4455
4491
|
"atomic-recs-result-template": HTMLAtomicRecsResultTemplateElement;
|
4456
4492
|
"atomic-refine-modal": HTMLAtomicRefineModalElement;
|
4457
4493
|
"atomic-refine-toggle": HTMLAtomicRefineToggleElement;
|
4494
|
+
"atomic-relevance-inspector": HTMLAtomicRelevanceInspectorElement;
|
4458
4495
|
"atomic-result": HTMLAtomicResultElement;
|
4459
4496
|
"atomic-result-badge": HTMLAtomicResultBadgeElement;
|
4460
4497
|
"atomic-result-children": HTMLAtomicResultChildrenElement;
|
@@ -6206,6 +6243,17 @@ declare namespace LocalJSX {
|
|
6206
6243
|
*/
|
6207
6244
|
"collapseFacetsAfter"?: number;
|
6208
6245
|
}
|
6246
|
+
/**
|
6247
|
+
* The `atomic-relevance-inspector` component is used internally to offer insight on search page relevance, as well as information to help troubleshoot issues during development.
|
6248
|
+
*/
|
6249
|
+
interface AtomicRelevanceInspector {
|
6250
|
+
/**
|
6251
|
+
* The Atomic interface bindings, namely the headless search engine and i18n instances.
|
6252
|
+
*/
|
6253
|
+
"bindings": Bindings;
|
6254
|
+
"onAtomic/relevanceInspector/close"?: (event: AtomicRelevanceInspectorCustomEvent<any>) => void;
|
6255
|
+
"open"?: boolean;
|
6256
|
+
}
|
6209
6257
|
/**
|
6210
6258
|
* The `atomic-result` component is used internally by the `atomic-result-list` component.
|
6211
6259
|
*/
|
@@ -7248,6 +7296,7 @@ declare namespace LocalJSX {
|
|
7248
7296
|
"atomic-recs-result-template": AtomicRecsResultTemplate;
|
7249
7297
|
"atomic-refine-modal": AtomicRefineModal;
|
7250
7298
|
"atomic-refine-toggle": AtomicRefineToggle;
|
7299
|
+
"atomic-relevance-inspector": AtomicRelevanceInspector;
|
7251
7300
|
"atomic-result": AtomicResult;
|
7252
7301
|
"atomic-result-badge": AtomicResultBadge;
|
7253
7302
|
"atomic-result-children": AtomicResultChildren;
|
@@ -7568,6 +7617,10 @@ declare module "@stencil/core" {
|
|
7568
7617
|
* When this component is added to the `atomic-search-interface`, an `atomic-refine-modal` component is automatically created.
|
7569
7618
|
*/
|
7570
7619
|
"atomic-refine-toggle": LocalJSX.AtomicRefineToggle & JSXBase.HTMLAttributes<HTMLAtomicRefineToggleElement>;
|
7620
|
+
/**
|
7621
|
+
* The `atomic-relevance-inspector` component is used internally to offer insight on search page relevance, as well as information to help troubleshoot issues during development.
|
7622
|
+
*/
|
7623
|
+
"atomic-relevance-inspector": LocalJSX.AtomicRelevanceInspector & JSXBase.HTMLAttributes<HTMLAtomicRelevanceInspectorElement>;
|
7571
7624
|
/**
|
7572
7625
|
* The `atomic-result` component is used internally by the `atomic-result-list` component.
|
7573
7626
|
*/
|
package/docs/atomic-docs.json
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
{
|
2
|
-
"timestamp": "2025-10-
|
2
|
+
"timestamp": "2025-10-01T20:44:30",
|
3
3
|
"compiler": {
|
4
4
|
"name": "@stencil/core",
|
5
5
|
"version": "4.20.0",
|
@@ -9341,6 +9341,88 @@
|
|
9341
9341
|
]
|
9342
9342
|
}
|
9343
9343
|
},
|
9344
|
+
{
|
9345
|
+
"filePath": "src/components/search/atomic-relevance-inspector/atomic-relevance-inspector.tsx",
|
9346
|
+
"encapsulation": "shadow",
|
9347
|
+
"tag": "atomic-relevance-inspector",
|
9348
|
+
"docs": "The `atomic-relevance-inspector` component is used internally to offer insight on search page relevance, as well as information to help troubleshoot issues during development.",
|
9349
|
+
"docsTags": [],
|
9350
|
+
"usage": {},
|
9351
|
+
"props": [
|
9352
|
+
{
|
9353
|
+
"name": "bindings",
|
9354
|
+
"type": "CommonBindings<SearchEngine<{}>, SearchStore, AtomicSearchInterface> & NonceBindings",
|
9355
|
+
"complexType": {
|
9356
|
+
"original": "Bindings",
|
9357
|
+
"resolved": "CommonBindings<SearchEngine<{}>, SearchStore, AtomicSearchInterface> & NonceBindings",
|
9358
|
+
"references": {
|
9359
|
+
"Bindings": {
|
9360
|
+
"location": "import",
|
9361
|
+
"path": "../atomic-search-interface/atomic-search-interface",
|
9362
|
+
"id": "src/components/search/atomic-search-interface/atomic-search-interface.ts::Bindings"
|
9363
|
+
}
|
9364
|
+
}
|
9365
|
+
},
|
9366
|
+
"mutable": false,
|
9367
|
+
"reflectToAttr": false,
|
9368
|
+
"docs": "The Atomic interface bindings, namely the headless search engine and i18n instances.",
|
9369
|
+
"docsTags": [],
|
9370
|
+
"values": [
|
9371
|
+
{
|
9372
|
+
"type": "CommonBindings<SearchEngine<{}>, SearchStore, AtomicSearchInterface> & NonceBindings"
|
9373
|
+
}
|
9374
|
+
],
|
9375
|
+
"optional": false,
|
9376
|
+
"required": true
|
9377
|
+
},
|
9378
|
+
{
|
9379
|
+
"name": "open",
|
9380
|
+
"type": "boolean",
|
9381
|
+
"complexType": {
|
9382
|
+
"original": "boolean",
|
9383
|
+
"resolved": "boolean",
|
9384
|
+
"references": {}
|
9385
|
+
},
|
9386
|
+
"mutable": false,
|
9387
|
+
"attr": "open",
|
9388
|
+
"reflectToAttr": true,
|
9389
|
+
"docs": "",
|
9390
|
+
"docsTags": [],
|
9391
|
+
"default": "false",
|
9392
|
+
"values": [
|
9393
|
+
{
|
9394
|
+
"type": "boolean"
|
9395
|
+
}
|
9396
|
+
],
|
9397
|
+
"optional": false,
|
9398
|
+
"required": false
|
9399
|
+
}
|
9400
|
+
],
|
9401
|
+
"methods": [],
|
9402
|
+
"events": [
|
9403
|
+
{
|
9404
|
+
"event": "atomic/relevanceInspector/close",
|
9405
|
+
"detail": "any",
|
9406
|
+
"bubbles": true,
|
9407
|
+
"complexType": {
|
9408
|
+
"original": "any",
|
9409
|
+
"resolved": "any",
|
9410
|
+
"references": {}
|
9411
|
+
},
|
9412
|
+
"cancelable": true,
|
9413
|
+
"composed": true,
|
9414
|
+
"docs": "",
|
9415
|
+
"docsTags": []
|
9416
|
+
}
|
9417
|
+
],
|
9418
|
+
"listeners": [],
|
9419
|
+
"styles": [],
|
9420
|
+
"slots": [],
|
9421
|
+
"parts": [],
|
9422
|
+
"dependents": [],
|
9423
|
+
"dependencies": [],
|
9424
|
+
"dependencyGraph": {}
|
9425
|
+
},
|
9344
9426
|
{
|
9345
9427
|
"filePath": "src/components/search/atomic-result/atomic-result.tsx",
|
9346
9428
|
"encapsulation": "shadow",
|
@@ -15609,6 +15691,11 @@
|
|
15609
15691
|
"docstring": "",
|
15610
15692
|
"path": "src/utils/initialization-utils.tsx"
|
15611
15693
|
},
|
15694
|
+
"src/components/search/atomic-search-interface/atomic-search-interface.ts::Bindings": {
|
15695
|
+
"declaration": "export type Bindings = CommonBindings<\n SearchEngine,\n SearchStore,\n AtomicSearchInterface\n> &\n //TODO: KIT-4893 - Remove once atomic-quickview-modal migration is complete.\n NonceBindings;",
|
15696
|
+
"docstring": "",
|
15697
|
+
"path": "src/components/search/atomic-search-interface/atomic-search-interface.ts"
|
15698
|
+
},
|
15612
15699
|
"../headless/dist/definitions/index.d.ts::FoldedResult": {
|
15613
15700
|
"declaration": "any",
|
15614
15701
|
"docstring": "",
|
package/package.json
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"name": "@coveo/atomic",
|
3
3
|
"type": "module",
|
4
|
-
"version": "3.33.9-pre.
|
4
|
+
"version": "3.33.9-pre.eac38e190d",
|
5
5
|
"description": "A web-component library for building modern UIs interfacing with the Coveo platform",
|
6
6
|
"homepage": "https://docs.coveo.com/en/atomic/latest/",
|
7
7
|
"repository": {
|
@@ -1,100 +0,0 @@
|
|
1
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
2
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
3
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
4
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
5
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
6
|
-
};
|
7
|
-
import { getOrganizationEndpoint } from '@coveo/headless';
|
8
|
-
import { html, LitElement, nothing } from 'lit';
|
9
|
-
import { customElement, state } from 'lit/decorators.js';
|
10
|
-
import { renderButton } from "../../common/button";
|
11
|
-
import { withTailwindStyles } from "../../../decorators/with-tailwind-styles.js";
|
12
|
-
import "../../common/atomic-modal/atomic-modal";
|
13
|
-
import { bindingGuard } from "../../../decorators/binding-guard";
|
14
|
-
import { bindings } from "../../../decorators/bindings";
|
15
|
-
import { errorGuard } from "../../../decorators/error-guard";
|
16
|
-
/**
|
17
|
-
* The `atomic-relevance-inspector` component is used internally to offer insight on search page relevance, as well as information to help troubleshoot issues during development.
|
18
|
-
*
|
19
|
-
* @internal
|
20
|
-
*/
|
21
|
-
let AtomicRelevanceInspector = class AtomicRelevanceInspector extends LitElement {
|
22
|
-
constructor() {
|
23
|
-
super(...arguments);
|
24
|
-
this.open = false;
|
25
|
-
this.initialize = () => {
|
26
|
-
this.bindings.interfaceElement.addEventListener('dblclick', this.handleRelevanceInspectorDoubleClick);
|
27
|
-
};
|
28
|
-
this.handleRelevanceInspectorDoubleClick = (e) => {
|
29
|
-
if (e.altKey) {
|
30
|
-
this.open = !this.open;
|
31
|
-
}
|
32
|
-
};
|
33
|
-
}
|
34
|
-
disconnectedCallback() {
|
35
|
-
this.removeEventListener('dblclick', this.handleRelevanceInspectorDoubleClick);
|
36
|
-
}
|
37
|
-
render() {
|
38
|
-
return html `
|
39
|
-
<atomic-modal
|
40
|
-
.isOpen=${this.open}
|
41
|
-
@close=${() => this.handleCloseRelevanceInspector()}
|
42
|
-
exportparts="footer"
|
43
|
-
>
|
44
|
-
<p slot="header">Open the relevance inspector</p>
|
45
|
-
<p slot="body">
|
46
|
-
The Relevance Inspector will open in the Coveo Administration Console.
|
47
|
-
</p>
|
48
|
-
<div slot="footer" class="flex w-full items-center justify-end">
|
49
|
-
${renderButton({
|
50
|
-
props: {
|
51
|
-
style: 'outline-primary',
|
52
|
-
class: 'mr-2 p-2',
|
53
|
-
onClick: () => this.handleCloseRelevanceInspector(),
|
54
|
-
text: 'Ignore',
|
55
|
-
},
|
56
|
-
})(nothing)}
|
57
|
-
${renderButton({
|
58
|
-
props: {
|
59
|
-
style: 'primary',
|
60
|
-
class: 'p-2',
|
61
|
-
onClick: () => {
|
62
|
-
window.open(this.adminHref, '_blank');
|
63
|
-
this.handleCloseRelevanceInspector();
|
64
|
-
},
|
65
|
-
text: 'Open',
|
66
|
-
},
|
67
|
-
})(nothing)}
|
68
|
-
</div>
|
69
|
-
</atomic-modal>
|
70
|
-
`;
|
71
|
-
}
|
72
|
-
handleCloseRelevanceInspector() {
|
73
|
-
this.open = false;
|
74
|
-
}
|
75
|
-
get adminHref() {
|
76
|
-
const { organizationId, environment } = this.bindings.engine.state.configuration;
|
77
|
-
const admin = getOrganizationEndpoint(organizationId, environment, 'admin');
|
78
|
-
const { searchResponseId } = this.bindings.engine.state.search;
|
79
|
-
return `${admin}/admin/#/${organizationId}/search/relevanceInspector/${searchResponseId}`;
|
80
|
-
}
|
81
|
-
};
|
82
|
-
__decorate([
|
83
|
-
state()
|
84
|
-
], AtomicRelevanceInspector.prototype, "bindings", void 0);
|
85
|
-
__decorate([
|
86
|
-
state()
|
87
|
-
], AtomicRelevanceInspector.prototype, "error", void 0);
|
88
|
-
__decorate([
|
89
|
-
state()
|
90
|
-
], AtomicRelevanceInspector.prototype, "open", void 0);
|
91
|
-
__decorate([
|
92
|
-
bindingGuard(),
|
93
|
-
errorGuard()
|
94
|
-
], AtomicRelevanceInspector.prototype, "render", null);
|
95
|
-
AtomicRelevanceInspector = __decorate([
|
96
|
-
customElement('atomic-relevance-inspector'),
|
97
|
-
bindings(),
|
98
|
-
withTailwindStyles
|
99
|
-
], AtomicRelevanceInspector);
|
100
|
-
export { AtomicRelevanceInspector };
|
@@ -1 +0,0 @@
|
|
1
|
-
{"file":"result-template-common.js","mappings":";;;;;;SA0BgB,mBAAmB,CAAC,IAAU;IAC5C,IAAI,mBAAmB,CAAC,IAAI,CAAC,EAAE;QAC7B,OAAO,SAAS,CAAC;KAClB;IACD,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,EAAE;QACvB,OAAO,UAAU,CAAC;KACnB;IACD,IACE,aAAa,CAAC,IAAI,CAAC;QACnB,IAAI,CAAC,OAAO,CAAC,WAAW,EAAE,KAAK,mBAAmB,EAClD;QACA,OAAO,yBAAyB,CAAC;KAClC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC;AAED,SAAS,gBAAgB,CAAC,KAAe;IACvC,OAAO,SAAS,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,IAAI,KAAK,mBAAmB,CAAC,IAAI,CAAC,CAAC,CAAC;AAC3E,CAAC;MAEY,oBAAoB;IAK/B,YAAY,EACV,IAAI,EACJ,QAAQ,EACR,YAAY,EACZ,UAAU,GAAG,KAAK,GACQ;QARrB,oBAAe,GAA8B,EAAE,CAAC;QAC/C,uBAAkB,GAAe,OAAO,CAAC;QAQ/C,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,gBAAgB,CAAC,IAAI,EAAE,QAAQ,EAAE,YAAY,EAAE,UAAU,CAAC,CAAC;KACjE;IAED,gBAAgB,CACd,IAAoB,EACpB,QAAgC,EAChC,YAAsB,EACtB,UAAU,GAAG,IAAI;QAEjB,MAAM,cAAc,GAAG,YAAY;aAChC,GAAG,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,WAAW,EAAE,CAAC;aAC3B,QAAQ,CAAC,IAAI,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C7B,UAAU,CAAC,IAAI,CACb,sBAAsB,CAAC,cAAc,CAAC,KAAK,EAAE,SAAS,CAAC,KAAK,CAAC,CAAC,CAC/D,CAAC;KACH;IAED,KAAK,MAAM,KAAK,IAAI,YAAY,EAAE;QAChC,UAAU,CAAC,IAAI,CACb,sBAAsB,CAAC,iBAAiB,CAAC,KAAK,EAAE,YAAY,CAAC,KAAK,CAAC,CAAC,CACrE,CAAC;KACH;IACD,OAAO,UAAU,CAAC;AACpB,CAAC;SAEe,qBAAqB,CACnC,SAAkB,EAClB,YAAqB;IAErB,MAAM,UAAU,GAA8B,EAAE,CAAC;IACjD,IAAI,SAAS,EAAE;QACb,MAAM,UAAU,GAAG,SAAS,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QACxC,UAAU,CAAC,IAAI,CAAC,sBAAsB,CAAC,mBAAmB,CAAC,UAAU,CAAC,CAAC,CAAC;KACzE;IAED,IAAI,YAAY,EAAE;QAChB,MAAM,UAAU,GAAG,YAAY,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QAC3C,UAAU,CAAC,IAAI,CAAC,sBAAsB,CAAC,sBAAsB,CAAC,UAAU,CAAC,CAAC,CAAC;KAC5E;IACD,OAAO,UAAU,CAAC;AACpB;;;;","names":[],"sources":["src/components/common/result-templates/result-template-common.tsx"],"sourcesContent":["import {\n ResultTemplate,\n ResultTemplateCondition,\n ResultTemplatesHelpers,\n} from '@coveo/headless';\nimport {h} from '@stencil/core';\nimport {aggregate, isElementNode, isVisualNode} from '../../../utils/utils';\nimport {tableElementTagName} from '../../search/atomic-table-result/table-element-utils';\nimport {ItemTarget} from '../layout/display-options';\nimport {isResultSectionNode} from '../layout/sections';\n\nexport type TemplateContent = DocumentFragment;\n\ninterface ResultTemplateCommonProps {\n allowEmpty?: boolean;\n host: HTMLDivElement;\n validParents: string[];\n setError: (error: Error) => void;\n}\n\ntype TemplateNodeType =\n | 'section'\n | 'metadata'\n | 'table-column-definition'\n | 'other';\n\nexport function getTemplateNodeType(node: Node): TemplateNodeType {\n if (isResultSectionNode(node)) {\n return 'section';\n }\n if (!isVisualNode(node)) {\n return 'metadata';\n }\n if (\n isElementNode(node) &&\n node.tagName.toLowerCase() === tableElementTagName\n ) {\n return 'table-column-definition';\n }\n return 'other';\n}\n\nfunction groupNodesByType(nodes: NodeList) {\n return aggregate(Array.from(nodes), (node) => getTemplateNodeType(node));\n}\n\nexport class ResultTemplateCommon {\n private host: HTMLDivElement;\n public matchConditions: ResultTemplateCondition[] = [];\n private gridCellLinkTarget: ItemTarget = '_self';\n\n constructor({\n host,\n setError,\n validParents,\n allowEmpty = false,\n }: ResultTemplateCommonProps) {\n this.host = host;\n this.validateTemplate(host, setError, validParents, allowEmpty);\n }\n\n validateTemplate(\n host: HTMLDivElement,\n setError: (error: Error) => void,\n validParents: string[],\n allowEmpty = true\n ) {\n const hasValidParent = validParents\n .map((p) => p.toUpperCase())\n .includes(host.parentElement?.nodeName || '');\n const tagName = host.nodeName.toLowerCase();\n\n if (!hasValidParent) {\n setError(\n new Error(\n `The \"${tagName}\" component has to be the child of one of the following: ${validParents\n .map((p) => `\"${p.toLowerCase()}\"`)\n .join(', ')}.`\n )\n );\n return;\n }\n\n if (\n host.parentElement?.attributes.getNamedItem('display')?.value === 'grid'\n ) {\n this.gridCellLinkTarget = host.parentElement?.attributes.getNamedItem(\n 'grid-cell-link-target'\n )?.value as ItemTarget;\n }\n\n const template = host.querySelector<HTMLTemplateElement>(\n 'template:not([slot])'\n );\n if (!template) {\n setError(\n new Error(\n `The \"${tagName}\" component has to contain a \"template\" element as a child.`\n )\n );\n return;\n }\n\n if (!allowEmpty && !template.innerHTML.trim()) {\n setError(\n new Error(`The \"template\" tag inside \"${tagName}\" cannot be empty.`)\n );\n return;\n }\n\n if (template.content.querySelector('script')) {\n console.warn(\n 'Any \"script\" tags defined inside of \"template\" elements are not supported and will not be executed when the results are rendered.',\n host\n );\n }\n\n const {section: sectionNodes, other: otherNodes} = groupNodesByType(\n template.content.childNodes\n );\n if (sectionNodes?.length && otherNodes?.length) {\n console.warn(\n 'Result templates should only contain section elements or non-section elements. Future updates could unpredictably affect this result template.',\n host,\n {sectionNodes, otherNodes}\n );\n }\n }\n\n getTemplate(\n conditions: ResultTemplateCondition[],\n error: Error\n ): ResultTemplate<TemplateContent> | null {\n if (error) {\n return null;\n }\n\n return {\n conditions: conditions.concat(this.matchConditions),\n content: getTemplateElement(this.host).content!,\n linkContent: this.getLinkTemplateElement(this.host).content!,\n priority: 1,\n };\n }\n\n renderIfError(error: Error) {\n if (error) {\n return (\n <atomic-component-error\n element={this.host}\n error={error}\n ></atomic-component-error>\n );\n }\n }\n\n getDefaultLinkTemplateElement() {\n const linkTemplate = document.createElement('template');\n linkTemplate.innerHTML = `<atomic-result-link>${this.gridCellLinkTarget ? `<a slot=\"attributes\" target=\"${this.gridCellLinkTarget}\"></a>` : ''}</atomic-result-link>`;\n return linkTemplate;\n }\n\n getLinkTemplateElement(host: HTMLElement) {\n return (\n host.querySelector<HTMLTemplateElement>('template[slot=\"link\"]') ??\n this.getDefaultLinkTemplateElement()\n );\n }\n}\n\nfunction getTemplateElement(host: HTMLElement) {\n return host.querySelector<HTMLTemplateElement>('template:not([slot])')!;\n}\n\nexport function makeMatchConditions(\n mustMatch: Record<string, string[]>,\n mustNotMatch: Record<string, string[]>\n): ResultTemplateCondition[] {\n const conditions: ResultTemplateCondition[] = [];\n for (const field in mustMatch) {\n conditions.push(\n ResultTemplatesHelpers.fieldMustMatch(field, mustMatch[field])\n );\n }\n\n for (const field in mustNotMatch) {\n conditions.push(\n ResultTemplatesHelpers.fieldMustNotMatch(field, mustNotMatch[field])\n );\n }\n return conditions;\n}\n\nexport function makeDefinedConditions(\n ifDefined?: string,\n ifNotDefined?: string\n): ResultTemplateCondition[] {\n const conditions: ResultTemplateCondition[] = [];\n if (ifDefined) {\n const fieldNames = ifDefined.split(',');\n conditions.push(ResultTemplatesHelpers.fieldsMustBeDefined(fieldNames));\n }\n\n if (ifNotDefined) {\n const fieldNames = ifNotDefined.split(',');\n conditions.push(ResultTemplatesHelpers.fieldsMustNotBeDefined(fieldNames));\n }\n return conditions;\n}\n"],"version":3}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"names":["AtomicInsightResultTemplate","constructor","hostRef","this","matchConditions","conditions","mustMatch","mustNotMatch","connectedCallback","resultTemplateCommon","ResultTemplateCommon","host","setError","err","error","validParents","allowEmpty","componentWillLoad","makeDefinedConditions","ifDefined","ifNotDefined","makeMatchConditions","getTemplate","render","renderIfError","__decorate","MapProp","splitValues"],"sources":["src/components/insight/result-templates/atomic-insight-result-template/atomic-insight-result-template.tsx"],"sourcesContent":["import {\n ResultTemplate as InsightResultTemplate,\n ResultTemplateCondition as InsightResultTemplateCondition,\n} from '@coveo/headless/insight';\nimport {Component, Element, Prop, Method, State} from '@stencil/core';\nimport {MapProp} from '../../../../utils/props-utils';\nimport {\n makeDefinedConditions,\n makeMatchConditions,\n ResultTemplateCommon,\n} from '../../../common/result-templates/result-template-common';\n\n/**\n * @internal\n */\n@Component({\n tag: 'atomic-insight-result-template',\n shadow: true,\n})\nexport class AtomicInsightResultTemplate {\n private resultTemplateCommon!: ResultTemplateCommon;\n\n @State() public error!: Error;\n\n @Element() public host!: HTMLDivElement;\n public matchConditions: InsightResultTemplateCondition[] = [];\n\n /**\n * A function that must return true on results for the result template to apply.\n * Set programmatically before initialization, not via attribute.\n *\n * For example, the following targets a template and sets a condition to make it apply only to results whose `title` contains `singapore`:\n * `document.querySelector('#target-template').conditions = [(result) => /singapore/i.test(result.title)];`\n */\n @Prop() public conditions: InsightResultTemplateCondition[] = [];\n\n /**\n * The field that, when defined on a result item, would allow the template to be applied.\n *\n * For example, a template with the following attribute only applies to result items whose `filetype` and `sourcetype` fields are defined: `if-defined=\"filetype,sourcetype\"`\n */\n @Prop({reflect: true}) ifDefined?: string;\n\n /**\n * The field that, when defined on a result item, would prevent the template from being applied.\n *\n * For example, a template with the following attribute only applies to result items whose `filetype` and `sourcetype` fields are NOT defined: `if-not-defined=\"filetype,sourcetype\"`\n */\n @Prop({reflect: true}) ifNotDefined?: string;\n\n /**\n * The field and values that define which result items the condition must be applied to.\n *\n * For example, a template with the following attribute only applies to result items whose `filetype` is `lithiummessage` or `YouTubePlaylist`: `must-match-filetype=\"lithiummessage,YouTubePlaylist\"`\n */\n @Prop() @MapProp({splitValues: true}) public mustMatch: Record<\n string,\n string[]\n > = {};\n\n /**\n * The field and values that define which result items the condition must not be applied to.\n *\n * For example, a template with the following attribute only applies to result items whose `filetype` is not `lithiummessage`: `must-not-match-filetype=\"lithiummessage\"`\n */\n @Prop() @MapProp({splitValues: true}) public mustNotMatch: Record<\n string,\n string[]\n > = {};\n\n constructor() {}\n\n connectedCallback() {\n this.resultTemplateCommon = new ResultTemplateCommon({\n host: this.host,\n setError: (err) => {\n this.error = err;\n },\n validParents: [\n 'atomic-insight-result-list',\n 'atomic-insight-folded-result-list',\n ],\n allowEmpty: true,\n });\n }\n\n public componentWillLoad() {\n this.conditions = makeDefinedConditions(this.ifDefined, this.ifNotDefined);\n this.resultTemplateCommon.matchConditions = makeMatchConditions(\n this.mustMatch,\n this.mustNotMatch\n );\n }\n\n /**\n * Gets the appropriate result template based on conditions applied.\n */\n @Method()\n public async getTemplate(): Promise<InsightResultTemplate<DocumentFragment> | null> {\n return this.resultTemplateCommon.getTemplate(this.conditions, this.error);\n }\n\n public render() {\n return this.resultTemplateCommon.renderIfError(this.error);\n }\n}\n"],"mappings":"upBAmBaA,EAA2B,MAmDtC,WAAAC,CAAAC,G,UA7COC,KAAAC,gBAAoD,GAS5CD,KAAAE,WAA+C,GAqBjBF,KAAAG,UAGzC,GAOyCH,KAAAI,aAGzC,G,qCAlC0D,G,oEAwB1D,G,kBAUA,E,CAIJ,iBAAAC,GACEL,KAAKM,qBAAuB,IAAIC,EAAqB,CACnDC,KAAMR,KAAKQ,KACXC,SAAWC,IACTV,KAAKW,MAAQD,CAAG,EAElBE,aAAc,CACZ,6BACA,qCAEFC,WAAY,M,CAIT,iBAAAC,GACLd,KAAKE,WAAaa,EAAsBf,KAAKgB,UAAWhB,KAAKiB,cAC7DjB,KAAKM,qBAAqBL,gBAAkBiB,EAC1ClB,KAAKG,UACLH,KAAKI,a,CAQF,iBAAMe,GACX,OAAOnB,KAAKM,qBAAqBa,YAAYnB,KAAKE,WAAYF,KAAKW,M,CAG9D,MAAAS,GACL,OAAOpB,KAAKM,qBAAqBe,cAAcrB,KAAKW,M,6BAhDTW,EAAA,CAApCC,EAAQ,CAACC,YAAa,Q,gCAUcF,EAAA,CAApCC,EAAQ,CAACC,YAAa,Q","ignoreList":[]}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"names":["AtomicResultChildrenTemplate","constructor","hostRef","this","conditions","mustMatch","mustNotMatch","connectedCallback","resultTemplateCommon","ResultTemplateCommon","host","setError","err","error","validParents","getTemplate","componentWillLoad","matchConditions","makeMatchConditions","render","renderIfError","__decorate","MapProp","splitValues"],"sources":["src/components/search/result-templates/atomic-result-children-template/atomic-result-children-template.tsx"],"sourcesContent":["import {ResultTemplate, ResultTemplateCondition} from '@coveo/headless';\nimport {Component, Element, Prop, State, Method} from '@stencil/core';\nimport {MapProp} from '../../../../utils/props-utils';\nimport {\n makeMatchConditions,\n ResultTemplateCommon,\n} from '../../../common/result-templates/result-template-common';\n\n/**\n * The `atomic-result-children-template` component determines the format of the child results, depending on the conditions that are defined for each template. A `template` element must be the child of an `atomic-result-children-template`, and an `atomic-result-children` must be the parent of each `atomic-result-children-template`.\n *\n * Note: Any `<script>` tags defined inside of a `<template>` element will not be executed when results are being rendered.\n * @MapProp name: mustMatch;attr: must-match;docs: The field and values that define which result items the condition must be applied to. For example, a template with the following attribute only applies to result items whose `filetype` is `lithiummessage` or `YouTubePlaylist`: `must-match-filetype=\"lithiummessage,YouTubePlaylist\"`;type: Record<string, string[]> ;default: {}\n * @MapProp name: mustNotMatch;attr: must-not-match;docs: The field and values that define which result items the condition must not be applied to. For example, a template with the following attribute only applies to result items whose `filetype` is not `lithiummessage`: `must-not-match-filetype=\"lithiummessage\";type: Record<string, string[]> ;default: {}\n */\n@Component({\n tag: 'atomic-result-children-template',\n shadow: true,\n})\nexport class AtomicResultChildrenTemplate {\n @Element() public host!: HTMLDivElement;\n\n @State() public error!: Error;\n\n /**\n * A function that must return true on results for the result template to apply.\n * Set programmatically before initialization, not via attribute.\n *\n * For example, the following targets a template and sets a condition to make it apply only to results whose `title` contains `singapore`:\n * `document.querySelector('#target-template').conditions = [(result) => /singapore/i.test(result.title)];`\n */\n @Prop() public conditions: ResultTemplateCondition[] = [];\n\n /**\n * Verifies whether the specified fields match the specified values.\n * @type {Record<string, string[]>}\n */\n @Prop() @MapProp({splitValues: true}) public mustMatch: Record<\n string,\n string[]\n > = {};\n\n /**\n * Verifies whether the specified fields do not match the specified values.\n * @type {Record<string, string[]>}\n */\n @Prop() @MapProp({splitValues: true}) public mustNotMatch: Record<\n string,\n string[]\n > = {};\n\n public resultTemplateCommon!: ResultTemplateCommon;\n\n constructor() {}\n\n connectedCallback() {\n this.resultTemplateCommon = new ResultTemplateCommon({\n host: this.host,\n setError: (err) => {\n this.error = err;\n },\n validParents: ['atomic-result-children'],\n });\n }\n\n /**\n * Gets the appropriate result template based on conditions applied.\n */\n @Method()\n public async getTemplate(): Promise<ResultTemplate<DocumentFragment> | null> {\n return this.resultTemplateCommon.getTemplate(this.conditions, this.error);\n }\n\n public componentWillLoad() {\n this.resultTemplateCommon.matchConditions = makeMatchConditions(\n this.mustMatch,\n this.mustNotMatch\n );\n }\n\n public render() {\n return this.resultTemplateCommon.renderIfError(this.error);\n }\n}\n"],"mappings":"gpBAmBaA,EAA4B,MAkCvC,WAAAC,CAAAC,G,UAtBeC,KAAAC,WAAwC,GAMVD,KAAAE,UAGzC,GAMyCF,KAAAG,aAGzC,G,qCAlBmD,G,eASnD,G,kBASA,E,CAMJ,iBAAAC,GACEJ,KAAKK,qBAAuB,IAAIC,EAAqB,CACnDC,KAAMP,KAAKO,KACXC,SAAWC,IACTT,KAAKU,MAAQD,CAAG,EAElBE,aAAc,CAAC,2B,CAQZ,iBAAMC,GACX,OAAOZ,KAAKK,qBAAqBO,YAAYZ,KAAKC,WAAYD,KAAKU,M,CAG9D,iBAAAG,GACLb,KAAKK,qBAAqBS,gBAAkBC,EAC1Cf,KAAKE,UACLF,KAAKG,a,CAIF,MAAAa,GACL,OAAOhB,KAAKK,qBAAqBY,cAAcjB,KAAKU,M,6BA5CTQ,EAAA,CAApCC,EAAQ,CAACC,YAAa,Q,gCAScF,EAAA,CAApCC,EAAQ,CAACC,YAAa,Q","ignoreList":[]}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"names":["atomicFieldConditionCss","AtomicFieldConditionStyle0","AtomicFieldCondition","this","mustMatch","mustNotMatch","conditions","shouldBeRemoved","componentWillLoad","ifDefined","fieldNames","split","push","ResultTemplatesHelpers","fieldsMustBeDefined","ifNotDefined","fieldsMustNotBeDefined","makeMatchConditions","render","every","condition","result","h","componentDidLoad","host","remove","__decorate","MapProp","splitValues","ResultContext"],"sources":["src/components/search/result-template-components/atomic-field-condition/atomic-field-condition.pcss?tag=atomic-field-condition","src/components/search/result-template-components/atomic-field-condition/atomic-field-condition.tsx"],"sourcesContent":["atomic-field-condition {\n max-width: 100%;\n}\n","import {\n Result,\n ResultTemplateCondition,\n ResultTemplatesHelpers,\n} from '@coveo/headless';\nimport {Component, Prop, h, Element} from '@stencil/core';\nimport {MapProp} from '../../../../utils/props-utils';\nimport {makeMatchConditions} from '../../../common/result-templates/result-template-common';\nimport {ResultContext} from '../result-template-decorators';\n\n/**\n * The `atomic-field-condition` component takes a list of conditions that, if fulfilled, apply the template in which it's defined.\n * The condition properties can be based on any top-level result property of the `result` object, not restricted to fields (e.g., `isRecommendation`).\n *\n * @slot default - The content to display if the conditions are met.\n *\n * @MapProp name: mustMatch;attr: must-match;docs: The field and values that define which result items the condition must be applied to. For example, a template with the following attribute only applies to result items whose `filetype` is `lithiummessage` or `YouTubePlaylist`: `must-match-filetype=\"lithiummessage,YouTubePlaylist\"`;type: Record<string, string[]> ;default: {}\n * @MapProp name: mustNotMatch;attr: must-not-match;docs: The field and values that define which result items the condition must not be applied to. For example, a template with the following attribute only applies to result items whose `filetype` is not `lithiummessage`: `must-not-match-filetype=\"lithiummessage\";type: Record<string, string[]> ;default: {}\n */\n@Component({\n tag: 'atomic-field-condition',\n styleUrl: 'atomic-field-condition.pcss',\n shadow: false,\n})\nexport class AtomicFieldCondition {\n @Element() host!: HTMLElement;\n\n /**\n * Verifies whether the specified fields are defined.\n */\n @Prop({reflect: true}) ifDefined?: string;\n /**\n * Verifies whether the specified fields are not defined.\n */\n @Prop({reflect: true}) ifNotDefined?: string;\n\n /**\n * Verifies whether the specified fields match the specified values.\n * @type {Record<string, string[]>}\n */\n @Prop() @MapProp({splitValues: true}) mustMatch: Record<string, string[]> =\n {};\n\n /**\n * Verifies whether the specified fields do not match the specified values.\n * @type {Record<string, string[]>}\n */\n @Prop() @MapProp({splitValues: true}) mustNotMatch: Record<string, string[]> =\n {};\n\n private conditions: ResultTemplateCondition[] = [];\n private shouldBeRemoved = false;\n\n @ResultContext() private result!: Result;\n\n public componentWillLoad() {\n if (this.ifDefined) {\n const fieldNames = this.ifDefined.split(',');\n this.conditions.push(\n ResultTemplatesHelpers.fieldsMustBeDefined(fieldNames)\n );\n }\n\n if (this.ifNotDefined) {\n const fieldNames = this.ifNotDefined.split(',');\n this.conditions.push(\n ResultTemplatesHelpers.fieldsMustNotBeDefined(fieldNames)\n );\n }\n\n this.conditions.push(\n ...makeMatchConditions(this.mustMatch, this.mustNotMatch)\n );\n }\n\n public render() {\n if (!this.conditions.every((condition) => condition(this.result))) {\n this.shouldBeRemoved = true;\n return '';\n }\n\n return <slot />;\n }\n\n public componentDidLoad() {\n this.shouldBeRemoved && this.host.remove();\n }\n}\n"],"mappings":"4aAAA,MAAMA,EAA0B,yCAChC,MAAAC,EAAeD,E,iXCuBFE,EAAoB,M,yBAgBOC,KAAAC,UACpC,GAMoCD,KAAAE,aACpC,GAEMF,KAAAG,WAAwC,GACxCH,KAAAI,gBAAkB,M,oEAVxB,G,kBAOA,E,CAOK,iBAAAC,GACL,GAAIL,KAAKM,UAAW,CAClB,MAAMC,EAAaP,KAAKM,UAAUE,MAAM,KACxCR,KAAKG,WAAWM,KACdC,EAAuBC,oBAAoBJ,G,CAI/C,GAAIP,KAAKY,aAAc,CACrB,MAAML,EAAaP,KAAKY,aAAaJ,MAAM,KAC3CR,KAAKG,WAAWM,KACdC,EAAuBG,uBAAuBN,G,CAIlDP,KAAKG,WAAWM,QACXK,EAAoBd,KAAKC,UAAWD,KAAKE,c,CAIzC,MAAAa,GACL,IAAKf,KAAKG,WAAWa,OAAOC,GAAcA,EAAUjB,KAAKkB,UAAU,CACjElB,KAAKI,gBAAkB,KACvB,MAAO,E,CAGT,OAAOe,EAAA,Y,CAGF,gBAAAC,GACLpB,KAAKI,iBAAmBJ,KAAKqB,KAAKC,Q,6BA7CEC,EAAA,CAA7BC,EAAQ,CAACC,YAAa,Q,gCAOOF,EAAA,CAA7BC,EAAQ,CAACC,YAAa,Q,mCAMNF,EAAA,CAAxBG,K","ignoreList":[]}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"names":["AtomicRecsResultTemplate","constructor","hostRef","this","matchConditions","conditions","mustMatch","mustNotMatch","connectedCallback","resultTemplateCommon","ResultTemplateCommon","host","setError","err","error","validParents","allowEmpty","componentWillLoad","makeDefinedConditions","ifDefined","ifNotDefined","makeMatchConditions","getTemplate","render","renderIfError","__decorate","MapProp","splitValues"],"sources":["src/components/recommendations/atomic-recs-result-template/atomic-recs-result-template.tsx"],"sourcesContent":["import {\n ResultTemplateCondition as RecsResultTemplateCondition,\n ResultTemplate as RecsResultTemplate,\n} from '@coveo/headless/recommendation';\nimport {Component, Element, Prop, Method, State} from '@stencil/core';\nimport {MapProp} from '../../../utils/props-utils';\nimport {\n makeDefinedConditions,\n makeMatchConditions,\n ResultTemplateCommon,\n} from '../../common/result-templates/result-template-common';\n\n/**\n * A [result template](https://docs.coveo.com/en/atomic/latest/usage/displaying-results#defining-a-result-template) determines the format of the query results, depending on the conditions that are defined for each template.\n *\n * A `template` element must be the child of an `atomic-recs-result-template`, and an `atomic-recs-list` must be the parent of each `atomic-recs-result-template`.\n *\n * **Note:** Any `<script>` tags that are defined inside a `<template>` element will not be executed when the results are being rendered.\n * @MapProp name: mustMatch;attr: must-match;docs: The field and values that define which result items the condition must be applied to. For example, a template with the following attribute only applies to result items whose `filetype` is `lithiummessage` or `YouTubePlaylist`: `must-match-filetype=\"lithiummessage,YouTubePlaylist\"`;type: Record<string, string[]> ;default: {}\n * @MapProp name: mustNotMatch;attr: must-not-match;docs: The field and values that define which result items the condition must not be applied to. For example, a template with the following attribute only applies to result items whose `filetype` is not `lithiummessage`: `must-not-match-filetype=\"lithiummessage\";type: Record<string, string[]> ;default: {}\n */\n@Component({\n tag: 'atomic-recs-result-template',\n shadow: true,\n})\nexport class AtomicRecsResultTemplate {\n private resultTemplateCommon!: ResultTemplateCommon;\n\n @State() public error!: Error;\n\n @Element() public host!: HTMLDivElement;\n public matchConditions: RecsResultTemplateCondition[] = [];\n\n /**\n * A function that must return true on results for the result template to apply.\n * Set programmatically before initialization, not via attribute.\n *\n * For example, the following targets a template and sets a condition to make it apply only to results whose `title` contains `singapore`:\n * `document.querySelector('#target-template').conditions = [(result) => /singapore/i.test(result.title)];`\n */\n @Prop() public conditions: RecsResultTemplateCondition[] = [];\n\n /**\n * The field that, when defined on a result item, would allow the template to be applied.\n *\n * For example, a template with the following attribute only applies to result items whose `filetype` and `sourcetype` fields are defined: `if-defined=\"filetype,sourcetype\"`\n */\n @Prop({reflect: true}) ifDefined?: string;\n\n /**\n * The field that, when defined on a result item, would prevent the template from being applied.\n *\n * For example, a template with the following attribute only applies to result items whose `filetype` and `sourcetype` fields are NOT defined: `if-not-defined=\"filetype,sourcetype\"`\n */\n @Prop({reflect: true}) ifNotDefined?: string;\n\n /**\n * The field and values that define which result items the condition must be applied to.\n *\n * For example, a template with the following attribute only applies to result items whose `filetype` is `lithiummessage` or `YouTubePlaylist`: `must-match-filetype=\"lithiummessage,YouTubePlaylist\"`\n */\n @Prop() @MapProp({splitValues: true}) public mustMatch: Record<\n string,\n string[]\n > = {};\n\n /**\n * The field and values that define which result items the condition must not be applied to.\n *\n * For example, a template with the following attribute only applies to result items whose `filetype` is not `lithiummessage`: `must-not-match-filetype=\"lithiummessage\"`\n */\n @Prop() @MapProp({splitValues: true}) public mustNotMatch: Record<\n string,\n string[]\n > = {};\n\n constructor() {}\n\n connectedCallback() {\n this.resultTemplateCommon = new ResultTemplateCommon({\n host: this.host,\n setError: (err) => {\n this.error = err;\n },\n validParents: ['atomic-recs-list', 'atomic-ipx-recs-list'],\n allowEmpty: true,\n });\n }\n\n public componentWillLoad() {\n this.conditions = makeDefinedConditions(this.ifDefined, this.ifNotDefined);\n this.resultTemplateCommon.matchConditions = makeMatchConditions(\n this.mustMatch,\n this.mustNotMatch\n );\n }\n\n /**\n * Gets the appropriate result template based on the conditions applied.\n */\n @Method()\n public async getTemplate(): Promise<RecsResultTemplate<DocumentFragment> | null> {\n return this.resultTemplateCommon.getTemplate(this.conditions, this.error);\n }\n\n public render() {\n return this.resultTemplateCommon.renderIfError(this.error);\n }\n}\n"],"mappings":"upBAyBaA,EAAwB,MAmDnC,WAAAC,CAAAC,G,UA7COC,KAAAC,gBAAiD,GASzCD,KAAAE,WAA4C,GAqBdF,KAAAG,UAGzC,GAOyCH,KAAAI,aAGzC,G,qCAlCuD,G,oEAwBvD,G,kBAUA,E,CAIJ,iBAAAC,GACEL,KAAKM,qBAAuB,IAAIC,EAAqB,CACnDC,KAAMR,KAAKQ,KACXC,SAAWC,IACTV,KAAKW,MAAQD,CAAG,EAElBE,aAAc,CAAC,mBAAoB,wBACnCC,WAAY,M,CAIT,iBAAAC,GACLd,KAAKE,WAAaa,EAAsBf,KAAKgB,UAAWhB,KAAKiB,cAC7DjB,KAAKM,qBAAqBL,gBAAkBiB,EAC1ClB,KAAKG,UACLH,KAAKI,a,CAQF,iBAAMe,GACX,OAAOnB,KAAKM,qBAAqBa,YAAYnB,KAAKE,WAAYF,KAAKW,M,CAG9D,MAAAS,GACL,OAAOpB,KAAKM,qBAAqBe,cAAcrB,KAAKW,M,6BA7CTW,EAAA,CAApCC,EAAQ,CAACC,YAAa,Q,gCAUcF,EAAA,CAApCC,EAAQ,CAACC,YAAa,Q","ignoreList":[]}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"names":["AtomicResultTemplate","constructor","hostRef","this","conditions","mustMatch","mustNotMatch","connectedCallback","resultTemplateCommon","ResultTemplateCommon","host","setError","err","error","validParents","allowEmpty","componentWillLoad","matchConditions","makeMatchConditions","getTemplate","render","renderIfError","__decorate","MapProp","splitValues"],"sources":["src/components/search/result-templates/atomic-result-template/atomic-result-template.tsx"],"sourcesContent":["import {ResultTemplate, ResultTemplateCondition} from '@coveo/headless';\nimport {Component, Element, Prop, Method, State} from '@stencil/core';\nimport {MapProp} from '../../../../utils/props-utils';\nimport {\n makeMatchConditions,\n ResultTemplateCommon,\n} from '../../../common/result-templates/result-template-common';\n\n/**\n * A [result template](https://docs.coveo.com/en/atomic/latest/usage/displaying-results#defining-a-result-template) determines the format of the query results, depending on the conditions that are defined for each template.\n *\n * @slot default - Mandatory. A `template` element that defines the structure of the result item.\n * @slot link - A `template` element that contains a single `atomic-result-link` component.\n *\n * **Note:** Any `<script>` tags that are defined inside a `<template>` element will not be executed when the results are being rendered.\n * @MapProp name: mustMatch;attr: must-match;docs: The field and values that define which result items the condition must be applied to. For example, a template with the following attribute only applies to result items whose `filetype` is `lithiummessage` or `YouTubePlaylist`: `must-match-filetype=\"lithiummessage,YouTubePlaylist\"`;type: Record<string, string[]> ;default: {}\n * @MapProp name: mustNotMatch;attr: must-not-match;docs: The field and values that define which result items the condition must not be applied to. For example, a template with the following attribute only applies to result items whose `filetype` is not `lithiummessage`: `must-not-match-filetype=\"lithiummessage\";type: Record<string, string[]> ;default: {}\n */\n@Component({\n tag: 'atomic-result-template',\n shadow: true,\n})\nexport class AtomicResultTemplate {\n private resultTemplateCommon!: ResultTemplateCommon;\n\n @State() public error!: Error;\n\n @Element() public host!: HTMLDivElement;\n\n /**\n * A function that must return true on results for the result template to apply.\n * Set programmatically before initialization, not via attribute.\n *\n * For example, the following targets a template and sets a condition to make it apply only to results whose `title` contains `singapore`:\n * `document.querySelector('#target-template').conditions = [(result) => /singapore/i.test(result.title)];`\n */\n @Prop() public conditions: ResultTemplateCondition[] = [];\n\n /**\n * Verifies whether the specified fields match the specified values.\n * @type {Record<string, string[]>}\n */\n @Prop() @MapProp({splitValues: true}) public mustMatch: Record<\n string,\n string[]\n > = {};\n\n /**\n * Verifies whether the specified fields do not match the specified values.\n * @type {Record<string, string[]>}\n */\n @Prop() @MapProp({splitValues: true}) public mustNotMatch: Record<\n string,\n string[]\n > = {};\n\n constructor() {}\n\n connectedCallback() {\n this.resultTemplateCommon = new ResultTemplateCommon({\n host: this.host,\n setError: (err) => {\n this.error = err;\n },\n validParents: [\n 'atomic-result-list',\n 'atomic-folded-result-list',\n 'atomic-search-box-instant-results',\n ],\n allowEmpty: true,\n });\n }\n\n public componentWillLoad() {\n this.resultTemplateCommon.matchConditions = makeMatchConditions(\n this.mustMatch,\n this.mustNotMatch\n );\n }\n\n /**\n * Gets the appropriate result template based on conditions applied.\n */\n @Method()\n public async getTemplate(): Promise<ResultTemplate<DocumentFragment> | null> {\n return this.resultTemplateCommon.getTemplate(this.conditions, this.error);\n }\n\n public render() {\n return this.resultTemplateCommon.renderIfError(this.error);\n }\n}\n"],"mappings":"gpBAsBaA,EAAoB,MAkC/B,WAAAC,CAAAC,G,UApBeC,KAAAC,WAAwC,GAMVD,KAAAE,UAGzC,GAMyCF,KAAAG,aAGzC,G,qCAlBmD,G,eASnD,G,kBASA,E,CAIJ,iBAAAC,GACEJ,KAAKK,qBAAuB,IAAIC,EAAqB,CACnDC,KAAMP,KAAKO,KACXC,SAAWC,IACTT,KAAKU,MAAQD,CAAG,EAElBE,aAAc,CACZ,qBACA,4BACA,qCAEFC,WAAY,M,CAIT,iBAAAC,GACLb,KAAKK,qBAAqBS,gBAAkBC,EAC1Cf,KAAKE,UACLF,KAAKG,a,CAQF,iBAAMa,GACX,OAAOhB,KAAKK,qBAAqBW,YAAYhB,KAAKC,WAAYD,KAAKU,M,CAG9D,MAAAO,GACL,OAAOjB,KAAKK,qBAAqBa,cAAclB,KAAKU,M,6BA/CTS,EAAA,CAApCC,EAAQ,CAACC,YAAa,Q,gCAScF,EAAA,CAApCC,EAAQ,CAACC,YAAa,Q","ignoreList":[]}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"names":["AtomicInsightResultChildrenTemplate","constructor","hostRef","this","conditions","mustMatch","mustNotMatch","connectedCallback","resultTemplateCommon","ResultTemplateCommon","host","setError","err","error","validParents","componentWillLoad","makeDefinedConditions","ifDefined","ifNotDefined","matchConditions","makeMatchConditions","getTemplate","render","renderIfError","__decorate","MapProp","splitValues"],"sources":["src/components/insight/result-templates/atomic-insight-result-children-template/atomic-insight-result-children-template.tsx"],"sourcesContent":["import {ResultTemplate, ResultTemplateCondition} from '@coveo/headless';\nimport {Component, Element, Prop, State, Method} from '@stencil/core';\nimport {MapProp} from '../../../../utils/props-utils';\nimport {\n makeDefinedConditions,\n makeMatchConditions,\n ResultTemplateCommon,\n} from '../../../common/result-templates/result-template-common';\n\n/**\n * @internal\n */\n@Component({\n tag: 'atomic-insight-result-children-template',\n shadow: true,\n})\nexport class AtomicInsightResultChildrenTemplate {\n @Element() public host!: HTMLDivElement;\n\n @State() public error!: Error;\n\n /**\n * A function that must return true on results for the result template to apply.\n * Set programmatically before initialization, not via attribute.\n *\n * For example, the following targets a template and sets a condition to make it apply only to results whose `title` contains `singapore`:\n * `document.querySelector('#target-template').conditions = [(result) => /singapore/i.test(result.title)];`\n */\n @Prop() public conditions: ResultTemplateCondition[] = [];\n\n /**\n * The field that, when defined on a result item, would allow the template to be applied.\n *\n * For example, a template with the following attribute only applies to result items whose `filetype` and `sourcetype` fields are defined: `if-defined=\"filetype,sourcetype\"`\n */\n @Prop({reflect: true}) ifDefined?: string;\n\n /**\n * The field that, when defined on a result item, would prevent the template from being applied.\n *\n * For example, a template with the following attribute only applies to result items whose `filetype` and `sourcetype` fields are NOT defined: `if-not-defined=\"filetype,sourcetype\"`\n */\n @Prop({reflect: true}) ifNotDefined?: string;\n\n /**\n * The field and values that define which result items the condition must be applied to.\n *\n * For example, a template with the following attribute only applies to result items whose `filetype` is `lithiummessage` or `YouTubePlaylist`: `must-match-filetype=\"lithiummessage,YouTubePlaylist\"`\n */\n @Prop() @MapProp({splitValues: true}) public mustMatch: Record<\n string,\n string[]\n > = {};\n\n /**\n * The field and values that define which result items the condition must not be applied to.\n *\n * For example, a template with the following attribute only applies to result items whose `filetype` is not `lithiummessage`: `must-not-match-filetype=\"lithiummessage\"`\n */\n @Prop() @MapProp({splitValues: true}) public mustNotMatch: Record<\n string,\n string[]\n > = {};\n\n public resultTemplateCommon!: ResultTemplateCommon;\n\n constructor() {}\n\n connectedCallback() {\n this.resultTemplateCommon = new ResultTemplateCommon({\n host: this.host,\n setError: (err) => {\n this.error = err;\n },\n validParents: ['atomic-insight-result-children'],\n });\n }\n\n public componentWillLoad() {\n this.conditions = makeDefinedConditions(this.ifDefined, this.ifNotDefined);\n this.resultTemplateCommon.matchConditions = makeMatchConditions(\n this.mustMatch,\n this.mustNotMatch\n );\n }\n\n /**\n * Gets the appropriate result template based on conditions applied.\n */\n @Method()\n public async getTemplate(): Promise<ResultTemplate<DocumentFragment> | null> {\n return this.resultTemplateCommon.getTemplate(this.conditions, this.error);\n }\n\n public render() {\n return this.resultTemplateCommon.renderIfError(this.error);\n }\n}\n"],"mappings":"upBAgBaA,EAAmC,MAkD9C,WAAAC,CAAAC,G,UAtCeC,KAAAC,WAAwC,GAqBVD,KAAAE,UAGzC,GAOyCF,KAAAG,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aggregate","h","ResultTemplatesHelpers"],"sources":["src/components/common/result-templates/result-template-common.tsx"],"sourcesContent":["import {\n ResultTemplate,\n ResultTemplateCondition,\n ResultTemplatesHelpers,\n} from '@coveo/headless';\nimport {h} from '@stencil/core';\nimport {aggregate, isElementNode, isVisualNode} from '../../../utils/utils';\nimport {tableElementTagName} from '../../search/atomic-table-result/table-element-utils';\nimport {ItemTarget} from '../layout/display-options';\nimport {isResultSectionNode} from '../layout/sections';\n\nexport type TemplateContent = DocumentFragment;\n\ninterface ResultTemplateCommonProps {\n allowEmpty?: boolean;\n host: HTMLDivElement;\n validParents: string[];\n setError: (error: Error) => void;\n}\n\ntype TemplateNodeType =\n | 'section'\n | 'metadata'\n | 'table-column-definition'\n | 'other';\n\nexport function getTemplateNodeType(node: Node): TemplateNodeType {\n if (isResultSectionNode(node)) {\n return 'section';\n }\n if (!isVisualNode(node)) {\n return 'metadata';\n }\n if (\n isElementNode(node) &&\n node.tagName.toLowerCase() === tableElementTagName\n ) {\n return 'table-column-definition';\n }\n return 'other';\n}\n\nfunction groupNodesByType(nodes: NodeList) {\n return aggregate(Array.from(nodes), (node) => getTemplateNodeType(node));\n}\n\nexport class ResultTemplateCommon {\n private host: HTMLDivElement;\n public matchConditions: ResultTemplateCondition[] = [];\n private gridCellLinkTarget: ItemTarget = '_self';\n\n constructor({\n host,\n setError,\n validParents,\n allowEmpty = false,\n }: ResultTemplateCommonProps) {\n this.host = host;\n this.validateTemplate(host, setError, validParents, allowEmpty);\n }\n\n validateTemplate(\n host: HTMLDivElement,\n setError: (error: Error) => void,\n validParents: string[],\n allowEmpty = true\n ) {\n const hasValidParent = validParents\n .map((p) => p.toUpperCase())\n .includes(host.parentElement?.nodeName || '');\n const tagName = host.nodeName.toLowerCase();\n\n if (!hasValidParent) {\n setError(\n new Error(\n `The \"${tagName}\" component has to be the child of one of the following: ${validParents\n .map((p) => `\"${p.toLowerCase()}\"`)\n .join(', ')}.`\n )\n );\n return;\n }\n\n if (\n host.parentElement?.attributes.getNamedItem('display')?.value === 'grid'\n ) {\n this.gridCellLinkTarget = host.parentElement?.attributes.getNamedItem(\n 'grid-cell-link-target'\n )?.value as ItemTarget;\n }\n\n const template = host.querySelector<HTMLTemplateElement>(\n 'template:not([slot])'\n );\n if (!template) {\n setError(\n new Error(\n `The \"${tagName}\" component has to contain a \"template\" element as a child.`\n )\n );\n return;\n }\n\n if (!allowEmpty && !template.innerHTML.trim()) {\n setError(\n new Error(`The \"template\" tag inside \"${tagName}\" cannot be empty.`)\n );\n return;\n }\n\n if (template.content.querySelector('script')) {\n console.warn(\n 'Any \"script\" tags defined inside of \"template\" elements are not supported and will not be executed when the results are rendered.',\n host\n );\n }\n\n const {section: sectionNodes, other: otherNodes} = groupNodesByType(\n template.content.childNodes\n );\n if (sectionNodes?.length && otherNodes?.length) {\n console.warn(\n 'Result templates should only contain section elements or non-section elements. Future updates could unpredictably affect this result template.',\n host,\n {sectionNodes, otherNodes}\n );\n }\n }\n\n getTemplate(\n conditions: ResultTemplateCondition[],\n error: Error\n ): ResultTemplate<TemplateContent> | null {\n if (error) {\n return null;\n }\n\n return {\n conditions: conditions.concat(this.matchConditions),\n content: getTemplateElement(this.host).content!,\n linkContent: this.getLinkTemplateElement(this.host).content!,\n priority: 1,\n };\n }\n\n renderIfError(error: Error) {\n if (error) {\n return (\n <atomic-component-error\n element={this.host}\n error={error}\n ></atomic-component-error>\n );\n }\n }\n\n getDefaultLinkTemplateElement() {\n const linkTemplate = document.createElement('template');\n linkTemplate.innerHTML = `<atomic-result-link>${this.gridCellLinkTarget ? `<a slot=\"attributes\" target=\"${this.gridCellLinkTarget}\"></a>` : ''}</atomic-result-link>`;\n return linkTemplate;\n }\n\n getLinkTemplateElement(host: HTMLElement) {\n return (\n host.querySelector<HTMLTemplateElement>('template[slot=\"link\"]') ??\n this.getDefaultLinkTemplateElement()\n );\n }\n}\n\nfunction getTemplateElement(host: HTMLElement) {\n return host.querySelector<HTMLTemplateElement>('template:not([slot])')!;\n}\n\nexport function makeMatchConditions(\n mustMatch: Record<string, string[]>,\n mustNotMatch: Record<string, string[]>\n): ResultTemplateCondition[] {\n const conditions: ResultTemplateCondition[] = [];\n for (const field in mustMatch) {\n conditions.push(\n ResultTemplatesHelpers.fieldMustMatch(field, mustMatch[field])\n );\n }\n\n for (const field in mustNotMatch) {\n conditions.push(\n ResultTemplatesHelpers.fieldMustNotMatch(field, mustNotMatch[field])\n );\n }\n return conditions;\n}\n\nexport function makeDefinedConditions(\n ifDefined?: string,\n ifNotDefined?: string\n): ResultTemplateCondition[] {\n const conditions: ResultTemplateCondition[] = [];\n if (ifDefined) {\n const fieldNames = ifDefined.split(',');\n conditions.push(ResultTemplatesHelpers.fieldsMustBeDefined(fieldNames));\n }\n\n if (ifNotDefined) {\n const fieldNames = ifNotDefined.split(',');\n conditions.push(ResultTemplatesHelpers.fieldsMustNotBeDefined(fieldNames));\n }\n return conditions;\n}\n"],"version":3}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"file":"result-template-common-ac9fecab.js","mappings":";;;;;;SA0BgB,mBAAmB,CAAC,IAAU;IAC5C,IAAI,mBAAmB,CAAC,IAAI,CAAC,EAAE;QAC7B,OAAO,SAAS,CAAC;KAClB;IACD,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,EAAE;QACvB,OAAO,UAAU,CAAC;KACnB;IACD,IACE,aAAa,CAAC,IAAI,CAAC;QACnB,IAAI,CAAC,OAAO,CAAC,WAAW,EAAE,KAAK,mBAAmB,EAClD;QACA,OAAO,yBAAyB,CAAC;KAClC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC;AAED,SAAS,gBAAgB,CAAC,KAAe;IACvC,OAAO,SAAS,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,IAAI,KAAK,mBAAmB,CAAC,IAAI,CAAC,CAAC,CAAC;AAC3E,CAAC;MAEY,oBAAoB;IAK/B,YAAY,EACV,IAAI,EACJ,QAAQ,EACR,YAAY,EACZ,UA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common.tsx"],"sourcesContent":["import {\n ResultTemplate,\n ResultTemplateCondition,\n ResultTemplatesHelpers,\n} from '@coveo/headless';\nimport {h} from '@stencil/core';\nimport {aggregate, isElementNode, isVisualNode} from '../../../utils/utils';\nimport {tableElementTagName} from '../../search/atomic-table-result/table-element-utils';\nimport {ItemTarget} from '../layout/display-options';\nimport {isResultSectionNode} from '../layout/sections';\n\nexport type TemplateContent = DocumentFragment;\n\ninterface ResultTemplateCommonProps {\n allowEmpty?: boolean;\n host: HTMLDivElement;\n validParents: string[];\n setError: (error: Error) => void;\n}\n\ntype TemplateNodeType =\n | 'section'\n | 'metadata'\n | 'table-column-definition'\n | 'other';\n\nexport function getTemplateNodeType(node: Node): TemplateNodeType {\n if (isResultSectionNode(node)) {\n return 'section';\n }\n if (!isVisualNode(node)) {\n return 'metadata';\n }\n if (\n isElementNode(node) &&\n node.tagName.toLowerCase() === tableElementTagName\n ) {\n return 'table-column-definition';\n }\n return 'other';\n}\n\nfunction groupNodesByType(nodes: NodeList) {\n return aggregate(Array.from(nodes), (node) => getTemplateNodeType(node));\n}\n\nexport class ResultTemplateCommon {\n private host: HTMLDivElement;\n public matchConditions: ResultTemplateCondition[] = [];\n private gridCellLinkTarget: ItemTarget = '_self';\n\n constructor({\n host,\n setError,\n validParents,\n allowEmpty = false,\n }: ResultTemplateCommonProps) {\n this.host = host;\n this.validateTemplate(host, setError, validParents, allowEmpty);\n }\n\n validateTemplate(\n host: HTMLDivElement,\n setError: (error: Error) => void,\n validParents: string[],\n allowEmpty = true\n ) {\n const hasValidParent = validParents\n .map((p) => p.toUpperCase())\n .includes(host.parentElement?.nodeName || '');\n const tagName = host.nodeName.toLowerCase();\n\n if (!hasValidParent) {\n setError(\n new Error(\n `The \"${tagName}\" component has to be the child of one of the following: ${validParents\n .map((p) => `\"${p.toLowerCase()}\"`)\n .join(', ')}.`\n )\n );\n return;\n }\n\n if (\n host.parentElement?.attributes.getNamedItem('display')?.value === 'grid'\n ) {\n this.gridCellLinkTarget = host.parentElement?.attributes.getNamedItem(\n 'grid-cell-link-target'\n )?.value as ItemTarget;\n }\n\n const template = host.querySelector<HTMLTemplateElement>(\n 'template:not([slot])'\n );\n if (!template) {\n setError(\n new Error(\n `The \"${tagName}\" component has to contain a \"template\" element as a child.`\n )\n );\n return;\n }\n\n if (!allowEmpty && !template.innerHTML.trim()) {\n setError(\n new Error(`The \"template\" tag inside \"${tagName}\" cannot be empty.`)\n );\n return;\n }\n\n if (template.content.querySelector('script')) {\n console.warn(\n 'Any \"script\" tags defined inside of \"template\" elements are not supported and will not be executed when the results are rendered.',\n host\n );\n }\n\n const {section: sectionNodes, other: otherNodes} = groupNodesByType(\n template.content.childNodes\n );\n if (sectionNodes?.length && otherNodes?.length) {\n console.warn(\n 'Result templates should only contain section elements or non-section elements. Future updates could unpredictably affect this result template.',\n host,\n {sectionNodes, otherNodes}\n );\n }\n }\n\n getTemplate(\n conditions: ResultTemplateCondition[],\n error: Error\n ): ResultTemplate<TemplateContent> | null {\n if (error) {\n return null;\n }\n\n return {\n conditions: conditions.concat(this.matchConditions),\n content: getTemplateElement(this.host).content!,\n linkContent: this.getLinkTemplateElement(this.host).content!,\n priority: 1,\n };\n }\n\n renderIfError(error: Error) {\n if (error) {\n return (\n <atomic-component-error\n element={this.host}\n error={error}\n ></atomic-component-error>\n );\n }\n }\n\n getDefaultLinkTemplateElement() {\n const linkTemplate = document.createElement('template');\n linkTemplate.innerHTML = `<atomic-result-link>${this.gridCellLinkTarget ? `<a slot=\"attributes\" target=\"${this.gridCellLinkTarget}\"></a>` : ''}</atomic-result-link>`;\n return linkTemplate;\n }\n\n getLinkTemplateElement(host: HTMLElement) {\n return (\n host.querySelector<HTMLTemplateElement>('template[slot=\"link\"]') ??\n this.getDefaultLinkTemplateElement()\n );\n }\n}\n\nfunction getTemplateElement(host: HTMLElement) {\n return host.querySelector<HTMLTemplateElement>('template:not([slot])')!;\n}\n\nexport function makeMatchConditions(\n mustMatch: Record<string, string[]>,\n mustNotMatch: Record<string, string[]>\n): ResultTemplateCondition[] {\n const conditions: ResultTemplateCondition[] = [];\n for (const field in mustMatch) {\n conditions.push(\n ResultTemplatesHelpers.fieldMustMatch(field, mustMatch[field])\n );\n }\n\n for (const field in mustNotMatch) {\n conditions.push(\n ResultTemplatesHelpers.fieldMustNotMatch(field, mustNotMatch[field])\n );\n }\n return conditions;\n}\n\nexport function makeDefinedConditions(\n ifDefined?: string,\n ifNotDefined?: string\n): ResultTemplateCondition[] {\n const conditions: ResultTemplateCondition[] = [];\n if (ifDefined) {\n const fieldNames = ifDefined.split(',');\n conditions.push(ResultTemplatesHelpers.fieldsMustBeDefined(fieldNames));\n }\n\n if (ifNotDefined) {\n const fieldNames = ifNotDefined.split(',');\n conditions.push(ResultTemplatesHelpers.fieldsMustNotBeDefined(fieldNames));\n }\n return conditions;\n}\n"],"version":3}
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|