@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.
@@ -6804,6 +6804,8 @@ var __async = (__this, __arguments, generator) => {
6804
6804
  const TRACKING_STORAGE_KEY = "LUPA_STATS";
6805
6805
  const TRACKING_STORAGE_KEY_BASE = "LUPA_STATS_BASE";
6806
6806
  const TRACKING_ANALYTICS_KEY = "LUPA_ANALYTICS";
6807
+ const TRACKING_CLICK_DELAYED = "LUPA_TRACKING_CLICK_DELAYED";
6808
+ const DELAYED_TRACKING_EVENTS_CACHE = "LUPA_DELAYED_TRACKING_EVENTS";
6807
6809
  const TRACKING_KEY_LENGTH = 10;
6808
6810
  const HISTORY_MAX_ITEMS = 7;
6809
6811
  const S_MIN_WIDTH = 575;
@@ -7024,6 +7026,14 @@ var __async = (__this, __arguments, generator) => {
7024
7026
  const transformedStr = typeof str === "string" ? str : str.toString();
7025
7027
  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();
7026
7028
  };
7029
+ const getTransformedString = (str) => {
7030
+ var _a, _b;
7031
+ if (!str) {
7032
+ return "";
7033
+ }
7034
+ const transformedStr = typeof str === "string" ? str : str.toString();
7035
+ return transformedStr.normalize === void 0 ? (_a = transformedStr.toLocaleLowerCase()) == null ? void 0 : _a.trim() : (_b = transformedStr.toLocaleLowerCase().normalize("NFKD")) == null ? void 0 : _b.trim();
7036
+ };
7027
7037
  const capitalize$1 = (str) => {
7028
7038
  if (!str) {
7029
7039
  return "";
@@ -7097,8 +7107,8 @@ var __async = (__this, __arguments, generator) => {
7097
7107
  if (!input2) {
7098
7108
  return false;
7099
7109
  }
7100
- const normalizedInput = getNormalizedString(input2);
7101
- return possibleValues.some((v) => getNormalizedString(v) === normalizedInput);
7110
+ const normalizedInput = getTransformedString(input2);
7111
+ return possibleValues.some((v) => getTransformedString(v) === normalizedInput);
7102
7112
  };
7103
7113
  const levenshteinDistance = (s = "", t = "") => {
7104
7114
  if (!(s == null ? void 0 : s.length)) {
@@ -7131,225 +7141,6 @@ var __async = (__this, __arguments, generator) => {
7131
7141
  const closestValue = (_a = possibleValues.filter((_, i) => distances[i] === minDistance)) == null ? void 0 : _a[0];
7132
7142
  return closestValue;
7133
7143
  };
7134
- const initAnalyticsTracking = (analyticsOptions) => {
7135
- try {
7136
- if (analyticsOptions == null ? void 0 : analyticsOptions.enabled) {
7137
- window.sessionStorage.setItem(TRACKING_ANALYTICS_KEY, JSON.stringify(analyticsOptions));
7138
- } else {
7139
- window.sessionStorage.removeItem(TRACKING_ANALYTICS_KEY);
7140
- }
7141
- } catch (e2) {
7142
- }
7143
- };
7144
- const initBaseTracking = (enabled) => {
7145
- try {
7146
- if (enabled) {
7147
- window.sessionStorage.setItem(TRACKING_STORAGE_KEY_BASE, "1");
7148
- } else {
7149
- window.sessionStorage.removeItem(TRACKING_STORAGE_KEY_BASE);
7150
- clearSessionTracking();
7151
- clearUserTracking();
7152
- }
7153
- } catch (e2) {
7154
- }
7155
- };
7156
- const clearSessionTracking = () => {
7157
- try {
7158
- window.sessionStorage.removeItem(TRACKING_STORAGE_KEY);
7159
- } catch (e2) {
7160
- }
7161
- };
7162
- const initSessionTracking = () => {
7163
- try {
7164
- if (getSessionKey()) {
7165
- return;
7166
- }
7167
- const key = getRandomString(TRACKING_KEY_LENGTH);
7168
- window.sessionStorage.setItem(TRACKING_STORAGE_KEY, key);
7169
- } catch (e2) {
7170
- }
7171
- };
7172
- const initUserTracking = (userKey) => {
7173
- try {
7174
- if (getUserKey()) {
7175
- return;
7176
- }
7177
- const key = userKey || getRandomString(TRACKING_KEY_LENGTH);
7178
- window.localStorage.setItem(TRACKING_STORAGE_KEY, key);
7179
- } catch (e2) {
7180
- }
7181
- };
7182
- const clearUserTracking = () => {
7183
- try {
7184
- window.localStorage.removeItem(TRACKING_STORAGE_KEY);
7185
- } catch (e2) {
7186
- }
7187
- };
7188
- const isTrackingEnabled = () => {
7189
- try {
7190
- return Boolean(window.sessionStorage.getItem(TRACKING_STORAGE_KEY_BASE));
7191
- } catch (e2) {
7192
- return false;
7193
- }
7194
- };
7195
- const getSessionKey = () => {
7196
- var _a;
7197
- try {
7198
- return (_a = window.sessionStorage.getItem(TRACKING_STORAGE_KEY)) != null ? _a : void 0;
7199
- } catch (e2) {
7200
- return void 0;
7201
- }
7202
- };
7203
- const getUserKey = () => {
7204
- var _a;
7205
- try {
7206
- return (_a = window.localStorage.getItem(TRACKING_STORAGE_KEY)) != null ? _a : void 0;
7207
- } catch (e2) {
7208
- return void 0;
7209
- }
7210
- };
7211
- const initTracking = (options) => {
7212
- initBaseTracking(Boolean(options.trackBase));
7213
- if (options.trackSession) {
7214
- initSessionTracking();
7215
- } else {
7216
- clearSessionTracking();
7217
- }
7218
- if (options.trackUser) {
7219
- initUserTracking(options.userKey);
7220
- } else {
7221
- clearUserTracking();
7222
- }
7223
- if (options.analytics) {
7224
- initAnalyticsTracking(options.analytics);
7225
- }
7226
- };
7227
- const getLupaTrackingContext = () => {
7228
- if (!isTrackingEnabled()) {
7229
- return {};
7230
- }
7231
- return {
7232
- userId: getUserKey(),
7233
- sessionId: getSessionKey()
7234
- };
7235
- };
7236
- const trackLupaEvent = (queryKey, data = {}, options) => {
7237
- var _a, _b;
7238
- if (!queryKey || !data.type) {
7239
- return;
7240
- }
7241
- const eventData = {
7242
- searchQuery: (_a = data.searchQuery) != null ? _a : "",
7243
- itemId: (_b = data.itemId) != null ? _b : "",
7244
- name: data.type,
7245
- userId: getUserKey(),
7246
- sessionId: getSessionKey(),
7247
- filters: data.filters
7248
- };
7249
- LupaSearchSdk.track(queryKey, eventData, options);
7250
- };
7251
- const sendGa = (name, ...args) => {
7252
- window.ga(() => {
7253
- const trackers = window.ga.getAll();
7254
- const firstTracker = trackers[0];
7255
- if (!firstTracker) {
7256
- console.error("GA tracker not found");
7257
- }
7258
- const trackerName = firstTracker.get("name");
7259
- window.ga(`${trackerName}.${name}`, ...args);
7260
- });
7261
- };
7262
- const trackAnalyticsEvent = (data) => {
7263
- var _a, _b, _c;
7264
- try {
7265
- const options = JSON.parse(
7266
- (_a = window.sessionStorage.getItem(TRACKING_ANALYTICS_KEY)) != null ? _a : "{}"
7267
- );
7268
- if (!data.analytics || !options.enabled || ((_c = options.ignoreEvents) == null ? void 0 : _c.includes((_b = data.analytics) == null ? void 0 : _b.type))) {
7269
- return;
7270
- }
7271
- switch (options.type) {
7272
- case "ua":
7273
- sendUaAnalyticsEvent(data, options);
7274
- break;
7275
- case "ga4":
7276
- sendGa4AnalyticsEvent(data, options);
7277
- break;
7278
- case "debug":
7279
- processDebugEvent(data);
7280
- break;
7281
- default:
7282
- sendUaAnalyticsEvent(data, options);
7283
- }
7284
- } catch (e2) {
7285
- console.error("Unable to send an event to google analytics");
7286
- }
7287
- };
7288
- const parseEcommerceData = (data, title) => {
7289
- var _a, _b;
7290
- return ((_a = data.analytics) == null ? void 0 : _a.items) ? {
7291
- item_list_name: title,
7292
- items: (_b = data.analytics) == null ? void 0 : _b.items
7293
- } : void 0;
7294
- };
7295
- const sendUaAnalyticsEvent = (data, options) => {
7296
- var _a, _b, _c, _d;
7297
- const ga = window.ga;
7298
- if (!ga) {
7299
- console.error("Google Analytics object not found");
7300
- return;
7301
- }
7302
- sendGa(
7303
- "send",
7304
- "event",
7305
- options.parentEventName,
7306
- (_b = (_a = data.analytics) == null ? void 0 : _a.type) != null ? _b : "",
7307
- (_d = (_c = data.analytics) == null ? void 0 : _c.label) != null ? _d : ""
7308
- );
7309
- };
7310
- const sendGa4AnalyticsEvent = (data, options) => {
7311
- var _a, _b, _c, _d, _e, _f, _g;
7312
- if (!window || !window.dataLayer) {
7313
- console.error("dataLayer object not found.");
7314
- return;
7315
- }
7316
- const sendItemTitle = data.searchQuery !== ((_a = data.analytics) == null ? void 0 : _a.label);
7317
- const title = sendItemTitle ? (_b = data.analytics) == null ? void 0 : _b.label : void 0;
7318
- const params = __spreadValues2({
7319
- search_text: data.searchQuery,
7320
- item_title: title,
7321
- item_id: data.itemId,
7322
- ecommerce: parseEcommerceData(data, (_c = data.analytics) == null ? void 0 : _c.listLabel)
7323
- }, (_e = (_d = data.analytics) == null ? void 0 : _d.additionalParams) != null ? _e : {});
7324
- window.dataLayer.push(__spreadValues2({
7325
- event: (_g = (_f = data.analytics) == null ? void 0 : _f.type) != null ? _g : options.parentEventName
7326
- }, params));
7327
- };
7328
- const processDebugEvent = (data) => {
7329
- var _a, _b, _c, _d;
7330
- const sendItemTitle = data.searchQuery !== ((_a = data.analytics) == null ? void 0 : _a.label);
7331
- const title = sendItemTitle ? (_b = data.analytics) == null ? void 0 : _b.label : void 0;
7332
- const params = {
7333
- event: (_c = data.analytics) == null ? void 0 : _c.type,
7334
- search_text: data.searchQuery,
7335
- item_title: title,
7336
- item_id: data.itemId,
7337
- ecommerce: parseEcommerceData(data, (_d = data.analytics) == null ? void 0 : _d.listLabel)
7338
- };
7339
- console.debug("Analytics debug event:", params);
7340
- };
7341
- const track = (queryKey, data = {}, options) => {
7342
- var _a;
7343
- if (!isTrackingEnabled()) {
7344
- return;
7345
- }
7346
- const hasSearchQuery = data.searchQuery;
7347
- if (!hasSearchQuery && !((_a = data.options) == null ? void 0 : _a.allowEmptySearchQuery)) {
7348
- return;
7349
- }
7350
- trackAnalyticsEvent(data);
7351
- trackLupaEvent(queryKey, data, options);
7352
- };
7353
7144
  const DEFAULT_SEARCH_BOX_OPTIONS$1 = {
7354
7145
  inputSelector: "#searchBox",
7355
7146
  options: {
@@ -7631,6 +7422,266 @@ var __async = (__this, __arguments, generator) => {
7631
7422
  getQueryParamName
7632
7423
  };
7633
7424
  });
7425
+ const initAnalyticsTracking = (analyticsOptions) => {
7426
+ try {
7427
+ if (analyticsOptions == null ? void 0 : analyticsOptions.enabled) {
7428
+ window.sessionStorage.setItem(TRACKING_ANALYTICS_KEY, JSON.stringify(analyticsOptions));
7429
+ } else {
7430
+ window.sessionStorage.removeItem(TRACKING_ANALYTICS_KEY);
7431
+ }
7432
+ } catch (e2) {
7433
+ }
7434
+ };
7435
+ const initBaseTracking = (enabled) => {
7436
+ try {
7437
+ if (enabled) {
7438
+ window.sessionStorage.setItem(TRACKING_STORAGE_KEY_BASE, "1");
7439
+ } else {
7440
+ window.sessionStorage.removeItem(TRACKING_STORAGE_KEY_BASE);
7441
+ clearSessionTracking();
7442
+ clearUserTracking();
7443
+ }
7444
+ } catch (e2) {
7445
+ }
7446
+ };
7447
+ const clearSessionTracking = () => {
7448
+ try {
7449
+ window.sessionStorage.removeItem(TRACKING_STORAGE_KEY);
7450
+ } catch (e2) {
7451
+ }
7452
+ };
7453
+ const initSessionTracking = () => {
7454
+ try {
7455
+ if (getSessionKey()) {
7456
+ return;
7457
+ }
7458
+ const key = getRandomString(TRACKING_KEY_LENGTH);
7459
+ window.sessionStorage.setItem(TRACKING_STORAGE_KEY, key);
7460
+ } catch (e2) {
7461
+ }
7462
+ };
7463
+ const initUserTracking = (userKey) => {
7464
+ try {
7465
+ if (getUserKey()) {
7466
+ return;
7467
+ }
7468
+ const key = userKey || getRandomString(TRACKING_KEY_LENGTH);
7469
+ window.localStorage.setItem(TRACKING_STORAGE_KEY, key);
7470
+ } catch (e2) {
7471
+ }
7472
+ };
7473
+ const clearUserTracking = () => {
7474
+ try {
7475
+ window.localStorage.removeItem(TRACKING_STORAGE_KEY);
7476
+ } catch (e2) {
7477
+ }
7478
+ };
7479
+ const isTrackingEnabled = () => {
7480
+ try {
7481
+ return Boolean(window.sessionStorage.getItem(TRACKING_STORAGE_KEY_BASE));
7482
+ } catch (e2) {
7483
+ return false;
7484
+ }
7485
+ };
7486
+ const isDelayedClickTracking = () => {
7487
+ try {
7488
+ return Boolean(window.localStorage.getItem(TRACKING_CLICK_DELAYED));
7489
+ } catch (e2) {
7490
+ return false;
7491
+ }
7492
+ };
7493
+ const getSessionKey = () => {
7494
+ var _a;
7495
+ try {
7496
+ return (_a = window.sessionStorage.getItem(TRACKING_STORAGE_KEY)) != null ? _a : void 0;
7497
+ } catch (e2) {
7498
+ return void 0;
7499
+ }
7500
+ };
7501
+ const getUserKey = () => {
7502
+ var _a;
7503
+ try {
7504
+ return (_a = window.localStorage.getItem(TRACKING_STORAGE_KEY)) != null ? _a : void 0;
7505
+ } catch (e2) {
7506
+ return void 0;
7507
+ }
7508
+ };
7509
+ const initTracking = (options) => {
7510
+ initBaseTracking(Boolean(options.trackBase));
7511
+ if (options.trackSession) {
7512
+ initSessionTracking();
7513
+ } else {
7514
+ clearSessionTracking();
7515
+ }
7516
+ if (options.trackUser) {
7517
+ initUserTracking(options.userKey);
7518
+ } else {
7519
+ clearUserTracking();
7520
+ }
7521
+ if (options.analytics) {
7522
+ initAnalyticsTracking(options.analytics);
7523
+ }
7524
+ if (options.delayedClickTracking) {
7525
+ window.localStorage.setItem(TRACKING_CLICK_DELAYED, "1");
7526
+ checkAndDispatchDelayedEvents();
7527
+ } else {
7528
+ window.localStorage.removeItem(TRACKING_CLICK_DELAYED);
7529
+ }
7530
+ };
7531
+ const getLupaTrackingContext = () => {
7532
+ if (!isTrackingEnabled()) {
7533
+ return {};
7534
+ }
7535
+ return {
7536
+ userId: getUserKey(),
7537
+ sessionId: getSessionKey()
7538
+ };
7539
+ };
7540
+ const trackLupaEvent = (queryKey, data = {}, options) => {
7541
+ var _a, _b;
7542
+ if (!queryKey || !data.type) {
7543
+ return;
7544
+ }
7545
+ const eventData = {
7546
+ searchQuery: (_a = data.searchQuery) != null ? _a : "",
7547
+ itemId: (_b = data.itemId) != null ? _b : "",
7548
+ name: data.type,
7549
+ userId: getUserKey(),
7550
+ sessionId: getSessionKey(),
7551
+ filters: data.filters
7552
+ };
7553
+ LupaSearchSdk.track(queryKey, eventData, options);
7554
+ };
7555
+ const sendGa = (name, ...args) => {
7556
+ window.ga(() => {
7557
+ const trackers = window.ga.getAll();
7558
+ const firstTracker = trackers[0];
7559
+ if (!firstTracker) {
7560
+ console.error("GA tracker not found");
7561
+ }
7562
+ const trackerName = firstTracker.get("name");
7563
+ window.ga(`${trackerName}.${name}`, ...args);
7564
+ });
7565
+ };
7566
+ const trackAnalyticsEvent = (data) => {
7567
+ var _a, _b, _c;
7568
+ try {
7569
+ const options = JSON.parse(
7570
+ (_a = window.sessionStorage.getItem(TRACKING_ANALYTICS_KEY)) != null ? _a : "{}"
7571
+ );
7572
+ if (!data.analytics || !options.enabled || ((_c = options.ignoreEvents) == null ? void 0 : _c.includes((_b = data.analytics) == null ? void 0 : _b.type))) {
7573
+ return;
7574
+ }
7575
+ switch (options.type) {
7576
+ case "ua":
7577
+ sendUaAnalyticsEvent(data, options);
7578
+ break;
7579
+ case "ga4":
7580
+ sendGa4AnalyticsEvent(data, options);
7581
+ break;
7582
+ case "debug":
7583
+ processDebugEvent(data);
7584
+ break;
7585
+ default:
7586
+ sendUaAnalyticsEvent(data, options);
7587
+ }
7588
+ } catch (e2) {
7589
+ console.error("Unable to send an event to google analytics");
7590
+ }
7591
+ };
7592
+ const parseEcommerceData = (data, title) => {
7593
+ var _a, _b;
7594
+ return ((_a = data.analytics) == null ? void 0 : _a.items) ? {
7595
+ item_list_name: title,
7596
+ items: (_b = data.analytics) == null ? void 0 : _b.items
7597
+ } : void 0;
7598
+ };
7599
+ const sendUaAnalyticsEvent = (data, options) => {
7600
+ var _a, _b, _c, _d;
7601
+ const ga = window.ga;
7602
+ if (!ga) {
7603
+ console.error("Google Analytics object not found");
7604
+ return;
7605
+ }
7606
+ sendGa(
7607
+ "send",
7608
+ "event",
7609
+ options.parentEventName,
7610
+ (_b = (_a = data.analytics) == null ? void 0 : _a.type) != null ? _b : "",
7611
+ (_d = (_c = data.analytics) == null ? void 0 : _c.label) != null ? _d : ""
7612
+ );
7613
+ };
7614
+ const sendGa4AnalyticsEvent = (data, options) => {
7615
+ var _a, _b, _c, _d, _e, _f, _g;
7616
+ if (!window || !window.dataLayer) {
7617
+ console.error("dataLayer object not found.");
7618
+ return;
7619
+ }
7620
+ const sendItemTitle = data.searchQuery !== ((_a = data.analytics) == null ? void 0 : _a.label);
7621
+ const title = sendItemTitle ? (_b = data.analytics) == null ? void 0 : _b.label : void 0;
7622
+ const params = __spreadValues2({
7623
+ search_text: data.searchQuery,
7624
+ item_title: title,
7625
+ item_id: data.itemId,
7626
+ ecommerce: parseEcommerceData(data, (_c = data.analytics) == null ? void 0 : _c.listLabel)
7627
+ }, (_e = (_d = data.analytics) == null ? void 0 : _d.additionalParams) != null ? _e : {});
7628
+ window.dataLayer.push(__spreadValues2({
7629
+ event: (_g = (_f = data.analytics) == null ? void 0 : _f.type) != null ? _g : options.parentEventName
7630
+ }, params));
7631
+ };
7632
+ const processDebugEvent = (data) => {
7633
+ var _a, _b, _c, _d;
7634
+ const sendItemTitle = data.searchQuery !== ((_a = data.analytics) == null ? void 0 : _a.label);
7635
+ const title = sendItemTitle ? (_b = data.analytics) == null ? void 0 : _b.label : void 0;
7636
+ const params = {
7637
+ event: (_c = data.analytics) == null ? void 0 : _c.type,
7638
+ search_text: data.searchQuery,
7639
+ item_title: title,
7640
+ item_id: data.itemId,
7641
+ ecommerce: parseEcommerceData(data, (_d = data.analytics) == null ? void 0 : _d.listLabel)
7642
+ };
7643
+ console.debug("Analytics debug event:", params);
7644
+ };
7645
+ const getDelayedEventsCache = () => {
7646
+ var _a;
7647
+ try {
7648
+ return JSON.parse((_a = window.localStorage.getItem(DELAYED_TRACKING_EVENTS_CACHE)) != null ? _a : "{}");
7649
+ } catch (e2) {
7650
+ return {};
7651
+ }
7652
+ };
7653
+ const storeDelayedEventCache = (cache) => {
7654
+ try {
7655
+ window.localStorage.setItem(DELAYED_TRACKING_EVENTS_CACHE, JSON.stringify(cache));
7656
+ } catch (e2) {
7657
+ }
7658
+ };
7659
+ const checkAndDispatchDelayedEvents = () => {
7660
+ var _a, _b;
7661
+ const optionsStore = useOptionsStore();
7662
+ const eventCache = getDelayedEventsCache();
7663
+ const urls = Object.keys(eventCache);
7664
+ for (const url of urls) {
7665
+ if ((_a = window.location.href) == null ? void 0 : _a.includes(url)) {
7666
+ const options = (_b = optionsStore.envOptions) != null ? _b : { environment: "production" };
7667
+ const { queryKey, data } = eventCache[url];
7668
+ track(queryKey, data, options);
7669
+ }
7670
+ }
7671
+ storeDelayedEventCache({});
7672
+ };
7673
+ const track = (queryKey, data = {}, options) => {
7674
+ var _a;
7675
+ if (!isTrackingEnabled()) {
7676
+ return;
7677
+ }
7678
+ const hasSearchQuery = data.searchQuery;
7679
+ if (!hasSearchQuery && !((_a = data.options) == null ? void 0 : _a.allowEmptySearchQuery)) {
7680
+ return;
7681
+ }
7682
+ trackAnalyticsEvent(data);
7683
+ trackLupaEvent(queryKey, data, options);
7684
+ };
7634
7685
  var DocumentElementType = /* @__PURE__ */ ((DocumentElementType2) => {
7635
7686
  DocumentElementType2["IMAGE"] = "image";
7636
7687
  DocumentElementType2["TITLE"] = "title";
@@ -7862,7 +7913,10 @@ var __async = (__this, __arguments, generator) => {
7862
7913
  if (!inputValue) {
7863
7914
  return escapeHtml$1(suggestion);
7864
7915
  }
7865
- return (_a = suggestion == null ? void 0 : suggestion.replace(inputValue, `<strong>${escapeHtml$1(inputValue)}</strong>`)) != null ? _a : "";
7916
+ return (_a = suggestion == null ? void 0 : suggestion.replace(
7917
+ inputValue == null ? void 0 : inputValue.toLocaleLowerCase(),
7918
+ `<strong>${escapeHtml$1(inputValue == null ? void 0 : inputValue.toLocaleLowerCase())}</strong>`
7919
+ )) != null ? _a : "";
7866
7920
  };
7867
7921
  const reverseKeyValue = (obj) => {
7868
7922
  return Object.fromEntries(Object.entries(obj).map(([k, v]) => [v, k.toLowerCase()]));
@@ -8080,14 +8134,16 @@ var __async = (__this, __arguments, generator) => {
8080
8134
  paramsToRemove: [getQueryParamName ? getQueryParamName(QUERY_PARAMS$1.PAGE) : QUERY_PARAMS$1.PAGE]
8081
8135
  });
8082
8136
  };
8137
+ const replaceHierarchyParam = (params = [], param = "") => {
8138
+ if (params.some((p2) => p2.startsWith(param))) {
8139
+ return toggleLastPram(params, param);
8140
+ }
8141
+ return [param];
8142
+ };
8083
8143
  const toggleHierarchyFilter = (appendParams, facetAction, getQueryParamName, currentFilters, removeAllLevels = false) => {
8084
- var _a;
8144
+ var _a, _b;
8085
8145
  const currentFilter = currentFilters == null ? void 0 : currentFilters[facetAction.key];
8086
- const newParams = toggleHierarchyParam(
8087
- (_a = currentFilter == null ? void 0 : currentFilter.terms) != null ? _a : [],
8088
- facetAction.value,
8089
- removeAllLevels
8090
- );
8146
+ 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);
8091
8147
  appendParams({
8092
8148
  params: [getFacetParam(facetAction.key, newParams, FACET_PARAMS_TYPE.HIERARCHY)],
8093
8149
  paramsToRemove: [getQueryParamName ? getQueryParamName(QUERY_PARAMS$1.PAGE) : QUERY_PARAMS$1.PAGE]
@@ -8430,6 +8486,7 @@ var __async = (__this, __arguments, generator) => {
8430
8486
  const highlightedIndex = ref(-1);
8431
8487
  const inputValue = ref("");
8432
8488
  const resultInputValue = ref("");
8489
+ const latestRequestIdByQueryKey = {};
8433
8490
  const historyStore = useHistoryStore();
8434
8491
  const resultsVisible = computed(() => {
8435
8492
  var _a;
@@ -8496,12 +8553,17 @@ var __async = (__this, __arguments, generator) => {
8496
8553
  }) {
8497
8554
  var _a;
8498
8555
  try {
8556
+ const currentRequestId = Date.now();
8557
+ latestRequestIdByQueryKey[queryKey] = currentRequestId;
8499
8558
  const context = getLupaTrackingContext();
8500
8559
  const result2 = yield LupaSearchSdk.suggestions(
8501
8560
  queryKey,
8502
8561
  __spreadValues2(__spreadValues2({}, publicQuery), context),
8503
8562
  options2
8504
8563
  );
8564
+ if (latestRequestIdByQueryKey[queryKey] !== currentRequestId) {
8565
+ return { suggestions: void 0 };
8566
+ }
8505
8567
  if (!result2.success) {
8506
8568
  return { suggestions: void 0 };
8507
8569
  }
@@ -8542,8 +8604,13 @@ var __async = (__this, __arguments, generator) => {
8542
8604
  options: options2
8543
8605
  }) {
8544
8606
  try {
8607
+ const currentRequestId = Date.now();
8608
+ latestRequestIdByQueryKey[queryKey] = currentRequestId;
8545
8609
  const context = getLupaTrackingContext();
8546
8610
  const result2 = yield LupaSearchSdk.query(queryKey, __spreadValues2(__spreadValues2({}, publicQuery), context), options2);
8611
+ if (latestRequestIdByQueryKey[queryKey] !== currentRequestId) {
8612
+ return { suggestions: void 0 };
8613
+ }
8547
8614
  if (!result2.success) {
8548
8615
  return { queryKey, result: { items: [] } };
8549
8616
  }
@@ -8598,7 +8665,7 @@ var __async = (__this, __arguments, generator) => {
8598
8665
  const _hoisted_1$1g = { id: "lupa-search-box-input-container" };
8599
8666
  const _hoisted_2$U = { class: "lupa-input-clear" };
8600
8667
  const _hoisted_3$D = { id: "lupa-search-box-input" };
8601
- const _hoisted_4$s = ["value"];
8668
+ const _hoisted_4$t = ["value"];
8602
8669
  const _hoisted_5$j = ["aria-label", "placeholder"];
8603
8670
  const _hoisted_6$9 = /* @__PURE__ */ createBaseVNode("span", { class: "lupa-search-submit-icon" }, null, -1);
8604
8671
  const _hoisted_7$7 = [
@@ -8705,7 +8772,7 @@ var __async = (__this, __arguments, generator) => {
8705
8772
  "aria-hidden": "true",
8706
8773
  value: showHint.value ? suggestedValue.value.item.suggestion : "",
8707
8774
  disabled: ""
8708
- }, null, 8, _hoisted_4$s),
8775
+ }, null, 8, _hoisted_4$t),
8709
8776
  withDirectives(createBaseVNode("input", mergeProps({
8710
8777
  "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => inputValue.value = $event)
8711
8778
  }, inputAttributes.value, {
@@ -8917,7 +8984,7 @@ var __async = (__this, __arguments, generator) => {
8917
8984
  class: "lupa-suggestion-facet",
8918
8985
  "data-cy": "lupa-suggestion-facet"
8919
8986
  };
8920
- const _hoisted_4$r = {
8987
+ const _hoisted_4$s = {
8921
8988
  class: "lupa-suggestion-facet-label",
8922
8989
  "data-cy": "lupa-suggestion-facet-label"
8923
8990
  };
@@ -8963,7 +9030,7 @@ var __async = (__this, __arguments, generator) => {
8963
9030
  innerHTML: _ctx.suggestion.displayHighlight
8964
9031
  }, null, 8, _hoisted_1$1c)) : (openBlock(), createElementBlock("div", _hoisted_2$S, toDisplayString(_ctx.suggestion.display), 1)),
8965
9032
  _ctx.suggestion.facet ? (openBlock(), createElementBlock("div", _hoisted_3$C, [
8966
- createBaseVNode("span", _hoisted_4$r, toDisplayString(facetLabel.value), 1),
9033
+ createBaseVNode("span", _hoisted_4$s, toDisplayString(facetLabel.value), 1),
8967
9034
  createBaseVNode("span", _hoisted_5$i, toDisplayString(_ctx.suggestion.facet.title), 1)
8968
9035
  ])) : createCommentVNode("", true)
8969
9036
  ]);
@@ -18479,7 +18546,7 @@ and ensure you are accounting for this risk.
18479
18546
  const _hoisted_1$16 = ["innerHTML"];
18480
18547
  const _hoisted_2$O = { key: 0 };
18481
18548
  const _hoisted_3$B = { key: 1 };
18482
- const _hoisted_4$q = { class: "lupa-search-box-custom-label" };
18549
+ const _hoisted_4$r = { class: "lupa-search-box-custom-label" };
18483
18550
  const _hoisted_5$h = { class: "lupa-search-box-custom-text" };
18484
18551
  const _sfc_main$1e = /* @__PURE__ */ defineComponent({
18485
18552
  __name: "SearchBoxProductCustom",
@@ -18512,7 +18579,7 @@ and ensure you are accounting for this risk.
18512
18579
  class: [className.value, "lupa-search-box-product-custom"]
18513
18580
  }, toHandlers(_ctx.options.action ? { click: handleClick } : {}, true)), [
18514
18581
  !label.value ? (openBlock(), createElementBlock("div", _hoisted_2$O, toDisplayString(text.value), 1)) : (openBlock(), createElementBlock("div", _hoisted_3$B, [
18515
- createBaseVNode("div", _hoisted_4$q, toDisplayString(label.value), 1),
18582
+ createBaseVNode("div", _hoisted_4$r, toDisplayString(label.value), 1),
18516
18583
  createBaseVNode("div", _hoisted_5$h, toDisplayString(text.value), 1)
18517
18584
  ]))
18518
18585
  ], 16));
@@ -18925,7 +18992,7 @@ and ensure you are accounting for this risk.
18925
18992
  const _hoisted_1$12 = { class: "lupa-badge-title" };
18926
18993
  const _hoisted_2$M = ["src"];
18927
18994
  const _hoisted_3$z = { key: 1 };
18928
- const _hoisted_4$p = {
18995
+ const _hoisted_4$q = {
18929
18996
  key: 0,
18930
18997
  class: "lupa-badge-full-text"
18931
18998
  };
@@ -18969,7 +19036,7 @@ and ensure you are accounting for this risk.
18969
19036
  }, null, 8, _hoisted_2$M)) : createCommentVNode("", true),
18970
19037
  hasTitleText.value && showTitle.value ? (openBlock(), createElementBlock("span", _hoisted_3$z, toDisplayString(_ctx.badge.titleText), 1)) : createCommentVNode("", true)
18971
19038
  ]),
18972
- hasAdditionalText.value ? (openBlock(), createElementBlock("span", _hoisted_4$p, toDisplayString(_ctx.badge.additionalText), 1)) : createCommentVNode("", true)
19039
+ hasAdditionalText.value ? (openBlock(), createElementBlock("span", _hoisted_4$q, toDisplayString(_ctx.badge.additionalText), 1)) : createCommentVNode("", true)
18973
19040
  ], 6);
18974
19041
  };
18975
19042
  }
@@ -19447,7 +19514,18 @@ and ensure you are accounting for this risk.
19447
19514
  options
19448
19515
  );
19449
19516
  };
19450
- return { trackSearch, trackResults, trackEvent };
19517
+ const trackDelayedEvent = ({
19518
+ queryKey,
19519
+ data,
19520
+ url
19521
+ }) => {
19522
+ let currentCache = getDelayedEventsCache();
19523
+ currentCache = __spreadProps2(__spreadValues2({}, currentCache), {
19524
+ [url]: { data, queryKey }
19525
+ });
19526
+ storeDelayedEventCache(currentCache);
19527
+ };
19528
+ return { trackSearch, trackResults, trackEvent, trackDelayedEvent };
19451
19529
  });
