@getlupa/vue 0.0.10 → 0.0.12

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/README.md CHANGED
@@ -1,4 +1,88 @@
1
- # lupasearch-client
1
+ # Quickstart
2
+
3
+ This is a vue plugin for
4
+
5
+ For SSR support, see [Plugin for Nuxt 3](https://github.com/lupasearch/lupasearch-nuxt)
6
+
7
+ For full configuration options see [Main repository](https://github.com/lupasearch/lupasearch-client)
8
+
9
+ ## Quick Setup
10
+
11
+ 1. Add `LupaSearch` dependency to your project
12
+
13
+ ```bash
14
+ # Using pnpm
15
+ pnpm add -D @getlupa/nuxt @getlupa/vue
16
+
17
+ # Using yarn
18
+ yarn add --dev @getlupa/nuxt @getlupa/vue
19
+
20
+ # Using npm
21
+ npm install --save-dev @getlupa/nuxt @getlupa/vue
22
+ ```
23
+
24
+ 2. Import desired plugins to your component:
25
+
26
+ ```html
27
+ <script setup lang="ts">
28
+ import { SearchBox, SearchBoxOptions, SearchResults, SearchResultsOptions } from '@getlupa/vue'
29
+ import '@getlupa/vue/dist/style.css'
30
+
31
+ const searchBoxOptions: SearchBoxOptions = {
32
+ // See main repository for full list of available options
33
+ }
34
+
35
+ const searchResultsOptions: SearchResultsOptions = {
36
+ // See main repository for full list of available options
37
+ }
38
+ </script>
39
+ <template>
40
+ <div class="box-wrapper">
41
+ <SearchBox :options="searchBoxOptions" />
42
+ </div>
43
+ <div class="result-wrapper">
44
+ <SearchResults :options="searchResultsOptions" />
45
+ </div>
46
+ </template>
47
+ ```
48
+
49
+ See main repo for full configuration options examples.
50
+
51
+ ## Using Slots
52
+
53
+ ```html
54
+ <script lang="ts" setup>
55
+ import { SearchBox, SearchBoxOptions, SearchResults, SearchResultsOptions } from '@getlupa/vue'
56
+ import '@getlupa/vue/dist/style.css'
57
+
58
+ const searchBoxOptions: SearchBoxOptions = {
59
+ // See main repository for full list of available options
60
+ }
61
+
62
+ const searchResultsOptions: SearchResultsOptions = {
63
+ // See main repository for full list of available options
64
+ }
65
+ </script>
66
+
67
+ <template>
68
+ <div>
69
+ <div>
70
+ <LupaSearchBox :options="searchBoxOptions" />
71
+ </div>
72
+ <div style="margin-top: 25px">
73
+ <LupaSearchResults :options="searchResultsOptions">
74
+ <template #productCard="props">
75
+ <div :style="props.style">
76
+ <div style="margin-bottom: 25px">{{ props.product.name }}</div>
77
+ </div>
78
+ </template>
79
+ </LupaSearchResults>
80
+ </div>
81
+ </div>
82
+ </template>
83
+ ```
84
+
85
+ # Development
2
86
 
3
87
  This template should help get you started developing with Vue 3 in Vite.
4
88
 
@@ -13,8 +97,8 @@ TypeScript cannot handle type information for `.vue` imports by default, so we r
13
97
  If the standalone TypeScript plugin doesn't feel fast enough to you, Volar has also implemented a [Take Over Mode](https://github.com/johnsoncodehk/volar/discussions/471#discussioncomment-1361669) that is more performant. You can enable it by the following steps:
14
98
 
15
99
  1. Disable the built-in TypeScript Extension
16
- 1) Run `Extensions: Show Built-in Extensions` from VSCode's command palette
17
- 2) Find `TypeScript and JavaScript Language Features`, right click and select `Disable (Workspace)`
100
+ 1. Run `Extensions: Show Built-in Extensions` from VSCode's command palette
101
+ 2. Find `TypeScript and JavaScript Language Features`, right click and select `Disable (Workspace)`
18
102
  2. Reload the VSCode window by running `Developer: Reload Window` from the command palette.
19
103
 
20
104
  ## Customize configuration
