@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.
Files changed (169) hide show
  1. package/dist/cjs/package.json +4 -4
  2. package/dist/cjs/src/lib/consts.d.ts +1 -0
  3. package/dist/cjs/src/lib/consts.js +2 -1
  4. package/dist/cjs/src/lib/events/base-widget-event.d.ts +38 -0
  5. package/dist/cjs/src/lib/events/base-widget-event.js +48 -0
  6. package/dist/cjs/src/lib/events/entity-view-event.d.ts +8 -8
  7. package/dist/cjs/src/lib/events/entity-view-event.js +10 -20
  8. package/dist/cjs/src/lib/events/interfaces.d.ts +20 -40
  9. package/dist/cjs/src/lib/events/widget-facet-click-event.d.ts +17 -8
  10. package/dist/cjs/src/lib/events/widget-facet-click-event.js +19 -20
  11. package/dist/cjs/src/lib/events/widget-item-click-event.d.ts +7 -8
  12. package/dist/cjs/src/lib/events/widget-item-click-event.js +9 -20
  13. package/dist/cjs/src/lib/events/widget-navigation-click-event.d.ts +7 -8
  14. package/dist/cjs/src/lib/events/widget-navigation-click-event.js +9 -20
  15. package/dist/cjs/src/lib/events/widget-suggestion-click-event.d.ts +15 -8
  16. package/dist/cjs/src/lib/events/widget-suggestion-click-event.js +17 -20
  17. package/dist/cjs/src/lib/events/widget-view-event.d.ts +15 -8
  18. package/dist/cjs/src/lib/events/widget-view-event.js +17 -20
  19. package/dist/cjs/src/lib/initializer/browser/initializer.d.ts +6 -0
  20. package/dist/cjs/src/lib/initializer/browser/initializer.js +7 -0
  21. package/dist/cjs/src/lib/initializer/server/initializer.d.ts +4 -0
  22. package/dist/cjs/src/lib/initializer/server/initializer.js +4 -0
  23. package/dist/cjs/src/lib/request-entities/context/context.d.ts +24 -24
  24. package/dist/cjs/src/lib/request-entities/context/context.js +24 -24
  25. package/dist/cjs/src/lib/request-entities/filters/base-filter.d.ts +1 -1
  26. package/dist/cjs/src/lib/request-entities/filters/base-filter.js +1 -1
  27. package/dist/cjs/src/lib/request-entities/filters/comparison-filter.d.ts +2 -2
  28. package/dist/cjs/src/lib/request-entities/filters/comparison-filter.js +2 -2
  29. package/dist/cjs/src/lib/request-entities/filters/facet/comparison-facet-filter.d.ts +2 -2
  30. package/dist/cjs/src/lib/request-entities/filters/facet/comparison-facet-filter.js +2 -2
  31. package/dist/cjs/src/lib/request-entities/filters/facet/list-facet-filter.d.ts +3 -3
  32. package/dist/cjs/src/lib/request-entities/filters/facet/list-facet-filter.js +3 -3
  33. package/dist/cjs/src/lib/request-entities/filters/facet/logical-facet-filter.d.ts +3 -3
  34. package/dist/cjs/src/lib/request-entities/filters/facet/logical-facet-filter.js +3 -3
  35. package/dist/cjs/src/lib/request-entities/filters/facet/not-facet-filter.d.ts +7 -0
  36. package/dist/cjs/src/lib/request-entities/filters/facet/not-facet-filter.js +7 -0
  37. package/dist/cjs/src/lib/request-entities/filters/geo-filter.d.ts +7 -2
  38. package/dist/cjs/src/lib/request-entities/filters/geo-filter.js +7 -2
  39. package/dist/cjs/src/lib/request-entities/filters/geo-within-filter.d.ts +8 -2
  40. package/dist/cjs/src/lib/request-entities/filters/geo-within-filter.js +8 -2
  41. package/dist/cjs/src/lib/request-entities/filters/list-filter.d.ts +3 -3
  42. package/dist/cjs/src/lib/request-entities/filters/list-filter.js +3 -3
  43. package/dist/cjs/src/lib/request-entities/filters/logical-filter.d.ts +3 -2
  44. package/dist/cjs/src/lib/request-entities/filters/logical-filter.js +3 -2
  45. package/dist/cjs/src/lib/request-entities/widgets/interfaces.d.ts +2 -0
  46. package/dist/cjs/src/lib/request-entities/widgets/questions-answers-widget-item.d.ts +22 -6
  47. package/dist/cjs/src/lib/request-entities/widgets/questions-answers-widget-item.js +22 -6
  48. package/dist/cjs/src/lib/request-entities/widgets/recommendation-widget-item.d.ts +10 -4
  49. package/dist/cjs/src/lib/request-entities/widgets/recommendation-widget-item.js +10 -4
  50. package/dist/cjs/src/lib/request-entities/widgets/results-widget-item.d.ts +11 -5
  51. package/dist/cjs/src/lib/request-entities/widgets/results-widget-item.js +11 -5
  52. package/dist/cjs/src/lib/request-entities/widgets/rule-widget-item.d.ts +35 -0
  53. package/dist/cjs/src/lib/request-entities/widgets/rule-widget-item.js +35 -0
  54. package/dist/cjs/src/lib/request-entities/widgets/search-widget-item.d.ts +70 -28
  55. package/dist/cjs/src/lib/request-entities/widgets/search-widget-item.js +77 -28
  56. package/dist/cjs/src/lib/request-entities/widgets/utils.d.ts +1 -1
  57. package/dist/cjs/src/lib/request-entities/widgets/utils.js +1 -1
  58. package/dist/cjs/src/lib/request-entities/widgets/widget-item.d.ts +20 -5
  59. package/dist/cjs/src/lib/request-entities/widgets/widget-item.js +20 -5
  60. package/dist/cjs/src/lib/request-entities/widgets/widget-request-data.d.ts +6 -1
  61. package/dist/cjs/src/lib/request-entities/widgets/widget-request-data.js +6 -1
  62. package/dist/cjs/src/lib/requests/browser/get-page-widget-data.d.ts +5 -4
  63. package/dist/cjs/src/lib/requests/browser/get-page-widget-data.js +5 -0
  64. package/dist/cjs/src/lib/requests/browser/get-widget-data.d.ts +1 -1
  65. package/dist/cjs/src/lib/requests/browser/get-widget-data.js +1 -1
  66. package/dist/cjs/src/lib/requests/post-request.d.ts +10 -6
  67. package/dist/cjs/src/lib/requests/post-request.js +2 -1
  68. package/dist/cjs/src/lib/requests/server/entity-view-event-server.d.ts +1 -1
  69. package/dist/cjs/src/lib/requests/server/entity-view-event-server.js +1 -1
  70. package/dist/cjs/src/lib/requests/server/get-page-widget-data-server.d.ts +3 -3
  71. package/dist/cjs/src/lib/requests/server/get-page-widget-data-server.js +5 -0
  72. package/dist/cjs/src/lib/requests/server/get-widget-data-server.d.ts +1 -1
  73. package/dist/cjs/src/lib/requests/server/get-widget-data-server.js +1 -1
  74. package/dist/cjs/src/lib/requests/server/widget-facet-click-event-server.d.ts +1 -1
  75. package/dist/cjs/src/lib/requests/server/widget-facet-click-event-server.js +1 -1
  76. package/dist/cjs/src/lib/requests/server/widget-item-click-event-server.d.ts +1 -1
  77. package/dist/cjs/src/lib/requests/server/widget-item-click-event-server.js +1 -1
  78. package/dist/cjs/src/lib/requests/server/widget-navigation-click-event-server.d.ts +1 -1
  79. package/dist/cjs/src/lib/requests/server/widget-navigation-click-event-server.js +1 -1
  80. package/dist/cjs/src/lib/requests/server/widget-suggestion-click-event-server.d.ts +1 -1
  81. package/dist/cjs/src/lib/requests/server/widget-suggestion-click-event-server.js +1 -1
  82. package/dist/cjs/src/lib/requests/server/widget-view-event-server.d.ts +1 -1
  83. package/dist/cjs/src/lib/requests/server/widget-view-event-server.js +1 -1
  84. package/dist/cjs/tsconfig.cjs.tsbuildinfo +1 -1
  85. package/dist/esm/package.json +4 -4
  86. package/dist/esm/src/lib/consts.d.ts +1 -0
  87. package/dist/esm/src/lib/consts.js +1 -0
  88. package/dist/esm/src/lib/events/base-widget-event.d.ts +38 -0
  89. package/dist/esm/src/lib/events/base-widget-event.js +44 -0
  90. package/dist/esm/src/lib/events/entity-view-event.d.ts +8 -8
  91. package/dist/esm/src/lib/events/entity-view-event.js +10 -20
  92. package/dist/esm/src/lib/events/interfaces.d.ts +20 -40
  93. package/dist/esm/src/lib/events/widget-facet-click-event.d.ts +17 -8
  94. package/dist/esm/src/lib/events/widget-facet-click-event.js +19 -20
  95. package/dist/esm/src/lib/events/widget-item-click-event.d.ts +7 -8
  96. package/dist/esm/src/lib/events/widget-item-click-event.js +9 -20
  97. package/dist/esm/src/lib/events/widget-navigation-click-event.d.ts +7 -8
  98. package/dist/esm/src/lib/events/widget-navigation-click-event.js +9 -20
  99. package/dist/esm/src/lib/events/widget-suggestion-click-event.d.ts +15 -8
  100. package/dist/esm/src/lib/events/widget-suggestion-click-event.js +17 -20
  101. package/dist/esm/src/lib/events/widget-view-event.d.ts +15 -8
  102. package/dist/esm/src/lib/events/widget-view-event.js +17 -20
  103. package/dist/esm/src/lib/initializer/browser/initializer.d.ts +6 -0
  104. package/dist/esm/src/lib/initializer/browser/initializer.js +8 -1
  105. package/dist/esm/src/lib/initializer/server/initializer.d.ts +4 -0
  106. package/dist/esm/src/lib/initializer/server/initializer.js +4 -0
  107. package/dist/esm/src/lib/request-entities/context/context.d.ts +24 -24
  108. package/dist/esm/src/lib/request-entities/context/context.js +24 -24
  109. package/dist/esm/src/lib/request-entities/filters/base-filter.d.ts +1 -1
  110. package/dist/esm/src/lib/request-entities/filters/base-filter.js +1 -1
  111. package/dist/esm/src/lib/request-entities/filters/comparison-filter.d.ts +2 -2
  112. package/dist/esm/src/lib/request-entities/filters/comparison-filter.js +2 -2
  113. package/dist/esm/src/lib/request-entities/filters/facet/comparison-facet-filter.d.ts +2 -2
  114. package/dist/esm/src/lib/request-entities/filters/facet/comparison-facet-filter.js +2 -2
  115. package/dist/esm/src/lib/request-entities/filters/facet/list-facet-filter.d.ts +3 -3
  116. package/dist/esm/src/lib/request-entities/filters/facet/list-facet-filter.js +3 -3
  117. package/dist/esm/src/lib/request-entities/filters/facet/logical-facet-filter.d.ts +3 -3
  118. package/dist/esm/src/lib/request-entities/filters/facet/logical-facet-filter.js +3 -3
  119. package/dist/esm/src/lib/request-entities/filters/facet/not-facet-filter.d.ts +7 -0
  120. package/dist/esm/src/lib/request-entities/filters/facet/not-facet-filter.js +7 -0
  121. package/dist/esm/src/lib/request-entities/filters/geo-filter.d.ts +7 -2
  122. package/dist/esm/src/lib/request-entities/filters/geo-filter.js +7 -2
  123. package/dist/esm/src/lib/request-entities/filters/geo-within-filter.d.ts +8 -2
  124. package/dist/esm/src/lib/request-entities/filters/geo-within-filter.js +8 -2
  125. package/dist/esm/src/lib/request-entities/filters/list-filter.d.ts +3 -3
  126. package/dist/esm/src/lib/request-entities/filters/list-filter.js +3 -3
  127. package/dist/esm/src/lib/request-entities/filters/logical-filter.d.ts +3 -2
  128. package/dist/esm/src/lib/request-entities/filters/logical-filter.js +3 -2
  129. package/dist/esm/src/lib/request-entities/widgets/interfaces.d.ts +2 -0
  130. package/dist/esm/src/lib/request-entities/widgets/questions-answers-widget-item.d.ts +22 -6
  131. package/dist/esm/src/lib/request-entities/widgets/questions-answers-widget-item.js +22 -6
  132. package/dist/esm/src/lib/request-entities/widgets/recommendation-widget-item.d.ts +10 -4
  133. package/dist/esm/src/lib/request-entities/widgets/recommendation-widget-item.js +10 -4
  134. package/dist/esm/src/lib/request-entities/widgets/results-widget-item.d.ts +11 -5
  135. package/dist/esm/src/lib/request-entities/widgets/results-widget-item.js +11 -5
  136. package/dist/esm/src/lib/request-entities/widgets/rule-widget-item.d.ts +35 -0
  137. package/dist/esm/src/lib/request-entities/widgets/rule-widget-item.js +35 -0
  138. package/dist/esm/src/lib/request-entities/widgets/search-widget-item.d.ts +70 -28
  139. package/dist/esm/src/lib/request-entities/widgets/search-widget-item.js +77 -28
  140. package/dist/esm/src/lib/request-entities/widgets/utils.d.ts +1 -1
  141. package/dist/esm/src/lib/request-entities/widgets/utils.js +1 -1
  142. package/dist/esm/src/lib/request-entities/widgets/widget-item.d.ts +20 -5
  143. package/dist/esm/src/lib/request-entities/widgets/widget-item.js +20 -5
  144. package/dist/esm/src/lib/request-entities/widgets/widget-request-data.d.ts +6 -1
  145. package/dist/esm/src/lib/request-entities/widgets/widget-request-data.js +6 -1
  146. package/dist/esm/src/lib/requests/browser/get-page-widget-data.d.ts +5 -4
  147. package/dist/esm/src/lib/requests/browser/get-page-widget-data.js +5 -0
  148. package/dist/esm/src/lib/requests/browser/get-widget-data.d.ts +1 -1
  149. package/dist/esm/src/lib/requests/browser/get-widget-data.js +1 -1
  150. package/dist/esm/src/lib/requests/post-request.d.ts +10 -6
  151. package/dist/esm/src/lib/requests/post-request.js +2 -1
  152. package/dist/esm/src/lib/requests/server/entity-view-event-server.d.ts +1 -1
  153. package/dist/esm/src/lib/requests/server/entity-view-event-server.js +1 -1
  154. package/dist/esm/src/lib/requests/server/get-page-widget-data-server.d.ts +3 -3
  155. package/dist/esm/src/lib/requests/server/get-page-widget-data-server.js +5 -0
  156. package/dist/esm/src/lib/requests/server/get-widget-data-server.d.ts +1 -1
  157. package/dist/esm/src/lib/requests/server/get-widget-data-server.js +1 -1
  158. package/dist/esm/src/lib/requests/server/widget-facet-click-event-server.d.ts +1 -1
  159. package/dist/esm/src/lib/requests/server/widget-facet-click-event-server.js +1 -1
  160. package/dist/esm/src/lib/requests/server/widget-item-click-event-server.d.ts +1 -1
  161. package/dist/esm/src/lib/requests/server/widget-item-click-event-server.js +1 -1
  162. package/dist/esm/src/lib/requests/server/widget-navigation-click-event-server.d.ts +1 -1
  163. package/dist/esm/src/lib/requests/server/widget-navigation-click-event-server.js +1 -1
  164. package/dist/esm/src/lib/requests/server/widget-suggestion-click-event-server.d.ts +1 -1
  165. package/dist/esm/src/lib/requests/server/widget-suggestion-click-event-server.js +1 -1
  166. package/dist/esm/src/lib/requests/server/widget-view-event-server.d.ts +1 -1
  167. package/dist/esm/src/lib/requests/server/widget-view-event-server.js +1 -1
  168. package/dist/esm/tsconfig.tsbuildinfo +1 -1
  169. package/package.json +4 -4
