@getlupa/vue 0.3.4 → 0.3.5
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 +61 -42
- package/dist/lupaSearch.mjs +61 -42
- package/package.json +1 -1
package/dist/lupaSearch.js
CHANGED
|
@@ -16079,6 +16079,7 @@ const defaultConfig = {
|
|
|
16079
16079
|
method: "POST",
|
|
16080
16080
|
headers: { "Content-Type": "application/json" }
|
|
16081
16081
|
};
|
|
16082
|
+
const headers = defaultConfig.headers;
|
|
16082
16083
|
const getApiUrl = (environment, customBaseUrl) => {
|
|
16083
16084
|
if (customBaseUrl) {
|
|
16084
16085
|
return customBaseUrl;
|
|
@@ -16086,66 +16087,84 @@ const getApiUrl = (environment, customBaseUrl) => {
|
|
|
16086
16087
|
return Env[environment] || Env["production"];
|
|
16087
16088
|
};
|
|
16088
16089
|
const suggestSearchChatPhrases = (options, request) => __async(exports, null, function* () {
|
|
16089
|
-
var _a;
|
|
16090
|
+
var _a, _b;
|
|
16090
16091
|
const { environment, customBaseUrl } = options;
|
|
16091
|
-
|
|
16092
|
-
|
|
16093
|
-
|
|
16094
|
-
|
|
16095
|
-
|
|
16096
|
-
|
|
16097
|
-
|
|
16092
|
+
try {
|
|
16093
|
+
const res = yield fetch(`${getApiUrl(environment, customBaseUrl)}chat/`, __spreadProps(__spreadValues({}, defaultConfig), {
|
|
16094
|
+
body: JSON.stringify(request),
|
|
16095
|
+
headers: __spreadValues(__spreadValues({}, headers), (_a = options.customHeaders) != null ? _a : {})
|
|
16096
|
+
}));
|
|
16097
|
+
if (res.status < 400) {
|
|
16098
|
+
const data = yield res.json();
|
|
16099
|
+
return __spreadProps(__spreadValues({}, data), { success: true });
|
|
16100
|
+
}
|
|
16101
|
+
const errors = yield res.json();
|
|
16102
|
+
return { success: false, errors };
|
|
16103
|
+
} catch (e) {
|
|
16104
|
+
(_b = options == null ? void 0 : options.onError) == null ? void 0 : _b.call(options, e);
|
|
16105
|
+
return { success: false, errors: [e] };
|
|
16098
16106
|
}
|
|
16099
|
-
const errors = yield res.json();
|
|
16100
|
-
return { success: false, errors };
|
|
16101
16107
|
});
|
|
16102
16108
|
const suggestPhraseAlternatives = (_0, _1) => __async(exports, [_0, _1], function* (options, { phrases }) {
|
|
16103
|
-
var _a;
|
|
16109
|
+
var _a, _b;
|
|
16104
16110
|
const { environment, customBaseUrl } = options;
|
|
16105
|
-
|
|
16106
|
-
|
|
16107
|
-
|
|
16108
|
-
|
|
16109
|
-
|
|
16110
|
-
|
|
16111
|
-
|
|
16111
|
+
try {
|
|
16112
|
+
const res = yield fetch(`${getApiUrl(environment, customBaseUrl)}chat/phraseAlternatives`, __spreadProps(__spreadValues({}, defaultConfig), {
|
|
16113
|
+
body: JSON.stringify({ phrases }),
|
|
16114
|
+
headers: __spreadValues(__spreadValues({}, headers), (_a = options.customHeaders) != null ? _a : {})
|
|
16115
|
+
}));
|
|
16116
|
+
if (res.status < 400) {
|
|
16117
|
+
const data = yield res.json();
|
|
16118
|
+
return __spreadProps(__spreadValues({}, data), { success: true });
|
|
16119
|
+
}
|
|
16120
|
+
const errors = yield res.json();
|
|
16121
|
+
return { success: false, errors };
|
|
16122
|
+
} catch (e) {
|
|
16123
|
+
(_b = options == null ? void 0 : options.onError) == null ? void 0 : _b.call(options, e);
|
|
16124
|
+
return { success: false, errors: [e] };
|
|
16112
16125
|
}
|
|
16113
|
-
const errors = yield res.json();
|
|
16114
|
-
return { success: false, errors };
|
|
16115
16126
|
});
|
|
16116
16127
|
const suggestSimplifiedPhrases = (_0, _1) => __async(exports, [_0, _1], function* (options, { phrases }) {
|
|
16117
|
-
var _a;
|
|
16128
|
+
var _a, _b;
|
|
16118
16129
|
const { environment, customBaseUrl } = options;
|
|
16119
|
-
|
|
16120
|
-
|
|
16121
|
-
|
|
16122
|
-
|
|
16123
|
-
|
|
16124
|
-
|
|
16125
|
-
|
|
16126
|
-
|
|
16130
|
+
try {
|
|
16131
|
+
const res = yield fetch(`${getApiUrl(environment, customBaseUrl)}chat/simplify`, __spreadProps(__spreadValues({}, defaultConfig), {
|
|
16132
|
+
body: JSON.stringify({ phrases }),
|
|
16133
|
+
headers: __spreadValues(__spreadValues({}, headers), (_a = options.customHeaders) != null ? _a : {})
|
|
16134
|
+
}));
|
|
16135
|
+
if (res.status < 400) {
|
|
16136
|
+
const data = yield res.json();
|
|
16137
|
+
return __spreadProps(__spreadValues({}, data), { success: true });
|
|
16138
|
+
}
|
|
16139
|
+
const errors = yield res.json();
|
|
16140
|
+
return { success: false, errors };
|
|
16141
|
+
} catch (e) {
|
|
16142
|
+
(_b = options == null ? void 0 : options.onError) == null ? void 0 : _b.call(options, e);
|
|
16143
|
+
return { success: false, errors: [e] };
|
|
16127
16144
|
}
|
|
16128
|
-
const errors = yield res.json();
|
|
16129
|
-
return { success: false, errors };
|
|
16130
16145
|
});
|
|
16131
16146
|
const suggestBestProductMatches = (_0, _1) => __async(exports, [_0, _1], function* (options, {
|
|
16132
16147
|
initialQuery,
|
|
16133
16148
|
productStrings,
|
|
16134
16149
|
messageHistory
|
|
16135
16150
|
}) {
|
|
16136
|
-
var _a;
|
|
16151
|
+
var _a, _b;
|
|
16137
16152
|
const { environment, customBaseUrl } = options;
|
|
16138
|
-
|
|
16139
|
-
|
|
16140
|
-
|
|
16141
|
-
|
|
16142
|
-
|
|
16143
|
-
|
|
16144
|
-
|
|
16145
|
-
|
|
16153
|
+
try {
|
|
16154
|
+
const res = yield fetch(`${getApiUrl(environment, customBaseUrl)}chat/bestProducts`, __spreadProps(__spreadValues({}, defaultConfig), {
|
|
16155
|
+
body: JSON.stringify({ initialQuery, messageHistory, productStrings }),
|
|
16156
|
+
headers: __spreadValues(__spreadValues({}, headers), (_a = options.customHeaders) != null ? _a : {})
|
|
16157
|
+
}));
|
|
16158
|
+
if (res.status < 400) {
|
|
16159
|
+
const data = yield res.json();
|
|
16160
|
+
return __spreadProps(__spreadValues({}, data), { success: true });
|
|
16161
|
+
}
|
|
16162
|
+
const errors = yield res.json();
|
|
16163
|
+
return { success: false, errors };
|
|
16164
|
+
} catch (e) {
|
|
16165
|
+
(_b = options == null ? void 0 : options.onError) == null ? void 0 : _b.call(options, e);
|
|
16166
|
+
return { success: false, errors: [e] };
|
|
16146
16167
|
}
|
|
16147
|
-
const errors = yield res.json();
|
|
16148
|
-
return { success: false, errors };
|
|
16149
16168
|
});
|
|
16150
16169
|
const prepareChatHistory = (chatLog) => {
|
|
16151
16170
|
var _a, _b;
|
package/dist/lupaSearch.mjs
CHANGED
|
@@ -16077,6 +16077,7 @@ const defaultConfig = {
|
|
|
16077
16077
|
method: "POST",
|
|
16078
16078
|
headers: { "Content-Type": "application/json" }
|
|
16079
16079
|
};
|
|
16080
|
+
const headers = defaultConfig.headers;
|
|
16080
16081
|
const getApiUrl = (environment, customBaseUrl) => {
|
|
16081
16082
|
if (customBaseUrl) {
|
|
16082
16083
|
return customBaseUrl;
|
|
@@ -16084,66 +16085,84 @@ const getApiUrl = (environment, customBaseUrl) => {
|
|
|
16084
16085
|
return Env[environment] || Env["production"];
|
|
16085
16086
|
};
|
|
16086
16087
|
const suggestSearchChatPhrases = (options, request) => __async(void 0, null, function* () {
|
|
16087
|
-
var _a;
|
|
16088
|
+
var _a, _b;
|
|
16088
16089
|
const { environment, customBaseUrl } = options;
|
|
16089
|
-
|
|
16090
|
-
|
|
16091
|
-
|
|
16092
|
-
|
|
16093
|
-
|
|
16094
|
-
|
|
16095
|
-
|
|
16090
|
+
try {
|
|
16091
|
+
const res = yield fetch(`${getApiUrl(environment, customBaseUrl)}chat/`, __spreadProps(__spreadValues({}, defaultConfig), {
|
|
16092
|
+
body: JSON.stringify(request),
|
|
16093
|
+
headers: __spreadValues(__spreadValues({}, headers), (_a = options.customHeaders) != null ? _a : {})
|
|
16094
|
+
}));
|
|
16095
|
+
if (res.status < 400) {
|
|
16096
|
+
const data = yield res.json();
|
|
16097
|
+
return __spreadProps(__spreadValues({}, data), { success: true });
|
|
16098
|
+
}
|
|
16099
|
+
const errors = yield res.json();
|
|
16100
|
+
return { success: false, errors };
|
|
16101
|
+
} catch (e) {
|
|
16102
|
+
(_b = options == null ? void 0 : options.onError) == null ? void 0 : _b.call(options, e);
|
|
16103
|
+
return { success: false, errors: [e] };
|
|
16096
16104
|
}
|
|
16097
|
-
const errors = yield res.json();
|
|
16098
|
-
return { success: false, errors };
|
|
16099
16105
|
});
|
|
16100
16106
|
const suggestPhraseAlternatives = (_0, _1) => __async(void 0, [_0, _1], function* (options, { phrases }) {
|
|
16101
|
-
var _a;
|
|
16107
|
+
var _a, _b;
|
|
16102
16108
|
const { environment, customBaseUrl } = options;
|
|
16103
|
-
|
|
16104
|
-
|
|
16105
|
-
|
|
16106
|
-
|
|
16107
|
-
|
|
16108
|
-
|
|
16109
|
-
|
|
16109
|
+
try {
|
|
16110
|
+
const res = yield fetch(`${getApiUrl(environment, customBaseUrl)}chat/phraseAlternatives`, __spreadProps(__spreadValues({}, defaultConfig), {
|
|
16111
|
+
body: JSON.stringify({ phrases }),
|
|
16112
|
+
headers: __spreadValues(__spreadValues({}, headers), (_a = options.customHeaders) != null ? _a : {})
|
|
16113
|
+
}));
|
|
16114
|
+
if (res.status < 400) {
|
|
16115
|
+
const data = yield res.json();
|
|
16116
|
+
return __spreadProps(__spreadValues({}, data), { success: true });
|
|
16117
|
+
}
|
|
16118
|
+
const errors = yield res.json();
|
|
16119
|
+
return { success: false, errors };
|
|
16120
|
+
} catch (e) {
|
|
16121
|
+
(_b = options == null ? void 0 : options.onError) == null ? void 0 : _b.call(options, e);
|
|
16122
|
+
return { success: false, errors: [e] };
|
|
16110
16123
|
}
|
|
16111
|
-
const errors = yield res.json();
|
|
16112
|
-
return { success: false, errors };
|
|
16113
16124
|
});
|
|
16114
16125
|
const suggestSimplifiedPhrases = (_0, _1) => __async(void 0, [_0, _1], function* (options, { phrases }) {
|
|
16115
|
-
var _a;
|
|
16126
|
+
var _a, _b;
|
|
16116
16127
|
const { environment, customBaseUrl } = options;
|
|
16117
|
-
|
|
16118
|
-
|
|
16119
|
-
|
|
16120
|
-
|
|
16121
|
-
|
|
16122
|
-
|
|
16123
|
-
|
|
16124
|
-
|
|
16128
|
+
try {
|
|
16129
|
+
const res = yield fetch(`${getApiUrl(environment, customBaseUrl)}chat/simplify`, __spreadProps(__spreadValues({}, defaultConfig), {
|
|
16130
|
+
body: JSON.stringify({ phrases }),
|
|
16131
|
+
headers: __spreadValues(__spreadValues({}, headers), (_a = options.customHeaders) != null ? _a : {})
|
|
16132
|
+
}));
|
|
16133
|
+
if (res.status < 400) {
|
|
16134
|
+
const data = yield res.json();
|
|
16135
|
+
return __spreadProps(__spreadValues({}, data), { success: true });
|
|
16136
|
+
}
|
|
16137
|
+
const errors = yield res.json();
|
|
16138
|
+
return { success: false, errors };
|
|
16139
|
+
} catch (e) {
|
|
16140
|
+
(_b = options == null ? void 0 : options.onError) == null ? void 0 : _b.call(options, e);
|
|
16141
|
+
return { success: false, errors: [e] };
|
|
16125
16142
|
}
|
|
16126
|
-
const errors = yield res.json();
|
|
16127
|
-
return { success: false, errors };
|
|
16128
16143
|
});
|
|
16129
16144
|
const suggestBestProductMatches = (_0, _1) => __async(void 0, [_0, _1], function* (options, {
|
|
16130
16145
|
initialQuery,
|
|
16131
16146
|
productStrings,
|
|
16132
16147
|
messageHistory
|
|
16133
16148
|
}) {
|
|
16134
|
-
var _a;
|
|
16149
|
+
var _a, _b;
|
|
16135
16150
|
const { environment, customBaseUrl } = options;
|
|
16136
|
-
|
|
16137
|
-
|
|
16138
|
-
|
|
16139
|
-
|
|
16140
|
-
|
|
16141
|
-
|
|
16142
|
-
|
|
16143
|
-
|
|
16151
|
+
try {
|
|
16152
|
+
const res = yield fetch(`${getApiUrl(environment, customBaseUrl)}chat/bestProducts`, __spreadProps(__spreadValues({}, defaultConfig), {
|
|
16153
|
+
body: JSON.stringify({ initialQuery, messageHistory, productStrings }),
|
|
16154
|
+
headers: __spreadValues(__spreadValues({}, headers), (_a = options.customHeaders) != null ? _a : {})
|
|
16155
|
+
}));
|
|
16156
|
+
if (res.status < 400) {
|
|
16157
|
+
const data = yield res.json();
|
|
16158
|
+
return __spreadProps(__spreadValues({}, data), { success: true });
|
|
16159
|
+
}
|
|
16160
|
+
const errors = yield res.json();
|
|
16161
|
+
return { success: false, errors };
|
|
16162
|
+
} catch (e) {
|
|
16163
|
+
(_b = options == null ? void 0 : options.onError) == null ? void 0 : _b.call(options, e);
|
|
16164
|
+
return { success: false, errors: [e] };
|
|
16144
16165
|
}
|
|
16145
|
-
const errors = yield res.json();
|
|
16146
|
-
return { success: false, errors };
|
|
16147
16166
|
});
|
|
16148
16167
|
const prepareChatHistory = (chatLog) => {
|
|
16149
16168
|
var _a, _b;
|