@bridgeline-digital/hawksearch-handlebars-ui 5.2.6 → 5.2.7
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/changelog.md +3 -0
- package/dist/components/base.component.d.ts +139 -0
- package/dist/components/content/content-types/base-content.component.d.ts +9 -0
- package/dist/components/content/content-types/custom-content/custom-content.component.d.ts +21 -0
- package/dist/components/content/content-types/featured-items-content/featured-items-content.component.d.ts +22 -0
- package/dist/components/content/content-types/featured-items-content-item/featured-items-content-item.component.d.ts +39 -0
- package/dist/components/content/content-types/image-content/image-content.component.d.ts +22 -0
- package/dist/components/content/content-types/index.d.ts +6 -0
- package/dist/components/content/content-types/popular-queries-content/popular-queries-content.component.d.ts +22 -0
- package/dist/components/content/content-zone/content-zone.component.d.ts +44 -0
- package/dist/components/content/index.d.ts +2 -0
- package/dist/components/general/date-picker/date-picker.component.d.ts +117 -0
- package/dist/components/general/icon/icon.component.d.ts +38 -0
- package/dist/components/general/index.d.ts +5 -0
- package/dist/components/general/range-slider/range-slider.component.d.ts +54 -0
- package/dist/components/general/rating/rating.component.d.ts +39 -0
- package/dist/components/general/tooltip/tooltip.component.d.ts +32 -0
- package/dist/components/index.d.ts +231 -0
- package/dist/components/landing-pages/index.d.ts +1 -0
- package/dist/components/landing-pages/landing-page/landing-page.component.d.ts +32 -0
- package/dist/components/recommendations/index.d.ts +2 -0
- package/dist/components/recommendations/recommendations/recommendations.component.d.ts +87 -0
- package/dist/components/recommendations/recommendations-item/recommendations-item.component.d.ts +40 -0
- package/dist/components/search/autocomplete/autocomplete.component.d.ts +59 -0
- package/dist/components/search/facet-types/base-facet.component.d.ts +44 -0
- package/dist/components/search/facet-types/checkbox-list-facet/checkbox-list-facet.component.d.ts +36 -0
- package/dist/components/search/facet-types/color-facet/color-facet.component.d.ts +24 -0
- package/dist/components/search/facet-types/date-range-facet/date-range-facet.component.d.ts +33 -0
- package/dist/components/search/facet-types/index.d.ts +11 -0
- package/dist/components/search/facet-types/linked-list-facet/link-list-facet.component.d.ts +24 -0
- package/dist/components/search/facet-types/numeric-range-facet/numeric-range-facet.component.d.ts +32 -0
- package/dist/components/search/facet-types/range-slider-facet/range-slider-facet.component.d.ts +34 -0
- package/dist/components/search/facet-types/recent-searches-facet/recent-searches-facet.component.d.ts +29 -0
- package/dist/components/search/facet-types/related-searches-facet/related-searches-facet.component.d.ts +29 -0
- package/dist/components/search/facet-types/search-within-facet/search-within-facet.component.d.ts +29 -0
- package/dist/components/search/facet-types/size-facet/size-facet.component.d.ts +24 -0
- package/dist/components/search/facet-wrapper/facet-wrapper.component.d.ts +47 -0
- package/dist/components/search/facets-list/facets-list.component.d.ts +32 -0
- package/dist/components/search/index.d.ts +15 -0
- package/dist/components/search/modified-query/modified-query.component.d.ts +32 -0
- package/dist/components/search/page-size/page-size.component.d.ts +32 -0
- package/dist/components/search/pagination/pagination.component.d.ts +43 -0
- package/dist/components/search/query-suggestions/query-suggestions.component.d.ts +38 -0
- package/dist/components/search/search-field/search-field.component.d.ts +40 -0
- package/dist/components/search/search-results/search-results.component.d.ts +34 -0
- package/dist/components/search/search-results-item/search-results-item.component.d.ts +38 -0
- package/dist/components/search/search-results-list/search-results-list.component.d.ts +23 -0
- package/dist/components/search/selected-facets/selected-facets.component.d.ts +31 -0
- package/dist/components/search/sorting/sorting.component.d.ts +30 -0
- package/dist/components/search/tabs/dist/tabs.component.spec.d.ts +1 -0
- package/dist/components/search/tabs/tabs.component.d.ts +30 -0
- package/dist/components/variants/index.d.ts +1 -0
- package/dist/components/variants/variant-selector/variant-selector.component.d.ts +23 -0
- package/dist/configuration/configuration.models.d.ts +609 -0
- package/dist/configuration/index.d.ts +4 -0
- package/dist/helpers/helpers.d.ts +221 -0
- package/dist/helpers/index.d.ts +4 -0
- package/dist/index.d.ts +1 -1438
- package/dist/index.js +3 -0
- package/dist/index.js.LICENSE.txt +28 -0
- package/dist/index.js.map +1 -0
- package/dist/models/autocomplete.models.d.ts +85 -0
- package/dist/models/base.models.d.ts +50 -0
- package/dist/models/component.models.d.ts +453 -0
- package/dist/models/content.models.d.ts +94 -0
- package/dist/models/index.d.ts +11 -0
- package/dist/models/raw/index.d.ts +4 -0
- package/dist/models/raw/raw-autocomplete.models.d.ts +51 -0
- package/dist/models/raw/raw-base.models.d.ts +8 -0
- package/dist/models/raw/raw-recommendation.models.d.ts +39 -0
- package/dist/models/raw/raw-search.models.d.ts +191 -0
- package/dist/models/recommendation.models.d.ts +31 -0
- package/dist/models/search.models.d.ts +237 -0
- package/dist/models/tracking.models.d.ts +42 -0
- package/dist/placeholder.c99b7374b9bf579d0fd0.png +0 -0
- package/dist/services/autocomplete.service.d.ts +11 -0
- package/dist/services/base.service.d.ts +63 -0
- package/dist/services/index.d.ts +8 -0
- package/dist/services/recommendations.service.d.ts +10 -0
- package/dist/services/search.service.d.ts +53 -0
- package/dist/services/tracking.service.d.ts +29 -0
- package/dist/styles.65c0ab8e75ac4bcab10e99f66a160664.css +1 -0
- package/dist/utilities/colors.d.ts +1 -0
- package/dist/utilities/dates.d.ts +4 -0
- package/dist/utilities/decodes.d.ts +1 -0
- package/dist/utilities/formatters.d.ts +4 -0
- package/dist/utilities/index.d.ts +7 -0
- package/package.json +1 -1
- package/dist/hawksearch-handlebars-ui.cjs +0 -10
- package/dist/hawksearch-handlebars-ui.js +0 -11623
- package/dist/hawksearch-handlebars-ui.min.js +0 -975
- package/dist/hawksearch-handlebars-ui.umd.cjs +0 -10
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { BaseComponent } from '@components';
|
|
2
|
+
import { HawkSearchComponents, VariantSelectorComponentConfig } from '@configuration';
|
|
3
|
+
import { VariantSelectorComponentModel, Variants } from '@models';
|
|
4
|
+
/**
|
|
5
|
+
* The Variant Selector component is used to select a single variant within an item.
|
|
6
|
+
*
|
|
7
|
+
* ## Tag
|
|
8
|
+
* The tag for this component is `<hawksearch-variant-selector>`.
|
|
9
|
+
*
|
|
10
|
+
* ## Default Template
|
|
11
|
+
* The following is the default Handlebars template for this component. To create a custom template, it is recommended to use this as a starting point.
|
|
12
|
+
* {@embed ./variant-selector.component.hbs}
|
|
13
|
+
*
|
|
14
|
+
* @category Variants
|
|
15
|
+
*/
|
|
16
|
+
export declare class VariantSelectorComponent extends BaseComponent<VariantSelectorComponentConfig, Variants, VariantSelectorComponentModel> {
|
|
17
|
+
protected componentName: keyof HawkSearchComponents;
|
|
18
|
+
protected defaultHtml: any;
|
|
19
|
+
protected bindFromEvent: boolean;
|
|
20
|
+
protected renderContent(): boolean;
|
|
21
|
+
protected getContentModel(): VariantSelectorComponentModel;
|
|
22
|
+
protected onRender(): void;
|
|
23
|
+
}
|
|
@@ -0,0 +1,609 @@
|
|
|
1
|
+
import * as Handlebars from 'handlebars';
|
|
2
|
+
import { ItemType, RecommendationsResponse, SearchRequest, SearchResponse } from '@models';
|
|
3
|
+
import { AutocompleteService, RecommendationsService, SearchService, TrackingService } from '../services';
|
|
4
|
+
export interface BaseComponentConfig {
|
|
5
|
+
/**
|
|
6
|
+
* Specifies whether the component should be rendered in the [Shadow DOM](https://developer.mozilla.org/en-US/docs/Web/Web_Components/Using_shadow_DOM). This is highly recommended to avoid CSS conflicts.
|
|
7
|
+
*
|
|
8
|
+
* #### Default Value
|
|
9
|
+
* `true`
|
|
10
|
+
*/
|
|
11
|
+
shadowDom?: boolean;
|
|
12
|
+
/**
|
|
13
|
+
* Specifies a custom template to be used instead of the default template.
|
|
14
|
+
*
|
|
15
|
+
* *For more information, see {@link Components}.*
|
|
16
|
+
*/
|
|
17
|
+
template?: string;
|
|
18
|
+
}
|
|
19
|
+
export interface AutocompleteComponentConfig extends BaseComponentConfig {
|
|
20
|
+
}
|
|
21
|
+
export interface CheckboxListFacetComponentConfig extends BaseComponentConfig {
|
|
22
|
+
excludeEnabled?: boolean;
|
|
23
|
+
strings?: {
|
|
24
|
+
collapse?: string;
|
|
25
|
+
exclude?: string;
|
|
26
|
+
expand?: string;
|
|
27
|
+
include?: string;
|
|
28
|
+
showFewer?: string;
|
|
29
|
+
showMore?: string;
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
export interface ColorFacetComponentConfig extends BaseComponentConfig {
|
|
33
|
+
excludeEnabled?: boolean;
|
|
34
|
+
strings?: {
|
|
35
|
+
exclude?: string;
|
|
36
|
+
include?: string;
|
|
37
|
+
showFewer?: string;
|
|
38
|
+
showMore?: string;
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
export interface ContentZoneComponentConfig extends BaseComponentConfig {
|
|
42
|
+
}
|
|
43
|
+
export interface CustomContentComponentConfig extends BaseComponentConfig {
|
|
44
|
+
}
|
|
45
|
+
export interface DatePickerComponentConfig extends BaseComponentConfig {
|
|
46
|
+
strings?: {
|
|
47
|
+
defaultLabel?: string;
|
|
48
|
+
next?: string;
|
|
49
|
+
previous?: string;
|
|
50
|
+
selectMonth?: string;
|
|
51
|
+
viewCalendar?: string;
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
export interface DateRangeFacetComponentConfig extends BaseComponentConfig {
|
|
55
|
+
strings?: {
|
|
56
|
+
endDate?: string;
|
|
57
|
+
startDate?: string;
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
export interface FacetsListComponentConfig extends BaseComponentConfig {
|
|
61
|
+
strings?: {
|
|
62
|
+
heading?: string;
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
export interface FacetWrapperComponentConfig extends BaseComponentConfig {
|
|
66
|
+
}
|
|
67
|
+
export interface FeaturedItemsContentComponentConfig extends BaseComponentConfig {
|
|
68
|
+
}
|
|
69
|
+
export interface FeaturedItemsContentItemComponentConfig extends BaseComponentConfig {
|
|
70
|
+
strings?: {
|
|
71
|
+
sale?: string;
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
export interface IconComponentConfig extends BaseComponentConfig {
|
|
75
|
+
}
|
|
76
|
+
export interface ImageContentComponentConfig extends BaseComponentConfig {
|
|
77
|
+
}
|
|
78
|
+
export interface LandingPageComponentConfig extends BaseComponentConfig {
|
|
79
|
+
}
|
|
80
|
+
export interface LinkListFacetComponentConfig extends BaseComponentConfig {
|
|
81
|
+
strings?: {
|
|
82
|
+
showFewer?: string;
|
|
83
|
+
showMore?: string;
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
export interface ModifiedQueryComponentConfig extends BaseComponentConfig {
|
|
87
|
+
strings?: {
|
|
88
|
+
showingResultsFor?: string;
|
|
89
|
+
searchInsteadFor?: string;
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
export interface NumericRangeFacetComponentConfig extends BaseComponentConfig {
|
|
93
|
+
strings?: {
|
|
94
|
+
maximum?: string;
|
|
95
|
+
minimum?: string;
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
export interface PageSizeComponentConfig extends BaseComponentConfig {
|
|
99
|
+
}
|
|
100
|
+
export interface PaginationComponentConfig extends BaseComponentConfig {
|
|
101
|
+
strings?: {
|
|
102
|
+
first?: string;
|
|
103
|
+
last?: string;
|
|
104
|
+
next?: string;
|
|
105
|
+
previous?: string;
|
|
106
|
+
summary?: string;
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
export interface PopularQueriesContentComponentConfig extends BaseComponentConfig {
|
|
110
|
+
}
|
|
111
|
+
export interface QuerySuggestionsComponentConfig extends BaseComponentConfig {
|
|
112
|
+
strings?: {
|
|
113
|
+
orDelimeter?: string;
|
|
114
|
+
prompt?: string;
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
export interface RangeSliderComponentConfig extends BaseComponentConfig {
|
|
118
|
+
strings?: {
|
|
119
|
+
end?: string;
|
|
120
|
+
start?: string;
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
export interface RangeSliderFacetComponentConfig extends BaseComponentConfig {
|
|
124
|
+
strings?: {
|
|
125
|
+
maximum?: string;
|
|
126
|
+
minimum?: string;
|
|
127
|
+
};
|
|
128
|
+
}
|
|
129
|
+
export interface RatingComponentConfig extends BaseComponentConfig {
|
|
130
|
+
}
|
|
131
|
+
export interface RecentSearchesFacetComponentConfig extends BaseComponentConfig {
|
|
132
|
+
}
|
|
133
|
+
export interface RecommendationsItemComponentConfig extends BaseComponentConfig {
|
|
134
|
+
strings?: {
|
|
135
|
+
sale?: string;
|
|
136
|
+
};
|
|
137
|
+
}
|
|
138
|
+
export interface RecommendationsComponentConfig extends BaseComponentConfig {
|
|
139
|
+
carousel?: {
|
|
140
|
+
autorotation?: {
|
|
141
|
+
enabled?: boolean;
|
|
142
|
+
interval?: number;
|
|
143
|
+
};
|
|
144
|
+
buttonsEnabled?: boolean;
|
|
145
|
+
enabled?: boolean;
|
|
146
|
+
paginationEnabled?: boolean;
|
|
147
|
+
paginationSelectedCssClass?: string;
|
|
148
|
+
};
|
|
149
|
+
headingEnabled?: boolean;
|
|
150
|
+
itemsToDisplay?: Breakpoints<number>;
|
|
151
|
+
strings?: {
|
|
152
|
+
next?: string;
|
|
153
|
+
previous?: string;
|
|
154
|
+
};
|
|
155
|
+
}
|
|
156
|
+
export interface RelatedSearchesFacetComponentConfig extends BaseComponentConfig {
|
|
157
|
+
}
|
|
158
|
+
export interface SearchFieldComponentConfig extends BaseComponentConfig {
|
|
159
|
+
strings?: {
|
|
160
|
+
placeholder?: string;
|
|
161
|
+
};
|
|
162
|
+
/**
|
|
163
|
+
* Specifies whether the input element should be pre-populared if "query" parameter exists on the URL.
|
|
164
|
+
*
|
|
165
|
+
* #### Default Value
|
|
166
|
+
* `false`
|
|
167
|
+
*/
|
|
168
|
+
disableAutofill?: boolean;
|
|
169
|
+
}
|
|
170
|
+
export interface SearchResultsComponentConfig extends BaseComponentConfig {
|
|
171
|
+
}
|
|
172
|
+
export interface SearchResultsItemComponentConfig extends BaseComponentConfig {
|
|
173
|
+
strings?: {
|
|
174
|
+
sale?: string;
|
|
175
|
+
};
|
|
176
|
+
}
|
|
177
|
+
export interface SearchResultsListComponentConfig extends BaseComponentConfig {
|
|
178
|
+
}
|
|
179
|
+
export interface SearchWithinFacetComponentConfig extends BaseComponentConfig {
|
|
180
|
+
strings?: {
|
|
181
|
+
label?: string;
|
|
182
|
+
};
|
|
183
|
+
}
|
|
184
|
+
export interface SelectedFacetsComponentConfig extends BaseComponentConfig {
|
|
185
|
+
strings?: {
|
|
186
|
+
remove?: string;
|
|
187
|
+
};
|
|
188
|
+
}
|
|
189
|
+
export interface SizeFacetComponentConfig extends BaseComponentConfig {
|
|
190
|
+
excludeEnabled?: boolean;
|
|
191
|
+
strings?: {
|
|
192
|
+
exclude?: string;
|
|
193
|
+
include?: string;
|
|
194
|
+
showFewer?: string;
|
|
195
|
+
showMore?: string;
|
|
196
|
+
};
|
|
197
|
+
}
|
|
198
|
+
export interface SortingComponentConfig extends BaseComponentConfig {
|
|
199
|
+
}
|
|
200
|
+
export interface TabsComponentConfig extends BaseComponentConfig {
|
|
201
|
+
}
|
|
202
|
+
export interface TooltipComponentConfig extends BaseComponentConfig {
|
|
203
|
+
}
|
|
204
|
+
export interface VariantSelectorComponentConfig extends BaseComponentConfig {
|
|
205
|
+
}
|
|
206
|
+
export interface HawkSearchComponents {
|
|
207
|
+
'autocomplete'?: AutocompleteComponentConfig;
|
|
208
|
+
'checkbox-list-facet'?: CheckboxListFacetComponentConfig;
|
|
209
|
+
'color-facet'?: ColorFacetComponentConfig;
|
|
210
|
+
'content-zone'?: ContentZoneComponentConfig;
|
|
211
|
+
'custom-content'?: CustomContentComponentConfig;
|
|
212
|
+
'date-picker'?: DatePickerComponentConfig;
|
|
213
|
+
'date-range-facet'?: DateRangeFacetComponentConfig;
|
|
214
|
+
'facet-wrapper'?: FacetWrapperComponentConfig;
|
|
215
|
+
'facets-list'?: FacetsListComponentConfig;
|
|
216
|
+
'featured-items-content'?: FeaturedItemsContentComponentConfig;
|
|
217
|
+
'featured-items-content-item'?: FeaturedItemsContentItemComponentConfig;
|
|
218
|
+
'icon'?: IconComponentConfig;
|
|
219
|
+
'image-content'?: ImageContentComponentConfig;
|
|
220
|
+
'landing-page'?: LandingPageComponentConfig;
|
|
221
|
+
'link-list-facet'?: LinkListFacetComponentConfig;
|
|
222
|
+
'modified-query'?: ModifiedQueryComponentConfig;
|
|
223
|
+
'numeric-range-facet'?: NumericRangeFacetComponentConfig;
|
|
224
|
+
'page-size'?: PageSizeComponentConfig;
|
|
225
|
+
'pagination'?: PaginationComponentConfig;
|
|
226
|
+
'popular-queries-content'?: PopularQueriesContentComponentConfig;
|
|
227
|
+
'query-suggestions'?: QuerySuggestionsComponentConfig;
|
|
228
|
+
'range-slider'?: RangeSliderComponentConfig;
|
|
229
|
+
'range-slider-facet'?: RangeSliderFacetComponentConfig;
|
|
230
|
+
'rating'?: RatingComponentConfig;
|
|
231
|
+
'recommendations'?: RecommendationsComponentConfig;
|
|
232
|
+
'recommendations-item'?: RecommendationsItemComponentConfig;
|
|
233
|
+
'recent-searches-facet'?: RecentSearchesFacetComponentConfig;
|
|
234
|
+
'related-searches-facet'?: RelatedSearchesFacetComponentConfig;
|
|
235
|
+
'search-field'?: SearchFieldComponentConfig;
|
|
236
|
+
'search-results'?: SearchResultsComponentConfig;
|
|
237
|
+
'search-results-item'?: SearchResultsItemComponentConfig;
|
|
238
|
+
'search-results-list'?: SearchResultsListComponentConfig;
|
|
239
|
+
'search-within-facet'?: SearchWithinFacetComponentConfig;
|
|
240
|
+
'selected-facets'?: SelectedFacetsComponentConfig;
|
|
241
|
+
'size-facet'?: SizeFacetComponentConfig;
|
|
242
|
+
'sorting'?: SortingComponentConfig;
|
|
243
|
+
'tabs'?: TabsComponentConfig;
|
|
244
|
+
'tooltip'?: TooltipComponentConfig;
|
|
245
|
+
'variant-selector'?: VariantSelectorComponentConfig;
|
|
246
|
+
}
|
|
247
|
+
export type DisplayType = 'mobile' | 'tablet' | 'desktop';
|
|
248
|
+
export interface Breakpoints<TValue> extends Record<DisplayType, TValue> {
|
|
249
|
+
}
|
|
250
|
+
export interface FieldMappings {
|
|
251
|
+
/**
|
|
252
|
+
* #### Default Value
|
|
253
|
+
* `['description', 'longdescription']`
|
|
254
|
+
*/
|
|
255
|
+
description?: string | Array<string>;
|
|
256
|
+
/**
|
|
257
|
+
* #### Default Value
|
|
258
|
+
* `['imageurl', 'image']`
|
|
259
|
+
*/
|
|
260
|
+
imageUrl?: string | Array<string>;
|
|
261
|
+
/**
|
|
262
|
+
* #### Default Value
|
|
263
|
+
* `'price'`
|
|
264
|
+
*/
|
|
265
|
+
price?: string | Array<string>;
|
|
266
|
+
/**
|
|
267
|
+
* #### Default Value
|
|
268
|
+
* `'rating'`
|
|
269
|
+
*/
|
|
270
|
+
rating?: string | Array<string>;
|
|
271
|
+
/**
|
|
272
|
+
* #### Default Value
|
|
273
|
+
* `['saleprice']`
|
|
274
|
+
*/
|
|
275
|
+
salePrice?: string | Array<string>;
|
|
276
|
+
/**
|
|
277
|
+
* #### Default Value
|
|
278
|
+
* `['sku']`
|
|
279
|
+
*/
|
|
280
|
+
sku?: string | Array<string>;
|
|
281
|
+
/**
|
|
282
|
+
* #### Default Value
|
|
283
|
+
* `['title', 'name', 'itemname']`
|
|
284
|
+
*/
|
|
285
|
+
title?: string | Array<string>;
|
|
286
|
+
/**
|
|
287
|
+
* #### Default Value
|
|
288
|
+
* `'type'`
|
|
289
|
+
*/
|
|
290
|
+
type?: string | Array<string>;
|
|
291
|
+
/**
|
|
292
|
+
* #### Default Value
|
|
293
|
+
* `'url'`
|
|
294
|
+
*/
|
|
295
|
+
url?: string;
|
|
296
|
+
}
|
|
297
|
+
export interface VariantFieldMappings extends FieldMappings {
|
|
298
|
+
/**
|
|
299
|
+
* #### Default Value
|
|
300
|
+
* `['id']`
|
|
301
|
+
*/
|
|
302
|
+
id?: string | Array<string>;
|
|
303
|
+
color?: {
|
|
304
|
+
/**
|
|
305
|
+
* #### Default Value
|
|
306
|
+
* `['colorname', 'color']`
|
|
307
|
+
*/
|
|
308
|
+
name?: string | Array<string>;
|
|
309
|
+
/**
|
|
310
|
+
* #### Default Value
|
|
311
|
+
* `['colorhex', 'colorvalue']`
|
|
312
|
+
*/
|
|
313
|
+
hex?: string | Array<string>;
|
|
314
|
+
/**
|
|
315
|
+
* #### Default Value
|
|
316
|
+
* `['colorimageurl', 'colorimage']`
|
|
317
|
+
*/
|
|
318
|
+
imageUrl?: string | Array<string>;
|
|
319
|
+
};
|
|
320
|
+
}
|
|
321
|
+
export interface HawkSearchConfig {
|
|
322
|
+
/**
|
|
323
|
+
* The unique ID for your installation found in the HawkSearch admin
|
|
324
|
+
*/
|
|
325
|
+
clientId: string;
|
|
326
|
+
/**
|
|
327
|
+
* Specify an index to query rather than the default
|
|
328
|
+
*/
|
|
329
|
+
index?: string;
|
|
330
|
+
/**
|
|
331
|
+
* Map item attributes to common object properties
|
|
332
|
+
*/
|
|
333
|
+
fieldMappings?: FieldMappings;
|
|
334
|
+
autocomplete?: {
|
|
335
|
+
/**
|
|
336
|
+
* The API used to retrieve search results
|
|
337
|
+
*
|
|
338
|
+
* #### Default Value
|
|
339
|
+
* `'https://searchapi-dev.hawksearch.net'`
|
|
340
|
+
*/
|
|
341
|
+
endpointUrl?: string;
|
|
342
|
+
/**
|
|
343
|
+
* Specifies whether autocomplete recommendations (autocomplete without entering a query - "instant engage") is enabled
|
|
344
|
+
*
|
|
345
|
+
* #### Default Value
|
|
346
|
+
* `false`
|
|
347
|
+
*/
|
|
348
|
+
recommendationsEnabled?: boolean;
|
|
349
|
+
/**
|
|
350
|
+
* Whether to automatically URI decode the search query value. Runs recursively until value is fully decoded. For example, `Test%2520Value` would become `Test Value`.
|
|
351
|
+
*
|
|
352
|
+
* #### Default Value
|
|
353
|
+
* `true`
|
|
354
|
+
*/
|
|
355
|
+
decodeQuery?: boolean;
|
|
356
|
+
/**
|
|
357
|
+
* Specifies the minimum length for a query to trigger an autocomplete recommendations request
|
|
358
|
+
*
|
|
359
|
+
* #### Default Value
|
|
360
|
+
* `1`
|
|
361
|
+
*/
|
|
362
|
+
minCharacterCount?: number;
|
|
363
|
+
};
|
|
364
|
+
search?: {
|
|
365
|
+
/**
|
|
366
|
+
* The API used to retrieve search results
|
|
367
|
+
*
|
|
368
|
+
* #### Default Value
|
|
369
|
+
* `'https://searchapi-dev.hawksearch.net'`
|
|
370
|
+
*/
|
|
371
|
+
endpointUrl?: string;
|
|
372
|
+
/**
|
|
373
|
+
* The URL of your search results page. This is used to redirect users after performing a search.
|
|
374
|
+
*
|
|
375
|
+
* #### Default Value
|
|
376
|
+
* `'/search'`
|
|
377
|
+
*/
|
|
378
|
+
url?: string;
|
|
379
|
+
/**
|
|
380
|
+
* The prefix for values sent to the API when excluding a facet. This is only modified in rare circumstances where the project has facet values starting with a hyphen.
|
|
381
|
+
*
|
|
382
|
+
* #### Default Value
|
|
383
|
+
* `'-'`
|
|
384
|
+
*/
|
|
385
|
+
facetExclusionPrefix?: string;
|
|
386
|
+
/**
|
|
387
|
+
* Specifies how search results should be classified
|
|
388
|
+
*/
|
|
389
|
+
itemTypes?: {
|
|
390
|
+
/**
|
|
391
|
+
* If the value a search result item is missing a value for the field mapped to {@link HawkSearchConfig.search | fieldMappings.type}, this value will be assumed.
|
|
392
|
+
*
|
|
393
|
+
* #### Default Value
|
|
394
|
+
* `'content'`
|
|
395
|
+
*/
|
|
396
|
+
default: ItemType;
|
|
397
|
+
/**
|
|
398
|
+
* List of values that will be considered a `product` result.
|
|
399
|
+
*
|
|
400
|
+
* #### Default Value
|
|
401
|
+
* `['item', 'product']`
|
|
402
|
+
*/
|
|
403
|
+
productValues?: Array<string>;
|
|
404
|
+
};
|
|
405
|
+
/**
|
|
406
|
+
* Specifies which query string parameters are used
|
|
407
|
+
*/
|
|
408
|
+
queryStringMappings?: {
|
|
409
|
+
/**
|
|
410
|
+
* #### Default Value
|
|
411
|
+
* `'disableSpellcheck'`
|
|
412
|
+
*/
|
|
413
|
+
disableSpellcheck?: string;
|
|
414
|
+
/**
|
|
415
|
+
* #### Default Value
|
|
416
|
+
* `'page'`
|
|
417
|
+
*/
|
|
418
|
+
page?: string;
|
|
419
|
+
/**
|
|
420
|
+
* #### Default Value
|
|
421
|
+
* `'pageSize'`
|
|
422
|
+
*/
|
|
423
|
+
pageSize?: string;
|
|
424
|
+
/**
|
|
425
|
+
* #### Default Value
|
|
426
|
+
* `'query'`
|
|
427
|
+
*/
|
|
428
|
+
query?: string;
|
|
429
|
+
/**
|
|
430
|
+
* #### Default Value
|
|
431
|
+
* `'searchWithin'`
|
|
432
|
+
*/
|
|
433
|
+
searchWithin?: string;
|
|
434
|
+
/**
|
|
435
|
+
* #### Default Value
|
|
436
|
+
* `'sort'`
|
|
437
|
+
*/
|
|
438
|
+
sort?: string;
|
|
439
|
+
};
|
|
440
|
+
/**
|
|
441
|
+
* Whether to automatically URI decode the search query value. Runs recursively until value is fully decoded. For example, `Test%2520Value` would become `Test Value`.
|
|
442
|
+
*
|
|
443
|
+
* #### Default Value
|
|
444
|
+
* `true`
|
|
445
|
+
*/
|
|
446
|
+
decodeQuery?: boolean;
|
|
447
|
+
/**
|
|
448
|
+
* Whether to automatically URI decode facet selection values. Runs recursively until value is fully decoded. For example, `Test%2520Value` would become `Test Value`.
|
|
449
|
+
*
|
|
450
|
+
* #### Default Value
|
|
451
|
+
* `true`
|
|
452
|
+
*/
|
|
453
|
+
decodeFacetValues?: boolean;
|
|
454
|
+
};
|
|
455
|
+
recommendations?: {
|
|
456
|
+
/**
|
|
457
|
+
* The API used to retrieve product recommendations
|
|
458
|
+
*
|
|
459
|
+
* #### Default Value
|
|
460
|
+
* `'https://recs-dev.hawksearch.net'`
|
|
461
|
+
*/
|
|
462
|
+
endpointUrl?: string;
|
|
463
|
+
};
|
|
464
|
+
tracking?: {
|
|
465
|
+
/**
|
|
466
|
+
* Specifies whether user actions should be tracked to provide valuable insights on your search engine performance
|
|
467
|
+
*
|
|
468
|
+
* #### Default Value
|
|
469
|
+
*
|
|
470
|
+
* `true`
|
|
471
|
+
*/
|
|
472
|
+
enabled?: boolean;
|
|
473
|
+
/**
|
|
474
|
+
* The API used to track user interactions
|
|
475
|
+
*
|
|
476
|
+
* #### Default Value
|
|
477
|
+
* `'https://tracking-dev.hawksearch.net'`
|
|
478
|
+
*/
|
|
479
|
+
endpointUrl?: string;
|
|
480
|
+
};
|
|
481
|
+
variants?: {
|
|
482
|
+
/**
|
|
483
|
+
* When `true`, specifies that facet counts should be calculated based on the number of child items rather than the number of parent items
|
|
484
|
+
*
|
|
485
|
+
* #### Default Value
|
|
486
|
+
*
|
|
487
|
+
* `false`
|
|
488
|
+
*/
|
|
489
|
+
baseFacetCountOnVariants?: boolean;
|
|
490
|
+
/**
|
|
491
|
+
* Specifies whether variant logic should be used if data is available
|
|
492
|
+
*
|
|
493
|
+
* #### Default Value
|
|
494
|
+
*
|
|
495
|
+
* `true`
|
|
496
|
+
*/
|
|
497
|
+
enabled?: boolean;
|
|
498
|
+
/**
|
|
499
|
+
* When specified, this prefix is removed from the `attributes` collection on variant items. For example, if a value of `'child_'` is used and HawkSearch returns a field named `'child_color'`, it will be transformed to `'color'`.
|
|
500
|
+
*/
|
|
501
|
+
fieldPrefix?: string;
|
|
502
|
+
/**
|
|
503
|
+
* Map item attributes to common object properties
|
|
504
|
+
*/
|
|
505
|
+
fieldMappings?: VariantFieldMappings;
|
|
506
|
+
/**
|
|
507
|
+
* When `true`, specifies that tracking should use the ID of the selected variant rather than the ID of the parent
|
|
508
|
+
*
|
|
509
|
+
* #### Default Value
|
|
510
|
+
*
|
|
511
|
+
* `false`
|
|
512
|
+
*/
|
|
513
|
+
trackUsingVariant?: boolean;
|
|
514
|
+
};
|
|
515
|
+
/**
|
|
516
|
+
* Specifies the minimum window widths that correspond to each breakpoint. This is used determine when certain content items are displayed.
|
|
517
|
+
*
|
|
518
|
+
* #### Default Value
|
|
519
|
+
* ```js
|
|
520
|
+
* {
|
|
521
|
+
* mobile: undefined,
|
|
522
|
+
* tablet: 740,
|
|
523
|
+
* desktop: 990
|
|
524
|
+
* }
|
|
525
|
+
* ```
|
|
526
|
+
*/
|
|
527
|
+
breakpoints?: Breakpoints<number>;
|
|
528
|
+
/**
|
|
529
|
+
* Specifies component-specific configuration options
|
|
530
|
+
*/
|
|
531
|
+
components?: HawkSearchComponents;
|
|
532
|
+
/**
|
|
533
|
+
* Specifies which styles should be loaded for each component
|
|
534
|
+
*/
|
|
535
|
+
css?: {
|
|
536
|
+
/**
|
|
537
|
+
* One or more style sets to be loaded. This can be either a URL to an external stylesheet, the ID of a `template` element wrapping around a `style` element, or a string containing CSS rules.
|
|
538
|
+
*/
|
|
539
|
+
customStyles?: string | Array<string>;
|
|
540
|
+
/**
|
|
541
|
+
* Specifies whether the default stylesheet should be loaded. This should generally be true except for with completely custom interfaces.
|
|
542
|
+
*/
|
|
543
|
+
defaultStyles?: boolean;
|
|
544
|
+
};
|
|
545
|
+
/**
|
|
546
|
+
* Specifies how values should be formatted for different cultures
|
|
547
|
+
*/
|
|
548
|
+
formatting?: {
|
|
549
|
+
/**
|
|
550
|
+
* #### Default Value
|
|
551
|
+
* `'en-US'`
|
|
552
|
+
*/
|
|
553
|
+
cultureIsoCode?: string;
|
|
554
|
+
/**
|
|
555
|
+
* #### Default Value
|
|
556
|
+
* `'USD'`
|
|
557
|
+
*/
|
|
558
|
+
currencyIsoCode?: string;
|
|
559
|
+
};
|
|
560
|
+
/**
|
|
561
|
+
* The URL of an image to be loaded whenever an image fails to load for a search result item
|
|
562
|
+
*/
|
|
563
|
+
placeholderImageUrl?: string;
|
|
564
|
+
seo?: {
|
|
565
|
+
title?: {
|
|
566
|
+
/**
|
|
567
|
+
* Value prepended to title returned from API
|
|
568
|
+
*/
|
|
569
|
+
prefix?: string;
|
|
570
|
+
/**
|
|
571
|
+
* Value appended to title returned from API
|
|
572
|
+
*/
|
|
573
|
+
suffix?: string;
|
|
574
|
+
};
|
|
575
|
+
};
|
|
576
|
+
/**
|
|
577
|
+
* Specifies whether components should be rendered in the [Shadow DOM](https://developer.mozilla.org/en-US/docs/Web/Web_Components/Using_shadow_DOM). This is highly recommended to avoid CSS conflicts.
|
|
578
|
+
*
|
|
579
|
+
* #### Default Value
|
|
580
|
+
* `true`
|
|
581
|
+
*/
|
|
582
|
+
shadowDom?: boolean;
|
|
583
|
+
/**
|
|
584
|
+
* If your data contains relative URLs, these values can be prepended to the values to convert them to absolute URLs
|
|
585
|
+
*/
|
|
586
|
+
urlPrefixes?: {
|
|
587
|
+
assets?: string;
|
|
588
|
+
content?: string;
|
|
589
|
+
};
|
|
590
|
+
}
|
|
591
|
+
export interface HawkSearchGlobal {
|
|
592
|
+
config: HawkSearchConfig;
|
|
593
|
+
handlebars: typeof Handlebars;
|
|
594
|
+
recommendationsResponses?: {
|
|
595
|
+
[widgetId: string]: RecommendationsResponse;
|
|
596
|
+
};
|
|
597
|
+
searchRequest?: SearchRequest;
|
|
598
|
+
searchResponse?: SearchResponse;
|
|
599
|
+
services?: {
|
|
600
|
+
autocomplete: AutocompleteService;
|
|
601
|
+
recommendations: RecommendationsService;
|
|
602
|
+
search: SearchService;
|
|
603
|
+
tracking: TrackingService;
|
|
604
|
+
};
|
|
605
|
+
}
|
|
606
|
+
export interface HawkSearchState {
|
|
607
|
+
searchRequest?: SearchRequest;
|
|
608
|
+
searchResponse: SearchResponse;
|
|
609
|
+
}
|