@getlupa/client 1.15.13 → 1.15.16

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.
@@ -18,6 +18,18 @@ var __spreadValues = (a, b) => {
18
18
  return a;
19
19
  };
20
20
  var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
21
+ var __objRest = (source, exclude) => {
22
+ var target = {};
23
+ for (var prop in source)
24
+ if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
25
+ target[prop] = source[prop];
26
+ if (source != null && __getOwnPropSymbols)
27
+ for (var prop of __getOwnPropSymbols(source)) {
28
+ if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
29
+ target[prop] = source[prop];
30
+ }
31
+ return target;
32
+ };
21
33
  var __async = (__this, __arguments, generator) => {
22
34
  return new Promise((resolve, reject) => {
23
35
  var fulfilled = (value) => {
@@ -6406,7 +6418,7 @@ var __async = (__this, __arguments, generator) => {
6406
6418
  return a;
6407
6419
  };
6408
6420
  var __spreadProps2 = (a, b) => __defProps2(a, __getOwnPropDescs2(b));
6409
- var __objRest = (source, exclude) => {
6421
+ var __objRest2 = (source, exclude) => {
6410
6422
  var target = {};
6411
6423
  for (var prop in source)
6412
6424
  if (__hasOwnProp2.call(source, prop) && exclude.indexOf(prop) < 0)
@@ -7339,6 +7351,7 @@ var __async = (__this, __arguments, generator) => {
7339
7351
  );
7340
7352
  const trackingOptions = ref({});
7341
7353
  const searchResultInitialFilters = ref({});
7354
+ const productRecommendationOptions = ref({});
7342
7355
  const screenStore = useScreenStore();
7343
7356
  const envOptions = computed(
7344
7357
  () => {
@@ -7399,6 +7412,11 @@ var __async = (__this, __arguments, generator) => {
7399
7412
  const setInitialFilters = ({ initialFilters: initialFilters2 }) => {
7400
7413
  searchResultInitialFilters.value = initialFilters2;
7401
7414
  };
7415
+ const setProductRecommendationOptions = ({
7416
+ options
7417
+ }) => {
7418
+ productRecommendationOptions.value = options;
7419
+ };
7402
7420
  const getQueryParamName = (param) => {
7403
7421
  var _a;
7404
7422
  const nameMap = searchBoxOptions.value.queryParameterNames;
@@ -7415,10 +7433,12 @@ var __async = (__this, __arguments, generator) => {
7415
7433
  searchResultsRoutingBehavior,
7416
7434
  defaultSearchResultPageSize,
7417
7435
  currentResolutionPageSizes,
7436
+ productRecommendationOptions,
7418
7437
  setSearchBoxOptions,
7419
7438
  setTrackingOptions,
7420
7439
  setSearchResultOptions,
7421
7440
  setInitialFilters,
7441
+ setProductRecommendationOptions,
7422
7442
  getQueryParamName
7423
7443
  };
7424
7444
  });
@@ -7506,7 +7526,7 @@ var __async = (__this, __arguments, generator) => {
7506
7526
  return void 0;
7507
7527
  }
7508
7528
  };
7509
- const initTracking = (options) => {
7529
+ const initTracking$1 = (options) => {
7510
7530
  initBaseTracking(Boolean(options.trackBase));
7511
7531
  if (options.trackSession) {
7512
7532
  initSessionTracking();
@@ -7548,7 +7568,9 @@ var __async = (__this, __arguments, generator) => {
7548
7568
  name: data.type,
7549
7569
  userId: getUserKey(),
7550
7570
  sessionId: getSessionKey(),
7551
- filters: data.filters
7571
+ filters: data.filters,
7572
+ metadata: data.metadata,
7573
+ sourceItemId: data.sourceItemId
7552
7574
  };
7553
7575
  LupaSearchSdk.track(queryKey, eventData, options);
7554
7576
  };
@@ -14883,7 +14905,7 @@ var __async = (__this, __arguments, generator) => {
14883
14905
  function fromJSON$1(json, inputs) {
14884
14906
  if (Array.isArray(json))
14885
14907
  return json.map((n) => fromJSON$1(n));
14886
- let _a = json, { inputs: ownInputs } = _a, defaults = __objRest(_a, ["inputs"]);
14908
+ let _a = json, { inputs: ownInputs } = _a, defaults = __objRest2(_a, ["inputs"]);
14887
14909
  if (ownInputs) {
14888
14910
  inputs = [];
14889
14911
  for (let input2 of ownInputs) {
@@ -14900,7 +14922,7 @@ var __async = (__this, __arguments, generator) => {
14900
14922
  defaults.nodes = json.nodes.map((n) => fromJSON$1(n, inputs));
14901
14923
  }
14902
14924
  if (defaults.source) {
14903
- let _b = defaults.source, { inputId } = _b, source = __objRest(_b, ["inputId"]);
14925
+ let _b = defaults.source, { inputId } = _b, source = __objRest2(_b, ["inputId"]);
14904
14926
  defaults.source = source;
14905
14927
  if (inputId != null) {
14906
14928
  defaults.source.input = inputs[inputId];
@@ -18978,7 +19000,7 @@ and ensure you are accounting for this risk.
18978
19000
  });
18979
19001
  const displayElement = computed(() => {
18980
19002
  const element = props.element;
18981
- const item = props.item;
19003
+ const item = enhancedItem.value;
18982
19004
  if (!element.display) {
18983
19005
  return true;
18984
19006
  }
@@ -24261,7 +24283,8 @@ and ensure you are accounting for this risk.
24261
24283
  options: {},
24262
24284
  isAdditionalPanel: { type: Boolean },
24263
24285
  clickTrackingSettings: {},
24264
- lupaClickTrackingType: {}
24286
+ lupaClickTrackingType: {},
24287
+ sourceItemId: {}
24265
24288
  },
24266
24289
  setup(__props) {
24267
24290
  const props = __props;
@@ -24274,7 +24297,7 @@ and ensure you are accounting for this risk.
24274
24297
  const paramsStore = useParamsStore();
24275
24298
  const trackingStore = useTrackingStore();
24276
24299
  const { layout } = storeToRefs(searchResultStore);
24277
- const { searchResultsRoutingBehavior, searchResultOptions, trackingOptions } = storeToRefs(optionsStore);
24300
+ const { searchResultsRoutingBehavior, searchResultOptions, productRecommendationOptions } = storeToRefs(optionsStore);
24278
24301
  const { query } = storeToRefs(paramsStore);
24279
24302
  const isInStock = ref(true);
24280
24303
  const listLayoutClass = computed(() => {
@@ -24371,7 +24394,8 @@ and ensure you are accounting for this risk.
24371
24394
  itemId: id.value
24372
24395
  },
24373
24396
  options: { allowEmptySearchQuery: true },
24374
- filters: searchResultStore.hasAnyFilter ? searchResultStore.filters : void 0
24397
+ filters: searchResultStore.hasAnyFilter ? searchResultStore.filters : void 0,
24398
+ sourceItemId: props.lupaClickTrackingType === "recommendedItemClick" ? props.sourceItemId : void 0
24375
24399
  }
24376
24400
  };
24377
24401
  if (isDelayedClickTracking()) {
@@ -25035,7 +25059,8 @@ and ensure you are accounting for this risk.
25035
25059
  relatedQueries.value = queries;
25036
25060
  }));
25037
25061
  const hasEnoughRelatedQueries = computed(() => {
25038
- return relatedQueries.value.length > 1;
25062
+ var _a;
25063
+ return ((_a = relatedQueries.value) == null ? void 0 : _a.length) > 1;
25039
25064
  });
25040
25065
  const handleRelatedQueryClick = (query) => {
25041
25066
  var _a;
@@ -32179,6 +32204,9 @@ and ensure you are accounting for this risk.
32179
32204
  optionsStore.setSearchResultOptions({
32180
32205
  options: props.options
32181
32206
  });
32207
+ optionsStore.setProductRecommendationOptions({
32208
+ options: props.options
32209
+ });
32182
32210
  if (props.options.lazyLoad) {
32183
32211
  initIntersectionObserver();
32184
32212
  } else {
@@ -32283,8 +32311,10 @@ and ensure you are accounting for this risk.
32283
32311
  createVNode(_sfc_main$p, {
32284
32312
  product,
32285
32313
  options: _ctx.options,
32286
- "click-tracking-settings": clickTrackingSettings.value
32287
- }, null, 8, ["product", "options", "click-tracking-settings"])
32314
+ "click-tracking-settings": clickTrackingSettings.value,
32315
+ "lupa-click-tracking-type": `recommendedItemClick`,
32316
+ "source-item-id": itemId.value
32317
+ }, null, 8, ["product", "options", "click-tracking-settings", "source-item-id"])
32288
32318
  ]),
32289
32319
  _: 2
32290
32320
  }, 1024);
@@ -32298,8 +32328,9 @@ and ensure you are accounting for this risk.
32298
32328
  key: getProductKeyAction(index, product),
32299
32329
  product,
32300
32330
  options: _ctx.options,
32301
- "lupa-click-tracking-type": `recommendedItemClick`
32302
- }, null, 8, ["style", "product", "options"]);
32331
+ "lupa-click-tracking-type": `recommendedItemClick`,
32332
+ "source-item-id": itemId.value
32333
+ }, null, 8, ["style", "product", "options", "source-item-id"]);
32303
32334
  }), 128))
