@getlupa/vue 0.17.8 → 0.17.10

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.
@@ -8163,7 +8163,8 @@ const getLabeledFilters = (filters, facets2, translations) => {
8163
8163
  var _a, _b, _c, _d;
8164
8164
  return __spreadProps(__spreadValues({}, f2), {
8165
8165
  label: (_d = (_c = (_a = translations == null ? void 0 : translations.keyTranslations) == null ? void 0 : _a[f2.key]) != null ? _c : (_b = facets2 == null ? void 0 : facets2.find((ft) => ft.key === f2.key)) == null ? void 0 : _b.label) != null ? _d : capitalize$1(f2.key),
8166
- value: getTranslatedFacetValue({ key: f2.key }, { title: f2.value }, translations)
8166
+ value: getTranslatedFacetValue({ key: f2.key }, { title: f2.value }, translations),
8167
+ originalValue: f2.value
8167
8168
  });
8168
8169
  });
8169
8170
  };
@@ -21335,7 +21336,7 @@ const _sfc_main$X = /* @__PURE__ */ vue.defineComponent({
21335
21336
  toggleTermFilter(
21336
21337
  // TODO: Fix any
21337
21338
  paramsStore.appendParams,
21338
- { type: "terms", value: filter2.value, key: filter2.key },
21339
+ { type: "terms", value: filter2.originalValue, key: filter2.key },
21339
21340
  optionStore.getQueryParamName,
21340
21341
  currentFilters.value
21341
21342
  );
@@ -21343,7 +21344,7 @@ const _sfc_main$X = /* @__PURE__ */ vue.defineComponent({
21343
21344
  case "hierarchy":
21344
21345
  toggleHierarchyFilter(
21345
21346
  paramsStore.appendParams,
21346
- { type: "hierarchy", value: filter2.value, key: filter2.key },
21347
+ { type: "hierarchy", value: filter2.originalValue, key: filter2.key },
21347
21348
  optionStore.getQueryParamName,
21348
21349
  currentFilters.value,
21349
21350
  true
@@ -27410,6 +27411,7 @@ const _sfc_main$a = /* @__PURE__ */ vue.defineComponent({
27410
27411
  }
27411
27412
  };
27412
27413
  vue.onMounted(() => {
27414
+ var _a, _b;
27413
27415
  handleResize();
27414
27416
  optionsStore.setSearchResultOptions({
27415
27417
  options: props.options
@@ -27422,6 +27424,9 @@ const _sfc_main$a = /* @__PURE__ */ vue.defineComponent({
27422
27424
  } else {
27423
27425
  loadRecommendations();
27424
27426
  }
27427
+ if ((_a = props.options.recommendationCallbacks) == null ? void 0 : _a.onMounted) {
27428
+ (_b = props.options.recommendationCallbacks) == null ? void 0 : _b.onMounted();
27429
+ }
27425
27430
  window.addEventListener("resize", handleResize);
27426
27431
  });
27427
27432
  vue.onBeforeUnmount(() => {
@@ -27477,6 +27482,7 @@ const _sfc_main$a = /* @__PURE__ */ vue.defineComponent({
27477
27482
  return typeof props.options.itemId === "string" || typeof props.options.itemId === "number" || Array.isArray(props.options.itemId) ? props.options.itemId : extractValue(props.options.itemId);
27478
27483
  });
27479
27484
  const loadLupaRecommendations = () => __async(this, null, function* () {
27485
+ var _a, _b;
27480
27486
  recommendationsType.value = "recommendations_lupasearch";
27481
27487
  try {
27482
27488
  loading.value = true;
@@ -27494,6 +27500,7 @@ const _sfc_main$a = /* @__PURE__ */ vue.defineComponent({
27494
27500
  yield dynamicDataStore.enhanceSearchResultsWithDynamicData({
27495
27501
  result: { items: result2.recommended }
27496
27502
  });
27503
+ (_b = (_a = props.options.recommendationCallbacks) == null ? void 0 : _a.onRecommenderResults) == null ? void 0 : _b.call(_a, result2.recommended);
27497
27504
  } finally {
27498
27505
  loading.value = false;
27499
27506
  }
@@ -8161,7 +8161,8 @@ const getLabeledFilters = (filters, facets2, translations) => {
8161
8161
  var _a, _b, _c, _d;
8162
8162
  return __spreadProps(__spreadValues({}, f2), {
8163
8163
  label: (_d = (_c = (_a = translations == null ? void 0 : translations.keyTranslations) == null ? void 0 : _a[f2.key]) != null ? _c : (_b = facets2 == null ? void 0 : facets2.find((ft) => ft.key === f2.key)) == null ? void 0 : _b.label) != null ? _d : capitalize$1(f2.key),
8164
- value: getTranslatedFacetValue({ key: f2.key }, { title: f2.value }, translations)
8164
+ value: getTranslatedFacetValue({ key: f2.key }, { title: f2.value }, translations),
8165
+ originalValue: f2.value
8165
8166
  });
8166
8167
  });
8167
8168
  };
@@ -21333,7 +21334,7 @@ const _sfc_main$X = /* @__PURE__ */ defineComponent({
21333
21334
  toggleTermFilter(
21334
21335
  // TODO: Fix any
21335
21336
  paramsStore.appendParams,
21336
- { type: "terms", value: filter2.value, key: filter2.key },
21337
+ { type: "terms", value: filter2.originalValue, key: filter2.key },
21337
21338
  optionStore.getQueryParamName,
21338
21339
  currentFilters.value
21339
21340
  );
@@ -21341,7 +21342,7 @@ const _sfc_main$X = /* @__PURE__ */ defineComponent({
21341
21342
  case "hierarchy":
21342
21343
  toggleHierarchyFilter(
21343
21344
  paramsStore.appendParams,
21344
- { type: "hierarchy", value: filter2.value, key: filter2.key },
21345
+ { type: "hierarchy", value: filter2.originalValue, key: filter2.key },
21345
21346
  optionStore.getQueryParamName,
21346
21347
  currentFilters.value,
21347
21348
  true
@@ -27408,6 +27409,7 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
27408
27409
  }
27409
27410
  };
27410
27411
  onMounted(() => {
27412
+ var _a, _b;
27411
27413
  handleResize();
27412
27414
  optionsStore.setSearchResultOptions({
27413
27415
  options: props.options
@@ -27420,6 +27422,9 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
27420
27422
  } else {
27421
27423
  loadRecommendations();
27422
27424
  }
27425
+ if ((_a = props.options.recommendationCallbacks) == null ? void 0 : _a.onMounted) {
27426
+ (_b = props.options.recommendationCallbacks) == null ? void 0 : _b.onMounted();
27427
+ }
27423
27428
  window.addEventListener("resize", handleResize);
27424
27429
  });
27425
27430
  onBeforeUnmount(() => {
@@ -27475,6 +27480,7 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
27475
27480
  return typeof props.options.itemId === "string" || typeof props.options.itemId === "number" || Array.isArray(props.options.itemId) ? props.options.itemId : extractValue(props.options.itemId);
27476
27481
  });
27477
27482
  const loadLupaRecommendations = () => __async(this, null, function* () {
27483
+ var _a, _b;
27478
27484
  recommendationsType.value = "recommendations_lupasearch";
27479
27485
  try {
27480
27486
  loading.value = true;
@@ -27492,6 +27498,7 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
27492
27498
  yield dynamicDataStore.enhanceSearchResultsWithDynamicData({
27493
27499
  result: { items: result2.recommended }
27494
27500
  });
27501
+ (_b = (_a = props.options.recommendationCallbacks) == null ? void 0 : _a.onRecommenderResults) == null ? void 0 : _b.call(_a, result2.recommended);
27495
27502
  } finally {
27496
27503
  loading.value = false;
27497
27504
  }
@@ -1,4 +1,4 @@
1
- import { FilterGroup } from '@getlupa/client-sdk/Types';
1
+ import type { FilterGroup, Document } from '@getlupa/client-sdk/Types';
2
2
  import type { SdkOptions } from '../General';
3
3
  import { SearchResultsProductOptions } from '../search-results/SearchResultsOptions';
4
4
  import { DataExtraction } from '../DataExtraction';
@@ -8,6 +8,10 @@ export type RecommenderCarouselOptions = {
8
8
  scrollPerPage?: number;
9
9
  breakpoints?: Record<number, RecommenderCarouselOptions>;
10
10
  };
11
+ export type RecommendationCallbacks = {
12
+ onRecommenderResults?: (results: Document[]) => unknown;
13
+ onMounted?: () => unknown;
14
+ };
11
15
  export type ProductRecommendationOptions = SearchResultsProductOptions & {
12
16
  options: SdkOptions;
13
17
  } & {
@@ -22,6 +26,7 @@ export type ProductRecommendationOptions = SearchResultsProductOptions & {
22
26
  recommendationLabels?: {
23
27
  title?: string;
24
28
  };
29
+ recommendationCallbacks?: RecommendationCallbacks;
25
30
  };
26
31
  export type RecommendationABTestingOptions = {
27
32
  enabled: boolean;
@@ -5,5 +5,6 @@ export type UnfoldedFilter = {
5
5
  };
6
6
  export type LabeledFilter = UnfoldedFilter & {
7
7
  label: string;
8
+ originalValue: string;
8
9
  };
9
10
  export type FilterType = 'terms' | 'range' | 'hierarchy';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@getlupa/vue",
3
- "version": "0.17.8",
3
+ "version": "0.17.10",
4
4
  "main": "dist/lupaSearch.mjs",
5
5
  "module": "dist/lupaSearch.mjs",
6
6
  "types": "dist/src/index.d.ts",