@getlupa/vue 0.14.17 → 0.15.1

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.
@@ -1522,6 +1522,8 @@ const HISTORY_LOCAL_STORAGE_KEY = "LUPA_HISTORY";
1522
1522
  const TRACKING_STORAGE_KEY = "LUPA_STATS";
1523
1523
  const TRACKING_STORAGE_KEY_BASE = "LUPA_STATS_BASE";
1524
1524
  const TRACKING_ANALYTICS_KEY = "LUPA_ANALYTICS";
1525
+ const TRACKING_CLICK_DELAYED = "LUPA_TRACKING_CLICK_DELAYED";
1526
+ const DELAYED_TRACKING_EVENTS_CACHE = "LUPA_DELAYED_TRACKING_EVENTS";
1525
1527
  const TRACKING_KEY_LENGTH = 10;
1526
1528
  const HISTORY_MAX_ITEMS = 7;
1527
1529
  const S_MIN_WIDTH = 575;
@@ -1742,6 +1744,14 @@ const getNormalizedString = (str) => {
1742
1744
  const transformedStr = typeof str === "string" ? str : str.toString();
1743
1745
  return transformedStr.normalize === void 0 ? (_a = transformedStr.toLocaleLowerCase()) == null ? void 0 : _a.trim() : (_b = transformedStr.toLocaleLowerCase().normalize("NFKD").replace(/[^\w\s.-_/]/g, "")) == null ? void 0 : _b.trim();
1744
1746
  };
