@bridgeline-digital/hawksearch-handlebars-ui 3.0.0-beta.0 → 4.0.0-beta.0

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.
@@ -1,4 +1,5 @@
1
1
  export * from './date-picker/date-picker.component';
2
2
  export * from './icon/icon.component';
3
3
  export * from './range-slider/range-slider.component';
4
+ export * from './rating/rating.component';
4
5
  export * from './tooltip/tooltip.component';
@@ -0,0 +1,39 @@
1
+ import { HawkSearchComponents, RatingComponentConfig } from '@configuration';
2
+ import { RatingComponentModel } from '@models';
3
+ import { BaseComponent } from '../../base.component';
4
+ /**
5
+ * The Rating component is used to display a visual representation of ratings for a particular product.
6
+ *
7
+ * ## Tag
8
+ * The tag for this component is `<hawksearch-rating>`.
9
+ *
10
+ * ## Attributes
11
+ * | Name | Type | Default Value | Required |
12
+ * | :- | :- | :- | :- |
13
+ * | rating | `number` | | Yes
14
+ *
15
+ * These attributes are used to position the tooltip based on the size and scroll position of the active window. The `hawksearch-tooltip` attribute should be present on an element containing both the element the tooltip is attached to (to display on hover) and the element containing the tooltip content, which should have a `hawksearch-tooltip-content` attribute.
16
+ *
17
+ * ## Handlebars Helpers
18
+ * | Name | Rating | Star Number
19
+ * | :- | :- | :- |
20
+ * | ratingIcon | `number` | `number` |
21
+ *
22
+ * This helper function returns the icon name to display for a given rating and star number (1-5)
23
+ *
24
+ * ## Default Template
25
+ * 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.
26
+ * {@embed ./rating.component.hbs}
27
+ *
28
+ * @category General
29
+ */
30
+ export declare class RatingComponent extends BaseComponent<RatingComponentConfig, number, RatingComponentModel> {
31
+ protected componentName: keyof HawkSearchComponents;
32
+ protected defaultHtml: any;
33
+ protected bindFromEvent: boolean;
34
+ protected registerHelpers(): void;
35
+ private get rating();
36
+ protected renderContent(): boolean;
37
+ protected getContentModel(): RatingComponentModel;
38
+ protected onRender(): void;
39
+ }
@@ -28,6 +28,7 @@ export declare class SearchFieldComponent extends BaseComponent<SearchFieldCompo
28
28
  private defaultAutocompleteResponse?;
29
29
  private previousAutocompleteResponse?;
30
30
  private previousValue;
31
+ private get recommendationsEnabled();
31
32
  connectedCallback(): void;
32
33
  disconnectedCallback(): void;
33
34
  protected getContentModel(): SearchFieldComponentModel;
@@ -126,6 +126,8 @@ export interface RangeSliderFacetComponentConfig extends BaseComponentConfig {
126
126
  minimum?: string;
127
127
  };
128
128
  }
129
+ export interface RatingComponentConfig extends BaseComponentConfig {
130
+ }
129
131
  export interface RecentSearchesFacetComponentConfig extends BaseComponentConfig {
130
132
  }
