@getlupa/client 1.14.17 → 1.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.
@@ -6802,6 +6802,8 @@ const HISTORY_LOCAL_STORAGE_KEY = "LUPA_HISTORY";
6802
6802
  const TRACKING_STORAGE_KEY = "LUPA_STATS";
6803
6803
  const TRACKING_STORAGE_KEY_BASE = "LUPA_STATS_BASE";
6804
6804
  const TRACKING_ANALYTICS_KEY = "LUPA_ANALYTICS";
6805
+ const TRACKING_CLICK_DELAYED = "LUPA_TRACKING_CLICK_DELAYED";
6806
+ const DELAYED_TRACKING_EVENTS_CACHE = "LUPA_DELAYED_TRACKING_EVENTS";
6805
6807
  const TRACKING_KEY_LENGTH = 10;
6806
6808
  const HISTORY_MAX_ITEMS = 7;
6807
6809
  const S_MIN_WIDTH = 575;
@@ -7022,6 +7024,14 @@ const getNormalizedString = (str) => {
7022
7024
  const transformedStr = typeof str === "string" ? str : str.toString();
7023
7025
  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();
7024
7026
  };
7027
+ const getTransformedString = (str) => {
7028
+ var _a, _b;
7029
+ if (!str) {
7030
+ return "";
7031
+ }
7032
+ const transformedStr = typeof str === "string" ? str : str.toString();
7033
+ return transformedStr.normalize === void 0 ? (_a = transformedStr.toLocaleLowerCase()) == null ? void 0 : _a.trim() : (_b = transformedStr.toLocaleLowerCase().normalize("NFKD")) == null ? void 0 : _b.trim();
7034
+ };
7025
7035
  const capitalize$1 = (str) => {
7026
7036
  if (!str) {
7027
7037
  return "";
@@ -7095,8 +7105,8 @@ const inputsAreEqual = (input2, possibleValues) => {
7095
7105
  if (!input2) {
7096
7106
  return false;
7097
7107
  }
7098
- const normalizedInput = getNormalizedString(input2);
7099
- return possibleValues.some((v) => getNormalizedString(v) === normalizedInput);
7108
+ const normalizedInput = getTransformedString(input2);
7109
+ return possibleValues.some((v) => getTransformedString(v) === normalizedInput);
7100
7110
  };
7101
7111
  const levenshteinDistance = (s = "", t = "") => {
7102
7112
  if (!(s == null ? void 0 : s.length)) {
@@ -7129,225 +7139,6 @@ const findClosestStringValue = (input2, possibleValues, key) => {
7129
7139
  const closestValue = (_a = possibleValues.filter((_, i) => distances[i] === minDistance)) == null ? void 0 : _a[0];
7130
7140
  return closestValue;
7131
7141
  };
7132
- const initAnalyticsTracking = (analyticsOptions) => {
7133
- try {
7134
- if (analyticsOptions == null ? void 0 : analyticsOptions.enabled) {
7135
- window.sessionStorage.setItem(TRACKING_ANALYTICS_KEY, JSON.stringify(analyticsOptions));
7136
- } else {
7137
- window.sessionStorage.removeItem(TRACKING_ANALYTICS_KEY);
7138
- }
7139
- } catch (e2) {
7140
- }
7141
- };
7142
- const initBaseTracking = (enabled) => {
7143
- try {
7144
- if (enabled) {
7145
- window.sessionStorage.setItem(TRACKING_STORAGE_KEY_BASE, "1");
7146
- } else {
7147
- window.sessionStorage.removeItem(TRACKING_STORAGE_KEY_BASE);
7148
- clearSessionTracking();
7149
- clearUserTracking();
7150
- }
7151
- } catch (e2) {
7152
- }
7153
- };
7154
- const clearSessionTracking = () => {
7155
- try {
7156
- window.sessionStorage.removeItem(TRACKING_STORAGE_KEY);
7157
- } catch (e2) {
7158
- }
7159
- };
7160
- const initSessionTracking = () => {
7161
- try {
7162
- if (getSessionKey()) {
7163
- return;
7164
- }
7165
- const key = getRandomString(TRACKING_KEY_LENGTH);
7166
- window.sessionStorage.setItem(TRACKING_STORAGE_KEY, key);
7167
- } catch (e2) {
7168
- }
7169
- };
7170
- const initUserTracking = (userKey) => {
7171
- try {
7172
- if (getUserKey()) {
7173
- return;
7174
- }
7175
- const key = userKey || getRandomString(TRACKING_KEY_LENGTH);
7176
- window.localStorage.setItem(TRACKING_STORAGE_KEY, key);
7177
- } catch (e2) {
7178
- }
7179
- };
7180
- const clearUserTracking = () => {
7181
- try {
7182
- window.localStorage.removeItem(TRACKING_STORAGE_KEY);
7183
- } catch (e2) {
7184
- }
7185
- };
7186
- const isTrackingEnabled = () => {
7187
- try {
7188
- return Boolean(window.sessionStorage.getItem(TRACKING_STORAGE_KEY_BASE));
7189
- } catch (e2) {
7190
- return false;
7191
- }
7192
- };
7193
- const getSessionKey = () => {
7194
- var _a;
7195
- try {
7196
- return (_a = window.sessionStorage.getItem(TRACKING_STORAGE_KEY)) != null ? _a : void 0;
7197
- } catch (e2) {
7198
- return void 0;
7199
- }
7200
- };
7201
- const getUserKey = () => {
7202
- var _a;
7203
- try {
7204
- return (_a = window.localStorage.getItem(TRACKING_STORAGE_KEY)) != null ? _a : void 0;
7205
- } catch (e2) {
7206
- return void 0;
7207
- }
7208
- };
7209
- const initTracking = (options) => {
7210
- initBaseTracking(Boolean(options.trackBase));
7211
- if (options.trackSession) {
7212
- initSessionTracking();
7213
- } else {
7214
- clearSessionTracking();
7215
- }
7216
- if (options.trackUser) {
7217
- initUserTracking(options.userKey);
7218
- } else {
7219
- clearUserTracking();
7220
- }
7221
- if (options.analytics) {
7222
- initAnalyticsTracking(options.analytics);
7223
- }
7224
- };
7225
- const getLupaTrackingContext = () => {
7226
- if (!isTrackingEnabled()) {
7227
- return {};
7228
- }
7229
- return {
7230
- userId: getUserKey(),
7231
- sessionId: getSessionKey()
7232
- };
7233
- };
7234
- const trackLupaEvent = (queryKey, data = {}, options) => {
7235
- var _a, _b;
7236
- if (!queryKey || !data.type) {
7237
- return;
7238
- }
7239
- const eventData = {
7240
- searchQuery: (_a = data.searchQuery) != null ? _a : "",
7241
- itemId: (_b = data.itemId) != null ? _b : "",
7242
- name: data.type,
7243
- userId: getUserKey(),
7244
- sessionId: getSessionKey(),
7245
- filters: data.filters
7246
- };
7247
- LupaSearchSdk.track(queryKey, eventData, options);
7248
- };
7249
- const sendGa = (name, ...args) => {
7250
- window.ga(() => {
7251
- const trackers = window.ga.getAll();
7252
- const firstTracker = trackers[0];
7253
- if (!firstTracker) {
7254
- console.error("GA tracker not found");
7255
- }
7256
- const trackerName = firstTracker.get("name");
7257
- window.ga(`${trackerName}.${name}`, ...args);
7258
- });
7259
- };
7260
- const trackAnalyticsEvent = (data) => {
7261
- var _a, _b, _c;
7262
- try {
7263
- const options = JSON.parse(
7264
- (_a = window.sessionStorage.getItem(TRACKING_ANALYTICS_KEY)) != null ? _a : "{}"
7265
- );
7266
- if (!data.analytics || !options.enabled || ((_c = options.ignoreEvents) == null ? void 0 : _c.includes((_b = data.analytics) == null ? void 0 : _b.type))) {
7267
- return;
7268
- }
7269
- switch (options.type) {
7270
- case "ua":
7271
- sendUaAnalyticsEvent(data, options);
7272
- break;
7273
- case "ga4":
7274
- sendGa4AnalyticsEvent(data, options);
7275
- break;
7276
- case "debug":
7277
- processDebugEvent(data);
7278
- break;
7279
- default:
7280
- sendUaAnalyticsEvent(data, options);
7281
- }
7282
- } catch (e2) {
7283
- console.error("Unable to send an event to google analytics");
7284
- }
7285
- };
7286
- const parseEcommerceData = (data, title) => {
7287
- var _a, _b;
7288
- return ((_a = data.analytics) == null ? void 0 : _a.items) ? {
7289
- item_list_name: title,
7290
- items: (_b = data.analytics) == null ? void 0 : _b.items
7291
- } : void 0;
7292
- };
7293
- const sendUaAnalyticsEvent = (data, options) => {
7294
- var _a, _b, _c, _d;
7295
- const ga = window.ga;
7296
- if (!ga) {
7297
- console.error("Google Analytics object not found");
7298
- return;
7299
- }
7300
- sendGa(
7301
- "send",
7302
- "event",
7303
- options.parentEventName,
7304
- (_b = (_a = data.analytics) == null ? void 0 : _a.type) != null ? _b : "",
7305
- (_d = (_c = data.analytics) == null ? void 0 : _c.label) != null ? _d : ""
7306
- );
7307
- };
7308
- const sendGa4AnalyticsEvent = (data, options) => {
7309
- var _a, _b, _c, _d, _e, _f, _g;
7310
- if (!window || !window.dataLayer) {
7311
- console.error("dataLayer object not found.");
7312
- return;
7313
- }
7314
- const sendItemTitle = data.searchQuery !== ((_a = data.analytics) == null ? void 0 : _a.label);
7315
- const title = sendItemTitle ? (_b = data.analytics) == null ? void 0 : _b.label : void 0;
7316
- const params = __spreadValues2({
7317
- search_text: data.searchQuery,
7318
- item_title: title,
7319
- item_id: data.itemId,
7320
- ecommerce: parseEcommerceData(data, (_c = data.analytics) == null ? void 0 : _c.listLabel)
7321
- }, (_e = (_d = data.analytics) == null ? void 0 : _d.additionalParams) != null ? _e : {});
7322
- window.dataLayer.push(__spreadValues2({
7323
- event: (_g = (_f = data.analytics) == null ? void 0 : _f.type) != null ? _g : options.parentEventName
7324
- }, params));
7325
- };
7326
- const processDebugEvent = (data) => {
7327
- var _a, _b, _c, _d;
7328
- const sendItemTitle = data.searchQuery !== ((_a = data.analytics) == null ? void 0 : _a.label);
7329
- const title = sendItemTitle ? (_b = data.analytics) == null ? void 0 : _b.label : void 0;
7330
- const params = {
7331
- event: (_c = data.analytics) == null ? void 0 : _c.type,
7332
- search_text: data.searchQuery,
7333
- item_title: title,
7334
- item_id: data.itemId,
7335
- ecommerce: parseEcommerceData(data, (_d = data.analytics) == null ? void 0 : _d.listLabel)
7336
- };
7337
- console.debug("Analytics debug event:", params);
7338
- };
7339
- const track = (queryKey, data = {}, options) => {
7340
- var _a;
7341
- if (!isTrackingEnabled()) {
7342
- return;
7343
- }
7344
- const hasSearchQuery = data.searchQuery;
7345
- if (!hasSearchQuery && !((_a = data.options) == null ? void 0 : _a.allowEmptySearchQuery)) {
7346
- return;
7347
- }
7348
- trackAnalyticsEvent(data);
7349
- trackLupaEvent(queryKey, data, options);
7350
- };
7351
7142
  const DEFAULT_SEARCH_BOX_OPTIONS$1 = {
7352
7143
  inputSelector: "#searchBox",
7353
7144
  options: {
@@ -7629,6 +7420,266 @@ const useOptionsStore = defineStore("options", () => {
7629
7420
  getQueryParamName
7630
7421
  };
7631
7422
  });
7423
+ const initAnalyticsTracking = (analyticsOptions) => {
7424
+ try {
7425
+ if (analyticsOptions == null ? void 0 : analyticsOptions.enabled) {
7426
+ window.sessionStorage.setItem(TRACKING_ANALYTICS_KEY, JSON.stringify(analyticsOptions));
7427
+ } else {
7428
+ window.sessionStorage.removeItem(TRACKING_ANALYTICS_KEY);
7429
+ }
7430
+ } catch (e2) {
7431
+ }
7432
+ };
7433
+ const initBaseTracking = (enabled) => {
7434
+ try {
7435
+ if (enabled) {
7436
+ window.sessionStorage.setItem(TRACKING_STORAGE_KEY_BASE, "1");
7437
+ } else {
7438
+ window.sessionStorage.removeItem(TRACKING_STORAGE_KEY_BASE);
7439
+ clearSessionTracking();
7440
+ clearUserTracking();
7441
+ }
7442
+ } catch (e2) {
7443
+ }
7444
+ };
7445
+ const clearSessionTracking = () => {
7446
+ try {
7447
+ window.sessionStorage.removeItem(TRACKING_STORAGE_KEY);
7448
+ } catch (e2) {
7449
+ }
7450
+ };
7451
+ const initSessionTracking = () => {
7452
+ try {
7453
+ if (getSessionKey()) {
7454
+ return;
7455
+ }
7456
+ const key = getRandomString(TRACKING_KEY_LENGTH);
7457
+ window.sessionStorage.setItem(TRACKING_STORAGE_KEY, key);
7458
+ } catch (e2) {
7459
+ }
7460
+ };
7461
+ const initUserTracking = (userKey) => {
7462
+ try {
7463
+ if (getUserKey()) {
7464
+ return;
7465
+ }
7466
+ const key = userKey || getRandomString(TRACKING_KEY_LENGTH);
7467
+ window.localStorage.setItem(TRACKING_STORAGE_KEY, key);
7468
+ } catch (e2) {
7469
+ }
7470
+ };
7471
+ const clearUserTracking = () => {
7472
+ try {
7473
+ window.localStorage.removeItem(TRACKING_STORAGE_KEY);
7474
+ } catch (e2) {
7475
+ }
7476
+ };
7477
+ const isTrackingEnabled = () => {
7478
+ try {
7479
+ return Boolean(window.sessionStorage.getItem(TRACKING_STORAGE_KEY_BASE));
7480
+ } catch (e2) {
7481
+ return false;
7482
+ }
7483
+ };
7484
+ const isDelayedClickTracking = () => {
7485
+ try {
7486
+ return Boolean(window.localStorage.getItem(TRACKING_CLICK_DELAYED));
7487
+ } catch (e2) {
7488
+ return false;
7489
+ }
7490
+ };
7491
+ const getSessionKey = () => {
7492
+ var _a;
7493
+ try {
7494
+ return (_a = window.sessionStorage.getItem(TRACKING_STORAGE_KEY)) != null ? _a : void 0;
7495
+ } catch (e2) {
7496
+ return void 0;
7497
+ }
7498
+ };
7499
+ const getUserKey = () => {
7500
+ var _a;
7501
+ try {
7502
+ return (_a = window.localStorage.getItem(TRACKING_STORAGE_KEY)) != null ? _a : void 0;
7503
+ } catch (e2) {
7504
+ return void 0;
7505
+ }
7506
+ };
7507
+ const initTracking = (options) => {
7508
+ initBaseTracking(Boolean(options.trackBase));
7509
+ if (options.trackSession) {
7510
+ initSessionTracking();
7511
+ } else {
7512
+ clearSessionTracking();
7513
+ }
7514
+ if (options.trackUser) {
7515
+ initUserTracking(options.userKey);
7516
+ } else {
7517
+ clearUserTracking();
7518
+ }
7519
+ if (options.analytics) {
7520
+ initAnalyticsTracking(options.analytics);
7521
+ }
7522
+ if (options.delayedClickTracking) {
7523
+ window.localStorage.setItem(TRACKING_CLICK_DELAYED, "1");
7524
+ checkAndDispatchDelayedEvents();
7525
+ } else {
7526
+ window.localStorage.removeItem(TRACKING_CLICK_DELAYED);
7527
+ }
7528
+ };
7529
+ const getLupaTrackingContext = () => {
7530
+ if (!isTrackingEnabled()) {
7531
+ return {};
7532
+ }
7533
+ return {
7534
+ userId: getUserKey(),
7535
+ sessionId: getSessionKey()
7536
+ };
7537
+ };
7538
+ const trackLupaEvent = (queryKey, data = {}, options) => {
7539
+ var _a, _b;
7540
+ if (!queryKey || !data.type) {
7541
+ return;
7542
+ }
7543
+ const eventData = {
7544
+ searchQuery: (_a = data.searchQuery) != null ? _a : "",
7545
+ itemId: (_b = data.itemId) != null ? _b : "",
7546
+ name: data.type,
7547
+ userId: getUserKey(),
7548
+ sessionId: getSessionKey(),
7549
+ filters: data.filters
7550
+ };
7551
+ LupaSearchSdk.track(queryKey, eventData, options);
7552
+ };
7553
+ const sendGa = (name, ...args) => {
7554
+ window.ga(() => {
7555
+ const trackers = window.ga.getAll();
7556
+ const firstTracker = trackers[0];
7557
+ if (!firstTracker) {
7558
+ console.error("GA tracker not found");
7559
+ }
7560
+ const trackerName = firstTracker.get("name");
7561
+ window.ga(`${trackerName}.${name}`, ...args);
7562
+ });
7563
+ };
7564
+ const trackAnalyticsEvent = (data) => {
7565
+ var _a, _b, _c;
7566
+ try {
7567
+ const options = JSON.parse(
7568
+ (_a = window.sessionStorage.getItem(TRACKING_ANALYTICS_KEY)) != null ? _a : "{}"
7569
+ );
7570
+ if (!data.analytics || !options.enabled || ((_c = options.ignoreEvents) == null ? void 0 : _c.includes((_b = data.analytics) == null ? void 0 : _b.type))) {
7571
+ return;
7572
+ }
7573
+ switch (options.type) {
7574
+ case "ua":
7575
+ sendUaAnalyticsEvent(data, options);
7576
+ break;
7577
+ case "ga4":
7578
+ sendGa4AnalyticsEvent(data, options);
7579
+ break;
7580
+ case "debug":
7581
+ processDebugEvent(data);
7582
+ break;
7583
+ default:
7584
+ sendUaAnalyticsEvent(data, options);
7585
+ }
7586
+ } catch (e2) {
7587
+ console.error("Unable to send an event to google analytics");
7588
+ }
7589
+ };
7590
+ const parseEcommerceData = (data, title) => {
7591
+ var _a, _b;
7592
+ return ((_a = data.analytics) == null ? void 0 : _a.items) ? {
7593
+ item_list_name: title,
7594
+ items: (_b = data.analytics) == null ? void 0 : _b.items
7595
+ } : void 0;
7596
+ };
7597
+ const sendUaAnalyticsEvent = (data, options) => {
7598
+ var _a, _b, _c, _d;
7599
+ const ga = window.ga;
7600
+ if (!ga) {
7601
+ console.error("Google Analytics object not found");
7602
+ return;
7603
+ }
7604
+ sendGa(
7605
+ "send",
7606
+ "event",
7607
+ options.parentEventName,
7608
+ (_b = (_a = data.analytics) == null ? void 0 : _a.type) != null ? _b : "",
7609
+ (_d = (_c = data.analytics) == null ? void 0 : _c.label) != null ? _d : ""
7610
+ );
7611
+ };
7612
+ const sendGa4AnalyticsEvent = (data, options) => {
7613
+ var _a, _b, _c, _d, _e, _f, _g;
7614
+ if (!window || !window.dataLayer) {
7615
+ console.error("dataLayer object not found.");
7616
+ return;
7617
+ }
7618
+ const sendItemTitle = data.searchQuery !== ((_a = data.analytics) == null ? void 0 : _a.label);
7619
+ const title = sendItemTitle ? (_b = data.analytics) == null ? void 0 : _b.label : void 0;
7620
+ const params = __spreadValues2({
7621
+ search_text: data.searchQuery,
7622
+ item_title: title,
7623
+ item_id: data.itemId,
7624
+ ecommerce: parseEcommerceData(data, (_c = data.analytics) == null ? void 0 : _c.listLabel)
7625
+ }, (_e = (_d = data.analytics) == null ? void 0 : _d.additionalParams) != null ? _e : {});
7626
+ window.dataLayer.push(__spreadValues2({
7627
+ event: (_g = (_f = data.analytics) == null ? void 0 : _f.type) != null ? _g : options.parentEventName
7628
+ }, params));
7629
+ };
7630
+ const processDebugEvent = (data) => {
7631
+ var _a, _b, _c, _d;
7632
+ const sendItemTitle = data.searchQuery !== ((_a = data.analytics) == null ? void 0 : _a.label);
7633
+ const title = sendItemTitle ? (_b = data.analytics) == null ? void 0 : _b.label : void 0;
7634
+ const params = {
7635
+ event: (_c = data.analytics) == null ? void 0 : _c.type,
7636
+ search_text: data.searchQuery,
7637
+ item_title: title,
7638
+ item_id: data.itemId,
7639
+ ecommerce: parseEcommerceData(data, (_d = data.analytics) == null ? void 0 : _d.listLabel)
7640
+ };
7641
+ console.debug("Analytics debug event:", params);
7642
+ };
7643
+ const getDelayedEventsCache = () => {
7644
+ var _a;
7645
+ try {
7646
+ return JSON.parse((_a = window.localStorage.getItem(DELAYED_TRACKING_EVENTS_CACHE)) != null ? _a : "{}");
7647
+ } catch (e2) {
7648
+ return {};
7649
+ }
7650
+ };
7651
+ const storeDelayedEventCache = (cache) => {
7652
+ try {
7653
+ window.localStorage.setItem(DELAYED_TRACKING_EVENTS_CACHE, JSON.stringify(cache));
7654
+ } catch (e2) {
7655
+ }
7656
+ };
7657
+ const checkAndDispatchDelayedEvents = () => {
7658
+ var _a, _b;
7659
+ const optionsStore = useOptionsStore();
7660
+ const eventCache = getDelayedEventsCache();
7661
+ const urls = Object.keys(eventCache);
7662
+ for (const url of urls) {
7663
+ if ((_a = window.location.href) == null ? void 0 : _a.includes(url)) {
7664
+ const options = (_b = optionsStore.envOptions) != null ? _b : { environment: "production" };
7665
+ const { queryKey, data } = eventCache[url];
7666
+ track(queryKey, data, options);
7667
+ }
7668
+ }
7669
+ storeDelayedEventCache({});
7670
+ };
7671
+ const track = (queryKey, data = {}, options) => {
7672
+ var _a;
7673
+ if (!isTrackingEnabled()) {
7674
+ return;
7675
+ }
7676
+ const hasSearchQuery = data.searchQuery;
7677
+ if (!hasSearchQuery && !((_a = data.options) == null ? void 0 : _a.allowEmptySearchQuery)) {
7678
+ return;
7679
+ }
7680
+ trackAnalyticsEvent(data);
7681
+ trackLupaEvent(queryKey, data, options);
7682
+ };
7632
7683
  var DocumentElementType = /* @__PURE__ */ ((DocumentElementType2) => {
7633
7684
  DocumentElementType2["IMAGE"] = "image";
7634
7685
  DocumentElementType2["TITLE"] = "title";
@@ -7860,7 +7911,10 @@ const getHint = (suggestion, inputValue) => {
7860
7911
  if (!inputValue) {
7861
7912
  return escapeHtml$1(suggestion);
7862
7913
  }
7863
- return (_a = suggestion == null ? void 0 : suggestion.replace(inputValue, `<strong>${escapeHtml$1(inputValue)}</strong>`)) != null ? _a : "";
7914
+ return (_a = suggestion == null ? void 0 : suggestion.replace(
7915
+ inputValue == null ? void 0 : inputValue.toLocaleLowerCase(),
7916
+ `<strong>${escapeHtml$1(inputValue == null ? void 0 : inputValue.toLocaleLowerCase())}</strong>`
7917
+ )) != null ? _a : "";
7864
7918
  };
7865
7919
  const reverseKeyValue = (obj) => {
7866
7920
  return Object.fromEntries(Object.entries(obj).map(([k, v]) => [v, k.toLowerCase()]));
@@ -8078,14 +8132,16 @@ const toggleTermFilter = (appendParams, facetAction, getQueryParamName, currentF
8078
8132
  paramsToRemove: [getQueryParamName ? getQueryParamName(QUERY_PARAMS$1.PAGE) : QUERY_PARAMS$1.PAGE]
8079
8133
  });
8080
8134
  };
8135
+ const replaceHierarchyParam = (params = [], param = "") => {
8136
+ if (params.some((p2) => p2.startsWith(param))) {
8137
+ return toggleLastPram(params, param);
8138
+ }
8139
+ return [param];
8140
+ };
8081
8141
  const toggleHierarchyFilter = (appendParams, facetAction, getQueryParamName, currentFilters, removeAllLevels = false) => {
8082
- var _a;
8142
+ var _a, _b;
8083
8143
  const currentFilter = currentFilters == null ? void 0 : currentFilters[facetAction.key];
8084
- const newParams = toggleHierarchyParam(
8085
- (_a = currentFilter == null ? void 0 : currentFilter.terms) != null ? _a : [],
8086
- facetAction.value,
8087
- removeAllLevels
8088
- );
8144
+ 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);
8089
8145
  appendParams({
8090
8146
  params: [getFacetParam(facetAction.key, newParams, FACET_PARAMS_TYPE.HIERARCHY)],
8091
8147
  paramsToRemove: [getQueryParamName ? getQueryParamName(QUERY_PARAMS$1.PAGE) : QUERY_PARAMS$1.PAGE]
@@ -8428,6 +8484,7 @@ const useSearchBoxStore = defineStore("searchBox", () => {
8428
8484
  const highlightedIndex = ref(-1);
8429
8485
  const inputValue = ref("");
8430
8486
  const resultInputValue = ref("");
8487
+ const latestRequestIdByQueryKey = {};
8431
8488
  const historyStore = useHistoryStore();
8432
8489
  const resultsVisible = computed(() => {
8433
8490
  var _a;
@@ -8494,12 +8551,17 @@ const useSearchBoxStore = defineStore("searchBox", () => {
8494
8551
  }) {
8495
8552
  var _a;
8496
8553
  try {
8554
+ const currentRequestId = Date.now();
8555
+ latestRequestIdByQueryKey[queryKey] = currentRequestId;
8497
8556
  const context = getLupaTrackingContext();
8498
8557
  const result2 = yield LupaSearchSdk.suggestions(
8499
8558
  queryKey,
8500
8559
  __spreadValues2(__spreadValues2({}, publicQuery), context),
8501
8560
  options2
8502
8561
  );
8562
+ if (latestRequestIdByQueryKey[queryKey] !== currentRequestId) {
8563
+ return { suggestions: void 0 };
8564
+ }
8503
8565
  if (!result2.success) {
8504
8566
  return { suggestions: void 0 };
8505
8567
  }
@@ -8540,8 +8602,13 @@ const useSearchBoxStore = defineStore("searchBox", () => {
8540
8602
  options: options2
8541
8603
  }) {
8542
8604
  try {
8605
+ const currentRequestId = Date.now();
8606
+ latestRequestIdByQueryKey[queryKey] = currentRequestId;
8543
8607
  const context = getLupaTrackingContext();
8544
8608
  const result2 = yield LupaSearchSdk.query(queryKey, __spreadValues2(__spreadValues2({}, publicQuery), context), options2);
8609
+ if (latestRequestIdByQueryKey[queryKey] !== currentRequestId) {
8610
+ return { suggestions: void 0 };
8611
+ }
8545
8612
  if (!result2.success) {
8546
8613
  return { queryKey, result: { items: [] } };
8547
8614
  }
@@ -8596,7 +8663,7 @@ const useSearchBoxStore = defineStore("searchBox", () => {
8596
8663
  const _hoisted_1$1g = { id: "lupa-search-box-input-container" };
8597
8664
  const _hoisted_2$U = { class: "lupa-input-clear" };
8598
8665
  const _hoisted_3$D = { id: "lupa-search-box-input" };
8599
- const _hoisted_4$s = ["value"];
8666
+ const _hoisted_4$t = ["value"];
8600
8667
  const _hoisted_5$j = ["aria-label", "placeholder"];
8601
8668
  const _hoisted_6$9 = /* @__PURE__ */ createBaseVNode("span", { class: "lupa-search-submit-icon" }, null, -1);
8602
8669
  const _hoisted_7$7 = [
@@ -8703,7 +8770,7 @@ const _sfc_main$1s = /* @__PURE__ */ defineComponent({
8703
8770
  "aria-hidden": "true",
8704
8771
  value: showHint.value ? suggestedValue.value.item.suggestion : "",
8705
8772
  disabled: ""
8706
- }, null, 8, _hoisted_4$s),
8773
+ }, null, 8, _hoisted_4$t),
8707
8774
  withDirectives(createBaseVNode("input", mergeProps({
8708
8775
  "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => inputValue.value = $event)
8709
8776
  }, inputAttributes.value, {
@@ -8915,7 +8982,7 @@ const _hoisted_3$C = {
8915
8982
  class: "lupa-suggestion-facet",
8916
8983
  "data-cy": "lupa-suggestion-facet"
8917
8984
  };
8918
- const _hoisted_4$r = {
8985
+ const _hoisted_4$s = {
8919
8986
  class: "lupa-suggestion-facet-label",
8920
8987
  "data-cy": "lupa-suggestion-facet-label"
8921
8988
  };
@@ -8961,7 +9028,7 @@ const _sfc_main$1n = /* @__PURE__ */ defineComponent({
8961
9028
  innerHTML: _ctx.suggestion.displayHighlight
8962
9029
  }, null, 8, _hoisted_1$1c)) : (openBlock(), createElementBlock("div", _hoisted_2$S, toDisplayString(_ctx.suggestion.display), 1)),
8963
9030
  _ctx.suggestion.facet ? (openBlock(), createElementBlock("div", _hoisted_3$C, [
8964
- createBaseVNode("span", _hoisted_4$r, toDisplayString(facetLabel.value), 1),
9031
+ createBaseVNode("span", _hoisted_4$s, toDisplayString(facetLabel.value), 1),
8965
9032
  createBaseVNode("span", _hoisted_5$i, toDisplayString(_ctx.suggestion.facet.title), 1)
8966
9033
  ])) : createCommentVNode("", true)
8967
9034
  ]);
@@ -18477,7 +18544,7 @@ const _sfc_main$1f = /* @__PURE__ */ defineComponent({
18477
18544
  const _hoisted_1$16 = ["innerHTML"];
18478
18545
  const _hoisted_2$O = { key: 0 };
18479
18546
  const _hoisted_3$B = { key: 1 };
18480
- const _hoisted_4$q = { class: "lupa-search-box-custom-label" };
18547
+ const _hoisted_4$r = { class: "lupa-search-box-custom-label" };
18481
18548
  const _hoisted_5$h = { class: "lupa-search-box-custom-text" };
18482
18549
  const _sfc_main$1e = /* @__PURE__ */ defineComponent({
18483
18550
  __name: "SearchBoxProductCustom",
@@ -18510,7 +18577,7 @@ const _sfc_main$1e = /* @__PURE__ */ defineComponent({
18510
18577
  class: [className.value, "lupa-search-box-product-custom"]
18511
18578
  }, toHandlers(_ctx.options.action ? { click: handleClick } : {}, true)), [
18512
18579
  !label.value ? (openBlock(), createElementBlock("div", _hoisted_2$O, toDisplayString(text.value), 1)) : (openBlock(), createElementBlock("div", _hoisted_3$B, [
18513
- createBaseVNode("div", _hoisted_4$q, toDisplayString(label.value), 1),
18580
+ createBaseVNode("div", _hoisted_4$r, toDisplayString(label.value), 1),
18514
18581
  createBaseVNode("div", _hoisted_5$h, toDisplayString(text.value), 1)
18515
18582
  ]))
18516
18583
  ], 16));
@@ -18923,7 +18990,7 @@ const _sfc_main$1b = /* @__PURE__ */ defineComponent(__spreadProps2(__spreadValu
18923
18990
  const _hoisted_1$12 = { class: "lupa-badge-title" };
18924
18991
  const _hoisted_2$M = ["src"];
18925
18992
  const _hoisted_3$z = { key: 1 };
18926
- const _hoisted_4$p = {
18993
+ const _hoisted_4$q = {
18927
18994
  key: 0,
18928
18995
  class: "lupa-badge-full-text"
18929
18996
  };
@@ -18967,7 +19034,7 @@ const _sfc_main$1a = /* @__PURE__ */ defineComponent({
18967
19034
  }, null, 8, _hoisted_2$M)) : createCommentVNode("", true),
18968
19035
  hasTitleText.value && showTitle.value ? (openBlock(), createElementBlock("span", _hoisted_3$z, toDisplayString(_ctx.badge.titleText), 1)) : createCommentVNode("", true)
18969
19036
  ]),
18970
- hasAdditionalText.value ? (openBlock(), createElementBlock("span", _hoisted_4$p, toDisplayString(_ctx.badge.additionalText), 1)) : createCommentVNode("", true)
19037
+ hasAdditionalText.value ? (openBlock(), createElementBlock("span", _hoisted_4$q, toDisplayString(_ctx.badge.additionalText), 1)) : createCommentVNode("", true)
18971
19038
  ], 6);
18972
19039
  };
18973
19040
  }
@@ -19445,7 +19512,18 @@ const useTrackingStore = defineStore("tracking", () => {
19445
19512
  options
19446
19513
  );
19447
19514
  };
19448
- return { trackSearch, trackResults, trackEvent };
19515
+ const trackDelayedEvent = ({
19516
+ queryKey,
19517
+ data,
19518
+ url
19519
+ }) => {
19520
+ let currentCache = getDelayedEventsCache();
19521
+ currentCache = __spreadProps2(__spreadValues2({}, currentCache), {
19522
+ [url]: { data, queryKey }
19523
+ });
19524
+ storeDelayedEventCache(currentCache);
19525
+ };
19526
+ return { trackSearch, trackResults, trackEvent, trackDelayedEvent };
19449
19527
  });
19450
19528
  const _hoisted_1$X = { id: "lupa-search-box-products" };
19451
19529
  const _sfc_main$12 = /* @__PURE__ */ defineComponent({
@@ -19489,7 +19567,7 @@ const _sfc_main$12 = /* @__PURE__ */ defineComponent({
19489
19567
  if (!props.panelOptions.idKey) {
19490
19568
  return;
19491
19569
  }
19492
- trackingStore.trackEvent({
19570
+ const trackableEvent = {
19493
19571
  queryKey: props.panelOptions.queryKey,
19494
19572
  data: {
19495
19573
  itemId: id,
@@ -19501,7 +19579,14 @@ const _sfc_main$12 = /* @__PURE__ */ defineComponent({
19501
19579
  items: [item]
19502
19580
  }
19503
19581
  }
19504
- });
19582
+ };
19583
+ if (isDelayedClickTracking()) {
19584
+ trackingStore.trackDelayedEvent(__spreadProps2(__spreadValues2({}, trackableEvent), {
19585
+ url: link
19586
+ }));
19587
+ } else {
19588
+ trackingStore.trackEvent(trackableEvent);
19589
+ }
19505
19590
  if (!link || eventType === "addToCart") {
19506
19591
  return;
19507
19592
  }
@@ -19767,7 +19852,7 @@ const _hoisted_3$x = {
19767
19852
  key: 0,
19768
19853
  class: "lupa-panel-title lupa-panel-title-top-results"
19769
19854
  };
19770
- const _hoisted_4$o = {
19855
+ const _hoisted_4$p = {
19771
19856
  key: 1,
19772
19857
  class: "lupa-panel-title"
19773
19858
  };
@@ -19961,7 +20046,7 @@ const _sfc_main$_ = /* @__PURE__ */ defineComponent(__spreadProps2(__spreadValue
19961
20046
  "data-cy": "lupa-panel-" + panel.type + "-index"
19962
20047
  }, [
19963
20048
  ((_a2 = panel.labels) == null ? void 0 : _a2.topResultsTitle) && showTopResultsPanelTitle(panel.queryKey) ? (openBlock(), createElementBlock("div", _hoisted_3$x, toDisplayString((_b = panel.labels) == null ? void 0 : _b.topResultsTitle), 1)) : createCommentVNode("", true),
19964
- ((_c = panel.labels) == null ? void 0 : _c.title) && showPanelTitle(panel) ? (openBlock(), createElementBlock("div", _hoisted_4$o, toDisplayString((_d = panel.labels) == null ? void 0 : _d.title), 1)) : createCommentVNode("", true),
20049
+ ((_c = panel.labels) == null ? void 0 : _c.title) && showPanelTitle(panel) ? (openBlock(), createElementBlock("div", _hoisted_4$p, toDisplayString((_d = panel.labels) == null ? void 0 : _d.title), 1)) : createCommentVNode("", true),
19965
20050
  panel.queryKey && canShowPanel(panel) ? (openBlock(), createBlock(resolveDynamicComponent(getComponent(panel.type)), {
19966
20051
  key: 2,
19967
20052
  panel,
@@ -20227,7 +20312,7 @@ const _sfc_main$Z = /* @__PURE__ */ defineComponent({
20227
20312
  if (!doc2.queryKey || !doc2.doc) {
20228
20313
  return;
20229
20314
  }
20230
- trackingStore.trackEvent({
20315
+ const event = {
20231
20316
  queryKey: doc2.queryKey,
20232
20317
  data: {
20233
20318
  itemId: doc2.id,
@@ -20239,7 +20324,14 @@ const _sfc_main$Z = /* @__PURE__ */ defineComponent({
20239
20324
  items: [doc2]
20240
20325
  }
20241
20326
  }
20242
- });
20327
+ };
20328
+ if (isDelayedClickTracking()) {
20329
+ trackingStore.trackDelayedEvent(__spreadProps2(__spreadValues2({}, event), {
20330
+ url: generateLink(props.options.links.searchResults, doc2)
20331
+ }));
20332
+ } else {
20333
+ trackingStore.trackEvent(event);
20334
+ }
20243
20335
  };
20244
20336
  const trackSearchQuery = (query) => {
20245
20337
  if (!query) {
@@ -20400,7 +20492,7 @@ const _hoisted_3$w = {
20400
20492
  key: 1,
20401
20493
  "data-cy": "did-you-mean-label"
20402
20494
  };
20403
- const _hoisted_4$n = { key: 1 };
20495
+ const _hoisted_4$o = { key: 1 };
20404
20496
  const _sfc_main$Y = /* @__PURE__ */ defineComponent({
20405
20497
  __name: "SearchResultsDidYouMean",
20406
20498
  props: {
@@ -20451,7 +20543,7 @@ const _sfc_main$Y = /* @__PURE__ */ defineComponent({
20451
20543
  class: "lupa-did-you-mean lupa-highlighted-search-text",
20452
20544
  "data-cy": "did-you-mean-value",
20453
20545
  onClick: _cache[0] || (_cache[0] = ($event) => goToResults({ searchText: didYouMeanValue.value }))
20454
- }, toDisplayString(didYouMeanValue.value) + " ", 1)) : (openBlock(), createElementBlock("span", _hoisted_4$n, toDisplayString(label) + " ", 1))
20546
+ }, toDisplayString(didYouMeanValue.value) + " ", 1)) : (openBlock(), createElementBlock("span", _hoisted_4$o, toDisplayString(label) + " ", 1))
20455
20547
  ]);
20456
20548
  }), 128))
20457
20549
  ])) : createCommentVNode("", true)
@@ -20501,7 +20593,7 @@ const _hoisted_3$v = {
20501
20593
  key: 1,
20502
20594
  class: "lupa-results-total-count"
20503
20595
  };
20504
- const _hoisted_4$m = { class: "lupa-results-total-count-number" };
20596
+ const _hoisted_4$n = { class: "lupa-results-total-count-number" };
20505
20597
  const _hoisted_5$f = ["innerHTML"];
20506
20598
  const _sfc_main$W = /* @__PURE__ */ defineComponent({
20507
20599
  __name: "SearchResultsTitle",
@@ -20547,7 +20639,7 @@ const _sfc_main$W = /* @__PURE__ */ defineComponent({
20547
20639
  queryText.value ? (openBlock(), createElementBlock("span", _hoisted_2$E, "'" + toDisplayString(queryText.value) + "'", 1)) : createCommentVNode("", true),
20548
20640
  showProductCount.value ? (openBlock(), createElementBlock("span", _hoisted_3$v, [
20549
20641
  createTextVNode("(" + toDisplayString(searchResultsCountLabel.value), 1),
20550
- createBaseVNode("span", _hoisted_4$m, toDisplayString(unref(totalItems)), 1),
20642
+ createBaseVNode("span", _hoisted_4$n, toDisplayString(unref(totalItems)), 1),
20551
20643
  createTextVNode(")")
20552
20644
  ])) : createCommentVNode("", true)
20553
20645
  ])) : createCommentVNode("", true),
@@ -20605,7 +20697,7 @@ const _hoisted_3$t = {
20605
20697
  key: 0,
20606
20698
  class: "filter-values"
20607
20699
  };
20608
- const _hoisted_4$l = { class: "lupa-current-filter-list" };
20700
+ const _hoisted_4$m = { class: "lupa-current-filter-list" };
20609
20701
  const _sfc_main$U = /* @__PURE__ */ defineComponent({
20610
20702
  __name: "CurrentFilters",
20611
20703
  props: {
@@ -20689,7 +20781,7 @@ const _sfc_main$U = /* @__PURE__ */ defineComponent({
20689
20781
  }, null, 2)) : createCommentVNode("", true)
20690
20782
  ]),
20691
20783
  !_ctx.expandable || isOpen.value ? (openBlock(), createElementBlock("div", _hoisted_3$t, [
20692
- createBaseVNode("div", _hoisted_4$l, [
20784
+ createBaseVNode("div", _hoisted_4$m, [
20693
20785
  (openBlock(true), createElementBlock(Fragment, null, renderList(currentDisplayFilters.value, (filter2) => {
20694
20786
  return openBlock(), createBlock(_sfc_main$V, {
20695
20787
  key: filter2.key + "_" + filter2.value,
@@ -20757,7 +20849,7 @@ const _hoisted_1$N = {
20757
20849
  };
20758
20850
  const _hoisted_2$B = { class: "lupa-category-back" };
20759
20851
  const _hoisted_3$s = ["href"];
20760
- const _hoisted_4$k = ["href"];
20852
+ const _hoisted_4$l = ["href"];
20761
20853
  const _hoisted_5$e = { class: "lupa-child-category-list" };
20762
20854
  const _sfc_main$S = /* @__PURE__ */ defineComponent({
20763
20855
  __name: "CategoryFilter",
@@ -20864,7 +20956,7 @@ const _sfc_main$S = /* @__PURE__ */ defineComponent({
20864
20956
  href: parentUrlLink.value,
20865
20957
  class: normalizeClass({ "lupa-title-category": !hasBackButton.value }),
20866
20958
  onClick: handleNavigationParent
20867
- }, toDisplayString(parentTitle.value), 11, _hoisted_4$k)
20959
+ }, toDisplayString(parentTitle.value), 11, _hoisted_4$l)
20868
20960
  ], 2),
20869
20961
  createBaseVNode("div", _hoisted_5$e, [
20870
20962
  (openBlock(true), createElementBlock(Fragment, null, renderList(categoryChildren.value, (child) => {
@@ -20885,7 +20977,7 @@ const _hoisted_1$M = {
20885
20977
  };
20886
20978
  const _hoisted_2$A = ["placeholder"];
20887
20979
  const _hoisted_3$r = { class: "lupa-terms-list" };
20888
- const _hoisted_4$j = ["onClick"];
20980
+ const _hoisted_4$k = ["onClick"];
20889
20981
  const _hoisted_5$d = { class: "lupa-term-checkbox-wrapper" };
20890
20982
  const _hoisted_6$8 = { class: "lupa-term-checkbox-label" };
20891
20983
  const _hoisted_7$6 = { class: "lupa-term-label" };
@@ -20993,7 +21085,7 @@ const _sfc_main$R = /* @__PURE__ */ defineComponent({
20993
21085
  createBaseVNode("span", _hoisted_7$6, toDisplayString(item.title), 1),
20994
21086
  _ctx.options.showDocumentCount ? (openBlock(), createElementBlock("span", _hoisted_8$2, "(" + toDisplayString(item.count) + ")", 1)) : createCommentVNode("", true)
20995
21087
  ])
20996
- ], 10, _hoisted_4$j);
21088
+ ], 10, _hoisted_4$k);
20997
21089
  }), 128))
20998
21090
  ]),
20999
21091
  displayShowMore.value ? (openBlock(), createElementBlock("div", {
@@ -21993,7 +22085,7 @@ const _hoisted_3$q = {
21993
22085
  key: 1,
21994
22086
  class: "lupa-stats-facet-summary-input"
21995
22087
  };
21996
- const _hoisted_4$i = {
22088
+ const _hoisted_4$j = {
21997
22089
  key: 0,
21998
22090
  class: "lupa-stats-range-label"
21999
22091
  };
@@ -22057,8 +22149,12 @@ const _sfc_main$Q = /* @__PURE__ */ defineComponent({
22057
22149
  var _a;
22058
22150
  return Boolean((_a = props.options.stats) == null ? void 0 : _a.inputs);
22059
22151
  });
22152
+ const pricePrecision = computed(() => {
22153
+ var _a, _b;
22154
+ return (_b = (_a = props.options.stats) == null ? void 0 : _a.pricePrecisionDigits) != null ? _b : 2;
22155
+ });
22060
22156
  const fromValue = computed({
22061
- get: () => isPrice.value ? sliderRange.value[0].toFixed(2).replace(".", separator.value) : `${sliderRange.value[0]}`,
22157
+ get: () => isPrice.value ? sliderRange.value[0].toFixed(pricePrecision.value).replace(".", separator.value) : `${sliderRange.value[0]}`,
22062
22158
  set: (stringValue) => {
22063
22159
  let value = normalizeFloat(stringValue);
22064
22160
  if (value < facetMin.value) {
@@ -22072,7 +22168,7 @@ const _sfc_main$Q = /* @__PURE__ */ defineComponent({
22072
22168
  }
22073
22169
  });
22074
22170
  const toValue = computed({
22075
- get: () => isPrice.value ? sliderRange.value[1].toFixed(2).replace(".", separator.value) : `${sliderRange.value[1]}`,
22171
+ get: () => isPrice.value ? sliderRange.value[1].toFixed(pricePrecision.value).replace(".", separator.value) : `${sliderRange.value[1]}`,
22076
22172
  set: (stringValue) => {
22077
22173
  let value = normalizeFloat(stringValue);
22078
22174
  if (value > facetMax.value) {
@@ -22188,7 +22284,7 @@ const _sfc_main$Q = /* @__PURE__ */ defineComponent({
22188
22284
  return openBlock(), createElementBlock("div", _hoisted_1$L, [
22189
22285
  !isInputVisible.value ? (openBlock(), createElementBlock("div", _hoisted_2$z, toDisplayString(statsSummary.value), 1)) : (openBlock(), createElementBlock("div", _hoisted_3$q, [
22190
22286
  createBaseVNode("div", null, [
22191
- rangeLabelFrom.value ? (openBlock(), createElementBlock("div", _hoisted_4$i, toDisplayString(rangeLabelFrom.value), 1)) : createCommentVNode("", true),
22287
+ rangeLabelFrom.value ? (openBlock(), createElementBlock("div", _hoisted_4$j, toDisplayString(rangeLabelFrom.value), 1)) : createCommentVNode("", true),
22192
22288
  createBaseVNode("div", _hoisted_5$c, [
22193
22289
  withDirectives(createBaseVNode("input", {
22194
22290
  "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => fromValue.value = $event),
@@ -22255,7 +22351,7 @@ const _sfc_main$Q = /* @__PURE__ */ defineComponent({
22255
22351
  const _hoisted_1$K = { class: "lupa-term-checkbox-wrapper" };
22256
22352
  const _hoisted_2$y = { class: "lupa-term-checkbox-label" };
22257
22353
  const _hoisted_3$p = { class: "lupa-term-label" };
22258
- const _hoisted_4$h = {
22354
+ const _hoisted_4$i = {
22259
22355
  key: 0,
22260
22356
  class: "lupa-term-count"
22261
22357
  };
@@ -22316,7 +22412,7 @@ const _sfc_main$P = /* @__PURE__ */ defineComponent({
22316
22412
  ]),
22317
22413
  createBaseVNode("div", _hoisted_2$y, [
22318
22414
  createBaseVNode("span", _hoisted_3$p, toDisplayString(_ctx.item.title) + toDisplayString(" "), 1),
22319
- _ctx.options.showDocumentCount ? (openBlock(), createElementBlock("span", _hoisted_4$h, "(" + toDisplayString(_ctx.item.count) + ")", 1)) : createCommentVNode("", true)
22415
+ _ctx.options.showDocumentCount ? (openBlock(), createElementBlock("span", _hoisted_4$i, "(" + toDisplayString(_ctx.item.count) + ")", 1)) : createCommentVNode("", true)
22320
22416
  ])
22321
22417
  ]),
22322
22418
  showChildren.value ? (openBlock(), createElementBlock("div", _hoisted_5$b, [
@@ -22381,15 +22477,20 @@ const _sfc_main$O = /* @__PURE__ */ defineComponent({
22381
22477
  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);
22382
22478
  });
22383
22479
  const handleFacetClick = ({ value }) => {
22480
+ var _a, _b;
22384
22481
  emit2("select", {
22385
22482
  key: facet.value.key,
22386
22483
  value,
22387
- type: "hierarchy"
22484
+ type: "hierarchy",
22485
+ behavior: (_b = (_a = props.options.hierarchy) == null ? void 0 : _a.behavior) != null ? _b : "append"
22388
22486
  });
22389
22487
  };
22390
22488
  const handleShowAll = () => {
22391
22489
  showAll.value = true;
22392
22490
  };
22491
+ const handleCancelShowAll = () => {
22492
+ showAll.value = false;
22493
+ };
22393
22494
  return (_ctx, _cache) => {
22394
22495
  return openBlock(), createElementBlock("div", _hoisted_1$J, [
22395
22496
  isFilterable.value ? (openBlock(), createElementBlock("div", _hoisted_2$x, [
@@ -22418,7 +22519,11 @@ const _sfc_main$O = /* @__PURE__ */ defineComponent({
22418
22519
  class: "lupa-facet-term lupa-show-more-facet-results",
22419
22520
  "data-cy": "lupa-facet-term",
22420
22521
  onClick: handleShowAll
22421
- }, toDisplayString(_ctx.options.labels.showAll), 1)) : createCommentVNode("", true)
22522
+ }, toDisplayString(_ctx.options.labels.showAll), 1)) : showAll.value ? (openBlock(), createElementBlock("div", {
22523
+ key: 2,
22524
+ class: "lupa-facet-term lupa-show-more-facet-results",
22525
+ onClick: handleCancelShowAll
22526
+ }, toDisplayString(_ctx.options.labels.showLess), 1)) : createCommentVNode("", true)
22422
22527
  ]);
22423
22528
  };
22424
22529
  }
@@ -22828,7 +22933,7 @@ const _hoisted_1$D = {
22828
22933
  };
22829
22934
  const _hoisted_2$t = ["onClick"];
22830
22935
  const _hoisted_3$n = { class: "lupa-mobile-sidebar-content" };
22831
- const _hoisted_4$g = { class: "lupa-sidebar-top" };
22936
+ const _hoisted_4$h = { class: "lupa-sidebar-top" };
22832
22937
  const _hoisted_5$a = { class: "lupa-sidebar-title" };
22833
22938
  const _hoisted_6$6 = {
22834
22939
  key: 0,
@@ -22872,7 +22977,7 @@ const _sfc_main$I = /* @__PURE__ */ defineComponent({
22872
22977
  onClick: withModifiers(handleMobileToggle, ["stop"])
22873
22978
  }, null, 8, _hoisted_2$t),
22874
22979
  createBaseVNode("div", _hoisted_3$n, [
22875
- createBaseVNode("div", _hoisted_4$g, [
22980
+ createBaseVNode("div", _hoisted_4$h, [
22876
22981
  createBaseVNode("div", _hoisted_5$a, [
22877
22982
  createTextVNode(toDisplayString(sidebarTitle.value) + " ", 1),
22878
22983
  isFilterCountVisible.value ? (openBlock(), createElementBlock("span", _hoisted_6$6, toDisplayString(unref(currentFilterCount)), 1)) : createCommentVNode("", true)
@@ -22900,7 +23005,7 @@ const _hoisted_3$m = {
22900
23005
  key: 1,
22901
23006
  class: "lupa-search-results-breadcrumb-text"
22902
23007
  };
22903
- const _hoisted_4$f = { key: 2 };
23008
+ const _hoisted_4$g = { key: 2 };
22904
23009
  const _sfc_main$H = /* @__PURE__ */ defineComponent({
22905
23010
  __name: "SearchResultsBreadcrumbs",
22906
23011
  props: {
@@ -22941,7 +23046,7 @@ const _sfc_main$H = /* @__PURE__ */ defineComponent({
22941
23046
  return handleNavigation(e2, (_a = breadcrumb == null ? void 0 : breadcrumb.link) != null ? _a : "");
22942
23047
  }
22943
23048
  }, toDisplayString(getLabel(breadcrumb.label)), 9, _hoisted_2$s)) : (openBlock(), createElementBlock("span", _hoisted_3$m, toDisplayString(getLabel(breadcrumb.label)), 1)),
22944
- index < breadcrumbsValue.value.length - 1 ? (openBlock(), createElementBlock("span", _hoisted_4$f, " / ")) : createCommentVNode("", true)
23049
+ index < breadcrumbsValue.value.length - 1 ? (openBlock(), createElementBlock("span", _hoisted_4$g, " / ")) : createCommentVNode("", true)
22945
23050
  ]);
22946
23051
  }), 128))
22947
23052
  ]);
@@ -23047,7 +23152,7 @@ const _hoisted_2$r = {
23047
23152
  class: "lupa-page-number-separator"
23048
23153
  };
23049
23154
  const _hoisted_3$l = ["onClick"];
23050
- const _hoisted_4$e = {
23155
+ const _hoisted_4$f = {
23051
23156
  key: 0,
23052
23157
  class: "lupa-page-number-separator"
23053
23158
  };
@@ -23153,7 +23258,7 @@ const _sfc_main$D = /* @__PURE__ */ defineComponent({
23153
23258
  }, toDisplayString(page), 11, _hoisted_3$l);
23154
23259
  }), 128)),
23155
23260
  showLastPage.value ? (openBlock(), createElementBlock(Fragment, { key: 2 }, [
23156
- showLastPageSeparator.value ? (openBlock(), createElementBlock("div", _hoisted_4$e, "...")) : createCommentVNode("", true),
23261
+ showLastPageSeparator.value ? (openBlock(), createElementBlock("div", _hoisted_4$f, "...")) : createCommentVNode("", true),
23157
23262
  createBaseVNode("div", {
23158
23263
  class: "lupa-page-number lupa-page-number-last",
23159
23264
  onClick: _cache[2] || (_cache[2] = () => {
@@ -23178,7 +23283,7 @@ const _hoisted_1$x = {
23178
23283
  };
23179
23284
  const _hoisted_2$q = { id: "lupa-select" };
23180
23285
  const _hoisted_3$k = { class: "lupa-select-label" };
23181
- const _hoisted_4$d = ["aria-label"];
23286
+ const _hoisted_4$e = ["aria-label"];
23182
23287
  const _hoisted_5$9 = ["value"];
23183
23288
  const _sfc_main$C = /* @__PURE__ */ defineComponent({
23184
23289
  __name: "SearchResultsPageSize",
@@ -23225,7 +23330,7 @@ const _sfc_main$C = /* @__PURE__ */ defineComponent({
23225
23330
  value: option
23226
23331
  }, toDisplayString(prefixLabel.value) + toDisplayString(option), 9, _hoisted_5$9);
23227
23332
  }), 128))
23228
- ], 40, _hoisted_4$d)
23333
+ ], 40, _hoisted_4$e)
23229
23334
  ])
23230
23335
  ]);
23231
23336
  };
@@ -23237,7 +23342,7 @@ const _hoisted_1$w = {
23237
23342
  };
23238
23343
  const _hoisted_2$p = { id: "lupa-select" };
23239
23344
  const _hoisted_3$j = { class: "lupa-select-label" };
23240
- const _hoisted_4$c = ["aria-label"];
23345
+ const _hoisted_4$d = ["aria-label"];
23241
23346
  const _hoisted_5$8 = ["value"];
23242
23347
  const _sfc_main$B = /* @__PURE__ */ defineComponent({
23243
23348
  __name: "SearchResultsSort",
@@ -23305,7 +23410,7 @@ const _sfc_main$B = /* @__PURE__ */ defineComponent({
23305
23410
  value: option.key
23306
23411
  }, toDisplayString(option.label), 9, _hoisted_5$8);
23307
23412
  }), 128))
23308
- ], 40, _hoisted_4$c), [
23413
+ ], 40, _hoisted_4$d), [
23309
23414
  [vModelSelect, selectedKey.value]
23310
23415
  ])
23311
23416
  ])
@@ -23319,7 +23424,7 @@ const _hoisted_2$o = {
23319
23424
  class: "lupa-toolbar-right-title"
23320
23425
  };
23321
23426
  const _hoisted_3$i = { key: 2 };
23322
- const _hoisted_4$b = { key: 4 };
23427
+ const _hoisted_4$c = { key: 4 };
23323
23428
  const _hoisted_5$7 = { key: 6 };
23324
23429
  const _hoisted_6$5 = { class: "lupa-toolbar-right" };
23325
23430
  const _hoisted_7$3 = {
@@ -23443,7 +23548,7 @@ const _sfc_main$A = /* @__PURE__ */ defineComponent({
23443
23548
  label: searchSummaryLabel.value,
23444
23549
  clearable: unref(hasAnyFilter) && showFilterClear.value,
23445
23550
  onClear: handleClearAll
23446
- }, null, 8, ["label", "clearable"])) : (openBlock(), createElementBlock("div", _hoisted_4$b)),
23551
+ }, null, 8, ["label", "clearable"])) : (openBlock(), createElementBlock("div", _hoisted_4$c)),
23447
23552
  displayPageSelect.value ? (openBlock(), createBlock(_sfc_main$D, {
23448
23553
  key: 5,
23449
23554
  options: paginationOptions.value.pageSelect,
@@ -23492,7 +23597,7 @@ const _sfc_main$z = /* @__PURE__ */ defineComponent({
23492
23597
  const _hoisted_1$u = ["title", "innerHTML"];
23493
23598
  const _hoisted_2$n = ["title"];
23494
23599
  const _hoisted_3$h = ["href", "innerHTML"];
23495
- const _hoisted_4$a = ["title"];
23600
+ const _hoisted_4$b = ["title"];
23496
23601
  const _hoisted_5$6 = {
23497
23602
  key: 0,
23498
23603
  class: "lupa-search-results-product-title-text"
@@ -23560,7 +23665,7 @@ const _sfc_main$y = /* @__PURE__ */ defineComponent({
23560
23665
  class: "lupa-search-results-product-title-text lupa-title-link",
23561
23666
  onClick: handleNavigation
23562
23667
  }, toDisplayString(title.value), 9, _hoisted_6$4)) : createCommentVNode("", true)
23563
- ], 12, _hoisted_4$a));
23668
+ ], 12, _hoisted_4$b));
23564
23669
  };
23565
23670
  }
23566
23671
  });
@@ -23603,7 +23708,7 @@ const _sfc_main$x = /* @__PURE__ */ defineComponent({
23603
23708
  const _hoisted_1$s = { id: "lupa-search-results-rating" };
23604
23709
  const _hoisted_2$m = { class: "lupa-ratings" };
23605
23710
  const _hoisted_3$g = { class: "lupa-ratings-base" };
23606
- const _hoisted_4$9 = ["innerHTML"];
23711
+ const _hoisted_4$a = ["innerHTML"];
23607
23712
  const _hoisted_5$5 = { class: "lupa-rating-wrapper" };
23608
23713
  const _hoisted_6$3 = ["innerHTML"];
23609
23714
  const _hoisted_7$2 = ["href"];
@@ -23653,7 +23758,7 @@ const _sfc_main$w = /* @__PURE__ */ defineComponent({
23653
23758
  key: index,
23654
23759
  innerHTML: star,
23655
23760
  class: "lupa-rating lupa-rating-not-highlighted"
23656
- }, null, 8, _hoisted_4$9);
23761
+ }, null, 8, _hoisted_4$a);
23657
23762
  }), 128))
23658
23763
  ]),
23659
23764
  createBaseVNode("div", _hoisted_5$5, [
@@ -23793,7 +23898,7 @@ const _sfc_main$t = /* @__PURE__ */ defineComponent({
23793
23898
  const _hoisted_1$p = ["innerHTML"];
23794
23899
  const _hoisted_2$k = { key: 0 };
23795
23900
  const _hoisted_3$e = { key: 1 };
23796
- const _hoisted_4$8 = { class: "lupa-search-box-custom-label" };
23901
+ const _hoisted_4$9 = { class: "lupa-search-box-custom-label" };
23797
23902
  const _hoisted_5$4 = { class: "lupa-search-box-custom-text" };
23798
23903
  const _sfc_main$s = /* @__PURE__ */ defineComponent({
23799
23904
  __name: "SearchResultsProductCustom",
@@ -23838,7 +23943,7 @@ const _sfc_main$s = /* @__PURE__ */ defineComponent({
23838
23943
  class: className.value
23839
23944
  }, toHandlers(_ctx.options.action ? { click: handleClick } : {}, true)), [
23840
23945
  !label.value ? (openBlock(), createElementBlock("div", _hoisted_2$k, toDisplayString(text.value), 1)) : (openBlock(), createElementBlock("div", _hoisted_3$e, [
23841
- createBaseVNode("div", _hoisted_4$8, toDisplayString(label.value), 1),
23946
+ createBaseVNode("div", _hoisted_4$9, toDisplayString(label.value), 1),
23842
23947
  createBaseVNode("div", _hoisted_5$4, toDisplayString(text.value), 1)
23843
23948
  ]))
23844
23949
  ], 16));
@@ -23884,7 +23989,7 @@ const _sfc_main$r = /* @__PURE__ */ defineComponent({
23884
23989
  const _hoisted_1$n = { id: "lupa-search-results-rating" };
23885
23990
  const _hoisted_2$j = ["innerHTML"];
23886
23991
  const _hoisted_3$d = { class: "lupa-ratings" };
23887
- const _hoisted_4$7 = ["href"];
23992
+ const _hoisted_4$8 = ["href"];
23888
23993
  const _sfc_main$q = /* @__PURE__ */ defineComponent({
23889
23994
  __name: "SearchResultsProductSingleStarRating",
23890
23995
  props: {
@@ -23922,7 +24027,7 @@ const _sfc_main$q = /* @__PURE__ */ defineComponent({
23922
24027
  createBaseVNode("a", {
23923
24028
  href: ratingLink.value,
23924
24029
  class: "lupa-total-ratings"
23925
- }, toDisplayString(totalRatings.value), 9, _hoisted_4$7)
24030
+ }, toDisplayString(totalRatings.value), 9, _hoisted_4$8)
23926
24031
  ]);
23927
24032
  };
23928
24033
  }
@@ -24017,12 +24122,13 @@ const _sfc_main$p = /* @__PURE__ */ defineComponent(__spreadProps2(__spreadValue
24017
24122
  };
24018
24123
  }
24019
24124
  }));
24020
- const _hoisted_1$m = ["href"];
24021
- const _hoisted_2$i = {
24125
+ const _hoisted_1$m = ["onMouseup"];
24126
+ const _hoisted_2$i = ["href"];
24127
+ const _hoisted_3$c = {
24022
24128
  key: 0,
24023
24129
  class: "lupa-out-of-stock"
24024
24130
  };
24025
- const _hoisted_3$c = { class: "lupa-search-result-product-details-section" };
24131
+ const _hoisted_4$7 = { class: "lupa-search-result-product-details-section" };
24026
24132
  const _sfc_main$o = /* @__PURE__ */ defineComponent({
24027
24133
  __name: "SearchResultsProductCard",
24028
24134
  props: {
@@ -24126,7 +24232,7 @@ const _sfc_main$o = /* @__PURE__ */ defineComponent({
24126
24232
  });
24127
24233
  const handleClick = () => {
24128
24234
  var _a, _b, _c, _d;
24129
- trackingStore.trackEvent({
24235
+ const event = {
24130
24236
  queryKey: props.options.queryKey,
24131
24237
  data: {
24132
24238
  itemId: id.value,
@@ -24139,9 +24245,15 @@ const _sfc_main$o = /* @__PURE__ */ defineComponent({
24139
24245
  items: [props.product],
24140
24246
  itemId: id.value
24141
24247
  },
24142
- options: { allowEmptySearchQuery: true }
24248
+ options: { allowEmptySearchQuery: true },
24249
+ filters: searchResultStore.hasAnyFilter ? searchResultStore.filters : void 0
24143
24250
  }
24144
- });
24251
+ };
24252
+ if (isDelayedClickTracking()) {
24253
+ trackingStore.trackDelayedEvent(__spreadProps2(__spreadValues2({}, event), { url: link.value }));
24254
+ } else {
24255
+ trackingStore.trackEvent(event);
24256
+ }
24145
24257
  (_d = (_c = searchResultOptions.value.callbacks) == null ? void 0 : _c.onProductClick) == null ? void 0 : _d.call(_c, {
24146
24258
  queryKey: query.value,
24147
24259
  hasResults: true,
@@ -24174,7 +24286,10 @@ const _sfc_main$o = /* @__PURE__ */ defineComponent({
24174
24286
  id: "lupa-search-result-product-card",
24175
24287
  "data-cy": "lupa-search-result-product-card",
24176
24288
  class: ["lupa-search-result-product-card", !isInStock.value ? "lupa-out-of-stock" : ""]
24177
- }, customDocumentHtmlAttributes.value, { onClick: handleClick }), [
24289
+ }, customDocumentHtmlAttributes.value, {
24290
+ onClick: handleClick,
24291
+ onMouseup: withModifiers(handleClick, ["middle", "exact"])
24292
+ }), [
24178
24293
  createVNode(_sfc_main$14, { options: badgesOptions.value }, null, 8, ["options"]),
24179
24294
  createBaseVNode("div", {
24180
24295
  class: normalizeClass(["lupa-search-result-product-contents", listLayoutClass.value])
@@ -24201,9 +24316,9 @@ const _sfc_main$o = /* @__PURE__ */ defineComponent({
24201
24316
  position: "image",
24202
24317
  class: "lupa-image-badges"
24203
24318
  }, null, 8, ["options"]),
24204
- ((_a = labels.value) == null ? void 0 : _a.outOfStock) && !isInStock.value ? (openBlock(), createElementBlock("div", _hoisted_2$i, toDisplayString(labels.value.outOfStock), 1)) : createCommentVNode("", true)
24205
- ], 8, _hoisted_1$m),
24206
- createBaseVNode("div", _hoisted_3$c, [
24319
+ ((_a = labels.value) == null ? void 0 : _a.outOfStock) && !isInStock.value ? (openBlock(), createElementBlock("div", _hoisted_3$c, toDisplayString(labels.value.outOfStock), 1)) : createCommentVNode("", true)
24320
+ ], 8, _hoisted_2$i),
24321
+ createBaseVNode("div", _hoisted_4$7, [
24207
24322
  (openBlock(true), createElementBlock(Fragment, null, renderList(detailElements.value, (element) => {
24208
24323
  return openBlock(), createBlock(_sfc_main$p, {
24209
24324
  class: "lupa-search-results-product-element",
@@ -24237,7 +24352,7 @@ const _sfc_main$o = /* @__PURE__ */ defineComponent({
24237
24352
  ], 2);
24238
24353
  }), 128))
24239
24354
  ], 2)
24240
- ], 16);
24355
+ ], 16, _hoisted_1$m);
24241
24356
  };
24242
24357
  }
24243
24358
  });
@@ -24375,6 +24490,7 @@ const _sfc_main$m = /* @__PURE__ */ defineComponent({
24375
24490
  });
24376
24491
  };
24377
24492
  const handleQueryChange = () => {
24493
+ showAll.value = false;
24378
24494
  const context = getLupaTrackingContext();
24379
24495
  const queryBody = __spreadProps2(__spreadValues2({}, context), {
24380
24496
  limit: props.panel.totalCountLimit,
@@ -24609,7 +24725,6 @@ const _sfc_main$i = /* @__PURE__ */ defineComponent({
24609
24725
  watch(
24610
24726
  () => props.query,
24611
24727
  () => {
24612
- console.log("query changed", props.query);
24613
24728
  searchForRelatedQuery();
24614
24729
  }
24615
24730
  );