1747
+ const getTransformedString = (str) => {
1748
+ var _a, _b;
1749
+ if (!str) {
1750
+ return "";
1751
+ }
1752
+ const transformedStr = typeof str === "string" ? str : str.toString();
1753
+ return transformedStr.normalize === void 0 ? (_a = transformedStr.toLocaleLowerCase()) == null ? void 0 : _a.trim() : (_b = transformedStr.toLocaleLowerCase().normalize("NFKD")) == null ? void 0 : _b.trim();
1754
+ };
1745
1755
  const capitalize$1 = (str) => {
1746
1756
  if (!str) {
1747
1757
  return "";
@@ -1815,8 +1825,8 @@ const inputsAreEqual = (input2, possibleValues) => {
1815
1825
  if (!input2) {
1816
1826
  return false;
1817
1827
  }
1818
- const normalizedInput = getNormalizedString(input2);
1819
- return possibleValues.some((v) => getNormalizedString(v) === normalizedInput);
1828
+ const normalizedInput = getTransformedString(input2);
1829
+ return possibleValues.some((v) => getTransformedString(v) === normalizedInput);
1820
1830
  };
1821
1831
  const levenshteinDistance = (s = "", t = "") => {
1822
1832
  if (!(s == null ? void 0 : s.length)) {
@@ -1849,225 +1859,6 @@ const findClosestStringValue = (input2, possibleValues, key) => {
1849
1859
  const closestValue = (_a = possibleValues.filter((_, i) => distances[i] === minDistance)) == null ? void 0 : _a[0];
1850
1860
  return closestValue;
1851
1861
  };
1852
- const initAnalyticsTracking = (analyticsOptions) => {
1853
- try {
1854
- if (analyticsOptions == null ? void 0 : analyticsOptions.enabled) {
1855
- window.sessionStorage.setItem(TRACKING_ANALYTICS_KEY, JSON.stringify(analyticsOptions));
1856
- } else {
1857
- window.sessionStorage.removeItem(TRACKING_ANALYTICS_KEY);
1858
- }
1859
- } catch (e2) {
1860
- }
1861
- };
1862
- const initBaseTracking = (enabled) => {
1863
- try {
1864
- if (enabled) {
1865
- window.sessionStorage.setItem(TRACKING_STORAGE_KEY_BASE, "1");
1866
- } else {
1867
- window.sessionStorage.removeItem(TRACKING_STORAGE_KEY_BASE);
1868
- clearSessionTracking();
1869
- clearUserTracking();
1870
- }
1871
- } catch (e2) {
1872
- }
1873
- };
1874
- const clearSessionTracking = () => {
1875
- try {
1876
- window.sessionStorage.removeItem(TRACKING_STORAGE_KEY);
1877
- } catch (e2) {
1878
- }
1879
- };
1880
- const initSessionTracking = () => {
1881
- try {
1882
- if (getSessionKey()) {
1883
- return;
1884
- }
1885
- const key = getRandomString(TRACKING_KEY_LENGTH);
1886
- window.sessionStorage.setItem(TRACKING_STORAGE_KEY, key);
1887
- } catch (e2) {
1888
- }
1889
- };
1890
- const initUserTracking = (userKey) => {
1891
- try {
1892
- if (getUserKey()) {
1893
- return;
1894
- }
1895
- const key = userKey || getRandomString(TRACKING_KEY_LENGTH);
1896
- window.localStorage.setItem(TRACKING_STORAGE_KEY, key);
1897
- } catch (e2) {
1898
- }
1899
- };
1900
- const clearUserTracking = () => {
1901
- try {
1902
- window.localStorage.removeItem(TRACKING_STORAGE_KEY);
1903
- } catch (e2) {
1904
- }
1905
- };
1906
- const isTrackingEnabled = () => {
1907
- try {
1908
- return Boolean(window.sessionStorage.getItem(TRACKING_STORAGE_KEY_BASE));
1909
- } catch (e2) {
1910
- return false;
1911
- }
1912
- };
1913
- const getSessionKey = () => {
1914
- var _a;
1915
- try {
1916
- return (_a = window.sessionStorage.getItem(TRACKING_STORAGE_KEY)) != null ? _a : void 0;
1917
- } catch (e2) {
1918
- return void 0;
1919
- }
1920
- };
1921
- const getUserKey = () => {
1922
- var _a;
1923
- try {
1924
- return (_a = window.localStorage.getItem(TRACKING_STORAGE_KEY)) != null ? _a : void 0;
1925
- } catch (e2) {
1926
- return void 0;
1927
- }
1928
- };
1929
- const initTracking = (options) => {
1930
- initBaseTracking(Boolean(options.trackBase));
1931
- if (options.trackSession) {
1932
- initSessionTracking();
1933
- } else {
1934
- clearSessionTracking();
1935
- }
1936
- if (options.trackUser) {
1937
- initUserTracking(options.userKey);
1938
- } else {
1939
- clearUserTracking();
1940
- }
1941
- if (options.analytics) {
1942
- initAnalyticsTracking(options.analytics);
1943
- }
1944
- };
1945
- const getLupaTrackingContext = () => {
1946
- if (!isTrackingEnabled()) {
1947
- return {};
1948
- }
1949
- return {
1950
- userId: getUserKey(),
1951
- sessionId: getSessionKey()
1952
- };
1953
- };
1954
- const trackLupaEvent = (queryKey, data = {}, options) => {
1955
- var _a, _b;
1956
- if (!queryKey || !data.type) {
1957
- return;
1958
- }
1959
- const eventData = {
1960
- searchQuery: (_a = data.searchQuery) != null ? _a : "",
1961
- itemId: (_b = data.itemId) != null ? _b : "",
1962
- name: data.type,
1963
- userId: getUserKey(),
1964
- sessionId: getSessionKey(),
1965
- filters: data.filters
1966
- };
1967
- LupaSearchSdk.track(queryKey, eventData, options);
1968
- };
1969
- const sendGa = (name, ...args) => {
1970
- window.ga(() => {
1971
- const trackers = window.ga.getAll();
1972
- const firstTracker = trackers[0];
1973
- if (!firstTracker) {
1974
- console.error("GA tracker not found");
1975
- }
1976
- const trackerName = firstTracker.get("name");
1977
- window.ga(`${trackerName}.${name}`, ...args);
1978
- });
1979
- };
1980
- const trackAnalyticsEvent = (data) => {
1981
- var _a, _b, _c;
1982
- try {
1983
- const options = JSON.parse(
1984
- (_a = window.sessionStorage.getItem(TRACKING_ANALYTICS_KEY)) != null ? _a : "{}"
1985
- );
1986
- if (!data.analytics || !options.enabled || ((_c = options.ignoreEvents) == null ? void 0 : _c.includes((_b = data.analytics) == null ? void 0 : _b.type))) {
1987
- return;
1988
- }
1989
- switch (options.type) {
1990
- case "ua":
1991
- sendUaAnalyticsEvent(data, options);
1992
- break;
1993
- case "ga4":
1994
- sendGa4AnalyticsEvent(data, options);
1995
- break;
1996
- case "debug":
1997
- processDebugEvent(data);
1998
- break;
1999
- default:
2000
- sendUaAnalyticsEvent(data, options);
2001
- }
2002
- } catch (e2) {
2003
- console.error("Unable to send an event to google analytics");
2004
- }
2005
- };
2006
- const parseEcommerceData = (data, title) => {
2007
- var _a, _b;
2008
- return ((_a = data.analytics) == null ? void 0 : _a.items) ? {
2009
- item_list_name: title,
2010
- items: (_b = data.analytics) == null ? void 0 : _b.items
2011
- } : void 0;
2012
- };
2013
- const sendUaAnalyticsEvent = (data, options) => {
2014
- var _a, _b, _c, _d;
2015
- const ga = window.ga;
2016
- if (!ga) {
2017
- console.error("Google Analytics object not found");
2018
- return;
2019
- }
2020
- sendGa(
2021
- "send",
2022
- "event",
2023
- options.parentEventName,
2024
- (_b = (_a = data.analytics) == null ? void 0 : _a.type) != null ? _b : "",
2025
- (_d = (_c = data.analytics) == null ? void 0 : _c.label) != null ? _d : ""
2026
- );
2027
- };
2028
- const sendGa4AnalyticsEvent = (data, options) => {
2029
- var _a, _b, _c, _d, _e, _f, _g;
2030
- if (!window || !window.dataLayer) {
2031
- console.error("dataLayer object not found.");
2032
- return;
2033
- }
2034
- const sendItemTitle = data.searchQuery !== ((_a = data.analytics) == null ? void 0 : _a.label);
2035
- const title = sendItemTitle ? (_b = data.analytics) == null ? void 0 : _b.label : void 0;
2036
- const params = __spreadValues({
2037
- search_text: data.searchQuery,
2038
- item_title: title,
2039
- item_id: data.itemId,
2040
- ecommerce: parseEcommerceData(data, (_c = data.analytics) == null ? void 0 : _c.listLabel)
2041
- }, (_e = (_d = data.analytics) == null ? void 0 : _d.additionalParams) != null ? _e : {});
2042
- window.dataLayer.push(__spreadValues({
2043
- event: (_g = (_f = data.analytics) == null ? void 0 : _f.type) != null ? _g : options.parentEventName
2044
- }, params));
2045
- };
2046
- const processDebugEvent = (data) => {
2047
- var _a, _b, _c, _d;
2048
- const sendItemTitle = data.searchQuery !== ((_a = data.analytics) == null ? void 0 : _a.label);
2049
- const title = sendItemTitle ? (_b = data.analytics) == null ? void 0 : _b.label : void 0;
2050
- const params = {
2051
- event: (_c = data.analytics) == null ? void 0 : _c.type,
2052
- search_text: data.searchQuery,
2053
- item_title: title,
2054
- item_id: data.itemId,
2055
- ecommerce: parseEcommerceData(data, (_d = data.analytics) == null ? void 0 : _d.listLabel)
2056
- };
2057
- console.debug("Analytics debug event:", params);
2058
- };
2059
- const track = (queryKey, data = {}, options) => {
2060
- var _a;
2061
- if (!isTrackingEnabled()) {
2062
- return;
2063
- }
2064
- const hasSearchQuery = data.searchQuery;
2065
- if (!hasSearchQuery && !((_a = data.options) == null ? void 0 : _a.allowEmptySearchQuery)) {
2066
- return;
2067
- }
2068
- trackAnalyticsEvent(data);
2069
- trackLupaEvent(queryKey, data, options);
2070
- };
2071
1862
  const DEFAULT_SEARCH_BOX_OPTIONS = {
2072
1863
  inputSelector: "#searchBox",
2073
1864
  options: {
@@ -2349,6 +2140,266 @@ const useOptionsStore = defineStore("options", () => {
2349
2140
  getQueryParamName
2350
2141
  };
2351
2142
  });
2143
+ const initAnalyticsTracking = (analyticsOptions) => {
2144
+ try {
2145
+ if (analyticsOptions == null ? void 0 : analyticsOptions.enabled) {
2146
+ window.sessionStorage.setItem(TRACKING_ANALYTICS_KEY, JSON.stringify(analyticsOptions));
2147
+ } else {
2148
+ window.sessionStorage.removeItem(TRACKING_ANALYTICS_KEY);
2149
+ }
2150
+ } catch (e2) {
2151
+ }
2152
+ };
2153
+ const initBaseTracking = (enabled) => {
2154
+ try {
2155
+ if (enabled) {
2156
+ window.sessionStorage.setItem(TRACKING_STORAGE_KEY_BASE, "1");
2157
+ } else {
2158
+ window.sessionStorage.removeItem(TRACKING_STORAGE_KEY_BASE);
2159
+ clearSessionTracking();
2160
+ clearUserTracking();
2161
+ }
2162
+ } catch (e2) {
2163
+ }
2164
+ };
2165
+ const clearSessionTracking = () => {
2166
+ try {
2167
+ window.sessionStorage.removeItem(TRACKING_STORAGE_KEY);
2168
+ } catch (e2) {
2169
+ }
2170
+ };
2171
+ const initSessionTracking = () => {
2172
+ try {
2173
+ if (getSessionKey()) {
2174
+ return;
2175
+ }
2176
+ const key = getRandomString(TRACKING_KEY_LENGTH);
2177
+ window.sessionStorage.setItem(TRACKING_STORAGE_KEY, key);
2178
+ } catch (e2) {
2179
+ }
2180
+ };
2181
+ const initUserTracking = (userKey) => {
2182
+ try {
2183
+ if (getUserKey()) {
2184
+ return;
2185
+ }
2186
+ const key = userKey || getRandomString(TRACKING_KEY_LENGTH);
2187
+ window.localStorage.setItem(TRACKING_STORAGE_KEY, key);
2188
+ } catch (e2) {
2189
+ }
2190
+ };
2191
+ const clearUserTracking = () => {
2192
+ try {
2193
+ window.localStorage.removeItem(TRACKING_STORAGE_KEY);
2194
+ } catch (e2) {
2195
+ }
2196
+ };
2197
+ const isTrackingEnabled = () => {
2198
+ try {
2199
+ return Boolean(window.sessionStorage.getItem(TRACKING_STORAGE_KEY_BASE));
2200
+ } catch (e2) {
2201
+ return false;
2202
+ }
2203
+ };
2204
+ const isDelayedClickTracking = () => {
2205
+ try {
2206
+ return Boolean(window.localStorage.getItem(TRACKING_CLICK_DELAYED));
2207
+ } catch (e2) {
2208
+ return false;
2209
+ }
2210
+ };
2211
+ const getSessionKey = () => {
2212
+ var _a;
2213
+ try {
2214
+ return (_a = window.sessionStorage.getItem(TRACKING_STORAGE_KEY)) != null ? _a : void 0;
2215
+ } catch (e2) {
2216
+ return void 0;
2217
+ }
2218
+ };
2219
+ const getUserKey = () => {
2220
+ var _a;
2221
+ try {
2222
+ return (_a = window.localStorage.getItem(TRACKING_STORAGE_KEY)) != null ? _a : void 0;
2223
+ } catch (e2) {
2224
+ return void 0;
2225
+ }
2226
+ };
2227
+ const initTracking = (options) => {
2228
+ initBaseTracking(Boolean(options.trackBase));
2229
+ if (options.trackSession) {
2230
+ initSessionTracking();
2231
+ } else {
2232
+ clearSessionTracking();
2233
+ }
2234
+ if (options.trackUser) {
2235
+ initUserTracking(options.userKey);
2236
+ } else {
2237
+ clearUserTracking();
2238
+ }
2239
+ if (options.analytics) {
2240
+ initAnalyticsTracking(options.analytics);
2241
+ }
2242
+ if (options.delayedClickTracking) {
2243
+ window.localStorage.setItem(TRACKING_CLICK_DELAYED, "1");
2244
+ checkAndDispatchDelayedEvents();
2245
+ } else {
2246
+ window.localStorage.removeItem(TRACKING_CLICK_DELAYED);
2247
+ }
2248
+ };
2249
+ const getLupaTrackingContext = () => {
2250
+ if (!isTrackingEnabled()) {
2251
+ return {};
2252
+ }
2253
+ return {
2254
+ userId: getUserKey(),
2255
+ sessionId: getSessionKey()
2256
+ };
2257
+ };
2258
+ const trackLupaEvent = (queryKey, data = {}, options) => {
2259
+ var _a, _b;
2260
+ if (!queryKey || !data.type) {
2261
+ return;
2262
+ }
2263
+ const eventData = {
2264
+ searchQuery: (_a = data.searchQuery) != null ? _a : "",
2265
+ itemId: (_b = data.itemId) != null ? _b : "",
2266
+ name: data.type,
2267
+ userId: getUserKey(),
2268
+ sessionId: getSessionKey(),
2269
+ filters: data.filters
2270
+ };
2271
+ LupaSearchSdk.track(queryKey, eventData, options);
2272
+ };
2273
+ const sendGa = (name, ...args) => {
2274
+ window.ga(() => {
2275
+ const trackers = window.ga.getAll();
2276
+ const firstTracker = trackers[0];
2277
+ if (!firstTracker) {
2278
+ console.error("GA tracker not found");
2279
+ }
2280
+ const trackerName = firstTracker.get("name");
2281
+ window.ga(`${trackerName}.${name}`, ...args);
2282
+ });
2283
+ };
2284
+ const trackAnalyticsEvent = (data) => {
2285
+ var _a, _b, _c;
2286
+ try {
2287
+ const options = JSON.parse(
2288
+ (_a = window.sessionStorage.getItem(TRACKING_ANALYTICS_KEY)) != null ? _a : "{}"
2289
+ );
2290
+ if (!data.analytics || !options.enabled || ((_c = options.ignoreEvents) == null ? void 0 : _c.includes((_b = data.analytics) == null ? void 0 : _b.type))) {
2291
+ return;
2292
+ }
2293
+ switch (options.type) {
2294
+ case "ua":
2295
+ sendUaAnalyticsEvent(data, options);
2296
+ break;
2297
+ case "ga4":
2298
+ sendGa4AnalyticsEvent(data, options);
2299
+ break;
2300
+ case "debug":
2301
+ processDebugEvent(data);
2302
+ break;
2303
+ default:
2304
+ sendUaAnalyticsEvent(data, options);
2305
+ }
2306
+ } catch (e2) {
2307
+ console.error("Unable to send an event to google analytics");
2308
+ }
2309
+ };
2310
+ const parseEcommerceData = (data, title) => {
2311
+ var _a, _b;
2312
+ return ((_a = data.analytics) == null ? void 0 : _a.items) ? {
2313
+ item_list_name: title,
2314
+ items: (_b = data.analytics) == null ? void 0 : _b.items
2315
+ } : void 0;
2316
+ };
2317
+ const sendUaAnalyticsEvent = (data, options) => {
2318
+ var _a, _b, _c, _d;
2319
+ const ga = window.ga;
2320
+ if (!ga) {
2321
+ console.error("Google Analytics object not found");
2322
+ return;
2323
+ }
2324
+ sendGa(
2325
+ "send",
2326
+ "event",
2327
+ options.parentEventName,
2328
+ (_b = (_a = data.analytics) == null ? void 0 : _a.type) != null ? _b : "",
2329
+ (_d = (_c = data.analytics) == null ? void 0 : _c.label) != null ? _d : ""
2330
+ );
2331
+ };
2332
+ const sendGa4AnalyticsEvent = (data, options) => {
2333
+ var _a, _b, _c, _d, _e, _f, _g;
2334
+ if (!window || !window.dataLayer) {
2335
+ console.error("dataLayer object not found.");
2336
+ return;
2337
+ }
2338
+ const sendItemTitle = data.searchQuery !== ((_a = data.analytics) == null ? void 0 : _a.label);
2339
+ const title = sendItemTitle ? (_b = data.analytics) == null ? void 0 : _b.label : void 0;
2340
+ const params = __spreadValues({
2341
+ search_text: data.searchQuery,
2342
+ item_title: title,
2343
+ item_id: data.itemId,
2344
+ ecommerce: parseEcommerceData(data, (_c = data.analytics) == null ? void 0 : _c.listLabel)
2345
+ }, (_e = (_d = data.analytics) == null ? void 0 : _d.additionalParams) != null ? _e : {});
2346
+ window.dataLayer.push(__spreadValues({
2347
+ event: (_g = (_f = data.analytics) == null ? void 0 : _f.type) != null ? _g : options.parentEventName
2348
+ }, params));
2349
+ };
2350
+ const processDebugEvent = (data) => {
2351
+ var _a, _b, _c, _d;
2352
+ const sendItemTitle = data.searchQuery !== ((_a = data.analytics) == null ? void 0 : _a.label);
2353
+ const title = sendItemTitle ? (_b = data.analytics) == null ? void 0 : _b.label : void 0;
2354
+ const params = {
2355
+ event: (_c = data.analytics) == null ? void 0 : _c.type,
2356
+ search_text: data.searchQuery,
2357
+ item_title: title,
2358
+ item_id: data.itemId,
2359
+ ecommerce: parseEcommerceData(data, (_d = data.analytics) == null ? void 0 : _d.listLabel)
2360
+ };
2361
+ console.debug("Analytics debug event:", params);
2362
+ };
2363
+ const getDelayedEventsCache = () => {
2364
+ var _a;
2365
+ try {
2366
+ return JSON.parse((_a = window.localStorage.getItem(DELAYED_TRACKING_EVENTS_CACHE)) != null ? _a : "{}");
2367
+ } catch (e2) {
2368
+ return {};
2369
+ }
2370
+ };
2371
+ const storeDelayedEventCache = (cache) => {
2372
+ try {
2373
+ window.localStorage.setItem(DELAYED_TRACKING_EVENTS_CACHE, JSON.stringify(cache));
2374
+ } catch (e2) {
2375
+ }
2376
+ };
2377
+ const checkAndDispatchDelayedEvents = () => {
2378
+ var _a, _b;
2379
+ const optionsStore = useOptionsStore();
2380
+ const eventCache = getDelayedEventsCache();
2381
+ const urls = Object.keys(eventCache);
2382
+ for (const url of urls) {
2383
+ if ((_a = window.location.href) == null ? void 0 : _a.includes(url)) {
2384
+ const options = (_b = optionsStore.envOptions) != null ? _b : { environment: "production" };
2385
+ const { queryKey, data } = eventCache[url];
2386
+ track(queryKey, data, options);
2387
+ }
2388
+ }
2389
+ storeDelayedEventCache({});
2390
+ };
2391
+ const track = (queryKey, data = {}, options) => {
2392
+ var _a;
2393
+ if (!isTrackingEnabled()) {
2394
+ return;
2395
+ }
2396
+ const hasSearchQuery = data.searchQuery;
2397
+ if (!hasSearchQuery && !((_a = data.options) == null ? void 0 : _a.allowEmptySearchQuery)) {
2398
+ return;
2399
+ }
2400
+ trackAnalyticsEvent(data);
2401
+ trackLupaEvent(queryKey, data, options);
2402
+ };
2352
2403
  var DocumentElementType = /* @__PURE__ */ ((DocumentElementType2) => {
2353
2404
  DocumentElementType2["IMAGE"] = "image";
2354
2405
  DocumentElementType2["TITLE"] = "title";
@@ -2580,7 +2631,10 @@ const getHint = (suggestion, inputValue) => {
2580
2631
  if (!inputValue) {
2581
2632
  return escapeHtml$1(suggestion);
2582
2633
  }
2583
- return (_a = suggestion == null ? void 0 : suggestion.replace(inputValue, `<strong>${escapeHtml$1(inputValue)}</strong>`)) != null ? _a : "";
2634
+ return (_a = suggestion == null ? void 0 : suggestion.replace(
2635
+ inputValue == null ? void 0 : inputValue.toLocaleLowerCase(),
2636
+ `<strong>${escapeHtml$1(inputValue == null ? void 0 : inputValue.toLocaleLowerCase())}</strong>`
2637
+ )) != null ? _a : "";
2584
2638
  };
2585
2639
  const reverseKeyValue = (obj) => {
2586
2640
  return Object.fromEntries(Object.entries(obj).map(([k, v]) => [v, k.toLowerCase()]));
@@ -2798,14 +2852,16 @@ const toggleTermFilter = (appendParams, facetAction, getQueryParamName, currentF
2798
2852
  paramsToRemove: [getQueryParamName ? getQueryParamName(QUERY_PARAMS.PAGE) : QUERY_PARAMS.PAGE]
2799
2853
  });
2800
2854
  };
2855
+ const replaceHierarchyParam = (params = [], param = "") => {
2856
+ if (params.some((p2) => p2.startsWith(param))) {
2857
+ return toggleLastPram(params, param);
2858
+ }
2859
+ return [param];
2860
+ };
2801
2861
  const toggleHierarchyFilter = (appendParams, facetAction, getQueryParamName, currentFilters, removeAllLevels = false) => {
2802
- var _a;
2862
+ var _a, _b;
2803
2863
  const currentFilter = currentFilters == null ? void 0 : currentFilters[facetAction.key];
2804
- const newParams = toggleHierarchyParam(
2805
- (_a = currentFilter == null ? void 0 : currentFilter.terms) != null ? _a : [],
2806
- facetAction.value,
2807
- removeAllLevels
2808
- );
2864
+ const newParams = facetAction.behavior === "replace" ? replaceHierarchyParam((_a = currentFilter == null ? void 0 : currentFilter.terms) != null ? _a : [], facetAction.value) : toggleHierarchyParam((_b = currentFilter == null ? void 0 : currentFilter.terms) != null ? _b : [], facetAction.value, removeAllLevels);
2809
2865
  appendParams({
2810
2866
  params: [getFacetParam(facetAction.key, newParams, FACET_PARAMS_TYPE.HIERARCHY)],
2811
2867
  paramsToRemove: [getQueryParamName ? getQueryParamName(QUERY_PARAMS.PAGE) : QUERY_PARAMS.PAGE]
@@ -3148,6 +3204,7 @@ const useSearchBoxStore = defineStore("searchBox", () => {
3148
3204
  const highlightedIndex = vue.ref(-1);
3149
3205
  const inputValue = vue.ref("");
3150
3206
  const resultInputValue = vue.ref("");
3207
+ const latestRequestIdByQueryKey = {};
3151
3208
  const historyStore = useHistoryStore();
3152
3209
  const resultsVisible = vue.computed(() => {
3153
3210
  var _a;
@@ -3214,12 +3271,17 @@ const useSearchBoxStore = defineStore("searchBox", () => {
3214
3271
  }) {
3215
3272
  var _a;
3216
3273
  try {
3274
+ const currentRequestId = Date.now();
3275
+ latestRequestIdByQueryKey[queryKey] = currentRequestId;
3217
3276
  const context = getLupaTrackingContext();
3218
3277
  const result2 = yield LupaSearchSdk.suggestions(
3219
3278
  queryKey,
3220
3279
  __spreadValues(__spreadValues({}, publicQuery), context),
3221
3280
  options2
3222
3281
  );
3282
+ if (latestRequestIdByQueryKey[queryKey] !== currentRequestId) {
3283
+ return { suggestions: void 0 };
3284
+ }
3223
3285
  if (!result2.success) {
3224
3286
  return { suggestions: void 0 };
3225
3287
  }
@@ -3260,8 +3322,13 @@ const useSearchBoxStore = defineStore("searchBox", () => {
3260
3322
  options: options2
3261
3323
  }) {
3262
3324
  try {
3325
+ const currentRequestId = Date.now();
3326
+ latestRequestIdByQueryKey[queryKey] = currentRequestId;
3263
3327
  const context = getLupaTrackingContext();
3264
3328
  const result2 = yield LupaSearchSdk.query(queryKey, __spreadValues(__spreadValues({}, publicQuery), context), options2);
3329
+ if (latestRequestIdByQueryKey[queryKey] !== currentRequestId) {
3330
+ return { suggestions: void 0 };
3331
+ }
3265
3332
  if (!result2.success) {
3266
3333
  return { queryKey, result: { items: [] } };
3267
3334
  }
@@ -3316,7 +3383,7 @@ const useSearchBoxStore = defineStore("searchBox", () => {
3316
3383
  const _hoisted_1$1g = { id: "lupa-search-box-input-container" };
3317
3384
  const _hoisted_2$U = { class: "lupa-input-clear" };
3318
3385
  const _hoisted_3$D = { id: "lupa-search-box-input" };
3319
- const _hoisted_4$s = ["value"];
3386
+ const _hoisted_4$t = ["value"];
3320
3387
  const _hoisted_5$j = ["aria-label", "placeholder"];
3321
3388
  const _hoisted_6$9 = /* @__PURE__ */ vue.createElementVNode("span", { class: "lupa-search-submit-icon" }, null, -1);
3322
3389
  const _hoisted_7$7 = [
@@ -3423,7 +3490,7 @@ const _sfc_main$1s = /* @__PURE__ */ vue.defineComponent({
3423
3490
  "aria-hidden": "true",
3424
3491
  value: showHint.value ? suggestedValue.value.item.suggestion : "",
3425
3492
  disabled: ""
3426
- }, null, 8, _hoisted_4$s),
3493
+ }, null, 8, _hoisted_4$t),
3427
3494
  vue.withDirectives(vue.createElementVNode("input", vue.mergeProps({
3428
3495
  "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => inputValue.value = $event)
3429
3496
  }, inputAttributes.value, {
@@ -3635,7 +3702,7 @@ const _hoisted_3$C = {
3635
3702
  class: "lupa-suggestion-facet",
3636
3703
  "data-cy": "lupa-suggestion-facet"
3637
3704
  };
3638
- const _hoisted_4$r = {
3705
+ const _hoisted_4$s = {
3639
3706
  class: "lupa-suggestion-facet-label",
3640
3707
  "data-cy": "lupa-suggestion-facet-label"
3641
3708
  };
@@ -3681,7 +3748,7 @@ const _sfc_main$1n = /* @__PURE__ */ vue.defineComponent({
3681
3748
  innerHTML: _ctx.suggestion.displayHighlight
3682
3749
  }, null, 8, _hoisted_1$1c)) : (vue.openBlock(), vue.createElementBlock("div", _hoisted_2$S, vue.toDisplayString(_ctx.suggestion.display), 1)),
3683
3750
  _ctx.suggestion.facet ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_3$C, [
3684
- vue.createElementVNode("span", _hoisted_4$r, vue.toDisplayString(facetLabel.value), 1),
3751
+ vue.createElementVNode("span", _hoisted_4$s, vue.toDisplayString(facetLabel.value), 1),
3685
3752
  vue.createElementVNode("span", _hoisted_5$i, vue.toDisplayString(_ctx.suggestion.facet.title), 1)
3686
3753
  ])) : vue.createCommentVNode("", true)
3687
3754
  ]);
@@ -13247,7 +13314,7 @@ const _sfc_main$1f = /* @__PURE__ */ vue.defineComponent({
13247
13314
  const _hoisted_1$16 = ["innerHTML"];
13248
13315
  const _hoisted_2$O = { key: 0 };
13249
13316
  const _hoisted_3$B = { key: 1 };
13250
- const _hoisted_4$q = { class: "lupa-search-box-custom-label" };
13317
+ const _hoisted_4$r = { class: "lupa-search-box-custom-label" };
13251
13318
  const _hoisted_5$h = { class: "lupa-search-box-custom-text" };
13252
13319
  const _sfc_main$1e = /* @__PURE__ */ vue.defineComponent({
13253
13320
  __name: "SearchBoxProductCustom",
@@ -13280,7 +13347,7 @@ const _sfc_main$1e = /* @__PURE__ */ vue.defineComponent({
13280
13347
  class: [className.value, "lupa-search-box-product-custom"]
13281
13348
  }, vue.toHandlers(_ctx.options.action ? { click: handleClick } : {}, true)), [
13282
13349
  !label.value ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_2$O, vue.toDisplayString(text.value), 1)) : (vue.openBlock(), vue.createElementBlock("div", _hoisted_3$B, [
13283
- vue.createElementVNode("div", _hoisted_4$q, vue.toDisplayString(label.value), 1),
13350
+ vue.createElementVNode("div", _hoisted_4$r, vue.toDisplayString(label.value), 1),
13284
13351
  vue.createElementVNode("div", _hoisted_5$h, vue.toDisplayString(text.value), 1)
13285
13352
  ]))
13286
13353
  ], 16));
@@ -13693,7 +13760,7 @@ const _sfc_main$1b = /* @__PURE__ */ vue.defineComponent(__spreadProps(__spreadV
13693
13760
  const _hoisted_1$12 = { class: "lupa-badge-title" };
13694
13761
  const _hoisted_2$M = ["src"];
13695
13762
  const _hoisted_3$z = { key: 1 };
13696
- const _hoisted_4$p = {
13763
+ const _hoisted_4$q = {
13697
13764
  key: 0,
13698
13765
  class: "lupa-badge-full-text"
13699
13766
  };
@@ -13737,7 +13804,7 @@ const _sfc_main$1a = /* @__PURE__ */ vue.defineComponent({
13737
13804
  }, null, 8, _hoisted_2$M)) : vue.createCommentVNode("", true),
13738
13805
  hasTitleText.value && showTitle.value ? (vue.openBlock(), vue.createElementBlock("span", _hoisted_3$z, vue.toDisplayString(_ctx.badge.titleText), 1)) : vue.createCommentVNode("", true)
13739
13806
  ]),
13740
- hasAdditionalText.value ? (vue.openBlock(), vue.createElementBlock("span", _hoisted_4$p, vue.toDisplayString(_ctx.badge.additionalText), 1)) : vue.createCommentVNode("", true)
13807
+ hasAdditionalText.value ? (vue.openBlock(), vue.createElementBlock("span", _hoisted_4$q, vue.toDisplayString(_ctx.badge.additionalText), 1)) : vue.createCommentVNode("", true)
13741
13808
  ], 6);
13742
13809
  };
13743
13810
  }
@@ -14215,7 +14282,18 @@ const useTrackingStore = defineStore("tracking", () => {
14215
14282
  options
14216
14283
  );
14217
14284
  };
14218
- return { trackSearch, trackResults, trackEvent };
14285
+ const trackDelayedEvent = ({
14286
+ queryKey,
14287
+ data,
14288
+ url
14289
+ }) => {
14290
+ let currentCache = getDelayedEventsCache();
14291
+ currentCache = __spreadProps(__spreadValues({}, currentCache), {
14292
+ [url]: { data, queryKey }
14293
+ });
14294
+ storeDelayedEventCache(currentCache);
14295
+ };
14296
+ return { trackSearch, trackResults, trackEvent, trackDelayedEvent };
14219
14297
  });
14220
14298
  const _hoisted_1$X = { id: "lupa-search-box-products" };
14221
14299
  const _sfc_main$12 = /* @__PURE__ */ vue.defineComponent({
@@ -14259,7 +14337,7 @@ const _sfc_main$12 = /* @__PURE__ */ vue.defineComponent({
14259
14337
  if (!props.panelOptions.idKey) {
14260
14338
  return;
14261
14339
  }
14262
- trackingStore.trackEvent({
14340
+ const trackableEvent = {
14263
14341
  queryKey: props.panelOptions.queryKey,
14264
14342
  data: {
14265
14343
  itemId: id,
@@ -14271,7 +14349,14 @@ const _sfc_main$12 = /* @__PURE__ */ vue.defineComponent({
14271
14349
  items: [item]
14272
14350
  }
14273
14351
  }
14274
- });
14352
+ };
14353
+ if (isDelayedClickTracking()) {
14354
+ trackingStore.trackDelayedEvent(__spreadProps(__spreadValues({}, trackableEvent), {
14355
+ url: link
14356
+ }));
14357
+ } else {
14358
+ trackingStore.trackEvent(trackableEvent);
14359
+ }
14275
14360
  if (!link || eventType === "addToCart") {
14276
14361
  return;
14277
14362
  }
@@ -14537,7 +14622,7 @@ const _hoisted_3$x = {
14537
14622
  key: 0,
14538
14623
  class: "lupa-panel-title lupa-panel-title-top-results"
14539
14624
  };
14540
- const _hoisted_4$o = {
14625
+ const _hoisted_4$p = {
14541
14626
  key: 1,
14542
14627
  class: "lupa-panel-title"
14543
14628
  };
@@ -14731,7 +14816,7 @@ const _sfc_main$_ = /* @__PURE__ */ vue.defineComponent(__spreadProps(__spreadVa
14731
14816
  "data-cy": "lupa-panel-" + panel.type + "-index"
14732
14817
  }, [
14733
14818
  ((_a2 = panel.labels) == null ? void 0 : _a2.topResultsTitle) && showTopResultsPanelTitle(panel.queryKey) ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_3$x, vue.toDisplayString((_b = panel.labels) == null ? void 0 : _b.topResultsTitle), 1)) : vue.createCommentVNode("", true),
14734
- ((_c = panel.labels) == null ? void 0 : _c.title) && showPanelTitle(panel) ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_4$o, vue.toDisplayString((_d = panel.labels) == null ? void 0 : _d.title), 1)) : vue.createCommentVNode("", true),
14819
+ ((_c = panel.labels) == null ? void 0 : _c.title) && showPanelTitle(panel) ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_4$p, vue.toDisplayString((_d = panel.labels) == null ? void 0 : _d.title), 1)) : vue.createCommentVNode("", true),
14735
14820
  panel.queryKey && canShowPanel(panel) ? (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(getComponent(panel.type)), {
14736
14821
  key: 2,
14737
14822
  panel,
@@ -14997,7 +15082,7 @@ const _sfc_main$Z = /* @__PURE__ */ vue.defineComponent({
14997
15082
  if (!doc.queryKey || !doc.doc) {
14998
15083
  return;
14999
15084
  }
15000
- trackingStore.trackEvent({
15085
+ const event = {
15001
15086
  queryKey: doc.queryKey,
15002
15087
  data: {
15003
15088
  itemId: doc.id,
@@ -15009,7 +15094,14 @@ const _sfc_main$Z = /* @__PURE__ */ vue.defineComponent({
15009
15094
  items: [doc]
15010
15095
  }
15011
15096
  }
15012
- });
15097
+ };
15098
+ if (isDelayedClickTracking()) {
15099
+ trackingStore.trackDelayedEvent(__spreadProps(__spreadValues({}, event), {
15100
+ url: generateLink(props.options.links.searchResults, doc)
15101
+ }));
15102
+ } else {
15103
+ trackingStore.trackEvent(event);
15104
+ }
15013
15105
  };
15014
15106
  const trackSearchQuery = (query) => {
15015
15107
  if (!query) {
@@ -15186,7 +15278,7 @@ const _hoisted_3$w = {
15186
15278
  key: 1,
15187
15279
  "data-cy": "did-you-mean-label"
15188
15280
  };
15189
- const _hoisted_4$n = { key: 1 };
15281
+ const _hoisted_4$o = { key: 1 };
15190
15282
  const _sfc_main$Y = /* @__PURE__ */ vue.defineComponent({
15191
15283
  __name: "SearchResultsDidYouMean",
15192
15284
  props: {
@@ -15237,7 +15329,7 @@ const _sfc_main$Y = /* @__PURE__ */ vue.defineComponent({
15237
15329
  class: "lupa-did-you-mean lupa-highlighted-search-text",
15238
15330
  "data-cy": "did-you-mean-value",
15239
15331
  onClick: _cache[0] || (_cache[0] = ($event) => goToResults({ searchText: didYouMeanValue.value }))
15240
- }, vue.toDisplayString(didYouMeanValue.value) + " ", 1)) : (vue.openBlock(), vue.createElementBlock("span", _hoisted_4$n, vue.toDisplayString(label) + " ", 1))
15332
+ }, vue.toDisplayString(didYouMeanValue.value) + " ", 1)) : (vue.openBlock(), vue.createElementBlock("span", _hoisted_4$o, vue.toDisplayString(label) + " ", 1))
15241
15333
  ]);
15242
15334
  }), 128))
15243
15335
  ])) : vue.createCommentVNode("", true)
@@ -15287,7 +15379,7 @@ const _hoisted_3$v = {
15287
15379
  key: 1,
15288
15380
  class: "lupa-results-total-count"
15289
15381
  };
15290
- const _hoisted_4$m = { class: "lupa-results-total-count-number" };
15382
+ const _hoisted_4$n = { class: "lupa-results-total-count-number" };
15291
15383
  const _hoisted_5$f = ["innerHTML"];
15292
15384
  const _sfc_main$W = /* @__PURE__ */ vue.defineComponent({
15293
15385
  __name: "SearchResultsTitle",
@@ -15333,7 +15425,7 @@ const _sfc_main$W = /* @__PURE__ */ vue.defineComponent({
15333
15425
  queryText.value ? (vue.openBlock(), vue.createElementBlock("span", _hoisted_2$E, "'" + vue.toDisplayString(queryText.value) + "'", 1)) : vue.createCommentVNode("", true),
15334
15426
  showProductCount.value ? (vue.openBlock(), vue.createElementBlock("span", _hoisted_3$v, [
15335
15427
  vue.createTextVNode("(" + vue.toDisplayString(searchResultsCountLabel.value), 1),
15336
- vue.createElementVNode("span", _hoisted_4$m, vue.toDisplayString(vue.unref(totalItems)), 1),
15428
+ vue.createElementVNode("span", _hoisted_4$n, vue.toDisplayString(vue.unref(totalItems)), 1),
15337
15429
  vue.createTextVNode(")")
15338
15430
  ])) : vue.createCommentVNode("", true)
15339
15431
  ])) : vue.createCommentVNode("", true),
@@ -15391,7 +15483,7 @@ const _hoisted_3$t = {
15391
15483
  key: 0,
15392
15484
  class: "filter-values"
15393
15485
  };
15394
- const _hoisted_4$l = { class: "lupa-current-filter-list" };
15486
+ const _hoisted_4$m = { class: "lupa-current-filter-list" };
15395
15487
  const _sfc_main$U = /* @__PURE__ */ vue.defineComponent({
15396
15488
  __name: "CurrentFilters",
15397
15489
  props: {
@@ -15475,7 +15567,7 @@ const _sfc_main$U = /* @__PURE__ */ vue.defineComponent({
15475
15567
  }, null, 2)) : vue.createCommentVNode("", true)
15476
15568
  ]),
15477
15569
  !_ctx.expandable || isOpen.value ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_3$t, [
15478
- vue.createElementVNode("div", _hoisted_4$l, [
15570
+ vue.createElementVNode("div", _hoisted_4$m, [
15479
15571
  (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(currentDisplayFilters.value, (filter2) => {
15480
15572
  return vue.openBlock(), vue.createBlock(_sfc_main$V, {
15481
15573
  key: filter2.key + "_" + filter2.value,
@@ -15543,7 +15635,7 @@ const _hoisted_1$N = {
15543
15635
  };
15544
15636
  const _hoisted_2$B = { class: "lupa-category-back" };
15545
15637
  const _hoisted_3$s = ["href"];
15546
- const _hoisted_4$k = ["href"];
15638
+ const _hoisted_4$l = ["href"];
15547
15639
  const _hoisted_5$e = { class: "lupa-child-category-list" };
15548
15640
  const _sfc_main$S = /* @__PURE__ */ vue.defineComponent({
15549
15641
  __name: "CategoryFilter",
@@ -15650,7 +15742,7 @@ const _sfc_main$S = /* @__PURE__ */ vue.defineComponent({
15650
15742
  href: parentUrlLink.value,
15651
15743
  class: vue.normalizeClass({ "lupa-title-category": !hasBackButton.value }),
15652
15744
  onClick: handleNavigationParent
15653
- }, vue.toDisplayString(parentTitle.value), 11, _hoisted_4$k)
15745
+ }, vue.toDisplayString(parentTitle.value), 11, _hoisted_4$l)
15654
15746
  ], 2),
15655
15747
  vue.createElementVNode("div", _hoisted_5$e, [
15656
15748
  (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(categoryChildren.value, (child) => {
@@ -15671,7 +15763,7 @@ const _hoisted_1$M = {
15671
15763
  };
15672
15764
  const _hoisted_2$A = ["placeholder"];
15673
15765
  const _hoisted_3$r = { class: "lupa-terms-list" };
15674
- const _hoisted_4$j = ["onClick"];
15766
+ const _hoisted_4$k = ["onClick"];
15675
15767
  const _hoisted_5$d = { class: "lupa-term-checkbox-wrapper" };
15676
15768
  const _hoisted_6$8 = { class: "lupa-term-checkbox-label" };
15677
15769
  const _hoisted_7$6 = { class: "lupa-term-label" };
@@ -15779,7 +15871,7 @@ const _sfc_main$R = /* @__PURE__ */ vue.defineComponent({
15779
15871
  vue.createElementVNode("span", _hoisted_7$6, vue.toDisplayString(item.title), 1),
15780
15872
  _ctx.options.showDocumentCount ? (vue.openBlock(), vue.createElementBlock("span", _hoisted_8$2, "(" + vue.toDisplayString(item.count) + ")", 1)) : vue.createCommentVNode("", true)
15781
15873
  ])
15782
- ], 10, _hoisted_4$j);
15874
+ ], 10, _hoisted_4$k);
15783
15875
  }), 128))
15784
15876
  ]),
15785
15877
  displayShowMore.value ? (vue.openBlock(), vue.createElementBlock("div", {
@@ -16779,7 +16871,7 @@ const _hoisted_3$q = {
16779
16871
  key: 1,
16780
16872
  class: "lupa-stats-facet-summary-input"
16781
16873
  };
16782
- const _hoisted_4$i = {
16874
+ const _hoisted_4$j = {
16783
16875
  key: 0,
16784
16876
  class: "lupa-stats-range-label"
16785
16877
  };
@@ -16843,8 +16935,12 @@ const _sfc_main$Q = /* @__PURE__ */ vue.defineComponent({
16843
16935
  var _a;
16844
16936
  return Boolean((_a = props.options.stats) == null ? void 0 : _a.inputs);
16845
16937
  });
16938
+ const pricePrecision = vue.computed(() => {
16939
+ var _a, _b;
16940
+ return (_b = (_a = props.options.stats) == null ? void 0 : _a.pricePrecisionDigits) != null ? _b : 2;
16941
+ });
16846
16942
  const fromValue = vue.computed({
16847
- get: () => isPrice.value ? sliderRange.value[0].toFixed(2).replace(".", separator.value) : `${sliderRange.value[0]}`,
16943
+ get: () => isPrice.value ? sliderRange.value[0].toFixed(pricePrecision.value).replace(".", separator.value) : `${sliderRange.value[0]}`,
16848
16944
  set: (stringValue) => {
16849
16945
  let value = normalizeFloat(stringValue);
16850
16946
  if (value < facetMin.value) {
@@ -16858,7 +16954,7 @@ const _sfc_main$Q = /* @__PURE__ */ vue.defineComponent({
16858
16954
  }
16859
16955
  });
16860
16956
  const toValue = vue.computed({
16861
- get: () => isPrice.value ? sliderRange.value[1].toFixed(2).replace(".", separator.value) : `${sliderRange.value[1]}`,
16957
+ get: () => isPrice.value ? sliderRange.value[1].toFixed(pricePrecision.value).replace(".", separator.value) : `${sliderRange.value[1]}`,
16862
16958
  set: (stringValue) => {
16863
16959
  let value = normalizeFloat(stringValue);
16864
16960
  if (value > facetMax.value) {
@@ -16974,7 +17070,7 @@ const _sfc_main$Q = /* @__PURE__ */ vue.defineComponent({
16974
17070
  return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$L, [
16975
17071
  !isInputVisible.value ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_2$z, vue.toDisplayString(statsSummary.value), 1)) : (vue.openBlock(), vue.createElementBlock("div", _hoisted_3$q, [
16976
17072
  vue.createElementVNode("div", null, [
16977
- rangeLabelFrom.value ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_4$i, vue.toDisplayString(rangeLabelFrom.value), 1)) : vue.createCommentVNode("", true),
17073
+ rangeLabelFrom.value ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_4$j, vue.toDisplayString(rangeLabelFrom.value), 1)) : vue.createCommentVNode("", true),
16978
17074
  vue.createElementVNode("div", _hoisted_5$c, [
16979
17075
  vue.withDirectives(vue.createElementVNode("input", {
16980
17076
  "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => fromValue.value = $event),
@@ -17041,7 +17137,7 @@ const _sfc_main$Q = /* @__PURE__ */ vue.defineComponent({
17041
17137
  const _hoisted_1$K = { class: "lupa-term-checkbox-wrapper" };
17042
17138
  const _hoisted_2$y = { class: "lupa-term-checkbox-label" };
17043
17139
  const _hoisted_3$p = { class: "lupa-term-label" };
17044
- const _hoisted_4$h = {
17140
+ const _hoisted_4$i = {
17045
17141
  key: 0,
17046
17142
  class: "lupa-term-count"
17047
17143
  };
@@ -17102,7 +17198,7 @@ const _sfc_main$P = /* @__PURE__ */ vue.defineComponent({
17102
17198
  ]),
17103
17199
  vue.createElementVNode("div", _hoisted_2$y, [
17104
17200
  vue.createElementVNode("span", _hoisted_3$p, vue.toDisplayString(_ctx.item.title) + vue.toDisplayString(" "), 1),
17105
- _ctx.options.showDocumentCount ? (vue.openBlock(), vue.createElementBlock("span", _hoisted_4$h, "(" + vue.toDisplayString(_ctx.item.count) + ")", 1)) : vue.createCommentVNode("", true)
17201
+ _ctx.options.showDocumentCount ? (vue.openBlock(), vue.createElementBlock("span", _hoisted_4$i, "(" + vue.toDisplayString(_ctx.item.count) + ")", 1)) : vue.createCommentVNode("", true)
17106
17202
  ])
17107
17203
  ]),
17108
17204
  showChildren.value ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_5$b, [
@@ -17167,15 +17263,20 @@ const _sfc_main$O = /* @__PURE__ */ vue.defineComponent({
17167
17263
  return Boolean((_a = props.options.hierarchy) == null ? void 0 : _a.filterable) && allValues.value.length >= ((_c = (_b = props.options.filterable) == null ? void 0 : _b.minValues) != null ? _c : MAX_FACET_VALUES);
17168
17264
  });
17169
17265
  const handleFacetClick = ({ value }) => {
17266
+ var _a, _b;
17170
17267
  emit("select", {
17171
17268
  key: facet.value.key,
17172
17269
  value,
17173
- type: "hierarchy"
17270
+ type: "hierarchy",
17271
+ behavior: (_b = (_a = props.options.hierarchy) == null ? void 0 : _a.behavior) != null ? _b : "append"
17174
17272
  });
17175
17273
  };
17176
17274
  const handleShowAll = () => {
17177
17275
  showAll.value = true;
17178
17276
  };
17277
+ const handleCancelShowAll = () => {
17278
+ showAll.value = false;
17279
+ };
17179
17280
  return (_ctx, _cache) => {
17180
17281
  return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$J, [
17181
17282
  isFilterable.value ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_2$x, [
@@ -17204,7 +17305,11 @@ const _sfc_main$O = /* @__PURE__ */ vue.defineComponent({
17204
17305
  class: "lupa-facet-term lupa-show-more-facet-results",
17205
17306
  "data-cy": "lupa-facet-term",
17206
17307
  onClick: handleShowAll
17207
- }, vue.toDisplayString(_ctx.options.labels.showAll), 1)) : vue.createCommentVNode("", true)
17308
+ }, vue.toDisplayString(_ctx.options.labels.showAll), 1)) : showAll.value ? (vue.openBlock(), vue.createElementBlock("div", {
17309
+ key: 2,
17310
+ class: "lupa-facet-term lupa-show-more-facet-results",
17311
+ onClick: handleCancelShowAll
17312
+ }, vue.toDisplayString(_ctx.options.labels.showLess), 1)) : vue.createCommentVNode("", true)
17208
17313
  ]);
17209
17314
  };
17210
17315
  }
@@ -17614,7 +17719,7 @@ const _hoisted_1$D = {
17614
17719
  };
17615
17720
  const _hoisted_2$t = ["onClick"];
17616
17721
  const _hoisted_3$n = { class: "lupa-mobile-sidebar-content" };
17617
- const _hoisted_4$g = { class: "lupa-sidebar-top" };
17722
+ const _hoisted_4$h = { class: "lupa-sidebar-top" };
17618
17723
  const _hoisted_5$a = { class: "lupa-sidebar-title" };
17619
17724
  const _hoisted_6$6 = {
17620
17725
  key: 0,
@@ -17658,7 +17763,7 @@ const _sfc_main$I = /* @__PURE__ */ vue.defineComponent({
17658
17763
  onClick: vue.withModifiers(handleMobileToggle, ["stop"])
17659
17764
  }, null, 8, _hoisted_2$t),
17660
17765
  vue.createElementVNode("div", _hoisted_3$n, [
17661
- vue.createElementVNode("div", _hoisted_4$g, [
17766
+ vue.createElementVNode("div", _hoisted_4$h, [
17662
17767
  vue.createElementVNode("div", _hoisted_5$a, [
17663
17768
  vue.createTextVNode(vue.toDisplayString(sidebarTitle.value) + " ", 1),
17664
17769
  isFilterCountVisible.value ? (vue.openBlock(), vue.createElementBlock("span", _hoisted_6$6, vue.toDisplayString(vue.unref(currentFilterCount)), 1)) : vue.createCommentVNode("", true)
@@ -17686,7 +17791,7 @@ const _hoisted_3$m = {
17686
17791
  key: 1,
17687
17792
  class: "lupa-search-results-breadcrumb-text"
17688
17793
  };
17689
- const _hoisted_4$f = { key: 2 };
17794
+ const _hoisted_4$g = { key: 2 };
17690
17795
  const _sfc_main$H = /* @__PURE__ */ vue.defineComponent({
17691
17796
  __name: "SearchResultsBreadcrumbs",
17692
17797
  props: {
@@ -17727,7 +17832,7 @@ const _sfc_main$H = /* @__PURE__ */ vue.defineComponent({
17727
17832
  return handleNavigation(e2, (_a = breadcrumb == null ? void 0 : breadcrumb.link) != null ? _a : "");
17728
17833
  }
17729
17834
  }, vue.toDisplayString(getLabel(breadcrumb.label)), 9, _hoisted_2$s)) : (vue.openBlock(), vue.createElementBlock("span", _hoisted_3$m, vue.toDisplayString(getLabel(breadcrumb.label)), 1)),
17730
- index < breadcrumbsValue.value.length - 1 ? (vue.openBlock(), vue.createElementBlock("span", _hoisted_4$f, " / ")) : vue.createCommentVNode("", true)
17835
+ index < breadcrumbsValue.value.length - 1 ? (vue.openBlock(), vue.createElementBlock("span", _hoisted_4$g, " / ")) : vue.createCommentVNode("", true)
17731
17836
  ]);
17732
17837
  }), 128))
17733
17838
  ]);
@@ -17833,7 +17938,7 @@ const _hoisted_2$r = {
17833
17938
  class: "lupa-page-number-separator"
17834
17939
  };
17835
17940
  const _hoisted_3$l = ["onClick"];
17836
- const _hoisted_4$e = {
17941
+ const _hoisted_4$f = {
17837
17942
  key: 0,
17838
17943
  class: "lupa-page-number-separator"
17839
17944
  };
@@ -17939,7 +18044,7 @@ const _sfc_main$D = /* @__PURE__ */ vue.defineComponent({
17939
18044
  }, vue.toDisplayString(page), 11, _hoisted_3$l);
17940
18045
  }), 128)),
17941
18046
  showLastPage.value ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 2 }, [
17942
- showLastPageSeparator.value ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_4$e, "...")) : vue.createCommentVNode("", true),
18047
+ showLastPageSeparator.value ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_4$f, "...")) : vue.createCommentVNode("", true),
17943
18048
  vue.createElementVNode("div", {
17944
18049
  class: "lupa-page-number lupa-page-number-last",
17945
18050
  onClick: _cache[2] || (_cache[2] = () => {
@@ -17964,7 +18069,7 @@ const _hoisted_1$x = {
17964
18069
  };
17965
18070
  const _hoisted_2$q = { id: "lupa-select" };
17966
18071
  const _hoisted_3$k = { class: "lupa-select-label" };
17967
- const _hoisted_4$d = ["aria-label"];
18072
+ const _hoisted_4$e = ["aria-label"];
17968
18073
  const _hoisted_5$9 = ["value"];
17969
18074
  const _sfc_main$C = /* @__PURE__ */ vue.defineComponent({
17970
18075
  __name: "SearchResultsPageSize",
@@ -18011,7 +18116,7 @@ const _sfc_main$C = /* @__PURE__ */ vue.defineComponent({
18011
18116
  value: option
18012
18117
  }, vue.toDisplayString(prefixLabel.value) + vue.toDisplayString(option), 9, _hoisted_5$9);
18013
18118
  }), 128))
18014
- ], 40, _hoisted_4$d)
18119
+ ], 40, _hoisted_4$e)
18015
18120
  ])
18016
18121
  ]);
18017
18122
  };
@@ -18023,7 +18128,7 @@ const _hoisted_1$w = {
18023
18128
  };
18024
18129
  const _hoisted_2$p = { id: "lupa-select" };
18025
18130
  const _hoisted_3$j = { class: "lupa-select-label" };
18026
- const _hoisted_4$c = ["aria-label"];
18131
+ const _hoisted_4$d = ["aria-label"];
18027
18132
  const _hoisted_5$8 = ["value"];
18028
18133
  const _sfc_main$B = /* @__PURE__ */ vue.defineComponent({
18029
18134
  __name: "SearchResultsSort",
@@ -18091,7 +18196,7 @@ const _sfc_main$B = /* @__PURE__ */ vue.defineComponent({
18091
18196
  value: option.key
18092
18197
  }, vue.toDisplayString(option.label), 9, _hoisted_5$8);
18093
18198
  }), 128))
18094
- ], 40, _hoisted_4$c), [
18199
+ ], 40, _hoisted_4$d), [
18095
18200
  [vue.vModelSelect, selectedKey.value]
18096
18201
  ])
18097
18202
  ])
@@ -18105,7 +18210,7 @@ const _hoisted_2$o = {
18105
18210
  class: "lupa-toolbar-right-title"
18106
18211
  };
18107
18212
  const _hoisted_3$i = { key: 2 };
18108
- const _hoisted_4$b = { key: 4 };
18213
+ const _hoisted_4$c = { key: 4 };
18109
18214
  const _hoisted_5$7 = { key: 6 };
18110
18215
  const _hoisted_6$5 = { class: "lupa-toolbar-right" };
18111
18216
  const _hoisted_7$3 = {
@@ -18229,7 +18334,7 @@ const _sfc_main$A = /* @__PURE__ */ vue.defineComponent({
18229
18334
  label: searchSummaryLabel.value,
18230
18335
  clearable: vue.unref(hasAnyFilter) && showFilterClear.value,
18231
18336
  onClear: handleClearAll
18232
- }, null, 8, ["label", "clearable"])) : (vue.openBlock(), vue.createElementBlock("div", _hoisted_4$b)),
18337
+ }, null, 8, ["label", "clearable"])) : (vue.openBlock(), vue.createElementBlock("div", _hoisted_4$c)),
18233
18338
  displayPageSelect.value ? (vue.openBlock(), vue.createBlock(_sfc_main$D, {
18234
18339
  key: 5,
18235
18340
  options: paginationOptions.value.pageSelect,
@@ -18278,7 +18383,7 @@ const _sfc_main$z = /* @__PURE__ */ vue.defineComponent({
18278
18383
  const _hoisted_1$u = ["title", "innerHTML"];
18279
18384
  const _hoisted_2$n = ["title"];
18280
18385
  const _hoisted_3$h = ["href", "innerHTML"];
18281
- const _hoisted_4$a = ["title"];
18386
+ const _hoisted_4$b = ["title"];
18282
18387
  const _hoisted_5$6 = {
18283
18388
  key: 0,
18284
18389
  class: "lupa-search-results-product-title-text"
@@ -18346,7 +18451,7 @@ const _sfc_main$y = /* @__PURE__ */ vue.defineComponent({
18346
18451
  class: "lupa-search-results-product-title-text lupa-title-link",
18347
18452
  onClick: handleNavigation
18348
18453
  }, vue.toDisplayString(title.value), 9, _hoisted_6$4)) : vue.createCommentVNode("", true)
18349
- ], 12, _hoisted_4$a));
18454
+ ], 12, _hoisted_4$b));
18350
18455
  };
18351
18456
  }
18352
18457
  });
@@ -18389,7 +18494,7 @@ const _sfc_main$x = /* @__PURE__ */ vue.defineComponent({
18389
18494
  const _hoisted_1$s = { id: "lupa-search-results-rating" };
18390
18495
  const _hoisted_2$m = { class: "lupa-ratings" };
18391
18496
  const _hoisted_3$g = { class: "lupa-ratings-base" };
18392
- const _hoisted_4$9 = ["innerHTML"];
18497
+ const _hoisted_4$a = ["innerHTML"];
18393
18498
  const _hoisted_5$5 = { class: "lupa-rating-wrapper" };
18394
18499
  const _hoisted_6$3 = ["innerHTML"];
18395
18500
  const _hoisted_7$2 = ["href"];
@@ -18439,7 +18544,7 @@ const _sfc_main$w = /* @__PURE__ */ vue.defineComponent({
18439
18544
  key: index,
18440
18545
  innerHTML: star,
18441
18546
  class: "lupa-rating lupa-rating-not-highlighted"
18442
- }, null, 8, _hoisted_4$9);
18547
+ }, null, 8, _hoisted_4$a);
18443
18548
  }), 128))
