@coveo/quantic 3.14.3 → 3.15.1

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 (57) 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/coveoheadless/case-assist/headless.js +7 -9
  19. package/force-app/main/default/staticresources/coveoheadless/definitions/api/commerce/commerce-api-client.d.ts +2 -2
  20. package/force-app/main/default/staticresources/coveoheadless/definitions/api/commerce/common/request.d.ts +4 -3
  21. package/force-app/main/default/staticresources/coveoheadless/definitions/api/commerce/recommendations/recommendations-request.d.ts +2 -2
  22. package/force-app/main/default/staticresources/coveoheadless/definitions/api/commerce/search/query-suggest/query-suggest-request.d.ts +1 -1
  23. package/force-app/main/default/staticresources/coveoheadless/definitions/api/commerce/search/request.d.ts +2 -2
  24. package/force-app/main/default/staticresources/coveoheadless/definitions/api/service/case-assist/get-document-suggestions/get-document-suggestions-request.d.ts +17 -1
  25. package/force-app/main/default/staticresources/coveoheadless/definitions/app/navigatorContextProvider.d.ts +6 -0
  26. package/force-app/main/default/staticresources/coveoheadless/definitions/commerce.index.d.ts +6 -1
  27. package/force-app/main/default/staticresources/coveoheadless/definitions/controllers/commerce/field-suggestions/headless-category-field-suggestions.d.ts +5 -1
  28. package/force-app/main/default/staticresources/coveoheadless/definitions/controllers/commerce/field-suggestions/headless-field-suggestions-generator.d.ts +9 -2
  29. package/force-app/main/default/staticresources/coveoheadless/definitions/controllers/commerce/filter-suggestions/headless-category-filter-suggestions.d.ts +87 -0
  30. package/force-app/main/default/staticresources/coveoheadless/definitions/controllers/commerce/filter-suggestions/headless-filter-suggestions-generator.d.ts +38 -0
  31. package/force-app/main/default/staticresources/coveoheadless/definitions/controllers/commerce/filter-suggestions/headless-filter-suggestions-generator.ssr.d.ts +16 -0
  32. package/force-app/main/default/staticresources/coveoheadless/definitions/controllers/commerce/filter-suggestions/headless-filter-suggestions.d.ts +88 -0
  33. package/force-app/main/default/staticresources/coveoheadless/definitions/features/analytics/search-action-cause.d.ts +4 -0
  34. package/force-app/main/default/staticresources/coveoheadless/definitions/features/commerce/common/base-commerce-api-request-builder.d.ts +5 -0
  35. package/force-app/main/default/staticresources/coveoheadless/definitions/features/commerce/common/filterable-commerce-api-request-builder.d.ts +6 -0
  36. package/force-app/main/default/staticresources/coveoheadless/definitions/features/commerce/common/paginated-commerce-api-request-builder.d.ts +6 -0
  37. package/force-app/main/default/staticresources/coveoheadless/definitions/features/commerce/facets/facet-search-set/commerce-facet-search-state.d.ts +2 -2
  38. package/force-app/main/default/staticresources/coveoheadless/definitions/features/commerce/product-listing/product-listing-actions-loader.d.ts +1 -2
  39. package/force-app/main/default/staticresources/coveoheadless/definitions/features/commerce/product-listing/product-listing-actions.d.ts +7 -2
  40. package/force-app/main/default/staticresources/coveoheadless/definitions/features/commerce/query-suggest/query-suggest-actions.d.ts +0 -3
  41. package/force-app/main/default/staticresources/coveoheadless/definitions/features/commerce/query-suggest/query-suggest-request-builder.d.ts +4 -0
  42. package/force-app/main/default/staticresources/coveoheadless/definitions/features/commerce/recommendations/recommendations-actions.d.ts +2 -2
  43. package/force-app/main/default/staticresources/coveoheadless/definitions/features/commerce/search/search-actions-thunk-processor.d.ts +6 -6
  44. package/force-app/main/default/staticresources/coveoheadless/definitions/features/commerce/standalone-search-box-set/plan-request-builder.d.ts +8 -0
  45. package/force-app/main/default/staticresources/coveoheadless/definitions/features/commerce/standalone-search-box-set/standalone-search-box-set-actions-loader.d.ts +3 -2
  46. package/force-app/main/default/staticresources/coveoheadless/definitions/features/commerce/standalone-search-box-set/standalone-search-box-set-actions.d.ts +2 -6
  47. package/force-app/main/default/staticresources/coveoheadless/definitions/features/document-suggestion/document-suggestion-actions.d.ts +2 -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/test/mock-commerce-api-request.d.ts +4 -0
  50. package/force-app/main/default/staticresources/coveoheadless/definitions/test/mock-product-listing.d.ts +1 -1
  51. package/force-app/main/default/staticresources/coveoheadless/headless.js +9 -11
  52. package/force-app/main/default/staticresources/coveoheadless/insight/headless.js +8 -10
  53. package/force-app/main/default/staticresources/coveoheadless/recommendation/headless.js +7 -9
  54. package/package.json +3 -3
  55. package/force-app/main/default/staticresources/coveoheadless/definitions/controllers/commerce/field-suggestions/headless-field-suggestions-generator.ssr.d.ts +0 -16
  56. package/force-app/main/default/staticresources/coveoheadless/definitions/controllers/commerce/field-suggestions/headless-field-suggestions.d.ts +0 -72
  57. package/force-app/main/default/staticresources/coveoheadless/definitions/features/commerce/common/actions.d.ts +0 -13