19452
19530
  const _hoisted_1$X = { id: "lupa-search-box-products" };
19453
19531
  const _sfc_main$12 = /* @__PURE__ */ defineComponent({
@@ -19491,7 +19569,7 @@ and ensure you are accounting for this risk.
19491
19569
  if (!props.panelOptions.idKey) {
19492
19570
  return;
19493
19571
  }
19494
- trackingStore.trackEvent({
19572
+ const trackableEvent = {
19495
19573
  queryKey: props.panelOptions.queryKey,
19496
19574
  data: {
19497
19575
  itemId: id,
@@ -19503,7 +19581,14 @@ and ensure you are accounting for this risk.
19503
19581
  items: [item]
19504
19582
  }
19505
19583
  }
19506
- });
19584
+ };
19585
+ if (isDelayedClickTracking()) {
19586
+ trackingStore.trackDelayedEvent(__spreadProps2(__spreadValues2({}, trackableEvent), {
19587
+ url: link
19588
+ }));
19589
+ } else {
19590
+ trackingStore.trackEvent(trackableEvent);
19591
+ }
19507
19592
  if (!link || eventType === "addToCart") {
19508
19593
  return;
19509
19594
  }
@@ -19769,7 +19854,7 @@ and ensure you are accounting for this risk.
19769
19854
  key: 0,
19770
19855
  class: "lupa-panel-title lupa-panel-title-top-results"
19771
19856
  };