18444
18549
  ]),
18445
18550
  vue.createElementVNode("div", _hoisted_5$5, [
@@ -18579,7 +18684,7 @@ const _sfc_main$t = /* @__PURE__ */ vue.defineComponent({
18579
18684
  const _hoisted_1$p = ["innerHTML"];
18580
18685
  const _hoisted_2$k = { key: 0 };
18581
18686
  const _hoisted_3$e = { key: 1 };
18582
- const _hoisted_4$8 = { class: "lupa-search-box-custom-label" };
18687
+ const _hoisted_4$9 = { class: "lupa-search-box-custom-label" };
18583
18688
  const _hoisted_5$4 = { class: "lupa-search-box-custom-text" };
18584
18689
  const _sfc_main$s = /* @__PURE__ */ vue.defineComponent({
18585
18690
  __name: "SearchResultsProductCustom",
@@ -18624,7 +18729,7 @@ const _sfc_main$s = /* @__PURE__ */ vue.defineComponent({
18624
18729
  class: className.value
18625
18730
  }, vue.toHandlers(_ctx.options.action ? { click: handleClick } : {}, true)), [
18626
18731
  !label.value ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_2$k, vue.toDisplayString(text.value), 1)) : (vue.openBlock(), vue.createElementBlock("div", _hoisted_3$e, [
18627
- vue.createElementVNode("div", _hoisted_4$8, vue.toDisplayString(label.value), 1),
18732
+ vue.createElementVNode("div", _hoisted_4$9, vue.toDisplayString(label.value), 1),
18628
18733
  vue.createElementVNode("div", _hoisted_5$4, vue.toDisplayString(text.value), 1)
18629
18734
  ]))
18630
18735
  ], 16));
@@ -18670,7 +18775,7 @@ const _sfc_main$r = /* @__PURE__ */ vue.defineComponent({
18670
18775
  const _hoisted_1$n = { id: "lupa-search-results-rating" };
18671
18776
  const _hoisted_2$j = ["innerHTML"];
18672
18777
  const _hoisted_3$d = { class: "lupa-ratings" };
18673
- const _hoisted_4$7 = ["href"];
18778
+ const _hoisted_4$8 = ["href"];
18674
18779
  const _sfc_main$q = /* @__PURE__ */ vue.defineComponent({
18675
18780
  __name: "SearchResultsProductSingleStarRating",
18676
18781
  props: {
@@ -18708,7 +18813,7 @@ const _sfc_main$q = /* @__PURE__ */ vue.defineComponent({
18708
18813
  vue.createElementVNode("a", {
18709
18814
  href: ratingLink.value,
18710
18815
  class: "lupa-total-ratings"
18711
- }, vue.toDisplayString(totalRatings.value), 9, _hoisted_4$7)
18816
+ }, vue.toDisplayString(totalRatings.value), 9, _hoisted_4$8)
18712
18817
  ]);
18713
18818
  };
18714
18819
  }
@@ -18803,12 +18908,13 @@ const _sfc_main$p = /* @__PURE__ */ vue.defineComponent(__spreadProps(__spreadVa
18803
18908
  };
18804
18909
  }
18805
18910
  }));
