@getlupa/vue 0.15.13 → 0.15.15

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.
@@ -2057,6 +2057,7 @@ const useOptionsStore = defineStore("options", () => {
2057
2057
  );
2058
2058
  const trackingOptions = vue.ref({});
2059
2059
  const searchResultInitialFilters = vue.ref({});
2060
+ const productRecommendationOptions = vue.ref({});
2060
2061
  const screenStore = useScreenStore();
2061
2062
  const envOptions = vue.computed(
2062
2063
  () => {
@@ -2117,6 +2118,11 @@ const useOptionsStore = defineStore("options", () => {
2117
2118
  const setInitialFilters = ({ initialFilters: initialFilters2 }) => {
2118
2119
  searchResultInitialFilters.value = initialFilters2;
2119
2120
  };
2121
+ const setProductRecommendationOptions = ({
2122
+ options
2123
+ }) => {
2124
+ productRecommendationOptions.value = options;
2125
+ };
2120
2126
  const getQueryParamName = (param) => {
2121
2127
  var _a;
2122
2128
  const nameMap = searchBoxOptions.value.queryParameterNames;
@@ -2133,10 +2139,12 @@ const useOptionsStore = defineStore("options", () => {
2133
2139
  searchResultsRoutingBehavior,
2134
2140
  defaultSearchResultPageSize,
2135
2141
  currentResolutionPageSizes,
2142
+ productRecommendationOptions,
2136
2143
  setSearchBoxOptions,
2137
2144
  setTrackingOptions,
2138
2145
  setSearchResultOptions,
2139
2146
  setInitialFilters,
2147
+ setProductRecommendationOptions,
2140
2148
  getQueryParamName
2141
2149
  };
2142
2150
  });
@@ -2266,7 +2274,9 @@ const trackLupaEvent = (queryKey, data = {}, options) => {
2266
2274
  name: data.type,
2267
2275
  userId: getUserKey(),
2268
2276
  sessionId: getSessionKey(),
2269
- filters: data.filters
2277
+ filters: data.filters,
2278
+ metadata: data.metadata,
2279
+ sourceItemId: data.sourceItemId
2270
2280
  };
2271
2281
  LupaSearchSdk.track(queryKey, eventData, options);
2272
2282
  };
@@ -13746,7 +13756,7 @@ const _sfc_main$1c = /* @__PURE__ */ vue.defineComponent(__spreadProps(__spreadV
13746
13756
  });
13747
13757
  const displayElement = vue.computed(() => {
13748
13758
  const element = props.element;
13749
- const item = props.item;
13759
+ const item = enhancedItem.value;
13750
13760
  if (!element.display) {
13751
13761
  return true;
13752
13762
  }
@@ -19045,7 +19055,8 @@ const _sfc_main$p = /* @__PURE__ */ vue.defineComponent({
19045
19055
  options: {},
19046
19056
  isAdditionalPanel: { type: Boolean },
19047
19057
  clickTrackingSettings: {},
19048
- lupaClickTrackingType: {}
19058
+ lupaClickTrackingType: {},
19059
+ sourceItemId: {}
19049
19060
  },
19050
19061
  setup(__props) {
19051
19062
  const props = __props;
@@ -19058,7 +19069,7 @@ const _sfc_main$p = /* @__PURE__ */ vue.defineComponent({
19058
19069
  const paramsStore = useParamsStore();
19059
19070
  const trackingStore = useTrackingStore();
19060
19071
  const { layout } = storeToRefs(searchResultStore);
19061
- const { searchResultsRoutingBehavior, searchResultOptions, trackingOptions } = storeToRefs(optionsStore);
19072
+ const { searchResultsRoutingBehavior, searchResultOptions, productRecommendationOptions } = storeToRefs(optionsStore);
19062
19073
  const { query } = storeToRefs(paramsStore);
19063
19074
  const isInStock = vue.ref(true);
19064
19075
  const listLayoutClass = vue.computed(() => {
@@ -19155,7 +19166,8 @@ const _sfc_main$p = /* @__PURE__ */ vue.defineComponent({
19155
19166
  itemId: id.value
19156
19167
  },
19157
19168
  options: { allowEmptySearchQuery: true },
19158
- filters: searchResultStore.hasAnyFilter ? searchResultStore.filters : void 0
19169
+ filters: searchResultStore.hasAnyFilter ? searchResultStore.filters : void 0,
19170
+ sourceItemId: props.lupaClickTrackingType === "recommendedItemClick" ? props.sourceItemId : void 0
19159
19171
  }
19160
19172
  };
19161
19173
  if (isDelayedClickTracking()) {
@@ -19819,7 +19831,8 @@ const _sfc_main$i = /* @__PURE__ */ vue.defineComponent({
19819
19831
  relatedQueries.value = queries;
19820
19832
  }));
19821
19833
  const hasEnoughRelatedQueries = vue.computed(() => {
19822
- return relatedQueries.value.length > 1;
19834
+ var _a;
19835
+ return ((_a = relatedQueries.value) == null ? void 0 : _a.length) > 1;
19823
19836
  });
19824
19837
  const handleRelatedQueryClick = (query) => {
19825
19838
  var _a;
@@ -26963,6 +26976,9 @@ const _sfc_main$a = /* @__PURE__ */ vue.defineComponent({
26963
26976
  optionsStore.setSearchResultOptions({
26964
26977
  options: props.options
26965
26978
  });
26979
+ optionsStore.setProductRecommendationOptions({
26980
+ options: props.options
26981
+ });
26966
26982
  if (props.options.lazyLoad) {
26967
26983
  initIntersectionObserver();
26968
26984
  } else {
@@ -27067,8 +27083,10 @@ const _sfc_main$a = /* @__PURE__ */ vue.defineComponent({
27067
27083
  vue.createVNode(_sfc_main$p, {
27068
27084
  product,
27069
27085
  options: _ctx.options,
27070
- "click-tracking-settings": clickTrackingSettings.value
27071
- }, null, 8, ["product", "options", "click-tracking-settings"])
27086
+ "click-tracking-settings": clickTrackingSettings.value,
27087
+ "lupa-click-tracking-type": `recommendedItemClick`,
27088
+ "source-item-id": itemId.value
27089
+ }, null, 8, ["product", "options", "click-tracking-settings", "source-item-id"])
27072
27090
  ]),
27073
27091
  _: 2
27074
27092
  }, 1024);
@@ -27082,8 +27100,9 @@ const _sfc_main$a = /* @__PURE__ */ vue.defineComponent({
27082
27100
  key: getProductKeyAction(index, product),
27083
27101
  product,
27084
27102
  options: _ctx.options,
27085
- "lupa-click-tracking-type": `recommendedItemClick`
27086
- }, null, 8, ["style", "product", "options"]);
27103
+ "lupa-click-tracking-type": `recommendedItemClick`,
27104
+ "source-item-id": itemId.value
27105
+ }, null, 8, ["style", "product", "options", "source-item-id"]);
27087
27106
  }), 128))
27088
27107
  ]))
27089
27108
  ])) : vue.createCommentVNode("", true)
