@sitecore-cloudsdk/search 0.5.0 → 0.5.1-rc.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/dist/cjs/package.json +4 -4
- package/dist/cjs/src/lib/consts.d.ts +1 -0
- package/dist/cjs/src/lib/consts.js +2 -1
- package/dist/cjs/src/lib/events/base-widget-event.d.ts +38 -0
- package/dist/cjs/src/lib/events/base-widget-event.js +48 -0
- package/dist/cjs/src/lib/events/entity-view-event.d.ts +8 -8
- package/dist/cjs/src/lib/events/entity-view-event.js +10 -20
- package/dist/cjs/src/lib/events/interfaces.d.ts +20 -40
- package/dist/cjs/src/lib/events/widget-facet-click-event.d.ts +17 -8
- package/dist/cjs/src/lib/events/widget-facet-click-event.js +19 -20
- package/dist/cjs/src/lib/events/widget-item-click-event.d.ts +7 -8
- package/dist/cjs/src/lib/events/widget-item-click-event.js +9 -20
- package/dist/cjs/src/lib/events/widget-navigation-click-event.d.ts +7 -8
- package/dist/cjs/src/lib/events/widget-navigation-click-event.js +9 -20
- package/dist/cjs/src/lib/events/widget-suggestion-click-event.d.ts +15 -8
- package/dist/cjs/src/lib/events/widget-suggestion-click-event.js +17 -20
- package/dist/cjs/src/lib/events/widget-view-event.d.ts +15 -8
- package/dist/cjs/src/lib/events/widget-view-event.js +17 -20
- package/dist/cjs/src/lib/initializer/browser/initializer.d.ts +6 -0
- package/dist/cjs/src/lib/initializer/browser/initializer.js +7 -0
- package/dist/cjs/src/lib/initializer/server/initializer.d.ts +4 -0
- package/dist/cjs/src/lib/initializer/server/initializer.js +4 -0
- package/dist/cjs/src/lib/request-entities/context/context.d.ts +24 -24
- package/dist/cjs/src/lib/request-entities/context/context.js +24 -24
- package/dist/cjs/src/lib/request-entities/filters/base-filter.d.ts +1 -1
- package/dist/cjs/src/lib/request-entities/filters/base-filter.js +1 -1
- package/dist/cjs/src/lib/request-entities/filters/comparison-filter.d.ts +2 -2
- package/dist/cjs/src/lib/request-entities/filters/comparison-filter.js +2 -2
- package/dist/cjs/src/lib/request-entities/filters/facet/comparison-facet-filter.d.ts +2 -2
- package/dist/cjs/src/lib/request-entities/filters/facet/comparison-facet-filter.js +2 -2
- package/dist/cjs/src/lib/request-entities/filters/facet/list-facet-filter.d.ts +3 -3
- package/dist/cjs/src/lib/request-entities/filters/facet/list-facet-filter.js +3 -3
- package/dist/cjs/src/lib/request-entities/filters/facet/logical-facet-filter.d.ts +3 -3
- package/dist/cjs/src/lib/request-entities/filters/facet/logical-facet-filter.js +3 -3
- package/dist/cjs/src/lib/request-entities/filters/facet/not-facet-filter.d.ts +7 -0
- package/dist/cjs/src/lib/request-entities/filters/facet/not-facet-filter.js +7 -0
- package/dist/cjs/src/lib/request-entities/filters/geo-filter.d.ts +7 -2
- package/dist/cjs/src/lib/request-entities/filters/geo-filter.js +7 -2
- package/dist/cjs/src/lib/request-entities/filters/geo-within-filter.d.ts +8 -2
- package/dist/cjs/src/lib/request-entities/filters/geo-within-filter.js +8 -2
- package/dist/cjs/src/lib/request-entities/filters/list-filter.d.ts +3 -3
- package/dist/cjs/src/lib/request-entities/filters/list-filter.js +3 -3
- package/dist/cjs/src/lib/request-entities/filters/logical-filter.d.ts +3 -2
- package/dist/cjs/src/lib/request-entities/filters/logical-filter.js +3 -2
- package/dist/cjs/src/lib/request-entities/widgets/interfaces.d.ts +2 -0
- package/dist/cjs/src/lib/request-entities/widgets/questions-answers-widget-item.d.ts +22 -6
- package/dist/cjs/src/lib/request-entities/widgets/questions-answers-widget-item.js +22 -6
- package/dist/cjs/src/lib/request-entities/widgets/recommendation-widget-item.d.ts +10 -4
- package/dist/cjs/src/lib/request-entities/widgets/recommendation-widget-item.js +10 -4
- package/dist/cjs/src/lib/request-entities/widgets/results-widget-item.d.ts +11 -5
- package/dist/cjs/src/lib/request-entities/widgets/results-widget-item.js +11 -5
- package/dist/cjs/src/lib/request-entities/widgets/rule-widget-item.d.ts +35 -0
- package/dist/cjs/src/lib/request-entities/widgets/rule-widget-item.js +35 -0
- package/dist/cjs/src/lib/request-entities/widgets/search-widget-item.d.ts +70 -28
- package/dist/cjs/src/lib/request-entities/widgets/search-widget-item.js +77 -28
- package/dist/cjs/src/lib/request-entities/widgets/utils.d.ts +1 -1
- package/dist/cjs/src/lib/request-entities/widgets/utils.js +1 -1
- package/dist/cjs/src/lib/request-entities/widgets/widget-item.d.ts +20 -5
- package/dist/cjs/src/lib/request-entities/widgets/widget-item.js +20 -5
- package/dist/cjs/src/lib/request-entities/widgets/widget-request-data.d.ts +6 -1
- package/dist/cjs/src/lib/request-entities/widgets/widget-request-data.js +6 -1
- package/dist/cjs/src/lib/requests/browser/get-page-widget-data.d.ts +5 -4
- package/dist/cjs/src/lib/requests/browser/get-page-widget-data.js +5 -0
- package/dist/cjs/src/lib/requests/browser/get-widget-data.d.ts +1 -1
- package/dist/cjs/src/lib/requests/browser/get-widget-data.js +1 -1
- package/dist/cjs/src/lib/requests/post-request.d.ts +10 -6
- package/dist/cjs/src/lib/requests/post-request.js +2 -1
- package/dist/cjs/src/lib/requests/server/entity-view-event-server.d.ts +1 -1
- package/dist/cjs/src/lib/requests/server/entity-view-event-server.js +1 -1
- package/dist/cjs/src/lib/requests/server/get-page-widget-data-server.d.ts +3 -3
- package/dist/cjs/src/lib/requests/server/get-page-widget-data-server.js +5 -0
- package/dist/cjs/src/lib/requests/server/get-widget-data-server.d.ts +1 -1
- package/dist/cjs/src/lib/requests/server/get-widget-data-server.js +1 -1
- package/dist/cjs/src/lib/requests/server/widget-facet-click-event-server.d.ts +1 -1
- package/dist/cjs/src/lib/requests/server/widget-facet-click-event-server.js +1 -1
- package/dist/cjs/src/lib/requests/server/widget-item-click-event-server.d.ts +1 -1
- package/dist/cjs/src/lib/requests/server/widget-item-click-event-server.js +1 -1
- package/dist/cjs/src/lib/requests/server/widget-navigation-click-event-server.d.ts +1 -1
- package/dist/cjs/src/lib/requests/server/widget-navigation-click-event-server.js +1 -1
- package/dist/cjs/src/lib/requests/server/widget-suggestion-click-event-server.d.ts +1 -1
- package/dist/cjs/src/lib/requests/server/widget-suggestion-click-event-server.js +1 -1
- package/dist/cjs/src/lib/requests/server/widget-view-event-server.d.ts +1 -1
- package/dist/cjs/src/lib/requests/server/widget-view-event-server.js +1 -1
- package/dist/cjs/tsconfig.cjs.tsbuildinfo +1 -1
- package/dist/esm/package.json +4 -4
- package/dist/esm/src/lib/consts.d.ts +1 -0
- package/dist/esm/src/lib/consts.js +1 -0
- package/dist/esm/src/lib/events/base-widget-event.d.ts +38 -0
- package/dist/esm/src/lib/events/base-widget-event.js +44 -0
- package/dist/esm/src/lib/events/entity-view-event.d.ts +8 -8
- package/dist/esm/src/lib/events/entity-view-event.js +10 -20
- package/dist/esm/src/lib/events/interfaces.d.ts +20 -40
- package/dist/esm/src/lib/events/widget-facet-click-event.d.ts +17 -8
- package/dist/esm/src/lib/events/widget-facet-click-event.js +19 -20
- package/dist/esm/src/lib/events/widget-item-click-event.d.ts +7 -8
- package/dist/esm/src/lib/events/widget-item-click-event.js +9 -20
- package/dist/esm/src/lib/events/widget-navigation-click-event.d.ts +7 -8
- package/dist/esm/src/lib/events/widget-navigation-click-event.js +9 -20
- package/dist/esm/src/lib/events/widget-suggestion-click-event.d.ts +15 -8
- package/dist/esm/src/lib/events/widget-suggestion-click-event.js +17 -20
- package/dist/esm/src/lib/events/widget-view-event.d.ts +15 -8
- package/dist/esm/src/lib/events/widget-view-event.js +17 -20
- package/dist/esm/src/lib/initializer/browser/initializer.d.ts +6 -0
- package/dist/esm/src/lib/initializer/browser/initializer.js +8 -1
- package/dist/esm/src/lib/initializer/server/initializer.d.ts +4 -0
- package/dist/esm/src/lib/initializer/server/initializer.js +4 -0
- package/dist/esm/src/lib/request-entities/context/context.d.ts +24 -24
- package/dist/esm/src/lib/request-entities/context/context.js +24 -24
- package/dist/esm/src/lib/request-entities/filters/base-filter.d.ts +1 -1
- package/dist/esm/src/lib/request-entities/filters/base-filter.js +1 -1
- package/dist/esm/src/lib/request-entities/filters/comparison-filter.d.ts +2 -2
- package/dist/esm/src/lib/request-entities/filters/comparison-filter.js +2 -2
- package/dist/esm/src/lib/request-entities/filters/facet/comparison-facet-filter.d.ts +2 -2
- package/dist/esm/src/lib/request-entities/filters/facet/comparison-facet-filter.js +2 -2
- package/dist/esm/src/lib/request-entities/filters/facet/list-facet-filter.d.ts +3 -3
- package/dist/esm/src/lib/request-entities/filters/facet/list-facet-filter.js +3 -3
- package/dist/esm/src/lib/request-entities/filters/facet/logical-facet-filter.d.ts +3 -3
- package/dist/esm/src/lib/request-entities/filters/facet/logical-facet-filter.js +3 -3
- package/dist/esm/src/lib/request-entities/filters/facet/not-facet-filter.d.ts +7 -0
- package/dist/esm/src/lib/request-entities/filters/facet/not-facet-filter.js +7 -0
- package/dist/esm/src/lib/request-entities/filters/geo-filter.d.ts +7 -2
- package/dist/esm/src/lib/request-entities/filters/geo-filter.js +7 -2
- package/dist/esm/src/lib/request-entities/filters/geo-within-filter.d.ts +8 -2
- package/dist/esm/src/lib/request-entities/filters/geo-within-filter.js +8 -2
- package/dist/esm/src/lib/request-entities/filters/list-filter.d.ts +3 -3
- package/dist/esm/src/lib/request-entities/filters/list-filter.js +3 -3
- package/dist/esm/src/lib/request-entities/filters/logical-filter.d.ts +3 -2
- package/dist/esm/src/lib/request-entities/filters/logical-filter.js +3 -2
- package/dist/esm/src/lib/request-entities/widgets/interfaces.d.ts +2 -0
- package/dist/esm/src/lib/request-entities/widgets/questions-answers-widget-item.d.ts +22 -6
- package/dist/esm/src/lib/request-entities/widgets/questions-answers-widget-item.js +22 -6
- package/dist/esm/src/lib/request-entities/widgets/recommendation-widget-item.d.ts +10 -4
- package/dist/esm/src/lib/request-entities/widgets/recommendation-widget-item.js +10 -4
- package/dist/esm/src/lib/request-entities/widgets/results-widget-item.d.ts +11 -5
- package/dist/esm/src/lib/request-entities/widgets/results-widget-item.js +11 -5
- package/dist/esm/src/lib/request-entities/widgets/rule-widget-item.d.ts +35 -0
- package/dist/esm/src/lib/request-entities/widgets/rule-widget-item.js +35 -0
- package/dist/esm/src/lib/request-entities/widgets/search-widget-item.d.ts +70 -28
- package/dist/esm/src/lib/request-entities/widgets/search-widget-item.js +77 -28
- package/dist/esm/src/lib/request-entities/widgets/utils.d.ts +1 -1
- package/dist/esm/src/lib/request-entities/widgets/utils.js +1 -1
- package/dist/esm/src/lib/request-entities/widgets/widget-item.d.ts +20 -5
- package/dist/esm/src/lib/request-entities/widgets/widget-item.js +20 -5
- package/dist/esm/src/lib/request-entities/widgets/widget-request-data.d.ts +6 -1
- package/dist/esm/src/lib/request-entities/widgets/widget-request-data.js +6 -1
- package/dist/esm/src/lib/requests/browser/get-page-widget-data.d.ts +5 -4
- package/dist/esm/src/lib/requests/browser/get-page-widget-data.js +5 -0
- package/dist/esm/src/lib/requests/browser/get-widget-data.d.ts +1 -1
- package/dist/esm/src/lib/requests/browser/get-widget-data.js +1 -1
- package/dist/esm/src/lib/requests/post-request.d.ts +10 -6
- package/dist/esm/src/lib/requests/post-request.js +2 -1
- package/dist/esm/src/lib/requests/server/entity-view-event-server.d.ts +1 -1
- package/dist/esm/src/lib/requests/server/entity-view-event-server.js +1 -1
- package/dist/esm/src/lib/requests/server/get-page-widget-data-server.d.ts +3 -3
- package/dist/esm/src/lib/requests/server/get-page-widget-data-server.js +5 -0
- package/dist/esm/src/lib/requests/server/get-widget-data-server.d.ts +1 -1
- package/dist/esm/src/lib/requests/server/get-widget-data-server.js +1 -1
- package/dist/esm/src/lib/requests/server/widget-facet-click-event-server.d.ts +1 -1
- package/dist/esm/src/lib/requests/server/widget-facet-click-event-server.js +1 -1
- package/dist/esm/src/lib/requests/server/widget-item-click-event-server.d.ts +1 -1
- package/dist/esm/src/lib/requests/server/widget-item-click-event-server.js +1 -1
- package/dist/esm/src/lib/requests/server/widget-navigation-click-event-server.d.ts +1 -1
- package/dist/esm/src/lib/requests/server/widget-navigation-click-event-server.js +1 -1
- package/dist/esm/src/lib/requests/server/widget-suggestion-click-event-server.d.ts +1 -1
- package/dist/esm/src/lib/requests/server/widget-suggestion-click-event-server.js +1 -1
- package/dist/esm/src/lib/requests/server/widget-view-event-server.d.ts +1 -1
- package/dist/esm/src/lib/requests/server/widget-view-event-server.js +1 -1
- package/dist/esm/tsconfig.tsbuildinfo +1 -1
- package/package.json +4 -4
|
@@ -3,12 +3,47 @@ import { WidgetItem } from './widget-item';
|
|
|
3
3
|
/** Base class for widgets that support rules functionality */
|
|
4
4
|
export declare class RuleWidgetItem extends WidgetItem {
|
|
5
5
|
protected _rule?: SearchRuleOptions;
|
|
6
|
+
/**
|
|
7
|
+
*
|
|
8
|
+
* @param entity - the entity value of the RuleWidgetItem.
|
|
9
|
+
* @param widgetId - the widgetId value of the RuleWidgetItem.
|
|
10
|
+
* @param rule - the {@link SearchRuleOptions} of the RuleWidgetItem.
|
|
11
|
+
* @throws - {@link ErrorMessages.IV_0027} | {@link ErrorMessages.IV_0028}
|
|
12
|
+
*/
|
|
6
13
|
constructor(entity: string, widgetId: string, rule?: SearchRuleOptions);
|
|
14
|
+
/**
|
|
15
|
+
* Sets the `rule` property
|
|
16
|
+
* @param rule - the {@link SearchRuleOptions} value to be applied.
|
|
17
|
+
* @throws - {@link ErrorMessages.IV_0027} | {@link ErrorMessages.IV_0028}
|
|
18
|
+
*/
|
|
7
19
|
set rule(rule: SearchRuleOptions);
|
|
20
|
+
/**
|
|
21
|
+
* @returns the {@link SearchRuleOptions} `rule` property of the RuleWidgetItem.
|
|
22
|
+
*/
|
|
8
23
|
get rule(): SearchRuleOptions | undefined;
|
|
9
24
|
resetRule(): void;
|
|
25
|
+
/**
|
|
26
|
+
* Throws error if on of the rule properties has invalid data.
|
|
27
|
+
* @param rule - {@link SearchRuleOptions}
|
|
28
|
+
* @throws - {@link ErrorMessages.IV_0027} | {@link ErrorMessages.IV_0028}
|
|
29
|
+
*/
|
|
10
30
|
protected _validateRule(rule?: SearchRuleOptions): void;
|
|
31
|
+
/**
|
|
32
|
+
*
|
|
33
|
+
* @param rules - array of {@link ArrayOfAtLeastOne} object with properties `filter` `slots` `weight`
|
|
34
|
+
* @returns the rule property in a boost rule DTO format {@link BoostRuleDTO}[].
|
|
35
|
+
*/
|
|
11
36
|
private _convertToBoostRuleDTO;
|
|
37
|
+
/**
|
|
38
|
+
*
|
|
39
|
+
* @param rules - array of {@link ArrayOfAtLeastOne} object with properties `filter` `slots`
|
|
40
|
+
* @returns the rule property in IncludeRuleDTO format {@link IncludeRuleDTO}[].
|
|
41
|
+
*/
|
|
12
42
|
private _convertToIncludeRuleDTO;
|
|
43
|
+
/**
|
|
44
|
+
*
|
|
45
|
+
* @param rule - {@link SearchRuleOptions}
|
|
46
|
+
* @returns - returns RuleWidgetItem in its DTO format {@link SearchRuleDTO}.
|
|
47
|
+
*/
|
|
13
48
|
protected _ruleToDTO(rule?: SearchRuleOptions): SearchRuleDTO | undefined;
|
|
14
49
|
}
|
|
@@ -6,6 +6,13 @@ const consts_1 = require("../../consts");
|
|
|
6
6
|
const widget_item_1 = require("./widget-item");
|
|
7
7
|
/** Base class for widgets that support rules functionality */
|
|
8
8
|
class RuleWidgetItem extends widget_item_1.WidgetItem {
|
|
9
|
+
/**
|
|
10
|
+
*
|
|
11
|
+
* @param entity - the entity value of the RuleWidgetItem.
|
|
12
|
+
* @param widgetId - the widgetId value of the RuleWidgetItem.
|
|
13
|
+
* @param rule - the {@link SearchRuleOptions} of the RuleWidgetItem.
|
|
14
|
+
* @throws - {@link ErrorMessages.IV_0027} | {@link ErrorMessages.IV_0028}
|
|
15
|
+
*/
|
|
9
16
|
constructor(entity, widgetId, rule) {
|
|
10
17
|
super(entity, widgetId);
|
|
11
18
|
if (rule) {
|
|
@@ -13,16 +20,29 @@ class RuleWidgetItem extends widget_item_1.WidgetItem {
|
|
|
13
20
|
this._rule = rule;
|
|
14
21
|
}
|
|
15
22
|
}
|
|
23
|
+
/**
|
|
24
|
+
* Sets the `rule` property
|
|
25
|
+
* @param rule - the {@link SearchRuleOptions} value to be applied.
|
|
26
|
+
* @throws - {@link ErrorMessages.IV_0027} | {@link ErrorMessages.IV_0028}
|
|
27
|
+
*/
|
|
16
28
|
set rule(rule) {
|
|
17
29
|
this._validateRule(rule);
|
|
18
30
|
this._rule = rule;
|
|
19
31
|
}
|
|
32
|
+
/**
|
|
33
|
+
* @returns the {@link SearchRuleOptions} `rule` property of the RuleWidgetItem.
|
|
34
|
+
*/
|
|
20
35
|
get rule() {
|
|
21
36
|
return this._rule;
|
|
22
37
|
}
|
|
23
38
|
resetRule() {
|
|
24
39
|
this._rule = undefined;
|
|
25
40
|
}
|
|
41
|
+
/**
|
|
42
|
+
* Throws error if on of the rule properties has invalid data.
|
|
43
|
+
* @param rule - {@link SearchRuleOptions}
|
|
44
|
+
* @throws - {@link ErrorMessages.IV_0027} | {@link ErrorMessages.IV_0028}
|
|
45
|
+
*/
|
|
26
46
|
_validateRule(rule) {
|
|
27
47
|
if (!rule)
|
|
28
48
|
return;
|
|
@@ -36,6 +56,11 @@ class RuleWidgetItem extends widget_item_1.WidgetItem {
|
|
|
36
56
|
// Validate include rules
|
|
37
57
|
rule.include?.forEach((item) => item.slots.forEach((slot) => this._validatePositiveInteger(consts_1.ErrorMessages.IV_0028, slot)));
|
|
38
58
|
}
|
|
59
|
+
/**
|
|
60
|
+
*
|
|
61
|
+
* @param rules - array of {@link ArrayOfAtLeastOne} object with properties `filter` `slots` `weight`
|
|
62
|
+
* @returns the rule property in a boost rule DTO format {@link BoostRuleDTO}[].
|
|
63
|
+
*/
|
|
39
64
|
_convertToBoostRuleDTO(rules) {
|
|
40
65
|
return rules.map((rule) => ({
|
|
41
66
|
filter: rule.filter.toDTO(),
|
|
@@ -43,12 +68,22 @@ class RuleWidgetItem extends widget_item_1.WidgetItem {
|
|
|
43
68
|
weight: rule.weight
|
|
44
69
|
}));
|
|
45
70
|
}
|
|
71
|
+
/**
|
|
72
|
+
*
|
|
73
|
+
* @param rules - array of {@link ArrayOfAtLeastOne} object with properties `filter` `slots`
|
|
74
|
+
* @returns the rule property in IncludeRuleDTO format {@link IncludeRuleDTO}[].
|
|
75
|
+
*/
|
|
46
76
|
_convertToIncludeRuleDTO(rules) {
|
|
47
77
|
return rules.map((rule) => ({
|
|
48
78
|
filter: rule.filter.toDTO(),
|
|
49
79
|
slots: rule.slots
|
|
50
80
|
}));
|
|
51
81
|
}
|
|
82
|
+
/**
|
|
83
|
+
*
|
|
84
|
+
* @param rule - {@link SearchRuleOptions}
|
|
85
|
+
* @returns - returns RuleWidgetItem in its DTO format {@link SearchRuleDTO}.
|
|
86
|
+
*/
|
|
52
87
|
_ruleToDTO(rule) {
|
|
53
88
|
if (!rule)
|
|
54
89
|
return undefined;
|
|
@@ -9,20 +9,27 @@ export declare class SearchWidgetItem extends ResultsWidgetItem {
|
|
|
9
9
|
private _suggestion?;
|
|
10
10
|
private _ranking?;
|
|
11
11
|
private _personalization?;
|
|
12
|
+
private _disableGrouping?;
|
|
12
13
|
/**
|
|
13
14
|
* Creates and holds the functionality of a search widget item.
|
|
14
15
|
* @param entity - The widget's item entity.
|
|
15
16
|
* @param widgetId - The widget's item id.
|
|
16
|
-
* @param searchOptions - The widget's
|
|
17
|
-
*
|
|
17
|
+
* @param searchOptions - The widget's {@link SearchOptions} object.
|
|
18
|
+
* @throws - {@link ErrorMessages.IV_0008} | {@link ErrorMessages.IV_0009};
|
|
19
|
+
* @throws - {@link ErrorMessages.IV_0014} | {@link ErrorMessages.IV_0016};
|
|
20
|
+
* @throws - {@link ErrorMessages.IV_0017} | {@link ErrorMessages.IV_0018};
|
|
21
|
+
* @throws - {@link ErrorMessages.IV_0019} | {@link ErrorMessages.IV_0020};
|
|
22
|
+
* @throws - {@link ErrorMessages.IV_0021} | {@link ErrorMessages.IV_0026};
|
|
23
|
+
* @throws - {@link ErrorMessages.IV_0029} | {@link ErrorMessages.IV_0030};
|
|
24
|
+
* @throws - {@link ErrorMessages.IV_0031}
|
|
18
25
|
*/
|
|
19
26
|
constructor(entity: string, widgetId: string, searchOptions?: SearchOptions);
|
|
20
27
|
/**
|
|
21
|
-
* @param personalization - the object of the `personalization` param
|
|
28
|
+
* @param personalization - the object {@link SearchPersonalizationOptions} of the `personalization` param
|
|
22
29
|
*/
|
|
23
30
|
set personalization(personalization: SearchPersonalizationOptions);
|
|
24
31
|
/**
|
|
25
|
-
* @returns the `personalization` property of the SearchWidgetItem
|
|
32
|
+
* @returns the {@link SearchPersonalizationOptions} `personalization` property of the SearchWidgetItem
|
|
26
33
|
*/
|
|
27
34
|
get personalization(): SearchPersonalizationOptions | undefined;
|
|
28
35
|
/**
|
|
@@ -32,21 +39,20 @@ export declare class SearchWidgetItem extends ResultsWidgetItem {
|
|
|
32
39
|
/**
|
|
33
40
|
*
|
|
34
41
|
* @param personalization - the object of the `personalization` property
|
|
35
|
-
* @throws
|
|
36
|
-
* @throws IV_0031 if `personalization.ids` contains an empty string
|
|
42
|
+
* @throws - {@link ErrorMessages.IV_0030} | {@link ErrorMessages.IV_0031};
|
|
37
43
|
*/
|
|
38
44
|
private _validatePersonalization;
|
|
39
45
|
/**
|
|
40
46
|
*
|
|
41
|
-
* @returns The personalization property in its DTO format.
|
|
47
|
+
* @returns The personalization property in its DTO format {@link SearchPersonalizationOptionsDto}.
|
|
42
48
|
*/
|
|
43
49
|
private _personalizationToDTO;
|
|
44
50
|
/**
|
|
45
|
-
* @param ranking - the object of the `ranking` param
|
|
51
|
+
* @param ranking - the object {@link SearchRankingOptions}[] of the `ranking` param
|
|
46
52
|
*/
|
|
47
53
|
set ranking(ranking: ArrayOfAtLeastOne<SearchRankingOptions>);
|
|
48
54
|
/**
|
|
49
|
-
* @returns the `ranking` property of the SearchWidgetItem
|
|
55
|
+
* @returns the {@link SearchRankingOptions}[] `ranking` property of the SearchWidgetItem
|
|
50
56
|
*/
|
|
51
57
|
get ranking(): ArrayOfAtLeastOne<SearchRankingOptions> | undefined;
|
|
52
58
|
/**
|
|
@@ -55,22 +61,27 @@ export declare class SearchWidgetItem extends ResultsWidgetItem {
|
|
|
55
61
|
resetRanking(): void;
|
|
56
62
|
/**
|
|
57
63
|
*
|
|
58
|
-
* @param ranking - the object of the `ranking` property
|
|
59
|
-
* @throws
|
|
60
|
-
* @throws IV_0016 if `ranking.weight` is outside of range 1 ~ 100
|
|
64
|
+
* @param ranking - the object {@link SearchRankingOptions}[] of the `ranking` property
|
|
65
|
+
* @throws - {@link ErrorMessages.IV_0016} | {@link ErrorMessages.IV_0029};
|
|
61
66
|
*/
|
|
62
67
|
private _validateRanking;
|
|
63
68
|
/**
|
|
64
69
|
* Sets the search query for the SearchWidgetItem.
|
|
65
70
|
* This method updates the `query` property of the search configuration within the SearchWidgetItem instance.
|
|
66
71
|
* The query is used to define specific search criteria.
|
|
67
|
-
* @param query - The operator that specifies the search criteria.
|
|
72
|
+
* @param query - The {@link QueryOptions} operator that specifies the search criteria.
|
|
73
|
+
* @throws - {@link ErrorMessages.IV_0008}
|
|
68
74
|
*/
|
|
69
75
|
set query(query: QueryOptions);
|
|
70
76
|
/**
|
|
71
|
-
* @returns The query property of the SearchWidgetItem.
|
|
77
|
+
* @returns The {@link QueryOptions} `query` property of the SearchWidgetItem.
|
|
72
78
|
*/
|
|
73
79
|
get query(): QueryOptions | undefined;
|
|
80
|
+
/**
|
|
81
|
+
*
|
|
82
|
+
* @param query - {@link QueryOptions}
|
|
83
|
+
* @throws - {@link ErrorMessages.IV_0009}
|
|
84
|
+
*/
|
|
74
85
|
private _validateQuery;
|
|
75
86
|
/**
|
|
76
87
|
* Sets the query data to undefined
|
|
@@ -81,11 +92,11 @@ export declare class SearchWidgetItem extends ResultsWidgetItem {
|
|
|
81
92
|
* This method updates the `facet` property of the search configuration within the SearchWidgetItem instance.
|
|
82
93
|
*
|
|
83
94
|
* @param facet - The object to set as the search facet.
|
|
84
|
-
* @throws
|
|
95
|
+
* @throws - {@link ErrorMessages.IV_0014}
|
|
85
96
|
*/
|
|
86
97
|
set facet(facet: FacetOptions);
|
|
87
98
|
/**
|
|
88
|
-
* @returns The facet property of the SearchWidgetItem.
|
|
99
|
+
* @returns The {@link FacetOptions} `facet` property of the SearchWidgetItem.
|
|
89
100
|
*/
|
|
90
101
|
get facet(): FacetOptions | undefined;
|
|
91
102
|
/**
|
|
@@ -96,7 +107,7 @@ export declare class SearchWidgetItem extends ResultsWidgetItem {
|
|
|
96
107
|
* Sets the search offset for the WidgetItem.
|
|
97
108
|
* Updates the offset property to manage pagination. Throws an error if the offset value is less than 0.
|
|
98
109
|
* @param offset - The non-negative integer to set as the search offset.
|
|
99
|
-
* @throws
|
|
110
|
+
* @throws - {@link ErrorMessages.IV_0008}
|
|
100
111
|
*/
|
|
101
112
|
set offset(offset: number);
|
|
102
113
|
/**
|
|
@@ -107,61 +118,92 @@ export declare class SearchWidgetItem extends ResultsWidgetItem {
|
|
|
107
118
|
* Sets the offset value to undefined
|
|
108
119
|
*/
|
|
109
120
|
resetOffset(): void;
|
|
121
|
+
/**
|
|
122
|
+
* Sets the disable grouping property of the SearchWidgetItem.
|
|
123
|
+
* @param disableGrouping - A boolean indicating if grouping has been enabled in Sitecore Search.
|
|
124
|
+
*/
|
|
125
|
+
set disableGrouping(disableGrouping: boolean);
|
|
126
|
+
/**
|
|
127
|
+
* @returns The disableGrouping property of the SearchWidgetItem.
|
|
128
|
+
*/
|
|
129
|
+
get disableGrouping(): boolean | undefined;
|
|
130
|
+
/**
|
|
131
|
+
* Sets the `disableGrouping` property to undefined.
|
|
132
|
+
*/
|
|
133
|
+
resetDisableGrouping(): void;
|
|
110
134
|
/**
|
|
111
135
|
* Sets the suggestion property for SearchWidgetItem
|
|
112
|
-
* @param suggestion - the
|
|
113
|
-
* @throws
|
|
114
|
-
* @throws error if <SearchSuggestionOptions>.<suggestion>.max property is not between the range 1 ~ 100
|
|
136
|
+
* @param suggestion - the {@link SearchSuggestionOptions}[] of objects for the suggestion param
|
|
137
|
+
* @throws - {@link ErrorMessages.IV_0014} | {@link ErrorMessages.IV_0016}
|
|
115
138
|
*/
|
|
116
139
|
set suggestion(suggestion: ArrayOfAtLeastOne<SearchSuggestionOptions>);
|
|
117
140
|
/**
|
|
118
|
-
* @returns The suggestion property of the SearchWidgetItem.
|
|
141
|
+
* @returns The {@link SearchSuggestionOptions} `suggestion` property of the SearchWidgetItem.
|
|
119
142
|
*/
|
|
120
143
|
get suggestion(): ArrayOfAtLeastOne<SearchSuggestionOptions> | undefined;
|
|
121
144
|
/**
|
|
122
|
-
* Sets the suggestion property to undefined.
|
|
145
|
+
* Sets the `suggestion` property to undefined.
|
|
123
146
|
*/
|
|
124
147
|
resetSuggestion(): void;
|
|
148
|
+
/**
|
|
149
|
+
*
|
|
150
|
+
* @returns the `suggestion` property in its DTO format. {@link SearchSuggestionOptionsDTO}[]
|
|
151
|
+
*/
|
|
125
152
|
private _suggestionToDTO;
|
|
126
153
|
/**
|
|
127
|
-
* Validates the suggestion property. Throws error if provided with incorrect values.
|
|
128
|
-
* @param suggestion - the
|
|
154
|
+
* Validates the `suggestion` property. Throws error if provided with incorrect values.
|
|
155
|
+
* @param suggestion - the {@link SearchSuggestionOptions}[] of objects for the `suggestion` param
|
|
156
|
+
* @throws - {@link ErrorMessages.IV_0014} | {@link ErrorMessages.IV_0016}
|
|
129
157
|
*/
|
|
130
158
|
private _validateSuggestion;
|
|
131
159
|
/**
|
|
132
160
|
* Sets the search sort property for SearchWidgetItem
|
|
133
161
|
* Throws an error if one of the values under sort have an empty `name`
|
|
134
|
-
* @param sort - the object for the sort param
|
|
162
|
+
* @param sort - the object {@link SearchSortOptions} for the `sort` param
|
|
135
163
|
* @throws error if <SearchSortOptions>.<SortValue>.name(s) property is an empty string
|
|
136
164
|
*/
|
|
137
165
|
set sort(sort: SearchSortOptions);
|
|
138
166
|
/**
|
|
139
|
-
* @returns The sort property of the SearchWidgetItem.
|
|
167
|
+
* @returns The sort {@link SearchSortOptions} `property` of the SearchWidgetItem.
|
|
140
168
|
*/
|
|
141
169
|
get sort(): SearchSortOptions | undefined;
|
|
142
170
|
/**
|
|
143
|
-
* Sets the sort
|
|
171
|
+
* Sets the `sort` property to undefined
|
|
144
172
|
*/
|
|
145
173
|
resetSort(): void;
|
|
146
174
|
/**
|
|
147
175
|
* Validates the sort field. Throws an error if incorrect values are provided.
|
|
176
|
+
* @param sort - {@link SearchSortOptions}
|
|
177
|
+
* @throws - {@link ErrorMessages.IV_0026}
|
|
148
178
|
*/
|
|
149
179
|
private _validateSort;
|
|
150
180
|
/**
|
|
151
181
|
* Validates the facet type fields. Throws an errors if incorrect values are provided.
|
|
182
|
+
* @param types - {@link FacetTypeOptions}[]
|
|
183
|
+
* @throws - {@link ErrorMessages.IV_0016} | {@link ErrorMessages.IV_0017}
|
|
184
|
+
* @throws - {@link ErrorMessages.IV_0018} | {@link ErrorMessages.IV_0019}
|
|
185
|
+
* @throws - {@link ErrorMessages.IV_0020} | {@link ErrorMessages.IV_0021}
|
|
152
186
|
*/
|
|
153
187
|
private _validateFacetTypes;
|
|
188
|
+
/**
|
|
189
|
+
* @param type - {@link FacetTypeOptions}
|
|
190
|
+
* @returns the `filter` property in a DTO format.
|
|
191
|
+
*/
|
|
154
192
|
private _filterToDTO;
|
|
155
193
|
/**
|
|
156
194
|
* Builds the sort piece of the DTO.
|
|
195
|
+
* @param type - {@link FacetTypeOptions}
|
|
157
196
|
*/
|
|
158
197
|
private _facetSortToDTO;
|
|
159
198
|
/**
|
|
160
|
-
* Builds the filtering options array.
|
|
199
|
+
* Builds the filtering options array in its DTO format.
|
|
200
|
+
* @param filteringOptions - {@link FilteringOptions}
|
|
201
|
+
* @returns - {@link FilteringOptionsDTO}
|
|
161
202
|
*/
|
|
162
203
|
private _filteringOptionsToDTO;
|
|
163
204
|
/**
|
|
164
205
|
* Maps the search widget item to its DTO format.
|
|
206
|
+
* @returns - {@link SearchWidgetItemDTO}
|
|
165
207
|
*/
|
|
166
208
|
toDTO(): SearchWidgetItemDTO;
|
|
167
209
|
}
|
|
@@ -10,8 +10,14 @@ class SearchWidgetItem extends results_widget_item_1.ResultsWidgetItem {
|
|
|
10
10
|
* Creates and holds the functionality of a search widget item.
|
|
11
11
|
* @param entity - The widget's item entity.
|
|
12
12
|
* @param widgetId - The widget's item id.
|
|
13
|
-
* @param searchOptions - The widget's
|
|
14
|
-
*
|
|
13
|
+
* @param searchOptions - The widget's {@link SearchOptions} object.
|
|
14
|
+
* @throws - {@link ErrorMessages.IV_0008} | {@link ErrorMessages.IV_0009};
|
|
15
|
+
* @throws - {@link ErrorMessages.IV_0014} | {@link ErrorMessages.IV_0016};
|
|
16
|
+
* @throws - {@link ErrorMessages.IV_0017} | {@link ErrorMessages.IV_0018};
|
|
17
|
+
* @throws - {@link ErrorMessages.IV_0019} | {@link ErrorMessages.IV_0020};
|
|
18
|
+
* @throws - {@link ErrorMessages.IV_0021} | {@link ErrorMessages.IV_0026};
|
|
19
|
+
* @throws - {@link ErrorMessages.IV_0029} | {@link ErrorMessages.IV_0030};
|
|
20
|
+
* @throws - {@link ErrorMessages.IV_0031}
|
|
15
21
|
*/
|
|
16
22
|
constructor(entity, widgetId, searchOptions) {
|
|
17
23
|
super(entity, widgetId, {
|
|
@@ -42,16 +48,17 @@ class SearchWidgetItem extends results_widget_item_1.ResultsWidgetItem {
|
|
|
42
48
|
this._sort = searchOptions.sort;
|
|
43
49
|
this._validateSuggestion(searchOptions.suggestion);
|
|
44
50
|
this._suggestion = searchOptions.suggestion;
|
|
51
|
+
this._disableGrouping = searchOptions.disableGrouping;
|
|
45
52
|
}
|
|
46
53
|
/**
|
|
47
|
-
* @param personalization - the object of the `personalization` param
|
|
54
|
+
* @param personalization - the object {@link SearchPersonalizationOptions} of the `personalization` param
|
|
48
55
|
*/
|
|
49
56
|
set personalization(personalization) {
|
|
50
57
|
this._validatePersonalization(personalization);
|
|
51
58
|
this._personalization = personalization;
|
|
52
59
|
}
|
|
53
60
|
/**
|
|
54
|
-
* @returns the `personalization` property of the SearchWidgetItem
|
|
61
|
+
* @returns the {@link SearchPersonalizationOptions} `personalization` property of the SearchWidgetItem
|
|
55
62
|
*/
|
|
56
63
|
get personalization() {
|
|
57
64
|
return this._personalization;
|
|
@@ -65,8 +72,7 @@ class SearchWidgetItem extends results_widget_item_1.ResultsWidgetItem {
|
|
|
65
72
|
/**
|
|
66
73
|
*
|
|
67
74
|
* @param personalization - the object of the `personalization` property
|
|
68
|
-
* @throws
|
|
69
|
-
* @throws IV_0031 if `personalization.ids` contains an empty string
|
|
75
|
+
* @throws - {@link ErrorMessages.IV_0030} | {@link ErrorMessages.IV_0031};
|
|
70
76
|
*/
|
|
71
77
|
_validatePersonalization(personalization) {
|
|
72
78
|
if (!personalization)
|
|
@@ -81,7 +87,7 @@ class SearchWidgetItem extends results_widget_item_1.ResultsWidgetItem {
|
|
|
81
87
|
}
|
|
82
88
|
/**
|
|
83
89
|
*
|
|
84
|
-
* @returns The personalization property in its DTO format.
|
|
90
|
+
* @returns The personalization property in its DTO format {@link SearchPersonalizationOptionsDto}.
|
|
85
91
|
*/
|
|
86
92
|
_personalizationToDTO() {
|
|
87
93
|
if (!this._personalization)
|
|
@@ -90,14 +96,14 @@ class SearchWidgetItem extends results_widget_item_1.ResultsWidgetItem {
|
|
|
90
96
|
return { fields: attributes, ...rest };
|
|
91
97
|
}
|
|
92
98
|
/**
|
|
93
|
-
* @param ranking - the object of the `ranking` param
|
|
99
|
+
* @param ranking - the object {@link SearchRankingOptions}[] of the `ranking` param
|
|
94
100
|
*/
|
|
95
101
|
set ranking(ranking) {
|
|
96
102
|
this._validateRanking(ranking);
|
|
97
103
|
this._ranking = ranking;
|
|
98
104
|
}
|
|
99
105
|
/**
|
|
100
|
-
* @returns the `ranking` property of the SearchWidgetItem
|
|
106
|
+
* @returns the {@link SearchRankingOptions}[] `ranking` property of the SearchWidgetItem
|
|
101
107
|
*/
|
|
102
108
|
get ranking() {
|
|
103
109
|
return this._ranking;
|
|
@@ -110,9 +116,8 @@ class SearchWidgetItem extends results_widget_item_1.ResultsWidgetItem {
|
|
|
110
116
|
}
|
|
111
117
|
/**
|
|
112
118
|
*
|
|
113
|
-
* @param ranking - the object of the `ranking` property
|
|
114
|
-
* @throws
|
|
115
|
-
* @throws IV_0016 if `ranking.weight` is outside of range 1 ~ 100
|
|
119
|
+
* @param ranking - the object {@link SearchRankingOptions}[] of the `ranking` property
|
|
120
|
+
* @throws - {@link ErrorMessages.IV_0016} | {@link ErrorMessages.IV_0029};
|
|
116
121
|
*/
|
|
117
122
|
_validateRanking(ranking) {
|
|
118
123
|
ranking?.forEach((rank) => {
|
|
@@ -124,18 +129,24 @@ class SearchWidgetItem extends results_widget_item_1.ResultsWidgetItem {
|
|
|
124
129
|
* Sets the search query for the SearchWidgetItem.
|
|
125
130
|
* This method updates the `query` property of the search configuration within the SearchWidgetItem instance.
|
|
126
131
|
* The query is used to define specific search criteria.
|
|
127
|
-
* @param query - The operator that specifies the search criteria.
|
|
132
|
+
* @param query - The {@link QueryOptions} operator that specifies the search criteria.
|
|
133
|
+
* @throws - {@link ErrorMessages.IV_0008}
|
|
128
134
|
*/
|
|
129
135
|
set query(query) {
|
|
130
136
|
this._validateQuery(query);
|
|
131
137
|
this._query = query;
|
|
132
138
|
}
|
|
133
139
|
/**
|
|
134
|
-
* @returns The query property of the SearchWidgetItem.
|
|
140
|
+
* @returns The {@link QueryOptions} `query` property of the SearchWidgetItem.
|
|
135
141
|
*/
|
|
136
142
|
get query() {
|
|
137
143
|
return this._query;
|
|
138
144
|
}
|
|
145
|
+
/**
|
|
146
|
+
*
|
|
147
|
+
* @param query - {@link QueryOptions}
|
|
148
|
+
* @throws - {@link ErrorMessages.IV_0009}
|
|
149
|
+
*/
|
|
139
150
|
_validateQuery(query) {
|
|
140
151
|
this._validateStringLengthInRange1To100(consts_1.ErrorMessages.IV_0009, query.keyphrase);
|
|
141
152
|
}
|
|
@@ -150,7 +161,7 @@ class SearchWidgetItem extends results_widget_item_1.ResultsWidgetItem {
|
|
|
150
161
|
* This method updates the `facet` property of the search configuration within the SearchWidgetItem instance.
|
|
151
162
|
*
|
|
152
163
|
* @param facet - The object to set as the search facet.
|
|
153
|
-
* @throws
|
|
164
|
+
* @throws - {@link ErrorMessages.IV_0014}
|
|
154
165
|
*/
|
|
155
166
|
set facet(facet) {
|
|
156
167
|
this._validateNumberInRange1To100(consts_1.ErrorMessages.IV_0014, facet.max);
|
|
@@ -158,7 +169,7 @@ class SearchWidgetItem extends results_widget_item_1.ResultsWidgetItem {
|
|
|
158
169
|
this._facet = facet;
|
|
159
170
|
}
|
|
160
171
|
/**
|
|
161
|
-
* @returns The facet property of the SearchWidgetItem.
|
|
172
|
+
* @returns The {@link FacetOptions} `facet` property of the SearchWidgetItem.
|
|
162
173
|
*/
|
|
163
174
|
get facet() {
|
|
164
175
|
return this._facet;
|
|
@@ -173,7 +184,7 @@ class SearchWidgetItem extends results_widget_item_1.ResultsWidgetItem {
|
|
|
173
184
|
* Sets the search offset for the WidgetItem.
|
|
174
185
|
* Updates the offset property to manage pagination. Throws an error if the offset value is less than 0.
|
|
175
186
|
* @param offset - The non-negative integer to set as the search offset.
|
|
176
|
-
* @throws
|
|
187
|
+
* @throws - {@link ErrorMessages.IV_0008}
|
|
177
188
|
*/
|
|
178
189
|
set offset(offset) {
|
|
179
190
|
this._validatePositiveInteger(consts_1.ErrorMessages.IV_0008, offset);
|
|
@@ -191,28 +202,50 @@ class SearchWidgetItem extends results_widget_item_1.ResultsWidgetItem {
|
|
|
191
202
|
resetOffset() {
|
|
192
203
|
this._offset = undefined;
|
|
193
204
|
}
|
|
205
|
+
/**
|
|
206
|
+
* Sets the disable grouping property of the SearchWidgetItem.
|
|
207
|
+
* @param disableGrouping - A boolean indicating if grouping has been enabled in Sitecore Search.
|
|
208
|
+
*/
|
|
209
|
+
set disableGrouping(disableGrouping) {
|
|
210
|
+
this._disableGrouping = disableGrouping;
|
|
211
|
+
}
|
|
212
|
+
/**
|
|
213
|
+
* @returns The disableGrouping property of the SearchWidgetItem.
|
|
214
|
+
*/
|
|
215
|
+
get disableGrouping() {
|
|
216
|
+
return this._disableGrouping;
|
|
217
|
+
}
|
|
218
|
+
/**
|
|
219
|
+
* Sets the `disableGrouping` property to undefined.
|
|
220
|
+
*/
|
|
221
|
+
resetDisableGrouping() {
|
|
222
|
+
this._disableGrouping = undefined;
|
|
223
|
+
}
|
|
194
224
|
/**
|
|
195
225
|
* Sets the suggestion property for SearchWidgetItem
|
|
196
|
-
* @param suggestion - the
|
|
197
|
-
* @throws
|
|
198
|
-
* @throws error if <SearchSuggestionOptions>.<suggestion>.max property is not between the range 1 ~ 100
|
|
226
|
+
* @param suggestion - the {@link SearchSuggestionOptions}[] of objects for the suggestion param
|
|
227
|
+
* @throws - {@link ErrorMessages.IV_0014} | {@link ErrorMessages.IV_0016}
|
|
199
228
|
*/
|
|
200
229
|
set suggestion(suggestion) {
|
|
201
230
|
this._validateSuggestion(suggestion);
|
|
202
231
|
this._suggestion = suggestion;
|
|
203
232
|
}
|
|
204
233
|
/**
|
|
205
|
-
* @returns The suggestion property of the SearchWidgetItem.
|
|
234
|
+
* @returns The {@link SearchSuggestionOptions} `suggestion` property of the SearchWidgetItem.
|
|
206
235
|
*/
|
|
207
236
|
get suggestion() {
|
|
208
237
|
return this._suggestion;
|
|
209
238
|
}
|
|
210
239
|
/**
|
|
211
|
-
* Sets the suggestion property to undefined.
|
|
240
|
+
* Sets the `suggestion` property to undefined.
|
|
212
241
|
*/
|
|
213
242
|
resetSuggestion() {
|
|
214
243
|
this._suggestion = undefined;
|
|
215
244
|
}
|
|
245
|
+
/**
|
|
246
|
+
*
|
|
247
|
+
* @returns the `suggestion` property in its DTO format. {@link SearchSuggestionOptionsDTO}[]
|
|
248
|
+
*/
|
|
216
249
|
_suggestionToDTO() {
|
|
217
250
|
if (!this._suggestion)
|
|
218
251
|
return undefined;
|
|
@@ -222,8 +255,9 @@ class SearchWidgetItem extends results_widget_item_1.ResultsWidgetItem {
|
|
|
222
255
|
});
|
|
223
256
|
}
|
|
224
257
|
/**
|
|
225
|
-
* Validates the suggestion property. Throws error if provided with incorrect values.
|
|
226
|
-
* @param suggestion - the
|
|
258
|
+
* Validates the `suggestion` property. Throws error if provided with incorrect values.
|
|
259
|
+
* @param suggestion - the {@link SearchSuggestionOptions}[] of objects for the `suggestion` param
|
|
260
|
+
* @throws - {@link ErrorMessages.IV_0014} | {@link ErrorMessages.IV_0016}
|
|
227
261
|
*/
|
|
228
262
|
_validateSuggestion(suggestion) {
|
|
229
263
|
suggestion?.forEach((suggestionItem) => {
|
|
@@ -234,7 +268,7 @@ class SearchWidgetItem extends results_widget_item_1.ResultsWidgetItem {
|
|
|
234
268
|
/**
|
|
235
269
|
* Sets the search sort property for SearchWidgetItem
|
|
236
270
|
* Throws an error if one of the values under sort have an empty `name`
|
|
237
|
-
* @param sort - the object for the sort param
|
|
271
|
+
* @param sort - the object {@link SearchSortOptions} for the `sort` param
|
|
238
272
|
* @throws error if <SearchSortOptions>.<SortValue>.name(s) property is an empty string
|
|
239
273
|
*/
|
|
240
274
|
set sort(sort) {
|
|
@@ -242,19 +276,21 @@ class SearchWidgetItem extends results_widget_item_1.ResultsWidgetItem {
|
|
|
242
276
|
this._sort = sort;
|
|
243
277
|
}
|
|
244
278
|
/**
|
|
245
|
-
* @returns The sort property of the SearchWidgetItem.
|
|
279
|
+
* @returns The sort {@link SearchSortOptions} `property` of the SearchWidgetItem.
|
|
246
280
|
*/
|
|
247
281
|
get sort() {
|
|
248
282
|
return this._sort;
|
|
249
283
|
}
|
|
250
284
|
/**
|
|
251
|
-
* Sets the sort
|
|
285
|
+
* Sets the `sort` property to undefined
|
|
252
286
|
*/
|
|
253
287
|
resetSort() {
|
|
254
288
|
this._sort = undefined;
|
|
255
289
|
}
|
|
256
290
|
/**
|
|
257
291
|
* Validates the sort field. Throws an error if incorrect values are provided.
|
|
292
|
+
* @param sort - {@link SearchSortOptions}
|
|
293
|
+
* @throws - {@link ErrorMessages.IV_0026}
|
|
258
294
|
*/
|
|
259
295
|
_validateSort(sort) {
|
|
260
296
|
sort?.value?.forEach((sortValueItem) => {
|
|
@@ -263,6 +299,10 @@ class SearchWidgetItem extends results_widget_item_1.ResultsWidgetItem {
|
|
|
263
299
|
}
|
|
264
300
|
/**
|
|
265
301
|
* Validates the facet type fields. Throws an errors if incorrect values are provided.
|
|
302
|
+
* @param types - {@link FacetTypeOptions}[]
|
|
303
|
+
* @throws - {@link ErrorMessages.IV_0016} | {@link ErrorMessages.IV_0017}
|
|
304
|
+
* @throws - {@link ErrorMessages.IV_0018} | {@link ErrorMessages.IV_0019}
|
|
305
|
+
* @throws - {@link ErrorMessages.IV_0020} | {@link ErrorMessages.IV_0021}
|
|
266
306
|
*/
|
|
267
307
|
_validateFacetTypes(types) {
|
|
268
308
|
if (!types)
|
|
@@ -280,6 +320,10 @@ class SearchWidgetItem extends results_widget_item_1.ResultsWidgetItem {
|
|
|
280
320
|
}
|
|
281
321
|
});
|
|
282
322
|
}
|
|
323
|
+
/**
|
|
324
|
+
* @param type - {@link FacetTypeOptions}
|
|
325
|
+
* @returns the `filter` property in a DTO format.
|
|
326
|
+
*/
|
|
283
327
|
_filterToDTO(type) {
|
|
284
328
|
if (!type.filter)
|
|
285
329
|
return undefined;
|
|
@@ -289,6 +333,7 @@ class SearchWidgetItem extends results_widget_item_1.ResultsWidgetItem {
|
|
|
289
333
|
}
|
|
290
334
|
/**
|
|
291
335
|
* Builds the sort piece of the DTO.
|
|
336
|
+
* @param type - {@link FacetTypeOptions}
|
|
292
337
|
*/
|
|
293
338
|
_facetSortToDTO(type) {
|
|
294
339
|
if (type.sort)
|
|
@@ -299,7 +344,9 @@ class SearchWidgetItem extends results_widget_item_1.ResultsWidgetItem {
|
|
|
299
344
|
return {};
|
|
300
345
|
}
|
|
301
346
|
/**
|
|
302
|
-
* Builds the filtering options array.
|
|
347
|
+
* Builds the filtering options array in its DTO format.
|
|
348
|
+
* @param filteringOptions - {@link FilteringOptions}
|
|
349
|
+
* @returns - {@link FilteringOptionsDTO}
|
|
303
350
|
*/
|
|
304
351
|
_filteringOptionsToDTO(filteringOptions) {
|
|
305
352
|
if (!filteringOptions)
|
|
@@ -312,6 +359,7 @@ class SearchWidgetItem extends results_widget_item_1.ResultsWidgetItem {
|
|
|
312
359
|
}
|
|
313
360
|
/**
|
|
314
361
|
* Maps the search widget item to its DTO format.
|
|
362
|
+
* @returns - {@link SearchWidgetItemDTO}
|
|
315
363
|
*/
|
|
316
364
|
toDTO() {
|
|
317
365
|
const baseDTO = super.toDTO();
|
|
@@ -341,6 +389,7 @@ class SearchWidgetItem extends results_widget_item_1.ResultsWidgetItem {
|
|
|
341
389
|
...{ ranking: this._ranking },
|
|
342
390
|
...{ suggestion: this._suggestionToDTO() },
|
|
343
391
|
...{ sort: this._sort },
|
|
392
|
+
...{ disable_grouping: this._disableGrouping },
|
|
344
393
|
...resultsDTO
|
|
345
394
|
};
|
|
346
395
|
const dto = {
|
|
@@ -2,7 +2,7 @@ import type { ArrayOfAtLeastOne } from '../filters/interfaces';
|
|
|
2
2
|
import type { FacetFilter } from './interfaces';
|
|
3
3
|
/**
|
|
4
4
|
* Checks if the provided filters are facet filters.
|
|
5
|
-
* @param filters - The
|
|
5
|
+
* @param filters - The {@link FacetFilter}[] | string[] to check.
|
|
6
6
|
* @returns True if the filters are facet filters, false otherwise.
|
|
7
7
|
*/
|
|
8
8
|
export declare function isFacetFilter(filters: ArrayOfAtLeastOne<string> | ArrayOfAtLeastOne<FacetFilter>): filters is ArrayOfAtLeastOne<FacetFilter>;
|
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.isFacetFilter = void 0;
|
|
4
4
|
/**
|
|
5
5
|
* Checks if the provided filters are facet filters.
|
|
6
|
-
* @param filters - The
|
|
6
|
+
* @param filters - The {@link FacetFilter}[] | string[] to check.
|
|
7
7
|
* @returns True if the filters are facet filters, false otherwise.
|
|
8
8
|
*/
|
|
9
9
|
function isFacetFilter(filters) {
|