@getlupa/vue 0.12.2 → 0.12.4

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.
@@ -1611,8 +1611,8 @@ const queryByIds = (queryKey, ids, environment, customBaseUrl) => __awaiter(void
1611
1611
  const errors = yield res.json();
1612
1612
  return { success: false, errors };
1613
1613
  });
1614
- const recommend = (queryKey, recommendForId, environment, customBaseUrl) => __awaiter(void 0, void 0, void 0, function* () {
1615
- const res = yield fetch(`${getApiUrl$1(environment, customBaseUrl)}recommendations/document/${recommendForId}?queryKey=${queryKey}`, Object.assign(Object.assign({}, defaultConfig$1), { method: "GET" }));
1614
+ const recommendForSingleId = (queryKey, recommendForId, environment, customBaseUrl) => __awaiter(void 0, void 0, void 0, function* () {
1615
+ const res = yield fetch(`${getApiUrl$1(environment, customBaseUrl)}recommendations/document/${recommendForId}?recommendationQueryKey=${queryKey}`, Object.assign(Object.assign({}, defaultConfig$1), { method: "GET" }));
1616
1616
  if (res.status < 400) {
1617
1617
  const data = yield res.json();
1618
1618
  return Object.assign(Object.assign({}, data), { success: true });
@@ -1620,6 +1620,19 @@ const recommend = (queryKey, recommendForId, environment, customBaseUrl) => __aw
1620
1620
  const errors = yield res.json();
1621
1621
  return { success: false, errors };
1622
1622
  });
1623
+ const recommendForMultipleIds = (queryKey, recommendForIds, environment, customBaseUrl) => __awaiter(void 0, void 0, void 0, function* () {
1624
+ const limitedRecommendForIds = recommendForIds.slice(0, 20);
1625
+ const res = yield fetch(`${getApiUrl$1(environment, customBaseUrl)}recommendations/documentsByMultipleIds?recommendationQueryKey=${queryKey}&itemId[]=${limitedRecommendForIds.join("&itemId[]=")}`, Object.assign(Object.assign({}, defaultConfig$1), { method: "GET" }));
1626
+ if (res.status < 400) {
1627
+ const data = yield res.json();
1628
+ return Object.assign(Object.assign({}, data), { success: true });
1629
+ }
1630
+ const errors = yield res.json();
1631
+ return { success: false, errors };
1632
+ });
1633
+ const recommend = (queryKey, recommendForId, environment, customBaseUrl) => __awaiter(void 0, void 0, void 0, function* () {
1634
+ return Array.isArray(recommendForId) ? yield recommendForMultipleIds(queryKey, recommendForId, environment, customBaseUrl) : yield recommendForSingleId(queryKey, recommendForId, environment, customBaseUrl);
1635
+ });
1623
1636
  const suggest = (queryKey, query, environment, customBaseUrl) => __awaiter(void 0, void 0, void 0, function* () {
1624
1637
  const res = yield fetch(`${getApiUrl$1(environment, customBaseUrl)}query/${queryKey}`, Object.assign(Object.assign({}, defaultConfig$1), { body: JSON.stringify(query) }));
1625
1638
  if (res.status < 400) {
@@ -6104,12 +6117,10 @@ const _sfc_main$Q = /* @__PURE__ */ vue.defineComponent({
6104
6117
  } = storeToRefs(searchResultStore);
6105
6118
  const currentFilters = vue.computed(() => filters.value);
6106
6119
  const currentDisplayFilters = vue.computed(
6107
- () => hideFiltersOnExactMatchForKeys.value.length ? displayFilters.value.filter(
6108
- (f2) => {
6109
- var _a;
6110
- return !((_a = hideFiltersOnExactMatchForKeys.value) == null ? void 0 : _a.includes(f2.key)) && getNormalizedString(currentQueryText.value) !== getNormalizedString(f2.label);
6111
- }
6112
- ) : displayFilters.value
6120
+ () => hideFiltersOnExactMatchForKeys.value.length ? displayFilters.value.filter((f2) => {
6121
+ var _a;
6122
+ return !((_a = hideFiltersOnExactMatchForKeys.value) == null ? void 0 : _a.includes(f2.key)) || getNormalizedString(currentQueryText.value) !== getNormalizedString(f2.value);
6123
+ }) : displayFilters.value
6113
6124
  );
6114
6125
  const hasFilters = vue.computed(() => {
6115
6126
  var _a;
@@ -1609,8 +1609,8 @@ const queryByIds = (queryKey, ids, environment, customBaseUrl) => __awaiter(void
1609
1609
  const errors = yield res.json();
1610
1610
  return { success: false, errors };
1611
1611
  });
1612
- const recommend = (queryKey, recommendForId, environment, customBaseUrl) => __awaiter(void 0, void 0, void 0, function* () {
1613
- const res = yield fetch(`${getApiUrl$1(environment, customBaseUrl)}recommendations/document/${recommendForId}?queryKey=${queryKey}`, Object.assign(Object.assign({}, defaultConfig$1), { method: "GET" }));
1612
+ const recommendForSingleId = (queryKey, recommendForId, environment, customBaseUrl) => __awaiter(void 0, void 0, void 0, function* () {
1613
+ const res = yield fetch(`${getApiUrl$1(environment, customBaseUrl)}recommendations/document/${recommendForId}?recommendationQueryKey=${queryKey}`, Object.assign(Object.assign({}, defaultConfig$1), { method: "GET" }));
1614
1614
  if (res.status < 400) {
1615
1615
  const data = yield res.json();
1616
1616
  return Object.assign(Object.assign({}, data), { success: true });
@@ -1618,6 +1618,19 @@ const recommend = (queryKey, recommendForId, environment, customBaseUrl) => __aw
1618
1618
  const errors = yield res.json();
1619
1619
  return { success: false, errors };
1620
1620
  });
1621
+ const recommendForMultipleIds = (queryKey, recommendForIds, environment, customBaseUrl) => __awaiter(void 0, void 0, void 0, function* () {
1622
+ const limitedRecommendForIds = recommendForIds.slice(0, 20);
1623
+ const res = yield fetch(`${getApiUrl$1(environment, customBaseUrl)}recommendations/documentsByMultipleIds?recommendationQueryKey=${queryKey}&itemId[]=${limitedRecommendForIds.join("&itemId[]=")}`, Object.assign(Object.assign({}, defaultConfig$1), { method: "GET" }));
1624
+ if (res.status < 400) {
1625
+ const data = yield res.json();
1626
+ return Object.assign(Object.assign({}, data), { success: true });
1627
+ }
1628
+ const errors = yield res.json();
1629
+ return { success: false, errors };
1630
+ });
1631
+ const recommend = (queryKey, recommendForId, environment, customBaseUrl) => __awaiter(void 0, void 0, void 0, function* () {
1632
+ return Array.isArray(recommendForId) ? yield recommendForMultipleIds(queryKey, recommendForId, environment, customBaseUrl) : yield recommendForSingleId(queryKey, recommendForId, environment, customBaseUrl);
1633
+ });
1621
1634
  const suggest = (queryKey, query, environment, customBaseUrl) => __awaiter(void 0, void 0, void 0, function* () {
1622
1635
  const res = yield fetch(`${getApiUrl$1(environment, customBaseUrl)}query/${queryKey}`, Object.assign(Object.assign({}, defaultConfig$1), { body: JSON.stringify(query) }));
1623
1636
  if (res.status < 400) {
@@ -6102,12 +6115,10 @@ const _sfc_main$Q = /* @__PURE__ */ defineComponent({
6102
6115
  } = storeToRefs(searchResultStore);
6103
6116
  const currentFilters = computed(() => filters.value);
6104
6117
  const currentDisplayFilters = computed(
6105
- () => hideFiltersOnExactMatchForKeys.value.length ? displayFilters.value.filter(
6106
- (f2) => {
6107
- var _a;
6108
- return !((_a = hideFiltersOnExactMatchForKeys.value) == null ? void 0 : _a.includes(f2.key)) && getNormalizedString(currentQueryText.value) !== getNormalizedString(f2.label);
6109
- }
6110
- ) : displayFilters.value
6118
+ () => hideFiltersOnExactMatchForKeys.value.length ? displayFilters.value.filter((f2) => {
6119
+ var _a;
6120
+ return !((_a = hideFiltersOnExactMatchForKeys.value) == null ? void 0 : _a.includes(f2.key)) || getNormalizedString(currentQueryText.value) !== getNormalizedString(f2.value);
6121
+ }) : displayFilters.value
6111
6122
  );
6112
6123
  const hasFilters = computed(() => {
6113
6124
  var _a;
@@ -11,7 +11,7 @@ export type ProductRecommendationOptions = SearchResultsProductCardOptions & {
11
11
  } & {
12
12
  containerSelector: string;
13
13
  queryKey: string;
14
- itemId: string;
14
+ itemId: string[] | string;
15
15
  abTesting?: RecommendationABTestingOptions;
16
16
  carousel?: RecommenderCarouselOptions;
17
17
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@getlupa/vue",
3
- "version": "0.12.2",
3
+ "version": "0.12.4",
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.4.2",
26
+ "@getlupa/client-sdk": "^1.5.1",
27
27
  "@pinia/testing": "^0.1.2",
28
28
  "@rollup/plugin-babel": "5.3.0",
29
29
  "@rollup/plugin-commonjs": "^21.0.1",