@getlupa/client 1.22.1 → 1.22.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.
@@ -31744,6 +31744,7 @@ and ensure you are accounting for this risk.
31744
31744
  const searchBoxStore = useSearchBoxStore();
31745
31745
  const { suggestionResults, hasAnyResults, panelItemCounts } = storeToRefs(searchBoxStore);
31746
31746
  const emit2 = __emit;
31747
+ const isSearchEmpty = computed(() => !props.inputValue || props.inputValue.length < 1);
31747
31748
  const displayResults = computed(() => {
31748
31749
  var _a25;
31749
31750
  return ((_a25 = props.inputValue) == null ? void 0 : _a25.length) >= props.options.minInputLength;
@@ -31754,6 +31755,12 @@ and ensure you are accounting for this risk.
31754
31755
  return Boolean(props.options.history) && ((_a25 = props.inputValue) == null ? void 0 : _a25.length) < 1 && props.options.minInputLength > 0;
31755
31756
  }
31756
31757
  );
31758
+ const displayShowMoreResultsButton = computed(() => {
31759
+ if (isSearchEmpty.value && props.options.hideMoreResultsButtonOnEmptyQuery) {
31760
+ return false;
31761
+ }
31762
+ return hasAnyResults.value || !props.options.hideMoreResultsButtonOnNoResults;
31763
+ });
31757
31764
  const displayPanels = computed(
31758
31765
  () => props.isSearchContainer ? panels.value.filter((p2) => p2.type === SearchBoxPanelType.SUGGESTION) : panels.value
31759
31766
  );
@@ -31923,7 +31930,7 @@ and ensure you are accounting for this risk.
31923
31930
  key: 1,
31924
31931
  labels: labels.value
31925
31932
  }, null, 8, ["labels"])) : createCommentVNode("", true),
