@getlupa/vue 0.0.9 → 0.0.11
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 +91 -7
- package/dist/lupaSearch.js +48 -10
- package/dist/lupaSearch.mjs +48 -10
- package/dist/src/components/search-results/SearchResults.vue.d.ts +9 -1
- package/dist/src/index.d.ts +4 -3
- package/dist/src/types/search-results/SearchResultsOptions.d.ts +5 -0
- package/dist/src/utils/ssr.utils.d.ts +7 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,4 +1,88 @@
|
|
|
1
|
-
#
|
|
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
|
-
|
|
17
|
-
|
|
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
|
-
|
|
111
|
+
yarn install
|
|
28
112
|
```
|
|
29
113
|
|
|
30
114
|
### Compile and Hot-Reload for Development
|
|
31
115
|
|
|
32
116
|
```sh
|
|
33
|
-
|
|
117
|
+
yarn dev
|
|
34
118
|
```
|
|
35
119
|
|
|
36
120
|
### Type-Check, Compile and Minify for Production
|
|
37
121
|
|
|
38
122
|
```sh
|
|
39
|
-
|
|
123
|
+
yarn build
|
|
40
124
|
```
|
|
41
125
|
|
|
42
126
|
### Lint with [ESLint](https://eslint.org/)
|
|
43
127
|
|
|
44
128
|
```sh
|
|
45
|
-
|
|
129
|
+
yarn lint
|
|
46
130
|
```
|
package/dist/lupaSearch.js
CHANGED
|
@@ -4697,10 +4697,12 @@ const useSearchResultStore = defineStore("searchResult", () => {
|
|
|
4697
4697
|
pageSize: searchResult.value.limit || 0
|
|
4698
4698
|
};
|
|
4699
4699
|
}
|
|
4700
|
-
|
|
4701
|
-
(
|
|
4702
|
-
|
|
4703
|
-
|
|
4700
|
+
if (typeof document !== "undefined") {
|
|
4701
|
+
setDocumentTitle(
|
|
4702
|
+
(_b = (_a = optionsStore.searchResultOptions) == null ? void 0 : _a.labels) == null ? void 0 : _b.htmlTitleTemplate,
|
|
4703
|
+
newSearchResult.searchText
|
|
4704
|
+
);
|
|
4705
|
+
}
|
|
4704
4706
|
searchResult.value = newSearchResult;
|
|
4705
4707
|
return { searchResult: newSearchResult };
|
|
4706
4708
|
};
|
|
@@ -4814,6 +4816,35 @@ const getPublicQuery = (publicQuery, initialFilters, isProductList) => {
|
|
|
4814
4816
|
searchText: isProductList ? "" : publicQuery.searchText
|
|
4815
4817
|
});
|
|
4816
4818
|
};
|
|
4819
|
+
const getSearchParams = (url, params, baseUrl) => {
|
|
4820
|
+
let searchParams;
|
|
4821
|
+
if (typeof window !== "undefined") {
|
|
4822
|
+
searchParams = params || new URLSearchParams(window.location.search);
|
|
4823
|
+
} else {
|
|
4824
|
+
if (url) {
|
|
4825
|
+
searchParams = params || new URLSearchParams(new URL(url, baseUrl).search);
|
|
4826
|
+
} else {
|
|
4827
|
+
throw new Error("LupaSaerch: ssr.url is required on the server side");
|
|
4828
|
+
}
|
|
4829
|
+
}
|
|
4830
|
+
return searchParams;
|
|
4831
|
+
};
|
|
4832
|
+
const getInitialSearchResults = (options, defaultData) => __async(exports, null, function* () {
|
|
4833
|
+
var _a, _b, _c;
|
|
4834
|
+
const searchParams = getSearchParams((_a = options.ssr) == null ? void 0 : _a.url, void 0, (_b = options.ssr) == null ? void 0 : _b.baseUrl);
|
|
4835
|
+
const publicQuery = createPublicQuery(
|
|
4836
|
+
parseParams(searchParams),
|
|
4837
|
+
options.sort,
|
|
4838
|
+
defaultData == null ? void 0 : defaultData.pageSize
|
|
4839
|
+
);
|
|
4840
|
+
const query = getPublicQuery(publicQuery, (_c = defaultData == null ? void 0 : defaultData.filters) != null ? _c : {}, false);
|
|
4841
|
+
try {
|
|
4842
|
+
const result = yield LupaSearchSdk.query(options.queryKey, query, options.options);
|
|
4843
|
+
return result;
|
|
4844
|
+
} catch (e) {
|
|
4845
|
+
options.options.onError(e);
|
|
4846
|
+
}
|
|
4847
|
+
});
|
|
4817
4848
|
const _hoisted_1$N = {
|
|
4818
4849
|
key: 0,
|
|
4819
4850
|
id: "lupa-search-results-did-you-mean"
|
|
@@ -9118,7 +9149,8 @@ const _sfc_main$4 = /* @__PURE__ */ vue.defineComponent({
|
|
|
9118
9149
|
options: {},
|
|
9119
9150
|
initialFilters: {},
|
|
9120
9151
|
isProductList: { type: Boolean },
|
|
9121
|
-
isContainer: { type: Boolean }
|
|
9152
|
+
isContainer: { type: Boolean },
|
|
9153
|
+
initialData: {}
|
|
9122
9154
|
},
|
|
9123
9155
|
setup(__props) {
|
|
9124
9156
|
const props = __props;
|
|
@@ -9224,7 +9256,8 @@ const _sfc_main$4 = /* @__PURE__ */ vue.defineComponent({
|
|
|
9224
9256
|
screenStore.setScreenWidth({ width: window.innerWidth });
|
|
9225
9257
|
};
|
|
9226
9258
|
const handleUrlChange = (params) => {
|
|
9227
|
-
|
|
9259
|
+
var _a;
|
|
9260
|
+
const searchParams = getSearchParams((_a = props.options.ssr) == null ? void 0 : _a.url, params);
|
|
9228
9261
|
const publicQuery = createPublicQuery(
|
|
9229
9262
|
parseParams(searchParams),
|
|
9230
9263
|
props.options.sort,
|
|
@@ -9244,15 +9277,12 @@ const _sfc_main$4 = /* @__PURE__ */ vue.defineComponent({
|
|
|
9244
9277
|
}
|
|
9245
9278
|
}
|
|
9246
9279
|
const params = new URLSearchParams(window.location.search);
|
|
9247
|
-
if (!params.has(QUERY_PARAMS.QUERY)) {
|
|
9280
|
+
if (!params.has(QUERY_PARAMS.QUERY) && !props.initialData) {
|
|
9248
9281
|
handleUrlChange(params);
|
|
9249
9282
|
}
|
|
9250
9283
|
paramStore.add(parseParams(params));
|
|
9251
9284
|
paramStore.setDefaultLimit(defaultSearchResultPageSize.value);
|
|
9252
9285
|
};
|
|
9253
|
-
const handleCreated = () => {
|
|
9254
|
-
handleUrlChange();
|
|
9255
|
-
};
|
|
9256
9286
|
vue.watch(searchString, () => handleParamsChange());
|
|
9257
9287
|
const handleParamsChange = () => {
|
|
9258
9288
|
var _a, _b;
|
|
@@ -9262,6 +9292,13 @@ const _sfc_main$4 = /* @__PURE__ */ vue.defineComponent({
|
|
|
9262
9292
|
urlQueryString: searchString.value
|
|
9263
9293
|
});
|
|
9264
9294
|
};
|
|
9295
|
+
const handleCreated = () => {
|
|
9296
|
+
const initialData = props.initialData;
|
|
9297
|
+
if (initialData) {
|
|
9298
|
+
handleResults({ queryKey: props.options.queryKey, results: initialData });
|
|
9299
|
+
searchResultStore.add(__spreadValues({}, initialData));
|
|
9300
|
+
}
|
|
9301
|
+
};
|
|
9265
9302
|
handleCreated();
|
|
9266
9303
|
return (_ctx, _cache) => {
|
|
9267
9304
|
var _a, _b, _c, _d, _e;
|
|
@@ -15807,4 +15844,5 @@ exports.Recommendations = _sfc_main;
|
|
|
15807
15844
|
exports.SearchBox = _sfc_main$R;
|
|
15808
15845
|
exports.SearchContainer = _sfc_main$1;
|
|
15809
15846
|
exports.SearchResults = _sfc_main$4;
|
|
15847
|
+
exports.getInitialSearchResults = getInitialSearchResults;
|
|
15810
15848
|
exports.setupTracking = setupTracking;
|
package/dist/lupaSearch.mjs
CHANGED
|
@@ -4695,10 +4695,12 @@ const useSearchResultStore = defineStore("searchResult", () => {
|
|
|
4695
4695
|
pageSize: searchResult.value.limit || 0
|
|
4696
4696
|
};
|
|
4697
4697
|
}
|
|
4698
|
-
|
|
4699
|
-
(
|
|
4700
|
-
|
|
4701
|
-
|
|
4698
|
+
if (typeof document !== "undefined") {
|
|
4699
|
+
setDocumentTitle(
|
|
4700
|
+
(_b = (_a = optionsStore.searchResultOptions) == null ? void 0 : _a.labels) == null ? void 0 : _b.htmlTitleTemplate,
|
|
4701
|
+
newSearchResult.searchText
|
|
4702
|
+
);
|
|
4703
|
+
}
|
|
4702
4704
|
searchResult.value = newSearchResult;
|
|
4703
4705
|
return { searchResult: newSearchResult };
|
|
4704
4706
|
};
|
|
@@ -4812,6 +4814,35 @@ const getPublicQuery = (publicQuery, initialFilters, isProductList) => {
|
|
|
4812
4814
|
searchText: isProductList ? "" : publicQuery.searchText
|
|
4813
4815
|
});
|
|
4814
4816
|
};
|
|
4817
|
+
const getSearchParams = (url, params, baseUrl) => {
|
|
4818
|
+
let searchParams;
|
|
4819
|
+
if (typeof window !== "undefined") {
|
|
4820
|
+
searchParams = params || new URLSearchParams(window.location.search);
|
|
4821
|
+
} else {
|
|
4822
|
+
if (url) {
|
|
4823
|
+
searchParams = params || new URLSearchParams(new URL(url, baseUrl).search);
|
|
4824
|
+
} else {
|
|
4825
|
+
throw new Error("LupaSaerch: ssr.url is required on the server side");
|
|
4826
|
+
}
|
|
4827
|
+
}
|
|
4828
|
+
return searchParams;
|
|
4829
|
+
};
|
|
4830
|
+
const getInitialSearchResults = (options, defaultData) => __async(void 0, null, function* () {
|
|
4831
|
+
var _a, _b, _c;
|
|
4832
|
+
const searchParams = getSearchParams((_a = options.ssr) == null ? void 0 : _a.url, void 0, (_b = options.ssr) == null ? void 0 : _b.baseUrl);
|
|
4833
|
+
const publicQuery = createPublicQuery(
|
|
4834
|
+
parseParams(searchParams),
|
|
4835
|
+
options.sort,
|
|
4836
|
+
defaultData == null ? void 0 : defaultData.pageSize
|
|
4837
|
+
);
|
|
4838
|
+
const query = getPublicQuery(publicQuery, (_c = defaultData == null ? void 0 : defaultData.filters) != null ? _c : {}, false);
|
|
4839
|
+
try {
|
|
4840
|
+
const result = yield LupaSearchSdk.query(options.queryKey, query, options.options);
|
|
4841
|
+
return result;
|
|
4842
|
+
} catch (e) {
|
|
4843
|
+
options.options.onError(e);
|
|
4844
|
+
}
|
|
4845
|
+
});
|
|
4815
4846
|
const _hoisted_1$N = {
|
|
4816
4847
|
key: 0,
|
|
4817
4848
|
id: "lupa-search-results-did-you-mean"
|
|
@@ -9116,7 +9147,8 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
|
|
|
9116
9147
|
options: {},
|
|
9117
9148
|
initialFilters: {},
|
|
9118
9149
|
isProductList: { type: Boolean },
|
|
9119
|
-
isContainer: { type: Boolean }
|
|
9150
|
+
isContainer: { type: Boolean },
|
|
9151
|
+
initialData: {}
|
|
9120
9152
|
},
|
|
9121
9153
|
setup(__props) {
|
|
9122
9154
|
const props = __props;
|
|
@@ -9222,7 +9254,8 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
|
|
|
9222
9254
|
screenStore.setScreenWidth({ width: window.innerWidth });
|
|
9223
9255
|
};
|
|
9224
9256
|
const handleUrlChange = (params) => {
|
|
9225
|
-
|
|
9257
|
+
var _a;
|
|
9258
|
+
const searchParams = getSearchParams((_a = props.options.ssr) == null ? void 0 : _a.url, params);
|
|
9226
9259
|
const publicQuery = createPublicQuery(
|
|
9227
9260
|
parseParams(searchParams),
|
|
9228
9261
|
props.options.sort,
|
|
@@ -9242,15 +9275,12 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
|
|
|
9242
9275
|
}
|
|
9243
9276
|
}
|
|
9244
9277
|
const params = new URLSearchParams(window.location.search);
|
|
9245
|
-
if (!params.has(QUERY_PARAMS.QUERY)) {
|
|
9278
|
+
if (!params.has(QUERY_PARAMS.QUERY) && !props.initialData) {
|
|
9246
9279
|
handleUrlChange(params);
|
|
9247
9280
|
}
|
|
9248
9281
|
paramStore.add(parseParams(params));
|
|
9249
9282
|
paramStore.setDefaultLimit(defaultSearchResultPageSize.value);
|
|
9250
9283
|
};
|
|
9251
|
-
const handleCreated = () => {
|
|
9252
|
-
handleUrlChange();
|
|
9253
|
-
};
|
|
9254
9284
|
watch(searchString, () => handleParamsChange());
|
|
9255
9285
|
const handleParamsChange = () => {
|
|
9256
9286
|
var _a, _b;
|
|
@@ -9260,6 +9290,13 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
|
|
|
9260
9290
|
urlQueryString: searchString.value
|
|
9261
9291
|
});
|
|
9262
9292
|
};
|
|
9293
|
+
const handleCreated = () => {
|
|
9294
|
+
const initialData = props.initialData;
|
|
9295
|
+
if (initialData) {
|
|
9296
|
+
handleResults({ queryKey: props.options.queryKey, results: initialData });
|
|
9297
|
+
searchResultStore.add(__spreadValues({}, initialData));
|
|
9298
|
+
}
|
|
9299
|
+
};
|
|
9263
9300
|
handleCreated();
|
|
9264
9301
|
return (_ctx, _cache) => {
|
|
9265
9302
|
var _a, _b, _c, _d, _e;
|
|
@@ -15806,5 +15843,6 @@ export {
|
|
|
15806
15843
|
_sfc_main$R as SearchBox,
|
|
15807
15844
|
_sfc_main$1 as SearchContainer,
|
|
15808
15845
|
_sfc_main$4 as SearchResults,
|
|
15846
|
+
getInitialSearchResults,
|
|
15809
15847
|
setupTracking
|
|
15810
15848
|
};
|
|
@@ -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;
|
package/dist/src/index.d.ts
CHANGED
|
@@ -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 };
|
|
@@ -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 = {
|
|
@@ -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>;
|