@coveo/quantic 3.14.2 → 3.15.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 (56) hide show
  1. package/docs/out/quantic-docs.json +2 -2
  2. package/force-app/main/default/lwc/quanticCaseClassification/__tests__/quanticCaseClassification.test.js +819 -0
  3. package/force-app/main/default/lwc/quanticCaseClassification/e2e/data.ts +23 -0
  4. package/force-app/main/default/lwc/quanticCaseClassification/e2e/fixture.ts +51 -0
  5. package/force-app/main/default/lwc/quanticCaseClassification/e2e/pageObject.ts +152 -0
  6. package/force-app/main/default/lwc/quanticCaseClassification/e2e/quanticCaseClassification.e2e.ts +269 -0
  7. package/force-app/main/default/lwc/quanticCaseClassification/quanticCaseClassification.html +6 -6
  8. package/force-app/main/default/lwc/quanticFacetManager/__tests__/quanticFacetManager.test.js +178 -0
  9. package/force-app/main/default/lwc/quanticFacetManager/e2e/fixture.ts +63 -0
  10. package/force-app/main/default/lwc/quanticFacetManager/e2e/pageObject.ts +23 -0
  11. package/force-app/main/default/lwc/quanticFacetManager/e2e/quanticFacetManager.e2e.ts +82 -0
  12. package/force-app/main/default/lwc/quanticFacetManager/quanticFacetManager.js +1 -0
  13. package/force-app/main/default/lwc/quanticGeneratedAnswer/__tests__/quanticGeneratedAnswer.test.js +54 -10
  14. package/force-app/main/default/lwc/quanticGeneratedAnswer/quanticGeneratedAnswer.js +19 -1
  15. package/force-app/main/default/lwc/quanticGeneratedAnswer/templates/generatedAnswer.css +4 -0
  16. package/force-app/main/default/lwc/quanticGeneratedAnswer/templates/generatedAnswer.html +17 -0
  17. package/force-app/main/default/lwc/quanticTooltip/__tests__/quanticTooltip.test.js +1 -1
  18. package/force-app/main/default/staticresources/coveobueno/definitions/index.d.ts +7 -7
  19. package/force-app/main/default/staticresources/coveobueno/definitions/values/boolean-value.d.ts +2 -2
  20. package/force-app/main/default/staticresources/coveobueno/definitions/values/complex-value.d.ts +5 -5
  21. package/force-app/main/default/staticresources/coveobueno/definitions/values/enum-value.d.ts +2 -2
  22. package/force-app/main/default/staticresources/coveobueno/definitions/values/number-value.d.ts +2 -2
  23. package/force-app/main/default/staticresources/coveobueno/definitions/values/string-value.d.ts +2 -2
  24. package/force-app/main/default/staticresources/coveobueno/definitions/values/value.d.ts +1 -1
  25. package/force-app/main/default/staticresources/coveoheadless/case-assist/headless.js +7 -9
  26. package/force-app/main/default/staticresources/coveoheadless/definitions/api/commerce/common/product.d.ts +6 -0
  27. package/force-app/main/default/staticresources/coveoheadless/definitions/api/knowledge/stream-answer-api.d.ts +1 -1
  28. package/force-app/main/default/staticresources/coveoheadless/definitions/app/commerce-ssr-engine/types/core-engine.d.ts +9 -0
  29. package/force-app/main/default/staticresources/coveoheadless/definitions/commerce.index.d.ts +6 -1
  30. package/force-app/main/default/staticresources/coveoheadless/definitions/controllers/commerce/field-suggestions/headless-category-field-suggestions.d.ts +5 -1
  31. package/force-app/main/default/staticresources/coveoheadless/definitions/controllers/commerce/field-suggestions/headless-field-suggestions-generator.d.ts +9 -2
  32. package/force-app/main/default/staticresources/coveoheadless/definitions/controllers/commerce/filter-suggestions/headless-category-filter-suggestions.d.ts +87 -0
  33. package/force-app/main/default/staticresources/coveoheadless/definitions/controllers/commerce/filter-suggestions/headless-filter-suggestions-generator.d.ts +38 -0
  34. package/force-app/main/default/staticresources/coveoheadless/definitions/controllers/commerce/filter-suggestions/headless-filter-suggestions-generator.ssr.d.ts +16 -0
  35. package/force-app/main/default/staticresources/coveoheadless/definitions/controllers/commerce/filter-suggestions/headless-filter-suggestions.d.ts +88 -0
  36. package/force-app/main/default/staticresources/coveoheadless/definitions/controllers/core/facets/category-facet/headless-core-category-facet-options.d.ts +3 -1
  37. package/force-app/main/default/staticresources/coveoheadless/definitions/controllers/core/facets/facet/headless-core-facet-options.d.ts +3 -1
  38. package/force-app/main/default/staticresources/coveoheadless/definitions/controllers/core/facets/range-facet/date-facet/headless-core-date-filter.d.ts +3 -1
  39. package/force-app/main/default/staticresources/coveoheadless/definitions/controllers/core/facets/range-facet/date-facet/headless-date-facet-options.d.ts +3 -1
  40. package/force-app/main/default/staticresources/coveoheadless/definitions/controllers/core/facets/range-facet/numeric-facet/headless-core-numeric-filter.d.ts +3 -1
  41. package/force-app/main/default/staticresources/coveoheadless/definitions/controllers/core/facets/range-facet/numeric-facet/headless-numeric-facet-options.d.ts +3 -1
  42. package/force-app/main/default/staticresources/coveoheadless/definitions/controllers/facets/facet/headless-facet-options.d.ts +3 -1
  43. package/force-app/main/default/staticresources/coveoheadless/definitions/features/facets/category-facet-set/category-facet-set-actions.d.ts +3 -1
  44. package/force-app/main/default/staticresources/coveoheadless/definitions/features/facets/facet-api/request.d.ts +4 -1
  45. package/force-app/main/default/staticresources/coveoheadless/definitions/features/facets/facet-set/facet-set-actions.d.ts +3 -1
  46. package/force-app/main/default/staticresources/coveoheadless/definitions/features/facets/range-facets/date-facet-set/date-facet-actions.d.ts +3 -1
  47. package/force-app/main/default/staticresources/coveoheadless/definitions/features/facets/range-facets/numeric-facet-set/numeric-facet-actions.d.ts +3 -1
  48. package/force-app/main/default/staticresources/coveoheadless/definitions/ssr-commerce.index.d.ts +2 -2
  49. package/force-app/main/default/staticresources/coveoheadless/definitions/utils/fetch-event-source/fetch.d.ts +44 -0
  50. package/force-app/main/default/staticresources/coveoheadless/definitions/utils/fetch-event-source/index.d.ts +2 -0
  51. package/force-app/main/default/staticresources/coveoheadless/definitions/utils/fetch-event-source/parse.d.ts +36 -0
  52. package/force-app/main/default/staticresources/coveoheadless/headless.js +9 -11
  53. package/force-app/main/default/staticresources/coveoheadless/insight/headless.js +8 -10
  54. package/force-app/main/default/staticresources/coveoheadless/recommendation/headless.js +7 -9
  55. package/package.json +6 -6
  56. package/force-app/main/default/staticresources/coveoheadless/definitions/tsdoc-metadata.json +0 -11
