@bridgeline-digital/hawksearch-handlebars-ui 5.0.0 → 5.0.4

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.
Files changed (84) hide show
  1. package/changelog.md +106 -102
  2. package/dist/components/base.component.d.ts +139 -139
  3. package/dist/components/content/content-types/base-content.component.d.ts +9 -9
  4. package/dist/components/content/content-types/custom-content/custom-content.component.d.ts +21 -21
  5. package/dist/components/content/content-types/featured-items-content/featured-items-content.component.d.ts +22 -22
  6. package/dist/components/content/content-types/featured-items-content-item/featured-items-content-item.component.d.ts +39 -39
  7. package/dist/components/content/content-types/image-content/image-content.component.d.ts +22 -22
  8. package/dist/components/content/content-types/index.d.ts +6 -6
  9. package/dist/components/content/content-types/popular-queries-content/popular-queries-content.component.d.ts +22 -22
  10. package/dist/components/content/content-zone/content-zone.component.d.ts +44 -44
  11. package/dist/components/content/index.d.ts +2 -2
  12. package/dist/components/general/date-picker/date-picker.component.d.ts +117 -117
  13. package/dist/components/general/icon/icon.component.d.ts +38 -38
  14. package/dist/components/general/index.d.ts +5 -5
  15. package/dist/components/general/range-slider/range-slider.component.d.ts +54 -54
  16. package/dist/components/general/rating/rating.component.d.ts +39 -39
  17. package/dist/components/general/tooltip/tooltip.component.d.ts +32 -32
  18. package/dist/components/index.d.ts +229 -229
  19. package/dist/components/landing-pages/index.d.ts +1 -1
  20. package/dist/components/landing-pages/landing-page/landing-page.component.d.ts +32 -32
  21. package/dist/components/recommendations/index.d.ts +2 -2
  22. package/dist/components/recommendations/recommendations/recommendations.component.d.ts +87 -87
  23. package/dist/components/recommendations/recommendations-item/recommendations-item.component.d.ts +40 -40
  24. package/dist/components/search/autocomplete/autocomplete.component.d.ts +59 -59
  25. package/dist/components/search/facet-types/base-facet.component.d.ts +44 -44
  26. package/dist/components/search/facet-types/checkbox-list-facet/checkbox-list-facet.component.d.ts +36 -36
  27. package/dist/components/search/facet-types/color-facet/color-facet.component.d.ts +24 -24
  28. package/dist/components/search/facet-types/date-range-facet/date-range-facet.component.d.ts +33 -33
  29. package/dist/components/search/facet-types/index.d.ts +11 -11
  30. package/dist/components/search/facet-types/linked-list-facet/link-list-facet.component.d.ts +24 -24
  31. package/dist/components/search/facet-types/numeric-range-facet/numeric-range-facet.component.d.ts +32 -32
  32. package/dist/components/search/facet-types/range-slider-facet/range-slider-facet.component.d.ts +34 -34
  33. package/dist/components/search/facet-types/recent-searches-facet/recent-searches-facet.component.d.ts +29 -29
  34. package/dist/components/search/facet-types/related-searches-facet/related-searches-facet.component.d.ts +29 -29
  35. package/dist/components/search/facet-types/search-within-facet/search-within-facet.component.d.ts +29 -29
  36. package/dist/components/search/facet-types/size-facet/size-facet.component.d.ts +24 -24
  37. package/dist/components/search/facet-wrapper/facet-wrapper.component.d.ts +47 -47
  38. package/dist/components/search/facets-list/facets-list.component.d.ts +32 -32
  39. package/dist/components/search/index.d.ts +15 -15
  40. package/dist/components/search/modified-query/modified-query.component.d.ts +32 -32
  41. package/dist/components/search/page-size/page-size.component.d.ts +32 -32
  42. package/dist/components/search/pagination/pagination.component.d.ts +43 -43
  43. package/dist/components/search/query-suggestions/query-suggestions.component.d.ts +38 -38
  44. package/dist/components/search/search-field/search-field.component.d.ts +38 -38
  45. package/dist/components/search/search-results/search-results.component.d.ts +34 -34
  46. package/dist/components/search/search-results-item/search-results-item.component.d.ts +38 -38
  47. package/dist/components/search/search-results-list/search-results-list.component.d.ts +23 -23
  48. package/dist/components/search/selected-facets/selected-facets.component.d.ts +31 -31
  49. package/dist/components/search/sorting/sorting.component.d.ts +30 -30
  50. package/dist/components/search/tabs/tabs.component.d.ts +30 -30
  51. package/dist/components/variants/index.d.ts +1 -1
  52. package/dist/components/variants/variant-selector/variant-selector.component.d.ts +23 -23
  53. package/dist/configuration/configuration.models.d.ts +574 -574
  54. package/dist/configuration/index.d.ts +4 -4
  55. package/dist/helpers/helpers.d.ts +200 -200
  56. package/dist/helpers/index.d.ts +4 -4
  57. package/dist/index.d.ts +1 -1
  58. package/dist/index.js +1 -1
  59. package/dist/index.js.map +1 -1
  60. package/dist/models/autocomplete.models.d.ts +85 -85
  61. package/dist/models/base.models.d.ts +50 -50
  62. package/dist/models/component.models.d.ts +453 -453
  63. package/dist/models/content.models.d.ts +94 -94
  64. package/dist/models/index.d.ts +11 -11
  65. package/dist/models/raw/index.d.ts +4 -4
  66. package/dist/models/raw/raw-autocomplete.models.d.ts +51 -51
  67. package/dist/models/raw/raw-base.models.d.ts +8 -8
  68. package/dist/models/raw/raw-recommendation.models.d.ts +39 -39
  69. package/dist/models/raw/raw-search.models.d.ts +191 -191
  70. package/dist/models/recommendation.models.d.ts +31 -31
  71. package/dist/models/search.models.d.ts +237 -237
  72. package/dist/models/tracking.models.d.ts +42 -42
  73. package/dist/services/autocomplete.service.d.ts +10 -10
  74. package/dist/services/base.service.d.ts +63 -63
  75. package/dist/services/index.d.ts +8 -8
  76. package/dist/services/recommendations.service.d.ts +10 -10
  77. package/dist/services/search.service.d.ts +50 -50
  78. package/dist/services/tracking.service.d.ts +29 -29
  79. package/dist/utilities/colors.d.ts +1 -1
  80. package/dist/utilities/dates.d.ts +4 -4
  81. package/dist/utilities/formatters.d.ts +4 -4
  82. package/dist/utilities/index.d.ts +6 -6
  83. package/package.json +1 -1
  84. package/readme.md +1 -1
