@coveo/headless 3.29.2-pre.c87a72e0fc → 3.29.2-pre.cdb6578fc8
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/node.cjs.stats.json +1 -1
- package/dist/cjs/ssr-commerce-next/headless.cjs +1 -1
- package/dist/cjs/ssr-commerce-next/node.cjs.stats.json +1 -1
- package/dist/cjs/ssr-next/headless.cjs +1 -1
- package/dist/definitions/ssr/commerce/types/kind.d.ts +3 -0
- package/dist/definitions/ssr-commerce-next.index.d.ts +1 -2
- package/dist/definitions/ssr-next/commerce/controllers/recommendations/headless-recommendations.ssr.d.ts +4 -8
- package/dist/definitions/ssr-next/commerce/types/controller-definitions.d.ts +1 -5
- package/dist/definitions/ssr-next/common/builders/static-controller-builder.d.ts +1 -6
- package/dist/definitions/test/mock-ssr-controller-definitions.d.ts +0 -3
- package/dist/esm/ssr/commerce/types/kind.js +3 -1
- package/dist/esm/ssr-commerce-next.index.js +0 -1
- package/dist/esm/ssr-next/commerce/controllers/cart/headless-cart.ssr.js +1 -3
- package/dist/esm/ssr-next/commerce/controllers/context/headless-context.ssr.js +2 -4
- package/dist/esm/ssr-next/commerce/controllers/parameter-manager/headless-core-parameter-manager.ssr.js +2 -5
- package/dist/esm/ssr-next/commerce/controllers/recommendations/headless-recommendations.ssr.js +2 -4
- package/dist/esm/ssr-next/common/builders/static-controller-builder.js +0 -11
- package/dist/esm/test/mock-ssr-controller-definitions.js +0 -2
- 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/commerce/types/kind.d.ts +0 -9
- package/dist/esm/ssr-next/commerce/types/kind.js +0 -14
|
@@ -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.2-pre.
|
|
1309
|
+
var VERSION = "3.29.2-pre.cdb6578fc8";
|
|
1310
1310
|
var COVEO_FRAMEWORK = ["@coveo/atomic", "@coveo/quantic"];
|
|
1311
1311
|
|
|
1312
1312
|
// src/api/analytics/analytics-selectors.ts
|
|
@@ -120,10 +120,9 @@ export { defineCommerceEngine } from './ssr-next/commerce/engine/commerce-engine
|
|
|
120
120
|
export type { CommerceEngineDefinitionOptions, SSRCommerceEngine as CommerceEngine, } from './ssr-next/commerce/factories/build-factory.js';
|
|
121
121
|
export type { BuildConfig, SSRCommerceEngineOptions, } from './ssr-next/commerce/types/build.js';
|
|
122
122
|
export { SolutionType } from './ssr-next/commerce/types/controller-constants.js';
|
|
123
|
-
export type { ControllerDefinition, ControllerDefinitionsMap,
|
|
123
|
+
export type { ControllerDefinition, ControllerDefinitionsMap, EngineDefinitionControllersPropsOption, HydratedState, InferControllerStaticStateFromController, InferControllerStaticStateMapFromControllers, OptionsTuple, } from './ssr-next/commerce/types/controller-definitions.js';
|
|
124
124
|
export type { InferControllerFromDefinition, InferControllerPropsMapFromDefinitions, InferControllerStaticStateMapFromDefinitionsWithSolutionType, InferControllersMapFromDefinition, InferHydratedState, InferStaticState, } from './ssr-next/commerce/types/controller-inference.js';
|
|
125
125
|
export type { CommerceEngineDefinition, CommerceEngineDefinitionBuildResult, EngineStaticState, FetchStaticState, HydrateStaticState, HydrateStaticStateOptions, } from './ssr-next/commerce/types/engine.js';
|
|
126
|
-
export { Kind } from './ssr-next/commerce/types/kind.js';
|
|
127
126
|
export type { CommerceAppState, CommerceProductListingParametersState, CommerceSearchParametersState, } from './state/commerce-app-state.js';
|
|
128
127
|
export * from './features/commerce/configuration/configuration-actions-loader.js';
|
|
129
128
|
export * from './features/commerce/context/cart/cart-actions-loader.js';
|
|
@@ -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;
|
|
@@ -10,7 +10,6 @@ import type { ParameterManagerDefinition } from '../controllers/parameter-manage
|
|
|
10
10
|
import type { SSRCommerceEngine } from '../factories/build-factory.js';
|
|
11
11
|
import { type recommendationInternalOptionKey, SolutionType } from './controller-constants.js';
|
|
12
12
|
import type { ListingAndStandaloneController, ListingOnlyController, NonRecommendationController, RecommendationOnlyController, SearchAndListingController, SearchOnlyController, UniversalController } from './controller-scopes.js';
|
|
13
|
-
import type { Kind } from './kind.js';
|
|
14
13
|
import type { HasSolutionType } from './utilities.js';
|
|
15
14
|
export type { HydratedState, OptionsTuple, InferControllerStaticStateFromController, InferControllerStaticStateMapFromControllers, };
|
|
16
15
|
export interface ControllerDefinitionWithoutProps<TController extends Controller> {
|
|
@@ -23,9 +22,6 @@ export interface ControllerDefinitionWithoutProps<TController extends Controller
|
|
|
23
22
|
*/
|
|
24
23
|
build(engine: SSRCommerceEngine, solutionType?: SolutionType): TController;
|
|
25
24
|
}
|
|
26
|
-
export interface ControllerWithKind extends Controller {
|
|
27
|
-
_kind: Kind;
|
|
28
|
-
}
|
|
29
25
|
export interface ControllerDefinitionWithProps<TController extends Controller, TProps> {
|
|
30
26
|
/**
|
|
31
27
|
* Creates an instance of the given controller.
|
|
@@ -35,7 +31,7 @@ export interface ControllerDefinitionWithProps<TController extends Controller, T
|
|
|
35
31
|
* @param solutionType - The type of solution for which the controller should be built (e.g. search or listing). This option only applies to sub-controllers.
|
|
36
32
|
* @returns The created controller instance.
|
|
37
33
|
*/
|
|
38
|
-
buildWithProps(engine: SSRCommerceEngine, props?: TProps, solutionType?: SolutionType): TController
|
|
34
|
+
buildWithProps(engine: SSRCommerceEngine, props?: TProps, solutionType?: SolutionType): TController;
|
|
39
35
|
}
|
|
40
36
|
interface SolutionTypeAvailability {
|
|
41
37
|
[SolutionType.search]?: boolean;
|
|
@@ -1,19 +1,14 @@
|
|
|
1
1
|
import type { Controller } from '../../../controllers/controller/headless-controller.js';
|
|
2
|
-
import type { ControllerWithKind } from '../../commerce/types/controller-definitions.js';
|
|
3
|
-
import type { Kind } from '../../commerce/types/kind.js';
|
|
4
2
|
export type StaticControllerState = {
|
|
5
3
|
initialState?: Controller['state'];
|
|
6
|
-
|
|
7
|
-
} & Pick<ControllerWithKind, 'state'>;
|
|
4
|
+
} & Pick<Controller, 'state'>;
|
|
8
5
|
/**
|
|
9
6
|
* Builder class for creating static controller
|
|
10
7
|
*/
|
|
11
8
|
declare class StaticControllerBuilder {
|
|
12
9
|
private _state?;
|
|
13
|
-
private _kind?;
|
|
14
10
|
private _initialState?;
|
|
15
11
|
withState(state: StaticControllerState['state']): this;
|
|
16
|
-
withKind(kind: Kind): this;
|
|
17
12
|
withInitialState(initialState: StaticControllerState['initialState']): this;
|
|
18
13
|
/**
|
|
19
14
|
* Builds and returns the static controller state object
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import type { SearchEngine } from '../app/search-engine/search-engine.js';
|
|
2
2
|
import type { Controller } from '../controllers/controller/headless-controller.js';
|
|
3
|
-
import type { Kind } from '../ssr/commerce/types/kind.js';
|
|
4
3
|
import { recommendationInternalOptionKey } from '../ssr-next/commerce/types/controller-constants.js';
|
|
5
4
|
import type { ControllerDefinitionWithoutProps, ControllerDefinitionWithProps } from '../ssr-next/common/types/controllers.js';
|
|
6
5
|
interface MockController {
|
|
@@ -29,7 +28,6 @@ export declare function defineMockCommerceControllerWithProps(options?: Solution
|
|
|
29
28
|
buildWithProps: import("vitest").Mock<(engine: any, props: any) => {
|
|
30
29
|
state: {};
|
|
31
30
|
subscribe(listener: () => void): import("redux").Unsubscribe;
|
|
32
|
-
_kind: Kind;
|
|
33
31
|
}>;
|
|
34
32
|
listing: boolean;
|
|
35
33
|
search: boolean;
|
|
@@ -44,7 +42,6 @@ export declare function defineMockRecommendationDefinition(slotId: string): {
|
|
|
44
42
|
buildWithProps: import("vitest").Mock<(engine: any, props: any) => {
|
|
45
43
|
state: {};
|
|
46
44
|
subscribe(listener: () => void): import("redux").Unsubscribe;
|
|
47
|
-
_kind: Kind;
|
|
48
45
|
}>;
|
|
49
46
|
};
|
|
50
47
|
export {};
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @deprecated This type will be removed in the next major version.
|
|
3
|
+
*/
|
|
1
4
|
export var Kind;
|
|
2
5
|
(function (Kind) {
|
|
3
6
|
Kind["Cart"] = "CART";
|
|
@@ -5,7 +8,6 @@ export var Kind;
|
|
|
5
8
|
Kind["ParameterManager"] = "PARAMETER_MANAGER";
|
|
6
9
|
Kind["Recommendations"] = "RECOMMENDATIONS";
|
|
7
10
|
})(Kind || (Kind = {}));
|
|
8
|
-
// TODO: KIT-4742: There is no point for this now that the wiring is happening in headless
|
|
9
11
|
export function createControllerWithKind(controller, kind) {
|
|
10
12
|
const copy = Object.defineProperties({}, Object.getOwnPropertyDescriptors(controller));
|
|
11
13
|
Object.defineProperty(copy, '_kind', {
|
|
@@ -89,7 +89,6 @@ export { defineQueryTrigger } from './ssr-next/commerce/controllers/triggers/hea
|
|
|
89
89
|
export { defineRedirectionTrigger } from './ssr-next/commerce/controllers/triggers/headless-redirection-trigger.ssr.js';
|
|
90
90
|
export { defineCommerceEngine } from './ssr-next/commerce/engine/commerce-engine.ssr.js';
|
|
91
91
|
export { SolutionType } from './ssr-next/commerce/types/controller-constants.js';
|
|
92
|
-
export { Kind } from './ssr-next/commerce/types/kind.js';
|
|
93
92
|
// TODO: KIT-3391 - export other SSR commerce controllers
|
|
94
93
|
//#endregion
|
|
95
94
|
export * from './features/commerce/configuration/configuration-actions-loader.js';
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { buildCart, } from '../../../../controllers/commerce/context/cart/headless-cart.js';
|
|
2
|
-
import { createControllerWithKind, Kind } from '../../types/kind.js';
|
|
3
2
|
/**
|
|
4
3
|
* Defines a `Cart` controller instance.
|
|
5
4
|
* @group Definers
|
|
@@ -13,10 +12,9 @@ export function defineCart() {
|
|
|
13
12
|
standalone: true,
|
|
14
13
|
recommendation: true,
|
|
15
14
|
buildWithProps: (engine, props) => {
|
|
16
|
-
|
|
15
|
+
return buildCart(engine, {
|
|
17
16
|
initialState: props ? props.initialState : {},
|
|
18
17
|
});
|
|
19
|
-
return createControllerWithKind(controller, Kind.Cart);
|
|
20
18
|
},
|
|
21
19
|
};
|
|
22
20
|
}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { buildContext, } from '../../../../controllers/commerce/context/headless-context.js';
|
|
2
2
|
import { MissingControllerProps } from '../../../common/errors.js';
|
|
3
|
-
import { createControllerWithKind, Kind } from '../../types/kind.js';
|
|
4
3
|
/**
|
|
5
4
|
* Defines a `Context` controller instance.
|
|
6
5
|
* @group Definers
|
|
@@ -15,10 +14,9 @@ export function defineContext() {
|
|
|
15
14
|
recommendation: true,
|
|
16
15
|
buildWithProps: (engine, props) => {
|
|
17
16
|
if (props === undefined) {
|
|
18
|
-
throw new MissingControllerProps(
|
|
17
|
+
throw new MissingControllerProps('Context');
|
|
19
18
|
}
|
|
20
|
-
|
|
21
|
-
return createControllerWithKind(controller, Kind.Context);
|
|
19
|
+
return buildContext(engine, { options: props.initialState });
|
|
22
20
|
},
|
|
23
21
|
};
|
|
24
22
|
}
|
|
@@ -11,7 +11,6 @@ import { querySetReducer as querySet } from '../../../../features/query-set/quer
|
|
|
11
11
|
import { ensureAtLeastOneSolutionType } from '../../../../ssr/commerce/controller-utils.js';
|
|
12
12
|
import { loadReducerError } from '../../../../utils/errors.js';
|
|
13
13
|
import { SolutionType } from '../../types/controller-constants.js';
|
|
14
|
-
import { createControllerWithKind, Kind } from '../../types/kind.js';
|
|
15
14
|
/**
|
|
16
15
|
* Defines a `ParameterManager` controller instance.
|
|
17
16
|
* @group Definers
|
|
@@ -29,21 +28,19 @@ export function defineParameterManager(options) {
|
|
|
29
28
|
if (!loadCommerceProductListingParameterReducers(engine)) {
|
|
30
29
|
throw loadReducerError;
|
|
31
30
|
}
|
|
32
|
-
|
|
31
|
+
return buildProductListing(engine).parameterManager({
|
|
33
32
|
...props,
|
|
34
33
|
excludeDefaultParameters: true,
|
|
35
34
|
});
|
|
36
|
-
return createControllerWithKind(controller, Kind.ParameterManager);
|
|
37
35
|
}
|
|
38
36
|
else {
|
|
39
37
|
if (!loadCommerceSearchParameterReducers(engine)) {
|
|
40
38
|
throw loadReducerError;
|
|
41
39
|
}
|
|
42
|
-
|
|
40
|
+
return buildSearch(engine).parameterManager({
|
|
43
41
|
...props,
|
|
44
42
|
excludeDefaultParameters: true,
|
|
45
43
|
});
|
|
46
|
-
return createControllerWithKind(controller, Kind.ParameterManager);
|
|
47
44
|
}
|
|
48
45
|
},
|
|
49
46
|
};
|
package/dist/esm/ssr-next/commerce/controllers/recommendations/headless-recommendations.ssr.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { buildRecommendations, } from '../../../../controllers/commerce/recommendations/headless-recommendations.js';
|
|
2
2
|
import { recommendationInternalOptionKey } from '../../types/controller-constants.js';
|
|
3
|
-
import { createControllerWithKind, Kind } from '../../types/kind.js';
|
|
4
3
|
/**
|
|
5
4
|
* Defines a `Recommendations` controller instance.
|
|
6
5
|
* @group Definers
|
|
@@ -16,10 +15,9 @@ export function defineRecommendations(props) {
|
|
|
16
15
|
},
|
|
17
16
|
buildWithProps: (engine, options) => {
|
|
18
17
|
const staticOptions = props.options;
|
|
19
|
-
|
|
20
|
-
options: { ...staticOptions, ...options
|
|
18
|
+
return buildRecommendations(engine, {
|
|
19
|
+
options: { ...staticOptions, ...options },
|
|
21
20
|
});
|
|
22
|
-
return createControllerWithKind(controller, Kind.Recommendations);
|
|
23
21
|
},
|
|
24
22
|
};
|
|
25
23
|
}
|
|
@@ -4,16 +4,11 @@ import { clone } from '../../../utils/utils.js';
|
|
|
4
4
|
*/
|
|
5
5
|
class StaticControllerBuilder {
|
|
6
6
|
_state;
|
|
7
|
-
_kind;
|
|
8
7
|
_initialState;
|
|
9
8
|
withState(state) {
|
|
10
9
|
this._state = clone(state);
|
|
11
10
|
return this;
|
|
12
11
|
}
|
|
13
|
-
withKind(kind) {
|
|
14
|
-
this._kind = kind;
|
|
15
|
-
return this;
|
|
16
|
-
}
|
|
17
12
|
withInitialState(initialState) {
|
|
18
13
|
this._initialState = clone(initialState);
|
|
19
14
|
return this;
|
|
@@ -25,9 +20,6 @@ class StaticControllerBuilder {
|
|
|
25
20
|
const result = {
|
|
26
21
|
state: this._state,
|
|
27
22
|
};
|
|
28
|
-
if (this._kind) {
|
|
29
|
-
result._kind = this._kind;
|
|
30
|
-
}
|
|
31
23
|
if (this._initialState) {
|
|
32
24
|
result.initialState = this._initialState;
|
|
33
25
|
}
|
|
@@ -36,9 +28,6 @@ class StaticControllerBuilder {
|
|
|
36
28
|
}
|
|
37
29
|
export function createStaticControllerBuilder(controller) {
|
|
38
30
|
const builder = new StaticControllerBuilder().withState(controller.state);
|
|
39
|
-
if ('_kind' in controller) {
|
|
40
|
-
builder.withKind(controller._kind);
|
|
41
|
-
}
|
|
42
31
|
if ('initialState' in controller) {
|
|
43
32
|
builder.withInitialState(controller.initialState);
|
|
44
33
|
}
|
|
@@ -31,7 +31,6 @@ export function defineMockCommerceController(options) {
|
|
|
31
31
|
export function defineMockCommerceControllerWithProps(options) {
|
|
32
32
|
return {
|
|
33
33
|
buildWithProps: vi.fn((engine, props) => ({
|
|
34
|
-
_kind: 'some-kind',
|
|
35
34
|
...buildMockControllerWithInitialState(engine, {
|
|
36
35
|
initialState: props?.initialState,
|
|
37
36
|
}),
|
|
@@ -49,7 +48,6 @@ export function defineMockRecommendationDefinition(slotId) {
|
|
|
49
48
|
slotId,
|
|
50
49
|
},
|
|
51
50
|
buildWithProps: vi.fn((engine, props) => ({
|
|
52
|
-
_kind: 'some-kind',
|
|
53
51
|
...buildMockControllerWithInitialState(engine, {
|
|
54
52
|
initialState: props?.initialState,
|
|
55
53
|
}),
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export const VERSION = "3.29.2-pre.
|
|
1
|
+
export const VERSION = "3.29.2-pre.cdb6578fc8" || 'Test version';
|
|
2
2
|
export const COVEO_FRAMEWORK = ['@coveo/atomic', '@coveo/quantic'];
|