@getlupa/vue 0.25.0 → 0.25.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.
@@ -26657,17 +26657,25 @@ const useLoadingSkeleton = () => {
26657
26657
  loadingRelatedQueries
26658
26658
  } = storeToRefs(searchResultStore);
26659
26659
  const { searchResultOptions } = storeToRefs(optionsStore);
26660
+ const enabled = vue.computed(() => {
26661
+ var _a25, _b25;
26662
+ return (_b25 = (_a25 = searchResultOptions.value) == null ? void 0 : _a25.loadingSkeleton) == null ? void 0 : _b25.enabled;
26663
+ });
26664
+ const showOnEveryFetch = vue.computed(() => {
26665
+ var _a25, _b25;
26666
+ return (_b25 = (_a25 = searchResultOptions.value) == null ? void 0 : _a25.loadingSkeleton) == null ? void 0 : _b25.showOnEveryFetch;
26667
+ });
26660
26668
  const skeletonEnabled = vue.computed(() => {
26661
- var _a25, _b25, _c, _d;
26662
- return ((_b25 = (_a25 = searchResultOptions.value) == null ? void 0 : _a25.loadingSkeleton) == null ? void 0 : _b25.enabled) && !((_d = (_c = searchResult.value) == null ? void 0 : _c.items) == null ? void 0 : _d.length);
26669
+ var _a25, _b25, _c;
26670
+ return enabled.value && (!((_b25 = (_a25 = searchResult.value) == null ? void 0 : _a25.items) == null ? void 0 : _b25.length) || ((_c = showOnEveryFetch.value) == null ? void 0 : _c.results));
26663
26671
  });
26664
26672
  const relatedQueriesSkeletonEnabled = vue.computed(() => {
26665
- var _a25, _b25, _c, _d, _e;
26666
- return ((_b25 = (_a25 = searchResultOptions.value) == null ? void 0 : _a25.loadingSkeleton) == null ? void 0 : _b25.enabled) && Boolean((_c = searchResultOptions.value) == null ? void 0 : _c.relatedQueries) && !((_e = (_d = relatedQueriesResult.value) == null ? void 0 : _d.relatedQueries) == null ? void 0 : _e.length);
26673
+ var _a25, _b25, _c, _d;
26674
+ return enabled.value && Boolean((_a25 = searchResultOptions.value) == null ? void 0 : _a25.relatedQueries) && (!((_c = (_b25 = relatedQueriesResult.value) == null ? void 0 : _b25.relatedQueries) == null ? void 0 : _c.length) || ((_d = showOnEveryFetch.value) == null ? void 0 : _d.relatedQueries));
26667
26675
  });
26668
26676
  const facetSkeletonEnabled = vue.computed(() => {
26669
- var _a25, _b25, _c, _d;
26670
- return ((_b25 = (_a25 = searchResultOptions.value) == null ? void 0 : _a25.loadingSkeleton) == null ? void 0 : _b25.enabled) && !((_d = (_c = searchResult.value) == null ? void 0 : _c.facets) == null ? void 0 : _d.length);
26677
+ var _a25, _b25, _c;
26678
+ return enabled.value && (!((_b25 = (_a25 = searchResult.value) == null ? void 0 : _a25.facets) == null ? void 0 : _b25.length) || ((_c = showOnEveryFetch.value) == null ? void 0 : _c.facets));
26671
26679
  });
