@bridgeline-digital/hawksearch-handlebars-ui 5.0.0 → 5.0.1
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 +106 -102
- package/dist/components/base.component.d.ts +139 -139
- package/dist/components/content/content-types/base-content.component.d.ts +9 -9
- package/dist/components/content/content-types/custom-content/custom-content.component.d.ts +21 -21
- package/dist/components/content/content-types/featured-items-content/featured-items-content.component.d.ts +22 -22
- package/dist/components/content/content-types/featured-items-content-item/featured-items-content-item.component.d.ts +39 -39
- package/dist/components/content/content-types/image-content/image-content.component.d.ts +22 -22
- package/dist/components/content/content-types/index.d.ts +6 -6
- package/dist/components/content/content-types/popular-queries-content/popular-queries-content.component.d.ts +22 -22
- package/dist/components/content/content-zone/content-zone.component.d.ts +44 -44
- package/dist/components/content/index.d.ts +2 -2
- package/dist/components/general/date-picker/date-picker.component.d.ts +117 -117
- package/dist/components/general/icon/icon.component.d.ts +38 -38
- package/dist/components/general/index.d.ts +5 -5
- package/dist/components/general/range-slider/range-slider.component.d.ts +54 -54
- package/dist/components/general/rating/rating.component.d.ts +39 -39
- package/dist/components/general/tooltip/tooltip.component.d.ts +32 -32
- package/dist/components/index.d.ts +229 -229
- package/dist/components/landing-pages/index.d.ts +1 -1
- package/dist/components/landing-pages/landing-page/landing-page.component.d.ts +32 -32
- package/dist/components/recommendations/index.d.ts +2 -2
- package/dist/components/recommendations/recommendations/recommendations.component.d.ts +87 -87
- package/dist/components/recommendations/recommendations-item/recommendations-item.component.d.ts +40 -40
- package/dist/components/search/autocomplete/autocomplete.component.d.ts +59 -59
- package/dist/components/search/facet-types/base-facet.component.d.ts +44 -44
- package/dist/components/search/facet-types/checkbox-list-facet/checkbox-list-facet.component.d.ts +36 -36
- package/dist/components/search/facet-types/color-facet/color-facet.component.d.ts +24 -24
- package/dist/components/search/facet-types/date-range-facet/date-range-facet.component.d.ts +33 -33
- package/dist/components/search/facet-types/index.d.ts +11 -11
- package/dist/components/search/facet-types/linked-list-facet/link-list-facet.component.d.ts +24 -24
- package/dist/components/search/facet-types/numeric-range-facet/numeric-range-facet.component.d.ts +32 -32
- package/dist/components/search/facet-types/range-slider-facet/range-slider-facet.component.d.ts +34 -34
- package/dist/components/search/facet-types/recent-searches-facet/recent-searches-facet.component.d.ts +29 -29
- package/dist/components/search/facet-types/related-searches-facet/related-searches-facet.component.d.ts +29 -29
- package/dist/components/search/facet-types/search-within-facet/search-within-facet.component.d.ts +29 -29
- package/dist/components/search/facet-types/size-facet/size-facet.component.d.ts +24 -24
- package/dist/components/search/facet-wrapper/facet-wrapper.component.d.ts +47 -47
- package/dist/components/search/facets-list/facets-list.component.d.ts +32 -32
- package/dist/components/search/index.d.ts +15 -15
- package/dist/components/search/modified-query/modified-query.component.d.ts +32 -32
- package/dist/components/search/page-size/page-size.component.d.ts +32 -32
- package/dist/components/search/pagination/pagination.component.d.ts +43 -43
- package/dist/components/search/query-suggestions/query-suggestions.component.d.ts +38 -38
- package/dist/components/search/search-field/search-field.component.d.ts +38 -38
- package/dist/components/search/search-results/search-results.component.d.ts +34 -34
- package/dist/components/search/search-results-item/search-results-item.component.d.ts +38 -38
- package/dist/components/search/search-results-list/search-results-list.component.d.ts +23 -23
- package/dist/components/search/selected-facets/selected-facets.component.d.ts +31 -31
- package/dist/components/search/sorting/sorting.component.d.ts +30 -30
- package/dist/components/search/tabs/tabs.component.d.ts +30 -30
- package/dist/components/variants/index.d.ts +1 -1
- package/dist/components/variants/variant-selector/variant-selector.component.d.ts +23 -23
- package/dist/configuration/configuration.models.d.ts +574 -574
- package/dist/configuration/index.d.ts +4 -4
- package/dist/helpers/helpers.d.ts +200 -200
- package/dist/helpers/index.d.ts +4 -4
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/models/autocomplete.models.d.ts +85 -85
- package/dist/models/base.models.d.ts +50 -50
- package/dist/models/component.models.d.ts +453 -453
- package/dist/models/content.models.d.ts +94 -94
- package/dist/models/index.d.ts +11 -11
- package/dist/models/raw/index.d.ts +4 -4
- package/dist/models/raw/raw-autocomplete.models.d.ts +51 -51
- package/dist/models/raw/raw-base.models.d.ts +8 -8
- package/dist/models/raw/raw-recommendation.models.d.ts +39 -39
- package/dist/models/raw/raw-search.models.d.ts +191 -191
- package/dist/models/recommendation.models.d.ts +31 -31
- package/dist/models/search.models.d.ts +237 -237
- package/dist/models/tracking.models.d.ts +42 -42
- package/dist/services/autocomplete.service.d.ts +10 -10
- package/dist/services/base.service.d.ts +63 -63
- package/dist/services/index.d.ts +8 -8
- package/dist/services/recommendations.service.d.ts +10 -10
- package/dist/services/search.service.d.ts +50 -50
- package/dist/services/tracking.service.d.ts +29 -29
- package/dist/utilities/colors.d.ts +1 -1
- package/dist/utilities/dates.d.ts +4 -4
- package/dist/utilities/formatters.d.ts +4 -4
- package/dist/utilities/index.d.ts +6 -6
- package/package.json +1 -1
- package/readme.md +1 -1
package/changelog.md
CHANGED
|
@@ -1,102 +1,106 @@
|
|
|
1
|
-
# 5.0.
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
# 4.0.
|
|
30
|
-
|
|
31
|
-
1.
|
|
32
|
-
|
|
33
|
-
# 4.0.
|
|
34
|
-
|
|
35
|
-
1.
|
|
36
|
-
|
|
37
|
-
# 4.0.
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
1
|
+
# 5.0.1
|
|
2
|
+
|
|
3
|
+
1. Fixed bug in API endpoint construction when overriding the default `endpointUrl` for Autocomplete
|
|
4
|
+
|
|
5
|
+
# 5.0.0
|
|
6
|
+
|
|
7
|
+
## New Features
|
|
8
|
+
|
|
9
|
+
1. Added VariantSelectorComponent
|
|
10
|
+
2. Implemented VariantSelectorComponent in default templates for search results, featured items, recommendations, and autocomplete
|
|
11
|
+
|
|
12
|
+
## Bug Fixes
|
|
13
|
+
|
|
14
|
+
1. Updated the `attributes` collection on recommendation items to split single string values by `|^|` into string arrays
|
|
15
|
+
2. Added logic to catch HTTP errors in service layer
|
|
16
|
+
|
|
17
|
+
## Breaking Changes
|
|
18
|
+
|
|
19
|
+
1. Modified JSON structure for field mapping configuration
|
|
20
|
+
2. The `attributes` collection on recommendation items now consists of the data in `customDict` from the API response rather than preserving `customDict` as a nested property
|
|
21
|
+
|
|
22
|
+
# 4.0.4
|
|
23
|
+
|
|
24
|
+
1. Modified RecommendationsService to transform response properties into arrays to be consistent with search results and autocomplete
|
|
25
|
+
2. Modified `attributes` property on `RecommendationsItem` to include only the properties from `customDict` on the API response. The other properties from the response are standard so repeating them under `attributes` does not make sense.
|
|
26
|
+
3. Fixed bug with autocomplete top categories links not working when not on search results page
|
|
27
|
+
4. Fixed parameter name in order tracking event data
|
|
28
|
+
|
|
29
|
+
# 4.0.3
|
|
30
|
+
|
|
31
|
+
1. Fixed URL parsing logic to avoid prepending domain when API returns a value starting with `//`
|
|
32
|
+
|
|
33
|
+
# 4.0.2
|
|
34
|
+
|
|
35
|
+
1. Updated `number` and `currency` Handlebars helpers to handle string values from API and made decimals parameter optional
|
|
36
|
+
|
|
37
|
+
# 4.0.1
|
|
38
|
+
|
|
39
|
+
1. Modified SearchService so that `hawksearch:after-search-completed` event fires before SEO elements are set
|
|
40
|
+
|
|
41
|
+
# 4.0.0
|
|
42
|
+
|
|
43
|
+
## New Features
|
|
44
|
+
|
|
45
|
+
1. Added `HawkSearch.config.autocomplete.recommendationsEnabled` property with a default value of `false` to toggle autocomplete recommendations (instant engage)
|
|
46
|
+
2. Added new RatingComponent to be displayed on SearchResultsItemComponent, RecommendationsItemComponent, and FeaturedItemsContentItemComponent.
|
|
47
|
+
3. Added product ratings and prices to autocomplete
|
|
48
|
+
4. Added suggested queries (did you mean?) to autocomplete
|
|
49
|
+
|
|
50
|
+
## Bug Fixes
|
|
51
|
+
|
|
52
|
+
1. Converting `price` and `salePrice` values of 0 to `undefined`
|
|
53
|
+
2. Fixed price rendering logic in default templates of SearchResultsItemComponent, RecommendationsItemComponent, and FeaturedItemsContentItemComponent
|
|
54
|
+
|
|
55
|
+
## Breaking Changes
|
|
56
|
+
|
|
57
|
+
1. Refactored HawkSearchConfig structure to group properties by search, autocomplete, and recommendations. Some property names have changed slightly.
|
|
58
|
+
2. Modified endpoints configuration to expect only domain rather than full API URL
|
|
59
|
+
|
|
60
|
+
# 3.0.0
|
|
61
|
+
|
|
62
|
+
## New Features
|
|
63
|
+
|
|
64
|
+
1. Added support for A/B testing in Recommendations component
|
|
65
|
+
2. Added support for default autocomplete without entering a query
|
|
66
|
+
3. Modified autocomplete to display when refocusing on search field
|
|
67
|
+
4. Added optional `item-id` attribute to Recommendations component
|
|
68
|
+
5. Added instance-level configuration overrides through `config` attribute or `configOverride` property
|
|
69
|
+
|
|
70
|
+
## Bug Fixes
|
|
71
|
+
|
|
72
|
+
1. Fixed script file name and configuration link in documentation
|
|
73
|
+
2. Fixed bug requiring double-click to expand facet that is collapsed by default
|
|
74
|
+
|
|
75
|
+
## Breaking Changes
|
|
76
|
+
|
|
77
|
+
1. Removed unused option to define custom component template as child content of tag to provide future possibility of using slots or declarative Shadow DOM
|
|
78
|
+
|
|
79
|
+
# 2.0.0
|
|
80
|
+
|
|
81
|
+
## New Features
|
|
82
|
+
|
|
83
|
+
1. Added Landing Pages components
|
|
84
|
+
2. Added Recommendations components
|
|
85
|
+
3. Added component-level configuration to support functionality toggles and easy string replacements
|
|
86
|
+
4. Added `hawksearch:before-${componentName}-rendered` event hooks to support passing custom data to Handlebars templates
|
|
87
|
+
5. Added configuration setting to toggle facet exclude value functionality. This is now disabled by default.
|
|
88
|
+
6. Added ability to load CSS styles without requiring an external stylesheet
|
|
89
|
+
7. Added customizable index to search results, autocomplete, and recommendations requests
|
|
90
|
+
8. Added ability to set product as default search results item type
|
|
91
|
+
9. Added alternate `[[value]]` syntax to work the same as the default Handlerbars `{{value}}` syntax to avoid conflicts when customizing templates within BigCommerce
|
|
92
|
+
10. Added support for nested object properties in field mappings
|
|
93
|
+
11. Added rendering of canonical URL including search refinements
|
|
94
|
+
12. Added configurable facet exclusion prefix
|
|
95
|
+
13. Implemented TypeDoc code-generated documentation to ensure it remains up-to-date and available for each version
|
|
96
|
+
|
|
97
|
+
## Bug Fixes
|
|
98
|
+
|
|
99
|
+
1. Fixed Autocomplete template name
|
|
100
|
+
2. Added logic to handle scrolling facets by setting a max-height in default template
|
|
101
|
+
|
|
102
|
+
## Breaking Changes
|
|
103
|
+
|
|
104
|
+
1. Changed entry file from `hawksearch-handlebars-ui.js` to `index.js`
|
|
105
|
+
2. Renamed `Hawksearch` global object to `HawkSearch`
|
|
106
|
+
3. Changes to `HawkSearch.config` model to support new features
|
|
@@ -1,139 +1,139 @@
|
|
|
1
|
-
import { BaseComponentConfig, HawkSearchComponents } from '@configuration';
|
|
2
|
-
import { BaseComponentModel } from '@models';
|
|
3
|
-
/**
|
|
4
|
-
* @typeParam TConfig Component configuration
|
|
5
|
-
* @typeParam TData Component data
|
|
6
|
-
* @typeParam TModel Data bound to Handlebars template
|
|
7
|
-
*
|
|
8
|
-
* @noInheritDoc
|
|
9
|
-
* @category Base
|
|
10
|
-
*/
|
|
11
|
-
export declare abstract class BaseComponent<TConfig extends BaseComponentConfig, TData, TModel extends BaseComponentModel> extends HTMLElement {
|
|
12
|
-
/**
|
|
13
|
-
* Optional instance-level configuration to override the global configuration
|
|
14
|
-
*/
|
|
15
|
-
configOverride?: TConfig;
|
|
16
|
-
/**
|
|
17
|
-
* The data bound to the component.
|
|
18
|
-
*/
|
|
19
|
-
data?: TData;
|
|
20
|
-
/**
|
|
21
|
-
* The Handlebars reference shared by all HawkSearch components.
|
|
22
|
-
*/
|
|
23
|
-
protected handlebars: typeof Handlebars;
|
|
24
|
-
/**
|
|
25
|
-
* For components that may have multiple instances with different data sources, this property is used to identify the subset of data used for binding.
|
|
26
|
-
*
|
|
27
|
-
* @internal
|
|
28
|
-
*/
|
|
29
|
-
protected eventFilter?: string;
|
|
30
|
-
/**
|
|
31
|
-
* The data bound to the Handlebars template.
|
|
32
|
-
*/
|
|
33
|
-
protected contentModel?: TModel;
|
|
34
|
-
/**
|
|
35
|
-
* The name of the component. This value is appended to `hawksearch-` to determine the tag name. For example, a value of `search-results` would be rendered by `<hawksearch-search-results>`.
|
|
36
|
-
*
|
|
37
|
-
* @internal
|
|
38
|
-
*/
|
|
39
|
-
protected abstract componentName: keyof HawkSearchComponents;
|
|
40
|
-
/**
|
|
41
|
-
* The default Handlebars template.
|
|
42
|
-
*
|
|
43
|
-
* @internal
|
|
44
|
-
*/
|
|
45
|
-
protected abstract defaultHtml: string;
|
|
46
|
-
/**
|
|
47
|
-
* Determines whether the component is bound by an event. If `false`, binding is performed by the parent component.
|
|
48
|
-
*
|
|
49
|
-
* @internal
|
|
50
|
-
*/
|
|
51
|
-
protected abstract bindFromEvent: boolean;
|
|
52
|
-
/**
|
|
53
|
-
* The optional configuration object for this component.
|
|
54
|
-
*/
|
|
55
|
-
protected get configuration(): TConfig | undefined;
|
|
56
|
-
/**
|
|
57
|
-
* Whether or not the component is rendered within the Shadow DOM. In order of preference, this is specified by {@link configuration} or {@link Models.HawkSearchConfig.shadowDom}.
|
|
58
|
-
*
|
|
59
|
-
* @internal
|
|
60
|
-
* @defaultValue `true`
|
|
61
|
-
*/
|
|
62
|
-
protected get shadowDom(): boolean;
|
|
63
|
-
/**
|
|
64
|
-
* The root element which should be used for querying any child elements. This resolves to `this.shadowRoot` if the Shadow DOM is enabled, otherwise `this`.
|
|
65
|
-
*/
|
|
66
|
-
get rootElement(): ParentNode;
|
|
67
|
-
/**
|
|
68
|
-
* The name of the event that this component listens to for data binding. if {@link bindFromEvent} is `true`, this prepends `hawksearch:bind-` to {@link componentName} and appends :{@link eventFilter}, if specified.
|
|
69
|
-
*
|
|
70
|
-
* @internal
|
|
71
|
-
*/
|
|
72
|
-
private get eventName();
|
|
73
|
-
/**
|
|
74
|
-
* @internal
|
|
75
|
-
*/
|
|
76
|
-
private bindEventHandler?;
|
|
77
|
-
/**
|
|
78
|
-
* @internal
|
|
79
|
-
*/
|
|
80
|
-
private template;
|
|
81
|
-
/**
|
|
82
|
-
* @ignore
|
|
83
|
-
*/
|
|
84
|
-
connectedCallback(): void;
|
|
85
|
-
/**
|
|
86
|
-
* @ignore
|
|
87
|
-
*/
|
|
88
|
-
disconnectedCallback(): void;
|
|
89
|
-
/**
|
|
90
|
-
* Optional method that can be overwritten to register Handlebars helper functions which can be accessed from the template. For more information, see [Custom Helpers](https://handlebarsjs.com/guide/#custom-helpers).
|
|
91
|
-
*
|
|
92
|
-
* @virtual
|
|
93
|
-
*/
|
|
94
|
-
protected registerHelpers(): void;
|
|
95
|
-
/**
|
|
96
|
-
* Binds {@link contentModel} to the Handlebars template and renders the resulting HTML content.
|
|
97
|
-
*/
|
|
98
|
-
render(): void;
|
|
99
|
-
/**
|
|
100
|
-
* Determines whether the {@link data} meets the necessary conditions to perform data binding and render content.
|
|
101
|
-
*
|
|
102
|
-
* @virtual
|
|
103
|
-
* @returns Whether the component should be rendered. If `false`, the component will have empty contents and be set to `display: none;`.
|
|
104
|
-
*/
|
|
105
|
-
protected renderContent(): boolean;
|
|
106
|
-
/**
|
|
107
|
-
* Gets the data to be bound to the Handlebars template.
|
|
108
|
-
*
|
|
109
|
-
* @internal
|
|
110
|
-
* @returns The data bound to the Handlebars template.
|
|
111
|
-
*/
|
|
112
|
-
protected abstract getContentModel(): TModel;
|
|
113
|
-
/**
|
|
114
|
-
* After the component is rendered, this method is called to bind any child components.
|
|
115
|
-
*
|
|
116
|
-
* @virtual
|
|
117
|
-
*/
|
|
118
|
-
protected bindChildElements(): void;
|
|
119
|
-
/**
|
|
120
|
-
* After the component is rendered, this method is called for any additional processing (such as attaching event listeners) which needs to occur.
|
|
121
|
-
*
|
|
122
|
-
* @virtual
|
|
123
|
-
*/
|
|
124
|
-
protected onRender(): void;
|
|
125
|
-
/**
|
|
126
|
-
* @returns The Handlebars template HTML. In order of preference, this is specified by the child contents of the HTML element, the template specified by {@link configuration}, or the default template for the component.
|
|
127
|
-
*
|
|
128
|
-
* @internal
|
|
129
|
-
*/
|
|
130
|
-
private getCustomTemplateHtml;
|
|
131
|
-
/**
|
|
132
|
-
* Replaces placeholders in a given string with values from a data object.
|
|
133
|
-
*
|
|
134
|
-
* @param template The template string.
|
|
135
|
-
* @param values The object containing properties which will be bound to `template`.
|
|
136
|
-
* @returns The `template` string with all placeholders replaced by the values specified in `values`.
|
|
137
|
-
*/
|
|
138
|
-
protected interpolate(template: string, values: Record<string, string>): string;
|
|
139
|
-
}
|
|
1
|
+
import { BaseComponentConfig, HawkSearchComponents } from '@configuration';
|
|
2
|
+
import { BaseComponentModel } from '@models';
|
|
3
|
+
/**
|
|
4
|
+
* @typeParam TConfig Component configuration
|
|
5
|
+
* @typeParam TData Component data
|
|
6
|
+
* @typeParam TModel Data bound to Handlebars template
|
|
7
|
+
*
|
|
8
|
+
* @noInheritDoc
|
|
9
|
+
* @category Base
|
|
10
|
+
*/
|
|
11
|
+
export declare abstract class BaseComponent<TConfig extends BaseComponentConfig, TData, TModel extends BaseComponentModel> extends HTMLElement {
|
|
12
|
+
/**
|
|
13
|
+
* Optional instance-level configuration to override the global configuration
|
|
14
|
+
*/
|
|
15
|
+
configOverride?: TConfig;
|
|
16
|
+
/**
|
|
17
|
+
* The data bound to the component.
|
|
18
|
+
*/
|
|
19
|
+
data?: TData;
|
|
20
|
+
/**
|
|
21
|
+
* The Handlebars reference shared by all HawkSearch components.
|
|
22
|
+
*/
|
|
23
|
+
protected handlebars: typeof Handlebars;
|
|
24
|
+
/**
|
|
25
|
+
* For components that may have multiple instances with different data sources, this property is used to identify the subset of data used for binding.
|
|
26
|
+
*
|
|
27
|
+
* @internal
|
|
28
|
+
*/
|
|
29
|
+
protected eventFilter?: string;
|
|
30
|
+
/**
|
|
31
|
+
* The data bound to the Handlebars template.
|
|
32
|
+
*/
|
|
33
|
+
protected contentModel?: TModel;
|
|
34
|
+
/**
|
|
35
|
+
* The name of the component. This value is appended to `hawksearch-` to determine the tag name. For example, a value of `search-results` would be rendered by `<hawksearch-search-results>`.
|
|
36
|
+
*
|
|
37
|
+
* @internal
|
|
38
|
+
*/
|
|
39
|
+
protected abstract componentName: keyof HawkSearchComponents;
|
|
40
|
+
/**
|
|
41
|
+
* The default Handlebars template.
|
|
42
|
+
*
|
|
43
|
+
* @internal
|
|
44
|
+
*/
|
|
45
|
+
protected abstract defaultHtml: string;
|
|
46
|
+
/**
|
|
47
|
+
* Determines whether the component is bound by an event. If `false`, binding is performed by the parent component.
|
|
48
|
+
*
|
|
49
|
+
* @internal
|
|
50
|
+
*/
|
|
51
|
+
protected abstract bindFromEvent: boolean;
|
|
52
|
+
/**
|
|
53
|
+
* The optional configuration object for this component.
|
|
54
|
+
*/
|
|
55
|
+
protected get configuration(): TConfig | undefined;
|
|
56
|
+
/**
|
|
57
|
+
* Whether or not the component is rendered within the Shadow DOM. In order of preference, this is specified by {@link configuration} or {@link Models.HawkSearchConfig.shadowDom}.
|
|
58
|
+
*
|
|
59
|
+
* @internal
|
|
60
|
+
* @defaultValue `true`
|
|
61
|
+
*/
|
|
62
|
+
protected get shadowDom(): boolean;
|
|
63
|
+
/**
|
|
64
|
+
* The root element which should be used for querying any child elements. This resolves to `this.shadowRoot` if the Shadow DOM is enabled, otherwise `this`.
|
|
65
|
+
*/
|
|
66
|
+
get rootElement(): ParentNode;
|
|
67
|
+
/**
|
|
68
|
+
* The name of the event that this component listens to for data binding. if {@link bindFromEvent} is `true`, this prepends `hawksearch:bind-` to {@link componentName} and appends :{@link eventFilter}, if specified.
|
|
69
|
+
*
|
|
70
|
+
* @internal
|
|
71
|
+
*/
|
|
72
|
+
private get eventName();
|
|
73
|
+
/**
|
|
74
|
+
* @internal
|
|
75
|
+
*/
|
|
76
|
+
private bindEventHandler?;
|
|
77
|
+
/**
|
|
78
|
+
* @internal
|
|
79
|
+
*/
|
|
80
|
+
private template;
|
|
81
|
+
/**
|
|
82
|
+
* @ignore
|
|
83
|
+
*/
|
|
84
|
+
connectedCallback(): void;
|
|
85
|
+
/**
|
|
86
|
+
* @ignore
|
|
87
|
+
*/
|
|
88
|
+
disconnectedCallback(): void;
|
|
89
|
+
/**
|
|
90
|
+
* Optional method that can be overwritten to register Handlebars helper functions which can be accessed from the template. For more information, see [Custom Helpers](https://handlebarsjs.com/guide/#custom-helpers).
|
|
91
|
+
*
|
|
92
|
+
* @virtual
|
|
93
|
+
*/
|
|
94
|
+
protected registerHelpers(): void;
|
|
95
|
+
/**
|
|
96
|
+
* Binds {@link contentModel} to the Handlebars template and renders the resulting HTML content.
|
|
97
|
+
*/
|
|
98
|
+
render(): void;
|
|
99
|
+
/**
|
|
100
|
+
* Determines whether the {@link data} meets the necessary conditions to perform data binding and render content.
|
|
101
|
+
*
|
|
102
|
+
* @virtual
|
|
103
|
+
* @returns Whether the component should be rendered. If `false`, the component will have empty contents and be set to `display: none;`.
|
|
104
|
+
*/
|
|
105
|
+
protected renderContent(): boolean;
|
|
106
|
+
/**
|
|
107
|
+
* Gets the data to be bound to the Handlebars template.
|
|
108
|
+
*
|
|
109
|
+
* @internal
|
|
110
|
+
* @returns The data bound to the Handlebars template.
|
|
111
|
+
*/
|
|
112
|
+
protected abstract getContentModel(): TModel;
|
|
113
|
+
/**
|
|
114
|
+
* After the component is rendered, this method is called to bind any child components.
|
|
115
|
+
*
|
|
116
|
+
* @virtual
|
|
117
|
+
*/
|
|
118
|
+
protected bindChildElements(): void;
|
|
119
|
+
/**
|
|
120
|
+
* After the component is rendered, this method is called for any additional processing (such as attaching event listeners) which needs to occur.
|
|
121
|
+
*
|
|
122
|
+
* @virtual
|
|
123
|
+
*/
|
|
124
|
+
protected onRender(): void;
|
|
125
|
+
/**
|
|
126
|
+
* @returns The Handlebars template HTML. In order of preference, this is specified by the child contents of the HTML element, the template specified by {@link configuration}, or the default template for the component.
|
|
127
|
+
*
|
|
128
|
+
* @internal
|
|
129
|
+
*/
|
|
130
|
+
private getCustomTemplateHtml;
|
|
131
|
+
/**
|
|
132
|
+
* Replaces placeholders in a given string with values from a data object.
|
|
133
|
+
*
|
|
134
|
+
* @param template The template string.
|
|
135
|
+
* @param values The object containing properties which will be bound to `template`.
|
|
136
|
+
* @returns The `template` string with all placeholders replaced by the values specified in `values`.
|
|
137
|
+
*/
|
|
138
|
+
protected interpolate(template: string, values: Record<string, string>): string;
|
|
139
|
+
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { BaseComponent } from '@components';
|
|
2
|
-
import { BaseComponentConfig } from '@configuration';
|
|
3
|
-
import { BaseComponentModel, ContentType } from '@models';
|
|
4
|
-
/**
|
|
5
|
-
* @category Content
|
|
6
|
-
*/
|
|
7
|
-
export declare abstract class BaseContentComponent<TConfig extends BaseComponentConfig, TData extends ContentType, TModel extends BaseComponentModel> extends BaseComponent<TConfig, TData, TModel> {
|
|
8
|
-
protected bindFromEvent: boolean;
|
|
9
|
-
}
|
|
1
|
+
import { BaseComponent } from '@components';
|
|
2
|
+
import { BaseComponentConfig } from '@configuration';
|
|
3
|
+
import { BaseComponentModel, ContentType } from '@models';
|
|
4
|
+
/**
|
|
5
|
+
* @category Content
|
|
6
|
+
*/
|
|
7
|
+
export declare abstract class BaseContentComponent<TConfig extends BaseComponentConfig, TData extends ContentType, TModel extends BaseComponentModel> extends BaseComponent<TConfig, TData, TModel> {
|
|
8
|
+
protected bindFromEvent: boolean;
|
|
9
|
+
}
|
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
import { CustomContentComponentConfig, HawkSearchComponents } from '@configuration';
|
|
2
|
-
import { CustomContent, CustomContentComponentModel } from '@models';
|
|
3
|
-
import { BaseContentComponent } from '../base-content.component';
|
|
4
|
-
/**
|
|
5
|
-
* The Custom Content component renders HTML defined in HawkSearch.
|
|
6
|
-
*
|
|
7
|
-
* ## Tag
|
|
8
|
-
* The tag for this component is `<hawksearch-custom-content>`.
|
|
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 ./custom-content.component.hbs}
|
|
13
|
-
*
|
|
14
|
-
* @category Content
|
|
15
|
-
*/
|
|
16
|
-
export declare class CustomContentComponent extends BaseContentComponent<CustomContentComponentConfig, CustomContent, CustomContentComponentModel> {
|
|
17
|
-
protected componentName: keyof HawkSearchComponents;
|
|
18
|
-
protected defaultHtml: any;
|
|
19
|
-
protected renderContent(): boolean;
|
|
20
|
-
protected getContentModel(): CustomContentComponentModel;
|
|
21
|
-
}
|
|
1
|
+
import { CustomContentComponentConfig, HawkSearchComponents } from '@configuration';
|
|
2
|
+
import { CustomContent, CustomContentComponentModel } from '@models';
|
|
3
|
+
import { BaseContentComponent } from '../base-content.component';
|
|
4
|
+
/**
|
|
5
|
+
* The Custom Content component renders HTML defined in HawkSearch.
|
|
6
|
+
*
|
|
7
|
+
* ## Tag
|
|
8
|
+
* The tag for this component is `<hawksearch-custom-content>`.
|
|
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 ./custom-content.component.hbs}
|
|
13
|
+
*
|
|
14
|
+
* @category Content
|
|
15
|
+
*/
|
|
16
|
+
export declare class CustomContentComponent extends BaseContentComponent<CustomContentComponentConfig, CustomContent, CustomContentComponentModel> {
|
|
17
|
+
protected componentName: keyof HawkSearchComponents;
|
|
18
|
+
protected defaultHtml: any;
|
|
19
|
+
protected renderContent(): boolean;
|
|
20
|
+
protected getContentModel(): CustomContentComponentModel;
|
|
21
|
+
}
|
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
import { FeaturedItemsContentComponentConfig, HawkSearchComponents } from '@configuration';
|
|
2
|
-
import { FeaturedItemsContent, FeaturedItemsContentComponentModel } from '@models';
|
|
3
|
-
import { BaseContentComponent } from '../base-content.component';
|
|
4
|
-
/**
|
|
5
|
-
* The Featured Items Content component renders a custom list of search results (typically products) defined as Spotlights in HawkSearch. This is commonly used to display a default set of products when a query returns no results.
|
|
6
|
-
*
|
|
7
|
-
* ## Tag
|
|
8
|
-
* The tag for this component is `<hawksearch-featured-items-content>`.
|
|
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 ./featured-items-content.component.hbs}
|
|
13
|
-
*
|
|
14
|
-
* @category Content
|
|
15
|
-
*/
|
|
16
|
-
export declare class FeaturedItemsContentComponent extends BaseContentComponent<FeaturedItemsContentComponentConfig, FeaturedItemsContent, FeaturedItemsContentComponentModel> {
|
|
17
|
-
protected componentName: keyof HawkSearchComponents;
|
|
18
|
-
protected defaultHtml: any;
|
|
19
|
-
protected renderContent(): boolean;
|
|
20
|
-
protected getContentModel(): FeaturedItemsContentComponentModel;
|
|
21
|
-
protected bindChildElements(): void;
|
|
22
|
-
}
|
|
1
|
+
import { FeaturedItemsContentComponentConfig, HawkSearchComponents } from '@configuration';
|
|
2
|
+
import { FeaturedItemsContent, FeaturedItemsContentComponentModel } from '@models';
|
|
3
|
+
import { BaseContentComponent } from '../base-content.component';
|
|
4
|
+
/**
|
|
5
|
+
* The Featured Items Content component renders a custom list of search results (typically products) defined as Spotlights in HawkSearch. This is commonly used to display a default set of products when a query returns no results.
|
|
6
|
+
*
|
|
7
|
+
* ## Tag
|
|
8
|
+
* The tag for this component is `<hawksearch-featured-items-content>`.
|
|
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 ./featured-items-content.component.hbs}
|
|
13
|
+
*
|
|
14
|
+
* @category Content
|
|
15
|
+
*/
|
|
16
|
+
export declare class FeaturedItemsContentComponent extends BaseContentComponent<FeaturedItemsContentComponentConfig, FeaturedItemsContent, FeaturedItemsContentComponentModel> {
|
|
17
|
+
protected componentName: keyof HawkSearchComponents;
|
|
18
|
+
protected defaultHtml: any;
|
|
19
|
+
protected renderContent(): boolean;
|
|
20
|
+
protected getContentModel(): FeaturedItemsContentComponentModel;
|
|
21
|
+
protected bindChildElements(): void;
|
|
22
|
+
}
|