@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.
@@ -6806,6 +6806,8 @@ var __async = (__this, __arguments, generator) => {
6806
6806
  const TRACKING_STORAGE_KEY = "LUPA_STATS";
6807
6807
  const TRACKING_STORAGE_KEY_BASE = "LUPA_STATS_BASE";
6808
6808
  const TRACKING_ANALYTICS_KEY = "LUPA_ANALYTICS";
6809
+ const TRACKING_CLICK_DELAYED = "LUPA_TRACKING_CLICK_DELAYED";
6810
+ const DELAYED_TRACKING_EVENTS_CACHE = "LUPA_DELAYED_TRACKING_EVENTS";
6809
6811
  const TRACKING_KEY_LENGTH = 10;
6810
6812
  const HISTORY_MAX_ITEMS = 7;
6811
6813
  const S_MIN_WIDTH = 575;
@@ -7026,6 +7028,14 @@ var __async = (__this, __arguments, generator) => {
7026
7028
  const transformedStr = typeof str === "string" ? str : str.toString();
7027
7029
  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();
7028
7030
  };
7031
+ const getTransformedString = (str) => {
7032
+ var _a, _b;
7033
+ if (!str) {
7034
+ return "";
7035
+ }
7036
+ const transformedStr = typeof str === "string" ? str : str.toString();
7037
+ return transformedStr.normalize === void 0 ? (_a = transformedStr.toLocaleLowerCase()) == null ? void 0 : _a.trim() : (_b = transformedStr.toLocaleLowerCase().normalize("NFKD")) == null ? void 0 : _b.trim();
7038
+ };
7029
7039
  const capitalize$1 = (str) => {
7030
7040
  if (!str) {
7031
7041
  return "";
@@ -7099,8 +7109,8 @@ var __async = (__this, __arguments, generator) => {
7099
7109
  if (!input2) {
7100
7110
  return false;
7101
7111
  }
7102
- const normalizedInput = getNormalizedString(input2);
7103
- return possibleValues.some((v) => getNormalizedString(v) === normalizedInput);
7112
+ const normalizedInput = getTransformedString(input2);
7113
+ return possibleValues.some((v) => getTransformedString(v) === normalizedInput);
7104
7114
  };
7105
7115
  const levenshteinDistance = (s = "", t = "") => {
7106
7116
  if (!(s == null ? void 0 : s.length)) {
@@ -7133,225 +7143,6 @@ var __async = (__this, __arguments, generator) => {
7133
7143
  const closestValue = (_a = possibleValues.filter((_, i) => distances[i] === minDistance)) == null ? void 0 : _a[0];
7134
7144
  return closestValue;
7135
7145
  };
7136
- const initAnalyticsTracking = (analyticsOptions) => {
7137
- try {
7138
- if (analyticsOptions == null ? void 0 : analyticsOptions.enabled) {
7139
- window.sessionStorage.setItem(TRACKING_ANALYTICS_KEY, JSON.stringify(analyticsOptions));
7140
- } else {
7141
- window.sessionStorage.removeItem(TRACKING_ANALYTICS_KEY);
7142
- }
7143
- } catch (e2) {
7144
- }
7145
- };
7146
- const initBaseTracking = (enabled) => {
7147
- try {
7148
- if (enabled) {
7149
- window.sessionStorage.setItem(TRACKING_STORAGE_KEY_BASE, "1");
7150
- } else {
7151
- window.sessionStorage.removeItem(TRACKING_STORAGE_KEY_BASE);
7152
- clearSessionTracking();
7153
- clearUserTracking();
7154
- }
7155
- } catch (e2) {
7156
- }
7157
- };
7158
- const clearSessionTracking = () => {
7159
- try {
7160
- window.sessionStorage.removeItem(TRACKING_STORAGE_KEY);
7161
- } catch (e2) {
7162
- }
7163
- };
7164
- const initSessionTracking = () => {
7165
- try {
7166
- if (getSessionKey()) {
7167
- return;
7168
- }
7169
- const key = getRandomString(TRACKING_KEY_LENGTH);
7170
- window.sessionStorage.setItem(TRACKING_STORAGE_KEY, key);
7171
- } catch (e2) {
7172
- }
7173
- };
7174
- const initUserTracking = (userKey) => {
7175
- try {
7176
- if (getUserKey()) {
7177
- return;
7178
- }
7179
- const key = userKey || getRandomString(TRACKING_KEY_LENGTH);
7180
- window.localStorage.setItem(TRACKING_STORAGE_KEY, key);
7181
- } catch (e2) {
7182
- }
7183
- };
7184
- const clearUserTracking = () => {
7185
- try {
7186
- window.localStorage.removeItem(TRACKING_STORAGE_KEY);
7187
- } catch (e2) {
7188
- }
7189
- };
7190
- const isTrackingEnabled = () => {
7191
- try {
7192
- return Boolean(window.sessionStorage.getItem(TRACKING_STORAGE_KEY_BASE));
7193
- } catch (e2) {
7194
- return false;
7195
- }
7196
- };
7197
- const getSessionKey = () => {
7198
- var _a;
7199
- try {
7200
- return (_a = window.sessionStorage.getItem(TRACKING_STORAGE_KEY)) != null ? _a : void 0;
7201
- } catch (e2) {
7202
- return void 0;
7203
- }
7204
- };
7205
- const getUserKey = () => {
7206
- var _a;
7207
- try {
7208
- return (_a = window.localStorage.getItem(TRACKING_STORAGE_KEY)) != null ? _a : void 0;
7209
- } catch (e2) {
7210
- return void 0;
7211
- }
7212
- };
7213
- const initTracking = (options) => {
7214
- initBaseTracking(Boolean(options.trackBase));
7215
- if (options.trackSession) {
7216
- initSessionTracking();
7217
- } else {
7218
- clearSessionTracking();
7219
- }
7220
- if (options.trackUser) {
7221
- initUserTracking(options.userKey);
7222
- } else {
7223
- clearUserTracking();
7224
- }
7225
- if (options.analytics) {
7226
- initAnalyticsTracking(options.analytics);
7227
- }
7228
- };
7229
- const getLupaTrackingContext = () => {
7230
- if (!isTrackingEnabled()) {
7231
- return {};
7232
- }
7233
- return {
7234
- userId: getUserKey(),
7235
- sessionId: getSessionKey()
7236
- };
7237
- };
7238
- const trackLupaEvent = (queryKey, data = {}, options) => {
7239
- var _a, _b;
7240
- if (!queryKey || !data.type) {
7241
- return;
7242
- }
7243
- const eventData = {
7244
- searchQuery: (_a = data.searchQuery) != null ? _a : "",
7245
- itemId: (_b = data.itemId) != null ? _b : "",
7246
- name: data.type,
7247
- userId: getUserKey(),
7248
- sessionId: getSessionKey(),
7249
- filters: data.filters
7250
- };
7251
- LupaSearchSdk.track(queryKey, eventData, options);
7252
- };
7253
- const sendGa = (name, ...args) => {
7254
- window.ga(() => {
7255
- const trackers = window.ga.getAll();
7256
- const firstTracker = trackers[0];
7257
- if (!firstTracker) {
7258
- console.error("GA tracker not found");
7259
- }
7260
- const trackerName = firstTracker.get("name");
7261
- window.ga(`${trackerName}.${name}`, ...args);
7262
- });
7263
- };
7264
- const trackAnalyticsEvent = (data) => {
7265
- var _a, _b, _c;
7266
- try {
7267
- const options = JSON.parse(
7268
- (_a = window.sessionStorage.getItem(TRACKING_ANALYTICS_KEY)) != null ? _a : "{}"
7269
- );
7270
- if (!data.analytics || !options.enabled || ((_c = options.ignoreEvents) == null ? void 0 : _c.includes((_b = data.analytics) == null ? void 0 : _b.type))) {
7271
- return;
7272
- }
7273
- switch (options.type) {
7274
- case "ua":
7275
- sendUaAnalyticsEvent(data, options);
7276
- break;
7277
- case "ga4":
7278
- sendGa4AnalyticsEvent(data, options);
7279
- break;
7280
- case "debug":
7281
- processDebugEvent(data);
7282
- break;
7283
- default:
7284
- sendUaAnalyticsEvent(data, options);
7285
- }
7286
- } catch (e2) {
7287
- console.error("Unable to send an event to google analytics");
7288
- }
7289
- };
7290
- const parseEcommerceData = (data, title) => {
7291
- var _a, _b;
7292
- return ((_a = data.analytics) == null ? void 0 : _a.items) ? {
7293
- item_list_name: title,
7294
- items: (_b = data.analytics) == null ? void 0 : _b.items
7295
- } : void 0;
7296
- };
7297
- const sendUaAnalyticsEvent = (data, options) => {
7298
- var _a, _b, _c, _d;
7299
- const ga = window.ga;
7300
- if (!ga) {
7301
- console.error("Google Analytics object not found");
7302
- return;
7303
- }
7304
- sendGa(
7305
- "send",
7306
- "event",
7307
- options.parentEventName,
7308
- (_b = (_a = data.analytics) == null ? void 0 : _a.type) != null ? _b : "",
7309
- (_d = (_c = data.analytics) == null ? void 0 : _c.label) != null ? _d : ""
7310
- );
7311
- };
7312
- const sendGa4AnalyticsEvent = (data, options) => {
7313
- var _a, _b, _c, _d, _e, _f, _g;
7314
- if (!window || !window.dataLayer) {
7315
- console.error("dataLayer object not found.");
7316
- return;
7317
- }
7318
- const sendItemTitle = data.searchQuery !== ((_a = data.analytics) == null ? void 0 : _a.label);
7319
- const title = sendItemTitle ? (_b = data.analytics) == null ? void 0 : _b.label : void 0;
7320
- const params = __spreadValues2({
7321
- search_text: data.searchQuery,
7322
- item_title: title,
7323
- item_id: data.itemId,
7324
- ecommerce: parseEcommerceData(data, (_c = data.analytics) == null ? void 0 : _c.listLabel)
7325
- }, (_e = (_d = data.analytics) == null ? void 0 : _d.additionalParams) != null ? _e : {});
7326
- window.dataLayer.push(__spreadValues2({
7327
- event: (_g = (_f = data.analytics) == null ? void 0 : _f.type) != null ? _g : options.parentEventName
7328
- }, params));
7329
- };
7330
- const processDebugEvent = (data) => {
7331
- var _a, _b, _c, _d;
7332
- const sendItemTitle = data.searchQuery !== ((_a = data.analytics) == null ? void 0 : _a.label);
7333
- const title = sendItemTitle ? (_b = data.analytics) == null ? void 0 : _b.label : void 0;
7334
- const params = {
7335
- event: (_c = data.analytics) == null ? void 0 : _c.type,
7336
- search_text: data.searchQuery,
7337
- item_title: title,
7338
- item_id: data.itemId,
7339
- ecommerce: parseEcommerceData(data, (_d = data.analytics) == null ? void 0 : _d.listLabel)
7340
- };
7341
- console.debug("Analytics debug event:", params);
7342
- };
7343
- const track = (queryKey, data = {}, options) => {
7344
- var _a;
7345
- if (!isTrackingEnabled()) {
7346
- return;
7347
- }
7348
- const hasSearchQuery = data.searchQuery;
7349
- if (!hasSearchQuery && !((_a = data.options) == null ? void 0 : _a.allowEmptySearchQuery)) {
7350
- return;
7351
- }
7352
- trackAnalyticsEvent(data);
7353
- trackLupaEvent(queryKey, data, options);
7354
- };
7355
7146
  const DEFAULT_SEARCH_BOX_OPTIONS$1 = {
7356
7147
  inputSelector: "#searchBox",
7357
7148
  options: {
@@ -7633,6 +7424,266 @@ var __async = (__this, __arguments, generator) => {
7633
7424
  getQueryParamName
7634
7425
  };
7635
7426
  });
7427
+ const initAnalyticsTracking = (analyticsOptions) => {
7428
+ try {
7429
+ if (analyticsOptions == null ? void 0 : analyticsOptions.enabled) {
7430
+ window.sessionStorage.setItem(TRACKING_ANALYTICS_KEY, JSON.stringify(analyticsOptions));
7431
+ } else {
7432
+ window.sessionStorage.removeItem(TRACKING_ANALYTICS_KEY);
7433
+ }
7434
+ } catch (e2) {
7435
+ }
7436
+ };
7437
+ const initBaseTracking = (enabled) => {
7438
+ try {
7439
+ if (enabled) {
7440
+ window.sessionStorage.setItem(TRACKING_STORAGE_KEY_BASE, "1");
7441
+ } else {
7442
+ window.sessionStorage.removeItem(TRACKING_STORAGE_KEY_BASE);
7443
+ clearSessionTracking();
7444
+ clearUserTracking();
7445
+ }
7446
+ } catch (e2) {
7447
+ }
7448
+ };
7449
+ const clearSessionTracking = () => {
7450
+ try {
7451
+ window.sessionStorage.removeItem(TRACKING_STORAGE_KEY);
7452
+ } catch (e2) {
7453
+ }
7454
+ };
7455
+ const initSessionTracking = () => {
7456
+ try {
7457
+ if (getSessionKey()) {
7458
+ return;
7459
+ }
7460
+ const key = getRandomString(TRACKING_KEY_LENGTH);
7461
+ window.sessionStorage.setItem(TRACKING_STORAGE_KEY, key);
7462
+ } catch (e2) {
7463
+ }
7464
+ };
7465
+ const initUserTracking = (userKey) => {
7466
+ try {
7467
+ if (getUserKey()) {
7468
+ return;
7469
+ }
7470
+ const key = userKey || getRandomString(TRACKING_KEY_LENGTH);
7471
+ window.localStorage.setItem(TRACKING_STORAGE_KEY, key);
7472
+ } catch (e2) {
7473
+ }
7474
+ };
7475
+ const clearUserTracking = () => {
7476
+ try {
7477
+ window.localStorage.removeItem(TRACKING_STORAGE_KEY);
7478
+ } catch (e2) {
7479
+ }
7480
+ };
7481
+ const isTrackingEnabled = () => {
7482
+ try {
7483
+ return Boolean(window.sessionStorage.getItem(TRACKING_STORAGE_KEY_BASE));
7484
+ } catch (e2) {
7485
+ return false;
7486
+ }
7487
+ };
7488
+ const isDelayedClickTracking = () => {
7489
+ try {
7490
+ return Boolean(window.localStorage.getItem(TRACKING_CLICK_DELAYED));
7491
+ } catch (e2) {
7492
+ return false;
7493
+ }
7494
+ };
7495
+ const getSessionKey = () => {
7496
+ var _a;
7497
+ try {
7498
+ return (_a = window.sessionStorage.getItem(TRACKING_STORAGE_KEY)) != null ? _a : void 0;
7499
+ } catch (e2) {
7500
+ return void 0;
7501
+ }
7502
+ };
7503
+ const getUserKey = () => {
7504
+ var _a;
7505
+ try {
7506
+ return (_a = window.localStorage.getItem(TRACKING_STORAGE_KEY)) != null ? _a : void 0;
7507
+ } catch (e2) {
7508
+ return void 0;
7509
+ }
7510
+ };
7511
+ const initTracking = (options) => {
7512
+ initBaseTracking(Boolean(options.trackBase));
7513
+ if (options.trackSession) {
7514
+ initSessionTracking();
7515
+ } else {
7516
+ clearSessionTracking();
7517
+ }
7518
+ if (options.trackUser) {
7519
+ initUserTracking(options.userKey);
7520
+ } else {
7521
+ clearUserTracking();
7522
+ }
7523
+ if (options.analytics) {
7524
+ initAnalyticsTracking(options.analytics);
7525
+ }
7526
+ if (options.delayedClickTracking) {
7527
+ window.localStorage.setItem(TRACKING_CLICK_DELAYED, "1");
7528
+ checkAndDispatchDelayedEvents();
7529
+ } else {
7530
+ window.localStorage.removeItem(TRACKING_CLICK_DELAYED);
7531
+ }
7532
+ };
7533
+ const getLupaTrackingContext = () => {
7534
+ if (!isTrackingEnabled()) {
7535
+ return {};
7536
+ }
7537
+ return {
7538
+ userId: getUserKey(),
7539
+ sessionId: getSessionKey()
7540
+ };
7541
+ };
7542
+ const trackLupaEvent = (queryKey, data = {}, options) => {
7543
+ var _a, _b;
7544
+ if (!queryKey || !data.type) {
7545
+ return;
7546
+ }
7547
+ const eventData = {
7548
+ searchQuery: (_a = data.searchQuery) != null ? _a : "",
7549
+ itemId: (_b = data.itemId) != null ? _b : "",
7550
+ name: data.type,
7551
+ userId: getUserKey(),
7552
+ sessionId: getSessionKey(),
7553
+ filters: data.filters
7554
+ };
7555
+ LupaSearchSdk.track(queryKey, eventData, options);
7556
+ };
7557
+ const sendGa = (name, ...args) => {
7558
+ window.ga(() => {
7559
+ const trackers = window.ga.getAll();
7560
+ const firstTracker = trackers[0];
7561
+ if (!firstTracker) {
7562
+ console.error("GA tracker not found");
7563
+ }
7564
+ const trackerName = firstTracker.get("name");
7565
+ window.ga(`${trackerName}.${name}`, ...args);
7566
+ });
7567
+ };
7568
+ const trackAnalyticsEvent = (data) => {
7569
+ var _a, _b, _c;
7570
+ try {
7571
+ const options = JSON.parse(
7572
+ (_a = window.sessionStorage.getItem(TRACKING_ANALYTICS_KEY)) != null ? _a : "{}"
7573
+ );
7574
+ if (!data.analytics || !options.enabled || ((_c = options.ignoreEvents) == null ? void 0 : _c.includes((_b = data.analytics) == null ? void 0 : _b.type))) {
7575
+ return;
7576
+ }
7577
+ switch (options.type) {
7578
+ case "ua":
7579
+ sendUaAnalyticsEvent(data, options);
7580
+ break;
7581
+ case "ga4":
7582
+ sendGa4AnalyticsEvent(data, options);
7583
+ break;
7584
+ case "debug":
7585
+ processDebugEvent(data);
7586
+ break;
7587
+ default:
7588
+ sendUaAnalyticsEvent(data, options);
7589
+ }
7590
+ } catch (e2) {
7591
+ console.error("Unable to send an event to google analytics");
7592
+ }
7593
+ };
7594
+ const parseEcommerceData = (data, title) => {
7595
+ var _a, _b;
7596
+ return ((_a = data.analytics) == null ? void 0 : _a.items) ? {
7597
+ item_list_name: title,
7598
+ items: (_b = data.analytics) == null ? void 0 : _b.items
7599
+ } : void 0;
7600
+ };
7601
+ const sendUaAnalyticsEvent = (data, options) => {
7602
+ var _a, _b, _c, _d;
7603
+ const ga = window.ga;
7604
+ if (!ga) {
7605
+ console.error("Google Analytics object not found");
7606
+ return;
7607
+ }
7608
+ sendGa(
7609
+ "send",
7610
+ "event",
7611
+ options.parentEventName,
7612
+ (_b = (_a = data.analytics) == null ? void 0 : _a.type) != null ? _b : "",
7613
+ (_d = (_c = data.analytics) == null ? void 0 : _c.label) != null ? _d : ""
7614
+ );
7615
+ };
7616
+ const sendGa4AnalyticsEvent = (data, options) => {
7617
+ var _a, _b, _c, _d, _e, _f, _g;
7618
+ if (!window || !window.dataLayer) {
7619
+ console.error("dataLayer object not found.");
7620
+ return;
7621
+ }
7622
+ const sendItemTitle = data.searchQuery !== ((_a = data.analytics) == null ? void 0 : _a.label);
7623
+ const title = sendItemTitle ? (_b = data.analytics) == null ? void 0 : _b.label : void 0;
7624
+ const params = __spreadValues2({
7625
+ search_text: data.searchQuery,
7626
+ item_title: title,
7627
+ item_id: data.itemId,
7628
+ ecommerce: parseEcommerceData(data, (_c = data.analytics) == null ? void 0 : _c.listLabel)
7629
+ }, (_e = (_d = data.analytics) == null ? void 0 : _d.additionalParams) != null ? _e : {});
7630
+ window.dataLayer.push(__spreadValues2({
7631
+ event: (_g = (_f = data.analytics) == null ? void 0 : _f.type) != null ? _g : options.parentEventName
7632
+ }, params));
7633
+ };
7634
+ const processDebugEvent = (data) => {
7635
+ var _a, _b, _c, _d;
7636
+ const sendItemTitle = data.searchQuery !== ((_a = data.analytics) == null ? void 0 : _a.label);
7637
+ const title = sendItemTitle ? (_b = data.analytics) == null ? void 0 : _b.label : void 0;
7638
+ const params = {
7639
+ event: (_c = data.analytics) == null ? void 0 : _c.type,
7640
+ search_text: data.searchQuery,
7641
+ item_title: title,
7642
+ item_id: data.itemId,
7643
+ ecommerce: parseEcommerceData(data, (_d = data.analytics) == null ? void 0 : _d.listLabel)
7644
+ };
7645
+ console.debug("Analytics debug event:", params);
7646
+ };
7647
+ const getDelayedEventsCache = () => {
7648
+ var _a;
7649
+ try {
7650
+ return JSON.parse((_a = window.localStorage.getItem(DELAYED_TRACKING_EVENTS_CACHE)) != null ? _a : "{}");
7651
+ } catch (e2) {
7652
+ return {};
7653
+ }
7654
+ };
7655
+ const storeDelayedEventCache = (cache) => {
7656
+ try {
7657
+ window.localStorage.setItem(DELAYED_TRACKING_EVENTS_CACHE, JSON.stringify(cache));
7658
+ } catch (e2) {
7659
+ }
7660
+ };
7661
+ const checkAndDispatchDelayedEvents = () => {
7662
+ var _a, _b;
7663
+ const optionsStore = useOptionsStore();
7664
+ const eventCache = getDelayedEventsCache();
7665
+ const urls = Object.keys(eventCache);
7666
+ for (const url of urls) {
7667
+ if ((_a = window.location.href) == null ? void 0 : _a.includes(url)) {
7668
+ const options = (_b = optionsStore.envOptions) != null ? _b : { environment: "production" };
7669
+ const { queryKey, data } = eventCache[url];
7670
+ track(queryKey, data, options);
7671
+ }
7672
+ }
7673
+ storeDelayedEventCache({});
7674
+ };
7675
+ const track = (queryKey, data = {}, options) => {
7676
+ var _a;
7677
+ if (!isTrackingEnabled()) {
7678
+ return;
7679
+ }
7680
+ const hasSearchQuery = data.searchQuery;
7681
+ if (!hasSearchQuery && !((_a = data.options) == null ? void 0 : _a.allowEmptySearchQuery)) {
7682
+ return;
7683
+ }
7684
+ trackAnalyticsEvent(data);
7685
+ trackLupaEvent(queryKey, data, options);
7686
+ };
7636
7687
  var DocumentElementType = /* @__PURE__ */ ((DocumentElementType2) => {
7637
7688
  DocumentElementType2["IMAGE"] = "image";
7638
7689
  DocumentElementType2["TITLE"] = "title";
@@ -7864,7 +7915,10 @@ var __async = (__this, __arguments, generator) => {
7864
7915
  if (!inputValue) {
7865
7916
  return escapeHtml$1(suggestion);
7866
7917
  }
7867
- return (_a = suggestion == null ? void 0 : suggestion.replace(inputValue, `<strong>${escapeHtml$1(inputValue)}</strong>`)) != null ? _a : "";
7918
+ return (_a = suggestion == null ? void 0 : suggestion.replace(
7919
+ inputValue == null ? void 0 : inputValue.toLocaleLowerCase(),
7920
+ `<strong>${escapeHtml$1(inputValue == null ? void 0 : inputValue.toLocaleLowerCase())}</strong>`
7921
+ )) != null ? _a : "";
7868
7922
  };
7869
7923
  const reverseKeyValue = (obj) => {
7870
7924
  return Object.fromEntries(Object.entries(obj).map(([k, v]) => [v, k.toLowerCase()]));
@@ -8082,14 +8136,16 @@ var __async = (__this, __arguments, generator) => {
8082
8136
  paramsToRemove: [getQueryParamName ? getQueryParamName(QUERY_PARAMS$1.PAGE) : QUERY_PARAMS$1.PAGE]
8083
8137
  });
8084
8138
  };
8139
+ const replaceHierarchyParam = (params = [], param = "") => {
8140
+ if (params.some((p2) => p2.startsWith(param))) {
8141
+ return toggleLastPram(params, param);
8142
+ }
8143
+ return [param];
8144
+ };
8085
8145
  const toggleHierarchyFilter = (appendParams, facetAction, getQueryParamName, currentFilters, removeAllLevels = false) => {
8086
- var _a;
8146
+ var _a, _b;
8087
8147
  const currentFilter = currentFilters == null ? void 0 : currentFilters[facetAction.key];
8088
- const newParams = toggleHierarchyParam(
8089
- (_a = currentFilter == null ? void 0 : currentFilter.terms) != null ? _a : [],
8090
- facetAction.value,
8091
- removeAllLevels
8092
- );
8148
+ 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);
8093
8149
  appendParams({
8094
8150
  params: [getFacetParam(facetAction.key, newParams, FACET_PARAMS_TYPE.HIERARCHY)],
8095
8151
  paramsToRemove: [getQueryParamName ? getQueryParamName(QUERY_PARAMS$1.PAGE) : QUERY_PARAMS$1.PAGE]
@@ -8432,6 +8488,7 @@ var __async = (__this, __arguments, generator) => {
8432
8488
  const highlightedIndex = ref(-1);
8433
8489
  const inputValue = ref("");
8434
8490
  const resultInputValue = ref("");
8491
+ const latestRequestIdByQueryKey = {};
8435
8492
  const historyStore = useHistoryStore();
8436
8493
  const resultsVisible = computed(() => {
8437
8494
  var _a;
@@ -8498,12 +8555,17 @@ var __async = (__this, __arguments, generator) => {
8498
8555
  }) {
8499
8556
  var _a;
8500
8557
  try {
8558
+ const currentRequestId = Date.now();
8559
+ latestRequestIdByQueryKey[queryKey] = currentRequestId;
8501
8560
  const context = getLupaTrackingContext();
8502
8561
  const result2 = yield LupaSearchSdk.suggestions(
8503
8562
  queryKey,
8504
8563
  __spreadValues2(__spreadValues2({}, publicQuery), context),
8505
8564
  options2
8506
8565
  );
8566
+ if (latestRequestIdByQueryKey[queryKey] !== currentRequestId) {
8567
+ return { suggestions: void 0 };
8568
+ }
8507
8569
  if (!result2.success) {
8508
8570
  return { suggestions: void 0 };
8509
8571
  }
@@ -8544,8 +8606,13 @@ var __async = (__this, __arguments, generator) => {
8544
8606
  options: options2
8545
8607
  }) {
8546
8608
  try {
8609
+ const currentRequestId = Date.now();
8610
+ latestRequestIdByQueryKey[queryKey] = currentRequestId;
8547
8611
  const context = getLupaTrackingContext();
8548
8612
  const result2 = yield LupaSearchSdk.query(queryKey, __spreadValues2(__spreadValues2({}, publicQuery), context), options2);
8613
+ if (latestRequestIdByQueryKey[queryKey] !== currentRequestId) {
8614
+ return { suggestions: void 0 };
8615
+ }
8549
8616
  if (!result2.success) {
8550
8617
  return { queryKey, result: { items: [] } };
8551
8618
  }
@@ -8600,7 +8667,7 @@ var __async = (__this, __arguments, generator) => {
8600
8667
  const _hoisted_1$1g = { id: "lupa-search-box-input-container" };
8601
8668
  const _hoisted_2$U = { class: "lupa-input-clear" };
8602
8669
  const _hoisted_3$D = { id: "lupa-search-box-input" };
8603
- const _hoisted_4$s = ["value"];
8670
+ const _hoisted_4$t = ["value"];
8604
8671
  const _hoisted_5$j = ["aria-label", "placeholder"];
8605
8672
  const _hoisted_6$9 = /* @__PURE__ */ createBaseVNode("span", { class: "lupa-search-submit-icon" }, null, -1);
8606
8673
  const _hoisted_7$7 = [
@@ -8707,7 +8774,7 @@ var __async = (__this, __arguments, generator) => {
8707
8774
  "aria-hidden": "true",
8708
8775
  value: showHint.value ? suggestedValue.value.item.suggestion : "",
8709
8776
  disabled: ""
8710
- }, null, 8, _hoisted_4$s),
8777
+ }, null, 8, _hoisted_4$t),
8711
8778
  withDirectives(createBaseVNode("input", mergeProps({
8712
8779
  "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => inputValue.value = $event)
8713
8780
  }, inputAttributes.value, {
@@ -8919,7 +8986,7 @@ var __async = (__this, __arguments, generator) => {
8919
8986
  class: "lupa-suggestion-facet",
8920
8987
  "data-cy": "lupa-suggestion-facet"
8921
8988
  };
8922
- const _hoisted_4$r = {
8989
+ const _hoisted_4$s = {
8923
8990
  class: "lupa-suggestion-facet-label",
8924
8991
  "data-cy": "lupa-suggestion-facet-label"
8925
8992
  };
@@ -8965,7 +9032,7 @@ var __async = (__this, __arguments, generator) => {
8965
9032
  innerHTML: _ctx.suggestion.displayHighlight
8966
9033
  }, null, 8, _hoisted_1$1c)) : (openBlock(), createElementBlock("div", _hoisted_2$S, toDisplayString(_ctx.suggestion.display), 1)),
8967
9034
  _ctx.suggestion.facet ? (openBlock(), createElementBlock("div", _hoisted_3$C, [
8968
- createBaseVNode("span", _hoisted_4$r, toDisplayString(facetLabel.value), 1),
9035
+ createBaseVNode("span", _hoisted_4$s, toDisplayString(facetLabel.value), 1),
8969
9036
  createBaseVNode("span", _hoisted_5$i, toDisplayString(_ctx.suggestion.facet.title), 1)
8970
9037
  ])) : createCommentVNode("", true)
8971
9038
  ]);
@@ -18481,7 +18548,7 @@ and ensure you are accounting for this risk.
18481
18548
  const _hoisted_1$16 = ["innerHTML"];
18482
18549
  const _hoisted_2$O = { key: 0 };
18483
18550
  const _hoisted_3$B = { key: 1 };
18484
- const _hoisted_4$q = { class: "lupa-search-box-custom-label" };
18551
+ const _hoisted_4$r = { class: "lupa-search-box-custom-label" };
18485
18552
  const _hoisted_5$h = { class: "lupa-search-box-custom-text" };
18486
18553
  const _sfc_main$1e = /* @__PURE__ */ defineComponent({
18487
18554
  __name: "SearchBoxProductCustom",
@@ -18514,7 +18581,7 @@ and ensure you are accounting for this risk.
18514
18581
  class: [className.value, "lupa-search-box-product-custom"]
18515
18582
  }, toHandlers(_ctx.options.action ? { click: handleClick } : {}, true)), [
18516
18583
  !label.value ? (openBlock(), createElementBlock("div", _hoisted_2$O, toDisplayString(text.value), 1)) : (openBlock(), createElementBlock("div", _hoisted_3$B, [
18517
- createBaseVNode("div", _hoisted_4$q, toDisplayString(label.value), 1),
18584
+ createBaseVNode("div", _hoisted_4$r, toDisplayString(label.value), 1),
18518
18585
  createBaseVNode("div", _hoisted_5$h, toDisplayString(text.value), 1)
18519
18586
  ]))
18520
18587
  ], 16));
@@ -18927,7 +18994,7 @@ and ensure you are accounting for this risk.
18927
18994
  const _hoisted_1$12 = { class: "lupa-badge-title" };
18928
18995
  const _hoisted_2$M = ["src"];
18929
18996
  const _hoisted_3$z = { key: 1 };
18930
- const _hoisted_4$p = {
18997
+ const _hoisted_4$q = {
18931
18998
  key: 0,
18932
18999
  class: "lupa-badge-full-text"
18933
19000
  };
@@ -18971,7 +19038,7 @@ and ensure you are accounting for this risk.
18971
19038
  }, null, 8, _hoisted_2$M)) : createCommentVNode("", true),
18972
19039
  hasTitleText.value && showTitle.value ? (openBlock(), createElementBlock("span", _hoisted_3$z, toDisplayString(_ctx.badge.titleText), 1)) : createCommentVNode("", true)
18973
19040
  ]),
18974
- hasAdditionalText.value ? (openBlock(), createElementBlock("span", _hoisted_4$p, toDisplayString(_ctx.badge.additionalText), 1)) : createCommentVNode("", true)
19041
+ hasAdditionalText.value ? (openBlock(), createElementBlock("span", _hoisted_4$q, toDisplayString(_ctx.badge.additionalText), 1)) : createCommentVNode("", true)
18975
19042
  ], 6);
18976
19043
  };
18977
19044
  }
@@ -19449,7 +19516,18 @@ and ensure you are accounting for this risk.
19449
19516
  options
19450
19517
  );
19451
19518
  };
19452
- return { trackSearch, trackResults, trackEvent };
19519
+ const trackDelayedEvent = ({
19520
+ queryKey,
19521
+ data,
19522
+ url
19523
+ }) => {
19524
+ let currentCache = getDelayedEventsCache();
19525
+ currentCache = __spreadProps2(__spreadValues2({}, currentCache), {
19526
+ [url]: { data, queryKey }
19527
+ });
19528
+ storeDelayedEventCache(currentCache);
19529
+ };
19530
+ return { trackSearch, trackResults, trackEvent, trackDelayedEvent };
19453
19531
  });
