@coveo/headless 3.29.0-pre.48ec9ee539 → 3.29.0-pre.4c98ddef9f
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/case-assist/headless.cjs +1 -1
- package/dist/cjs/commerce/headless.cjs +1 -1
- package/dist/cjs/headless.cjs +1 -1
- package/dist/cjs/insight/headless.cjs +1 -1
- package/dist/cjs/recommendation/headless.cjs +1 -1
- package/dist/cjs/ssr/headless.cjs +1 -1
- package/dist/cjs/ssr-commerce/headless.cjs +1 -1
- package/dist/cjs/ssr-commerce-next/headless.cjs +1 -1
- package/dist/cjs/ssr-next/headless.cjs +1 -1
- package/dist/definitions/ssr-next/commerce/controller-utils.d.ts +5 -7
- package/dist/definitions/ssr-next/commerce/controllers/recommendations/headless-recommendations.ssr.d.ts +4 -8
- package/dist/definitions/ssr-next/commerce/factories/build-factory.d.ts +4 -5
- package/dist/definitions/ssr-next/commerce/factories/hydrated-state-factory.d.ts +2 -6
- package/dist/definitions/ssr-next/commerce/factories/recommendation-hydrated-state-factory.d.ts +1 -3
- package/dist/definitions/ssr-next/commerce/factories/recommendation-static-state-factory.d.ts +2 -12
- package/dist/definitions/ssr-next/commerce/factories/static-state-factory.d.ts +2 -7
- package/dist/definitions/ssr-next/commerce/types/build.d.ts +16 -51
- package/dist/definitions/ssr-next/commerce/types/controller-definitions.d.ts +119 -4
- package/dist/definitions/ssr-next/commerce/types/controller-inference.d.ts +3 -3
- package/dist/definitions/ssr-next/commerce/types/engine.d.ts +10 -8
- package/dist/definitions/ssr-next/commerce/types/fetch-static-state.d.ts +1 -1
- package/dist/definitions/ssr-next/commerce/types/hydrate-static-state.d.ts +1 -2
- package/dist/definitions/ssr-next/commerce/utils/controller-wiring.d.ts +2 -29
- package/dist/definitions/ssr-next/commerce/utils/engine-wiring.d.ts +1 -1
- package/dist/definitions/ssr-next/commerce/utils/recommendation-filter.d.ts +2 -15
- package/dist/definitions/ssr-next/common/types/utilities.d.ts +3 -0
- package/dist/definitions/test/mock-ssr-controller-definitions.d.ts +0 -12
- package/dist/esm/ssr-next/commerce/controllers/recommendations/headless-recommendations.ssr.js +1 -1
- package/dist/esm/ssr-next/commerce/factories/build-factory.js +11 -12
- package/dist/esm/ssr-next/commerce/factories/hydrated-state-factory.js +6 -1
- package/dist/esm/ssr-next/commerce/factories/recommendation-hydrated-state-factory.js +6 -1
- package/dist/esm/ssr-next/commerce/factories/recommendation-static-state-factory.js +11 -7
- package/dist/esm/ssr-next/commerce/factories/static-state-factory.js +1 -4
- package/dist/esm/ssr-next/commerce/utils/controller-wiring.js +3 -152
- package/dist/esm/ssr-next/commerce/utils/engine-wiring.js +3 -9
- package/dist/esm/ssr-next/commerce/utils/recommendation-filter.js +8 -27
- package/dist/esm/test/mock-ssr-controller-definitions.js +0 -15
- package/dist/esm/utils/version.js +1 -1
- package/dist/quantic/case-assist/headless.js +1 -1
- package/dist/quantic/commerce/headless.js +1 -1
- package/dist/quantic/headless.js +1 -1
- package/dist/quantic/insight/headless.js +1 -1
- package/dist/quantic/recommendation/headless.js +1 -1
- package/package.json +1 -1
|
@@ -800,7 +800,7 @@ var import_bueno5 = require("@coveo/bueno");
|
|
|
800
800
|
var import_toolkit7 = require("@reduxjs/toolkit");
|
|
801
801
|
|
|
802
802
|
// src/utils/version.ts
|
|
803
|
-
var VERSION = "3.29.0-pre.
|
|
803
|
+
var VERSION = "3.29.0-pre.4c98ddef9f";
|
|
804
804
|
var COVEO_FRAMEWORK = ["@coveo/atomic", "@coveo/quantic"];
|
|
805
805
|
|
|
806
806
|
// src/features/configuration/configuration-actions.ts
|
|
@@ -1149,7 +1149,7 @@ var import_bueno6 = require("@coveo/bueno");
|
|
|
1149
1149
|
var import_toolkit4 = require("@reduxjs/toolkit");
|
|
1150
1150
|
|
|
1151
1151
|
// src/utils/version.ts
|
|
1152
|
-
var VERSION = "3.29.0-pre.
|
|
1152
|
+
var VERSION = "3.29.0-pre.4c98ddef9f";
|
|
1153
1153
|
var COVEO_FRAMEWORK = ["@coveo/atomic", "@coveo/quantic"];
|
|
1154
1154
|
|
|
1155
1155
|
// src/features/configuration/configuration-actions.ts
|
package/dist/cjs/headless.cjs
CHANGED
|
@@ -1374,7 +1374,7 @@ var import_toolkit2 = require("@reduxjs/toolkit");
|
|
|
1374
1374
|
var import_toolkit = require("@reduxjs/toolkit");
|
|
1375
1375
|
|
|
1376
1376
|
// src/utils/version.ts
|
|
1377
|
-
var VERSION = "3.29.0-pre.
|
|
1377
|
+
var VERSION = "3.29.0-pre.4c98ddef9f";
|
|
1378
1378
|
var COVEO_FRAMEWORK = ["@coveo/atomic", "@coveo/quantic"];
|
|
1379
1379
|
|
|
1380
1380
|
// src/api/analytics/analytics-selectors.ts
|
|
@@ -1278,7 +1278,7 @@ var import_toolkit2 = require("@reduxjs/toolkit");
|
|
|
1278
1278
|
var import_toolkit = require("@reduxjs/toolkit");
|
|
1279
1279
|
|
|
1280
1280
|
// src/utils/version.ts
|
|
1281
|
-
var VERSION = "3.29.0-pre.
|
|
1281
|
+
var VERSION = "3.29.0-pre.4c98ddef9f";
|
|
1282
1282
|
var COVEO_FRAMEWORK = ["@coveo/atomic", "@coveo/quantic"];
|
|
1283
1283
|
|
|
1284
1284
|
// src/api/analytics/analytics-selectors.ts
|
|
@@ -881,7 +881,7 @@ var validateObject = (engine, schema, obj, validationMessage, errorMessage) => {
|
|
|
881
881
|
};
|
|
882
882
|
|
|
883
883
|
// src/utils/version.ts
|
|
884
|
-
var VERSION = "3.29.0-pre.
|
|
884
|
+
var VERSION = "3.29.0-pre.4c98ddef9f";
|
|
885
885
|
var COVEO_FRAMEWORK = ["@coveo/atomic", "@coveo/quantic"];
|
|
886
886
|
|
|
887
887
|
// src/features/configuration/configuration-actions.ts
|
|
@@ -1306,7 +1306,7 @@ var import_toolkit2 = require("@reduxjs/toolkit");
|
|
|
1306
1306
|
var import_toolkit = require("@reduxjs/toolkit");
|
|
1307
1307
|
|
|
1308
1308
|
// src/utils/version.ts
|
|
1309
|
-
var VERSION = "3.29.0-pre.
|
|
1309
|
+
var VERSION = "3.29.0-pre.4c98ddef9f";
|
|
1310
1310
|
var COVEO_FRAMEWORK = ["@coveo/atomic", "@coveo/quantic"];
|
|
1311
1311
|
|
|
1312
1312
|
// src/api/analytics/analytics-selectors.ts
|
|
@@ -468,7 +468,7 @@ var import_bueno8 = require("@coveo/bueno");
|
|
|
468
468
|
var import_toolkit3 = require("@reduxjs/toolkit");
|
|
469
469
|
|
|
470
470
|
// src/utils/version.ts
|
|
471
|
-
var VERSION = "3.29.0-pre.
|
|
471
|
+
var VERSION = "3.29.0-pre.4c98ddef9f";
|
|
472
472
|
var COVEO_FRAMEWORK = ["@coveo/atomic", "@coveo/quantic"];
|
|
473
473
|
|
|
474
474
|
// src/features/configuration/configuration-actions.ts
|
|
@@ -468,7 +468,7 @@ var import_bueno8 = require("@coveo/bueno");
|
|
|
468
468
|
var import_toolkit3 = require("@reduxjs/toolkit");
|
|
469
469
|
|
|
470
470
|
// src/utils/version.ts
|
|
471
|
-
var VERSION = "3.29.0-pre.
|
|
471
|
+
var VERSION = "3.29.0-pre.4c98ddef9f";
|
|
472
472
|
var COVEO_FRAMEWORK = ["@coveo/atomic", "@coveo/quantic"];
|
|
473
473
|
|
|
474
474
|
// src/features/configuration/configuration-actions.ts
|
|
@@ -1306,7 +1306,7 @@ var import_toolkit2 = require("@reduxjs/toolkit");
|
|
|
1306
1306
|
var import_toolkit = require("@reduxjs/toolkit");
|
|
1307
1307
|
|
|
1308
1308
|
// src/utils/version.ts
|
|
1309
|
-
var VERSION = "3.29.0-pre.
|
|
1309
|
+
var VERSION = "3.29.0-pre.4c98ddef9f";
|
|
1310
1310
|
var COVEO_FRAMEWORK = ["@coveo/atomic", "@coveo/quantic"];
|
|
1311
1311
|
|
|
1312
1312
|
// src/api/analytics/analytics-selectors.ts
|
|
@@ -2,15 +2,13 @@ import type { UnknownAction } from '@reduxjs/toolkit';
|
|
|
2
2
|
import type { Controller } from '../../controllers/controller/headless-controller.js';
|
|
3
3
|
import type { SSRCommerceEngine } from './factories/build-factory.js';
|
|
4
4
|
import type { SolutionType } from './types/controller-constants.js';
|
|
5
|
-
import type { ControllerDefinitionOption, ControllerDefinitionsMap
|
|
5
|
+
import type { ControllerDefinitionOption, ControllerDefinitionsMap } from './types/controller-definitions.js';
|
|
6
6
|
import type { InferControllerPropsMapFromDefinitions, InferControllerStaticStateMapFromDefinitionsWithSolutionType, InferControllersMapFromDefinition } from './types/controller-inference.js';
|
|
7
|
-
|
|
7
|
+
import type { EngineStaticState } from './types/engine.js';
|
|
8
|
+
export declare function createStaticState<TSearchAction extends UnknownAction, TControllerDefinitions extends ControllerDefinitionsMap<Controller>>({ searchActions, controllers, }: {
|
|
8
9
|
searchActions: TSearchAction[];
|
|
9
|
-
controllers:
|
|
10
|
-
}):
|
|
11
|
-
controllers: InferControllerStaticStateMapFromDefinitionsWithSolutionType<TControllerDefinitions, TSolutionType> & FilteredBakedInControllers<TSolutionType>;
|
|
12
|
-
searchActions: TSearchAction[];
|
|
13
|
-
};
|
|
10
|
+
controllers: InferControllersMapFromDefinition<TControllerDefinitions, SolutionType>;
|
|
11
|
+
}): EngineStaticState<TSearchAction, InferControllerStaticStateMapFromDefinitionsWithSolutionType<TControllerDefinitions, SolutionType>>;
|
|
14
12
|
export declare function buildControllerDefinitions<TControllerDefinitionsMap extends ControllerDefinitionsMap<Controller>, TSolutionType extends SolutionType>({ definitionsMap, engine, solutionType, propsMap, }: {
|
|
15
13
|
definitionsMap: TControllerDefinitionsMap;
|
|
16
14
|
engine: SSRCommerceEngine;
|
|
@@ -1,13 +1,11 @@
|
|
|
1
|
-
import { type Recommendations, type RecommendationsOptions, type RecommendationsState } from '../../../../controllers/commerce/recommendations/headless-recommendations.js';
|
|
1
|
+
import { type Recommendations, type RecommendationsOptions, type RecommendationsProps, type RecommendationsState } from '../../../../controllers/commerce/recommendations/headless-recommendations.js';
|
|
2
2
|
import { recommendationInternalOptionKey } from '../../types/controller-constants.js';
|
|
3
3
|
import type { RecommendationOnlyControllerDefinitionWithProps } from '../../types/controller-definitions.js';
|
|
4
4
|
export type { Recommendations, RecommendationsState };
|
|
5
5
|
export type RecommendationsDefinitionMeta = {
|
|
6
|
-
[recommendationInternalOptionKey]: {} &
|
|
6
|
+
[recommendationInternalOptionKey]: {} & RecommendationsProps['options'];
|
|
7
7
|
};
|
|
8
|
-
export interface RecommendationsDefinition extends RecommendationOnlyControllerDefinitionWithProps<Recommendations, {
|
|
9
|
-
initialState: Partial<RecommendationsOptions>;
|
|
10
|
-
}> {
|
|
8
|
+
export interface RecommendationsDefinition extends RecommendationOnlyControllerDefinitionWithProps<Recommendations, Partial<RecommendationsOptions>> {
|
|
11
9
|
}
|
|
12
10
|
/**
|
|
13
11
|
* Defines a `Recommendations` controller instance.
|
|
@@ -16,6 +14,4 @@ export interface RecommendationsDefinition extends RecommendationOnlyControllerD
|
|
|
16
14
|
* @param props - The configurable `Recommendations` properties.
|
|
17
15
|
* @returns The `Recommendations` controller definition.
|
|
18
16
|
* */
|
|
19
|
-
export declare function defineRecommendations(props:
|
|
20
|
-
options: Omit<RecommendationsOptions, 'productId'>;
|
|
21
|
-
}): RecommendationsDefinition & RecommendationsDefinitionMeta;
|
|
17
|
+
export declare function defineRecommendations(props: RecommendationsProps): RecommendationsDefinition & RecommendationsDefinitionMeta;
|
|
@@ -3,9 +3,8 @@ import { type CommerceEngine } from '../../../app/commerce-engine/commerce-engin
|
|
|
3
3
|
import type { Controller } from '../../../controllers/controller/headless-controller.js';
|
|
4
4
|
import type { SSRCommerceEngineOptions } from '../types/build.js';
|
|
5
5
|
import { SolutionType } from '../types/controller-constants.js';
|
|
6
|
-
import type {
|
|
7
|
-
import type {
|
|
8
|
-
import type { CommerceControllerDefinitionsMap, EngineDefinitionOptions, FetchStaticStateParameters, HydrateStaticStateParameters } from '../types/engine.js';
|
|
6
|
+
import type { ControllerDefinitionsMap } from '../types/controller-definitions.js';
|
|
7
|
+
import type { BuildParameters, CommerceControllerDefinitionsMap, EngineDefinitionOptions } from '../types/engine.js';
|
|
9
8
|
/**
|
|
10
9
|
* The SSR commerce engine.
|
|
11
10
|
*
|
|
@@ -18,7 +17,7 @@ export interface SSRCommerceEngine extends CommerceEngine {
|
|
|
18
17
|
waitForRequestCompletedAction(): Promise<Action>[];
|
|
19
18
|
}
|
|
20
19
|
export type CommerceEngineDefinitionOptions<TControllers extends ControllerDefinitionsMap<Controller> = ControllerDefinitionsMap<Controller>> = EngineDefinitionOptions<SSRCommerceEngineOptions, TControllers>;
|
|
21
|
-
export declare const buildFactory: <TControllerDefinitions extends CommerceControllerDefinitionsMap>(controllerDefinitions:
|
|
20
|
+
export declare const buildFactory: <TControllerDefinitions extends CommerceControllerDefinitionsMap>(controllerDefinitions: TControllerDefinitions, options: CommerceEngineDefinitionOptions<TControllerDefinitions>) => <T extends SolutionType>(solutionType: T) => (...[buildOptions]: BuildParameters<TControllerDefinitions>) => Promise<{
|
|
22
21
|
engine: SSRCommerceEngine;
|
|
23
|
-
controllers: InferControllersMapFromDefinition<TControllerDefinitions,
|
|
22
|
+
controllers: import("../types/controller-inference.js").InferControllersMapFromDefinition<TControllerDefinitions, T>;
|
|
24
23
|
}>;
|
|
@@ -1,8 +1,4 @@
|
|
|
1
1
|
import type { SolutionType } from '../types/controller-constants.js';
|
|
2
|
-
import type {
|
|
3
|
-
import type { CommerceControllerDefinitionsMap, HydrateStaticStateParameters } from '../types/engine.js';
|
|
2
|
+
import type { CommerceControllerDefinitionsMap, HydrateStaticStateFunction } from '../types/engine.js';
|
|
4
3
|
import { type CommerceEngineDefinitionOptions } from './build-factory.js';
|
|
5
|
-
export declare function hydratedStaticStateFactory<TControllerDefinitions extends CommerceControllerDefinitionsMap>(controllerDefinitions:
|
|
6
|
-
engine: import("./build-factory.js").SSRCommerceEngine;
|
|
7
|
-
controllers: import("../types/controller-inference.js").InferControllersMapFromDefinition<TControllerDefinitions, TSolutionType> & import("../types/controller-definitions.js").BakedInControllers;
|
|
8
|
-
}>;
|
|
4
|
+
export declare function hydratedStaticStateFactory<TControllerDefinitions extends CommerceControllerDefinitionsMap>(controllerDefinitions: TControllerDefinitions, options: CommerceEngineDefinitionOptions<TControllerDefinitions>): (solutionType: SolutionType) => HydrateStaticStateFunction<TControllerDefinitions>;
|
package/dist/definitions/ssr-next/commerce/factories/recommendation-hydrated-state-factory.d.ts
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import { SolutionType } from '../types/controller-constants.js';
|
|
2
|
-
import type { AugmentedControllerDefinition } from '../types/controller-definitions.js';
|
|
3
1
|
import type { CommerceControllerDefinitionsMap, HydrateStaticStateFunction } from '../types/engine.js';
|
|
4
2
|
import { type CommerceEngineDefinitionOptions } from './build-factory.js';
|
|
5
|
-
export declare function hydratedRecommendationStaticStateFactory<TControllerDefinitions extends CommerceControllerDefinitionsMap>(controllerDefinitions:
|
|
3
|
+
export declare function hydratedRecommendationStaticStateFactory<TControllerDefinitions extends CommerceControllerDefinitionsMap>(controllerDefinitions: TControllerDefinitions, options: CommerceEngineDefinitionOptions<TControllerDefinitions>): HydrateStaticStateFunction<TControllerDefinitions>;
|
package/dist/definitions/ssr-next/commerce/factories/recommendation-static-state-factory.d.ts
CHANGED
|
@@ -1,14 +1,4 @@
|
|
|
1
|
-
import type { UnknownAction } from '@reduxjs/toolkit';
|
|
2
|
-
import { SolutionType } from '../types/controller-constants.js';
|
|
3
1
|
import type { AugmentedControllerDefinition } from '../types/controller-definitions.js';
|
|
4
|
-
import type { CommerceControllerDefinitionsMap,
|
|
2
|
+
import type { CommerceControllerDefinitionsMap, FetchStaticStateFunction } from '../types/engine.js';
|
|
5
3
|
import { type CommerceEngineDefinitionOptions } from './build-factory.js';
|
|
6
|
-
export declare function fetchRecommendationStaticStateFactory<TControllerDefinitions extends CommerceControllerDefinitionsMap>(controllerDefinitions: AugmentedControllerDefinition<TControllerDefinitions>, options: CommerceEngineDefinitionOptions<TControllerDefinitions>):
|
|
7
|
-
controllers: import("../types/controller-inference.js").InferControllerStaticStateMapFromDefinitionsWithSolutionType<TControllerDefinitions, SolutionType.recommendation> & import("../types/controller-definitions.js").FilteredBakedInControllers<SolutionType.recommendation>;
|
|
8
|
-
searchActions: UnknownAction[];
|
|
9
|
-
context: import("../../../commerce.index.js").ContextOptions;
|
|
10
|
-
searchParams?: import("../../../commerce.index.js").ParameterManagerState<import("../../../commerce.index.js").Parameters>["parameters"];
|
|
11
|
-
cart?: import("../../../commerce.index.js").CartInitialState;
|
|
12
|
-
productId?: string;
|
|
13
|
-
recommendations: Extract<keyof TControllerDefinitions, { [K in keyof TControllerDefinitions]: import("../../common/types/utilities.js").HasKey<TControllerDefinitions[K], SolutionType.recommendation> extends never ? never : import("../../common/types/utilities.js").HasKey<TControllerDefinitions[K], typeof import("../types/controller-constants.js").recommendationInternalOptionKey> extends never ? never : K; }[keyof TControllerDefinitions]>[];
|
|
14
|
-
}>;
|
|
4
|
+
export declare function fetchRecommendationStaticStateFactory<TControllerDefinitions extends CommerceControllerDefinitionsMap>(controllerDefinitions: AugmentedControllerDefinition<TControllerDefinitions>, options: CommerceEngineDefinitionOptions<TControllerDefinitions>): FetchStaticStateFunction<TControllerDefinitions>;
|
|
@@ -1,10 +1,5 @@
|
|
|
1
|
-
import type { UnknownAction } from '@reduxjs/toolkit';
|
|
2
|
-
import type { BuildConfig } from '../types/build.js';
|
|
3
1
|
import { SolutionType } from '../types/controller-constants.js';
|
|
4
2
|
import type { AugmentedControllerDefinition } from '../types/controller-definitions.js';
|
|
5
|
-
import type { CommerceControllerDefinitionsMap,
|
|
3
|
+
import type { CommerceControllerDefinitionsMap, FetchStaticStateFunction } from '../types/engine.js';
|
|
6
4
|
import { type CommerceEngineDefinitionOptions } from './build-factory.js';
|
|
7
|
-
export declare function fetchStaticStateFactory<TControllerDefinitions extends CommerceControllerDefinitionsMap>(controllerDefinitions: AugmentedControllerDefinition<TControllerDefinitions>, options: CommerceEngineDefinitionOptions<TControllerDefinitions>):
|
|
8
|
-
controllers: import("../types/controller-inference.js").InferControllerStaticStateMapFromDefinitionsWithSolutionType<TControllerDefinitions, TSolutionType> & import("../types/controller-definitions.js").FilteredBakedInControllers<TSolutionType>;
|
|
9
|
-
searchActions: UnknownAction[];
|
|
10
|
-
}>;
|
|
5
|
+
export declare function fetchStaticStateFactory<TControllerDefinitions extends CommerceControllerDefinitionsMap>(controllerDefinitions: AugmentedControllerDefinition<TControllerDefinitions>, options: CommerceEngineDefinitionOptions<TControllerDefinitions>): (solutionType: SolutionType) => FetchStaticStateFunction<TControllerDefinitions>;
|
|
@@ -1,73 +1,38 @@
|
|
|
1
|
+
import type { CurrencyCodeISO4217 } from '@coveo/relay-event-types';
|
|
1
2
|
import type { CommerceEngineOptions } from '../../../app/commerce-engine/commerce-engine.js';
|
|
2
3
|
import type { Controller } from '../../../controllers/controller/headless-controller.js';
|
|
3
4
|
import type { ControllersMap, ControllersPropsMap } from '../../common/types/controllers.js';
|
|
4
|
-
import type {
|
|
5
|
+
import type { OptionsTuple } from '../../common/types/utilities.js';
|
|
5
6
|
import type { CartInitialState } from '../controllers/cart/headless-cart.ssr.js';
|
|
6
|
-
import type {
|
|
7
|
+
import type { UserLocation } from '../controllers/context/headless-context.ssr.js';
|
|
7
8
|
import type { ParameterManagerState, Parameters } from '../controllers/parameter-manager/headless-core-parameter-manager.ssr.js';
|
|
8
9
|
import type { SolutionType } from './controller-constants.js';
|
|
9
|
-
import type { ControllerDefinitionsMap, EngineDefinitionControllersPropsOption
|
|
10
|
+
import type { ControllerDefinitionsMap, EngineDefinitionControllersPropsOption } from './controller-definitions.js';
|
|
10
11
|
import type { CommerceEngineDefinitionBuildResult } from './engine.js';
|
|
11
12
|
export interface SearchBuildConfig extends CommonBuildConfig {
|
|
12
13
|
searchParams: ParameterManagerState<Parameters & {
|
|
13
14
|
query: string;
|
|
14
15
|
}>['parameters'];
|
|
15
16
|
}
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
* The `recommendations` property is a string array containing the names of the recommendation controllers
|
|
20
|
-
* that were defined in your engine definition. This allows you to specify which recommendation controllers
|
|
21
|
-
* should be included in the SSR request.
|
|
22
|
-
*
|
|
23
|
-
* For example, on a storefront homepage, it might make sense to display a carousel of popular products.
|
|
24
|
-
* However, showing recommendations based on items frequently bought together may not be relevant in that context and should not be retrieved unnecessarily.
|
|
25
|
-
*
|
|
26
|
-
* @example
|
|
27
|
-
* Given the following engine definition:
|
|
28
|
-
*
|
|
29
|
-
* ```ts
|
|
30
|
-
* const {recommendationEngineDefinition} = defineCommerceEngine({
|
|
31
|
-
* controllers: {
|
|
32
|
-
* popularProducts: defineRecommendations({options: {slotId: '...'}}),
|
|
33
|
-
* frequentlyBought: defineRecommendations({options: {slotId: '...'}}),
|
|
34
|
-
* // ...other controllers
|
|
35
|
-
* },
|
|
36
|
-
* });
|
|
37
|
-
*
|
|
38
|
-
* // When fetching static state for recommendations:
|
|
39
|
-
* const staticState = await recommendationEngineDefinition.fetchStaticState({
|
|
40
|
-
* recommendations: ['popularProducts'],
|
|
41
|
-
* // ...other config
|
|
42
|
-
* });
|
|
43
|
-
* ```
|
|
44
|
-
*
|
|
45
|
-
* In this example, only the `popularProducts` recommendation controller will be included in the SSR request.
|
|
46
|
-
*/
|
|
47
|
-
export type RecommendationBuildConfig<TControllers extends ControllerDefinitionsMap<Controller>> = CommonBuildConfig & {
|
|
48
|
-
/**
|
|
49
|
-
* The unique identifier of the product to use for seeded recommendations.
|
|
50
|
-
*/
|
|
51
|
-
productId?: string;
|
|
52
|
-
/**
|
|
53
|
-
* An array of recommendation controller names from your engine definition to include in the SSR request.
|
|
54
|
-
* Each name corresponds to the key used when defining recommendation controllers in your engine definition.
|
|
55
|
-
* If not specified, no recommendation requests will be executed.
|
|
56
|
-
*/
|
|
57
|
-
recommendations: Array<Extract<keyof TControllers, {
|
|
58
|
-
[K in keyof TControllers]: HasKey<TControllers[K], SolutionType.recommendation> extends never ? never : IsRecommendationController<TControllers[K]> extends never ? never : K;
|
|
59
|
-
}[keyof TControllers]>>;
|
|
60
|
-
};
|
|
17
|
+
export interface RecommendationBuildConfig extends CommonBuildConfig {
|
|
18
|
+
recommendations?: [];
|
|
19
|
+
}
|
|
61
20
|
export interface ListingBuildConfig extends CommonBuildConfig {
|
|
62
21
|
}
|
|
63
22
|
export interface StandaloneBuildConfig extends CommonBuildConfig {
|
|
64
23
|
}
|
|
65
24
|
export interface CommonBuildConfig {
|
|
66
|
-
context:
|
|
25
|
+
context: {
|
|
26
|
+
url: string;
|
|
27
|
+
language: string;
|
|
28
|
+
country: string;
|
|
29
|
+
currency: CurrencyCodeISO4217;
|
|
30
|
+
location?: UserLocation;
|
|
31
|
+
};
|
|
67
32
|
searchParams?: ParameterManagerState<Parameters>['parameters'];
|
|
68
33
|
cart?: CartInitialState;
|
|
69
34
|
}
|
|
70
|
-
export type BuildConfig<
|
|
35
|
+
export type BuildConfig<TSolutionType extends SolutionType> = TSolutionType extends SolutionType.search ? SearchBuildConfig : TSolutionType extends SolutionType.listing ? ListingBuildConfig : TSolutionType extends SolutionType.recommendation ? RecommendationBuildConfig : TSolutionType extends SolutionType.standalone ? CommonBuildConfig : never;
|
|
71
36
|
/**
|
|
72
37
|
* Commerce engine options for SSR scenarios where context is defined when fetching static state.
|
|
73
38
|
*/
|
|
@@ -77,4 +42,4 @@ export type SSRCommerceEngineOptions = Omit<CommerceEngineOptions, 'configuratio
|
|
|
77
42
|
/**
|
|
78
43
|
* @internal
|
|
79
44
|
*/
|
|
80
|
-
export type Build<TControllersMap extends ControllersMap, TControllersProps extends ControllersPropsMap, TControllersDefinitionsMap extends ControllerDefinitionsMap<Controller>, TSolutionType extends SolutionType> = (...params: OptionsTuple<BuildConfig<
|
|
45
|
+
export type Build<TControllersMap extends ControllersMap, TControllersProps extends ControllersPropsMap, TControllersDefinitionsMap extends ControllerDefinitionsMap<Controller>, TSolutionType extends SolutionType> = (...params: OptionsTuple<BuildConfig<TSolutionType> & EngineDefinitionControllersPropsOption<TControllersDefinitionsMap, TControllersProps, TSolutionType>>) => Promise<CommerceEngineDefinitionBuildResult<TControllersMap>>;
|
|
@@ -3,7 +3,7 @@ import type { InvalidControllerDefinition } from '../../common/errors.js';
|
|
|
3
3
|
import type { ControllersPropsMap } from '../../common/types/controllers.js';
|
|
4
4
|
import type { HydratedState } from '../../common/types/hydrate-static-state.js';
|
|
5
5
|
import type { InferControllerStaticStateFromController, InferControllerStaticStateMapFromControllers } from '../../common/types/inference.js';
|
|
6
|
-
import type { HasKey, HasRequiredKeys, OptionsTuple } from '../../common/types/utilities.js';
|
|
6
|
+
import type { HasKey, HasOptionalKeys, HasRequiredKeys, OptionsTuple } from '../../common/types/utilities.js';
|
|
7
7
|
import type { CartDefinition } from '../controllers/cart/headless-cart.ssr.js';
|
|
8
8
|
import type { ContextDefinition } from '../controllers/context/headless-context.ssr.js';
|
|
9
9
|
import type { ParameterManagerDefinition } from '../controllers/parameter-manager/headless-core-parameter-manager.ssr.js';
|
|
@@ -13,6 +13,15 @@ import type { ListingAndStandaloneController, ListingOnlyController, NonRecommen
|
|
|
13
13
|
import type { Kind } from './kind.js';
|
|
14
14
|
import type { HasSolutionType } from './utilities.js';
|
|
15
15
|
export type { HydratedState, OptionsTuple, InferControllerStaticStateFromController, InferControllerStaticStateMapFromControllers, };
|
|
16
|
+
export type RecommendationControllerSettings = {
|
|
17
|
+
/**
|
|
18
|
+
* Toggle to enable or disable the recommendation controller.
|
|
19
|
+
* When set to `true`, the controller will perform a recommendation request server-side.
|
|
20
|
+
*
|
|
21
|
+
* @default false
|
|
22
|
+
*/
|
|
23
|
+
enabled?: boolean;
|
|
24
|
+
};
|
|
16
25
|
export interface ControllerDefinitionWithoutProps<TController extends Controller> {
|
|
17
26
|
/**
|
|
18
27
|
* Creates an instance of the given controller.
|
|
@@ -85,14 +94,120 @@ export type AugmentedControllerDefinition<TControllerDefinitions extends Control
|
|
|
85
94
|
/**
|
|
86
95
|
* This type defines the required and optional controller props for the engine definition.
|
|
87
96
|
*/
|
|
88
|
-
export type EngineDefinitionControllersPropsOption<TControllers extends ControllerDefinitionsMap<Controller>, TControllersPropsMap extends ControllersPropsMap, TSolutionType extends SolutionType> = RequiredEngineDefinitionControllersPropsOption<TControllers, TControllersPropsMap, TSolutionType>;
|
|
97
|
+
export type EngineDefinitionControllersPropsOption<TControllers extends ControllerDefinitionsMap<Controller>, TControllersPropsMap extends ControllersPropsMap, TSolutionType extends SolutionType> = OptionalEngineDefinitionControllersPropsOption<TControllers, TControllersPropsMap, TSolutionType> & RequiredEngineDefinitionControllersPropsOption<TControllers, TControllersPropsMap, TSolutionType>;
|
|
98
|
+
/**
|
|
99
|
+
* Represents an optional engine definition for controller properties.
|
|
100
|
+
*
|
|
101
|
+
* This type is used to define a map of optional controller properties based on the provided
|
|
102
|
+
* controller definitions, controller properties map, and solution type.
|
|
103
|
+
*
|
|
104
|
+
* @template TControllers - A map of controller definitions.
|
|
105
|
+
* @template TControllersPropsMap - A map of controller properties.
|
|
106
|
+
* @template TSolutionType - The type of solution.
|
|
107
|
+
*
|
|
108
|
+
* The type iterates over the controller keys (defined in the engine definition) and includes only those keys where:
|
|
109
|
+
* 1. The controller can be used for a specific solution type (HasKey<TControllers[K], TSolutionType> is not 'never').
|
|
110
|
+
* 2. The controller properties have optional options (HasOptionalKeys<ConditionalControllerProps<...>> is true).
|
|
111
|
+
*
|
|
112
|
+
* @example
|
|
113
|
+
* Given the following controller definitions:
|
|
114
|
+
* ```
|
|
115
|
+
* const {recommendationEngineDefinition} = defineCommerceEngine({
|
|
116
|
+
* controllers: {
|
|
117
|
+
* popularViewed: defineRecommendations({
|
|
118
|
+
* options: {slotId: 'slot-id'}
|
|
119
|
+
* })
|
|
120
|
+
* }
|
|
121
|
+
* });
|
|
122
|
+
* ```
|
|
123
|
+
*
|
|
124
|
+
* The following code will not throw an error since the 'popularViewed' controller props are optional
|
|
125
|
+
* ```
|
|
126
|
+
* recommendationEngineDefinition.fetchStaticState({
|
|
127
|
+
* controllers: {
|
|
128
|
+
* popularViewed: {enabled: true, productId: 'some-product-id'} // This is optional
|
|
129
|
+
* }
|
|
130
|
+
* })
|
|
131
|
+
* ```
|
|
132
|
+
*
|
|
133
|
+
* The following code (with no arguments) is also valid because the 'popularViewed' controller props are optional, and there are no other required controller props in the engine definition.
|
|
134
|
+
* ```
|
|
135
|
+
* recommendationEngineDefinition.fetchStaticState()
|
|
136
|
+
* ```
|
|
137
|
+
*/
|
|
138
|
+
type OptionalEngineDefinitionControllersPropsOption<TControllers extends ControllerDefinitionsMap<Controller>, TControllersPropsMap extends ControllersPropsMap, TSolutionType extends SolutionType> = {
|
|
139
|
+
[K in keyof TControllers as HasKey<TControllers[K], TSolutionType> extends never ? never : HasOptionalKeys<ConditionalControllerProps<TControllers, TControllersPropsMap, TSolutionType, K>> extends false ? never : 'controllers']?: ConditionalControllerProps<TControllers, TControllersPropsMap, TSolutionType, K>;
|
|
140
|
+
};
|
|
141
|
+
/**
|
|
142
|
+
* Represents a type that defines the required controller properties for engine definition controllers.
|
|
143
|
+
*
|
|
144
|
+
* @template TControllers - A map of controller definitions.
|
|
145
|
+
* @template TControllersPropsMap - A map of controller properties.
|
|
146
|
+
* @template TSolutionType - The type of solution being used.
|
|
147
|
+
*
|
|
148
|
+
* The type iterates over the controller keys (defined in the engine definition) and includes only those keys where:
|
|
149
|
+
* 1. The controller can be used for a specific solution type (HasKey<TControllers[K], TSolutionType> is not 'never').
|
|
150
|
+
* 2. The controller properties have required options (HasRequiredKeys<ConditionalControllerProps<...>> is true).
|
|
151
|
+
*
|
|
152
|
+
* The resulting type maps the valid keys to their corresponding conditional controller properties.
|
|
153
|
+
*
|
|
154
|
+
* @example
|
|
155
|
+
* Given the following controller definitions:
|
|
156
|
+
* ```
|
|
157
|
+
* const {standaloneEngineDefinition} = defineCommerceEngine({
|
|
158
|
+
* controllers: {cart: defineCart()},
|
|
159
|
+
* });
|
|
160
|
+
* ```
|
|
161
|
+
*
|
|
162
|
+
* The following code will not throw an error since the 'cart' controller props are required for the standalone engine definition:
|
|
163
|
+
* ```
|
|
164
|
+
* standaloneEngineDefinition.fetchStaticState({
|
|
165
|
+
* controllers: {
|
|
166
|
+
* cart: {initialState: {items: []}},
|
|
167
|
+
* },
|
|
168
|
+
* })
|
|
169
|
+
* ```
|
|
170
|
+
*
|
|
171
|
+
*/
|
|
89
172
|
type RequiredEngineDefinitionControllersPropsOption<TControllers extends ControllerDefinitionsMap<Controller>, TControllersPropsMap extends ControllersPropsMap, TSolutionType extends SolutionType> = {
|
|
90
|
-
[K in keyof TControllers as HasKey<TControllers[K], TSolutionType> extends never ? never :
|
|
173
|
+
[K in keyof TControllers as HasKey<TControllers[K], TSolutionType> extends never ? never : HasRequiredKeys<ConditionalControllerProps<TControllers, TControllersPropsMap, TSolutionType, K>> extends false ? never : 'controllers']: ConditionalControllerProps<TControllers, TControllersPropsMap, TSolutionType, K>;
|
|
174
|
+
};
|
|
175
|
+
type IsRecommendationController<TController extends ControllerDefinition<Controller>> = HasKey<TController, typeof recommendationInternalOptionKey>;
|
|
176
|
+
/**
|
|
177
|
+
* This type ensures that recommendation controller props are optional, while other controller props remain required.
|
|
178
|
+
*
|
|
179
|
+
* It works by checking if the controller definition includes the `recommendationInternalOptionKey`.
|
|
180
|
+
*
|
|
181
|
+
* - If the key is present, the controller props are made optional.
|
|
182
|
+
* - If the key is absent, the controller props are required.
|
|
183
|
+
*
|
|
184
|
+
* Example:
|
|
185
|
+
*
|
|
186
|
+
* ```typescript
|
|
187
|
+
* type ControllerProps = InferControllerPropsFromDefinition<{
|
|
188
|
+
* recommendation: defineRecommendation({}),
|
|
189
|
+
* cart: defineCart(),
|
|
190
|
+
* }>;
|
|
191
|
+
*
|
|
192
|
+
* // In this example:
|
|
193
|
+
* // - The `recommendation` controller props are optional.
|
|
194
|
+
* // - The `cart` controller props are required.
|
|
195
|
+
*
|
|
196
|
+
* const props: ControllerProps = {
|
|
197
|
+
* cart: {initialState: {items: []}},
|
|
198
|
+
* // recommendation props can be omitted
|
|
199
|
+
* };
|
|
200
|
+
* ```
|
|
201
|
+
*/
|
|
202
|
+
type RecommendationControllerProps<TControllers extends ControllerDefinitionsMap<Controller>, TControllersPropsMap extends ControllersPropsMap, K extends keyof TControllers> = {
|
|
203
|
+
[I in keyof TControllersPropsMap as I extends K ? IsRecommendationController<TControllers[I]> extends never ? never : I : never]?: TControllersPropsMap[I];
|
|
204
|
+
} & {
|
|
205
|
+
[I in keyof TControllersPropsMap as I extends K ? IsRecommendationController<TControllers[I]> extends never ? I : never : never]: TControllersPropsMap[I];
|
|
91
206
|
};
|
|
92
|
-
export type IsRecommendationController<TController extends ControllerDefinition<Controller>> = HasKey<TController, typeof recommendationInternalOptionKey>;
|
|
93
207
|
type DefaultControllerProps<TControllers extends ControllerDefinitionsMap<Controller>, TControllersPropsMap extends ControllersPropsMap, K extends keyof TControllers> = {
|
|
94
208
|
[I in keyof TControllersPropsMap as I extends K ? I : never]: TControllersPropsMap[I];
|
|
95
209
|
};
|
|
210
|
+
type ConditionalControllerProps<TControllers extends ControllerDefinitionsMap<Controller>, TControllersPropsMap extends ControllersPropsMap, TSolutionType extends SolutionType, K extends keyof TControllers> = TSolutionType extends SolutionType.recommendation ? RecommendationControllerProps<TControllers, TControllersPropsMap, K> : DefaultControllerProps<TControllers, TControllersPropsMap, K>;
|
|
96
211
|
export interface ControllerDefinitionOption {
|
|
97
212
|
/**
|
|
98
213
|
* Whether the controller will be used in a product listing context.
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import type { Controller } from '../../../controllers/controller/headless-controller.js';
|
|
2
2
|
import type { HasKey, HasKeys } from '../../common/types/utilities.js';
|
|
3
|
-
import type { SolutionType } from './controller-constants.js';
|
|
4
|
-
import type { ControllerDefinition, ControllerDefinitionsMap, ControllerDefinitionWithoutProps, ControllerDefinitionWithProps, InferControllerStaticStateFromController } from './controller-definitions.js';
|
|
3
|
+
import type { recommendationInternalOptionKey, SolutionType } from './controller-constants.js';
|
|
4
|
+
import type { ControllerDefinition, ControllerDefinitionsMap, ControllerDefinitionWithoutProps, ControllerDefinitionWithProps, InferControllerStaticStateFromController, RecommendationControllerSettings } from './controller-definitions.js';
|
|
5
5
|
export type InferStaticState<T extends {
|
|
6
6
|
fetchStaticState(...args: unknown[]): Promise<unknown>;
|
|
7
7
|
}> = Awaited<ReturnType<T['fetchStaticState']>>;
|
|
8
8
|
export type InferHydratedState<T extends {
|
|
9
9
|
hydrateStaticState(...args: unknown[]): Promise<unknown>;
|
|
10
10
|
}> = Awaited<ReturnType<T['hydrateStaticState']>>;
|
|
11
|
-
type InferControllerPropsFromDefinition<TController extends ControllerDefinition<Controller>> = TController extends ControllerDefinitionWithProps<Controller, infer Props> ? Props : TController extends ControllerDefinitionWithoutProps<Controller> ? {} : unknown;
|
|
11
|
+
type InferControllerPropsFromDefinition<TController extends ControllerDefinition<Controller>> = TController extends ControllerDefinitionWithProps<Controller, infer Props> ? HasKey<TController, typeof recommendationInternalOptionKey> extends never ? Props : Props & RecommendationControllerSettings : TController extends ControllerDefinitionWithoutProps<Controller> ? HasKey<TController, typeof recommendationInternalOptionKey> extends never ? {} : RecommendationControllerSettings : unknown;
|
|
12
12
|
export type InferControllerPropsMapFromDefinitions<TControllers extends ControllerDefinitionsMap<Controller>> = {
|
|
13
13
|
[K in keyof TControllers as HasKeys<InferControllerPropsFromDefinition<TControllers[K]>> extends false ? never : K]: InferControllerPropsFromDefinition<TControllers[K]>;
|
|
14
14
|
};
|
|
@@ -4,6 +4,7 @@ import type { NavigatorContextProvider } from '../../../app/navigator-context-pr
|
|
|
4
4
|
import type { Controller } from '../../../controllers/controller/headless-controller.js';
|
|
5
5
|
import type { ControllerStaticStateMap, ControllersMap } from '../../common/types/controllers.js';
|
|
6
6
|
import type { SSRCommerceEngine } from '../factories/build-factory.js';
|
|
7
|
+
import type { Build } from './build.js';
|
|
7
8
|
import type { SolutionType } from './controller-constants.js';
|
|
8
9
|
import type { BakedInControllers, ControllerDefinitionsMap } from './controller-definitions.js';
|
|
9
10
|
import type { InferControllerPropsMapFromDefinitions, InferControllerStaticStateMapFromDefinitionsWithSolutionType, InferControllersMapFromDefinition } from './controller-inference.js';
|
|
@@ -57,13 +58,14 @@ export interface CommerceEngineDefinitionBuildResult<TControllers extends Contro
|
|
|
57
58
|
controllers: TControllers & BakedInControllers;
|
|
58
59
|
}
|
|
59
60
|
export type CommerceControllerDefinitionsMap = ControllerDefinitionsMap<Controller>;
|
|
60
|
-
type Definition<TControllerDefinitions extends CommerceControllerDefinitionsMap
|
|
61
|
-
export type FetchStaticStateFunction<TControllerDefinitions extends CommerceControllerDefinitionsMap
|
|
62
|
-
export type HydrateStaticStateFunction<TControllerDefinitions extends CommerceControllerDefinitionsMap
|
|
63
|
-
export type
|
|
64
|
-
export type
|
|
65
|
-
type
|
|
66
|
-
|
|
61
|
+
type Definition<TControllerDefinitions extends CommerceControllerDefinitionsMap> = CommerceEngineDefinition<TControllerDefinitions, SolutionType>;
|
|
62
|
+
export type FetchStaticStateFunction<TControllerDefinitions extends CommerceControllerDefinitionsMap> = Definition<TControllerDefinitions>['fetchStaticState'];
|
|
63
|
+
export type HydrateStaticStateFunction<TControllerDefinitions extends CommerceControllerDefinitionsMap> = Definition<TControllerDefinitions>['hydrateStaticState'];
|
|
64
|
+
export type BuildParameters<TControllerDefinitions extends CommerceControllerDefinitionsMap> = Parameters<Build<InferControllersMapFromDefinition<TControllerDefinitions, SolutionType>, InferControllerPropsMapFromDefinitions<TControllerDefinitions>, TControllerDefinitions, SolutionType>>;
|
|
65
|
+
export type FetchStaticStateParameters<TControllerDefinitions extends CommerceControllerDefinitionsMap> = Parameters<FetchStaticStateFunction<TControllerDefinitions>>;
|
|
66
|
+
export type HydrateStaticStateParameters<TControllerDefinitions extends CommerceControllerDefinitionsMap> = Parameters<HydrateStaticStateFunction<TControllerDefinitions>>;
|
|
67
|
+
type Controllers<TControllerDefinitions extends CommerceControllerDefinitionsMap> = InferControllersMapFromDefinition<TControllerDefinitions, SolutionType>;
|
|
68
|
+
export type BuildResult<TControllerDefinitions extends CommerceControllerDefinitionsMap> = {
|
|
67
69
|
engine: SSRCommerceEngine;
|
|
68
|
-
controllers: Controllers<TControllerDefinitions
|
|
70
|
+
controllers: Controllers<TControllerDefinitions> & BakedInControllers;
|
|
69
71
|
};
|
|
@@ -10,4 +10,4 @@ import type { EngineStaticState } from './engine.js';
|
|
|
10
10
|
*
|
|
11
11
|
* Useful for static generation and server-side rendering.
|
|
12
12
|
*/
|
|
13
|
-
export type FetchStaticState<TSearchAction extends UnknownAction, TControllersStaticState extends ControllerStaticStateMap, TControllersProps extends ControllersPropsMap, TControllersDefinitionsMap extends ControllerDefinitionsMap<Controller>, TSolutionType extends SolutionType> = (...params: OptionsTuple<BuildConfig<
|
|
13
|
+
export type FetchStaticState<TSearchAction extends UnknownAction, TControllersStaticState extends ControllerStaticStateMap, TControllersProps extends ControllersPropsMap, TControllersDefinitionsMap extends ControllerDefinitionsMap<Controller>, TSolutionType extends SolutionType> = (...params: OptionsTuple<BuildConfig<TSolutionType> & EngineDefinitionControllersPropsOption<TControllersDefinitionsMap, TControllersProps, TSolutionType>>) => Promise<EngineStaticState<TSearchAction, TControllersStaticState & FilteredBakedInControllers<TSolutionType>>>;
|
|
@@ -3,7 +3,6 @@ import type { Controller } from '../../../controllers/controller/headless-contro
|
|
|
3
3
|
import type { ControllersMap, ControllersPropsMap } from '../../common/types/controllers.js';
|
|
4
4
|
import type { HydratedState } from '../../common/types/hydrate-static-state.js';
|
|
5
5
|
import type { SSRCommerceEngine } from '../factories/build-factory.js';
|
|
6
|
-
import type { BuildConfig } from './build.js';
|
|
7
6
|
import type { SolutionType } from './controller-constants.js';
|
|
8
7
|
import type { ControllerDefinitionsMap, EngineDefinitionControllersPropsOption, OptionsTuple } from './controller-definitions.js';
|
|
9
8
|
export interface HydrateStaticStateOptions<TSearchAction> {
|
|
@@ -14,4 +13,4 @@ export interface HydrateStaticStateOptions<TSearchAction> {
|
|
|
14
13
|
*
|
|
15
14
|
* Useful when hydrating a server-side-rendered engine.
|
|
16
15
|
*/
|
|
17
|
-
export type HydrateStaticState<TControllers extends ControllersMap, TSearchAction extends UnknownAction, TControllersProps extends ControllersPropsMap, TControllersDefinitionsMap extends ControllerDefinitionsMap<Controller>, TSolutionType extends SolutionType> = (...params: OptionsTuple<HydrateStaticStateOptions<TSearchAction> &
|
|
16
|
+
export type HydrateStaticState<TControllers extends ControllersMap, TSearchAction extends UnknownAction, TControllersProps extends ControllersPropsMap, TControllersDefinitionsMap extends ControllerDefinitionsMap<Controller>, TSolutionType extends SolutionType> = (...params: OptionsTuple<HydrateStaticStateOptions<TSearchAction> & EngineDefinitionControllersPropsOption<TControllersDefinitionsMap, TControllersProps, TSolutionType>>) => Promise<HydratedState<SSRCommerceEngine, TControllers>>;
|
|
@@ -1,35 +1,8 @@
|
|
|
1
|
-
import { Schema } from '@coveo/bueno';
|
|
2
1
|
import type { ControllersPropsMap } from '../../common/types/controllers.js';
|
|
3
2
|
import type { BuildConfig } from '../types/build.js';
|
|
4
|
-
import { SolutionType } from '../types/controller-constants.js';
|
|
3
|
+
import type { SolutionType } from '../types/controller-constants.js';
|
|
5
4
|
import type { InferControllerPropsMapFromDefinitions } from '../types/controller-inference.js';
|
|
6
5
|
import type { CommerceControllerDefinitionsMap } from '../types/engine.js';
|
|
7
|
-
export declare
|
|
8
|
-
searchParams: unknown;
|
|
9
|
-
context: unknown;
|
|
10
|
-
}>;
|
|
11
|
-
export declare const searchDefinitionSchema: Schema<{
|
|
12
|
-
searchParams: unknown;
|
|
13
|
-
context: unknown;
|
|
14
|
-
}>;
|
|
15
|
-
export declare const standaloneDefinitionSchema: Schema<{
|
|
16
|
-
context: unknown;
|
|
17
|
-
}>;
|
|
18
|
-
export declare const recommendationsDefinitionSchema: (recommendationName: string[]) => Schema<{
|
|
19
|
-
recommendations: import("@coveo/bueno").PrimitivesValues[] | null | undefined;
|
|
20
|
-
productId: string;
|
|
21
|
-
context: unknown;
|
|
22
|
-
}>;
|
|
23
|
-
/**
|
|
24
|
-
* Converts simple user configuration (URL, language, currency, query) into the
|
|
25
|
-
* nested structure required by the internal {@link Build} method. Automatically generates
|
|
26
|
-
* appropriate controllers (context, cart, parameterManager) transparently.
|
|
27
|
-
*
|
|
28
|
-
* @param solutionType - The type of solution (search, listing, recommendation, standalone)
|
|
29
|
-
* @param controllerDefinitions - Map of controller definitions to be initialized
|
|
30
|
-
* @param buildConfig - Simple configuration object with simplified controller properties
|
|
31
|
-
* @returns Formatted and validated controller properties map defined for the controller in the definition
|
|
32
|
-
*/
|
|
33
|
-
export declare function wireControllerParams<TControllerDefinitions extends CommerceControllerDefinitionsMap>(solutionType: SolutionType, controllerDefinitions: TControllerDefinitions, buildConfig: BuildConfig<TControllerDefinitions, SolutionType> & {
|
|
6
|
+
export declare function wireControllerParams<TControllerDefinitions extends CommerceControllerDefinitionsMap>(_solutionType: SolutionType, _controllerDefinitions: TControllerDefinitions, _paramsObject: BuildConfig<SolutionType> & {
|
|
34
7
|
controllers?: ControllersPropsMap;
|
|
35
8
|
}): InferControllerPropsMapFromDefinitions<TControllerDefinitions>;
|
|
@@ -2,4 +2,4 @@ import type { CommerceEngineConfiguration } from '../../../app/commerce-engine/c
|
|
|
2
2
|
import type { CommerceEngineDefinitionOptions } from '../factories/build-factory.js';
|
|
3
3
|
import type { CommonBuildConfig } from '../types/build.js';
|
|
4
4
|
import type { CommerceControllerDefinitionsMap } from '../types/engine.js';
|
|
5
|
-
export declare function extendEngineConfiguration<TControllerDefinitions extends CommerceControllerDefinitionsMap>(
|
|
5
|
+
export declare function extendEngineConfiguration<TControllerDefinitions extends CommerceControllerDefinitionsMap>(_configuration: CommerceEngineDefinitionOptions<TControllerDefinitions>['configuration'], _commonBuildOptions: CommonBuildConfig): CommerceEngineConfiguration;
|