@@ -24,23 +108,23 @@ See [Vite Configuration Reference](https://vitejs.dev/config/).
24
108
  ## Project Setup
25
109
 
26
110
  ```sh
27
- npm install
111
+ yarn install
28
112
  ```
29
113
 
30
114
  ### Compile and Hot-Reload for Development
31
115
 
32
116
  ```sh
33
- npm run dev
117
+ yarn dev
34
118
  ```
35
119
 
36
120
  ### Type-Check, Compile and Minify for Production
37
121
 
38
122
  ```sh
39
- npm run build
123
+ yarn build
40
124
  ```
41
125
 
42
126
  ### Lint with [ESLint](https://eslint.org/)
43
127
 
44
128
  ```sh
45
- npm run lint
129
+ yarn lint
46
130
  ```
@@ -2583,9 +2583,14 @@ const redirectToResultsPage = (link, searchText, facet, routingBehavior = "direc
2583
2583
  window.location.assign(url);
2584
2584
  }
2585
2585
  };
2586
- const getPageUrl = (pathnameOverride) => {
2587
- const pathname = pathnameOverride || window.location.pathname;
2588
- return new URL(window.location.origin + pathname + window.location.search);
2586
+ const getPageUrl = (pathnameOverride, ssr) => {
2587
+ if (typeof window !== "undefined") {
2588
+ const pathname = pathnameOverride || window.location.pathname;
2589
+ const origin = window.location.origin;
2590
+ const search2 = window.location.search;
2591
+ return new URL(origin + pathname + search2);
2592
+ }
2593
+ return new URL(ssr.url, ssr.baseUrl);
2589
2594
  };
2590
2595
  const getFacetKey = (key, type) => {
2591
2596
  return `${FACET_FILTER_MAP[type]}${key}`;
@@ -2671,11 +2676,11 @@ const useParamsStore = defineStore("params", () => {
2671
2676
  var _a;
2672
2677
  return (_a = params.value.filters) != null ? _a : {};
2673
2678
  });
2674
- const add = (newParams) => {
2679
+ const add = (newParams, ssr) => {
2675
2680
  if (!newParams) {
2676
2681
  return { params: params.value };
2677
2682
  }
2678
- const url = getPageUrl();
2683
+ const url = getPageUrl(void 0, ssr);
2679
2684
  params.value = newParams;
2680
2685
  searchString.value = url.search;
2681
2686
  };
@@ -4697,10 +4702,12 @@ const useSearchResultStore = defineStore("searchResult", () => {
4697
4702
  pageSize: searchResult.value.limit || 0
4698
4703
  };
4699
4704
  }
4700
- setDocumentTitle(
4701
- (_b = (_a = optionsStore.searchResultOptions) == null ? void 0 : _a.labels) == null ? void 0 : _b.htmlTitleTemplate,
4702
- newSearchResult.searchText
4703
- );
4705
+ if (typeof document !== "undefined") {
4706
+ setDocumentTitle(
4707
+ (_b = (_a = optionsStore.searchResultOptions) == null ? void 0 : _a.labels) == null ? void 0 : _b.htmlTitleTemplate,
4708
+ newSearchResult.searchText
4709
+ );
4710
+ }
4704
4711
  searchResult.value = newSearchResult;
4705
4712
  return { searchResult: newSearchResult };
4706
4713
  };
@@ -4814,6 +4821,35 @@ const getPublicQuery = (publicQuery, initialFilters, isProductList) => {
4814
4821
  searchText: isProductList ? "" : publicQuery.searchText
4815
4822
  });
4816
4823
  };