31926
- unref(hasAnyResults) || !_ctx.options.hideMoreResultsButtonOnNoResults ? (openBlock(), createBlock(_sfc_main$1x, {
31933
+ displayShowMoreResultsButton.value ? (openBlock(), createBlock(_sfc_main$1x, {
31927
31934
  key: 2,
31928
31935
  labels: labels.value,
31929
31936
  options: _ctx.options,
@@ -32007,6 +32014,7 @@ and ensure you are accounting for this risk.
32007
32014
  "debounce",
32008
32015
  "showTotalCount",
32009
32016
  "hideMoreResultsButtonOnNoResults",
32017
+ "hideMoreResultsButtonOnEmptyQuery",
32010
32018
  "showNoResultsPanel",
32011
32019
  "expandOnSinglePanel",
32012
32020
  "showMoreResultsButton"
@@ -33954,6 +33962,18 @@ and ensure you are accounting for this risk.
33954
33962
  m.render = function(e2, t, r, i, n, o) {
33955
33963
  return openBlock(), createElementBlock("div", mergeProps(e2.sliderProps, { ref: "slider" }), null, 16);
33956
33964
  }, m.__file = "src/Slider.vue";
33965
+ const roundToMaxDecimals = (value, maxPrecision = 0.1) => {
33966
+ if (value === void 0 || value === null || Number.isNaN(value)) return "";
33967
+ const log = Math.log10(maxPrecision);
33968
+ const decimals = log < 0 ? Math.round(-log) : 0;
33969
+ const factor = Math.pow(10, decimals);
33970
+ const rounded = Math.round((value + Number.EPSILON) * factor) / factor;
33971
+ let out = rounded.toFixed(decimals);
33972
+ if (Number.isInteger(value)) {
33973
+ out = Math.trunc(value).toString();
33974
+ }
33975
+ return out;
33976
+ };
33957
33977
  const _hoisted_1$P = { class: "lupa-search-result-facet-stats-values" };
33958
33978
  const _hoisted_2$B = {
33959
33979
  key: 0,
@@ -34102,7 +34122,7 @@ and ensure you are accounting for this risk.
34102
34122
  const originalSliderRange = computed(() => {
34103
34123
  return innerSliderRange.value.length === 2 && (currentFilters.value.gte || currentFilters.value.lte) ? [
34104
34124
  Math.max(+currentFilters.value.gte, facetValue.value.min),
34105
- Math.min(+currentFilters.value.lte, facetValue.value.max)
34125
+ Math.min(+(currentFilters.value.lt || currentFilters.value.lte), facetValue.value.max)
34106
34126
  ] : [facetValue.value.min, facetValue.value.max];
34107
34127
  });
34108
34128
  const fromValue = computed({
@@ -34158,6 +34178,7 @@ and ensure you are accounting for this risk.
34158
34178
  }
34159
34179
  );
34160
34180
  const statsSummary = computed(() => {
34181
+ var _a25, _b25;
34161
34182
  const [min, max] = originalSliderRange.value;
34162
34183
  if (isPrice.value) {
34163
34184
  return formatPriceSummary(
@@ -34168,10 +34189,12 @@ and ensure you are accounting for this risk.
34168
34189
  multiCurrency.value
34169
34190
  );
34170
34191
  }
34192
+ const minValue = roundToMaxDecimals(min, (_a25 = customInterval.value) != null ? _a25 : 0.1);
34193
+ const maxValue = roundToMaxDecimals(max, (_b25 = customInterval.value) != null ? _b25 : 0.1);
34171
34194
  if (unit.value) {
34172
- return `${min} ${unit.value} – ${max} ${unit.value}`;
34195
+ return `${minValue} ${unit.value} – ${maxValue} ${unit.value}`;
34173
34196
  }
34174
- return formatRange({ gte: min, lte: max });
34197
+ return formatRange({ gte: minValue, lte: maxValue });
34175
34198
  });
34176
34199
  function handleInputChange() {
34177
34200
  if (innerSliderRange.value.length < 2) return;
@@ -31744,6 +31744,7 @@ const _sfc_main$14 = /* @__PURE__ */ defineComponent(__spreadProps2(__spreadValu
31744
31744
  const searchBoxStore = useSearchBoxStore();
31745
31745
  const { suggestionResults, hasAnyResults, panelItemCounts } = storeToRefs(searchBoxStore);
31746
31746
  const emit2 = __emit;
31747
+ const isSearchEmpty = computed(() => !props.inputValue || props.inputValue.length < 1);
31747
31748
  const displayResults = computed(() => {
31748
31749
  var _a25;
31749
31750
  return ((_a25 = props.inputValue) == null ? void 0 : _a25.length) >= props.options.minInputLength;
@@ -31754,6 +31755,12 @@ const _sfc_main$14 = /* @__PURE__ */ defineComponent(__spreadProps2(__spreadValu
31754
31755
  return Boolean(props.options.history) && ((_a25 = props.inputValue) == null ? void 0 : _a25.length) < 1 && props.options.minInputLength > 0;
31755
31756
  }
31756
31757
  );
31758
+ const displayShowMoreResultsButton = computed(() => {
31759
+ if (isSearchEmpty.value && props.options.hideMoreResultsButtonOnEmptyQuery) {
31760
+ return false;
31761
+ }
31762
+ return hasAnyResults.value || !props.options.hideMoreResultsButtonOnNoResults;
31763
+ });
31757
31764
  const displayPanels = computed(
31758
31765
  () => props.isSearchContainer ? panels.value.filter((p2) => p2.type === SearchBoxPanelType.SUGGESTION) : panels.value
31759
31766
  );
@@ -31923,7 +31930,7 @@ const _sfc_main$14 = /* @__PURE__ */ defineComponent(__spreadProps2(__spreadValu
31923
31930
  key: 1,
31924
31931
  labels: labels.value
31925
31932
  }, null, 8, ["labels"])) : createCommentVNode("", true),
31926
- unref(hasAnyResults) || !_ctx.options.hideMoreResultsButtonOnNoResults ? (openBlock(), createBlock(_sfc_main$1x, {
31933
+ displayShowMoreResultsButton.value ? (openBlock(), createBlock(_sfc_main$1x, {
31927
31934
  key: 2,
31928
31935
  labels: labels.value,
31929
31936
  options: _ctx.options,
@@ -32007,6 +32014,7 @@ const _sfc_main$13 = /* @__PURE__ */ defineComponent({
32007
32014
  "debounce",
32008
32015
  "showTotalCount",
32009
32016
  "hideMoreResultsButtonOnNoResults",
32017
+ "hideMoreResultsButtonOnEmptyQuery",
32010
32018
  "showNoResultsPanel",
32011
32019
  "expandOnSinglePanel",
32012
32020
  "showMoreResultsButton"
@@ -33954,6 +33962,18 @@ var m = { name: "Slider", emits: ["input", "update:modelValue", "start", "slide"
33954
33962
  m.render = function(e2, t, r, i, n, o) {
33955
33963
  return openBlock(), createElementBlock("div", mergeProps(e2.sliderProps, { ref: "slider" }), null, 16);
33956
33964
  }, m.__file = "src/Slider.vue";
33965
+ const roundToMaxDecimals = (value, maxPrecision = 0.1) => {
33966
+ if (value === void 0 || value === null || Number.isNaN(value)) return "";
33967
+ const log = Math.log10(maxPrecision);
33968
+ const decimals = log < 0 ? Math.round(-log) : 0;
33969
+ const factor = Math.pow(10, decimals);
33970
+ const rounded = Math.round((value + Number.EPSILON) * factor) / factor;
33971
+ let out = rounded.toFixed(decimals);
33972
+ if (Number.isInteger(value)) {
33973
+ out = Math.trunc(value).toString();
33974
+ }
33975
+ return out;
33976
+ };
33957
33977
  const _hoisted_1$P = { class: "lupa-search-result-facet-stats-values" };
33958
33978
  const _hoisted_2$B = {
33959
33979
  key: 0,
@@ -34102,7 +34122,7 @@ const _sfc_main$W = /* @__PURE__ */ defineComponent({
34102
34122
  const originalSliderRange = computed(() => {
34103
34123
  return innerSliderRange.value.length === 2 && (currentFilters.value.gte || currentFilters.value.lte) ? [
34104
34124
  Math.max(+currentFilters.value.gte, facetValue.value.min),
34105
- Math.min(+currentFilters.value.lte, facetValue.value.max)
34125
+ Math.min(+(currentFilters.value.lt || currentFilters.value.lte), facetValue.value.max)
34106
34126
  ] : [facetValue.value.min, facetValue.value.max];
34107
34127
  });
34108
34128
  const fromValue = computed({
@@ -34158,6 +34178,7 @@ const _sfc_main$W = /* @__PURE__ */ defineComponent({
34158
34178
  }
34159
34179
  );
34160
34180
  const statsSummary = computed(() => {
34181
+ var _a25, _b25;
34161
34182
  const [min, max] = originalSliderRange.value;
34162
34183
  if (isPrice.value) {
34163
34184
  return formatPriceSummary(
@@ -34168,10 +34189,12 @@ const _sfc_main$W = /* @__PURE__ */ defineComponent({
34168
34189
  multiCurrency.value
34169
34190
  );
34170
34191
  }
34192
+ const minValue = roundToMaxDecimals(min, (_a25 = customInterval.value) != null ? _a25 : 0.1);
34193
+ const maxValue = roundToMaxDecimals(max, (_b25 = customInterval.value) != null ? _b25 : 0.1);
34171
34194
  if (unit.value) {
34172
- return `${min} ${unit.value} – ${max} ${unit.value}`;
34195
+ return `${minValue} ${unit.value} – ${maxValue} ${unit.value}`;
34173
34196
  }
34174
- return formatRange({ gte: min, lte: max });
34197
+ return formatRange({ gte: minValue, lte: maxValue });
34175
34198
  });
34176
34199
  function handleInputChange() {
34177
34200
  if (innerSliderRange.value.length < 2) return;
@@ -31742,6 +31742,7 @@ const _sfc_main$14 = /* @__PURE__ */ defineComponent(__spreadProps2(__spreadValu
31742
31742
  const searchBoxStore = useSearchBoxStore();
31743
31743
  const { suggestionResults, hasAnyResults, panelItemCounts } = storeToRefs(searchBoxStore);
31744
31744
  const emit2 = __emit;
31745
+ const isSearchEmpty = computed(() => !props.inputValue || props.inputValue.length < 1);
31745
31746
  const displayResults = computed(() => {
31746
31747
  var _a25;
31747
31748
  return ((_a25 = props.inputValue) == null ? void 0 : _a25.length) >= props.options.minInputLength;
@@ -31752,6 +31753,12 @@ const _sfc_main$14 = /* @__PURE__ */ defineComponent(__spreadProps2(__spreadValu
31752
31753
  return Boolean(props.options.history) && ((_a25 = props.inputValue) == null ? void 0 : _a25.length) < 1 && props.options.minInputLength > 0;
31753
31754
  }
31754
31755
  );
31756
+ const displayShowMoreResultsButton = computed(() => {
31757
+ if (isSearchEmpty.value && props.options.hideMoreResultsButtonOnEmptyQuery) {
31758
+ return false;
31759
+ }
31760
+ return hasAnyResults.value || !props.options.hideMoreResultsButtonOnNoResults;
31761
+ });
31755
31762
  const displayPanels = computed(
31756
31763
  () => props.isSearchContainer ? panels.value.filter((p2) => p2.type === SearchBoxPanelType.SUGGESTION) : panels.value
31757
31764
  );
@@ -31921,7 +31928,7 @@ const _sfc_main$14 = /* @__PURE__ */ defineComponent(__spreadProps2(__spreadValu
31921
31928
  key: 1,
31922
31929
  labels: labels.value
31923
31930
  }, null, 8, ["labels"])) : createCommentVNode("", true),
31924
- unref(hasAnyResults) || !_ctx.options.hideMoreResultsButtonOnNoResults ? (openBlock(), createBlock(_sfc_main$1x, {
31931
+ displayShowMoreResultsButton.value ? (openBlock(), createBlock(_sfc_main$1x, {
31925
31932
  key: 2,
31926
31933
  labels: labels.value,
31927
31934
  options: _ctx.options,
@@ -32005,6 +32012,7 @@ const _sfc_main$13 = /* @__PURE__ */ defineComponent({
32005
32012
  "debounce",
32006
32013
  "showTotalCount",
32007
32014
  "hideMoreResultsButtonOnNoResults",
32015
+ "hideMoreResultsButtonOnEmptyQuery",
32008
32016
  "showNoResultsPanel",
32009
32017
  "expandOnSinglePanel",
32010
32018
  "showMoreResultsButton"
@@ -33952,6 +33960,18 @@ var m = { name: "Slider", emits: ["input", "update:modelValue", "start", "slide"
33952
33960
  m.render = function(e2, t, r, i, n, o) {
33953
33961
  return openBlock(), createElementBlock("div", mergeProps(e2.sliderProps, { ref: "slider" }), null, 16);
33954
33962
  }, m.__file = "src/Slider.vue";
33963
+ const roundToMaxDecimals = (value, maxPrecision = 0.1) => {
33964
+ if (value === void 0 || value === null || Number.isNaN(value)) return "";
33965
+ const log = Math.log10(maxPrecision);
33966
+ const decimals = log < 0 ? Math.round(-log) : 0;
33967
+ const factor = Math.pow(10, decimals);
33968
+ const rounded = Math.round((value + Number.EPSILON) * factor) / factor;
33969
+ let out = rounded.toFixed(decimals);
33970
+ if (Number.isInteger(value)) {
33971
+ out = Math.trunc(value).toString();
33972
+ }
33973
+ return out;
33974
+ };
33955
33975
  const _hoisted_1$P = { class: "lupa-search-result-facet-stats-values" };
33956
33976
  const _hoisted_2$B = {
33957
33977
  key: 0,
@@ -34100,7 +34120,7 @@ const _sfc_main$W = /* @__PURE__ */ defineComponent({
34100
34120
  const originalSliderRange = computed(() => {
34101
34121
  return innerSliderRange.value.length === 2 && (currentFilters.value.gte || currentFilters.value.lte) ? [
34102
34122
  Math.max(+currentFilters.value.gte, facetValue.value.min),
34103
- Math.min(+currentFilters.value.lte, facetValue.value.max)
34123
+ Math.min(+(currentFilters.value.lt || currentFilters.value.lte), facetValue.value.max)
34104
34124
  ] : [facetValue.value.min, facetValue.value.max];
34105
34125
  });
34106
34126
  const fromValue = computed({
@@ -34156,6 +34176,7 @@ const _sfc_main$W = /* @__PURE__ */ defineComponent({
34156
34176
  }
34157
34177
  );
34158
34178
  const statsSummary = computed(() => {
34179
+ var _a25, _b25;
34159
34180
  const [min, max] = originalSliderRange.value;
34160
34181
  if (isPrice.value) {
34161
34182
  return formatPriceSummary(
@@ -34166,10 +34187,12 @@ const _sfc_main$W = /* @__PURE__ */ defineComponent({
34166
34187
  multiCurrency.value
34167
34188
  );
34168
34189
  }
34190
+ const minValue = roundToMaxDecimals(min, (_a25 = customInterval.value) != null ? _a25 : 0.1);
34191
+ const maxValue = roundToMaxDecimals(max, (_b25 = customInterval.value) != null ? _b25 : 0.1);
34169
34192
  if (unit.value) {
34170
- return `${min} ${unit.value} – ${max} ${unit.value}`;
34193
+ return `${minValue} ${unit.value} – ${maxValue} ${unit.value}`;
34171
34194
  }
34172
- return formatRange({ gte: min, lte: max });
34195
+ return formatRange({ gte: minValue, lte: maxValue });
34173
34196
  });
34174
34197
  function handleInputChange() {
34175
34198
  if (innerSliderRange.value.length < 2) return;
@@ -31746,6 +31746,7 @@ and ensure you are accounting for this risk.
31746
31746
  const searchBoxStore = useSearchBoxStore();
31747
31747
  const { suggestionResults, hasAnyResults, panelItemCounts } = storeToRefs(searchBoxStore);
31748
31748
  const emit2 = __emit;
31749
+ const isSearchEmpty = computed(() => !props.inputValue || props.inputValue.length < 1);
31749
31750
  const displayResults = computed(() => {
31750
31751
  var _a25;
31751
31752
  return ((_a25 = props.inputValue) == null ? void 0 : _a25.length) >= props.options.minInputLength;
@@ -31756,6 +31757,12 @@ and ensure you are accounting for this risk.
31756
31757
  return Boolean(props.options.history) && ((_a25 = props.inputValue) == null ? void 0 : _a25.length) < 1 && props.options.minInputLength > 0;
31757
31758
  }
31758
31759
  );
31760
+ const displayShowMoreResultsButton = computed(() => {
31761
+ if (isSearchEmpty.value && props.options.hideMoreResultsButtonOnEmptyQuery) {
31762
+ return false;
31763
+ }
31764
+ return hasAnyResults.value || !props.options.hideMoreResultsButtonOnNoResults;
31765
+ });
31759
31766
  const displayPanels = computed(
31760
31767
  () => props.isSearchContainer ? panels.value.filter((p2) => p2.type === SearchBoxPanelType.SUGGESTION) : panels.value
31761
31768
  );
@@ -31925,7 +31932,7 @@ and ensure you are accounting for this risk.
31925
31932
  key: 1,
31926
31933
  labels: labels.value
31927
31934
  }, null, 8, ["labels"])) : createCommentVNode("", true),
31928
- unref(hasAnyResults) || !_ctx.options.hideMoreResultsButtonOnNoResults ? (openBlock(), createBlock(_sfc_main$1x, {
31935
+ displayShowMoreResultsButton.value ? (openBlock(), createBlock(_sfc_main$1x, {
31929
31936
  key: 2,
31930
31937
  labels: labels.value,
31931
31938
  options: _ctx.options,
@@ -32009,6 +32016,7 @@ and ensure you are accounting for this risk.
32009
32016
  "debounce",
32010
32017
  "showTotalCount",
32011
32018
  "hideMoreResultsButtonOnNoResults",
32019
+ "hideMoreResultsButtonOnEmptyQuery",
32012
32020
  "showNoResultsPanel",
32013
32021
  "expandOnSinglePanel",
32014
32022
  "showMoreResultsButton"
@@ -33956,6 +33964,18 @@ and ensure you are accounting for this risk.
33956
33964
  m.render = function(e2, t, r, i, n, o) {
33957
33965
  return openBlock(), createElementBlock("div", mergeProps(e2.sliderProps, { ref: "slider" }), null, 16);
33958
33966
  }, m.__file = "src/Slider.vue";
33967
+ const roundToMaxDecimals = (value, maxPrecision = 0.1) => {
33968
+ if (value === void 0 || value === null || Number.isNaN(value)) return "";
33969
+ const log = Math.log10(maxPrecision);
33970
+ const decimals = log < 0 ? Math.round(-log) : 0;
33971
+ const factor = Math.pow(10, decimals);
33972
+ const rounded = Math.round((value + Number.EPSILON) * factor) / factor;
33973
+ let out = rounded.toFixed(decimals);
33974
+ if (Number.isInteger(value)) {
33975
+ out = Math.trunc(value).toString();
33976
+ }
33977
+ return out;
33978
+ };
33959
33979
  const _hoisted_1$P = { class: "lupa-search-result-facet-stats-values" };
33960
33980
  const _hoisted_2$B = {
33961
33981
  key: 0,
@@ -34104,7 +34124,7 @@ and ensure you are accounting for this risk.
34104
34124
  const originalSliderRange = computed(() => {
34105
34125
  return innerSliderRange.value.length === 2 && (currentFilters.value.gte || currentFilters.value.lte) ? [
34106
34126
  Math.max(+currentFilters.value.gte, facetValue.value.min),
34107
- Math.min(+currentFilters.value.lte, facetValue.value.max)
34127
+ Math.min(+(currentFilters.value.lt || currentFilters.value.lte), facetValue.value.max)
34108
34128
  ] : [facetValue.value.min, facetValue.value.max];
34109
34129
  });
34110
34130
  const fromValue = computed({
@@ -34160,6 +34180,7 @@ and ensure you are accounting for this risk.
34160
34180
  }
34161
34181
  );
34162
34182
  const statsSummary = computed(() => {
34183
+ var _a25, _b25;
34163
34184
  const [min, max] = originalSliderRange.value;
34164
34185
  if (isPrice.value) {
34165
34186
  return formatPriceSummary(
@@ -34170,10 +34191,12 @@ and ensure you are accounting for this risk.
34170
34191
  multiCurrency.value
34171
34192
  );
34172
34193
  }
34194
+ const minValue = roundToMaxDecimals(min, (_a25 = customInterval.value) != null ? _a25 : 0.1);
34195
+ const maxValue = roundToMaxDecimals(max, (_b25 = customInterval.value) != null ? _b25 : 0.1);
34173
34196
  if (unit.value) {
34174
- return `${min} ${unit.value} – ${max} ${unit.value}`;
34197
+ return `${minValue} ${unit.value} – ${maxValue} ${unit.value}`;
34175
34198
  }
34176
- return formatRange({ gte: min, lte: max });
34199
+ return formatRange({ gte: minValue, lte: maxValue });
34177
34200
  });
34178
34201
  function handleInputChange() {
34179
34202
  if (innerSliderRange.value.length < 2) return;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@getlupa/client",
3
- "version": "1.22.1",
3
+ "version": "1.22.3",
4
4
  "main": "dist/lupaSearch.js",
5
5
  "module": "dist/lupaSearch.mjs",
6
6
  "types": "dist/index.d.ts",
@@ -20,7 +20,7 @@
20
20
  },
21
21
  "devDependencies": {
22
22
  "@getlupa/client-sdk": "^1.8.1",
23
- "@getlupa/vue": "0.22.1",
23
+ "@getlupa/vue": "0.22.3",
24
24
  "@rushstack/eslint-patch": "^1.12.0",
25
25
  "@tsconfig/node18": "^18.2.4",
26
26
  "@types/jsdom": "^21.1.7",