@coveo/quantic 3.30.0-pre.8a67bd16aa → 3.30.0-pre.8b47cb07e6

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 (30) hide show
  1. package/force-app/main/default/staticresources/coveoheadless/case-assist/headless.js +2 -2
  2. package/force-app/main/default/staticresources/coveoheadless/definitions/ssr/commerce/types/controller-definitions.d.ts +0 -3
  3. package/force-app/main/default/staticresources/coveoheadless/definitions/ssr-commerce-next.index.d.ts +8 -8
  4. package/force-app/main/default/staticresources/coveoheadless/definitions/ssr-next/commerce/controller-utils.d.ts +2 -1
  5. package/force-app/main/default/staticresources/coveoheadless/definitions/ssr-next/commerce/controllers/breadcrumb-manager/headless-core-breadcrumb-manager.ssr.d.ts +2 -3
  6. package/force-app/main/default/staticresources/coveoheadless/definitions/ssr-next/commerce/controllers/cart/headless-cart.ssr.d.ts +2 -1
  7. package/force-app/main/default/staticresources/coveoheadless/definitions/ssr-next/commerce/controllers/context/headless-context.ssr.d.ts +3 -2
  8. package/force-app/main/default/staticresources/coveoheadless/definitions/ssr-next/commerce/controllers/did-you-mean/headless-did-you-mean.ssr.d.ts +1 -2
  9. package/force-app/main/default/staticresources/coveoheadless/definitions/ssr-next/commerce/controllers/filter-suggestions/headless-filter-suggestions-generator.ssr.d.ts +2 -1
  10. package/force-app/main/default/staticresources/coveoheadless/definitions/ssr-next/commerce/controllers/generator/headless-commerce-facet-generator.ssr.d.ts +2 -3
  11. package/force-app/main/default/staticresources/coveoheadless/definitions/ssr-next/commerce/controllers/instant-products/headless-instant-products.ssr.d.ts +2 -1
  12. package/force-app/main/default/staticresources/coveoheadless/definitions/ssr-next/commerce/controllers/pagination/headless-core-commerce-pagination.ssr.d.ts +2 -3
  13. package/force-app/main/default/staticresources/coveoheadless/definitions/ssr-next/commerce/controllers/parameter-manager/headless-core-parameter-manager.ssr.d.ts +13 -3
  14. package/force-app/main/default/staticresources/coveoheadless/definitions/ssr-next/commerce/controllers/product-list/headless-product-list.ssr.d.ts +2 -3
  15. package/force-app/main/default/staticresources/coveoheadless/definitions/ssr-next/commerce/controllers/product-view/headless-product-view.ssr.d.ts +3 -1
  16. package/force-app/main/default/staticresources/coveoheadless/definitions/ssr-next/commerce/controllers/recent-queries-list/headless-recent-queries-list.ssr.d.ts +2 -1
  17. package/force-app/main/default/staticresources/coveoheadless/definitions/ssr-next/commerce/controllers/search-box/headless-search-box.ssr.d.ts +2 -1
  18. package/force-app/main/default/staticresources/coveoheadless/definitions/ssr-next/commerce/controllers/sort/headless-core-commerce-sort.ssr.d.ts +2 -3
  19. package/force-app/main/default/staticresources/coveoheadless/definitions/ssr-next/commerce/controllers/standalone-search-box/headless-standalone-search-box.ssr.d.ts +2 -1
  20. package/force-app/main/default/staticresources/coveoheadless/definitions/ssr-next/commerce/controllers/summary/headless-core-summary.ssr.d.ts +2 -3
  21. package/force-app/main/default/staticresources/coveoheadless/definitions/ssr-next/commerce/controllers/triggers/headless-notify-trigger.ssr.d.ts +2 -1
  22. package/force-app/main/default/staticresources/coveoheadless/definitions/ssr-next/commerce/controllers/triggers/headless-query-trigger.ssr.d.ts +2 -1
  23. package/force-app/main/default/staticresources/coveoheadless/definitions/ssr-next/commerce/controllers/triggers/headless-redirection-trigger.ssr.d.ts +2 -1
  24. package/force-app/main/default/staticresources/coveoheadless/definitions/ssr-next/commerce/types/controller-definitions.d.ts +48 -3
  25. package/force-app/main/default/staticresources/coveoheadless/definitions/ssr-next/commerce/types/controller-scopes.d.ts +6 -0
  26. package/force-app/main/default/staticresources/coveoheadless/definitions/ssr-next/common/errors.d.ts +3 -0
  27. package/force-app/main/default/staticresources/coveoheadless/headless.js +3 -3
  28. package/force-app/main/default/staticresources/coveoheadless/insight/headless.js +2 -2
  29. package/force-app/main/default/staticresources/coveoheadless/recommendation/headless.js +2 -2
  30. package/package.json +2 -2