19454
19532
  const _hoisted_1$X = { id: "lupa-search-box-products" };
19455
19533
  const _sfc_main$12 = /* @__PURE__ */ defineComponent({
@@ -19493,7 +19571,7 @@ and ensure you are accounting for this risk.
19493
19571
  if (!props.panelOptions.idKey) {
19494
19572
  return;
19495
19573
  }
19496
- trackingStore.trackEvent({
19574
+ const trackableEvent = {
19497
19575
  queryKey: props.panelOptions.queryKey,
19498
19576
  data: {
19499
19577
  itemId: id,
@@ -19505,7 +19583,14 @@ and ensure you are accounting for this risk.
19505
19583
  items: [item]
19506
19584
  }
19507
19585
  }
19508
- });
19586
+ };
19587
+ if (isDelayedClickTracking()) {
19588
+ trackingStore.trackDelayedEvent(__spreadProps2(__spreadValues2({}, trackableEvent), {
19589
+ url: link
19590
+ }));
19591
+ } else {
19592
+ trackingStore.trackEvent(trackableEvent);
19593
+ }
19509
19594
  if (!link || eventType === "addToCart") {
19510
19595
  return;
19511
19596
  }
@@ -19771,7 +19856,7 @@ and ensure you are accounting for this risk.
19771
19856
  key: 0,
19772
19857
  class: "lupa-panel-title lupa-panel-title-top-results"
19773
19858
  };