19772
- const _hoisted_4$o = {
19857
+ const _hoisted_4$p = {
19773
19858
  key: 1,
19774
19859
  class: "lupa-panel-title"
19775
19860
  };
@@ -19963,7 +20048,7 @@ and ensure you are accounting for this risk.
19963
20048
  "data-cy": "lupa-panel-" + panel.type + "-index"
19964
20049
  }, [
19965
20050
  ((_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),
19966
- ((_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),
20051
+ ((_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),
19967
20052
  panel.queryKey && canShowPanel(panel) ? (openBlock(), createBlock(resolveDynamicComponent(getComponent(panel.type)), {
19968
20053
  key: 2,
19969
20054
  panel,
@@ -20229,7 +20314,7 @@ and ensure you are accounting for this risk.
20229
20314
  if (!doc2.queryKey || !doc2.doc) {
20230
20315
  return;
20231
20316
  }
20232
- trackingStore.trackEvent({
20317
+ const event = {
20233
20318
  queryKey: doc2.queryKey,
20234
20319
  data: {
20235
20320
  itemId: doc2.id,
@@ -20241,7 +20326,14 @@ and ensure you are accounting for this risk.
20241
20326
  items: [doc2]
20242
20327
  }
20243
20328
  }
20244
- });
20329
+ };
20330
+ if (isDelayedClickTracking()) {
20331
+ trackingStore.trackDelayedEvent(__spreadProps2(__spreadValues2({}, event), {
20332
+ url: generateLink(props.options.links.searchResults, doc2)
20333
+ }));
20334
+ } else {
20335
+ trackingStore.trackEvent(event);
20336
+ }
20245
20337
  };
20246
20338
  const trackSearchQuery = (query) => {
20247
20339
  if (!query) {
@@ -20402,7 +20494,7 @@ and ensure you are accounting for this risk.
20402
20494
  key: 1,
20403
20495
  "data-cy": "did-you-mean-label"
20404
20496
  };
20405
- const _hoisted_4$n = { key: 1 };
20497
+ const _hoisted_4$o = { key: 1 };
20406
20498
  const _sfc_main$Y = /* @__PURE__ */ defineComponent({
20407
20499
  __name: "SearchResultsDidYouMean",
20408
20500
  props: {
@@ -20453,7 +20545,7 @@ and ensure you are accounting for this risk.
20453
20545
  class: "lupa-did-you-mean lupa-highlighted-search-text",
20454
20546
  "data-cy": "did-you-mean-value",
20455
20547
  onClick: _cache[0] || (_cache[0] = ($event) => goToResults({ searchText: didYouMeanValue.value }))
20456
- }, toDisplayString(didYouMeanValue.value) + " ", 1)) : (openBlock(), createElementBlock("span", _hoisted_4$n, toDisplayString(label) + " ", 1))
20548
+ }, toDisplayString(didYouMeanValue.value) + " ", 1)) : (openBlock(), createElementBlock("span", _hoisted_4$o, toDisplayString(label) + " ", 1))
20457
20549
  ]);
20458
20550
  }), 128))