@@ -6,7 +6,8 @@ export class QuestionsAnswersWidgetItem extends RuleWidgetItem {
6
6
  * Creates and holds the functionality of a questions answers widget item.
7
7
  * @param entity - The widget's item entity.
8
8
  * @param widgetId - The widget's item id.
9
- * @param questionsAnswersOptions - The widget's questions answers options object.
9
+ * @param questionsAnswersOptions - The widget's {@link QuestionsAnswersOptions} object.
10
+ * @throws - {@link ErrorMessages.IV_0007} | {@link ErrorMessages.IV_0008} | {@link ErrorMessages.IV_0009}
10
11
  */
11
12
  constructor(entity, widgetId, questionsAnswersOptions) {
12
13
  super(entity, widgetId, questionsAnswersOptions.rule);
@@ -18,6 +19,11 @@ export class QuestionsAnswersWidgetItem extends RuleWidgetItem {
18
19
  this._relatedQuestions = questionsAnswersOptions.relatedQuestions;
19
20
  }
20
21
  }
22
+ /**
23
+ * Throws an error if limit is outside of range of 1 ~ 100 or offset is not a positive integer
24
+ * @param relatedQuestions - {@link RelatedQuestionsOptions}
25
+ * @throws - {@link ErrorMessages.IV_0007} | {@link ErrorMessages.IV_0008}
26
+ */
21
27
  _validateRelatedQuestions(relatedQuestions) {
22
28
  this._validateNumberInRange1To100(ErrorMessages.IV_0007, relatedQuestions.limit);
23
29
  this._validatePositiveInteger(ErrorMessages.IV_0008, relatedQuestions.offset);
@@ -27,6 +33,7 @@ export class QuestionsAnswersWidgetItem extends RuleWidgetItem {
27
33
  * This method updates the `keyphrase` property of the questions answers configuration.
28
34
  *
29
35
  * @param keyphrase - The keyphrase that the visitor enters to search for relevant content.
36
+ * @throws - {@link ErrorMessages.IV_0009}
30
37
  */
31
38
  set keyphrase(keyphrase) {
32
39
  this._validateStringLengthInRange1To100(ErrorMessages.IV_0009, keyphrase);
@@ -42,13 +49,13 @@ export class QuestionsAnswersWidgetItem extends RuleWidgetItem {
42
49
  * Sets the exactAnswer for the QuestionsAnswersWidgetItem.
43
50
  * This method updates the `exactAnswer` property of the questions answers configuration.
44
51
  *
45
- * @param exactAnswer - The exactAnswer that the visitor enters to search for relevant content.
52
+ * @param exactAnswer - The {@link ExactAnswerOptions} that the visitor enters to search for relevant content.
46
53
  */
47
54
  set exactAnswer(exactAnswer) {
48
55
  this._exactAnswer = exactAnswer;
49
56
  }
50
57
  /**
51
- * @returns The exactAnswer property of the QuestionsAnswersWidgetItem.
58
+ * @returns The {@link ExactAnswerOptions} `exactAnswer` property of the QuestionsAnswersWidgetItem.
52
59
  */
53
60
  get exactAnswer() {
54
61
  return this._exactAnswer;
@@ -63,14 +70,15 @@ export class QuestionsAnswersWidgetItem extends RuleWidgetItem {
63
70
  * Sets the relatedQuestions for the QuestionsAnswersWidgetItem.
64
71
  * This method updates the `relatedQuestions` property of the questions answers configuration.
65
72
  *
66
- * @param relatedQuestions - The relatedQuestions that the visitor enters to search for relevant content.
73
+ * @param relatedQuestions - {@link RelatedQuestionsOptions} that the visitor enters to search for relevant content.
74
+ * @throws - {@link ErrorMessages.IV_0007} | {@link ErrorMessages.IV_0008}
67
75
  */
68
76
  set relatedQuestions(relatedQuestions) {
69
77
  this._validateRelatedQuestions(relatedQuestions);
70
78
  this._relatedQuestions = relatedQuestions;
71
79
  }
72
80
  /**
73
- * @returns The relatedQuestions property of the QuestionsAnswersWidgetItem.
81
+ * @returns The {@link RelatedQuestionsOptions} `relatedQuestions` property of the QuestionsAnswersWidgetItem.
74
82
  */
75
83
  get relatedQuestions() {
76
84
  return this._relatedQuestions;
@@ -81,11 +89,19 @@ export class QuestionsAnswersWidgetItem extends RuleWidgetItem {
81
89
  resetRelatedQuestions() {
82
90
  this._relatedQuestions = undefined;
83
91
  }
92
+ /**
93
+ *
94
+ * @returns exactAnswer property in its DTO format.
95
+ */
84
96
  _exactAnswerToDTO() {
85
97
  if (!this._exactAnswer)
86
98
  return;
87
99
  return { include_sources: this._exactAnswer.includeSources, query_types: this._exactAnswer.queryTypes };
88
100
  }
101
+ /**
102
+ *
103
+ * @returns relatedQuestions property in its DTO format.
104
+ */
89
105
  _relatedQuestionsToDTO() {
90
106
  if (!this._relatedQuestions)
91
107
  return;
@@ -98,7 +114,7 @@ export class QuestionsAnswersWidgetItem extends RuleWidgetItem {
98
114
  };
99
115
  }
100
116
  /**
101
- * Maps the questions answers widget item to its DTO format.
117
+ * Maps the questions answers widget item to its DTO format {@link QuestionsAnswersWidgetItemDTO}.
102
118
  */
103
119
  toDTO() {
104
120
  return {
@@ -6,7 +6,8 @@ export declare class RecommendationWidgetItem extends ResultsWidgetItem {
6
6
  * Creates and holds the functionality of a recommendation widget item.
7
7
  * @param entity - The widget's item entity.
8
8
  * @param widgetId - The widget's item id.
9
- * @param recommendationOptions - The widget's recommendation options object.
9
+ * @param recommendationOptions - The widget's {@link RecommendationOptions} object.
10
+ * @throws - {@link ErrorMessages.IV_0023} | {@link ErrorMessages.IV_0024}
10
11
  */
11
12
  constructor(entity: string, widgetId: string, recommendationOptions?: RecommendationOptions);
12
13
  /**
@@ -20,20 +21,25 @@ export declare class RecommendationWidgetItem extends ResultsWidgetItem {
20
21
  * If not provided, the API uses the recipe specified in CEC.
21
22
  *
22
23
  * @param recipe - {@link Recipe} The recipe configuration with id and version.
23
- * @throws Error If the recipe id is empty or version is less than 1.
24
+ * @throws - {@link ErrorMessages.IV_0023} | {@link ErrorMessages.IV_0024}
24
25
  */
25
26
  set recipe(recipe: Recipe);
26
27
  /**
27
- * @returns The recipe property of the RecommendationWidgetItem.
28
+ * @returns The {@link Recipe} recipe property of the RecommendationWidgetItem.
28
29
  */
29
30
  get recipe(): Recipe | undefined;
30
31
  /**
31
32
  * Sets the recipe to undefined
32
33
  */
33
34
  resetRecipe(): void;
35
+ /**
36
+ * Throws an error if recipe exists but is an empty string or has wrong version.
37
+ * @param recipe - {@link Recipe}
38
+ * @throws - {@link ErrorMessages.IV_0023} | {@link ErrorMessages.IV_0024}
39
+ */
34
40
  private _validateRecipe;
35
41
  /**
36
- * Maps the recommendation widget item to its DTO format.
42
+ * Maps the recommendation widget item to its DTO format {@link WidgetItemRecommendationDTO}.
37
43
  */
38
44
  toDTO(): WidgetItemRecommendationDTO;
39
45
  }
@@ -6,7 +6,8 @@ export class RecommendationWidgetItem extends ResultsWidgetItem {
6
6
  * Creates and holds the functionality of a recommendation widget item.
7
7
  * @param entity - The widget's item entity.
8
8
  * @param widgetId - The widget's item id.
9
- * @param recommendationOptions - The widget's recommendation options object.
9
+ * @param recommendationOptions - The widget's {@link RecommendationOptions} object.
10
+ * @throws - {@link ErrorMessages.IV_0023} | {@link ErrorMessages.IV_0024}
10
11
  */
11
12
  constructor(entity, widgetId, recommendationOptions) {
12
13
  const { recipe, ...rest } = recommendationOptions || {};
@@ -33,7 +34,7 @@ export class RecommendationWidgetItem extends ResultsWidgetItem {
33
34
  * If not provided, the API uses the recipe specified in CEC.
34
35
  *
35
36
  * @param recipe - {@link Recipe} The recipe configuration with id and version.
36
- * @throws Error If the recipe id is empty or version is less than 1.
37
+ * @throws - {@link ErrorMessages.IV_0023} | {@link ErrorMessages.IV_0024}
37
38
  */
38
39
  set recipe(recipe) {
39
40
  this._validateRecipe(recipe);
@@ -43,7 +44,7 @@ export class RecommendationWidgetItem extends ResultsWidgetItem {
43
44
  };
44
45
  }
45
46
  /**
46
- * @returns The recipe property of the RecommendationWidgetItem.
47
+ * @returns The {@link Recipe} recipe property of the RecommendationWidgetItem.
47
48
  */
48
49
  get recipe() {
49
50
  return this._recommendation?.recipe;
@@ -54,6 +55,11 @@ export class RecommendationWidgetItem extends ResultsWidgetItem {
54
55
  resetRecipe() {
55
56
  this._recommendation = undefined;
56
57
  }
58
+ /**
59
+ * Throws an error if recipe exists but is an empty string or has wrong version.
60
+ * @param recipe - {@link Recipe}
61
+ * @throws - {@link ErrorMessages.IV_0023} | {@link ErrorMessages.IV_0024}
62
+ */
57
63
  _validateRecipe(recipe) {
58
64
  if (!recipe)
59
65
  return;
@@ -62,7 +68,7 @@ export class RecommendationWidgetItem extends ResultsWidgetItem {
62
68
  throw new Error(ErrorMessages.IV_0024);
63
69
  }
64
70
  /**
65
- * Maps the recommendation widget item to its DTO format.
71
+ * Maps the recommendation widget item to its DTO format {@link WidgetItemRecommendationDTO}.
66
72
  */
67
73
  toDTO() {
68
74
  const baseDTO = super.toDTO();
@@ -10,7 +10,8 @@ export declare class ResultsWidgetItem extends RuleWidgetItem {
10
10
  * Creates and holds the functionality of a widget item.
11
11
  * @param entity - The widget's item entity.
12
12
  * @param widgetId - The widget's item id.
13
- * @param resultOptions - The widget's results options object.
13
+ * @param resultOptions - The widget's {@link ResultsOptions} object.
14
+ * @throws - {@link ErrorMessages.IV_0007} | {@link ErrorMessages.IV_0022}
14
15
  */
15
16
  constructor(entity: string, widgetId: string, resultOptions?: ResultsOptions);
16
17
  /**
@@ -34,7 +35,7 @@ export declare class ResultsWidgetItem extends RuleWidgetItem {
34
35
  * Sets the search content for the ResultsItem.
35
36
  * This method updates the `content` property within the ResultsItem instance.
36
37
  * The attributes is used to define specific search criteria or filters.
37
- * @param contentOptions - The array attributes that specifies the search criteria.
38
+ * @param contentOptions - The array attributes {@link ContentOptions} that specifies the search criteria.
38
39
  */
39
40
  set content(contentOptions: ContentOptions);
40
41
  /**
@@ -57,20 +58,25 @@ export declare class ResultsWidgetItem extends RuleWidgetItem {
57
58
  get groupBy(): string | undefined;
58
59
  /** Sets the groupBy to undefined */
59
60
  resetGroupBy(): void;
61
+ /**
62
+ *
63
+ * @param groupBy - the groupBy string.
64
+ * @throws - {@link ErrorMessages.IV_0022}
65
+ */
60
66
  private _validateGroupBy;
61
67
  /** Set the search filter */
62
68
  set filter(filter: Filter);
63
- /** @returns The filter property of the WidgetItem */
69
+ /** @returns The {@link Filter} filter property of the WidgetItem */
64
70
  get filter(): Filter | undefined;
65
71
  /** Sets the filter to undefined */
66
72
  resetFilter(): void;
67
73
  /**
68
74
  *
69
- * @returns The content property in its DTO format.
75
+ * @returns The content property in its DTO format {@link ContentOptionsDto}.
70
76
  */
71
77
  private _contentToDTO;
72
78
  /**
73
- * Maps the results item to its DTO format.
79
+ * Maps the results item to its DTO format {@link ResultsItemDTO}.
74
80
  */
75
81
  protected _resultsToDTO(): ResultsItemDTO;
76
82
  }
@@ -6,7 +6,8 @@ export class ResultsWidgetItem extends RuleWidgetItem {
6
6
  * Creates and holds the functionality of a widget item.
7
7
  * @param entity - The widget's item entity.
8
8
  * @param widgetId - The widget's item id.
9
- * @param resultOptions - The widget's results options object.
9
+ * @param resultOptions - The widget's {@link ResultsOptions} object.
10
+ * @throws - {@link ErrorMessages.IV_0007} | {@link ErrorMessages.IV_0022}
10
11
  */
11
12
  constructor(entity, widgetId, resultOptions) {
12
13
  super(entity, widgetId, resultOptions?.rule);
@@ -45,7 +46,7 @@ export class ResultsWidgetItem extends RuleWidgetItem {
45
46
  * Sets the search content for the ResultsItem.
46
47
  * This method updates the `content` property within the ResultsItem instance.
47
48
  * The attributes is used to define specific search criteria or filters.
48
- * @param contentOptions - The array attributes that specifies the search criteria.
49
+ * @param contentOptions - The array attributes {@link ContentOptions} that specifies the search criteria.
49
50
  */
50
51
  set content(contentOptions) {
51
52
  this._content = contentOptions;
@@ -81,6 +82,11 @@ export class ResultsWidgetItem extends RuleWidgetItem {
81
82
  resetGroupBy() {
82
83
  this._groupBy = undefined;
83
84
  }
85
+ /**
86
+ *
87
+ * @param groupBy - the groupBy string.
88
+ * @throws - {@link ErrorMessages.IV_0022}
89
+ */
84
90
  _validateGroupBy(groupBy) {
85
91
  if (typeof groupBy === 'string' && groupBy.trim().length === 0)
86
92
  throw new Error(ErrorMessages.IV_0022);
@@ -89,7 +95,7 @@ export class ResultsWidgetItem extends RuleWidgetItem {
89
95
  set filter(filter) {
90
96
  this._filter = filter;
91
97
  }
92
- /** @returns The filter property of the WidgetItem */
98
+ /** @returns The {@link Filter} filter property of the WidgetItem */
93
99
  get filter() {
94
100
  return this._filter;
95
101
  }
@@ -99,7 +105,7 @@ export class ResultsWidgetItem extends RuleWidgetItem {
99
105
  }
100
106
  /**
101
107
  *
102
- * @returns The content property in its DTO format.
108
+ * @returns The content property in its DTO format {@link ContentOptionsDto}.
103
109
  */
104
110
  _contentToDTO() {
105
111
  if (!this._content)
@@ -108,7 +114,7 @@ export class ResultsWidgetItem extends RuleWidgetItem {
108
114
  return { fields: attributes, ...rest };
109
115
  }
110
116
  /**
111
- * Maps the results item to its DTO format.
117
+ * Maps the results item to its DTO format {@link ResultsItemDTO}.
112
118
  */
113
119
  _resultsToDTO() {
114
120
  return {
@@ -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
  }
@@ -3,6 +3,13 @@ import { ErrorMessages } from '../../consts';
3
3
  import { WidgetItem } from './widget-item';
4
4
  /** Base class for widgets that support rules functionality */
5
5
  export class RuleWidgetItem extends WidgetItem {
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, widgetId, rule) {
7
14
  super(entity, widgetId);
8
15
  if (rule) {
@@ -10,16 +17,29 @@ export class RuleWidgetItem extends WidgetItem {
10
17
  this._rule = rule;
11
18
  }
12
19
  }
20
+ /**
21
+ * Sets the `rule` property
22
+ * @param rule - the {@link SearchRuleOptions} value to be applied.
23
+ * @throws - {@link ErrorMessages.IV_0027} | {@link ErrorMessages.IV_0028}
24
+ */
13
25
  set rule(rule) {
14
26
  this._validateRule(rule);
15
27
  this._rule = rule;
16
28
  }
29
+ /**
30
+ * @returns the {@link SearchRuleOptions} `rule` property of the RuleWidgetItem.
31
+ */
17
32
  get rule() {
18
33
  return this._rule;
19
34
  }
20
35
  resetRule() {
21
36
  this._rule = undefined;
22
37
  }
38
+ /**
39
+ * Throws error if on of the rule properties has invalid data.
40
+ * @param rule - {@link SearchRuleOptions}
41
+ * @throws - {@link ErrorMessages.IV_0027} | {@link ErrorMessages.IV_0028}
42
+ */
23
43
  _validateRule(rule) {
24
44
  if (!rule)
25
45
  return;
@@ -33,6 +53,11 @@ export class RuleWidgetItem extends WidgetItem {
33
53
  // Validate include rules
34
54
  rule.include?.forEach((item) => item.slots.forEach((slot) => this._validatePositiveInteger(ErrorMessages.IV_0028, slot)));
35
55
  }
56
+ /**
57
+ *
58
+ * @param rules - array of {@link ArrayOfAtLeastOne} object with properties `filter` `slots` `weight`
59
+ * @returns the rule property in a boost rule DTO format {@link BoostRuleDTO}[].
60
+ */
36
61
  _convertToBoostRuleDTO(rules) {
37
62
  return rules.map((rule) => ({
38
63
  filter: rule.filter.toDTO(),
@@ -40,12 +65,22 @@ export class RuleWidgetItem extends WidgetItem {
40
65
  weight: rule.weight
41
66
  }));
42
67
  }
68
+ /**
69
+ *
70
+ * @param rules - array of {@link ArrayOfAtLeastOne} object with properties `filter` `slots`
71
+ * @returns the rule property in IncludeRuleDTO format {@link IncludeRuleDTO}[].
72
+ */
43
73
  _convertToIncludeRuleDTO(rules) {
44
74
  return rules.map((rule) => ({
45
75
  filter: rule.filter.toDTO(),
46
76
  slots: rule.slots
47
77
  }));
48
78
  }
79
+ /**
80
+ *
81
+ * @param rule - {@link SearchRuleOptions}
82
+ * @returns - returns RuleWidgetItem in its DTO format {@link SearchRuleDTO}.
83
+ */
49
84
  _ruleToDTO(rule) {
50
85
  if (!rule)
51
86
  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 search options object.
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 IV_0030 if `personalization.attributes` contains an empty or whitespace string
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 IV_0016 if `ranking.name` contains an empty string
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 Error If the max is less than 1 or greater than 100, indicating an invalid range.
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 Error If the offset is less than 0.
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 <array>array of objects for the suggestion param
113
- * @throws error if <SearchSuggestionOptions>.<suggestion>.name property is an empty string or contains spaces
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 <array> of objects for the suggestion param
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 data to undefined
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
  }