19774
- const _hoisted_4$o = {
19859
+ const _hoisted_4$p = {
19775
19860
  key: 1,
19776
19861
  class: "lupa-panel-title"
19777
19862
  };
@@ -19965,7 +20050,7 @@ and ensure you are accounting for this risk.
19965
20050
  "data-cy": "lupa-panel-" + panel.type + "-index"
19966
20051
  }, [
19967
20052
  ((_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),
19968
- ((_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),
20053
+ ((_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),
19969
20054
  panel.queryKey && canShowPanel(panel) ? (openBlock(), createBlock(resolveDynamicComponent(getComponent(panel.type)), {
19970
20055
  key: 2,
19971
20056
  panel,
@@ -20231,7 +20316,7 @@ and ensure you are accounting for this risk.
20231
20316
  if (!doc2.queryKey || !doc2.doc) {
20232
20317
  return;
20233
20318
  }
20234
- trackingStore.trackEvent({
20319
+ const event = {
20235
20320
  queryKey: doc2.queryKey,
20236
20321
  data: {
20237
20322
  itemId: doc2.id,
@@ -20243,7 +20328,14 @@ and ensure you are accounting for this risk.
20243
20328
  items: [doc2]
20244
20329
  }
20245
20330
  }
20246
- });
20331
+ };
20332
+ if (isDelayedClickTracking()) {
20333
+ trackingStore.trackDelayedEvent(__spreadProps2(__spreadValues2({}, event), {
20334
+ url: generateLink(props.options.links.searchResults, doc2)
20335
+ }));
20336
+ } else {
20337
+ trackingStore.trackEvent(event);
20338
+ }
20247
20339
  };
20248
20340
  const trackSearchQuery = (query) => {
20249
20341
  if (!query) {
@@ -20404,7 +20496,7 @@ and ensure you are accounting for this risk.
20404
20496
  key: 1,
20405
20497
  "data-cy": "did-you-mean-label"
20406
20498
  };
20407
- const _hoisted_4$n = { key: 1 };
20499
+ const _hoisted_4$o = { key: 1 };
20408
20500
  const _sfc_main$Y = /* @__PURE__ */ defineComponent({
20409
20501
  __name: "SearchResultsDidYouMean",
20410
20502
  props: {
@@ -20455,7 +20547,7 @@ and ensure you are accounting for this risk.
20455
20547
  class: "lupa-did-you-mean lupa-highlighted-search-text",
20456
20548
  "data-cy": "did-you-mean-value",
20457
20549
  onClick: _cache[0] || (_cache[0] = ($event) => goToResults({ searchText: didYouMeanValue.value }))
20458
- }, toDisplayString(didYouMeanValue.value) + " ", 1)) : (openBlock(), createElementBlock("span", _hoisted_4$n, toDisplayString(label) + " ", 1))
20550
+ }, toDisplayString(didYouMeanValue.value) + " ", 1)) : (openBlock(), createElementBlock("span", _hoisted_4$o, toDisplayString(label) + " ", 1))
20459
20551
  ]);
20460
20552
  }), 128))