@@ -1,13 +1,12 @@
1
1
  import { type ProductListing, type ProductListingState } from '../../../../controllers/commerce/product-listing/headless-product-listing.js';
2
2
  import { type Search } from '../../../../controllers/commerce/search/headless-search.js';
3
- import type { SearchAndListingControllerDefinitionWithoutProps } from '../../types/controller-definitions.js';
3
+ import type { ControllerDefinitionOption, SubControllerDefinitionWithoutProps } from '../../types/controller-definitions.js';
4
4
  export type { Search, ProductListing, ProductListingState as ProductListState };
5
5
  export type ProductList = Pick<ProductListing | Search, 'state' | 'subscribe' | 'interactiveProduct' | 'promoteChildToParent'>;
6
- export type ProductListDefinition = SearchAndListingControllerDefinitionWithoutProps<ProductList>;
7
6
  /**
8
7
  * Defines a `ProductList` controller instance.
9
8
  * @group Definers
10
9
  *
11
10
  * @returns The `ProductList` controller definition.
12
11
  */
13
- export declare function defineProductList(): ProductListDefinition;
12
+ export declare function defineProductList<TOptions extends ControllerDefinitionOption | undefined>(options?: TOptions): SubControllerDefinitionWithoutProps<ProductList, TOptions>;
@@ -1,7 +1,8 @@
1
1
  import { type ProductView as BaseProductView } from '../../../../controllers/commerce/product-view/headless-product-view.js';
2
2
  import { type Controller } from '../../../../controllers/controller/headless-controller.js';
3
3
  import type { NonRecommendationControllerDefinitionWithoutProps } from '../../types/controller-definitions.js';
4
- export type ProductViewDefinition = NonRecommendationControllerDefinitionWithoutProps<ProductView>;
4
+ interface ProductViewDefinition extends NonRecommendationControllerDefinitionWithoutProps<ProductView> {
5
+ }
5
6
  /**
6
7
  * Defines a `ProductView` controller instance.
7
8
  *
@@ -16,3 +17,4 @@ export type ProductViewDefinition = NonRecommendationControllerDefinitionWithout
16
17
  export declare function defineProductView(): ProductViewDefinition;
17
18
  export interface ProductView extends BaseProductView, Controller {
18
19
  }
20
+ export {};
@@ -1,7 +1,8 @@
1
1
  import { type RecentQueriesList, type RecentQueriesListInitialState, type RecentQueriesListOptions, type RecentQueriesListProps, type RecentQueriesState } from '../../../../controllers/commerce/recent-queries-list/headless-recent-queries-list.js';
2
2
  import type { NonRecommendationControllerDefinitionWithoutProps } from '../../types/controller-definitions.js';
3
3
  export type { RecentQueriesListInitialState, RecentQueriesListOptions, RecentQueriesState, RecentQueriesList, RecentQueriesListProps, };
4
- export type RecentQueriesListDefinition = NonRecommendationControllerDefinitionWithoutProps<RecentQueriesList>;
4
+ export interface RecentQueriesListDefinition extends NonRecommendationControllerDefinitionWithoutProps<RecentQueriesList> {
5
+ }
5
6
  /**
6
7
  * Defines the `RecentQueriesList` controller for the purpose of server-side rendering.
7
8
  * @group Definers
@@ -1,7 +1,8 @@
1
1
  import { type CoreSearchBox, type SearchBox, type SearchBoxOptions, type SearchBoxProps, type SearchBoxState, type Suggestion } from '../../../../controllers/commerce/search-box/headless-search-box.js';
2
2
  import type { SearchOnlyControllerDefinitionWithoutProps } from '../../types/controller-definitions.js';
3
3
  export type { CoreSearchBox, SearchBox, SearchBoxProps, SearchBoxState, SearchBoxOptions, Suggestion, };
4
- export type SearchBoxDefinition = SearchOnlyControllerDefinitionWithoutProps<SearchBox>;
4
+ export interface SearchBoxDefinition extends SearchOnlyControllerDefinitionWithoutProps<SearchBox> {
5
+ }
5
6
  /**
6
7
  * Defines a `SearchBox` controller instance.
7
8
  * @group Definers
@@ -1,7 +1,6 @@
1
1
  import type { Sort, SortProps, SortState } from '../../../../controllers/commerce/core/sort/headless-core-commerce-sort.js';
2
- import type { SearchAndListingControllerDefinitionWithoutProps } from '../../types/controller-definitions.js';
2
+ import type { ControllerDefinitionOption, SubControllerDefinitionWithoutProps } from '../../types/controller-definitions.js';
3
3
  export type { Sort, SortProps, SortState };
4
- export type SortDefinition = SearchAndListingControllerDefinitionWithoutProps<Sort>;
5
4
  /**
6
5
  * Defines a `Sort` controller instance.
7
6
  * @group Definers
@@ -9,4 +8,4 @@ export type SortDefinition = SearchAndListingControllerDefinitionWithoutProps<So
9
8
  * @param props - The configurable `Sort` properties.
10
9
  * @returns The `Sort` controller definition.
11
10
  */
