@coveo/headless 3.28.4-pre.c9b699efbb → 3.28.4-pre.cca67ebcc7
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-commerce-next.index.d.ts +1 -1
- package/dist/definitions/ssr-next/commerce/controller-utils.d.ts +6 -7
- package/dist/definitions/ssr-next/commerce/controllers/context/headless-context.ssr.d.ts +3 -1
- package/dist/definitions/ssr-next/commerce/controllers/parameter-manager/headless-core-parameter-manager.ssr.d.ts +2 -1
- package/dist/definitions/ssr-next/commerce/engine/commerce-engine.ssr.d.ts +3 -28
- package/dist/definitions/ssr-next/commerce/types/controller-inference.d.ts +3 -2
- package/dist/definitions/ssr-next/commerce/types/engine.d.ts +8 -0
- package/dist/definitions/ssr-next/commerce/types/fetch-static-state.d.ts +1 -22
- package/dist/definitions/ssr-next/common/builders/controller-builder.d.ts +17 -0
- package/dist/definitions/ssr-next/common/builders/static-controller-builder.d.ts +24 -0
- package/dist/definitions/ssr-next/common/controller-utils.d.ts +6 -6
- package/dist/definitions/ssr-next/common/types/controllers.d.ts +6 -0
- package/dist/definitions/ssr-next/common/types/engine.d.ts +8 -0
- package/dist/definitions/ssr-next/common/types/fetch-static-state.d.ts +1 -4
- package/dist/definitions/ssr-next/common/types/inference.d.ts +3 -2
- package/dist/definitions/ssr-next/search/engine/search-engine.ssr.d.ts +20 -18
- package/dist/definitions/test/mock-controller.d.ts +9 -0
- package/dist/definitions/test/mock-ssr-controller-definitions.d.ts +38 -0
- package/dist/esm/ssr-next/commerce/controller-utils.js +6 -18
- package/dist/esm/ssr-next/commerce/controllers/cart/headless-cart.ssr.js +3 -5
- package/dist/esm/ssr-next/commerce/controllers/context/headless-context.ssr.js +1 -1
- package/dist/esm/ssr-next/commerce/engine/commerce-engine.ssr.js +12 -32
- package/dist/esm/ssr-next/commerce/factories/static-state-factory.js +8 -17
- package/dist/esm/ssr-next/common/builders/controller-builder.js +38 -0
- package/dist/esm/ssr-next/common/builders/static-controller-builder.js +46 -0
- package/dist/esm/ssr-next/common/controller-utils.js +7 -13
- package/dist/esm/ssr-next/search/engine/search-engine.ssr.js +39 -49
- package/dist/esm/test/mock-controller.js +13 -0
- package/dist/esm/test/mock-ssr-controller-definitions.js +43 -0
- 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
- package/dist/definitions/ssr-next/common/navigator-context-utils.d.ts +0 -22
- package/dist/esm/ssr-next/common/navigator-context-utils.js +0 -28
|
@@ -18,49 +18,29 @@ import { SolutionType } from '../types/controller-constants.js';
|
|
|
18
18
|
*
|
|
19
19
|
* @example
|
|
20
20
|
* ```ts
|
|
21
|
-
* const
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
* const staticState = await listingEngineDefinition.fetchStaticState({
|
|
25
|
-
* navigatorContext: {
|
|
26
|
-
* forwardedFor: req.ip,
|
|
27
|
-
* referrer: req.headers.referer || null,
|
|
28
|
-
* userAgent: req.headers['user-agent'] || null,
|
|
29
|
-
* clientId: 'unique-session-id'
|
|
30
|
-
* }
|
|
31
|
-
* });
|
|
32
|
-
*
|
|
33
|
-
* // Framework examples:
|
|
34
|
-
* // Express.js
|
|
35
|
-
* app.get('/api/listing', async (req, res) => {
|
|
36
|
-
* const state = await listingEngineDefinition.fetchStaticState({
|
|
37
|
-
* navigatorContext: {
|
|
38
|
-
* forwardedFor: req.ip,
|
|
39
|
-
* referrer: req.headers.referer || null,
|
|
40
|
-
* userAgent: req.headers['user-agent'] || null,
|
|
41
|
-
* clientId: req.sessionID
|
|
42
|
-
* }
|
|
43
|
-
* });
|
|
44
|
-
* res.json(state);
|
|
45
|
-
* });
|
|
46
|
-
*
|
|
47
|
-
* type SearchStaticState = InferStaticState<typeof listingEngineDefinition>;
|
|
48
|
-
* type SearchHydratedState = InferHydratedState<typeof listingEngineDefinition>;
|
|
21
|
+
* const engineDefinition = defineCommerceEngine(engineConfig);
|
|
22
|
+
* type SearchStaticState = InferStaticState<typeof engineDefinition>;
|
|
23
|
+
* type SearchHydratedState = InferHydratedState<typeof engineDefinition>;
|
|
49
24
|
* ```
|
|
50
25
|
*
|
|
51
26
|
* @group Engine
|
|
52
27
|
*/
|
|
53
28
|
export function defineCommerceEngine(options) {
|
|
54
29
|
const { controllers: controllerDefinitions, ...engineOptions } = options;
|
|
30
|
+
const getOptions = () => engineOptions;
|
|
31
|
+
const setNavigatorContextProvider = (navigatorContextProvider) => {
|
|
32
|
+
engineOptions.navigatorContextProvider = navigatorContextProvider;
|
|
33
|
+
};
|
|
55
34
|
const getAccessToken = () => engineOptions.configuration.accessToken;
|
|
56
35
|
const setAccessToken = (accessToken) => {
|
|
57
36
|
engineOptions.configuration.accessToken = accessToken;
|
|
58
37
|
};
|
|
59
|
-
const fetchStaticState = fetchStaticStateFactory(controllerDefinitions,
|
|
60
|
-
const hydrateStaticState = hydratedStaticStateFactory(controllerDefinitions,
|
|
61
|
-
const fetchRecommendationStaticState = fetchRecommendationStaticStateFactory(controllerDefinitions,
|
|
62
|
-
const hydrateRecommendationStaticState = hydratedRecommendationStaticStateFactory(controllerDefinitions,
|
|
38
|
+
const fetchStaticState = fetchStaticStateFactory(controllerDefinitions, getOptions());
|
|
39
|
+
const hydrateStaticState = hydratedStaticStateFactory(controllerDefinitions, getOptions());
|
|
40
|
+
const fetchRecommendationStaticState = fetchRecommendationStaticStateFactory(controllerDefinitions, getOptions());
|
|
41
|
+
const hydrateRecommendationStaticState = hydratedRecommendationStaticStateFactory(controllerDefinitions, getOptions());
|
|
63
42
|
const commonMethods = {
|
|
43
|
+
setNavigatorContextProvider,
|
|
64
44
|
getAccessToken,
|
|
65
45
|
setAccessToken,
|
|
66
46
|
};
|
|
@@ -1,30 +1,21 @@
|
|
|
1
1
|
import { buildProductListing } from '../../../controllers/commerce/product-listing/headless-product-listing.js';
|
|
2
2
|
import { buildSearch } from '../../../controllers/commerce/search/headless-search.js';
|
|
3
3
|
import { augmentPreprocessRequestWithForwardedFor } from '../../common/augment-preprocess-request.js';
|
|
4
|
-
import { extractNavigatorContextProvider } from '../../common/navigator-context-utils.js';
|
|
5
4
|
import { createStaticState } from '../controller-utils.js';
|
|
6
5
|
import { SolutionType } from '../types/controller-constants.js';
|
|
7
6
|
import { buildFactory, } from './build-factory.js';
|
|
8
7
|
export function fetchStaticStateFactory(controllerDefinitions, options) {
|
|
9
8
|
return (solutionType) => async (...params) => {
|
|
10
|
-
const
|
|
11
|
-
// Create options for this call with navigator context
|
|
12
|
-
const callSpecificOptions = {
|
|
9
|
+
const solutionTypeBuild = await buildFactory(controllerDefinitions, {
|
|
13
10
|
...options,
|
|
14
|
-
|
|
15
|
-
configuration: {
|
|
16
|
-
...options.configuration,
|
|
17
|
-
preprocessRequest: navigatorContextProvider
|
|
18
|
-
? augmentPreprocessRequestWithForwardedFor({
|
|
19
|
-
preprocessRequest: options.configuration.preprocessRequest,
|
|
20
|
-
navigatorContextProvider,
|
|
21
|
-
loggerOptions: options.loggerOptions,
|
|
22
|
-
})
|
|
23
|
-
: options.configuration.preprocessRequest,
|
|
24
|
-
},
|
|
25
|
-
};
|
|
26
|
-
const solutionTypeBuild = await buildFactory(controllerDefinitions, callSpecificOptions)(solutionType);
|
|
11
|
+
})(solutionType);
|
|
27
12
|
const { engine, controllers } = await solutionTypeBuild(...params);
|
|
13
|
+
options.configuration.preprocessRequest =
|
|
14
|
+
augmentPreprocessRequestWithForwardedFor({
|
|
15
|
+
preprocessRequest: options.configuration.preprocessRequest,
|
|
16
|
+
navigatorContextProvider: options.navigatorContextProvider,
|
|
17
|
+
loggerOptions: options.loggerOptions,
|
|
18
|
+
});
|
|
28
19
|
switch (solutionType) {
|
|
29
20
|
case SolutionType.listing:
|
|
30
21
|
buildProductListing(engine).executeFirstRequest();
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Builder class for creating controllers from definitions
|
|
3
|
+
*/
|
|
4
|
+
export class ControllerBuilder {
|
|
5
|
+
_definition;
|
|
6
|
+
_engine;
|
|
7
|
+
_props;
|
|
8
|
+
_additionalArgs = [];
|
|
9
|
+
constructor(definition, engine, props) {
|
|
10
|
+
this._definition = definition;
|
|
11
|
+
this._engine = engine;
|
|
12
|
+
this._props = props;
|
|
13
|
+
}
|
|
14
|
+
withAdditionalArgs(additionalArgs = []) {
|
|
15
|
+
this._additionalArgs = additionalArgs;
|
|
16
|
+
return this;
|
|
17
|
+
}
|
|
18
|
+
build() {
|
|
19
|
+
if ('build' in this._definition &&
|
|
20
|
+
typeof this._definition.build === 'function') {
|
|
21
|
+
return this.buildWithoutProps();
|
|
22
|
+
}
|
|
23
|
+
if ('buildWithProps' in this._definition &&
|
|
24
|
+
typeof this._definition.buildWithProps === 'function') {
|
|
25
|
+
return this.buildWithProps();
|
|
26
|
+
}
|
|
27
|
+
throw new Error('Controller definition must have a build or buildWithProps method.');
|
|
28
|
+
}
|
|
29
|
+
buildWithoutProps() {
|
|
30
|
+
const buildFn = this._definition.build;
|
|
31
|
+
return buildFn(this._engine, ...this._additionalArgs);
|
|
32
|
+
}
|
|
33
|
+
buildWithProps() {
|
|
34
|
+
const buildWithPropsFn = this._definition.buildWithProps;
|
|
35
|
+
const controller = buildWithPropsFn(this._engine, this._props, ...this._additionalArgs);
|
|
36
|
+
return { ...controller, initialState: controller.state };
|
|
37
|
+
}
|
|
38
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { clone } from '../../../utils/utils.js';
|
|
2
|
+
/**
|
|
3
|
+
* Builder class for creating static controller
|
|
4
|
+
*/
|
|
5
|
+
class StaticControllerBuilder {
|
|
6
|
+
_state;
|
|
7
|
+
_kind;
|
|
8
|
+
_initialState;
|
|
9
|
+
withState(state) {
|
|
10
|
+
this._state = clone(state);
|
|
11
|
+
return this;
|
|
12
|
+
}
|
|
13
|
+
withKind(kind) {
|
|
14
|
+
this._kind = kind;
|
|
15
|
+
return this;
|
|
16
|
+
}
|
|
17
|
+
withInitialState(initialState) {
|
|
18
|
+
this._initialState = clone(initialState);
|
|
19
|
+
return this;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Builds and returns the static controller state object
|
|
23
|
+
*/
|
|
24
|
+
build() {
|
|
25
|
+
const result = {
|
|
26
|
+
state: this._state,
|
|
27
|
+
};
|
|
28
|
+
if (this._kind) {
|
|
29
|
+
result._kind = this._kind;
|
|
30
|
+
}
|
|
31
|
+
if (this._initialState) {
|
|
32
|
+
result.initialState = this._initialState;
|
|
33
|
+
}
|
|
34
|
+
return result;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
export function createStaticControllerBuilder(controller) {
|
|
38
|
+
const builder = new StaticControllerBuilder().withState(controller.state);
|
|
39
|
+
if ('_kind' in controller) {
|
|
40
|
+
builder.withKind(controller._kind);
|
|
41
|
+
}
|
|
42
|
+
if ('initialState' in controller) {
|
|
43
|
+
builder.withInitialState(controller.initialState);
|
|
44
|
+
}
|
|
45
|
+
return builder;
|
|
46
|
+
}
|
|
@@ -1,21 +1,15 @@
|
|
|
1
1
|
import { clone, mapObject } from '../../utils/utils.js';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
? definition.build(engine)
|
|
5
|
-
: definition.buildWithProps(engine, props));
|
|
6
|
-
}
|
|
2
|
+
import { ControllerBuilder } from './builders/controller-builder.js';
|
|
3
|
+
import { createStaticControllerBuilder } from './builders/static-controller-builder.js';
|
|
7
4
|
export function buildControllerDefinitions({ definitionsMap, engine, propsMap, }) {
|
|
8
|
-
return mapObject(definitionsMap, (definition, key) =>
|
|
9
|
-
|
|
10
|
-
engine,
|
|
11
|
-
|
|
12
|
-
}));
|
|
5
|
+
return mapObject(definitionsMap, (definition, key) => {
|
|
6
|
+
const props = propsMap?.[key];
|
|
7
|
+
return new ControllerBuilder(definition, engine, props).build();
|
|
8
|
+
});
|
|
13
9
|
}
|
|
14
10
|
export function createStaticState({ searchAction, controllers, }) {
|
|
15
11
|
return {
|
|
16
|
-
controllers: mapObject(controllers, (controller) => (
|
|
17
|
-
state: clone(controller.state),
|
|
18
|
-
})),
|
|
12
|
+
controllers: mapObject(controllers, (controller) => createStaticControllerBuilder(controller).build()),
|
|
19
13
|
searchAction: clone(searchAction),
|
|
20
14
|
};
|
|
21
15
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
+
import { buildLogger } from '../../../app/logger.js';
|
|
1
2
|
import { buildSearchEngine, } from '../../../app/search-engine/search-engine.js';
|
|
2
3
|
import { createWaitForActionMiddleware } from '../../../utils/utils.js';
|
|
3
4
|
import { augmentPreprocessRequestWithForwardedFor } from '../../common/augment-preprocess-request.js';
|
|
4
5
|
import { buildControllerDefinitions, createStaticState, } from '../../common/controller-utils.js';
|
|
5
|
-
import { extractCallOptionsAndNavigatorContextProvider } from '../../common/navigator-context-utils.js';
|
|
6
6
|
function isSearchCompletedAction(action) {
|
|
7
7
|
return /^search\/executeSearch\/(fulfilled|rejected)$/.test(action.type);
|
|
8
8
|
}
|
|
@@ -23,67 +23,50 @@ function buildSSRSearchEngine(options) {
|
|
|
23
23
|
};
|
|
24
24
|
}
|
|
25
25
|
/**
|
|
26
|
-
* Initializes a Search engine definition in SSR with
|
|
26
|
+
* Initializes a Search engine definition in SSR with given controllers definitions and search engine config.
|
|
27
27
|
*
|
|
28
28
|
* @param options - The search engine definition
|
|
29
|
-
* @returns
|
|
30
|
-
*
|
|
31
|
-
* @example
|
|
32
|
-
* ```ts
|
|
33
|
-
* const searchEngine = defineSearchEngine(config);
|
|
34
|
-
*
|
|
35
|
-
* // Pass navigator context directly to fetchStaticState
|
|
36
|
-
* const staticState = await searchEngine.fetchStaticState({
|
|
37
|
-
* navigatorContext: {
|
|
38
|
-
* forwardedFor: req.ip,
|
|
39
|
-
* referrer: req.headers.referer || null,
|
|
40
|
-
* userAgent: req.headers['user-agent'] || null,
|
|
41
|
-
* clientId: 'abc123'
|
|
42
|
-
* }
|
|
43
|
-
* });
|
|
44
|
-
* ```
|
|
29
|
+
* @returns Three utility functions to fetch the initial state of the engine in SSR, hydrate the state in CSR,
|
|
30
|
+
* and a build function that can be used for edge cases requiring more control.
|
|
45
31
|
*
|
|
46
32
|
* @group Engine
|
|
47
33
|
*/
|
|
48
34
|
export function defineSearchEngine(options) {
|
|
49
35
|
const { controllers: controllerDefinitions, ...engineOptions } = options;
|
|
50
|
-
const
|
|
51
|
-
|
|
52
|
-
const controllers = buildControllerDefinitions({
|
|
53
|
-
definitionsMap: (controllerDefinitions ?? {}),
|
|
54
|
-
engine,
|
|
55
|
-
propsMap: {},
|
|
56
|
-
});
|
|
57
|
-
const [staticState] = params;
|
|
58
|
-
engine.dispatch(staticState.searchAction);
|
|
59
|
-
await engine.waitForSearchCompletedAction();
|
|
60
|
-
return { engine, controllers };
|
|
36
|
+
const getOptions = () => {
|
|
37
|
+
return engineOptions;
|
|
61
38
|
};
|
|
62
|
-
const
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
navigatorContextProvider,
|
|
74
|
-
loggerOptions: options.loggerOptions,
|
|
75
|
-
})
|
|
76
|
-
: options.configuration.preprocessRequest,
|
|
77
|
-
},
|
|
78
|
-
};
|
|
79
|
-
const engine = buildSSRSearchEngine(callSpecificOptions);
|
|
39
|
+
const setNavigatorContextProvider = (navigatorContextProvider) => {
|
|
40
|
+
engineOptions.navigatorContextProvider = navigatorContextProvider;
|
|
41
|
+
};
|
|
42
|
+
const build = async (...[buildOptions]) => {
|
|
43
|
+
const logger = buildLogger(options.loggerOptions);
|
|
44
|
+
if (!getOptions().navigatorContextProvider) {
|
|
45
|
+
logger.warn('[WARNING] Missing navigator context in server-side code. Make sure to set it with `setNavigatorContextProvider` before calling fetchStaticState()');
|
|
46
|
+
}
|
|
47
|
+
const engine = buildSSRSearchEngine(buildOptions?.extend
|
|
48
|
+
? await buildOptions.extend(getOptions())
|
|
49
|
+
: getOptions());
|
|
80
50
|
const controllers = buildControllerDefinitions({
|
|
81
51
|
definitionsMap: (controllerDefinitions ?? {}),
|
|
82
52
|
engine,
|
|
83
|
-
propsMap: (
|
|
84
|
-
?
|
|
53
|
+
propsMap: (buildOptions && 'controllers' in buildOptions
|
|
54
|
+
? buildOptions.controllers
|
|
85
55
|
: {}),
|
|
86
56
|
});
|
|
57
|
+
return {
|
|
58
|
+
engine,
|
|
59
|
+
controllers,
|
|
60
|
+
};
|
|
61
|
+
};
|
|
62
|
+
const fetchStaticState = async (...params) => {
|
|
63
|
+
const { engine, controllers } = await build(...params);
|
|
64
|
+
options.configuration.preprocessRequest =
|
|
65
|
+
augmentPreprocessRequestWithForwardedFor({
|
|
66
|
+
preprocessRequest: options.configuration.preprocessRequest,
|
|
67
|
+
navigatorContextProvider: options.navigatorContextProvider,
|
|
68
|
+
loggerOptions: options.loggerOptions,
|
|
69
|
+
});
|
|
87
70
|
engine.executeFirstSearch();
|
|
88
71
|
const staticState = createStaticState({
|
|
89
72
|
searchAction: await engine.waitForSearchCompletedAction(),
|
|
@@ -91,8 +74,15 @@ export function defineSearchEngine(options) {
|
|
|
91
74
|
});
|
|
92
75
|
return staticState;
|
|
93
76
|
};
|
|
77
|
+
const hydrateStaticState = async (...params) => {
|
|
78
|
+
const { engine, controllers } = await build(...params);
|
|
79
|
+
engine.dispatch(params[0].searchAction);
|
|
80
|
+
await engine.waitForSearchCompletedAction();
|
|
81
|
+
return { engine, controllers };
|
|
82
|
+
};
|
|
94
83
|
return {
|
|
95
84
|
fetchStaticState,
|
|
96
85
|
hydrateStaticState,
|
|
86
|
+
setNavigatorContextProvider,
|
|
97
87
|
};
|
|
98
88
|
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { vi } from 'vitest';
|
|
2
|
+
export function buildMockController() {
|
|
3
|
+
return {
|
|
4
|
+
subscribe: vi.fn(),
|
|
5
|
+
state: {},
|
|
6
|
+
};
|
|
7
|
+
}
|
|
8
|
+
export function buildMockControllerWithInitialState(_engine, props) {
|
|
9
|
+
return {
|
|
10
|
+
state: props.initialState,
|
|
11
|
+
subscribe: vi.fn(),
|
|
12
|
+
};
|
|
13
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { vi } from 'vitest';
|
|
2
|
+
import { buildMockController, buildMockControllerWithInitialState, } from './mock-controller.js';
|
|
3
|
+
export function defineMockController() {
|
|
4
|
+
return {
|
|
5
|
+
build: vi.fn((_engine) => {
|
|
6
|
+
return buildMockController();
|
|
7
|
+
}),
|
|
8
|
+
};
|
|
9
|
+
}
|
|
10
|
+
export function defineMockControllerWithProps() {
|
|
11
|
+
return {
|
|
12
|
+
buildWithProps: vi.fn((engine, props) => {
|
|
13
|
+
return buildMockControllerWithInitialState(engine, {
|
|
14
|
+
initialState: props?.initialState,
|
|
15
|
+
});
|
|
16
|
+
}),
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
export function defineMockCommerceController(options) {
|
|
20
|
+
return {
|
|
21
|
+
build: vi.fn((_engine) => {
|
|
22
|
+
return buildMockController();
|
|
23
|
+
}),
|
|
24
|
+
listing: options?.listing ?? true,
|
|
25
|
+
search: options?.search ?? true,
|
|
26
|
+
standalone: options?.standalone ?? true,
|
|
27
|
+
recommendation: options?.recommendation ?? true,
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
export function defineMockCommerceControllerWithProps(options) {
|
|
31
|
+
return {
|
|
32
|
+
buildWithProps: vi.fn((engine, props) => ({
|
|
33
|
+
_kind: 'some-kind',
|
|
34
|
+
...buildMockControllerWithInitialState(engine, {
|
|
35
|
+
initialState: props?.initialState,
|
|
36
|
+
}),
|
|
37
|
+
})),
|
|
38
|
+
listing: options?.listing ?? true,
|
|
39
|
+
search: options?.search ?? true,
|
|
40
|
+
standalone: options?.standalone ?? true,
|
|
41
|
+
recommendation: options?.recommendation ?? true,
|
|
42
|
+
};
|
|
43
|
+
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export const VERSION = "3.28.4-pre.
|
|
1
|
+
export const VERSION = "3.28.4-pre.cca67ebcc7" || 'Test version';
|
|
2
2
|
export const COVEO_FRAMEWORK = ['@coveo/atomic', '@coveo/quantic'];
|