@getlupa/client 0.8.0 → 0.8.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/cjs/index.min.js +16 -11
- package/dist/cjs/store/modules/params.d.ts +1 -0
- package/dist/cjs/types/General.d.ts +1 -0
- package/dist/es/index.min.js +16 -11
- package/dist/es/store/modules/params.d.ts +1 -0
- package/dist/es/types/General.d.ts +1 -0
- package/dist/iife/index.min.js +1 -1
- package/dist/iife/store/modules/params.d.ts +1 -0
- package/dist/iife/types/General.d.ts +1 -0
- package/package.json +2 -2
package/dist/cjs/index.min.js
CHANGED
|
@@ -14134,7 +14134,10 @@ var Env = {
|
|
|
14134
14134
|
staging: staging
|
|
14135
14135
|
};
|
|
14136
14136
|
|
|
14137
|
-
const getApiUrl = (environment) => {
|
|
14137
|
+
const getApiUrl = (environment, customBaseUrl) => {
|
|
14138
|
+
if (customBaseUrl) {
|
|
14139
|
+
return customBaseUrl;
|
|
14140
|
+
}
|
|
14138
14141
|
return Env[environment] || Env["production"];
|
|
14139
14142
|
};
|
|
14140
14143
|
|
|
@@ -14177,8 +14180,8 @@ const suggestCustom = (query, options) => __awaiter(void 0, void 0, void 0, func
|
|
|
14177
14180
|
const errors = yield res.json();
|
|
14178
14181
|
return { success: false, errors };
|
|
14179
14182
|
});
|
|
14180
|
-
const search = (queryKey, query, environment) => __awaiter(void 0, void 0, void 0, function* () {
|
|
14181
|
-
const res = yield fetch(`${getApiUrl(environment)}query/${queryKey}`, Object.assign(Object.assign({}, defaultConfig), { body: JSON.stringify(query) }));
|
|
14183
|
+
const search = (queryKey, query, environment, customBaseUrl) => __awaiter(void 0, void 0, void 0, function* () {
|
|
14184
|
+
const res = yield fetch(`${getApiUrl(environment, customBaseUrl)}query/${queryKey}`, Object.assign(Object.assign({}, defaultConfig), { body: JSON.stringify(query) }));
|
|
14182
14185
|
if (res.status < 400) {
|
|
14183
14186
|
const data = yield res.json();
|
|
14184
14187
|
return Object.assign(Object.assign({}, data), { success: true });
|
|
@@ -14186,8 +14189,8 @@ const search = (queryKey, query, environment) => __awaiter(void 0, void 0, void
|
|
|
14186
14189
|
const errors = yield res.json();
|
|
14187
14190
|
return { success: false, errors };
|
|
14188
14191
|
});
|
|
14189
|
-
const suggest = (queryKey, query, environment) => __awaiter(void 0, void 0, void 0, function* () {
|
|
14190
|
-
const res = yield fetch(`${getApiUrl(environment)}query/${queryKey}`, Object.assign(Object.assign({}, defaultConfig), { body: JSON.stringify(query) }));
|
|
14192
|
+
const suggest = (queryKey, query, environment, customBaseUrl) => __awaiter(void 0, void 0, void 0, function* () {
|
|
14193
|
+
const res = yield fetch(`${getApiUrl(environment, customBaseUrl)}query/${queryKey}`, Object.assign(Object.assign({}, defaultConfig), { body: JSON.stringify(query) }));
|
|
14191
14194
|
if (res.status < 400) {
|
|
14192
14195
|
const items = yield res.json();
|
|
14193
14196
|
return { items, success: true };
|
|
@@ -14195,8 +14198,8 @@ const suggest = (queryKey, query, environment) => __awaiter(void 0, void 0, void
|
|
|
14195
14198
|
const errors = yield res.json();
|
|
14196
14199
|
return { success: false, errors };
|
|
14197
14200
|
});
|
|
14198
|
-
const track$1 = (queryKey, event, environment) => __awaiter(void 0, void 0, void 0, function* () {
|
|
14199
|
-
const res = yield fetch(`${getApiUrl(environment)}events`, Object.assign(Object.assign({}, defaultConfig), { body: JSON.stringify(Object.assign({ queryKey }, event)) }));
|
|
14201
|
+
const track$1 = (queryKey, event, environment, customBaseUrl) => __awaiter(void 0, void 0, void 0, function* () {
|
|
14202
|
+
const res = yield fetch(`${getApiUrl(environment, customBaseUrl)}events`, Object.assign(Object.assign({}, defaultConfig), { body: JSON.stringify(Object.assign({ queryKey }, event)) }));
|
|
14200
14203
|
if (res.status < 400) {
|
|
14201
14204
|
return { success: false };
|
|
14202
14205
|
}
|
|
@@ -14208,16 +14211,16 @@ const getLupaSdk = {
|
|
|
14208
14211
|
if (options === null || options === void 0 ? void 0 : options.customUrl) {
|
|
14209
14212
|
return searchCustom(publicQuery, options);
|
|
14210
14213
|
}
|
|
14211
|
-
return search(queryKey, publicQuery, (options === null || options === void 0 ? void 0 : options.environment) || "production");
|
|
14214
|
+
return search(queryKey, publicQuery, (options === null || options === void 0 ? void 0 : options.environment) || "production", options === null || options === void 0 ? void 0 : options.customBaseUrl);
|
|
14212
14215
|
},
|
|
14213
14216
|
suggestions: (queryKey, suggestionQuery, options = null) => {
|
|
14214
14217
|
if (options === null || options === void 0 ? void 0 : options.customUrl) {
|
|
14215
14218
|
return suggestCustom(suggestionQuery, options);
|
|
14216
14219
|
}
|
|
14217
|
-
return suggest(queryKey, suggestionQuery, (options === null || options === void 0 ? void 0 : options.environment) || "production");
|
|
14220
|
+
return suggest(queryKey, suggestionQuery, (options === null || options === void 0 ? void 0 : options.environment) || "production", options === null || options === void 0 ? void 0 : options.customBaseUrl);
|
|
14218
14221
|
},
|
|
14219
14222
|
track: (queryKey, eventData, options = null) => {
|
|
14220
|
-
return track$1(queryKey, eventData, (options === null || options === void 0 ? void 0 : options.environment) || "production");
|
|
14223
|
+
return track$1(queryKey, eventData, (options === null || options === void 0 ? void 0 : options.environment) || "production", options === null || options === void 0 ? void 0 : options.customBaseUrl);
|
|
14221
14224
|
},
|
|
14222
14225
|
};
|
|
14223
14226
|
|
|
@@ -22229,7 +22232,9 @@ let ParamsModule = class ParamsModule extends VuexModule {
|
|
|
22229
22232
|
if (!params) {
|
|
22230
22233
|
return { params: this.params };
|
|
22231
22234
|
}
|
|
22232
|
-
|
|
22235
|
+
const url = getPageUrl();
|
|
22236
|
+
const searchString = url.search;
|
|
22237
|
+
return { params, searchString };
|
|
22233
22238
|
}
|
|
22234
22239
|
removeAllFilters() {
|
|
22235
22240
|
const url = getPageUrl();
|
|
@@ -2,6 +2,7 @@ import { AnalyticsOptions } from "./AnalyticsOptions";
|
|
|
2
2
|
import { Environment as SdkEnvironment } from "@getlupa/client-sdk/Types";
|
|
3
3
|
export declare type SdkOptions = {
|
|
4
4
|
environment: SdkEnvironment;
|
|
5
|
+
customBaseUrl?: string;
|
|
5
6
|
customUrl?: string;
|
|
6
7
|
customPayload?: Record<string, unknown>;
|
|
7
8
|
customHeaders?: Record<string, string>;
|
package/dist/es/index.min.js
CHANGED
|
@@ -14130,7 +14130,10 @@ var Env = {
|
|
|
14130
14130
|
staging: staging
|
|
14131
14131
|
};
|
|
14132
14132
|
|
|
14133
|
-
const getApiUrl = (environment) => {
|
|
14133
|
+
const getApiUrl = (environment, customBaseUrl) => {
|
|
14134
|
+
if (customBaseUrl) {
|
|
14135
|
+
return customBaseUrl;
|
|
14136
|
+
}
|
|
14134
14137
|
return Env[environment] || Env["production"];
|
|
14135
14138
|
};
|
|
14136
14139
|
|
|
@@ -14173,8 +14176,8 @@ const suggestCustom = (query, options) => __awaiter(void 0, void 0, void 0, func
|
|
|
14173
14176
|
const errors = yield res.json();
|
|
14174
14177
|
return { success: false, errors };
|
|
14175
14178
|
});
|
|
14176
|
-
const search = (queryKey, query, environment) => __awaiter(void 0, void 0, void 0, function* () {
|
|
14177
|
-
const res = yield fetch(`${getApiUrl(environment)}query/${queryKey}`, Object.assign(Object.assign({}, defaultConfig), { body: JSON.stringify(query) }));
|
|
14179
|
+
const search = (queryKey, query, environment, customBaseUrl) => __awaiter(void 0, void 0, void 0, function* () {
|
|
14180
|
+
const res = yield fetch(`${getApiUrl(environment, customBaseUrl)}query/${queryKey}`, Object.assign(Object.assign({}, defaultConfig), { body: JSON.stringify(query) }));
|
|
14178
14181
|
if (res.status < 400) {
|
|
14179
14182
|
const data = yield res.json();
|
|
14180
14183
|
return Object.assign(Object.assign({}, data), { success: true });
|
|
@@ -14182,8 +14185,8 @@ const search = (queryKey, query, environment) => __awaiter(void 0, void 0, void
|
|
|
14182
14185
|
const errors = yield res.json();
|
|
14183
14186
|
return { success: false, errors };
|
|
14184
14187
|
});
|
|
14185
|
-
const suggest = (queryKey, query, environment) => __awaiter(void 0, void 0, void 0, function* () {
|
|
14186
|
-
const res = yield fetch(`${getApiUrl(environment)}query/${queryKey}`, Object.assign(Object.assign({}, defaultConfig), { body: JSON.stringify(query) }));
|
|
14188
|
+
const suggest = (queryKey, query, environment, customBaseUrl) => __awaiter(void 0, void 0, void 0, function* () {
|
|
14189
|
+
const res = yield fetch(`${getApiUrl(environment, customBaseUrl)}query/${queryKey}`, Object.assign(Object.assign({}, defaultConfig), { body: JSON.stringify(query) }));
|
|
14187
14190
|
if (res.status < 400) {
|
|
14188
14191
|
const items = yield res.json();
|
|
14189
14192
|
return { items, success: true };
|
|
@@ -14191,8 +14194,8 @@ const suggest = (queryKey, query, environment) => __awaiter(void 0, void 0, void
|
|
|
14191
14194
|
const errors = yield res.json();
|
|
14192
14195
|
return { success: false, errors };
|
|
14193
14196
|
});
|
|
14194
|
-
const track$1 = (queryKey, event, environment) => __awaiter(void 0, void 0, void 0, function* () {
|
|
14195
|
-
const res = yield fetch(`${getApiUrl(environment)}events`, Object.assign(Object.assign({}, defaultConfig), { body: JSON.stringify(Object.assign({ queryKey }, event)) }));
|
|
14197
|
+
const track$1 = (queryKey, event, environment, customBaseUrl) => __awaiter(void 0, void 0, void 0, function* () {
|
|
14198
|
+
const res = yield fetch(`${getApiUrl(environment, customBaseUrl)}events`, Object.assign(Object.assign({}, defaultConfig), { body: JSON.stringify(Object.assign({ queryKey }, event)) }));
|
|
14196
14199
|
if (res.status < 400) {
|
|
14197
14200
|
return { success: false };
|
|
14198
14201
|
}
|
|
@@ -14204,16 +14207,16 @@ const getLupaSdk = {
|
|
|
14204
14207
|
if (options === null || options === void 0 ? void 0 : options.customUrl) {
|
|
14205
14208
|
return searchCustom(publicQuery, options);
|
|
14206
14209
|
}
|
|
14207
|
-
return search(queryKey, publicQuery, (options === null || options === void 0 ? void 0 : options.environment) || "production");
|
|
14210
|
+
return search(queryKey, publicQuery, (options === null || options === void 0 ? void 0 : options.environment) || "production", options === null || options === void 0 ? void 0 : options.customBaseUrl);
|
|
14208
14211
|
},
|
|
14209
14212
|
suggestions: (queryKey, suggestionQuery, options = null) => {
|
|
14210
14213
|
if (options === null || options === void 0 ? void 0 : options.customUrl) {
|
|
14211
14214
|
return suggestCustom(suggestionQuery, options);
|
|
14212
14215
|
}
|
|
14213
|
-
return suggest(queryKey, suggestionQuery, (options === null || options === void 0 ? void 0 : options.environment) || "production");
|
|
14216
|
+
return suggest(queryKey, suggestionQuery, (options === null || options === void 0 ? void 0 : options.environment) || "production", options === null || options === void 0 ? void 0 : options.customBaseUrl);
|
|
14214
14217
|
},
|
|
14215
14218
|
track: (queryKey, eventData, options = null) => {
|
|
14216
|
-
return track$1(queryKey, eventData, (options === null || options === void 0 ? void 0 : options.environment) || "production");
|
|
14219
|
+
return track$1(queryKey, eventData, (options === null || options === void 0 ? void 0 : options.environment) || "production", options === null || options === void 0 ? void 0 : options.customBaseUrl);
|
|
14217
14220
|
},
|
|
14218
14221
|
};
|
|
14219
14222
|
|
|
@@ -22225,7 +22228,9 @@ let ParamsModule = class ParamsModule extends VuexModule {
|
|
|
22225
22228
|
if (!params) {
|
|
22226
22229
|
return { params: this.params };
|
|
22227
22230
|
}
|
|
22228
|
-
|
|
22231
|
+
const url = getPageUrl();
|
|
22232
|
+
const searchString = url.search;
|
|
22233
|
+
return { params, searchString };
|
|
22229
22234
|
}
|
|
22230
22235
|
removeAllFilters() {
|
|
22231
22236
|
const url = getPageUrl();
|
|
@@ -2,6 +2,7 @@ import { AnalyticsOptions } from "./AnalyticsOptions";
|
|
|
2
2
|
import { Environment as SdkEnvironment } from "@getlupa/client-sdk/Types";
|
|
3
3
|
export declare type SdkOptions = {
|
|
4
4
|
environment: SdkEnvironment;
|
|
5
|
+
customBaseUrl?: string;
|
|
5
6
|
customUrl?: string;
|
|
6
7
|
customPayload?: Record<string, unknown>;
|
|
7
8
|
customHeaders?: Record<string, string>;
|