32304
32335
  ]))
32305
32336
  ])) : createCommentVNode("", true)
@@ -33037,7 +33068,7 @@ and ensure you are accounting for this risk.
33037
33068
  const setupTracking = (options) => {
33038
33069
  const pinia = initPinia();
33039
33070
  const store = useOptionsStore(pinia);
33040
- initTracking(options);
33071
+ initTracking$1(options);
33041
33072
  store.setTrackingOptions({ options });
33042
33073
  };
33043
33074
  const displayDiscountedPriceSection = (doc2, options) => {
@@ -39663,6 +39694,49 @@ and ensure you are accounting for this risk.
39663
39694
  return null;
39664
39695
  }
39665
39696
  };
39697
+ const mergeSearchBoxConfiguration = (options, overrides) => {
39698
+ var _a, _b, _c;
39699
+ for (const panel of (_a = options.panels) != null ? _a : []) {
39700
+ if (panel.type !== SearchBoxPanelType.DOCUMENT) {
39701
+ continue;
39702
+ }
39703
+ const overridePanel = (_b = overrides.panels) == null ? void 0 : _b.find((p2) => p2.queryKey === panel.queryKey);
39704
+ if (!overridePanel || overridePanel.type !== SearchBoxPanelType.DOCUMENT || !overridePanel) {
39705
+ continue;
39706
+ }
39707
+ panel.elements = (_c = panel.elements) == null ? void 0 : _c.map((element) => {
39708
+ var _a2;
39709
+ const overrideElement = (_a2 = overridePanel == null ? void 0 : overridePanel.elements) == null ? void 0 : _a2.find((e2) => e2.key === element.key);
39710
+ if (!overrideElement) {
39711
+ return element;
39712
+ }
39713
+ return __spreadValues(__spreadValues({}, element), overrideElement);
39714
+ });
39715
+ }
39716
+ const _d = overrides, { panels } = _d, overridesWithoutPanels = __objRest(_d, ["panels"]);
39717
+ return merge(options, overridesWithoutPanels);
39718
+ };
39719
+ const mergeSearchResultsConfiguration = (options, overrides) => {
39720
+ var _a;
39721
+ if (!overrides.elements) {
39722
+ return merge(options, overrides);
39723
+ }
39724
+ const elements = (_a = options.elements) == null ? void 0 : _a.map((element) => {
39725
+ var _a2;
39726
+ const overrideElement = (_a2 = overrides.elements) == null ? void 0 : _a2.find((e2) => e2.key === element.key);
39727
+ if (!overrideElement) {
39728
+ return element;
39729
+ }
39730
+ return __spreadValues(__spreadValues({}, element), overrideElement);
39731
+ });
39732
+ options.elements = elements;
39733
+ const _b = overrides, { elements: _ } = _b, overridesWithoutElements = __objRest(_b, ["elements"]);
39734
+ return merge(options, overridesWithoutElements);
39735
+ };
39736
+ const PluginConfigurationMerger = {
39737
+ mergeSearchBoxConfiguration,
39738
+ mergeSearchResultsConfiguration
39739
+ };
39666
39740
  const PREVIEW_PARAMETER = "lupaSearchPreview";
39667
39741
  const MAX_ELEMENT_MOUNT_RETRIES = 25;
39668
39742
  let styleElement = null;
@@ -39758,7 +39832,10 @@ and ensure you are accounting for this risk.
39758
39832
  );
39759
39833
  return;
39760
39834
  }
39761
- const mergedOptions = merge(resolvedConfiguration, (_a = optionOverrides == null ? void 0 : optionOverrides.searchBox) != null ? _a : {});
39835
+ const mergedOptions = PluginConfigurationMerger.mergeSearchBoxConfiguration(
39836
+ resolvedConfiguration,
39837
+ (_a = optionOverrides == null ? void 0 : optionOverrides.searchBox) != null ? _a : {}
39838
+ );
39762
39839
  searchBox(__spreadProps(__spreadValues({}, mergedOptions), { options }), { fetch: fetch2, allowedMountUrls });
39763
39840
  });
39764
39841
  const mountSearchResults = (configuration, options, optionOverrides, fetch2 = true, remount = false) => __async(this, null, function* () {
@@ -39779,7 +39856,10 @@ and ensure you are accounting for this risk.
39779
39856
  );
39780
39857
  return;
39781
39858
  }
39782
- const mergedOptions = merge(resolvedConfiguration, (_a = optionOverrides == null ? void 0 : optionOverrides.searchResults) != null ? _a : {});
39859
+ const mergedOptions = PluginConfigurationMerger.mergeSearchResultsConfiguration(
39860
+ resolvedConfiguration,
39861
+ (_a = optionOverrides == null ? void 0 : optionOverrides.searchResults) != null ? _a : {}
39862
+ );
39783
39863
  searchResults(__spreadProps(__spreadValues({}, mergedOptions), { options }), { fetch: fetch2, allowedMountUrls });
39784
39864
  });
39785
39865
  const mountProductList = (configuration, options, optionOverrides, fetch2 = true, remount = false) => __async(this, null, function* () {
@@ -39863,6 +39943,16 @@ and ensure you are accounting for this risk.
39863
39943
  { fetch: fetch2, allowedMountUrls }
39864
39944
  );
39865
39945
  });
39946
+ const initTracking = (configuration) => __async(this, null, function* () {
39947
+ let trackingOptions = { trackBase: false };
39948
+ if (configuration.tracking) {
39949
+ const resolvedConfiguration = JSON.parse(configuration.tracking);
39950
+ if (resolvedConfiguration.trackBase) {
39951
+ trackingOptions = resolvedConfiguration;
39952
+ }
39953
+ }
39954
+ setupTracking(trackingOptions);
39955
+ });
39866
39956
  const mount = (_0, ..._1) => __async(this, [_0, ..._1], function* (configuration, options = { environment: "production" }, optionOverrides = {}, fetch2 = true, remount = false) {
39867
39957
  yield applyStyles(configuration);
39868
39958
  const mountPromises = [
@@ -39873,6 +39963,7 @@ and ensure you are accounting for this risk.
39873
39963
  mountChat(configuration, options, fetch2, remount)
39874
39964
  ];
39875
39965
  yield Promise.all(mountPromises);
39966
+ initTracking(configuration);
39876
39967
  });