20461
20553
  ])) : createCommentVNode("", true)
@@ -20505,7 +20597,7 @@ and ensure you are accounting for this risk.
20505
20597
  key: 1,
20506
20598
  class: "lupa-results-total-count"
20507
20599
  };
20508
- const _hoisted_4$m = { class: "lupa-results-total-count-number" };
20600
+ const _hoisted_4$n = { class: "lupa-results-total-count-number" };
20509
20601
  const _hoisted_5$f = ["innerHTML"];
20510
20602
  const _sfc_main$W = /* @__PURE__ */ defineComponent({
20511
20603
  __name: "SearchResultsTitle",
@@ -20551,7 +20643,7 @@ and ensure you are accounting for this risk.
20551
20643
  queryText.value ? (openBlock(), createElementBlock("span", _hoisted_2$E, "'" + toDisplayString(queryText.value) + "'", 1)) : createCommentVNode("", true),
20552
20644
  showProductCount.value ? (openBlock(), createElementBlock("span", _hoisted_3$v, [
20553
20645
  createTextVNode("(" + toDisplayString(searchResultsCountLabel.value), 1),
20554
- createBaseVNode("span", _hoisted_4$m, toDisplayString(unref(totalItems)), 1),
20646
+ createBaseVNode("span", _hoisted_4$n, toDisplayString(unref(totalItems)), 1),
20555
20647
  createTextVNode(")")
20556
20648
  ])) : createCommentVNode("", true)
20557
20649
  ])) : createCommentVNode("", true),
