@getlupa/client 1.20.1 → 1.20.2

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.
@@ -11983,6 +11983,13 @@ var __async = (__this, __arguments, generator) => {
11983
11983
  }
11984
11984
  return Env$1[environment] || Env$1["production"];
11985
11985
  };
11986
+ const addCustomParams = (url, customParams) => {
11987
+ if (!customParams || Object.keys(customParams).length === 0) {
11988
+ return url;
11989
+ }
11990
+ const separator = url.includes("?") ? "&" : "?";
11991
+ return url + separator + e(customParams);
11992
+ };
11986
11993
  var __awaiter = function(thisArg, _arguments, P, generator) {
11987
11994
  function adopt(value) {
11988
11995
  return value instanceof P ? value : new P(function(resolve2) {
@@ -12040,8 +12047,10 @@ var __async = (__this, __arguments, generator) => {
12040
12047
  const errors = yield res.json();
12041
12048
  return { success: false, errors };
12042
12049
  });
12043
- const search = (queryKey, query, environment, customBaseUrl) => __awaiter(void 0, void 0, void 0, function* () {
12044
- const res = yield fetch(`${getApiUrl$1(environment, customBaseUrl)}query/${queryKey}`, Object.assign(Object.assign({}, defaultConfig), { body: JSON.stringify(query) }));
12050
+ const search = (queryKey, query, environment, customBaseUrl, customParams) => __awaiter(void 0, void 0, void 0, function* () {
12051
+ const endpoint = `${getApiUrl$1(environment, customBaseUrl)}query/${queryKey}`;
12052
+ const url = addCustomParams(endpoint, customParams);
12053
+ const res = yield fetch(url, Object.assign(Object.assign({}, defaultConfig), { body: JSON.stringify(query) }));
12045
12054
  if (res.status < 400) {
12046
12055
  const data = yield res.json();
12047
12056
  return Object.assign(Object.assign({}, data), { success: true });
@@ -12049,8 +12058,10 @@ var __async = (__this, __arguments, generator) => {
12049
12058
  const errors = yield res.json();
12050
12059
  return { success: false, errors };
12051
12060
  });
12052
- const facets = (queryKey, query, environment, customBaseUrl) => __awaiter(void 0, void 0, void 0, function* () {
12053
- const res = yield fetch(`${getApiUrl$1(environment, customBaseUrl)}query/${queryKey}/facets`, Object.assign(Object.assign({}, defaultConfig), { body: JSON.stringify(query) }));
12061
+ const facets = (queryKey, query, environment, customBaseUrl, customParams) => __awaiter(void 0, void 0, void 0, function* () {
12062
+ const endpoint = `${getApiUrl$1(environment, customBaseUrl)}query/${queryKey}/facets`;
12063
+ const url = addCustomParams(endpoint, customParams);
12064
+ const res = yield fetch(url, Object.assign(Object.assign({}, defaultConfig), { body: JSON.stringify(query) }));
12054
12065
  if (res.status < 400) {
12055
12066
  const data = yield res.json();
12056
12067
  return Object.assign(Object.assign({}, data), { success: true });
@@ -12058,8 +12069,10 @@ var __async = (__this, __arguments, generator) => {
12058
12069
  const errors = yield res.json();
12059
12070
  return { success: false, errors };
12060
12071
  });
12061
- const refiners = (queryKey, query, environment, customBaseUrl) => __awaiter(void 0, void 0, void 0, function* () {
12062
- const res = yield fetch(`${getApiUrl$1(environment, customBaseUrl)}query/${queryKey}/refiners`, Object.assign(Object.assign({}, defaultConfig), { body: JSON.stringify(query) }));
12072
+ const refiners = (queryKey, query, environment, customBaseUrl, customParams) => __awaiter(void 0, void 0, void 0, function* () {
12073
+ const endpoint = `${getApiUrl$1(environment, customBaseUrl)}query/${queryKey}/refiners`;
12074
+ const url = addCustomParams(endpoint, customParams);
12075
+ const res = yield fetch(url, Object.assign(Object.assign({}, defaultConfig), { body: JSON.stringify(query) }));
12063
12076
  if (res.status < 400) {
12064
12077
  const data = yield res.json();
12065
12078
  return Object.assign(Object.assign({}, data), { success: true });
@@ -12067,8 +12080,10 @@ var __async = (__this, __arguments, generator) => {
12067
12080
  const errors = yield res.json();
12068
12081
  return { success: false, errors };
12069
12082
  });
12070
- const relatedQueries = (queryKey, query, environment, customBaseUrl) => __awaiter(void 0, void 0, void 0, function* () {
12071
- const res = yield fetch(`${getApiUrl$1(environment, customBaseUrl)}query/${queryKey}/related`, Object.assign(Object.assign({}, defaultConfig), { body: JSON.stringify(query) }));
12083
+ const relatedQueries = (queryKey, query, environment, customBaseUrl, customParams) => __awaiter(void 0, void 0, void 0, function* () {
12084
+ const endpoint = `${getApiUrl$1(environment, customBaseUrl)}query/${queryKey}/related`;
12085
+ const url = addCustomParams(endpoint, customParams);
12086
+ const res = yield fetch(url, Object.assign(Object.assign({}, defaultConfig), { body: JSON.stringify(query) }));
12072
12087
  if (res.status < 400) {
12073
12088
  const data = yield res.json();
12074
12089
  return Object.assign(Object.assign({}, data), { success: true });
@@ -12076,9 +12091,11 @@ var __async = (__this, __arguments, generator) => {
12076
12091
  const errors = yield res.json();
12077
12092
  return { success: false, errors };
12078
12093
  });
12079
- const queryByIds = (queryKey, ids, environment, customBaseUrl) => __awaiter(void 0, void 0, void 0, function* () {
12094
+ const queryByIds = (queryKey, ids, environment, customBaseUrl, customParams) => __awaiter(void 0, void 0, void 0, function* () {
12080
12095
  const idParam = ids.map((id) => `ids=${id}`).join("&");
12081
- const res = yield fetch(`${getApiUrl$1(environment, customBaseUrl)}query/${queryKey}/ids?${idParam}`, Object.assign(Object.assign({}, defaultConfig), { method: "GET" }));
12096
+ const endpoint = `${getApiUrl$1(environment, customBaseUrl)}query/${queryKey}/ids?${idParam}`;
12097
+ const url = addCustomParams(endpoint, customParams);
12098
+ const res = yield fetch(url, Object.assign(Object.assign({}, defaultConfig), { method: "GET" }));
12082
12099
  if (res.status < 400) {
12083
12100
  const data = yield res.json();
12084
12101
  return Object.assign(Object.assign({}, data), { success: true });
@@ -12086,11 +12103,12 @@ var __async = (__this, __arguments, generator) => {
12086
12103
  const errors = yield res.json();
12087
12104
  return { success: false, errors };
12088
12105
  });
12089
- const recommendForSingleId = (queryKey, recommendForId, filters, environment, customBaseUrl) => __awaiter(void 0, void 0, void 0, function* () {
12090
- let url = `${getApiUrl$1(environment, customBaseUrl)}recommendations/document/${recommendForId}?recommendationQueryKey=${queryKey}`;
12106
+ const recommendForSingleId = (queryKey, recommendForId, filters, environment, customBaseUrl, customParams) => __awaiter(void 0, void 0, void 0, function* () {
12107
+ let endpoint = `${getApiUrl$1(environment, customBaseUrl)}recommendations/document/${recommendForId}?recommendationQueryKey=${queryKey}`;
12091
12108
  if (filters) {
12092
- url += `&${e({ filters })}`;
12109
+ endpoint += `&${e({ filters })}`;
12093
12110
  }
12111
+ const url = addCustomParams(endpoint, customParams);
12094
12112
  const res = yield fetch(url, Object.assign(Object.assign({}, defaultConfig), { method: "GET" }));
12095
12113
  if (res.status < 400) {
12096
12114
  const data = yield res.json();
@@ -12099,12 +12117,13 @@ var __async = (__this, __arguments, generator) => {
12099
12117
  const errors = yield res.json();
12100
12118
  return { success: false, errors };
12101
12119
  });
12102
- const recommendForMultipleIds = (queryKey, recommendForIds, filters, environment, customBaseUrl) => __awaiter(void 0, void 0, void 0, function* () {
12120
+ const recommendForMultipleIds = (queryKey, recommendForIds, filters, environment, customBaseUrl, customParams) => __awaiter(void 0, void 0, void 0, function* () {
12103
12121
  const limitedRecommendForIds = recommendForIds.slice(0, 20);
12104
- let url = `${getApiUrl$1(environment, customBaseUrl)}recommendations/documentsByMultipleIds?recommendationQueryKey=${queryKey}&itemId[]=${limitedRecommendForIds.join("&itemId[]=")}`;
12122
+ let endpoint = `${getApiUrl$1(environment, customBaseUrl)}recommendations/documentsByMultipleIds?recommendationQueryKey=${queryKey}&itemId[]=${limitedRecommendForIds.join("&itemId[]=")}`;
12105
12123
  if (filters) {
12106
- url += `&${e({ filters })}`;
12124
+ endpoint += `&${e({ filters })}`;
12107
12125
  }
12126
+ const url = addCustomParams(endpoint, customParams);
12108
12127
  const res = yield fetch(url, Object.assign(Object.assign({}, defaultConfig), { method: "GET" }));
12109
12128
  if (res.status < 400) {
12110
12129
  const data = yield res.json();
@@ -12113,11 +12132,13 @@ var __async = (__this, __arguments, generator) => {
12113
12132
  const errors = yield res.json();
12114
12133
  return { success: false, errors };
12115
12134
  });
12116
- const recommend = (queryKey, recommendForId, filters, environment, customBaseUrl) => __awaiter(void 0, void 0, void 0, function* () {
12117
- return Array.isArray(recommendForId) ? yield recommendForMultipleIds(queryKey, recommendForId, filters, environment, customBaseUrl) : yield recommendForSingleId(queryKey, recommendForId, filters, environment, customBaseUrl);
12135
+ const recommend = (queryKey, recommendForId, filters, environment, customBaseUrl, customParams) => __awaiter(void 0, void 0, void 0, function* () {
12136
+ return Array.isArray(recommendForId) ? yield recommendForMultipleIds(queryKey, recommendForId, filters, environment, customBaseUrl, customParams) : yield recommendForSingleId(queryKey, recommendForId, filters, environment, customBaseUrl, customParams);
12118
12137
  });
12119
- const suggest = (queryKey, query, environment, customBaseUrl) => __awaiter(void 0, void 0, void 0, function* () {
12120
- const res = yield fetch(`${getApiUrl$1(environment, customBaseUrl)}query/${queryKey}`, Object.assign(Object.assign({}, defaultConfig), { body: JSON.stringify(query) }));
12138
+ const suggest = (queryKey, query, environment, customBaseUrl, customParams) => __awaiter(void 0, void 0, void 0, function* () {
12139
+ const endpoint = `${getApiUrl$1(environment, customBaseUrl)}query/${queryKey}`;
12140
+ const url = addCustomParams(endpoint, customParams);
12141
+ const res = yield fetch(url, Object.assign(Object.assign({}, defaultConfig), { body: JSON.stringify(query) }));
12121
12142
  if (res.status < 400) {
12122
12143
  const items = yield res.json();
12123
12144
  return { items, success: true };
@@ -12149,31 +12170,31 @@ var __async = (__this, __arguments, generator) => {
12149
12170
  if (options === null || options === void 0 ? void 0 : options.customUrl) {
12150
12171
  return searchCustom(publicQuery, options);
12151
12172
  }
12152
- return search(queryKey, publicQuery, (options === null || options === void 0 ? void 0 : options.environment) || "production", options === null || options === void 0 ? void 0 : options.customBaseUrl);
12173
+ return search(queryKey, publicQuery, (options === null || options === void 0 ? void 0 : options.environment) || "production", options === null || options === void 0 ? void 0 : options.customBaseUrl, options === null || options === void 0 ? void 0 : options.customParams);
12153
12174
  },
12154
12175
  queryFacets: (queryKey, publicQuery, options = null) => {
12155
- return facets(queryKey, publicQuery, (options === null || options === void 0 ? void 0 : options.environment) || "production", options === null || options === void 0 ? void 0 : options.customBaseUrl);
12176
+ return facets(queryKey, publicQuery, (options === null || options === void 0 ? void 0 : options.environment) || "production", options === null || options === void 0 ? void 0 : options.customBaseUrl, options === null || options === void 0 ? void 0 : options.customParams);
12156
12177
  },
12157
12178
  queryRefiners: (queryKey, publicQuery, options = null) => {
12158
- return refiners(queryKey, publicQuery, (options === null || options === void 0 ? void 0 : options.environment) || "production", options === null || options === void 0 ? void 0 : options.customBaseUrl);
12179
+ return refiners(queryKey, publicQuery, (options === null || options === void 0 ? void 0 : options.environment) || "production", options === null || options === void 0 ? void 0 : options.customBaseUrl, options === null || options === void 0 ? void 0 : options.customParams);
12159
12180
  },
12160
12181
  queryRelated: (queryKey, publicQuery, options = null) => {
12161
- return relatedQueries(queryKey, publicQuery, (options === null || options === void 0 ? void 0 : options.environment) || "production", options === null || options === void 0 ? void 0 : options.customBaseUrl);
12182
+ return relatedQueries(queryKey, publicQuery, (options === null || options === void 0 ? void 0 : options.environment) || "production", options === null || options === void 0 ? void 0 : options.customBaseUrl, options === null || options === void 0 ? void 0 : options.customParams);
12162
12183
  },
12163
12184
  suggestions: (queryKey, suggestionQuery, options = null) => {
12164
12185
  if (options === null || options === void 0 ? void 0 : options.customUrl) {
12165
12186
  return suggestCustom(suggestionQuery, options);
12166
12187
  }
12167
- return suggest(queryKey, suggestionQuery, (options === null || options === void 0 ? void 0 : options.environment) || "production", options === null || options === void 0 ? void 0 : options.customBaseUrl);
12188
+ return suggest(queryKey, suggestionQuery, (options === null || options === void 0 ? void 0 : options.environment) || "production", options === null || options === void 0 ? void 0 : options.customBaseUrl, options === null || options === void 0 ? void 0 : options.customParams);
12168
12189
  },
12169
12190
  track: (queryKey, eventData, options = null) => {
12170
12191
  return track$1(queryKey, eventData, (options === null || options === void 0 ? void 0 : options.environment) || "production", options === null || options === void 0 ? void 0 : options.customBaseUrl);
12171
12192
  },
12172
12193
  recommend: (queryKey, recommendForId, filters, options = null) => {
12173
- return recommend(queryKey, recommendForId, filters, (options === null || options === void 0 ? void 0 : options.environment) || "production", options === null || options === void 0 ? void 0 : options.customBaseUrl);
12194
+ return recommend(queryKey, recommendForId, filters, (options === null || options === void 0 ? void 0 : options.environment) || "production", options === null || options === void 0 ? void 0 : options.customBaseUrl, options === null || options === void 0 ? void 0 : options.customParams);
12174
12195
  },
12175
12196
  queryByIds: (queryKey, ids, options = null) => {
12176
- return queryByIds(queryKey, ids, (options === null || options === void 0 ? void 0 : options.environment) || "production", options === null || options === void 0 ? void 0 : options.customBaseUrl);
12197
+ return queryByIds(queryKey, ids, (options === null || options === void 0 ? void 0 : options.environment) || "production", options === null || options === void 0 ? void 0 : options.customBaseUrl, options === null || options === void 0 ? void 0 : options.customParams);
12177
12198
  },
12178
12199
  loadRedirectionRules: (queryKey, options = null) => {
12179
12200
  return loadRedirectionRules(queryKey, (options === null || options === void 0 ? void 0 : options.environment) || "production", options === null || options === void 0 ? void 0 : options.customBaseUrl);
@@ -11983,6 +11983,13 @@ const getApiUrl$1 = (environment, customBaseUrl) => {
11983
11983
  }
11984
11984
  return Env$1[environment] || Env$1["production"];
11985
11985
  };
11986
+ const addCustomParams = (url, customParams) => {
11987
+ if (!customParams || Object.keys(customParams).length === 0) {
11988
+ return url;
11989
+ }
11990
+ const separator = url.includes("?") ? "&" : "?";
11991
+ return url + separator + e(customParams);
11992
+ };
11986
11993
  var __awaiter = function(thisArg, _arguments, P, generator) {
11987
11994
  function adopt(value) {
11988
11995
  return value instanceof P ? value : new P(function(resolve2) {
@@ -12040,8 +12047,10 @@ const suggestCustom = (query, options) => __awaiter(void 0, void 0, void 0, func
12040
12047
  const errors = yield res.json();
12041
12048
  return { success: false, errors };
12042
12049
  });
12043
- const search = (queryKey, query, environment, customBaseUrl) => __awaiter(void 0, void 0, void 0, function* () {
12044
- const res = yield fetch(`${getApiUrl$1(environment, customBaseUrl)}query/${queryKey}`, Object.assign(Object.assign({}, defaultConfig), { body: JSON.stringify(query) }));
12050
+ const search = (queryKey, query, environment, customBaseUrl, customParams) => __awaiter(void 0, void 0, void 0, function* () {
12051
+ const endpoint = `${getApiUrl$1(environment, customBaseUrl)}query/${queryKey}`;
12052
+ const url = addCustomParams(endpoint, customParams);
12053
+ const res = yield fetch(url, Object.assign(Object.assign({}, defaultConfig), { body: JSON.stringify(query) }));
12045
12054
  if (res.status < 400) {
12046
12055
  const data = yield res.json();
12047
12056
  return Object.assign(Object.assign({}, data), { success: true });
@@ -12049,8 +12058,10 @@ const search = (queryKey, query, environment, customBaseUrl) => __awaiter(void 0
12049
12058
  const errors = yield res.json();
12050
12059
  return { success: false, errors };
12051
12060
  });
12052
- const facets = (queryKey, query, environment, customBaseUrl) => __awaiter(void 0, void 0, void 0, function* () {
12053
- const res = yield fetch(`${getApiUrl$1(environment, customBaseUrl)}query/${queryKey}/facets`, Object.assign(Object.assign({}, defaultConfig), { body: JSON.stringify(query) }));
12061
+ const facets = (queryKey, query, environment, customBaseUrl, customParams) => __awaiter(void 0, void 0, void 0, function* () {
12062
+ const endpoint = `${getApiUrl$1(environment, customBaseUrl)}query/${queryKey}/facets`;
12063
+ const url = addCustomParams(endpoint, customParams);
12064
+ const res = yield fetch(url, Object.assign(Object.assign({}, defaultConfig), { body: JSON.stringify(query) }));
12054
12065
  if (res.status < 400) {
12055
12066
  const data = yield res.json();
12056
12067
  return Object.assign(Object.assign({}, data), { success: true });
@@ -12058,8 +12069,10 @@ const facets = (queryKey, query, environment, customBaseUrl) => __awaiter(void 0
12058
12069
  const errors = yield res.json();
12059
12070
  return { success: false, errors };
12060
12071
  });
12061
- const refiners = (queryKey, query, environment, customBaseUrl) => __awaiter(void 0, void 0, void 0, function* () {
12062
- const res = yield fetch(`${getApiUrl$1(environment, customBaseUrl)}query/${queryKey}/refiners`, Object.assign(Object.assign({}, defaultConfig), { body: JSON.stringify(query) }));
12072
+ const refiners = (queryKey, query, environment, customBaseUrl, customParams) => __awaiter(void 0, void 0, void 0, function* () {
12073
+ const endpoint = `${getApiUrl$1(environment, customBaseUrl)}query/${queryKey}/refiners`;
12074
+ const url = addCustomParams(endpoint, customParams);
12075
+ const res = yield fetch(url, Object.assign(Object.assign({}, defaultConfig), { body: JSON.stringify(query) }));
12063
12076
  if (res.status < 400) {
12064
12077
  const data = yield res.json();
12065
12078
  return Object.assign(Object.assign({}, data), { success: true });
@@ -12067,8 +12080,10 @@ const refiners = (queryKey, query, environment, customBaseUrl) => __awaiter(void
12067
12080
  const errors = yield res.json();
12068
12081
  return { success: false, errors };
12069
12082
  });
12070
- const relatedQueries = (queryKey, query, environment, customBaseUrl) => __awaiter(void 0, void 0, void 0, function* () {
12071
- const res = yield fetch(`${getApiUrl$1(environment, customBaseUrl)}query/${queryKey}/related`, Object.assign(Object.assign({}, defaultConfig), { body: JSON.stringify(query) }));
12083
+ const relatedQueries = (queryKey, query, environment, customBaseUrl, customParams) => __awaiter(void 0, void 0, void 0, function* () {
12084
+ const endpoint = `${getApiUrl$1(environment, customBaseUrl)}query/${queryKey}/related`;
12085
+ const url = addCustomParams(endpoint, customParams);
12086
+ const res = yield fetch(url, Object.assign(Object.assign({}, defaultConfig), { body: JSON.stringify(query) }));
12072
12087
  if (res.status < 400) {
12073
12088
  const data = yield res.json();
12074
12089
  return Object.assign(Object.assign({}, data), { success: true });
@@ -12076,9 +12091,11 @@ const relatedQueries = (queryKey, query, environment, customBaseUrl) => __awaite
12076
12091
  const errors = yield res.json();
12077
12092
  return { success: false, errors };
12078
12093
  });
12079
- const queryByIds = (queryKey, ids, environment, customBaseUrl) => __awaiter(void 0, void 0, void 0, function* () {
12094
+ const queryByIds = (queryKey, ids, environment, customBaseUrl, customParams) => __awaiter(void 0, void 0, void 0, function* () {
12080
12095
  const idParam = ids.map((id) => `ids=${id}`).join("&");
12081
- const res = yield fetch(`${getApiUrl$1(environment, customBaseUrl)}query/${queryKey}/ids?${idParam}`, Object.assign(Object.assign({}, defaultConfig), { method: "GET" }));
12096
+ const endpoint = `${getApiUrl$1(environment, customBaseUrl)}query/${queryKey}/ids?${idParam}`;
12097
+ const url = addCustomParams(endpoint, customParams);
12098
+ const res = yield fetch(url, Object.assign(Object.assign({}, defaultConfig), { method: "GET" }));
12082
12099
  if (res.status < 400) {
12083
12100
  const data = yield res.json();
12084
12101
  return Object.assign(Object.assign({}, data), { success: true });
@@ -12086,11 +12103,12 @@ const queryByIds = (queryKey, ids, environment, customBaseUrl) => __awaiter(void
12086
12103
  const errors = yield res.json();
12087
12104
  return { success: false, errors };
12088
12105
  });
12089
- const recommendForSingleId = (queryKey, recommendForId, filters, environment, customBaseUrl) => __awaiter(void 0, void 0, void 0, function* () {
12090
- let url = `${getApiUrl$1(environment, customBaseUrl)}recommendations/document/${recommendForId}?recommendationQueryKey=${queryKey}`;
12106
+ const recommendForSingleId = (queryKey, recommendForId, filters, environment, customBaseUrl, customParams) => __awaiter(void 0, void 0, void 0, function* () {
12107
+ let endpoint = `${getApiUrl$1(environment, customBaseUrl)}recommendations/document/${recommendForId}?recommendationQueryKey=${queryKey}`;
12091
12108
  if (filters) {
12092
- url += `&${e({ filters })}`;
12109
+ endpoint += `&${e({ filters })}`;
12093
12110
  }
12111
+ const url = addCustomParams(endpoint, customParams);
12094
12112
  const res = yield fetch(url, Object.assign(Object.assign({}, defaultConfig), { method: "GET" }));
12095
12113
  if (res.status < 400) {
12096
12114
  const data = yield res.json();
@@ -12099,12 +12117,13 @@ const recommendForSingleId = (queryKey, recommendForId, filters, environment, cu
12099
12117
  const errors = yield res.json();
12100
12118
  return { success: false, errors };
12101
12119
  });
12102
- const recommendForMultipleIds = (queryKey, recommendForIds, filters, environment, customBaseUrl) => __awaiter(void 0, void 0, void 0, function* () {
12120
+ const recommendForMultipleIds = (queryKey, recommendForIds, filters, environment, customBaseUrl, customParams) => __awaiter(void 0, void 0, void 0, function* () {
12103
12121
  const limitedRecommendForIds = recommendForIds.slice(0, 20);
12104
- let url = `${getApiUrl$1(environment, customBaseUrl)}recommendations/documentsByMultipleIds?recommendationQueryKey=${queryKey}&itemId[]=${limitedRecommendForIds.join("&itemId[]=")}`;
12122
+ let endpoint = `${getApiUrl$1(environment, customBaseUrl)}recommendations/documentsByMultipleIds?recommendationQueryKey=${queryKey}&itemId[]=${limitedRecommendForIds.join("&itemId[]=")}`;
12105
12123
  if (filters) {
12106
- url += `&${e({ filters })}`;
12124
+ endpoint += `&${e({ filters })}`;
12107
12125
  }
12126
+ const url = addCustomParams(endpoint, customParams);
12108
12127
  const res = yield fetch(url, Object.assign(Object.assign({}, defaultConfig), { method: "GET" }));
12109
12128
  if (res.status < 400) {
12110
12129
  const data = yield res.json();
@@ -12113,11 +12132,13 @@ const recommendForMultipleIds = (queryKey, recommendForIds, filters, environment
12113
12132
  const errors = yield res.json();
12114
12133
  return { success: false, errors };
12115
12134
  });
12116
- const recommend = (queryKey, recommendForId, filters, environment, customBaseUrl) => __awaiter(void 0, void 0, void 0, function* () {
12117
- return Array.isArray(recommendForId) ? yield recommendForMultipleIds(queryKey, recommendForId, filters, environment, customBaseUrl) : yield recommendForSingleId(queryKey, recommendForId, filters, environment, customBaseUrl);
12135
+ const recommend = (queryKey, recommendForId, filters, environment, customBaseUrl, customParams) => __awaiter(void 0, void 0, void 0, function* () {
12136
+ return Array.isArray(recommendForId) ? yield recommendForMultipleIds(queryKey, recommendForId, filters, environment, customBaseUrl, customParams) : yield recommendForSingleId(queryKey, recommendForId, filters, environment, customBaseUrl, customParams);
12118
12137
  });
12119
- const suggest = (queryKey, query, environment, customBaseUrl) => __awaiter(void 0, void 0, void 0, function* () {
12120
- const res = yield fetch(`${getApiUrl$1(environment, customBaseUrl)}query/${queryKey}`, Object.assign(Object.assign({}, defaultConfig), { body: JSON.stringify(query) }));
12138
+ const suggest = (queryKey, query, environment, customBaseUrl, customParams) => __awaiter(void 0, void 0, void 0, function* () {
12139
+ const endpoint = `${getApiUrl$1(environment, customBaseUrl)}query/${queryKey}`;
12140
+ const url = addCustomParams(endpoint, customParams);
12141
+ const res = yield fetch(url, Object.assign(Object.assign({}, defaultConfig), { body: JSON.stringify(query) }));
12121
12142
  if (res.status < 400) {
12122
12143
  const items = yield res.json();
12123
12144
  return { items, success: true };
@@ -12149,31 +12170,31 @@ const LupaSearchSdk = {
12149
12170
  if (options === null || options === void 0 ? void 0 : options.customUrl) {
12150
12171
  return searchCustom(publicQuery, options);
12151
12172
  }
12152
- return search(queryKey, publicQuery, (options === null || options === void 0 ? void 0 : options.environment) || "production", options === null || options === void 0 ? void 0 : options.customBaseUrl);
12173
+ return search(queryKey, publicQuery, (options === null || options === void 0 ? void 0 : options.environment) || "production", options === null || options === void 0 ? void 0 : options.customBaseUrl, options === null || options === void 0 ? void 0 : options.customParams);
12153
12174
  },
12154
12175
  queryFacets: (queryKey, publicQuery, options = null) => {
12155
- return facets(queryKey, publicQuery, (options === null || options === void 0 ? void 0 : options.environment) || "production", options === null || options === void 0 ? void 0 : options.customBaseUrl);
12176
+ return facets(queryKey, publicQuery, (options === null || options === void 0 ? void 0 : options.environment) || "production", options === null || options === void 0 ? void 0 : options.customBaseUrl, options === null || options === void 0 ? void 0 : options.customParams);
12156
12177
  },
12157
12178
  queryRefiners: (queryKey, publicQuery, options = null) => {
12158
- return refiners(queryKey, publicQuery, (options === null || options === void 0 ? void 0 : options.environment) || "production", options === null || options === void 0 ? void 0 : options.customBaseUrl);
12179
+ return refiners(queryKey, publicQuery, (options === null || options === void 0 ? void 0 : options.environment) || "production", options === null || options === void 0 ? void 0 : options.customBaseUrl, options === null || options === void 0 ? void 0 : options.customParams);
12159
12180
  },
12160
12181
  queryRelated: (queryKey, publicQuery, options = null) => {
12161
- return relatedQueries(queryKey, publicQuery, (options === null || options === void 0 ? void 0 : options.environment) || "production", options === null || options === void 0 ? void 0 : options.customBaseUrl);
12182
+ return relatedQueries(queryKey, publicQuery, (options === null || options === void 0 ? void 0 : options.environment) || "production", options === null || options === void 0 ? void 0 : options.customBaseUrl, options === null || options === void 0 ? void 0 : options.customParams);
12162
12183
  },
12163
12184
  suggestions: (queryKey, suggestionQuery, options = null) => {
12164
12185
  if (options === null || options === void 0 ? void 0 : options.customUrl) {
12165
12186
  return suggestCustom(suggestionQuery, options);
12166
12187
  }
12167
- return suggest(queryKey, suggestionQuery, (options === null || options === void 0 ? void 0 : options.environment) || "production", options === null || options === void 0 ? void 0 : options.customBaseUrl);
12188
+ return suggest(queryKey, suggestionQuery, (options === null || options === void 0 ? void 0 : options.environment) || "production", options === null || options === void 0 ? void 0 : options.customBaseUrl, options === null || options === void 0 ? void 0 : options.customParams);
12168
12189
  },
12169
12190
  track: (queryKey, eventData, options = null) => {
12170
12191
  return track$1(queryKey, eventData, (options === null || options === void 0 ? void 0 : options.environment) || "production", options === null || options === void 0 ? void 0 : options.customBaseUrl);
12171
12192
  },
12172
12193
  recommend: (queryKey, recommendForId, filters, options = null) => {
12173
- return recommend(queryKey, recommendForId, filters, (options === null || options === void 0 ? void 0 : options.environment) || "production", options === null || options === void 0 ? void 0 : options.customBaseUrl);
12194
+ return recommend(queryKey, recommendForId, filters, (options === null || options === void 0 ? void 0 : options.environment) || "production", options === null || options === void 0 ? void 0 : options.customBaseUrl, options === null || options === void 0 ? void 0 : options.customParams);
12174
12195
  },
12175
12196
  queryByIds: (queryKey, ids, options = null) => {
12176
- return queryByIds(queryKey, ids, (options === null || options === void 0 ? void 0 : options.environment) || "production", options === null || options === void 0 ? void 0 : options.customBaseUrl);
12197
+ return queryByIds(queryKey, ids, (options === null || options === void 0 ? void 0 : options.environment) || "production", options === null || options === void 0 ? void 0 : options.customBaseUrl, options === null || options === void 0 ? void 0 : options.customParams);
12177
12198
  },
12178
12199
  loadRedirectionRules: (queryKey, options = null) => {
12179
12200
  return loadRedirectionRules(queryKey, (options === null || options === void 0 ? void 0 : options.environment) || "production", options === null || options === void 0 ? void 0 : options.customBaseUrl);
@@ -11981,6 +11981,13 @@ const getApiUrl$1 = (environment, customBaseUrl) => {
11981
11981
  }
11982
11982
  return Env$1[environment] || Env$1["production"];
11983
11983
  };
11984
+ const addCustomParams = (url, customParams) => {
11985
+ if (!customParams || Object.keys(customParams).length === 0) {
11986
+ return url;
11987
+ }
11988
+ const separator = url.includes("?") ? "&" : "?";
11989
+ return url + separator + e(customParams);
11990
+ };
11984
11991
  var __awaiter = function(thisArg, _arguments, P, generator) {
11985
11992
  function adopt(value) {
11986
11993
  return value instanceof P ? value : new P(function(resolve2) {
@@ -12038,8 +12045,10 @@ const suggestCustom = (query, options) => __awaiter(void 0, void 0, void 0, func
12038
12045
  const errors = yield res.json();
12039
12046
  return { success: false, errors };
12040
12047
  });
12041
- const search = (queryKey, query, environment, customBaseUrl) => __awaiter(void 0, void 0, void 0, function* () {
12042
- const res = yield fetch(`${getApiUrl$1(environment, customBaseUrl)}query/${queryKey}`, Object.assign(Object.assign({}, defaultConfig), { body: JSON.stringify(query) }));
12048
+ const search = (queryKey, query, environment, customBaseUrl, customParams) => __awaiter(void 0, void 0, void 0, function* () {
12049
+ const endpoint = `${getApiUrl$1(environment, customBaseUrl)}query/${queryKey}`;
12050
+ const url = addCustomParams(endpoint, customParams);
12051
+ const res = yield fetch(url, Object.assign(Object.assign({}, defaultConfig), { body: JSON.stringify(query) }));
12043
12052
  if (res.status < 400) {
12044
12053
  const data = yield res.json();
12045
12054
  return Object.assign(Object.assign({}, data), { success: true });
@@ -12047,8 +12056,10 @@ const search = (queryKey, query, environment, customBaseUrl) => __awaiter(void 0
12047
12056
  const errors = yield res.json();
12048
12057
  return { success: false, errors };
12049
12058
  });
12050
- const facets = (queryKey, query, environment, customBaseUrl) => __awaiter(void 0, void 0, void 0, function* () {
12051
- const res = yield fetch(`${getApiUrl$1(environment, customBaseUrl)}query/${queryKey}/facets`, Object.assign(Object.assign({}, defaultConfig), { body: JSON.stringify(query) }));
12059
+ const facets = (queryKey, query, environment, customBaseUrl, customParams) => __awaiter(void 0, void 0, void 0, function* () {
12060
+ const endpoint = `${getApiUrl$1(environment, customBaseUrl)}query/${queryKey}/facets`;
12061
+ const url = addCustomParams(endpoint, customParams);
12062
+ const res = yield fetch(url, Object.assign(Object.assign({}, defaultConfig), { body: JSON.stringify(query) }));
12052
12063
  if (res.status < 400) {
12053
12064
  const data = yield res.json();
12054
12065
  return Object.assign(Object.assign({}, data), { success: true });
@@ -12056,8 +12067,10 @@ const facets = (queryKey, query, environment, customBaseUrl) => __awaiter(void 0
12056
12067
  const errors = yield res.json();
12057
12068
  return { success: false, errors };
12058
12069
  });
12059
- const refiners = (queryKey, query, environment, customBaseUrl) => __awaiter(void 0, void 0, void 0, function* () {
12060
- const res = yield fetch(`${getApiUrl$1(environment, customBaseUrl)}query/${queryKey}/refiners`, Object.assign(Object.assign({}, defaultConfig), { body: JSON.stringify(query) }));
12070
+ const refiners = (queryKey, query, environment, customBaseUrl, customParams) => __awaiter(void 0, void 0, void 0, function* () {
12071
+ const endpoint = `${getApiUrl$1(environment, customBaseUrl)}query/${queryKey}/refiners`;
12072
+ const url = addCustomParams(endpoint, customParams);
12073
+ const res = yield fetch(url, Object.assign(Object.assign({}, defaultConfig), { body: JSON.stringify(query) }));
12061
12074
  if (res.status < 400) {
12062
12075
  const data = yield res.json();
12063
12076
  return Object.assign(Object.assign({}, data), { success: true });
@@ -12065,8 +12078,10 @@ const refiners = (queryKey, query, environment, customBaseUrl) => __awaiter(void
12065
12078
  const errors = yield res.json();
12066
12079
  return { success: false, errors };
12067
12080
  });
12068
- const relatedQueries = (queryKey, query, environment, customBaseUrl) => __awaiter(void 0, void 0, void 0, function* () {
12069
- const res = yield fetch(`${getApiUrl$1(environment, customBaseUrl)}query/${queryKey}/related`, Object.assign(Object.assign({}, defaultConfig), { body: JSON.stringify(query) }));
12081
+ const relatedQueries = (queryKey, query, environment, customBaseUrl, customParams) => __awaiter(void 0, void 0, void 0, function* () {
12082
+ const endpoint = `${getApiUrl$1(environment, customBaseUrl)}query/${queryKey}/related`;
12083
+ const url = addCustomParams(endpoint, customParams);
12084
+ const res = yield fetch(url, Object.assign(Object.assign({}, defaultConfig), { body: JSON.stringify(query) }));
12070
12085
  if (res.status < 400) {
12071
12086
  const data = yield res.json();
12072
12087
  return Object.assign(Object.assign({}, data), { success: true });
@@ -12074,9 +12089,11 @@ const relatedQueries = (queryKey, query, environment, customBaseUrl) => __awaite
12074
12089
  const errors = yield res.json();
12075
12090
  return { success: false, errors };
12076
12091
  });
12077
- const queryByIds = (queryKey, ids, environment, customBaseUrl) => __awaiter(void 0, void 0, void 0, function* () {
12092
+ const queryByIds = (queryKey, ids, environment, customBaseUrl, customParams) => __awaiter(void 0, void 0, void 0, function* () {
12078
12093
  const idParam = ids.map((id) => `ids=${id}`).join("&");
12079
- const res = yield fetch(`${getApiUrl$1(environment, customBaseUrl)}query/${queryKey}/ids?${idParam}`, Object.assign(Object.assign({}, defaultConfig), { method: "GET" }));
12094
+ const endpoint = `${getApiUrl$1(environment, customBaseUrl)}query/${queryKey}/ids?${idParam}`;
12095
+ const url = addCustomParams(endpoint, customParams);
12096
+ const res = yield fetch(url, Object.assign(Object.assign({}, defaultConfig), { method: "GET" }));
12080
12097
  if (res.status < 400) {
12081
12098
  const data = yield res.json();
12082
12099
  return Object.assign(Object.assign({}, data), { success: true });
@@ -12084,11 +12101,12 @@ const queryByIds = (queryKey, ids, environment, customBaseUrl) => __awaiter(void
12084
12101
  const errors = yield res.json();
12085
12102
  return { success: false, errors };
12086
12103
  });
12087
- const recommendForSingleId = (queryKey, recommendForId, filters, environment, customBaseUrl) => __awaiter(void 0, void 0, void 0, function* () {
12088
- let url = `${getApiUrl$1(environment, customBaseUrl)}recommendations/document/${recommendForId}?recommendationQueryKey=${queryKey}`;
12104
+ const recommendForSingleId = (queryKey, recommendForId, filters, environment, customBaseUrl, customParams) => __awaiter(void 0, void 0, void 0, function* () {
12105
+ let endpoint = `${getApiUrl$1(environment, customBaseUrl)}recommendations/document/${recommendForId}?recommendationQueryKey=${queryKey}`;
12089
12106
  if (filters) {
12090
- url += `&${e({ filters })}`;
12107
+ endpoint += `&${e({ filters })}`;
12091
12108
  }
12109
+ const url = addCustomParams(endpoint, customParams);
12092
12110
  const res = yield fetch(url, Object.assign(Object.assign({}, defaultConfig), { method: "GET" }));
12093
12111
  if (res.status < 400) {
12094
12112
  const data = yield res.json();
@@ -12097,12 +12115,13 @@ const recommendForSingleId = (queryKey, recommendForId, filters, environment, cu
12097
12115
  const errors = yield res.json();
12098
12116
  return { success: false, errors };
12099
12117
  });
12100
- const recommendForMultipleIds = (queryKey, recommendForIds, filters, environment, customBaseUrl) => __awaiter(void 0, void 0, void 0, function* () {
12118
+ const recommendForMultipleIds = (queryKey, recommendForIds, filters, environment, customBaseUrl, customParams) => __awaiter(void 0, void 0, void 0, function* () {
12101
12119
  const limitedRecommendForIds = recommendForIds.slice(0, 20);
12102
- let url = `${getApiUrl$1(environment, customBaseUrl)}recommendations/documentsByMultipleIds?recommendationQueryKey=${queryKey}&itemId[]=${limitedRecommendForIds.join("&itemId[]=")}`;
12120
+ let endpoint = `${getApiUrl$1(environment, customBaseUrl)}recommendations/documentsByMultipleIds?recommendationQueryKey=${queryKey}&itemId[]=${limitedRecommendForIds.join("&itemId[]=")}`;
12103
12121
  if (filters) {
12104
- url += `&${e({ filters })}`;
12122
+ endpoint += `&${e({ filters })}`;
12105
12123
  }
12124
+ const url = addCustomParams(endpoint, customParams);
12106
12125
  const res = yield fetch(url, Object.assign(Object.assign({}, defaultConfig), { method: "GET" }));
12107
12126
  if (res.status < 400) {
12108
12127
  const data = yield res.json();
@@ -12111,11 +12130,13 @@ const recommendForMultipleIds = (queryKey, recommendForIds, filters, environment
12111
12130
  const errors = yield res.json();
12112
12131
  return { success: false, errors };
12113
12132
  });
12114
- const recommend = (queryKey, recommendForId, filters, environment, customBaseUrl) => __awaiter(void 0, void 0, void 0, function* () {
12115
- return Array.isArray(recommendForId) ? yield recommendForMultipleIds(queryKey, recommendForId, filters, environment, customBaseUrl) : yield recommendForSingleId(queryKey, recommendForId, filters, environment, customBaseUrl);
12133
+ const recommend = (queryKey, recommendForId, filters, environment, customBaseUrl, customParams) => __awaiter(void 0, void 0, void 0, function* () {
12134
+ return Array.isArray(recommendForId) ? yield recommendForMultipleIds(queryKey, recommendForId, filters, environment, customBaseUrl, customParams) : yield recommendForSingleId(queryKey, recommendForId, filters, environment, customBaseUrl, customParams);
12116
12135
  });
12117
- const suggest = (queryKey, query, environment, customBaseUrl) => __awaiter(void 0, void 0, void 0, function* () {
12118
- const res = yield fetch(`${getApiUrl$1(environment, customBaseUrl)}query/${queryKey}`, Object.assign(Object.assign({}, defaultConfig), { body: JSON.stringify(query) }));
12136
+ const suggest = (queryKey, query, environment, customBaseUrl, customParams) => __awaiter(void 0, void 0, void 0, function* () {
12137
+ const endpoint = `${getApiUrl$1(environment, customBaseUrl)}query/${queryKey}`;
12138
+ const url = addCustomParams(endpoint, customParams);
12139
+ const res = yield fetch(url, Object.assign(Object.assign({}, defaultConfig), { body: JSON.stringify(query) }));
12119
12140
  if (res.status < 400) {
12120
12141
  const items = yield res.json();
12121
12142
  return { items, success: true };
@@ -12147,31 +12168,31 @@ const LupaSearchSdk = {
12147
12168
  if (options === null || options === void 0 ? void 0 : options.customUrl) {
12148
12169
  return searchCustom(publicQuery, options);
12149
12170
  }
12150
- return search(queryKey, publicQuery, (options === null || options === void 0 ? void 0 : options.environment) || "production", options === null || options === void 0 ? void 0 : options.customBaseUrl);
12171
+ return search(queryKey, publicQuery, (options === null || options === void 0 ? void 0 : options.environment) || "production", options === null || options === void 0 ? void 0 : options.customBaseUrl, options === null || options === void 0 ? void 0 : options.customParams);
12151
12172
  },
12152
12173
  queryFacets: (queryKey, publicQuery, options = null) => {
12153
- return facets(queryKey, publicQuery, (options === null || options === void 0 ? void 0 : options.environment) || "production", options === null || options === void 0 ? void 0 : options.customBaseUrl);
12174
+ return facets(queryKey, publicQuery, (options === null || options === void 0 ? void 0 : options.environment) || "production", options === null || options === void 0 ? void 0 : options.customBaseUrl, options === null || options === void 0 ? void 0 : options.customParams);
12154
12175
  },
12155
12176
  queryRefiners: (queryKey, publicQuery, options = null) => {
12156
- return refiners(queryKey, publicQuery, (options === null || options === void 0 ? void 0 : options.environment) || "production", options === null || options === void 0 ? void 0 : options.customBaseUrl);
12177
+ return refiners(queryKey, publicQuery, (options === null || options === void 0 ? void 0 : options.environment) || "production", options === null || options === void 0 ? void 0 : options.customBaseUrl, options === null || options === void 0 ? void 0 : options.customParams);
12157
12178
  },
12158
12179
  queryRelated: (queryKey, publicQuery, options = null) => {
12159
- return relatedQueries(queryKey, publicQuery, (options === null || options === void 0 ? void 0 : options.environment) || "production", options === null || options === void 0 ? void 0 : options.customBaseUrl);
12180
+ return relatedQueries(queryKey, publicQuery, (options === null || options === void 0 ? void 0 : options.environment) || "production", options === null || options === void 0 ? void 0 : options.customBaseUrl, options === null || options === void 0 ? void 0 : options.customParams);
12160
12181
  },
12161
12182
  suggestions: (queryKey, suggestionQuery, options = null) => {
12162
12183
  if (options === null || options === void 0 ? void 0 : options.customUrl) {
12163
12184
  return suggestCustom(suggestionQuery, options);
12164
12185
  }
12165
- return suggest(queryKey, suggestionQuery, (options === null || options === void 0 ? void 0 : options.environment) || "production", options === null || options === void 0 ? void 0 : options.customBaseUrl);
12186
+ return suggest(queryKey, suggestionQuery, (options === null || options === void 0 ? void 0 : options.environment) || "production", options === null || options === void 0 ? void 0 : options.customBaseUrl, options === null || options === void 0 ? void 0 : options.customParams);
12166
12187
  },
12167
12188
  track: (queryKey, eventData, options = null) => {
12168
12189
  return track$1(queryKey, eventData, (options === null || options === void 0 ? void 0 : options.environment) || "production", options === null || options === void 0 ? void 0 : options.customBaseUrl);
12169
12190
  },
12170
12191
  recommend: (queryKey, recommendForId, filters, options = null) => {
12171
- return recommend(queryKey, recommendForId, filters, (options === null || options === void 0 ? void 0 : options.environment) || "production", options === null || options === void 0 ? void 0 : options.customBaseUrl);
12192
+ return recommend(queryKey, recommendForId, filters, (options === null || options === void 0 ? void 0 : options.environment) || "production", options === null || options === void 0 ? void 0 : options.customBaseUrl, options === null || options === void 0 ? void 0 : options.customParams);
12172
12193
  },
12173
12194
  queryByIds: (queryKey, ids, options = null) => {
12174
- return queryByIds(queryKey, ids, (options === null || options === void 0 ? void 0 : options.environment) || "production", options === null || options === void 0 ? void 0 : options.customBaseUrl);
12195
+ return queryByIds(queryKey, ids, (options === null || options === void 0 ? void 0 : options.environment) || "production", options === null || options === void 0 ? void 0 : options.customBaseUrl, options === null || options === void 0 ? void 0 : options.customParams);
12175
12196
  },
12176
12197
  loadRedirectionRules: (queryKey, options = null) => {
12177
12198
  return loadRedirectionRules(queryKey, (options === null || options === void 0 ? void 0 : options.environment) || "production", options === null || options === void 0 ? void 0 : options.customBaseUrl);
@@ -11985,6 +11985,13 @@ var __async = (__this, __arguments, generator) => {
11985
11985
  }
11986
11986
  return Env$1[environment] || Env$1["production"];
11987
11987
  };
11988
+ const addCustomParams = (url, customParams) => {
11989
+ if (!customParams || Object.keys(customParams).length === 0) {
11990
+ return url;
11991
+ }
11992
+ const separator = url.includes("?") ? "&" : "?";
11993
+ return url + separator + e(customParams);
11994
+ };
11988
11995
  var __awaiter = function(thisArg, _arguments, P, generator) {
11989
11996
  function adopt(value) {
11990
11997
  return value instanceof P ? value : new P(function(resolve2) {
@@ -12042,8 +12049,10 @@ var __async = (__this, __arguments, generator) => {
12042
12049
  const errors = yield res.json();
12043
12050
  return { success: false, errors };
12044
12051
  });
12045
- const search = (queryKey, query, environment, customBaseUrl) => __awaiter(void 0, void 0, void 0, function* () {
12046
- const res = yield fetch(`${getApiUrl$1(environment, customBaseUrl)}query/${queryKey}`, Object.assign(Object.assign({}, defaultConfig), { body: JSON.stringify(query) }));
12052
+ const search = (queryKey, query, environment, customBaseUrl, customParams) => __awaiter(void 0, void 0, void 0, function* () {
12053
+ const endpoint = `${getApiUrl$1(environment, customBaseUrl)}query/${queryKey}`;
12054
+ const url = addCustomParams(endpoint, customParams);
12055
+ const res = yield fetch(url, Object.assign(Object.assign({}, defaultConfig), { body: JSON.stringify(query) }));
12047
12056
  if (res.status < 400) {
12048
12057
  const data = yield res.json();
12049
12058
  return Object.assign(Object.assign({}, data), { success: true });
@@ -12051,8 +12060,10 @@ var __async = (__this, __arguments, generator) => {
12051
12060
  const errors = yield res.json();
12052
12061
  return { success: false, errors };
12053
12062
  });
12054
- const facets = (queryKey, query, environment, customBaseUrl) => __awaiter(void 0, void 0, void 0, function* () {
12055
- const res = yield fetch(`${getApiUrl$1(environment, customBaseUrl)}query/${queryKey}/facets`, Object.assign(Object.assign({}, defaultConfig), { body: JSON.stringify(query) }));
12063
+ const facets = (queryKey, query, environment, customBaseUrl, customParams) => __awaiter(void 0, void 0, void 0, function* () {
12064
+ const endpoint = `${getApiUrl$1(environment, customBaseUrl)}query/${queryKey}/facets`;
12065
+ const url = addCustomParams(endpoint, customParams);
12066
+ const res = yield fetch(url, Object.assign(Object.assign({}, defaultConfig), { body: JSON.stringify(query) }));
12056
12067
  if (res.status < 400) {
12057
12068
  const data = yield res.json();
12058
12069
  return Object.assign(Object.assign({}, data), { success: true });
@@ -12060,8 +12071,10 @@ var __async = (__this, __arguments, generator) => {
12060
12071
  const errors = yield res.json();
12061
12072
  return { success: false, errors };
12062
12073
  });
12063
- const refiners = (queryKey, query, environment, customBaseUrl) => __awaiter(void 0, void 0, void 0, function* () {
12064
- const res = yield fetch(`${getApiUrl$1(environment, customBaseUrl)}query/${queryKey}/refiners`, Object.assign(Object.assign({}, defaultConfig), { body: JSON.stringify(query) }));
12074
+ const refiners = (queryKey, query, environment, customBaseUrl, customParams) => __awaiter(void 0, void 0, void 0, function* () {
12075
+ const endpoint = `${getApiUrl$1(environment, customBaseUrl)}query/${queryKey}/refiners`;
12076
+ const url = addCustomParams(endpoint, customParams);
12077
+ const res = yield fetch(url, Object.assign(Object.assign({}, defaultConfig), { body: JSON.stringify(query) }));
12065
12078
  if (res.status < 400) {
12066
12079
  const data = yield res.json();
12067
12080
  return Object.assign(Object.assign({}, data), { success: true });
@@ -12069,8 +12082,10 @@ var __async = (__this, __arguments, generator) => {
12069
12082
  const errors = yield res.json();
12070
12083
  return { success: false, errors };
12071
12084
  });
12072
- const relatedQueries = (queryKey, query, environment, customBaseUrl) => __awaiter(void 0, void 0, void 0, function* () {
12073
- const res = yield fetch(`${getApiUrl$1(environment, customBaseUrl)}query/${queryKey}/related`, Object.assign(Object.assign({}, defaultConfig), { body: JSON.stringify(query) }));
12085
+ const relatedQueries = (queryKey, query, environment, customBaseUrl, customParams) => __awaiter(void 0, void 0, void 0, function* () {
12086
+ const endpoint = `${getApiUrl$1(environment, customBaseUrl)}query/${queryKey}/related`;
12087
+ const url = addCustomParams(endpoint, customParams);
12088
+ const res = yield fetch(url, Object.assign(Object.assign({}, defaultConfig), { body: JSON.stringify(query) }));
12074
12089
  if (res.status < 400) {
12075
12090
  const data = yield res.json();
12076
12091
  return Object.assign(Object.assign({}, data), { success: true });
@@ -12078,9 +12093,11 @@ var __async = (__this, __arguments, generator) => {
12078
12093
  const errors = yield res.json();
12079
12094
  return { success: false, errors };
12080
12095
  });
12081
- const queryByIds = (queryKey, ids, environment, customBaseUrl) => __awaiter(void 0, void 0, void 0, function* () {
12096
+ const queryByIds = (queryKey, ids, environment, customBaseUrl, customParams) => __awaiter(void 0, void 0, void 0, function* () {
12082
12097
  const idParam = ids.map((id) => `ids=${id}`).join("&");
12083
- const res = yield fetch(`${getApiUrl$1(environment, customBaseUrl)}query/${queryKey}/ids?${idParam}`, Object.assign(Object.assign({}, defaultConfig), { method: "GET" }));
12098
+ const endpoint = `${getApiUrl$1(environment, customBaseUrl)}query/${queryKey}/ids?${idParam}`;
12099
+ const url = addCustomParams(endpoint, customParams);
12100
+ const res = yield fetch(url, Object.assign(Object.assign({}, defaultConfig), { method: "GET" }));
12084
12101
  if (res.status < 400) {
12085
12102
  const data = yield res.json();
12086
12103
  return Object.assign(Object.assign({}, data), { success: true });
@@ -12088,11 +12105,12 @@ var __async = (__this, __arguments, generator) => {
12088
12105
  const errors = yield res.json();
12089
12106
  return { success: false, errors };
12090
12107
  });
12091
- const recommendForSingleId = (queryKey, recommendForId, filters, environment, customBaseUrl) => __awaiter(void 0, void 0, void 0, function* () {
12092
- let url = `${getApiUrl$1(environment, customBaseUrl)}recommendations/document/${recommendForId}?recommendationQueryKey=${queryKey}`;
12108
+ const recommendForSingleId = (queryKey, recommendForId, filters, environment, customBaseUrl, customParams) => __awaiter(void 0, void 0, void 0, function* () {
12109
+ let endpoint = `${getApiUrl$1(environment, customBaseUrl)}recommendations/document/${recommendForId}?recommendationQueryKey=${queryKey}`;
12093
12110
  if (filters) {
12094
- url += `&${e({ filters })}`;
12111
+ endpoint += `&${e({ filters })}`;
12095
12112
  }
12113
+ const url = addCustomParams(endpoint, customParams);
12096
12114
  const res = yield fetch(url, Object.assign(Object.assign({}, defaultConfig), { method: "GET" }));
12097
12115
  if (res.status < 400) {
12098
12116
  const data = yield res.json();
@@ -12101,12 +12119,13 @@ var __async = (__this, __arguments, generator) => {
12101
12119
  const errors = yield res.json();
12102
12120
  return { success: false, errors };
12103
12121
  });
12104
- const recommendForMultipleIds = (queryKey, recommendForIds, filters, environment, customBaseUrl) => __awaiter(void 0, void 0, void 0, function* () {
12122
+ const recommendForMultipleIds = (queryKey, recommendForIds, filters, environment, customBaseUrl, customParams) => __awaiter(void 0, void 0, void 0, function* () {
12105
12123
  const limitedRecommendForIds = recommendForIds.slice(0, 20);
12106
- let url = `${getApiUrl$1(environment, customBaseUrl)}recommendations/documentsByMultipleIds?recommendationQueryKey=${queryKey}&itemId[]=${limitedRecommendForIds.join("&itemId[]=")}`;
12124
+ let endpoint = `${getApiUrl$1(environment, customBaseUrl)}recommendations/documentsByMultipleIds?recommendationQueryKey=${queryKey}&itemId[]=${limitedRecommendForIds.join("&itemId[]=")}`;
12107
12125
  if (filters) {
12108
- url += `&${e({ filters })}`;
12126
+ endpoint += `&${e({ filters })}`;
12109
12127
  }
12128
+ const url = addCustomParams(endpoint, customParams);
12110
12129
  const res = yield fetch(url, Object.assign(Object.assign({}, defaultConfig), { method: "GET" }));
12111
12130
  if (res.status < 400) {
12112
12131
  const data = yield res.json();
@@ -12115,11 +12134,13 @@ var __async = (__this, __arguments, generator) => {
12115
12134
  const errors = yield res.json();
12116
12135
  return { success: false, errors };
12117
12136
  });
12118
- const recommend = (queryKey, recommendForId, filters, environment, customBaseUrl) => __awaiter(void 0, void 0, void 0, function* () {
12119
- return Array.isArray(recommendForId) ? yield recommendForMultipleIds(queryKey, recommendForId, filters, environment, customBaseUrl) : yield recommendForSingleId(queryKey, recommendForId, filters, environment, customBaseUrl);
12137
+ const recommend = (queryKey, recommendForId, filters, environment, customBaseUrl, customParams) => __awaiter(void 0, void 0, void 0, function* () {
12138
+ return Array.isArray(recommendForId) ? yield recommendForMultipleIds(queryKey, recommendForId, filters, environment, customBaseUrl, customParams) : yield recommendForSingleId(queryKey, recommendForId, filters, environment, customBaseUrl, customParams);
12120
12139
  });
12121
- const suggest = (queryKey, query, environment, customBaseUrl) => __awaiter(void 0, void 0, void 0, function* () {
12122
- const res = yield fetch(`${getApiUrl$1(environment, customBaseUrl)}query/${queryKey}`, Object.assign(Object.assign({}, defaultConfig), { body: JSON.stringify(query) }));
12140
+ const suggest = (queryKey, query, environment, customBaseUrl, customParams) => __awaiter(void 0, void 0, void 0, function* () {
12141
+ const endpoint = `${getApiUrl$1(environment, customBaseUrl)}query/${queryKey}`;
12142
+ const url = addCustomParams(endpoint, customParams);
12143
+ const res = yield fetch(url, Object.assign(Object.assign({}, defaultConfig), { body: JSON.stringify(query) }));
12123
12144
  if (res.status < 400) {
12124
12145
  const items = yield res.json();
12125
12146
  return { items, success: true };
@@ -12151,31 +12172,31 @@ var __async = (__this, __arguments, generator) => {
12151
12172
  if (options === null || options === void 0 ? void 0 : options.customUrl) {
12152
12173
  return searchCustom(publicQuery, options);
12153
12174
  }
12154
- return search(queryKey, publicQuery, (options === null || options === void 0 ? void 0 : options.environment) || "production", options === null || options === void 0 ? void 0 : options.customBaseUrl);
12175
+ return search(queryKey, publicQuery, (options === null || options === void 0 ? void 0 : options.environment) || "production", options === null || options === void 0 ? void 0 : options.customBaseUrl, options === null || options === void 0 ? void 0 : options.customParams);
12155
12176
  },
12156
12177
  queryFacets: (queryKey, publicQuery, options = null) => {
12157
- return facets(queryKey, publicQuery, (options === null || options === void 0 ? void 0 : options.environment) || "production", options === null || options === void 0 ? void 0 : options.customBaseUrl);
12178
+ return facets(queryKey, publicQuery, (options === null || options === void 0 ? void 0 : options.environment) || "production", options === null || options === void 0 ? void 0 : options.customBaseUrl, options === null || options === void 0 ? void 0 : options.customParams);
12158
12179
  },
12159
12180
  queryRefiners: (queryKey, publicQuery, options = null) => {
12160
- return refiners(queryKey, publicQuery, (options === null || options === void 0 ? void 0 : options.environment) || "production", options === null || options === void 0 ? void 0 : options.customBaseUrl);
12181
+ return refiners(queryKey, publicQuery, (options === null || options === void 0 ? void 0 : options.environment) || "production", options === null || options === void 0 ? void 0 : options.customBaseUrl, options === null || options === void 0 ? void 0 : options.customParams);
12161
12182
  },
12162
12183
  queryRelated: (queryKey, publicQuery, options = null) => {
12163
- return relatedQueries(queryKey, publicQuery, (options === null || options === void 0 ? void 0 : options.environment) || "production", options === null || options === void 0 ? void 0 : options.customBaseUrl);
12184
+ return relatedQueries(queryKey, publicQuery, (options === null || options === void 0 ? void 0 : options.environment) || "production", options === null || options === void 0 ? void 0 : options.customBaseUrl, options === null || options === void 0 ? void 0 : options.customParams);
12164
12185
  },
12165
12186
  suggestions: (queryKey, suggestionQuery, options = null) => {
12166
12187
  if (options === null || options === void 0 ? void 0 : options.customUrl) {
12167
12188
  return suggestCustom(suggestionQuery, options);
12168
12189
  }
12169
- return suggest(queryKey, suggestionQuery, (options === null || options === void 0 ? void 0 : options.environment) || "production", options === null || options === void 0 ? void 0 : options.customBaseUrl);
12190
+ return suggest(queryKey, suggestionQuery, (options === null || options === void 0 ? void 0 : options.environment) || "production", options === null || options === void 0 ? void 0 : options.customBaseUrl, options === null || options === void 0 ? void 0 : options.customParams);
12170
12191
  },
12171
12192
  track: (queryKey, eventData, options = null) => {
12172
12193
  return track$1(queryKey, eventData, (options === null || options === void 0 ? void 0 : options.environment) || "production", options === null || options === void 0 ? void 0 : options.customBaseUrl);
12173
12194
  },
12174
12195
  recommend: (queryKey, recommendForId, filters, options = null) => {
12175
- return recommend(queryKey, recommendForId, filters, (options === null || options === void 0 ? void 0 : options.environment) || "production", options === null || options === void 0 ? void 0 : options.customBaseUrl);
12196
+ return recommend(queryKey, recommendForId, filters, (options === null || options === void 0 ? void 0 : options.environment) || "production", options === null || options === void 0 ? void 0 : options.customBaseUrl, options === null || options === void 0 ? void 0 : options.customParams);
12176
12197
  },
12177
12198
  queryByIds: (queryKey, ids, options = null) => {
12178
- return queryByIds(queryKey, ids, (options === null || options === void 0 ? void 0 : options.environment) || "production", options === null || options === void 0 ? void 0 : options.customBaseUrl);
12199
+ return queryByIds(queryKey, ids, (options === null || options === void 0 ? void 0 : options.environment) || "production", options === null || options === void 0 ? void 0 : options.customBaseUrl, options === null || options === void 0 ? void 0 : options.customParams);
12179
12200
  },
12180
12201
  loadRedirectionRules: (queryKey, options = null) => {
12181
12202
  return loadRedirectionRules(queryKey, (options === null || options === void 0 ? void 0 : options.environment) || "production", options === null || options === void 0 ? void 0 : options.customBaseUrl);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@getlupa/client",
3
- "version": "1.20.1",
3
+ "version": "1.20.2",
4
4
  "main": "dist/lupaSearch.js",
5
5
  "module": "dist/lupaSearch.mjs",
6
6
  "types": "dist/index.d.ts",
@@ -20,7 +20,7 @@
20
20
  },
21
21
  "devDependencies": {
22
22
  "@getlupa/client-sdk": "^1.8.1",
23
- "@getlupa/vue": "0.20.1",
23
+ "@getlupa/vue": "0.20.2",
24
24
  "@rushstack/eslint-patch": "^1.12.0",
25
25
  "@tsconfig/node18": "^18.2.4",
26
26
  "@types/jsdom": "^21.1.7",