vviinn-widgets 2.219.0 → 2.220.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (51) hide show
  1. package/dist/cjs/{index-DdCwxNyl.js → index-FE9nOqQo.js} +1 -1
  2. package/dist/cjs/{search.store-DiomZf0i.js → search.store-C6QU_D02.js} +3 -9
  3. package/dist/cjs/vviinn-button_6.cjs.entry.js +1 -1
  4. package/dist/cjs/vviinn-camera_12.cjs.entry.js +13 -13
  5. package/dist/cjs/vviinn-carousel_10.cjs.entry.js +2 -2
  6. package/dist/cjs/vviinn-shop-the-look.cjs.entry.js +1 -1
  7. package/dist/cjs/vviinn-text-search.cjs.entry.js +27 -24
  8. package/dist/cjs/vviinn-vps-button.cjs.entry.js +2 -2
  9. package/dist/collection/components/vviinn-text-search/helpers/autoSuggestDebounce.js +4 -4
  10. package/dist/collection/components/vviinn-text-search/vviinn-text-search.js +25 -22
  11. package/dist/collection/components/vviinn-vps-button/vviinn-vps-button.js +3 -3
  12. package/dist/collection/components/vviinn-vps-widget/vviinn-vps-widget.js +12 -12
  13. package/dist/collection/store/search.store.js +2 -7
  14. package/dist/esm/{index-DHNImAac.js → index-ChtanA0O.js} +1 -1
  15. package/dist/esm/{search.store-DUkS1MAq.js → search.store-BVRhMpHA.js} +4 -9
  16. package/dist/esm/vviinn-button_6.entry.js +1 -1
  17. package/dist/esm/vviinn-camera_12.entry.js +13 -13
  18. package/dist/esm/vviinn-carousel_10.entry.js +2 -2
  19. package/dist/esm/vviinn-shop-the-look.entry.js +1 -1
  20. package/dist/esm/vviinn-text-search.entry.js +27 -24
  21. package/dist/esm/vviinn-vps-button.entry.js +2 -2
  22. package/dist/types/components/vviinn-text-search/helpers/autoSuggestDebounce.d.ts +2 -1
  23. package/dist/types/components/vviinn-text-search/vviinn-text-search.d.ts +2 -1
  24. package/dist/types/store/search.store.d.ts +1 -3
  25. package/{www/build/p-fcbaa790.entry.js → dist/vviinn-widgets/p-1888506e.entry.js} +1 -1
  26. package/dist/vviinn-widgets/{p-ab6447df.entry.js → p-55582bb6.entry.js} +1 -1
  27. package/dist/vviinn-widgets/p-773cdbb0.entry.js +1 -0
  28. package/dist/vviinn-widgets/p-7f9e1cff.entry.js +1 -0
  29. package/dist/vviinn-widgets/{p-C063BS9s.js → p-CU3f7I7a.js} +1 -1
  30. package/dist/vviinn-widgets/{p-DXT8Rt8G.js → p-CZFFW_Cj.js} +1 -1
  31. package/dist/vviinn-widgets/{p-5e186249.entry.js → p-a145a231.entry.js} +1 -1
  32. package/dist/vviinn-widgets/p-ffbd1062.entry.js +1 -0
  33. package/dist/vviinn-widgets/vviinn-widgets.esm.js +1 -1
  34. package/package.json +1 -1
  35. package/{dist/vviinn-widgets/p-fcbaa790.entry.js → www/build/p-1888506e.entry.js} +1 -1
  36. package/www/build/{p-ed15ff33.js → p-1f41ab53.js} +1 -1
  37. package/www/build/{p-ab6447df.entry.js → p-55582bb6.entry.js} +1 -1
  38. package/www/build/p-773cdbb0.entry.js +1 -0
  39. package/www/build/p-7f9e1cff.entry.js +1 -0
  40. package/www/build/{p-C063BS9s.js → p-CU3f7I7a.js} +1 -1
  41. package/www/build/{p-DXT8Rt8G.js → p-CZFFW_Cj.js} +1 -1
  42. package/www/build/{p-5e186249.entry.js → p-a145a231.entry.js} +1 -1
  43. package/www/build/p-ffbd1062.entry.js +1 -0
  44. package/www/build/vviinn-widgets.esm.js +1 -1
  45. package/www/index.html +1 -1
  46. package/dist/vviinn-widgets/p-315db5a2.entry.js +0 -1
  47. package/dist/vviinn-widgets/p-91768e9c.entry.js +0 -1
  48. package/dist/vviinn-widgets/p-fa907040.entry.js +0 -1
  49. package/www/build/p-315db5a2.entry.js +0 -1
  50. package/www/build/p-91768e9c.entry.js +0 -1
  51. package/www/build/p-fa907040.entry.js +0 -1
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  var index = require('./index-D38ORu31.js');
4
- var search_store = require('./search.store-DiomZf0i.js');
4
+ var search_store = require('./search.store-C6QU_D02.js');
5
5
  var store = require('./store-jPZ4ROqV.js');
6
6
 