12
- export declare function defineSort(props?: SortProps): SortDefinition;
11
+ export declare function defineSort<TOptions extends ControllerDefinitionOption | undefined>(props?: SortProps & TOptions): SubControllerDefinitionWithoutProps<Sort, TOptions>;
@@ -2,7 +2,8 @@ import { type StandaloneSearchBox, type StandaloneSearchBoxState } from '../../.
2
2
  import type { StandaloneSearchBoxProps } from '../../../../controllers/standalone-search-box/headless-standalone-search-box.js';
3
3
  import type { ListingAndStandaloneControllerWithoutProps } from '../../types/controller-definitions.js';
4
4
  export type { StandaloneSearchBoxState, StandaloneSearchBox, StandaloneSearchBoxProps, };
5
- export type StandaloneSearchBoxDefinition = ListingAndStandaloneControllerWithoutProps<StandaloneSearchBox>;
5
+ export interface StandaloneSearchBoxDefinition extends ListingAndStandaloneControllerWithoutProps<StandaloneSearchBox> {
6
+ }
6
7
  /**
7
8
  * Defines the `StandaloneSearchBox` controller for the purpose of server-side rendering.
8
9
  * @group Definers
@@ -2,13 +2,12 @@ import type { Summary, SummaryState } from '../../../../controllers/commerce/cor
2
2
  import type { ProductListingSummaryState } from '../../../../controllers/commerce/product-listing/summary/headless-product-listing-summary.js';
3
3
  import type { RecommendationsSummaryState } from '../../../../controllers/commerce/recommendations/summary/headless-recommendations-summary.js';
4
4
  import type { SearchSummaryState } from '../../../../controllers/commerce/search/summary/headless-search-summary.js';
5
- import type { SearchAndListingControllerDefinitionWithoutProps } from '../../types/controller-definitions.js';
5
+ import type { ControllerDefinitionOption, SubControllerDefinitionWithoutProps } from '../../types/controller-definitions.js';
6
6
  export type { Summary, ProductListingSummaryState, RecommendationsSummaryState, SearchSummaryState, SummaryState, };
7
- export type SummaryDefinition = SearchAndListingControllerDefinitionWithoutProps<Summary<ProductListingSummaryState | SearchSummaryState | RecommendationsSummaryState>>;
8
7
  /**
9
8
  * Defines a `Summary` controller instance.
10
9
  * @group Definers
11
10
  *
12
11
  * @returns The `Summary` controller definition.
13
12
  */
14
- export declare function defineSummary(): SummaryDefinition;
13
+ export declare function defineSummary<TOptions extends ControllerDefinitionOption | undefined>(options?: TOptions): SubControllerDefinitionWithoutProps<Summary<ProductListingSummaryState | SearchSummaryState | RecommendationsSummaryState>, TOptions>;
@@ -1,7 +1,8 @@
1
1
  import type { NotifyTrigger, NotifyTriggerState } from '../../../../controllers/core/triggers/headless-core-notify-trigger.js';
2
2
  import type { SearchAndListingControllerDefinitionWithoutProps } from '../../types/controller-definitions.js';
3
3
  export type { NotifyTrigger, NotifyTriggerState };