@@ -20609,7 +20701,7 @@ and ensure you are accounting for this risk.
20609
20701
  key: 0,
20610
20702
  class: "filter-values"
20611
20703
  };
20612
- const _hoisted_4$l = { class: "lupa-current-filter-list" };
20704
+ const _hoisted_4$m = { class: "lupa-current-filter-list" };
20613
20705
  const _sfc_main$U = /* @__PURE__ */ defineComponent({
20614
20706
  __name: "CurrentFilters",
20615
20707
  props: {
@@ -20693,7 +20785,7 @@ and ensure you are accounting for this risk.
20693
20785
  }, null, 2)) : createCommentVNode("", true)
20694
20786
  ]),
20695
20787
  !_ctx.expandable || isOpen.value ? (openBlock(), createElementBlock("div", _hoisted_3$t, [
20696
- createBaseVNode("div", _hoisted_4$l, [
20788
+ createBaseVNode("div", _hoisted_4$m, [
20697
20789
  (openBlock(true), createElementBlock(Fragment, null, renderList(currentDisplayFilters.value, (filter2) => {
20698
20790
  return openBlock(), createBlock(_sfc_main$V, {
20699
20791
  key: filter2.key + "_" + filter2.value,
@@ -20761,7 +20853,7 @@ and ensure you are accounting for this risk.
20761
20853
  };
20762
20854
  const _hoisted_2$B = { class: "lupa-category-back" };
20763
20855
  const _hoisted_3$s = ["href"];
20764
- const _hoisted_4$k = ["href"];
20856
+ const _hoisted_4$l = ["href"];
20765
20857
  const _hoisted_5$e = { class: "lupa-child-category-list" };
20766
20858
  const _sfc_main$S = /* @__PURE__ */ defineComponent({
20767
20859
  __name: "CategoryFilter",
@@ -20868,7 +20960,7 @@ and ensure you are accounting for this risk.
20868
20960
  href: parentUrlLink.value,
20869
20961
  class: normalizeClass({ "lupa-title-category": !hasBackButton.value }),
20870
20962
  onClick: handleNavigationParent
20871
- }, toDisplayString(parentTitle.value), 11, _hoisted_4$k)
20963
+ }, toDisplayString(parentTitle.value), 11, _hoisted_4$l)
20872
20964
  ], 2),
20873
20965
  createBaseVNode("div", _hoisted_5$e, [
20874
20966
  (openBlock(true), createElementBlock(Fragment, null, renderList(categoryChildren.value, (child) => {
@@ -20889,7 +20981,7 @@ and ensure you are accounting for this risk.
20889
20981
  };
20890
20982
  const _hoisted_2$A = ["placeholder"];
20891
20983
  const _hoisted_3$r = { class: "lupa-terms-list" };
20892
- const _hoisted_4$j = ["onClick"];
20984
+ const _hoisted_4$k = ["onClick"];
20893
20985
  const _hoisted_5$d = { class: "lupa-term-checkbox-wrapper" };
20894
20986
  const _hoisted_6$8 = { class: "lupa-term-checkbox-label" };
20895
20987
  const _hoisted_7$6 = { class: "lupa-term-label" };
@@ -20997,7 +21089,7 @@ and ensure you are accounting for this risk.
20997
21089
  createBaseVNode("span", _hoisted_7$6, toDisplayString(item.title), 1),
20998
21090
  _ctx.options.showDocumentCount ? (openBlock(), createElementBlock("span", _hoisted_8$2, "(" + toDisplayString(item.count) + ")", 1)) : createCommentVNode("", true)
20999
21091
  ])
21000
- ], 10, _hoisted_4$j);
21092
+ ], 10, _hoisted_4$k);
21001
21093
  }), 128))
21002
21094
  ]),
21003
21095
  displayShowMore.value ? (openBlock(), createElementBlock("div", {
@@ -21997,7 +22089,7 @@ and ensure you are accounting for this risk.
21997
22089
  key: 1,
21998
22090
  class: "lupa-stats-facet-summary-input"
21999
22091
  };
22000
- const _hoisted_4$i = {
22092
+ const _hoisted_4$j = {
22001
22093
  key: 0,
22002
22094
  class: "lupa-stats-range-label"
22003
22095
  };
@@ -22061,8 +22153,12 @@ and ensure you are accounting for this risk.
22061
22153
  var _a;
22062
22154
  return Boolean((_a = props.options.stats) == null ? void 0 : _a.inputs);
22063
22155
  });
22156
+ const pricePrecision = computed(() => {
22157
+ var _a, _b;
22158
+ return (_b = (_a = props.options.stats) == null ? void 0 : _a.pricePrecisionDigits) != null ? _b : 2;
22159
+ });
22064
22160
  const fromValue = computed({
22065
- get: () => isPrice.value ? sliderRange.value[0].toFixed(2).replace(".", separator.value) : `${sliderRange.value[0]}`,
22161
+ get: () => isPrice.value ? sliderRange.value[0].toFixed(pricePrecision.value).replace(".", separator.value) : `${sliderRange.value[0]}`,
22066
22162
  set: (stringValue) => {
22067
22163
  let value = normalizeFloat(stringValue);
22068
22164
  if (value < facetMin.value) {
@@ -22076,7 +22172,7 @@ and ensure you are accounting for this risk.
22076
22172
  }
22077
22173
  });
22078
22174
  const toValue = computed({
22079
- get: () => isPrice.value ? sliderRange.value[1].toFixed(2).replace(".", separator.value) : `${sliderRange.value[1]}`,
22175
+ get: () => isPrice.value ? sliderRange.value[1].toFixed(pricePrecision.value).replace(".", separator.value) : `${sliderRange.value[1]}`,
22080
22176
  set: (stringValue) => {
22081
22177
  let value = normalizeFloat(stringValue);
22082
22178
  if (value > facetMax.value) {
@@ -22192,7 +22288,7 @@ and ensure you are accounting for this risk.
22192
22288
  return openBlock(), createElementBlock("div", _hoisted_1$L, [
22193
22289
  !isInputVisible.value ? (openBlock(), createElementBlock("div", _hoisted_2$z, toDisplayString(statsSummary.value), 1)) : (openBlock(), createElementBlock("div", _hoisted_3$q, [
22194
22290
  createBaseVNode("div", null, [
22195
- rangeLabelFrom.value ? (openBlock(), createElementBlock("div", _hoisted_4$i, toDisplayString(rangeLabelFrom.value), 1)) : createCommentVNode("", true),
22291
+ rangeLabelFrom.value ? (openBlock(), createElementBlock("div", _hoisted_4$j, toDisplayString(rangeLabelFrom.value), 1)) : createCommentVNode("", true),
22196
22292
  createBaseVNode("div", _hoisted_5$c, [
22197
22293
  withDirectives(createBaseVNode("input", {
22198
22294
  "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => fromValue.value = $event),
@@ -22259,7 +22355,7 @@ and ensure you are accounting for this risk.
22259
22355
  const _hoisted_1$K = { class: "lupa-term-checkbox-wrapper" };
22260
22356
  const _hoisted_2$y = { class: "lupa-term-checkbox-label" };
22261
22357
  const _hoisted_3$p = { class: "lupa-term-label" };
22262
- const _hoisted_4$h = {
22358
+ const _hoisted_4$i = {
22263
22359
  key: 0,
22264
22360
  class: "lupa-term-count"
22265
22361
  };
@@ -22320,7 +22416,7 @@ and ensure you are accounting for this risk.
22320
22416
  ]),
22321
22417
  createBaseVNode("div", _hoisted_2$y, [
22322
22418
  createBaseVNode("span", _hoisted_3$p, toDisplayString(_ctx.item.title) + toDisplayString(" "), 1),
22323
- _ctx.options.showDocumentCount ? (openBlock(), createElementBlock("span", _hoisted_4$h, "(" + toDisplayString(_ctx.item.count) + ")", 1)) : createCommentVNode("", true)
22419
+ _ctx.options.showDocumentCount ? (openBlock(), createElementBlock("span", _hoisted_4$i, "(" + toDisplayString(_ctx.item.count) + ")", 1)) : createCommentVNode("", true)
22324
22420
  ])
22325
22421
  ]),
22326
22422
  showChildren.value ? (openBlock(), createElementBlock("div", _hoisted_5$b, [
@@ -22385,15 +22481,20 @@ and ensure you are accounting for this risk.
22385
22481
  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);
22386
22482
  });
22387
22483
  const handleFacetClick = ({ value }) => {
22484
+ var _a, _b;
22388
22485
  emit2("select", {
22389
22486
  key: facet.value.key,
22390
22487
  value,
22391
- type: "hierarchy"
22488
+ type: "hierarchy",
22489
+ behavior: (_b = (_a = props.options.hierarchy) == null ? void 0 : _a.behavior) != null ? _b : "append"
22392
22490
  });
22393
22491
  };
22394
22492
  const handleShowAll = () => {
22395
22493
  showAll.value = true;
22396
22494
  };
22495
+ const handleCancelShowAll = () => {
22496
+ showAll.value = false;
22497
+ };
22397
22498
  return (_ctx, _cache) => {
22398
22499
  return openBlock(), createElementBlock("div", _hoisted_1$J, [
22399
22500
  isFilterable.value ? (openBlock(), createElementBlock("div", _hoisted_2$x, [
@@ -22422,7 +22523,11 @@ and ensure you are accounting for this risk.
22422
22523
  class: "lupa-facet-term lupa-show-more-facet-results",
22423
22524
  "data-cy": "lupa-facet-term",
22424
22525
  onClick: handleShowAll
22425
- }, toDisplayString(_ctx.options.labels.showAll), 1)) : createCommentVNode("", true)
22526
+ }, toDisplayString(_ctx.options.labels.showAll), 1)) : showAll.value ? (openBlock(), createElementBlock("div", {
22527
+ key: 2,
22528
+ class: "lupa-facet-term lupa-show-more-facet-results",
22529
+ onClick: handleCancelShowAll
22530
+ }, toDisplayString(_ctx.options.labels.showLess), 1)) : createCommentVNode("", true)
22426
22531
  ]);
22427
22532
  };
22428
22533
  }
@@ -22832,7 +22937,7 @@ and ensure you are accounting for this risk.
22832
22937
  };
22833
22938
  const _hoisted_2$t = ["onClick"];
22834
22939
  const _hoisted_3$n = { class: "lupa-mobile-sidebar-content" };
22835
- const _hoisted_4$g = { class: "lupa-sidebar-top" };
22940
+ const _hoisted_4$h = { class: "lupa-sidebar-top" };
22836
22941
  const _hoisted_5$a = { class: "lupa-sidebar-title" };
22837
22942
  const _hoisted_6$6 = {
22838
22943
  key: 0,
@@ -22876,7 +22981,7 @@ and ensure you are accounting for this risk.
22876
22981
  onClick: withModifiers(handleMobileToggle, ["stop"])
22877
22982
  }, null, 8, _hoisted_2$t),
22878
22983
  createBaseVNode("div", _hoisted_3$n, [
22879
- createBaseVNode("div", _hoisted_4$g, [
22984
+ createBaseVNode("div", _hoisted_4$h, [
22880
22985
  createBaseVNode("div", _hoisted_5$a, [
22881
22986
  createTextVNode(toDisplayString(sidebarTitle.value) + " ", 1),
22882
22987
  isFilterCountVisible.value ? (openBlock(), createElementBlock("span", _hoisted_6$6, toDisplayString(unref(currentFilterCount)), 1)) : createCommentVNode("", true)
@@ -22904,7 +23009,7 @@ and ensure you are accounting for this risk.
22904
23009
  key: 1,
22905
23010
  class: "lupa-search-results-breadcrumb-text"
22906
23011
  };
22907
- const _hoisted_4$f = { key: 2 };
23012
+ const _hoisted_4$g = { key: 2 };
22908
23013
  const _sfc_main$H = /* @__PURE__ */ defineComponent({
22909
23014
  __name: "SearchResultsBreadcrumbs",
22910
23015
  props: {
@@ -22945,7 +23050,7 @@ and ensure you are accounting for this risk.
22945
23050
  return handleNavigation(e2, (_a = breadcrumb == null ? void 0 : breadcrumb.link) != null ? _a : "");
22946
23051
  }
22947
23052
  }, toDisplayString(getLabel(breadcrumb.label)), 9, _hoisted_2$s)) : (openBlock(), createElementBlock("span", _hoisted_3$m, toDisplayString(getLabel(breadcrumb.label)), 1)),
22948
- index < breadcrumbsValue.value.length - 1 ? (openBlock(), createElementBlock("span", _hoisted_4$f, " / ")) : createCommentVNode("", true)
23053
+ index < breadcrumbsValue.value.length - 1 ? (openBlock(), createElementBlock("span", _hoisted_4$g, " / ")) : createCommentVNode("", true)
22949
23054
  ]);
22950
23055
  }), 128))
22951
23056
  ]);
@@ -23051,7 +23156,7 @@ and ensure you are accounting for this risk.
23051
23156
  class: "lupa-page-number-separator"
23052
23157
  };
23053
23158
  const _hoisted_3$l = ["onClick"];
23054
- const _hoisted_4$e = {
23159
+ const _hoisted_4$f = {
23055
23160
  key: 0,
23056
23161
  class: "lupa-page-number-separator"
23057
23162
  };
@@ -23157,7 +23262,7 @@ and ensure you are accounting for this risk.
23157
23262
  }, toDisplayString(page), 11, _hoisted_3$l);
23158
23263
  }), 128)),
23159
23264
  showLastPage.value ? (openBlock(), createElementBlock(Fragment, { key: 2 }, [
23160
- showLastPageSeparator.value ? (openBlock(), createElementBlock("div", _hoisted_4$e, "...")) : createCommentVNode("", true),
23265
+ showLastPageSeparator.value ? (openBlock(), createElementBlock("div", _hoisted_4$f, "...")) : createCommentVNode("", true),
23161
23266
  createBaseVNode("div", {
23162
23267
  class: "lupa-page-number lupa-page-number-last",
23163
23268
  onClick: _cache[2] || (_cache[2] = () => {
@@ -23182,7 +23287,7 @@ and ensure you are accounting for this risk.
23182
23287
  };
23183
23288
  const _hoisted_2$q = { id: "lupa-select" };
23184
23289
  const _hoisted_3$k = { class: "lupa-select-label" };
23185
- const _hoisted_4$d = ["aria-label"];
23290
+ const _hoisted_4$e = ["aria-label"];
23186
23291
  const _hoisted_5$9 = ["value"];
23187
23292
  const _sfc_main$C = /* @__PURE__ */ defineComponent({
23188
23293
  __name: "SearchResultsPageSize",
@@ -23229,7 +23334,7 @@ and ensure you are accounting for this risk.
23229
23334
  value: option
23230
23335
  }, toDisplayString(prefixLabel.value) + toDisplayString(option), 9, _hoisted_5$9);
23231
23336
  }), 128))
23232
- ], 40, _hoisted_4$d)
23337
+ ], 40, _hoisted_4$e)
23233
23338
  ])