131
133
  export interface RecommendationsItemComponentConfig extends BaseComponentConfig {
@@ -216,6 +218,7 @@ export interface HawkSearchComponents {
216
218
  'query-suggestions'?: QuerySuggestionsComponentConfig;
217
219
  'range-slider'?: RangeSliderComponentConfig;
218
220
  'range-slider-facet'?: RangeSliderFacetComponentConfig;
221
+ 'rating'?: RatingComponentConfig;
219
222
  'recommendations'?: RecommendationsComponentConfig;
220
223
  'recommendations-item'?: RecommendationsItemComponentConfig;
221
224
  'recent-searches-facet'?: RecentSearchesFacetComponentConfig;
@@ -240,77 +243,45 @@ export interface HawkSearchConfig {
240
243
  */
241
244
  clientId: string;
242
245
  /**
243
- * Specifies the minimum window widths that correspond to each breakpoint. This is used determine when certain content items are displayed.
244
- *
245
- * #### Default Value
246
- * ```js
247
- * {
248
- * mobile: undefined,
249
- * tablet: 740,
250
- * desktop: 990
251
- * }
252
- * ```
253
- */
254
- breakpoints?: Breakpoints<number>;
255
- /**
256
- * Specifies component-specific configuration options
257
- */
258
- components?: HawkSearchComponents;
259
- /**
260
- * Specifies which styles should be loaded for each component
246
+ * Specify an index to query rather than the default
261
247
  */
262
- css?: {
263
- /**
264
- * 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.
265
- */
266
- customStyles?: string | Array<string>;
248
+ index?: string;
249
+ autocomplete?: {
267
250
  /**
268
- * Specifies whether the default stylesheet should be loaded. This should generally be true except for with completely custom interfaces.
251
+ * The API used to retrieve search results
252
+ *
253
+ * #### Default Value
254
+ * `'https://searchapi-dev.hawksearch.net'`
269
255
  */
270
- defaultStyles?: boolean;
256
+ endpointUrl?: string;
257
+ recommendationsEnabled?: boolean;
271
258
  };
272
- /**
273
- * Specifies which endpoints are called by each {@link Services | service}
274
- */
275
- endpoints?: {
259
+ search?: {
276
260
  /**
277
- * The API used to retrieve product recommendations
261
+ * The API used to retrieve search results
278
262
  *
279
263
  * #### Default Value
280
- * `'https://recs-dev.hawksearch.net/api/recommendation/v2'`
264
+ * `'https://searchapi-dev.hawksearch.net'`
281
265
  */
282
- recommendations: string;
266
+ endpointUrl?: string;
283
267
  /**
284
- * The API used to retrieve search results
268
+ * The URL of your search results page. This is used to redirect users after performing a search.
285
269
  *
286
270
  * #### Default Value
287
- * `'https://searchapi-dev.hawksearch.net/api/v2'`
271
+ * `'/search'`
288
272
  */
289
- search: string;
273
+ url?: string;
290
274
  /**
291
- * The API used to track user interactions
275
+ * 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.
292
276
  *
293
277
  * #### Default Value
294
- * `'https://tracking-dev.hawksearch.net/api'`
278
+ * `'-'`
295
279
  */
296
- tracking: string;
297
- };
298
- /**
299
- * Specify an index to query rather than the default
300
- */
301
- index?: string;
302
- /**
303
- * 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.
304
- *
305
- * #### Default Value
306
- * `'-'`
307
- */
308
- facetExclusionPrefix?: string;
309
- /**
310
- * Map item attributes to common object properties
311
- */
312
- fieldMappings?: {
313
- recommendations?: {
280
+ facetExclusionPrefix?: string;
281
+ /**
282
+ * Map item attributes to common object properties
283
+ */
284
+ fieldMappings?: {
314
285
  /**
315
286
  * #### Default Value
316
287
  * `'longdescription'`
@@ -326,6 +297,11 @@ export interface HawkSearchConfig {
326
297
  * `'price'`
327
298
  */
328
299
  price?: string;
300
+ /**
301
+ * #### Default Value
302
+ * `'rating'`
303
+ */
304
+ rating?: string;
329
305
  /**
330
306
  * #### Default Value
331
307
  * `'saleprice'`
@@ -336,13 +312,84 @@ export interface HawkSearchConfig {
336
312
  * `'itemname'`
337
313
  */
338
314
  title?: string;
315
+ /**
316
+ * #### Default Value
317
+ * `'type'`
318
+ */
319
+ type?: string;
339
320
  /**
340
321
  * #### Default Value
341
322
  * `'url'`
342
323
  */
343
324
  url?: string;
344
325
  };
345
- searchResults?: {
326
+ /**
327
+ * Specifies how search results should be classified
328
+ */
329
+ itemTypes?: {
330
+ /**
331
+ * If the value a search result item is missing a value for the field mapped to {@link HawkSearchConfig.fieldMappings | type}, this value will be assumed.
332
+ *
333
+ * #### Default Value
334
+ * `'content'`
335
+ */
336
+ default: SearchResultsItemType;
337
+ /**
338
+ * List of values that will be considered a `product` result.
339
+ *
340
+ * #### Default Value
341
+ * `['item', 'product']`
342
+ */
343
+ productValues?: Array<string>;
344
+ };
345
+ /**
346
+ * Specifies which query string parameters are used
347
+ */
348
+ queryStringMappings?: {
349
+ /**
350
+ * #### Default Value
351
+ * `'disableSpellcheck'`
352
+ */
353
+ disableSpellcheck?: string;
354
+ /**
355
+ * #### Default Value
356
+ * `'page'`
357
+ */
358
+ page?: string;
359
+ /**
360
+ * #### Default Value
361
+ * `'pageSize'`
362
+ */
363
+ pageSize?: string;
364
+ /**
365
+ * #### Default Value
366
+ * `'query'`
367
+ */
368
+ query?: string;
369
+ /**
370
+ * #### Default Value
371
+ * `'searchWithin'`
372
+ */
373
+ searchWithin?: string;
374
+ /**
375
+ * #### Default Value
376
+ * `'sort'`
377
+ */
378
+ sort?: string;
379
+ };
380
+ };
381
+ recommendations?: {
382
+ /**
383
+ * The API used to retrieve product recommendations
384
+ *
385
+ * #### Default Value
386
+ * `'https://recs-dev.hawksearch.net'`
387
+ */
388
+ endpointUrl?: string;
389
+ /**
390
+ * Map item attributes to common object properties
391
+ */
392
+ fieldMappings?: {
346
393
  /**
347
394
  * #### Default Value
348
395
  * `'longdescription'`
@@ -358,6 +405,11 @@ export interface HawkSearchConfig {
358
405
  * `'price'`
359
406
  */
360
407
  price?: string;
408
+ /**
409
+ * #### Default Value
410
+ * `'rating'`
411
+ */
412
+ rating?: string;
361
413
  /**
362
414
  * #### Default Value
363
415
  * `'saleprice'`
@@ -368,11 +420,6 @@ export interface HawkSearchConfig {
368
420
  * `'itemname'`
369
421
  */
370
422
  title?: string;
371
- /**
372
- * #### Default Value
373
- * `'type'`
374
- */
375
- type?: string;
376
423
  /**
377
424
  * #### Default Value
378
425
  * `'url'`
@@ -380,86 +427,72 @@ export interface HawkSearchConfig {
380
427
  url?: string;
381
428
  };
382
429
  };
383
- /**
384
- * Specifies how values should be formatted for different cultures
385
- */
386
- formatting?: {
387
- /**
388
- * #### Default Value
389
- * `'en-US'`
390
- */
391
- cultureIsoCode?: string;
392
- /**
393
- * #### Default Value
394
- * `'USD'`
395
- */
396
- currencyIsoCode?: string;
397
- };
398
- /**
399
- * Specifies how search results should be classified
400
- */
401
- itemTypes?: {
430
+ tracking?: {
402
431
  /**
403
- * If the value a search result item is missing a value for the field mapped to {@link HawkSearchConfig.fieldMappings | type}, this value will be assumed.
432
+ * Specifies whether user actions should be tracked to provide valuable insights on your search engine performance
404
433
  *
405
434
  * #### Default Value
406
- * `'content'`
435
+ *
436
+ * `true`
407
437
  */
408
- default: SearchResultsItemType;
438
+ enabled?: boolean;
409
439
  /**
410
- * List of values that will be considered a `product` result.
440
+ * The API used to track user interactions
411
441
  *
412
442
  * #### Default Value
413
- * `['item', 'product']`
443
+ * `'https://tracking-dev.hawksearch.net'`
414
444
  */
415
- productValues?: Array<string>;
445
+ endpointUrl?: string;
416
446
  };
417
447
  /**
418
- * The URL of an image to be loaded whenever an image fails to load for a search result item
448
+ * Specifies the minimum window widths that correspond to each breakpoint. This is used determine when certain content items are displayed.
449
+ *
450
+ * #### Default Value
451
+ * ```js
452
+ * {
453
+ * mobile: undefined,
454
+ * tablet: 740,
455
+ * desktop: 990
456
+ * }
457
+ * ```
419
458
  */
420
- placeholderImageUrl?: string;
459
+ breakpoints?: Breakpoints<number>;
421
460
  /**
422
- * Specifies which query string parameters are used
461
+ * Specifies component-specific configuration options
423
462
  */
424
- queryStringMappings?: {
425
- /**
426
- * #### Default Value
427
- * `'disableSpellcheck'`
428
- */
429
- disableSpellcheck?: string;
430
- /**
431
- * #### Default Value
432
- * `'page'`
433
- */
434
- page?: string;
463
+ components?: HawkSearchComponents;
464
+ /**
465
+ * Specifies which styles should be loaded for each component
466
+ */
467
+ css?: {
435
468
  /**
436
- * #### Default Value
437
- * `'pageSize'`
469
+ * 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.
438
470
  */
439
- pageSize?: string;
471
+ customStyles?: string | Array<string>;
440
472
  /**
441
- * #### Default Value
442
- * `'query'`
473
+ * Specifies whether the default stylesheet should be loaded. This should generally be true except for with completely custom interfaces.
443
474
  */
444
- query?: string;
475
+ defaultStyles?: boolean;
476
+ };
477
+ /**
478
+ * Specifies how values should be formatted for different cultures
479
+ */
480
+ formatting?: {
445
481
  /**
446
482
  * #### Default Value
447
- * `'searchWithin'`
483
+ * `'en-US'`
448
484
  */
449
- searchWithin?: string;
485
+ cultureIsoCode?: string;
450
486
  /**
451
487
  * #### Default Value
452
- * `'sort'`
488
+ * `'USD'`
453
489
  */
454
- sort?: string;
490
+ currencyIsoCode?: string;
455
491
  };
456
492
  /**
457
- * The URL of your search results page. This is used to redirect users after performing a search.
458
- *
459
- * #### Default Value
460
- * `'/search'`
493
+ * The URL of an image to be loaded whenever an image fails to load for a search result item
461
494
  */
462
- searchUrl?: string;
495
+ placeholderImageUrl?: string;
463
496
  seo?: {
464
497
  title?: {
465
498
  /**
@@ -479,14 +512,6 @@ export interface HawkSearchConfig {
479
512
  * `true`
480
513
  */
481
514
  shadowDom?: boolean;
482
- /**
483
- * Specifies whether user actions should be tracked to provide valuable insights on your search engine performance
484
- *
485
- * #### Default Value
486
- *
487
- * `true`
488
- */
489
- trackingEnabled?: boolean;
490
515
  /**
491
516
  * If your data contains relative URLs, these values can be prepended to the values to convert them to absolute URLs
492
517
  */