20459
20551
  ])) : createCommentVNode("", true)
@@ -20503,7 +20595,7 @@ and ensure you are accounting for this risk.
20503
20595
  key: 1,
20504
20596
  class: "lupa-results-total-count"
20505
20597
  };
20506
- const _hoisted_4$m = { class: "lupa-results-total-count-number" };
20598
+ const _hoisted_4$n = { class: "lupa-results-total-count-number" };
20507
20599
  const _hoisted_5$f = ["innerHTML"];
20508
20600
  const _sfc_main$W = /* @__PURE__ */ defineComponent({
20509
20601
  __name: "SearchResultsTitle",
@@ -20549,7 +20641,7 @@ and ensure you are accounting for this risk.
20549
20641
  queryText.value ? (openBlock(), createElementBlock("span", _hoisted_2$E, "'" + toDisplayString(queryText.value) + "'", 1)) : createCommentVNode("", true),
20550
20642
  showProductCount.value ? (openBlock(), createElementBlock("span", _hoisted_3$v, [
20551
20643
  createTextVNode("(" + toDisplayString(searchResultsCountLabel.value), 1),
20552
- createBaseVNode("span", _hoisted_4$m, toDisplayString(unref(totalItems)), 1),
20644
+ createBaseVNode("span", _hoisted_4$n, toDisplayString(unref(totalItems)), 1),
20553
20645
  createTextVNode(")")
20554
20646
  ])) : createCommentVNode("", true)
20555
20647
  ])) : createCommentVNode("", true),
