@searchstax-inc/searchstudio-ux-js 1.1.40 → 2.0.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.
- package/README.md +362 -121
- package/README.mustache +352 -78
- package/dist/@searchstax-inc/searchstudio-ux-js.cjs +17 -15
- package/dist/@searchstax-inc/searchstudio-ux-js.d.mts +1 -0
- package/dist/@searchstax-inc/searchstudio-ux-js.d.ts +1 -0
- package/dist/@searchstax-inc/searchstudio-ux-js.iife.js +21 -19
- package/dist/@searchstax-inc/searchstudio-ux-js.mjs +293 -275
- package/dist/templates.js +5 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -19,6 +19,7 @@ Initialization object needs to be of type: `ISearchstaxConfig`
|
|
|
19
19
|
interface ISearchstaxConfig {
|
|
20
20
|
sessionId?: string; // session id that is used for tracking. if not defined random value will be generated
|
|
21
21
|
language: string; // language code. Example: 'en'
|
|
22
|
+
model?: string; // Site Search model name.
|
|
22
23
|
searchURL: string; // Site Search select endpoint
|
|
23
24
|
suggesterURL: string; //Site Search suggest endpoint
|
|
24
25
|
trackApiKey: string; // Api key used for tracking events
|
|
@@ -40,6 +41,7 @@ Initialization example
|
|
|
40
41
|
```
|
|
41
42
|
searchstax.initialize({
|
|
42
43
|
language: "en",
|
|
44
|
+
model: "Main Profile",
|
|
43
45
|
searchURL: "",
|
|
44
46
|
suggesterURL: "",
|
|
45
47
|
trackApiKey: "",
|
|
@@ -124,74 +126,33 @@ Following widgets are available:
|
|
|
124
126
|
[Data flow subscriptions](#data-flow-subscriptions)
|
|
125
127
|
|
|
126
128
|
### Answer Widget ###
|
|
127
|
-
|
|
129
|
+
SearchStax Site Search solution offers Native JS widgets to assist in building your custom search page.
|
|
128
130
|
|
|
129
|
-
|
|
131
|
+
The SearchstaxAnswerWidget component for JS provides an AI answer widget for your searches.
|
|
130
132
|
|
|
131
|
-
|
|
133
|
+
**Usage**
|
|
132
134
|
|
|
133
|
-
example of answer widget initialization with minimum options
|
|
134
135
|
```
|
|
135
136
|
searchstax.addAnswerWidget("searchstax-answer-container", {
|
|
136
|
-
showShowMoreAfterWordCount: 100
|
|
137
|
+
showShowMoreAfterWordCount: 100,
|
|
138
|
+
feedbackwidget: feedbackConfig
|
|
137
139
|
});
|
|
138
140
|
```
|
|
139
141
|
|
|
142
|
+
**Props**
|
|
140
143
|
|
|
141
|
-
|
|
142
|
-
|
|
144
|
+
- showShowMoreAfterWordCount - number(default 100) determining after how many symbols UI will show “Read More” view.
|
|
145
|
+
- feedbackWidget – an optional object that configures thumbs-up and thumbs-down feedback functionality.
|
|
146
|
+
- templates - template override. look at examples below
|
|
143
147
|
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
<div>
|
|
153
|
-
<div class="searchstax-answer-container {{#showMoreButtonVisible}}searchstax-answer-show-more{{/showMoreButtonVisible}}">
|
|
154
|
-
<div class="searchstax-answer-title">Smart Answers</div>
|
|
155
|
-
{{#shouldShowAnswerError}}
|
|
156
|
-
<div class="searchstax-answer-error">{{{answerErrorMessage}}}</div>
|
|
157
|
-
{{/shouldShowAnswerError}}
|
|
158
|
-
<div class="searchstax-answer-description">
|
|
159
|
-
{{{fullAnswerFormatted}}}
|
|
160
|
-
{{^showMoreButtonVisible}}
|
|
161
|
-
{{#answerLoading}}
|
|
162
|
-
<div class="searchstax-answer-loading"></div>
|
|
163
|
-
{{/answerLoading}}
|
|
164
|
-
{{/showMoreButtonVisible}}
|
|
165
|
-
</div>
|
|
166
|
-
|
|
167
|
-
</div>
|
|
168
|
-
|
|
169
|
-
{{#showMoreButtonVisible}}
|
|
170
|
-
<div class="searchstax-answer-load-more-button-container">
|
|
171
|
-
{{#answerLoading}}
|
|
172
|
-
<div class="searchstax-answer-loading"></div>
|
|
173
|
-
{{/answerLoading}}
|
|
174
|
-
<button class="searchstax-answer-load-more-button">Read More</button>
|
|
175
|
-
</div>
|
|
176
|
-
{{/showMoreButtonVisible}}
|
|
177
|
-
</div>
|
|
178
|
-
<div class="searchstax-answer-footer">
|
|
179
|
-
<div id="feedbackWidgetContainer"></div>
|
|
180
|
-
<div class="searchstax-lightweight-widget-separator-inline"></div>
|
|
181
|
-
<p class="searchstax-disclaimer">Generative AI is Experimental</p>
|
|
182
|
-
</div>
|
|
183
|
-
</div>
|
|
184
|
-
{{/shouldShowAnswer}}
|
|
185
|
-
`,
|
|
186
|
-
answerContainerId: ``,
|
|
187
|
-
},
|
|
188
|
-
},
|
|
189
|
-
feedbackwidget: {
|
|
190
|
-
renderFeedbackWidget: true,
|
|
191
|
-
emailOverride: () => '',
|
|
192
|
-
thumbsUpValue: 10,
|
|
193
|
-
thumbsDownValue: 0,
|
|
194
|
-
lightweightTemplateOverride: `
|
|
148
|
+
Example of feedbackWidget config:
|
|
149
|
+
```
|
|
150
|
+
const feedbackConfig = {
|
|
151
|
+
renderFeedbackWidget: true,
|
|
152
|
+
emailOverride: searchstaxEmailOverride,
|
|
153
|
+
thumbsUpValue: 10,
|
|
154
|
+
thumbsDownValue: 0,
|
|
155
|
+
lightweightTemplateOverride: `
|
|
195
156
|
<div class="searchstax-lightweight-widget-container">
|
|
196
157
|
<div class="searchstax-lightweight-widget-thumbs-up {{#thumbsUpActive}}active{{/thumbsUpActive}}">
|
|
197
158
|
<svg width="17" height="17" viewBox="0 0 17 17" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
@@ -207,11 +168,26 @@ searchstax.addAnswerWidget("searchstax-answer-container", {
|
|
|
207
168
|
</div>
|
|
208
169
|
</div>
|
|
209
170
|
`,
|
|
210
|
-
|
|
211
|
-
});
|
|
171
|
+
}
|
|
212
172
|
```
|
|
213
173
|
|
|
214
|
-
|
|
174
|
+
|
|
175
|
+
**searchAnswerTemplate**
|
|
176
|
+
|
|
177
|
+
The templates prop allows customizing the answer UI.
|
|
178
|
+
|
|
179
|
+
It receives the following props:
|
|
180
|
+
|
|
181
|
+
- shouldShowAnswer – boolean
|
|
182
|
+
- answerErrorMessage – string
|
|
183
|
+
- fullAnswerFormatted – string
|
|
184
|
+
- showMoreButtonVisible – boolean
|
|
185
|
+
- answerLoading – boolean
|
|
186
|
+
|
|
187
|
+
**Example**
|
|
188
|
+
|
|
189
|
+
This example is based on [sitesearch-ux-js](https://www.npmjs.com/package/@searchstax-inc/searchstudio-ux-js#answer-widget):
|
|
190
|
+
|
|
215
191
|
```
|
|
216
192
|
|
|
217
193
|
searchstax.addAnswerWidget("searchstax-answer-container", {
|
|
@@ -259,25 +235,46 @@ searchstax.addAnswerWidget("searchstax-answer-container", {
|
|
|
259
235
|
answerContainerId: ``,
|
|
260
236
|
},
|
|
261
237
|
},
|
|
238
|
+
feedbackwidget: feedbackConfig
|
|
262
239
|
});
|
|
263
240
|
```
|
|
264
|
-
### Input Widget ###
|
|
265
|
-
Initialization properties
|
|
266
241
|
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
b. Input widget config object of type: [ISearchstaxSearchInputConfig](https://www.searchstax.com/docs/searchstudio/interfaces/#h-search-input-interfaces)
|
|
242
|
+
### Input Widget ###
|
|
270
243
|
|
|
244
|
+
The SearchStax Site Search solution’s Input widget provides the search input field with autosuggest/autocomplete capabilities.
|
|
271
245
|
|
|
272
|
-
|
|
246
|
+
**Usage**
|
|
273
247
|
```
|
|
274
248
|
searchstax.addSearchInputWidget("searchstax-input-container", {
|
|
275
249
|
suggestAfterMinChars: 3,
|
|
276
250
|
});
|
|
277
251
|
```
|
|
278
252
|
|
|
253
|
+
**Props**
|
|
254
|
+
|
|
255
|
+
- suggestAfterMinChars - default 3. Number of characters needed for autosuggest to start triggering
|
|
256
|
+
- hooks.beforeAutosuggest - callback function that 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.
|
|
257
|
+
- hooks.afterAutosuggest - callback function that gets called after autosuggest has values but before rendering. It needs to return same type of data but it can be modified.
|
|
258
|
+
- templates - template override. look at examples below
|
|
279
259
|
|
|
280
|
-
|
|
260
|
+
|
|
261
|
+
**inputWidgetTemplate**
|
|
262
|
+
|
|
263
|
+
The templates prop allows customizing the input UI.
|
|
264
|
+
|
|
265
|
+
It receives the following props:
|
|
266
|
+
|
|
267
|
+
- locationEnabled – boolean
|
|
268
|
+
|
|
269
|
+
**inputWidgetAutosuggestTemplate**
|
|
270
|
+
|
|
271
|
+
The templates prop allows customizing the input autosuggest UI.
|
|
272
|
+
|
|
273
|
+
It receives the following props:
|
|
274
|
+
|
|
275
|
+
- term – suggested term
|
|
276
|
+
|
|
277
|
+
**example**
|
|
281
278
|
```
|
|
282
279
|
searchstax.addSearchInputWidget("searchstax-input-container", {
|
|
283
280
|
suggestAfterMinChars: 3,
|
|
@@ -317,13 +314,12 @@ example of input widget initialization with various options
|
|
|
317
314
|
```
|
|
318
315
|
### Location Widget ###
|
|
319
316
|
|
|
320
|
-
|
|
317
|
+
SearchStax Site Search solution offers a native JS search-location widget to assist with your custom search page.
|
|
321
318
|
|
|
322
|
-
a
|
|
319
|
+
The SearchstaxLocationWidget provides a location search input with location-based search functionality.
|
|
323
320
|
|
|
324
|
-
|
|
321
|
+
**Usage**
|
|
325
322
|
|
|
326
|
-
example of results widget initialization with minimum options
|
|
327
323
|
```
|
|
328
324
|
function locationDecodeFunction(term: string): Promise<ISearchstaxLocation>{
|
|
329
325
|
return new Promise((resolve) => {
|
|
@@ -355,7 +351,24 @@ function locationDecodeFunction(term: string): Promise<ISearchstaxLocation>{
|
|
|
355
351
|
},
|
|
356
352
|
});
|
|
357
353
|
```
|
|
358
|
-
|
|
354
|
+
|
|
355
|
+
**Props**
|
|
356
|
+
|
|
357
|
+
- hooks.locationDecode - callback function to override location decoding
|
|
358
|
+
- hooks.locationDecodeCoordinatesToAddress - callback function to override location decoding
|
|
359
|
+
|
|
360
|
+
**Template Override**
|
|
361
|
+
|
|
362
|
+
The templates prop allows customizing the location input UI.
|
|
363
|
+
|
|
364
|
+
It receives the following props:
|
|
365
|
+
|
|
366
|
+
- locationSearchDistanceValues – location distance values
|
|
367
|
+
- shouldShowLocationDistanceDropdown – boolean determining if distance dropdown should be shown
|
|
368
|
+
|
|
369
|
+
|
|
370
|
+
**Example**
|
|
371
|
+
|
|
359
372
|
```
|
|
360
373
|
searchstax.addSearchLocationWidget("searchstax-location-container", {
|
|
361
374
|
templates:{
|
|
@@ -389,27 +402,72 @@ searchstax.addSearchLocationWidget("searchstax-location-container", {
|
|
|
389
402
|
},
|
|
390
403
|
});
|
|
391
404
|
```
|
|
405
|
+
|
|
392
406
|
### Result Widget ###
|
|
393
|
-
Initialization properties
|
|
394
407
|
|
|
395
|
-
|
|
408
|
+
The SearchStax Site Search solution’s Results Widget for UX-JS displays the search results.
|
|
396
409
|
|
|
397
|
-
|
|
410
|
+
**Usage**
|
|
398
411
|
|
|
399
|
-
example of results widget initialization with minimum options
|
|
400
412
|
```
|
|
401
413
|
searchstax.addSearchResultsWidget("searchstax-results-container", {});
|
|
402
414
|
```
|
|
403
415
|
|
|
404
|
-
|
|
416
|
+
**Main Template Override**
|
|
417
|
+
|
|
418
|
+
The template prop allows customizing the result UI.
|
|
419
|
+
|
|
420
|
+
It receives no props:
|
|
421
|
+
|
|
422
|
+
**Search Result Template Override**
|
|
423
|
+
|
|
424
|
+
The template prop allows customizing the result UI.
|
|
425
|
+
|
|
426
|
+
It receives following props:
|
|
427
|
+
|
|
428
|
+
- custom?: any - custom properties that may be added through aftersearchHook
|
|
429
|
+
- ribbon: string | null
|
|
430
|
+
- paths: string | null;
|
|
431
|
+
- url: string | null;
|
|
432
|
+
- title: string | null;
|
|
433
|
+
- titleTracking: string | null;
|
|
434
|
+
- promoted: boolean | null;
|
|
435
|
+
- thumbnail: string | null;
|
|
436
|
+
- date: string | null;
|
|
437
|
+
- snippet: string | null;
|
|
438
|
+
- description: string | null;
|
|
439
|
+
- uniqueId: string;
|
|
440
|
+
- position: number;
|
|
441
|
+
- distance: number | null;
|
|
442
|
+
- unit: string | null;
|
|
443
|
+
- unmappedFields: {
|
|
444
|
+
key: string;
|
|
445
|
+
value: string | string[] | boolean;
|
|
446
|
+
isImage?: boolean;
|
|
447
|
+
}[] - fields that were not mapped.
|
|
448
|
+
- allFields: { key: string; value: string | string[] | boolean }[] - all fields
|
|
449
|
+
|
|
450
|
+
**No Results Template Override**
|
|
451
|
+
|
|
452
|
+
The template prop allows customizing the result UI.
|
|
453
|
+
|
|
454
|
+
It receives following props:
|
|
455
|
+
|
|
456
|
+
- spellingSuggestion - suggestion of corrected spelling
|
|
457
|
+
- searchExecuted - boolean if search was executed
|
|
458
|
+
- searchTerm - term that was searched
|
|
459
|
+
|
|
460
|
+
**Example of default render method**
|
|
405
461
|
```
|
|
406
462
|
searchstax.addSearchResultsWidget("searchstax-results-container", {
|
|
407
463
|
templates: {
|
|
408
464
|
mainTemplate: {
|
|
409
465
|
template: `
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
466
|
+
<section aria-label="search results container" tabindex="0">
|
|
467
|
+
<div class="searchstax-search-results-container" id="searchstax-search-results-container" data-test-id="searchstax-search-results-container">
|
|
468
|
+
<div class="searchstax-search-results" id="searchstax-search-results"></div>
|
|
469
|
+
</div>
|
|
470
|
+
</section>
|
|
413
471
|
`,
|
|
414
472
|
searchResultsContainerId: "searchstax-search-results",
|
|
415
473
|
},
|
|
@@ -499,15 +557,17 @@ example of result widget initialization with various options
|
|
|
499
557
|
});
|
|
500
558
|
```
|
|
501
559
|
|
|
502
|
-
|
|
560
|
+
**Example of infinite scroll render method**
|
|
503
561
|
```
|
|
504
562
|
searchstax.addSearchResultsWidget("searchstax-results-container", {
|
|
505
563
|
templates: {
|
|
506
564
|
mainTemplate: {
|
|
507
565
|
template: `
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
566
|
+
<section aria-label="search results container" tabindex="0">
|
|
567
|
+
<div class="searchstax-search-results-container" id="searchstax-search-results-container" data-test-id="searchstax-search-results-container">
|
|
568
|
+
<div class="searchstax-search-results" id="searchstax-search-results"></div>
|
|
569
|
+
</div>
|
|
570
|
+
</section>
|
|
511
571
|
`,
|
|
512
572
|
searchResultsContainerId: "searchstax-search-results",
|
|
513
573
|
},
|
|
@@ -599,18 +659,50 @@ example of result widget initialization with infinite scroll enabled. This will
|
|
|
599
659
|
```
|
|
600
660
|
|
|
601
661
|
### Pagination Widget ###
|
|
602
|
-
Initialization properties
|
|
603
662
|
|
|
604
|
-
|
|
663
|
+
The SearchStax Site Search solution’s Pagination Widget displays a pagination control for UX-JS.
|
|
605
664
|
|
|
606
|
-
|
|
665
|
+
**Usage**
|
|
607
666
|
|
|
608
|
-
example of pagination widget initialization with minimum options
|
|
609
667
|
```
|
|
610
668
|
searchstax.addPaginationWidget("searchstax-pagination-container", {});
|
|
611
669
|
```
|
|
612
670
|
|
|
613
|
-
|
|
671
|
+
**Multiple Instances**
|
|
672
|
+
|
|
673
|
+
Multiple instances of the Pagination widget can be added by calling the addPaginationWidget method multiple times with different target containers:
|
|
674
|
+
|
|
675
|
+
```
|
|
676
|
+
searchstax.addPaginationWidget('container1', options1);
|
|
677
|
+
|
|
678
|
+
searchstax.addPaginationWidget('container2', options2);
|
|
679
|
+
|
|
680
|
+
```
|
|
681
|
+
|
|
682
|
+
Each instance can be configured separately via its options object. This allows for the widget to be added to different locations on the page as needed.
|
|
683
|
+
|
|
684
|
+
|
|
685
|
+
|
|
686
|
+
**Main Template Override**
|
|
687
|
+
|
|
688
|
+
Main template for the pagination controls.
|
|
689
|
+
|
|
690
|
+
It receives following props:
|
|
691
|
+
|
|
692
|
+
- nextPageLink - link of next page;
|
|
693
|
+
- previousPageLink - link of previous page;
|
|
694
|
+
|
|
695
|
+
|
|
696
|
+
**Infinite Scroll Template Override**
|
|
697
|
+
|
|
698
|
+
Main template for the pagination controls in infinite scroll mode.
|
|
699
|
+
|
|
700
|
+
It receives following props:
|
|
701
|
+
- isLastPage - boolean, true if its last page
|
|
702
|
+
- results - results.length can be used if there are results
|
|
703
|
+
|
|
704
|
+
**Example**
|
|
705
|
+
|
|
614
706
|
```
|
|
615
707
|
searchstax.addPaginationWidget("searchstax-pagination-container", {
|
|
616
708
|
templates: {
|
|
@@ -652,13 +744,15 @@ example of pagination widget initialization with various options
|
|
|
652
744
|
```
|
|
653
745
|
|
|
654
746
|
### Facets Widget ###
|
|
655
|
-
Initialization properties
|
|
656
747
|
|
|
657
|
-
|
|
748
|
+
The SearchStax Site Search solution’s Facets Widget for UX-JS displays faceted filters for search.
|
|
749
|
+
|
|
750
|
+
**Facet Selection and Order**
|
|
751
|
+
|
|
752
|
+
Facet lists are configured and ordered on the Site Search [Faceting Tab](https://www.searchstax.com/docs/searchstudio/faceting-tab/).
|
|
658
753
|
|
|
659
|
-
|
|
754
|
+
**Usage**
|
|
660
755
|
|
|
661
|
-
example of facets widget initialization with minimum options
|
|
662
756
|
```
|
|
663
757
|
searchstax.addFacetsWidget("searchstax-facets-container", {
|
|
664
758
|
facetingType: "and",
|
|
@@ -667,8 +761,94 @@ example of facets widget initialization with minimum options
|
|
|
667
761
|
});
|
|
668
762
|
```
|
|
669
763
|
|
|
764
|
+
**Multiple Instances**
|
|
765
|
+
|
|
766
|
+
Multiple instances of the Facets widget can be added by calling the addFacetsWidget method multiple times with different target containers:
|
|
767
|
+
|
|
768
|
+
```
|
|
769
|
+
searchstax.addFacetsWidget('container1', options1);
|
|
770
|
+
|
|
771
|
+
searchstax.addFacetsWidget('container2', options2);
|
|
670
772
|
|
|
671
|
-
|
|
773
|
+
```
|
|
774
|
+
|
|
775
|
+
Each instance can be configured separately via its options object. This allows for the widget to be added to different locations on the page as needed.
|
|
776
|
+
|
|
777
|
+
|
|
778
|
+
**Props**
|
|
779
|
+
|
|
780
|
+
- facetingType: "and" | "or" | "showUnavailable" | "tabs"; // type that determines how facets will behave
|
|
781
|
+
- specificFacets?: string[]; // optional array of facet names that if provided will only render those facets
|
|
782
|
+
- itemsPerPageDesktop: number; // default expanded facets for desktop
|
|
783
|
+
- itemsPerPageMobile: number; // default expanded facets for mobile
|
|
784
|
+
- templates - see examples below
|
|
785
|
+
|
|
786
|
+
|
|
787
|
+
**Main Template Desktop Override**
|
|
788
|
+
|
|
789
|
+
Main wrapper template for desktop facets display.
|
|
790
|
+
|
|
791
|
+
It receives following props from [IFacetsTemplateData](https://www.searchstax.com/docs/searchstudio/interfaces/#h-facets-interfaces)
|
|
792
|
+
|
|
793
|
+
|
|
794
|
+
**Main Template Mobile Override**
|
|
795
|
+
|
|
796
|
+
Main wrapper template for mobile facets display.
|
|
797
|
+
|
|
798
|
+
It receives following props from [IFacetsTemplateData](https://www.searchstax.com/docs/searchstudio/interfaces/#h-facets-interfaces)
|
|
799
|
+
|
|
800
|
+
**Show More Button Container Override**
|
|
801
|
+
|
|
802
|
+
Template for show more button
|
|
803
|
+
|
|
804
|
+
It receives following props:
|
|
805
|
+
|
|
806
|
+
- showingAllFacets - boolean true if showing all facets
|
|
807
|
+
|
|
808
|
+
**Facet Item Container Template Override**
|
|
809
|
+
|
|
810
|
+
Template for facet item container.
|
|
811
|
+
|
|
812
|
+
It receives following props:
|
|
813
|
+
|
|
814
|
+
- label - label of facet
|
|
815
|
+
|
|
816
|
+
|
|
817
|
+
**Clear Facets Template Override**
|
|
818
|
+
|
|
819
|
+
Template for clear facets.
|
|
820
|
+
|
|
821
|
+
It receives following props:
|
|
822
|
+
|
|
823
|
+
- shouldShow - boolean, true if it should be displayed
|
|
824
|
+
|
|
825
|
+
**Facet Item Template Override**
|
|
826
|
+
|
|
827
|
+
Template for facet item.
|
|
828
|
+
|
|
829
|
+
It receives following props:
|
|
830
|
+
|
|
831
|
+
- disabled - boolean, true if disabled
|
|
832
|
+
- isChecked - boolean, true if checked
|
|
833
|
+
- value - string, value of facet
|
|
834
|
+
- count - number of items for that facet
|
|
835
|
+
|
|
836
|
+
**Filter By Template Override**
|
|
837
|
+
|
|
838
|
+
Template for filter by.
|
|
839
|
+
|
|
840
|
+
It receives no props
|
|
841
|
+
|
|
842
|
+
**Selected Facets Template Override**
|
|
843
|
+
|
|
844
|
+
Template for selected facets.
|
|
845
|
+
|
|
846
|
+
It receives following props:
|
|
847
|
+
|
|
848
|
+
- value - string, value of facet
|
|
849
|
+
- count - number of items for that facet
|
|
850
|
+
|
|
851
|
+
**Example**
|
|
672
852
|
```
|
|
673
853
|
searchstax.addFacetsWidget("searchstax-facets-container", {
|
|
674
854
|
facetingType: "and",
|
|
@@ -776,20 +956,44 @@ example of facets widget initialization with various options
|
|
|
776
956
|
```
|
|
777
957
|
|
|
778
958
|
### SearchFeedback Widget ###
|
|
779
|
-
Initialization properties
|
|
780
959
|
|
|
781
|
-
|
|
960
|
+
The SearchStax Site Search solution’s Feedback Widget displays search feedback and stats for UX-JS.
|
|
782
961
|
|
|
783
|
-
|
|
962
|
+
**Usage**
|
|
784
963
|
|
|
785
|
-
|
|
786
|
-
example of search feedback widget initialization with minimum options
|
|
787
964
|
```
|
|
788
965
|
searchstax.addSearchFeedbackWidget("search-feedback-container", {});
|
|
789
966
|
```
|
|
790
967
|
|
|
968
|
+
**Multiple Instances**
|
|
969
|
+
|
|
970
|
+
Multiple instances of the SearchFeedback widget can be added by calling the addSearchFeedbackWidget method multiple times with different target containers:
|
|
971
|
+
|
|
972
|
+
```
|
|
973
|
+
searchstax.addSearchFeedbackWidget('container1', options1);
|
|
974
|
+
|
|
975
|
+
searchstax.addSearchFeedbackWidget('container2', options2);
|
|
976
|
+
|
|
977
|
+
```
|
|
978
|
+
|
|
979
|
+
Each instance can be configured separately via its options object. This allows for the widget to be added to different locations on the page as needed.
|
|
980
|
+
|
|
981
|
+
|
|
982
|
+
**Main Template Override**
|
|
983
|
+
|
|
984
|
+
Main template for the search feedback message.
|
|
985
|
+
|
|
986
|
+
It receives following props:
|
|
987
|
+
- searchExecuted - boolean, true if search was executed
|
|
988
|
+
- hasResults - boolean, true if search has results
|
|
989
|
+
- startResultIndex - number, start of page results
|
|
990
|
+
- endResultIndex - number, end of page results
|
|
991
|
+
- totalResults - number, total results
|
|
992
|
+
- searchTerm - term that was searched
|
|
993
|
+
- autoCorrectedQuery - query that search was autocorrected to
|
|
994
|
+
- originalQuery - original query
|
|
791
995
|
|
|
792
|
-
|
|
996
|
+
**Example**
|
|
793
997
|
```
|
|
794
998
|
searchstax.addSearchFeedbackWidget("search-feedback-container", {
|
|
795
999
|
templates: {
|
|
@@ -815,15 +1019,11 @@ searchstax.addSearchFeedbackWidget("search-feedback-container", {
|
|
|
815
1019
|
});
|
|
816
1020
|
```
|
|
817
1021
|
|
|
818
|
-
|
|
819
|
-
Initialization properties
|
|
1022
|
+
### RelatedSearches widget ###
|
|
820
1023
|
|
|
821
|
-
|
|
1024
|
+
The SearchStax Site Search solution’s Related Searches Widget displays related searches for UX-JS.
|
|
822
1025
|
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
example of search feedback widget initialization with minimum options
|
|
1026
|
+
**Usage**
|
|
827
1027
|
```
|
|
828
1028
|
searchstax.addRelatedSearchesWidget("searchstax-related-searches-container", {
|
|
829
1029
|
relatedSearchesURL: "URL",
|
|
@@ -831,8 +1031,27 @@ example of search feedback widget initialization with minimum options
|
|
|
831
1031
|
})
|
|
832
1032
|
```
|
|
833
1033
|
|
|
1034
|
+
**Main Template Override**
|
|
1035
|
+
|
|
1036
|
+
Main template for related searches.
|
|
1037
|
+
|
|
1038
|
+
It receives following props:
|
|
1039
|
+
|
|
1040
|
+
- hasRelatedSearches - boolean, true if has related searches
|
|
1041
|
+
- relatedSearches - array of related searches
|
|
1042
|
+
|
|
1043
|
+
|
|
1044
|
+
**Related Search Template Override**
|
|
1045
|
+
|
|
1046
|
+
Related Search template.
|
|
1047
|
+
|
|
1048
|
+
It receives following props:
|
|
1049
|
+
|
|
1050
|
+
- related_search - string, related searc
|
|
1051
|
+
- last - boolean, true if last related search
|
|
1052
|
+
|
|
1053
|
+
**Example**
|
|
834
1054
|
|
|
835
|
-
example of search feedback widget initialization with various options
|
|
836
1055
|
```
|
|
837
1056
|
searchstax.addRelatedSearchesWidget("searchstax-related-searches-container", {
|
|
838
1057
|
relatedSearchesURL: "URL",
|
|
@@ -866,20 +1085,35 @@ searchstax.addRelatedSearchesWidget("searchstax-related-searches-container", {
|
|
|
866
1085
|
```
|
|
867
1086
|
|
|
868
1087
|
### ExternalPromotions widget ###
|
|
869
|
-
Initialization properties
|
|
870
|
-
|
|
871
|
-
a. id of container where widget will be rendered
|
|
872
1088
|
|
|
873
|
-
|
|
1089
|
+
SearchStax Site Search solution’s External Promotions Widget displays external promotions for UX-JS.
|
|
874
1090
|
|
|
1091
|
+
**Usage**
|
|
875
1092
|
|
|
876
|
-
example of search feedback widget initialization with minimum options
|
|
877
1093
|
```
|
|
878
1094
|
searchstax.addExternalPromotionsWidget("searchstax-external-promotions-layout-container", {})
|
|
879
1095
|
```
|
|
880
1096
|
|
|
1097
|
+
**Main Template Override**
|
|
881
1098
|
|
|
882
|
-
|
|
1099
|
+
Main template for external promotions.
|
|
1100
|
+
|
|
1101
|
+
It receives following props:
|
|
1102
|
+
|
|
1103
|
+
- hasExternalPromotions - boolean, true if has external promotions
|
|
1104
|
+
|
|
1105
|
+
**External promotion Template Override**
|
|
1106
|
+
|
|
1107
|
+
Template for external promotion item.
|
|
1108
|
+
|
|
1109
|
+
It receives following props:
|
|
1110
|
+
|
|
1111
|
+
- url - url of external promotion
|
|
1112
|
+
- uniqueId - unique id
|
|
1113
|
+
- name - name of promotion
|
|
1114
|
+
- description - description
|
|
1115
|
+
|
|
1116
|
+
**Example**
|
|
883
1117
|
```
|
|
884
1118
|
searchstax.addExternalPromotionsWidget("searchstax-external-promotions-layout-container", {
|
|
885
1119
|
templates: {
|
|
@@ -922,20 +1156,27 @@ searchstax.addExternalPromotionsWidget("searchstax-external-promotions-layout-co
|
|
|
922
1156
|
|
|
923
1157
|
|
|
924
1158
|
### Sorting Widget ###
|
|
925
|
-
Initialization properties
|
|
926
|
-
|
|
927
|
-
a. id of container where widget will be rendered
|
|
928
1159
|
|
|
929
|
-
|
|
1160
|
+
The SearchStax Site Search solution’s Sorting Widget allows sorting of search results for UX-JS.
|
|
930
1161
|
|
|
1162
|
+
**Usage**
|
|
931
1163
|
|
|
932
|
-
example of sorting widget initialization with minimum options
|
|
933
1164
|
```
|
|
934
1165
|
searchstax.addSearchSortingWidget("search-sorting-container", {});
|
|
935
1166
|
```
|
|
936
1167
|
|
|
1168
|
+
**Main Template Override**
|
|
1169
|
+
|
|
1170
|
+
Main template for sorting widget.
|
|
1171
|
+
|
|
1172
|
+
It receives following props:
|
|
1173
|
+
|
|
1174
|
+
- searchExecuted - boolean, true if search was executed
|
|
1175
|
+
- hasResultsOrExternalPromotions - boolean, true if there are results or external promotions
|
|
1176
|
+
- sortOptions - array of sort options, has key/value
|
|
1177
|
+
|
|
1178
|
+
**Example**
|
|
937
1179
|
|
|
938
|
-
example of sorting widget initialization with various options
|
|
939
1180
|
```
|
|
940
1181
|
searchstax.addSearchSortingWidget("search-sorting-container", {
|
|
941
1182
|
templates: {
|