23234
23339
  ]);
23235
23340
  };
@@ -23241,7 +23346,7 @@ and ensure you are accounting for this risk.
23241
23346
  };
23242
23347
  const _hoisted_2$p = { id: "lupa-select" };
23243
23348
  const _hoisted_3$j = { class: "lupa-select-label" };
23244
- const _hoisted_4$c = ["aria-label"];
23349
+ const _hoisted_4$d = ["aria-label"];
23245
23350
  const _hoisted_5$8 = ["value"];
23246
23351
  const _sfc_main$B = /* @__PURE__ */ defineComponent({
23247
23352
  __name: "SearchResultsSort",
@@ -23309,7 +23414,7 @@ and ensure you are accounting for this risk.
23309
23414
  value: option.key
23310
23415
  }, toDisplayString(option.label), 9, _hoisted_5$8);
23311
23416
  }), 128))
23312
- ], 40, _hoisted_4$c), [
23417
+ ], 40, _hoisted_4$d), [
23313
23418
  [vModelSelect, selectedKey.value]
23314
23419
  ])
23315
23420
  ])
@@ -23323,7 +23428,7 @@ and ensure you are accounting for this risk.
23323
23428
  class: "lupa-toolbar-right-title"
23324
23429
  };
23325
23430
  const _hoisted_3$i = { key: 2 };