@@ -20607,7 +20699,7 @@ and ensure you are accounting for this risk.
20607
20699
  key: 0,
20608
20700
  class: "filter-values"
20609
20701
  };
20610
- const _hoisted_4$l = { class: "lupa-current-filter-list" };
20702
+ const _hoisted_4$m = { class: "lupa-current-filter-list" };
20611
20703
  const _sfc_main$U = /* @__PURE__ */ defineComponent({
20612
20704
  __name: "CurrentFilters",
20613
20705
  props: {
@@ -20691,7 +20783,7 @@ and ensure you are accounting for this risk.
20691
20783
  }, null, 2)) : createCommentVNode("", true)
20692
20784
  ]),
20693
20785
  !_ctx.expandable || isOpen.value ? (openBlock(), createElementBlock("div", _hoisted_3$t, [
20694
- createBaseVNode("div", _hoisted_4$l, [
20786
+ createBaseVNode("div", _hoisted_4$m, [
20695
20787
  (openBlock(true), createElementBlock(Fragment, null, renderList(currentDisplayFilters.value, (filter2) => {
20696
20788
  return openBlock(), createBlock(_sfc_main$V, {
20697
20789
  key: filter2.key + "_" + filter2.value,
@@ -20759,7 +20851,7 @@ and ensure you are accounting for this risk.
20759
20851
  };
20760
20852
  const _hoisted_2$B = { class: "lupa-category-back" };
20761
20853
  const _hoisted_3$s = ["href"];
20762
- const _hoisted_4$k = ["href"];
20854
+ const _hoisted_4$l = ["href"];
20763
20855
  const _hoisted_5$e = { class: "lupa-child-category-list" };
20764
20856
  const _sfc_main$S = /* @__PURE__ */ defineComponent({
20765
20857
  __name: "CategoryFilter",
@@ -20866,7 +20958,7 @@ and ensure you are accounting for this risk.
20866
20958
  href: parentUrlLink.value,
20867
20959
  class: normalizeClass({ "lupa-title-category": !hasBackButton.value }),
20868
20960
  onClick: handleNavigationParent
20869
- }, toDisplayString(parentTitle.value), 11, _hoisted_4$k)
20961
+ }, toDisplayString(parentTitle.value), 11, _hoisted_4$l)
20870
20962
  ], 2),
20871
20963
  createBaseVNode("div", _hoisted_5$e, [
20872
20964
  (openBlock(true), createElementBlock(Fragment, null, renderList(categoryChildren.value, (child) => {
@@ -20887,7 +20979,7 @@ and ensure you are accounting for this risk.
20887
20979
  };
20888
20980
  const _hoisted_2$A = ["placeholder"];
20889
20981
  const _hoisted_3$r = { class: "lupa-terms-list" };
20890
- const _hoisted_4$j = ["onClick"];
20982
+ const _hoisted_4$k = ["onClick"];
20891
20983
  const _hoisted_5$d = { class: "lupa-term-checkbox-wrapper" };
20892
20984
  const _hoisted_6$8 = { class: "lupa-term-checkbox-label" };
20893
20985
  const _hoisted_7$6 = { class: "lupa-term-label" };
@@ -20995,7 +21087,7 @@ and ensure you are accounting for this risk.
20995
21087
  createBaseVNode("span", _hoisted_7$6, toDisplayString(item.title), 1),
20996
21088
  _ctx.options.showDocumentCount ? (openBlock(), createElementBlock("span", _hoisted_8$2, "(" + toDisplayString(item.count) + ")", 1)) : createCommentVNode("", true)
20997
21089
  ])
20998
- ], 10, _hoisted_4$j);
21090
+ ], 10, _hoisted_4$k);
20999
21091
  }), 128))
21000
21092
  ]),
21001
21093
  displayShowMore.value ? (openBlock(), createElementBlock("div", {
@@ -21995,7 +22087,7 @@ and ensure you are accounting for this risk.
21995
22087
  key: 1,
21996
22088
  class: "lupa-stats-facet-summary-input"
21997
22089
  };
21998
- const _hoisted_4$i = {
22090
+ const _hoisted_4$j = {
21999
22091
  key: 0,
22000
22092
  class: "lupa-stats-range-label"
22001
22093
  };
@@ -22059,8 +22151,12 @@ and ensure you are accounting for this risk.
22059
22151
  var _a;
22060
22152
  return Boolean((_a = props.options.stats) == null ? void 0 : _a.inputs);
22061
22153
  });
22154
+ const pricePrecision = computed(() => {
22155
+ var _a, _b;
22156
+ return (_b = (_a = props.options.stats) == null ? void 0 : _a.pricePrecisionDigits) != null ? _b : 2;
22157
+ });
22062
22158
  const fromValue = computed({
22063
- get: () => isPrice.value ? sliderRange.value[0].toFixed(2).replace(".", separator.value) : `${sliderRange.value[0]}`,
22159
+ get: () => isPrice.value ? sliderRange.value[0].toFixed(pricePrecision.value).replace(".", separator.value) : `${sliderRange.value[0]}`,
22064
22160
  set: (stringValue) => {
22065
22161
  let value = normalizeFloat(stringValue);
22066
22162
  if (value < facetMin.value) {
@@ -22074,7 +22170,7 @@ and ensure you are accounting for this risk.
22074
22170
  }
22075
22171
  });
22076
22172
  const toValue = computed({
22077
- get: () => isPrice.value ? sliderRange.value[1].toFixed(2).replace(".", separator.value) : `${sliderRange.value[1]}`,
22173
+ get: () => isPrice.value ? sliderRange.value[1].toFixed(pricePrecision.value).replace(".", separator.value) : `${sliderRange.value[1]}`,
22078
22174
  set: (stringValue) => {
22079
22175
  let value = normalizeFloat(stringValue);
22080
22176
  if (value > facetMax.value) {
@@ -22190,7 +22286,7 @@ and ensure you are accounting for this risk.
22190
22286
  return openBlock(), createElementBlock("div", _hoisted_1$L, [
22191
22287
  !isInputVisible.value ? (openBlock(), createElementBlock("div", _hoisted_2$z, toDisplayString(statsSummary.value), 1)) : (openBlock(), createElementBlock("div", _hoisted_3$q, [
22192
22288
  createBaseVNode("div", null, [
22193
- rangeLabelFrom.value ? (openBlock(), createElementBlock("div", _hoisted_4$i, toDisplayString(rangeLabelFrom.value), 1)) : createCommentVNode("", true),
22289
+ rangeLabelFrom.value ? (openBlock(), createElementBlock("div", _hoisted_4$j, toDisplayString(rangeLabelFrom.value), 1)) : createCommentVNode("", true),
22194
22290
  createBaseVNode("div", _hoisted_5$c, [
22195
22291
  withDirectives(createBaseVNode("input", {
22196
22292
  "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => fromValue.value = $event),
@@ -22257,7 +22353,7 @@ and ensure you are accounting for this risk.
22257
22353
  const _hoisted_1$K = { class: "lupa-term-checkbox-wrapper" };
22258
22354
  const _hoisted_2$y = { class: "lupa-term-checkbox-label" };
22259
22355
  const _hoisted_3$p = { class: "lupa-term-label" };
22260
- const _hoisted_4$h = {
22356
+ const _hoisted_4$i = {
22261
22357
  key: 0,
22262
22358
  class: "lupa-term-count"
22263
22359
  };
@@ -22318,7 +22414,7 @@ and ensure you are accounting for this risk.
22318
22414
  ]),
22319
22415
  createBaseVNode("div", _hoisted_2$y, [
22320
22416
  createBaseVNode("span", _hoisted_3$p, toDisplayString(_ctx.item.title) + toDisplayString(" "), 1),
22321
- _ctx.options.showDocumentCount ? (openBlock(), createElementBlock("span", _hoisted_4$h, "(" + toDisplayString(_ctx.item.count) + ")", 1)) : createCommentVNode("", true)
22417
+ _ctx.options.showDocumentCount ? (openBlock(), createElementBlock("span", _hoisted_4$i, "(" + toDisplayString(_ctx.item.count) + ")", 1)) : createCommentVNode("", true)
22322
22418
  ])
22323
22419
  ]),
22324
22420
  showChildren.value ? (openBlock(), createElementBlock("div", _hoisted_5$b, [
@@ -22383,15 +22479,20 @@ and ensure you are accounting for this risk.
22383
22479
  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);
22384
22480
  });
22385
22481
  const handleFacetClick = ({ value }) => {
22482
+ var _a, _b;
22386
22483
  emit2("select", {
22387
22484
  key: facet.value.key,
22388
22485
  value,
22389
- type: "hierarchy"
22486
+ type: "hierarchy",
22487
+ behavior: (_b = (_a = props.options.hierarchy) == null ? void 0 : _a.behavior) != null ? _b : "append"
22390
22488
  });
22391
22489
  };
22392
22490
  const handleShowAll = () => {
22393
22491
  showAll.value = true;
22394
22492
  };
22493
+ const handleCancelShowAll = () => {
22494
+ showAll.value = false;
22495
+ };
22395
22496
  return (_ctx, _cache) => {
22396
22497
  return openBlock(), createElementBlock("div", _hoisted_1$J, [
22397
22498
  isFilterable.value ? (openBlock(), createElementBlock("div", _hoisted_2$x, [
@@ -22420,7 +22521,11 @@ and ensure you are accounting for this risk.
22420
22521
  class: "lupa-facet-term lupa-show-more-facet-results",
22421
22522
  "data-cy": "lupa-facet-term",
22422
22523
  onClick: handleShowAll
22423
- }, toDisplayString(_ctx.options.labels.showAll), 1)) : createCommentVNode("", true)
22524
+ }, toDisplayString(_ctx.options.labels.showAll), 1)) : showAll.value ? (openBlock(), createElementBlock("div", {
22525
+ key: 2,
22526
+ class: "lupa-facet-term lupa-show-more-facet-results",
22527
+ onClick: handleCancelShowAll
22528
+ }, toDisplayString(_ctx.options.labels.showLess), 1)) : createCommentVNode("", true)
22424
22529
  ]);
22425
22530
  };
22426
22531
  }
@@ -22830,7 +22935,7 @@ and ensure you are accounting for this risk.
22830
22935
  };
22831
22936
  const _hoisted_2$t = ["onClick"];
22832
22937
  const _hoisted_3$n = { class: "lupa-mobile-sidebar-content" };
22833
- const _hoisted_4$g = { class: "lupa-sidebar-top" };
22938
+ const _hoisted_4$h = { class: "lupa-sidebar-top" };
22834
22939
  const _hoisted_5$a = { class: "lupa-sidebar-title" };
22835
22940
  const _hoisted_6$6 = {
22836
22941
  key: 0,
@@ -22874,7 +22979,7 @@ and ensure you are accounting for this risk.
22874
22979
  onClick: withModifiers(handleMobileToggle, ["stop"])
22875
22980
  }, null, 8, _hoisted_2$t),
22876
22981
  createBaseVNode("div", _hoisted_3$n, [
22877
- createBaseVNode("div", _hoisted_4$g, [
22982
+ createBaseVNode("div", _hoisted_4$h, [
22878
22983
  createBaseVNode("div", _hoisted_5$a, [
22879
22984
  createTextVNode(toDisplayString(sidebarTitle.value) + " ", 1),
22880
22985
  isFilterCountVisible.value ? (openBlock(), createElementBlock("span", _hoisted_6$6, toDisplayString(unref(currentFilterCount)), 1)) : createCommentVNode("", true)
@@ -22902,7 +23007,7 @@ and ensure you are accounting for this risk.
22902
23007
  key: 1,
22903
23008
  class: "lupa-search-results-breadcrumb-text"
22904
23009
  };
22905
- const _hoisted_4$f = { key: 2 };
23010
+ const _hoisted_4$g = { key: 2 };
22906
23011
  const _sfc_main$H = /* @__PURE__ */ defineComponent({
22907
23012
  __name: "SearchResultsBreadcrumbs",
22908
23013
  props: {
@@ -22943,7 +23048,7 @@ and ensure you are accounting for this risk.
22943
23048
  return handleNavigation(e2, (_a = breadcrumb == null ? void 0 : breadcrumb.link) != null ? _a : "");
22944
23049
  }
22945
23050
  }, toDisplayString(getLabel(breadcrumb.label)), 9, _hoisted_2$s)) : (openBlock(), createElementBlock("span", _hoisted_3$m, toDisplayString(getLabel(breadcrumb.label)), 1)),
22946
- index < breadcrumbsValue.value.length - 1 ? (openBlock(), createElementBlock("span", _hoisted_4$f, " / ")) : createCommentVNode("", true)
23051
+ index < breadcrumbsValue.value.length - 1 ? (openBlock(), createElementBlock("span", _hoisted_4$g, " / ")) : createCommentVNode("", true)
22947
23052
  ]);
22948
23053
  }), 128))
22949
23054
  ]);
@@ -23049,7 +23154,7 @@ and ensure you are accounting for this risk.
23049
23154
  class: "lupa-page-number-separator"
23050
23155
  };
23051
23156
  const _hoisted_3$l = ["onClick"];
23052
- const _hoisted_4$e = {
23157
+ const _hoisted_4$f = {
23053
23158
  key: 0,
23054
23159
  class: "lupa-page-number-separator"
23055
23160
  };
@@ -23155,7 +23260,7 @@ and ensure you are accounting for this risk.
23155
23260
  }, toDisplayString(page), 11, _hoisted_3$l);
23156
23261
  }), 128)),
23157
23262
  showLastPage.value ? (openBlock(), createElementBlock(Fragment, { key: 2 }, [
23158
- showLastPageSeparator.value ? (openBlock(), createElementBlock("div", _hoisted_4$e, "...")) : createCommentVNode("", true),
23263
+ showLastPageSeparator.value ? (openBlock(), createElementBlock("div", _hoisted_4$f, "...")) : createCommentVNode("", true),
23159
23264
  createBaseVNode("div", {
23160
23265
  class: "lupa-page-number lupa-page-number-last",
23161
23266
  onClick: _cache[2] || (_cache[2] = () => {
@@ -23180,7 +23285,7 @@ and ensure you are accounting for this risk.
23180
23285
  };
23181
23286
  const _hoisted_2$q = { id: "lupa-select" };
23182
23287
  const _hoisted_3$k = { class: "lupa-select-label" };
23183
- const _hoisted_4$d = ["aria-label"];
23288
+ const _hoisted_4$e = ["aria-label"];
23184
23289
  const _hoisted_5$9 = ["value"];
23185
23290
  const _sfc_main$C = /* @__PURE__ */ defineComponent({
23186
23291
  __name: "SearchResultsPageSize",
@@ -23227,7 +23332,7 @@ and ensure you are accounting for this risk.
23227
23332
  value: option
23228
23333
  }, toDisplayString(prefixLabel.value) + toDisplayString(option), 9, _hoisted_5$9);
23229
23334
  }), 128))
23230
- ], 40, _hoisted_4$d)
23335
+ ], 40, _hoisted_4$e)
23231
23336
  ])
