@coveo/quantic 3.33.3 → 3.33.5
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/docs/out/quantic-docs.json +13 -13
- package/force-app/main/default/lwc/quanticCategoryFacet/quanticCategoryFacet.js +1 -1
- package/force-app/main/default/lwc/quanticCitation/__tests__/quanticCitation.test.js +142 -3
- package/force-app/main/default/lwc/quanticCitation/quanticCitation.html +10 -4
- package/force-app/main/default/lwc/quanticCitation/quanticCitation.js +72 -31
- package/force-app/main/default/lwc/quanticFacet/quanticFacet.js +1 -1
- package/force-app/main/default/lwc/quanticHeading/quanticHeading.js +1 -1
- package/force-app/main/default/lwc/quanticHeadlessLoader/quanticHeadlessLoader.js +4 -1
- package/force-app/main/default/lwc/quanticResultsPerPage/quanticResultsPerPage.js +1 -1
- package/force-app/main/default/lwc/quanticSmartSnippet/e2e/quanticSmartSnippet.e2e.ts +4 -28
- package/force-app/main/default/lwc/quanticSummary/quanticSummary.js +1 -1
- package/force-app/main/default/lwc/quanticTimeframe/quanticTimeframe.js +2 -2
- package/force-app/main/default/lwc/quanticUtils/facetDependenciesUtils.js +2 -2
- package/force-app/main/default/lwc/quanticUtils/quanticUtils.js +4 -4
- package/force-app/main/default/staticresources/coveoheadless/case-assist/headless.js +8 -8
- package/force-app/main/default/staticresources/coveoheadless/definitions/api/commerce/common/product.d.ts +2 -2
- package/force-app/main/default/staticresources/coveoheadless/definitions/api/search/date/date-format.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/api/search/plan/plan-response.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/api/search/search/stemming.d.ts +2 -2
- package/force-app/main/default/staticresources/coveoheadless/definitions/app/case-assist-engine/case-assist-engine-configuration.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/app/commerce-engine/commerce-engine-configuration.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/app/engine-configuration.d.ts +7 -7
- package/force-app/main/default/staticresources/coveoheadless/definitions/app/insight-engine/insight-engine-configuration.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/app/recommendation-engine/recommendation-engine-configuration.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/app/search-engine/search-engine-configuration.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/commerce.index.d.ts +2 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/controllers/breadcrumb-manager/headless-breadcrumb-manager.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/controllers/commerce/core/breadcrumb-manager/headless-core-breadcrumb-manager.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/controllers/commerce/core/facets/generator/headless-commerce-facet-generator.d.ts +0 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/controllers/commerce/core/parameter-manager/headless-core-parameter-manager.d.ts +2 -2
- package/force-app/main/default/staticresources/coveoheadless/definitions/controllers/commerce/filter-suggestions/headless-category-filter-suggestions.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/controllers/commerce/filter-suggestions/headless-filter-suggestions.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/controllers/commerce/instant-products/headless-instant-products.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/controllers/commerce/product-listing/headless-product-listing.d.ts +2 -2
- package/force-app/main/default/staticresources/coveoheadless/definitions/controllers/commerce/recent-queries-list/headless-recent-queries-list.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/controllers/commerce/recommendations/headless-recommendations.d.ts +3 -3
- package/force-app/main/default/staticresources/coveoheadless/definitions/controllers/commerce/search/headless-search.d.ts +2 -2
- package/force-app/main/default/staticresources/coveoheadless/definitions/controllers/core/breadcrumb-manager/headless-core-breadcrumb-manager.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/controllers/core/context/headless-core-context.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/controllers/core/did-you-mean/headless-core-did-you-mean.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/controllers/core/facet-manager/headless-core-facet-manager.d.ts +2 -2
- package/force-app/main/default/staticresources/coveoheadless/definitions/controllers/core/facets/category-facet/headless-core-category-facet.d.ts +2 -2
- package/force-app/main/default/staticresources/coveoheadless/definitions/controllers/core/facets/facet/headless-core-facet.d.ts +4 -4
- package/force-app/main/default/staticresources/coveoheadless/definitions/controllers/core/facets/range-facet/date-facet/headless-core-date-facet.d.ts +2 -2
- package/force-app/main/default/staticresources/coveoheadless/definitions/controllers/core/facets/range-facet/date-facet/headless-core-date-filter.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/controllers/core/facets/range-facet/numeric-facet/headless-core-numeric-facet.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/controllers/core/facets/range-facet/numeric-facet/headless-core-numeric-filter.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/controllers/core/folded-result-list/headless-core-folded-result-list.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/controllers/core/pager/headless-core-pager.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/controllers/core/query-error/headless-core-query-error.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/controllers/core/recent-queries-list/headless-core-recent-queries-list.d.ts +3 -3
- package/force-app/main/default/staticresources/coveoheadless/definitions/controllers/core/result-list/headless-core-result-list.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/controllers/core/results-per-page/headless-core-results-per-page.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/controllers/core/search-box/headless-core-search-box-options.d.ts +3 -3
- package/force-app/main/default/staticresources/coveoheadless/definitions/controllers/core/smart-snippet-questions-list/headless-core-smart-snippet-questions-list.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/controllers/core/sort/headless-core-sort.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/controllers/core/status/headless-core-status.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/controllers/core/tab/headless-core-tab.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/controllers/core/triggers/headless-core-notify-trigger.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/controllers/core/triggers/headless-core-query-trigger.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/controllers/core/triggers/headless-core-redirection-trigger.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/controllers/dictionary-field-context/headless-dictionary-field-context.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/controllers/facets/automatic-facet-generator/headless-automatic-facet-generator.d.ts +3 -3
- package/force-app/main/default/staticresources/coveoheadless/definitions/controllers/field-suggestions/category-facet/headless-category-field-suggestions.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/controllers/field-suggestions/facet/headless-field-suggestions.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/controllers/history-manager/headless-history-manager.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/controllers/instant-results/instant-results.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/controllers/query-summary/headless-query-summary.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/controllers/quickview/headless-quickview.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/controllers/recent-results-list/headless-recent-results-list.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/controllers/recommendation/headless-recommendation.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/controllers/relevance-inspector/headless-relevance-inspector.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/controllers/result-list/headless-interactive-result.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/controllers/smart-snippet-questions-list/headless-smart-snippet-questions-list.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/controllers/standalone-search-box/headless-standalone-search-box.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/controllers/static-filter/headless-static-filter.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/controllers/static-filter/static-filter-value.d.ts +2 -2
- package/force-app/main/default/staticresources/coveoheadless/definitions/controllers/triggers/headless-execute-trigger.d.ts +2 -2
- package/force-app/main/default/staticresources/coveoheadless/definitions/controllers/url-manager/headless-url-manager.d.ts +5 -5
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/advanced-search-queries/advanced-search-queries-state.d.ts +6 -6
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/analytics/analytics-actions.d.ts +2 -2
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/analytics/search-action-cause.d.ts +3 -3
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/analytics/search-analytics-actions-loader.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/case-assist-configuration/case-assist-configuration-actions.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/case-assist-configuration/case-assist-configuration-state.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/case-field/case-field-actions.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/case-input/case-input-actions.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/commerce/configuration/configuration-actions.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/commerce/configuration/configuration-state.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/commerce/facets/core-facet/core-facet-actions.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/commerce/facets/location-facet/location-facet-actions.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/commerce/facets/numeric-facet/manual-numeric-facet-selectors.d.ts +1 -21
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/commerce/facets/numeric-facet/numeric-facet-actions.d.ts +3 -3
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/commerce/pagination/pagination-selectors.d.ts +6 -126
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/commerce/product-listing/product-listing-selectors.d.ts +6 -160
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/commerce/query/query-actions.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/commerce/recommendations/recommendations-actions.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/commerce/recommendations/recommendations-selectors.d.ts +2 -42
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/commerce/search/search-actions.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/commerce/search/search-selectors.d.ts +7 -181
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/configuration/configuration-actions.d.ts +13 -13
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/configuration/configuration-selectors.d.ts +4 -48
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/configuration/configuration-state.d.ts +5 -5
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/context/context-actions-loader.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/context/context-selector.d.ts +2 -24
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/debug/ranking-info-parser.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/dictionary-field-context/dictionary-field-context-actions-loader.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/did-you-mean/did-you-mean-actions-loader.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/did-you-mean/did-you-mean-selectors.d.ts +1 -21
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/excerpt-length/excerpt-length-selectors.d.ts +2 -24
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/facet-options/facet-options-actions-loader.d.ts +2 -2
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/facets/category-facet-set/category-facet-set-actions-loader.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/facets/category-facet-set/category-facet-set-actions.d.ts +5 -5
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/facets/facet-set/facet-set-actions-loader.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/facets/facet-set/facet-set-actions.d.ts +6 -6
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/facets/range-facets/date-facet-set/date-facet-actions-loader.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/facets/range-facets/date-facet-set/date-facet-actions.d.ts +3 -3
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/facets/range-facets/numeric-facet-set/numeric-facet-actions-loader.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/facets/range-facets/numeric-facet-set/numeric-facet-actions.d.ts +3 -3
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/fields/fields-actions-loader.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/generated-answer/generated-answer-actions.d.ts +3 -2
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/generated-answer/generated-answer-mocks.d.ts +11 -0
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/instant-items/instant-items-state.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/pipeline/select-pipeline.d.ts +2 -24
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/query/query-actions.d.ts +2 -2
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/query/query-selectors.d.ts +4 -48
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/query/query-state.d.ts +2 -2
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/query-suggest/query-suggest-actions.d.ts +6 -6
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/query-suggest/query-suggest-state.d.ts +2 -2
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/question-answering/question-answering-state.d.ts +2 -2
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/recommendation/recommendation-state.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/search/search-actions.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/search-hub/search-hub-selectors.d.ts +2 -24
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/search-parameters/search-parameter-actions.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/sort-criteria/criteria-parser.d.ts +2 -2
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/sort-criteria/sort-criteria-selectors.d.ts +2 -24
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/static-filter-set/static-filter-set-actions-loader.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/static-filter-set/static-filter-set-state.d.ts +2 -2
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/tab-set/tab-set-actions-loader.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/tab-set/tab-set-actions.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/insight.index.d.ts +0 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/ssr/common/types/engine.d.ts +9 -0
- package/force-app/main/default/staticresources/coveoheadless/definitions/ssr/search/controllers/facets/range-facet/date-facet/headless-date-facet.ssr.d.ts +0 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/ssr/search/controllers/facets/range-facet/numeric-facet/headless-numeric-facet.ssr.d.ts +0 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/ssr/search/controllers/static-filter/headless-static-filter.ssr.d.ts +0 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/ssr-next/commerce/types/build.d.ts +75 -0
- package/force-app/main/default/staticresources/coveoheadless/definitions/ssr-next/commerce/types/engine.d.ts +52 -2
- package/force-app/main/default/staticresources/coveoheadless/definitions/ssr-next/common/types/engine.d.ts +53 -0
- package/force-app/main/default/staticresources/coveoheadless/definitions/ssr-next/search/controllers/facets/range-facet/date-facet/headless-date-facet.ssr.d.ts +0 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/ssr-next/search/controllers/facets/range-facet/numeric-facet/headless-numeric-facet.ssr.d.ts +0 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/ssr-next/search/controllers/static-filter/headless-static-filter.ssr.d.ts +0 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/ssr-next/search/engine/search-engine.ssr.d.ts +17 -5
- package/force-app/main/default/staticresources/coveoheadless/definitions/ssr-next/search/factories/standalone-static-state-factory.d.ts +9 -0
- package/force-app/main/default/staticresources/coveoheadless/definitions/ssr-next/search/types/engine.d.ts +4 -0
- package/force-app/main/default/staticresources/coveoheadless/headless.js +10 -10
- package/force-app/main/default/staticresources/coveoheadless/insight/headless.js +9 -9
- package/force-app/main/default/staticresources/coveoheadless/recommendation/headless.js +7 -7
- package/package.json +3 -3
|
@@ -1,51 +1,7 @@
|
|
|
1
1
|
import type { QueryState } from './query-state.js';
|
|
2
|
-
export declare const selectQuery: (
|
|
2
|
+
export declare const selectQuery: (state: {
|
|
3
3
|
query?: QueryState;
|
|
4
|
-
}) => QueryState | undefined
|
|
5
|
-
|
|
6
|
-
resultsCount: () => number;
|
|
7
|
-
resetResultsCount: () => void;
|
|
8
|
-
} & {
|
|
9
|
-
resultFunc: (resultFuncArgs_0: QueryState | undefined) => QueryState | undefined;
|
|
10
|
-
memoizedResultFunc: ((resultFuncArgs_0: QueryState | undefined) => QueryState | undefined) & {
|
|
11
|
-
clearCache: () => void;
|
|
12
|
-
resultsCount: () => number;
|
|
13
|
-
resetResultsCount: () => void;
|
|
14
|
-
};
|
|
15
|
-
lastResult: () => QueryState | undefined;
|
|
16
|
-
dependencies: [(state: {
|
|
17
|
-
query?: QueryState;
|
|
18
|
-
}) => QueryState | undefined];
|
|
19
|
-
recomputations: () => number;
|
|
20
|
-
resetRecomputations: () => void;
|
|
21
|
-
dependencyRecomputations: () => number;
|
|
22
|
-
resetDependencyRecomputations: () => void;
|
|
23
|
-
} & {
|
|
24
|
-
argsMemoize: typeof import("reselect").weakMapMemoize;
|
|
25
|
-
memoize: typeof import("reselect").weakMapMemoize;
|
|
26
|
-
};
|
|
27
|
-
export declare const selectEnableQuerySyntax: ((state: {
|
|
4
|
+
}) => QueryState | undefined;
|
|
5
|
+
export declare const selectEnableQuerySyntax: (state: {
|
|
28
6
|
query?: QueryState;
|
|
29
|
-
}) => boolean | undefined
|
|
30
|
-
clearCache: () => void;
|
|
31
|
-
resultsCount: () => number;
|
|
32
|
-
resetResultsCount: () => void;
|
|
33
|
-
} & {
|
|
34
|
-
resultFunc: (resultFuncArgs_0: boolean | undefined) => boolean | undefined;
|
|
35
|
-
memoizedResultFunc: ((resultFuncArgs_0: boolean | undefined) => boolean | undefined) & {
|
|
36
|
-
clearCache: () => void;
|
|
37
|
-
resultsCount: () => number;
|
|
38
|
-
resetResultsCount: () => void;
|
|
39
|
-
};
|
|
40
|
-
lastResult: () => boolean | undefined;
|
|
41
|
-
dependencies: [(state: {
|
|
42
|
-
query?: QueryState;
|
|
43
|
-
}) => boolean | undefined];
|
|
44
|
-
recomputations: () => number;
|
|
45
|
-
resetRecomputations: () => void;
|
|
46
|
-
dependencyRecomputations: () => number;
|
|
47
|
-
resetDependencyRecomputations: () => void;
|
|
48
|
-
} & {
|
|
49
|
-
argsMemoize: typeof import("reselect").weakMapMemoize;
|
|
50
|
-
memoize: typeof import("reselect").weakMapMemoize;
|
|
51
|
-
};
|
|
7
|
+
}) => boolean | undefined;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
export interface QueryState {
|
|
2
2
|
/**
|
|
3
|
-
* The basic query expression (
|
|
3
|
+
* The basic query expression (for example, `acme tornado seeds`).
|
|
4
4
|
*/
|
|
5
5
|
q: string;
|
|
6
6
|
/**
|
|
7
|
-
* Whether to interpret advanced [Coveo
|
|
7
|
+
* Whether to interpret advanced [Coveo query syntax](https://docs.coveo.com/en/1552/) in the query.
|
|
8
8
|
*/
|
|
9
9
|
enableQuerySyntax: boolean;
|
|
10
10
|
}
|
|
@@ -5,11 +5,11 @@ import type { ConfigurationSection, ContextSection, PipelineSection, QuerySetSec
|
|
|
5
5
|
export type StateNeededByQuerySuggest = ConfigurationSection & QuerySuggestionSection & QuerySetSection & Partial<ContextSection & PipelineSection & SearchHubSection>;
|
|
6
6
|
export interface RegisterQuerySuggestActionCreatorPayload {
|
|
7
7
|
/**
|
|
8
|
-
* A unique identifier for the new query suggest entity (
|
|
8
|
+
* A unique identifier for the new query suggest entity (for example, `b953ab2e-022b-4de4-903f-68b2c0682942`). Usually, this will be the ID of the search box controller that requests the query suggestions.
|
|
9
9
|
*/
|
|
10
10
|
id: string;
|
|
11
11
|
/**
|
|
12
|
-
* The number of query suggestions to request from Coveo ML (
|
|
12
|
+
* The number of query suggestions to request from Coveo ML (for example, `3`).
|
|
13
13
|
*
|
|
14
14
|
* @defaultValue `5`.
|
|
15
15
|
*/
|
|
@@ -23,25 +23,25 @@ export declare const unregisterQuerySuggest: import("@reduxjs/toolkit").ActionCr
|
|
|
23
23
|
}, "querySuggest/unregister", never, never>;
|
|
24
24
|
export interface SelectQuerySuggestionActionCreatorPayload {
|
|
25
25
|
/**
|
|
26
|
-
* The unique identifier of the target query suggest entity (
|
|
26
|
+
* The unique identifier of the target query suggest entity (for example, `b953ab2e-022b-4de4-903f-68b2c0682942`). Usually, this will be the ID of the search box controller that requests the query suggestions.
|
|
27
27
|
*/
|
|
28
28
|
id: string;
|
|
29
29
|
/**
|
|
30
|
-
* The selected query suggestion (
|
|
30
|
+
* The selected query suggestion (for example, `coveo`).
|
|
31
31
|
*/
|
|
32
32
|
expression: string;
|
|
33
33
|
}
|
|
34
34
|
export declare const selectQuerySuggestion: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[payload: SelectQuerySuggestionActionCreatorPayload], SelectQuerySuggestionActionCreatorPayload, "querySuggest/selectSuggestion", never, never>;
|
|
35
35
|
export interface ClearQuerySuggestActionCreatorPayload {
|
|
36
36
|
/**
|
|
37
|
-
* The unique identifier of the target query suggest entity (
|
|
37
|
+
* The unique identifier of the target query suggest entity (for example, `b953ab2e-022b-4de4-903f-68b2c0682942`). Usually, this will be the ID of the search box controller that requests the query suggestions.
|
|
38
38
|
*/
|
|
39
39
|
id: string;
|
|
40
40
|
}
|
|
41
41
|
export declare const clearQuerySuggest: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[payload: ClearQuerySuggestActionCreatorPayload], ClearQuerySuggestActionCreatorPayload, "querySuggest/clear", never, never>;
|
|
42
42
|
export interface FetchQuerySuggestionsActionCreatorPayload {
|
|
43
43
|
/**
|
|
44
|
-
* The unique identifier of the target query suggest entity (
|
|
44
|
+
* The unique identifier of the target query suggest entity (for example, `b953ab2e-022b-4de4-903f-68b2c0682942`). Usually, this will be the ID of the search box controller that requests the query suggestions.
|
|
45
45
|
*/
|
|
46
46
|
id: string;
|
|
47
47
|
}
|
|
@@ -2,7 +2,7 @@ import type { QuerySuggestCompletion } from '../../api/search/query-suggest/quer
|
|
|
2
2
|
import type { SearchAPIErrorWithStatusCode } from '../../api/search/search-api-error-response.js';
|
|
3
3
|
export interface QuerySuggestState {
|
|
4
4
|
/**
|
|
5
|
-
* The unique identifier of the query suggest entity (
|
|
5
|
+
* The unique identifier of the query suggest entity (for example, `b953ab2e-022b-4de4-903f-68b2c0682942`).
|
|
6
6
|
*/
|
|
7
7
|
id: string;
|
|
8
8
|
/**
|
|
@@ -18,7 +18,7 @@ export interface QuerySuggestState {
|
|
|
18
18
|
*/
|
|
19
19
|
partialQueries: string[];
|
|
20
20
|
/**
|
|
21
|
-
* The number of query suggestions requested from Coveo ML (
|
|
21
|
+
* The number of query suggestions requested from Coveo ML (for example, `3`).
|
|
22
22
|
*/
|
|
23
23
|
count: number;
|
|
24
24
|
/**
|
|
@@ -5,7 +5,7 @@ export interface QuestionAnsweringRelatedQuestionState extends QuestionAnswerDoc
|
|
|
5
5
|
*/
|
|
6
6
|
expanded: boolean;
|
|
7
7
|
/**
|
|
8
|
-
* The unique identifier for this question
|
|
8
|
+
* The unique identifier for this question and answer.
|
|
9
9
|
*/
|
|
10
10
|
questionAnswerId: string;
|
|
11
11
|
}
|
|
@@ -27,7 +27,7 @@ export interface QuestionAnsweringState {
|
|
|
27
27
|
*/
|
|
28
28
|
feedbackModalOpen: boolean;
|
|
29
29
|
/**
|
|
30
|
-
* The unique identifier for this question
|
|
30
|
+
* The unique identifier for this question and answer.
|
|
31
31
|
*/
|
|
32
32
|
questionAnswerId?: string;
|
|
33
33
|
relatedQuestions: QuestionAnsweringRelatedQuestionState[];
|
|
@@ -28,7 +28,7 @@ export interface RecommendationState {
|
|
|
28
28
|
*/
|
|
29
29
|
searchUid: string;
|
|
30
30
|
/**
|
|
31
|
-
* The version of the A/B test that applied to the related recommendation (
|
|
31
|
+
* The version of the A/B test that applied to the related recommendation (that is, version A or version B).
|
|
32
32
|
*/
|
|
33
33
|
splitTestRun: string;
|
|
34
34
|
/**
|
|
@@ -22,7 +22,7 @@ export interface ExecuteSearchThunkReturn {
|
|
|
22
22
|
export interface PrepareForSearchWithQueryOptions {
|
|
23
23
|
/**
|
|
24
24
|
* Whether to clear all active query filters when the end user submits a new query from the search box.
|
|
25
|
-
* Setting this option to "false" is not recommended
|
|
25
|
+
* Setting this option to "false" is not recommended and can lead to an increasing number of queries returning no results.
|
|
26
26
|
*/
|
|
27
27
|
clearFilters: boolean;
|
|
28
28
|
}
|
|
@@ -1,25 +1,3 @@
|
|
|
1
|
-
export declare const selectSearchHub: (
|
|
1
|
+
export declare const selectSearchHub: (state: {
|
|
2
2
|
searchHub?: string;
|
|
3
|
-
}) => string | undefined
|
|
4
|
-
clearCache: () => void;
|
|
5
|
-
resultsCount: () => number;
|
|
6
|
-
resetResultsCount: () => void;
|
|
7
|
-
} & {
|
|
8
|
-
resultFunc: (resultFuncArgs_0: string | undefined) => string | undefined;
|
|
9
|
-
memoizedResultFunc: ((resultFuncArgs_0: string | undefined) => string | undefined) & {
|
|
10
|
-
clearCache: () => void;
|
|
11
|
-
resultsCount: () => number;
|
|
12
|
-
resetResultsCount: () => void;
|
|
13
|
-
};
|
|
14
|
-
lastResult: () => string | undefined;
|
|
15
|
-
dependencies: [(state: {
|
|
16
|
-
searchHub?: string;
|
|
17
|
-
}) => string | undefined];
|
|
18
|
-
recomputations: () => number;
|
|
19
|
-
resetRecomputations: () => void;
|
|
20
|
-
dependencyRecomputations: () => number;
|
|
21
|
-
resetDependencyRecomputations: () => void;
|
|
22
|
-
} & {
|
|
23
|
-
argsMemoize: typeof import("reselect").weakMapMemoize;
|
|
24
|
-
memoize: typeof import("reselect").weakMapMemoize;
|
|
25
|
-
};
|
|
3
|
+
}) => string | undefined;
|
|
@@ -25,7 +25,7 @@ export interface SearchParameters {
|
|
|
25
25
|
*/
|
|
26
26
|
df?: Record<string, DateRangeRequest[]>;
|
|
27
27
|
/**
|
|
28
|
-
* Whether to interpret advanced [Coveo
|
|
28
|
+
* Whether to interpret advanced [Coveo query syntax](https://docs.coveo.com/en/1552/) in the query.
|
|
29
29
|
*/
|
|
30
30
|
enableQuerySyntax?: boolean;
|
|
31
31
|
/**
|
|
@@ -7,8 +7,8 @@ import { type SortCriterion } from './criteria.js';
|
|
|
7
7
|
* - `relevancy`
|
|
8
8
|
* - `date ascending`/`date descending`
|
|
9
9
|
* - `qre`
|
|
10
|
-
* - `field ascending`/`field descending`, where you replace `field` with the name of a sortable field in your index (
|
|
10
|
+
* - `field ascending`/`field descending`, where you replace `field` with the name of a sortable field in your index (for example, `criteria="size ascending"`).
|
|
11
11
|
*
|
|
12
|
-
* You can specify multiple sort criteria to be used in the same request by separating them with a comma (
|
|
12
|
+
* You can specify multiple sort criteria to be used in the same request by separating them with a comma (for example, `criteria="size ascending, date ascending"` ).
|
|
13
13
|
*/
|
|
14
14
|
export declare function parseCriterionExpression(expression: string): SortCriterion[];
|
|
@@ -1,26 +1,4 @@
|
|
|
1
1
|
import type { SortCriteriaState } from './sort-criteria-state.js';
|
|
2
|
-
export declare const selectSortCriteria: (
|
|
2
|
+
export declare const selectSortCriteria: (state: {
|
|
3
3
|
sortCriteria?: SortCriteriaState;
|
|
4
|
-
}) => string | undefined
|
|
5
|
-
clearCache: () => void;
|
|
6
|
-
resultsCount: () => number;
|
|
7
|
-
resetResultsCount: () => void;
|
|
8
|
-
} & {
|
|
9
|
-
resultFunc: (resultFuncArgs_0: string | undefined) => string | undefined;
|
|
10
|
-
memoizedResultFunc: ((resultFuncArgs_0: string | undefined) => string | undefined) & {
|
|
11
|
-
clearCache: () => void;
|
|
12
|
-
resultsCount: () => number;
|
|
13
|
-
resetResultsCount: () => void;
|
|
14
|
-
};
|
|
15
|
-
lastResult: () => string | undefined;
|
|
16
|
-
dependencies: [(state: {
|
|
17
|
-
sortCriteria?: SortCriteriaState;
|
|
18
|
-
}) => string | undefined];
|
|
19
|
-
recomputations: () => number;
|
|
20
|
-
resetRecomputations: () => void;
|
|
21
|
-
dependencyRecomputations: () => number;
|
|
22
|
-
resetDependencyRecomputations: () => void;
|
|
23
|
-
} & {
|
|
24
|
-
argsMemoize: typeof import("reselect").weakMapMemoize;
|
|
25
|
-
memoize: typeof import("reselect").weakMapMemoize;
|
|
26
|
-
};
|
|
4
|
+
}) => string | undefined;
|
|
@@ -33,7 +33,7 @@ export interface StaticFilterSetActionCreators {
|
|
|
33
33
|
/**
|
|
34
34
|
* Deselects all values of a filter.
|
|
35
35
|
*
|
|
36
|
-
* @param id - The unique identifier of the static filter (
|
|
36
|
+
* @param id - The unique identifier of the static filter (for example, `"abc"`).
|
|
37
37
|
* @returns A dispatchable action.
|
|
38
38
|
*/
|
|
39
39
|
deselectAllStaticFilterValues(id: string): PayloadAction<string>;
|
|
@@ -6,11 +6,11 @@ export interface StaticFilterSlice {
|
|
|
6
6
|
}
|
|
7
7
|
export interface StaticFilterValue {
|
|
8
8
|
/**
|
|
9
|
-
* A human-readable caption for the expression (
|
|
9
|
+
* A human-readable caption for the expression (for example, `Youtube`).
|
|
10
10
|
*/
|
|
11
11
|
caption: string;
|
|
12
12
|
/**
|
|
13
|
-
* The query filter expression to apply when the value is selected (
|
|
13
|
+
* The query filter expression to apply when the value is selected (for example, `@filetype=="youtubevideo"`).
|
|
14
14
|
*/
|
|
15
15
|
expression: string;
|
|
16
16
|
/**
|
|
@@ -17,7 +17,7 @@ export interface TabSetActionCreators {
|
|
|
17
17
|
registerTab(payload: RegisterTabActionCreatorPayload): PayloadAction<RegisterTabActionCreatorPayload>;
|
|
18
18
|
/**
|
|
19
19
|
* Updates the active tab, deselecting other tabs.
|
|
20
|
-
* @param id - The unique identifier of the target tab (
|
|
20
|
+
* @param id - The unique identifier of the target tab (for example, `"abc"`).
|
|
21
21
|
* @returns A dispatchable action.
|
|
22
22
|
*/
|
|
23
23
|
updateActiveTab(id: string): PayloadAction<string>;
|
|
@@ -102,7 +102,6 @@ export * from './features/context/context-actions-loader.js';
|
|
|
102
102
|
export type { CategoryFacetSortCriterion, CategoryFacetValueRequest, } from './features/facets/category-facet-set/interfaces/request.js';
|
|
103
103
|
export type { FacetSortCriterion, FacetValueRequest, } from './features/facets/facet-set/interfaces/request.js';
|
|
104
104
|
export * from './features/facets/range-facets/date-facet-set/date-facet-actions-loader.js';
|
|
105
|
-
export * from './features/facets/range-facets/date-facet-set/date-facet-actions-loader.js';
|
|
106
105
|
export type { DateFacetValue } from './features/facets/range-facets/date-facet-set/interfaces/response.js';
|
|
107
106
|
export type { RangeFacetRangeAlgorithm, RangeFacetSortCriterion, } from './features/facets/range-facets/generic/interfaces/request.js';
|
|
108
107
|
export type { NumericFacetValue } from './features/facets/range-facets/numeric-facet-set/interfaces/response.js';
|
|
@@ -41,6 +41,15 @@ export interface EngineDefinition<TEngine extends CoreEngine | CoreEngineNext, T
|
|
|
41
41
|
* Builds an engine and its controllers from an engine definition.
|
|
42
42
|
*/
|
|
43
43
|
build: Build<TEngine, TEngineOptions, InferControllersMapFromDefinition<TControllers>, InferControllerPropsMapFromDefinitions<TControllers>>;
|
|
44
|
+
/**
|
|
45
|
+
* Returns the access token.
|
|
46
|
+
*/
|
|
47
|
+
getAccessToken: () => string;
|
|
48
|
+
/**
|
|
49
|
+
* Updates the access token.
|
|
50
|
+
* @param accessToken - The access token to update.
|
|
51
|
+
*/
|
|
52
|
+
setAccessToken: (accessToken: string) => void;
|
|
44
53
|
}
|
|
45
54
|
/**
|
|
46
55
|
* @deprecated Use SearchEngineDefinitionBuildResult or CommerceEngineDefinitionBuildResult instead
|
|
@@ -2,7 +2,6 @@ import type { SearchEngine } from '../../../../../../app/search-engine/search-en
|
|
|
2
2
|
import { type DateFacet, type DateFacetProps } from '../../../../../../controllers/facets/range-facet/date-facet/headless-date-facet.js';
|
|
3
3
|
import type { ControllerDefinitionWithoutProps } from '../../../../../common/types/controllers.js';
|
|
4
4
|
export * from '../../../../../../controllers/facets/range-facet/date-facet/headless-date-facet.js';
|
|
5
|
-
export { buildDateRange } from '../../../../../../controllers/facets/range-facet/date-facet/headless-date-facet.js';
|
|
6
5
|
export interface DateFacetDefinition extends ControllerDefinitionWithoutProps<SearchEngine, DateFacet> {
|
|
7
6
|
}
|
|
8
7
|
/**
|
|
@@ -2,7 +2,6 @@ import type { SearchEngine } from '../../../../../../app/search-engine/search-en
|
|
|
2
2
|
import { type NumericFacet, type NumericFacetProps } from '../../../../../../controllers/facets/range-facet/numeric-facet/headless-numeric-facet.js';
|
|
3
3
|
import type { ControllerDefinitionWithoutProps } from '../../../../../common/types/controllers.js';
|
|
4
4
|
export * from '../../../../../../controllers/facets/range-facet/numeric-facet/headless-numeric-facet.js';
|
|
5
|
-
export { buildNumericRange } from '../../../../../../controllers/facets/range-facet/numeric-facet/headless-numeric-facet.js';
|
|
6
5
|
export interface NumericFacetDefinition extends ControllerDefinitionWithoutProps<SearchEngine, NumericFacet> {
|
|
7
6
|
}
|
|
8
7
|
/**
|
|
@@ -2,7 +2,6 @@ import type { SearchEngine } from '../../../../app/search-engine/search-engine.j
|
|
|
2
2
|
import { type StaticFilter, type StaticFilterProps } from '../../../../controllers/static-filter/headless-static-filter.js';
|
|
3
3
|
import type { ControllerDefinitionWithoutProps } from '../../../common/types/controllers.js';
|
|
4
4
|
export * from '../../../../controllers/static-filter/headless-static-filter.js';
|
|
5
|
-
export { buildStaticFilterValue } from '../../../../controllers/static-filter/headless-static-filter.js';
|
|
6
5
|
export interface StaticFilterDefinition extends ControllerDefinitionWithoutProps<SearchEngine, StaticFilter> {
|
|
7
6
|
}
|
|
8
7
|
/**
|
|
@@ -75,9 +75,84 @@ export interface ListingBuildConfig extends CommonBuildConfig {
|
|
|
75
75
|
export interface StandaloneBuildConfig extends CommonBuildConfig {
|
|
76
76
|
}
|
|
77
77
|
export interface CommonBuildConfig {
|
|
78
|
+
/**
|
|
79
|
+
* The `NavigatorContext` interface represents the context of the browser client.
|
|
80
|
+
* See {@link NavigatorContext}
|
|
81
|
+
*/
|
|
78
82
|
navigatorContext: NavigatorContext;
|
|
83
|
+
/**
|
|
84
|
+
* The initial context options passed to the engine when fetching the static state.
|
|
85
|
+
*
|
|
86
|
+
* This property is used to configure the commerce context (e.g., currency, language, country)
|
|
87
|
+
* when calling `fetchStaticState()`.
|
|
88
|
+
*
|
|
89
|
+
* @remarks
|
|
90
|
+
* To access the context after engine creation, use the context controller.
|
|
91
|
+
*
|
|
92
|
+
* @example
|
|
93
|
+
* ```typescript
|
|
94
|
+
* // Setting context during static state fetch
|
|
95
|
+
* const staticState = await engineDefinition.fetchStaticState({
|
|
96
|
+
* context: { currency: 'USD', language: 'en', country: 'US' },
|
|
97
|
+
* // ...other config
|
|
98
|
+
* });
|
|
99
|
+
*
|
|
100
|
+
* // Reading context from the static state
|
|
101
|
+
* const {context} = staticState.controllers;
|
|
102
|
+
* console.log(context.state.currency); // 'USD'
|
|
103
|
+
* ```
|
|
104
|
+
*/
|
|
79
105
|
context: ContextOptions;
|
|
106
|
+
/**
|
|
107
|
+
* The initial search parameters to apply when fetching the static state.
|
|
108
|
+
*
|
|
109
|
+
* This property allows you to set initial search parameters (filters, facets, query, etc.)
|
|
110
|
+
* that will be applied during the server-side search execution.
|
|
111
|
+
*
|
|
112
|
+
* @remarks
|
|
113
|
+
* To access search parameters after engine creation, use the parameter manager controller.
|
|
114
|
+
*
|
|
115
|
+
* @example
|
|
116
|
+
* ```typescript
|
|
117
|
+
* // Setting search parameters during static state fetch
|
|
118
|
+
* const staticState = await engineDefinition.fetchStaticState({
|
|
119
|
+
* searchParams: {
|
|
120
|
+
* q: 'shoes',
|
|
121
|
+
* },
|
|
122
|
+
* // ...other config
|
|
123
|
+
* });
|
|
124
|
+
*
|
|
125
|
+
* // Reading search parameters from the static state
|
|
126
|
+
* const {parameterManager} = staticState.controllers;
|
|
127
|
+
* console.log(parameterManager.state.parameters.q); // 'shoes'
|
|
128
|
+
* ```
|
|
129
|
+
*/
|
|
80
130
|
searchParams?: ParameterManagerState<Parameters>['parameters'];
|
|
131
|
+
/**
|
|
132
|
+
* The initial cart state to apply when fetching the static state.
|
|
133
|
+
*
|
|
134
|
+
* This property allows you to set an initial cart state that will be used during
|
|
135
|
+
* server-side rendering.
|
|
136
|
+
*
|
|
137
|
+
* @remarks
|
|
138
|
+
* To access cart state after engine creation, use the cart controller.
|
|
139
|
+
*
|
|
140
|
+
* @example
|
|
141
|
+
* ```typescript
|
|
142
|
+
* // Setting cart state during static state fetch
|
|
143
|
+
* const staticState = await engineDefinition.fetchStaticState({
|
|
144
|
+
* cart: {
|
|
145
|
+
* // This is a simplified example. The actual item structure may require additional properties.
|
|
146
|
+
* items: [{ productId: 'abc123', quantity: 1 }]
|
|
147
|
+
* },
|
|
148
|
+
* // ...other config
|
|
149
|
+
* });
|
|
150
|
+
*
|
|
151
|
+
* // Reading cart state from the static state
|
|
152
|
+
* const {cart} = staticState.controllers;
|
|
153
|
+
* console.log(cart.state.items.length); // 1
|
|
154
|
+
* ```
|
|
155
|
+
*/
|
|
81
156
|
cart?: CartInitialState;
|
|
82
157
|
}
|
|
83
158
|
export type BuildConfig<TControllers extends ControllerDefinitionsMap<Controller>, TSolutionType extends SolutionType> = TSolutionType extends SolutionType.search ? SearchBuildConfig : TSolutionType extends SolutionType.listing ? ListingBuildConfig : TSolutionType extends SolutionType.recommendation ? RecommendationBuildConfig<TControllers> : TSolutionType extends SolutionType.standalone ? CommonBuildConfig : never;
|
|
@@ -29,11 +29,61 @@ export type CommerceEngineDefinitionOptions<TControllers extends ControllerDefin
|
|
|
29
29
|
};
|
|
30
30
|
export interface CommerceEngineDefinition<TControllers extends ControllerDefinitionsMap<Controller>, TSolutionType extends SolutionType> {
|
|
31
31
|
/**
|
|
32
|
-
*
|
|
32
|
+
* Executes a commerce search/listing/recommendation request on the server side and returns the static state.
|
|
33
|
+
*
|
|
34
|
+
* This method performs the initial commerce request based on the solution type, captures the response,
|
|
35
|
+
* and returns a serializable state snapshot that can be transferred to the client for hydration.
|
|
36
|
+
*
|
|
37
|
+
* The returned static state includes controller states (facets, products, pagination, etc.)
|
|
38
|
+
*
|
|
39
|
+
* @param params - A configuration object containing navigation context, search parameters,
|
|
40
|
+
* cart state, and controller-specific props
|
|
41
|
+
* @returns A Promise that resolves to the static state containing controller states
|
|
42
|
+
*
|
|
43
|
+
* @example
|
|
44
|
+
* ```typescript
|
|
45
|
+
* // For a search page
|
|
46
|
+
* const staticState = await searchEngineDefinition.fetchStaticState({
|
|
47
|
+
* navigatorContext: { ... },
|
|
48
|
+
* context: { ... },
|
|
49
|
+
* searchParams: { q: 'running shoes' }
|
|
50
|
+
* });
|
|
51
|
+
*
|
|
52
|
+
* // For recommendations
|
|
53
|
+
* const staticState = await recommendationEngineDefinition.fetchStaticState({
|
|
54
|
+
* navigatorContext: { ... },
|
|
55
|
+
* context: { ... },
|
|
56
|
+
* recommendations: ['popularProducts'],
|
|
57
|
+
* productId: 'abc123'
|
|
58
|
+
* });
|
|
59
|
+
* ```
|
|
33
60
|
*/
|
|
34
61
|
fetchStaticState: FetchStaticState<UnknownAction, InferControllerStaticStateMapFromDefinitionsWithSolutionType<TControllers, TSolutionType>, InferControllerPropsMapFromDefinitions<TControllers>, TControllers, TSolutionType>;
|
|
35
62
|
/**
|
|
36
|
-
*
|
|
63
|
+
* Creates a commerce engine on the client side from the server-side static state.
|
|
64
|
+
*
|
|
65
|
+
* This method is used for client-side hydration in SSR scenarios. It takes the static state
|
|
66
|
+
* generated by `fetchStaticState()` on the server and reconstructs a live commerce engine
|
|
67
|
+
* with all controllers in the exact same state as they were on the server.
|
|
68
|
+
*
|
|
69
|
+
* The hydration process:
|
|
70
|
+
* - Recreates the engine with the same configuration
|
|
71
|
+
* - Restores all controller states from the static state
|
|
72
|
+
* - Replays search/listing/recommendation actions to synchronize the state
|
|
73
|
+
* - Returns live, interactive controllers ready for user interaction
|
|
74
|
+
*
|
|
75
|
+
* @param params - A configuration object containing the static state, navigation context,
|
|
76
|
+
* and any controller-specific props needed for hydration
|
|
77
|
+
* @returns A Promise that resolves to the hydrated engine and interactive controllers
|
|
78
|
+
*
|
|
79
|
+
* @example
|
|
80
|
+
* ```typescript
|
|
81
|
+
* // Client-side hydration
|
|
82
|
+
* const result = await engineDefinition.hydrateStaticState(staticState);
|
|
83
|
+
*
|
|
84
|
+
* // Controllers are now interactive
|
|
85
|
+
* result.controllers.productListing.sort({ criterion: 'price' });
|
|
86
|
+
* ```
|
|
37
87
|
*/
|
|
38
88
|
hydrateStaticState: HydrateStaticState<InferControllersMapFromDefinition<TControllers, TSolutionType>, UnknownAction, InferControllerPropsMapFromDefinitions<TControllers>, TControllers, TSolutionType>;
|
|
39
89
|
/**
|
|
@@ -1,12 +1,65 @@
|
|
|
1
1
|
import type { UnknownAction } from '@reduxjs/toolkit';
|
|
2
2
|
import type { ControllerStaticStateMap } from './controllers.js';
|
|
3
3
|
export interface EngineStaticState<TSearchAction extends UnknownAction, TControllers extends ControllerStaticStateMap> {
|
|
4
|
+
/**
|
|
5
|
+
* An array of Redux actions representing completed search operations that were executed when the static state was fetched.
|
|
6
|
+
*
|
|
7
|
+
* These actions capture the results of search requests (both successful and failed) performed on the server side.
|
|
8
|
+
* During client-side hydration, these actions are replayed to restore the engine to the exact same state
|
|
9
|
+
* it was in on the server, ensuring consistency between server-rendered and client-rendered content.
|
|
10
|
+
*
|
|
11
|
+
* Each action contains the search results, metadata, and any error information from the Search API responses.
|
|
12
|
+
*/
|
|
4
13
|
searchActions: TSearchAction[];
|
|
14
|
+
/**
|
|
15
|
+
* A map of controller static states, where each key is the controller name and
|
|
16
|
+
* each value contains the serializable state of that controller.
|
|
17
|
+
*/
|
|
5
18
|
controllers: TControllers;
|
|
6
19
|
}
|
|
20
|
+
/**
|
|
21
|
+
* Utility type to infer the static state type from an engine definition's `fetchStaticState` method.
|
|
22
|
+
*
|
|
23
|
+
* This type extracts the resolved type from the Promise returned by `fetchStaticState`,
|
|
24
|
+
* allowing you to work with the static state type without manually specifying it.
|
|
25
|
+
*
|
|
26
|
+
* @template T - An object with a `fetchStaticState` method that returns a Promise
|
|
27
|
+
*
|
|
28
|
+
* @example
|
|
29
|
+
* ```typescript
|
|
30
|
+
* const searchEngineDefinition = defineSearchEngine({
|
|
31
|
+
* configuration: { organizationId: 'myorg', accessToken: 'token' },
|
|
32
|
+
* controllers: { searchBox: defineSearchBox() }
|
|
33
|
+
* });
|
|
34
|
+
*
|
|
35
|
+
* type StaticState = InferStaticState<typeof searchEngineDefinition>;
|
|
36
|
+
* ```
|
|
37
|
+
*
|
|
38
|
+
* @group Engine
|
|
39
|
+
*/
|
|
7
40
|
export type InferStaticState<T extends {
|
|
8
41
|
fetchStaticState(...args: unknown[]): Promise<unknown>;
|
|
9
42
|
}> = Awaited<ReturnType<T['fetchStaticState']>>;
|
|
43
|
+
/**
|
|
44
|
+
* Utility type to infer the hydrated state type from an engine definition's `hydrateStaticState` method.
|
|
45
|
+
*
|
|
46
|
+
* This type extracts the resolved type from the Promise returned by `hydrateStaticState`,
|
|
47
|
+
* allowing you to work with the hydrated state type without manually specifying it.
|
|
48
|
+
*
|
|
49
|
+
* @template T - An object with a `hydrateStaticState` method that returns a Promise
|
|
50
|
+
*
|
|
51
|
+
* @example
|
|
52
|
+
* ```typescript
|
|
53
|
+
* const searchEngineDefinition = defineSearchEngine({
|
|
54
|
+
* configuration: { organizationId: 'myorg', accessToken: 'token' },
|
|
55
|
+
* controllers: { searchBox: defineSearchBox() }
|
|
56
|
+
* });
|
|
57
|
+
*
|
|
58
|
+
* type HydratedState = InferHydratedState<typeof searchEngineDefinition>;
|
|
59
|
+
* ```
|
|
60
|
+
*
|
|
61
|
+
* @group Engine
|
|
62
|
+
*/
|
|
10
63
|
export type InferHydratedState<T extends {
|
|
11
64
|
hydrateStaticState(...args: unknown[]): Promise<unknown>;
|
|
12
65
|
}> = Awaited<ReturnType<T['hydrateStaticState']>>;
|
|
@@ -2,7 +2,6 @@ import type { SearchEngine } from '../../../../../../app/search-engine/search-en
|
|
|
2
2
|
import { type DateFacet, type DateFacetProps } from '../../../../../../controllers/facets/range-facet/date-facet/headless-date-facet.js';
|
|
3
3
|
import type { ControllerDefinitionWithoutProps } from '../../../../types/controller-definition.js';
|
|
4
4
|
export * from '../../../../../../controllers/facets/range-facet/date-facet/headless-date-facet.js';
|
|
5
|
-
export { buildDateRange } from '../../../../../../controllers/facets/range-facet/date-facet/headless-date-facet.js';
|
|
6
5
|
export interface DateFacetDefinition extends ControllerDefinitionWithoutProps<SearchEngine, DateFacet> {
|
|
7
6
|
}
|
|
8
7
|
/**
|
|
@@ -2,7 +2,6 @@ import type { SearchEngine } from '../../../../../../app/search-engine/search-en
|
|
|
2
2
|
import { type NumericFacet, type NumericFacetProps } from '../../../../../../controllers/facets/range-facet/numeric-facet/headless-numeric-facet.js';
|
|
3
3
|
import type { ControllerDefinitionWithoutProps } from '../../../../types/controller-definition.js';
|
|
4
4
|
export * from '../../../../../../controllers/facets/range-facet/numeric-facet/headless-numeric-facet.js';
|
|
5
|
-
export { buildNumericRange } from '../../../../../../controllers/facets/range-facet/numeric-facet/headless-numeric-facet.js';
|
|
6
5
|
export interface NumericFacetDefinition extends ControllerDefinitionWithoutProps<SearchEngine, NumericFacet> {
|
|
7
6
|
}
|
|
8
7
|
/**
|
|
@@ -2,7 +2,6 @@ import type { SearchEngine } from '../../../../app/search-engine/search-engine.j
|
|
|
2
2
|
import { type StaticFilter, type StaticFilterProps } from '../../../../controllers/static-filter/headless-static-filter.js';
|
|
3
3
|
import type { ControllerDefinitionWithoutProps } from '../../types/controller-definition.js';
|
|
4
4
|
export * from '../../../../controllers/static-filter/headless-static-filter.js';
|
|
5
|
-
export { buildStaticFilterValue } from '../../../../controllers/static-filter/headless-static-filter.js';
|
|
6
5
|
export interface StaticFilterDefinition extends ControllerDefinitionWithoutProps<SearchEngine, StaticFilter> {
|
|
7
6
|
}
|
|
8
7
|
/**
|
|
@@ -4,17 +4,26 @@ import type { SearchControllerDefinitionsMap, SearchEngineDefinition, SearchEngi
|
|
|
4
4
|
* Initializes a Search engine definition in SSR with given controllers definitions and search engine config.
|
|
5
5
|
*
|
|
6
6
|
* @param options - The search engine definition
|
|
7
|
-
* @returns
|
|
7
|
+
* @returns An object containing two engine definitions:
|
|
8
|
+
* - `searchEngineDefinition`: For pages with search results (executes server-side search)
|
|
9
|
+
* - `standaloneEngineDefinition`: For pages with standalone components only (no server-side search execution)
|
|
8
10
|
*
|
|
9
11
|
* @remarks
|
|
10
|
-
* You can use the {@link InferStaticState} and {@link InferHydratedState} utility types with the returned engine
|
|
12
|
+
* You can use the {@link InferStaticState} and {@link InferHydratedState} utility types with the returned engine definitions
|
|
11
13
|
* to infer the types of static and hydrated state for your controllers.
|
|
12
14
|
*
|
|
13
15
|
* @example
|
|
14
16
|
* ```ts
|
|
15
|
-
* const searchEngineDefinition = defineSearchEngine(config);
|
|
17
|
+
* const {searchEngineDefinition, standaloneEngineDefinition} = defineSearchEngine(config);
|
|
16
18
|
*
|
|
17
|
-
*
|
|
19
|
+
* // For search results pages
|
|
20
|
+
* const searchState = await searchEngineDefinition.fetchStaticState({
|
|
21
|
+
* navigatorContext: {/*...* /},
|
|
22
|
+
* searchParams: {q: 'query'}
|
|
23
|
+
* });
|
|
24
|
+
*
|
|
25
|
+
* // For pages with standalone search box only (e.g., homepage)
|
|
26
|
+
* const standaloneState = await standaloneEngineDefinition.fetchStaticState({
|
|
18
27
|
* navigatorContext: {/*...* /},
|
|
19
28
|
* });
|
|
20
29
|
*
|
|
@@ -24,4 +33,7 @@ import type { SearchControllerDefinitionsMap, SearchEngineDefinition, SearchEngi
|
|
|
24
33
|
*
|
|
25
34
|
* @group Engine
|
|
26
35
|
*/
|
|
27
|
-
export declare function defineSearchEngine<TControllerDefinitions extends SearchControllerDefinitionsMap = {}>(options: SearchEngineDefinitionOptions<TControllerDefinitions>):
|
|
36
|
+
export declare function defineSearchEngine<TControllerDefinitions extends SearchControllerDefinitionsMap = {}>(options: SearchEngineDefinitionOptions<TControllerDefinitions>): {
|
|
37
|
+
searchEngineDefinition: SearchEngineDefinition<SSRSearchEngine, TControllerDefinitions>;
|
|
38
|
+
standaloneEngineDefinition: SearchEngineDefinition<SSRSearchEngine, TControllerDefinitions>;
|
|
39
|
+
};
|