4824
+ const getSearchParams = (url, params, baseUrl) => {
4825
+ let searchParams;
4826
+ if (typeof window !== "undefined") {
4827
+ searchParams = params || new URLSearchParams(window.location.search);
4828
+ } else {
4829
+ if (url) {
4830
+ searchParams = params || new URLSearchParams(new URL(url, baseUrl).search);
4831
+ } else {
4832
+ throw new Error("LupaSaerch: ssr.url is required on the server side");
4833
+ }
4834
+ }
4835
+ return searchParams;
4836
+ };
4837
+ const getInitialSearchResults = (options, defaultData) => __async(exports, null, function* () {
4838
+ var _a, _b, _c;
4839
+ const searchParams = getSearchParams((_a = options.ssr) == null ? void 0 : _a.url, void 0, (_b = options.ssr) == null ? void 0 : _b.baseUrl);
4840
+ const publicQuery = createPublicQuery(
4841
+ parseParams(searchParams),
4842
+ options.sort,
4843
+ defaultData == null ? void 0 : defaultData.pageSize
4844
+ );
4845
+ const query = getPublicQuery(publicQuery, (_c = defaultData == null ? void 0 : defaultData.filters) != null ? _c : {}, false);
4846
+ try {
4847
+ const result = yield LupaSearchSdk.query(options.queryKey, query, options.options);
4848
+ return result;
4849
+ } catch (e) {
4850
+ options.options.onError(e);
4851
+ }
4852
+ });
4817
4853
  const _hoisted_1$N = {
4818
4854
  key: 0,
4819
4855
  id: "lupa-search-results-did-you-mean"
@@ -9118,7 +9154,8 @@ const _sfc_main$4 = /* @__PURE__ */ vue.defineComponent({
9118
9154
  options: {},
9119
9155
  initialFilters: {},
9120
9156
  isProductList: { type: Boolean },
9121
- isContainer: { type: Boolean }
9157
+ isContainer: { type: Boolean },
9158
+ initialData: {}
9122
9159
  },
9123
9160
  setup(__props) {
9124
9161
  const props = __props;
@@ -9224,7 +9261,8 @@ const _sfc_main$4 = /* @__PURE__ */ vue.defineComponent({
9224
9261
  screenStore.setScreenWidth({ width: window.innerWidth });
9225
9262
  };
9226
9263
  const handleUrlChange = (params) => {
9227
- const searchParams = params || new URLSearchParams(window.location.search);
9264
+ var _a;
9265
+ const searchParams = getSearchParams((_a = props.options.ssr) == null ? void 0 : _a.url, params);
9228
9266
  const publicQuery = createPublicQuery(
9229
9267
  parseParams(searchParams),
9230
9268
  props.options.sort,
@@ -9244,7 +9282,7 @@ const _sfc_main$4 = /* @__PURE__ */ vue.defineComponent({
9244
9282
  }
9245
9283
  }
9246
9284
  const params = new URLSearchParams(window.location.search);
9247
- if (!params.has(QUERY_PARAMS.QUERY)) {
9285
+ if (!params.has(QUERY_PARAMS.QUERY) && !props.initialData) {
9248
9286
  handleUrlChange(params);
9249
9287
  }
9250
9288
  paramStore.add(parseParams(params));
@@ -9259,6 +9297,23 @@ const _sfc_main$4 = /* @__PURE__ */ vue.defineComponent({
9259
9297
  urlQueryString: searchString.value
9260
9298
  });
9261
9299
  };
9300
+ const handleCreated = () => {
9301
+ var _a, _b;
9302
+ const initialData = props.initialData;
9303
+ if (initialData) {
9304
+ const searchParams = getSearchParams(
9305
+ (_a = props.options.ssr) == null ? void 0 : _a.url,
9306
+ void 0,
9307
+ (_b = props.options.ssr) == null ? void 0 : _b.baseUrl
9308
+ );
9309
+ optionStore.setSearchResultOptions({ options: props.options });
9310
+ searchResultStore.add(__spreadValues({}, initialData));
9311
+ paramStore.add(parseParams(searchParams), props.options.ssr);
9312
+ paramStore.setDefaultLimit(defaultSearchResultPageSize.value);
9313
+ handleResults({ queryKey: props.options.queryKey, results: initialData });
9314
+ }
9315
+ };
9316
+ handleCreated();
9262
9317
  return (_ctx, _cache) => {
9263
9318
  var _a, _b, _c, _d, _e;
9264
9319
  return vue.openBlock(), vue.createElementBlock("div", {
@@ -15803,4 +15858,5 @@ exports.Recommendations = _sfc_main;
15803
15858
  exports.SearchBox = _sfc_main$R;
15804
15859
  exports.SearchContainer = _sfc_main$1;
15805
15860
  exports.SearchResults = _sfc_main$4;
15861
+ exports.getInitialSearchResults = getInitialSearchResults;
15806
15862
  exports.setupTracking = setupTracking;
@@ -2581,9 +2581,14 @@ const redirectToResultsPage = (link, searchText, facet, routingBehavior = "direc
2581
2581
  window.location.assign(url);
2582
2582
  }
2583
2583
  };
2584
- const getPageUrl = (pathnameOverride) => {
2585
- const pathname = pathnameOverride || window.location.pathname;
2586
- return new URL(window.location.origin + pathname + window.location.search);
2584
+ const getPageUrl = (pathnameOverride, ssr) => {
2585
+ if (typeof window !== "undefined") {
2586
+ const pathname = pathnameOverride || window.location.pathname;
2587
+ const origin = window.location.origin;
2588
+ const search2 = window.location.search;
2589
+ return new URL(origin + pathname + search2);
2590
+ }
2591
+ return new URL(ssr.url, ssr.baseUrl);
2587
2592
  };
2588
2593
  const getFacetKey = (key, type) => {
2589
2594
  return `${FACET_FILTER_MAP[type]}${key}`;
@@ -2669,11 +2674,11 @@ const useParamsStore = defineStore("params", () => {
2669
2674
  var _a;
2670
2675
  return (_a = params.value.filters) != null ? _a : {};
2671
2676
  });
2672
- const add = (newParams) => {
2677
+ const add = (newParams, ssr) => {
2673
2678
  if (!newParams) {
2674
2679
  return { params: params.value };
2675
2680
  }
2676
- const url = getPageUrl();
2681
+ const url = getPageUrl(void 0, ssr);
2677
2682
  params.value = newParams;
2678
2683
  searchString.value = url.search;
2679
2684
  };
@@ -4695,10 +4700,12 @@ const useSearchResultStore = defineStore("searchResult", () => {
4695
4700
  pageSize: searchResult.value.limit || 0
4696
4701
  };
4697
4702
  }
4698
- setDocumentTitle(
4699
- (_b = (_a = optionsStore.searchResultOptions) == null ? void 0 : _a.labels) == null ? void 0 : _b.htmlTitleTemplate,
4700
- newSearchResult.searchText
4701
- );
4703
+ if (typeof document !== "undefined") {
4704
+ setDocumentTitle(
4705
+ (_b = (_a = optionsStore.searchResultOptions) == null ? void 0 : _a.labels) == null ? void 0 : _b.htmlTitleTemplate,
4706
+ newSearchResult.searchText
4707
+ );
4708
+ }
4702
4709
  searchResult.value = newSearchResult;
4703
4710
  return { searchResult: newSearchResult };
4704
4711
  };
@@ -4812,6 +4819,35 @@ const getPublicQuery = (publicQuery, initialFilters, isProductList) => {
4812
4819
  searchText: isProductList ? "" : publicQuery.searchText
4813
4820
  });
4814
4821
  };
4822
+ const getSearchParams = (url, params, baseUrl) => {
4823
+ let searchParams;
4824
+ if (typeof window !== "undefined") {
4825
+ searchParams = params || new URLSearchParams(window.location.search);
4826
+ } else {
4827
+ if (url) {
4828
+ searchParams = params || new URLSearchParams(new URL(url, baseUrl).search);
4829
+ } else {
4830
+ throw new Error("LupaSaerch: ssr.url is required on the server side");
4831
+ }
4832
+ }
4833
+ return searchParams;
4834
+ };
4835
+ const getInitialSearchResults = (options, defaultData) => __async(void 0, null, function* () {
4836
+ var _a, _b, _c;
4837
+ const searchParams = getSearchParams((_a = options.ssr) == null ? void 0 : _a.url, void 0, (_b = options.ssr) == null ? void 0 : _b.baseUrl);
4838
+ const publicQuery = createPublicQuery(
4839
+ parseParams(searchParams),
4840
+ options.sort,
4841
+ defaultData == null ? void 0 : defaultData.pageSize
4842
+ );
4843
+ const query = getPublicQuery(publicQuery, (_c = defaultData == null ? void 0 : defaultData.filters) != null ? _c : {}, false);
4844
+ try {
4845
+ const result = yield LupaSearchSdk.query(options.queryKey, query, options.options);
4846
+ return result;
4847
+ } catch (e) {
4848
+ options.options.onError(e);
4849
+ }
4850
+ });
4815
4851
  const _hoisted_1$N = {
4816
4852
  key: 0,
4817
4853
  id: "lupa-search-results-did-you-mean"
@@ -9116,7 +9152,8 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
9116
9152
  options: {},
9117
9153
  initialFilters: {},
9118
9154
  isProductList: { type: Boolean },
9119
- isContainer: { type: Boolean }
9155
+ isContainer: { type: Boolean },
9156
+ initialData: {}
9120
9157
  },
9121
9158
  setup(__props) {
9122
9159
  const props = __props;
@@ -9222,7 +9259,8 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
9222
9259
  screenStore.setScreenWidth({ width: window.innerWidth });
9223
9260
  };
9224
9261
  const handleUrlChange = (params) => {
9225
- const searchParams = params || new URLSearchParams(window.location.search);
9262
+ var _a;
9263
+ const searchParams = getSearchParams((_a = props.options.ssr) == null ? void 0 : _a.url, params);
9226
9264
  const publicQuery = createPublicQuery(
9227
9265
  parseParams(searchParams),
9228
9266
  props.options.sort,
@@ -9242,7 +9280,7 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
9242
9280
  }
9243
9281
  }
9244
9282
  const params = new URLSearchParams(window.location.search);
9245
- if (!params.has(QUERY_PARAMS.QUERY)) {
9283
+ if (!params.has(QUERY_PARAMS.QUERY) && !props.initialData) {
9246
9284
  handleUrlChange(params);
9247
9285
  }
9248
9286
  paramStore.add(parseParams(params));
@@ -9257,6 +9295,23 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
9257
9295
  urlQueryString: searchString.value
9258
9296
  });
9259
9297
  };
9298
+ const handleCreated = () => {
9299
+ var _a, _b;
9300
+ const initialData = props.initialData;
9301
+ if (initialData) {
9302
+ const searchParams = getSearchParams(
9303
+ (_a = props.options.ssr) == null ? void 0 : _a.url,
9304
+ void 0,
9305
+ (_b = props.options.ssr) == null ? void 0 : _b.baseUrl
9306
+ );
9307
+ optionStore.setSearchResultOptions({ options: props.options });
9308
+ searchResultStore.add(__spreadValues({}, initialData));
9309
+ paramStore.add(parseParams(searchParams), props.options.ssr);
9310
+ paramStore.setDefaultLimit(defaultSearchResultPageSize.value);
9311
+ handleResults({ queryKey: props.options.queryKey, results: initialData });
9312
+ }
9313
+ };
9314
+ handleCreated();
9260
9315
  return (_ctx, _cache) => {
9261
9316
  var _a, _b, _c, _d, _e;
9262
9317
  return openBlock(), createElementBlock("div", {
@@ -15802,5 +15857,6 @@ export {
15802
15857
  _sfc_main$R as SearchBox,
15803
15858
  _sfc_main$1 as SearchContainer,
15804
15859
  _sfc_main$4 as SearchResults,
15860
+ getInitialSearchResults,
15805
15861
  setupTracking
15806
15862
  };
@@ -1,6 +1,6 @@
1
1
  import type { PropType as __PropType } from 'vue';
2
2
  import type { SearchResultsOptions } from '../../types/search-results/SearchResultsOptions';
3
- import type { FilterGroup } from '@getlupa/client-sdk/Types';
3
+ import type { FilterGroup, SearchQueryResult } from '@getlupa/client-sdk/Types';
4
4
  declare const _sfc_main: import("vue").DefineComponent<{
5
5
  options: {
6
6
  type: __PropType<SearchResultsOptions>;
@@ -18,6 +18,10 @@ declare const _sfc_main: import("vue").DefineComponent<{
18
18
  type: __PropType<boolean>;
19
19
  required: false;
20
20
  };
21
+ initialData: {
22
+ type: __PropType<SearchQueryResult>;
23
+ required: false;
24
+ };
21
25
  }, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
22
26
  options: {
23
27
  type: __PropType<SearchResultsOptions>;
@@ -35,5 +39,9 @@ declare const _sfc_main: import("vue").DefineComponent<{
35
39
  type: __PropType<boolean>;
36
40
  required: false;
37
41
  };
42
+ initialData: {
43
+ type: __PropType<SearchQueryResult>;
44
+ required: false;
45
+ };
38
46
  }>>, {}, {}>;
39
47
  export default _sfc_main;
@@ -8,7 +8,7 @@ import type { SearchBoxPanelType } from './types/search-box/SearchBoxPanel';
8
8
  import type { SearchContainerOptions, SearchContainerConfigOptions } from './types/search-container/SearchContainerOptions';
9
9
  import type { BadgeType, SearchResultBadgeType, SearchResultBadgeElement, BadgeGenerateSeed, BadgeGenerateOptions, BadgeOptions } from './types/search-results/BadgeOptions';
10
10
  import type { RoutingBehavior } from './types/search-results/RoutingBehavior';
11
- import type { SearchResultsOptions, FacetStyle, SearchResultEventCallbacks, CallbackContext, FacetFilterQuery, SearchResultsFilterOptions, ResultFacetOptions, DynamicData } from './types/search-results/SearchResultsOptions';
11
+ import type { SearchResultsOptions, FacetStyle, SearchResultEventCallbacks, CallbackContext, FacetFilterQuery, SearchResultsFilterOptions, ResultFacetOptions, DynamicData, SsrOptions } from './types/search-results/SearchResultsOptions';
12
12
  import type { AnchorPosition } from './types/search-results/SearchResultsProductCardOptions';
13
13
  import type { SortOptions, SearchResultsSortOptions } from './types/search-results/SearchResultsSort';
14
14
  import SearchBox from './components/search-box/SearchBox.vue';
@@ -16,9 +16,10 @@ import SearchResults from './components/search-results/SearchResults.vue';
16
16
  import ProductList from './components/product-list/ProductList.vue';
17
17
  import SearchContainer from './components/search-container/SearchContainer.vue';
18
18
  import Recommendations from './components/recommendations/Recommendations.vue';
19
+ import { getInitialSearchResults } from './utils/ssr.utils';
19
20
  declare const setupTracking: (options: TrackingOptions) => void;
20
21
  declare const LupaSearch: {
21
22
  install: (app: any, options: any) => void;
22
23
  };
23
- export { SearchBox, SearchResults, ProductList, Recommendations, SearchContainer, DocumentElementType, SearchBoxPanelType, BadgeType, setupTracking, LupaSearch };
24
- export type { TrackingOptions, SearchBoxOptions, SearchResultsOptions, ProductListOptions, SdkOptions, FacetStyle, Environment, RoutingBehavior, AnchorPosition, SortDirection, DocumentElement, ImageDocumentElement, TitleDocumentElement, DescriptionDocumentElement, CustomDocumentElement, PriceElement, RegularPriceDocumentElement, RatingElement, AddToCartElement, CustomHtmlElement, SortOptions, SearchResultsSortOptions, SearchResultEventCallbacks, CallbackContext, FacetFilterQuery, CategoryFilterOptions, SearchResultsFilterOptions, SearchResultBadgeType, SearchResultBadgeElement, ResultFacetOptions, BadgeGenerateSeed, BadgeGenerateOptions, BadgeOptions, SearchContainerOptions, SearchContainerConfigOptions, SingleStarRatingElement, DynamicData, ProductRecommendationOptions, RecommendationABTestingOptions };
24
+ export { SearchBox, SearchResults, ProductList, Recommendations, SearchContainer, DocumentElementType, SearchBoxPanelType, BadgeType, setupTracking, LupaSearch, getInitialSearchResults };
25
+ export type { TrackingOptions, SearchBoxOptions, SearchResultsOptions, ProductListOptions, SdkOptions, FacetStyle, Environment, RoutingBehavior, AnchorPosition, SortDirection, DocumentElement, ImageDocumentElement, TitleDocumentElement, DescriptionDocumentElement, CustomDocumentElement, PriceElement, RegularPriceDocumentElement, RatingElement, AddToCartElement, CustomHtmlElement, SortOptions, SearchResultsSortOptions, SearchResultEventCallbacks, CallbackContext, FacetFilterQuery, CategoryFilterOptions, SearchResultsFilterOptions, SearchResultBadgeType, SearchResultBadgeElement, ResultFacetOptions, BadgeGenerateSeed, BadgeGenerateOptions, BadgeOptions, SearchContainerOptions, SearchContainerConfigOptions, SingleStarRatingElement, DynamicData, ProductRecommendationOptions, RecommendationABTestingOptions, SsrOptions };
@@ -1,6 +1,7 @@
1
1
  import { type Ref } from 'vue';
2
2
  import type { QueryParams } from '../types/search-results/QueryParams';
3
3
  import type { InputSuggestionFacet } from '../types/search-box/Common';
4
+ import { SsrOptions } from '..';
4
5
  export declare const useParamsStore: import("pinia").StoreDefinition<"params", import("pinia")._UnwrapAll<Pick<{
5
6
  params: Ref<QueryParams>;
6
7
  defaultLimit: Ref<number>;
@@ -11,7 +12,7 @@ export declare const useParamsStore: import("pinia").StoreDefinition<"params", i
11
12
  limit: import("vue").ComputedRef<number>;
12
13
  sort: import("vue").ComputedRef<string>;
13
14
  filters: import("vue").ComputedRef<import("@getlupa/client-sdk/Types").FilterGroup>;
14
- add: (newParams: QueryParams) => {
15
+ add: (newParams: QueryParams, ssr?: SsrOptions) => {
15
16
  params: QueryParams;
16
17
  };
17
18
  removeAllFilters: () => void;
@@ -51,7 +52,7 @@ export declare const useParamsStore: import("pinia").StoreDefinition<"params", i
51
52
  limit: import("vue").ComputedRef<number>;
52
53
  sort: import("vue").ComputedRef<string>;
53
54
  filters: import("vue").ComputedRef<import("@getlupa/client-sdk/Types").FilterGroup>;
54
- add: (newParams: QueryParams) => {
55
+ add: (newParams: QueryParams, ssr?: SsrOptions) => {
55
56
  params: QueryParams;
56
57
  };
57
58
  removeAllFilters: () => void;
@@ -91,7 +92,7 @@ export declare const useParamsStore: import("pinia").StoreDefinition<"params", i
91
92
  limit: import("vue").ComputedRef<number>;
92
93
  sort: import("vue").ComputedRef<string>;
93
94
  filters: import("vue").ComputedRef<import("@getlupa/client-sdk/Types").FilterGroup>;
94
- add: (newParams: QueryParams) => {
95
+ add: (newParams: QueryParams, ssr?: SsrOptions) => {
95
96
  params: QueryParams;
96
97
  };
97
98
  removeAllFilters: () => void;
@@ -11,6 +11,11 @@ export type SearchResultsOptions = SearchResultsProductOptions & SearchResultsAd
11
11
  callbacks?: SearchResultEventCallbacks;
12
12
  categories?: CategoryFilterOptions;
13
13
  dynamicData?: DynamicData;
14
+ ssr?: SsrOptions;
15
+ };
16
+ export type SsrOptions = {
17
+ baseUrl?: string;
18
+ url?: string;
14
19
  };
15
20
  export type SearchTitlePosition = 'page-top' | 'search-results-top';
16
21
  export type SearchResultsDidYouMeanLabels = {
@@ -1,6 +1,6 @@
1
1
  import type { InputSuggestionFacet } from '../types/search-box/Common';
2
- import type { RoutingBehavior } from '..';
2
+ import type { RoutingBehavior, SsrOptions } from '..';
3
3
  export declare const emitRoutingEvent: (url: string) => void;
4
4
  export declare const handleRoutingEvent: (link: string, event?: Event, hasEventRouting?: boolean) => void;
5
5
  export declare const redirectToResultsPage: (link: string, searchText: string, facet?: InputSuggestionFacet, routingBehavior?: RoutingBehavior) => void;
6
- export declare const getPageUrl: (pathnameOverride?: string) => URL;
6
+ export declare const getPageUrl: (pathnameOverride?: string, ssr?: SsrOptions) => URL;
@@ -0,0 +1,7 @@
1
+ import { SearchResultsOptions } from '..';
2
+ import { FilterGroup } from '@getlupa/client-sdk/Types';
3
+ export declare const getSearchParams: (url?: string, params?: URLSearchParams, baseUrl?: string) => URLSearchParams;
4
+ export declare const getInitialSearchResults: (options: SearchResultsOptions, defaultData?: {
5
+ filters?: FilterGroup;
6
+ pageSize?: number;
7
+ }) => Promise<import("@getlupa/client-sdk/Types").SearchQueryResult | import("@getlupa/client-sdk/Types").SdkError>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@getlupa/vue",
3
- "version": "0.0.10",
3
+ "version": "0.0.12",
4
4
  "main": "dist/lupaSearch.js",
5
5
  "module": "dist/lupaSearch.mjs",
6
6
  "types": "dist/src/index.d.ts",