39877
39968
  const init$1 = (_0, ..._1) => __async(this, [_0, ..._1], function* (configurationKey, options = { environment: "production" }, optionOverrides = {}) {
39878
39969
  var _a;
@@ -18,6 +18,18 @@ var __spreadValues = (a, b) => {
18
18
  return a;
19
19
  };
20
20
  var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
21
+ var __objRest = (source, exclude) => {
22
+ var target = {};
23
+ for (var prop in source)
24
+ if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
25
+ target[prop] = source[prop];
26
+ if (source != null && __getOwnPropSymbols)
27
+ for (var prop of __getOwnPropSymbols(source)) {
28
+ if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
29
+ target[prop] = source[prop];
30
+ }
31
+ return target;
32
+ };
21
33
  var __async = (__this, __arguments, generator) => {
22
34
  return new Promise((resolve2, reject) => {
23
35
  var fulfilled = (value) => {
@@ -6406,7 +6418,7 @@ var __spreadValues2 = (a, b) => {
6406
6418
  return a;
6407
6419
  };
6408
6420
  var __spreadProps2 = (a, b) => __defProps2(a, __getOwnPropDescs2(b));
6409
- var __objRest = (source, exclude) => {
6421
+ var __objRest2 = (source, exclude) => {
6410
6422
  var target = {};
6411
6423
  for (var prop in source)
6412
6424
  if (__hasOwnProp2.call(source, prop) && exclude.indexOf(prop) < 0)
@@ -7339,6 +7351,7 @@ const useOptionsStore = defineStore("options", () => {
7339
7351
  );
7340
7352
  const trackingOptions = ref({});
7341
7353
  const searchResultInitialFilters = ref({});
7354
+ const productRecommendationOptions = ref({});
7342
7355
  const screenStore = useScreenStore();
7343
7356
  const envOptions = computed(
7344
7357
  () => {
@@ -7399,6 +7412,11 @@ const useOptionsStore = defineStore("options", () => {
7399
7412
  const setInitialFilters = ({ initialFilters: initialFilters2 }) => {
7400
7413
  searchResultInitialFilters.value = initialFilters2;
7401
7414
  };
7415
+ const setProductRecommendationOptions = ({
7416
+ options
7417
+ }) => {
7418
+ productRecommendationOptions.value = options;
7419
+ };
7402
7420
  const getQueryParamName = (param) => {
7403
7421
  var _a;
7404
7422
  const nameMap = searchBoxOptions.value.queryParameterNames;
@@ -7415,10 +7433,12 @@ const useOptionsStore = defineStore("options", () => {
7415
7433
  searchResultsRoutingBehavior,
7416
7434
  defaultSearchResultPageSize,
7417
7435
  currentResolutionPageSizes,
7436
+ productRecommendationOptions,
7418
7437
  setSearchBoxOptions,
7419
7438
  setTrackingOptions,
7420
7439
  setSearchResultOptions,
7421
7440
  setInitialFilters,
7441
+ setProductRecommendationOptions,
7422
7442
  getQueryParamName
7423
7443
  };
7424
7444
  });
@@ -7506,7 +7526,7 @@ const getUserKey = () => {
7506
7526
  return void 0;
7507
7527
  }
7508
7528
  };
7509
- const initTracking = (options) => {
7529
+ const initTracking$1 = (options) => {
7510
7530
  initBaseTracking(Boolean(options.trackBase));
7511
7531
  if (options.trackSession) {
7512
7532
  initSessionTracking();
@@ -7548,7 +7568,9 @@ const trackLupaEvent = (queryKey, data = {}, options) => {
7548
7568
  name: data.type,
7549
7569
  userId: getUserKey(),
7550
7570
  sessionId: getSessionKey(),
7551
- filters: data.filters
7571
+ filters: data.filters,
7572
+ metadata: data.metadata,
7573
+ sourceItemId: data.sourceItemId
7552
7574
  };
7553
7575
  LupaSearchSdk.track(queryKey, eventData, options);
7554
7576
  };
@@ -14883,7 +14905,7 @@ let Rule$2 = rule;
14883
14905
  function fromJSON$1(json, inputs) {
14884
14906
  if (Array.isArray(json))
14885
14907
  return json.map((n) => fromJSON$1(n));
14886
- let _a = json, { inputs: ownInputs } = _a, defaults = __objRest(_a, ["inputs"]);
14908
+ let _a = json, { inputs: ownInputs } = _a, defaults = __objRest2(_a, ["inputs"]);
14887
14909
  if (ownInputs) {
14888
14910
  inputs = [];
14889
14911
  for (let input2 of ownInputs) {
@@ -14900,7 +14922,7 @@ function fromJSON$1(json, inputs) {
14900
14922
  defaults.nodes = json.nodes.map((n) => fromJSON$1(n, inputs));
14901
14923
  }
14902
14924
  if (defaults.source) {
14903
- let _b = defaults.source, { inputId } = _b, source = __objRest(_b, ["inputId"]);
14925
+ let _b = defaults.source, { inputId } = _b, source = __objRest2(_b, ["inputId"]);
14904
14926
  defaults.source = source;
14905
14927
  if (inputId != null) {
14906
14928
  defaults.source.input = inputs[inputId];
@@ -18978,7 +19000,7 @@ const _sfc_main$1c = /* @__PURE__ */ defineComponent(__spreadProps2(__spreadValu
18978
19000
  });
18979
19001
  const displayElement = computed(() => {
18980
19002
  const element = props.element;
18981
- const item = props.item;
19003
+ const item = enhancedItem.value;
18982
19004
  if (!element.display) {
18983
19005
  return true;
18984
19006
  }
@@ -24261,7 +24283,8 @@ const _sfc_main$p = /* @__PURE__ */ defineComponent({
24261
24283
  options: {},
24262
24284
  isAdditionalPanel: { type: Boolean },
24263
24285
  clickTrackingSettings: {},
24264
- lupaClickTrackingType: {}
24286
+ lupaClickTrackingType: {},
24287
+ sourceItemId: {}
24265
24288
  },
24266
24289
  setup(__props) {
24267
24290
  const props = __props;
@@ -24274,7 +24297,7 @@ const _sfc_main$p = /* @__PURE__ */ defineComponent({
24274
24297
  const paramsStore = useParamsStore();
24275
24298
  const trackingStore = useTrackingStore();
24276
24299
  const { layout } = storeToRefs(searchResultStore);
24277
- const { searchResultsRoutingBehavior, searchResultOptions, trackingOptions } = storeToRefs(optionsStore);
24300
+ const { searchResultsRoutingBehavior, searchResultOptions, productRecommendationOptions } = storeToRefs(optionsStore);
24278
24301
  const { query } = storeToRefs(paramsStore);
24279
24302
  const isInStock = ref(true);
24280
24303
  const listLayoutClass = computed(() => {
@@ -24371,7 +24394,8 @@ const _sfc_main$p = /* @__PURE__ */ defineComponent({
24371
24394
  itemId: id.value
24372
24395
  },
24373
24396
  options: { allowEmptySearchQuery: true },
24374
- filters: searchResultStore.hasAnyFilter ? searchResultStore.filters : void 0
24397
+ filters: searchResultStore.hasAnyFilter ? searchResultStore.filters : void 0,
24398
+ sourceItemId: props.lupaClickTrackingType === "recommendedItemClick" ? props.sourceItemId : void 0
24375
24399
  }
24376
24400
  };
24377
24401
  if (isDelayedClickTracking()) {
@@ -25035,7 +25059,8 @@ const _sfc_main$i = /* @__PURE__ */ defineComponent({
25035
25059
  relatedQueries.value = queries;
25036
25060
  }));
25037
25061
  const hasEnoughRelatedQueries = computed(() => {
25038
- return relatedQueries.value.length > 1;
25062
+ var _a;
25063
+ return ((_a = relatedQueries.value) == null ? void 0 : _a.length) > 1;
25039
25064
  });
25040
25065
  const handleRelatedQueryClick = (query) => {
25041
25066
  var _a;
@@ -32179,6 +32204,9 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
32179
32204
  optionsStore.setSearchResultOptions({
32180
32205
  options: props.options
32181
32206
  });
32207
+ optionsStore.setProductRecommendationOptions({
32208
+ options: props.options
32209
+ });
32182
32210
  if (props.options.lazyLoad) {
32183
32211
  initIntersectionObserver();
32184
32212
  } else {
@@ -32283,8 +32311,10 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
32283
32311
  createVNode(_sfc_main$p, {
32284
32312
  product,
32285
32313
  options: _ctx.options,
32286
- "click-tracking-settings": clickTrackingSettings.value
32287
- }, null, 8, ["product", "options", "click-tracking-settings"])
32314
+ "click-tracking-settings": clickTrackingSettings.value,
32315
+ "lupa-click-tracking-type": `recommendedItemClick`,
32316
+ "source-item-id": itemId.value
32317
+ }, null, 8, ["product", "options", "click-tracking-settings", "source-item-id"])
32288
32318
  ]),
32289
32319
  _: 2
32290
32320
  }, 1024);
@@ -32298,8 +32328,9 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
32298
32328
  key: getProductKeyAction(index, product),
32299
32329
  product,
32300
32330
  options: _ctx.options,
32301
- "lupa-click-tracking-type": `recommendedItemClick`
32302
- }, null, 8, ["style", "product", "options"]);
32331
+ "lupa-click-tracking-type": `recommendedItemClick`,
32332
+ "source-item-id": itemId.value
32333
+ }, null, 8, ["style", "product", "options", "source-item-id"]);
32303
32334
  }), 128))
32304
32335
  ]))
32305
32336
  ])) : createCommentVNode("", true)
@@ -33037,7 +33068,7 @@ const initPinia = () => {
33037
33068
  const setupTracking = (options) => {
33038
33069
  const pinia = initPinia();
33039
33070
  const store = useOptionsStore(pinia);
33040
- initTracking(options);
33071
+ initTracking$1(options);
33041
33072
  store.setTrackingOptions({ options });
33042
33073
  };
33043
33074
  const displayDiscountedPriceSection = (doc2, options) => {
@@ -39663,6 +39694,49 @@ const getQueryParam = (name) => {
39663
39694
  return null;
39664
39695
  }
39665
39696
  };
39697
+ const mergeSearchBoxConfiguration = (options, overrides) => {
39698
+ var _a, _b, _c;
39699
+ for (const panel of (_a = options.panels) != null ? _a : []) {
39700
+ if (panel.type !== SearchBoxPanelType.DOCUMENT) {
39701
+ continue;
39702
+ }
39703
+ const overridePanel = (_b = overrides.panels) == null ? void 0 : _b.find((p2) => p2.queryKey === panel.queryKey);
39704
+ if (!overridePanel || overridePanel.type !== SearchBoxPanelType.DOCUMENT || !overridePanel) {
39705
+ continue;
39706
+ }
39707
+ panel.elements = (_c = panel.elements) == null ? void 0 : _c.map((element) => {
39708
+ var _a2;
39709
+ const overrideElement = (_a2 = overridePanel == null ? void 0 : overridePanel.elements) == null ? void 0 : _a2.find((e2) => e2.key === element.key);
39710
+ if (!overrideElement) {
39711
+ return element;
39712
+ }
39713
+ return __spreadValues(__spreadValues({}, element), overrideElement);
39714
+ });
39715
+ }
39716
+ const _d = overrides, { panels } = _d, overridesWithoutPanels = __objRest(_d, ["panels"]);
39717
+ return merge(options, overridesWithoutPanels);
39718
+ };
39719
+ const mergeSearchResultsConfiguration = (options, overrides) => {
39720
+ var _a;
39721
+ if (!overrides.elements) {
39722
+ return merge(options, overrides);
39723
+ }
39724
+ const elements = (_a = options.elements) == null ? void 0 : _a.map((element) => {
39725
+ var _a2;
39726
+ const overrideElement = (_a2 = overrides.elements) == null ? void 0 : _a2.find((e2) => e2.key === element.key);
39727
+ if (!overrideElement) {
39728
+ return element;
39729
+ }
39730
+ return __spreadValues(__spreadValues({}, element), overrideElement);
39731
+ });
39732
+ options.elements = elements;
39733
+ const _b = overrides, { elements: _ } = _b, overridesWithoutElements = __objRest(_b, ["elements"]);
39734
+ return merge(options, overridesWithoutElements);
39735
+ };
39736
+ const PluginConfigurationMerger = {
39737
+ mergeSearchBoxConfiguration,
39738
+ mergeSearchResultsConfiguration
39739
+ };
39666
39740
  const PREVIEW_PARAMETER = "lupaSearchPreview";
39667
39741
  const MAX_ELEMENT_MOUNT_RETRIES = 25;
39668
39742
  let styleElement = null;
@@ -39758,7 +39832,10 @@ const mountSearchBox = (configuration, options, optionOverrides, fetch2 = true,
39758
39832
  );
39759
39833
  return;
39760
39834
  }
39761
- const mergedOptions = merge(resolvedConfiguration, (_a = optionOverrides == null ? void 0 : optionOverrides.searchBox) != null ? _a : {});
39835
+ const mergedOptions = PluginConfigurationMerger.mergeSearchBoxConfiguration(
39836
+ resolvedConfiguration,
39837
+ (_a = optionOverrides == null ? void 0 : optionOverrides.searchBox) != null ? _a : {}
39838
+ );
39762
39839
  searchBox(__spreadProps(__spreadValues({}, mergedOptions), { options }), { fetch: fetch2, allowedMountUrls });
39763
39840
  });
39764
39841
  const mountSearchResults = (configuration, options, optionOverrides, fetch2 = true, remount = false) => __async(exports, null, function* () {
@@ -39779,7 +39856,10 @@ const mountSearchResults = (configuration, options, optionOverrides, fetch2 = tr
39779
39856
  );
39780
39857
  return;
39781
39858
  }
39782
- const mergedOptions = merge(resolvedConfiguration, (_a = optionOverrides == null ? void 0 : optionOverrides.searchResults) != null ? _a : {});
39859
+ const mergedOptions = PluginConfigurationMerger.mergeSearchResultsConfiguration(
39860
+ resolvedConfiguration,
39861
+ (_a = optionOverrides == null ? void 0 : optionOverrides.searchResults) != null ? _a : {}
39862
+ );
39783
39863
  searchResults(__spreadProps(__spreadValues({}, mergedOptions), { options }), { fetch: fetch2, allowedMountUrls });
39784
39864
  });
39785
39865
  const mountProductList = (configuration, options, optionOverrides, fetch2 = true, remount = false) => __async(exports, null, function* () {
@@ -39863,6 +39943,16 @@ const mountChat = (configuration, options, fetch2 = true, remount = false) => __
39863
39943
  { fetch: fetch2, allowedMountUrls }
39864
39944
  );
39865
39945
  });
39946
+ const initTracking = (configuration) => __async(exports, null, function* () {
39947
+ let trackingOptions = { trackBase: false };
39948
+ if (configuration.tracking) {
39949
+ const resolvedConfiguration = JSON.parse(configuration.tracking);
39950
+ if (resolvedConfiguration.trackBase) {
39951
+ trackingOptions = resolvedConfiguration;
39952
+ }
39953
+ }
39954
+ setupTracking(trackingOptions);
39955
+ });
39866
39956
  const mount = (_0, ..._1) => __async(exports, [_0, ..._1], function* (configuration, options = { environment: "production" }, optionOverrides = {}, fetch2 = true, remount = false) {
39867
39957
  yield applyStyles(configuration);
39868
39958
  const mountPromises = [
@@ -39873,6 +39963,7 @@ const mount = (_0, ..._1) => __async(exports, [_0, ..._1], function* (configurat
39873
39963
  mountChat(configuration, options, fetch2, remount)
39874
39964
  ];
39875
39965
  yield Promise.all(mountPromises);
39966
+ initTracking(configuration);
39876
39967
  });
39877
39968
  const init$1 = (_0, ..._1) => __async(exports, [_0, ..._1], function* (configurationKey, options = { environment: "production" }, optionOverrides = {}) {
39878
39969
  var _a;
@@ -17,6 +17,18 @@ var __spreadValues = (a, b) => {
17
17
  return a;
18
18
  };
19
19
  var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
20
+ var __objRest = (source, exclude) => {
21
+ var target = {};
22
+ for (var prop in source)
23
+ if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
24
+ target[prop] = source[prop];
25
+ if (source != null && __getOwnPropSymbols)
26
+ for (var prop of __getOwnPropSymbols(source)) {
27
+ if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
28
+ target[prop] = source[prop];
29
+ }
30
+ return target;
31
+ };
20
32
  var __async = (__this, __arguments, generator) => {
21
33
  return new Promise((resolve2, reject) => {
22
34
  var fulfilled = (value) => {
@@ -6404,7 +6416,7 @@ var __spreadValues2 = (a, b) => {
6404
6416
  return a;
6405
6417
  };
6406
6418
  var __spreadProps2 = (a, b) => __defProps2(a, __getOwnPropDescs2(b));
6407
- var __objRest = (source, exclude) => {
6419
+ var __objRest2 = (source, exclude) => {
6408
6420
  var target = {};
6409
6421
  for (var prop in source)
6410
6422
  if (__hasOwnProp2.call(source, prop) && exclude.indexOf(prop) < 0)
@@ -7337,6 +7349,7 @@ const useOptionsStore = defineStore("options", () => {
7337
7349
  );
7338
7350
  const trackingOptions = ref({});
7339
7351
  const searchResultInitialFilters = ref({});
7352
+ const productRecommendationOptions = ref({});
7340
7353
  const screenStore = useScreenStore();
7341
7354
  const envOptions = computed(
7342
7355
  () => {
@@ -7397,6 +7410,11 @@ const useOptionsStore = defineStore("options", () => {
7397
7410
  const setInitialFilters = ({ initialFilters: initialFilters2 }) => {
7398
7411
  searchResultInitialFilters.value = initialFilters2;
7399
7412
  };
7413
+ const setProductRecommendationOptions = ({
7414
+ options
7415
+ }) => {
7416
+ productRecommendationOptions.value = options;
7417
+ };
7400
7418
  const getQueryParamName = (param) => {
7401
7419
  var _a;
7402
7420
  const nameMap = searchBoxOptions.value.queryParameterNames;
@@ -7413,10 +7431,12 @@ const useOptionsStore = defineStore("options", () => {
7413
7431
  searchResultsRoutingBehavior,
7414
7432
  defaultSearchResultPageSize,
7415
7433
  currentResolutionPageSizes,
7434
+ productRecommendationOptions,
7416
7435
  setSearchBoxOptions,
7417
7436
  setTrackingOptions,
7418
7437
  setSearchResultOptions,
7419
7438
  setInitialFilters,
7439
+ setProductRecommendationOptions,
7420
7440
  getQueryParamName
7421
7441
  };
7422
7442
  });
@@ -7504,7 +7524,7 @@ const getUserKey = () => {
7504
7524
  return void 0;
7505
7525
  }
7506
7526
  };
7507
- const initTracking = (options) => {
7527
+ const initTracking$1 = (options) => {
7508
7528
  initBaseTracking(Boolean(options.trackBase));
7509
7529
  if (options.trackSession) {
7510
7530
  initSessionTracking();
@@ -7546,7 +7566,9 @@ const trackLupaEvent = (queryKey, data = {}, options) => {
7546
7566
  name: data.type,
7547
7567
  userId: getUserKey(),
7548
7568
  sessionId: getSessionKey(),
7549
- filters: data.filters
7569
+ filters: data.filters,
7570
+ metadata: data.metadata,
7571
+ sourceItemId: data.sourceItemId
7550
7572
  };
7551
7573
  LupaSearchSdk.track(queryKey, eventData, options);
7552
7574
  };
@@ -14881,7 +14903,7 @@ let Rule$2 = rule;
14881
14903
  function fromJSON$1(json, inputs) {
14882
14904
  if (Array.isArray(json))
14883
14905
  return json.map((n) => fromJSON$1(n));
14884
- let _a = json, { inputs: ownInputs } = _a, defaults = __objRest(_a, ["inputs"]);
14906
+ let _a = json, { inputs: ownInputs } = _a, defaults = __objRest2(_a, ["inputs"]);
14885
14907
  if (ownInputs) {
14886
14908
  inputs = [];
14887
14909
  for (let input2 of ownInputs) {
@@ -14898,7 +14920,7 @@ function fromJSON$1(json, inputs) {
14898
14920
  defaults.nodes = json.nodes.map((n) => fromJSON$1(n, inputs));
14899
14921
  }
14900
14922
  if (defaults.source) {
14901
- let _b = defaults.source, { inputId } = _b, source = __objRest(_b, ["inputId"]);
14923
+ let _b = defaults.source, { inputId } = _b, source = __objRest2(_b, ["inputId"]);
14902
14924
  defaults.source = source;
14903
14925
  if (inputId != null) {
14904
14926
  defaults.source.input = inputs[inputId];
@@ -18976,7 +18998,7 @@ const _sfc_main$1c = /* @__PURE__ */ defineComponent(__spreadProps2(__spreadValu
18976
18998
  });
18977
18999
  const displayElement = computed(() => {
18978
19000
  const element = props.element;
18979
- const item = props.item;
19001
+ const item = enhancedItem.value;
18980
19002
  if (!element.display) {
18981
19003
  return true;
18982
19004
  }
@@ -24259,7 +24281,8 @@ const _sfc_main$p = /* @__PURE__ */ defineComponent({
24259
24281
  options: {},
24260
24282
  isAdditionalPanel: { type: Boolean },
24261
24283
  clickTrackingSettings: {},
24262
- lupaClickTrackingType: {}
24284
+ lupaClickTrackingType: {},
24285
+ sourceItemId: {}
24263
24286
  },
24264
24287
  setup(__props) {
24265
24288
  const props = __props;
@@ -24272,7 +24295,7 @@ const _sfc_main$p = /* @__PURE__ */ defineComponent({
24272
24295
  const paramsStore = useParamsStore();
24273
24296
  const trackingStore = useTrackingStore();
24274
24297
  const { layout } = storeToRefs(searchResultStore);
24275
- const { searchResultsRoutingBehavior, searchResultOptions, trackingOptions } = storeToRefs(optionsStore);
24298
+ const { searchResultsRoutingBehavior, searchResultOptions, productRecommendationOptions } = storeToRefs(optionsStore);
24276
24299
  const { query } = storeToRefs(paramsStore);
24277
24300
  const isInStock = ref(true);
24278
24301
  const listLayoutClass = computed(() => {
@@ -24369,7 +24392,8 @@ const _sfc_main$p = /* @__PURE__ */ defineComponent({
24369
24392
  itemId: id.value
24370
24393
  },
24371
24394
  options: { allowEmptySearchQuery: true },
24372
- filters: searchResultStore.hasAnyFilter ? searchResultStore.filters : void 0
24395
+ filters: searchResultStore.hasAnyFilter ? searchResultStore.filters : void 0,
24396
+ sourceItemId: props.lupaClickTrackingType === "recommendedItemClick" ? props.sourceItemId : void 0
24373
24397
  }
24374
24398
  };
24375
24399
  if (isDelayedClickTracking()) {
@@ -25033,7 +25057,8 @@ const _sfc_main$i = /* @__PURE__ */ defineComponent({
25033
25057
  relatedQueries.value = queries;
25034
25058
  }));
25035
25059
  const hasEnoughRelatedQueries = computed(() => {
25036
- return relatedQueries.value.length > 1;
25060
+ var _a;
25061
+ return ((_a = relatedQueries.value) == null ? void 0 : _a.length) > 1;
25037
25062
  });
25038
25063
  const handleRelatedQueryClick = (query) => {
25039
25064
  var _a;
@@ -32177,6 +32202,9 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
32177
32202
  optionsStore.setSearchResultOptions({
32178
32203
  options: props.options
32179
32204
  });
32205
+ optionsStore.setProductRecommendationOptions({
32206
+ options: props.options
32207
+ });
32180
32208
  if (props.options.lazyLoad) {
32181
32209
  initIntersectionObserver();
32182
32210
  } else {
@@ -32281,8 +32309,10 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
32281
32309
  createVNode(_sfc_main$p, {
32282
32310
  product,
32283
32311
  options: _ctx.options,
32284
- "click-tracking-settings": clickTrackingSettings.value
32285
- }, null, 8, ["product", "options", "click-tracking-settings"])
32312
+ "click-tracking-settings": clickTrackingSettings.value,
32313
+ "lupa-click-tracking-type": `recommendedItemClick`,
32314
+ "source-item-id": itemId.value
32315
+ }, null, 8, ["product", "options", "click-tracking-settings", "source-item-id"])
32286
32316
  ]),
32287
32317
  _: 2
32288
32318
  }, 1024);
@@ -32296,8 +32326,9 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
32296
32326
  key: getProductKeyAction(index, product),
32297
32327
  product,
32298
32328
  options: _ctx.options,
32299
- "lupa-click-tracking-type": `recommendedItemClick`
32300
- }, null, 8, ["style", "product", "options"]);
32329
+ "lupa-click-tracking-type": `recommendedItemClick`,
32330
+ "source-item-id": itemId.value
32331
+ }, null, 8, ["style", "product", "options", "source-item-id"]);
32301
32332
  }), 128))
32302
32333
  ]))
32303
32334
  ])) : createCommentVNode("", true)
@@ -33035,7 +33066,7 @@ const initPinia = () => {
33035
33066
  const setupTracking = (options) => {
33036
33067
  const pinia = initPinia();
33037
33068
  const store = useOptionsStore(pinia);
33038
- initTracking(options);
33069
+ initTracking$1(options);
33039
33070
  store.setTrackingOptions({ options });
33040
33071
  };
33041
33072
  const displayDiscountedPriceSection = (doc2, options) => {
@@ -39661,6 +39692,49 @@ const getQueryParam = (name) => {
39661
39692
  return null;
39662
39693
  }
39663
39694
  };
39695
+ const mergeSearchBoxConfiguration = (options, overrides) => {
39696
+ var _a, _b, _c;
39697
+ for (const panel of (_a = options.panels) != null ? _a : []) {
39698
+ if (panel.type !== SearchBoxPanelType.DOCUMENT) {
39699
+ continue;
39700
+ }
39701
+ const overridePanel = (_b = overrides.panels) == null ? void 0 : _b.find((p2) => p2.queryKey === panel.queryKey);
39702
+ if (!overridePanel || overridePanel.type !== SearchBoxPanelType.DOCUMENT || !overridePanel) {
39703
+ continue;
39704
+ }
39705
+ panel.elements = (_c = panel.elements) == null ? void 0 : _c.map((element) => {
39706
+ var _a2;
39707
+ const overrideElement = (_a2 = overridePanel == null ? void 0 : overridePanel.elements) == null ? void 0 : _a2.find((e2) => e2.key === element.key);
39708
+ if (!overrideElement) {
39709
+ return element;
39710
+ }
39711
+ return __spreadValues(__spreadValues({}, element), overrideElement);
39712
+ });
39713
+ }
39714
+ const _d = overrides, { panels } = _d, overridesWithoutPanels = __objRest(_d, ["panels"]);
39715
+ return merge(options, overridesWithoutPanels);
39716
+ };
39717
+ const mergeSearchResultsConfiguration = (options, overrides) => {
39718
+ var _a;
39719
+ if (!overrides.elements) {
39720
+ return merge(options, overrides);
39721
+ }
39722
+ const elements = (_a = options.elements) == null ? void 0 : _a.map((element) => {
39723
+ var _a2;
39724
+ const overrideElement = (_a2 = overrides.elements) == null ? void 0 : _a2.find((e2) => e2.key === element.key);
39725
+ if (!overrideElement) {
39726
+ return element;
39727
+ }
39728
+ return __spreadValues(__spreadValues({}, element), overrideElement);
39729
+ });
39730
+ options.elements = elements;
39731
+ const _b = overrides, { elements: _ } = _b, overridesWithoutElements = __objRest(_b, ["elements"]);
39732
+ return merge(options, overridesWithoutElements);
39733
+ };
39734
+ const PluginConfigurationMerger = {
39735
+ mergeSearchBoxConfiguration,
39736
+ mergeSearchResultsConfiguration
39737
+ };
39664
39738
  const PREVIEW_PARAMETER = "lupaSearchPreview";
39665
39739
  const MAX_ELEMENT_MOUNT_RETRIES = 25;
39666
39740
  let styleElement = null;
@@ -39756,7 +39830,10 @@ const mountSearchBox = (configuration, options, optionOverrides, fetch2 = true,
39756
39830
  );
39757
39831
  return;
39758
39832
  }
39759
- const mergedOptions = merge(resolvedConfiguration, (_a = optionOverrides == null ? void 0 : optionOverrides.searchBox) != null ? _a : {});
39833
+ const mergedOptions = PluginConfigurationMerger.mergeSearchBoxConfiguration(
39834
+ resolvedConfiguration,
39835
+ (_a = optionOverrides == null ? void 0 : optionOverrides.searchBox) != null ? _a : {}
39836
+ );
39760
39837
  searchBox(__spreadProps(__spreadValues({}, mergedOptions), { options }), { fetch: fetch2, allowedMountUrls });
39761
39838
  });
39762
39839
  const mountSearchResults = (configuration, options, optionOverrides, fetch2 = true, remount = false) => __async(void 0, null, function* () {
@@ -39777,7 +39854,10 @@ const mountSearchResults = (configuration, options, optionOverrides, fetch2 = tr
39777
39854
  );
39778
39855
  return;
39779
39856
  }
39780
- const mergedOptions = merge(resolvedConfiguration, (_a = optionOverrides == null ? void 0 : optionOverrides.searchResults) != null ? _a : {});
39857
+ const mergedOptions = PluginConfigurationMerger.mergeSearchResultsConfiguration(
39858
+ resolvedConfiguration,
39859
+ (_a = optionOverrides == null ? void 0 : optionOverrides.searchResults) != null ? _a : {}
39860
+ );
39781
39861
  searchResults(__spreadProps(__spreadValues({}, mergedOptions), { options }), { fetch: fetch2, allowedMountUrls });
39782
39862
  });
39783
39863
  const mountProductList = (configuration, options, optionOverrides, fetch2 = true, remount = false) => __async(void 0, null, function* () {
@@ -39861,6 +39941,16 @@ const mountChat = (configuration, options, fetch2 = true, remount = false) => __
39861
39941
  { fetch: fetch2, allowedMountUrls }
39862
39942
  );
39863
39943
  });
39944
+ const initTracking = (configuration) => __async(void 0, null, function* () {
39945
+ let trackingOptions = { trackBase: false };
39946
+ if (configuration.tracking) {
39947
+ const resolvedConfiguration = JSON.parse(configuration.tracking);
39948
+ if (resolvedConfiguration.trackBase) {
39949
+ trackingOptions = resolvedConfiguration;
39950
+ }
39951
+ }
39952
+ setupTracking(trackingOptions);
39953
+ });
39864
39954
  const mount = (_0, ..._1) => __async(void 0, [_0, ..._1], function* (configuration, options = { environment: "production" }, optionOverrides = {}, fetch2 = true, remount = false) {
39865
39955
  yield applyStyles(configuration);
39866
39956
  const mountPromises = [
@@ -39871,6 +39961,7 @@ const mount = (_0, ..._1) => __async(void 0, [_0, ..._1], function* (configurati
39871
39961
  mountChat(configuration, options, fetch2, remount)
39872
39962
  ];
39873
39963
  yield Promise.all(mountPromises);
39964
+ initTracking(configuration);
39874
39965
  });
39875
39966
  const init$1 = (_0, ..._1) => __async(void 0, [_0, ..._1], function* (configurationKey, options = { environment: "production" }, optionOverrides = {}) {
39876
39967
  var _a;
@@ -20,6 +20,18 @@ var __spreadValues = (a, b) => {
20
20
  return a;
21
21
  };
22
22
  var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
23
+ var __objRest = (source, exclude) => {
24
+ var target = {};
25
+ for (var prop in source)
26
+ if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
27
+ target[prop] = source[prop];
28
+ if (source != null && __getOwnPropSymbols)
29
+ for (var prop of __getOwnPropSymbols(source)) {
30
+ if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
31
+ target[prop] = source[prop];
32
+ }
33
+ return target;
34
+ };
23
35
  var __async = (__this, __arguments, generator) => {
24
36
  return new Promise((resolve, reject) => {
25
37
  var fulfilled = (value) => {
@@ -6408,7 +6420,7 @@ var __async = (__this, __arguments, generator) => {
6408
6420
  return a;
6409
6421
  };
6410
6422
  var __spreadProps2 = (a, b) => __defProps2(a, __getOwnPropDescs2(b));
6411
- var __objRest = (source, exclude) => {
6423
+ var __objRest2 = (source, exclude) => {
6412
6424
  var target = {};
6413
6425
  for (var prop in source)
6414
6426
  if (__hasOwnProp2.call(source, prop) && exclude.indexOf(prop) < 0)
@@ -7341,6 +7353,7 @@ var __async = (__this, __arguments, generator) => {
7341
7353
  );
7342
7354
  const trackingOptions = ref({});
7343
7355
  const searchResultInitialFilters = ref({});
7356
+ const productRecommendationOptions = ref({});
7344
7357
  const screenStore = useScreenStore();
7345
7358
  const envOptions = computed(
7346
7359
  () => {
@@ -7401,6 +7414,11 @@ var __async = (__this, __arguments, generator) => {
7401
7414
  const setInitialFilters = ({ initialFilters: initialFilters2 }) => {
7402
7415
  searchResultInitialFilters.value = initialFilters2;
7403
7416
  };
7417
+ const setProductRecommendationOptions = ({
7418
+ options
7419
+ }) => {
7420
+ productRecommendationOptions.value = options;
7421
+ };
7404
7422
  const getQueryParamName = (param) => {
7405
7423
  var _a;
7406
7424
  const nameMap = searchBoxOptions.value.queryParameterNames;
@@ -7417,10 +7435,12 @@ var __async = (__this, __arguments, generator) => {
7417
7435
  searchResultsRoutingBehavior,
7418
7436
  defaultSearchResultPageSize,
7419
7437
  currentResolutionPageSizes,
7438
+ productRecommendationOptions,
7420
7439
  setSearchBoxOptions,
7421
7440
  setTrackingOptions,
7422
7441
  setSearchResultOptions,
7423
7442
  setInitialFilters,
7443
+ setProductRecommendationOptions,
7424
7444
  getQueryParamName
7425
7445
  };
7426
7446
  });
@@ -7508,7 +7528,7 @@ var __async = (__this, __arguments, generator) => {
7508
7528
  return void 0;
7509
7529
  }
7510
7530
  };
7511
- const initTracking = (options) => {
7531
+ const initTracking$1 = (options) => {
7512
7532
  initBaseTracking(Boolean(options.trackBase));
7513
7533
  if (options.trackSession) {
7514
7534
  initSessionTracking();
@@ -7550,7 +7570,9 @@ var __async = (__this, __arguments, generator) => {
7550
7570
  name: data.type,
7551
7571
  userId: getUserKey(),
7552
7572
  sessionId: getSessionKey(),
7553
- filters: data.filters
7573
+ filters: data.filters,
7574
+ metadata: data.metadata,
7575
+ sourceItemId: data.sourceItemId
7554
7576
  };
7555
7577
  LupaSearchSdk.track(queryKey, eventData, options);
7556
7578
  };
@@ -14885,7 +14907,7 @@ var __async = (__this, __arguments, generator) => {
14885
14907
  function fromJSON$1(json, inputs) {
14886
14908
  if (Array.isArray(json))
14887
14909
  return json.map((n) => fromJSON$1(n));
14888
- let _a = json, { inputs: ownInputs } = _a, defaults = __objRest(_a, ["inputs"]);
14910
+ let _a = json, { inputs: ownInputs } = _a, defaults = __objRest2(_a, ["inputs"]);
14889
14911
  if (ownInputs) {
14890
14912
  inputs = [];
14891
14913
  for (let input2 of ownInputs) {
@@ -14902,7 +14924,7 @@ var __async = (__this, __arguments, generator) => {
14902
14924
  defaults.nodes = json.nodes.map((n) => fromJSON$1(n, inputs));
14903
14925
  }
14904
14926
  if (defaults.source) {
14905
- let _b = defaults.source, { inputId } = _b, source = __objRest(_b, ["inputId"]);
14927
+ let _b = defaults.source, { inputId } = _b, source = __objRest2(_b, ["inputId"]);
14906
14928
  defaults.source = source;
14907
14929
  if (inputId != null) {
14908
14930
  defaults.source.input = inputs[inputId];
@@ -18980,7 +19002,7 @@ and ensure you are accounting for this risk.
18980
19002
  });
18981
19003
  const displayElement = computed(() => {
18982
19004
  const element = props.element;
18983
- const item = props.item;
19005
+ const item = enhancedItem.value;
18984
19006
  if (!element.display) {
18985
19007
  return true;
18986
19008
  }
@@ -24263,7 +24285,8 @@ and ensure you are accounting for this risk.
24263
24285
  options: {},
24264
24286
  isAdditionalPanel: { type: Boolean },
24265
24287
  clickTrackingSettings: {},
24266
- lupaClickTrackingType: {}
24288
+ lupaClickTrackingType: {},
24289
+ sourceItemId: {}
24267
24290
  },
24268
24291
  setup(__props) {
24269
24292
  const props = __props;
@@ -24276,7 +24299,7 @@ and ensure you are accounting for this risk.
24276
24299
  const paramsStore = useParamsStore();
24277
24300
  const trackingStore = useTrackingStore();
24278
24301
  const { layout } = storeToRefs(searchResultStore);
24279
- const { searchResultsRoutingBehavior, searchResultOptions, trackingOptions } = storeToRefs(optionsStore);
24302
+ const { searchResultsRoutingBehavior, searchResultOptions, productRecommendationOptions } = storeToRefs(optionsStore);
24280
24303
  const { query } = storeToRefs(paramsStore);
24281
24304
  const isInStock = ref(true);
24282
24305
  const listLayoutClass = computed(() => {
@@ -24373,7 +24396,8 @@ and ensure you are accounting for this risk.
24373
24396
  itemId: id.value
24374
24397
  },
24375
24398
  options: { allowEmptySearchQuery: true },
24376
- filters: searchResultStore.hasAnyFilter ? searchResultStore.filters : void 0
24399
+ filters: searchResultStore.hasAnyFilter ? searchResultStore.filters : void 0,
24400
+ sourceItemId: props.lupaClickTrackingType === "recommendedItemClick" ? props.sourceItemId : void 0
24377
24401
  }
24378
24402
  };
24379
24403
  if (isDelayedClickTracking()) {
@@ -25037,7 +25061,8 @@ and ensure you are accounting for this risk.
25037
25061
  relatedQueries.value = queries;
25038
25062
  }));
25039
25063
  const hasEnoughRelatedQueries = computed(() => {
25040
- return relatedQueries.value.length > 1;
25064
+ var _a;
25065
+ return ((_a = relatedQueries.value) == null ? void 0 : _a.length) > 1;
25041
25066
  });
25042
25067
  const handleRelatedQueryClick = (query) => {
25043
25068
  var _a;
@@ -32181,6 +32206,9 @@ and ensure you are accounting for this risk.
32181
32206
  optionsStore.setSearchResultOptions({
32182
32207
  options: props.options
32183
32208
  });
32209
+ optionsStore.setProductRecommendationOptions({
32210
+ options: props.options
32211
+ });
32184
32212
  if (props.options.lazyLoad) {
32185
32213
  initIntersectionObserver();
32186
32214
  } else {
@@ -32285,8 +32313,10 @@ and ensure you are accounting for this risk.
32285
32313
  createVNode(_sfc_main$p, {
32286
32314
  product,
32287
32315
  options: _ctx.options,
32288
- "click-tracking-settings": clickTrackingSettings.value
32289
- }, null, 8, ["product", "options", "click-tracking-settings"])
32316
+ "click-tracking-settings": clickTrackingSettings.value,
32317
+ "lupa-click-tracking-type": `recommendedItemClick`,
32318
+ "source-item-id": itemId.value
32319
+ }, null, 8, ["product", "options", "click-tracking-settings", "source-item-id"])
32290
32320
  ]),
32291
32321
  _: 2
32292
32322
  }, 1024);
@@ -32300,8 +32330,9 @@ and ensure you are accounting for this risk.
32300
32330
  key: getProductKeyAction(index, product),
32301
32331
  product,
32302
32332
  options: _ctx.options,
32303
- "lupa-click-tracking-type": `recommendedItemClick`
32304
- }, null, 8, ["style", "product", "options"]);
32333
+ "lupa-click-tracking-type": `recommendedItemClick`,
32334
+ "source-item-id": itemId.value
32335
+ }, null, 8, ["style", "product", "options", "source-item-id"]);
32305
32336
  }), 128))
32306
32337
  ]))
32307
32338
  ])) : createCommentVNode("", true)
@@ -33039,7 +33070,7 @@ and ensure you are accounting for this risk.
33039
33070
  const setupTracking = (options) => {
33040
33071
  const pinia = initPinia();
33041
33072
  const store = useOptionsStore(pinia);
33042
- initTracking(options);
33073
+ initTracking$1(options);
33043
33074
  store.setTrackingOptions({ options });
33044
33075
  };
33045
33076
  const displayDiscountedPriceSection = (doc2, options) => {
@@ -39665,6 +39696,49 @@ and ensure you are accounting for this risk.
39665
39696
  return null;
39666
39697
  }
39667
39698
  };
39699
+ const mergeSearchBoxConfiguration = (options, overrides) => {
39700
+ var _a, _b, _c;
39701
+ for (const panel of (_a = options.panels) != null ? _a : []) {
39702
+ if (panel.type !== SearchBoxPanelType.DOCUMENT) {
39703
+ continue;
39704
+ }
39705
+ const overridePanel = (_b = overrides.panels) == null ? void 0 : _b.find((p2) => p2.queryKey === panel.queryKey);
39706
+ if (!overridePanel || overridePanel.type !== SearchBoxPanelType.DOCUMENT || !overridePanel) {
39707
+ continue;
39708
+ }
39709
+ panel.elements = (_c = panel.elements) == null ? void 0 : _c.map((element) => {
39710
+ var _a2;
39711
+ const overrideElement = (_a2 = overridePanel == null ? void 0 : overridePanel.elements) == null ? void 0 : _a2.find((e2) => e2.key === element.key);
39712
+ if (!overrideElement) {
39713
+ return element;
39714
+ }
39715
+ return __spreadValues(__spreadValues({}, element), overrideElement);
39716
+ });
39717
+ }
39718
+ const _d = overrides, { panels } = _d, overridesWithoutPanels = __objRest(_d, ["panels"]);
39719
+ return merge(options, overridesWithoutPanels);
39720
+ };
39721
+ const mergeSearchResultsConfiguration = (options, overrides) => {
39722
+ var _a;
39723
+ if (!overrides.elements) {
39724
+ return merge(options, overrides);
39725
+ }
39726
+ const elements = (_a = options.elements) == null ? void 0 : _a.map((element) => {
39727
+ var _a2;
39728
+ const overrideElement = (_a2 = overrides.elements) == null ? void 0 : _a2.find((e2) => e2.key === element.key);
39729
+ if (!overrideElement) {
39730
+ return element;
39731
+ }
39732
+ return __spreadValues(__spreadValues({}, element), overrideElement);
39733
+ });
39734
+ options.elements = elements;
39735
+ const _b = overrides, { elements: _ } = _b, overridesWithoutElements = __objRest(_b, ["elements"]);
39736
+ return merge(options, overridesWithoutElements);
39737
+ };
39738
+ const PluginConfigurationMerger = {
39739
+ mergeSearchBoxConfiguration,
39740
+ mergeSearchResultsConfiguration
39741
+ };
39668
39742
  const PREVIEW_PARAMETER = "lupaSearchPreview";
39669
39743
  const MAX_ELEMENT_MOUNT_RETRIES = 25;
39670
39744
  let styleElement = null;
@@ -39760,7 +39834,10 @@ and ensure you are accounting for this risk.
39760
39834
  );
39761
39835
  return;
39762
39836
  }
39763
- const mergedOptions = merge(resolvedConfiguration, (_a = optionOverrides == null ? void 0 : optionOverrides.searchBox) != null ? _a : {});
39837
+ const mergedOptions = PluginConfigurationMerger.mergeSearchBoxConfiguration(
39838
+ resolvedConfiguration,
39839
+ (_a = optionOverrides == null ? void 0 : optionOverrides.searchBox) != null ? _a : {}
39840
+ );
39764
39841
  searchBox(__spreadProps(__spreadValues({}, mergedOptions), { options }), { fetch: fetch2, allowedMountUrls });
39765
39842
  });
39766
39843
  const mountSearchResults = (configuration, options, optionOverrides, fetch2 = true, remount = false) => __async(this, null, function* () {
@@ -39781,7 +39858,10 @@ and ensure you are accounting for this risk.
39781
39858
  );
39782
39859
  return;
39783
39860
  }
39784
- const mergedOptions = merge(resolvedConfiguration, (_a = optionOverrides == null ? void 0 : optionOverrides.searchResults) != null ? _a : {});
39861
+ const mergedOptions = PluginConfigurationMerger.mergeSearchResultsConfiguration(
39862
+ resolvedConfiguration,
39863
+ (_a = optionOverrides == null ? void 0 : optionOverrides.searchResults) != null ? _a : {}
39864
+ );
39785
39865
  searchResults(__spreadProps(__spreadValues({}, mergedOptions), { options }), { fetch: fetch2, allowedMountUrls });
39786
39866
  });
39787
39867
  const mountProductList = (configuration, options, optionOverrides, fetch2 = true, remount = false) => __async(this, null, function* () {
@@ -39865,6 +39945,16 @@ and ensure you are accounting for this risk.
39865
39945
  { fetch: fetch2, allowedMountUrls }
39866
39946
  );
39867
39947
  });