26672
26680
  const loadingFacets = vue.computed(() => {
26673
26681
  var _a25;
@@ -29696,6 +29704,13 @@ const _sfc_main$M = /* @__PURE__ */ vue.defineComponent({
29696
29704
  return props.options.renderAsLinks ? "a" : "div";
29697
29705
  });
29698
29706
  const getPageUrlWithNewParams = (page) => {
29707
+ if (page === 1) {
29708
+ const url = paramStore.getPageUrlWithNewParams({
29709
+ params: [],
29710
+ paramsToRemove: [optionsStore.getQueryParamName(QUERY_PARAMS.PAGE)]
29711
+ });
29712
+ return url ? url : getPageUrl().pathname;
29713
+ }
29699
29714
  return paramStore.getPageUrlWithNewParams({
29700
29715
  params: [{ name: optionsStore.getQueryParamName(QUERY_PARAMS.PAGE), value: page.toString() }]
29701
29716
  });
@@ -29754,18 +29769,18 @@ const _sfc_main$M = /* @__PURE__ */ vue.defineComponent({
29754
29769
  return vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(tagName.value), {
29755
29770
  key: page,
29756
29771
  href: getHref(page),
29757
- onClick: (e2) => handlePageChange(e2, page),
29758
29772
  class: vue.normalizeClass([
29759
29773
  "lupa-page-number",
29760
29774
  page === _ctx.options.selectedPage ? "lupa-page-number-selected" : ""
29761
29775
  ]),
29762
- "data-cy": "lupa-page-number"
29776
+ "data-cy": "lupa-page-number",
29777
+ onClick: (e2) => handlePageChange(e2, page)
29763
29778
  }, {
29764
29779
  default: vue.withCtx(() => [
29765
29780
  vue.createTextVNode(vue.toDisplayString(page), 1)
29766
29781
  ]),
29767
29782
  _: 2
29768
- }, 1032, ["href", "onClick", "class"]);
29783
+ }, 1032, ["href", "class", "onClick"]);
29769
29784
  }), 128)),
29770
29785
  showLastPage.value ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 2 }, [
29771
29786
  showLastPageSeparator.value ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_3$o, "...")) : vue.createCommentVNode("", true),
@@ -26655,17 +26655,25 @@ const useLoadingSkeleton = () => {
26655
26655
  loadingRelatedQueries
26656
26656
  } = storeToRefs(searchResultStore);
26657
26657
  const { searchResultOptions } = storeToRefs(optionsStore);
26658
+ const enabled = computed(() => {
26659
+ var _a25, _b25;
26660
+ return (_b25 = (_a25 = searchResultOptions.value) == null ? void 0 : _a25.loadingSkeleton) == null ? void 0 : _b25.enabled;
26661
+ });
26662
+ const showOnEveryFetch = computed(() => {
26663
+ var _a25, _b25;
26664
+ return (_b25 = (_a25 = searchResultOptions.value) == null ? void 0 : _a25.loadingSkeleton) == null ? void 0 : _b25.showOnEveryFetch;
26665
+ });
26658
26666
  const skeletonEnabled = computed(() => {
26659
- var _a25, _b25, _c, _d;
26660
- return ((_b25 = (_a25 = searchResultOptions.value) == null ? void 0 : _a25.loadingSkeleton) == null ? void 0 : _b25.enabled) && !((_d = (_c = searchResult.value) == null ? void 0 : _c.items) == null ? void 0 : _d.length);
26667
+ var _a25, _b25, _c;
26668
+ return enabled.value && (!((_b25 = (_a25 = searchResult.value) == null ? void 0 : _a25.items) == null ? void 0 : _b25.length) || ((_c = showOnEveryFetch.value) == null ? void 0 : _c.results));
26661
26669
  });
26662
26670
  const relatedQueriesSkeletonEnabled = computed(() => {
26663
- var _a25, _b25, _c, _d, _e;
26664
- return ((_b25 = (_a25 = searchResultOptions.value) == null ? void 0 : _a25.loadingSkeleton) == null ? void 0 : _b25.enabled) && Boolean((_c = searchResultOptions.value) == null ? void 0 : _c.relatedQueries) && !((_e = (_d = relatedQueriesResult.value) == null ? void 0 : _d.relatedQueries) == null ? void 0 : _e.length);
26671
+ var _a25, _b25, _c, _d;
26672
+ return enabled.value && Boolean((_a25 = searchResultOptions.value) == null ? void 0 : _a25.relatedQueries) && (!((_c = (_b25 = relatedQueriesResult.value) == null ? void 0 : _b25.relatedQueries) == null ? void 0 : _c.length) || ((_d = showOnEveryFetch.value) == null ? void 0 : _d.relatedQueries));
26665
26673
  });