23326
- const _hoisted_4$b = { key: 4 };
23431
+ const _hoisted_4$c = { key: 4 };
23327
23432
  const _hoisted_5$7 = { key: 6 };
23328
23433
  const _hoisted_6$5 = { class: "lupa-toolbar-right" };
23329
23434
  const _hoisted_7$3 = {
@@ -23447,7 +23552,7 @@ and ensure you are accounting for this risk.
23447
23552
  label: searchSummaryLabel.value,
23448
23553
  clearable: unref(hasAnyFilter) && showFilterClear.value,
23449
23554
  onClear: handleClearAll
23450
- }, null, 8, ["label", "clearable"])) : (openBlock(), createElementBlock("div", _hoisted_4$b)),
23555
+ }, null, 8, ["label", "clearable"])) : (openBlock(), createElementBlock("div", _hoisted_4$c)),
23451
23556
  displayPageSelect.value ? (openBlock(), createBlock(_sfc_main$D, {
23452
23557
  key: 5,
23453
23558
  options: paginationOptions.value.pageSelect,
@@ -23496,7 +23601,7 @@ and ensure you are accounting for this risk.
23496
23601
  const _hoisted_1$u = ["title", "innerHTML"];
23497
23602
  const _hoisted_2$n = ["title"];
23498
23603
  const _hoisted_3$h = ["href", "innerHTML"];
23499
- const _hoisted_4$a = ["title"];
23604
+ const _hoisted_4$b = ["title"];
23500
23605
  const _hoisted_5$6 = {
23501
23606
  key: 0,
23502
23607
  class: "lupa-search-results-product-title-text"
@@ -23564,7 +23669,7 @@ and ensure you are accounting for this risk.
23564
23669
  class: "lupa-search-results-product-title-text lupa-title-link",
23565
23670
  onClick: handleNavigation
23566
23671
  }, toDisplayString(title.value), 9, _hoisted_6$4)) : createCommentVNode("", true)
23567
- ], 12, _hoisted_4$a));
23672
+ ], 12, _hoisted_4$b));
23568
23673
  };
23569
23674
  }
23570
23675
  });
@@ -23607,7 +23712,7 @@ and ensure you are accounting for this risk.
23607
23712
  const _hoisted_1$s = { id: "lupa-search-results-rating" };
23608
23713
  const _hoisted_2$m = { class: "lupa-ratings" };
23609
23714
  const _hoisted_3$g = { class: "lupa-ratings-base" };
23610
- const _hoisted_4$9 = ["innerHTML"];
23715
+ const _hoisted_4$a = ["innerHTML"];
23611
23716
  const _hoisted_5$5 = { class: "lupa-rating-wrapper" };