@@ -2055,6 +2055,7 @@ const useOptionsStore = defineStore("options", () => {
2055
2055
  );
2056
2056
  const trackingOptions = ref({});
2057
2057
  const searchResultInitialFilters = ref({});
2058
+ const productRecommendationOptions = ref({});
2058
2059
  const screenStore = useScreenStore();
2059
2060
  const envOptions = computed(
2060
2061
  () => {
@@ -2115,6 +2116,11 @@ const useOptionsStore = defineStore("options", () => {
2115
2116
  const setInitialFilters = ({ initialFilters: initialFilters2 }) => {
2116
2117
  searchResultInitialFilters.value = initialFilters2;
2117
2118
  };
2119
+ const setProductRecommendationOptions = ({
2120
+ options
2121
+ }) => {
2122
+ productRecommendationOptions.value = options;
2123
+ };
2118
2124
  const getQueryParamName = (param) => {
2119
2125
  var _a;
2120
2126
  const nameMap = searchBoxOptions.value.queryParameterNames;
@@ -2131,10 +2137,12 @@ const useOptionsStore = defineStore("options", () => {
2131
2137
  searchResultsRoutingBehavior,
2132
2138
  defaultSearchResultPageSize,
2133
2139
  currentResolutionPageSizes,
2140
+ productRecommendationOptions,
2134
2141
  setSearchBoxOptions,
2135
2142
  setTrackingOptions,
2136
2143
  setSearchResultOptions,
2137
2144
  setInitialFilters,
2145
+ setProductRecommendationOptions,
2138
2146
  getQueryParamName
2139
2147
  };
2140
2148
  });
@@ -2264,7 +2272,9 @@ const trackLupaEvent = (queryKey, data = {}, options) => {
2264
2272
  name: data.type,
2265
2273
  userId: getUserKey(),
2266
2274
  sessionId: getSessionKey(),
2267
- filters: data.filters
2275
+ filters: data.filters,
2276
+ metadata: data.metadata,
2277
+ sourceItemId: data.sourceItemId
2268
2278
  };
2269
2279
  LupaSearchSdk.track(queryKey, eventData, options);
2270
2280
  };
@@ -13744,7 +13754,7 @@ const _sfc_main$1c = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValue
13744
13754
  });
13745
13755
  const displayElement = computed(() => {
13746
13756
  const element = props.element;
13747
- const item = props.item;
13757
+ const item = enhancedItem.value;
13748
13758
  if (!element.display) {
13749
13759
  return true;
13750
13760
  }
@@ -19043,7 +19053,8 @@ const _sfc_main$p = /* @__PURE__ */ defineComponent({
19043
19053
  options: {},
19044
19054
  isAdditionalPanel: { type: Boolean },
19045
19055
  clickTrackingSettings: {},
19046
- lupaClickTrackingType: {}
19056
+ lupaClickTrackingType: {},
19057
+ sourceItemId: {}
19047
19058
  },
19048
19059
  setup(__props) {
19049
19060
  const props = __props;
@@ -19056,7 +19067,7 @@ const _sfc_main$p = /* @__PURE__ */ defineComponent({
19056
19067
  const paramsStore = useParamsStore();
19057
19068
  const trackingStore = useTrackingStore();
19058
19069
  const { layout } = storeToRefs(searchResultStore);
19059
- const { searchResultsRoutingBehavior, searchResultOptions, trackingOptions } = storeToRefs(optionsStore);
19070
+ const { searchResultsRoutingBehavior, searchResultOptions, productRecommendationOptions } = storeToRefs(optionsStore);
19060
19071
  const { query } = storeToRefs(paramsStore);
19061
19072
  const isInStock = ref(true);
19062
19073
  const listLayoutClass = computed(() => {
@@ -19153,7 +19164,8 @@ const _sfc_main$p = /* @__PURE__ */ defineComponent({
19153
19164
  itemId: id.value
19154
19165
  },
19155
19166
  options: { allowEmptySearchQuery: true },
19156
- filters: searchResultStore.hasAnyFilter ? searchResultStore.filters : void 0
19167
+ filters: searchResultStore.hasAnyFilter ? searchResultStore.filters : void 0,
19168
+ sourceItemId: props.lupaClickTrackingType === "recommendedItemClick" ? props.sourceItemId : void 0
19157
19169
  }
19158
19170
  };
19159
19171
  if (isDelayedClickTracking()) {
@@ -19817,7 +19829,8 @@ const _sfc_main$i = /* @__PURE__ */ defineComponent({
19817
19829
  relatedQueries.value = queries;
19818
19830
  }));
19819
19831
  const hasEnoughRelatedQueries = computed(() => {
19820
- return relatedQueries.value.length > 1;
19832
+ var _a;
19833
+ return ((_a = relatedQueries.value) == null ? void 0 : _a.length) > 1;
19821
19834
  });
19822
19835
  const handleRelatedQueryClick = (query) => {
19823
19836
  var _a;
@@ -26961,6 +26974,9 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
26961
26974
  optionsStore.setSearchResultOptions({
26962
26975
  options: props.options
26963
26976
  });
26977
+ optionsStore.setProductRecommendationOptions({
26978
+ options: props.options
26979
+ });
26964
26980
  if (props.options.lazyLoad) {
26965
26981
  initIntersectionObserver();
26966
26982
  } else {
@@ -27065,8 +27081,10 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
27065
27081
  createVNode(_sfc_main$p, {
27066
27082
  product,
27067
27083
  options: _ctx.options,
27068
- "click-tracking-settings": clickTrackingSettings.value
27069
- }, null, 8, ["product", "options", "click-tracking-settings"])
27084
+ "click-tracking-settings": clickTrackingSettings.value,
27085
+ "lupa-click-tracking-type": `recommendedItemClick`,
27086
+ "source-item-id": itemId.value
27087
+ }, null, 8, ["product", "options", "click-tracking-settings", "source-item-id"])
27070
27088
  ]),
27071
27089
  _: 2
27072
27090
  }, 1024);
@@ -27080,8 +27098,9 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
27080
27098
  key: getProductKeyAction(index, product),
27081
27099
  product,
27082
27100
  options: _ctx.options,
27083
- "lupa-click-tracking-type": `recommendedItemClick`
27084
- }, null, 8, ["style", "product", "options"]);
27101
+ "lupa-click-tracking-type": `recommendedItemClick`,
27102
+ "source-item-id": itemId.value
27103
+ }, null, 8, ["style", "product", "options", "source-item-id"]);
27085
27104
  }), 128))