23232
23337
  ]);
23233
23338
  };
@@ -23239,7 +23344,7 @@ and ensure you are accounting for this risk.
23239
23344
  };
23240
23345
  const _hoisted_2$p = { id: "lupa-select" };
23241
23346
  const _hoisted_3$j = { class: "lupa-select-label" };
23242
- const _hoisted_4$c = ["aria-label"];
23347
+ const _hoisted_4$d = ["aria-label"];
23243
23348
  const _hoisted_5$8 = ["value"];
23244
23349
  const _sfc_main$B = /* @__PURE__ */ defineComponent({
23245
23350
  __name: "SearchResultsSort",
@@ -23307,7 +23412,7 @@ and ensure you are accounting for this risk.
23307
23412
  value: option.key
23308
23413
  }, toDisplayString(option.label), 9, _hoisted_5$8);
23309
23414
  }), 128))
23310
- ], 40, _hoisted_4$c), [
23415
+ ], 40, _hoisted_4$d), [
23311
23416
  [vModelSelect, selectedKey.value]
23312
23417
  ])
23313
23418
  ])
@@ -23321,7 +23426,7 @@ and ensure you are accounting for this risk.
23321
23426
  class: "lupa-toolbar-right-title"
23322
23427
  };
23323
23428
  const _hoisted_3$i = { key: 2 };
