@coveo/atomic 3.33.7-pre.f339e5b2e0 → 3.33.7-pre.f5f219c071
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 +0 -2
- package/dist/atomic/components/_index.js +0 -1
- 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-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-query-summary.js +47 -2
- package/dist/atomic/components/atomic-insight-query-summary.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-refine-modal2.js +1 -1
- package/dist/atomic/components/atomic-refine-toggle.js +1 -1
- package/dist/atomic/components/atomic-relevance-inspector2.js +2 -2
- 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-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 +4 -4
- 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/commerce/atomic-commerce-query-summary/atomic-commerce-query-summary.js +1 -1
- package/dist/atomic/components/components/search/atomic-query-summary/atomic-query-summary.js +104 -0
- package/dist/atomic/components/components/search/atomic-results-per-page/atomic-results-per-page.js +2 -2
- package/dist/atomic/components/components/search/index.js +1 -0
- package/dist/atomic/components/components/search/lazy-index.js +1 -0
- package/dist/atomic/components/global/environment.js +1 -1
- package/dist/atomic/components/index.js.map +1 -1
- package/dist/atomic/{p-a59c4d49.entry.js → p-06465d20.entry.js} +2 -2
- package/dist/atomic/{p-e57a49d5.entry.js → p-0be0c9d9.entry.js} +2 -2
- package/dist/atomic/{p-b0bd2709.entry.js → p-156aa33a.entry.js} +2 -2
- package/dist/atomic/p-1afa7711.entry.js +2 -0
- package/dist/atomic/p-1afa7711.entry.js.map +1 -0
- package/dist/atomic/{p-bfdecd0f.entry.js → p-1d8eba10.entry.js} +2 -2
- package/dist/atomic/p-256b5495.entry.js +2 -0
- package/dist/atomic/{p-f32dbc1d.entry.js → p-312922a0.entry.js} +2 -2
- package/dist/atomic/{p-26b30352.entry.js → p-367b575e.entry.js} +2 -2
- package/dist/atomic/{p-1246be0e.entry.js → p-38346ea7.entry.js} +2 -2
- package/dist/atomic/{p-8c714a2a.entry.js → p-3fbd4bc9.entry.js} +2 -2
- package/dist/atomic/{p-d5326c89.entry.js → p-4e49a6d0.entry.js} +2 -2
- package/dist/atomic/{p-8ed5d217.entry.js → p-56df61fd.entry.js} +2 -2
- package/dist/atomic/{p-a113bf37.entry.js → p-63b4a863.entry.js} +2 -2
- package/dist/atomic/{p-09924944.entry.js → p-681610d3.entry.js} +2 -2
- package/dist/atomic/{p-7ffe752b.entry.js → p-a3c64c2a.entry.js} +2 -2
- package/dist/atomic/{p-e40a763b.entry.js → p-a506e2e3.entry.js} +2 -2
- package/dist/atomic/{p-97bbac20.entry.js → p-ad3fcff7.entry.js} +2 -2
- package/dist/atomic/{p-f24267a9.entry.js → p-b7bf0850.entry.js} +2 -2
- package/dist/atomic/{p-633628d5.entry.js → p-cbeca949.entry.js} +2 -2
- package/dist/atomic/{p-5f694374.entry.js → p-cc45e03c.entry.js} +2 -2
- package/dist/atomic/{p-391830cc.entry.js → p-d970a070.entry.js} +2 -2
- package/dist/atomic/{p-1e0ecf71.entry.js → p-dd44f42d.entry.js} +2 -2
- package/dist/atomic/{p-42101a1d.entry.js → p-ea9e09d5.entry.js} +2 -2
- package/dist/atomic/{p-eb4911ef.js → p-f1916a8e.js} +2 -2
- package/dist/atomic/{p-1891a142.entry.js → p-f2071b81.entry.js} +2 -2
- package/dist/atomic/{p-cf878415.entry.js → p-f91ee8ae.entry.js} +2 -2
- package/dist/atomic/{p-6e10a3e0.entry.js → p-fc950da3.entry.js} +2 -2
- package/dist/cjs/_loader.cjs.js +1 -1
- package/dist/cjs/{analytics-config-55453ba8.js → analytics-config-93f53412.js} +2 -2
- package/dist/cjs/{analytics-config-55453ba8.js.map → analytics-config-93f53412.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-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-query-summary.cjs.entry.js +48 -3
- package/dist/cjs/atomic-insight-query-summary.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-refine-modal.cjs.entry.js +1 -1
- package/dist/cjs/atomic-refine-toggle.cjs.entry.js +1 -1
- package/dist/cjs/atomic-relevance-inspector.cjs.entry.js +2 -2
- 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-search-box-query-suggestions_2.cjs.entry.js +2 -2
- package/dist/cjs/atomic-search-box.cjs.entry.js +4 -4
- package/dist/cjs/atomic-search-interface.cjs.entry.js +1 -1
- 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 +0 -4
- package/dist/cjs/version.cjs.js +2 -2
- package/dist/esm/_loader.js +1 -1
- package/dist/esm/{analytics-config-794c1038.js → analytics-config-963fd113.js} +2 -2
- package/dist/esm/{analytics-config-794c1038.js.map → analytics-config-963fd113.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-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-query-summary.entry.js +47 -2
- package/dist/esm/atomic-insight-query-summary.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-refine-modal.entry.js +1 -1
- package/dist/esm/atomic-refine-toggle.entry.js +1 -1
- package/dist/esm/atomic-relevance-inspector.entry.js +2 -2
- 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-search-box-query-suggestions_2.entry.js +2 -2
- package/dist/esm/atomic-search-box.entry.js +4 -4
- package/dist/esm/atomic-search-interface.entry.js +1 -1
- 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 +0 -4
- package/dist/esm/version.js +2 -2
- package/dist/types/components/commerce/atomic-commerce-query-summary/atomic-commerce-query-summary.d.ts +1 -1
- package/dist/types/components/search/atomic-query-summary/atomic-query-summary.d.ts +18 -8
- package/dist/types/components/search/index.d.ts +1 -0
- package/dist/types/components.d.ts +0 -25
- package/docs/atomic-docs.json +1 -61
- package/package.json +3 -3
- package/dist/atomic/components/atomic-query-summary.d.ts +0 -11
- package/dist/atomic/components/atomic-query-summary.js +0 -80
- package/dist/atomic/components/atomic-query-summary.js.map +0 -1
- package/dist/atomic/components/stencil-utils.js +0 -51
- package/dist/atomic/components/stencil-utils.js.map +0 -1
- package/dist/atomic/p-4c458f4f.entry.js +0 -2
- package/dist/atomic/p-4c458f4f.entry.js.map +0 -1
- package/dist/atomic/p-52121e1e.entry.js +0 -2
- package/dist/atomic/p-94d24701.js +0 -2
- package/dist/atomic/p-94d24701.js.map +0 -1
- package/dist/atomic/p-db929bc4.entry.js +0 -2
- package/dist/atomic/p-db929bc4.entry.js.map +0 -1
- package/dist/cjs/atomic-query-summary.cjs.entry.js +0 -70
- package/dist/cjs/atomic-query-summary.cjs.entry.js.map +0 -1
- package/dist/cjs/stencil-utils-9078a8de.js +0 -55
- package/dist/cjs/stencil-utils-9078a8de.js.map +0 -1
- package/dist/esm/atomic-query-summary.entry.js +0 -66
- package/dist/esm/atomic-query-summary.entry.js.map +0 -1
- package/dist/esm/stencil-utils-2f985079.js +0 -51
- package/dist/esm/stencil-utils-2f985079.js.map +0 -1
- /package/dist/atomic/{p-a59c4d49.entry.js.map → p-06465d20.entry.js.map} +0 -0
- /package/dist/atomic/{p-e57a49d5.entry.js.map → p-0be0c9d9.entry.js.map} +0 -0
- /package/dist/atomic/{p-b0bd2709.entry.js.map → p-156aa33a.entry.js.map} +0 -0
- /package/dist/atomic/{p-bfdecd0f.entry.js.map → p-1d8eba10.entry.js.map} +0 -0
- /package/dist/atomic/{p-52121e1e.entry.js.map → p-256b5495.entry.js.map} +0 -0
- /package/dist/atomic/{p-f32dbc1d.entry.js.map → p-312922a0.entry.js.map} +0 -0
- /package/dist/atomic/{p-26b30352.entry.js.map → p-367b575e.entry.js.map} +0 -0
- /package/dist/atomic/{p-1246be0e.entry.js.map → p-38346ea7.entry.js.map} +0 -0
- /package/dist/atomic/{p-8c714a2a.entry.js.map → p-3fbd4bc9.entry.js.map} +0 -0
- /package/dist/atomic/{p-d5326c89.entry.js.map → p-4e49a6d0.entry.js.map} +0 -0
- /package/dist/atomic/{p-8ed5d217.entry.js.map → p-56df61fd.entry.js.map} +0 -0
- /package/dist/atomic/{p-a113bf37.entry.js.map → p-63b4a863.entry.js.map} +0 -0
- /package/dist/atomic/{p-09924944.entry.js.map → p-681610d3.entry.js.map} +0 -0
- /package/dist/atomic/{p-7ffe752b.entry.js.map → p-a3c64c2a.entry.js.map} +0 -0
- /package/dist/atomic/{p-e40a763b.entry.js.map → p-a506e2e3.entry.js.map} +0 -0
- /package/dist/atomic/{p-97bbac20.entry.js.map → p-ad3fcff7.entry.js.map} +0 -0
- /package/dist/atomic/{p-f24267a9.entry.js.map → p-b7bf0850.entry.js.map} +0 -0
- /package/dist/atomic/{p-633628d5.entry.js.map → p-cbeca949.entry.js.map} +0 -0
- /package/dist/atomic/{p-5f694374.entry.js.map → p-cc45e03c.entry.js.map} +0 -0
- /package/dist/atomic/{p-391830cc.entry.js.map → p-d970a070.entry.js.map} +0 -0
- /package/dist/atomic/{p-1e0ecf71.entry.js.map → p-dd44f42d.entry.js.map} +0 -0
- /package/dist/atomic/{p-42101a1d.entry.js.map → p-ea9e09d5.entry.js.map} +0 -0
- /package/dist/atomic/{p-eb4911ef.js.map → p-f1916a8e.js.map} +0 -0
- /package/dist/atomic/{p-1891a142.entry.js.map → p-f2071b81.entry.js.map} +0 -0
- /package/dist/atomic/{p-cf878415.entry.js.map → p-f91ee8ae.entry.js.map} +0 -0
- /package/dist/atomic/{p-6e10a3e0.entry.js.map → p-fc950da3.entry.js.map} +0 -0
|
@@ -289,7 +289,7 @@ const AtomicNumericFacet$1 = /*@__PURE__*/ proxyCustomElement(class AtomicNumeri
|
|
|
289
289
|
}
|
|
290
290
|
render() {
|
|
291
291
|
const { searchStatusState: { firstSearchExecuted, hasError }, bindings: { i18n }, } = this;
|
|
292
|
-
return (h(FacetGuard, { key: '
|
|
292
|
+
return (h(FacetGuard, { key: 'dcb8b8c56b81d541105e3345eba035a16116c7c4', enabled: this.enabled, firstSearchExecuted: firstSearchExecuted, hasError: hasError, hasResults: this.shouldRenderFacet }, firstSearchExecuted ? (h(FacetContainer, null, h(FacetHeader, { i18n: i18n, label: this.label, onClearFilters: () => {
|
|
293
293
|
this.focusTarget.focusAfterSearch();
|
|
294
294
|
if (this.filterState?.range) {
|
|
295
295
|
this.filter?.clear();
|
|
@@ -584,7 +584,7 @@ const AtomicQuickviewModal = /*@__PURE__*/ proxyCustomElement(class AtomicQuickv
|
|
|
584
584
|
});
|
|
585
585
|
}
|
|
586
586
|
render() {
|
|
587
|
-
return (h("atomic-modal", { key: '
|
|
587
|
+
return (h("atomic-modal", { key: '02e1832bc82249b65fdaec75675bbae23250f10b', fullscreen: this.bindings.store.isMobile(), class: 'atomic-quickview-modal', isOpen: this.isOpen, close: () => this.onClose(), exportparts: ATOMIC_MODAL_EXPORT_PARTS }, this.renderHeader(), this.renderBody(), this.renderFooter()));
|
|
588
588
|
}
|
|
589
589
|
static get watchers() { return {
|
|
590
590
|
"highlightKeywords": ["watchHighlightKeywords"]
|
|
@@ -108,7 +108,7 @@ const AtomicQuickview$1 = /*@__PURE__*/ proxyCustomElement(class AtomicQuickview
|
|
|
108
108
|
}
|
|
109
109
|
render() {
|
|
110
110
|
if (this.quickviewState.resultHasPreview) {
|
|
111
|
-
return (h(Button, { key: '
|
|
111
|
+
return (h(Button, { key: '72e95cedd02c6791c40ce45981f29068f0a4495d', part: "button", title: this.bindings.i18n.t('quickview'), style: "outline-primary", class: "p-2", onClick: (event) => this.onClick(event), ref: this.focusTarget.setTarget }, h("atomic-icon", { key: '8e7d5d70056a9ba229c9f1d03625f4d463a9933f', part: "icon", class: "flex w-5 justify-center", icon: QuickviewIcon })));
|
|
112
112
|
}
|
|
113
113
|
}
|
|
114
114
|
static get style() { return AtomicQuickviewStyle0; }
|
|
@@ -206,7 +206,7 @@ const AtomicRefineModal = /*@__PURE__*/ proxyCustomElement(class AtomicRefineMod
|
|
|
206
206
|
return (h(RefineModalFiltersSection, { i18n: i18n, withFacets: hasFacetElements, withAutomaticFacets: hasAutomaticFacets }, this.breadcrumbManagerState.hasBreadcrumbs && (h(RefineModalFiltersClearButton, { i18n: i18n, onClick: () => this.breadcrumbManager.deselectAll() }))));
|
|
207
207
|
}
|
|
208
208
|
render() {
|
|
209
|
-
return (h(RefineModal, { key: '
|
|
209
|
+
return (h(RefineModal, { key: '588c02274d716ac4871f1bf4e9c43a1d3e75f4a3', i18n: this.bindings.i18n, host: this.host, isOpen: this.isOpen, onClose: () => (this.isOpen = false), title: this.bindings.i18n.t('sort-and-filter'), numberOfItems: this.querySummaryState.total, openButton: this.openButton }, h(RefineModalBody, { key: '3be92683f697bb9d28bf6e3fafc877437aae08aa' }, this.renderSort(), this.renderFilters())));
|
|
210
210
|
}
|
|
211
211
|
componentDidLoad() {
|
|
212
212
|
this.host.style.display = '';
|
|
@@ -70,7 +70,7 @@ const AtomicRefineToggle$1 = /*@__PURE__*/ proxyCustomElement(class AtomicRefine
|
|
|
70
70
|
this.modalRef && (this.modalRef.isOpen = true);
|
|
71
71
|
}
|
|
72
72
|
render() {
|
|
73
|
-
return (h(RefineToggleGuard, { key: '
|
|
73
|
+
return (h(RefineToggleGuard, { key: 'fd562a60540b4749bc0324b739514351c6896e62', firstRequestExecuted: this.searchStatusState.firstSearchExecuted, hasError: this.searchStatusState.hasError, hasItems: this.searchStatusState.hasResults }, h(RefineToggleButton, { key: '21702faa4703a9cd6a06ef87f9cdba8846ec45bc', i18n: this.bindings.i18n, onClick: () => this.enableModal(), setRef: (button) => {
|
|
74
74
|
if (!button) {
|
|
75
75
|
return;
|
|
76
76
|
}
|
|
@@ -18,9 +18,9 @@ const AtomicRelevanceInspector = /*@__PURE__*/ proxyCustomElement(class AtomicRe
|
|
|
18
18
|
this.open = false;
|
|
19
19
|
}
|
|
20
20
|
render() {
|
|
21
|
-
return (h("atomic-modal", { key: '
|
|
21
|
+
return (h("atomic-modal", { key: '6452c09e6706cf2b05c080f6a46aed9ae5fe4563', exportparts: "footer", isOpen: this.open, close: () => {
|
|
22
22
|
this.closeRelevanceInspector?.emit();
|
|
23
|
-
} }, h("p", { key: '
|
|
23
|
+
} }, h("p", { key: 'b9665c93520cdf4b7fc421928a7f86de65f9f06b', slot: "header" }, "Open the relevance inspector"), h("p", { key: 'b50fc62e610b420754fb850018bea716571d76fd', slot: "body" }, "The Relevance Inspector will open in the Coveo Administration Console."), h("div", { key: 'e58526af861165cad3ec8410de5c2542f5b70bb5', slot: "footer", class: "flex w-full items-center justify-end" }, h(Button, { key: '5b19e7c0c44024cc9bdc2a0544098c8052b90042', style: "outline-primary", class: "mr-2 p-2", onClick: () => this.closeRelevanceInspector?.emit() }, "Ignore"), h("a", { key: '8d2ac6969445607f7804e926b4a61572e644dd19', class: "btn-primary p-2", target: "_blank", href: this.adminHref, onClick: () => this.closeRelevanceInspector?.emit() }, "Open"))));
|
|
24
24
|
}
|
|
25
25
|
get adminHref() {
|
|
26
26
|
const { organizationId, environment } = this.bindings.engine.state.configuration;
|
|
@@ -138,7 +138,7 @@ const AtomicResultChildren$1 = /*@__PURE__*/ proxyCustomElement(class AtomicResu
|
|
|
138
138
|
return (h(ChildrenWrapper, { hasChildren: children.length > 0 }, children.map((child, i) => this.renderChild(child, i === children.length - 1))));
|
|
139
139
|
}
|
|
140
140
|
render() {
|
|
141
|
-
return (h(ResultChildrenGuard, { key: '
|
|
141
|
+
return (h(ResultChildrenGuard, { key: '95cced037c2ff2e776f2ff0798439c90f320140b', inheritTemplates: this.inheritTemplates, resultTemplateRegistered: this.resultTemplateRegistered, templateHasError: this.templateHasError }, this.collection ? this.renderCollection() : this.renderFoldedResult()));
|
|
142
142
|
}
|
|
143
143
|
get host() { return this; }
|
|
144
144
|
static get style() { return AtomicResultChildrenStyle0; }
|
|
@@ -98,7 +98,7 @@ const AtomicResultFieldsList$1 = /*@__PURE__*/ proxyCustomElement(class AtomicRe
|
|
|
98
98
|
}
|
|
99
99
|
}
|
|
100
100
|
render() {
|
|
101
|
-
return h(Host, { key: '
|
|
101
|
+
return h(Host, { key: '0454ef5f46021ef1176e7e5d96694bb213b1026e' });
|
|
102
102
|
}
|
|
103
103
|
get host() { return this; }
|
|
104
104
|
static get style() { return AtomicResultFieldsListStyle0; }
|
|
@@ -43,7 +43,7 @@ const AtomicResultLink$1 = /*@__PURE__*/ proxyCustomElement(class AtomicResultLi
|
|
|
43
43
|
const href = isUndefined(this.hrefTemplate)
|
|
44
44
|
? this.result.clickUri
|
|
45
45
|
: buildStringTemplateFromResult(this.hrefTemplate, this.result, this.bindings);
|
|
46
|
-
return (h(LinkWithItemAnalytics, { key: '
|
|
46
|
+
return (h(LinkWithItemAnalytics, { key: '91ac5b839339b2450a665ace9b5c16067802041f', href: href, onSelect: () => this.interactiveResult.select(), onBeginDelayedSelect: () => this.interactiveResult.beginDelayedSelect(), onCancelPendingSelect: () => this.interactiveResult.cancelPendingSelect(), attributes: this.linkAttributes, stopPropagation: this.stopPropagation }, this.hasDefaultSlot ? (h("slot", null)) : (h("atomic-result-text", { field: "title", default: "no-title" }))));
|
|
47
47
|
}
|
|
48
48
|
get host() { return this; }
|
|
49
49
|
static get style() { return AtomicResultLinkStyle0; }
|
|
@@ -194,7 +194,7 @@ const AtomicResultList$1 = /*@__PURE__*/ proxyCustomElement(class AtomicResultLi
|
|
|
194
194
|
render() {
|
|
195
195
|
this.resultListCommon.updateBreakpoints();
|
|
196
196
|
const listClasses = this.computeListDisplayClasses();
|
|
197
|
-
return (h(TabGuard, { key: '
|
|
197
|
+
return (h(TabGuard, { key: '5b4569fd5bbdec7f668c2c30b90071d6c115dd6d', tabsIncluded: this.tabsIncluded, tabsExcluded: this.tabsExcluded, activeTab: this.tabManagerState.activeTab }, h(ItemListGuard, { key: '3a2ff503cec54a306178ac82aacb63fdb7ff4f91', hasError: this.resultListState.hasError, hasTemplate: this.resultTemplateRegistered, templateHasError: this.itemTemplateProvider.hasError, firstRequestExecuted: this.resultListState.firstSearchExecuted, hasItems: this.resultListState.hasResults }, h(DisplayWrapper, { key: '61c4e4c85bd62b8ca9a23217d0c09a06baaa7c25', display: this.display, listClasses: listClasses }, h(ResultsPlaceholdersGuard, { key: '5401b30e47737e01d80e12c6b5e2395484fe4da9', density: this.density, display: this.display, imageSize: this.imageSize, displayPlaceholders: !this.isAppLoaded, numberOfPlaceholders: this.resultsPerPageState.numberOfResults }), h(ItemDisplayGuard, { key: '540e38788640a9598dd90932effa400022dccc7e', firstRequestExecuted: this.resultListState.firstSearchExecuted, hasItems: this.resultListState.hasResults }, this.display === 'table'
|
|
198
198
|
? this.renderAsTable()
|
|
199
199
|
: this.display === 'grid'
|
|
200
200
|
? this.renderAsGrid()
|
|
@@ -18,7 +18,7 @@ const AtomicResultTablePlaceholder = /*@__PURE__*/ proxyCustomElement(class Atom
|
|
|
18
18
|
return getItemDisplayClasses('table', this.density, this.imageSize);
|
|
19
19
|
}
|
|
20
20
|
render() {
|
|
21
|
-
return (h("table", { key: '
|
|
21
|
+
return (h("table", { key: 'ae48be5639a61375fef2937ba0910439d9cd6d8a', class: `list-root animate-pulse ${this.getClasses().join(' ')}` }, h("thead", { key: 'ef98ffc5146aebe3980dc79c72e3e56a76433687' }, h("tr", { key: '131e6f9835363e224ba4449bde2bfca1ba863c2f' }, h("th", { key: 'd9b9ed5efd2a277977cae8b103d560d65e813f1d' }, h("div", { key: '634aed335c094769829eabeac094a19e3fcf69de', class: `mt-2 h-8 ${placeholderClasses}`, style: { width: '14.5rem' } })), h("th", { key: '44b72525283eeb1f46f21a88093f61ae536914f6' }, h("div", { key: '1e1ca63273b33718c167174d22d8c09dbdb902fb', class: `mt-2 h-8 ${placeholderClasses}`, style: { width: '9.75rem' } })), h("th", { key: '06d33f8b8b0945722fb1752ef162d3fbe2bb9274' }, h("div", { key: '32bbc45bb32870a401be2d6dfa206023d3259875', class: `mt-2 h-8 ${placeholderClasses}`, style: { width: '6.5rem' } })))), h("tbody", { key: 'ab18b97ef676c6bf993dea8312b5046a1f77b4a9' }, Array.from({ length: this.rows }, () => (h("tr", null, h("td", null, h("div", { class: `mb-6 h-8 ${placeholderClasses}`, style: { width: '22.875rem' } }), h("div", { class: `mb-2 h-5 ${placeholderClasses}`, style: { width: '23.75rem' } }), h("div", { class: `h-5 ${placeholderClasses}`, style: { width: '11.5rem' } })), h("td", null, h("div", { class: `mt-1.5 h-5 ${placeholderClasses}`, style: { width: '11rem' } })), h("td", null, h("div", { class: `mt-1.5 h-5 ${placeholderClasses}`, style: { width: '4.875rem' } }))))))));
|
|
22
22
|
}
|
|
23
23
|
static get style() { return AtomicResultTablePlaceholderStyle0; }
|
|
24
24
|
}, [1, "atomic-result-table-placeholder", {
|
|
@@ -60,7 +60,7 @@ const AtomicSearchBoxQuerySuggestions = /*@__PURE__*/ proxyCustomElement(class A
|
|
|
60
60
|
}
|
|
61
61
|
render() {
|
|
62
62
|
if (this.error) {
|
|
63
|
-
return (h("atomic-component-error", { key: '
|
|
63
|
+
return (h("atomic-component-error", { key: 'd37f642d0a8dab2ea78883cfd40ae4afd481e245', element: this.host, error: this.error }));
|
|
64
64
|
}
|
|
65
65
|
}
|
|
66
66
|
get host() { return this; }
|
|
@@ -154,7 +154,7 @@ const AtomicSearchBoxRecentQueries = /*@__PURE__*/ proxyCustomElement(class Atom
|
|
|
154
154
|
}
|
|
155
155
|
render() {
|
|
156
156
|
if (this.error) {
|
|
157
|
-
return (h("atomic-component-error", { key: '
|
|
157
|
+
return (h("atomic-component-error", { key: '4e4f5a2acd2e77885f1867aa27abb8d372e95dcf', element: this.host, error: this.error }));
|
|
158
158
|
}
|
|
159
159
|
}
|
|
160
160
|
get host() { return this; }
|
|
@@ -427,18 +427,18 @@ const AtomicSearchBox$1 = /*@__PURE__*/ proxyCustomElement(class AtomicSearchBox
|
|
|
427
427
|
if (!this.suggestionManager.suggestions.length) {
|
|
428
428
|
this.registerSearchboxSuggestionEvents();
|
|
429
429
|
}
|
|
430
|
-
return (h(Host, { key: '
|
|
431
|
-
h(SearchBoxWrapper, { key: '
|
|
430
|
+
return (h(Host, { key: 'dbdbc97b10a1cf170c0baee6cde1c2d8ef7fe28e' }, this.renderAbsolutePositionSpacer(), [
|
|
431
|
+
h(SearchBoxWrapper, { key: '8c3079d587bd9f54334e30ec3ede82c3e2b5ed38', disabled: isDisabled, onFocusout: (event) => {
|
|
432
432
|
if (!isFocusingOut(event)) {
|
|
433
433
|
return;
|
|
434
434
|
}
|
|
435
435
|
this.suggestionManager.clearSuggestions();
|
|
436
436
|
this.isExpanded = false;
|
|
437
|
-
} }, this.renderTextBox(searchLabel), h(SubmitButton, { key: '
|
|
437
|
+
} }, this.renderTextBox(searchLabel), h(SubmitButton, { key: '66f38c383d28a1ee350b45358a9546944d7d9cd4', bindings: this.bindings, disabled: isDisabled, onClick: () => {
|
|
438
438
|
this.searchBox.submit();
|
|
439
439
|
this.suggestionManager.clearSuggestions();
|
|
440
440
|
} }), this.renderSuggestions()),
|
|
441
|
-
!this.suggestionManager.suggestions.length && (h("slot", { key: '
|
|
441
|
+
!this.suggestionManager.suggestions.length && (h("slot", { key: '85d2a3ea66e49325c829022fbe8c13eb07c15fdb' }, h("atomic-search-box-recent-queries", { key: '17f5e6e7bae4f8182298a67a6d14914284a23ef1' }), h("atomic-search-box-query-suggestions", { key: '4788e7863db50becd3a182803653bf4320f9d401' }))),
|
|
442
442
|
]));
|
|
443
443
|
}
|
|
444
444
|
get host() { return this; }
|
|
@@ -45,9 +45,9 @@ const AtomicSmartSnippetFeedbackModal = /*@__PURE__*/ proxyCustomElement(class A
|
|
|
45
45
|
}
|
|
46
46
|
render() {
|
|
47
47
|
updateBreakpoints(this.host);
|
|
48
|
-
return (h("atomic-modal", { key: '
|
|
48
|
+
return (h("atomic-modal", { key: 'f9f2832f5eb7b4a5f2b89f9b420a42b35c51c30f', fullscreen: false, source: this.source, container: this.host, isOpen: this.isOpen, close: () => this.close(), exportparts: ATOMIC_MODAL_EXPORT_PARTS }, h(SmartSnippetFeedbackModalHeader, { key: '21ac2cf6152e4aec8e64d3ea2e3f20bf4e259938', i18n: this.bindings.i18n }), h(SmartSnippetFeedbackModalBody, { key: '7707a40b56a2000af78412c82ae97493018477e9', formId: this.formId, onSubmit: (e) => this.sendFeedback(e) }, h(SmartSnippetFeebackModalOptions, { key: '033e3c0fa91f49c0819654e4b775e0eb5d1cf0f5', i18n: this.bindings.i18n }, smartSnippetFeedbackOptions.map(({ id, localeKey, correspondingAnswer }) => (h(SmartSnippetFeedbackModalOption, { correspondingAnswer: correspondingAnswer, currentAnswer: this.currentAnswer, i18n: this.bindings.i18n, id: id, localeKey: localeKey, onChange: () => {
|
|
49
49
|
this.currentAnswer = correspondingAnswer;
|
|
50
|
-
} })))), h(SmartSnippetFeedbackModalDetails, { key: '
|
|
50
|
+
} })))), h(SmartSnippetFeedbackModalDetails, { key: '4f230b1871432e462f33dd74de67fca3eccbe7fe', currentAnswer: this.currentAnswer, i18n: this.bindings.i18n, setDetailsInputRef: (ref) => (this.detailsInputRef = ref) })), h(SmartSnippetFeedbackModalFooter, { key: 'f6d4b7341e7b2e799de180daeb329e1c8d6da415', formId: this.formId, i18n: this.bindings.i18n, onClick: () => this.close() })));
|
|
51
51
|
}
|
|
52
52
|
close() {
|
|
53
53
|
this.isOpen = false;
|
|
@@ -117,8 +117,8 @@ const AtomicSortDropdown$1 = /*@__PURE__*/ proxyCustomElement(class AtomicSortDr
|
|
|
117
117
|
const { hasError, hasResults, firstSearchExecuted } = this.searchStatusState;
|
|
118
118
|
const { bindings: { i18n }, id, } = this;
|
|
119
119
|
return [
|
|
120
|
-
h(SortGuard, { key: '
|
|
121
|
-
h("slot", { key: '
|
|
120
|
+
h(SortGuard, { key: '6667c6e503af290a0e51b40bfd6f643831dfa0fc', firstSearchExecuted: firstSearchExecuted, hasError: hasError, hasResults: hasResults }, h(SortContainer, { key: 'b0373de043f4dc0fc61e650ea5a90b4fdd304339' }, h(SortLabel, { key: '8a4fff541f85ca5f40a32b3858c6ba235c2679a1', i18n: i18n, id: id }), h(SortSelect, { key: '5580563b8a27810e0c20d793a63bac8c74cb4cab', i18n: i18n, id: id, onSelect: (evt) => this.select(evt) }, this.options.map(({ label, criteria, expression }) => (h(SortOption, { i18n: i18n, label: label, selected: this.sort.isSortedBy(criteria), value: expression })))))),
|
|
121
|
+
h("slot", { key: '60c231823fd359621709b41f5d95aa230fc2ee64' }),
|
|
122
122
|
];
|
|
123
123
|
}
|
|
124
124
|
get host() { return this; }
|
|
@@ -47,7 +47,7 @@ const AtomicSortExpression$1 = /*@__PURE__*/ proxyCustomElement(class AtomicSort
|
|
|
47
47
|
const dropdownComponent = 'atomic-sort-dropdown';
|
|
48
48
|
if (!this.host.closest(dropdownComponent)) {
|
|
49
49
|
const error = new Error(`The "${this.host.nodeName.toLowerCase()}" component has to be used inside an ${dropdownComponent} element.`);
|
|
50
|
-
return (h("atomic-component-error", { key: '
|
|
50
|
+
return (h("atomic-component-error", { key: '1dcf1d5a49d9a2582cf71892f27811e86aaaf329', element: this.host, error: error }));
|
|
51
51
|
}
|
|
52
52
|
}
|
|
53
53
|
get host() { return this; }
|
|
@@ -59,7 +59,7 @@ const AtomicTabManager$1 = /*@__PURE__*/ proxyCustomElement(class AtomicTabManag
|
|
|
59
59
|
});
|
|
60
60
|
}
|
|
61
61
|
render() {
|
|
62
|
-
return (h(Host, { key: '
|
|
62
|
+
return (h(Host, { key: '4a69196109d422072d625146adab3cc92b76016e' }, h("atomic-tab-bar", { key: 'ab8f6f14eef1425517142abf03b5b3783f821a30' }, h("div", { key: 'b2e122393dc52e1de0b9c3f6f151cafe461c1b11', role: "list", "aria-label": "tab-area", part: "tab-area", class: "border-neutral mb-2 flex w-full flex-row border-b" }, this.tabs.map((tab) => (h("atomic-tab-button", { active: this.tabManagerState.activeTab === tab.name, label: this.bindings.i18n.t(tab.label, {
|
|
63
63
|
defaultValue: tab.label,
|
|
64
64
|
}), select: () => {
|
|
65
65
|
if (!tab.tabController.state.isActive) {
|
|
@@ -23,7 +23,7 @@ import { getProductQuerySummaryI18nParameters } from '../../common/query-summary
|
|
|
23
23
|
* @part container - The container for the whole summary.
|
|
24
24
|
* @part highlight - The summary highlights.
|
|
25
25
|
* @part query - The summary highlighted query.
|
|
26
|
-
* @part placeholder - The query summary placeholder used while the
|
|
26
|
+
* @part placeholder - The query summary placeholder used while the commerce interface is initializing.
|
|
27
27
|
*/
|
|
28
28
|
let AtomicCommerceQuerySummary = class AtomicCommerceQuerySummary extends LitElement {
|
|
29
29
|
constructor() {
|
|
@@ -0,0 +1,104 @@
|
|
|
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 { buildQuerySummary, } from '@coveo/headless';
|
|
8
|
+
import { css, html, LitElement } from 'lit';
|
|
9
|
+
import { customElement, state } from 'lit/decorators.js';
|
|
10
|
+
import { bindStateToController } from "../../../decorators/bind-state";
|
|
11
|
+
import { bindingGuard } from "../../../decorators/binding-guard";
|
|
12
|
+
import { bindings } from "../../../decorators/bindings";
|
|
13
|
+
import { errorGuard } from "../../../decorators/error-guard";
|
|
14
|
+
import { withTailwindStyles } from "../../../decorators/with-tailwind-styles.js";
|
|
15
|
+
import { localizedString } from "../../../directives/localized-string";
|
|
16
|
+
import { InitializeBindingsMixin } from "../../../mixins/bindings-mixin";
|
|
17
|
+
import { AriaLiveRegionController } from "../../../utils/accessibility-utils";
|
|
18
|
+
import { renderQuerySummaryContainer } from '../../common/query-summary/container';
|
|
19
|
+
import { renderQuerySummaryGuard } from '../../common/query-summary/guard';
|
|
20
|
+
import { getQuerySummaryI18nParameters } from '../../common/query-summary/utils';
|
|
21
|
+
/**
|
|
22
|
+
* The `atomic-query-summary` component displays information about the current range of results and the request duration (e.g., "Results 1-10 of 123 in 0.47 seconds").
|
|
23
|
+
*
|
|
24
|
+
* @part container - The container for the whole summary.
|
|
25
|
+
* @part duration - The container for the duration.
|
|
26
|
+
* @part highlight - The summary highlights.
|
|
27
|
+
* @part query - The summary highlighted query.
|
|
28
|
+
* @part placeholder - The query summary placeholder used while the search interface is initializing.
|
|
29
|
+
*/
|
|
30
|
+
let AtomicQuerySummary = class AtomicQuerySummary extends InitializeBindingsMixin(LitElement) {
|
|
31
|
+
constructor() {
|
|
32
|
+
super(...arguments);
|
|
33
|
+
this.ariaMessage = new AriaLiveRegionController(this, 'query-summary');
|
|
34
|
+
}
|
|
35
|
+
initialize() {
|
|
36
|
+
this.querySummary = buildQuerySummary(this.bindings.engine);
|
|
37
|
+
}
|
|
38
|
+
render() {
|
|
39
|
+
const { firstSearchExecuted, hasResults, hasError, total, firstResult, lastResult, query, durationInSeconds, isLoading, } = this.querySummaryState;
|
|
40
|
+
const { i18nKey, highlights, ariaLiveMessage } = getQuerySummaryI18nParameters({
|
|
41
|
+
first: firstResult,
|
|
42
|
+
last: lastResult,
|
|
43
|
+
query,
|
|
44
|
+
total,
|
|
45
|
+
i18n: this.bindings.i18n,
|
|
46
|
+
isLoading,
|
|
47
|
+
});
|
|
48
|
+
this.ariaMessage.message = ariaLiveMessage;
|
|
49
|
+
return html `${renderQuerySummaryGuard({
|
|
50
|
+
props: {
|
|
51
|
+
firstSearchExecuted,
|
|
52
|
+
hasResults,
|
|
53
|
+
hasError,
|
|
54
|
+
},
|
|
55
|
+
})(html `
|
|
56
|
+
${renderQuerySummaryContainer({ props: {} })(html `
|
|
57
|
+
${localizedString({
|
|
58
|
+
i18n: this.bindings.i18n,
|
|
59
|
+
key: i18nKey,
|
|
60
|
+
params: {
|
|
61
|
+
first: html `${highlights.first}`,
|
|
62
|
+
last: html `${highlights.last}`,
|
|
63
|
+
total: html `${highlights.total}`,
|
|
64
|
+
query: html `${highlights.query}`,
|
|
65
|
+
},
|
|
66
|
+
count: total,
|
|
67
|
+
})}
|
|
68
|
+
<span class="hidden" part="duration">
|
|
69
|
+
|
|
70
|
+
${localizedString({
|
|
71
|
+
i18n: this.bindings.i18n,
|
|
72
|
+
key: 'in-seconds',
|
|
73
|
+
params: {
|
|
74
|
+
count: durationInSeconds.toLocaleString(this.bindings.i18n.language),
|
|
75
|
+
},
|
|
76
|
+
})}
|
|
77
|
+
</span>
|
|
78
|
+
`)}
|
|
79
|
+
`)}`;
|
|
80
|
+
}
|
|
81
|
+
};
|
|
82
|
+
AtomicQuerySummary.styles = [
|
|
83
|
+
css`:host{overflow:hidden}`,
|
|
84
|
+
];
|
|
85
|
+
__decorate([
|
|
86
|
+
state()
|
|
87
|
+
], AtomicQuerySummary.prototype, "bindings", void 0);
|
|
88
|
+
__decorate([
|
|
89
|
+
state()
|
|
90
|
+
], AtomicQuerySummary.prototype, "error", void 0);
|
|
91
|
+
__decorate([
|
|
92
|
+
bindStateToController('querySummary'),
|
|
93
|
+
state()
|
|
94
|
+
], AtomicQuerySummary.prototype, "querySummaryState", void 0);
|
|
95
|
+
__decorate([
|
|
96
|
+
bindingGuard(),
|
|
97
|
+
errorGuard()
|
|
98
|
+
], AtomicQuerySummary.prototype, "render", null);
|
|
99
|
+
AtomicQuerySummary = __decorate([
|
|
100
|
+
customElement('atomic-query-summary'),
|
|
101
|
+
bindings(),
|
|
102
|
+
withTailwindStyles
|
|
103
|
+
], AtomicQuerySummary);
|
|
104
|
+
export { AtomicQuerySummary };
|
package/dist/atomic/components/components/search/atomic-results-per-page/atomic-results-per-page.js
CHANGED
|
@@ -108,8 +108,8 @@ __decorate([
|
|
|
108
108
|
state()
|
|
109
109
|
], AtomicResultsPerPage.prototype, "error", void 0);
|
|
110
110
|
__decorate([
|
|
111
|
-
|
|
112
|
-
|
|
111
|
+
bindStateToController('resultPerPage'),
|
|
112
|
+
state()
|
|
113
113
|
], AtomicResultsPerPage.prototype, "resultPerPageState", void 0);
|
|
114
114
|
__decorate([
|
|
115
115
|
bindStateToController('searchStatus'),
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
// Auto-generated file
|
|
2
|
+
export { AtomicQuerySummary } from './atomic-query-summary/atomic-query-summary.js';
|
|
2
3
|
export { AtomicResultsPerPage } from './atomic-results-per-page/atomic-results-per-page.js';
|
|
3
4
|
export { AtomicSearchLayout } from './atomic-search-layout/atomic-search-layout.js';
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
// Auto-generated file
|
|
2
2
|
export default {
|
|
3
|
+
'atomic-query-summary': async () => await import('./atomic-query-summary/atomic-query-summary.js'),
|
|
3
4
|
'atomic-results-per-page': async () => await import('./atomic-results-per-page/atomic-results-per-page.js'),
|
|
4
5
|
'atomic-search-layout': async () => await import('./atomic-search-layout/atomic-search-layout.js'),
|
|
5
6
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"file":"index.js","mappings":"
|
|
1
|
+
{"file":"index.js","mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGA;;;;;;;;;;;;SAYgB,cAAc,CAAoB,OAAgB;IAChE,OAAO,WAAW,CAAI,OAAO,EAAE,gBAAgB,CAAC,CAAC;AACnD;;MCHa,kBAAmB,SAAQ,KAAK;IAC3C,YAAY,WAAmB,EAAE,UAAkB;QACjD,KAAK,CACH,QAAQ,WAAW,sCAAsC,UAAU,YAAY,CAChF,CAAC;KACH;;;ACfH,MAAM,oBAAoB,GAAG,sBAAsB,CAAC;SAIpC,gBAAgB,CAAI,OAAgB,EAAE,UAAkB;IACtE,OAAO,IAAI,OAAO,CAAI,CAAC,OAAO,EAAE,MAAM;QACpC,MAAM,KAAK,GAAG,gBAAgB,CAC5B,oBAAoB,EACpB,CAAC,IAAO;YACN,OAAO,OAAO,CAAC,IAAI,CAAC,CAAC;SACtB,CACF,CAAC;QACF,OAAO,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;QAE7B,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE,UAAU,CAAC,EAAE;YACjC,MAAM,CACJ,IAAI,kBAAkB,CAAC,OAAO,CAAC,QAAQ,CAAC,WAAW,EAAE,EAAE,UAAU,CAAC,CACnE,CAAC;SACH;KACF,CAAC,CAAC;AACL;;ACoDA;;;;;;;;;;SAUgB,mBAAmB,CAAoB,OAAgB;IACrE,OAAO,gBAAgB,CAAI,OAAO,EAAE,gBAAgB,CAAC,CAAC;AACxD;;;;","names":[],"sources":["src/components/commerce/product-template-component-utils/stencil-product-template-decorators.tsx","src/components/common/item-list/context/item-context-controller.ts","src/components/common/item-list/fetch-item-context.ts","src/decorators/commerce/product-template-decorators.ts"],"sourcesContent":["import {Product} from '@coveo/headless/commerce';\nimport {itemContext} from '../../common/item-list/stencil-item-decorators';\n\n/**\n * Retrieves `Product` on a rendered `atomic-product`.\n *\n * This method is useful for building custom product template elements, see [Create a Product List](https://docs.coveo.com/en/atomic/latest/cc-search/create-custom-components/native-components/#custom-product-template-component-example) for more information.\n *\n * 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).\n *\n * @param element - The element that the event is dispatched to, which must be the child of a rendered \"atomic-product\".\n * @returns A promise that resolves on initialization of the parent \"atomic-product\" element, or rejects when there is no parent \"atomic-product\" element.\n *\n * @deprecated should only be used for Stencil components. For Lit components, use `fetchProductContext` from \\@/src/decorators/commerce/product-template-decorators.ts\n */\nexport function productContext<T extends Product>(element: Element) {\n return itemContext<T>(element, 'atomic-product');\n}\n","import type {LitElement, ReactiveController, ReactiveControllerHost} from 'lit';\nimport type {InitializableComponent} from '@/src/decorators/types.js';\nimport {buildCustomEvent} from '@/src/utils/event-utils';\n\ntype LitElementWithError = Omit<\n Pick<InitializableComponent, 'error'>,\n 'error'\n> &\n LitElement & {\n error: Error | null;\n };\n\nconst itemContextEventName = 'atomic/resolveResult';\n\nexport class MissingParentError extends Error {\n constructor(elementName: string, parentName: string) {\n super(\n `The \"${elementName}\" element must be the child of an \"${parentName}\" element.`\n );\n }\n}\n\nfunction extractFolded<T = Record<string, unknown>>(\n item: Record<string, unknown>,\n returnFolded: boolean\n): T {\n if (returnFolded) {\n if ('children' in item) {\n return item as T;\n } else {\n return {children: [], result: item} as T;\n }\n }\n\n if ('children' in item && 'result' in item) {\n return item.result as T;\n }\n return item as T;\n}\n\n/**\n * A reactive controller that manages item context data from parent components.\n * Handles fetching item data via custom events and manages error states.\n */\nexport class ItemContextController<T = Record<string, unknown>>\n implements ReactiveController\n{\n private host: ReactiveControllerHost & LitElementWithError;\n private parentName: string;\n private folded: boolean;\n private _item: T | null = null;\n private _error: MissingParentError | null = null;\n\n constructor(\n host: ReactiveControllerHost & LitElementWithError,\n options: {parentName?: string; folded?: boolean} = {}\n ) {\n this.host = host;\n this.parentName = options.parentName ?? 'atomic-result';\n this.folded = options.folded ?? false;\n host.addController(this);\n }\n\n get item(): T | null {\n return this._error ? null : this._item;\n }\n\n get error(): MissingParentError | null {\n return this._error;\n }\n\n get hasError(): boolean {\n return this._error !== null;\n }\n\n hostConnected(): void {\n this._resolveItemContext();\n }\n\n private _resolveItemContext(): void {\n const event = buildCustomEvent(\n itemContextEventName,\n (item: Record<string, unknown>) => {\n this._item = extractFolded<T>(item, this.folded);\n this._error = null;\n this.host.error = null;\n this.host.requestUpdate();\n }\n );\n\n const canceled = this.host.dispatchEvent(event);\n if (canceled) {\n const elementName = (this.host as Element).nodeName.toLowerCase();\n this._error = new MissingParentError(elementName, this.parentName);\n this._item = null;\n this.host.error = this._error;\n this.host.requestUpdate();\n }\n }\n}\n\ntype ItemContextEventHandler<T> = (item: T) => void;\nexport type ItemContextEvent<T> = CustomEvent<ItemContextEventHandler<T>>;\n","import {closest} from '../../../utils/dom-utils.js';\nimport {buildCustomEvent} from '../../../utils/event-utils.js';\nimport {MissingParentError} from './context/item-context-controller.js';\n\nconst itemContextEventName = 'atomic/resolveResult';\n\ntype ItemContextEventHandler<T> = (item: T) => void;\n\nexport function fetchItemContext<T>(element: Element, parentName: string) {\n return new Promise<T>((resolve, reject) => {\n const event = buildCustomEvent<ItemContextEventHandler<T>>(\n itemContextEventName,\n (item: T) => {\n return resolve(item);\n }\n );\n element.dispatchEvent(event);\n\n if (!closest(element, parentName)) {\n reject(\n new MissingParentError(element.nodeName.toLowerCase(), parentName)\n );\n }\n });\n}\n","import type {InteractiveProduct, Product} from '@coveo/headless/commerce';\nimport type {LitElement} from 'lit';\nimport {\n InteractiveItemContextController,\n type InteractiveItemContextEvent,\n} from '@/src/components/common/item-list/context/interactive-item-context-controller';\nimport {\n ItemContextController,\n type ItemContextEvent,\n} from '@/src/components/common/item-list/context/item-context-controller';\nimport {fetchItemContext} from '@/src/components/common/item-list/fetch-item-context';\n\n/**\n * Creates a [Lit reactive controller](https://lit.dev/docs/composition/controllers/) for managing product context in product template components.\n *\n * @param host - The Lit component instance\n * @param options - Configuration options\n * @returns ItemContextController instance configured for atomic-product\n *\n * @example\n * ```typescript\n * @customElement('my-product-component')\n * export class MyProductComponent extends LitElement {\n * private productController = createProductContextController(this);\n *\n * @state() product!: Product;\n *\n * render() {\n * this.product = this.productController.item;\n * return html`<div>${this.product?.ec_name}</div>`;\n * }\n * }\n * ```\n */\nexport function createProductContextController(\n host: LitElement & {error: Error | null},\n options: {folded?: boolean} = {}\n): ItemContextController<Product> {\n return new ItemContextController<Product>(host, {\n parentName: 'atomic-product',\n folded: options.folded ?? false,\n });\n}\n\n/**\n * Creates a [Lit reactive controller](https://lit.dev/docs/composition/controllers/) for managing interactive product context in product template components.\n *\n * @param host - The Lit component instance\n * @returns InteractiveItemContextController instance\n *\n * @example\n * ```typescript\n * @customElement('my-interactive-product-component')\n * export class MyInteractiveProductComponent extends LitElement {\n * private interactiveProductController = createInteractiveProductContextController(this);\n *\n * @state() product!: Product;\n *\n * render() {\n * this.product = this.interactiveProductController.interactiveItem;\n * return html`<div>${this.product?.ec_name}</div>`;\n * }\n * }\n * ```\n */\nexport function createInteractiveProductContextController(\n host: LitElement & {error: Error}\n): InteractiveItemContextController<InteractiveProduct> {\n return new InteractiveItemContextController<InteractiveProduct>(host);\n}\n\nexport type ProductContextEvent<T = Product> = ItemContextEvent<T>;\nexport type InteractiveProductContextEvent<\n T extends InteractiveProduct = InteractiveProduct,\n> = InteractiveItemContextEvent<T>;\n\n/**\n * Retrieves `Product` on a rendered `atomic-product`.\n *\n * This utility function is useful for building custom product template elements, see [Create a Product List](https://docs.coveo.com/en/atomic/latest/cc-search/create-custom-components/native-components/#custom-product-template-component-example) for more information.\n *\n * You should use the utility function in the [`connectedCallback` lifecycle method](https://developer.mozilla.org/en-US/docs/Web/Web_Components/Using_custom_elements#using_the_lifecycle_callbacks).\n *\n * @param element - The element that the event is dispatched to, which must be the child of a rendered `atomic-product`.\n * @returns A promise that resolves on initialization of the parent `atomic-product` element, or rejects when there is no parent `atomic-product` element.\n */\nexport function fetchProductContext<T extends Product>(element: Element) {\n return fetchItemContext<T>(element, 'atomic-product');\n}\n"],"version":3}
|