@searchstax-inc/searchstudio-ux-js 0.3.0 → 0.3.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/README.md
CHANGED
|
@@ -28,42 +28,7 @@ After importing Searchstax class a new instance needs to be created:
|
|
|
28
28
|
```const searchstax = new Searchstax();```
|
|
29
29
|
|
|
30
30
|
## Initialization
|
|
31
|
-
Initialization object
|
|
32
|
-
|
|
33
|
-
{
|
|
34
|
-
|
|
35
|
-
`language: string;` - language code. Example: 'en'
|
|
36
|
-
|
|
37
|
-
`searchURL: string;` - SeachStudio select endpoint
|
|
38
|
-
|
|
39
|
-
`suggesterURL: string;` - SeachStudio suggest endpoint
|
|
40
|
-
|
|
41
|
-
`trackApiKey: string;` - Api key used for tracking events
|
|
42
|
-
|
|
43
|
-
`searchAuth: string;` - Authentication value. based on authType it's either a token value or basic auth value
|
|
44
|
-
|
|
45
|
-
`authType: 'token' | 'basic';` - Type of authentication
|
|
46
|
-
|
|
47
|
-
`router: {` - optional object containing router settings
|
|
48
|
-
|
|
49
|
-
'enabled: boolean' - if enabled navigation will history and will keep track of search state
|
|
50
|
-
|
|
51
|
-
'routeName: string' - prefix name for all search properties
|
|
52
|
-
|
|
53
|
-
'title: (result: ISearchObject) => string' - function that will update page title
|
|
54
|
-
|
|
55
|
-
`ignoredKeys: string[]` - array of keys to ignore and not keep track of
|
|
56
|
-
|
|
57
|
-
`}`
|
|
58
|
-
|
|
59
|
-
`hooks?: {` - optional object that provides various hook options
|
|
60
|
-
|
|
61
|
-
`beforeSearch?: (props: ISearchObject) => ISearchObject | null;` - this function gets called before firing search. searchProps are being passed as a property and can be modified, if passed along further search will execute with modified properties, if null is returned then event gets canceled and search never fires.
|
|
62
|
-
|
|
63
|
-
`afterSearch?: (results: ISearchstaxParsedResult[]) => ISearchstaxParsedResult[];` - this function gets called after firing search and before rendering. It needs to return array of results that are either modified or untouched.
|
|
64
|
-
`};`
|
|
65
|
-
|
|
66
|
-
}
|
|
31
|
+
Initialization object needs to be of type: [ISearchstaxConfig](https://github.com/searchstax/searchstudio-ux-js/blob/main/src/interfaces/connector.interface.ts#L5)
|
|
67
32
|
|
|
68
33
|
Initialization example
|
|
69
34
|
```
|
|
@@ -146,31 +111,7 @@ Initialization properties
|
|
|
146
111
|
|
|
147
112
|
a. id of container where widget will be rendered
|
|
148
113
|
|
|
149
|
-
b.
|
|
150
|
-
|
|
151
|
-
`suggestAfterMinChars: number;` - controls how many characters the UI should accept at the minimum before showing suggestions
|
|
152
|
-
|
|
153
|
-
`templates?: {` - optional object that defines template override options
|
|
154
|
-
|
|
155
|
-
`mainTemplate?: {` - optional object for overriding main template
|
|
156
|
-
`template: string;` - main template in Mustache templating language
|
|
157
|
-
`searchInputId: string;` - id of search input within the mainTemplate
|
|
158
|
-
`};`
|
|
159
|
-
|
|
160
|
-
`autosuggestItemTemplate?: {` - autosuggest item template in Mustache
|
|
161
|
-
`template: string;` - autosuggest template in Mustache templating language
|
|
162
|
-
`};`
|
|
163
|
-
`};`
|
|
164
|
-
|
|
165
|
-
`hooks?: {` - optional object that provides various hook options
|
|
166
|
-
|
|
167
|
-
`beforeAutosuggest?: (props: ISearchstaxSuggestProps) => ISearchstaxSuggestProps | null;` - this function gets called before firing autosuggest. autosuggestProps are being passed as a property and can be modified, if passed along further search will execute with modified properties, if null is returned then event gets canceled and search never fires.
|
|
168
|
-
|
|
169
|
-
`afterAutosuggest?: (result: ISearchstaxSuggestResponse) => ISearchstaxSuggestResponse;`- this function gets called after autosuggest has values but before rendering. It needs to return same type of data but it can be modified.
|
|
170
|
-
|
|
171
|
-
`};`
|
|
172
|
-
|
|
173
|
-
}
|
|
114
|
+
b. Input widget config object of type: [ISearchstaxSearchInputConfig](https://github.com/searchstax/searchstudio-ux-js/blob/main/src/interfaces/searchInputConfig.interface.ts#L4)
|
|
174
115
|
|
|
175
116
|
|
|
176
117
|
example of input widget initialization with minimum options
|
|
@@ -223,34 +164,7 @@ Initialization properties
|
|
|
223
164
|
|
|
224
165
|
a. id of container where widget will be rendered
|
|
225
166
|
|
|
226
|
-
b.
|
|
227
|
-
|
|
228
|
-
`searchResultUniqueIdAttribute?: string;` - this is needed only if searchResultTemplate is overridden. searchResultTemplate needs to have unique result id property. Default is data-searchstax-unique-result-id="uniqueId". see example below on how it is used
|
|
229
|
-
|
|
230
|
-
`templates?: {` - optional object that defines template override options
|
|
231
|
-
|
|
232
|
-
`mainTemplate?: {`
|
|
233
|
-
template: string; - main template in Mustache templating language.,
|
|
234
|
-
searchResultsContainerId: string;` - this is needed only if mainTemplate is overridden. It points to an element in the template where results need to be rendered
|
|
235
|
-
}
|
|
236
|
-
|
|
237
|
-
`searchResultTemplate?: {`
|
|
238
|
-
template: string - result template using Mustache. ISearchstaxParsedResult is passed to the template and all its properties are available to be used when rendering;
|
|
239
|
-
searchResultUniqueIdAttribute?: string - this is needed only if searchResultTemplate is overridden. searchResultTemplate needs to have unique result id property. Default is data-searchstax-unique-result-id="niqueId". see example below on how it is used
|
|
240
|
-
}
|
|
241
|
-
|
|
242
|
-
`noSearchResultTemplate?: {`
|
|
243
|
-
template: string - Mustache template for no results section override. spellingSuggestion and searchTerm are values available in the template
|
|
244
|
-
}
|
|
245
|
-
|
|
246
|
-
`};`
|
|
247
|
-
|
|
248
|
-
`hooks?: {` - optional object that provides various hook options
|
|
249
|
-
|
|
250
|
-
`afterLinkClick?: (resultClicked: ISearchstaxParsedResult) => ISearchstaxParsedResult | null;` - function is called after user clicks result and passes that result as a property. when result is passed along tracking will execute and user will be navigated if null is returned events are canceled and nothing happens.
|
|
251
|
-
|
|
252
|
-
`};`
|
|
253
|
-
}
|
|
167
|
+
b. Result widget config object of type: [ISearchstaxSearchResultsConfig](https://github.com/searchstax/searchstudio-ux-js/blob/main/src/interfaces/searchResultsConfig.interface.ts#L3)
|
|
254
168
|
|
|
255
169
|
example of results widget initialization with minimum options
|
|
256
170
|
```
|
|
@@ -353,18 +267,7 @@ Initialization properties
|
|
|
353
267
|
|
|
354
268
|
a. id of container where widget will be rendered
|
|
355
269
|
|
|
356
|
-
b.
|
|
357
|
-
|
|
358
|
-
`templates?: {` - optional object that defines template override options
|
|
359
|
-
|
|
360
|
-
`mainTemplate?: {` - optional object for overriding main template
|
|
361
|
-
`template: string;` - main template in Mustache templating language. Data available: IPaginationData
|
|
362
|
-
`previousButtonClass: string;` - class of previous page link within template,
|
|
363
|
-
`nextButtonClass: string;` - class of next page link within template,
|
|
364
|
-
`};`
|
|
365
|
-
`};`
|
|
366
|
-
|
|
367
|
-
}
|
|
270
|
+
b. Pagination widget config object of type: [ISearchstaxSearchPaginationConfig](https://github.com/searchstax/searchstudio-ux-js/blob/main/src/interfaces/searchPaginationConfig.interface.ts#L1)
|
|
368
271
|
|
|
369
272
|
example of pagination widget initialization with minimum options
|
|
370
273
|
```
|
|
@@ -401,65 +304,7 @@ Initialization properties
|
|
|
401
304
|
|
|
402
305
|
a. id of container where widget will be rendered
|
|
403
306
|
|
|
404
|
-
b.
|
|
405
|
-
|
|
406
|
-
`facetingType`: "and" | "or" | "showUnavailable" | "tabs" - type that determines how facets will behave,
|
|
407
|
-
|
|
408
|
-
'specificFacets?: string[]' - optional array of facet names that if provided will only render those facets
|
|
409
|
-
|
|
410
|
-
`itemsPerPageDesktop`: number - default expanded facets for desktop,
|
|
411
|
-
|
|
412
|
-
`itemsPerPageMobile`: number - default expanded facets for mobile,
|
|
413
|
-
|
|
414
|
-
`templates?: {` - optional object that defines template override options
|
|
415
|
-
|
|
416
|
-
`mainTemplateDesktop?: {` - optional object for overriding main template
|
|
417
|
-
`template: string;` - main template in Mustache templating language data available: IFacetsTemplateData
|
|
418
|
-
`facetsContainerClass: string;` - class of container where facets will be placed
|
|
419
|
-
`},`
|
|
420
|
-
|
|
421
|
-
`mainTemplateMobile?: {` - optional object for overriding main mobile template
|
|
422
|
-
`template: string;` - main template in Mustache templating language. data available: IFacetsTemplateData
|
|
423
|
-
`facetsContainerId: string;` - id of container where facets will be placed
|
|
424
|
-
`closeOverlayTriggerClasses: string[];` - class list of all elements that should trigger mobile overlay close action
|
|
425
|
-
`filterByContainerId: string` - id of container where "Filter By" button will be rendered
|
|
426
|
-
'selectedFacetsContainerId: string' - id of container where selected facets will be listed
|
|
427
|
-
`},`
|
|
428
|
-
|
|
429
|
-
`showMoreButtonContainerTemplate?: {` - optional object for overriding facet section show more/less template
|
|
430
|
-
`template: string;` - main template in Mustache templating language. data available: IFacetData
|
|
431
|
-
`showMoreButtonClass: string;` - class of container where show more/less button will be placed
|
|
432
|
-
`},`
|
|
433
|
-
|
|
434
|
-
`facetItemContainerTemplate?: {` - optional object for overriding facet container template
|
|
435
|
-
`template: string;` - main template in Mustache templating language. data available: IFacetData
|
|
436
|
-
'facetListTitleContainerClass: string;' - container class where facet category title will be rendered within template
|
|
437
|
-
`facetListContainerClass: string;` - container class where facet items will be listed
|
|
438
|
-
`},`
|
|
439
|
-
|
|
440
|
-
`clearFacetsTemplate?: {` - optional object for overriding clear facets container template
|
|
441
|
-
`template: string;` - main template in Mustache templating language. data available: {shouldShow: boolean}
|
|
442
|
-
'containerId: string;' - container id where clear facets button will be rendered
|
|
443
|
-
`},`
|
|
444
|
-
|
|
445
|
-
`facetItemTemplate?: {` - optional object for overriding clear facet item template
|
|
446
|
-
`template: string;` - main template in Mustache templating language. data available: { ...IFacetValueData, isChecked }
|
|
447
|
-
'inputCheckboxClass: string;' - class of checkboxes
|
|
448
|
-
'checkTriggerClasses: string[];' - class list of elements that trigger facet select/unselect action
|
|
449
|
-
`},`
|
|
450
|
-
|
|
451
|
-
`filterByTemplate?: {` - optional object for overriding filter by button template
|
|
452
|
-
`template: string;` - main template in Mustache templating language
|
|
453
|
-
'containerId: string;' - id where button will be placed within the template
|
|
454
|
-
`},`
|
|
455
|
-
|
|
456
|
-
`selectedFacetsTemplate?: {` - optional object for overriding selected facets template
|
|
457
|
-
`template: string;` - main template in Mustache templating language. data available: IFacetValue | IFacetValueRange
|
|
458
|
-
'containerId: string;' - id where selected facets will be placed within the template
|
|
459
|
-
`},`
|
|
460
|
-
`};`
|
|
461
|
-
|
|
462
|
-
}
|
|
307
|
+
b. Facets widget config object of type: [ISearchstaxSearchFacetsConfig](https://github.com/searchstax/searchstudio-ux-js/blob/main/src/interfaces/searchFacetsConfig.interface.ts#L1)
|
|
463
308
|
|
|
464
309
|
example of facets widget initialization with minimum options
|
|
465
310
|
```
|
|
@@ -584,17 +429,7 @@ Initialization properties
|
|
|
584
429
|
|
|
585
430
|
a. id of container where widget will be rendered
|
|
586
431
|
|
|
587
|
-
b.
|
|
588
|
-
|
|
589
|
-
`templates?: {` - optional object that defines template override options
|
|
590
|
-
|
|
591
|
-
`main?: {` - optional object for overriding main template
|
|
592
|
-
`template: string;` - main template in Mustache templating language
|
|
593
|
-
`};`
|
|
594
|
-
|
|
595
|
-
`};`
|
|
596
|
-
|
|
597
|
-
}
|
|
432
|
+
b. SearchFeedback widget config object of type: [ISearchstaxSearchFeedbackConfig](https://github.com/searchstax/searchstudio-ux-js/blob/main/src/interfaces/searchFeedbackConfig.interface.ts#L1)
|
|
598
433
|
|
|
599
434
|
|
|
600
435
|
example of search feedback widget initialization with minimum options
|
|
@@ -625,23 +460,7 @@ Initialization properties
|
|
|
625
460
|
|
|
626
461
|
a. id of container where widget will be rendered
|
|
627
462
|
|
|
628
|
-
b.
|
|
629
|
-
|
|
630
|
-
`templates?: {` - optional object that defines template override options
|
|
631
|
-
|
|
632
|
-
`main?: {` - optional object for overriding main template
|
|
633
|
-
`template: string;` - main template in Mustache templating language
|
|
634
|
-
`relatedSearchesContainerClass: string;` - class where related searches will be rendered within the template
|
|
635
|
-
`};`
|
|
636
|
-
|
|
637
|
-
`relatedSearch?: {` - optional object for overriding main template
|
|
638
|
-
`template: string;` - main template in Mustache templating language
|
|
639
|
-
`relatedSearchContainerClass: string;` - class where related search item will be rendered within the template
|
|
640
|
-
`};`
|
|
641
|
-
|
|
642
|
-
`};`
|
|
643
|
-
|
|
644
|
-
}
|
|
463
|
+
b. RelatedSearches widget config object of type: [ISearchstaxRelatedSearchesConfig](https://github.com/searchstax/searchstudio-ux-js/blob/main/src/interfaces/searchRelatedSearchesConfig.interface.ts#L1)
|
|
645
464
|
|
|
646
465
|
|
|
647
466
|
example of search feedback widget initialization with minimum options
|
|
@@ -691,22 +510,7 @@ Initialization properties
|
|
|
691
510
|
|
|
692
511
|
a. id of container where widget will be rendered
|
|
693
512
|
|
|
694
|
-
b.
|
|
695
|
-
|
|
696
|
-
`templates?: {` - optional object that defines template override options
|
|
697
|
-
|
|
698
|
-
`mainTemplate?: {` - optional object for overriding main template
|
|
699
|
-
`template: string;` - main template in Mustache templating language
|
|
700
|
-
`externalPromotionsContainerId: string;` - id where external promotions will be rendered within the template
|
|
701
|
-
`};`
|
|
702
|
-
|
|
703
|
-
`externalPromotion?: {` - optional object for overriding main template
|
|
704
|
-
`template: string;` - main template in Mustache templating language
|
|
705
|
-
`};`
|
|
706
|
-
|
|
707
|
-
`};`
|
|
708
|
-
|
|
709
|
-
}
|
|
513
|
+
b. ExternalPromotions widget config object of type: [ISearchstaxExternalPromotionsConfig](https://github.com/searchstax/searchstudio-ux-js/blob/main/src/interfaces/searchExternalPromotionsConfig.interface.ts#L1)
|
|
710
514
|
|
|
711
515
|
|
|
712
516
|
example of search feedback widget initialization with minimum options
|
|
@@ -763,18 +567,7 @@ Initialization properties
|
|
|
763
567
|
|
|
764
568
|
a. id of container where widget will be rendered
|
|
765
569
|
|
|
766
|
-
b.
|
|
767
|
-
|
|
768
|
-
`templates?: {` - optional object that defines template override options
|
|
769
|
-
|
|
770
|
-
`main?: {` - optional object for overriding main template
|
|
771
|
-
`template: string;` - main template in Mustache templating language
|
|
772
|
-
`selectId: string;` - id of select element within the template
|
|
773
|
-
`};`
|
|
774
|
-
|
|
775
|
-
`};`
|
|
776
|
-
|
|
777
|
-
}
|
|
570
|
+
b. Sorting widget config object of type: [ISearchstaxSearchSortingConfig](https://github.com/searchstax/searchstudio-ux-js/blob/main/src/interfaces/searchSortingConfig.interface.ts#L1)
|
|
778
571
|
|
|
779
572
|
|
|
780
573
|
example of sorting widget initialization with minimum options
|
package/README.mustache
CHANGED
|
@@ -28,42 +28,7 @@ After importing Searchstax class a new instance needs to be created:
|
|
|
28
28
|
```const searchstax = new Searchstax();```
|
|
29
29
|
|
|
30
30
|
## Initialization
|
|
31
|
-
Initialization object
|
|
32
|
-
|
|
33
|
-
{
|
|
34
|
-
|
|
35
|
-
`language: string;` - language code. Example: 'en'
|
|
36
|
-
|
|
37
|
-
`searchURL: string;` - SeachStudio select endpoint
|
|
38
|
-
|
|
39
|
-
`suggesterURL: string;` - SeachStudio suggest endpoint
|
|
40
|
-
|
|
41
|
-
`trackApiKey: string;` - Api key used for tracking events
|
|
42
|
-
|
|
43
|
-
`searchAuth: string;` - Authentication value. based on authType it's either a token value or basic auth value
|
|
44
|
-
|
|
45
|
-
`authType: 'token' | 'basic';` - Type of authentication
|
|
46
|
-
|
|
47
|
-
`router: {` - optional object containing router settings
|
|
48
|
-
|
|
49
|
-
'enabled: boolean' - if enabled navigation will history and will keep track of search state
|
|
50
|
-
|
|
51
|
-
'routeName: string' - prefix name for all search properties
|
|
52
|
-
|
|
53
|
-
'title: (result: ISearchObject) => string' - function that will update page title
|
|
54
|
-
|
|
55
|
-
`ignoredKeys: string[]` - array of keys to ignore and not keep track of
|
|
56
|
-
|
|
57
|
-
`}`
|
|
58
|
-
|
|
59
|
-
`hooks?: {` - optional object that provides various hook options
|
|
60
|
-
|
|
61
|
-
`beforeSearch?: (props: ISearchObject) => ISearchObject | null;` - this function gets called before firing search. searchProps are being passed as a property and can be modified, if passed along further search will execute with modified properties, if null is returned then event gets canceled and search never fires.
|
|
62
|
-
|
|
63
|
-
`afterSearch?: (results: ISearchstaxParsedResult[]) => ISearchstaxParsedResult[];` - this function gets called after firing search and before rendering. It needs to return array of results that are either modified or untouched.
|
|
64
|
-
`};`
|
|
65
|
-
|
|
66
|
-
}
|
|
31
|
+
Initialization object needs to be of type: [ISearchstaxConfig](https://github.com/searchstax/searchstudio-ux-js/blob/main/src/interfaces/connector.interface.ts#L5)
|
|
67
32
|
|
|
68
33
|
Initialization example
|
|
69
34
|
```
|
|
@@ -146,31 +111,7 @@ Initialization properties
|
|
|
146
111
|
|
|
147
112
|
a. id of container where widget will be rendered
|
|
148
113
|
|
|
149
|
-
b.
|
|
150
|
-
|
|
151
|
-
`suggestAfterMinChars: number;` - controls how many characters the UI should accept at the minimum before showing suggestions
|
|
152
|
-
|
|
153
|
-
`templates?: {` - optional object that defines template override options
|
|
154
|
-
|
|
155
|
-
`mainTemplate?: {` - optional object for overriding main template
|
|
156
|
-
`template: string;` - main template in Mustache templating language
|
|
157
|
-
`searchInputId: string;` - id of search input within the mainTemplate
|
|
158
|
-
`};`
|
|
159
|
-
|
|
160
|
-
`autosuggestItemTemplate?: {` - autosuggest item template in Mustache
|
|
161
|
-
`template: string;` - autosuggest template in Mustache templating language
|
|
162
|
-
`};`
|
|
163
|
-
`};`
|
|
164
|
-
|
|
165
|
-
`hooks?: {` - optional object that provides various hook options
|
|
166
|
-
|
|
167
|
-
`beforeAutosuggest?: (props: ISearchstaxSuggestProps) => ISearchstaxSuggestProps | null;` - this function gets called before firing autosuggest. autosuggestProps are being passed as a property and can be modified, if passed along further search will execute with modified properties, if null is returned then event gets canceled and search never fires.
|
|
168
|
-
|
|
169
|
-
`afterAutosuggest?: (result: ISearchstaxSuggestResponse) => ISearchstaxSuggestResponse;`- this function gets called after autosuggest has values but before rendering. It needs to return same type of data but it can be modified.
|
|
170
|
-
|
|
171
|
-
`};`
|
|
172
|
-
|
|
173
|
-
}
|
|
114
|
+
b. Input widget config object of type: [ISearchstaxSearchInputConfig](https://github.com/searchstax/searchstudio-ux-js/blob/main/src/interfaces/searchInputConfig.interface.ts#L4)
|
|
174
115
|
|
|
175
116
|
|
|
176
117
|
example of input widget initialization with minimum options
|
|
@@ -214,34 +155,7 @@ Initialization properties
|
|
|
214
155
|
|
|
215
156
|
a. id of container where widget will be rendered
|
|
216
157
|
|
|
217
|
-
b.
|
|
218
|
-
|
|
219
|
-
`searchResultUniqueIdAttribute?: string;` - this is needed only if searchResultTemplate is overridden. searchResultTemplate needs to have unique result id property. Default is data-searchstax-unique-result-id="uniqueId". see example below on how it is used
|
|
220
|
-
|
|
221
|
-
`templates?: {` - optional object that defines template override options
|
|
222
|
-
|
|
223
|
-
`mainTemplate?: {`
|
|
224
|
-
template: string; - main template in Mustache templating language.,
|
|
225
|
-
searchResultsContainerId: string;` - this is needed only if mainTemplate is overridden. It points to an element in the template where results need to be rendered
|
|
226
|
-
}
|
|
227
|
-
|
|
228
|
-
`searchResultTemplate?: {`
|
|
229
|
-
template: string - result template using Mustache. ISearchstaxParsedResult is passed to the template and all its properties are available to be used when rendering;
|
|
230
|
-
searchResultUniqueIdAttribute?: string - this is needed only if searchResultTemplate is overridden. searchResultTemplate needs to have unique result id property. Default is data-searchstax-unique-result-id="niqueId". see example below on how it is used
|
|
231
|
-
}
|
|
232
|
-
|
|
233
|
-
`noSearchResultTemplate?: {`
|
|
234
|
-
template: string - Mustache template for no results section override. spellingSuggestion and searchTerm are values available in the template
|
|
235
|
-
}
|
|
236
|
-
|
|
237
|
-
`};`
|
|
238
|
-
|
|
239
|
-
`hooks?: {` - optional object that provides various hook options
|
|
240
|
-
|
|
241
|
-
`afterLinkClick?: (resultClicked: ISearchstaxParsedResult) => ISearchstaxParsedResult | null;` - function is called after user clicks result and passes that result as a property. when result is passed along tracking will execute and user will be navigated if null is returned events are canceled and nothing happens.
|
|
242
|
-
|
|
243
|
-
`};`
|
|
244
|
-
}
|
|
158
|
+
b. Result widget config object of type: [ISearchstaxSearchResultsConfig](https://github.com/searchstax/searchstudio-ux-js/blob/main/src/interfaces/searchResultsConfig.interface.ts#L3)
|
|
245
159
|
|
|
246
160
|
example of results widget initialization with minimum options
|
|
247
161
|
```
|
|
@@ -280,18 +194,7 @@ Initialization properties
|
|
|
280
194
|
|
|
281
195
|
a. id of container where widget will be rendered
|
|
282
196
|
|
|
283
|
-
b.
|
|
284
|
-
|
|
285
|
-
`templates?: {` - optional object that defines template override options
|
|
286
|
-
|
|
287
|
-
`mainTemplate?: {` - optional object for overriding main template
|
|
288
|
-
`template: string;` - main template in Mustache templating language. Data available: IPaginationData
|
|
289
|
-
`previousButtonClass: string;` - class of previous page link within template,
|
|
290
|
-
`nextButtonClass: string;` - class of next page link within template,
|
|
291
|
-
`};`
|
|
292
|
-
`};`
|
|
293
|
-
|
|
294
|
-
}
|
|
197
|
+
b. Pagination widget config object of type: [ISearchstaxSearchPaginationConfig](https://github.com/searchstax/searchstudio-ux-js/blob/main/src/interfaces/searchPaginationConfig.interface.ts#L1)
|
|
295
198
|
|
|
296
199
|
example of pagination widget initialization with minimum options
|
|
297
200
|
```
|
|
@@ -316,65 +219,7 @@ Initialization properties
|
|
|
316
219
|
|
|
317
220
|
a. id of container where widget will be rendered
|
|
318
221
|
|
|
319
|
-
b.
|
|
320
|
-
|
|
321
|
-
`facetingType`: "and" | "or" | "showUnavailable" | "tabs" - type that determines how facets will behave,
|
|
322
|
-
|
|
323
|
-
'specificFacets?: string[]' - optional array of facet names that if provided will only render those facets
|
|
324
|
-
|
|
325
|
-
`itemsPerPageDesktop`: number - default expanded facets for desktop,
|
|
326
|
-
|
|
327
|
-
`itemsPerPageMobile`: number - default expanded facets for mobile,
|
|
328
|
-
|
|
329
|
-
`templates?: {` - optional object that defines template override options
|
|
330
|
-
|
|
331
|
-
`mainTemplateDesktop?: {` - optional object for overriding main template
|
|
332
|
-
`template: string;` - main template in Mustache templating language data available: IFacetsTemplateData
|
|
333
|
-
`facetsContainerClass: string;` - class of container where facets will be placed
|
|
334
|
-
`},`
|
|
335
|
-
|
|
336
|
-
`mainTemplateMobile?: {` - optional object for overriding main mobile template
|
|
337
|
-
`template: string;` - main template in Mustache templating language. data available: IFacetsTemplateData
|
|
338
|
-
`facetsContainerId: string;` - id of container where facets will be placed
|
|
339
|
-
`closeOverlayTriggerClasses: string[];` - class list of all elements that should trigger mobile overlay close action
|
|
340
|
-
`filterByContainerId: string` - id of container where "Filter By" button will be rendered
|
|
341
|
-
'selectedFacetsContainerId: string' - id of container where selected facets will be listed
|
|
342
|
-
`},`
|
|
343
|
-
|
|
344
|
-
`showMoreButtonContainerTemplate?: {` - optional object for overriding facet section show more/less template
|
|
345
|
-
`template: string;` - main template in Mustache templating language. data available: IFacetData
|
|
346
|
-
`showMoreButtonClass: string;` - class of container where show more/less button will be placed
|
|
347
|
-
`},`
|
|
348
|
-
|
|
349
|
-
`facetItemContainerTemplate?: {` - optional object for overriding facet container template
|
|
350
|
-
`template: string;` - main template in Mustache templating language. data available: IFacetData
|
|
351
|
-
'facetListTitleContainerClass: string;' - container class where facet category title will be rendered within template
|
|
352
|
-
`facetListContainerClass: string;` - container class where facet items will be listed
|
|
353
|
-
`},`
|
|
354
|
-
|
|
355
|
-
`clearFacetsTemplate?: {` - optional object for overriding clear facets container template
|
|
356
|
-
`template: string;` - main template in Mustache templating language. data available: {shouldShow: boolean}
|
|
357
|
-
'containerId: string;' - container id where clear facets button will be rendered
|
|
358
|
-
`},`
|
|
359
|
-
|
|
360
|
-
`facetItemTemplate?: {` - optional object for overriding clear facet item template
|
|
361
|
-
`template: string;` - main template in Mustache templating language. data available: { ...IFacetValueData, isChecked }
|
|
362
|
-
'inputCheckboxClass: string;' - class of checkboxes
|
|
363
|
-
'checkTriggerClasses: string[];' - class list of elements that trigger facet select/unselect action
|
|
364
|
-
`},`
|
|
365
|
-
|
|
366
|
-
`filterByTemplate?: {` - optional object for overriding filter by button template
|
|
367
|
-
`template: string;` - main template in Mustache templating language
|
|
368
|
-
'containerId: string;' - id where button will be placed within the template
|
|
369
|
-
`},`
|
|
370
|
-
|
|
371
|
-
`selectedFacetsTemplate?: {` - optional object for overriding selected facets template
|
|
372
|
-
`template: string;` - main template in Mustache templating language. data available: IFacetValue | IFacetValueRange
|
|
373
|
-
'containerId: string;' - id where selected facets will be placed within the template
|
|
374
|
-
`},`
|
|
375
|
-
`};`
|
|
376
|
-
|
|
377
|
-
}
|
|
222
|
+
b. Facets widget config object of type: [ISearchstaxSearchFacetsConfig](https://github.com/searchstax/searchstudio-ux-js/blob/main/src/interfaces/searchFacetsConfig.interface.ts#L1)
|
|
378
223
|
|
|
379
224
|
example of facets widget initialization with minimum options
|
|
380
225
|
```
|
|
@@ -440,17 +285,7 @@ Initialization properties
|
|
|
440
285
|
|
|
441
286
|
a. id of container where widget will be rendered
|
|
442
287
|
|
|
443
|
-
b.
|
|
444
|
-
|
|
445
|
-
`templates?: {` - optional object that defines template override options
|
|
446
|
-
|
|
447
|
-
`main?: {` - optional object for overriding main template
|
|
448
|
-
`template: string;` - main template in Mustache templating language
|
|
449
|
-
`};`
|
|
450
|
-
|
|
451
|
-
`};`
|
|
452
|
-
|
|
453
|
-
}
|
|
288
|
+
b. SearchFeedback widget config object of type: [ISearchstaxSearchFeedbackConfig](https://github.com/searchstax/searchstudio-ux-js/blob/main/src/interfaces/searchFeedbackConfig.interface.ts#L1)
|
|
454
289
|
|
|
455
290
|
|
|
456
291
|
example of search feedback widget initialization with minimum options
|
|
@@ -475,23 +310,7 @@ Initialization properties
|
|
|
475
310
|
|
|
476
311
|
a. id of container where widget will be rendered
|
|
477
312
|
|
|
478
|
-
b.
|
|
479
|
-
|
|
480
|
-
`templates?: {` - optional object that defines template override options
|
|
481
|
-
|
|
482
|
-
`main?: {` - optional object for overriding main template
|
|
483
|
-
`template: string;` - main template in Mustache templating language
|
|
484
|
-
`relatedSearchesContainerClass: string;` - class where related searches will be rendered within the template
|
|
485
|
-
`};`
|
|
486
|
-
|
|
487
|
-
`relatedSearch?: {` - optional object for overriding main template
|
|
488
|
-
`template: string;` - main template in Mustache templating language
|
|
489
|
-
`relatedSearchContainerClass: string;` - class where related search item will be rendered within the template
|
|
490
|
-
`};`
|
|
491
|
-
|
|
492
|
-
`};`
|
|
493
|
-
|
|
494
|
-
}
|
|
313
|
+
b. RelatedSearches widget config object of type: [ISearchstaxRelatedSearchesConfig](https://github.com/searchstax/searchstudio-ux-js/blob/main/src/interfaces/searchRelatedSearchesConfig.interface.ts#L1)
|
|
495
314
|
|
|
496
315
|
|
|
497
316
|
example of search feedback widget initialization with minimum options
|
|
@@ -526,22 +345,7 @@ Initialization properties
|
|
|
526
345
|
|
|
527
346
|
a. id of container where widget will be rendered
|
|
528
347
|
|
|
529
|
-
b.
|
|
530
|
-
|
|
531
|
-
`templates?: {` - optional object that defines template override options
|
|
532
|
-
|
|
533
|
-
`mainTemplate?: {` - optional object for overriding main template
|
|
534
|
-
`template: string;` - main template in Mustache templating language
|
|
535
|
-
`externalPromotionsContainerId: string;` - id where external promotions will be rendered within the template
|
|
536
|
-
`};`
|
|
537
|
-
|
|
538
|
-
`externalPromotion?: {` - optional object for overriding main template
|
|
539
|
-
`template: string;` - main template in Mustache templating language
|
|
540
|
-
`};`
|
|
541
|
-
|
|
542
|
-
`};`
|
|
543
|
-
|
|
544
|
-
}
|
|
348
|
+
b. ExternalPromotions widget config object of type: [ISearchstaxExternalPromotionsConfig](https://github.com/searchstax/searchstudio-ux-js/blob/main/src/interfaces/searchExternalPromotionsConfig.interface.ts#L1)
|
|
545
349
|
|
|
546
350
|
|
|
547
351
|
example of search feedback widget initialization with minimum options
|
|
@@ -571,18 +375,7 @@ Initialization properties
|
|
|
571
375
|
|
|
572
376
|
a. id of container where widget will be rendered
|
|
573
377
|
|
|
574
|
-
b.
|
|
575
|
-
|
|
576
|
-
`templates?: {` - optional object that defines template override options
|
|
577
|
-
|
|
578
|
-
`main?: {` - optional object for overriding main template
|
|
579
|
-
`template: string;` - main template in Mustache templating language
|
|
580
|
-
`selectId: string;` - id of select element within the template
|
|
581
|
-
`};`
|
|
582
|
-
|
|
583
|
-
`};`
|
|
584
|
-
|
|
585
|
-
}
|
|
378
|
+
b. Sorting widget config object of type: [ISearchstaxSearchSortingConfig](https://github.com/searchstax/searchstudio-ux-js/blob/main/src/interfaces/searchSortingConfig.interface.ts#L1)
|
|
586
379
|
|
|
587
380
|
|
|
588
381
|
example of sorting widget initialization with minimum options
|
|
@@ -153,10 +153,6 @@ export interface ISearchstaxSuggestResponse {
|
|
|
153
153
|
responseHeader: ISearchstaxSuggestResponseHeader;
|
|
154
154
|
suggest: ISearchstaxSuggest;
|
|
155
155
|
}
|
|
156
|
-
export interface ISearchstaxSuggestProps {
|
|
157
|
-
term: string;
|
|
158
|
-
queryParams: IAdditionalProp[];
|
|
159
|
-
}
|
|
160
156
|
export interface ISearchstaxSearchInputConfig {
|
|
161
157
|
suggestAfterMinChars: number;
|
|
162
158
|
templates?: ISearchstaxSearchInputConfigTemplates;
|
|
@@ -165,6 +161,10 @@ export interface ISearchstaxSearchInputConfig {
|
|
|
165
161
|
afterAutosuggest?: (result: ISearchstaxSuggestResponse) => ISearchstaxSuggestResponse;
|
|
166
162
|
};
|
|
167
163
|
}
|
|
164
|
+
export interface ISearchstaxSuggestProps {
|
|
165
|
+
term: string;
|
|
166
|
+
queryParams: IAdditionalProp[];
|
|
167
|
+
}
|
|
168
168
|
export interface ISearchstaxSearchInputConfigTemplates {
|
|
169
169
|
mainTemplate?: ISearchstaxSearchInputMainTemplateData;
|
|
170
170
|
autosuggestItemTemplate?: ISearchstaxSearchInputAutosuggestTemplateData;
|
|
@@ -366,7 +366,7 @@ export interface ISearchstaxRelatedSearchTemplateData {
|
|
|
366
366
|
template: string;
|
|
367
367
|
relatedSearchContainerClass: string;
|
|
368
368
|
}
|
|
369
|
-
export interface
|
|
369
|
+
export interface ISearchstaxSearchResultsConfig {
|
|
370
370
|
templates?: ISearchstaxSearchResultsConfigTemplates;
|
|
371
371
|
hooks?: {
|
|
372
372
|
afterLinkClick?: (resultClicked: ISearchstaxParsedResult) => ISearchstaxParsedResult | null;
|
|
@@ -434,7 +434,7 @@ export declare class Searchstax {
|
|
|
434
434
|
suggest(term: string, queryParams: IAdditionalProp[]): void;
|
|
435
435
|
changeLanguage(language: string): void;
|
|
436
436
|
addSearchInputWidget(containerId: string, config: ISearchstaxSearchInputConfig): void;
|
|
437
|
-
addSearchResultsWidget(containerId: string, config:
|
|
437
|
+
addSearchResultsWidget(containerId: string, config: ISearchstaxSearchResultsConfig): void;
|
|
438
438
|
addPaginationWidget(containerId: string, config: ISearchstaxSearchPaginationConfig): void;
|
|
439
439
|
addSearchFeedbackWidget(containerId: string, config: ISearchstaxSearchFeedbackConfig): void;
|
|
440
440
|
addSearchSortingWidget(containerId: string, config: ISearchstaxSearchSortingConfig): void;
|
|
@@ -153,10 +153,6 @@ export interface ISearchstaxSuggestResponse {
|
|
|
153
153
|
responseHeader: ISearchstaxSuggestResponseHeader;
|
|
154
154
|
suggest: ISearchstaxSuggest;
|
|
155
155
|
}
|
|
156
|
-
export interface ISearchstaxSuggestProps {
|
|
157
|
-
term: string;
|
|
158
|
-
queryParams: IAdditionalProp[];
|
|
159
|
-
}
|
|
160
156
|
export interface ISearchstaxSearchInputConfig {
|
|
161
157
|
suggestAfterMinChars: number;
|
|
162
158
|
templates?: ISearchstaxSearchInputConfigTemplates;
|
|
@@ -165,6 +161,10 @@ export interface ISearchstaxSearchInputConfig {
|
|
|
165
161
|
afterAutosuggest?: (result: ISearchstaxSuggestResponse) => ISearchstaxSuggestResponse;
|
|
166
162
|
};
|
|
167
163
|
}
|
|
164
|
+
export interface ISearchstaxSuggestProps {
|
|
165
|
+
term: string;
|
|
166
|
+
queryParams: IAdditionalProp[];
|
|
167
|
+
}
|
|
168
168
|
export interface ISearchstaxSearchInputConfigTemplates {
|
|
169
169
|
mainTemplate?: ISearchstaxSearchInputMainTemplateData;
|
|
170
170
|
autosuggestItemTemplate?: ISearchstaxSearchInputAutosuggestTemplateData;
|
|
@@ -366,7 +366,7 @@ export interface ISearchstaxRelatedSearchTemplateData {
|
|
|
366
366
|
template: string;
|
|
367
367
|
relatedSearchContainerClass: string;
|
|
368
368
|
}
|
|
369
|
-
export interface
|
|
369
|
+
export interface ISearchstaxSearchResultsConfig {
|
|
370
370
|
templates?: ISearchstaxSearchResultsConfigTemplates;
|
|
371
371
|
hooks?: {
|
|
372
372
|
afterLinkClick?: (resultClicked: ISearchstaxParsedResult) => ISearchstaxParsedResult | null;
|
|
@@ -434,7 +434,7 @@ export declare class Searchstax {
|
|
|
434
434
|
suggest(term: string, queryParams: IAdditionalProp[]): void;
|
|
435
435
|
changeLanguage(language: string): void;
|
|
436
436
|
addSearchInputWidget(containerId: string, config: ISearchstaxSearchInputConfig): void;
|
|
437
|
-
addSearchResultsWidget(containerId: string, config:
|
|
437
|
+
addSearchResultsWidget(containerId: string, config: ISearchstaxSearchResultsConfig): void;
|
|
438
438
|
addPaginationWidget(containerId: string, config: ISearchstaxSearchPaginationConfig): void;
|
|
439
439
|
addSearchFeedbackWidget(containerId: string, config: ISearchstaxSearchFeedbackConfig): void;
|
|
440
440
|
addSearchSortingWidget(containerId: string, config: ISearchstaxSearchSortingConfig): void;
|