23324
- const _hoisted_4$b = { key: 4 };
23429
+ const _hoisted_4$c = { key: 4 };
23325
23430
  const _hoisted_5$7 = { key: 6 };
23326
23431
  const _hoisted_6$5 = { class: "lupa-toolbar-right" };
23327
23432
  const _hoisted_7$3 = {
@@ -23445,7 +23550,7 @@ and ensure you are accounting for this risk.
23445
23550
  label: searchSummaryLabel.value,
23446
23551
  clearable: unref(hasAnyFilter) && showFilterClear.value,
23447
23552
  onClear: handleClearAll
23448
- }, null, 8, ["label", "clearable"])) : (openBlock(), createElementBlock("div", _hoisted_4$b)),
23553
+ }, null, 8, ["label", "clearable"])) : (openBlock(), createElementBlock("div", _hoisted_4$c)),
23449
23554
  displayPageSelect.value ? (openBlock(), createBlock(_sfc_main$D, {
23450
23555
  key: 5,
23451
23556
  options: paginationOptions.value.pageSelect,
@@ -23494,7 +23599,7 @@ and ensure you are accounting for this risk.
23494
23599
  const _hoisted_1$u = ["title", "innerHTML"];
23495
23600
  const _hoisted_2$n = ["title"];
23496
23601
  const _hoisted_3$h = ["href", "innerHTML"];
23497
- const _hoisted_4$a = ["title"];
23602
+ const _hoisted_4$b = ["title"];
23498
23603
  const _hoisted_5$6 = {
23499
23604
  key: 0,
23500
23605
  class: "lupa-search-results-product-title-text"
@@ -23562,7 +23667,7 @@ and ensure you are accounting for this risk.
23562
23667
  class: "lupa-search-results-product-title-text lupa-title-link",
23563
23668
  onClick: handleNavigation
23564
23669
  }, toDisplayString(title.value), 9, _hoisted_6$4)) : createCommentVNode("", true)
23565
- ], 12, _hoisted_4$a));
23670
+ ], 12, _hoisted_4$b));
23566
23671
  };
23567
23672
  }
23568
23673
  });
@@ -23605,7 +23710,7 @@ and ensure you are accounting for this risk.
23605
23710
  const _hoisted_1$s = { id: "lupa-search-results-rating" };
23606
23711
  const _hoisted_2$m = { class: "lupa-ratings" };
23607
23712
  const _hoisted_3$g = { class: "lupa-ratings-base" };
23608
- const _hoisted_4$9 = ["innerHTML"];
23713
+ const _hoisted_4$a = ["innerHTML"];
23609
23714
  const _hoisted_5$5 = { class: "lupa-rating-wrapper" };
