@getlupa/client 1.3.7 → 1.3.9
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.iife.js +17 -10
- package/dist/lupaSearch.js +17 -10
- package/dist/lupaSearch.mjs +17 -10
- package/dist/lupaSearch.umd.js +17 -10
- package/package.json +2 -2
package/dist/lupaSearch.iife.js
CHANGED
|
@@ -12265,6 +12265,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
12265
12265
|
const paramStore = useParamsStore();
|
|
12266
12266
|
const { sort } = storeToRefs(paramStore);
|
|
12267
12267
|
const selectedKey = ref("");
|
|
12268
|
+
const previousKey = ref("");
|
|
12268
12269
|
const sortItems = computed(() => {
|
|
12269
12270
|
if (props.options.options && props.options.options.length) {
|
|
12270
12271
|
return props.options.options;
|
|
@@ -12280,6 +12281,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
12280
12281
|
var _a, _b;
|
|
12281
12282
|
const optionToSelect = (_a = sortItems.value.find((x) => x.key === sort.value)) == null ? void 0 : _a.key;
|
|
12282
12283
|
selectedKey.value = optionToSelect != null ? optionToSelect : (_b = defaultSortValue.value) == null ? void 0 : _b.key;
|
|
12284
|
+
previousKey.value = selectedKey.value;
|
|
12283
12285
|
};
|
|
12284
12286
|
watch(sort, () => setSortValue());
|
|
12285
12287
|
onMounted(() => {
|
|
@@ -12291,11 +12293,12 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
12291
12293
|
if (!value) {
|
|
12292
12294
|
return;
|
|
12293
12295
|
}
|
|
12294
|
-
(_c = (_b = props.callbacks) == null ? void 0 : _b.onSortChange) == null ? void 0 : _c.call(_b, { selectedSortKey: value });
|
|
12296
|
+
(_c = (_b = props.callbacks) == null ? void 0 : _b.onSortChange) == null ? void 0 : _c.call(_b, { selectedSortKey: value, previousSortKey: previousKey.value });
|
|
12295
12297
|
paramStore.appendParams({
|
|
12296
12298
|
params: [{ name: QUERY_PARAMS$1.SORT, value }],
|
|
12297
12299
|
paramsToRemove: [QUERY_PARAMS$1.PAGE]
|
|
12298
12300
|
});
|
|
12301
|
+
previousKey.value = selectedKey.value;
|
|
12299
12302
|
};
|
|
12300
12303
|
return (_ctx, _cache) => {
|
|
12301
12304
|
return openBlock(), createElementBlock("div", _hoisted_1$y, [
|
|
@@ -13990,7 +13993,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
13990
13993
|
const hasResults2 = Boolean(
|
|
13991
13994
|
results.total > 0 || ((_a = results.similarQueries) == null ? void 0 : _a.length) || ((_b = results.didYouMean) == null ? void 0 : _b.options)
|
|
13992
13995
|
);
|
|
13993
|
-
(_d = (_c = props.options.callbacks) == null ? void 0 : _c.onSearchResults) == null ? void 0 : _d.call(_c, { queryKey, hasResults: hasResults2 });
|
|
13996
|
+
(_d = (_c = props.options.callbacks) == null ? void 0 : _c.onSearchResults) == null ? void 0 : _d.call(_c, { queryKey, hasResults: hasResults2, params: paramStore.params });
|
|
13994
13997
|
if (!hasResults2) {
|
|
13995
13998
|
return;
|
|
13996
13999
|
}
|
|
@@ -20714,7 +20717,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
20714
20717
|
return Env[environment] || Env["production"];
|
|
20715
20718
|
};
|
|
20716
20719
|
const suggestSearchChatPhrases = (options, request) => __async(void 0, null, function* () {
|
|
20717
|
-
var _a, _b;
|
|
20720
|
+
var _a, _b, _c;
|
|
20718
20721
|
const { environment, customBaseUrl } = options;
|
|
20719
20722
|
try {
|
|
20720
20723
|
const res = yield fetch(`${getApiUrl(environment, customBaseUrl)}chat/`, __spreadProps2(__spreadValues2({}, defaultConfig), {
|
|
@@ -20726,14 +20729,15 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
20726
20729
|
return __spreadProps2(__spreadValues2({}, data), { success: true });
|
|
20727
20730
|
}
|
|
20728
20731
|
const errors = yield res.json();
|
|
20732
|
+
(_b = options == null ? void 0 : options.onError) == null ? void 0 : _b.call(options, errors);
|
|
20729
20733
|
return { success: false, errors };
|
|
20730
20734
|
} catch (e) {
|
|
20731
|
-
(
|
|
20735
|
+
(_c = options == null ? void 0 : options.onError) == null ? void 0 : _c.call(options, e);
|
|
20732
20736
|
return { success: false, errors: [e] };
|
|
20733
20737
|
}
|
|
20734
20738
|
});
|
|
20735
20739
|
const suggestPhraseAlternatives = (_0, _1) => __async(void 0, [_0, _1], function* (options, { phrases }) {
|
|
20736
|
-
var _a, _b;
|
|
20740
|
+
var _a, _b, _c;
|
|
20737
20741
|
const { environment, customBaseUrl } = options;
|
|
20738
20742
|
try {
|
|
20739
20743
|
const res = yield fetch(`${getApiUrl(environment, customBaseUrl)}chat/phraseAlternatives`, __spreadProps2(__spreadValues2({}, defaultConfig), {
|
|
@@ -20745,14 +20749,15 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
20745
20749
|
return __spreadProps2(__spreadValues2({}, data), { success: true });
|
|
20746
20750
|
}
|
|
20747
20751
|
const errors = yield res.json();
|
|
20752
|
+
(_b = options == null ? void 0 : options.onError) == null ? void 0 : _b.call(options, errors);
|
|
20748
20753
|
return { success: false, errors };
|
|
20749
20754
|
} catch (e) {
|
|
20750
|
-
(
|
|
20755
|
+
(_c = options == null ? void 0 : options.onError) == null ? void 0 : _c.call(options, e);
|
|
20751
20756
|
return { success: false, errors: [e] };
|
|
20752
20757
|
}
|
|
20753
20758
|
});
|
|
20754
20759
|
const suggestSimplifiedPhrases = (_0, _1) => __async(void 0, [_0, _1], function* (options, { phrases }) {
|
|
20755
|
-
var _a, _b;
|
|
20760
|
+
var _a, _b, _c;
|
|
20756
20761
|
const { environment, customBaseUrl } = options;
|
|
20757
20762
|
try {
|
|
20758
20763
|
const res = yield fetch(`${getApiUrl(environment, customBaseUrl)}chat/simplify`, __spreadProps2(__spreadValues2({}, defaultConfig), {
|
|
@@ -20764,9 +20769,10 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
20764
20769
|
return __spreadProps2(__spreadValues2({}, data), { success: true });
|
|
20765
20770
|
}
|
|
20766
20771
|
const errors = yield res.json();
|
|
20772
|
+
(_b = options == null ? void 0 : options.onError) == null ? void 0 : _b.call(options, errors);
|
|
20767
20773
|
return { success: false, errors };
|
|
20768
20774
|
} catch (e) {
|
|
20769
|
-
(
|
|
20775
|
+
(_c = options == null ? void 0 : options.onError) == null ? void 0 : _c.call(options, e);
|
|
20770
20776
|
return { success: false, errors: [e] };
|
|
20771
20777
|
}
|
|
20772
20778
|
});
|
|
@@ -20775,7 +20781,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
20775
20781
|
productStrings,
|
|
20776
20782
|
messageHistory
|
|
20777
20783
|
}) {
|
|
20778
|
-
var _a, _b;
|
|
20784
|
+
var _a, _b, _c;
|
|
20779
20785
|
const { environment, customBaseUrl } = options;
|
|
20780
20786
|
try {
|
|
20781
20787
|
const res = yield fetch(`${getApiUrl(environment, customBaseUrl)}chat/bestProducts`, __spreadProps2(__spreadValues2({}, defaultConfig), {
|
|
@@ -20787,9 +20793,10 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
20787
20793
|
return __spreadProps2(__spreadValues2({}, data), { success: true });
|
|
20788
20794
|
}
|
|
20789
20795
|
const errors = yield res.json();
|
|
20796
|
+
(_b = options == null ? void 0 : options.onError) == null ? void 0 : _b.call(options, errors);
|
|
20790
20797
|
return { success: false, errors };
|
|
20791
20798
|
} catch (e) {
|
|
20792
|
-
(
|
|
20799
|
+
(_c = options == null ? void 0 : options.onError) == null ? void 0 : _c.call(options, e);
|
|
20793
20800
|
return { success: false, errors: [e] };
|
|
20794
20801
|
}
|
|
20795
20802
|
});
|
package/dist/lupaSearch.js
CHANGED
|
@@ -12265,6 +12265,7 @@ const _sfc_main$B = /* @__PURE__ */ defineComponent({
|
|
|
12265
12265
|
const paramStore = useParamsStore();
|
|
12266
12266
|
const { sort } = storeToRefs(paramStore);
|
|
12267
12267
|
const selectedKey = ref("");
|
|
12268
|
+
const previousKey = ref("");
|
|
12268
12269
|
const sortItems = computed(() => {
|
|
12269
12270
|
if (props.options.options && props.options.options.length) {
|
|
12270
12271
|
return props.options.options;
|
|
@@ -12280,6 +12281,7 @@ const _sfc_main$B = /* @__PURE__ */ defineComponent({
|
|
|
12280
12281
|
var _a, _b;
|
|
12281
12282
|
const optionToSelect = (_a = sortItems.value.find((x) => x.key === sort.value)) == null ? void 0 : _a.key;
|
|
12282
12283
|
selectedKey.value = optionToSelect != null ? optionToSelect : (_b = defaultSortValue.value) == null ? void 0 : _b.key;
|
|
12284
|
+
previousKey.value = selectedKey.value;
|
|
12283
12285
|
};
|
|
12284
12286
|
watch(sort, () => setSortValue());
|
|
12285
12287
|
onMounted(() => {
|
|
@@ -12291,11 +12293,12 @@ const _sfc_main$B = /* @__PURE__ */ defineComponent({
|
|
|
12291
12293
|
if (!value) {
|
|
12292
12294
|
return;
|
|
12293
12295
|
}
|
|
12294
|
-
(_c = (_b = props.callbacks) == null ? void 0 : _b.onSortChange) == null ? void 0 : _c.call(_b, { selectedSortKey: value });
|
|
12296
|
+
(_c = (_b = props.callbacks) == null ? void 0 : _b.onSortChange) == null ? void 0 : _c.call(_b, { selectedSortKey: value, previousSortKey: previousKey.value });
|
|
12295
12297
|
paramStore.appendParams({
|
|
12296
12298
|
params: [{ name: QUERY_PARAMS$1.SORT, value }],
|
|
12297
12299
|
paramsToRemove: [QUERY_PARAMS$1.PAGE]
|
|
12298
12300
|
});
|
|
12301
|
+
previousKey.value = selectedKey.value;
|
|
12299
12302
|
};
|
|
12300
12303
|
return (_ctx, _cache) => {
|
|
12301
12304
|
return openBlock(), createElementBlock("div", _hoisted_1$y, [
|
|
@@ -13990,7 +13993,7 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
|
|
|
13990
13993
|
const hasResults2 = Boolean(
|
|
13991
13994
|
results.total > 0 || ((_a = results.similarQueries) == null ? void 0 : _a.length) || ((_b = results.didYouMean) == null ? void 0 : _b.options)
|
|
13992
13995
|
);
|
|
13993
|
-
(_d = (_c = props.options.callbacks) == null ? void 0 : _c.onSearchResults) == null ? void 0 : _d.call(_c, { queryKey, hasResults: hasResults2 });
|
|
13996
|
+
(_d = (_c = props.options.callbacks) == null ? void 0 : _c.onSearchResults) == null ? void 0 : _d.call(_c, { queryKey, hasResults: hasResults2, params: paramStore.params });
|
|
13994
13997
|
if (!hasResults2) {
|
|
13995
13998
|
return;
|
|
13996
13999
|
}
|
|
@@ -20714,7 +20717,7 @@ const getApiUrl = (environment, customBaseUrl) => {
|
|
|
20714
20717
|
return Env[environment] || Env["production"];
|
|
20715
20718
|
};
|
|
20716
20719
|
const suggestSearchChatPhrases = (options, request) => __async(void 0, null, function* () {
|
|
20717
|
-
var _a, _b;
|
|
20720
|
+
var _a, _b, _c;
|
|
20718
20721
|
const { environment, customBaseUrl } = options;
|
|
20719
20722
|
try {
|
|
20720
20723
|
const res = yield fetch(`${getApiUrl(environment, customBaseUrl)}chat/`, __spreadProps2(__spreadValues2({}, defaultConfig), {
|
|
@@ -20726,14 +20729,15 @@ const suggestSearchChatPhrases = (options, request) => __async(void 0, null, fun
|
|
|
20726
20729
|
return __spreadProps2(__spreadValues2({}, data), { success: true });
|
|
20727
20730
|
}
|
|
20728
20731
|
const errors = yield res.json();
|
|
20732
|
+
(_b = options == null ? void 0 : options.onError) == null ? void 0 : _b.call(options, errors);
|
|
20729
20733
|
return { success: false, errors };
|
|
20730
20734
|
} catch (e) {
|
|
20731
|
-
(
|
|
20735
|
+
(_c = options == null ? void 0 : options.onError) == null ? void 0 : _c.call(options, e);
|
|
20732
20736
|
return { success: false, errors: [e] };
|
|
20733
20737
|
}
|
|
20734
20738
|
});
|
|
20735
20739
|
const suggestPhraseAlternatives = (_0, _1) => __async(void 0, [_0, _1], function* (options, { phrases }) {
|
|
20736
|
-
var _a, _b;
|
|
20740
|
+
var _a, _b, _c;
|
|
20737
20741
|
const { environment, customBaseUrl } = options;
|
|
20738
20742
|
try {
|
|
20739
20743
|
const res = yield fetch(`${getApiUrl(environment, customBaseUrl)}chat/phraseAlternatives`, __spreadProps2(__spreadValues2({}, defaultConfig), {
|
|
@@ -20745,14 +20749,15 @@ const suggestPhraseAlternatives = (_0, _1) => __async(void 0, [_0, _1], function
|
|
|
20745
20749
|
return __spreadProps2(__spreadValues2({}, data), { success: true });
|
|
20746
20750
|
}
|
|
20747
20751
|
const errors = yield res.json();
|
|
20752
|
+
(_b = options == null ? void 0 : options.onError) == null ? void 0 : _b.call(options, errors);
|
|
20748
20753
|
return { success: false, errors };
|
|
20749
20754
|
} catch (e) {
|
|
20750
|
-
(
|
|
20755
|
+
(_c = options == null ? void 0 : options.onError) == null ? void 0 : _c.call(options, e);
|
|
20751
20756
|
return { success: false, errors: [e] };
|
|
20752
20757
|
}
|
|
20753
20758
|
});
|
|
20754
20759
|
const suggestSimplifiedPhrases = (_0, _1) => __async(void 0, [_0, _1], function* (options, { phrases }) {
|
|
20755
|
-
var _a, _b;
|
|
20760
|
+
var _a, _b, _c;
|
|
20756
20761
|
const { environment, customBaseUrl } = options;
|
|
20757
20762
|
try {
|
|
20758
20763
|
const res = yield fetch(`${getApiUrl(environment, customBaseUrl)}chat/simplify`, __spreadProps2(__spreadValues2({}, defaultConfig), {
|
|
@@ -20764,9 +20769,10 @@ const suggestSimplifiedPhrases = (_0, _1) => __async(void 0, [_0, _1], function*
|
|
|
20764
20769
|
return __spreadProps2(__spreadValues2({}, data), { success: true });
|
|
20765
20770
|
}
|
|
20766
20771
|
const errors = yield res.json();
|
|
20772
|
+
(_b = options == null ? void 0 : options.onError) == null ? void 0 : _b.call(options, errors);
|
|
20767
20773
|
return { success: false, errors };
|
|
20768
20774
|
} catch (e) {
|
|
20769
|
-
(
|
|
20775
|
+
(_c = options == null ? void 0 : options.onError) == null ? void 0 : _c.call(options, e);
|
|
20770
20776
|
return { success: false, errors: [e] };
|
|
20771
20777
|
}
|
|
20772
20778
|
});
|
|
@@ -20775,7 +20781,7 @@ const suggestBestProductMatches = (_0, _1) => __async(void 0, [_0, _1], function
|
|
|
20775
20781
|
productStrings,
|
|
20776
20782
|
messageHistory
|
|
20777
20783
|
}) {
|
|
20778
|
-
var _a, _b;
|
|
20784
|
+
var _a, _b, _c;
|
|
20779
20785
|
const { environment, customBaseUrl } = options;
|
|
20780
20786
|
try {
|
|
20781
20787
|
const res = yield fetch(`${getApiUrl(environment, customBaseUrl)}chat/bestProducts`, __spreadProps2(__spreadValues2({}, defaultConfig), {
|
|
@@ -20787,9 +20793,10 @@ const suggestBestProductMatches = (_0, _1) => __async(void 0, [_0, _1], function
|
|
|
20787
20793
|
return __spreadProps2(__spreadValues2({}, data), { success: true });
|
|
20788
20794
|
}
|
|
20789
20795
|
const errors = yield res.json();
|
|
20796
|
+
(_b = options == null ? void 0 : options.onError) == null ? void 0 : _b.call(options, errors);
|
|
20790
20797
|
return { success: false, errors };
|
|
20791
20798
|
} catch (e) {
|
|
20792
|
-
(
|
|
20799
|
+
(_c = options == null ? void 0 : options.onError) == null ? void 0 : _c.call(options, e);
|
|
20793
20800
|
return { success: false, errors: [e] };
|
|
20794
20801
|
}
|
|
20795
20802
|
});
|
package/dist/lupaSearch.mjs
CHANGED
|
@@ -12263,6 +12263,7 @@ const _sfc_main$B = /* @__PURE__ */ defineComponent({
|
|
|
12263
12263
|
const paramStore = useParamsStore();
|
|
12264
12264
|
const { sort } = storeToRefs(paramStore);
|
|
12265
12265
|
const selectedKey = ref("");
|
|
12266
|
+
const previousKey = ref("");
|
|
12266
12267
|
const sortItems = computed(() => {
|
|
12267
12268
|
if (props.options.options && props.options.options.length) {
|
|
12268
12269
|
return props.options.options;
|
|
@@ -12278,6 +12279,7 @@ const _sfc_main$B = /* @__PURE__ */ defineComponent({
|
|
|
12278
12279
|
var _a, _b;
|
|
12279
12280
|
const optionToSelect = (_a = sortItems.value.find((x) => x.key === sort.value)) == null ? void 0 : _a.key;
|
|
12280
12281
|
selectedKey.value = optionToSelect != null ? optionToSelect : (_b = defaultSortValue.value) == null ? void 0 : _b.key;
|
|
12282
|
+
previousKey.value = selectedKey.value;
|
|
12281
12283
|
};
|
|
12282
12284
|
watch(sort, () => setSortValue());
|
|
12283
12285
|
onMounted(() => {
|
|
@@ -12289,11 +12291,12 @@ const _sfc_main$B = /* @__PURE__ */ defineComponent({
|
|
|
12289
12291
|
if (!value) {
|
|
12290
12292
|
return;
|
|
12291
12293
|
}
|
|
12292
|
-
(_c = (_b = props.callbacks) == null ? void 0 : _b.onSortChange) == null ? void 0 : _c.call(_b, { selectedSortKey: value });
|
|
12294
|
+
(_c = (_b = props.callbacks) == null ? void 0 : _b.onSortChange) == null ? void 0 : _c.call(_b, { selectedSortKey: value, previousSortKey: previousKey.value });
|
|
12293
12295
|
paramStore.appendParams({
|
|
12294
12296
|
params: [{ name: QUERY_PARAMS$1.SORT, value }],
|
|
12295
12297
|
paramsToRemove: [QUERY_PARAMS$1.PAGE]
|
|
12296
12298
|
});
|
|
12299
|
+
previousKey.value = selectedKey.value;
|
|
12297
12300
|
};
|
|
12298
12301
|
return (_ctx, _cache) => {
|
|
12299
12302
|
return openBlock(), createElementBlock("div", _hoisted_1$y, [
|
|
@@ -13988,7 +13991,7 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
|
|
|
13988
13991
|
const hasResults2 = Boolean(
|
|
13989
13992
|
results.total > 0 || ((_a = results.similarQueries) == null ? void 0 : _a.length) || ((_b = results.didYouMean) == null ? void 0 : _b.options)
|
|
13990
13993
|
);
|
|
13991
|
-
(_d = (_c = props.options.callbacks) == null ? void 0 : _c.onSearchResults) == null ? void 0 : _d.call(_c, { queryKey, hasResults: hasResults2 });
|
|
13994
|
+
(_d = (_c = props.options.callbacks) == null ? void 0 : _c.onSearchResults) == null ? void 0 : _d.call(_c, { queryKey, hasResults: hasResults2, params: paramStore.params });
|
|
13992
13995
|
if (!hasResults2) {
|
|
13993
13996
|
return;
|
|
13994
13997
|
}
|
|
@@ -20712,7 +20715,7 @@ const getApiUrl = (environment, customBaseUrl) => {
|
|
|
20712
20715
|
return Env[environment] || Env["production"];
|
|
20713
20716
|
};
|
|
20714
20717
|
const suggestSearchChatPhrases = (options, request) => __async(void 0, null, function* () {
|
|
20715
|
-
var _a, _b;
|
|
20718
|
+
var _a, _b, _c;
|
|
20716
20719
|
const { environment, customBaseUrl } = options;
|
|
20717
20720
|
try {
|
|
20718
20721
|
const res = yield fetch(`${getApiUrl(environment, customBaseUrl)}chat/`, __spreadProps2(__spreadValues2({}, defaultConfig), {
|
|
@@ -20724,14 +20727,15 @@ const suggestSearchChatPhrases = (options, request) => __async(void 0, null, fun
|
|
|
20724
20727
|
return __spreadProps2(__spreadValues2({}, data), { success: true });
|
|
20725
20728
|
}
|
|
20726
20729
|
const errors = yield res.json();
|
|
20730
|
+
(_b = options == null ? void 0 : options.onError) == null ? void 0 : _b.call(options, errors);
|
|
20727
20731
|
return { success: false, errors };
|
|
20728
20732
|
} catch (e) {
|
|
20729
|
-
(
|
|
20733
|
+
(_c = options == null ? void 0 : options.onError) == null ? void 0 : _c.call(options, e);
|
|
20730
20734
|
return { success: false, errors: [e] };
|
|
20731
20735
|
}
|
|
20732
20736
|
});
|
|
20733
20737
|
const suggestPhraseAlternatives = (_0, _1) => __async(void 0, [_0, _1], function* (options, { phrases }) {
|
|
20734
|
-
var _a, _b;
|
|
20738
|
+
var _a, _b, _c;
|
|
20735
20739
|
const { environment, customBaseUrl } = options;
|
|
20736
20740
|
try {
|
|
20737
20741
|
const res = yield fetch(`${getApiUrl(environment, customBaseUrl)}chat/phraseAlternatives`, __spreadProps2(__spreadValues2({}, defaultConfig), {
|
|
@@ -20743,14 +20747,15 @@ const suggestPhraseAlternatives = (_0, _1) => __async(void 0, [_0, _1], function
|
|
|
20743
20747
|
return __spreadProps2(__spreadValues2({}, data), { success: true });
|
|
20744
20748
|
}
|
|
20745
20749
|
const errors = yield res.json();
|
|
20750
|
+
(_b = options == null ? void 0 : options.onError) == null ? void 0 : _b.call(options, errors);
|
|
20746
20751
|
return { success: false, errors };
|
|
20747
20752
|
} catch (e) {
|
|
20748
|
-
(
|
|
20753
|
+
(_c = options == null ? void 0 : options.onError) == null ? void 0 : _c.call(options, e);
|
|
20749
20754
|
return { success: false, errors: [e] };
|
|
20750
20755
|
}
|
|
20751
20756
|
});
|
|
20752
20757
|
const suggestSimplifiedPhrases = (_0, _1) => __async(void 0, [_0, _1], function* (options, { phrases }) {
|
|
20753
|
-
var _a, _b;
|
|
20758
|
+
var _a, _b, _c;
|
|
20754
20759
|
const { environment, customBaseUrl } = options;
|
|
20755
20760
|
try {
|
|
20756
20761
|
const res = yield fetch(`${getApiUrl(environment, customBaseUrl)}chat/simplify`, __spreadProps2(__spreadValues2({}, defaultConfig), {
|
|
@@ -20762,9 +20767,10 @@ const suggestSimplifiedPhrases = (_0, _1) => __async(void 0, [_0, _1], function*
|
|
|
20762
20767
|
return __spreadProps2(__spreadValues2({}, data), { success: true });
|
|
20763
20768
|
}
|
|
20764
20769
|
const errors = yield res.json();
|
|
20770
|
+
(_b = options == null ? void 0 : options.onError) == null ? void 0 : _b.call(options, errors);
|
|
20765
20771
|
return { success: false, errors };
|
|
20766
20772
|
} catch (e) {
|
|
20767
|
-
(
|
|
20773
|
+
(_c = options == null ? void 0 : options.onError) == null ? void 0 : _c.call(options, e);
|
|
20768
20774
|
return { success: false, errors: [e] };
|
|
20769
20775
|
}
|
|
20770
20776
|
});
|
|
@@ -20773,7 +20779,7 @@ const suggestBestProductMatches = (_0, _1) => __async(void 0, [_0, _1], function
|
|
|
20773
20779
|
productStrings,
|
|
20774
20780
|
messageHistory
|
|
20775
20781
|
}) {
|
|
20776
|
-
var _a, _b;
|
|
20782
|
+
var _a, _b, _c;
|
|
20777
20783
|
const { environment, customBaseUrl } = options;
|
|
20778
20784
|
try {
|
|
20779
20785
|
const res = yield fetch(`${getApiUrl(environment, customBaseUrl)}chat/bestProducts`, __spreadProps2(__spreadValues2({}, defaultConfig), {
|
|
@@ -20785,9 +20791,10 @@ const suggestBestProductMatches = (_0, _1) => __async(void 0, [_0, _1], function
|
|
|
20785
20791
|
return __spreadProps2(__spreadValues2({}, data), { success: true });
|
|
20786
20792
|
}
|
|
20787
20793
|
const errors = yield res.json();
|
|
20794
|
+
(_b = options == null ? void 0 : options.onError) == null ? void 0 : _b.call(options, errors);
|
|
20788
20795
|
return { success: false, errors };
|
|
20789
20796
|
} catch (e) {
|
|
20790
|
-
(
|
|
20797
|
+
(_c = options == null ? void 0 : options.onError) == null ? void 0 : _c.call(options, e);
|
|
20791
20798
|
return { success: false, errors: [e] };
|
|
20792
20799
|
}
|
|
20793
20800
|
});
|
package/dist/lupaSearch.umd.js
CHANGED
|
@@ -12267,6 +12267,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
12267
12267
|
const paramStore = useParamsStore();
|
|
12268
12268
|
const { sort } = storeToRefs(paramStore);
|
|
12269
12269
|
const selectedKey = ref("");
|
|
12270
|
+
const previousKey = ref("");
|
|
12270
12271
|
const sortItems = computed(() => {
|
|
12271
12272
|
if (props.options.options && props.options.options.length) {
|
|
12272
12273
|
return props.options.options;
|
|
@@ -12282,6 +12283,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
12282
12283
|
var _a, _b;
|
|
12283
12284
|
const optionToSelect = (_a = sortItems.value.find((x) => x.key === sort.value)) == null ? void 0 : _a.key;
|
|
12284
12285
|
selectedKey.value = optionToSelect != null ? optionToSelect : (_b = defaultSortValue.value) == null ? void 0 : _b.key;
|
|
12286
|
+
previousKey.value = selectedKey.value;
|
|
12285
12287
|
};
|
|
12286
12288
|
watch(sort, () => setSortValue());
|
|
12287
12289
|
onMounted(() => {
|
|
@@ -12293,11 +12295,12 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
12293
12295
|
if (!value) {
|
|
12294
12296
|
return;
|
|
12295
12297
|
}
|
|
12296
|
-
(_c = (_b = props.callbacks) == null ? void 0 : _b.onSortChange) == null ? void 0 : _c.call(_b, { selectedSortKey: value });
|
|
12298
|
+
(_c = (_b = props.callbacks) == null ? void 0 : _b.onSortChange) == null ? void 0 : _c.call(_b, { selectedSortKey: value, previousSortKey: previousKey.value });
|
|
12297
12299
|
paramStore.appendParams({
|
|
12298
12300
|
params: [{ name: QUERY_PARAMS$1.SORT, value }],
|
|
12299
12301
|
paramsToRemove: [QUERY_PARAMS$1.PAGE]
|
|
12300
12302
|
});
|
|
12303
|
+
previousKey.value = selectedKey.value;
|
|
12301
12304
|
};
|
|
12302
12305
|
return (_ctx, _cache) => {
|
|
12303
12306
|
return openBlock(), createElementBlock("div", _hoisted_1$y, [
|
|
@@ -13992,7 +13995,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
13992
13995
|
const hasResults2 = Boolean(
|
|
13993
13996
|
results.total > 0 || ((_a = results.similarQueries) == null ? void 0 : _a.length) || ((_b = results.didYouMean) == null ? void 0 : _b.options)
|
|
13994
13997
|
);
|
|
13995
|
-
(_d = (_c = props.options.callbacks) == null ? void 0 : _c.onSearchResults) == null ? void 0 : _d.call(_c, { queryKey, hasResults: hasResults2 });
|
|
13998
|
+
(_d = (_c = props.options.callbacks) == null ? void 0 : _c.onSearchResults) == null ? void 0 : _d.call(_c, { queryKey, hasResults: hasResults2, params: paramStore.params });
|
|
13996
13999
|
if (!hasResults2) {
|
|
13997
14000
|
return;
|
|
13998
14001
|
}
|
|
@@ -20716,7 +20719,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
20716
20719
|
return Env[environment] || Env["production"];
|
|
20717
20720
|
};
|
|
20718
20721
|
const suggestSearchChatPhrases = (options, request) => __async(void 0, null, function* () {
|
|
20719
|
-
var _a, _b;
|
|
20722
|
+
var _a, _b, _c;
|
|
20720
20723
|
const { environment, customBaseUrl } = options;
|
|
20721
20724
|
try {
|
|
20722
20725
|
const res = yield fetch(`${getApiUrl(environment, customBaseUrl)}chat/`, __spreadProps2(__spreadValues2({}, defaultConfig), {
|
|
@@ -20728,14 +20731,15 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
20728
20731
|
return __spreadProps2(__spreadValues2({}, data), { success: true });
|
|
20729
20732
|
}
|
|
20730
20733
|
const errors = yield res.json();
|
|
20734
|
+
(_b = options == null ? void 0 : options.onError) == null ? void 0 : _b.call(options, errors);
|
|
20731
20735
|
return { success: false, errors };
|
|
20732
20736
|
} catch (e) {
|
|
20733
|
-
(
|
|
20737
|
+
(_c = options == null ? void 0 : options.onError) == null ? void 0 : _c.call(options, e);
|
|
20734
20738
|
return { success: false, errors: [e] };
|
|
20735
20739
|
}
|
|
20736
20740
|
});
|
|
20737
20741
|
const suggestPhraseAlternatives = (_0, _1) => __async(void 0, [_0, _1], function* (options, { phrases }) {
|
|
20738
|
-
var _a, _b;
|
|
20742
|
+
var _a, _b, _c;
|
|
20739
20743
|
const { environment, customBaseUrl } = options;
|
|
20740
20744
|
try {
|
|
20741
20745
|
const res = yield fetch(`${getApiUrl(environment, customBaseUrl)}chat/phraseAlternatives`, __spreadProps2(__spreadValues2({}, defaultConfig), {
|
|
@@ -20747,14 +20751,15 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
20747
20751
|
return __spreadProps2(__spreadValues2({}, data), { success: true });
|
|
20748
20752
|
}
|
|
20749
20753
|
const errors = yield res.json();
|
|
20754
|
+
(_b = options == null ? void 0 : options.onError) == null ? void 0 : _b.call(options, errors);
|
|
20750
20755
|
return { success: false, errors };
|
|
20751
20756
|
} catch (e) {
|
|
20752
|
-
(
|
|
20757
|
+
(_c = options == null ? void 0 : options.onError) == null ? void 0 : _c.call(options, e);
|
|
20753
20758
|
return { success: false, errors: [e] };
|
|
20754
20759
|
}
|
|
20755
20760
|
});
|
|
20756
20761
|
const suggestSimplifiedPhrases = (_0, _1) => __async(void 0, [_0, _1], function* (options, { phrases }) {
|
|
20757
|
-
var _a, _b;
|
|
20762
|
+
var _a, _b, _c;
|
|
20758
20763
|
const { environment, customBaseUrl } = options;
|
|
20759
20764
|
try {
|
|
20760
20765
|
const res = yield fetch(`${getApiUrl(environment, customBaseUrl)}chat/simplify`, __spreadProps2(__spreadValues2({}, defaultConfig), {
|
|
@@ -20766,9 +20771,10 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
20766
20771
|
return __spreadProps2(__spreadValues2({}, data), { success: true });
|
|
20767
20772
|
}
|
|
20768
20773
|
const errors = yield res.json();
|
|
20774
|
+
(_b = options == null ? void 0 : options.onError) == null ? void 0 : _b.call(options, errors);
|
|
20769
20775
|
return { success: false, errors };
|
|
20770
20776
|
} catch (e) {
|
|
20771
|
-
(
|
|
20777
|
+
(_c = options == null ? void 0 : options.onError) == null ? void 0 : _c.call(options, e);
|
|
20772
20778
|
return { success: false, errors: [e] };
|
|
20773
20779
|
}
|
|
20774
20780
|
});
|
|
@@ -20777,7 +20783,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
20777
20783
|
productStrings,
|
|
20778
20784
|
messageHistory
|
|
20779
20785
|
}) {
|
|
20780
|
-
var _a, _b;
|
|
20786
|
+
var _a, _b, _c;
|
|
20781
20787
|
const { environment, customBaseUrl } = options;
|
|
20782
20788
|
try {
|
|
20783
20789
|
const res = yield fetch(`${getApiUrl(environment, customBaseUrl)}chat/bestProducts`, __spreadProps2(__spreadValues2({}, defaultConfig), {
|
|
@@ -20789,9 +20795,10 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
20789
20795
|
return __spreadProps2(__spreadValues2({}, data), { success: true });
|
|
20790
20796
|
}
|
|
20791
20797
|
const errors = yield res.json();
|
|
20798
|
+
(_b = options == null ? void 0 : options.onError) == null ? void 0 : _b.call(options, errors);
|
|
20792
20799
|
return { success: false, errors };
|
|
20793
20800
|
} catch (e) {
|
|
20794
|
-
(
|
|
20801
|
+
(_c = options == null ? void 0 : options.onError) == null ? void 0 : _c.call(options, e);
|
|
20795
20802
|
return { success: false, errors: [e] };
|
|
20796
20803
|
}
|
|
20797
20804
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@getlupa/client",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.9",
|
|
4
4
|
"main": "dist/lupaSearch.js",
|
|
5
5
|
"module": "dist/index.mjs",
|
|
6
6
|
"types": "dist/src/index.d.ts",
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
},
|
|
21
21
|
"devDependencies": {
|
|
22
22
|
"@getlupa/client-sdk": "^1.3.4",
|
|
23
|
-
"@getlupa/vue": "0.3.
|
|
23
|
+
"@getlupa/vue": "0.3.7",
|
|
24
24
|
"@rushstack/eslint-patch": "^1.3.2",
|
|
25
25
|
"@tsconfig/node18": "^2.0.1",
|
|
26
26
|
"@types/jsdom": "^21.1.1",
|