4
- export type NotifyTriggerDefinition = SearchAndListingControllerDefinitionWithoutProps<NotifyTrigger>;
4
+ export interface NotifyTriggerDefinition extends SearchAndListingControllerDefinitionWithoutProps<NotifyTrigger> {
5
+ }
5
6
  /**
6
7
  * Defines the `NotifyTrigger` controller for the purpose of server-side rendering.
7
8
  * @group Definers
@@ -2,7 +2,8 @@ import type { QueryTrigger } from '../../../../controllers/core/triggers/headles
2
2
  import type { SearchOnlyControllerDefinitionWithoutProps } from '../../types/controller-definitions.js';
3
3
  export type { QueryTriggerState } from '../../../../controllers/core/triggers/headless-core-query-trigger.js';
4
4
  export type { QueryTrigger };
5
- export type QueryTriggerDefinition = SearchOnlyControllerDefinitionWithoutProps<QueryTrigger>;
5
+ export interface QueryTriggerDefinition extends SearchOnlyControllerDefinitionWithoutProps<QueryTrigger> {
6
+ }
6
7
  /**
7
8
  * Defines the `QueryTrigger` controller for the purpose of server-side rendering.
8
9
  * @group Definers
@@ -1,7 +1,8 @@
1
1
  import type { RedirectionTrigger, RedirectionTriggerState } from '../../../../controllers/core/triggers/headless-core-redirection-trigger.js';
2
2
  import type { SearchOnlyControllerDefinitionWithoutProps } from '../../types/controller-definitions.js';
3
3
  export type { RedirectionTrigger, RedirectionTriggerState };
4
- export type RedirectionTriggerDefinition = SearchOnlyControllerDefinitionWithoutProps<RedirectionTrigger>;
4
+ export interface RedirectionTriggerDefinition extends SearchOnlyControllerDefinitionWithoutProps<RedirectionTrigger> {
5
+ }
5
6
  /**
6
7
  * Defines the `RedirectionTrigger` controller for the purpose of server-side rendering.
7
8
  * @group Definers
@@ -1,4 +1,5 @@
1
1
  import type { Controller } from '../../../controllers/controller/headless-controller.js';
2
+ import type { InvalidControllerDefinition } from '../../common/errors.js';
2
3
  import type { InferControllerStaticStateFromController, InferControllerStaticStateMapFromControllers } from '../../common/types/controller-inference.js';
3
4
  import type { ControllersPropsMap } from '../../common/types/controllers.js';
4
5
  import type { HasKey, HasRequiredKeys, OptionsTuple } from '../../common/types/utilities.js';
@@ -7,7 +8,7 @@ import type { ContextDefinition } from '../controllers/context/headless-context.
7
8
  import type { ParameterManagerDefinition } from '../controllers/parameter-manager/headless-core-parameter-manager.ssr.js';
8
9
  import type { SSRCommerceEngine } from '../factories/build-factory.js';
9
10
  import { type recommendationInternalOptionKey, SolutionType } from './controller-constants.js';
10
- import type { ListingAndStandaloneController, NonRecommendationController, RecommendationOnlyController, SearchAndListingController, SearchOnlyController, UniversalController } from './controller-scopes.js';
11
+ import type { ListingAndStandaloneController, ListingOnlyController, NonRecommendationController, RecommendationOnlyController, SearchAndListingController, SearchOnlyController, UniversalController } from './controller-scopes.js';
11
12
  import type { HydratedState } from './hydrate-static-state.js';
12
13
  import type { HasSolutionType } from './utilities.js';
13
14
  export type { HydratedState, OptionsTuple, InferControllerStaticStateFromController, InferControllerStaticStateMapFromControllers, };
@@ -43,7 +44,10 @@ export interface ControllerDefinitionsMap<TController extends Controller> {
43
44
  [customName: string]: ControllerDefinition<TController>;
44
45
  }
45
46
  type BakedInControllerDefinitions = {
46
- parameterManager: ParameterManagerDefinition;
47
+ parameterManager: ParameterManagerDefinition<{
48
+ listing: true;
49
+ search: true;
50
+ }>;
47
51
  context: ContextDefinition;
48
52
  cart: CartDefinition;
49
53
  };
@@ -85,10 +89,51 @@ export type IsRecommendationController<TController extends ControllerDefinition<
85
89
  type DefaultControllerProps<TControllers extends ControllerDefinitionsMap<Controller>, TControllersPropsMap extends ControllersPropsMap, K extends keyof TControllers> = {
86
90
  [I in keyof TControllersPropsMap as I extends K ? I : never]: TControllersPropsMap[I];
87
91
  };
92
+ export interface ControllerDefinitionOption {
93
+ /**
94
+ * Whether the controller will be used in a product listing context.
95
+ * @defaultValue true
96
+ */
97
+ listing?: boolean;
98
+ /**
99
+ * Whether the controller will be used in a search page context.
100
+ * @defaultValue true
101
+ */
102
+ search?: boolean;
103
+ }
88
104
  export type SearchOnlyControllerDefinitionWithoutProps<TController extends Controller> = ControllerDefinitionWithoutProps<TController> & SearchOnlyController;
