@coveo/atomic 3.33.8-pre.f82c4ba7d3 → 3.33.8-pre.fb042f4f0e
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-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-history-toggle.js +2 -2
- package/dist/atomic/components/atomic-insight-history-toggle.js.map +1 -1
- package/dist/atomic/components/atomic-insight-user-actions-toggle.js +2 -2
- package/dist/atomic/components/atomic-insight-user-actions-toggle.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-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-search-box-query-suggestions2.js +1 -1
- package/dist/atomic/components/atomic-search-box-recent-queries.d.ts +11 -0
- package/dist/atomic/components/atomic-search-box-recent-queries.js +8 -0
- package/dist/atomic/components/atomic-search-box-recent-queries.js.map +1 -0
- package/dist/atomic/components/atomic-search-box-recent-queries2.js +183 -0
- package/dist/atomic/components/atomic-search-box-recent-queries2.js.map +1 -0
- package/dist/atomic/components/atomic-search-box.js +23 -6
- package/dist/atomic/components/atomic-search-box.js.map +1 -1
- 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/clock.js +2 -2
- package/dist/atomic/components/components/commerce/atomic-commerce-interface/atomic-commerce-interface.js +49 -7
- package/dist/atomic/components/components/commerce/atomic-commerce-query-summary/atomic-commerce-query-summary.js +2 -2
- package/dist/atomic/components/components/commerce/atomic-commerce-recommendation-interface/atomic-commerce-recommendation-interface.js +25 -10
- package/dist/atomic/components/components/commerce/atomic-commerce-search-box/atomic-commerce-search-box.js +12 -5
- package/dist/atomic/components/components/common/atomic-modal/atomic-modal.js +2 -0
- 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/{p-75e00690.entry.js → p-089be992.entry.js} +2 -2
- package/dist/atomic/{p-4b3d253b.entry.js → p-09a3a067.entry.js} +2 -2
- package/dist/atomic/{p-7b899b57.entry.js → p-1d1f54a5.entry.js} +2 -2
- package/dist/atomic/{p-ae98c582.entry.js → p-2ce8220a.entry.js} +2 -2
- package/dist/atomic/{p-877d35b1.entry.js → p-3b023e83.entry.js} +2 -2
- package/dist/atomic/{p-52ba404c.entry.js → p-49c38b27.entry.js} +2 -2
- package/dist/atomic/p-4c2f230f.entry.js +2 -0
- package/dist/atomic/p-4c2f230f.entry.js.map +1 -0
- package/dist/atomic/{p-299555fb.entry.js → p-4c41abd0.entry.js} +2 -2
- package/dist/atomic/{p-88d5e178.entry.js → p-51a4606d.entry.js} +2 -2
- package/dist/atomic/{p-0ce38b0d.entry.js → p-5528d006.entry.js} +2 -2
- package/dist/atomic/{p-d00a12e9.entry.js → p-5f1fa581.entry.js} +2 -2
- package/dist/atomic/{p-ba4bf29f.entry.js → p-6329ff94.entry.js} +2 -2
- package/dist/atomic/{p-7383fd32.entry.js → p-6e6d686e.entry.js} +2 -2
- package/dist/atomic/p-744da781.entry.js +2 -0
- package/dist/atomic/{p-c88a3d2d.entry.js.map → p-744da781.entry.js.map} +1 -1
- package/dist/atomic/{p-a760d9f9.entry.js → p-7e2109e9.entry.js} +2 -2
- package/dist/atomic/{p-b28011e6.entry.js → p-89085429.entry.js} +2 -2
- package/dist/atomic/{p-39e63678.entry.js → p-89ab44de.entry.js} +2 -2
- package/dist/atomic/{p-330e6e7c.entry.js → p-9c9b1965.entry.js} +2 -2
- package/dist/atomic/{p-78b70622.entry.js → p-a8882a2a.entry.js} +2 -2
- package/dist/atomic/{p-f22bcb8c.entry.js → p-b6963bae.entry.js} +2 -2
- package/dist/atomic/{p-3c8d109e.entry.js → p-b7063a0d.entry.js} +2 -2
- package/dist/atomic/{p-e1cc5150.js → p-c280cd05.js} +1 -1
- package/dist/atomic/{p-5bc31a30.js → p-dd761b10.js} +2 -2
- package/dist/atomic/{p-7b0b9e9b.entry.js → p-f289269f.entry.js} +2 -2
- package/dist/atomic/{p-c49cfa0c.entry.js → p-fda26113.entry.js} +2 -2
- package/dist/cjs/_loader.cjs.js +1 -1
- package/dist/cjs/{analytics-config-68dbae8e.js → analytics-config-fa9c8790.js} +2 -2
- package/dist/cjs/{analytics-config-68dbae8e.js.map → analytics-config-fa9c8790.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-history-toggle.cjs.entry.js +2 -2
- package/dist/cjs/atomic-insight-history-toggle.cjs.entry.js.map +1 -1
- package/dist/cjs/atomic-insight-interface.cjs.entry.js +1 -1
- package/dist/cjs/atomic-insight-user-actions-toggle.cjs.entry.js +2 -2
- package/dist/cjs/atomic-insight-user-actions-toggle.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-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-search-box-query-suggestions_2.cjs.entry.js +234 -0
- package/dist/cjs/atomic-search-box-query-suggestions_2.cjs.entry.js.map +1 -0
- package/dist/cjs/atomic-search-box.cjs.entry.js +15 -4
- package/dist/cjs/atomic-search-box.cjs.entry.js.map +1 -1
- 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/clock-f03ff827.js +7 -0
- package/dist/cjs/clock-f03ff827.js.map +1 -0
- package/dist/cjs/index-757bc886.js +2 -2
- package/dist/cjs/version.cjs.js +2 -2
- package/dist/esm/_loader.js +1 -1
- package/dist/esm/{analytics-config-18d42f83.js → analytics-config-c51d0bc9.js} +2 -2
- package/dist/esm/{analytics-config-18d42f83.js.map → analytics-config-c51d0bc9.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-history-toggle.entry.js +2 -2
- package/dist/esm/atomic-insight-history-toggle.entry.js.map +1 -1
- package/dist/esm/atomic-insight-interface.entry.js +1 -1
- package/dist/esm/atomic-insight-user-actions-toggle.entry.js +2 -2
- package/dist/esm/atomic-insight-user-actions-toggle.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-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-search-box-query-suggestions_2.entry.js +229 -0
- package/dist/esm/atomic-search-box-query-suggestions_2.entry.js.map +1 -0
- package/dist/esm/atomic-search-box.entry.js +15 -4
- package/dist/esm/atomic-search-box.entry.js.map +1 -1
- 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/clock-add3e9a5.js +5 -0
- package/dist/esm/clock-add3e9a5.js.map +1 -0
- package/dist/esm/index-3f35faca.js +2 -2
- package/dist/esm/version.js +2 -2
- package/dist/types/components/commerce/atomic-commerce-interface/atomic-commerce-interface.d.ts +29 -1
- package/dist/types/components/commerce/atomic-commerce-recommendation-interface/atomic-commerce-recommendation-interface.d.ts +1 -0
- package/dist/types/components/commerce/atomic-commerce-search-box/atomic-commerce-search-box.d.ts +1 -0
- package/dist/types/components/search/atomic-search-box/atomic-search-box.d.ts +1 -0
- package/dist/types/components/search/index.d.ts +0 -1
- package/dist/types/components/search/{atomic-search-box-recent-queries → search-box-suggestions/atomic-search-box-recent-queries}/atomic-search-box-recent-queries.d.ts +7 -15
- package/dist/types/components.d.ts +49 -0
- package/docs/atomic-docs.json +98 -1
- package/package.json +3 -3
- package/dist/atomic/components/components/search/atomic-search-box-recent-queries/atomic-search-box-recent-queries.js +0 -137
- package/dist/atomic/p-2e9db4ca.entry.js +0 -2
- package/dist/atomic/p-2e9db4ca.entry.js.map +0 -1
- package/dist/atomic/p-c88a3d2d.entry.js +0 -2
- package/dist/cjs/atomic-search-box-query-suggestions.cjs.entry.js +0 -76
- package/dist/cjs/atomic-search-box-query-suggestions.cjs.entry.js.map +0 -1
- package/dist/cjs/clock-7aeb19d0.js +0 -7
- package/dist/cjs/clock-7aeb19d0.js.map +0 -1
- package/dist/esm/atomic-search-box-query-suggestions.entry.js +0 -72
- package/dist/esm/atomic-search-box-query-suggestions.entry.js.map +0 -1
- package/dist/esm/clock-b1f5d7f7.js +0 -5
- package/dist/esm/clock-b1f5d7f7.js.map +0 -1
- /package/dist/atomic/{p-75e00690.entry.js.map → p-089be992.entry.js.map} +0 -0
- /package/dist/atomic/{p-4b3d253b.entry.js.map → p-09a3a067.entry.js.map} +0 -0
- /package/dist/atomic/{p-7b899b57.entry.js.map → p-1d1f54a5.entry.js.map} +0 -0
- /package/dist/atomic/{p-ae98c582.entry.js.map → p-2ce8220a.entry.js.map} +0 -0
- /package/dist/atomic/{p-877d35b1.entry.js.map → p-3b023e83.entry.js.map} +0 -0
- /package/dist/atomic/{p-52ba404c.entry.js.map → p-49c38b27.entry.js.map} +0 -0
- /package/dist/atomic/{p-299555fb.entry.js.map → p-4c41abd0.entry.js.map} +0 -0
- /package/dist/atomic/{p-88d5e178.entry.js.map → p-51a4606d.entry.js.map} +0 -0
- /package/dist/atomic/{p-0ce38b0d.entry.js.map → p-5528d006.entry.js.map} +0 -0
- /package/dist/atomic/{p-d00a12e9.entry.js.map → p-5f1fa581.entry.js.map} +0 -0
- /package/dist/atomic/{p-ba4bf29f.entry.js.map → p-6329ff94.entry.js.map} +0 -0
- /package/dist/atomic/{p-7383fd32.entry.js.map → p-6e6d686e.entry.js.map} +0 -0
- /package/dist/atomic/{p-a760d9f9.entry.js.map → p-7e2109e9.entry.js.map} +0 -0
- /package/dist/atomic/{p-b28011e6.entry.js.map → p-89085429.entry.js.map} +0 -0
- /package/dist/atomic/{p-39e63678.entry.js.map → p-89ab44de.entry.js.map} +0 -0
- /package/dist/atomic/{p-330e6e7c.entry.js.map → p-9c9b1965.entry.js.map} +0 -0
- /package/dist/atomic/{p-78b70622.entry.js.map → p-a8882a2a.entry.js.map} +0 -0
- /package/dist/atomic/{p-f22bcb8c.entry.js.map → p-b6963bae.entry.js.map} +0 -0
- /package/dist/atomic/{p-3c8d109e.entry.js.map → p-b7063a0d.entry.js.map} +0 -0
- /package/dist/atomic/{p-e1cc5150.js.map → p-c280cd05.js.map} +0 -0
- /package/dist/atomic/{p-5bc31a30.js.map → p-dd761b10.js.map} +0 -0
- /package/dist/atomic/{p-7b0b9e9b.entry.js.map → p-f289269f.entry.js.map} +0 -0
- /package/dist/atomic/{p-c49cfa0c.entry.js.map → p-fda26113.entry.js.map} +0 -0
@@ -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: '13b57531b5cbe4d96cdd8a6da8cc2e51a7cb5c09', firstSearchExecuted: firstSearchExecuted, hasError: hasError, hasResults: hasResults }, h(SortContainer, { key: '6669f4b0017f7bdf92b2a0310c82dc2ad9ede435' }, h(SortLabel, { key: '2fb9759cc247e03e5c00a515a3de858b7ae6e316', i18n: i18n, id: id }), h(SortSelect, { key: '451912937924b88a4c53cc07a1f4945a5ae29d90', 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: 'b7ff8bfb88f3a07462f058e5ef0bf3e41e761646' }),
|
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: 'e6c396c032fee71b5255255fc78606a85b554c22', 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: '177a674f1d915777f0a4e555873f30a60cd52088' }, h("atomic-tab-bar", { key: 'a06f874f12b76dec3e0b948ce126b5224a12dabf' }, h("div", { key: '3d0b23b2daf746445ea6d7dd12c4d9c008fbfbef', 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) {
|
@@ -1,5 +1,5 @@
|
|
1
|
-
const
|
1
|
+
const Clock = `<svg fill="none" stroke="currentColor" stroke-linejoin="round" stroke-linecap="round" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg"><circle cx="8" cy="8" r="7.5"/><path d="m8.5 4.5v4"/><path d="m10.3066 10.1387-1.80932-1.5768"/></svg>`;
|
2
2
|
|
3
|
-
export {
|
3
|
+
export { Clock as C };
|
4
4
|
|
5
5
|
//# sourceMappingURL=clock.js.map
|
@@ -4,7 +4,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
4
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
5
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
6
6
|
};
|
7
|
-
import { buildCommerceEngine, buildContext, buildProductListing, buildSearch, VERSION as HEADLESS_VERSION, loadConfigurationActions, loadQueryActions, } from '@coveo/headless/commerce';
|
7
|
+
import { buildCommerceEngine, buildContext, buildProductListing, buildSearch, VERSION as HEADLESS_VERSION, loadConfigurationActions, loadContextActions, loadQueryActions, } from '@coveo/headless/commerce';
|
8
8
|
import { provide } from '@lit/context';
|
9
9
|
import i18next from 'i18next';
|
10
10
|
import { css, html, LitElement } from 'lit';
|
@@ -144,6 +144,41 @@ let AtomicCommerceInterface = class AtomicCommerceInterface extends ChildrenUpda
|
|
144
144
|
this.searchOrListing.executeFirstRequest();
|
145
145
|
}
|
146
146
|
}
|
147
|
+
/**
|
148
|
+
* Updates the locale settings for the commerce interface and headless commerce
|
149
|
+
* engine. Only the provided parameters will be updated.
|
150
|
+
*
|
151
|
+
* Calling this method affects the localization of the interface as well as
|
152
|
+
* the catalog configuration being used by the Commerce API. If the resulting
|
153
|
+
* language-country-currency combination matches no existing catalog
|
154
|
+
* configuration in your Coveo organization, requests made through the
|
155
|
+
* commerce engine will start failing.
|
156
|
+
*
|
157
|
+
* @param language - (Optional) The IETF language code tag (e.g., `en`).
|
158
|
+
* @param country - (Optional) The ISO-3166-1 country tag (e.g., `US`).
|
159
|
+
* @param currency - (Optional) The ISO-4217 currency code (e.g., `USD`).
|
160
|
+
*
|
161
|
+
* @example
|
162
|
+
* ```typescript
|
163
|
+
* interface.updateLocale('fr', 'CA', 'CAD');
|
164
|
+
* ```
|
165
|
+
*/
|
166
|
+
updateLocale(language, country, currency) {
|
167
|
+
if (!this.interfaceController.engineIsCreated(this.engine) ||
|
168
|
+
!this.context) {
|
169
|
+
return;
|
170
|
+
}
|
171
|
+
language && this.interfaceController.onLanguageChange(language);
|
172
|
+
if (this.isNewLocale(language, country, currency)) {
|
173
|
+
const { setContext } = loadContextActions(this.engine);
|
174
|
+
this.engine.dispatch(setContext({
|
175
|
+
...this.context.state,
|
176
|
+
...(language && { language }),
|
177
|
+
...(country && { country }),
|
178
|
+
...(currency && { currency }),
|
179
|
+
}));
|
180
|
+
}
|
181
|
+
}
|
147
182
|
toggleAnalytics() {
|
148
183
|
this.interfaceController.onAnalyticsChange();
|
149
184
|
}
|
@@ -157,11 +192,10 @@ let AtomicCommerceInterface = class AtomicCommerceInterface extends ChildrenUpda
|
|
157
192
|
!this.context) {
|
158
193
|
return;
|
159
194
|
}
|
160
|
-
|
195
|
+
this.engine.logger.warn('The `language` property will be removed in the next major version of Atomic (v4). Rather than using this property, set the initial language through the engine configuration when calling `initialize` or `initializeWithEngine`, and update the language as needed using the `updateLocale` method.');
|
161
196
|
this.context.setLanguage(this.language);
|
162
197
|
return this.interfaceController.onLanguageChange();
|
163
198
|
}
|
164
|
-
// TODO - KIT-4993: Add updateLocale public method.
|
165
199
|
disconnectedCallback() {
|
166
200
|
super.disconnectedCallback();
|
167
201
|
if (typeof this.unsubscribeUrlManager === 'function') {
|
@@ -211,11 +245,11 @@ let AtomicCommerceInterface = class AtomicCommerceInterface extends ChildrenUpda
|
|
211
245
|
throw error;
|
212
246
|
}
|
213
247
|
}
|
214
|
-
// TODO - KIT-4993: Adjust.
|
215
248
|
initLanguage() {
|
216
|
-
if (!this.language) {
|
217
|
-
|
249
|
+
if (!this.context || this.language) {
|
250
|
+
return;
|
218
251
|
}
|
252
|
+
this.interfaceController.onLanguageChange(this.context.state.language);
|
219
253
|
}
|
220
254
|
initRequestStatus() {
|
221
255
|
this.searchOrListing =
|
@@ -257,7 +291,7 @@ let AtomicCommerceInterface = class AtomicCommerceInterface extends ChildrenUpda
|
|
257
291
|
this.i18Initialized,
|
258
292
|
]);
|
259
293
|
this.initContext();
|
260
|
-
this.updateLanguage();
|
294
|
+
this.updateLanguage(); // TODO - (v4) KIT-4365: Remove.
|
261
295
|
this.bindings = this.getBindings();
|
262
296
|
markParentAsReady(this);
|
263
297
|
this.initRequestStatus();
|
@@ -267,6 +301,14 @@ let AtomicCommerceInterface = class AtomicCommerceInterface extends ChildrenUpda
|
|
267
301
|
this.initUrlManager();
|
268
302
|
this.initialized = true;
|
269
303
|
}
|
304
|
+
isNewLocale(language, country, currency) {
|
305
|
+
if (!this.context) {
|
306
|
+
return false;
|
307
|
+
}
|
308
|
+
return ((language && language !== this.context.state.language) ||
|
309
|
+
(country && country !== this.context.state.country) ||
|
310
|
+
(currency && currency !== this.context.state.currency));
|
311
|
+
}
|
270
312
|
// TODO - (v4) KIT-4991: Make private.
|
271
313
|
scrollToTop() {
|
272
314
|
const scrollContainerElement = document.querySelector(this.scrollContainer);
|
@@ -37,7 +37,7 @@ let AtomicCommerceQuerySummary = class AtomicCommerceQuerySummary extends LitEle
|
|
37
37
|
this.listingOrSearchSummary = controller.summary();
|
38
38
|
}
|
39
39
|
render() {
|
40
|
-
const { firstProduct, firstRequestExecuted, lastProduct, totalNumberOfProducts, hasProducts, hasError, } = this.listingOrSearchSummaryState;
|
40
|
+
const { firstProduct, firstRequestExecuted, lastProduct, totalNumberOfProducts, hasProducts, hasError, isLoading, } = this.listingOrSearchSummaryState;
|
41
41
|
const { i18nKey, highlights, ariaLiveMessage } = getProductQuerySummaryI18nParameters({
|
42
42
|
first: firstProduct,
|
43
43
|
last: lastProduct,
|
@@ -46,7 +46,7 @@ let AtomicCommerceQuerySummary = class AtomicCommerceQuerySummary extends LitEle
|
|
46
46
|
: '',
|
47
47
|
total: totalNumberOfProducts,
|
48
48
|
i18n: this.bindings.i18n,
|
49
|
-
isLoading
|
49
|
+
isLoading,
|
50
50
|
});
|
51
51
|
this.ariaMessage.message = ariaLiveMessage;
|
52
52
|
return html `${renderQuerySummaryGuard({
|
@@ -50,6 +50,9 @@ let AtomicCommerceRecommendationInterface = class AtomicCommerceRecommendationIn
|
|
50
50
|
*
|
51
51
|
*/
|
52
52
|
this.iconAssetsPath = './assets';
|
53
|
+
// TODO - KIT-4994: Add disableAnalytics property that defaults to false.
|
54
|
+
// TODO - KIT-4994: Deprecate in favor of disableAnalytics property.
|
55
|
+
// TODO - (v4) KIT-4990: Remove.
|
53
56
|
/**
|
54
57
|
* Whether to enable analytics.
|
55
58
|
*/
|
@@ -104,13 +107,15 @@ let AtomicCommerceRecommendationInterface = class AtomicCommerceRecommendationIn
|
|
104
107
|
return;
|
105
108
|
}
|
106
109
|
language && this.interfaceController.onLanguageChange(language);
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
110
|
+
if (this.isNewLocale(language, country, currency)) {
|
111
|
+
const { setContext } = loadContextActions(this.engine);
|
112
|
+
this.engine.dispatch(setContext({
|
113
|
+
...this.context.state,
|
114
|
+
...(language && { language }),
|
115
|
+
...(country && { country }),
|
116
|
+
...(currency && { currency }),
|
117
|
+
}));
|
118
|
+
}
|
114
119
|
}
|
115
120
|
toggleAnalytics() {
|
116
121
|
this.interfaceController.onAnalyticsChange();
|
@@ -118,6 +123,7 @@ let AtomicCommerceRecommendationInterface = class AtomicCommerceRecommendationIn
|
|
118
123
|
updateIconAssetsPath() {
|
119
124
|
this.store.state.iconAssetsPath = this.iconAssetsPath;
|
120
125
|
}
|
126
|
+
// TODO - (v4) KIT-4365: Remove.
|
121
127
|
async updateLanguage() {
|
122
128
|
if (!this.interfaceController.engineIsCreated(this.engine) ||
|
123
129
|
!this.language ||
|
@@ -150,7 +156,7 @@ let AtomicCommerceRecommendationInterface = class AtomicCommerceRecommendationIn
|
|
150
156
|
this.i18Initialized,
|
151
157
|
]);
|
152
158
|
this.initContext();
|
153
|
-
this.
|
159
|
+
this.updateLanguage();
|
154
160
|
this.bindings = this.getBindings();
|
155
161
|
markParentAsReady(this);
|
156
162
|
this.initLanguage();
|
@@ -167,9 +173,18 @@ let AtomicCommerceRecommendationInterface = class AtomicCommerceRecommendationIn
|
|
167
173
|
};
|
168
174
|
}
|
169
175
|
initLanguage() {
|
170
|
-
if (!this.language) {
|
171
|
-
|
176
|
+
if (!this.context || this.language) {
|
177
|
+
return;
|
178
|
+
}
|
179
|
+
this.interfaceController.onLanguageChange(this.context.state.language);
|
180
|
+
}
|
181
|
+
isNewLocale(language, country, currency) {
|
182
|
+
if (!this.context) {
|
183
|
+
return false;
|
172
184
|
}
|
185
|
+
return ((language && language !== this.context.state.language) ||
|
186
|
+
(country && country !== this.context.state.country) ||
|
187
|
+
(currency && currency !== this.context.state.currency));
|
173
188
|
}
|
174
189
|
};
|
175
190
|
AtomicCommerceRecommendationInterface.styles = [
|
@@ -20,6 +20,7 @@ import { AriaLiveRegionController } from "../../../utils/accessibility-utils";
|
|
20
20
|
import { hasKeyboard, isMacOS } from "../../../utils/device-utils";
|
21
21
|
import { SafeStorage, StorageItems, } from "../../../utils/local-storage-utils";
|
22
22
|
import { updateBreakpoints } from "../../../utils/replace-breakpoint-utils";
|
23
|
+
import { getDefaultSlotFromHost } from "../../../utils/slot-utils";
|
23
24
|
import { isFocusingOut, once, randomID, spreadProperties, } from '../../../utils/utils';
|
24
25
|
import { renderSearchBoxWrapper } from '../../common/search-box/search-box-wrapper';
|
25
26
|
import { renderSearchBoxTextArea } from '../../common/search-box/search-text-area';
|
@@ -123,9 +124,6 @@ let AtomicCommerceSearchBox = class AtomicCommerceSearchBox extends LitElement {
|
|
123
124
|
}
|
124
125
|
connectedCallback() {
|
125
126
|
super.connectedCallback();
|
126
|
-
if (this.children.length === 0) {
|
127
|
-
this.replaceChildren(document.createElement('atomic-commerce-search-box-recent-queries'), document.createElement('atomic-commerce-search-box-query-suggestions'));
|
128
|
-
}
|
129
127
|
this.addEventListener('atomic/searchBoxSuggestion/register', (event) => {
|
130
128
|
const customEvent = event;
|
131
129
|
this.searchBoxSuggestionEventsQueue.push(customEvent);
|
@@ -492,6 +490,14 @@ let AtomicCommerceSearchBox = class AtomicCommerceSearchBox extends LitElement {
|
|
492
490
|
></atomic-suggestion-renderer>
|
493
491
|
`;
|
494
492
|
}
|
493
|
+
renderSlotContent() {
|
494
|
+
const hasDefaultSlot = !!getDefaultSlotFromHost(this);
|
495
|
+
if (hasDefaultSlot) {
|
496
|
+
return html `<slot></slot>`;
|
497
|
+
}
|
498
|
+
return html `<atomic-commerce-search-box-recent-queries></atomic-commerce-search-box-recent-queries>
|
499
|
+
<atomic-commerce-search-box-query-suggestions></atomic-commerce-search-box-query-suggestions>`;
|
500
|
+
}
|
495
501
|
render() {
|
496
502
|
this.updateBreakpoints();
|
497
503
|
if (!this.suggestionManager.suggestions.length) {
|
@@ -511,7 +517,7 @@ let AtomicCommerceSearchBox = class AtomicCommerceSearchBox extends LitElement {
|
|
511
517
|
},
|
512
518
|
},
|
513
519
|
})(html `${this.renderTextBox()}
|
514
|
-
|
520
|
+
${renderSubmitButton({
|
515
521
|
props: {
|
516
522
|
i18n: this.bindings.i18n,
|
517
523
|
disabled: this.isSearchDisabledForEndUser,
|
@@ -521,7 +527,8 @@ let AtomicCommerceSearchBox = class AtomicCommerceSearchBox extends LitElement {
|
|
521
527
|
},
|
522
528
|
},
|
523
529
|
})}
|
524
|
-
|
530
|
+
${this.renderSuggestions()}`)}
|
531
|
+
${this.renderSlotContent()}
|
525
532
|
`;
|
526
533
|
}
|
527
534
|
};
|
@@ -9,6 +9,7 @@ import { customElement, property, state } from 'lit/decorators.js';
|
|
9
9
|
import { createRef, ref } from 'lit/directives/ref.js';
|
10
10
|
import { when } from 'lit/directives/when.js';
|
11
11
|
import { booleanConverter } from "../../../converters/boolean-converter.js";
|
12
|
+
import { bindings } from "../../../decorators/bindings.js";
|
12
13
|
import { errorGuard } from "../../../decorators/error-guard";
|
13
14
|
import { watch } from "../../../decorators/watch.js";
|
14
15
|
import { withTailwindStyles } from "../../../decorators/with-tailwind-styles.js";
|
@@ -296,6 +297,7 @@ __decorate([
|
|
296
297
|
], AtomicModal.prototype, "watchToggleOpen", null);
|
297
298
|
AtomicModal = __decorate([
|
298
299
|
customElement('atomic-modal'),
|
300
|
+
bindings(),
|
299
301
|
withTailwindStyles
|
300
302
|
], AtomicModal);
|
301
303
|
export { AtomicModal };
|
@@ -1,5 +1,4 @@
|
|
1
1
|
// Auto-generated file
|
2
2
|
export { AtomicQuerySummary } from './atomic-query-summary/atomic-query-summary.js';
|
3
3
|
export { AtomicResultsPerPage } from './atomic-results-per-page/atomic-results-per-page.js';
|
4
|
-
export { AtomicSearchBoxRecentQueries } from './atomic-search-box-recent-queries/atomic-search-box-recent-queries.js';
|
5
4
|
export { AtomicSearchLayout } from './atomic-search-layout/atomic-search-layout.js';
|
@@ -2,6 +2,5 @@
|
|
2
2
|
export default {
|
3
3
|
'atomic-query-summary': async () => await import('./atomic-query-summary/atomic-query-summary.js'),
|
4
4
|
'atomic-results-per-page': async () => await import('./atomic-results-per-page/atomic-results-per-page.js'),
|
5
|
-
'atomic-search-box-recent-queries': async () => await import('./atomic-search-box-recent-queries/atomic-search-box-recent-queries.js'),
|
6
5
|
'atomic-search-layout': async () => await import('./atomic-search-layout/atomic-search-layout.js'),
|
7
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}
|