23610
23715
  const _hoisted_6$3 = ["innerHTML"];
23611
23716
  const _hoisted_7$2 = ["href"];
@@ -23655,7 +23760,7 @@ and ensure you are accounting for this risk.
23655
23760
  key: index,
23656
23761
  innerHTML: star,
23657
23762
  class: "lupa-rating lupa-rating-not-highlighted"
23658
- }, null, 8, _hoisted_4$9);
23763
+ }, null, 8, _hoisted_4$a);
23659
23764
  }), 128))
23660
23765
  ]),
23661
23766
  createBaseVNode("div", _hoisted_5$5, [
@@ -23795,7 +23900,7 @@ and ensure you are accounting for this risk.
23795
23900
  const _hoisted_1$p = ["innerHTML"];
23796
23901
  const _hoisted_2$k = { key: 0 };
23797
23902
  const _hoisted_3$e = { key: 1 };
23798
- const _hoisted_4$8 = { class: "lupa-search-box-custom-label" };
23903
+ const _hoisted_4$9 = { class: "lupa-search-box-custom-label" };
23799
23904
  const _hoisted_5$4 = { class: "lupa-search-box-custom-text" };
23800
23905
  const _sfc_main$s = /* @__PURE__ */ defineComponent({
23801
23906
  __name: "SearchResultsProductCustom",
@@ -23840,7 +23945,7 @@ and ensure you are accounting for this risk.
23840
23945
  class: className.value
23841
23946
  }, toHandlers(_ctx.options.action ? { click: handleClick } : {}, true)), [
23842
23947
  !label.value ? (openBlock(), createElementBlock("div", _hoisted_2$k, toDisplayString(text.value), 1)) : (openBlock(), createElementBlock("div", _hoisted_3$e, [
23843
- createBaseVNode("div", _hoisted_4$8, toDisplayString(label.value), 1),
23948
+ createBaseVNode("div", _hoisted_4$9, toDisplayString(label.value), 1),
23844
23949
  createBaseVNode("div", _hoisted_5$4, toDisplayString(text.value), 1)
23845
23950
  ]))
23846
23951
  ], 16));
@@ -23886,7 +23991,7 @@ and ensure you are accounting for this risk.
23886
23991
  const _hoisted_1$n = { id: "lupa-search-results-rating" };
23887
23992
  const _hoisted_2$j = ["innerHTML"];
23888
23993
  const _hoisted_3$d = { class: "lupa-ratings" };
23889
- const _hoisted_4$7 = ["href"];
23994
+ const _hoisted_4$8 = ["href"];
23890
23995
  const _sfc_main$q = /* @__PURE__ */ defineComponent({
23891
23996
  __name: "SearchResultsProductSingleStarRating",
23892
23997
  props: {
@@ -23924,7 +24029,7 @@ and ensure you are accounting for this risk.
23924
24029
  createBaseVNode("a", {
23925
24030
  href: ratingLink.value,
23926
24031
  class: "lupa-total-ratings"
23927
- }, toDisplayString(totalRatings.value), 9, _hoisted_4$7)
24032
+ }, toDisplayString(totalRatings.value), 9, _hoisted_4$8)
23928
24033
  ]);
23929
24034
  };
23930
24035
  }
@@ -24019,12 +24124,13 @@ and ensure you are accounting for this risk.
24019
24124
  };
24020
24125
  }
24021
24126
  }));
24022
- const _hoisted_1$m = ["href"];
24023
- const _hoisted_2$i = {
24127
+ const _hoisted_1$m = ["onMouseup"];
24128
+ const _hoisted_2$i = ["href"];
24129
+ const _hoisted_3$c = {
24024
24130
  key: 0,
24025
24131
  class: "lupa-out-of-stock"
24026
24132
  };
24027
- const _hoisted_3$c = { class: "lupa-search-result-product-details-section" };
24133
+ const _hoisted_4$7 = { class: "lupa-search-result-product-details-section" };
24028
24134
  const _sfc_main$o = /* @__PURE__ */ defineComponent({
24029
24135
  __name: "SearchResultsProductCard",
24030
24136
  props: {
@@ -24128,7 +24234,7 @@ and ensure you are accounting for this risk.
24128
24234
  });
24129
24235
  const handleClick = () => {
24130
24236
  var _a, _b, _c, _d;
24131
- trackingStore.trackEvent({
24237
+ const event = {
24132
24238
  queryKey: props.options.queryKey,
24133
24239
  data: {
24134
24240
  itemId: id.value,
@@ -24141,9 +24247,15 @@ and ensure you are accounting for this risk.
24141
24247
  items: [props.product],
24142
24248
  itemId: id.value
24143
24249
  },
24144
- options: { allowEmptySearchQuery: true }
24250
+ options: { allowEmptySearchQuery: true },
24251
+ filters: searchResultStore.hasAnyFilter ? searchResultStore.filters : void 0
24145
24252
  }
24146
- });
24253
+ };
24254
+ if (isDelayedClickTracking()) {
24255
+ trackingStore.trackDelayedEvent(__spreadProps2(__spreadValues2({}, event), { url: link.value }));
24256
+ } else {
24257
+ trackingStore.trackEvent(event);
24258
+ }
24147
24259
  (_d = (_c = searchResultOptions.value.callbacks) == null ? void 0 : _c.onProductClick) == null ? void 0 : _d.call(_c, {
24148
24260
  queryKey: query.value,
24149
24261
  hasResults: true,
@@ -24176,7 +24288,10 @@ and ensure you are accounting for this risk.
24176
24288
  id: "lupa-search-result-product-card",
24177
24289
  "data-cy": "lupa-search-result-product-card",
24178
24290
  class: ["lupa-search-result-product-card", !isInStock.value ? "lupa-out-of-stock" : ""]
24179
- }, customDocumentHtmlAttributes.value, { onClick: handleClick }), [
24291
+ }, customDocumentHtmlAttributes.value, {
24292
+ onClick: handleClick,
24293
+ onMouseup: withModifiers(handleClick, ["middle", "exact"])
24294
+ }), [
24180
24295
  createVNode(_sfc_main$14, { options: badgesOptions.value }, null, 8, ["options"]),
24181
24296
  createBaseVNode("div", {
24182
24297
  class: normalizeClass(["lupa-search-result-product-contents", listLayoutClass.value])
@@ -24203,9 +24318,9 @@ and ensure you are accounting for this risk.
24203
24318
  position: "image",
24204
24319
  class: "lupa-image-badges"
24205
24320
  }, null, 8, ["options"]),
24206
- ((_a = labels.value) == null ? void 0 : _a.outOfStock) && !isInStock.value ? (openBlock(), createElementBlock("div", _hoisted_2$i, toDisplayString(labels.value.outOfStock), 1)) : createCommentVNode("", true)
24207
- ], 8, _hoisted_1$m),
24208
- createBaseVNode("div", _hoisted_3$c, [
24321
+ ((_a = labels.value) == null ? void 0 : _a.outOfStock) && !isInStock.value ? (openBlock(), createElementBlock("div", _hoisted_3$c, toDisplayString(labels.value.outOfStock), 1)) : createCommentVNode("", true)
24322
+ ], 8, _hoisted_2$i),
24323
+ createBaseVNode("div", _hoisted_4$7, [
24209
24324
  (openBlock(true), createElementBlock(Fragment, null, renderList(detailElements.value, (element) => {
24210
24325
  return openBlock(), createBlock(_sfc_main$p, {
24211
24326
  class: "lupa-search-results-product-element",
@@ -24239,7 +24354,7 @@ and ensure you are accounting for this risk.
24239
24354
  ], 2);
24240
24355
  }), 128))
24241
24356
  ], 2)
24242
- ], 16);
24357
+ ], 16, _hoisted_1$m);
24243
24358
  };
24244
24359
  }
24245
24360
  });
@@ -24377,6 +24492,7 @@ and ensure you are accounting for this risk.
24377
24492
  });
24378
24493
  };
24379
24494
  const handleQueryChange = () => {
24495
+ showAll.value = false;
24380
24496
  const context = getLupaTrackingContext();
24381
24497
  const queryBody = __spreadProps2(__spreadValues2({}, context), {
24382
24498
  limit: props.panel.totalCountLimit,
@@ -24611,7 +24727,6 @@ and ensure you are accounting for this risk.
24611
24727
  watch(
24612
24728
  () => props.query,
24613
24729
  () => {
24614
- console.log("query changed", props.query);
24615
24730
  searchForRelatedQuery();
24616
24731
  }
24617
24732
  );