7
7
  const PlusIcon = () => (index.h("svg", { width: "32", height: "32", viewBox: "0 0 32 32", fill: "none", xmlns: "http://www.w3.org/2000/svg", class: "plus-icon", "aria-hidden": "true" },
@@ -8593,7 +8593,7 @@ const encodeToBase64UTF8 = (str) => {
8593
8593
  return btoa(String.fromCharCode.apply(null, utf8Array));
8594
8594
  };
8595
8595
 
8596
- const version = "2.219.0";
8596
+ const version = "2.220.0";
8597
8597
 
8598
8598
  const appStateGlobalDefaults = {
8599
8599
  excluded: null,
@@ -8623,7 +8623,6 @@ const receivedDataDefaults = {
8623
8623
  detectedObjects: [],
8624
8624
  stream: null,
8625
8625
  redirect: null,
8626
- autoSuggestCompletions: [],
8627
8626
  };
8628
8627
  const storeDefaults = Object.assign(Object.assign(Object.assign({}, appStateGlobalDefaults), appStateDefaults), receivedDataDefaults);
8629
8628
  const widgetStore = createStore(storeDefaults);
@@ -8867,7 +8866,7 @@ const useSearchStore = (showInWidget) => showInWidget
8867
8866
  onChange: onChangeComponentsState,
8868
8867
  storeName: "components",
8869
8868
  };
8870
- const makeAutoSuggestRequest = async (store, query, token, apiPath) => {
8869
+ const makeAutoSuggestRequest = async (store, query, token, apiPath, onCompletions) => {
8871
8870
  const state = useStore(store);
8872
8871
  const body = {
8873
8872
  query,
@@ -8878,7 +8877,7 @@ const makeAutoSuggestRequest = async (store, query, token, apiPath) => {
8878
8877
  ((_a = state.textSearchQuery) === null || _a === void 0 ? void 0 : _a.trim().toLowerCase()))
8879
8878
  return response;
8880
8879
  const completions = (_b = response.data.completions) !== null && _b !== void 0 ? _b : [];
8881
- state.autoSuggestCompletions = completions;
8880
+ onCompletions === null || onCompletions === void 0 ? void 0 : onCompletions(completions);
8882
8881
  const matchingCompletion = completions.find((completion) => completion.suggestion.trim().toLowerCase() ===
8883
8882
  query.trim().toLowerCase() && (completion === null || completion === void 0 ? void 0 : completion.url));
8884
8883
  if (matchingCompletion === null || matchingCompletion === void 0 ? void 0 : matchingCompletion.url) {
@@ -8890,17 +8889,12 @@ const makeAutoSuggestRequest = async (store, query, token, apiPath) => {
8890
8889
  return response;
8891
8890
  }), Rectangle.mapLeft((error) => error))();
8892
8891
  };
8893
- const clearAutoSuggestCompletions = (store) => {
8894
- const state = useStore(store);
8895
- state.autoSuggestCompletions = [];
8896
- };
8897
8892
 
8898
8893
  exports._ArrayExports = _ArrayExports;
8899
8894
  exports.addIfNotEmpty = addIfNotEmpty;
8900
8895
  exports.campaignTypeNames = campaignTypeNames;
8901
8896
  exports.checkDeviceType = checkDeviceType;
8902
8897
  exports.checkImageType = checkImageType;
8903
- exports.clearAutoSuggestCompletions = clearAutoSuggestCompletions;
8904
8898
  exports.extractFilterValue = extractFilterValue;
8905
8899
  exports.fold = fold;
8906
8900
  exports.fromString = fromString;
@@ -2,7 +2,7 @@
2
2
 
3
3
  var index = require('./index-D38ORu31.js');
4
4
  var store = require('./store-jPZ4ROqV.js');
5
- var search_store = require('./search.store-DiomZf0i.js');
5
+ var search_store = require('./search.store-C6QU_D02.js');
6
6
  var index$1 = require('./index-CBteD3gC.js');
7
7
  var SecondaryActionIcon = require('./SecondaryActionIcon-Ng84u7-b.js');
8
8
  var index$2 = require('./index-CvMi8_tX.js');
@@ -2,9 +2,9 @@
2
2
 
3
3
  var index = require('./index-D38ORu31.js');
4
4
  var Rectangle = require('./Rectangle-7dF6_xf3.js');
5
- var search_store = require('./search.store-DiomZf0i.js');
5
+ var search_store = require('./search.store-C6QU_D02.js');
6
6
  var index$2 = require('./index-CBteD3gC.js');
7
- var index$1 = require('./index-DdCwxNyl.js');
7
+ var index$1 = require('./index-FE9nOqQo.js');
8
8
  var store = require('./store-jPZ4ROqV.js');
9
9
  var cropperUtils = require('./cropperUtils-DCDOLeBS.js');
10
10
  var cssUrlHelper = require('./cssUrlHelper-BX9kngtZ.js');
@@ -1758,7 +1758,7 @@ const VviinnVpsWidget = class {
1758
1758
  /** Show the text search */
1759
1759
  this.textSearchShow = false;
1760
1760
  /** Show auto-suggest dropdown with search completions */
1761
- this.autoSuggestShow = false;
1761
+ this.autoSuggestShow = true;
1762
1762
  /** Show or hide Add to Basket buttons */
1763
1763
  this.addToBasketShow = false;
1764
1764
  /** Show or hide Favorite button */
@@ -2148,31 +2148,31 @@ const VviinnVpsWidget = class {
2148
2148
  }
2149
2149
  render() {
2150
2150
  var _a, _b, _c;
2151
- return (index.h(index.Host, { key: '0985a289b00fca5286466be2d4f33ef7d32c49cb', exportparts: `${index$3.modalParts}, ${index$3.productCardParts}, ${index$3.searchBarParts}, ${index$3.searchWidgetFilterParts}, ${index$3.searchWidgetButtonParts}, ${index$3.productCardsGridPart}, ${index$3.suggestionsParts}` }, cssUrlHelper.renderExternalCSS(this.cssUrl), !this.showingInButton && index$2.SlotSkeleton("search"), index.h("vviinn-overlayed-modal", { key: '42c48cf9f6414ccd23705ad4a1ca2dcccf6aa65f', class: { "first-screen": this.isOnboardingSlide() }, isFirstScreen: this.isOnboardingSlide(), active: this.active, resetState: this.resetState, onVviinnWidgetClose: ({ detail }) => {
2151
+ return (index.h(index.Host, { key: '0ffc3a002f79fd6481c59a582561d00f5643c33a', exportparts: `${index$3.modalParts}, ${index$3.productCardParts}, ${index$3.searchBarParts}, ${index$3.searchWidgetFilterParts}, ${index$3.searchWidgetButtonParts}, ${index$3.productCardsGridPart}, ${index$3.suggestionsParts}` }, cssUrlHelper.renderExternalCSS(this.cssUrl), !this.showingInButton && index$2.SlotSkeleton("search"), index.h("vviinn-overlayed-modal", { key: 'af3589b5adc791a3d04c7fce56e6b9177af508da', class: { "first-screen": this.isOnboardingSlide() }, isFirstScreen: this.isOnboardingSlide(), active: this.active, resetState: this.resetState, onVviinnWidgetClose: ({ detail }) => {
2152
2152
  if (detail.campaignTypeId !== "VPR")
2153
2153
  this.handleModalClose();
2154
2154
  }, buttonElementId: (_a = this.buttonElementId) !== null && _a !== void 0 ? _a : this.widgetElementId, widgetVersion: search_store.version, hideBackButton: this.mode === "upload" ||
2155
- (!this.isCameraEnabled && this.isOnboardingSlide()) }, index.h("vviinn-slider", { key: '399dac9c2c005efad3c3506dd84f7bcf9c550eaf', position: this.slidePosition }, index.h("vviinn-slide", { key: '832f2287e46f4edaeade004325106fecbdb3e618', class: {
2155
+ (!this.isCameraEnabled && this.isOnboardingSlide()) }, index.h("vviinn-slider", { key: '1b98b36bde65dedc539bd49468db86a7317a74d4', position: this.slidePosition }, index.h("vviinn-slide", { key: 'd1b48094f57f9f34a808ee79f78875793cbde05f', class: {
2156
2156
  "start-page": true,
2157
2157
  "camera-enabled": this.isCameraEnabled,
2158
- } }, index.h("vviinn-camera", { key: 'fee0491b5660c7f4c61796bfc647edf6c1121ed6', token: this.token, onVviinnImageUploadFinished: ({ detail }) => this.handleVviinnImageUploadFinished(detail), onVviinnImageUploadStarted: () => {
2158
+ } }, index.h("vviinn-camera", { key: 'a8b4695f255d22f80a0980fa6f7e6ef62b9f6e33', token: this.token, onVviinnImageUploadFinished: ({ detail }) => this.handleVviinnImageUploadFinished(detail), onVviinnImageUploadStarted: () => {
2159
2159
  this.handleVviinnImageUpload("startCamera");
2160
- }, apiPath: this.apiPath, basicEventData: this.getBasicEventData(), srcObject: this.stream, cameraButtonClicked: this.isCameraButtonClicked, exampleImageSource: this.exampleImageSource, showInWidget: this.showInWidget, storeName: this.storeName, state: this.state }), index.h("div", { key: 'f5e463f64ac999e3b7bded376a0f12406ad3869d', class: {
2160
+ }, apiPath: this.apiPath, basicEventData: this.getBasicEventData(), srcObject: this.stream, cameraButtonClicked: this.isCameraButtonClicked, exampleImageSource: this.exampleImageSource, showInWidget: this.showInWidget, storeName: this.storeName, state: this.state }), index.h("div", { key: 'b38d1c05099d04c7a8c22587e7c02bd93fce532d', class: {
2161
2161
  error: this.haveErrors(),
2162
- }, id: "start-page_block" }, index.h("div", { key: '155a80658288afe387d77f1140819fa72134a42e', class: "start-page_main-content" }, (this.wrongImageFormat ||
2163
- this.state.searchStatus === "error") && (index.h("div", { key: '3c948759b2b3b264008d814d8c711cba759f0042', class: "start-page_errors-block" }, this.getCurrentErrorType() && (index.h("vviinn-error", { key: '6ded7b63230680c53893a571100ad63787db36e8', errorType: this.getCurrentErrorType(), handler: this.resetState, hasBackground: true, searchType: this.state.searchType })))), !this.haveErrors() && (index.h(index.Fragment, { key: '14c56d10d2df3af3f32b37aa10bc687bc4a52617' }, index.h("vviinn-teaser", { key: '99092cc741e26cb2f1101fa4bb5ff219017c7be9' }), index.h("div", { key: '77cf9e9e82a38e9fc9de074c3d02dda473d604ac', class: "buttons-group" }, this.renderButtons()), this.textSearchShow && !this.isResultSlide() && (index.h("vviinn-text-search", { key: '9393d8afb3ae1bbc3ed1d6f4f6461356dd3be912', token: this.token, apiPath: this.apiPath, locale: this.locale, showInWidget: this.showInWidget, showOnFirstScreen: true, uiSessionId: this.uiSessionId, basicEventData: this.getBasicEventData(true), resultsPageUrl: this.resultsPageUrl, autoSuggestShow: this.autoSuggestShow, "save-image-mode": "never" }))))), index.h("vviinn-privacy-badge", { key: '4c381e57c33d18a5736af7ad54a3512ba1ace512', privacyBadgeText: store.instance.t("privacyBadgeText", {
2162
+ }, id: "start-page_block" }, index.h("div", { key: 'c989f1cb41cced69828e4f24ea925922b92218ec', class: "start-page_main-content" }, (this.wrongImageFormat ||
2163
+ this.state.searchStatus === "error") && (index.h("div", { key: 'ed3feb471a4bbd2989800c9ab698ee8c9c3f8845', class: "start-page_errors-block" }, this.getCurrentErrorType() && (index.h("vviinn-error", { key: 'f859d178f1804136273faef22e5188fd51d07d4c', errorType: this.getCurrentErrorType(), handler: this.resetState, hasBackground: true, searchType: this.state.searchType })))), !this.haveErrors() && (index.h(index.Fragment, { key: 'b137960307e69c1884da1258a4ccb7456da4be43' }, index.h("vviinn-teaser", { key: '9f13392722c88be790b4a2ceed67197a25c7ccdc' }), index.h("div", { key: '94640ebeec975c56bac6bf90197cd95f1cb99f95', class: "buttons-group" }, this.renderButtons()), this.textSearchShow && !this.isResultSlide() && (index.h("vviinn-text-search", { key: '3c556fa2769f9ae91d7647e834aae3033c1131e9', token: this.token, apiPath: this.apiPath, locale: this.locale, showInWidget: this.showInWidget, showOnFirstScreen: true, uiSessionId: this.uiSessionId, basicEventData: this.getBasicEventData(true), resultsPageUrl: this.resultsPageUrl, autoSuggestShow: this.autoSuggestShow, "save-image-mode": "never" }))))), index.h("vviinn-privacy-badge", { key: 'a4021fb73a348f19e2401852d36e16b50f93506a', privacyBadgeText: store.instance.t("privacyBadgeText", {
2164
2164
  interpolation: { escapeValue: false },
2165
- }), class: { invisible: this.haveErrors() } }))), index.h("vviinn-slide", { key: 'c3f7ea7984ce33f702153878f378be802adb8258', class: {
2165
+ }), class: { invisible: this.haveErrors() } }))), index.h("vviinn-slide", { key: 'e9fabc9d45efd4f621454b076f9508c3b79ce690', class: {
2166
2166
  "results-page": true,
2167
2167
  active: this.isResultSlide(),
2168
- } }, this.isResultSlide() && (index.h("div", { key: 'cd8ec6519b09395d2b4926301bfeec3dc91d2ac6', class: "source-wrapper" }, this.isTextSearch() && (index.h("vviinn-text-search", { key: '96e71f8fb6f1c682f872e76f2b9dd5616d767934', token: this.token, showInWidget: this.showInWidget, apiPath: this.apiPath, locale: this.locale, uiSessionId: this.uiSessionId, basicEventData: this.getBasicEventData(true), resultsPageUrl: this.resultsPageUrl, autoSuggestShow: this.autoSuggestShow, "save-image-mode": "never" })), !this.isTextSearch() && (index.h("vviinn-cropper", { key: '4aabf6d68425e50b277c15c881c40bea2e4d38b1', token: this.token, basicEventData: this.getBasicEventData(), showAspectRatioError: this.showAspectRatioError, apiPath: this.apiPath, showInWidget: this.showInWidget, "save-image-mode": "never" })), index.h("vviinn-suggestions", { key: 'ca8f970dbd2f3b1824f80feb7477b3d34b8b5ed1', showInWidget: this.showInWidget, token: this.token, apiPath: this.apiPath, locale: this.locale }), index.h("vviinn-selected-filters", { key: '44ff0a2c8dea93a3b5c2cd593b34dc20a4b115b4', locale: this.locale, currencySign: this.currencySign, showInWidget: this.showInWidget, exportparts: index$3.filtersParts }), ((_b = this.state.dynamicFilters) === null || _b === void 0 ? void 0 : _b.length) > 0 && (index.h("div", { key: 'dbf0b1c1a240f60931b1b75d8b76806e071f359f', class: {
2168
+ } }, this.isResultSlide() && (index.h("div", { key: '5240101a650b79c94b9c1e7a835f7061a328b41c', class: "source-wrapper" }, this.isTextSearch() && (index.h("vviinn-text-search", { key: '91c201e63dc2f01a4d00fe6f5a08e6627cfb7873', token: this.token, showInWidget: this.showInWidget, apiPath: this.apiPath, locale: this.locale, uiSessionId: this.uiSessionId, basicEventData: this.getBasicEventData(true), resultsPageUrl: this.resultsPageUrl, autoSuggestShow: this.autoSuggestShow, "save-image-mode": "never" })), !this.isTextSearch() && (index.h("vviinn-cropper", { key: 'ba7917b428a626458ab0956c028ac6d7fc3310f0', token: this.token, basicEventData: this.getBasicEventData(), showAspectRatioError: this.showAspectRatioError, apiPath: this.apiPath, showInWidget: this.showInWidget, "save-image-mode": "never" })), index.h("vviinn-suggestions", { key: '7954cbf976caf22a47d1b59cd242aad2546e4da5', showInWidget: this.showInWidget, token: this.token, apiPath: this.apiPath, locale: this.locale }), index.h("vviinn-selected-filters", { key: 'ac42d53feaeb3af7bc3e916e5a4cee9a9ba4b395', locale: this.locale, currencySign: this.currencySign, showInWidget: this.showInWidget, exportparts: index$3.filtersParts }), ((_b = this.state.dynamicFilters) === null || _b === void 0 ? void 0 : _b.length) > 0 && (index.h("div", { key: 'f8869d18215c0d35196217efdad6501234cbbf97', class: {
2169
2169
  "filters-wrapper": true,
2170
2170
  hidden: this.showAspectRatioError,
2171
- } }, index.h("vviinn-filters", { key: '801f6aab643da44e564f062fddeb14811eca70bd', showInWidget: this.showInWidget, showIntervalInputs: this.showIntervalInputs }), index.h("vviinn-extended-filters", { key: '36a32875a0532cbf7148720df7a743bb0159e51e', mode: "preview", showHeader: false, showInWidget: this.showInWidget, locale: this.locale, currencySign: this.currencySign, showIntervalInputs: this.showIntervalInputs }), index.h("vviinn-extended-filters-button", { key: '148bf202a89af93e8cd88a612d585d0849a3d7de', class: {
2171
+ } }, index.h("vviinn-filters", { key: '87c6a34f3600b5c27bc0a9dc4e68239a5179593d', showInWidget: this.showInWidget, showIntervalInputs: this.showIntervalInputs }), index.h("vviinn-extended-filters", { key: '2185ccdc5005da02c03562b290693390a6ecf2ff', mode: "preview", showHeader: false, showInWidget: this.showInWidget, locale: this.locale, currencySign: this.currencySign, showIntervalInputs: this.showIntervalInputs }), index.h("vviinn-extended-filters-button", { key: '3b65d1435f512939444dcef95a4902c0f70a25f1', class: {
2172
2172
  "extended-filters-button": true,
2173
2173
  "has-primary-filters": this.state.dynamicFilters.filter((f) => f.isPrimary)
2174
2174
  .length > 0,
2175
- }, showInWidget: this.showInWidget }))))), this.isResultSlide() && (index.h(index.Fragment, { key: '263743fba6b324f47a1fae12648995bdef73aa25' }, index.h("vviinn-results", { key: '977140130b3b8dafaac6ae428c2b9f013de37d00', token: this.token, locale: this.locale, numberLocale: this.numberLocale, pricePrefix: this.pricePrefix, "currency-sign": this.currencySign, apiPath: this.apiPath, campaignIdTextSearch: this.campaignIdTextSearch, campaignIdVisualSearch: this.campaignIdVisualSearch, uiSessionId: this.uiSessionId, widgetElementId: (_c = this.buttonElementId) !== null && _c !== void 0 ? _c : this.widgetElementId, showInWidget: this.showInWidget, buttonElementId: this.buttonElementId, imageResolutionWidth: this.imageResolutionWidth, showMultipleImages: this.showMultipleImages, productDetailsNewTab: this.productDetailsNewTab, productDetailsRedirect: this.productDetailsRedirect, addToBasketShow: this.addToBasketShow, favoriteShow: this.favoriteShow, showAspectRatioError: this.showAspectRatioError, resetWidgetState: this.resetState, replaceSlotsContentInWidget: this.replaceSlotsContent.bind(this), replaceSlotsContentInButton: this.replaceSlotsContentInButton, addPriceContainer: this.addPriceContainer, oneClickDiscoveryMode: this.oneClickDiscoveryMode, oneClickDiscoveryCampaigns: this.oneClickDiscoveryCampaigns, parentSlots: [...this.parentSlots, ...this.slots], scrollableModalBody: this.modalBody }))))), index.h("vviinn-extended-filters", { key: '24d12faff2641fd61a4d13d7303734f1770120b2', class: "modal-extended-filters", mode: "modal", exportparts: index$3.extendedFiltersParts, showInWidget: this.showInWidget, locale: this.locale, currencySign: this.currencySign, showIntervalInputs: this.showIntervalInputs }))));
2175
+ }, showInWidget: this.showInWidget }))))), this.isResultSlide() && (index.h(index.Fragment, { key: '20234d1d8db73b4a0e7e3160ece10ec961623970' }, index.h("vviinn-results", { key: 'b66732f0a86a9e296e4fd6dbb1c75e4e4debe657', token: this.token, locale: this.locale, numberLocale: this.numberLocale, pricePrefix: this.pricePrefix, "currency-sign": this.currencySign, apiPath: this.apiPath, campaignIdTextSearch: this.campaignIdTextSearch, campaignIdVisualSearch: this.campaignIdVisualSearch, uiSessionId: this.uiSessionId, widgetElementId: (_c = this.buttonElementId) !== null && _c !== void 0 ? _c : this.widgetElementId, showInWidget: this.showInWidget, buttonElementId: this.buttonElementId, imageResolutionWidth: this.imageResolutionWidth, showMultipleImages: this.showMultipleImages, productDetailsNewTab: this.productDetailsNewTab, productDetailsRedirect: this.productDetailsRedirect, addToBasketShow: this.addToBasketShow, favoriteShow: this.favoriteShow, showAspectRatioError: this.showAspectRatioError, resetWidgetState: this.resetState, replaceSlotsContentInWidget: this.replaceSlotsContent.bind(this), replaceSlotsContentInButton: this.replaceSlotsContentInButton, addPriceContainer: this.addPriceContainer, oneClickDiscoveryMode: this.oneClickDiscoveryMode, oneClickDiscoveryCampaigns: this.oneClickDiscoveryCampaigns, parentSlots: [...this.parentSlots, ...this.slots], scrollableModalBody: this.modalBody }))))), index.h("vviinn-extended-filters", { key: 'b08b5f73b3462169236f63aa2499940aa0898115', class: "modal-extended-filters", mode: "modal", exportparts: index$3.extendedFiltersParts, showInWidget: this.showInWidget, locale: this.locale, currencySign: this.currencySign, showIntervalInputs: this.showIntervalInputs }))));
2176
2176
  }
2177
2177
  get el() { return index.getElement(this); }
2178
2178
  static get watchers() { return {
@@ -1,10 +1,10 @@
1
1
  'use strict';
2
2
 
3
3
  var index = require('./index-D38ORu31.js');
4
- var search_store = require('./search.store-DiomZf0i.js');
4
+ var search_store = require('./search.store-C6QU_D02.js');
5
5
  var Rectangle = require('./Rectangle-7dF6_xf3.js');
6
6
  var store = require('./store-jPZ4ROqV.js');
7
- var index$1 = require('./index-DdCwxNyl.js');
7
+ var index$1 = require('./index-FE9nOqQo.js');
8
8
  var constants = require('./constants-BlwqMvns.js');
9
9
  var index$2 = require('./index-CBteD3gC.js');
10
10
  var index$3 = require('./index-CvMi8_tX.js');
@@ -4,7 +4,7 @@ var index = require('./index-D38ORu31.js');
4
4
  var Rectangle = require('./Rectangle-7dF6_xf3.js');
5
5
  var cropperUtils = require('./cropperUtils-DCDOLeBS.js');
6
6
  var swiperElement = require('./swiper-element-DjtzojCR.js');
7
- var search_store = require('./search.store-DiomZf0i.js');
7
+ var search_store = require('./search.store-C6QU_D02.js');
8
8
  var SecondaryActionIcon = require('./SecondaryActionIcon-Ng84u7-b.js');
9
9
  var index$1 = require('./index-CvMi8_tX.js');
10
10
  var store = require('./store-jPZ4ROqV.js');
@@ -2,7 +2,7 @@
2
2
 
3
3
  var index = require('./index-D38ORu31.js');
4
4
  var Rectangle = require('./Rectangle-7dF6_xf3.js');
5
- var search_store = require('./search.store-DiomZf0i.js');
5
+ var search_store = require('./search.store-C6QU_D02.js');
6
6
  var index$2 = require('./index-CBteD3gC.js');
7
7
  var store = require('./store-jPZ4ROqV.js');
8
8
  var index$1 = require('./index-CvMi8_tX.js');
@@ -16,17 +16,17 @@ const MicIcon = () => (index.h("svg", { xmlns: "http://www.w3.org/2000/svg", vie
16
16
  index.h("path", { d: "M12 14C11.1667 14 10.4583 13.7083 9.87501 13.125C9.29168 12.5417 9.00001 11.8333 9.00001 11V5C9.00001 4.16667 9.29168 3.45833 9.87501 2.875C10.4583 2.29167 11.1667 2 12 2C12.8333 2 13.5417 2.29167 14.125 2.875C14.7083 3.45833 15 4.16667 15 5V11C15 11.8333 14.7083 12.5417 14.125 13.125C13.5417 13.7083 12.8333 14 12 14ZM11 20V17.925C9.46668 17.7083 8.15418 17.0583 7.06251 15.975C5.97085 14.8917 5.30835 13.575 5.07501 12.025C5.04168 11.7417 5.11668 11.5 5.30001 11.3C5.48335 11.1 5.71668 11 6.00001 11C6.28335 11 6.52085 11.0958 6.71251 11.2875C6.90418 11.4792 7.03335 11.7167 7.10001 12C7.33335 13.1667 7.91251 14.125 8.83751 14.875C9.76251 15.625 10.8167 16 12 16C13.2 16 14.2583 15.6208 15.175 14.8625C16.0917 14.1042 16.6667 13.15 16.9 12C16.9667 11.7167 17.0958 11.4792 17.2875 11.2875C17.4792 11.0958 17.7167 11 18 11C18.2833 11 18.5167 11.1 18.7 11.3C18.8833 11.5 18.9583 11.7417 18.925 12.025C18.6917 13.5417 18.0333 14.85 16.95 15.95C15.8667 17.05 14.55 17.7083 13 17.925V20C13 20.2833 12.9042 20.5208 12.7125 20.7125C12.5208 20.9042 12.2833 21 12 21C11.7167 21 11.4792 20.9042 11.2875 20.7125C11.0958 20.5208 11 20.2833 11 20Z", fill: "#161616" })));
17
17
 
18
18
  const AUTO_SUGGEST_DEBOUNCE_MS = 300;
19
- const createAutoSuggestHandler = (storeName, token, apiPath) => {
19
+ const createAutoSuggestHandler = (storeName, token, apiPath, onCompletions) => {
20
20
  let debounceTimer;
21
21
  const handleInputChange = (value) => {
22
22
  search_store.setTextSearchQuery(storeName, value);
23
23
  clearTimeout(debounceTimer);
24
24
  if (!value) {
25
- search_store.clearAutoSuggestCompletions(storeName);
25
+ onCompletions([]);
26
26
  return;
27
27
  }
28
28
  debounceTimer = setTimeout(() => {
29
- search_store.makeAutoSuggestRequest(storeName, value, token, apiPath);
29
+ search_store.makeAutoSuggestRequest(storeName, value, token, apiPath, onCompletions);
30
30
  }, AUTO_SUGGEST_DEBOUNCE_MS);
31
31
  };
32
32
  const cancelPending = () => clearTimeout(debounceTimer);
@@ -184,7 +184,7 @@ const VviinnTextSearch = class {
184
184
  /** Custom placeholder for the text search input */
185
185
  this.placeholder = "";
186
186
  /** Show auto-suggest dropdown with search completions */
187
- this.autoSuggestShow = false;
187
+ this.autoSuggestShow = true;
188
188
  /** True, when used inside the widget */
189
189
  /** @internal */
190
190
  this.showInWidget = false;
@@ -197,6 +197,7 @@ const VviinnTextSearch = class {
197
197
  this.activeSuggestionIndex = -1;
198
198
  this.originalQuery = "";
199
199
  this.searchSubmitted = false;
200
+ this.isDisconnected = false;
200
201
  this.slots = [];
201
202
  this.isShowPreloader = () => this.state.searchStatus === "loading" && this.state.searchType === "text";
202
203
  this.isShowRecording = () => this.isRecording;
@@ -212,6 +213,14 @@ const VviinnTextSearch = class {
212
213
  ? this.placeholder
213
214
  : store.instance.t("textSearchPlaceholder");
214
215
  this.recognition = null;
216
+ this.setAutoSuggestCompletions = (completions) => {
217
+ if (this.isDisconnected)
218
+ return;
219
+ if (this.searchSubmitted && completions.length > 0)
220
+ return;
221
+ this.autoSuggestCompletions = completions;
222
+ this.activeSuggestionIndex = -1;
223
+ };
215
224
  this.trackTextSearch = () => this.vviinnFilterTriggered.emit({
216
225
  kind: this.state.textSearchQuery,
217
226
  action: "select",
@@ -246,7 +255,8 @@ const VviinnTextSearch = class {
246
255
  }
247
256
  };
248
257
  this.hideSuggestions = () => {
249
- search_store.clearAutoSuggestCompletions(this.storeName);
258
+ this.autoSuggestCompletions = [];
259
+ this.activeSuggestionIndex = -1;
250
260
  };
251
261
  this.selectSuggestion = (completion) => {
252
262
  search_store.setTextSearchQuery(this.storeName, completion.suggestion);
@@ -304,7 +314,7 @@ const VviinnTextSearch = class {
304
314
  }
305
315
  };
306
316
  this.checkAutoSuggest = async (query) => {
307
- Rectangle._functionExports.pipe(await search_store.makeAutoSuggestRequest(this.storeName, query, this.token, this.apiPath), Rectangle.fold(
317
+ Rectangle._functionExports.pipe(await search_store.makeAutoSuggestRequest(this.storeName, query, this.token, this.apiPath, this.setAutoSuggestCompletions), Rectangle.fold(
308
318
  // Intentionally ignore errors for auto-suggest
309
319
  () => { }, () => { }));
310
320
  };
@@ -335,24 +345,17 @@ const VviinnTextSearch = class {
335
345
  };
336
346
  }
337
347
  connectedCallback() {
338
- const { state, storeName, onChange } = search_store.useSearchStore(this.showInWidget);
348
+ const { state, storeName } = search_store.useSearchStore(this.showInWidget);
339
349
  this.state = state;
340
350
  this.storeName = storeName;
341
- if (this.autoSuggestShow) {
342
- this.disposeOnChange = onChange("autoSuggestCompletions", (completions) => {
343
- if (this.searchSubmitted && completions.length > 0)
344
- return;
345
- this.autoSuggestCompletions = completions;
346
- this.activeSuggestionIndex = -1;
347
- });
348
- }
351
+ this.isDisconnected = false;
349
352
  }
350
353
  disconnectedCallback() {
351
- var _a, _b;
354
+ var _a;
355
+ this.isDisconnected = true;
352
356
  clearTimeout(this.triggerTooltipStart);
353
357
  clearTimeout(this.triggerTooltipEnd);
354
358
  (_a = this.autoSuggestHandler) === null || _a === void 0 ? void 0 : _a.cleanup();
355
- (_b = this.disposeOnChange) === null || _b === void 0 ? void 0 : _b.call(this);
356
359
  }
357
360
  async componentWillLoad() {
358
361
  var _a, _b, _c;
@@ -360,7 +363,7 @@ const VviinnTextSearch = class {
360
363
  index$2.slotChangeListener(this, this.el);
361
364
  this.slots = index$2.findSlotElements(this.el);
362
365
  if (this.autoSuggestShow) {
363
- this.autoSuggestHandler = createAutoSuggestHandler(this.storeName, this.token, this.apiPath);
366
+ this.autoSuggestHandler = createAutoSuggestHandler(this.storeName, this.token, this.apiPath, this.setAutoSuggestCompletions);
364
367
  }
365
368
  this.recognition = initializeRecognition((_a = this.locale) !== null && _a !== void 0 ? _a : store.defaultConfig.locale, () => {
366
369
  this.showRecording();
@@ -405,7 +408,7 @@ const VviinnTextSearch = class {
405
408
  }
406
409
  }
407
410
  render() {
408
- return (index.h(index.Host, { key: 'a97f9685f46a30ca9ab12396ee1aa01482731370', exportparts: `${index$1.searchBarParts}, ${index$1.searchModalFirstScreenParts}` }, index.h("div", { key: '384e2cc006c0c66b2e50d56631beb538cbaa4f07', class: "text-search-container", part: "text-search-container" }, index.h("input", Object.assign({ key: '5e571ee58eab698531946a19c5e92fb970340d33', class: "text-search-input", part: "text-search-input", type: "text", placeholder: this.getPlaceholderText(), value: this.state.textSearchQuery || "", onInput: (event) => this.handleInputChange(event), onKeyDown: this.handleKeyDown, onBlur: this.autoSuggestShow ? this.hideSuggestions : undefined }, (this.autoSuggestShow && {
411
+ return (index.h(index.Host, { key: '0ac6e28c6631ea47c8e7c47b63fa2eb3af500087', exportparts: `${index$1.searchBarParts}, ${index$1.searchModalFirstScreenParts}` }, index.h("div", { key: '4b1d8edd675e91f4abd1a5933a1449b721a571c1', class: "text-search-container", part: "text-search-container" }, index.h("input", Object.assign({ key: '13e356c598ada0b70e9b5c99531563dae6c334b5', class: "text-search-input", part: "text-search-input", type: "text", placeholder: this.getPlaceholderText(), value: this.state.textSearchQuery || "", onInput: (event) => this.handleInputChange(event), onKeyDown: this.handleKeyDown, onBlur: this.autoSuggestShow ? this.hideSuggestions : undefined }, (this.autoSuggestShow && {
409
412
  role: "combobox",
410
413
  "aria-autocomplete": "list",
411
414
  "aria-expanded": this.autoSuggestCompletions.length > 0 &&
@@ -416,11 +419,11 @@ const VviinnTextSearch = class {
416
419
  "aria-activedescendant": this.activeSuggestionIndex >= 0
417
420
  ? `suggestion-${this.activeSuggestionIndex}`
418
421
  : undefined,
419
- }))), this.mode === "extended" && (index.h("vviinn-vps-button", Object.assign({ key: 'a92908b647b3f07546bfa3e3a15f7306374cd59d', token: this.token, locale: this.locale, apiPath: this.apiPath, addStyle: false, showResultsInModal: false, resultsPageUrl: this.resultsPageUrl, resultsPageParams: this.resultsPageParams }, (this.exampleImageSource && {
422
+ }))), this.mode === "extended" && (index.h("vviinn-vps-button", Object.assign({ key: 'c3d89667ac1eaa2682a4e3c68481b06f9479e0d6', token: this.token, locale: this.locale, apiPath: this.apiPath, addStyle: false, showResultsInModal: false, resultsPageUrl: this.resultsPageUrl, resultsPageParams: this.resultsPageParams }, (this.exampleImageSource && {
420
423
  exampleImageSource: this.exampleImageSource,
421
- }), (this.cssUrl != null && { cssUrl: this.cssUrl }), (this.visualSearchMode && { mode: this.visualSearchMode }), { parentSlots: this.slots }))), this.mode === "basic" && (index.h("slot", { key: '06e20a8744dea22ee8bd51d5a1e37b5e29b0b7f4', name: "vviinn-text-search-actions" })), (this.mode === "extended" || this.showInWidget) &&
422
- this.recognition && (index.h("button", { key: '1ab2f0acb7137c36231a542234a717e34430474f', class: "speech-button", part: "speech-button", "aria-label": store.instance.t("a11y.speechButton"), onClick: this.handleSpeech, onKeyDown: (event) => this.handleButtonKeyDown(event, this.handleSpeech) }, index.h(MicIcon, { key: 'eb97b29086e9e5ad18b1ff6ac9637b760ae2c83a' }), this.isShowRecording() && (index.h("span", { key: 'dc8cecbb91eaa4a5195727b50919022898630a23', class: "recording-indicator" })))), index.h("button", { key: 'ebd39b8d86ab47cd4fadda6a5ad30c8001bd8c5a', class: "text-search-button", part: "text-search-button", onClick: () => this.handleTextSearch(), onKeyDown: (event) => this.handleButtonKeyDown(event, this.handleTextSearch), disabled: this.state.searchStatus === "loading", "aria-label": store.instance.t("a11y.textSearchButton") }, this.isShowPreloader() ? (index.h("vviinn-preloader", null)) : (index.h("slot", { name: "vviinn-text-search-icon" }, index.h(TextSearchIcon, null))))), this.autoSuggestShow &&
423
- renderSuggestions(this.autoSuggestCompletions, this.state.textSearchQuery, this.activeSuggestionIndex, this.selectSuggestion), this.showTooltip && (index.h("p", { key: 'd59b3a49c6bda6b2992e3b0aa7bffb4ef674d3b6', class: "text-search-tooltip", part: "text-search-tooltip" }, store.instance.t(this.tooltipText)))));
424
+ }), (this.cssUrl != null && { cssUrl: this.cssUrl }), (this.visualSearchMode && { mode: this.visualSearchMode }), { parentSlots: this.slots }))), this.mode === "basic" && (index.h("slot", { key: 'c900b67d3dcffb64f3ca513c0475f64eb72ef495', name: "vviinn-text-search-actions" })), (this.mode === "extended" || this.showInWidget) &&
425
+ this.recognition && (index.h("button", { key: '99f75f77a43f618a45bd06124f283a5b97e422c3', class: "speech-button", part: "speech-button", "aria-label": store.instance.t("a11y.speechButton"), onClick: this.handleSpeech, onKeyDown: (event) => this.handleButtonKeyDown(event, this.handleSpeech) }, index.h(MicIcon, { key: 'ab0676502accecbb25377737a595550ae96b19cc' }), this.isShowRecording() && (index.h("span", { key: 'ece24c838cabc64e9b045c5eb97bc47d7bd932ba', class: "recording-indicator" })))), index.h("button", { key: 'e986f20a8e3d02f38e58c6a6e6946795d6d29875', class: "text-search-button", part: "text-search-button", onClick: () => this.handleTextSearch(), onKeyDown: (event) => this.handleButtonKeyDown(event, this.handleTextSearch), disabled: this.state.searchStatus === "loading", "aria-label": store.instance.t("a11y.textSearchButton") }, this.isShowPreloader() ? (index.h("vviinn-preloader", null)) : (index.h("slot", { name: "vviinn-text-search-icon" }, index.h(TextSearchIcon, null))))), this.autoSuggestShow &&
426
+ renderSuggestions(this.autoSuggestCompletions, this.state.textSearchQuery, this.activeSuggestionIndex, this.selectSuggestion), this.showTooltip && (index.h("p", { key: '470a0c67f9f310f775566a4e581be3dbb7a7cb95', class: "text-search-tooltip", part: "text-search-tooltip" }, store.instance.t(this.tooltipText)))));
424
427
  }
425
428
  get el() { return index.getElement(this); }
426
429
  };
@@ -68,7 +68,7 @@ const VviinnVpsButton = class {
68
68
  /** Show the text search */
69
69
  this.textSearchShow = false;
70
70
  /** Show auto-suggest dropdown with search completions */
71
- this.autoSuggestShow = false;
71
+ this.autoSuggestShow = true;
72
72
  /** Show or hide Add to Basket buttons */
73
73
  this.addToBasketShow = false;
74
74
  /** Show or hide Favorite button */
@@ -155,7 +155,7 @@ const VviinnVpsButton = class {
155
155
  }
156
156
  render() {
157
157
  const { ariaLabel, buttonIcon } = this.getButtonConfig();
158
- return (index.h(index.Host, { key: '9d0e319edac342158caa501aae1756ade2b92242', role: this.buttonPressed ? undefined : "button", "aria-label": this.buttonPressed ? undefined : ariaLabel, exportparts: `vviinn-button, ${index$1.searchModalFirstScreenParts}` }, cssUrlHelper.renderExternalCSS(this.cssUrl), index.h("vviinn-button", { key: 'f30a55f9bbb705f5a17c925b655fa9210695b18d', addStyle: this.addStyle, part: "vviinn-button", tabindex: this.buttonPressed ? undefined : "0", onClick: this.buttonPressed ? undefined : this.handleActivation, onKeyDown: this.buttonPressed ? undefined : this.handleKeyDown }, index.h("slot", { key: 'e4fe7e8fe94fde3111836c7d0ae227a9a35fd1f4' }, buttonIcon)), index$2.SlotSkeleton("search"), index.h("vviinn-vps-widget", { key: '981a1866d06c8e35d7a9b211bf9f87ad06b85e42', mode: this.mode, "currency-sign": this.currencySign, token: this.token, locale: this.locale, numberLocale: this.numberLocale, apiPath: this.apiPath, pricePrefix: this.pricePrefix, campaignId: this.campaignId, campaignIdTextSearch: this.campaignIdTextSearch, campaignIdVisualSearch: this.campaignIdVisualSearch, showingInButton: true, buttonPressed: this.buttonPressed, resetVpsButton: this.resetButton, buttonElementId: this.el.id, active: this.buttonPressed &&
158
+ return (index.h(index.Host, { key: '2d9e0e9860039f521305b3f25da2a6aa5fee5e37', role: this.buttonPressed ? undefined : "button", "aria-label": this.buttonPressed ? undefined : ariaLabel, exportparts: `vviinn-button, ${index$1.searchModalFirstScreenParts}` }, cssUrlHelper.renderExternalCSS(this.cssUrl), index.h("vviinn-button", { key: '33bf0113ab55a6bf91cf25181fe8d863af84d264', addStyle: this.addStyle, part: "vviinn-button", tabindex: this.buttonPressed ? undefined : "0", onClick: this.buttonPressed ? undefined : this.handleActivation, onKeyDown: this.buttonPressed ? undefined : this.handleKeyDown }, index.h("slot", { key: '922d706ce5bf9418c3747fc69bf7920d2ad53c8b' }, buttonIcon)), index$2.SlotSkeleton("search"), index.h("vviinn-vps-widget", { key: 'd6735e7ff8e3ca9dca10f5546d7c4f9f97a8ffa7', mode: this.mode, "currency-sign": this.currencySign, token: this.token, locale: this.locale, numberLocale: this.numberLocale, apiPath: this.apiPath, pricePrefix: this.pricePrefix, campaignId: this.campaignId, campaignIdTextSearch: this.campaignIdTextSearch, campaignIdVisualSearch: this.campaignIdVisualSearch, showingInButton: true, buttonPressed: this.buttonPressed, resetVpsButton: this.resetButton, buttonElementId: this.el.id, active: this.buttonPressed &&
159
159
  (this.mode === "modal" || this.mode === "camera"), excluded: this.excluded, productDetailsNewTab: this.productDetailsNewTab, productDetailsRedirect: this.productDetailsRedirect, imageResolutionWidth: this.imageResolutionWidth, showMultipleImages: this.showMultipleImages, exampleImageSource: this.exampleImageSource, textSearchShow: this.textSearchShow, autoSuggestShow: this.autoSuggestShow, addToBasketShow: this.addToBasketShow, addPriceContainer: this.addPriceContainer, showIntervalInputs: this.showIntervalInputs, replaceSlotsContentInButton: this.replaceSlotsContent.bind(this), oneClickDiscoveryMode: this.oneClickDiscoveryMode, oneClickDiscoveryCampaigns: this.oneClickDiscoveryCampaigns, favoriteShow: this.favoriteShow, showResultsInModal: this.showResultsInModal, resultsPageUrl: this.resultsPageUrl, resultsPageParams: this.resultsPageParams, parentSlots: [...this.parentSlots, ...this.slots], cssUrl: this.cssUrl })));
160
160
  }
161
161
  get el() { return index.getElement(this); }
@@ -1,16 +1,16 @@
1
- import { clearAutoSuggestCompletions, makeAutoSuggestRequest, setTextSearchQuery, } from "../../../store/search.store";
1
+ import { makeAutoSuggestRequest, setTextSearchQuery, } from "../../../store/search.store";
2
2
  const AUTO_SUGGEST_DEBOUNCE_MS = 300;
3
- export const createAutoSuggestHandler = (storeName, token, apiPath) => {
3
+ export const createAutoSuggestHandler = (storeName, token, apiPath, onCompletions) => {
4
4
  let debounceTimer;
5
5
  const handleInputChange = (value) => {
6
6
  setTextSearchQuery(storeName, value);
7
7
  clearTimeout(debounceTimer);
8
8
  if (!value) {
9
- clearAutoSuggestCompletions(storeName);
9
+ onCompletions([]);
10
10
  return;
11
11
  }
12
12
  debounceTimer = setTimeout(() => {
13
- makeAutoSuggestRequest(storeName, value, token, apiPath);
13
+ makeAutoSuggestRequest(storeName, value, token, apiPath, onCompletions);
14
14
  }, AUTO_SUGGEST_DEBOUNCE_MS);
15
15
  };
16
16
  const cancelPending = () => clearTimeout(debounceTimer);
@@ -2,7 +2,7 @@ import { Host, h, } from "@stencil/core";
2
2
  import * as E from "fp-ts/Either";
3
3
  import { pipe } from "fp-ts/lib/function";
4
4
  import { version } from "../../../package.json";
5
- import { clearAutoSuggestCompletions, makeAutoSuggestRequest, makeTextSearchRequest, setTextSearchQuery, useSearchStore, } from "../../store/search.store";
5
+ import { makeAutoSuggestRequest, makeTextSearchRequest, setTextSearchQuery, useSearchStore, } from "../../store/search.store";
6
6
  import { TextSearchIcon } from "../vviinn-icons";
7
7
  import { slotChangeListener } from "../customized-slots";
8
8
  import i18next from "i18next";
@@ -46,7 +46,7 @@ export class VviinnTextSearch {
46
46
  /** Custom placeholder for the text search input */
47
47
  this.placeholder = "";
48
48
  /** Show auto-suggest dropdown with search completions */
49
- this.autoSuggestShow = false;
49
+ this.autoSuggestShow = true;
50
50
  /** True, when used inside the widget */
51
51
  /** @internal */
52
52
  this.showInWidget = false;
@@ -59,6 +59,7 @@ export class VviinnTextSearch {
59
59
  this.activeSuggestionIndex = -1;
60
60
  this.originalQuery = "";
61
61
  this.searchSubmitted = false;
62
+ this.isDisconnected = false;
62
63
  this.slots = [];
63
64
  this.isShowPreloader = () => this.state.searchStatus === "loading" && this.state.searchType === "text";
64
65
  this.isShowRecording = () => this.isRecording;
@@ -74,6 +75,14 @@ export class VviinnTextSearch {
74
75
  ? this.placeholder
75
76
  : i18next.t("textSearchPlaceholder");
76
77
  this.recognition = null;
78
+ this.setAutoSuggestCompletions = (completions) => {
79
+ if (this.isDisconnected)
80
+ return;
81
+ if (this.searchSubmitted && completions.length > 0)
82
+ return;
83
+ this.autoSuggestCompletions = completions;
84
+ this.activeSuggestionIndex = -1;
85
+ };
77
86
  this.trackTextSearch = () => this.vviinnFilterTriggered.emit({
78
87
  kind: this.state.textSearchQuery,
79
88
  action: "select",
@@ -108,7 +117,8 @@ export class VviinnTextSearch {
108
117
  }
109
118
  };
110
119
  this.hideSuggestions = () => {
111
- clearAutoSuggestCompletions(this.storeName);
120
+ this.autoSuggestCompletions = [];
121
+ this.activeSuggestionIndex = -1;
112
122
  };
113
123
  this.selectSuggestion = (completion) => {
114
124
  setTextSearchQuery(this.storeName, completion.suggestion);
@@ -166,7 +176,7 @@ export class VviinnTextSearch {
166
176
  }
167
177
  };
168
178
  this.checkAutoSuggest = async (query) => {
169
- pipe(await makeAutoSuggestRequest(this.storeName, query, this.token, this.apiPath), E.fold(
179
+ pipe(await makeAutoSuggestRequest(this.storeName, query, this.token, this.apiPath, this.setAutoSuggestCompletions), E.fold(
170
180
  // Intentionally ignore errors for auto-suggest
171
181
  () => { }, () => { }));
172
182
  };
@@ -197,24 +207,17 @@ export class VviinnTextSearch {
197
207
  };
198
208
  }
199
209
  connectedCallback() {
200
- const { state, storeName, onChange } = useSearchStore(this.showInWidget);
210
+ const { state, storeName } = useSearchStore(this.showInWidget);
201
211
  this.state = state;
202
212
  this.storeName = storeName;
203
- if (this.autoSuggestShow) {
204
- this.disposeOnChange = onChange("autoSuggestCompletions", (completions) => {
205
- if (this.searchSubmitted && completions.length > 0)
206
- return;
207
- this.autoSuggestCompletions = completions;
208
- this.activeSuggestionIndex = -1;
209
- });
210
- }
213
+ this.isDisconnected = false;
211
214
  }
212
215
  disconnectedCallback() {
213
- var _a, _b;
216
+ var _a;
217
+ this.isDisconnected = true;
214
218
  clearTimeout(this.triggerTooltipStart);
215
219
  clearTimeout(this.triggerTooltipEnd);
216
220
  (_a = this.autoSuggestHandler) === null || _a === void 0 ? void 0 : _a.cleanup();
217
- (_b = this.disposeOnChange) === null || _b === void 0 ? void 0 : _b.call(this);
218
221
  }
219
222
  async componentWillLoad() {
220
223
  var _a, _b, _c;
@@ -222,7 +225,7 @@ export class VviinnTextSearch {
222
225
  slotChangeListener(this, this.el);
223
226
  this.slots = findSlotElements(this.el);
224
227
  if (this.autoSuggestShow) {
225
- this.autoSuggestHandler = createAutoSuggestHandler(this.storeName, this.token, this.apiPath);
228
+ this.autoSuggestHandler = createAutoSuggestHandler(this.storeName, this.token, this.apiPath, this.setAutoSuggestCompletions);
226
229
  }
227
230
  this.recognition = initializeRecognition((_a = this.locale) !== null && _a !== void 0 ? _a : defaultConfig.locale, () => {
228
231
  this.showRecording();
@@ -267,7 +270,7 @@ export class VviinnTextSearch {
267
270
  }
268
271
  }
269
272
  render() {
270
- return (h(Host, { key: 'a97f9685f46a30ca9ab12396ee1aa01482731370', exportparts: `${searchBarParts}, ${searchModalFirstScreenParts}` }, h("div", { key: '384e2cc006c0c66b2e50d56631beb538cbaa4f07', class: "text-search-container", part: "text-search-container" }, h("input", Object.assign({ key: '5e571ee58eab698531946a19c5e92fb970340d33', class: "text-search-input", part: "text-search-input", type: "text", placeholder: this.getPlaceholderText(), value: this.state.textSearchQuery || "", onInput: (event) => this.handleInputChange(event), onKeyDown: this.handleKeyDown, onBlur: this.autoSuggestShow ? this.hideSuggestions : undefined }, (this.autoSuggestShow && {
273
+ return (h(Host, { key: '0ac6e28c6631ea47c8e7c47b63fa2eb3af500087', exportparts: `${searchBarParts}, ${searchModalFirstScreenParts}` }, h("div", { key: '4b1d8edd675e91f4abd1a5933a1449b721a571c1', class: "text-search-container", part: "text-search-container" }, h("input", Object.assign({ key: '13e356c598ada0b70e9b5c99531563dae6c334b5', class: "text-search-input", part: "text-search-input", type: "text", placeholder: this.getPlaceholderText(), value: this.state.textSearchQuery || "", onInput: (event) => this.handleInputChange(event), onKeyDown: this.handleKeyDown, onBlur: this.autoSuggestShow ? this.hideSuggestions : undefined }, (this.autoSuggestShow && {
271
274
  role: "combobox",
272
275
  "aria-autocomplete": "list",
273
276
  "aria-expanded": this.autoSuggestCompletions.length > 0 &&
@@ -278,11 +281,11 @@ export class VviinnTextSearch {
278
281
  "aria-activedescendant": this.activeSuggestionIndex >= 0
279
282
  ? `suggestion-${this.activeSuggestionIndex}`
280
283
  : undefined,
281
- }))), this.mode === "extended" && (h("vviinn-vps-button", Object.assign({ key: 'a92908b647b3f07546bfa3e3a15f7306374cd59d', token: this.token, locale: this.locale, apiPath: this.apiPath, addStyle: false, showResultsInModal: false, resultsPageUrl: this.resultsPageUrl, resultsPageParams: this.resultsPageParams }, (this.exampleImageSource && {
284
+ }))), this.mode === "extended" && (h("vviinn-vps-button", Object.assign({ key: 'c3d89667ac1eaa2682a4e3c68481b06f9479e0d6', token: this.token, locale: this.locale, apiPath: this.apiPath, addStyle: false, showResultsInModal: false, resultsPageUrl: this.resultsPageUrl, resultsPageParams: this.resultsPageParams }, (this.exampleImageSource && {
282
285
  exampleImageSource: this.exampleImageSource,
283
- }), (this.cssUrl != null && { cssUrl: this.cssUrl }), (this.visualSearchMode && { mode: this.visualSearchMode }), { parentSlots: this.slots }))), this.mode === "basic" && (h("slot", { key: '06e20a8744dea22ee8bd51d5a1e37b5e29b0b7f4', name: "vviinn-text-search-actions" })), (this.mode === "extended" || this.showInWidget) &&
284
- this.recognition && (h("button", { key: '1ab2f0acb7137c36231a542234a717e34430474f', class: "speech-button", part: "speech-button", "aria-label": i18next.t("a11y.speechButton"), onClick: this.handleSpeech, onKeyDown: (event) => this.handleButtonKeyDown(event, this.handleSpeech) }, h(MicIcon, { key: 'eb97b29086e9e5ad18b1ff6ac9637b760ae2c83a' }), this.isShowRecording() && (h("span", { key: 'dc8cecbb91eaa4a5195727b50919022898630a23', class: "recording-indicator" })))), h("button", { key: 'ebd39b8d86ab47cd4fadda6a5ad30c8001bd8c5a', class: "text-search-button", part: "text-search-button", onClick: () => this.handleTextSearch(), onKeyDown: (event) => this.handleButtonKeyDown(event, this.handleTextSearch), disabled: this.state.searchStatus === "loading", "aria-label": i18next.t("a11y.textSearchButton") }, this.isShowPreloader() ? (h("vviinn-preloader", null)) : (h("slot", { name: "vviinn-text-search-icon" }, h(TextSearchIcon, null))))), this.autoSuggestShow &&
285
- renderSuggestions(this.autoSuggestCompletions, this.state.textSearchQuery, this.activeSuggestionIndex, this.selectSuggestion), this.showTooltip && (h("p", { key: 'd59b3a49c6bda6b2992e3b0aa7bffb4ef674d3b6', class: "text-search-tooltip", part: "text-search-tooltip" }, i18next.t(this.tooltipText)))));
286
+ }), (this.cssUrl != null && { cssUrl: this.cssUrl }), (this.visualSearchMode && { mode: this.visualSearchMode }), { parentSlots: this.slots }))), this.mode === "basic" && (h("slot", { key: 'c900b67d3dcffb64f3ca513c0475f64eb72ef495', name: "vviinn-text-search-actions" })), (this.mode === "extended" || this.showInWidget) &&
287
+ this.recognition && (h("button", { key: '99f75f77a43f618a45bd06124f283a5b97e422c3', class: "speech-button", part: "speech-button", "aria-label": i18next.t("a11y.speechButton"), onClick: this.handleSpeech, onKeyDown: (event) => this.handleButtonKeyDown(event, this.handleSpeech) }, h(MicIcon, { key: 'ab0676502accecbb25377737a595550ae96b19cc' }), this.isShowRecording() && (h("span", { key: 'ece24c838cabc64e9b045c5eb97bc47d7bd932ba', class: "recording-indicator" })))), h("button", { key: 'e986f20a8e3d02f38e58c6a6e6946795d6d29875', class: "text-search-button", part: "text-search-button", onClick: () => this.handleTextSearch(), onKeyDown: (event) => this.handleButtonKeyDown(event, this.handleTextSearch), disabled: this.state.searchStatus === "loading", "aria-label": i18next.t("a11y.textSearchButton") }, this.isShowPreloader() ? (h("vviinn-preloader", null)) : (h("slot", { name: "vviinn-text-search-icon" }, h(TextSearchIcon, null))))), this.autoSuggestShow &&
288
+ renderSuggestions(this.autoSuggestCompletions, this.state.textSearchQuery, this.activeSuggestionIndex, this.selectSuggestion), this.showTooltip && (h("p", { key: '470a0c67f9f310f775566a4e581be3dbb7a7cb95', class: "text-search-tooltip", part: "text-search-tooltip" }, i18next.t(this.tooltipText)))));
286
289
  }
287
290
  static get is() { return "vviinn-text-search"; }
288
291
  static get encapsulation() { return "shadow"; }
@@ -482,7 +485,7 @@ export class VviinnTextSearch {
482
485
  "getter": false,
483
486
  "setter": false,
484
487
  "reflect": false,
485
- "defaultValue": "false"
488
+ "defaultValue": "true"
486
489
  },
487
490
  "exampleImageSource": {
488
491
  "type": "string",
@@ -118,7 +118,7 @@ export class VviinnVpsButton {
118
118
  /** Show the text search */
119
119
  this.textSearchShow = false;
120
120
  /** Show auto-suggest dropdown with search completions */
121
- this.autoSuggestShow = false;
121
+ this.autoSuggestShow = true;
122
122
  /** Show or hide Add to Basket buttons */
123
123
  this.addToBasketShow = false;
124
124
  /** Show or hide Favorite button */
@@ -205,7 +205,7 @@ export class VviinnVpsButton {
205
205
  }
206
206
  render() {
207
207
  const { ariaLabel, buttonIcon } = this.getButtonConfig();
208
- return (h(Host, { key: '9d0e319edac342158caa501aae1756ade2b92242', role: this.buttonPressed ? undefined : "button", "aria-label": this.buttonPressed ? undefined : ariaLabel, exportparts: `vviinn-button, ${searchModalFirstScreenParts}` }, renderExternalCSS(this.cssUrl), h("vviinn-button", { key: 'f30a55f9bbb705f5a17c925b655fa9210695b18d', addStyle: this.addStyle, part: "vviinn-button", tabindex: this.buttonPressed ? undefined : "0", onClick: this.buttonPressed ? undefined : this.handleActivation, onKeyDown: this.buttonPressed ? undefined : this.handleKeyDown }, h("slot", { key: 'e4fe7e8fe94fde3111836c7d0ae227a9a35fd1f4' }, buttonIcon)), SlotSkeleton("search"), h("vviinn-vps-widget", { key: '981a1866d06c8e35d7a9b211bf9f87ad06b85e42', mode: this.mode, "currency-sign": this.currencySign, token: this.token, locale: this.locale, numberLocale: this.numberLocale, apiPath: this.apiPath, pricePrefix: this.pricePrefix, campaignId: this.campaignId, campaignIdTextSearch: this.campaignIdTextSearch, campaignIdVisualSearch: this.campaignIdVisualSearch, showingInButton: true, buttonPressed: this.buttonPressed, resetVpsButton: this.resetButton, buttonElementId: this.el.id, active: this.buttonPressed &&
208
+ return (h(Host, { key: '2d9e0e9860039f521305b3f25da2a6aa5fee5e37', role: this.buttonPressed ? undefined : "button", "aria-label": this.buttonPressed ? undefined : ariaLabel, exportparts: `vviinn-button, ${searchModalFirstScreenParts}` }, renderExternalCSS(this.cssUrl), h("vviinn-button", { key: '33bf0113ab55a6bf91cf25181fe8d863af84d264', addStyle: this.addStyle, part: "vviinn-button", tabindex: this.buttonPressed ? undefined : "0", onClick: this.buttonPressed ? undefined : this.handleActivation, onKeyDown: this.buttonPressed ? undefined : this.handleKeyDown }, h("slot", { key: '922d706ce5bf9418c3747fc69bf7920d2ad53c8b' }, buttonIcon)), SlotSkeleton("search"), h("vviinn-vps-widget", { key: 'd6735e7ff8e3ca9dca10f5546d7c4f9f97a8ffa7', mode: this.mode, "currency-sign": this.currencySign, token: this.token, locale: this.locale, numberLocale: this.numberLocale, apiPath: this.apiPath, pricePrefix: this.pricePrefix, campaignId: this.campaignId, campaignIdTextSearch: this.campaignIdTextSearch, campaignIdVisualSearch: this.campaignIdVisualSearch, showingInButton: true, buttonPressed: this.buttonPressed, resetVpsButton: this.resetButton, buttonElementId: this.el.id, active: this.buttonPressed &&
209
209
  (this.mode === "modal" || this.mode === "camera"), excluded: this.excluded, productDetailsNewTab: this.productDetailsNewTab, productDetailsRedirect: this.productDetailsRedirect, imageResolutionWidth: this.imageResolutionWidth, showMultipleImages: this.showMultipleImages, exampleImageSource: this.exampleImageSource, textSearchShow: this.textSearchShow, autoSuggestShow: this.autoSuggestShow, addToBasketShow: this.addToBasketShow, addPriceContainer: this.addPriceContainer, showIntervalInputs: this.showIntervalInputs, replaceSlotsContentInButton: this.replaceSlotsContent.bind(this), oneClickDiscoveryMode: this.oneClickDiscoveryMode, oneClickDiscoveryCampaigns: this.oneClickDiscoveryCampaigns, favoriteShow: this.favoriteShow, showResultsInModal: this.showResultsInModal, resultsPageUrl: this.resultsPageUrl, resultsPageParams: this.resultsPageParams, parentSlots: [...this.parentSlots, ...this.slots], cssUrl: this.cssUrl })));
210
210
  }
211
211
  static get is() { return "vviinn-vps-button"; }
@@ -587,7 +587,7 @@ export class VviinnVpsButton {
587
587
  "getter": false,
588
588
  "setter": false,
589
589
  "reflect": false,
590
- "defaultValue": "false"
590
+ "defaultValue": "true"
591
591
  },
592
592
  "addToBasketShow": {
593
593
  "type": "boolean",