@@ -123,6 +123,12 @@ export interface BaseProduct {
123
123
  /**
124
124
  * The length and offset of each word to highlight in the product excerpt string.
125
125
  */
126
+ excerptHighlights?: HighlightKeyword[];
127
+ /**
128
+ * @deprecated Use `excerptHighlights` instead.
129
+ *
130
+ * The length and offset of each word to highlight in the product excerpt string.
131
+ */
126
132
  excerptsHighlights?: HighlightKeyword[];
127
133
  }
128
134
  export interface Product extends BaseProduct {
@@ -1,8 +1,8 @@
1
- import { EventSourceMessage } from '@microsoft/fetch-event-source';
2
1
  import { ThunkDispatch, UnknownAction } from '@reduxjs/toolkit';
3
2
  import { GeneratedContentFormat } from '../../features/generated-answer/generated-response-format.js';
4
3
  import { SearchAppState } from '../../state/search-app-state.js';
5
4
  import { ConfigurationSection, GeneratedAnswerSection, InsightConfigurationSection } from '../../state/state-sections.js';
5
+ import { EventSourceMessage } from '../../utils/fetch-event-source/parse.js';
6
6
  import { GeneratedAnswerCitation } from '../generated-answer/generated-answer-event-payload.js';
7
7
  import { SearchRequest } from '../search/search/search-request.js';
8
8
  export type StateNeededByAnswerAPI = {
@@ -39,6 +39,15 @@ export interface EngineDefinition<TControllers extends ControllerDefinitionsMap<
39
39
  * Note: The implementation specifics of the navigator context provider depend on the Node.js framework being utilized. It is the developer's responsibility to appropriately define and implement the navigator context provider to ensure accurate navigation context is available throughout the application. If the user fails to provide a navigator context provider, a warning will be logged either on the server or the browser console.
40
40
  */
41
41
  setNavigatorContextProvider: (navigatorContextProvider: NavigatorContextProvider) => void;
42
+ /**
43
+ * Returns the access token.
44
+ */
45
+ getAccessToken: () => string;
46
+ /**
47
+ * Updates the access token.
48
+ * @param accessToken - The access token to update.
49
+ */
50
+ setAccessToken: (accessToken: string) => void;
42
51
  }
43
52
  export type InferStaticState<T extends {
44
53
  fetchStaticState(...args: unknown[]): Promise<unknown>;
@@ -119,11 +119,16 @@ export type { RedirectionTrigger, RedirectionTriggerState, } from './controllers
119
119
  export { buildRedirectionTrigger } from './controllers/commerce/triggers/headless-redirection-trigger.js';
120
120
  export type { QueryTrigger, QueryTriggerState, } from './controllers/core/triggers/headless-core-query-trigger.js';
121
121
  export { buildQueryTrigger } from './controllers/commerce/triggers/headless-query-trigger.js';
122
- export type { FieldSuggestions, FieldSuggestionsState, } from './controllers/commerce/field-suggestions/headless-field-suggestions.js';
123
122
  export type { CategoryFieldSuggestions, CategoryFieldSuggestionsState, } from './controllers/commerce/field-suggestions/headless-category-field-suggestions.js';
124
123
  export type { FieldSuggestionsGenerator, GeneratedFieldSuggestionsControllers, } from './controllers/commerce/field-suggestions/headless-field-suggestions-generator.js';
125
124
  export type { FieldSuggestionsFacet } from './features/commerce/facets/field-suggestions-order/field-suggestions-order-state.ts';
126
125
  export { buildFieldSuggestionsGenerator } from './controllers/commerce/field-suggestions/headless-field-suggestions-generator.js';
126
+ export type { FilterSuggestionsGenerator, GeneratedFilterSuggestionsControllers, } from './controllers/commerce/filter-suggestions/headless-filter-suggestions-generator.js';
127
+ export { buildFilterSuggestionsGenerator } from './controllers/commerce/filter-suggestions/headless-filter-suggestions-generator.js';
128
+ export type { CategoryFilterSuggestions, CategoryFilterSuggestionsState, } from './controllers/commerce/filter-suggestions/headless-category-filter-suggestions.js';
129
+ export { buildCategoryFilterSuggestions } from './controllers/commerce/filter-suggestions/headless-category-filter-suggestions.js';
130
+ export type { FilterSuggestions, FilterSuggestionsState, } from './controllers/commerce/filter-suggestions/headless-filter-suggestions.js';
131
+ export { buildFilterSuggestions } from './controllers/commerce/filter-suggestions/headless-filter-suggestions.js';
127
132
  export type { ParameterManager, ParameterManagerState, ParameterManagerProps, ParameterManagerInitialState, } from './controllers/commerce/core/parameter-manager/headless-core-parameter-manager.js';
128
133
  export type { Parameters } from './features/commerce/parameters/parameters-actions.js';
129
134
  export type { SearchParameters } from './features/search-parameters/search-parameter-actions.js';
@@ -1,5 +1,5 @@
1
- import { FieldSuggestionsFacet } from '../../../api/commerce/search/query-suggest/query-suggest-response.js';
2
1
  import { CommerceEngine } from '../../../app/commerce-engine/commerce-engine.js';
2
+ import { FieldSuggestionsFacet } from '../../../features/commerce/facets/field-suggestions-order/field-suggestions-order-state.js';
3
3
  import { Controller } from '../../controller/headless-controller.js';
4
4
  import { CategoryFieldSuggestionsState as CoreCategoryFieldSuggestionsState, CategoryFieldSuggestionsValue } from '../../field-suggestions/category-facet/headless-category-field-suggestions.js';
5
5
  import { CategoryFacetOptions } from '../core/facets/category/headless-commerce-category-facet.js';
@@ -10,6 +10,8 @@ export type { CategoryFieldSuggestionsValue };
10
10
  *
11
11
  * @group Buildable controllers
12
12
  * @category CategoryFieldSuggestions
13
+ * @alpha
14
+ * @deprecated
13
15
  */
14
16
  export type CategoryFieldSuggestionsState = CoreCategoryFieldSuggestionsState & Pick<FieldSuggestionsFacet, 'facetId' | 'displayName' | 'field'>;
15
17
  /**
@@ -21,6 +23,8 @@ export type CategoryFieldSuggestionsState = CoreCategoryFieldSuggestionsState &
21
23
  *
22
24
  * @group Buildable controllers
23
25
  * @category CategoryFieldSuggestions
26
+ * @alpha
27
+ * @deprecated
24
28
  */
25
29
  export interface CategoryFieldSuggestions extends Controller, FacetControllerType<'hierarchical'> {
26
30
  /**
@@ -2,13 +2,18 @@ import { CommerceEngine } from '../../../app/commerce-engine/commerce-engine.js'
2
2
  import { FieldSuggestionsFacet } from '../../../features/commerce/facets/field-suggestions-order/field-suggestions-order-state.js';
3
3
  import { Controller } from '../../controller/headless-controller.js';
4
4
  import { CategoryFieldSuggestions } from './headless-category-field-suggestions.js';
5
- import { FieldSuggestions } from './headless-field-suggestions.js';
6
- export type GeneratedFieldSuggestionsControllers = Array<FieldSuggestions | CategoryFieldSuggestions>;
5
+ /**
6
+ * @alpha
7
+ * @deprecated
8
+ */
9
+ export type GeneratedFieldSuggestionsControllers = Array<CategoryFieldSuggestions>;
7
10
  /**
8
11
  * The `FieldSuggestionsGenerator` controller is responsible for generating field suggestions controllers for a given commerce engine.
9
12
  *
10
13
  * @group Buildable controllers
11
14
  * @category FieldSuggestionsGenerator
15
+ * @alpha
16
+ * @deprecated
12
17
  */
13
18
  export interface FieldSuggestionsGenerator extends Controller {
14
19
  /**
@@ -27,5 +32,7 @@ export interface FieldSuggestionsGenerator extends Controller {
27
32
  *
28
33
  * @group Buildable controllers
29
34
  * @category FieldSuggestionsGenerator
35
+ * @alpha
36
+ * @deprecated
30
37
  */
31
38
  export declare function buildFieldSuggestionsGenerator(engine: CommerceEngine): FieldSuggestionsGenerator;
@@ -0,0 +1,87 @@
1
+ import { FieldSuggestionsFacet } from '../../../api/commerce/search/query-suggest/query-suggest-response.js';
2
+ import { CommerceEngine } from '../../../app/commerce-engine/commerce-engine.js';
3
+ import { Controller } from '../../controller/headless-controller.js';
4
+ import { CategoryFieldSuggestionsState as CoreCategoryFieldSuggestionsState, CategoryFieldSuggestionsValue } from '../../field-suggestions/category-facet/headless-category-field-suggestions.js';
5
+ import { CategoryFacetOptions } from '../core/facets/category/headless-commerce-category-facet.js';
6
+ import { FacetControllerType } from '../core/facets/headless-core-commerce-facet.js';
7
+ export type { CategoryFieldSuggestionsValue };
8
+ /**
9
+ * The state of the `CategoryFilterSuggestions` controller.
10
+ *
11
+ * @group Buildable controllers
12
+ * @category CategoryFilterSuggestions
13
+ */
14
+ export type CategoryFilterSuggestionsState = CoreCategoryFieldSuggestionsState & Pick<FieldSuggestionsFacet, 'facetId' | 'displayName' | 'field'>;
15
+ /**
16
+ * The `CategoryFilterSuggestions` controller provides methods to request and interact with category facet suggestions
17
+ * based on a specific field for a given search query.
18
+ *
19
+ * @alpha This controller relies on a Commerce API functionality that is not yet generally available. If you wish to
20
+ * use this feature in an implementation, please contact your Coveo representative.
21
+ *
22
+ * @group Buildable controllers
23
+ * @category CategoryFilterSuggestions
24
+ */
25
+ export interface CategoryFilterSuggestions extends Controller, FacetControllerType<'hierarchical'> {
26
+ /**
27
+ * Resets the query in the controller state and clears the category filter suggestions.
28
+ */
29
+ clear(): void;
30
+ /**
31
+ * Returns the serialized search parameters for the current search query and specified category filter suggestion.
32
+ *
33
+ * For example, `q=jeans&cf-ec-category=Clothes,Pants`.
34
+ *
35
+ * In a typical scenario, this method should called when the user selects a category filter suggestion from a
36
+ * standalone search box. The returned string is then used to pass the correct URL query parameters or fragment when
37
+ * redirecting the browser to the search page.
38
+ *
39
+ * When the user selects a category filter suggestion from the main search box on the search page, use the `select`
40
+ * method instead.
41
+ *
42
+ * @param value - The category filter suggestion to serialize.
43
+ * @returns The serialized search parameters for the current search query and specified category filter suggestion.
44
+ */
45
+ getSearchParameters(value: CategoryFieldSuggestionsValue): string;
46
+ /**
47
+ * Clears all facet values, selects the specified category filter suggestion, updates the query, and executes a new
48
+ * search request.
49
+ *
50
+ * In a typical scenario, this method should be called when the user selects a category filter suggestion from the
51
+ * main search box on the search page.
52
+ *
53
+ * When the user selects a category filter suggestion from a standalone search box, use the `getSearchParameters`
54
+ * method instead.
55
+ *
56
+ * @param value - The category filter suggestion to select.
57
+ */
58
+ select(value: CategoryFieldSuggestionsValue): void;
59
+ /**
60
+ * Sets the query in the controller state to the specified value and requests category filter suggestions based on the
61
+ * updated query.
62
+ *
63
+ * For example, if this method is called with `jeans` as an argument, it will request values from the controller's
64
+ * field (e.g., `ec_category`) that would return results if selected when the search query is `jeans` (such as
65
+ * `Clothing`, `Clothing;Pants`, and `Clothing;Shorts`).
66
+ *
67
+ * @param query - The search query to use as context to request the category filter suggestions. In a typical
68
+ * scenario, this should set to the current value of the search box input.
69
+ */
70
+ updateQuery(query: string): void;
71
+ state: CategoryFilterSuggestionsState;
72
+ }
73
+ /**
74
+ * The `CategoryFilterSuggestions` controller provides methods to request and interact with category facet suggestions
75
+ * based on a specific field for a given search query.
76
+ *
77
+ * @alpha This controller relies on a Commerce API functionality that is not yet generally available. If you wish to
78
+ * use this feature in an implementation, please contact your Coveo representative.
79
+ *
80
+ * @param engine - The headless commerce engine.
81
+ * @param options - The options for the `CategoryFilterSuggestions` controller.
82
+ * @returns A `CategoryFilterSuggestions` controller instance.
83
+ *
84
+ * @group Buildable controllers
85
+ * @category CategoryFilterSuggestions
86
+ */
87
+ export declare function buildCategoryFilterSuggestions(engine: CommerceEngine, options: CategoryFacetOptions): CategoryFilterSuggestions;
@@ -0,0 +1,38 @@
1
+ import { CommerceEngine } from '../../../app/commerce-engine/commerce-engine.js';
2
+ import { FieldSuggestionsFacet } from '../../../features/commerce/facets/field-suggestions-order/field-suggestions-order-state.js';
3
+ import { Controller } from '../../controller/headless-controller.js';
4
+ import { CategoryFilterSuggestions } from './headless-category-filter-suggestions.js';
5
+ import { FilterSuggestions } from './headless-filter-suggestions.js';
6
+ export type GeneratedFilterSuggestionsControllers = Array<FilterSuggestions | CategoryFilterSuggestions>;
7
+ /**
8
+ * The `FilterSuggestionsGenerator` controller is responsible for generating filter suggestions controllers for a given
9
+ * commerce engine.
10
+ *
11
+ * @alpha This controller relies on a Commerce API functionality that is not yet generally available. If you wish to use this
12
+ * feature in an implementation, please contact your Coveo representative.
13
+ *
14
+ * @group Buildable controllers
15
+ * @category FilterSuggestionsGenerator
16
+ */
17
+ export interface FilterSuggestionsGenerator extends Controller {
18
+ /**
19
+ * The filter suggestions controllers created by the filter suggestions generator.
20
+ */
21
+ filterSuggestions: GeneratedFilterSuggestionsControllers;
22
+ /**
23
+ * The state of the filter suggestions generator.
24
+ */
25
+ state: FieldSuggestionsFacet[];
26
+ }
27
+ /**
28
+ * Builds a filter suggestions generator controller for a given commerce engine.
29
+ * @param engine - The commerce engine.
30
+ * @returns The filter suggestions generator controller.
31
+ *
32
+ * @alpha This controller relies on a Commerce API functionality that is not yet generally available. If you wish to
33
+ * use this feature in an implementation, please contact your Coveo representative.
34
+ *
35
+ * @group Buildable controllers
36
+ * @category FilterSuggestionsGenerator
37
+ */
38
+ export declare function buildFilterSuggestionsGenerator(engine: CommerceEngine): FilterSuggestionsGenerator;
@@ -0,0 +1,16 @@
1
+ import { NonRecommendationControllerDefinitionWithoutProps } from '../../../app/commerce-ssr-engine/types/common.js';
2
+ import { FilterSuggestionsGenerator } from './headless-filter-suggestions-generator.js';
3
+ export type { FilterSuggestions, FilterSuggestionsState, } from './headless-filter-suggestions.js';
4
+ export type { CategoryFilterSuggestions, CategoryFilterSuggestionsState, } from './headless-category-filter-suggestions.js';
5
+ export type { FieldSuggestionsFacet } from '../../../features/commerce/facets/field-suggestions-order/field-suggestions-order-state.js';
6
+ export type { GeneratedFilterSuggestionsControllers as GeneratedFilterSuggestionsControllers } from './headless-filter-suggestions-generator.js';
7
+ export type { FilterSuggestionsGenerator as FilterSuggestionsGenerator };
8
+ export interface FilterSuggestionsGeneratorDefinition extends NonRecommendationControllerDefinitionWithoutProps<FilterSuggestionsGenerator> {
9
+ }
10
+ /**
11
+ * Defines the `FilterSuggestionsGenerator` controller for the purpose of server-side rendering.
12
+ * @group Definers
13
+ *
14
+ * @returns The `FilterSuggestionsGenerator` controller definition.
15
+ */
16
+ export declare function defineFilterSuggestionsGenerator(): FilterSuggestionsGeneratorDefinition;
@@ -0,0 +1,88 @@
1
+ import { FieldSuggestionsFacet } from '../../../api/commerce/search/query-suggest/query-suggest-response.js';
2
+ import { SpecificFacetSearchResult } from '../../../api/search/facet-search/specific-facet-search/specific-facet-search-response.js';
3
+ import { CommerceEngine } from '../../../app/commerce-engine/commerce-engine.js';
4
+ import { Controller } from '../../controller/headless-controller.js';
5
+ import { FacetControllerType } from '../core/facets/headless-core-commerce-facet.js';
6
+ import { RegularFacetSearchState } from '../core/facets/regular/headless-commerce-regular-facet-search.js';
7
+ import { RegularFacetOptions } from '../core/facets/regular/headless-commerce-regular-facet.js';
8
+ export type { SpecificFacetSearchResult };
9
+ /**
10
+ * The state of the `FilterSuggestions` controller.
11
+ *
12
+ * @group Buildable controllers
13
+ * @category FilterSuggestions
14
+ */
15
+ export type FilterSuggestionsState = RegularFacetSearchState & Pick<FieldSuggestionsFacet, 'facetId' | 'displayName' | 'field'>;
16
+ /**
17
+ * The `FilterSuggestions` controller provides methods to request and interact with facet suggestions based on a
18
+ * specific field for a given search query.
19
+ *
20
+ * @alpha This controller relies on a Commerce API functionality that is not yet generally available. If you wish to
21
+ * use this feature in an implementation, please contact your Coveo representative.
22
+ *
23
+ * @group Buildable controllers
24
+ * @category FilterSuggestions
25
+ */
26
+ export interface FilterSuggestions extends Controller, FacetControllerType<'regular'> {
27
+ /**
28
+ * Resets the query in the controller state and clears the filter suggestions.
29
+ */
30
+ clear(): void;
31
+ /**
32
+ * Returns the serialized search parameters for the current search query and specified filter suggestion.
33
+ *
34
+ * For example, `q=jeans&f-cat_color=Blue`.
35
+ *
36
+ * In a typical scenario, this method should be called when the user selects a filter suggestion from a standalone
37
+ * search box. The returned string is then used to pass the correct URL query parametes or fragment when redirecting
38
+ * the browser to the search page.
39
+ *
40
+ * When the user selects a filter suggestion from the main search box on the search page, use the `select` method
41
+ * instead.
42
+ *
43
+ * @param value - The filter suggestion to serialize.
44
+ * @returns The serialized search parameters for the current search query and specified filter suggestion.
45
+ */
46
+ getSearchParameters(value: SpecificFacetSearchResult): string;
47
+ /**
48
+ * Clears all facet values, selects the specified filter suggestion, updates the query, and executes a new search
49
+ * request.
50
+ *
51
+ * In a typical scenario, this method should be called when the user selects a filter suggestion from the main search
52
+ * box on the search page.
53
+ *
54
+ * When the user selects a filter suggestion from a standalone search box, use the `getSearchParameters` method
55
+ * instead.
56
+ *
57
+ * @param value - The filter suggestion to select.
58
+ */
59
+ select(value: SpecificFacetSearchResult): void;
60
+ /**
61
+ * Sets the query in the controller state to the specified value and requests filter suggestions based on the updated
62
+ * query.
63
+ *
64
+ * For example, if this method is called with `jeans` as an argument, it will request values from the controller's
65
+ * field (e.g., `ec_brand`) that would return results if selected when the search query is `jeans` (such as
66
+ * `Calvin Klein`, `Columbia`, and `Nautica`).
67
+ *
68
+ * @param query - The search query to use as context to request the category filter suggestions. In a typical
69
+ * scenario, this should set to the current value of the search box input.
70
+ */
71
+ updateQuery(query: string): void;
72
+ state: FilterSuggestionsState;
73
+ }
74
+ /**
75
+ * The `FilterSuggestions` controller provides methods to request and interact with facet suggestions based on a
76
+ * specific field for a given search query.
77
+ *
78
+ * @alpha This controller relies on a Commerce API functionality that is not yet generally available. If you wish to use this
79
+ * feature in an implementation, please contact your Coveo representative.
80
+ *
81
+ * @param engine - The headless commerce engine.
82
+ * @param options - The options for the `FilterSuggestions` controller.
83
+ * @returns A `FilterSuggestions` controller instance.
84
+ *
85
+ * @group Buildable controllers
86
+ * @category FilterSuggestions
87
+ */
88
+ export declare function buildFilterSuggestions(engine: CommerceEngine, options: RegularFacetOptions): FilterSuggestions;
@@ -41,13 +41,15 @@ export interface CategoryFacetOptions {
41
41
  /**
42
42
  * Whether to exclude the parents of folded results when estimating the result count for each facet value.
43
43
  *
44
+ * Note: Resulting count is only an estimation, in some cases this value could be incorrect.
45
+ *
44
46
  * @defaultValue `true`
45
47
  */
46
48
  filterFacetCount?: boolean;
47
49
  /**
48
50
  * The maximum number of results to scan in the index to ensure that the facet lists all of the potential facet values.
49
51
  *
50
- * **Note:** A high `injectionDepth` may reduce facet request performance.
52
+ * Note: A high `injectionDepth` may reduce facet request performance.
51
53
  *
52
54
  * Minimum: `0`
53
55
  *
@@ -24,13 +24,15 @@ export interface FacetOptions {
24
24
  /**
25
25
  * Whether to exclude the parents of folded results when estimating the result count for each facet value.
26
26
  *
27
+ * Note: Resulting count is only an estimation, in some cases this value could be incorrect.
28
+ *
27
29
  * @defaultValue `true`
28
30
  */
29
31
  filterFacetCount?: boolean;
30
32
  /**
31
33
  * The maximum number of results to scan in the index to ensure that the facet lists all potential facet values.
32
34
  *
33
- * Note: A high injectionDepth may negatively impact the facet request performance.
35
+ * Note: A high `injectionDepth` may negatively impact the facet request performance.
34
36
  *
35
37
  * Minimum: `0`
36
38
  *
@@ -24,13 +24,15 @@ export interface DateFilterOptions {
24
24
  /**
25
25
  * Whether to exclude folded result parents when estimating the result count for each facet value.
26
26
  *
27
+ * Note: Resulting count is only an estimation, in some cases this value could be incorrect.
28
+ *
27
29
  * @defaultValue `true`
28
30
  */
29
31
  filterFacetCount?: boolean;
30
32
  /**
31
33
  * The maximum number of results to scan in the index to ensure that the facet lists all potential facet values.
32
34
  *
33
- * Note: A high injectionDepth may negatively impact the facet request performance.
35
+ * Note: A high `injectionDepth` may negatively impact the facet request performance.
34
36
  *
35
37
  * Minimum: `0`
36
38
  *
@@ -38,13 +38,15 @@ export interface DateFacetOptions {
38
38
  /**
39
39
  * Whether to exclude folded result parents when estimating the result count for each facet value.
40
40
  *
41
+ * Note: Resulting count is only an estimation, in some cases this value could be incorrect.
42
+ *
41
43
  * @defaultValue `true`
42
44
  */
43
45
  filterFacetCount?: boolean;
44
46
  /**
45
47
  * The maximum number of results to scan in the index to ensure that the facet lists all potential facet values.
46
48
  *
47
- * Note: A high injectionDepth may negatively impact the facet request performance.
49
+ * Note: A high `injectionDepth` may negatively impact the facet request performance.
48
50
  *
49
51
  * Minimum: `0`
50
52
  *
@@ -24,13 +24,15 @@ export interface NumericFilterOptions {
24
24
  /**
25
25
  * Whether to exclude folded result parents when estimating the result count for each facet value.
26
26
  *
27
+ * Note: Resulting count is only an estimation, in some cases this value could be incorrect.
28
+ *
27
29
  * @defaultValue `true`
28
30
  */
29
31
  filterFacetCount?: boolean;
30
32
  /**
31
33
  * The maximum number of results to scan in the index to ensure that the facet lists all potential facet values.
32
34
  *
33
- * Note: A high injectionDepth may negatively impact the facet request performance.
35
+ * Note: A high `injectionDepth` may negatively impact the facet request performance.
34
36
  *
35
37
  * Minimum: `0`
36
38
  *
@@ -42,13 +42,15 @@ export interface NumericFacetOptions {
42
42
  /**
43
43
  * Whether to exclude folded result parents when estimating the result count for each facet value.
44
44
  *
45
+ * Note: Resulting count is only an estimation, in some cases this value could be incorrect.
46
+ *
45
47
  * @defaultValue `true`
46
48
  */
47
49
  filterFacetCount?: boolean;
48
50
  /**
49
51
  * The maximum number of results to scan in the index to ensure that the facet lists all potential facet values.
50
52
  *
51
- * Note: A high injectionDepth may negatively impact the facet request performance.
53
+ * Note: A high `injectionDepth` may negatively impact the facet request performance.
52
54
  *
53
55
  * Minimum: `0`
54
56
  *
@@ -24,13 +24,15 @@ export interface FacetOptions {
24
24
  /**
25
25
  * Whether to exclude the parents of folded results when estimating the result count for each facet value.
26
26
  *
27
+ * Note: Resulting count is only an estimation, in some cases this value could be incorrect.
28
+ *
27
29
  * @defaultValue `true`
28
30
  */
29
31
  filterFacetCount?: boolean;
30
32
  /**
31
33
  * The maximum number of results to scan in the index to ensure that the facet lists all potential facet values.
32
34
  *
33
- * Note: A high injectionDepth may negatively impact the facet request performance.
35
+ * Note: A high `injectionDepth` may negatively impact the facet request performance.
34
36
  *
35
37
  * Minimum: `0`
36
38
  *
@@ -41,13 +41,15 @@ export interface RegisterCategoryFacetActionCreatorPayload {
41
41
  /**
42
42
  * Whether to exclude the parents of folded results when estimating the result count for each facet value.
43
43
  *
44
+ * Note: Resulting count is only an estimation, in some cases this value could be incorrect.
45
+ *
44
46
  * @defaultValue `true`
45
47
  */
46
48
  filterFacetCount?: boolean;
47
49
  /**
48
50
  * The maximum number of results to scan in the index to ensure that the facet lists all potential facet values.
49
51
  *
50
- * Note: A high injectionDepth may negatively impact the facet request performance.
52
+ * Note: A high `injectionDepth` may negatively impact the facet request performance.
51
53
  *
52
54
  * Minimum: `0`
53
55
  *
@@ -9,12 +9,15 @@ export interface BaseFacetRequest {
9
9
  /** The field whose values you want to display in the facet.*/
10
10
  field: string;
11
11
  /** Whether to exclude folded result parents when estimating the result count for each facet value.
12
+ *
13
+ * Note: Resulting count is only an estimation, in some cases this value could be incorrect.
14
+ *
12
15
  * @defaultValue `true`
13
16
  */
14
17
  filterFacetCount: boolean;
15
18
  /** The maximum number of results to scan in the index to ensure that the facet lists all potential facet values.
16
19
  *
17
- * Note: A high injectionDepth may negatively impact the facet request performance.
20
+ * Note: A high `injectionDepth` may negatively impact the facet request performance.
18
21
  *
19
22
  * Minimum: `0`
20
23
  *
@@ -24,13 +24,15 @@ export interface RegisterFacetActionCreatorPayload {
24
24
  /**
25
25
  * Whether to exclude the parents of folded results when estimating the result count for each facet value.
26
26
  *
27
+ * Note: Resulting count is only an estimation, in some cases this value could be incorrect.
28
+ *
27
29
  * @defaultValue `true`
28
30
  */
29
31
  filterFacetCount?: boolean;
30
32
  /**
31
33
  * The maximum number of results to scan in the index to ensure that the facet lists all potential facet values.
32
34
  *
33
- * Note: A high injectionDepth may negatively impact the facet request performance.
35
+ * Note: A high `injectionDepth` may negatively impact the facet request performance.
34
36
  *
35
37
  * Minimum: `0`
36
38
  *
@@ -39,13 +39,15 @@ export interface RegisterDateFacetActionCreatorPayload {
39
39
  /**
40
40
  * Whether to exclude folded result parents when estimating the result count for each facet value.
41
41
  *
42
+ * Note: Resulting count is only an estimation, in some cases this value could be incorrect.
43
+ *
42
44
  * @defaultValue `true`
43
45
  */
44
46
  filterFacetCount?: boolean;
45
47
  /**
46
48
  * The maximum number of results to scan in the index to ensure that the facet lists all potential facet values.
47
49
  *
48
- * Note: A high injectionDepth may negatively impact the facet request performance.
50
+ * Note: A high `injectionDepth` may negatively impact the facet request performance.
49
51
  *
50
52
  * Minimum: `0`
51
53
  *
@@ -39,13 +39,15 @@ export interface RegisterNumericFacetActionCreatorPayload {
39
39
  /**
40
40
  * Whether to exclude folded result parents when estimating the result count for each facet value.
41
41
  *
42
+ * Note: Resulting count is only an estimation, in some cases this value could be incorrect.
43
+ *
42
44
  * @defaultValue `true`
43
45
  */
44
46
  filterFacetCount?: boolean;
45
47
  /**
46
48
  * The maximum number of results to scan in the index to ensure that the facet lists all potential facet values.
47
49
  *
48
- * Note: A high injectionDepth may negatively impact the facet request performance.
50
+ * Note: A high `injectionDepth` may negatively impact the facet request performance.
49
51
  *
50
52
  * Minimum: `0`
51
53
  *
@@ -113,8 +113,8 @@ export type { Summary, ProductListingSummaryState, RecommendationsSummaryState,
113
113
  export { defineSummary } from './controllers/commerce/core/summary/headless-core-summary.ssr.js';
114
114
  export type { RecentQueriesList, RecentQueriesListOptions, RecentQueriesListProps, RecentQueriesListInitialState, RecentQueriesState, RecentQueriesListDefinition, } from './controllers/commerce/recent-queries-list/headless-recent-queries-list.ssr.js';
115
115
  export { defineRecentQueriesList } from './controllers/commerce/recent-queries-list/headless-recent-queries-list.ssr.js';
116
- export type { FieldSuggestions, FieldSuggestionsState, CategoryFieldSuggestions, CategoryFieldSuggestionsState, FieldSuggestionsFacet, GeneratedFieldSuggestionsControllers, FieldSuggestionsGenerator, FieldSuggestionsGeneratorDefinition, } from './controllers/commerce/field-suggestions/headless-field-suggestions-generator.ssr.js';
117
- export { defineFieldSuggestionsGenerator } from './controllers/commerce/field-suggestions/headless-field-suggestions-generator.ssr.js';
116
+ export type { FilterSuggestions, FilterSuggestionsState, CategoryFilterSuggestions, CategoryFilterSuggestionsState, FieldSuggestionsFacet, GeneratedFilterSuggestionsControllers, FilterSuggestionsGenerator, FilterSuggestionsGeneratorDefinition, } from './controllers/commerce/filter-suggestions/headless-filter-suggestions-generator.ssr.js';
117
+ export { defineFilterSuggestionsGenerator } from './controllers/commerce/filter-suggestions/headless-filter-suggestions-generator.ssr.js';
118
118
  export type { NotifyTrigger, NotifyTriggerState, NotifyTriggerDefinition, } from './controllers/commerce/triggers/headless-notify-trigger.ssr.js';
119
119
  export { defineNotifyTrigger } from './controllers/commerce/triggers/headless-notify-trigger.ssr.js';
120
120
  export type { QueryTrigger, QueryTriggerState, QueryTriggerDefinition, } from './controllers/commerce/triggers/headless-query-trigger.ssr.js';
@@ -0,0 +1,44 @@
1
+ import { EventSourceMessage } from './parse.js';
2
+ export declare const EventStreamContentType = "text/event-stream";
3
+ export interface FetchEventSourceInit extends RequestInit {
4
+ /**
5
+ * The request headers. FetchEventSource only supports the Record<string,string> format.
6
+ */
7
+ headers?: Record<string, string>;
8
+ /**
9
+ * Called when a response is received. Use this to validate that the response
10
+ * actually matches what you expect (and throw if it doesn't.) If not provided,
11
+ * will default to a basic validation to ensure the content-type is text/event-stream.
12
+ */
13
+ onopen?: (response: Response) => Promise<void>;
14
+ /**
15
+ * Called when a message is received. NOTE: Unlike the default browser
16
+ * EventSource.onmessage, this callback is called for _all_ events,
17
+ * even ones with a custom `event` field.
18
+ */
19
+ onmessage?: (ev: EventSourceMessage) => void;
20
+ /**
21
+ * Called when a response finishes. If you don't expect the server to kill
22
+ * the connection, you can throw an exception here and retry using onerror.
23
+ */
24
+ onclose?: () => void;
25
+ /**
26
+ * Called when there is any error making the request / processing messages /
27
+ * handling callbacks etc. Use this to control the retry strategy: if the
28
+ * error is fatal, rethrow the error inside the callback to stop the entire
29
+ * operation. Otherwise, you can return an interval (in milliseconds) after
30
+ * which the request will automatically retry (with the last-event-id).
31
+ * If this callback is not specified, or it returns undefined, fetchEventSource
32
+ * will treat every error as retryable and will try again after 1 second.
33
+ */
34
+ onerror?: (err: unknown) => number | null | undefined | void;
35
+ /**
36
+ * If true, will keep the request open even if the document is hidden.
37
+ * By default, fetchEventSource will close the request and reopen it
38
+ * automatically when the document becomes visible again.
39
+ */
40
+ openWhenHidden?: boolean;
41
+ /** The Fetch function to use. Defaults to window.fetch */
42
+ fetch?: typeof fetch;
43
+ }
44
+ export declare function fetchEventSource(input: RequestInfo, { signal: inputSignal, headers: inputHeaders, onopen: inputOnOpen, onmessage, onclose, onerror, openWhenHidden, fetch: inputFetch, ...rest }: FetchEventSourceInit): Promise<void>;
@@ -0,0 +1,2 @@
1
+ export { fetchEventSource, type FetchEventSourceInit, EventStreamContentType, } from './fetch.js';
2
+ export { type EventSourceMessage } from './parse.js';