@getlupa/vue 0.20.0 → 0.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.
- package/dist/lupaSearch.js +48 -27
- package/dist/lupaSearch.mjs +48 -27
- package/dist/types/General.d.ts +1 -0
- package/package.json +3 -3
- /package/dist/{assets/output-BnpcD7E7.css → lupaChatStyle.css} +0 -0
- /package/dist/{assets/output-BPIK2yNV.css → lupaContainerStyle.css} +0 -0
- /package/dist/{assets/output-CFGf2C1W.css → style.css} +0 -0
package/dist/lupaSearch.js
CHANGED
|
@@ -5715,6 +5715,13 @@ const getApiUrl$1 = (environment, customBaseUrl) => {
|
|
|
5715
5715
|
}
|
|
5716
5716
|
return Env$1[environment] || Env$1["production"];
|
|
5717
5717
|
};
|
|
5718
|
+
const addCustomParams = (url, customParams) => {
|
|
5719
|
+
if (!customParams || Object.keys(customParams).length === 0) {
|
|
5720
|
+
return url;
|
|
5721
|
+
}
|
|
5722
|
+
const separator = url.includes("?") ? "&" : "?";
|
|
5723
|
+
return url + separator + e(customParams);
|
|
5724
|
+
};
|
|
5718
5725
|
var __awaiter = function(thisArg, _arguments, P, generator) {
|
|
5719
5726
|
function adopt(value) {
|
|
5720
5727
|
return value instanceof P ? value : new P(function(resolve) {
|
|
@@ -5772,8 +5779,10 @@ const suggestCustom = (query, options) => __awaiter(void 0, void 0, void 0, func
|
|
|
5772
5779
|
const errors = yield res.json();
|
|
5773
5780
|
return { success: false, errors };
|
|
5774
5781
|
});
|
|
5775
|
-
const search = (queryKey, query, environment, customBaseUrl) => __awaiter(void 0, void 0, void 0, function* () {
|
|
5776
|
-
const
|
|
5782
|
+
const search = (queryKey, query, environment, customBaseUrl, customParams) => __awaiter(void 0, void 0, void 0, function* () {
|
|
5783
|
+
const endpoint = `${getApiUrl$1(environment, customBaseUrl)}query/${queryKey}`;
|
|
5784
|
+
const url = addCustomParams(endpoint, customParams);
|
|
5785
|
+
const res = yield fetch(url, Object.assign(Object.assign({}, defaultConfig), { body: JSON.stringify(query) }));
|
|
5777
5786
|
if (res.status < 400) {
|
|
5778
5787
|
const data = yield res.json();
|
|
5779
5788
|
return Object.assign(Object.assign({}, data), { success: true });
|
|
@@ -5781,8 +5790,10 @@ const search = (queryKey, query, environment, customBaseUrl) => __awaiter(void 0
|
|
|
5781
5790
|
const errors = yield res.json();
|
|
5782
5791
|
return { success: false, errors };
|
|
5783
5792
|
});
|
|
5784
|
-
const facets = (queryKey, query, environment, customBaseUrl) => __awaiter(void 0, void 0, void 0, function* () {
|
|
5785
|
-
const
|
|
5793
|
+
const facets = (queryKey, query, environment, customBaseUrl, customParams) => __awaiter(void 0, void 0, void 0, function* () {
|
|
5794
|
+
const endpoint = `${getApiUrl$1(environment, customBaseUrl)}query/${queryKey}/facets`;
|
|
5795
|
+
const url = addCustomParams(endpoint, customParams);
|
|
5796
|
+
const res = yield fetch(url, Object.assign(Object.assign({}, defaultConfig), { body: JSON.stringify(query) }));
|
|
5786
5797
|
if (res.status < 400) {
|
|
5787
5798
|
const data = yield res.json();
|
|
5788
5799
|
return Object.assign(Object.assign({}, data), { success: true });
|
|
@@ -5790,8 +5801,10 @@ const facets = (queryKey, query, environment, customBaseUrl) => __awaiter(void 0
|
|
|
5790
5801
|
const errors = yield res.json();
|
|
5791
5802
|
return { success: false, errors };
|
|
5792
5803
|
});
|
|
5793
|
-
const refiners = (queryKey, query, environment, customBaseUrl) => __awaiter(void 0, void 0, void 0, function* () {
|
|
5794
|
-
const
|
|
5804
|
+
const refiners = (queryKey, query, environment, customBaseUrl, customParams) => __awaiter(void 0, void 0, void 0, function* () {
|
|
5805
|
+
const endpoint = `${getApiUrl$1(environment, customBaseUrl)}query/${queryKey}/refiners`;
|
|
5806
|
+
const url = addCustomParams(endpoint, customParams);
|
|
5807
|
+
const res = yield fetch(url, Object.assign(Object.assign({}, defaultConfig), { body: JSON.stringify(query) }));
|
|
5795
5808
|
if (res.status < 400) {
|
|
5796
5809
|
const data = yield res.json();
|
|
5797
5810
|
return Object.assign(Object.assign({}, data), { success: true });
|
|
@@ -5799,8 +5812,10 @@ const refiners = (queryKey, query, environment, customBaseUrl) => __awaiter(void
|
|
|
5799
5812
|
const errors = yield res.json();
|
|
5800
5813
|
return { success: false, errors };
|
|
5801
5814
|
});
|
|
5802
|
-
const relatedQueries = (queryKey, query, environment, customBaseUrl) => __awaiter(void 0, void 0, void 0, function* () {
|
|
5803
|
-
const
|
|
5815
|
+
const relatedQueries = (queryKey, query, environment, customBaseUrl, customParams) => __awaiter(void 0, void 0, void 0, function* () {
|
|
5816
|
+
const endpoint = `${getApiUrl$1(environment, customBaseUrl)}query/${queryKey}/related`;
|
|
5817
|
+
const url = addCustomParams(endpoint, customParams);
|
|
5818
|
+
const res = yield fetch(url, Object.assign(Object.assign({}, defaultConfig), { body: JSON.stringify(query) }));
|
|
5804
5819
|
if (res.status < 400) {
|
|
5805
5820
|
const data = yield res.json();
|
|
5806
5821
|
return Object.assign(Object.assign({}, data), { success: true });
|
|
@@ -5808,9 +5823,11 @@ const relatedQueries = (queryKey, query, environment, customBaseUrl) => __awaite
|
|
|
5808
5823
|
const errors = yield res.json();
|
|
5809
5824
|
return { success: false, errors };
|
|
5810
5825
|
});
|
|
5811
|
-
const queryByIds = (queryKey, ids, environment, customBaseUrl) => __awaiter(void 0, void 0, void 0, function* () {
|
|
5826
|
+
const queryByIds = (queryKey, ids, environment, customBaseUrl, customParams) => __awaiter(void 0, void 0, void 0, function* () {
|
|
5812
5827
|
const idParam = ids.map((id) => `ids=${id}`).join("&");
|
|
5813
|
-
const
|
|
5828
|
+
const endpoint = `${getApiUrl$1(environment, customBaseUrl)}query/${queryKey}/ids?${idParam}`;
|
|
5829
|
+
const url = addCustomParams(endpoint, customParams);
|
|
5830
|
+
const res = yield fetch(url, Object.assign(Object.assign({}, defaultConfig), { method: "GET" }));
|
|
5814
5831
|
if (res.status < 400) {
|
|
5815
5832
|
const data = yield res.json();
|
|
5816
5833
|
return Object.assign(Object.assign({}, data), { success: true });
|
|
@@ -5818,11 +5835,12 @@ const queryByIds = (queryKey, ids, environment, customBaseUrl) => __awaiter(void
|
|
|
5818
5835
|
const errors = yield res.json();
|
|
5819
5836
|
return { success: false, errors };
|
|
5820
5837
|
});
|
|
5821
|
-
const recommendForSingleId = (queryKey, recommendForId, filters, environment, customBaseUrl) => __awaiter(void 0, void 0, void 0, function* () {
|
|
5822
|
-
let
|
|
5838
|
+
const recommendForSingleId = (queryKey, recommendForId, filters, environment, customBaseUrl, customParams) => __awaiter(void 0, void 0, void 0, function* () {
|
|
5839
|
+
let endpoint = `${getApiUrl$1(environment, customBaseUrl)}recommendations/document/${recommendForId}?recommendationQueryKey=${queryKey}`;
|
|
5823
5840
|
if (filters) {
|
|
5824
|
-
|
|
5841
|
+
endpoint += `&${e({ filters })}`;
|
|
5825
5842
|
}
|
|
5843
|
+
const url = addCustomParams(endpoint, customParams);
|
|
5826
5844
|
const res = yield fetch(url, Object.assign(Object.assign({}, defaultConfig), { method: "GET" }));
|
|
5827
5845
|
if (res.status < 400) {
|
|
5828
5846
|
const data = yield res.json();
|
|
@@ -5831,12 +5849,13 @@ const recommendForSingleId = (queryKey, recommendForId, filters, environment, cu
|
|
|
5831
5849
|
const errors = yield res.json();
|
|
5832
5850
|
return { success: false, errors };
|
|
5833
5851
|
});
|
|
5834
|
-
const recommendForMultipleIds = (queryKey, recommendForIds, filters, environment, customBaseUrl) => __awaiter(void 0, void 0, void 0, function* () {
|
|
5852
|
+
const recommendForMultipleIds = (queryKey, recommendForIds, filters, environment, customBaseUrl, customParams) => __awaiter(void 0, void 0, void 0, function* () {
|
|
5835
5853
|
const limitedRecommendForIds = recommendForIds.slice(0, 20);
|
|
5836
|
-
let
|
|
5854
|
+
let endpoint = `${getApiUrl$1(environment, customBaseUrl)}recommendations/documentsByMultipleIds?recommendationQueryKey=${queryKey}&itemId[]=${limitedRecommendForIds.join("&itemId[]=")}`;
|
|
5837
5855
|
if (filters) {
|
|
5838
|
-
|
|
5856
|
+
endpoint += `&${e({ filters })}`;
|
|
5839
5857
|
}
|
|
5858
|
+
const url = addCustomParams(endpoint, customParams);
|
|
5840
5859
|
const res = yield fetch(url, Object.assign(Object.assign({}, defaultConfig), { method: "GET" }));
|
|
5841
5860
|
if (res.status < 400) {
|
|
5842
5861
|
const data = yield res.json();
|
|
@@ -5845,11 +5864,13 @@ const recommendForMultipleIds = (queryKey, recommendForIds, filters, environment
|
|
|
5845
5864
|
const errors = yield res.json();
|
|
5846
5865
|
return { success: false, errors };
|
|
5847
5866
|
});
|
|
5848
|
-
const recommend = (queryKey, recommendForId, filters, environment, customBaseUrl) => __awaiter(void 0, void 0, void 0, function* () {
|
|
5849
|
-
return Array.isArray(recommendForId) ? yield recommendForMultipleIds(queryKey, recommendForId, filters, environment, customBaseUrl) : yield recommendForSingleId(queryKey, recommendForId, filters, environment, customBaseUrl);
|
|
5867
|
+
const recommend = (queryKey, recommendForId, filters, environment, customBaseUrl, customParams) => __awaiter(void 0, void 0, void 0, function* () {
|
|
5868
|
+
return Array.isArray(recommendForId) ? yield recommendForMultipleIds(queryKey, recommendForId, filters, environment, customBaseUrl, customParams) : yield recommendForSingleId(queryKey, recommendForId, filters, environment, customBaseUrl, customParams);
|
|
5850
5869
|
});
|
|
5851
|
-
const suggest = (queryKey, query, environment, customBaseUrl) => __awaiter(void 0, void 0, void 0, function* () {
|
|
5852
|
-
const
|
|
5870
|
+
const suggest = (queryKey, query, environment, customBaseUrl, customParams) => __awaiter(void 0, void 0, void 0, function* () {
|
|
5871
|
+
const endpoint = `${getApiUrl$1(environment, customBaseUrl)}query/${queryKey}`;
|
|
5872
|
+
const url = addCustomParams(endpoint, customParams);
|
|
5873
|
+
const res = yield fetch(url, Object.assign(Object.assign({}, defaultConfig), { body: JSON.stringify(query) }));
|
|
5853
5874
|
if (res.status < 400) {
|
|
5854
5875
|
const items = yield res.json();
|
|
5855
5876
|
return { items, success: true };
|
|
@@ -5881,31 +5902,31 @@ const LupaSearchSdk = {
|
|
|
5881
5902
|
if (options === null || options === void 0 ? void 0 : options.customUrl) {
|
|
5882
5903
|
return searchCustom(publicQuery, options);
|
|
5883
5904
|
}
|
|
5884
|
-
return search(queryKey, publicQuery, (options === null || options === void 0 ? void 0 : options.environment) || "production", options === null || options === void 0 ? void 0 : options.customBaseUrl);
|
|
5905
|
+
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);
|
|
5885
5906
|
},
|
|
5886
5907
|
queryFacets: (queryKey, publicQuery, options = null) => {
|
|
5887
|
-
return facets(queryKey, publicQuery, (options === null || options === void 0 ? void 0 : options.environment) || "production", options === null || options === void 0 ? void 0 : options.customBaseUrl);
|
|
5908
|
+
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);
|
|
5888
5909
|
},
|
|
5889
5910
|
queryRefiners: (queryKey, publicQuery, options = null) => {
|
|
5890
|
-
return refiners(queryKey, publicQuery, (options === null || options === void 0 ? void 0 : options.environment) || "production", options === null || options === void 0 ? void 0 : options.customBaseUrl);
|
|
5911
|
+
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);
|
|
5891
5912
|
},
|
|
5892
5913
|
queryRelated: (queryKey, publicQuery, options = null) => {
|
|
5893
|
-
return relatedQueries(queryKey, publicQuery, (options === null || options === void 0 ? void 0 : options.environment) || "production", options === null || options === void 0 ? void 0 : options.customBaseUrl);
|
|
5914
|
+
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);
|
|
5894
5915
|
},
|
|
5895
5916
|
suggestions: (queryKey, suggestionQuery, options = null) => {
|
|
5896
5917
|
if (options === null || options === void 0 ? void 0 : options.customUrl) {
|
|
5897
5918
|
return suggestCustom(suggestionQuery, options);
|
|
5898
5919
|
}
|
|
5899
|
-
return suggest(queryKey, suggestionQuery, (options === null || options === void 0 ? void 0 : options.environment) || "production", options === null || options === void 0 ? void 0 : options.customBaseUrl);
|
|
5920
|
+
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);
|
|
5900
5921
|
},
|
|
5901
5922
|
track: (queryKey, eventData, options = null) => {
|
|
5902
5923
|
return track$1(queryKey, eventData, (options === null || options === void 0 ? void 0 : options.environment) || "production", options === null || options === void 0 ? void 0 : options.customBaseUrl);
|
|
5903
5924
|
},
|
|
5904
5925
|
recommend: (queryKey, recommendForId, filters, options = null) => {
|
|
5905
|
-
return recommend(queryKey, recommendForId, filters, (options === null || options === void 0 ? void 0 : options.environment) || "production", options === null || options === void 0 ? void 0 : options.customBaseUrl);
|
|
5926
|
+
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);
|
|
5906
5927
|
},
|
|
5907
5928
|
queryByIds: (queryKey, ids, options = null) => {
|
|
5908
|
-
return queryByIds(queryKey, ids, (options === null || options === void 0 ? void 0 : options.environment) || "production", options === null || options === void 0 ? void 0 : options.customBaseUrl);
|
|
5929
|
+
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);
|
|
5909
5930
|
},
|
|
5910
5931
|
loadRedirectionRules: (queryKey, options = null) => {
|
|
5911
5932
|
return loadRedirectionRules(queryKey, (options === null || options === void 0 ? void 0 : options.environment) || "production", options === null || options === void 0 ? void 0 : options.customBaseUrl);
|
package/dist/lupaSearch.mjs
CHANGED
|
@@ -5713,6 +5713,13 @@ const getApiUrl$1 = (environment, customBaseUrl) => {
|
|
|
5713
5713
|
}
|
|
5714
5714
|
return Env$1[environment] || Env$1["production"];
|
|
5715
5715
|
};
|
|
5716
|
+
const addCustomParams = (url, customParams) => {
|
|
5717
|
+
if (!customParams || Object.keys(customParams).length === 0) {
|
|
5718
|
+
return url;
|
|
5719
|
+
}
|
|
5720
|
+
const separator = url.includes("?") ? "&" : "?";
|
|
5721
|
+
return url + separator + e(customParams);
|
|
5722
|
+
};
|
|
5716
5723
|
var __awaiter = function(thisArg, _arguments, P, generator) {
|
|
5717
5724
|
function adopt(value) {
|
|
5718
5725
|
return value instanceof P ? value : new P(function(resolve) {
|
|
@@ -5770,8 +5777,10 @@ const suggestCustom = (query, options) => __awaiter(void 0, void 0, void 0, func
|
|
|
5770
5777
|
const errors = yield res.json();
|
|
5771
5778
|
return { success: false, errors };
|
|
5772
5779
|
});
|
|
5773
|
-
const search = (queryKey, query, environment, customBaseUrl) => __awaiter(void 0, void 0, void 0, function* () {
|
|
5774
|
-
const
|
|
5780
|
+
const search = (queryKey, query, environment, customBaseUrl, customParams) => __awaiter(void 0, void 0, void 0, function* () {
|
|
5781
|
+
const endpoint = `${getApiUrl$1(environment, customBaseUrl)}query/${queryKey}`;
|
|
5782
|
+
const url = addCustomParams(endpoint, customParams);
|
|
5783
|
+
const res = yield fetch(url, Object.assign(Object.assign({}, defaultConfig), { body: JSON.stringify(query) }));
|
|
5775
5784
|
if (res.status < 400) {
|
|
5776
5785
|
const data = yield res.json();
|
|
5777
5786
|
return Object.assign(Object.assign({}, data), { success: true });
|
|
@@ -5779,8 +5788,10 @@ const search = (queryKey, query, environment, customBaseUrl) => __awaiter(void 0
|
|
|
5779
5788
|
const errors = yield res.json();
|
|
5780
5789
|
return { success: false, errors };
|
|
5781
5790
|
});
|
|
5782
|
-
const facets = (queryKey, query, environment, customBaseUrl) => __awaiter(void 0, void 0, void 0, function* () {
|
|
5783
|
-
const
|
|
5791
|
+
const facets = (queryKey, query, environment, customBaseUrl, customParams) => __awaiter(void 0, void 0, void 0, function* () {
|
|
5792
|
+
const endpoint = `${getApiUrl$1(environment, customBaseUrl)}query/${queryKey}/facets`;
|
|
5793
|
+
const url = addCustomParams(endpoint, customParams);
|
|
5794
|
+
const res = yield fetch(url, Object.assign(Object.assign({}, defaultConfig), { body: JSON.stringify(query) }));
|
|
5784
5795
|
if (res.status < 400) {
|
|
5785
5796
|
const data = yield res.json();
|
|
5786
5797
|
return Object.assign(Object.assign({}, data), { success: true });
|
|
@@ -5788,8 +5799,10 @@ const facets = (queryKey, query, environment, customBaseUrl) => __awaiter(void 0
|
|
|
5788
5799
|
const errors = yield res.json();
|
|
5789
5800
|
return { success: false, errors };
|
|
5790
5801
|
});
|
|
5791
|
-
const refiners = (queryKey, query, environment, customBaseUrl) => __awaiter(void 0, void 0, void 0, function* () {
|
|
5792
|
-
const
|
|
5802
|
+
const refiners = (queryKey, query, environment, customBaseUrl, customParams) => __awaiter(void 0, void 0, void 0, function* () {
|
|
5803
|
+
const endpoint = `${getApiUrl$1(environment, customBaseUrl)}query/${queryKey}/refiners`;
|
|
5804
|
+
const url = addCustomParams(endpoint, customParams);
|
|
5805
|
+
const res = yield fetch(url, Object.assign(Object.assign({}, defaultConfig), { body: JSON.stringify(query) }));
|
|
5793
5806
|
if (res.status < 400) {
|
|
5794
5807
|
const data = yield res.json();
|
|
5795
5808
|
return Object.assign(Object.assign({}, data), { success: true });
|
|
@@ -5797,8 +5810,10 @@ const refiners = (queryKey, query, environment, customBaseUrl) => __awaiter(void
|
|
|
5797
5810
|
const errors = yield res.json();
|
|
5798
5811
|
return { success: false, errors };
|
|
5799
5812
|
});
|
|
5800
|
-
const relatedQueries = (queryKey, query, environment, customBaseUrl) => __awaiter(void 0, void 0, void 0, function* () {
|
|
5801
|
-
const
|
|
5813
|
+
const relatedQueries = (queryKey, query, environment, customBaseUrl, customParams) => __awaiter(void 0, void 0, void 0, function* () {
|
|
5814
|
+
const endpoint = `${getApiUrl$1(environment, customBaseUrl)}query/${queryKey}/related`;
|
|
5815
|
+
const url = addCustomParams(endpoint, customParams);
|
|
5816
|
+
const res = yield fetch(url, Object.assign(Object.assign({}, defaultConfig), { body: JSON.stringify(query) }));
|
|
5802
5817
|
if (res.status < 400) {
|
|
5803
5818
|
const data = yield res.json();
|
|
5804
5819
|
return Object.assign(Object.assign({}, data), { success: true });
|
|
@@ -5806,9 +5821,11 @@ const relatedQueries = (queryKey, query, environment, customBaseUrl) => __awaite
|
|
|
5806
5821
|
const errors = yield res.json();
|
|
5807
5822
|
return { success: false, errors };
|
|
5808
5823
|
});
|
|
5809
|
-
const queryByIds = (queryKey, ids, environment, customBaseUrl) => __awaiter(void 0, void 0, void 0, function* () {
|
|
5824
|
+
const queryByIds = (queryKey, ids, environment, customBaseUrl, customParams) => __awaiter(void 0, void 0, void 0, function* () {
|
|
5810
5825
|
const idParam = ids.map((id) => `ids=${id}`).join("&");
|
|
5811
|
-
const
|
|
5826
|
+
const endpoint = `${getApiUrl$1(environment, customBaseUrl)}query/${queryKey}/ids?${idParam}`;
|
|
5827
|
+
const url = addCustomParams(endpoint, customParams);
|
|
5828
|
+
const res = yield fetch(url, Object.assign(Object.assign({}, defaultConfig), { method: "GET" }));
|
|
5812
5829
|
if (res.status < 400) {
|
|
5813
5830
|
const data = yield res.json();
|
|
5814
5831
|
return Object.assign(Object.assign({}, data), { success: true });
|
|
@@ -5816,11 +5833,12 @@ const queryByIds = (queryKey, ids, environment, customBaseUrl) => __awaiter(void
|
|
|
5816
5833
|
const errors = yield res.json();
|
|
5817
5834
|
return { success: false, errors };
|
|
5818
5835
|
});
|
|
5819
|
-
const recommendForSingleId = (queryKey, recommendForId, filters, environment, customBaseUrl) => __awaiter(void 0, void 0, void 0, function* () {
|
|
5820
|
-
let
|
|
5836
|
+
const recommendForSingleId = (queryKey, recommendForId, filters, environment, customBaseUrl, customParams) => __awaiter(void 0, void 0, void 0, function* () {
|
|
5837
|
+
let endpoint = `${getApiUrl$1(environment, customBaseUrl)}recommendations/document/${recommendForId}?recommendationQueryKey=${queryKey}`;
|
|
5821
5838
|
if (filters) {
|
|
5822
|
-
|
|
5839
|
+
endpoint += `&${e({ filters })}`;
|
|
5823
5840
|
}
|
|
5841
|
+
const url = addCustomParams(endpoint, customParams);
|
|
5824
5842
|
const res = yield fetch(url, Object.assign(Object.assign({}, defaultConfig), { method: "GET" }));
|
|
5825
5843
|
if (res.status < 400) {
|
|
5826
5844
|
const data = yield res.json();
|
|
@@ -5829,12 +5847,13 @@ const recommendForSingleId = (queryKey, recommendForId, filters, environment, cu
|
|
|
5829
5847
|
const errors = yield res.json();
|
|
5830
5848
|
return { success: false, errors };
|
|
5831
5849
|
});
|
|
5832
|
-
const recommendForMultipleIds = (queryKey, recommendForIds, filters, environment, customBaseUrl) => __awaiter(void 0, void 0, void 0, function* () {
|
|
5850
|
+
const recommendForMultipleIds = (queryKey, recommendForIds, filters, environment, customBaseUrl, customParams) => __awaiter(void 0, void 0, void 0, function* () {
|
|
5833
5851
|
const limitedRecommendForIds = recommendForIds.slice(0, 20);
|
|
5834
|
-
let
|
|
5852
|
+
let endpoint = `${getApiUrl$1(environment, customBaseUrl)}recommendations/documentsByMultipleIds?recommendationQueryKey=${queryKey}&itemId[]=${limitedRecommendForIds.join("&itemId[]=")}`;
|
|
5835
5853
|
if (filters) {
|
|
5836
|
-
|
|
5854
|
+
endpoint += `&${e({ filters })}`;
|
|
5837
5855
|
}
|
|
5856
|
+
const url = addCustomParams(endpoint, customParams);
|
|
5838
5857
|
const res = yield fetch(url, Object.assign(Object.assign({}, defaultConfig), { method: "GET" }));
|
|
5839
5858
|
if (res.status < 400) {
|
|
5840
5859
|
const data = yield res.json();
|
|
@@ -5843,11 +5862,13 @@ const recommendForMultipleIds = (queryKey, recommendForIds, filters, environment
|
|
|
5843
5862
|
const errors = yield res.json();
|
|
5844
5863
|
return { success: false, errors };
|
|
5845
5864
|
});
|
|
5846
|
-
const recommend = (queryKey, recommendForId, filters, environment, customBaseUrl) => __awaiter(void 0, void 0, void 0, function* () {
|
|
5847
|
-
return Array.isArray(recommendForId) ? yield recommendForMultipleIds(queryKey, recommendForId, filters, environment, customBaseUrl) : yield recommendForSingleId(queryKey, recommendForId, filters, environment, customBaseUrl);
|
|
5865
|
+
const recommend = (queryKey, recommendForId, filters, environment, customBaseUrl, customParams) => __awaiter(void 0, void 0, void 0, function* () {
|
|
5866
|
+
return Array.isArray(recommendForId) ? yield recommendForMultipleIds(queryKey, recommendForId, filters, environment, customBaseUrl, customParams) : yield recommendForSingleId(queryKey, recommendForId, filters, environment, customBaseUrl, customParams);
|
|
5848
5867
|
});
|
|
5849
|
-
const suggest = (queryKey, query, environment, customBaseUrl) => __awaiter(void 0, void 0, void 0, function* () {
|
|
5850
|
-
const
|
|
5868
|
+
const suggest = (queryKey, query, environment, customBaseUrl, customParams) => __awaiter(void 0, void 0, void 0, function* () {
|
|
5869
|
+
const endpoint = `${getApiUrl$1(environment, customBaseUrl)}query/${queryKey}`;
|
|
5870
|
+
const url = addCustomParams(endpoint, customParams);
|
|
5871
|
+
const res = yield fetch(url, Object.assign(Object.assign({}, defaultConfig), { body: JSON.stringify(query) }));
|
|
5851
5872
|
if (res.status < 400) {
|
|
5852
5873
|
const items = yield res.json();
|
|
5853
5874
|
return { items, success: true };
|
|
@@ -5879,31 +5900,31 @@ const LupaSearchSdk = {
|
|
|
5879
5900
|
if (options === null || options === void 0 ? void 0 : options.customUrl) {
|
|
5880
5901
|
return searchCustom(publicQuery, options);
|
|
5881
5902
|
}
|
|
5882
|
-
return search(queryKey, publicQuery, (options === null || options === void 0 ? void 0 : options.environment) || "production", options === null || options === void 0 ? void 0 : options.customBaseUrl);
|
|
5903
|
+
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);
|
|
5883
5904
|
},
|
|
5884
5905
|
queryFacets: (queryKey, publicQuery, options = null) => {
|
|
5885
|
-
return facets(queryKey, publicQuery, (options === null || options === void 0 ? void 0 : options.environment) || "production", options === null || options === void 0 ? void 0 : options.customBaseUrl);
|
|
5906
|
+
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);
|
|
5886
5907
|
},
|
|
5887
5908
|
queryRefiners: (queryKey, publicQuery, options = null) => {
|
|
5888
|
-
return refiners(queryKey, publicQuery, (options === null || options === void 0 ? void 0 : options.environment) || "production", options === null || options === void 0 ? void 0 : options.customBaseUrl);
|
|
5909
|
+
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);
|
|
5889
5910
|
},
|
|
5890
5911
|
queryRelated: (queryKey, publicQuery, options = null) => {
|
|
5891
|
-
return relatedQueries(queryKey, publicQuery, (options === null || options === void 0 ? void 0 : options.environment) || "production", options === null || options === void 0 ? void 0 : options.customBaseUrl);
|
|
5912
|
+
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);
|
|
5892
5913
|
},
|
|
5893
5914
|
suggestions: (queryKey, suggestionQuery, options = null) => {
|
|
5894
5915
|
if (options === null || options === void 0 ? void 0 : options.customUrl) {
|
|
5895
5916
|
return suggestCustom(suggestionQuery, options);
|
|
5896
5917
|
}
|
|
5897
|
-
return suggest(queryKey, suggestionQuery, (options === null || options === void 0 ? void 0 : options.environment) || "production", options === null || options === void 0 ? void 0 : options.customBaseUrl);
|
|
5918
|
+
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);
|
|
5898
5919
|
},
|
|
5899
5920
|
track: (queryKey, eventData, options = null) => {
|
|
5900
5921
|
return track$1(queryKey, eventData, (options === null || options === void 0 ? void 0 : options.environment) || "production", options === null || options === void 0 ? void 0 : options.customBaseUrl);
|
|
5901
5922
|
},
|
|
5902
5923
|
recommend: (queryKey, recommendForId, filters, options = null) => {
|
|
5903
|
-
return recommend(queryKey, recommendForId, filters, (options === null || options === void 0 ? void 0 : options.environment) || "production", options === null || options === void 0 ? void 0 : options.customBaseUrl);
|
|
5924
|
+
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);
|
|
5904
5925
|
},
|
|
5905
5926
|
queryByIds: (queryKey, ids, options = null) => {
|
|
5906
|
-
return queryByIds(queryKey, ids, (options === null || options === void 0 ? void 0 : options.environment) || "production", options === null || options === void 0 ? void 0 : options.customBaseUrl);
|
|
5927
|
+
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);
|
|
5907
5928
|
},
|
|
5908
5929
|
loadRedirectionRules: (queryKey, options = null) => {
|
|
5909
5930
|
return loadRedirectionRules(queryKey, (options === null || options === void 0 ? void 0 : options.environment) || "production", options === null || options === void 0 ? void 0 : options.customBaseUrl);
|
package/dist/types/General.d.ts
CHANGED
|
@@ -7,6 +7,7 @@ export type SdkOptions = {
|
|
|
7
7
|
customUrl?: string;
|
|
8
8
|
customPayload?: Record<string, unknown>;
|
|
9
9
|
customHeaders?: Record<string, string>;
|
|
10
|
+
customParams?: Record<string, string | string[]>;
|
|
10
11
|
onError?: (err: unknown) => unknown;
|
|
11
12
|
};
|
|
12
13
|
export type TrackingOptions = {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@getlupa/vue",
|
|
3
|
-
"version": "0.20.
|
|
3
|
+
"version": "0.20.2",
|
|
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.
|
|
26
|
+
"@getlupa/client-sdk": "^1.9.2",
|
|
27
27
|
"@pinia/testing": "^1.0.2",
|
|
28
28
|
"@rollup/plugin-babel": "^6.0.4",
|
|
29
29
|
"@rollup/plugin-commonjs": "^28.0.6",
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
"rollup-plugin-filesize": "^10.0.0",
|
|
55
55
|
"rollup-plugin-node-resolve": "^5.2.0",
|
|
56
56
|
"rollup-plugin-replace": "^2.2.0",
|
|
57
|
-
"rollup-plugin-scss": "^
|
|
57
|
+
"rollup-plugin-scss": "^3",
|
|
58
58
|
"sass": "^1.89.2",
|
|
59
59
|
"start-server-and-test": "^2.0.12",
|
|
60
60
|
"ts-jest": "^29.4.0",
|
|
File without changes
|
|
File without changes
|
|
File without changes
|