@searchstax-inc/searchstudio-ux-js 0.5.3 → 0.5.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -28,7 +28,24 @@ 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 needs to be of type: [ISearchstaxConfig](https://github.com/searchstax/searchstudio-ux-js/blob/main/src/interfaces/connector.interface.ts#L5)
31
+ Initialization object needs to be of type: `ISearchstaxConfig`
32
+ ```
33
+ interface ISearchstaxConfig {
34
+ language: string; // language code. Example: 'en'
35
+ searchURL: string; // SearchStudio select endpoint
36
+ suggesterURL: string; //SearchStudio suggest endpoint
37
+ trackApiKey: string; // Api key used for tracking events
38
+ searchAuth: string; // Authentication value. based on authType it's either a token value or basic auth value
39
+ authType: "token" | "basic"; // Type of authentication
40
+ autoCorrect?: boolean; // if set to true it will autoCorrect misspelled words. Default is false
41
+ router?: IRouterConfig; // optional object containing router settings
42
+ hooks?: {
43
+ // optional object that provides various hook options
44
+ 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.
45
+ 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.
46
+ };
47
+ }
48
+ ```
32
49
 
33
50
  Initialization example
34
51
  ```
@@ -110,7 +127,7 @@ Initialization properties
110
127
 
111
128
  a. id of container where widget will be rendered
112
129
 
113
- b. Input widget config object of type: [ISearchstaxSearchInputConfig](https://github.com/searchstax/searchstudio-ux-js/blob/main/src/interfaces/searchInputConfig.interface.ts#L4)
130
+ b. Input widget config object of type: [ISearchstaxSearchInputConfig](https://www.searchstax.com/docs/searchstudio/interfaces/#h-search-input-interfaces)
114
131
 
115
132
 
116
133
  example of input widget initialization with minimum options
@@ -163,7 +180,7 @@ Initialization properties
163
180
 
164
181
  a. id of container where widget will be rendered
165
182
 
166
- b. Result widget config object of type: [ISearchstaxSearchResultsConfig](https://github.com/searchstax/searchstudio-ux-js/blob/main/src/interfaces/searchResultsConfig.interface.ts#L3)
183
+ b. Result widget config object of type: [ISearchstaxSearchResultsConfig](https://www.searchstax.com/docs/searchstudio/interfaces/#h-search-results-interfaces)
167
184
 
168
185
  example of results widget initialization with minimum options
169
186
  ```
@@ -266,7 +283,7 @@ Initialization properties
266
283
 
267
284
  a. id of container where widget will be rendered
268
285
 
269
- b. Pagination widget config object of type: [ISearchstaxSearchPaginationConfig](https://github.com/searchstax/searchstudio-ux-js/blob/main/src/interfaces/searchPaginationConfig.interface.ts#L1)
286
+ b. Pagination widget config object of type: [ISearchstaxSearchPaginationConfig](https://www.searchstax.com/docs/searchstudio/interfaces/#h-pagination-interfaces)
270
287
 
271
288
  example of pagination widget initialization with minimum options
272
289
  ```
@@ -303,7 +320,7 @@ Initialization properties
303
320
 
304
321
  a. id of container where widget will be rendered
305
322
 
306
- b. Facets widget config object of type: [ISearchstaxSearchFacetsConfig](https://github.com/searchstax/searchstudio-ux-js/blob/main/src/interfaces/searchFacetsConfig.interface.ts#L1)
323
+ b. Facets widget config object of type: [ISearchstaxSearchFacetsConfig](https://www.searchstax.com/docs/searchstudio/interfaces/#h-facets-interfaces)
307
324
 
308
325
  example of facets widget initialization with minimum options
309
326
  ```
@@ -427,7 +444,7 @@ Initialization properties
427
444
 
428
445
  a. id of container where widget will be rendered
429
446
 
430
- b. SearchFeedback widget config object of type: [ISearchstaxSearchFeedbackConfig](https://github.com/searchstax/searchstudio-ux-js/blob/main/src/interfaces/searchFeedbackConfig.interface.ts#L1)
447
+ b. SearchFeedback widget config object of type: [ISearchstaxSearchFeedbackConfig](https://www.searchstax.com/docs/searchstudio/interfaces/#h-search-feedback-interfaces)
431
448
 
432
449
 
433
450
  example of search feedback widget initialization with minimum options
@@ -466,7 +483,7 @@ Initialization properties
466
483
 
467
484
  a. id of container where widget will be rendered
468
485
 
469
- b. RelatedSearches widget config object of type: [ISearchstaxRelatedSearchesConfig](https://github.com/searchstax/searchstudio-ux-js/blob/main/src/interfaces/searchRelatedSearchesConfig.interface.ts#L1)
486
+ b. RelatedSearches widget config object of type: [ISearchstaxRelatedSearchesConfig](https://www.searchstax.com/docs/searchstudio/interfaces/#h-related-searches-interfaces)
470
487
 
471
488
 
472
489
  example of search feedback widget initialization with minimum options
@@ -516,7 +533,7 @@ Initialization properties
516
533
 
517
534
  a. id of container where widget will be rendered
518
535
 
519
- b. ExternalPromotions widget config object of type: [ISearchstaxExternalPromotionsConfig](https://github.com/searchstax/searchstudio-ux-js/blob/main/src/interfaces/searchExternalPromotionsConfig.interface.ts#L1)
536
+ b. ExternalPromotions widget config object of type: [ISearchstaxExternalPromotionsConfig](https://www.searchstax.com/docs/searchstudio/interfaces/#:~:text=%7D-,export%20interface%20IExternalPromotion%20%7B,%7D,-export%20interface%20ISearchstaxMetadata)
520
537
 
521
538
 
522
539
  example of search feedback widget initialization with minimum options
@@ -572,7 +589,7 @@ Initialization properties
572
589
 
573
590
  a. id of container where widget will be rendered
574
591
 
575
- b. Sorting widget config object of type: [ISearchstaxSearchSortingConfig](https://github.com/searchstax/searchstudio-ux-js/blob/main/src/interfaces/searchSortingConfig.interface.ts#L1)
592
+ b. Sorting widget config object of type: [ISearchstaxSearchSortingConfig](https://www.searchstax.com/docs/searchstudio/interfaces/#h-sorting-interfaces)
576
593
 
577
594
 
578
595
  example of sorting widget initialization with minimum options
package/README.mustache CHANGED
@@ -28,7 +28,24 @@ 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 needs to be of type: [ISearchstaxConfig](https://github.com/searchstax/searchstudio-ux-js/blob/main/src/interfaces/connector.interface.ts#L5)
31
+ Initialization object needs to be of type: `ISearchstaxConfig`
32
+ ```
33
+ interface ISearchstaxConfig {
34
+ language: string; // language code. Example: 'en'
35
+ searchURL: string; // SearchStudio select endpoint
36
+ suggesterURL: string; //SearchStudio suggest endpoint
37
+ trackApiKey: string; // Api key used for tracking events
38
+ searchAuth: string; // Authentication value. based on authType it's either a token value or basic auth value
39
+ authType: "token" | "basic"; // Type of authentication
40
+ autoCorrect?: boolean; // if set to true it will autoCorrect misspelled words. Default is false
41
+ router?: IRouterConfig; // optional object containing router settings
42
+ hooks?: {
43
+ // optional object that provides various hook options
44
+ 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.
45
+ 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.
46
+ };
47
+ }
48
+ ```
32
49
 
33
50
  Initialization example
34
51
  ```
@@ -110,7 +127,7 @@ Initialization properties
110
127
 
111
128
  a. id of container where widget will be rendered
112
129
 
113
- b. Input widget config object of type: [ISearchstaxSearchInputConfig](https://github.com/searchstax/searchstudio-ux-js/blob/main/src/interfaces/searchInputConfig.interface.ts#L4)
130
+ b. Input widget config object of type: [ISearchstaxSearchInputConfig](https://www.searchstax.com/docs/searchstudio/interfaces/#h-search-input-interfaces)
114
131
 
115
132
 
116
133
  example of input widget initialization with minimum options
@@ -154,7 +171,7 @@ Initialization properties
154
171
 
155
172
  a. id of container where widget will be rendered
156
173
 
157
- b. Result widget config object of type: [ISearchstaxSearchResultsConfig](https://github.com/searchstax/searchstudio-ux-js/blob/main/src/interfaces/searchResultsConfig.interface.ts#L3)
174
+ b. Result widget config object of type: [ISearchstaxSearchResultsConfig](https://www.searchstax.com/docs/searchstudio/interfaces/#h-search-results-interfaces)
158
175
 
159
176
  example of results widget initialization with minimum options
160
177
  ```
@@ -193,7 +210,7 @@ Initialization properties
193
210
 
194
211
  a. id of container where widget will be rendered
195
212
 
196
- b. Pagination widget config object of type: [ISearchstaxSearchPaginationConfig](https://github.com/searchstax/searchstudio-ux-js/blob/main/src/interfaces/searchPaginationConfig.interface.ts#L1)
213
+ b. Pagination widget config object of type: [ISearchstaxSearchPaginationConfig](https://www.searchstax.com/docs/searchstudio/interfaces/#h-pagination-interfaces)
197
214
 
198
215
  example of pagination widget initialization with minimum options
199
216
  ```
@@ -218,7 +235,7 @@ Initialization properties
218
235
 
219
236
  a. id of container where widget will be rendered
220
237
 
221
- b. Facets widget config object of type: [ISearchstaxSearchFacetsConfig](https://github.com/searchstax/searchstudio-ux-js/blob/main/src/interfaces/searchFacetsConfig.interface.ts#L1)
238
+ b. Facets widget config object of type: [ISearchstaxSearchFacetsConfig](https://www.searchstax.com/docs/searchstudio/interfaces/#h-facets-interfaces)
222
239
 
223
240
  example of facets widget initialization with minimum options
224
241
  ```
@@ -284,7 +301,7 @@ Initialization properties
284
301
 
285
302
  a. id of container where widget will be rendered
286
303
 
287
- b. SearchFeedback widget config object of type: [ISearchstaxSearchFeedbackConfig](https://github.com/searchstax/searchstudio-ux-js/blob/main/src/interfaces/searchFeedbackConfig.interface.ts#L1)
304
+ b. SearchFeedback widget config object of type: [ISearchstaxSearchFeedbackConfig](https://www.searchstax.com/docs/searchstudio/interfaces/#h-search-feedback-interfaces)
288
305
 
289
306
 
290
307
  example of search feedback widget initialization with minimum options
@@ -310,7 +327,7 @@ Initialization properties
310
327
 
311
328
  a. id of container where widget will be rendered
312
329
 
313
- b. RelatedSearches widget config object of type: [ISearchstaxRelatedSearchesConfig](https://github.com/searchstax/searchstudio-ux-js/blob/main/src/interfaces/searchRelatedSearchesConfig.interface.ts#L1)
330
+ b. RelatedSearches widget config object of type: [ISearchstaxRelatedSearchesConfig](https://www.searchstax.com/docs/searchstudio/interfaces/#h-related-searches-interfaces)
314
331
 
315
332
 
316
333
  example of search feedback widget initialization with minimum options
@@ -345,7 +362,7 @@ Initialization properties
345
362
 
346
363
  a. id of container where widget will be rendered
347
364
 
348
- b. ExternalPromotions widget config object of type: [ISearchstaxExternalPromotionsConfig](https://github.com/searchstax/searchstudio-ux-js/blob/main/src/interfaces/searchExternalPromotionsConfig.interface.ts#L1)
365
+ b. ExternalPromotions widget config object of type: [ISearchstaxExternalPromotionsConfig](https://www.searchstax.com/docs/searchstudio/interfaces/#:~:text=%7D-,export%20interface%20IExternalPromotion%20%7B,%7D,-export%20interface%20ISearchstaxMetadata)
349
366
 
350
367
 
351
368
  example of search feedback widget initialization with minimum options
@@ -375,7 +392,7 @@ Initialization properties
375
392
 
376
393
  a. id of container where widget will be rendered
377
394
 
378
- b. Sorting widget config object of type: [ISearchstaxSearchSortingConfig](https://github.com/searchstax/searchstudio-ux-js/blob/main/src/interfaces/searchSortingConfig.interface.ts#L1)
395
+ b. Sorting widget config object of type: [ISearchstaxSearchSortingConfig](https://www.searchstax.com/docs/searchstudio/interfaces/#h-sorting-interfaces)
379
396
 
380
397
 
381
398
  example of sorting widget initialization with minimum options
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@searchstax-inc/searchstudio-ux-js",
3
3
  "private": false,
4
- "version": "0.5.3",
4
+ "version": "0.5.4",
5
5
  "files": [
6
6
  "dist"
7
7
  ],