105
+ type SearchOnlyControllerDefinitionWithProps<TController extends Controller, TProps> = ControllerDefinitionWithProps<TController, TProps> & SearchOnlyController;
89
106
  export type ListingAndStandaloneControllerWithoutProps<TController extends Controller> = ControllerDefinitionWithoutProps<TController> & ListingAndStandaloneController;
107
+ type ListingOnlyControllerDefinitionWithoutProps<TController extends Controller> = ControllerDefinitionWithoutProps<TController> & ListingOnlyController;
108
+ type ListingOnlyControllerDefinitionWithProps<TController extends Controller, TProps> = ControllerDefinitionWithProps<TController, TProps> & ListingOnlyController;
90
109
  export type RecommendationOnlyControllerDefinitionWithProps<TController extends Controller, TProps> = ControllerDefinitionWithProps<TController, TProps> & RecommendationOnlyController;
91
110
  export type NonRecommendationControllerDefinitionWithoutProps<TController extends Controller> = ControllerDefinitionWithoutProps<TController> & NonRecommendationController;
92
111
  export type UniversalControllerDefinitionWithProps<TController extends Controller, TProps> = ControllerDefinitionWithProps<TController, TProps> & UniversalController;
93
112
  export type SearchAndListingControllerDefinitionWithoutProps<TController extends Controller> = ControllerDefinitionWithoutProps<TController> & SearchAndListingController;
94
- export type SearchAndListingControllerDefinitionWithProps<TController extends Controller, TProps> = ControllerDefinitionWithProps<TController, TProps> & SearchAndListingController;
113
+ type SearchAndListingControllerDefinitionWithProps<TController extends Controller, TProps> = ControllerDefinitionWithProps<TController, TProps> & SearchAndListingController;
114
+ export type SubControllerDefinitionWithoutProps<TController extends Controller, TDefinition extends ControllerDefinitionOption | undefined> = TDefinition extends {
115
+ listing?: true;
116
+ search?: true;
117
+ } | undefined ? SearchAndListingControllerDefinitionWithoutProps<TController> : TDefinition extends {
118
+ listing?: true;
119
+ search?: false;
120
+ } ? ListingOnlyControllerDefinitionWithoutProps<TController> : TDefinition extends {
121
+ listing?: false;
122
+ search?: true;
123
+ } ? SearchOnlyControllerDefinitionWithoutProps<TController> : TDefinition extends {
124
+ listing: false;
125
+ search: false;
126
+ } ? InvalidControllerDefinition : never;
127
+ export type SubControllerDefinitionWithProps<TController extends Controller, TDefinition extends ControllerDefinitionOption | undefined, TProps> = TDefinition extends {
128
+ listing?: true;
129
+ search?: true;
130
+ } | undefined ? SearchAndListingControllerDefinitionWithProps<TController, TProps> : TDefinition extends {
131
+ listing?: true;
132
+ search?: false;
133
+ } ? ListingOnlyControllerDefinitionWithProps<TController, TProps> : TDefinition extends {
134
+ listing?: false;
135
+ search?: true;
136
+ } ? SearchOnlyControllerDefinitionWithProps<TController, TProps> : TDefinition extends {
137
+ listing: false;
138
+ search: false;
139
+ } ? InvalidControllerDefinition : never;
@@ -37,6 +37,12 @@ export interface SearchOnlyController {
37
37
  */
38
38
  [SolutionType.search]: true;
39
39
  }
40
+ export interface ListingOnlyController {
41
+ /**
42
+ * @internal
43
+ */
44
+ [SolutionType.listing]: true;
45
+ }
40
46
  export interface RecommendationOnlyController {
41
47
  /**
42
48
  * @internal
@@ -1,3 +1,6 @@
1
+ export declare class InvalidControllerDefinition extends Error {
2
+ constructor();
3
+ }
1
4
  export declare class MissingControllerProps extends Error {
2
5
  constructor(controller: string);
3
6
  }