@getlupa/client 1.8.2 → 1.8.3
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 +41 -11
- package/dist/lupaSearch.js +41 -11
- package/dist/lupaSearch.mjs +41 -11
- package/dist/lupaSearch.umd.js +41 -11
- package/package.json +2 -2
package/dist/lupaSearch.iife.js
CHANGED
|
@@ -6166,6 +6166,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
6166
6166
|
const DEFAULT_PAGE_SIZE_SELECTION = [12, 24, 36, 60];
|
|
6167
6167
|
const LUPA_ROUTING_EVENT = "lupaRedirect";
|
|
6168
6168
|
const RATING_STAR_HTML = "☆";
|
|
6169
|
+
const RESULT_ROOT_SELECTOR = "#lupa-search-results";
|
|
6169
6170
|
const production = "https://api.lupasearch.com/v1/";
|
|
6170
6171
|
const staging = "https://api.staging.lupasearch.com/v1/";
|
|
6171
6172
|
const Env$1 = {
|
|
@@ -7150,7 +7151,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
7150
7151
|
const [min, max] = range.split(FACET_RANGE_SEPARATOR);
|
|
7151
7152
|
return {
|
|
7152
7153
|
gte: min,
|
|
7153
|
-
|
|
7154
|
+
lte: max
|
|
7154
7155
|
};
|
|
7155
7156
|
}
|
|
7156
7157
|
if (key.startsWith(FACET_PARAMS_TYPE.HIERARCHY)) {
|
|
@@ -8620,22 +8621,21 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
8620
8621
|
ResultsLayoutEnum2["LIST"] = "List";
|
|
8621
8622
|
return ResultsLayoutEnum2;
|
|
8622
8623
|
})(ResultsLayoutEnum || {});
|
|
8623
|
-
const RESULT_ROOT_ID = "lupa-search-results";
|
|
8624
8624
|
const SHADOW_ROOT_ID = "lupa-shadow-id";
|
|
8625
8625
|
const CONTAINER_ROOT_ID = "lupa-search-container";
|
|
8626
|
-
const scrollToSearchResults = (timeout = 500) => {
|
|
8626
|
+
const scrollToSearchResults = (timeout = 500, containerSelector) => {
|
|
8627
8627
|
if (timeout) {
|
|
8628
|
-
setTimeout(() => scrollTo(
|
|
8628
|
+
setTimeout(() => scrollTo(containerSelector != null ? containerSelector : RESULT_ROOT_SELECTOR), timeout);
|
|
8629
8629
|
} else {
|
|
8630
|
-
scrollTo(
|
|
8630
|
+
scrollTo(RESULT_ROOT_SELECTOR);
|
|
8631
8631
|
}
|
|
8632
8632
|
};
|
|
8633
|
-
const scrollTo = (
|
|
8633
|
+
const scrollTo = (elementSelector) => {
|
|
8634
8634
|
var _a, _b;
|
|
8635
|
-
let el = document.
|
|
8635
|
+
let el = document.querySelector(elementSelector);
|
|
8636
8636
|
const shadowRoot = (_a = document.getElementById(SHADOW_ROOT_ID)) == null ? void 0 : _a.shadowRoot;
|
|
8637
8637
|
if (!el) {
|
|
8638
|
-
el = (_b = shadowRoot == null ? void 0 : shadowRoot.getElementById(
|
|
8638
|
+
el = (_b = shadowRoot == null ? void 0 : shadowRoot.getElementById(elementSelector)) != null ? _b : null;
|
|
8639
8639
|
}
|
|
8640
8640
|
if (!el) {
|
|
8641
8641
|
return;
|
|
@@ -11457,7 +11457,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
11457
11457
|
return typeof currentFilters.value.gte === "string" ? parseFloat(currentFilters.value.gte) : currentFilters.value.gte;
|
|
11458
11458
|
});
|
|
11459
11459
|
const currentLte = computed(() => {
|
|
11460
|
-
return typeof currentFilters.value.
|
|
11460
|
+
return typeof currentFilters.value.lte === "string" ? parseFloat(currentFilters.value.lte) : currentFilters.value.lte;
|
|
11461
11461
|
});
|
|
11462
11462
|
const currentMinValue = computed(() => {
|
|
11463
11463
|
return currentGte.value ? Math.max(currentGte.value, facetMin.value) : facetMin.value;
|
|
@@ -12004,8 +12004,10 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
12004
12004
|
const props = __props;
|
|
12005
12005
|
const paramStore = useParamsStore();
|
|
12006
12006
|
const searchResultStore = useSearchResultStore();
|
|
12007
|
+
const optionsStore = useOptionsStore();
|
|
12007
12008
|
const { filters } = storeToRefs(paramStore);
|
|
12008
12009
|
const { facets } = storeToRefs(searchResultStore);
|
|
12010
|
+
const { searchResultOptions } = storeToRefs(optionsStore);
|
|
12009
12011
|
computed(() => {
|
|
12010
12012
|
var _a;
|
|
12011
12013
|
return (_a = facets.value) == null ? void 0 : _a.filter((f2) => {
|
|
@@ -12020,6 +12022,14 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
12020
12022
|
return !((_a2 = props.options.promotedFacets) == null ? void 0 : _a2.includes(f2.key));
|
|
12021
12023
|
});
|
|
12022
12024
|
});
|
|
12025
|
+
const scrollToResultsOptions = computed(() => {
|
|
12026
|
+
var _a, _b, _c, _d, _e, _f;
|
|
12027
|
+
return {
|
|
12028
|
+
enabled: ((_a = searchResultOptions.value.scrollToResults) == null ? void 0 : _a.enabled) === void 0 ? true : (_b = searchResultOptions.value.scrollToResults) == null ? void 0 : _b.enabled,
|
|
12029
|
+
container: (_d = (_c = searchResultOptions.value.scrollToResults) == null ? void 0 : _c.scrollToContainerSelector) != null ? _d : RESULT_ROOT_SELECTOR,
|
|
12030
|
+
timeout: (_f = (_e = searchResultOptions.value.scrollToResults) == null ? void 0 : _e.timeout) != null ? _f : 500
|
|
12031
|
+
};
|
|
12032
|
+
});
|
|
12023
12033
|
const handleFacetSelect = (facetAction) => {
|
|
12024
12034
|
switch (facetAction.type) {
|
|
12025
12035
|
case "terms":
|
|
@@ -12032,7 +12042,12 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
12032
12042
|
toggleHierarchyFilter(paramStore.appendParams, facetAction, filters.value);
|
|
12033
12043
|
break;
|
|
12034
12044
|
}
|
|
12035
|
-
|
|
12045
|
+
if (scrollToResultsOptions.value.enabled) {
|
|
12046
|
+
scrollToSearchResults(
|
|
12047
|
+
scrollToResultsOptions.value.timeout,
|
|
12048
|
+
scrollToResultsOptions.value.container
|
|
12049
|
+
);
|
|
12050
|
+
}
|
|
12036
12051
|
};
|
|
12037
12052
|
const clear2 = (facet) => {
|
|
12038
12053
|
const param = getFacetKey(facet.key, facet.type);
|
|
@@ -12344,7 +12359,9 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
12344
12359
|
});
|
|
12345
12360
|
const paramStore = useParamsStore();
|
|
12346
12361
|
const screenStore = useScreenStore();
|
|
12362
|
+
const optionsStore = useOptionsStore();
|
|
12347
12363
|
const { isMobileWidth } = storeToRefs(screenStore);
|
|
12364
|
+
const { searchResultOptions } = storeToRefs(optionsStore);
|
|
12348
12365
|
const pageOptionsCount = computed(() => {
|
|
12349
12366
|
return isMobileWidth.value ? props.options.displayMobile : props.options.display;
|
|
12350
12367
|
});
|
|
@@ -12378,12 +12395,25 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
12378
12395
|
const showPagination = computed(() => {
|
|
12379
12396
|
return pages.value.length > 1;
|
|
12380
12397
|
});
|
|
12398
|
+
const scrollToResultsOptions = computed(() => {
|
|
12399
|
+
var _a, _b, _c, _d, _e, _f;
|
|
12400
|
+
return {
|
|
12401
|
+
enabled: ((_a = searchResultOptions.value.scrollToResults) == null ? void 0 : _a.enabled) === void 0 ? true : (_b = searchResultOptions.value.scrollToResults) == null ? void 0 : _b.enabled,
|
|
12402
|
+
container: (_d = (_c = searchResultOptions.value.scrollToResults) == null ? void 0 : _c.scrollToContainerSelector) != null ? _d : RESULT_ROOT_SELECTOR,
|
|
12403
|
+
timeout: (_f = (_e = searchResultOptions.value.scrollToResults) == null ? void 0 : _e.timeout) != null ? _f : 500
|
|
12404
|
+
};
|
|
12405
|
+
});
|
|
12381
12406
|
const handlePageChange = (page) => {
|
|
12382
12407
|
if (page > 0) {
|
|
12383
12408
|
paramStore.appendParams({
|
|
12384
12409
|
params: [{ name: QUERY_PARAMS$1.PAGE, value: page.toString() }]
|
|
12385
12410
|
});
|
|
12386
|
-
|
|
12411
|
+
if (scrollToResultsOptions.value.enabled) {
|
|
12412
|
+
scrollToSearchResults(
|
|
12413
|
+
scrollToResultsOptions.value.timeout,
|
|
12414
|
+
scrollToResultsOptions.value.container
|
|
12415
|
+
);
|
|
12416
|
+
}
|
|
12387
12417
|
}
|
|
12388
12418
|
};
|
|
12389
12419
|
return (_ctx, _cache) => {
|
package/dist/lupaSearch.js
CHANGED
|
@@ -6166,6 +6166,7 @@ const DEFAULT_PAGE_SIZE = 12;
|
|
|
6166
6166
|
const DEFAULT_PAGE_SIZE_SELECTION = [12, 24, 36, 60];
|
|
6167
6167
|
const LUPA_ROUTING_EVENT = "lupaRedirect";
|
|
6168
6168
|
const RATING_STAR_HTML = "☆";
|
|
6169
|
+
const RESULT_ROOT_SELECTOR = "#lupa-search-results";
|
|
6169
6170
|
const production = "https://api.lupasearch.com/v1/";
|
|
6170
6171
|
const staging = "https://api.staging.lupasearch.com/v1/";
|
|
6171
6172
|
const Env$1 = {
|
|
@@ -7150,7 +7151,7 @@ const parseFacetKey = (key, searchParams) => {
|
|
|
7150
7151
|
const [min, max] = range.split(FACET_RANGE_SEPARATOR);
|
|
7151
7152
|
return {
|
|
7152
7153
|
gte: min,
|
|
7153
|
-
|
|
7154
|
+
lte: max
|
|
7154
7155
|
};
|
|
7155
7156
|
}
|
|
7156
7157
|
if (key.startsWith(FACET_PARAMS_TYPE.HIERARCHY)) {
|
|
@@ -8620,22 +8621,21 @@ var ResultsLayoutEnum = /* @__PURE__ */ ((ResultsLayoutEnum2) => {
|
|
|
8620
8621
|
ResultsLayoutEnum2["LIST"] = "List";
|
|
8621
8622
|
return ResultsLayoutEnum2;
|
|
8622
8623
|
})(ResultsLayoutEnum || {});
|
|
8623
|
-
const RESULT_ROOT_ID = "lupa-search-results";
|
|
8624
8624
|
const SHADOW_ROOT_ID = "lupa-shadow-id";
|
|
8625
8625
|
const CONTAINER_ROOT_ID = "lupa-search-container";
|
|
8626
|
-
const scrollToSearchResults = (timeout = 500) => {
|
|
8626
|
+
const scrollToSearchResults = (timeout = 500, containerSelector) => {
|
|
8627
8627
|
if (timeout) {
|
|
8628
|
-
setTimeout(() => scrollTo(
|
|
8628
|
+
setTimeout(() => scrollTo(containerSelector != null ? containerSelector : RESULT_ROOT_SELECTOR), timeout);
|
|
8629
8629
|
} else {
|
|
8630
|
-
scrollTo(
|
|
8630
|
+
scrollTo(RESULT_ROOT_SELECTOR);
|
|
8631
8631
|
}
|
|
8632
8632
|
};
|
|
8633
|
-
const scrollTo = (
|
|
8633
|
+
const scrollTo = (elementSelector) => {
|
|
8634
8634
|
var _a, _b;
|
|
8635
|
-
let el = document.
|
|
8635
|
+
let el = document.querySelector(elementSelector);
|
|
8636
8636
|
const shadowRoot = (_a = document.getElementById(SHADOW_ROOT_ID)) == null ? void 0 : _a.shadowRoot;
|
|
8637
8637
|
if (!el) {
|
|
8638
|
-
el = (_b = shadowRoot == null ? void 0 : shadowRoot.getElementById(
|
|
8638
|
+
el = (_b = shadowRoot == null ? void 0 : shadowRoot.getElementById(elementSelector)) != null ? _b : null;
|
|
8639
8639
|
}
|
|
8640
8640
|
if (!el) {
|
|
8641
8641
|
return;
|
|
@@ -11457,7 +11457,7 @@ const _sfc_main$R = /* @__PURE__ */ defineComponent({
|
|
|
11457
11457
|
return typeof currentFilters.value.gte === "string" ? parseFloat(currentFilters.value.gte) : currentFilters.value.gte;
|
|
11458
11458
|
});
|
|
11459
11459
|
const currentLte = computed(() => {
|
|
11460
|
-
return typeof currentFilters.value.
|
|
11460
|
+
return typeof currentFilters.value.lte === "string" ? parseFloat(currentFilters.value.lte) : currentFilters.value.lte;
|
|
11461
11461
|
});
|
|
11462
11462
|
const currentMinValue = computed(() => {
|
|
11463
11463
|
return currentGte.value ? Math.max(currentGte.value, facetMin.value) : facetMin.value;
|
|
@@ -12004,8 +12004,10 @@ const _sfc_main$M = /* @__PURE__ */ defineComponent({
|
|
|
12004
12004
|
const props = __props;
|
|
12005
12005
|
const paramStore = useParamsStore();
|
|
12006
12006
|
const searchResultStore = useSearchResultStore();
|
|
12007
|
+
const optionsStore = useOptionsStore();
|
|
12007
12008
|
const { filters } = storeToRefs(paramStore);
|
|
12008
12009
|
const { facets } = storeToRefs(searchResultStore);
|
|
12010
|
+
const { searchResultOptions } = storeToRefs(optionsStore);
|
|
12009
12011
|
computed(() => {
|
|
12010
12012
|
var _a;
|
|
12011
12013
|
return (_a = facets.value) == null ? void 0 : _a.filter((f2) => {
|
|
@@ -12020,6 +12022,14 @@ const _sfc_main$M = /* @__PURE__ */ defineComponent({
|
|
|
12020
12022
|
return !((_a2 = props.options.promotedFacets) == null ? void 0 : _a2.includes(f2.key));
|
|
12021
12023
|
});
|
|
12022
12024
|
});
|
|
12025
|
+
const scrollToResultsOptions = computed(() => {
|
|
12026
|
+
var _a, _b, _c, _d, _e, _f;
|
|
12027
|
+
return {
|
|
12028
|
+
enabled: ((_a = searchResultOptions.value.scrollToResults) == null ? void 0 : _a.enabled) === void 0 ? true : (_b = searchResultOptions.value.scrollToResults) == null ? void 0 : _b.enabled,
|
|
12029
|
+
container: (_d = (_c = searchResultOptions.value.scrollToResults) == null ? void 0 : _c.scrollToContainerSelector) != null ? _d : RESULT_ROOT_SELECTOR,
|
|
12030
|
+
timeout: (_f = (_e = searchResultOptions.value.scrollToResults) == null ? void 0 : _e.timeout) != null ? _f : 500
|
|
12031
|
+
};
|
|
12032
|
+
});
|
|
12023
12033
|
const handleFacetSelect = (facetAction) => {
|
|
12024
12034
|
switch (facetAction.type) {
|
|
12025
12035
|
case "terms":
|
|
@@ -12032,7 +12042,12 @@ const _sfc_main$M = /* @__PURE__ */ defineComponent({
|
|
|
12032
12042
|
toggleHierarchyFilter(paramStore.appendParams, facetAction, filters.value);
|
|
12033
12043
|
break;
|
|
12034
12044
|
}
|
|
12035
|
-
|
|
12045
|
+
if (scrollToResultsOptions.value.enabled) {
|
|
12046
|
+
scrollToSearchResults(
|
|
12047
|
+
scrollToResultsOptions.value.timeout,
|
|
12048
|
+
scrollToResultsOptions.value.container
|
|
12049
|
+
);
|
|
12050
|
+
}
|
|
12036
12051
|
};
|
|
12037
12052
|
const clear2 = (facet) => {
|
|
12038
12053
|
const param = getFacetKey(facet.key, facet.type);
|
|
@@ -12344,7 +12359,9 @@ const _sfc_main$F = /* @__PURE__ */ defineComponent({
|
|
|
12344
12359
|
});
|
|
12345
12360
|
const paramStore = useParamsStore();
|
|
12346
12361
|
const screenStore = useScreenStore();
|
|
12362
|
+
const optionsStore = useOptionsStore();
|
|
12347
12363
|
const { isMobileWidth } = storeToRefs(screenStore);
|
|
12364
|
+
const { searchResultOptions } = storeToRefs(optionsStore);
|
|
12348
12365
|
const pageOptionsCount = computed(() => {
|
|
12349
12366
|
return isMobileWidth.value ? props.options.displayMobile : props.options.display;
|
|
12350
12367
|
});
|
|
@@ -12378,12 +12395,25 @@ const _sfc_main$F = /* @__PURE__ */ defineComponent({
|
|
|
12378
12395
|
const showPagination = computed(() => {
|
|
12379
12396
|
return pages.value.length > 1;
|
|
12380
12397
|
});
|
|
12398
|
+
const scrollToResultsOptions = computed(() => {
|
|
12399
|
+
var _a, _b, _c, _d, _e, _f;
|
|
12400
|
+
return {
|
|
12401
|
+
enabled: ((_a = searchResultOptions.value.scrollToResults) == null ? void 0 : _a.enabled) === void 0 ? true : (_b = searchResultOptions.value.scrollToResults) == null ? void 0 : _b.enabled,
|
|
12402
|
+
container: (_d = (_c = searchResultOptions.value.scrollToResults) == null ? void 0 : _c.scrollToContainerSelector) != null ? _d : RESULT_ROOT_SELECTOR,
|
|
12403
|
+
timeout: (_f = (_e = searchResultOptions.value.scrollToResults) == null ? void 0 : _e.timeout) != null ? _f : 500
|
|
12404
|
+
};
|
|
12405
|
+
});
|
|
12381
12406
|
const handlePageChange = (page) => {
|
|
12382
12407
|
if (page > 0) {
|
|
12383
12408
|
paramStore.appendParams({
|
|
12384
12409
|
params: [{ name: QUERY_PARAMS$1.PAGE, value: page.toString() }]
|
|
12385
12410
|
});
|
|
12386
|
-
|
|
12411
|
+
if (scrollToResultsOptions.value.enabled) {
|
|
12412
|
+
scrollToSearchResults(
|
|
12413
|
+
scrollToResultsOptions.value.timeout,
|
|
12414
|
+
scrollToResultsOptions.value.container
|
|
12415
|
+
);
|
|
12416
|
+
}
|
|
12387
12417
|
}
|
|
12388
12418
|
};
|
|
12389
12419
|
return (_ctx, _cache) => {
|
package/dist/lupaSearch.mjs
CHANGED
|
@@ -6164,6 +6164,7 @@ const DEFAULT_PAGE_SIZE = 12;
|
|
|
6164
6164
|
const DEFAULT_PAGE_SIZE_SELECTION = [12, 24, 36, 60];
|
|
6165
6165
|
const LUPA_ROUTING_EVENT = "lupaRedirect";
|
|
6166
6166
|
const RATING_STAR_HTML = "☆";
|
|
6167
|
+
const RESULT_ROOT_SELECTOR = "#lupa-search-results";
|
|
6167
6168
|
const production = "https://api.lupasearch.com/v1/";
|
|
6168
6169
|
const staging = "https://api.staging.lupasearch.com/v1/";
|
|
6169
6170
|
const Env$1 = {
|
|
@@ -7148,7 +7149,7 @@ const parseFacetKey = (key, searchParams) => {
|
|
|
7148
7149
|
const [min, max] = range.split(FACET_RANGE_SEPARATOR);
|
|
7149
7150
|
return {
|
|
7150
7151
|
gte: min,
|
|
7151
|
-
|
|
7152
|
+
lte: max
|
|
7152
7153
|
};
|
|
7153
7154
|
}
|
|
7154
7155
|
if (key.startsWith(FACET_PARAMS_TYPE.HIERARCHY)) {
|
|
@@ -8618,22 +8619,21 @@ var ResultsLayoutEnum = /* @__PURE__ */ ((ResultsLayoutEnum2) => {
|
|
|
8618
8619
|
ResultsLayoutEnum2["LIST"] = "List";
|
|
8619
8620
|
return ResultsLayoutEnum2;
|
|
8620
8621
|
})(ResultsLayoutEnum || {});
|
|
8621
|
-
const RESULT_ROOT_ID = "lupa-search-results";
|
|
8622
8622
|
const SHADOW_ROOT_ID = "lupa-shadow-id";
|
|
8623
8623
|
const CONTAINER_ROOT_ID = "lupa-search-container";
|
|
8624
|
-
const scrollToSearchResults = (timeout = 500) => {
|
|
8624
|
+
const scrollToSearchResults = (timeout = 500, containerSelector) => {
|
|
8625
8625
|
if (timeout) {
|
|
8626
|
-
setTimeout(() => scrollTo(
|
|
8626
|
+
setTimeout(() => scrollTo(containerSelector != null ? containerSelector : RESULT_ROOT_SELECTOR), timeout);
|
|
8627
8627
|
} else {
|
|
8628
|
-
scrollTo(
|
|
8628
|
+
scrollTo(RESULT_ROOT_SELECTOR);
|
|
8629
8629
|
}
|
|
8630
8630
|
};
|
|
8631
|
-
const scrollTo = (
|
|
8631
|
+
const scrollTo = (elementSelector) => {
|
|
8632
8632
|
var _a, _b;
|
|
8633
|
-
let el = document.
|
|
8633
|
+
let el = document.querySelector(elementSelector);
|
|
8634
8634
|
const shadowRoot = (_a = document.getElementById(SHADOW_ROOT_ID)) == null ? void 0 : _a.shadowRoot;
|
|
8635
8635
|
if (!el) {
|
|
8636
|
-
el = (_b = shadowRoot == null ? void 0 : shadowRoot.getElementById(
|
|
8636
|
+
el = (_b = shadowRoot == null ? void 0 : shadowRoot.getElementById(elementSelector)) != null ? _b : null;
|
|
8637
8637
|
}
|
|
8638
8638
|
if (!el) {
|
|
8639
8639
|
return;
|
|
@@ -11455,7 +11455,7 @@ const _sfc_main$R = /* @__PURE__ */ defineComponent({
|
|
|
11455
11455
|
return typeof currentFilters.value.gte === "string" ? parseFloat(currentFilters.value.gte) : currentFilters.value.gte;
|
|
11456
11456
|
});
|
|
11457
11457
|
const currentLte = computed(() => {
|
|
11458
|
-
return typeof currentFilters.value.
|
|
11458
|
+
return typeof currentFilters.value.lte === "string" ? parseFloat(currentFilters.value.lte) : currentFilters.value.lte;
|
|
11459
11459
|
});
|
|
11460
11460
|
const currentMinValue = computed(() => {
|
|
11461
11461
|
return currentGte.value ? Math.max(currentGte.value, facetMin.value) : facetMin.value;
|
|
@@ -12002,8 +12002,10 @@ const _sfc_main$M = /* @__PURE__ */ defineComponent({
|
|
|
12002
12002
|
const props = __props;
|
|
12003
12003
|
const paramStore = useParamsStore();
|
|
12004
12004
|
const searchResultStore = useSearchResultStore();
|
|
12005
|
+
const optionsStore = useOptionsStore();
|
|
12005
12006
|
const { filters } = storeToRefs(paramStore);
|
|
12006
12007
|
const { facets } = storeToRefs(searchResultStore);
|
|
12008
|
+
const { searchResultOptions } = storeToRefs(optionsStore);
|
|
12007
12009
|
computed(() => {
|
|
12008
12010
|
var _a;
|
|
12009
12011
|
return (_a = facets.value) == null ? void 0 : _a.filter((f2) => {
|
|
@@ -12018,6 +12020,14 @@ const _sfc_main$M = /* @__PURE__ */ defineComponent({
|
|
|
12018
12020
|
return !((_a2 = props.options.promotedFacets) == null ? void 0 : _a2.includes(f2.key));
|
|
12019
12021
|
});
|
|
12020
12022
|
});
|
|
12023
|
+
const scrollToResultsOptions = computed(() => {
|
|
12024
|
+
var _a, _b, _c, _d, _e, _f;
|
|
12025
|
+
return {
|
|
12026
|
+
enabled: ((_a = searchResultOptions.value.scrollToResults) == null ? void 0 : _a.enabled) === void 0 ? true : (_b = searchResultOptions.value.scrollToResults) == null ? void 0 : _b.enabled,
|
|
12027
|
+
container: (_d = (_c = searchResultOptions.value.scrollToResults) == null ? void 0 : _c.scrollToContainerSelector) != null ? _d : RESULT_ROOT_SELECTOR,
|
|
12028
|
+
timeout: (_f = (_e = searchResultOptions.value.scrollToResults) == null ? void 0 : _e.timeout) != null ? _f : 500
|
|
12029
|
+
};
|
|
12030
|
+
});
|
|
12021
12031
|
const handleFacetSelect = (facetAction) => {
|
|
12022
12032
|
switch (facetAction.type) {
|
|
12023
12033
|
case "terms":
|
|
@@ -12030,7 +12040,12 @@ const _sfc_main$M = /* @__PURE__ */ defineComponent({
|
|
|
12030
12040
|
toggleHierarchyFilter(paramStore.appendParams, facetAction, filters.value);
|
|
12031
12041
|
break;
|
|
12032
12042
|
}
|
|
12033
|
-
|
|
12043
|
+
if (scrollToResultsOptions.value.enabled) {
|
|
12044
|
+
scrollToSearchResults(
|
|
12045
|
+
scrollToResultsOptions.value.timeout,
|
|
12046
|
+
scrollToResultsOptions.value.container
|
|
12047
|
+
);
|
|
12048
|
+
}
|
|
12034
12049
|
};
|
|
12035
12050
|
const clear2 = (facet) => {
|
|
12036
12051
|
const param = getFacetKey(facet.key, facet.type);
|
|
@@ -12342,7 +12357,9 @@ const _sfc_main$F = /* @__PURE__ */ defineComponent({
|
|
|
12342
12357
|
});
|
|
12343
12358
|
const paramStore = useParamsStore();
|
|
12344
12359
|
const screenStore = useScreenStore();
|
|
12360
|
+
const optionsStore = useOptionsStore();
|
|
12345
12361
|
const { isMobileWidth } = storeToRefs(screenStore);
|
|
12362
|
+
const { searchResultOptions } = storeToRefs(optionsStore);
|
|
12346
12363
|
const pageOptionsCount = computed(() => {
|
|
12347
12364
|
return isMobileWidth.value ? props.options.displayMobile : props.options.display;
|
|
12348
12365
|
});
|
|
@@ -12376,12 +12393,25 @@ const _sfc_main$F = /* @__PURE__ */ defineComponent({
|
|
|
12376
12393
|
const showPagination = computed(() => {
|
|
12377
12394
|
return pages.value.length > 1;
|
|
12378
12395
|
});
|
|
12396
|
+
const scrollToResultsOptions = computed(() => {
|
|
12397
|
+
var _a, _b, _c, _d, _e, _f;
|
|
12398
|
+
return {
|
|
12399
|
+
enabled: ((_a = searchResultOptions.value.scrollToResults) == null ? void 0 : _a.enabled) === void 0 ? true : (_b = searchResultOptions.value.scrollToResults) == null ? void 0 : _b.enabled,
|
|
12400
|
+
container: (_d = (_c = searchResultOptions.value.scrollToResults) == null ? void 0 : _c.scrollToContainerSelector) != null ? _d : RESULT_ROOT_SELECTOR,
|
|
12401
|
+
timeout: (_f = (_e = searchResultOptions.value.scrollToResults) == null ? void 0 : _e.timeout) != null ? _f : 500
|
|
12402
|
+
};
|
|
12403
|
+
});
|
|
12379
12404
|
const handlePageChange = (page) => {
|
|
12380
12405
|
if (page > 0) {
|
|
12381
12406
|
paramStore.appendParams({
|
|
12382
12407
|
params: [{ name: QUERY_PARAMS$1.PAGE, value: page.toString() }]
|
|
12383
12408
|
});
|
|
12384
|
-
|
|
12409
|
+
if (scrollToResultsOptions.value.enabled) {
|
|
12410
|
+
scrollToSearchResults(
|
|
12411
|
+
scrollToResultsOptions.value.timeout,
|
|
12412
|
+
scrollToResultsOptions.value.container
|
|
12413
|
+
);
|
|
12414
|
+
}
|
|
12385
12415
|
}
|
|
12386
12416
|
};
|
|
12387
12417
|
return (_ctx, _cache) => {
|
package/dist/lupaSearch.umd.js
CHANGED
|
@@ -6168,6 +6168,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
6168
6168
|
const DEFAULT_PAGE_SIZE_SELECTION = [12, 24, 36, 60];
|
|
6169
6169
|
const LUPA_ROUTING_EVENT = "lupaRedirect";
|
|
6170
6170
|
const RATING_STAR_HTML = "☆";
|
|
6171
|
+
const RESULT_ROOT_SELECTOR = "#lupa-search-results";
|
|
6171
6172
|
const production = "https://api.lupasearch.com/v1/";
|
|
6172
6173
|
const staging = "https://api.staging.lupasearch.com/v1/";
|
|
6173
6174
|
const Env$1 = {
|
|
@@ -7152,7 +7153,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
7152
7153
|
const [min, max] = range.split(FACET_RANGE_SEPARATOR);
|
|
7153
7154
|
return {
|
|
7154
7155
|
gte: min,
|
|
7155
|
-
|
|
7156
|
+
lte: max
|
|
7156
7157
|
};
|
|
7157
7158
|
}
|
|
7158
7159
|
if (key.startsWith(FACET_PARAMS_TYPE.HIERARCHY)) {
|
|
@@ -8622,22 +8623,21 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
8622
8623
|
ResultsLayoutEnum2["LIST"] = "List";
|
|
8623
8624
|
return ResultsLayoutEnum2;
|
|
8624
8625
|
})(ResultsLayoutEnum || {});
|
|
8625
|
-
const RESULT_ROOT_ID = "lupa-search-results";
|
|
8626
8626
|
const SHADOW_ROOT_ID = "lupa-shadow-id";
|
|
8627
8627
|
const CONTAINER_ROOT_ID = "lupa-search-container";
|
|
8628
|
-
const scrollToSearchResults = (timeout = 500) => {
|
|
8628
|
+
const scrollToSearchResults = (timeout = 500, containerSelector) => {
|
|
8629
8629
|
if (timeout) {
|
|
8630
|
-
setTimeout(() => scrollTo(
|
|
8630
|
+
setTimeout(() => scrollTo(containerSelector != null ? containerSelector : RESULT_ROOT_SELECTOR), timeout);
|
|
8631
8631
|
} else {
|
|
8632
|
-
scrollTo(
|
|
8632
|
+
scrollTo(RESULT_ROOT_SELECTOR);
|
|
8633
8633
|
}
|
|
8634
8634
|
};
|
|
8635
|
-
const scrollTo = (
|
|
8635
|
+
const scrollTo = (elementSelector) => {
|
|
8636
8636
|
var _a, _b;
|
|
8637
|
-
let el = document.
|
|
8637
|
+
let el = document.querySelector(elementSelector);
|
|
8638
8638
|
const shadowRoot = (_a = document.getElementById(SHADOW_ROOT_ID)) == null ? void 0 : _a.shadowRoot;
|
|
8639
8639
|
if (!el) {
|
|
8640
|
-
el = (_b = shadowRoot == null ? void 0 : shadowRoot.getElementById(
|
|
8640
|
+
el = (_b = shadowRoot == null ? void 0 : shadowRoot.getElementById(elementSelector)) != null ? _b : null;
|
|
8641
8641
|
}
|
|
8642
8642
|
if (!el) {
|
|
8643
8643
|
return;
|
|
@@ -11459,7 +11459,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
11459
11459
|
return typeof currentFilters.value.gte === "string" ? parseFloat(currentFilters.value.gte) : currentFilters.value.gte;
|
|
11460
11460
|
});
|
|
11461
11461
|
const currentLte = computed(() => {
|
|
11462
|
-
return typeof currentFilters.value.
|
|
11462
|
+
return typeof currentFilters.value.lte === "string" ? parseFloat(currentFilters.value.lte) : currentFilters.value.lte;
|
|
11463
11463
|
});
|
|
11464
11464
|
const currentMinValue = computed(() => {
|
|
11465
11465
|
return currentGte.value ? Math.max(currentGte.value, facetMin.value) : facetMin.value;
|
|
@@ -12006,8 +12006,10 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
12006
12006
|
const props = __props;
|
|
12007
12007
|
const paramStore = useParamsStore();
|
|
12008
12008
|
const searchResultStore = useSearchResultStore();
|
|
12009
|
+
const optionsStore = useOptionsStore();
|
|
12009
12010
|
const { filters } = storeToRefs(paramStore);
|
|
12010
12011
|
const { facets } = storeToRefs(searchResultStore);
|
|
12012
|
+
const { searchResultOptions } = storeToRefs(optionsStore);
|
|
12011
12013
|
computed(() => {
|
|
12012
12014
|
var _a;
|
|
12013
12015
|
return (_a = facets.value) == null ? void 0 : _a.filter((f2) => {
|
|
@@ -12022,6 +12024,14 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
12022
12024
|
return !((_a2 = props.options.promotedFacets) == null ? void 0 : _a2.includes(f2.key));
|
|
12023
12025
|
});
|
|
12024
12026
|
});
|
|
12027
|
+
const scrollToResultsOptions = computed(() => {
|
|
12028
|
+
var _a, _b, _c, _d, _e, _f;
|
|
12029
|
+
return {
|
|
12030
|
+
enabled: ((_a = searchResultOptions.value.scrollToResults) == null ? void 0 : _a.enabled) === void 0 ? true : (_b = searchResultOptions.value.scrollToResults) == null ? void 0 : _b.enabled,
|
|
12031
|
+
container: (_d = (_c = searchResultOptions.value.scrollToResults) == null ? void 0 : _c.scrollToContainerSelector) != null ? _d : RESULT_ROOT_SELECTOR,
|
|
12032
|
+
timeout: (_f = (_e = searchResultOptions.value.scrollToResults) == null ? void 0 : _e.timeout) != null ? _f : 500
|
|
12033
|
+
};
|
|
12034
|
+
});
|
|
12025
12035
|
const handleFacetSelect = (facetAction) => {
|
|
12026
12036
|
switch (facetAction.type) {
|
|
12027
12037
|
case "terms":
|
|
@@ -12034,7 +12044,12 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
12034
12044
|
toggleHierarchyFilter(paramStore.appendParams, facetAction, filters.value);
|
|
12035
12045
|
break;
|
|
12036
12046
|
}
|
|
12037
|
-
|
|
12047
|
+
if (scrollToResultsOptions.value.enabled) {
|
|
12048
|
+
scrollToSearchResults(
|
|
12049
|
+
scrollToResultsOptions.value.timeout,
|
|
12050
|
+
scrollToResultsOptions.value.container
|
|
12051
|
+
);
|
|
12052
|
+
}
|
|
12038
12053
|
};
|
|
12039
12054
|
const clear2 = (facet) => {
|
|
12040
12055
|
const param = getFacetKey(facet.key, facet.type);
|
|
@@ -12346,7 +12361,9 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
12346
12361
|
});
|
|
12347
12362
|
const paramStore = useParamsStore();
|
|
12348
12363
|
const screenStore = useScreenStore();
|
|
12364
|
+
const optionsStore = useOptionsStore();
|
|
12349
12365
|
const { isMobileWidth } = storeToRefs(screenStore);
|
|
12366
|
+
const { searchResultOptions } = storeToRefs(optionsStore);
|
|
12350
12367
|
const pageOptionsCount = computed(() => {
|
|
12351
12368
|
return isMobileWidth.value ? props.options.displayMobile : props.options.display;
|
|
12352
12369
|
});
|
|
@@ -12380,12 +12397,25 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
12380
12397
|
const showPagination = computed(() => {
|
|
12381
12398
|
return pages.value.length > 1;
|
|
12382
12399
|
});
|
|
12400
|
+
const scrollToResultsOptions = computed(() => {
|
|
12401
|
+
var _a, _b, _c, _d, _e, _f;
|
|
12402
|
+
return {
|
|
12403
|
+
enabled: ((_a = searchResultOptions.value.scrollToResults) == null ? void 0 : _a.enabled) === void 0 ? true : (_b = searchResultOptions.value.scrollToResults) == null ? void 0 : _b.enabled,
|
|
12404
|
+
container: (_d = (_c = searchResultOptions.value.scrollToResults) == null ? void 0 : _c.scrollToContainerSelector) != null ? _d : RESULT_ROOT_SELECTOR,
|
|
12405
|
+
timeout: (_f = (_e = searchResultOptions.value.scrollToResults) == null ? void 0 : _e.timeout) != null ? _f : 500
|
|
12406
|
+
};
|
|
12407
|
+
});
|
|
12383
12408
|
const handlePageChange = (page) => {
|
|
12384
12409
|
if (page > 0) {
|
|
12385
12410
|
paramStore.appendParams({
|
|
12386
12411
|
params: [{ name: QUERY_PARAMS$1.PAGE, value: page.toString() }]
|
|
12387
12412
|
});
|
|
12388
|
-
|
|
12413
|
+
if (scrollToResultsOptions.value.enabled) {
|
|
12414
|
+
scrollToSearchResults(
|
|
12415
|
+
scrollToResultsOptions.value.timeout,
|
|
12416
|
+
scrollToResultsOptions.value.container
|
|
12417
|
+
);
|
|
12418
|
+
}
|
|
12389
12419
|
}
|
|
12390
12420
|
};
|
|
12391
12421
|
return (_ctx, _cache) => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@getlupa/client",
|
|
3
|
-
"version": "1.8.
|
|
3
|
+
"version": "1.8.3",
|
|
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.8.
|
|
23
|
+
"@getlupa/vue": "0.8.3",
|
|
24
24
|
"@rushstack/eslint-patch": "^1.3.2",
|
|
25
25
|
"@tsconfig/node18": "^2.0.1",
|
|
26
26
|
"@types/jsdom": "^21.1.1",
|