39948
+ const initTracking = (configuration) => __async(this, null, function* () {
39949
+ let trackingOptions = { trackBase: false };
39950
+ if (configuration.tracking) {
39951
+ const resolvedConfiguration = JSON.parse(configuration.tracking);
39952
+ if (resolvedConfiguration.trackBase) {
39953
+ trackingOptions = resolvedConfiguration;
39954
+ }
39955
+ }
39956
+ setupTracking(trackingOptions);
39957
+ });
39868
39958
  const mount = (_0, ..._1) => __async(this, [_0, ..._1], function* (configuration, options = { environment: "production" }, optionOverrides = {}, fetch2 = true, remount = false) {
39869
39959
  yield applyStyles(configuration);
39870
39960
  const mountPromises = [
@@ -39875,6 +39965,7 @@ and ensure you are accounting for this risk.
39875
39965
  mountChat(configuration, options, fetch2, remount)
39876
39966
  ];
39877
39967
  yield Promise.all(mountPromises);
39968
+ initTracking(configuration);
39878
39969
  });
39879
39970
  const init$1 = (_0, ..._1) => __async(this, [_0, ..._1], function* (configurationKey, options = { environment: "production" }, optionOverrides = {}) {
39880
39971
  var _a;
@@ -0,0 +1,85 @@
1
+ import { ResolvedSearchBoxOptions, ResolvedSearchResultOptions } from '../../types/ResolvedOptions';
2
+ import { SearchBoxOptions, SearchResultsOptions } from '@getlupa/vue';
3
+ declare const _default: {
4
+ mergeSearchBoxConfiguration: (options: ResolvedSearchBoxOptions, overrides: Partial<SearchBoxOptions>) => import("@getlupa/vue/dist/src/types/search-box/SearchBoxOptions").SearchBoxInputOptions & {
5
+ history: import("@getlupa/vue/dist/src/types/search-box/SearchBoxHistory").SearchBoxHistory;
6
+ panels: import("@getlupa/vue/dist/src/types/search-box/SearchBoxPanel").SearchBoxPanel[];
7
+ options: import("@getlupa/vue").SdkOptions;
8
+ debounce?: number;
9
+ showTotalCount?: boolean;
10
+ showNoResultsPanel?: boolean;
11
+ hideMoreResultsButtonOnNoResults?: boolean;
12
+ showMoreResultsButton?: boolean;
13
+ expandOnSinglePanel?: boolean;
14
+ forceFullReloadOnParams?: string[];
15
+ initialFilters?: import("@getlupa/client-sdk/Types").FilterGroup | Record<string, import("@getlupa/vue/dist/src/types/DataExtraction").DataExtraction>;
16
+ } & {
17
+ inputSelector: string;
18
+ searchTriggers?: string[];
19
+ routingBehavior?: import("@getlupa/vue").RoutingBehavior;
20
+ dynamicData?: import("@getlupa/vue").DynamicData;
21
+ callbacks?: import("@getlupa/vue").SearchBoxEventCallbacks;
22
+ redirections?: import("@getlupa/vue").RedirectionOptions;
23
+ queryParameterNames?: Record<import("@getlupa/vue/dist/src/types/General").LupaQueryParamValue, string>;
24
+ keepOpen?: boolean;
25
+ } & {
26
+ allowedMountUrls?: string[];
27
+ } & {
28
+ minInputLength?: number;
29
+ labels?: import("@getlupa/vue/dist/src/types/search-box/SearchBoxOptions").SearchBoxOptionLabels;
30
+ links?: import("@getlupa/vue/dist/src/types/search-box/SearchBoxOptions").SearchBoxOptionLinks;
31
+ inputAttributes?: Record<string, string>;
32
+ showSubmitButton?: boolean;
33
+ history?: import("@getlupa/vue/dist/src/types/search-box/SearchBoxHistory").SearchBoxHistory;
34
+ options?: import("@getlupa/vue").SdkOptions;
35
+ debounce?: number;
36
+ showTotalCount?: boolean;
37
+ showNoResultsPanel?: boolean;
38
+ hideMoreResultsButtonOnNoResults?: boolean;
39
+ showMoreResultsButton?: boolean;
40
+ expandOnSinglePanel?: boolean;
41
+ forceFullReloadOnParams?: string[];
42
+ initialFilters?: import("@getlupa/client-sdk/Types").FilterGroup | Record<string, import("@getlupa/vue/dist/src/types/DataExtraction").DataExtraction>;
43
+ inputSelector?: string;
44
+ searchTriggers?: string[];
45
+ routingBehavior?: import("@getlupa/vue").RoutingBehavior;
46
+ dynamicData?: import("@getlupa/vue").DynamicData;
47
+ callbacks?: import("@getlupa/vue").SearchBoxEventCallbacks;
48
+ redirections?: import("@getlupa/vue").RedirectionOptions;
49
+ queryParameterNames?: Record<import("@getlupa/vue/dist/src/types/General").LupaQueryParamValue, string>;
50
+ keepOpen?: boolean;
51
+ };
52
+ mergeSearchResultsConfiguration: (options: ResolvedSearchResultOptions, overrides: Partial<SearchResultsOptions>) => import("@getlupa/vue/dist/src/types/search-results/SearchResultsProductCardOptions").SearchResultsProductCardOptions & import("@getlupa/vue/dist/src/types/search-results/SearchResultsOptions").SearchResultsAdditionalPanels & {
53
+ grid: import("@getlupa/vue/dist/src/types/search-results/SearchResultsOptions").ProductGrid;
54
+ options: import("@getlupa/vue").SdkOptions;
55
+ queryKey: string;
56
+ pagination: import("@getlupa/vue/dist/src/types/search-results/SearchResultsOptions").SearchResultsPagination;
57
+ sort: import("@getlupa/vue").SearchResultsSortOptions[];
58
+ filters?: import("@getlupa/vue").SearchResultsFilterOptions;
59
+ searchTitlePosition?: string;
60
+ hideResultsOnReload?: boolean;
61
+ relatedQueries?: import("@getlupa/vue/dist/src/types/search-results/RelatedQueryOptions").RelatedQueryOptions;
62
+ redirectionSuggestions?: import("@getlupa/vue/dist/src/types/search-results/RedirectionSuggestionOptionts").RedirectionSuggestionOptions[];
63
+ toolbar?: {
64
+ layoutSelector?: boolean;
65
+ itemSummary?: boolean;
66
+ clearFilters?: boolean;
67
+ totalCount?: boolean;
68
+ };
69
+ } & {
70
+ containerSelector: string;
71
+ breadcrumbs: import("@getlupa/vue/dist/src/types/search-results/SearchResultsOptions").SearchResultsBreadcrumb[];
72
+ classMap?: Record<string, string>;
73
+ disallowEmptyQuery?: boolean;
74
+ callbacks?: import("@getlupa/vue").SearchResultEventCallbacks;
75
+ categories?: import("@getlupa/vue").CategoryFilterOptions;
76
+ dynamicData?: import("@getlupa/vue").DynamicData;
77
+ ssr?: import("@getlupa/vue").SsrOptions;
78
+ redirections?: import("@getlupa/vue").RedirectionOptions;
79
+ scrollToResults?: import("@getlupa/vue").ScrollToResultsOptions;
80
+ initialFilters?: import("@getlupa/client-sdk/Types").FilterGroup | Record<string, import("@getlupa/vue/dist/src/types/DataExtraction").DataExtraction>;
81
+ } & {
82
+ allowedMountUrls?: string[];
83
+ } & Partial<SearchResultsOptions>;
84
+ };
85
+ export default _default;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@getlupa/client",
3
- "version": "1.15.13",
3
+ "version": "1.15.16",
4
4
  "main": "dist/lupaSearch.js",
5
5
  "module": "dist/index.mjs",
6
6
  "types": "dist/src/index.d.ts",
@@ -20,7 +20,7 @@
20
20
  },
21
21
  "devDependencies": {
22
22
  "@getlupa/client-sdk": "^1.3.4",
23
- "@getlupa/vue": "0.15.13",
23
+ "@getlupa/vue": "0.15.16",
24
24
  "@rushstack/eslint-patch": "^1.3.2",
25
25
  "@tsconfig/node18": "^2.0.1",
26
26
  "@types/jsdom": "^21.1.1",