18806
- const _hoisted_1$m = ["href"];
18807
- const _hoisted_2$i = {
18911
+ const _hoisted_1$m = ["onMouseup"];
18912
+ const _hoisted_2$i = ["href"];
18913
+ const _hoisted_3$c = {
18808
18914
  key: 0,
18809
18915
  class: "lupa-out-of-stock"
18810
18916
  };
18811
- const _hoisted_3$c = { class: "lupa-search-result-product-details-section" };
18917
+ const _hoisted_4$7 = { class: "lupa-search-result-product-details-section" };
18812
18918
  const _sfc_main$o = /* @__PURE__ */ vue.defineComponent({
18813
18919
  __name: "SearchResultsProductCard",
18814
18920
  props: {
@@ -18912,7 +19018,7 @@ const _sfc_main$o = /* @__PURE__ */ vue.defineComponent({
18912
19018
  });
18913
19019
  const handleClick = () => {
18914
19020
  var _a, _b, _c, _d;
18915
- trackingStore.trackEvent({
19021
+ const event = {
18916
19022
  queryKey: props.options.queryKey,
18917
19023
  data: {
18918
19024
  itemId: id.value,
@@ -18925,9 +19031,15 @@ const _sfc_main$o = /* @__PURE__ */ vue.defineComponent({
18925
19031
  items: [props.product],
18926
19032
  itemId: id.value
18927
19033
  },
18928
- options: { allowEmptySearchQuery: true }
19034
+ options: { allowEmptySearchQuery: true },
19035
+ filters: searchResultStore.hasAnyFilter ? searchResultStore.filters : void 0
18929
19036
  }
18930
- });
19037
+ };
19038
+ if (isDelayedClickTracking()) {
19039
+ trackingStore.trackDelayedEvent(__spreadProps(__spreadValues({}, event), { url: link.value }));
19040
+ } else {
19041
+ trackingStore.trackEvent(event);
19042
+ }
18931
19043
  (_d = (_c = searchResultOptions.value.callbacks) == null ? void 0 : _c.onProductClick) == null ? void 0 : _d.call(_c, {
18932
19044
  queryKey: query.value,
18933
19045
  hasResults: true,
@@ -18960,7 +19072,10 @@ const _sfc_main$o = /* @__PURE__ */ vue.defineComponent({
18960
19072
  id: "lupa-search-result-product-card",
18961
19073
  "data-cy": "lupa-search-result-product-card",
18962
19074
  class: ["lupa-search-result-product-card", !isInStock.value ? "lupa-out-of-stock" : ""]
18963
- }, customDocumentHtmlAttributes.value, { onClick: handleClick }), [
19075
+ }, customDocumentHtmlAttributes.value, {
19076
+ onClick: handleClick,
19077
+ onMouseup: vue.withModifiers(handleClick, ["middle", "exact"])
19078
+ }), [
18964
19079
  vue.createVNode(_sfc_main$14, { options: badgesOptions.value }, null, 8, ["options"]),
18965
19080
  vue.createElementVNode("div", {
18966
19081
  class: vue.normalizeClass(["lupa-search-result-product-contents", listLayoutClass.value])
@@ -18987,9 +19102,9 @@ const _sfc_main$o = /* @__PURE__ */ vue.defineComponent({
18987
19102
  position: "image",
18988
19103
  class: "lupa-image-badges"
18989
19104
  }, null, 8, ["options"]),
18990
- ((_a = labels.value) == null ? void 0 : _a.outOfStock) && !isInStock.value ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_2$i, vue.toDisplayString(labels.value.outOfStock), 1)) : vue.createCommentVNode("", true)
18991
- ], 8, _hoisted_1$m),
18992
- vue.createElementVNode("div", _hoisted_3$c, [
19105
+ ((_a = labels.value) == null ? void 0 : _a.outOfStock) && !isInStock.value ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_3$c, vue.toDisplayString(labels.value.outOfStock), 1)) : vue.createCommentVNode("", true)
19106
+ ], 8, _hoisted_2$i),
19107
+ vue.createElementVNode("div", _hoisted_4$7, [
18993
19108
  (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(detailElements.value, (element) => {
18994
19109
  return vue.openBlock(), vue.createBlock(_sfc_main$p, {
18995
19110
  class: "lupa-search-results-product-element",
@@ -19023,7 +19138,7 @@ const _sfc_main$o = /* @__PURE__ */ vue.defineComponent({
19023
19138
  ], 2);
19024
19139
  }), 128))
19025
19140
  ], 2)
19026
- ], 16);
19141
+ ], 16, _hoisted_1$m);
19027
19142
  };
19028
19143
  }
19029
19144
  });
@@ -19161,6 +19276,7 @@ const _sfc_main$m = /* @__PURE__ */ vue.defineComponent({
19161
19276
  });
19162
19277
  };
19163
19278
  const handleQueryChange = () => {
19279
+ showAll.value = false;
19164
19280
  const context = getLupaTrackingContext();
19165
19281
  const queryBody = __spreadProps(__spreadValues({}, context), {
19166
19282
  limit: props.panel.totalCountLimit,
@@ -19395,7 +19511,6 @@ const _sfc_main$i = /* @__PURE__ */ vue.defineComponent({
19395
19511
  vue.watch(
19396
19512
  () => props.query,
19397
19513
  () => {
19398
- console.log("query changed", props.query);
19399
19514
  searchForRelatedQuery();
19400
19515
  }
19401
19516
  );