@coveo/quantic 3.29.0-pre.fccbdc0bca → 3.29.0
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/README.md +1 -1
- package/force-app/main/default/lwc/quanticCitation/quanticCitation.html +1 -0
- package/force-app/main/default/lwc/quanticCitation/quanticCitation.js +33 -7
- package/force-app/main/default/lwc/quanticFeedbackModal/quanticFeedbackModal.js +1 -1
- package/force-app/main/default/lwc/quanticFeedbackModalQna/quanticFeedbackModalQna.js +1 -1
- package/force-app/main/default/lwc/quanticGeneratedAnswer/quanticGeneratedAnswer.js +21 -6
- package/force-app/main/default/lwc/quanticGeneratedAnswer/templates/generatedAnswer.html +1 -0
- package/force-app/main/default/lwc/quanticSourceCitations/quanticSourceCitations.html +1 -0
- package/force-app/main/default/lwc/quanticSourceCitations/quanticSourceCitations.js +7 -0
- package/force-app/main/default/lwc/quanticTab/quanticTab.js +11 -1
- package/force-app/main/default/lwc/quanticUtils/citationAnchoringUtils.js +43 -0
- package/force-app/main/default/lwc/quanticUtils/quanticUtils.js +1 -0
- package/force-app/main/default/staticresources/coveoheadless/case-assist/headless.js +2 -4
- package/force-app/main/default/staticresources/coveoheadless/definitions/app/case-assist-engine/case-assist-engine.d.ts +2 -2
- 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/case-field/headless-case-field.d.ts +2 -2
- package/force-app/main/default/staticresources/coveoheadless/definitions/controllers/case-input/headless-case-input.d.ts +2 -2
- package/force-app/main/default/staticresources/coveoheadless/definitions/controllers/commerce/product-listing/headless-product-listing.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/controllers/commerce/recommendations/headless-recommendations.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/controllers/commerce/search/headless-search.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 +1 -1
- 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 +3 -3
- 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/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/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/document-suggestion-list/case-assist-headless-interactive-result.d.ts +2 -2
- package/force-app/main/default/staticresources/coveoheadless/definitions/controllers/document-suggestion-list/headless-document-suggestion-list.d.ts +2 -2
- package/force-app/main/default/staticresources/coveoheadless/definitions/controllers/facets/automatic-facet-generator/headless-automatic-facet-generator.d.ts +2 -2
- 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/case-assist-headless-quickview.d.ts +2 -2
- 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-queries-list/headless-recent-queries-list.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/triggers/headless-execute-trigger.d.ts +2 -2
- package/force-app/main/default/staticresources/coveoheadless/definitions/controllers/url-manager/headless-url-manager.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/ssr/commerce/types/build.d.ts +8 -0
- package/force-app/main/default/staticresources/coveoheadless/definitions/ssr/commerce/types/controller-inference.d.ts +4 -0
- package/force-app/main/default/staticresources/coveoheadless/definitions/ssr/commerce/types/engine.d.ts +3 -0
- package/force-app/main/default/staticresources/coveoheadless/definitions/ssr/common/types/engine.d.ts +4 -0
- package/force-app/main/default/staticresources/coveoheadless/definitions/ssr/common/types/from-build-result.d.ts +8 -0
- package/force-app/main/default/staticresources/coveoheadless/definitions/ssr-commerce-next.index.d.ts +2 -3
- package/force-app/main/default/staticresources/coveoheadless/definitions/ssr-next/commerce/engine/commerce-engine.ssr.d.ts +13 -5
- package/force-app/main/default/staticresources/coveoheadless/definitions/ssr-next/commerce/factories/hydrated-state-factory.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/ssr-next/commerce/factories/static-state-factory.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/ssr-next/commerce/types/build.d.ts +5 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/ssr-next/commerce/types/controller-inference.d.ts +0 -3
- package/force-app/main/default/staticresources/coveoheadless/definitions/ssr-next/commerce/types/engine.d.ts +6 -17
- package/force-app/main/default/staticresources/coveoheadless/definitions/ssr-next/commerce/types/fetch-static-state.d.ts +7 -11
- package/force-app/main/default/staticresources/coveoheadless/definitions/ssr-next/commerce/types/hydrate-static-state.d.ts +6 -10
- package/force-app/main/default/staticresources/coveoheadless/definitions/ssr-next/common/controller-utils.d.ts +0 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/ssr-next/common/types/build.d.ts +3 -0
- package/force-app/main/default/staticresources/coveoheadless/definitions/ssr-next/common/types/engine.d.ts +3 -9
- package/force-app/main/default/staticresources/coveoheadless/definitions/ssr-next/common/types/fetch-static-state.d.ts +7 -12
- package/force-app/main/default/staticresources/coveoheadless/definitions/ssr-next/common/types/hydrate-static-state.d.ts +6 -10
- package/force-app/main/default/staticresources/coveoheadless/definitions/ssr-next/search/engine/search-engine.ssr.d.ts +8 -3
- package/force-app/main/default/staticresources/coveoheadless/definitions/ssr-next.index.d.ts +1 -2
- package/force-app/main/default/staticresources/coveoheadless/headless.js +2 -4
- package/force-app/main/default/staticresources/coveoheadless/insight/headless.js +2 -4
- package/force-app/main/default/staticresources/coveoheadless/recommendation/headless.js +2 -4
- package/package.json +3 -3
- package/force-app/main/default/staticresources/coveoheadless/definitions/ssr-next/commerce/types/from-build-result.d.ts +0 -19
- package/force-app/main/default/staticresources/coveoheadless/definitions/ssr-next/common/types/from-build-result.d.ts +0 -8
|
@@ -15,7 +15,7 @@ export interface ResultsPerPageInitialState {
|
|
|
15
15
|
/**
|
|
16
16
|
* The `ResultsPerPage` controller allows the end user to choose how many results to display per page.
|
|
17
17
|
*
|
|
18
|
-
* Example: [results-per-page.fn.tsx](https://github.com/coveo/ui-kit/blob/
|
|
18
|
+
* Example: [results-per-page.fn.tsx](https://github.com/coveo/ui-kit/blob/main/packages/samples/headless-react/src/components/results-per-page/results-per-page.fn.tsx)
|
|
19
19
|
*
|
|
20
20
|
* @group Controllers
|
|
21
21
|
* @category ResultsPerPage
|
|
@@ -16,7 +16,7 @@ export interface SortInitialState {
|
|
|
16
16
|
/**
|
|
17
17
|
* The `Sort` controller manages how the results are sorted.
|
|
18
18
|
*
|
|
19
|
-
* Example: [sort.fn.tsx](https://github.com/coveo/ui-kit/blob/
|
|
19
|
+
* Example: [sort.fn.tsx](https://github.com/coveo/ui-kit/blob/main/packages/samples/headless-react/src/components/sort/sort.fn.tsx)
|
|
20
20
|
*
|
|
21
21
|
* @group Controllers
|
|
22
22
|
* @category Sort
|
|
@@ -3,7 +3,7 @@ import { type Controller } from '../../controller/headless-controller.js';
|
|
|
3
3
|
/**
|
|
4
4
|
* The `SearchStatus` controller lets you access search status information.
|
|
5
5
|
*
|
|
6
|
-
* Example: [search-status.fn.tsx](https://github.com/coveo/ui-kit/blob/
|
|
6
|
+
* Example: [search-status.fn.tsx](https://github.com/coveo/ui-kit/blob/main/packages/samples/headless-react/src/components/search-status/search-status.fn.tsx)
|
|
7
7
|
*
|
|
8
8
|
* @group Controllers
|
|
9
9
|
* @category SearchStatus
|
|
@@ -38,7 +38,7 @@ export interface TabProps {
|
|
|
38
38
|
/**
|
|
39
39
|
* The `Tab` headless controller offers a high-level interface for designing a common tab UI controller.
|
|
40
40
|
*
|
|
41
|
-
* Example: [tab.fn.tsx](https://github.com/coveo/ui-kit/blob/
|
|
41
|
+
* Example: [tab.fn.tsx](https://github.com/coveo/ui-kit/blob/main/packages/samples/headless-react/src/components/tab/tab.fn.tsx)
|
|
42
42
|
*
|
|
43
43
|
* @group Controllers
|
|
44
44
|
* @category Tab
|
|
@@ -4,7 +4,7 @@ import { type Controller } from '../../controller/headless-controller.js';
|
|
|
4
4
|
/**
|
|
5
5
|
* The `NotifyTrigger` controller handles notify triggers. A [Notify trigger](https://docs.coveo.com/en/3413#notify) query pipeline rule lets you define a message to be displayed to the end user when a certain condition is met.
|
|
6
6
|
*
|
|
7
|
-
* Example: [notify-trigger.fn.tsx](https://github.com/coveo/ui-kit/blob/
|
|
7
|
+
* Example: [notify-trigger.fn.tsx](https://github.com/coveo/ui-kit/blob/main/packages/samples/headless-react/src/components/triggers/notify-trigger.fn.tsx)
|
|
8
8
|
*
|
|
9
9
|
* @group Controllers
|
|
10
10
|
* @category NotifyTrigger
|
|
@@ -2,7 +2,7 @@ import type { Controller } from '../../controller/headless-controller.js';
|
|
|
2
2
|
/**
|
|
3
3
|
* The `QueryTrigger` controller handles [query trigger](https://docs.coveo.com/en/3413#query) query pipeline rules, which let you define a search query to execute when a certain condition is met.
|
|
4
4
|
*
|
|
5
|
-
* Example: [query-trigger.fn.tsx](https://github.com/coveo/ui-kit/blob/
|
|
5
|
+
* Example: [query-trigger.fn.tsx](https://github.com/coveo/ui-kit/blob/main/packages/samples/headless-react/src/components/triggers/query-trigger.fn.tsx)
|
|
6
6
|
*
|
|
7
7
|
* @group Controllers
|
|
8
8
|
* @category QueryTrigger
|
|
@@ -2,7 +2,7 @@ import type { Controller } from '../../controller/headless-controller.js';
|
|
|
2
2
|
/**
|
|
3
3
|
* The `RedirectionTrigger` controller handles redirection triggers. A [Redirection trigger](https://docs.coveo.com/en/3413#redirect) query pipeline rule lets you define a URL to redirect the user's browser to when a certain condition is met.
|
|
4
4
|
*
|
|
5
|
-
* Example: [redirection-trigger.fn.tsx](https://github.com/coveo/ui-kit/blob/
|
|
5
|
+
* Example: [redirection-trigger.fn.tsx](https://github.com/coveo/ui-kit/blob/main/packages/samples/headless-react/src/components/triggers/redirection-trigger.fn.tsx)
|
|
6
6
|
*
|
|
7
7
|
* @group Controllers
|
|
8
8
|
* @category RedirectionTrigger
|
|
@@ -5,7 +5,7 @@ export type { DictionaryFieldContextPayload };
|
|
|
5
5
|
/**
|
|
6
6
|
* The `DictionaryFieldContext` controller allows specifying which [dictionary field](https://docs.coveo.com/en/2036/) keys to retrieve.
|
|
7
7
|
*
|
|
8
|
-
* Example: [dictionary-field-context.fn.ts](https://github.com/coveo/ui-kit/blob/
|
|
8
|
+
* Example: [dictionary-field-context.fn.ts](https://github.com/coveo/ui-kit/blob/main/packages/samples/headless-react/src/components/dictionary-field-context/dictionary-field-context.fn.ts)
|
|
9
9
|
*
|
|
10
10
|
* @group Controllers
|
|
11
11
|
* @category DictionaryFieldContext
|
|
@@ -18,8 +18,8 @@ export interface CaseAssistInteractiveResultProps extends InteractiveResultCoreP
|
|
|
18
18
|
* The `CaseAssistInteractiveResult` controller provides an interface for triggering desirable side effects, such as logging UA events to the Coveo Platform, when a user selects a query result.
|
|
19
19
|
*
|
|
20
20
|
* For example implementations, see the following [Coveo Quantic Case Assist components](https://docs.coveo.com/en/quantic/latest/reference/case-assist-components/):
|
|
21
|
-
* * [quanticCaseClassification.js](https://github.com/coveo/ui-kit/blob/
|
|
22
|
-
* * [quanticDocumentSuggestion](https://github.com/coveo/ui-kit/blob/
|
|
21
|
+
* * [quanticCaseClassification.js](https://github.com/coveo/ui-kit/blob/main/packages/quantic/force-app/main/default/lwc/quanticCaseClassification/quanticCaseClassification.js)
|
|
22
|
+
* * [quanticDocumentSuggestion](https://github.com/coveo/ui-kit/blob/main/packages/quantic/force-app/main/default/lwc/quanticDocumentSuggestion/quanticDocumentSuggestion.js)
|
|
23
23
|
*
|
|
24
24
|
* @group Controllers
|
|
25
25
|
* @category CaseAssistInteractiveResult
|
|
@@ -6,8 +6,8 @@ import { type Controller } from '../controller/headless-controller.js';
|
|
|
6
6
|
* The `DocumentSuggestion` controller is responsible for getting document suggestions using case information present in the state.
|
|
7
7
|
*
|
|
8
8
|
* For example implementations, see the following [Coveo Quantic Case Assist components](https://docs.coveo.com/en/quantic/latest/reference/case-assist-components/):
|
|
9
|
-
* * [quanticCaseClassification.js](https://github.com/coveo/ui-kit/blob/
|
|
10
|
-
* * [quanticDocumentSuggestion](https://github.com/coveo/ui-kit/blob/
|
|
9
|
+
* * [quanticCaseClassification.js](https://github.com/coveo/ui-kit/blob/main/packages/quantic/force-app/main/default/lwc/quanticCaseClassification/quanticCaseClassification.js)
|
|
10
|
+
* * [quanticDocumentSuggestion](https://github.com/coveo/ui-kit/blob/main/packages/quantic/force-app/main/default/lwc/quanticDocumentSuggestion/quanticDocumentSuggestion.js)
|
|
11
11
|
*
|
|
12
12
|
* @group Controllers
|
|
13
13
|
* @category DocumentSuggestionList
|
|
@@ -12,8 +12,8 @@ export type { AutomaticFacetGeneratorOptions };
|
|
|
12
12
|
* To learn more about the automatic facet generator feature, see: [About the Facet Generator](https://docs.coveo.com/en/n9sd0159/).
|
|
13
13
|
*
|
|
14
14
|
* Examples:
|
|
15
|
-
* - [automatic-facet-generator.fn.tsx](https://github.com/coveo/ui-kit/blob/
|
|
16
|
-
* - [automatic-facet-generator.class.tsx](https://github.com/coveo/ui-kit/blob/
|
|
15
|
+
* - [automatic-facet-generator.fn.tsx](https://github.com/coveo/ui-kit/blob/main/packages/samples/headless-react/src/components/automatic-facet-generator/automatic-facet-generator.fn.tsx)
|
|
16
|
+
* - [automatic-facet-generator.class.tsx](https://github.com/coveo/ui-kit/blob/main/packages/samples/headless-react/src/components/automatic-facet-generator/automatic-facet-generator.class.tsx)
|
|
17
17
|
*
|
|
18
18
|
* @group Controllers
|
|
19
19
|
* @category AutomaticFacetGenerator
|
|
@@ -54,7 +54,7 @@ export interface CategoryFieldSuggestionsState {
|
|
|
54
54
|
*
|
|
55
55
|
* This controller is a wrapper around the basic category facet controller search functionality, and thus exposes similar options and properties.
|
|
56
56
|
*
|
|
57
|
-
* Example: [category-suggestions.fn.tsx](https://github.com/coveo/ui-kit/blob/
|
|
57
|
+
* Example: [category-suggestions.fn.tsx](https://github.com/coveo/ui-kit/blob/main/packages/samples/headless-react/src/components/field-suggestions/category-field/category-suggestions.fn.tsx)
|
|
58
58
|
*
|
|
59
59
|
* @group Controllers
|
|
60
60
|
* @category CategoryFieldSuggestions
|
|
@@ -47,7 +47,7 @@ export interface FieldSuggestionsState {
|
|
|
47
47
|
*
|
|
48
48
|
* This controller is a wrapper around the basic facet controller search functionality, and thus exposes similar options and properties.
|
|
49
49
|
*
|
|
50
|
-
* Example: [field-suggestions.fn.tsx](https://github.com/coveo/ui-kit/blob/
|
|
50
|
+
* Example: [field-suggestions.fn.tsx](https://github.com/coveo/ui-kit/blob/main/packages/samples/headless-react/src/components/field-suggestions/specific-field/field-suggestions.fn.tsx)
|
|
51
51
|
*
|
|
52
52
|
* @group Controllers
|
|
53
53
|
* @category FieldSuggestions
|
|
@@ -5,7 +5,7 @@ import { type Controller } from '../controller/headless-controller.js';
|
|
|
5
5
|
/**
|
|
6
6
|
* The `HistoryManager` controller is in charge of allowing navigating back and forward in the search interface history.
|
|
7
7
|
*
|
|
8
|
-
* Example: [history-manager.fn.tsx](https://github.com/coveo/ui-kit/blob/
|
|
8
|
+
* Example: [history-manager.fn.tsx](https://github.com/coveo/ui-kit/blob/main/packages/samples/headless-react/src/components/history-manager/history-manager.fn.tsx)
|
|
9
9
|
*
|
|
10
10
|
* @group Controllers
|
|
11
11
|
* @category HistoryManager
|
|
@@ -11,7 +11,7 @@ export interface InstantResultProps {
|
|
|
11
11
|
/**
|
|
12
12
|
* The `InstantResults` controller allows the end user to manage instant results queries.
|
|
13
13
|
*
|
|
14
|
-
* Example: [instant-results.fn.tsx](https://github.com/coveo/ui-kit/blob/
|
|
14
|
+
* Example: [instant-results.fn.tsx](https://github.com/coveo/ui-kit/blob/main/packages/samples/headless-react/src/components/instant-results/instant-results.fn.tsx)
|
|
15
15
|
*
|
|
16
16
|
* @group Controllers
|
|
17
17
|
* @category InstantResults
|
|
@@ -7,7 +7,7 @@ export type { QuerySummary, QuerySummaryState };
|
|
|
7
7
|
* @param engine - The headless engine instance.
|
|
8
8
|
* @returns A `QuerySummary` controller instance.
|
|
9
9
|
*
|
|
10
|
-
* Example: [query-summary.fn.tsx](https://github.com/coveo/ui-kit/blob/
|
|
10
|
+
* Example: [query-summary.fn.tsx](https://github.com/coveo/ui-kit/blob/main/packages/samples/headless-react/src/components/query-summary/query-summary.fn.tsx)
|
|
11
11
|
*
|
|
12
12
|
* @group Controllers
|
|
13
13
|
* @category QuerySummary
|
|
@@ -8,8 +8,8 @@ export interface CaseAssistQuickviewOptions extends QuickviewOptions {
|
|
|
8
8
|
* The `CaseAssistQuickview` controller provides an interface for triggering desirable side effects, such as logging UA events to the Coveo Platform, when a user interacts with a quickview.
|
|
9
9
|
*
|
|
10
10
|
* For example implementations, see the following [Coveo Quantic Case Assist components](https://docs.coveo.com/en/quantic/latest/reference/case-assist-components/):
|
|
11
|
-
* * [quanticCaseClassification.js](https://github.com/coveo/ui-kit/blob/
|
|
12
|
-
* * [quanticDocumentSuggestion](https://github.com/coveo/ui-kit/blob/
|
|
11
|
+
* * [quanticCaseClassification.js](https://github.com/coveo/ui-kit/blob/main/packages/quantic/force-app/main/default/lwc/quanticCaseClassification/quanticCaseClassification.js)
|
|
12
|
+
* * [quanticDocumentSuggestion](https://github.com/coveo/ui-kit/blob/main/packages/quantic/force-app/main/default/lwc/quanticDocumentSuggestion/quanticDocumentSuggestion.js)
|
|
13
13
|
*
|
|
14
14
|
* @group Controllers
|
|
15
15
|
* @category CaseAssistQuickview
|
|
@@ -24,7 +24,7 @@ export interface QuickviewState extends CoreQuickviewState {
|
|
|
24
24
|
/**
|
|
25
25
|
* The `Quickview` controller provides an interface for triggering desirable side effects, such as logging UA events to the Coveo Platform, when a user interacts with a quickview.
|
|
26
26
|
*
|
|
27
|
-
* Example: [quickview.fn.tsx](https://github.com/coveo/ui-kit/blob/
|
|
27
|
+
* Example: [quickview.fn.tsx](https://github.com/coveo/ui-kit/blob/main/packages/samples/headless-react/src/components/quickview/quickview.fn.tsx)
|
|
28
28
|
*
|
|
29
29
|
* @group Controllers
|
|
30
30
|
* @category Quickview
|
|
@@ -32,7 +32,7 @@ export interface RecentQueriesListOptions {
|
|
|
32
32
|
/**
|
|
33
33
|
* The `RecentQueriesList` controller manages the user's recent queries.
|
|
34
34
|
*
|
|
35
|
-
* Example: [recent-queries.fn.tsx](https://github.com/coveo/ui-kit/blob/
|
|
35
|
+
* Example: [recent-queries.fn.tsx](https://github.com/coveo/ui-kit/blob/main/packages/samples/headless-react/src/components/recent-queries/recent-queries.fn.tsx)
|
|
36
36
|
*
|
|
37
37
|
* @group Controllers
|
|
38
38
|
* @category RecentQueriesList
|
|
@@ -28,7 +28,7 @@ export interface RecentResultsListOptions {
|
|
|
28
28
|
/**
|
|
29
29
|
* The `RecentResultsList` controller manages a user's recently clicked results.
|
|
30
30
|
*
|
|
31
|
-
* Example: [recent-results.fn.tsx](https://github.com/coveo/ui-kit/blob/
|
|
31
|
+
* Example: [recent-results.fn.tsx](https://github.com/coveo/ui-kit/blob/main/packages/samples/headless-react/src/components/recent-results/recent-results.fn.tsx)
|
|
32
32
|
*
|
|
33
33
|
* @group Controllers
|
|
34
34
|
* @category RecentResultsList
|
|
@@ -20,7 +20,7 @@ export interface RecommendationListProps {
|
|
|
20
20
|
/**
|
|
21
21
|
* The `RecommendationList` controller retrieves information about the current recommendations by the search API, if there are any.
|
|
22
22
|
*
|
|
23
|
-
* Example: [recommendation-list.fn.tsx](https://github.com/coveo/ui-kit/blob/
|
|
23
|
+
* Example: [recommendation-list.fn.tsx](https://github.com/coveo/ui-kit/blob/main/packages/samples/headless-react/src/components/recommendation-list/recommendation-list.fn.tsx)
|
|
24
24
|
*
|
|
25
25
|
* @group Controllers
|
|
26
26
|
* @category RecommendationList
|
|
@@ -22,7 +22,7 @@ export interface RelevanceInspectorInitialState {
|
|
|
22
22
|
/**
|
|
23
23
|
* The `RelevanceInspector` controller is in charge of allowing displaying various debug information.
|
|
24
24
|
*
|
|
25
|
-
* Example: [relevance-inspector.fn.tsx](https://github.com/coveo/ui-kit/blob/
|
|
25
|
+
* Example: [relevance-inspector.fn.tsx](https://github.com/coveo/ui-kit/blob/main/packages/samples/headless-react/src/components/relevance-inspector/relevance-inspector.fn.tsx)
|
|
26
26
|
*
|
|
27
27
|
* @group Controllers
|
|
28
28
|
* @category RelevanceInspector
|
|
@@ -16,7 +16,7 @@ export interface InteractiveResultProps extends InteractiveResultCoreProps {
|
|
|
16
16
|
/**
|
|
17
17
|
* The `InteractiveResult` controller provides an interface for triggering desirable side effects, such as logging UA events to the Coveo Platform, when a user selects a query result.
|
|
18
18
|
*
|
|
19
|
-
* Example: [result-link.tsx](https://github.com/coveo/ui-kit/blob/
|
|
19
|
+
* Example: [result-link.tsx](https://github.com/coveo/ui-kit/blob/main/packages/samples/headless-react/src/components/result-list/result-link.tsx)
|
|
20
20
|
*
|
|
21
21
|
* @group Controllers
|
|
22
22
|
* @category InteractiveResult
|
|
@@ -13,7 +13,7 @@ export interface SmartSnippetQuestionsListState extends CoreSmartSnippetQuestion
|
|
|
13
13
|
/**
|
|
14
14
|
* The `SmartSnippetQuestionsList` controller allows to manage additional queries for which a SmartSnippet model can provide relevant excerpts.
|
|
15
15
|
*
|
|
16
|
-
* Example: [smart-snippet-questions-list.fn.tsx](https://github.com/coveo/ui-kit/blob/
|
|
16
|
+
* Example: [smart-snippet-questions-list.fn.tsx](https://github.com/coveo/ui-kit/blob/main/packages/samples/headless-react/src/components/smart-snippet-questions-list/smart-snippet-questions-list.fn.tsx)
|
|
17
17
|
*
|
|
18
18
|
* @group Controllers
|
|
19
19
|
* @category SmartSnippetQuestionsList
|
|
@@ -10,7 +10,7 @@ export interface StandaloneSearchBoxProps {
|
|
|
10
10
|
* The `StandaloneSearchBox` headless controller offers a high-level interface for designing a common search box UI controller.
|
|
11
11
|
* Meant to be used for a search box that will redirect instead of executing a query.
|
|
12
12
|
*
|
|
13
|
-
* Example: [standalone-search-box.fn.tsx](https://github.com/coveo/ui-kit/blob/
|
|
13
|
+
* Example: [standalone-search-box.fn.tsx](https://github.com/coveo/ui-kit/blob/main/packages/samples/headless-react/src/components/standalone-search-box/standalone-search-box.fn.tsx)
|
|
14
14
|
*
|
|
15
15
|
* @group Controllers
|
|
16
16
|
* @category StandaloneSearchBox
|
|
@@ -23,7 +23,7 @@ export interface StaticFilterOptions {
|
|
|
23
23
|
/**
|
|
24
24
|
* The `StaticFilter` controller manages a collection of filter values.
|
|
25
25
|
*
|
|
26
|
-
* Example: [static-filter.fn.tsx](https://github.com/coveo/ui-kit/blob/
|
|
26
|
+
* Example: [static-filter.fn.tsx](https://github.com/coveo/ui-kit/blob/main/packages/samples/headless-react/src/components/static-filter/static-filter.fn.tsx)
|
|
27
27
|
*
|
|
28
28
|
* @group Controllers
|
|
29
29
|
* @category StaticFilter
|
|
@@ -5,8 +5,8 @@ import { type Controller } from '../controller/headless-controller.js';
|
|
|
5
5
|
* The `ExecuteTrigger` controller handles Execute triggers from the query response. An [Execute trigger](https://docs.coveo.com/en/3413#execute) query pipeline rule lets you define a custom JavaScript function to be executed in the frontend when a certain condition is met.
|
|
6
6
|
*
|
|
7
7
|
* Examples:
|
|
8
|
-
* - [execute-trigger.tsx](https://github.com/coveo/ui-kit/blob/
|
|
9
|
-
* - [execute-trigger.class.tsx](https://github.com/coveo/ui-kit/blob/
|
|
8
|
+
* - [execute-trigger.tsx](https://github.com/coveo/ui-kit/blob/main/packages/samples/headless-react/src/components/triggers/execute-trigger.tsx)
|
|
9
|
+
* - [execute-trigger.class.tsx](https://github.com/coveo/ui-kit/blob/main/packages/samples/headless-react/src/components/triggers/execute-trigger.class.tsx)
|
|
10
10
|
*
|
|
11
11
|
* @group Controllers
|
|
12
12
|
* @category ExecuteTrigger
|
|
@@ -18,7 +18,7 @@ export declare const initialStateSchema: Schema<Required<UrlManagerInitialState>
|
|
|
18
18
|
/**
|
|
19
19
|
* The `UrlManager` controller can parse an url fragment to extract search parameters which affect the search response.
|
|
20
20
|
*
|
|
21
|
-
* Example: [url-manager.ts](https://github.com/coveo/ui-kit/blob/
|
|
21
|
+
* Example: [url-manager.ts](https://github.com/coveo/ui-kit/blob/main/packages/samples/headless-react/src/components/url-manager/url-manager.ts)
|
|
22
22
|
*
|
|
23
23
|
* @group Controllers
|
|
24
24
|
* @category UrlManager
|
|
@@ -4,7 +4,15 @@ import type { OptionsExtender, OptionsTuple } from '../../common/types/utilities
|
|
|
4
4
|
import type { SSRCommerceEngine } from '../factories/build-factory.js';
|
|
5
5
|
import type { SolutionType } from './controller-constants.js';
|
|
6
6
|
import type { ControllerDefinitionsMap, EngineDefinitionBuildResult, EngineDefinitionControllersPropsOption } from './controller-definitions.js';
|
|
7
|
+
/**
|
|
8
|
+
* @deprecated This type should not be used directly.
|
|
9
|
+
* @internal
|
|
10
|
+
*/
|
|
7
11
|
export interface BuildOptions<TEngineOptions> {
|
|
8
12
|
extend?: OptionsExtender<TEngineOptions>;
|
|
9
13
|
}
|
|
14
|
+
/**
|
|
15
|
+
* @deprecated This type should not be used directly.
|
|
16
|
+
* @internal
|
|
17
|
+
*/
|
|
10
18
|
export type Build<TEngineOptions, TControllersMap extends ControllersMap, TControllersProps extends ControllersPropsMap, TControllersDefinitionsMap extends ControllerDefinitionsMap<Controller>, TSolutionType extends SolutionType> = (...params: OptionsTuple<BuildOptions<TEngineOptions> & EngineDefinitionControllersPropsOption<TControllersDefinitionsMap, TControllersProps, TSolutionType>>) => Promise<EngineDefinitionBuildResult<SSRCommerceEngine, TControllersMap>>;
|
|
@@ -8,6 +8,10 @@ export type InferStaticState<T extends {
|
|
|
8
8
|
export type InferHydratedState<T extends {
|
|
9
9
|
hydrateStaticState(...args: unknown[]): Promise<unknown>;
|
|
10
10
|
}> = Awaited<ReturnType<T['hydrateStaticState']>>;
|
|
11
|
+
/**
|
|
12
|
+
* @deprecated This type is deprecated and will be removed in a future version.
|
|
13
|
+
* {@link EngineDefinition.build} will be removed in a future version.
|
|
14
|
+
*/
|
|
11
15
|
export type InferBuildResult<T extends {
|
|
12
16
|
build(...args: unknown[]): Promise<unknown>;
|
|
13
17
|
}> = Awaited<ReturnType<T['build']>>;
|
|
@@ -26,6 +26,9 @@ export type EngineDefinitionOptions<TOptions extends {
|
|
|
26
26
|
*/
|
|
27
27
|
controllers?: TControllers;
|
|
28
28
|
};
|
|
29
|
+
/**
|
|
30
|
+
* @deprecated This type will be removed in the future. Use {@link CommerceEngineDefinition} instead.
|
|
31
|
+
*/
|
|
29
32
|
export interface EngineDefinition<TControllers extends ControllerDefinitionsMap<Controller>, TEngineOptions, TSolutionType extends SolutionType> {
|
|
30
33
|
/**
|
|
31
34
|
* Fetches the static state on the server side using your engine definition.
|
|
@@ -55,6 +55,10 @@ export type InferStaticState<T extends {
|
|
|
55
55
|
export type InferHydratedState<T extends {
|
|
56
56
|
hydrateStaticState(...args: unknown[]): Promise<unknown>;
|
|
57
57
|
}> = Awaited<ReturnType<T['hydrateStaticState']>>;
|
|
58
|
+
/**
|
|
59
|
+
* @deprecated This type is deprecated and will be removed in a future version.
|
|
60
|
+
* {@link EngineDefinition.build} will be removed in a future version.
|
|
61
|
+
*/
|
|
58
62
|
export type InferBuildResult<T extends {
|
|
59
63
|
build(...args: unknown[]): Promise<unknown>;
|
|
60
64
|
}> = Awaited<ReturnType<T['build']>>;
|
|
@@ -1,8 +1,16 @@
|
|
|
1
1
|
import type { CoreEngine, CoreEngineNext } from '../../../app/engine.js';
|
|
2
2
|
import type { ControllersMap } from './controllers.js';
|
|
3
3
|
import type { EngineDefinitionBuildResult } from './engine.js';
|
|
4
|
+
/**
|
|
5
|
+
* @deprecated This type is deprecated and will be removed in a future version.
|
|
6
|
+
* {@link EngineDefinition.build} will be removed in a future version.
|
|
7
|
+
*/
|
|
4
8
|
export interface FromBuildResultOptions<TEngine extends CoreEngine | CoreEngineNext, TControllers extends ControllersMap> {
|
|
5
9
|
buildResult: EngineDefinitionBuildResult<TEngine, TControllers>;
|
|
6
10
|
allowedRecommendationKeys?: (keyof TControllers)[];
|
|
7
11
|
}
|
|
12
|
+
/**
|
|
13
|
+
* @deprecated This type is deprecated and will be removed in a future version.
|
|
14
|
+
* {@link EngineDefinition.build} will be removed in a future version.
|
|
15
|
+
*/
|
|
8
16
|
export type FromBuildResult<TEngine extends CoreEngine | CoreEngineNext, TControllers extends ControllersMap, TOptions, TReturn> = (options: FromBuildResultOptions<TEngine, TControllers> & TOptions) => Promise<TReturn>;
|
|
@@ -117,13 +117,12 @@ export type { QueryTrigger, QueryTriggerDefinition, QueryTriggerState, } from '.
|
|
|
117
117
|
export { defineQueryTrigger } from './ssr-next/commerce/controllers/triggers/headless-query-trigger.ssr.js';
|
|
118
118
|
export type { RedirectionTrigger, RedirectionTriggerDefinition, RedirectionTriggerState, } from './ssr-next/commerce/controllers/triggers/headless-redirection-trigger.ssr.js';
|
|
119
119
|
export { defineRedirectionTrigger } from './ssr-next/commerce/controllers/triggers/headless-redirection-trigger.ssr.js';
|
|
120
|
-
export type { CommerceEngineDefinition } from './ssr-next/commerce/engine/commerce-engine.ssr.js';
|
|
121
120
|
export { defineCommerceEngine } from './ssr-next/commerce/engine/commerce-engine.ssr.js';
|
|
122
121
|
export type { CommerceEngineDefinitionOptions, SSRCommerceEngine as CommerceEngine, } from './ssr-next/commerce/factories/build-factory.js';
|
|
123
122
|
export { SolutionType } from './ssr-next/commerce/types/controller-constants.js';
|
|
124
123
|
export type { ControllerDefinition, ControllerDefinitionsMap, ControllerWithKind, EngineDefinitionBuildResult, EngineDefinitionControllersPropsOption, HydratedState, InferControllerStaticStateFromController, InferControllerStaticStateMapFromControllers, OptionsTuple, } from './ssr-next/commerce/types/controller-definitions.js';
|
|
125
|
-
export type {
|
|
126
|
-
export type {
|
|
124
|
+
export type { InferControllerFromDefinition, InferControllerPropsMapFromDefinitions, InferControllerStaticStateMapFromDefinitionsWithSolutionType, InferControllersMapFromDefinition, InferHydratedState, InferStaticState, } from './ssr-next/commerce/types/controller-inference.js';
|
|
125
|
+
export type { CommerceEngineDefinition, EngineStaticState, FetchStaticState, FetchStaticStateOptions, HydrateStaticState, HydrateStaticStateOptions, } from './ssr-next/commerce/types/engine.js';
|
|
127
126
|
export { Kind } from './ssr-next/commerce/types/kind.js';
|
|
128
127
|
export type { CommerceAppState, CommerceProductListingParametersState, CommerceSearchParametersState, } from './state/commerce-app-state.js';
|
|
129
128
|
export * from './features/commerce/configuration/configuration-actions-loader.js';
|
|
@@ -1,20 +1,28 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Utility functions to be used for Commerce Server Side Rendering.
|
|
3
3
|
*/
|
|
4
|
-
import type { CommerceEngineOptions } from '../../../app/commerce-engine/commerce-engine.js';
|
|
5
4
|
import type { Controller } from '../../../controllers/controller/headless-controller.js';
|
|
6
|
-
import {
|
|
5
|
+
import type { CommerceEngineDefinitionOptions } from '../factories/build-factory.js';
|
|
7
6
|
import { SolutionType } from '../types/controller-constants.js';
|
|
8
7
|
import type { ControllerDefinitionsMap } from '../types/controller-definitions.js';
|
|
9
|
-
import type {
|
|
10
|
-
export interface CommerceEngineDefinition<TControllers extends ControllerDefinitionsMap<Controller>, TSolutionType extends SolutionType> extends EngineDefinition<TControllers, CommerceEngineOptions, TSolutionType> {
|
|
11
|
-
}
|
|
8
|
+
import type { CommerceEngineDefinition } from '../types/engine.js';
|
|
12
9
|
/**
|
|
13
10
|
* Initializes a Commerce engine definition in SSR with given controllers definitions and commerce engine config.
|
|
14
11
|
* @param options - The commerce engine definition
|
|
15
12
|
* @returns Three utility functions to fetch the initial state of the engine in SSR, hydrate the state in CSR,
|
|
16
13
|
* and a build function that can be used for edge cases requiring more control.
|
|
17
14
|
*
|
|
15
|
+
* @remarks
|
|
16
|
+
* You can use the {@link InferStaticState} and {@link InferHydratedState} utility types with the returned engine definitions
|
|
17
|
+
* to infer the types of static and hydrated state for your controllers.
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* ```ts
|
|
21
|
+
* const engineDefinition = defineCommerceEngine(engineConfig);
|
|
22
|
+
* type SearchStaticState = InferStaticState<typeof engineDefinition>;
|
|
23
|
+
* type SearchHydratedState = InferHydratedState<typeof engineDefinition>;
|
|
24
|
+
* ```
|
|
25
|
+
*
|
|
18
26
|
* @group Engine
|
|
19
27
|
*/
|
|
20
28
|
export declare function defineCommerceEngine<TControllerDefinitions extends ControllerDefinitionsMap<Controller>>(options: CommerceEngineDefinitionOptions<TControllerDefinitions>): {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { SolutionType } from '../types/controller-constants.js';
|
|
2
2
|
import type { CommerceControllerDefinitionsMap, HydrateStaticStateFunction } from '../types/engine.js';
|
|
3
3
|
import { type CommerceEngineDefinitionOptions } from './build-factory.js';
|
|
4
|
-
export declare
|
|
4
|
+
export declare function hydratedStaticStateFactory<TControllerDefinitions extends CommerceControllerDefinitionsMap>(controllerDefinitions: TControllerDefinitions | undefined, options: CommerceEngineDefinitionOptions<TControllerDefinitions>): (solutionType: SolutionType) => HydrateStaticStateFunction<TControllerDefinitions>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { SolutionType } from '../types/controller-constants.js';
|
|
2
2
|
import type { CommerceControllerDefinitionsMap, FetchStaticStateFunction } from '../types/engine.js';
|
|
3
3
|
import { type CommerceEngineDefinitionOptions } from './build-factory.js';
|
|
4
|
-
export declare
|
|
4
|
+
export declare function fetchStaticStateFactory<TControllerDefinitions extends CommerceControllerDefinitionsMap>(controllerDefinitions: TControllerDefinitions | undefined, options: CommerceEngineDefinitionOptions<TControllerDefinitions>): (solutionType: SolutionType) => FetchStaticStateFunction<TControllerDefinitions>;
|
|
@@ -4,7 +4,11 @@ import type { OptionsExtender, OptionsTuple } from '../../common/types/utilities
|
|
|
4
4
|
import type { SSRCommerceEngine } from '../factories/build-factory.js';
|
|
5
5
|
import type { SolutionType } from './controller-constants.js';
|
|
6
6
|
import type { ControllerDefinitionsMap, EngineDefinitionBuildResult, EngineDefinitionControllersPropsOption } from './controller-definitions.js';
|
|
7
|
-
|
|
7
|
+
interface BuildOptions<TEngineOptions> {
|
|
8
8
|
extend?: OptionsExtender<TEngineOptions>;
|
|
9
9
|
}
|
|
10
|
+
/**
|
|
11
|
+
* @internal
|
|
12
|
+
*/
|
|
10
13
|
export type Build<TEngineOptions, TControllersMap extends ControllersMap, TControllersProps extends ControllersPropsMap, TControllersDefinitionsMap extends ControllerDefinitionsMap<Controller>, TSolutionType extends SolutionType> = (...params: OptionsTuple<BuildOptions<TEngineOptions> & EngineDefinitionControllersPropsOption<TControllersDefinitionsMap, TControllersProps, TSolutionType>>) => Promise<EngineDefinitionBuildResult<SSRCommerceEngine, TControllersMap>>;
|
|
14
|
+
export {};
|
|
@@ -8,9 +8,6 @@ export type InferStaticState<T extends {
|
|
|
8
8
|
export type InferHydratedState<T extends {
|
|
9
9
|
hydrateStaticState(...args: unknown[]): Promise<unknown>;
|
|
10
10
|
}> = Awaited<ReturnType<T['hydrateStaticState']>>;
|
|
11
|
-
export type InferBuildResult<T extends {
|
|
12
|
-
build(...args: unknown[]): Promise<unknown>;
|
|
13
|
-
}> = Awaited<ReturnType<T['build']>>;
|
|
14
11
|
export type InferControllerPropsFromDefinition<TController extends ControllerDefinition<Controller>> = TController extends ControllerDefinitionWithProps<Controller, infer Props> ? HasKey<TController, typeof recommendationInternalOptionKey> extends never ? Props : Props & RecommendationControllerSettings : TController extends ControllerDefinitionWithoutProps<Controller> ? HasKey<TController, typeof recommendationInternalOptionKey> extends never ? {} : RecommendationControllerSettings : unknown;
|
|
15
12
|
export type InferControllerPropsMapFromDefinitions<TControllers extends ControllerDefinitionsMap<Controller>> = {
|
|
16
13
|
[K in keyof TControllers as HasKeys<InferControllerPropsFromDefinition<TControllers[K]>> extends false ? never : K]: InferControllerPropsFromDefinition<TControllers[K]>;
|
|
@@ -1,19 +1,17 @@
|
|
|
1
1
|
import type { UnknownAction } from '@reduxjs/toolkit';
|
|
2
|
+
import type { CommerceEngineOptions } from '../../../app/commerce-engine/commerce-engine.js';
|
|
2
3
|
import type { EngineConfiguration } from '../../../app/engine-configuration.js';
|
|
3
4
|
import type { NavigatorContextProvider } from '../../../app/navigator-context-provider.js';
|
|
4
5
|
import type { Controller } from '../../../controllers/controller/headless-controller.js';
|
|
5
6
|
import type { ControllerStaticStateMap } from '../../common/types/controllers.js';
|
|
6
|
-
import type { FromBuildResultOptions } from '../../common/types/from-build-result.js';
|
|
7
|
-
import type { CommerceEngineDefinition } from '../engine/commerce-engine.ssr.js';
|
|
8
7
|
import type { SSRCommerceEngine } from '../factories/build-factory.js';
|
|
9
|
-
import type { Build
|
|
8
|
+
import type { Build } from './build.js';
|
|
10
9
|
import type { SolutionType } from './controller-constants.js';
|
|
11
10
|
import type { ControllerDefinitionsMap } from './controller-definitions.js';
|
|
12
11
|
import type { InferControllerPropsMapFromDefinitions, InferControllerStaticStateMapFromDefinitionsWithSolutionType, InferControllersMapFromDefinition } from './controller-inference.js';
|
|
13
12
|
import type { FetchStaticState, FetchStaticStateOptions } from './fetch-static-state.js';
|
|
14
|
-
import type { FromBuildResult } from './from-build-result.js';
|
|
15
13
|
import type { HydrateStaticState, HydrateStaticStateOptions } from './hydrate-static-state.js';
|
|
16
|
-
export type {
|
|
14
|
+
export type { HydrateStaticState, HydrateStaticStateOptions, FetchStaticState, FetchStaticStateOptions, };
|
|
17
15
|
export interface EngineStaticState<TSearchAction extends UnknownAction, TControllers extends ControllerStaticStateMap> {
|
|
18
16
|
searchActions: TSearchAction[];
|
|
19
17
|
controllers: TControllers;
|
|
@@ -26,19 +24,15 @@ export type EngineDefinitionOptions<TOptions extends {
|
|
|
26
24
|
*/
|
|
27
25
|
controllers?: TControllers;
|
|
28
26
|
};
|
|
29
|
-
export interface
|
|
27
|
+
export interface CommerceEngineDefinition<TControllers extends ControllerDefinitionsMap<Controller>, TSolutionType extends SolutionType> {
|
|
30
28
|
/**
|
|
31
29
|
* Fetches the static state on the server side using your engine definition.
|
|
32
30
|
*/
|
|
33
|
-
fetchStaticState: FetchStaticState<
|
|
31
|
+
fetchStaticState: FetchStaticState<UnknownAction, InferControllerStaticStateMapFromDefinitionsWithSolutionType<TControllers, TSolutionType>, InferControllerPropsMapFromDefinitions<TControllers>, TControllers, TSolutionType>;
|
|
34
32
|
/**
|
|
35
33
|
* Fetches the hydrated state on the client side using your engine definition and the static state.
|
|
36
34
|
*/
|
|
37
35
|
hydrateStaticState: HydrateStaticState<InferControllersMapFromDefinition<TControllers, TSolutionType>, UnknownAction, InferControllerPropsMapFromDefinitions<TControllers>, TControllers, TSolutionType>;
|
|
38
|
-
/**
|
|
39
|
-
* Builds an engine and its controllers from an engine definition.
|
|
40
|
-
*/
|
|
41
|
-
build: Build<TEngineOptions, InferControllersMapFromDefinition<TControllers, TSolutionType>, InferControllerPropsMapFromDefinitions<TControllers>, TControllers, TSolutionType>;
|
|
42
36
|
/**
|
|
43
37
|
* Sets the navigator context provider.
|
|
44
38
|
* 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.
|
|
@@ -58,16 +52,11 @@ export interface EngineDefinition<TControllers extends ControllerDefinitionsMap<
|
|
|
58
52
|
}
|
|
59
53
|
export type CommerceControllerDefinitionsMap = ControllerDefinitionsMap<Controller>;
|
|
60
54
|
type Definition<TControllerDefinitions extends CommerceControllerDefinitionsMap> = CommerceEngineDefinition<TControllerDefinitions, SolutionType>;
|
|
61
|
-
type BuildFunction<TControllerDefinitions extends CommerceControllerDefinitionsMap> = Definition<TControllerDefinitions>['build'];
|
|
62
55
|
export type FetchStaticStateFunction<TControllerDefinitions extends CommerceControllerDefinitionsMap> = Definition<TControllerDefinitions>['fetchStaticState'];
|
|
63
56
|
export type HydrateStaticStateFunction<TControllerDefinitions extends CommerceControllerDefinitionsMap> = Definition<TControllerDefinitions>['hydrateStaticState'];
|
|
64
|
-
type
|
|
65
|
-
type HydrateStaticStateFromBuildResultFunction<TControllerDefinitions extends CommerceControllerDefinitionsMap> = HydrateStaticStateFunction<TControllerDefinitions>['fromBuildResult'];
|
|
66
|
-
export type BuildParameters<TControllerDefinitions extends CommerceControllerDefinitionsMap> = Parameters<BuildFunction<TControllerDefinitions>>;
|
|
57
|
+
export type BuildParameters<TControllerDefinitions extends CommerceControllerDefinitionsMap> = Parameters<Build<CommerceEngineOptions, InferControllersMapFromDefinition<TControllerDefinitions, SolutionType>, InferControllerPropsMapFromDefinitions<TControllerDefinitions>, TControllerDefinitions, SolutionType>>;
|
|
67
58
|
export type FetchStaticStateParameters<TControllerDefinitions extends CommerceControllerDefinitionsMap> = Parameters<FetchStaticStateFunction<TControllerDefinitions>>;
|
|
68
59
|
export type HydrateStaticStateParameters<TControllerDefinitions extends CommerceControllerDefinitionsMap> = Parameters<HydrateStaticStateFunction<TControllerDefinitions>>;
|
|
69
|
-
export type FetchStaticStateFromBuildResultParameters<TControllerDefinitions extends CommerceControllerDefinitionsMap> = Parameters<FetchStaticStateFromBuildResultFunction<TControllerDefinitions>>;
|
|
70
|
-
export type HydrateStaticStateFromBuildResultParameters<TControllerDefinitions extends CommerceControllerDefinitionsMap> = Parameters<HydrateStaticStateFromBuildResultFunction<TControllerDefinitions>>;
|
|
71
60
|
type Controllers<TControllerDefinitions extends CommerceControllerDefinitionsMap> = InferControllersMapFromDefinition<TControllerDefinitions, SolutionType>;
|
|
72
61
|
export type BuildResult<TControllerDefinitions extends CommerceControllerDefinitionsMap> = {
|
|
73
62
|
engine: SSRCommerceEngine;
|
|
@@ -1,17 +1,13 @@
|
|
|
1
1
|
import type { UnknownAction } from '@reduxjs/toolkit';
|
|
2
2
|
import type { Controller } from '../../../controllers/controller/headless-controller.js';
|
|
3
|
-
import type { ControllerStaticStateMap,
|
|
3
|
+
import type { ControllerStaticStateMap, ControllersPropsMap } from '../../common/types/controllers.js';
|
|
4
4
|
import type { SolutionType } from './controller-constants.js';
|
|
5
5
|
import type { ControllerDefinitionsMap, EngineDefinitionControllersPropsOption, OptionsTuple } from './controller-definitions.js';
|
|
6
6
|
import type { EngineStaticState } from './engine.js';
|
|
7
|
-
import type { FromBuildResult } from './from-build-result.js';
|
|
8
7
|
export type FetchStaticStateOptions = {};
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
(...params: OptionsTuple<FetchStaticStateOptions & EngineDefinitionControllersPropsOption<TControllersDefinitionsMap, TControllersProps, TSolutionType>>): Promise<EngineStaticState<TSearchAction, TControllersStaticState>>;
|
|
16
|
-
fromBuildResult: FromBuildResult<TControllers, FetchStaticStateOptions, EngineStaticState<TSearchAction, TControllersStaticState>>;
|
|
17
|
-
};
|
|
8
|
+
/**
|
|
9
|
+
* Executes only the initial search for a given configuration, then returns a resumable snapshot of engine state along with the state of the controllers.
|
|
10
|
+
*
|
|
11
|
+
* Useful for static generation and server-side rendering.
|
|
12
|
+
*/
|
|
13
|
+
export type FetchStaticState<TSearchAction extends UnknownAction, TControllersStaticState extends ControllerStaticStateMap, TControllersProps extends ControllersPropsMap, TControllersDefinitionsMap extends ControllerDefinitionsMap<Controller>, TSolutionType extends SolutionType> = (...params: OptionsTuple<FetchStaticStateOptions & EngineDefinitionControllersPropsOption<TControllersDefinitionsMap, TControllersProps, TSolutionType>>) => Promise<EngineStaticState<TSearchAction, TControllersStaticState>>;
|