@getlupa/client 1.3.6 → 1.3.7
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 +61 -42
- package/dist/lupaSearch.js +61 -42
- package/dist/lupaSearch.mjs +61 -42
- package/dist/lupaSearch.umd.js +61 -42
- package/package.json +2 -2
package/dist/lupaSearch.iife.js
CHANGED
|
@@ -20706,6 +20706,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
20706
20706
|
method: "POST",
|
|
20707
20707
|
headers: { "Content-Type": "application/json" }
|
|
20708
20708
|
};
|
|
20709
|
+
const headers = defaultConfig.headers;
|
|
20709
20710
|
const getApiUrl = (environment, customBaseUrl) => {
|
|
20710
20711
|
if (customBaseUrl) {
|
|
20711
20712
|
return customBaseUrl;
|
|
@@ -20713,66 +20714,84 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
20713
20714
|
return Env[environment] || Env["production"];
|
|
20714
20715
|
};
|
|
20715
20716
|
const suggestSearchChatPhrases = (options, request) => __async(void 0, null, function* () {
|
|
20716
|
-
var _a;
|
|
20717
|
+
var _a, _b;
|
|
20717
20718
|
const { environment, customBaseUrl } = options;
|
|
20718
|
-
|
|
20719
|
-
|
|
20720
|
-
|
|
20721
|
-
|
|
20722
|
-
|
|
20723
|
-
|
|
20724
|
-
|
|
20719
|
+
try {
|
|
20720
|
+
const res = yield fetch(`${getApiUrl(environment, customBaseUrl)}chat/`, __spreadProps2(__spreadValues2({}, defaultConfig), {
|
|
20721
|
+
body: JSON.stringify(request),
|
|
20722
|
+
headers: __spreadValues2(__spreadValues2({}, headers), (_a = options.customHeaders) != null ? _a : {})
|
|
20723
|
+
}));
|
|
20724
|
+
if (res.status < 400) {
|
|
20725
|
+
const data = yield res.json();
|
|
20726
|
+
return __spreadProps2(__spreadValues2({}, data), { success: true });
|
|
20727
|
+
}
|
|
20728
|
+
const errors = yield res.json();
|
|
20729
|
+
return { success: false, errors };
|
|
20730
|
+
} catch (e) {
|
|
20731
|
+
(_b = options == null ? void 0 : options.onError) == null ? void 0 : _b.call(options, e);
|
|
20732
|
+
return { success: false, errors: [e] };
|
|
20725
20733
|
}
|
|
20726
|
-
const errors = yield res.json();
|
|
20727
|
-
return { success: false, errors };
|
|
20728
20734
|
});
|
|
20729
20735
|
const suggestPhraseAlternatives = (_0, _1) => __async(void 0, [_0, _1], function* (options, { phrases }) {
|
|
20730
|
-
var _a;
|
|
20736
|
+
var _a, _b;
|
|
20731
20737
|
const { environment, customBaseUrl } = options;
|
|
20732
|
-
|
|
20733
|
-
|
|
20734
|
-
|
|
20735
|
-
|
|
20736
|
-
|
|
20737
|
-
|
|
20738
|
-
|
|
20738
|
+
try {
|
|
20739
|
+
const res = yield fetch(`${getApiUrl(environment, customBaseUrl)}chat/phraseAlternatives`, __spreadProps2(__spreadValues2({}, defaultConfig), {
|
|
20740
|
+
body: JSON.stringify({ phrases }),
|
|
20741
|
+
headers: __spreadValues2(__spreadValues2({}, headers), (_a = options.customHeaders) != null ? _a : {})
|
|
20742
|
+
}));
|
|
20743
|
+
if (res.status < 400) {
|
|
20744
|
+
const data = yield res.json();
|
|
20745
|
+
return __spreadProps2(__spreadValues2({}, data), { success: true });
|
|
20746
|
+
}
|
|
20747
|
+
const errors = yield res.json();
|
|
20748
|
+
return { success: false, errors };
|
|
20749
|
+
} catch (e) {
|
|
20750
|
+
(_b = options == null ? void 0 : options.onError) == null ? void 0 : _b.call(options, e);
|
|
20751
|
+
return { success: false, errors: [e] };
|
|
20739
20752
|
}
|
|
20740
|
-
const errors = yield res.json();
|
|
20741
|
-
return { success: false, errors };
|
|
20742
20753
|
});
|
|
20743
20754
|
const suggestSimplifiedPhrases = (_0, _1) => __async(void 0, [_0, _1], function* (options, { phrases }) {
|
|
20744
|
-
var _a;
|
|
20755
|
+
var _a, _b;
|
|
20745
20756
|
const { environment, customBaseUrl } = options;
|
|
20746
|
-
|
|
20747
|
-
|
|
20748
|
-
|
|
20749
|
-
|
|
20750
|
-
|
|
20751
|
-
|
|
20752
|
-
|
|
20753
|
-
|
|
20757
|
+
try {
|
|
20758
|
+
const res = yield fetch(`${getApiUrl(environment, customBaseUrl)}chat/simplify`, __spreadProps2(__spreadValues2({}, defaultConfig), {
|
|
20759
|
+
body: JSON.stringify({ phrases }),
|
|
20760
|
+
headers: __spreadValues2(__spreadValues2({}, headers), (_a = options.customHeaders) != null ? _a : {})
|
|
20761
|
+
}));
|
|
20762
|
+
if (res.status < 400) {
|
|
20763
|
+
const data = yield res.json();
|
|
20764
|
+
return __spreadProps2(__spreadValues2({}, data), { success: true });
|
|
20765
|
+
}
|
|
20766
|
+
const errors = yield res.json();
|
|
20767
|
+
return { success: false, errors };
|
|
20768
|
+
} catch (e) {
|
|
20769
|
+
(_b = options == null ? void 0 : options.onError) == null ? void 0 : _b.call(options, e);
|
|
20770
|
+
return { success: false, errors: [e] };
|
|
20754
20771
|
}
|
|
20755
|
-
const errors = yield res.json();
|
|
20756
|
-
return { success: false, errors };
|
|
20757
20772
|
});
|
|
20758
20773
|
const suggestBestProductMatches = (_0, _1) => __async(void 0, [_0, _1], function* (options, {
|
|
20759
20774
|
initialQuery,
|
|
20760
20775
|
productStrings,
|
|
20761
20776
|
messageHistory
|
|
20762
20777
|
}) {
|
|
20763
|
-
var _a;
|
|
20778
|
+
var _a, _b;
|
|
20764
20779
|
const { environment, customBaseUrl } = options;
|
|
20765
|
-
|
|
20766
|
-
|
|
20767
|
-
|
|
20768
|
-
|
|
20769
|
-
|
|
20770
|
-
|
|
20771
|
-
|
|
20772
|
-
|
|
20780
|
+
try {
|
|
20781
|
+
const res = yield fetch(`${getApiUrl(environment, customBaseUrl)}chat/bestProducts`, __spreadProps2(__spreadValues2({}, defaultConfig), {
|
|
20782
|
+
body: JSON.stringify({ initialQuery, messageHistory, productStrings }),
|
|
20783
|
+
headers: __spreadValues2(__spreadValues2({}, headers), (_a = options.customHeaders) != null ? _a : {})
|
|
20784
|
+
}));
|
|
20785
|
+
if (res.status < 400) {
|
|
20786
|
+
const data = yield res.json();
|
|
20787
|
+
return __spreadProps2(__spreadValues2({}, data), { success: true });
|
|
20788
|
+
}
|
|
20789
|
+
const errors = yield res.json();
|
|
20790
|
+
return { success: false, errors };
|
|
20791
|
+
} catch (e) {
|
|
20792
|
+
(_b = options == null ? void 0 : options.onError) == null ? void 0 : _b.call(options, e);
|
|
20793
|
+
return { success: false, errors: [e] };
|
|
20773
20794
|
}
|
|
20774
|
-
const errors = yield res.json();
|
|
20775
|
-
return { success: false, errors };
|
|
20776
20795
|
});
|
|
20777
20796
|
const prepareChatHistory = (chatLog) => {
|
|
20778
20797
|
var _a, _b;
|
package/dist/lupaSearch.js
CHANGED
|
@@ -20706,6 +20706,7 @@ const defaultConfig = {
|
|
|
20706
20706
|
method: "POST",
|
|
20707
20707
|
headers: { "Content-Type": "application/json" }
|
|
20708
20708
|
};
|
|
20709
|
+
const headers = defaultConfig.headers;
|
|
20709
20710
|
const getApiUrl = (environment, customBaseUrl) => {
|
|
20710
20711
|
if (customBaseUrl) {
|
|
20711
20712
|
return customBaseUrl;
|
|
@@ -20713,66 +20714,84 @@ const getApiUrl = (environment, customBaseUrl) => {
|
|
|
20713
20714
|
return Env[environment] || Env["production"];
|
|
20714
20715
|
};
|
|
20715
20716
|
const suggestSearchChatPhrases = (options, request) => __async(void 0, null, function* () {
|
|
20716
|
-
var _a;
|
|
20717
|
+
var _a, _b;
|
|
20717
20718
|
const { environment, customBaseUrl } = options;
|
|
20718
|
-
|
|
20719
|
-
|
|
20720
|
-
|
|
20721
|
-
|
|
20722
|
-
|
|
20723
|
-
|
|
20724
|
-
|
|
20719
|
+
try {
|
|
20720
|
+
const res = yield fetch(`${getApiUrl(environment, customBaseUrl)}chat/`, __spreadProps2(__spreadValues2({}, defaultConfig), {
|
|
20721
|
+
body: JSON.stringify(request),
|
|
20722
|
+
headers: __spreadValues2(__spreadValues2({}, headers), (_a = options.customHeaders) != null ? _a : {})
|
|
20723
|
+
}));
|
|
20724
|
+
if (res.status < 400) {
|
|
20725
|
+
const data = yield res.json();
|
|
20726
|
+
return __spreadProps2(__spreadValues2({}, data), { success: true });
|
|
20727
|
+
}
|
|
20728
|
+
const errors = yield res.json();
|
|
20729
|
+
return { success: false, errors };
|
|
20730
|
+
} catch (e) {
|
|
20731
|
+
(_b = options == null ? void 0 : options.onError) == null ? void 0 : _b.call(options, e);
|
|
20732
|
+
return { success: false, errors: [e] };
|
|
20725
20733
|
}
|
|
20726
|
-
const errors = yield res.json();
|
|
20727
|
-
return { success: false, errors };
|
|
20728
20734
|
});
|
|
20729
20735
|
const suggestPhraseAlternatives = (_0, _1) => __async(void 0, [_0, _1], function* (options, { phrases }) {
|
|
20730
|
-
var _a;
|
|
20736
|
+
var _a, _b;
|
|
20731
20737
|
const { environment, customBaseUrl } = options;
|
|
20732
|
-
|
|
20733
|
-
|
|
20734
|
-
|
|
20735
|
-
|
|
20736
|
-
|
|
20737
|
-
|
|
20738
|
-
|
|
20738
|
+
try {
|
|
20739
|
+
const res = yield fetch(`${getApiUrl(environment, customBaseUrl)}chat/phraseAlternatives`, __spreadProps2(__spreadValues2({}, defaultConfig), {
|
|
20740
|
+
body: JSON.stringify({ phrases }),
|
|
20741
|
+
headers: __spreadValues2(__spreadValues2({}, headers), (_a = options.customHeaders) != null ? _a : {})
|
|
20742
|
+
}));
|
|
20743
|
+
if (res.status < 400) {
|
|
20744
|
+
const data = yield res.json();
|
|
20745
|
+
return __spreadProps2(__spreadValues2({}, data), { success: true });
|
|
20746
|
+
}
|
|
20747
|
+
const errors = yield res.json();
|
|
20748
|
+
return { success: false, errors };
|
|
20749
|
+
} catch (e) {
|
|
20750
|
+
(_b = options == null ? void 0 : options.onError) == null ? void 0 : _b.call(options, e);
|
|
20751
|
+
return { success: false, errors: [e] };
|
|
20739
20752
|
}
|
|
20740
|
-
const errors = yield res.json();
|
|
20741
|
-
return { success: false, errors };
|
|
20742
20753
|
});
|
|
20743
20754
|
const suggestSimplifiedPhrases = (_0, _1) => __async(void 0, [_0, _1], function* (options, { phrases }) {
|
|
20744
|
-
var _a;
|
|
20755
|
+
var _a, _b;
|
|
20745
20756
|
const { environment, customBaseUrl } = options;
|
|
20746
|
-
|
|
20747
|
-
|
|
20748
|
-
|
|
20749
|
-
|
|
20750
|
-
|
|
20751
|
-
|
|
20752
|
-
|
|
20753
|
-
|
|
20757
|
+
try {
|
|
20758
|
+
const res = yield fetch(`${getApiUrl(environment, customBaseUrl)}chat/simplify`, __spreadProps2(__spreadValues2({}, defaultConfig), {
|
|
20759
|
+
body: JSON.stringify({ phrases }),
|
|
20760
|
+
headers: __spreadValues2(__spreadValues2({}, headers), (_a = options.customHeaders) != null ? _a : {})
|
|
20761
|
+
}));
|
|
20762
|
+
if (res.status < 400) {
|
|
20763
|
+
const data = yield res.json();
|
|
20764
|
+
return __spreadProps2(__spreadValues2({}, data), { success: true });
|
|
20765
|
+
}
|
|
20766
|
+
const errors = yield res.json();
|
|
20767
|
+
return { success: false, errors };
|
|
20768
|
+
} catch (e) {
|
|
20769
|
+
(_b = options == null ? void 0 : options.onError) == null ? void 0 : _b.call(options, e);
|
|
20770
|
+
return { success: false, errors: [e] };
|
|
20754
20771
|
}
|
|
20755
|
-
const errors = yield res.json();
|
|
20756
|
-
return { success: false, errors };
|
|
20757
20772
|
});
|
|
20758
20773
|
const suggestBestProductMatches = (_0, _1) => __async(void 0, [_0, _1], function* (options, {
|
|
20759
20774
|
initialQuery,
|
|
20760
20775
|
productStrings,
|
|
20761
20776
|
messageHistory
|
|
20762
20777
|
}) {
|
|
20763
|
-
var _a;
|
|
20778
|
+
var _a, _b;
|
|
20764
20779
|
const { environment, customBaseUrl } = options;
|
|
20765
|
-
|
|
20766
|
-
|
|
20767
|
-
|
|
20768
|
-
|
|
20769
|
-
|
|
20770
|
-
|
|
20771
|
-
|
|
20772
|
-
|
|
20780
|
+
try {
|
|
20781
|
+
const res = yield fetch(`${getApiUrl(environment, customBaseUrl)}chat/bestProducts`, __spreadProps2(__spreadValues2({}, defaultConfig), {
|
|
20782
|
+
body: JSON.stringify({ initialQuery, messageHistory, productStrings }),
|
|
20783
|
+
headers: __spreadValues2(__spreadValues2({}, headers), (_a = options.customHeaders) != null ? _a : {})
|
|
20784
|
+
}));
|
|
20785
|
+
if (res.status < 400) {
|
|
20786
|
+
const data = yield res.json();
|
|
20787
|
+
return __spreadProps2(__spreadValues2({}, data), { success: true });
|
|
20788
|
+
}
|
|
20789
|
+
const errors = yield res.json();
|
|
20790
|
+
return { success: false, errors };
|
|
20791
|
+
} catch (e) {
|
|
20792
|
+
(_b = options == null ? void 0 : options.onError) == null ? void 0 : _b.call(options, e);
|
|
20793
|
+
return { success: false, errors: [e] };
|
|
20773
20794
|
}
|
|
20774
|
-
const errors = yield res.json();
|
|
20775
|
-
return { success: false, errors };
|
|
20776
20795
|
});
|
|
20777
20796
|
const prepareChatHistory = (chatLog) => {
|
|
20778
20797
|
var _a, _b;
|
package/dist/lupaSearch.mjs
CHANGED
|
@@ -20704,6 +20704,7 @@ const defaultConfig = {
|
|
|
20704
20704
|
method: "POST",
|
|
20705
20705
|
headers: { "Content-Type": "application/json" }
|
|
20706
20706
|
};
|
|
20707
|
+
const headers = defaultConfig.headers;
|
|
20707
20708
|
const getApiUrl = (environment, customBaseUrl) => {
|
|
20708
20709
|
if (customBaseUrl) {
|
|
20709
20710
|
return customBaseUrl;
|
|
@@ -20711,66 +20712,84 @@ const getApiUrl = (environment, customBaseUrl) => {
|
|
|
20711
20712
|
return Env[environment] || Env["production"];
|
|
20712
20713
|
};
|
|
20713
20714
|
const suggestSearchChatPhrases = (options, request) => __async(void 0, null, function* () {
|
|
20714
|
-
var _a;
|
|
20715
|
+
var _a, _b;
|
|
20715
20716
|
const { environment, customBaseUrl } = options;
|
|
20716
|
-
|
|
20717
|
-
|
|
20718
|
-
|
|
20719
|
-
|
|
20720
|
-
|
|
20721
|
-
|
|
20722
|
-
|
|
20717
|
+
try {
|
|
20718
|
+
const res = yield fetch(`${getApiUrl(environment, customBaseUrl)}chat/`, __spreadProps2(__spreadValues2({}, defaultConfig), {
|
|
20719
|
+
body: JSON.stringify(request),
|
|
20720
|
+
headers: __spreadValues2(__spreadValues2({}, headers), (_a = options.customHeaders) != null ? _a : {})
|
|
20721
|
+
}));
|
|
20722
|
+
if (res.status < 400) {
|
|
20723
|
+
const data = yield res.json();
|
|
20724
|
+
return __spreadProps2(__spreadValues2({}, data), { success: true });
|
|
20725
|
+
}
|
|
20726
|
+
const errors = yield res.json();
|
|
20727
|
+
return { success: false, errors };
|
|
20728
|
+
} catch (e) {
|
|
20729
|
+
(_b = options == null ? void 0 : options.onError) == null ? void 0 : _b.call(options, e);
|
|
20730
|
+
return { success: false, errors: [e] };
|
|
20723
20731
|
}
|
|
20724
|
-
const errors = yield res.json();
|
|
20725
|
-
return { success: false, errors };
|
|
20726
20732
|
});
|
|
20727
20733
|
const suggestPhraseAlternatives = (_0, _1) => __async(void 0, [_0, _1], function* (options, { phrases }) {
|
|
20728
|
-
var _a;
|
|
20734
|
+
var _a, _b;
|
|
20729
20735
|
const { environment, customBaseUrl } = options;
|
|
20730
|
-
|
|
20731
|
-
|
|
20732
|
-
|
|
20733
|
-
|
|
20734
|
-
|
|
20735
|
-
|
|
20736
|
-
|
|
20736
|
+
try {
|
|
20737
|
+
const res = yield fetch(`${getApiUrl(environment, customBaseUrl)}chat/phraseAlternatives`, __spreadProps2(__spreadValues2({}, defaultConfig), {
|
|
20738
|
+
body: JSON.stringify({ phrases }),
|
|
20739
|
+
headers: __spreadValues2(__spreadValues2({}, headers), (_a = options.customHeaders) != null ? _a : {})
|
|
20740
|
+
}));
|
|
20741
|
+
if (res.status < 400) {
|
|
20742
|
+
const data = yield res.json();
|
|
20743
|
+
return __spreadProps2(__spreadValues2({}, data), { success: true });
|
|
20744
|
+
}
|
|
20745
|
+
const errors = yield res.json();
|
|
20746
|
+
return { success: false, errors };
|
|
20747
|
+
} catch (e) {
|
|
20748
|
+
(_b = options == null ? void 0 : options.onError) == null ? void 0 : _b.call(options, e);
|
|
20749
|
+
return { success: false, errors: [e] };
|
|
20737
20750
|
}
|
|
20738
|
-
const errors = yield res.json();
|
|
20739
|
-
return { success: false, errors };
|
|
20740
20751
|
});
|
|
20741
20752
|
const suggestSimplifiedPhrases = (_0, _1) => __async(void 0, [_0, _1], function* (options, { phrases }) {
|
|
20742
|
-
var _a;
|
|
20753
|
+
var _a, _b;
|
|
20743
20754
|
const { environment, customBaseUrl } = options;
|
|
20744
|
-
|
|
20745
|
-
|
|
20746
|
-
|
|
20747
|
-
|
|
20748
|
-
|
|
20749
|
-
|
|
20750
|
-
|
|
20751
|
-
|
|
20755
|
+
try {
|
|
20756
|
+
const res = yield fetch(`${getApiUrl(environment, customBaseUrl)}chat/simplify`, __spreadProps2(__spreadValues2({}, defaultConfig), {
|
|
20757
|
+
body: JSON.stringify({ phrases }),
|
|
20758
|
+
headers: __spreadValues2(__spreadValues2({}, headers), (_a = options.customHeaders) != null ? _a : {})
|
|
20759
|
+
}));
|
|
20760
|
+
if (res.status < 400) {
|
|
20761
|
+
const data = yield res.json();
|
|
20762
|
+
return __spreadProps2(__spreadValues2({}, data), { success: true });
|
|
20763
|
+
}
|
|
20764
|
+
const errors = yield res.json();
|
|
20765
|
+
return { success: false, errors };
|
|
20766
|
+
} catch (e) {
|
|
20767
|
+
(_b = options == null ? void 0 : options.onError) == null ? void 0 : _b.call(options, e);
|
|
20768
|
+
return { success: false, errors: [e] };
|
|
20752
20769
|
}
|
|
20753
|
-
const errors = yield res.json();
|
|
20754
|
-
return { success: false, errors };
|
|
20755
20770
|
});
|
|
20756
20771
|
const suggestBestProductMatches = (_0, _1) => __async(void 0, [_0, _1], function* (options, {
|
|
20757
20772
|
initialQuery,
|
|
20758
20773
|
productStrings,
|
|
20759
20774
|
messageHistory
|
|
20760
20775
|
}) {
|
|
20761
|
-
var _a;
|
|
20776
|
+
var _a, _b;
|
|
20762
20777
|
const { environment, customBaseUrl } = options;
|
|
20763
|
-
|
|
20764
|
-
|
|
20765
|
-
|
|
20766
|
-
|
|
20767
|
-
|
|
20768
|
-
|
|
20769
|
-
|
|
20770
|
-
|
|
20778
|
+
try {
|
|
20779
|
+
const res = yield fetch(`${getApiUrl(environment, customBaseUrl)}chat/bestProducts`, __spreadProps2(__spreadValues2({}, defaultConfig), {
|
|
20780
|
+
body: JSON.stringify({ initialQuery, messageHistory, productStrings }),
|
|
20781
|
+
headers: __spreadValues2(__spreadValues2({}, headers), (_a = options.customHeaders) != null ? _a : {})
|
|
20782
|
+
}));
|
|
20783
|
+
if (res.status < 400) {
|
|
20784
|
+
const data = yield res.json();
|
|
20785
|
+
return __spreadProps2(__spreadValues2({}, data), { success: true });
|
|
20786
|
+
}
|
|
20787
|
+
const errors = yield res.json();
|
|
20788
|
+
return { success: false, errors };
|
|
20789
|
+
} catch (e) {
|
|
20790
|
+
(_b = options == null ? void 0 : options.onError) == null ? void 0 : _b.call(options, e);
|
|
20791
|
+
return { success: false, errors: [e] };
|
|
20771
20792
|
}
|
|
20772
|
-
const errors = yield res.json();
|
|
20773
|
-
return { success: false, errors };
|
|
20774
20793
|
});
|
|
20775
20794
|
const prepareChatHistory = (chatLog) => {
|
|
20776
20795
|
var _a, _b;
|
package/dist/lupaSearch.umd.js
CHANGED
|
@@ -20708,6 +20708,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
20708
20708
|
method: "POST",
|
|
20709
20709
|
headers: { "Content-Type": "application/json" }
|
|
20710
20710
|
};
|
|
20711
|
+
const headers = defaultConfig.headers;
|
|
20711
20712
|
const getApiUrl = (environment, customBaseUrl) => {
|
|
20712
20713
|
if (customBaseUrl) {
|
|
20713
20714
|
return customBaseUrl;
|
|
@@ -20715,66 +20716,84 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
20715
20716
|
return Env[environment] || Env["production"];
|
|
20716
20717
|
};
|
|
20717
20718
|
const suggestSearchChatPhrases = (options, request) => __async(void 0, null, function* () {
|
|
20718
|
-
var _a;
|
|
20719
|
+
var _a, _b;
|
|
20719
20720
|
const { environment, customBaseUrl } = options;
|
|
20720
|
-
|
|
20721
|
-
|
|
20722
|
-
|
|
20723
|
-
|
|
20724
|
-
|
|
20725
|
-
|
|
20726
|
-
|
|
20721
|
+
try {
|
|
20722
|
+
const res = yield fetch(`${getApiUrl(environment, customBaseUrl)}chat/`, __spreadProps2(__spreadValues2({}, defaultConfig), {
|
|
20723
|
+
body: JSON.stringify(request),
|
|
20724
|
+
headers: __spreadValues2(__spreadValues2({}, headers), (_a = options.customHeaders) != null ? _a : {})
|
|
20725
|
+
}));
|
|
20726
|
+
if (res.status < 400) {
|
|
20727
|
+
const data = yield res.json();
|
|
20728
|
+
return __spreadProps2(__spreadValues2({}, data), { success: true });
|
|
20729
|
+
}
|
|
20730
|
+
const errors = yield res.json();
|
|
20731
|
+
return { success: false, errors };
|
|
20732
|
+
} catch (e) {
|
|
20733
|
+
(_b = options == null ? void 0 : options.onError) == null ? void 0 : _b.call(options, e);
|
|
20734
|
+
return { success: false, errors: [e] };
|
|
20727
20735
|
}
|
|
20728
|
-
const errors = yield res.json();
|
|
20729
|
-
return { success: false, errors };
|
|
20730
20736
|
});
|
|
20731
20737
|
const suggestPhraseAlternatives = (_0, _1) => __async(void 0, [_0, _1], function* (options, { phrases }) {
|
|
20732
|
-
var _a;
|
|
20738
|
+
var _a, _b;
|
|
20733
20739
|
const { environment, customBaseUrl } = options;
|
|
20734
|
-
|
|
20735
|
-
|
|
20736
|
-
|
|
20737
|
-
|
|
20738
|
-
|
|
20739
|
-
|
|
20740
|
-
|
|
20740
|
+
try {
|
|
20741
|
+
const res = yield fetch(`${getApiUrl(environment, customBaseUrl)}chat/phraseAlternatives`, __spreadProps2(__spreadValues2({}, defaultConfig), {
|
|
20742
|
+
body: JSON.stringify({ phrases }),
|
|
20743
|
+
headers: __spreadValues2(__spreadValues2({}, headers), (_a = options.customHeaders) != null ? _a : {})
|
|
20744
|
+
}));
|
|
20745
|
+
if (res.status < 400) {
|
|
20746
|
+
const data = yield res.json();
|
|
20747
|
+
return __spreadProps2(__spreadValues2({}, data), { success: true });
|
|
20748
|
+
}
|
|
20749
|
+
const errors = yield res.json();
|
|
20750
|
+
return { success: false, errors };
|
|
20751
|
+
} catch (e) {
|
|
20752
|
+
(_b = options == null ? void 0 : options.onError) == null ? void 0 : _b.call(options, e);
|
|
20753
|
+
return { success: false, errors: [e] };
|
|
20741
20754
|
}
|
|
20742
|
-
const errors = yield res.json();
|
|
20743
|
-
return { success: false, errors };
|
|
20744
20755
|
});
|
|
20745
20756
|
const suggestSimplifiedPhrases = (_0, _1) => __async(void 0, [_0, _1], function* (options, { phrases }) {
|
|
20746
|
-
var _a;
|
|
20757
|
+
var _a, _b;
|
|
20747
20758
|
const { environment, customBaseUrl } = options;
|
|
20748
|
-
|
|
20749
|
-
|
|
20750
|
-
|
|
20751
|
-
|
|
20752
|
-
|
|
20753
|
-
|
|
20754
|
-
|
|
20755
|
-
|
|
20759
|
+
try {
|
|
20760
|
+
const res = yield fetch(`${getApiUrl(environment, customBaseUrl)}chat/simplify`, __spreadProps2(__spreadValues2({}, defaultConfig), {
|
|
20761
|
+
body: JSON.stringify({ phrases }),
|
|
20762
|
+
headers: __spreadValues2(__spreadValues2({}, headers), (_a = options.customHeaders) != null ? _a : {})
|
|
20763
|
+
}));
|
|
20764
|
+
if (res.status < 400) {
|
|
20765
|
+
const data = yield res.json();
|
|
20766
|
+
return __spreadProps2(__spreadValues2({}, data), { success: true });
|
|
20767
|
+
}
|
|
20768
|
+
const errors = yield res.json();
|
|
20769
|
+
return { success: false, errors };
|
|
20770
|
+
} catch (e) {
|
|
20771
|
+
(_b = options == null ? void 0 : options.onError) == null ? void 0 : _b.call(options, e);
|
|
20772
|
+
return { success: false, errors: [e] };
|
|
20756
20773
|
}
|
|
20757
|
-
const errors = yield res.json();
|
|
20758
|
-
return { success: false, errors };
|
|
20759
20774
|
});
|
|
20760
20775
|
const suggestBestProductMatches = (_0, _1) => __async(void 0, [_0, _1], function* (options, {
|
|
20761
20776
|
initialQuery,
|
|
20762
20777
|
productStrings,
|
|
20763
20778
|
messageHistory
|
|
20764
20779
|
}) {
|
|
20765
|
-
var _a;
|
|
20780
|
+
var _a, _b;
|
|
20766
20781
|
const { environment, customBaseUrl } = options;
|
|
20767
|
-
|
|
20768
|
-
|
|
20769
|
-
|
|
20770
|
-
|
|
20771
|
-
|
|
20772
|
-
|
|
20773
|
-
|
|
20774
|
-
|
|
20782
|
+
try {
|
|
20783
|
+
const res = yield fetch(`${getApiUrl(environment, customBaseUrl)}chat/bestProducts`, __spreadProps2(__spreadValues2({}, defaultConfig), {
|
|
20784
|
+
body: JSON.stringify({ initialQuery, messageHistory, productStrings }),
|
|
20785
|
+
headers: __spreadValues2(__spreadValues2({}, headers), (_a = options.customHeaders) != null ? _a : {})
|
|
20786
|
+
}));
|
|
20787
|
+
if (res.status < 400) {
|
|
20788
|
+
const data = yield res.json();
|
|
20789
|
+
return __spreadProps2(__spreadValues2({}, data), { success: true });
|
|
20790
|
+
}
|
|
20791
|
+
const errors = yield res.json();
|
|
20792
|
+
return { success: false, errors };
|
|
20793
|
+
} catch (e) {
|
|
20794
|
+
(_b = options == null ? void 0 : options.onError) == null ? void 0 : _b.call(options, e);
|
|
20795
|
+
return { success: false, errors: [e] };
|
|
20775
20796
|
}
|
|
20776
|
-
const errors = yield res.json();
|
|
20777
|
-
return { success: false, errors };
|
|
20778
20797
|
});
|
|
20779
20798
|
const prepareChatHistory = (chatLog) => {
|
|
20780
20799
|
var _a, _b;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@getlupa/client",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.7",
|
|
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.5",
|
|
24
24
|
"@rushstack/eslint-patch": "^1.3.2",
|
|
25
25
|
"@tsconfig/node18": "^2.0.1",
|
|
26
26
|
"@types/jsdom": "^21.1.1",
|