26666
26674
  const facetSkeletonEnabled = computed(() => {
26667
- var _a25, _b25, _c, _d;
26668
- return ((_b25 = (_a25 = searchResultOptions.value) == null ? void 0 : _a25.loadingSkeleton) == null ? void 0 : _b25.enabled) && !((_d = (_c = searchResult.value) == null ? void 0 : _c.facets) == null ? void 0 : _d.length);
26675
+ var _a25, _b25, _c;
26676
+ return enabled.value && (!((_b25 = (_a25 = searchResult.value) == null ? void 0 : _a25.facets) == null ? void 0 : _b25.length) || ((_c = showOnEveryFetch.value) == null ? void 0 : _c.facets));
26669
26677
  });
26670
26678
  const loadingFacets = computed(() => {
26671
26679
  var _a25;
@@ -29694,6 +29702,13 @@ const _sfc_main$M = /* @__PURE__ */ defineComponent({
29694
29702
  return props.options.renderAsLinks ? "a" : "div";
29695
29703
  });
29696
29704
  const getPageUrlWithNewParams = (page) => {
29705
+ if (page === 1) {
29706
+ const url = paramStore.getPageUrlWithNewParams({
29707
+ params: [],
29708
+ paramsToRemove: [optionsStore.getQueryParamName(QUERY_PARAMS.PAGE)]
29709
+ });
29710
+ return url ? url : getPageUrl().pathname;
29711
+ }
29697
29712
  return paramStore.getPageUrlWithNewParams({
29698
29713
  params: [{ name: optionsStore.getQueryParamName(QUERY_PARAMS.PAGE), value: page.toString() }]
29699
29714
  });
@@ -29752,18 +29767,18 @@ const _sfc_main$M = /* @__PURE__ */ defineComponent({
29752
29767
  return openBlock(), createBlock(resolveDynamicComponent(tagName.value), {
29753
29768
  key: page,
29754
29769
  href: getHref(page),
29755
- onClick: (e2) => handlePageChange(e2, page),
29756
29770
  class: normalizeClass([
29757
29771
  "lupa-page-number",
29758
29772
  page === _ctx.options.selectedPage ? "lupa-page-number-selected" : ""
29759
29773
  ]),
29760
- "data-cy": "lupa-page-number"
29774
+ "data-cy": "lupa-page-number",
29775
+ onClick: (e2) => handlePageChange(e2, page)
29761
29776
  }, {
29762
29777
  default: withCtx(() => [
29763
29778
  createTextVNode(toDisplayString(page), 1)
29764
29779
  ]),
29765
29780
  _: 2
29766
- }, 1032, ["href", "onClick", "class"]);
29781
+ }, 1032, ["href", "class", "onClick"]);
29767
29782
  }), 128)),
29768
29783
  showLastPage.value ? (openBlock(), createElementBlock(Fragment, { key: 2 }, [
29769
29784
  showLastPageSeparator.value ? (openBlock(), createElementBlock("div", _hoisted_3$o, "...")) : createCommentVNode("", true),
@@ -26,6 +26,11 @@ export type SearchResultsOptions = SearchResultsProductOptions & SearchResultsAd
26
26
  selectFields?: string[];
27
27
  loadingSkeleton?: {
28
28
  enabled: boolean;
29
+ showOnEveryFetch?: {
30
+ results?: boolean;
31
+ facets?: boolean;
32
+ relatedQueries?: boolean;
33
+ };
29
34
  };
30
35
  } & Partial<MultiCurrencyConfig>;
31
36
  export type ZeroResultsOptions = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@getlupa/vue",
3
- "version": "0.25.0",
3
+ "version": "0.25.2",
4
4
  "main": "dist/lupaSearch.mjs",
5
5
  "module": "dist/lupaSearch.mjs",
6
6
  "types": "dist/src/index.d.ts",