@@ -5,7 +5,7 @@ import { PlatformEnvironment } from '../../utils/url-utils.js';
5
5
  import { PreprocessRequest } from '../preprocess-request.js';
6
6
  import { SpecificFacetSearchResponse } from '../search/facet-search/specific-facet-search/specific-facet-search-response.js';
7
7
  import { CommerceAPIErrorResponse, CommerceAPIErrorStatusResponse } from './commerce-api-error-response.js';
8
- import { CommerceAPIRequest } from './common/request.js';
8
+ import { FilterableCommerceAPIRequest } from './common/request.js';
9
9
  import { CommerceSuccessResponse } from './common/response.js';
10
10
  import { CommerceFacetSearchRequest, FacetSearchType } from './facet-search/facet-search-request.js';
11
11
  import { CommerceRecommendationsRequest } from './recommendations/recommendations-request.js';
@@ -34,7 +34,7 @@ export declare const isErrorResponse: <T>(r: CommerceAPIResponse<T>) => r is Com
34
34
  export declare class CommerceAPIClient implements CommerceFacetSearchAPIClient {
35
35
  private options;
36
36
  constructor(options: CommerceAPIClientOptions);
37
- getProductListing(req: CommerceAPIRequest): Promise<CommerceAPIResponse<CommerceSuccessResponse>>;
37
+ getProductListing(req: FilterableCommerceAPIRequest): Promise<CommerceAPIResponse<CommerceSuccessResponse>>;
38
38
  search(req: CommerceSearchRequest): Promise<CommerceAPIResponse<SearchCommerceSuccessResponse>>;
39
39
  getRecommendations(req: CommerceRecommendationsRequest): Promise<CommerceAPIResponse<RecommendationsCommerceSuccessResponse>>;
40
40
  productSuggestions(req: CommerceSearchRequest): Promise<CommerceAPIResponse<SearchCommerceSuccessResponse>>;
@@ -2,9 +2,10 @@ import { PlatformClientCallOptions } from '../../platform-client.js';
2
2
  import { BaseParam } from '../../platform-service-params.js';
3
3
  import { TrackingIdParam, LanguageParam, CountryParam, CurrencyParam, ClientIdParam, ContextParam, FacetsParam, PageParam, SortParam, PerPageParam } from '../commerce-api-params.js';
4
4
  import { CommerceApiMethod } from '../commerce-metadata.js';
5
- export type BaseCommerceAPIRequest = BaseParam & TrackingIdParam & LanguageParam & CountryParam & CurrencyParam & ClientIdParam & ContextParam & PageParam & PerPageParam;
6
- export type CommerceAPIRequest = BaseCommerceAPIRequest & FacetsParam & SortParam;
7
- export declare const buildRequest: (req: CommerceAPIRequest, path: CommerceApiMethod) => {
5
+ export type BaseCommerceAPIRequest = BaseParam & TrackingIdParam & LanguageParam & CountryParam & CurrencyParam & ClientIdParam & ContextParam;
6
+ export type PaginatedCommerceAPIRequest = BaseCommerceAPIRequest & PageParam & PerPageParam;
7
+ export type FilterableCommerceAPIRequest = PaginatedCommerceAPIRequest & FacetsParam & SortParam;
8
+ export declare const getRequestOptions: (req: FilterableCommerceAPIRequest, path: CommerceApiMethod) => {
8
9
  requestParams: {
9
10
  trackingId: string;
10
11
  clientId: string | undefined;
@@ -1,7 +1,7 @@
1
1
  import { SlotIdParam } from '../commerce-api-params.js';
2
2
  import { CommerceApiMethod } from '../commerce-metadata.js';
3
- import { BaseCommerceAPIRequest } from '../common/request.js';
4
- export type CommerceRecommendationsRequest = BaseCommerceAPIRequest & SlotIdParam;
3
+ import { PaginatedCommerceAPIRequest } from '../common/request.js';
4
+ export type CommerceRecommendationsRequest = PaginatedCommerceAPIRequest & SlotIdParam;
5
5
  export declare const buildRecommendationsRequest: (req: CommerceRecommendationsRequest, path: CommerceApiMethod) => {
6
6
  requestParams: {
7
7
  slotId: string;
@@ -1,7 +1,7 @@
1
1
  import { BaseParam } from '../../../platform-service-params.js';
2
2
  import { ClientIdParam, CurrencyParam, LanguageParam, QueryParam, TrackingIdParam, ContextParam, CountryParam } from '../../commerce-api-params.js';
3
3
  export type QuerySuggestRequest = BaseParam & TrackingIdParam & LanguageParam & CountryParam & CurrencyParam & ClientIdParam & ContextParam & QueryParam;
4
- export declare const buildQuerySuggestRequest: (req: QuerySuggestRequest) => {
4
+ export declare const getQuerySuggestRequestOptions: (req: QuerySuggestRequest) => {
5
5
  requestParams: {
6
6
  trackingId: string;
7
7
  query: string | undefined;
@@ -1,3 +1,3 @@
1
1
  import { QueryParam } from '../commerce-api-params.js';
2
- import { CommerceAPIRequest } from '../common/request.js';
3
- export type CommerceSearchRequest = CommerceAPIRequest & QueryParam;
2
+ import { FilterableCommerceAPIRequest } from '../common/request.js';
3
+ export type CommerceSearchRequest = FilterableCommerceAPIRequest & QueryParam;
@@ -1,12 +1,28 @@
1
1
  import { BaseParam, ClientIDParam, ContextParam, DebugParam, LocaleParam, NumberOfResultsParam } from '../../../platform-service-params.js';
2
+ import { AnalyticsParam } from '../../../search/search-api-params.js';
2
3
  import { CaseAssistIdParam, FieldsParam } from '../case-assist-params.js';
3
- export type GetDocumentSuggestionsRequest = BaseParam & CaseAssistIdParam & ClientIDParam & LocaleParam & FieldsParam & ContextParam & NumberOfResultsParam & DebugParam;
4
+ export type GetDocumentSuggestionsRequest = BaseParam & CaseAssistIdParam & ClientIDParam & LocaleParam & FieldsParam & ContextParam & NumberOfResultsParam & DebugParam & AnalyticsParam;
4
5
  export declare const buildGetDocumentSuggestionsRequest: (req: GetDocumentSuggestionsRequest) => {
5
6
  requestParams: {
6
7
  clientId: string | undefined;
7
8
  locale: string | undefined;
8
9
  fields: import("../case-assist-params.js").CaseFields;
9
10
  context: Record<string, string | string[]> | undefined;
11
+ analytics: {
12
+ actionCause?: string;
13
+ customData?: object;
14
+ clientId: string;
15
+ deviceId?: string;
16
+ pageId?: string;
17
+ clientTimestamp: string;
18
+ documentReferrer: string | null;
19
+ originContext: string;
20
+ userDisplayName?: string;
21
+ documentLocation?: string | null;
22
+ trackingId?: string;
23
+ capture?: boolean;
24
+ source?: string[];
25
+ } | undefined;
10
26
  };
11
27
  url: string;
12
28
  accessToken: string;
@@ -20,6 +20,12 @@ export interface NavigatorContext {
20
20
  * See [clientId](https://docs.coveo.com/en/masb0234).
21
21
  */
22
22
  clientId: string;
23
+ /**
24
+ * Whether to capture analytics events.
25
+ *
26
+ * Must be left undefined or set to `false` if the `clientId` is an empty string, otherwise requests will fail.
27
+ */
28
+ capture?: boolean;
23
29
  }
24
30
  export type NavigatorContextProvider = () => NavigatorContext;
25
31
  export type BrowserNavigatorContextProvider = (clientId: string) => NavigatorContext;
@@ -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;
@@ -87,6 +87,10 @@ export declare enum SearchPageEvents {
87
87
  * Identifies the search event that gets logged when the sort criteria on a facet is updated.
88
88
  */
89
89
  facetUpdateSort = "facetUpdateSort",
90
+ /**
91
+ * Identifies the search event that gets logged when the document suggestions are fetched.
92
+ */
93
+ documentSuggestion = "documentSuggestion",
90
94
  /**
91
95
  * The custom event that gets logged when an end-user expands a facet to see additional values.
92
96
  */
@@ -0,0 +1,5 @@
1
+ import { BaseCommerceAPIRequest } from '../../../api/commerce/common/request.js';
2
+ import { NavigatorContext } from '../../../app/navigatorContextProvider.js';
3
+ import { CartSection, CommerceConfigurationSection, CommerceContextSection, VersionSection } from '../../../state/state-sections.js';
4
+ export type StateNeededForBaseCommerceAPIRequest = CommerceConfigurationSection & CommerceContextSection & CartSection & Partial<VersionSection>;
5
+ export declare const buildBaseCommerceAPIRequest: (state: StateNeededForBaseCommerceAPIRequest, navigatorContext: NavigatorContext) => BaseCommerceAPIRequest;
@@ -0,0 +1,6 @@
1
+ import { FilterableCommerceAPIRequest } from '../../../api/commerce/common/request.js';
2
+ import { NavigatorContext } from '../../../app/navigatorContextProvider.js';
3
+ import { CommerceFacetSetSection, CommerceSortSection, FacetOrderSection, ManualRangeSection } from '../../../state/state-sections.js';
4
+ import { StateNeededForPaginatedCommerceAPIRequest } from './paginated-commerce-api-request-builder.js';
5
+ export type StateNeededForFilterableCommerceAPIRequest = StateNeededForPaginatedCommerceAPIRequest & Partial<CommerceSortSection & CommerceFacetSetSection & FacetOrderSection & ManualRangeSection>;
6
+ export declare const buildFilterableCommerceAPIRequest: (state: StateNeededForFilterableCommerceAPIRequest, navigatorContext: NavigatorContext) => FilterableCommerceAPIRequest;
@@ -0,0 +1,6 @@
1
+ import { PaginatedCommerceAPIRequest } from '../../../api/commerce/common/request.js';
2
+ import { NavigatorContext } from '../../../app/navigatorContextProvider.js';
3
+ import { CommercePaginationSection } from '../../../state/state-sections.js';
4
+ import { StateNeededForBaseCommerceAPIRequest } from './base-commerce-api-request-builder.js';
5
+ export type StateNeededForPaginatedCommerceAPIRequest = StateNeededForBaseCommerceAPIRequest & Partial<CommercePaginationSection>;
6
+ export declare const buildPaginatedCommerceAPIRequest: (state: StateNeededForPaginatedCommerceAPIRequest, navigatorContext: NavigatorContext, slotId?: string) => PaginatedCommerceAPIRequest;
@@ -1,6 +1,6 @@
1
1
  import { CommerceFacetSetSection, CommerceQuerySection } from '../../../../state/state-sections.js';
2
- import { StateNeededByQueryCommerceAPI } from '../../common/actions.js';
2
+ import { StateNeededForPaginatedCommerceAPIRequest } from '../../common/paginated-commerce-api-request-builder.js';
3
3
  import { StateNeededForCategoryFacetSearch } from './category/commerce-category-facet-search-state.js';
4
4
  import { StateNeededForRegularFacetSearch } from './regular/commerce-regular-facet-search-state.js';
5
- export type CoreStateNeededForFacetSearch = StateNeededByQueryCommerceAPI & CommerceFacetSetSection & Partial<CommerceQuerySection>;
5
+ export type CoreStateNeededForFacetSearch = StateNeededForPaginatedCommerceAPIRequest & CommerceFacetSetSection & Partial<CommerceQuerySection>;
6
6
  export type StateNeededForAnyFacetSearch = StateNeededForRegularFacetSearch | StateNeededForCategoryFacetSearch;
@@ -1,8 +1,7 @@
1
1
  import { AsyncThunkAction, PayloadAction } from '@reduxjs/toolkit';
2
2
  import { AsyncThunkCommerceOptions } from '../../../api/commerce/commerce-api-client.js';
3
3
  import { CommerceEngine } from '../../../app/commerce-engine/commerce-engine.js';
4
- import { QueryCommerceAPIThunkReturn } from '../common/actions.js';
5
- import { PromoteChildToParentPayload, StateNeededByFetchProductListing } from './product-listing-actions.js';
4
+ import { PromoteChildToParentPayload, QueryCommerceAPIThunkReturn, StateNeededByFetchProductListing } from './product-listing-actions.js';
6
5
  /**
7
6
  * The product listing action creators.
8
7
  *
@@ -1,8 +1,13 @@
1
1
  import { RecordValue } from '@coveo/bueno';
2
2
  import { ChildProduct } from '../../../api/commerce/common/product.js';
3
+ import { CommerceSuccessResponse } from '../../../api/commerce/common/response.js';
3
4
  import { ProductListingSection } from '../../../state/state-sections.js';
4
- import { QueryCommerceAPIThunkReturn, ListingAndSearchStateNeededByQueryCommerceAPI } from '../common/actions.js';
5
- export type StateNeededByFetchProductListing = ListingAndSearchStateNeededByQueryCommerceAPI & ProductListingSection;
5
+ import { StateNeededForFilterableCommerceAPIRequest } from '../common/filterable-commerce-api-request-builder.js';
6
+ export interface QueryCommerceAPIThunkReturn {
7
+ /** The successful response. */
8
+ response: CommerceSuccessResponse;
9
+ }
10
+ export type StateNeededByFetchProductListing = StateNeededForFilterableCommerceAPIRequest & ProductListingSection;
6
11
  export declare const fetchProductListing: import("@reduxjs/toolkit").AsyncThunk<QueryCommerceAPIThunkReturn, void, {
7
12
  state: StateNeededByFetchProductListing;
8
13
  rejectValue: import("../../../api/commerce/commerce-api-error-response.js").CommerceAPIErrorStatusResponse;
@@ -1,6 +1,4 @@
1
- import { QuerySuggestRequest } from '../../../api/commerce/search/query-suggest/query-suggest-request.js';
2
1
  import { QuerySuggestSuccessResponse } from '../../../api/commerce/search/query-suggest/query-suggest-response.js';
3
- import { NavigatorContext } from '../../../app/navigatorContextProvider.js';
4
2
  import { CartSection, CommerceContextSection, CommerceQuerySection, CommerceConfigurationSection, QuerySetSection, VersionSection } from '../../../state/state-sections.js';
5
3
  import { ClearQuerySuggestActionCreatorPayload, FetchQuerySuggestionsActionCreatorPayload, RegisterQuerySuggestActionCreatorPayload, SelectQuerySuggestionActionCreatorPayload } from '../../query-suggest/query-suggest-actions.js';
6
4
  export type ClearQuerySuggestPayload = ClearQuerySuggestActionCreatorPayload;
@@ -27,4 +25,3 @@ export type RegisterQuerySuggestPayload = RegisterQuerySuggestActionCreatorPaylo
27
25
  export declare const registerQuerySuggest: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[payload: RegisterQuerySuggestActionCreatorPayload], RegisterQuerySuggestActionCreatorPayload, "commerce/querySuggest/register", never, never>;
28
26
  export type SelectQuerySuggestionPayload = SelectQuerySuggestionActionCreatorPayload;
29
27
  export declare const selectQuerySuggestion: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[payload: SelectQuerySuggestionActionCreatorPayload], SelectQuerySuggestionActionCreatorPayload, "commerce/querySuggest/selectSuggestion", never, never>;
30
- export declare const buildQuerySuggestRequest: (id: string, state: StateNeededByQuerySuggest, navigatorContext: NavigatorContext) => QuerySuggestRequest;
@@ -0,0 +1,4 @@
1
+ import { QuerySuggestRequest } from '../../../api/commerce/search/query-suggest/query-suggest-request.js';
2
+ import { NavigatorContext } from '../../../app/navigatorContextProvider.js';
3
+ import { StateNeededByQuerySuggest } from './query-suggest-actions.js';
4
+ export declare const buildQuerySuggestRequest: (id: string, state: StateNeededByQuerySuggest, navigatorContext: NavigatorContext) => QuerySuggestRequest;
@@ -2,12 +2,12 @@ import { RecordValue, StringValue } from '@coveo/bueno';
2
2
  import { ChildProduct } from '../../../api/commerce/common/product.js';
3
3
  import { RecommendationsCommerceSuccessResponse } from '../../../api/commerce/recommendations/recommendations-response.js';
4
4
  import { RecommendationsSection } from '../../../state/state-sections.js';
5
- import { StateNeededByQueryCommerceAPI } from '../common/actions.js';
5
+ import { StateNeededForPaginatedCommerceAPIRequest } from '../common/paginated-commerce-api-request-builder.js';
6
6
  export interface QueryRecommendationsCommerceAPIThunkReturn {
7
7
  /** The successful recommendations response. */
8
8
  response: RecommendationsCommerceSuccessResponse;
9
9
  }
10
- export type StateNeededByFetchRecommendations = StateNeededByQueryCommerceAPI & RecommendationsSection;
10
+ export type StateNeededByFetchRecommendations = StateNeededForPaginatedCommerceAPIRequest & RecommendationsSection;
11
11
  export interface FetchRecommendationsPayload {
12
12
  /**
13
13
  * The unique identifier of the recommendations slot (e.g., `b953ab2e-022b-4de4-903f-68b2c0682942`).
@@ -2,20 +2,20 @@ import { UnknownAction } from '@reduxjs/toolkit';
2
2
  import { ThunkDispatch } from 'redux-thunk';
3
3
  import { CommerceAPIClient, CommerceAPIResponse } from '../../../api/commerce/commerce-api-client.js';
4
4
  import { CommerceAPIErrorStatusResponse } from '../../../api/commerce/commerce-api-error-response.js';
5
- import { CommerceAPIRequest } from '../../../api/commerce/common/request.js';
5
+ import { FilterableCommerceAPIRequest } from '../../../api/commerce/common/request.js';
6
6
  import { CommerceSearchRequest } from '../../../api/commerce/search/request.js';
7
7
  import { SearchCommerceSuccessResponse } from '../../../api/commerce/search/response.js';
8
8
  import { ClientThunkExtraArguments } from '../../../app/thunk-extra-arguments.js';
9
9
  import { CommerceSearchSection, CommerceQuerySection, CommerceDidYouMeanSection, TriggerSection } from '../../../state/state-sections.js';
10
- import { ListingAndSearchStateNeededByQueryCommerceAPI } from '../common/actions.js';
10
+ import { StateNeededForFilterableCommerceAPIRequest } from '../common/filterable-commerce-api-request-builder.js';
11
11
  import { QuerySearchCommerceAPIThunkReturn } from './search-actions.js';
12
12
  interface FetchedResponse {
13
13
  response: CommerceAPIResponse<SearchCommerceSuccessResponse>;
14
14
  duration: number;
15
15
  queryExecuted: string;
16
- requestExecuted: CommerceAPIRequest;
16
+ requestExecuted: FilterableCommerceAPIRequest;
17
17
  }
18
- export type StateNeededByExecuteSearch = ListingAndSearchStateNeededByQueryCommerceAPI & CommerceSearchSection & CommerceQuerySection & CommerceDidYouMeanSection & TriggerSection;
18
+ export type StateNeededByExecuteSearch = StateNeededForFilterableCommerceAPIRequest & CommerceSearchSection & CommerceQuerySection & CommerceDidYouMeanSection & TriggerSection;
19
19
  export interface AsyncThunkConfig {
20
20
  getState: () => StateNeededByExecuteSearch;
21
21
  dispatch: ThunkDispatch<StateNeededByExecuteSearch, ClientThunkExtraArguments<CommerceAPIClient> & {
@@ -29,11 +29,11 @@ export declare class AsyncSearchThunkProcessor<RejectionType> {
29
29
  private config;
30
30
  constructor(config: AsyncThunkConfig);
31
31
  process(fetched: FetchedResponse): Promise<ValidReturnTypeFromProcessingStep<RejectionType>>;
32
- fetchFromAPI(request: CommerceAPIRequest | CommerceSearchRequest): Promise<{
32
+ fetchFromAPI(request: FilterableCommerceAPIRequest | CommerceSearchRequest): Promise<{
33
33
  response: CommerceAPIResponse<SearchCommerceSuccessResponse>;
34
34
  duration: number;
35
35
  queryExecuted: string;
36
- requestExecuted: CommerceAPIRequest | CommerceSearchRequest;
36
+ requestExecuted: FilterableCommerceAPIRequest | CommerceSearchRequest;
37
37
  }>;
38
38
  private processSuccessResponse;
39
39
  private processQueryErrorOrContinue;
@@ -0,0 +1,8 @@
1
+ import { PageParam, PerPageParam, QueryParam } from '../../../api/commerce/commerce-api-params.js';
2
+ import { BaseCommerceAPIRequest } from '../../../api/commerce/common/request.js';
3
+ import { NavigatorContext } from '../../../app/navigatorContextProvider.js';
4
+ import { CommerceQuerySection } from '../../../state/state-sections.js';
5
+ import { StateNeededForBaseCommerceAPIRequest } from '../common/base-commerce-api-request-builder.js';
6
+ export type StateNeededForPlanCommerceAPIRequest = StateNeededForBaseCommerceAPIRequest & CommerceQuerySection;
7
+ export type CommercePlanRequest = BaseCommerceAPIRequest & QueryParam & PageParam & PerPageParam;
8
+ export declare const buildPlanRequest: (state: StateNeededForPlanCommerceAPIRequest, navigatorContext: NavigatorContext) => CommercePlanRequest;
@@ -1,7 +1,8 @@
1
1
  import { AsyncThunkAction, PayloadAction } from '@reduxjs/toolkit';
2
2
  import { AsyncThunkCommerceOptions } from '../../../api/commerce/commerce-api-client.js';
3
3
  import { CommerceEngine } from '../../../app/commerce-engine/commerce-engine.js';
4
- import { FetchRedirectUrlPayload, RegisterStandaloneSearchBoxPayload, ResetStandaloneSearchBoxPayload, StateNeededForRedirect } from './standalone-search-box-set-actions.js';
4
+ import { StateNeededForPlanCommerceAPIRequest } from './plan-request-builder.js';
5
+ import { FetchRedirectUrlPayload, RegisterStandaloneSearchBoxPayload, ResetStandaloneSearchBoxPayload } from './standalone-search-box-set-actions.js';
5
6
  export type { FetchRedirectUrlPayload, RegisterStandaloneSearchBoxPayload, ResetStandaloneSearchBoxPayload, };
6
7
  /**
7
8
  * The commerce standalone search box set action creators.
@@ -16,7 +17,7 @@ export interface StandaloneSearchBoxSetActionCreators {
16
17
  * @param payload - The action creator payload.
17
18
  * @returns A dispatchable action.
18
19
  */
19
- fetchRedirectUrl(payload: FetchRedirectUrlPayload): AsyncThunkAction<string, FetchRedirectUrlPayload, AsyncThunkCommerceOptions<StateNeededForRedirect>>;
20
+ fetchRedirectUrl(payload: FetchRedirectUrlPayload): AsyncThunkAction<string, FetchRedirectUrlPayload, AsyncThunkCommerceOptions<StateNeededForPlanCommerceAPIRequest>>;
20
21
  /**
21
22
  * Registers a standalone search box.
22
23
  *