@@ -1,574 +1,574 @@
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
- export interface SearchResultsComponentConfig extends BaseComponentConfig {
164
- }
165
- export interface SearchResultsItemComponentConfig extends BaseComponentConfig {
166
- strings?: {
167
- sale?: string;
168
- };
169
- }
170
- export interface SearchResultsListComponentConfig extends BaseComponentConfig {
171
- }
172
- export interface SearchWithinFacetComponentConfig extends BaseComponentConfig {
173
- strings?: {
174
- label?: string;
175
- };
176
- }
177
- export interface SelectedFacetsComponentConfig extends BaseComponentConfig {
178
- strings?: {
179
- remove?: string;
180
- };
181
- }
182
- export interface SizeFacetComponentConfig extends BaseComponentConfig {
183
- excludeEnabled?: boolean;
184
- strings?: {
185
- exclude?: string;
186
- include?: string;
187
- showFewer?: string;
188
- showMore?: string;
189
- };
190
- }
191
- export interface SortingComponentConfig extends BaseComponentConfig {
192
- }
193
- export interface TabsComponentConfig extends BaseComponentConfig {
194
- }
195
- export interface TooltipComponentConfig extends BaseComponentConfig {
196
- }
197
- export interface VariantSelectorComponentConfig extends BaseComponentConfig {
198
- }
199
- export interface HawkSearchComponents {
200
- 'autocomplete'?: AutocompleteComponentConfig;
201
- 'checkbox-list-facet'?: CheckboxListFacetComponentConfig;
202
- 'color-facet'?: ColorFacetComponentConfig;
203
- 'content-zone'?: ContentZoneComponentConfig;
204
- 'custom-content'?: CustomContentComponentConfig;
205
- 'date-picker'?: DatePickerComponentConfig;
206
- 'date-range-facet'?: DateRangeFacetComponentConfig;
207
- 'facet-wrapper'?: FacetWrapperComponentConfig;
208
- 'facets-list'?: FacetsListComponentConfig;
209
- 'featured-items-content'?: FeaturedItemsContentComponentConfig;
210
- 'featured-items-content-item'?: FeaturedItemsContentItemComponentConfig;
211
- 'icon'?: IconComponentConfig;
212
- 'image-content'?: ImageContentComponentConfig;
213
- 'landing-page'?: LandingPageComponentConfig;
214
- 'link-list-facet'?: LinkListFacetComponentConfig;
215
- 'modified-query'?: ModifiedQueryComponentConfig;
216
- 'numeric-range-facet'?: NumericRangeFacetComponentConfig;
217
- 'page-size'?: PageSizeComponentConfig;
218
- 'pagination'?: PaginationComponentConfig;
219
- 'popular-queries-content'?: PopularQueriesContentComponentConfig;
220
- 'query-suggestions'?: QuerySuggestionsComponentConfig;
221
- 'range-slider'?: RangeSliderComponentConfig;
222
- 'range-slider-facet'?: RangeSliderFacetComponentConfig;
223
- 'rating'?: RatingComponentConfig;
224
- 'recommendations'?: RecommendationsComponentConfig;
225
- 'recommendations-item'?: RecommendationsItemComponentConfig;
226
- 'recent-searches-facet'?: RecentSearchesFacetComponentConfig;
227
- 'related-searches-facet'?: RelatedSearchesFacetComponentConfig;
228
- 'search-field'?: SearchFieldComponentConfig;
229
- 'search-results'?: SearchResultsComponentConfig;
230
- 'search-results-item'?: SearchResultsItemComponentConfig;
231
- 'search-results-list'?: SearchResultsListComponentConfig;
232
- 'search-within-facet'?: SearchWithinFacetComponentConfig;
233
- 'selected-facets'?: SelectedFacetsComponentConfig;
234
- 'size-facet'?: SizeFacetComponentConfig;
235
- 'sorting'?: SortingComponentConfig;
236
- 'tabs'?: TabsComponentConfig;
237
- 'tooltip'?: TooltipComponentConfig;
238
- 'variant-selector'?: VariantSelectorComponentConfig;
239
- }
240
- export type DisplayType = 'mobile' | 'tablet' | 'desktop';
241
- export interface Breakpoints<TValue> extends Record<DisplayType, TValue> {
242
- }
243
- export interface FieldMappings {
244
- /**
245
- * #### Default Value
246
- * `['description', 'longdescription']`
247
- */
248
- description?: string | Array<string>;
249
- /**
250
- * #### Default Value
251
- * `['imageurl', 'image']`
252
- */
253
- imageUrl?: string | Array<string>;
254
- /**
255
- * #### Default Value
256
- * `'price'`
257
- */
258
- price?: string | Array<string>;
259
- /**
260
- * #### Default Value
261
- * `'rating'`
262
- */
263
- rating?: string | Array<string>;
264
- /**
265
- * #### Default Value
266
- * `['saleprice']`
267
- */
268
- salePrice?: string | Array<string>;
269
- /**
270
- * #### Default Value
271
- * `['sku']`
272
- */
273
- sku?: string | Array<string>;
274
- /**
275
- * #### Default Value
276
- * `['title', 'name', 'itemname']`
277
- */
278
- title?: string | Array<string>;
279
- /**
280
- * #### Default Value
281
- * `'type'`
282
- */
283
- type?: string | Array<string>;
284
- /**
285
- * #### Default Value
286
- * `'url'`
287
- */
288
- url?: string;
289
- }
290
- export interface VariantFieldMappings extends FieldMappings {
291
- /**
292
- * #### Default Value
293
- * `['id']`
294
- */
295
- id?: string | Array<string>;
296
- color?: {
297
- /**
298
- * #### Default Value
299
- * `['colorname', 'color']`
300
- */
301
- name?: string | Array<string>;
302
- /**
303
- * #### Default Value
304
- * `['colorhex', 'colorvalue']`
305
- */
306
- hex?: string | Array<string>;
307
- /**
308
- * #### Default Value
309
- * `['colorimageurl', 'colorimage']`
310
- */
311
- imageUrl?: string | Array<string>;
312
- };
313
- }
314
- export interface HawkSearchConfig {
315
- /**
316
- * The unique ID for your installation found in the HawkSearch admin
317
- */
318
- clientId: string;
319
- /**
320
- * Specify an index to query rather than the default
321
- */
322
- index?: string;
323
- /**
324
- * Map item attributes to common object properties
325
- */
326
- fieldMappings?: FieldMappings;
327
- autocomplete?: {
328
- /**
329
- * The API used to retrieve search results
330
- *
331
- * #### Default Value
332
- * `'https://searchapi-dev.hawksearch.net'`
333
- */
334
- endpointUrl?: string;
335
- /**
336
- * Specifies whether autocomplete recommendations (autocomplete without entering a query) is enabled
337
- *
338
- * #### Default Value
339
- * `false`
340
- */
341
- recommendationsEnabled?: boolean;
342
- };
343
- search?: {
344
- /**
345
- * The API used to retrieve search results
346
- *
347
- * #### Default Value
348
- * `'https://searchapi-dev.hawksearch.net'`
349
- */
350
- endpointUrl?: string;
351
- /**
352
- * The URL of your search results page. This is used to redirect users after performing a search.
353
- *
354
- * #### Default Value
355
- * `'/search'`
356
- */
357
- url?: string;
358
- /**
359
- * 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.
360
- *
361
- * #### Default Value
362
- * `'-'`
363
- */
364
- facetExclusionPrefix?: string;
365
- /**
366
- * Specifies how search results should be classified
367
- */
368
- itemTypes?: {
369
- /**
370
- * 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.
371
- *
372
- * #### Default Value
373
- * `'content'`
374
- */
375
- default: ItemType;
376
- /**
377
- * List of values that will be considered a `product` result.
378
- *
379
- * #### Default Value
380
- * `['item', 'product']`
381
- */
382
- productValues?: Array<string>;
383
- };
384
- /**
385
- * Specifies which query string parameters are used
386
- */
387
- queryStringMappings?: {
388
- /**
389
- * #### Default Value
390
- * `'disableSpellcheck'`
391
- */
392
- disableSpellcheck?: string;
393
- /**
394
- * #### Default Value
395
- * `'page'`
396
- */
397
- page?: string;
398
- /**
399
- * #### Default Value
400
- * `'pageSize'`
401
- */
402
- pageSize?: string;
403
- /**
404
- * #### Default Value
405
- * `'query'`
406
- */
407
- query?: string;
408
- /**
409
- * #### Default Value
410
- * `'searchWithin'`
411
- */
412
- searchWithin?: string;
413
- /**
414
- * #### Default Value
415
- * `'sort'`
416
- */
417
- sort?: string;
418
- };
419
- };
420
- recommendations?: {
421
- /**
422
- * The API used to retrieve product recommendations
423
- *
424
- * #### Default Value
425
- * `'https://recs-dev.hawksearch.net'`
426
- */
427
- endpointUrl?: string;
428
- };
429
- tracking?: {
430
- /**
431
- * Specifies whether user actions should be tracked to provide valuable insights on your search engine performance
432
- *
433
- * #### Default Value
434
- *
435
- * `true`
436
- */
437
- enabled?: boolean;
438
- /**
439
- * The API used to track user interactions
440
- *
441
- * #### Default Value
442
- * `'https://tracking-dev.hawksearch.net'`
443
- */
444
- endpointUrl?: string;
445
- };
446
- variants?: {
447
- /**
448
- * When `true`, specifies that facet counts should be calculated based on the number of child items rather than the number of parent items
449
- *
450
- * #### Default Value
451
- *
452
- * `false`
453
- */
454
- baseFacetCountOnVariants?: boolean;
455
- /**
456
- * Specifies whether variant logic should be used if data is available
457
- *
458
- * #### Default Value
459
- *
460
- * `true`
461
- */
462
- enabled?: boolean;
463
- /**
464
- * 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'`.
465
- */
466
- fieldPrefix?: string;
467
- /**
468
- * Map item attributes to common object properties
469
- */
470
- fieldMappings?: VariantFieldMappings;
471
- /**
472
- * When `true`, specifies that tracking should use the ID of the selected variant rather than the ID of the parent
473
- *
474
- * #### Default Value
475
- *
476
- * `false`
477
- */
478
- trackUsingVariant?: boolean;
479
- };
480
- /**
481
- * Specifies the minimum window widths that correspond to each breakpoint. This is used determine when certain content items are displayed.
482
- *
483
- * #### Default Value
484
- * ```js
485
- * {
486
- * mobile: undefined,
487
- * tablet: 740,
488
- * desktop: 990
489
- * }
490
- * ```
491
- */
492
- breakpoints?: Breakpoints<number>;
493
- /**
494
- * Specifies component-specific configuration options
495
- */
496
- components?: HawkSearchComponents;
497
- /**
498
- * Specifies which styles should be loaded for each component
499
- */
500
- css?: {
501
- /**
502
- * 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.
503
- */
504
- customStyles?: string | Array<string>;
505
- /**
506
- * Specifies whether the default stylesheet should be loaded. This should generally be true except for with completely custom interfaces.
507
- */
508
- defaultStyles?: boolean;
509
- };
510
- /**
511
- * Specifies how values should be formatted for different cultures
512
- */
513
- formatting?: {
514
- /**
515
- * #### Default Value
516
- * `'en-US'`
517
- */
518
- cultureIsoCode?: string;
519
- /**
520
- * #### Default Value
521
- * `'USD'`
522
- */
523
- currencyIsoCode?: string;
524
- };
525
- /**
526
- * The URL of an image to be loaded whenever an image fails to load for a search result item
527
- */
528
- placeholderImageUrl?: string;
529
- seo?: {
530
- title?: {
531
- /**
532
- * Value prepended to title returned from API
533
- */
534
- prefix?: string;
535
- /**
536
- * Value appended to title returned from API
537
- */
538
- suffix?: string;
539
- };
540
- };
541
- /**
542
- * 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.
543
- *
544
- * #### Default Value
545
- * `true`
546
- */
547
- shadowDom?: boolean;
548
- /**
549
- * If your data contains relative URLs, these values can be prepended to the values to convert them to absolute URLs
550
- */
551
- urlPrefixes?: {
552
- assets?: string;
553
- content?: string;
554
- };
555
- }
556
- export interface HawkSearchGlobal {
557
- config: HawkSearchConfig;
558
- handlebars: typeof Handlebars;
559
- recommendationsResponses?: {
560
- [widgetId: string]: RecommendationsResponse;
561
- };
562
- searchRequest?: SearchRequest;
563
- searchResponse?: SearchResponse;
564
- services?: {
565
- autocomplete: AutocompleteService;
566
- recommendations: RecommendationsService;
567
- search: SearchService;
568
- tracking: TrackingService;
569
- };
570
- }
571
- export interface HawkSearchState {
572
- searchRequest?: SearchRequest;
573
- searchResponse: SearchResponse;
574
- }
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
+ export interface SearchResultsComponentConfig extends BaseComponentConfig {
164
+ }
165
+ export interface SearchResultsItemComponentConfig extends BaseComponentConfig {
166
+ strings?: {
167
+ sale?: string;
168
+ };
169
+ }
170
+ export interface SearchResultsListComponentConfig extends BaseComponentConfig {
171
+ }
172
+ export interface SearchWithinFacetComponentConfig extends BaseComponentConfig {
173
+ strings?: {
174
+ label?: string;
175
+ };
176
+ }
177
+ export interface SelectedFacetsComponentConfig extends BaseComponentConfig {
178
+ strings?: {
179
+ remove?: string;
180
+ };
181
+ }
182
+ export interface SizeFacetComponentConfig extends BaseComponentConfig {
183
+ excludeEnabled?: boolean;
184
+ strings?: {
185
+ exclude?: string;
186
+ include?: string;
187
+ showFewer?: string;
188
+ showMore?: string;
189
+ };
190
+ }
191
+ export interface SortingComponentConfig extends BaseComponentConfig {
192
+ }
193
+ export interface TabsComponentConfig extends BaseComponentConfig {
194
+ }
195
+ export interface TooltipComponentConfig extends BaseComponentConfig {
196
+ }
197
+ export interface VariantSelectorComponentConfig extends BaseComponentConfig {
198
+ }
199
+ export interface HawkSearchComponents {
200
+ 'autocomplete'?: AutocompleteComponentConfig;
201
+ 'checkbox-list-facet'?: CheckboxListFacetComponentConfig;
202
+ 'color-facet'?: ColorFacetComponentConfig;
203
+ 'content-zone'?: ContentZoneComponentConfig;
204
+ 'custom-content'?: CustomContentComponentConfig;
205
+ 'date-picker'?: DatePickerComponentConfig;
206
+ 'date-range-facet'?: DateRangeFacetComponentConfig;
207
+ 'facet-wrapper'?: FacetWrapperComponentConfig;
208
+ 'facets-list'?: FacetsListComponentConfig;
209
+ 'featured-items-content'?: FeaturedItemsContentComponentConfig;
210
+ 'featured-items-content-item'?: FeaturedItemsContentItemComponentConfig;
211
+ 'icon'?: IconComponentConfig;
212
+ 'image-content'?: ImageContentComponentConfig;
213
+ 'landing-page'?: LandingPageComponentConfig;
214
+ 'link-list-facet'?: LinkListFacetComponentConfig;
215
+ 'modified-query'?: ModifiedQueryComponentConfig;
216
+ 'numeric-range-facet'?: NumericRangeFacetComponentConfig;
217
+ 'page-size'?: PageSizeComponentConfig;
218
+ 'pagination'?: PaginationComponentConfig;
219
+ 'popular-queries-content'?: PopularQueriesContentComponentConfig;
220
+ 'query-suggestions'?: QuerySuggestionsComponentConfig;
221
+ 'range-slider'?: RangeSliderComponentConfig;
222
+ 'range-slider-facet'?: RangeSliderFacetComponentConfig;
223
+ 'rating'?: RatingComponentConfig;
224
+ 'recommendations'?: RecommendationsComponentConfig;
225
+ 'recommendations-item'?: RecommendationsItemComponentConfig;
226
+ 'recent-searches-facet'?: RecentSearchesFacetComponentConfig;
227
+ 'related-searches-facet'?: RelatedSearchesFacetComponentConfig;
228
+ 'search-field'?: SearchFieldComponentConfig;
229
+ 'search-results'?: SearchResultsComponentConfig;
230
+ 'search-results-item'?: SearchResultsItemComponentConfig;
231
+ 'search-results-list'?: SearchResultsListComponentConfig;
232
+ 'search-within-facet'?: SearchWithinFacetComponentConfig;
233
+ 'selected-facets'?: SelectedFacetsComponentConfig;
234
+ 'size-facet'?: SizeFacetComponentConfig;
235
+ 'sorting'?: SortingComponentConfig;
236
+ 'tabs'?: TabsComponentConfig;
237
+ 'tooltip'?: TooltipComponentConfig;
238
+ 'variant-selector'?: VariantSelectorComponentConfig;
239
+ }
240
+ export type DisplayType = 'mobile' | 'tablet' | 'desktop';
241
+ export interface Breakpoints<TValue> extends Record<DisplayType, TValue> {
242
+ }
243
+ export interface FieldMappings {
244
+ /**
245
+ * #### Default Value
246
+ * `['description', 'longdescription']`
247
+ */
248
+ description?: string | Array<string>;
249
+ /**
250
+ * #### Default Value
251
+ * `['imageurl', 'image']`
252
+ */
253
+ imageUrl?: string | Array<string>;
254
+ /**
255
+ * #### Default Value
256
+ * `'price'`
257
+ */
258
+ price?: string | Array<string>;
259
+ /**
260
+ * #### Default Value
261
+ * `'rating'`
262
+ */
263
+ rating?: string | Array<string>;
264
+ /**
265
+ * #### Default Value
266
+ * `['saleprice']`
267
+ */
268
+ salePrice?: string | Array<string>;
269
+ /**
270
+ * #### Default Value
271
+ * `['sku']`
272
+ */
273
+ sku?: string | Array<string>;
274
+ /**
275
+ * #### Default Value
276
+ * `['title', 'name', 'itemname']`
277
+ */
278
+ title?: string | Array<string>;
279
+ /**
280
+ * #### Default Value
281
+ * `'type'`
282
+ */
283
+ type?: string | Array<string>;
284
+ /**
285
+ * #### Default Value
286
+ * `'url'`
287
+ */
288
+ url?: string;
289
+ }
290
+ export interface VariantFieldMappings extends FieldMappings {
291
+ /**
292
+ * #### Default Value
293
+ * `['id']`
294
+ */
295
+ id?: string | Array<string>;
296
+ color?: {
297
+ /**
298
+ * #### Default Value
299
+ * `['colorname', 'color']`
300
+ */
301
+ name?: string | Array<string>;
302
+ /**
303
+ * #### Default Value
304
+ * `['colorhex', 'colorvalue']`
305
+ */
306
+ hex?: string | Array<string>;
307
+ /**
308
+ * #### Default Value
309
+ * `['colorimageurl', 'colorimage']`
310
+ */
311
+ imageUrl?: string | Array<string>;
312
+ };
313
+ }
314
+ export interface HawkSearchConfig {
315
+ /**
316
+ * The unique ID for your installation found in the HawkSearch admin
317
+ */
318
+ clientId: string;
319
+ /**
320
+ * Specify an index to query rather than the default
321
+ */
322
+ index?: string;
323
+ /**
324
+ * Map item attributes to common object properties
325
+ */
326
+ fieldMappings?: FieldMappings;
327
+ autocomplete?: {
328
+ /**
329
+ * The API used to retrieve search results
330
+ *
331
+ * #### Default Value
332
+ * `'https://searchapi-dev.hawksearch.net'`
333
+ */
334
+ endpointUrl?: string;
335
+ /**
336
+ * Specifies whether autocomplete recommendations (autocomplete without entering a query) is enabled
337
+ *
338
+ * #### Default Value
339
+ * `false`
340
+ */
341
+ recommendationsEnabled?: boolean;
342
+ };
343
+ search?: {
344
+ /**
345
+ * The API used to retrieve search results
346
+ *
347
+ * #### Default Value
348
+ * `'https://searchapi-dev.hawksearch.net'`
349
+ */
350
+ endpointUrl?: string;
351
+ /**
352
+ * The URL of your search results page. This is used to redirect users after performing a search.
353
+ *
354
+ * #### Default Value
355
+ * `'/search'`
356
+ */
357
+ url?: string;
358
+ /**
359
+ * 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.
360
+ *
361
+ * #### Default Value
362
+ * `'-'`
363
+ */
364
+ facetExclusionPrefix?: string;
365
+ /**
366
+ * Specifies how search results should be classified
367
+ */
368
+ itemTypes?: {
369
+ /**
370
+ * 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.
371
+ *
372
+ * #### Default Value
373
+ * `'content'`
374
+ */
375
+ default: ItemType;
376
+ /**
377
+ * List of values that will be considered a `product` result.
378
+ *
379
+ * #### Default Value
380
+ * `['item', 'product']`
381
+ */
382
+ productValues?: Array<string>;
383
+ };
384
+ /**
385
+ * Specifies which query string parameters are used
386
+ */
387
+ queryStringMappings?: {
388
+ /**
389
+ * #### Default Value
390
+ * `'disableSpellcheck'`
391
+ */
392
+ disableSpellcheck?: string;
393
+ /**
394
+ * #### Default Value
395
+ * `'page'`
396
+ */
397
+ page?: string;
398
+ /**
399
+ * #### Default Value
400
+ * `'pageSize'`
401
+ */
402
+ pageSize?: string;
403
+ /**
404
+ * #### Default Value
405
+ * `'query'`
406
+ */
407
+ query?: string;
408
+ /**
409
+ * #### Default Value
410
+ * `'searchWithin'`
411
+ */
412
+ searchWithin?: string;
413
+ /**
414
+ * #### Default Value
415
+ * `'sort'`
416
+ */
417
+ sort?: string;
418
+ };
419
+ };
420
+ recommendations?: {
421
+ /**
422
+ * The API used to retrieve product recommendations
423
+ *
424
+ * #### Default Value
425
+ * `'https://recs-dev.hawksearch.net'`
426
+ */
427
+ endpointUrl?: string;
428
+ };
429
+ tracking?: {
430
+ /**
431
+ * Specifies whether user actions should be tracked to provide valuable insights on your search engine performance
432
+ *
433
+ * #### Default Value
434
+ *
435
+ * `true`
436
+ */
437
+ enabled?: boolean;
438
+ /**
439
+ * The API used to track user interactions
440
+ *
441
+ * #### Default Value
442
+ * `'https://tracking-dev.hawksearch.net'`
443
+ */
444
+ endpointUrl?: string;
445
+ };
446
+ variants?: {
447
+ /**
448
+ * When `true`, specifies that facet counts should be calculated based on the number of child items rather than the number of parent items
449
+ *
450
+ * #### Default Value
451
+ *
452
+ * `false`
453
+ */
454
+ baseFacetCountOnVariants?: boolean;
455
+ /**
456
+ * Specifies whether variant logic should be used if data is available
457
+ *
458
+ * #### Default Value
459
+ *
460
+ * `true`
461
+ */
462
+ enabled?: boolean;
463
+ /**
464
+ * 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'`.
465
+ */
466
+ fieldPrefix?: string;
467
+ /**
468
+ * Map item attributes to common object properties
469
+ */
470
+ fieldMappings?: VariantFieldMappings;
471
+ /**
472
+ * When `true`, specifies that tracking should use the ID of the selected variant rather than the ID of the parent
473
+ *
474
+ * #### Default Value
475
+ *
476
+ * `false`
477
+ */
478
+ trackUsingVariant?: boolean;
479
+ };
480
+ /**
481
+ * Specifies the minimum window widths that correspond to each breakpoint. This is used determine when certain content items are displayed.
482
+ *
483
+ * #### Default Value
484
+ * ```js
485
+ * {
486
+ * mobile: undefined,
487
+ * tablet: 740,
488
+ * desktop: 990
489
+ * }
490
+ * ```
491
+ */
492
+ breakpoints?: Breakpoints<number>;
493
+ /**
494
+ * Specifies component-specific configuration options
495
+ */
496
+ components?: HawkSearchComponents;
497
+ /**
498
+ * Specifies which styles should be loaded for each component
499
+ */
500
+ css?: {
501
+ /**
502
+ * 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.
503
+ */
504
+ customStyles?: string | Array<string>;
505
+ /**
506
+ * Specifies whether the default stylesheet should be loaded. This should generally be true except for with completely custom interfaces.
507
+ */
508
+ defaultStyles?: boolean;
509
+ };
510
+ /**
511
+ * Specifies how values should be formatted for different cultures
512
+ */
513
+ formatting?: {
514
+ /**
515
+ * #### Default Value
516
+ * `'en-US'`
517
+ */
518
+ cultureIsoCode?: string;
519
+ /**
520
+ * #### Default Value
521
+ * `'USD'`
522
+ */
523
+ currencyIsoCode?: string;
524
+ };
525
+ /**
526
+ * The URL of an image to be loaded whenever an image fails to load for a search result item
527
+ */
528
+ placeholderImageUrl?: string;
529
+ seo?: {
530
+ title?: {
531
+ /**
532
+ * Value prepended to title returned from API
533
+ */
534
+ prefix?: string;
535
+ /**
536
+ * Value appended to title returned from API
537
+ */
538
+ suffix?: string;
539
+ };
540
+ };
541
+ /**
542
+ * 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.
543
+ *
544
+ * #### Default Value
545
+ * `true`
546
+ */
547
+ shadowDom?: boolean;
548
+ /**
549
+ * If your data contains relative URLs, these values can be prepended to the values to convert them to absolute URLs
550
+ */
551
+ urlPrefixes?: {
552
+ assets?: string;
553
+ content?: string;
554
+ };
555
+ }
556
+ export interface HawkSearchGlobal {
557
+ config: HawkSearchConfig;
558
+ handlebars: typeof Handlebars;
559
+ recommendationsResponses?: {
560
+ [widgetId: string]: RecommendationsResponse;
561
+ };
562
+ searchRequest?: SearchRequest;
563
+ searchResponse?: SearchResponse;
564
+ services?: {
565
+ autocomplete: AutocompleteService;
566
+ recommendations: RecommendationsService;
567
+ search: SearchService;
568
+ tracking: TrackingService;
569
+ };
570
+ }
571
+ export interface HawkSearchState {
572
+ searchRequest?: SearchRequest;
573
+ searchResponse: SearchResponse;
574
+ }