23612
23717
  const _hoisted_6$3 = ["innerHTML"];
23613
23718
  const _hoisted_7$2 = ["href"];
@@ -23657,7 +23762,7 @@ and ensure you are accounting for this risk.
23657
23762
  key: index,
23658
23763
  innerHTML: star,
23659
23764
  class: "lupa-rating lupa-rating-not-highlighted"
23660
- }, null, 8, _hoisted_4$9);
23765
+ }, null, 8, _hoisted_4$a);
23661
23766
  }), 128))
23662
23767
  ]),
23663
23768
  createBaseVNode("div", _hoisted_5$5, [
@@ -23797,7 +23902,7 @@ and ensure you are accounting for this risk.
23797
23902
  const _hoisted_1$p = ["innerHTML"];
23798
23903
  const _hoisted_2$k = { key: 0 };
23799
23904
  const _hoisted_3$e = { key: 1 };
23800
- const _hoisted_4$8 = { class: "lupa-search-box-custom-label" };
23905
+ const _hoisted_4$9 = { class: "lupa-search-box-custom-label" };
23801
23906
  const _hoisted_5$4 = { class: "lupa-search-box-custom-text" };
23802
23907
  const _sfc_main$s = /* @__PURE__ */ defineComponent({
23803
23908
  __name: "SearchResultsProductCustom",
@@ -23842,7 +23947,7 @@ and ensure you are accounting for this risk.
23842
23947
  class: className.value
23843
23948
  }, toHandlers(_ctx.options.action ? { click: handleClick } : {}, true)), [
23844
23949
  !label.value ? (openBlock(), createElementBlock("div", _hoisted_2$k, toDisplayString(text.value), 1)) : (openBlock(), createElementBlock("div", _hoisted_3$e, [
23845
- createBaseVNode("div", _hoisted_4$8, toDisplayString(label.value), 1),
23950
+ createBaseVNode("div", _hoisted_4$9, toDisplayString(label.value), 1),
23846
23951
  createBaseVNode("div", _hoisted_5$4, toDisplayString(text.value), 1)
23847
23952
  ]))
23848
23953
  ], 16));
@@ -23888,7 +23993,7 @@ and ensure you are accounting for this risk.
23888
23993
  const _hoisted_1$n = { id: "lupa-search-results-rating" };
23889
23994
  const _hoisted_2$j = ["innerHTML"];
23890
23995
  const _hoisted_3$d = { class: "lupa-ratings" };
23891
- const _hoisted_4$7 = ["href"];
23996
+ const _hoisted_4$8 = ["href"];
23892
23997
  const _sfc_main$q = /* @__PURE__ */ defineComponent({
23893
23998
  __name: "SearchResultsProductSingleStarRating",
23894
23999
  props: {
@@ -23926,7 +24031,7 @@ and ensure you are accounting for this risk.
23926
24031
  createBaseVNode("a", {
23927
24032
  href: ratingLink.value,
23928
24033
  class: "lupa-total-ratings"
23929
- }, toDisplayString(totalRatings.value), 9, _hoisted_4$7)
24034
+ }, toDisplayString(totalRatings.value), 9, _hoisted_4$8)
23930
24035
  ]);
23931
24036
  };
23932
24037
  }
@@ -24021,12 +24126,13 @@ and ensure you are accounting for this risk.
24021
24126
  };
24022
24127
  }
24023
24128
  }));
24024
- const _hoisted_1$m = ["href"];
24025
- const _hoisted_2$i = {
24129
+ const _hoisted_1$m = ["onMouseup"];
24130
+ const _hoisted_2$i = ["href"];
24131
+ const _hoisted_3$c = {
24026
24132
  key: 0,
24027
24133
  class: "lupa-out-of-stock"
24028
24134
  };
24029
- const _hoisted_3$c = { class: "lupa-search-result-product-details-section" };
24135
+ const _hoisted_4$7 = { class: "lupa-search-result-product-details-section" };
24030
24136
  const _sfc_main$o = /* @__PURE__ */ defineComponent({
24031
24137
  __name: "SearchResultsProductCard",
24032
24138
  props: {
@@ -24130,7 +24236,7 @@ and ensure you are accounting for this risk.
24130
24236
  });
24131
24237
  const handleClick = () => {
24132
24238
  var _a, _b, _c, _d;
24133
- trackingStore.trackEvent({
24239
+ const event = {
24134
24240
  queryKey: props.options.queryKey,
24135
24241
  data: {
24136
24242
  itemId: id.value,
@@ -24143,9 +24249,15 @@ and ensure you are accounting for this risk.
24143
24249
  items: [props.product],
24144
24250
  itemId: id.value
24145
24251
  },
24146
- options: { allowEmptySearchQuery: true }
24252
+ options: { allowEmptySearchQuery: true },
24253
+ filters: searchResultStore.hasAnyFilter ? searchResultStore.filters : void 0
24147
24254
  }
24148
- });
24255
+ };
24256
+ if (isDelayedClickTracking()) {
24257
+ trackingStore.trackDelayedEvent(__spreadProps2(__spreadValues2({}, event), { url: link.value }));
24258
+ } else {
24259
+ trackingStore.trackEvent(event);
24260
+ }
24149
24261
  (_d = (_c = searchResultOptions.value.callbacks) == null ? void 0 : _c.onProductClick) == null ? void 0 : _d.call(_c, {
24150
24262
  queryKey: query.value,
24151
24263
  hasResults: true,
@@ -24178,7 +24290,10 @@ and ensure you are accounting for this risk.
24178
24290
  id: "lupa-search-result-product-card",
24179
24291
  "data-cy": "lupa-search-result-product-card",
24180
24292
  class: ["lupa-search-result-product-card", !isInStock.value ? "lupa-out-of-stock" : ""]
24181
- }, customDocumentHtmlAttributes.value, { onClick: handleClick }), [
24293
+ }, customDocumentHtmlAttributes.value, {
24294
+ onClick: handleClick,
24295
+ onMouseup: withModifiers(handleClick, ["middle", "exact"])
24296
+ }), [
24182
24297
  createVNode(_sfc_main$14, { options: badgesOptions.value }, null, 8, ["options"]),
24183
24298
  createBaseVNode("div", {
24184
24299
  class: normalizeClass(["lupa-search-result-product-contents", listLayoutClass.value])
@@ -24205,9 +24320,9 @@ and ensure you are accounting for this risk.
24205
24320
  position: "image",
24206
24321
  class: "lupa-image-badges"
24207
24322
  }, null, 8, ["options"]),
24208
- ((_a = labels.value) == null ? void 0 : _a.outOfStock) && !isInStock.value ? (openBlock(), createElementBlock("div", _hoisted_2$i, toDisplayString(labels.value.outOfStock), 1)) : createCommentVNode("", true)
24209
- ], 8, _hoisted_1$m),
24210
- createBaseVNode("div", _hoisted_3$c, [
24323
+ ((_a = labels.value) == null ? void 0 : _a.outOfStock) && !isInStock.value ? (openBlock(), createElementBlock("div", _hoisted_3$c, toDisplayString(labels.value.outOfStock), 1)) : createCommentVNode("", true)
24324
+ ], 8, _hoisted_2$i),
24325
+ createBaseVNode("div", _hoisted_4$7, [
24211
24326
  (openBlock(true), createElementBlock(Fragment, null, renderList(detailElements.value, (element) => {
24212
24327
  return openBlock(), createBlock(_sfc_main$p, {
24213
24328
  class: "lupa-search-results-product-element",
@@ -24241,7 +24356,7 @@ and ensure you are accounting for this risk.
24241
24356
  ], 2);
24242
24357
  }), 128))
24243
24358
  ], 2)
24244
- ], 16);
24359
+ ], 16, _hoisted_1$m);
24245
24360
  };
24246
24361
  }
24247
24362
  });
@@ -24379,6 +24494,7 @@ and ensure you are accounting for this risk.
24379
24494
  });
24380
24495
  };
24381
24496
  const handleQueryChange = () => {
24497
+ showAll.value = false;
24382
24498
  const context = getLupaTrackingContext();
24383
24499
  const queryBody = __spreadProps2(__spreadValues2({}, context), {
24384
24500
  limit: props.panel.totalCountLimit,
@@ -24613,7 +24729,6 @@ and ensure you are accounting for this risk.
24613
24729
  watch(
24614
24730
  () => props.query,
24615
24731
  () => {
24616
- console.log("query changed", props.query);
24617
24732
  searchForRelatedQuery();
24618
24733
  }
24619
24734
  );