@coveo/quantic 3.30.3-pre.b400a05b95 → 3.30.3-pre.b407bdfc38
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/force-app/main/default/staticresources/coveoheadless/case-assist/headless.js +3 -3
- package/force-app/main/default/staticresources/coveoheadless/definitions/app/navigator-context-provider.d.ts +6 -0
- package/force-app/main/default/staticresources/coveoheadless/definitions/controllers/knowledge/generated-answer/headless-answerapi-generated-answer-mocks.d.ts +732 -7765
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/generated-answer/generated-answer-request.d.ts +1961 -20
- package/force-app/main/default/staticresources/coveoheadless/definitions/ssr-commerce-next.index.d.ts +7 -2
- package/force-app/main/default/staticresources/coveoheadless/definitions/ssr-next/commerce/engine/commerce-engine.ssr.d.ts +9 -3
- package/force-app/main/default/staticresources/coveoheadless/definitions/ssr-next/commerce/factories/build-factory.d.ts +2 -2
- package/force-app/main/default/staticresources/coveoheadless/definitions/ssr-next/commerce/factories/recommendation-static-state-factory.d.ts +1 -0
- package/force-app/main/default/staticresources/coveoheadless/definitions/ssr-next/commerce/types/build.d.ts +2 -5
- package/force-app/main/default/staticresources/coveoheadless/definitions/ssr-next/commerce/types/engine.d.ts +0 -8
- package/force-app/main/default/staticresources/coveoheadless/definitions/ssr-next/commerce/utils/engine-wiring.d.ts +2 -2
- package/force-app/main/default/staticresources/coveoheadless/definitions/ssr-next/search/engine/search-engine.ssr.d.ts +10 -4
- package/force-app/main/default/staticresources/coveoheadless/definitions/ssr-next/search/types/build.d.ts +4 -0
- package/force-app/main/default/staticresources/coveoheadless/definitions/ssr-next/search/types/engine.d.ts +0 -8
- package/force-app/main/default/staticresources/coveoheadless/definitions/ssr-next/search/types/fetch-static-state.d.ts +2 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/ssr-next/search/types/hydrate-static-state.d.ts +2 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/ssr-next.index.d.ts +6 -5
- package/force-app/main/default/staticresources/coveoheadless/definitions/test/mock-context.d.ts +2 -0
- package/force-app/main/default/staticresources/coveoheadless/headless.js +3 -3
- package/force-app/main/default/staticresources/coveoheadless/insight/headless.js +3 -3
- package/force-app/main/default/staticresources/coveoheadless/recommendation/headless.js +3 -3
- package/package.json +3 -3
- package/docs/out/quantic-docs.json +0 -6440
|
@@ -44,6 +44,11 @@
|
|
|
44
44
|
* standaloneEngineDefinition,
|
|
45
45
|
* } = engineDefinition;
|
|
46
46
|
*
|
|
47
|
+
* await listingEngineDefinition.fetchStaticState({
|
|
48
|
+
* navigatorContextProvider: () => {/*...* /},
|
|
49
|
+
* context: {/*...* /},
|
|
50
|
+
* });
|
|
51
|
+
*
|
|
47
52
|
* export type ListingStaticState = InferStaticState<
|
|
48
53
|
* typeof listingEngineDefinition
|
|
49
54
|
* >;
|
|
@@ -118,9 +123,9 @@ export type { RedirectionTrigger, RedirectionTriggerDefinition, RedirectionTrigg
|
|
|
118
123
|
export { defineRedirectionTrigger } from './ssr-next/commerce/controllers/triggers/headless-redirection-trigger.ssr.js';
|
|
119
124
|
export { defineCommerceEngine } from './ssr-next/commerce/engine/commerce-engine.ssr.js';
|
|
120
125
|
export type { SSRCommerceEngine as CommerceEngine } from './ssr-next/commerce/factories/build-factory.js';
|
|
121
|
-
export type { BuildConfig, SSRCommerceEngineOptions
|
|
126
|
+
export type { BuildConfig, SSRCommerceEngineOptions, } from './ssr-next/commerce/types/build.js';
|
|
122
127
|
export { SolutionType } from './ssr-next/commerce/types/controller-constants.js';
|
|
123
|
-
export type {
|
|
128
|
+
export type { CommerceEngineDefinitionControllersPropsOption as EngineDefinitionControllersPropsOption, ControllerDefinition, ControllerDefinitionsMap, HydratedState, InferControllerStaticStateFromController, InferControllerStaticStateMapFromControllers, OptionsTuple, } from './ssr-next/commerce/types/controller-definitions.js';
|
|
124
129
|
export type { InferControllerFromDefinition, InferControllerPropsMapFromDefinitions, InferControllerStaticStateMapFromDefinitionsWithSolutionType, InferControllersMapFromDefinition, InferHydratedState, InferStaticState, } from './ssr-next/commerce/types/controller-inference.js';
|
|
125
130
|
export type { CommerceEngineDefinition, CommerceEngineDefinitionBuildResult, CommerceEngineDefinitionOptions, EngineStaticState, FetchStaticState, HydrateStaticState, HydrateStaticStateOptions, } from './ssr-next/commerce/types/engine.js';
|
|
126
131
|
export type { CommerceAppState, CommerceProductListingParametersState, CommerceSearchParametersState, } from './state/commerce-app-state.js';
|
|
@@ -17,9 +17,15 @@ import type { CommerceEngineDefinition, CommerceEngineDefinitionOptions } from '
|
|
|
17
17
|
*
|
|
18
18
|
* @example
|
|
19
19
|
* ```ts
|
|
20
|
-
* const
|
|
21
|
-
*
|
|
22
|
-
*
|
|
20
|
+
* const { listingEngineDefinition } = defineCommerceEngine(engineConfig);
|
|
21
|
+
*
|
|
22
|
+
* const staticState = await listingEngineDefinition.fetchStaticState({
|
|
23
|
+
* navigatorContextProvider: () => {/*...* /},
|
|
24
|
+
* context: {/*...* /},
|
|
25
|
+
* });
|
|
26
|
+
*
|
|
27
|
+
* type SearchStaticState = InferStaticState<typeof listingEngineDefinition>;
|
|
28
|
+
* type SearchHydratedState = InferHydratedState<typeof listingEngineDefinition>;
|
|
23
29
|
* ```
|
|
24
30
|
*
|
|
25
31
|
* @group Engine
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { Action } from '@reduxjs/toolkit';
|
|
2
2
|
import { type CommerceEngine } from '../../../app/commerce-engine/commerce-engine.js';
|
|
3
3
|
import { SolutionType } from '../types/controller-constants.js';
|
|
4
|
-
import type {
|
|
4
|
+
import type { BakedInControllers } from '../types/controller-definitions.js';
|
|
5
5
|
import type { InferControllersMapFromDefinition } from '../types/controller-inference.js';
|
|
6
6
|
import type { CommerceControllerDefinitionsMap, CommerceEngineDefinitionOptions, FetchStaticStateParameters, HydrateStaticStateParameters } from '../types/engine.js';
|
|
7
7
|
/**
|
|
@@ -15,7 +15,7 @@ export interface SSRCommerceEngine extends CommerceEngine {
|
|
|
15
15
|
*/
|
|
16
16
|
waitForRequestCompletedAction(): Promise<Action>[];
|
|
17
17
|
}
|
|
18
|
-
export declare const buildFactory: <TControllerDefinitions extends CommerceControllerDefinitionsMap>(controllerDefinitions:
|
|
18
|
+
export declare const buildFactory: <TControllerDefinitions extends CommerceControllerDefinitionsMap>(controllerDefinitions: TControllerDefinitions, options: CommerceEngineDefinitionOptions<TControllerDefinitions>) => <TSolutionType extends SolutionType>(solutionType: TSolutionType) => (...[buildOptions]: FetchStaticStateParameters<TControllerDefinitions, TSolutionType> | HydrateStaticStateParameters<TControllerDefinitions, TSolutionType>) => Promise<{
|
|
19
19
|
engine: SSRCommerceEngine;
|
|
20
20
|
controllers: InferControllersMapFromDefinition<TControllerDefinitions, TSolutionType> & BakedInControllers;
|
|
21
21
|
}>;
|
|
@@ -5,6 +5,7 @@ import type { CommerceControllerDefinitionsMap, CommerceEngineDefinitionOptions,
|
|
|
5
5
|
export declare function fetchRecommendationStaticStateFactory<TControllerDefinitions extends CommerceControllerDefinitionsMap>(controllerDefinitions: AugmentedControllerDefinition<TControllerDefinitions>, options: CommerceEngineDefinitionOptions<TControllerDefinitions>): (...params: FetchStaticStateParameters<TControllerDefinitions, SolutionType.recommendation>) => Promise<{
|
|
6
6
|
controllers: import("../types/controller-inference.js").InferControllerStaticStateMapFromDefinitionsWithSolutionType<TControllerDefinitions, SolutionType.recommendation> & import("../types/controller-definitions.js").FilteredBakedInControllers<SolutionType.recommendation>;
|
|
7
7
|
searchActions: UnknownAction[];
|
|
8
|
+
navigatorContextProvider: import("../../../ssr.index.js").NavigatorContextProvider;
|
|
8
9
|
context: import("../../../commerce.index.js").ContextOptions;
|
|
9
10
|
searchParams?: import("../../../commerce.index.js").ParameterManagerState<import("../../../commerce.index.js").Parameters>["parameters"];
|
|
10
11
|
cart?: import("../../../commerce.index.js").CartInitialState;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { CommerceEngineOptions } from '../../../app/commerce-engine/commerce-engine.js';
|
|
2
|
+
import type { NavigatorContextProvider } from '../../../app/navigator-context-provider.js';
|
|
2
3
|
import type { Controller } from '../../../controllers/controller/headless-controller.js';
|
|
3
4
|
import type { HasKey } from '../../common/types/utilities.js';
|
|
4
5
|
import type { CartInitialState } from '../controllers/cart/headless-cart.ssr.js';
|
|
@@ -15,11 +16,6 @@ export interface ListingBuildConfig extends CommonBuildConfig {
|
|
|
15
16
|
}
|
|
16
17
|
export interface StandaloneBuildConfig extends CommonBuildConfig {
|
|
17
18
|
}
|
|
18
|
-
export interface CommonBuildConfig {
|
|
19
|
-
context: ContextOptions;
|
|
20
|
-
searchParams?: ParameterManagerState<Parameters>['parameters'];
|
|
21
|
-
cart?: CartInitialState;
|
|
22
|
-
}
|
|
23
19
|
/**
|
|
24
20
|
* Commerce engine options for SSR scenarios where context is defined when fetching static state.
|
|
25
21
|
*/
|
|
@@ -76,6 +72,7 @@ export interface ListingBuildConfig extends CommonBuildConfig {
|
|
|
76
72
|
export interface StandaloneBuildConfig extends CommonBuildConfig {
|
|
77
73
|
}
|
|
78
74
|
export interface CommonBuildConfig {
|
|
75
|
+
navigatorContextProvider: NavigatorContextProvider;
|
|
79
76
|
context: ContextOptions;
|
|
80
77
|
searchParams?: ParameterManagerState<Parameters>['parameters'];
|
|
81
78
|
cart?: CartInitialState;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import type { UnknownAction } from '@reduxjs/toolkit';
|
|
2
|
-
import type { NavigatorContextProvider } from '../../../app/navigator-context-provider.js';
|
|
3
2
|
import type { Controller } from '../../../controllers/controller/headless-controller.js';
|
|
4
3
|
import type { ControllersMap } from '../../common/types/controllers.js';
|
|
5
4
|
import type { EngineStaticState } from '../../common/types/engine.js';
|
|
@@ -35,13 +34,6 @@ export interface CommerceEngineDefinition<TControllers extends ControllerDefinit
|
|
|
35
34
|
* Fetches the hydrated state on the client side using your engine definition and the static state.
|
|
36
35
|
*/
|
|
37
36
|
hydrateStaticState: HydrateStaticState<InferControllersMapFromDefinition<TControllers, TSolutionType>, UnknownAction, InferControllerPropsMapFromDefinitions<TControllers>, TControllers, TSolutionType>;
|
|
38
|
-
/**
|
|
39
|
-
* Sets the navigator context provider.
|
|
40
|
-
* This provider is essential for retrieving navigation-related data such as referrer, userAgent, location, and clientId, which are crucial for handling both server-side and client-side API requests effectively.
|
|
41
|
-
*
|
|
42
|
-
* Note: The implementation specifics of the navigator context provider depend on the Node.js framework being utilized. It is the developer's responsibility to appropriately define and implement the navigator context provider to ensure accurate navigation context is available throughout the application. If the user fails to provide a navigator context provider, a warning will be logged either on the server or the browser console.
|
|
43
|
-
*/
|
|
44
|
-
setNavigatorContextProvider: (navigatorContextProvider: NavigatorContextProvider) => void;
|
|
45
37
|
/**
|
|
46
38
|
* Returns the access token.
|
|
47
39
|
*/
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { CommerceEngineOptions } from '../../../app/commerce-engine/commerce-engine.js';
|
|
2
2
|
import type { CommonBuildConfig } from '../types/build.js';
|
|
3
3
|
import type { CommerceControllerDefinitionsMap, CommerceEngineDefinitionOptions } from '../types/engine.js';
|
|
4
|
-
export declare function
|
|
4
|
+
export declare function augmentCommerceEngineOptions<TControllerDefinitions extends CommerceControllerDefinitionsMap>(engineOptions: CommerceEngineDefinitionOptions<TControllerDefinitions>, buildConfig: CommonBuildConfig): CommerceEngineOptions;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import type { NavigatorContextProvider } from '../../../app/navigator-context-provider.js';
|
|
2
1
|
import { type SearchEngine } from '../../../app/search-engine/search-engine.js';
|
|
3
2
|
import type { Controller } from '../../../controllers/controller/headless-controller.js';
|
|
4
3
|
import type { LegacySearchAction } from '../../../features/analytics/analytics-utils.js';
|
|
@@ -21,13 +20,20 @@ export type SearchCompletedAction = ReturnType<LegacySearchAction['fulfilled' |
|
|
|
21
20
|
* Initializes a Search engine definition in SSR with given controllers definitions and search engine config.
|
|
22
21
|
*
|
|
23
22
|
* @param options - The search engine definition
|
|
24
|
-
* @returns
|
|
25
|
-
*
|
|
23
|
+
* @returns Two utility functions to fetch the initial state of the engine in SSR and hydrate the state in CSR.
|
|
24
|
+
*
|
|
25
|
+
* @example
|
|
26
|
+
* ```ts
|
|
27
|
+
* const searchEngine = defineSearchEngine(config);
|
|
28
|
+
*
|
|
29
|
+
* const staticState = await searchEngine.fetchStaticState({
|
|
30
|
+
* navigatorContextProvider: () => {/*...* /},
|
|
31
|
+
* });
|
|
32
|
+
* ```
|
|
26
33
|
*
|
|
27
34
|
* @group Engine
|
|
28
35
|
*/
|
|
29
36
|
export declare function defineSearchEngine<TControllerDefinitions extends ControllerDefinitionsMap<SearchEngine, Controller>>(options: SearchEngineDefinitionOptions<TControllerDefinitions>): {
|
|
30
37
|
fetchStaticState: import("../types/fetch-static-state.js").FetchStaticState<import("redux").AnyAction, InferControllerStaticStateMapFromDefinitions<TControllerDefinitions>, InferControllerPropsMapFromDefinitions<TControllerDefinitions>>;
|
|
31
38
|
hydrateStaticState: import("../types/hydrate-static-state.js").HydrateStaticState<SSRSearchEngine, import("../types/controller-inference.js").InferControllersMapFromDefinition<TControllerDefinitions>, import("redux").AnyAction, InferControllerPropsMapFromDefinitions<TControllerDefinitions>>;
|
|
32
|
-
setNavigatorContextProvider: (navigatorContextProvider: NavigatorContextProvider) => void;
|
|
33
39
|
};
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
import type { CoreEngine, CoreEngineNext } from '../../../app/engine.js';
|
|
2
|
+
import type { NavigatorContextProvider } from '../../../app/navigator-context-provider.js';
|
|
2
3
|
import type { ControllersMap, ControllersPropsMap } from '../../common/types/controllers.js';
|
|
3
4
|
import type { OptionsTuple } from '../../common/types/utilities.js';
|
|
4
5
|
import type { SearchEngineDefinitionBuildResult, SearchEngineDefinitionControllersPropsOption } from './engine.js';
|
|
6
|
+
export type BuildConfig = {
|
|
7
|
+
navigatorContextProvider: NavigatorContextProvider;
|
|
8
|
+
};
|
|
5
9
|
/**
|
|
6
10
|
* @internal
|
|
7
11
|
*/
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import type { AnyAction } from '@reduxjs/toolkit';
|
|
2
2
|
import type { CoreEngine, CoreEngineNext } from '../../../app/engine.js';
|
|
3
|
-
import type { NavigatorContextProvider } from '../../../app/navigator-context-provider.js';
|
|
4
3
|
import type { SearchEngineOptions } from '../../../app/search-engine/search-engine.js';
|
|
5
4
|
import type { Controller } from '../../../controllers/controller/headless-controller.js';
|
|
6
5
|
import type { ControllersMap, ControllersPropsMap } from '../../common/types/controllers.js';
|
|
@@ -32,13 +31,6 @@ export interface SearchEngineDefinition<TEngine extends CoreEngine | CoreEngineN
|
|
|
32
31
|
* Fetches the hydrated state on the client side using your engine definition and the static state.
|
|
33
32
|
*/
|
|
34
33
|
hydrateStaticState: HydrateStaticState<TEngine, InferControllersMapFromDefinition<TControllers>, AnyAction, InferControllerPropsMapFromDefinitions<TControllers>>;
|
|
35
|
-
/**
|
|
36
|
-
* Sets the navigator context provider.
|
|
37
|
-
* This provider is essential for retrieving navigation-related data such as referrer, userAgent, location, and clientId, which are crucial for handling both server-side and client-side API requests effectively.
|
|
38
|
-
*
|
|
39
|
-
* Note: The implementation specifics of the navigator context provider depend on the Node.js framework being utilized. It is the developer's responsibility to appropriately define and implement the navigator context provider to ensure accurate navigation context is available throughout the application. If the user fails to provide a navigator context provider, a warning will be logged either on the server or the browser console.
|
|
40
|
-
*/
|
|
41
|
-
setNavigatorContextProvider: (navigatorContextProvider: NavigatorContextProvider) => void;
|
|
42
34
|
}
|
|
43
35
|
/**
|
|
44
36
|
* This type defines the required and optional controller props for the search engine definition.
|
|
@@ -2,10 +2,11 @@ import type { UnknownAction } from '@reduxjs/toolkit';
|
|
|
2
2
|
import type { ControllerStaticStateMap, ControllersPropsMap } from '../../common/types/controllers.js';
|
|
3
3
|
import type { EngineStaticState } from '../../common/types/engine.js';
|
|
4
4
|
import type { OptionsTuple } from '../../common/types/utilities.js';
|
|
5
|
+
import type { BuildConfig } from './build.js';
|
|
5
6
|
import type { SearchEngineDefinitionControllersPropsOption } from './engine.js';
|
|
6
7
|
/**
|
|
7
8
|
* Executes only the initial search for a given configuration, then returns a resumable snapshot of engine state along with the state of the controllers.
|
|
8
9
|
*
|
|
9
10
|
* Useful for static generation and server-side rendering.
|
|
10
11
|
*/
|
|
11
|
-
export type FetchStaticState<TSearchAction extends UnknownAction, TControllersStaticState extends ControllerStaticStateMap, TControllersProps extends ControllersPropsMap> = (...params: OptionsTuple<SearchEngineDefinitionControllersPropsOption<TControllersProps>>) => Promise<EngineStaticState<TSearchAction, TControllersStaticState
|
|
12
|
+
export type FetchStaticState<TSearchAction extends UnknownAction, TControllersStaticState extends ControllerStaticStateMap, TControllersProps extends ControllersPropsMap> = (...params: OptionsTuple<BuildConfig & SearchEngineDefinitionControllersPropsOption<TControllersProps>>) => Promise<EngineStaticState<TSearchAction, TControllersStaticState> & BuildConfig>;
|
|
@@ -2,6 +2,7 @@ import type { UnknownAction } from '@reduxjs/toolkit';
|
|
|
2
2
|
import type { CoreEngine, CoreEngineNext } from '../../../app/engine.js';
|
|
3
3
|
import type { ControllersMap, ControllersPropsMap } from '../../common/types/controllers.js';
|
|
4
4
|
import type { OptionsTuple } from '../../common/types/utilities.js';
|
|
5
|
+
import type { BuildConfig } from './build.js';
|
|
5
6
|
import type { SearchEngineDefinitionBuildResult, SearchEngineDefinitionControllersPropsOption } from './engine.js';
|
|
6
7
|
export type HydratedState<TEngine extends CoreEngine | CoreEngineNext, TControllers extends ControllersMap> = SearchEngineDefinitionBuildResult<TEngine, TControllers>;
|
|
7
8
|
interface HydrateStaticStateOptions<TSearchAction> {
|
|
@@ -12,5 +13,5 @@ interface HydrateStaticStateOptions<TSearchAction> {
|
|
|
12
13
|
*
|
|
13
14
|
* Useful when hydrating a server-side-rendered engine.
|
|
14
15
|
*/
|
|
15
|
-
export type HydrateStaticState<TEngine extends CoreEngine | CoreEngineNext, TControllers extends ControllersMap, TSearchAction extends UnknownAction, TControllersProps extends ControllersPropsMap> = (...params: OptionsTuple<HydrateStaticStateOptions<TSearchAction> & SearchEngineDefinitionControllersPropsOption<TControllersProps>>) => Promise<HydratedState<TEngine, TControllers>>;
|
|
16
|
+
export type HydrateStaticState<TEngine extends CoreEngine | CoreEngineNext, TControllers extends ControllersMap, TSearchAction extends UnknownAction, TControllersProps extends ControllersPropsMap> = (...params: OptionsTuple<BuildConfig & HydrateStaticStateOptions<TSearchAction> & SearchEngineDefinitionControllersPropsOption<TControllersProps>>) => Promise<HydratedState<TEngine, TControllers>>;
|
|
16
17
|
export {};
|
package/force-app/main/default/staticresources/coveoheadless/definitions/ssr-next.index.d.ts
CHANGED
|
@@ -36,11 +36,12 @@
|
|
|
36
36
|
* export type SearchStaticState = InferStaticState<typeof engineDefinition>;
|
|
37
37
|
* export type SearchHydratedState = InferHydratedState<typeof engineDefinition>;
|
|
38
38
|
*
|
|
39
|
-
* export const {
|
|
40
|
-
*
|
|
41
|
-
*
|
|
42
|
-
*
|
|
43
|
-
* }
|
|
39
|
+
* export const {fetchStaticState, hydrateStaticState} = engineDefinition;
|
|
40
|
+
*
|
|
41
|
+
* await fetchStaticState({
|
|
42
|
+
* navigatorContextProvider: () => {/*...* /},
|
|
43
|
+
* context: {/*...* /},
|
|
44
|
+
* });
|
|
44
45
|
|
|
45
46
|
* ```
|
|
46
47
|
* @module SSR Search
|