27086
27105
  ]))
27087
27106
  ])) : createCommentVNode("", true)
@@ -1,6 +1,6 @@
1
1
  import type { PropType as __PropType } from 'vue';
2
2
  import { SearchResultsProductOptions } from '../../types/search-results/SearchResultsOptions';
3
- import { Document } from '@getlupa/client-sdk/Types';
3
+ import type { Document } from '@getlupa/client-sdk/Types';
4
4
  declare const _sfc_main: import("vue").DefineComponent<{
5
5
  options: {
6
6
  type: __PropType<SearchResultsProductOptions>;
@@ -1,5 +1,5 @@
1
1
  import type { PropType as __PropType } from 'vue';
2
- import { Document } from '@getlupa/client-sdk/Types';
2
+ import type { Document } from '@getlupa/client-sdk/Types';
3
3
  import { SearchResultsProductOptions } from '../../types/search-results/SearchResultsOptions';
4
4
  declare const _sfc_main: import("vue").DefineComponent<{
5
5
  options: {
@@ -23,6 +23,10 @@ declare const _sfc_main: import("vue").DefineComponent<{
23
23
  type: __PropType<"itemClick" | "recommendedItemClick">;
24
24
  required: false;
25
25
  };
26
+ sourceItemId: {
27
+ type: __PropType<string | string[]>;
28
+ required: false;
29
+ };
26
30
  }, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
27
31
  product: {
28
32
  type: __PropType<Document>;
@@ -44,5 +48,9 @@ declare const _sfc_main: import("vue").DefineComponent<{
44
48
  type: __PropType<"itemClick" | "recommendedItemClick">;
45
49
  required: false;
46
50
  };
51
+ sourceItemId: {
52
+ type: __PropType<string | string[]>;
53
+ required: false;
54
+ };
47
55
  }>>, {}, {}>;
48
56
  export default _sfc_main;
@@ -1,6 +1,6 @@
1
1
  import type { PropType as __PropType } from 'vue';
2
2
  import { RelatedQueryOptions } from '../../../types/search-results/RelatedQueryOptions';
3
- import { Document } from '@getlupa/client-sdk/Types';
3
+ import type { Document } from '@getlupa/client-sdk/Types';
4
4
  declare const _sfc_main: import("vue").DefineComponent<{
5
5
  query: {
6
6
  type: __PropType<string>;
@@ -31,6 +31,7 @@ export type TrackableEventData = {
31
31
  type?: ReportableEventType;
32
32
  searchQuery?: string;
33
33
  itemId?: string;
34
+ sourceItemId?: string | string[];
34
35
  analytics?: {
35
36
  type: AnalyticsEventType;
36
37
  label: string;
@@ -43,6 +44,7 @@ export type TrackableEventData = {
43
44
  allowEmptySearchQuery: boolean;
44
45
  };
45
46
  filters?: FilterGroup;
47
+ metadata?: Record<string, unknown>;
46
48
  };
47
49
  export type HighlightedDocInfo = {
48
50
  doc?: Document;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@getlupa/vue",
3
- "version": "0.15.13",
3
+ "version": "0.15.15",
4
4
  "main": "dist/lupaSearch.mjs",
5
5
  "module": "dist/lupaSearch.mjs",
6
6
  "types": "dist/src/index.d.ts",
@@ -23,7 +23,7 @@
23
23
  "vue": "^3.0.0"
24
24
  },
25
25
  "devDependencies": {
26
- "@getlupa/client-sdk": "^1.5.4",
26
+ "@getlupa/client-sdk": "^1.6.1",
27
27
  "@pinia/testing": "^0.1.2",
28
28
  "@rollup/plugin-babel": "5.3.0",
29
29
  "@rollup/plugin-commonjs": "^21.0.1",