@coveo/quantic 3.33.6 → 3.34.1
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 +1 -1
- package/force-app/main/default/lwc/jsconfig.json +1 -1
- package/force-app/main/default/lwc/quanticResultQuickview/__tests__/quanticResultQuickview.test.js +8 -1
- package/force-app/main/default/lwc/quanticResultQuickview/quanticResultQuickview.js +13 -5
- package/force-app/main/default/lwc/quanticUtils/quanticUtils.js +8 -8
- package/force-app/main/default/staticresources/coveobueno/browser/bueno.js +1 -1
- package/force-app/main/default/staticresources/coveoheadless/case-assist/headless.js +10 -10
- package/force-app/main/default/staticresources/coveoheadless/definitions/api/commerce/commerce-api-client.d.ts +6 -2
- package/force-app/main/default/staticresources/coveoheadless/definitions/api/commerce/commerce-api-params.d.ts +6 -0
- package/force-app/main/default/staticresources/coveoheadless/definitions/api/commerce/commerce-metadata.d.ts +7 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/api/commerce/common/product.d.ts +5 -6
- package/force-app/main/default/staticresources/coveoheadless/definitions/api/commerce/common/request.d.ts +2 -2
- package/force-app/main/default/staticresources/coveoheadless/definitions/api/commerce/common/result.d.ts +52 -0
- package/force-app/main/default/staticresources/coveoheadless/definitions/api/commerce/listing/request.d.ts +3 -0
- package/force-app/main/default/staticresources/coveoheadless/definitions/api/commerce/listing/response.d.ts +5 -0
- package/force-app/main/default/staticresources/coveoheadless/definitions/api/commerce/product-enrichment/product-enrichment-request.d.ts +29 -0
- package/force-app/main/default/staticresources/coveoheadless/definitions/api/commerce/product-enrichment/product-enrichment-response.d.ts +17 -0
- 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/commerce.index.d.ts +9 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/controllers/commerce/core/interactive-spotlight-content/headless-core-interactive-spotlight-content.d.ts +38 -0
- package/force-app/main/default/staticresources/coveoheadless/definitions/controllers/commerce/core/sub-controller/headless-sub-controller.d.ts +10 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/controllers/commerce/product-enrichment/headless-product-enrichment.d.ts +56 -0
- package/force-app/main/default/staticresources/coveoheadless/definitions/controllers/commerce/product-listing/headless-product-listing.d.ts +14 -5
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/commerce/product-enrichment/product-enrichment-actions-loader.d.ts +28 -0
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/commerce/product-enrichment/product-enrichment-actions.d.ts +27 -0
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/commerce/product-enrichment/product-enrichment-slice.d.ts +4 -0
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/commerce/product-enrichment/product-enrichment-state.d.ts +17 -0
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/commerce/product-enrichment/product-enrichment.d.ts +7 -0
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/commerce/product-listing/product-listing-actions-loader.d.ts +3 -3
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/commerce/product-listing/product-listing-actions.d.ts +12 -4
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/commerce/product-listing/product-listing-state.d.ts +2 -0
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/commerce/spotlight-content/spotlight-content-actions-loaders.d.ts +29 -0
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/commerce/spotlight-content/spotlight-content-actions.d.ts +29 -0
- package/force-app/main/default/staticresources/coveoheadless/definitions/ssr-commerce.index.d.ts +2 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/state/commerce-app-state.d.ts +2 -2
- package/force-app/main/default/staticresources/coveoheadless/definitions/state/state-sections.d.ts +7 -0
- package/force-app/main/default/staticresources/coveoheadless/definitions/test/mock-product-enrichment.d.ts +6 -0
- package/force-app/main/default/staticresources/coveoheadless/definitions/test/mock-product-listing.d.ts +2 -2
- package/force-app/main/default/staticresources/coveoheadless/definitions/test/mock-spotlight-content.d.ts +3 -0
- package/force-app/main/default/staticresources/coveoheadless/headless.js +12 -12
- package/force-app/main/default/staticresources/coveoheadless/insight/headless.js +11 -11
- package/force-app/main/default/staticresources/coveoheadless/recommendation/headless.js +9 -9
- package/package.json +4 -4
|
@@ -5,9 +5,12 @@ import type { PlatformEnvironment } from '../../utils/url-utils.js';
|
|
|
5
5
|
import type { PreprocessRequest } from '../preprocess-request.js';
|
|
6
6
|
import type { SpecificFacetSearchResponse } from '../search/facet-search/specific-facet-search/specific-facet-search-response.js';
|
|
7
7
|
import type { CommerceAPIErrorResponse, CommerceAPIErrorStatusResponse } from './commerce-api-error-response.js';
|
|
8
|
-
import { type FilterableCommerceAPIRequest } from './common/request.js';
|
|
9
8
|
import type { CommerceSuccessResponse } from './common/response.js';
|
|
10
9
|
import type { CommerceFacetSearchRequest, FacetSearchType } from './facet-search/facet-search-request.js';
|
|
10
|
+
import type { CommerceListingRequest } from './listing/request.js';
|
|
11
|
+
import type { ListingCommerceSuccessResponse } from './listing/response.js';
|
|
12
|
+
import { type ProductEnrichmentBadgesRequest } from './product-enrichment/product-enrichment-request.js';
|
|
13
|
+
import type { ProductEnrichmentSuccessBadgesResponse } from './product-enrichment/product-enrichment-response.js';
|
|
11
14
|
import { type CommerceRecommendationsRequest } from './recommendations/recommendations-request.js';
|
|
12
15
|
import type { RecommendationsCommerceSuccessResponse } from './recommendations/recommendations-response.js';
|
|
13
16
|
import { type QuerySuggestRequest } from './search/query-suggest/query-suggest-request.js';
|
|
@@ -34,12 +37,13 @@ export declare const isErrorResponse: <T>(r: CommerceAPIResponse<T>) => r is Com
|
|
|
34
37
|
export declare class CommerceAPIClient implements CommerceFacetSearchAPIClient {
|
|
35
38
|
private options;
|
|
36
39
|
constructor(options: CommerceAPIClientOptions);
|
|
37
|
-
getProductListing(req:
|
|
40
|
+
getProductListing(req: CommerceListingRequest): Promise<CommerceAPIResponse<ListingCommerceSuccessResponse>>;
|
|
38
41
|
search(req: CommerceSearchRequest): Promise<CommerceAPIResponse<SearchCommerceSuccessResponse>>;
|
|
39
42
|
getRecommendations(req: CommerceRecommendationsRequest): Promise<CommerceAPIResponse<RecommendationsCommerceSuccessResponse>>;
|
|
40
43
|
productSuggestions(req: CommerceSearchRequest): Promise<CommerceAPIResponse<SearchCommerceSuccessResponse>>;
|
|
41
44
|
querySuggest(req: QuerySuggestRequest): Promise<CommerceAPIResponse<QuerySuggestSuccessResponse>>;
|
|
42
45
|
facetSearch(req: CommerceFacetSearchRequest, type: FacetSearchType): Promise<CommerceAPIResponse<SpecificFacetSearchResponse>>;
|
|
46
|
+
getBadges(req: ProductEnrichmentBadgesRequest): Promise<CommerceAPIResponse<ProductEnrichmentSuccessBadgesResponse>>;
|
|
43
47
|
plan(req: CommerceSearchRequest): Promise<CommerceAPIResponse<CommerceSuccessResponse>>;
|
|
44
48
|
private query;
|
|
45
49
|
}
|
|
@@ -18,6 +18,9 @@ export interface ClientIdParam {
|
|
|
18
18
|
export interface ContextParam {
|
|
19
19
|
context: ContextParams;
|
|
20
20
|
}
|
|
21
|
+
export interface EnableResultsParam {
|
|
22
|
+
enableResults: boolean;
|
|
23
|
+
}
|
|
21
24
|
type ProductParam = {
|
|
22
25
|
productId: string;
|
|
23
26
|
};
|
|
@@ -79,4 +82,7 @@ export interface IgnorePathsParam {
|
|
|
79
82
|
export interface SlotIdParam {
|
|
80
83
|
slotId: string;
|
|
81
84
|
}
|
|
85
|
+
export interface PlacementIdsParam {
|
|
86
|
+
placementIds?: string[];
|
|
87
|
+
}
|
|
82
88
|
export {};
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
export type CommerceApiMethod = 'listing' | 'search' | 'recommendations' | 'search/productSuggest' | 'search/querySuggest' | 'querySuggest' | 'facet';
|
|
1
|
+
export type CommerceApiMethod = 'listing' | 'search' | 'recommendations' | 'search/productSuggest' | 'search/querySuggest' | 'querySuggest' | 'facet' | 'badges';
|
|
2
|
+
/**
|
|
3
|
+
* API methods that require the tracking ID to be included in the URL path.
|
|
4
|
+
* These endpoints use the pattern: /tracking-ids/{trackingId}/{method}
|
|
5
|
+
* All other endpoints use: /{method}
|
|
6
|
+
*/
|
|
7
|
+
export declare const TRACKING_ID_IN_PATH_METHODS: readonly CommerceApiMethod[];
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { HighlightKeyword } from '../../../utils/highlight.js';
|
|
2
|
+
import type { ResultPosition, ResultType } from './result.js';
|
|
2
3
|
export type ChildProduct = Omit<BaseProduct, 'children' | 'totalNumberOfChildren'>;
|
|
3
4
|
export interface BaseProduct {
|
|
4
5
|
/**
|
|
@@ -134,12 +135,10 @@ export interface BaseProduct {
|
|
|
134
135
|
* The ID of the response that returned the product.
|
|
135
136
|
*/
|
|
136
137
|
responseId?: string;
|
|
137
|
-
}
|
|
138
|
-
export interface Product extends BaseProduct {
|
|
139
138
|
/**
|
|
140
|
-
* The
|
|
141
|
-
*
|
|
142
|
-
* For example, if the product is the third one on the second page, and there are 10 products per page, its position is 13 (not 3).
|
|
139
|
+
* The result type of the product.
|
|
143
140
|
*/
|
|
144
|
-
|
|
141
|
+
resultType: ResultType.PRODUCT | ResultType.CHILD_PRODUCT;
|
|
142
|
+
}
|
|
143
|
+
export interface Product extends ResultPosition, BaseProduct {
|
|
145
144
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { PlatformClientCallOptions } from '../../platform-client.js';
|
|
2
2
|
import type { BaseParam } from '../../platform-service-params.js';
|
|
3
3
|
import type { ClientIdParam, ContextParam, CountryParam, CurrencyParam, FacetsParam, LanguageParam, PageParam, PerPageParam, SortParam, TrackingIdParam } from '../commerce-api-params.js';
|
|
4
|
-
import type
|
|
4
|
+
import { type CommerceApiMethod } from '../commerce-metadata.js';
|
|
5
5
|
export type BaseCommerceAPIRequest = BaseParam & TrackingIdParam & LanguageParam & CountryParam & CurrencyParam & ClientIdParam & ContextParam;
|
|
6
6
|
export type PaginatedCommerceAPIRequest = BaseCommerceAPIRequest & PageParam & PerPageParam;
|
|
7
7
|
export type FilterableCommerceAPIRequest = PaginatedCommerceAPIRequest & FacetsParam & SortParam;
|
|
@@ -35,4 +35,4 @@ export declare const getRequestOptions: (req: FilterableCommerceAPIRequest, path
|
|
|
35
35
|
contentType: import("../../platform-client.js").HTTPContentType;
|
|
36
36
|
requestMetadata?: import("../../preprocess-request.js").RequestMetadata | undefined;
|
|
37
37
|
};
|
|
38
|
-
export declare const baseRequest: (req:
|
|
38
|
+
export declare const baseRequest: (req: BaseCommerceAPIRequest, path: CommerceApiMethod) => Pick<PlatformClientCallOptions, "accessToken" | "method" | "contentType" | "url" | "origin" | "requestMetadata">;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import type { BaseProduct, Product } from './product.js';
|
|
2
|
+
export declare enum ResultType {
|
|
3
|
+
CHILD_PRODUCT = "childProduct",
|
|
4
|
+
PRODUCT = "product",
|
|
5
|
+
SPOTLIGHT = "spotlight"
|
|
6
|
+
}
|
|
7
|
+
export interface BaseSpotlightContent {
|
|
8
|
+
/**
|
|
9
|
+
* The unique identifier of the spotlight content.
|
|
10
|
+
*/
|
|
11
|
+
id: string;
|
|
12
|
+
/**
|
|
13
|
+
* The URI to navigate to when the spotlight content is clicked.
|
|
14
|
+
*/
|
|
15
|
+
clickUri: string;
|
|
16
|
+
/**
|
|
17
|
+
* The image URL for desktop display.
|
|
18
|
+
*/
|
|
19
|
+
desktopImage: string;
|
|
20
|
+
/**
|
|
21
|
+
* The image URL for mobile display.
|
|
22
|
+
*/
|
|
23
|
+
mobileImage?: string;
|
|
24
|
+
/**
|
|
25
|
+
* The name of the spotlight content.
|
|
26
|
+
*/
|
|
27
|
+
name?: string;
|
|
28
|
+
/**
|
|
29
|
+
* The description of the spotlight content.
|
|
30
|
+
*/
|
|
31
|
+
description?: string;
|
|
32
|
+
/**
|
|
33
|
+
* The ID of the response that returned the spotlight content.
|
|
34
|
+
*/
|
|
35
|
+
responseId?: string;
|
|
36
|
+
/**
|
|
37
|
+
* The result type identifier, always SPOTLIGHT for spotlight content.
|
|
38
|
+
*/
|
|
39
|
+
resultType: ResultType.SPOTLIGHT;
|
|
40
|
+
}
|
|
41
|
+
export interface ResultPosition {
|
|
42
|
+
/**
|
|
43
|
+
* The 1-based result's position across the non-paginated result set.
|
|
44
|
+
*
|
|
45
|
+
* For example, if the result is the third one on the second page, and there are 10 results per page, its position is 13 (not 3).
|
|
46
|
+
*/
|
|
47
|
+
position: number;
|
|
48
|
+
}
|
|
49
|
+
export interface SpotlightContent extends ResultPosition, BaseSpotlightContent {
|
|
50
|
+
}
|
|
51
|
+
export type BaseResult = BaseProduct | BaseSpotlightContent;
|
|
52
|
+
export type Result = Product | SpotlightContent;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { PlacementIdsParam } from '../commerce-api-params.js';
|
|
2
|
+
import { type BaseCommerceAPIRequest } from '../common/request.js';
|
|
3
|
+
export type ProductEnrichmentBadgesRequest = BaseCommerceAPIRequest & PlacementIdsParam;
|
|
4
|
+
export declare const buildProductEnrichmentBadgesRequest: (req: ProductEnrichmentBadgesRequest) => {
|
|
5
|
+
requestParams: {
|
|
6
|
+
clientId?: string | undefined;
|
|
7
|
+
language: string;
|
|
8
|
+
country: string;
|
|
9
|
+
currency: string;
|
|
10
|
+
placementIds: string[] | undefined;
|
|
11
|
+
context: {
|
|
12
|
+
view: import("../commerce-api-params.js").ViewParams;
|
|
13
|
+
user?: import("../commerce-api-params.js").UserParams;
|
|
14
|
+
product?: {
|
|
15
|
+
productId: string;
|
|
16
|
+
};
|
|
17
|
+
cart?: import("../commerce-api-params.js").CartItemParam[];
|
|
18
|
+
purchased?: import("../commerce-api-params.js").CartItemParam[];
|
|
19
|
+
capture: boolean;
|
|
20
|
+
source: string[];
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
accessToken: string;
|
|
24
|
+
url: string;
|
|
25
|
+
method: import("../../platform-client.js").HttpMethods;
|
|
26
|
+
origin: import("../../preprocess-request.js").PlatformClientOrigin;
|
|
27
|
+
contentType: import("../../platform-client.js").HTTPContentType;
|
|
28
|
+
requestMetadata?: import("../../preprocess-request.js").RequestMetadata | undefined;
|
|
29
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export interface Badge {
|
|
2
|
+
text: string;
|
|
3
|
+
backgroundColor: string;
|
|
4
|
+
textColor: string;
|
|
5
|
+
iconUrl: string | null;
|
|
6
|
+
}
|
|
7
|
+
export interface BadgePlacement {
|
|
8
|
+
placementId: string;
|
|
9
|
+
badges: Badge[];
|
|
10
|
+
}
|
|
11
|
+
export interface BadgesProduct {
|
|
12
|
+
productId: string;
|
|
13
|
+
badgePlacements: BadgePlacement[];
|
|
14
|
+
}
|
|
15
|
+
export interface ProductEnrichmentSuccessBadgesResponse {
|
|
16
|
+
products: BadgesProduct[];
|
|
17
|
+
}
|
package/force-app/main/default/staticresources/coveoheadless/definitions/commerce.index.d.ts
CHANGED
|
@@ -22,6 +22,8 @@ export type { Relay } from '@coveo/relay';
|
|
|
22
22
|
export type { Middleware, Unsubscribe } from '@reduxjs/toolkit';
|
|
23
23
|
export { getCommerceApiBaseUrl } from './api/commerce/commerce-api-client.js';
|
|
24
24
|
export type { BaseProduct, ChildProduct, Product, } from './api/commerce/common/product.js';
|
|
25
|
+
export type { BaseResult, Result, SpotlightContent, } from './api/commerce/common/result.js';
|
|
26
|
+
export { ResultType } from './api/commerce/common/result.js';
|
|
25
27
|
export { getAnalyticsNextApiBaseUrl, getOrganizationEndpoint, } from './api/platform-client.js';
|
|
26
28
|
export type { CommerceEngine, CommerceEngineConfiguration, CommerceEngineOptions, } from './app/commerce-engine/commerce-engine.js';
|
|
27
29
|
export { buildCommerceEngine } from './app/commerce-engine/commerce-engine.js';
|
|
@@ -42,6 +44,7 @@ export * from './features/commerce/facets/regular-facet/regular-facet-actions-lo
|
|
|
42
44
|
export * from './features/commerce/instant-products/instant-products-actions-loader.js';
|
|
43
45
|
export * from './features/commerce/pagination/pagination-actions-loader.js';
|
|
44
46
|
export * from './features/commerce/product/product-actions-loaders.js';
|
|
47
|
+
export * from './features/commerce/product-enrichment/product-enrichment-actions-loader.js';
|
|
45
48
|
export * from './features/commerce/product-listing/product-listing-actions-loader.js';
|
|
46
49
|
export * from './features/commerce/product-listing-parameters/product-listing-parameters-actions-loader.js';
|
|
47
50
|
export * from './features/commerce/query/query-actions-loader.js';
|
|
@@ -52,12 +55,14 @@ export * from './features/commerce/recommendations/recommendations-actions-loade
|
|
|
52
55
|
export * from './features/commerce/search/search-actions-loader.js';
|
|
53
56
|
export * from './features/commerce/search-parameters/search-parameters-actions-loader.js';
|
|
54
57
|
export * from './features/commerce/sort/sort-actions-loader.js';
|
|
58
|
+
export * from './features/commerce/spotlight-content/spotlight-content-actions-loaders.js';
|
|
55
59
|
export * from './features/commerce/standalone-search-box-set/standalone-search-box-set-actions-loader.js';
|
|
56
60
|
export * from './features/commerce/triggers/triggers-actions-loader.js';
|
|
57
61
|
export type { HighlightKeyword } from './utils/highlight.js';
|
|
58
62
|
export type { PlatformEnvironment } from './utils/url-utils.js';
|
|
59
63
|
export { Selectors };
|
|
60
64
|
export type { CartItemParam } from './api/commerce/commerce-api-params.js';
|
|
65
|
+
export type { Badge, BadgePlacement, BadgesProduct, } from './api/commerce/product-enrichment/product-enrichment-response.js';
|
|
61
66
|
export type { CategoryFacetSearchResult } from './api/search/facet-search/category-facet-search/category-facet-search-response.js';
|
|
62
67
|
export type { SpecificFacetSearchResult as RegularFacetSearchResult } from './api/search/facet-search/specific-facet-search/specific-facet-search-response.js';
|
|
63
68
|
export type { Cart, CartInitialState, CartItem, CartProps, CartState, } from './controllers/commerce/context/cart/headless-cart.js';
|
|
@@ -76,6 +81,7 @@ export type { NumericFacet, NumericFacetState, } from './controllers/commerce/co
|
|
|
76
81
|
export type { RegularFacet, RegularFacetState, } from './controllers/commerce/core/facets/regular/headless-commerce-regular-facet.js';
|
|
77
82
|
export type { RegularFacetSearch, RegularFacetSearchState, } from './controllers/commerce/core/facets/regular/headless-commerce-regular-facet-search.js';
|
|
78
83
|
export type { InteractiveProduct, InteractiveProductOptions, InteractiveProductProps, } from './controllers/commerce/core/interactive-product/headless-core-interactive-product.js';
|
|
84
|
+
export type { InteractiveSpotlightContent, InteractiveSpotlightContentOptions, InteractiveSpotlightContentProps, } from './controllers/commerce/core/interactive-spotlight-content/headless-core-interactive-spotlight-content.js';
|
|
79
85
|
export type { Pagination, PaginationOptions, PaginationProps, PaginationState, } from './controllers/commerce/core/pagination/headless-core-commerce-pagination.js';
|
|
80
86
|
export type { ParameterManager, ParameterManagerInitialState, ParameterManagerProps, ParameterManagerState, } from './controllers/commerce/core/parameter-manager/headless-core-parameter-manager.js';
|
|
81
87
|
export type { Sort, SortByFields, SortByFieldsFields, SortByRelevance, SortCriterion, SortInitialState, SortProps, SortState, } from './controllers/commerce/core/sort/headless-core-commerce-sort.js';
|
|
@@ -94,7 +100,9 @@ export type { FilterSuggestionsGenerator, GeneratedFilterSuggestionsControllers,
|
|
|
94
100
|
export { buildFilterSuggestionsGenerator } from './controllers/commerce/filter-suggestions/headless-filter-suggestions-generator.js';
|
|
95
101
|
export type { InstantProducts, InstantProductsOptions, InstantProductsProps, InstantProductsState, } from './controllers/commerce/instant-products/headless-instant-products.js';
|
|
96
102
|
export { buildInstantProducts } from './controllers/commerce/instant-products/headless-instant-products.js';
|
|
97
|
-
export type {
|
|
103
|
+
export type { ProductEnrichment, ProductEnrichmentOptions, ProductEnrichmentProps, ProductEnrichmentState, } from './controllers/commerce/product-enrichment/headless-product-enrichment.js';
|
|
104
|
+
export { buildProductEnrichment } from './controllers/commerce/product-enrichment/headless-product-enrichment.js';
|
|
105
|
+
export type { ProductListing, ProductListingOptions, ProductListingState, } from './controllers/commerce/product-listing/headless-product-listing.js';
|
|
98
106
|
export { buildProductListing } from './controllers/commerce/product-listing/headless-product-listing.js';
|
|
99
107
|
export type { ProductListingSummaryState } from './controllers/commerce/product-listing/summary/headless-product-listing-summary.js';
|
|
100
108
|
export type { ProductView } from './controllers/commerce/product-view/headless-product-view.js';
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import type { SpotlightContent } from '../../../../api/commerce/common/result.js';
|
|
2
|
+
import type { CommerceEngine, CommerceEngineState } from '../../../../app/commerce-engine/commerce-engine.js';
|
|
3
|
+
import type { InteractiveResultCore, InteractiveResultCoreProps as InteractiveResultHeadlessCoreProps, InteractiveResultCoreOptions as InteractiveSpotlightContentCoreOptions } from '../../../core/interactive-result/headless-core-interactive-result.js';
|
|
4
|
+
export interface InteractiveSpotlightContentOptions extends InteractiveSpotlightContentCoreOptions {
|
|
5
|
+
/**
|
|
6
|
+
* The spotlight content to log analytics for.
|
|
7
|
+
*/
|
|
8
|
+
spotlightContent: SpotlightContent;
|
|
9
|
+
}
|
|
10
|
+
export interface InteractiveSpotlightContentCoreProps extends InteractiveResultHeadlessCoreProps {
|
|
11
|
+
/**
|
|
12
|
+
* The options for the `InteractiveSpotlightContent` sub-controller.
|
|
13
|
+
*/
|
|
14
|
+
options: InteractiveSpotlightContentOptions;
|
|
15
|
+
/**
|
|
16
|
+
* The selector to fetch the response ID from the state.
|
|
17
|
+
*/
|
|
18
|
+
responseIdSelector: (state: CommerceEngineState) => string;
|
|
19
|
+
}
|
|
20
|
+
export type InteractiveSpotlightContentProps = Omit<InteractiveSpotlightContentCoreProps, 'responseIdSelector'>;
|
|
21
|
+
/**
|
|
22
|
+
* The `InteractiveSpotlightContent` sub-controller provides an interface for handling long presses, multiple clicks, etc. to ensure
|
|
23
|
+
* analytics events are logged properly when a user selects a spotlight content item.
|
|
24
|
+
*/
|
|
25
|
+
export interface InteractiveSpotlightContent extends InteractiveResultCore {
|
|
26
|
+
warningMessage?: string;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Creates an `InteractiveSpotlightContent` sub-controller instance.
|
|
30
|
+
*
|
|
31
|
+
* @param engine - The headless commerce engine.
|
|
32
|
+
* @param props - The configurable `InteractiveSpotlightContent` properties.
|
|
33
|
+
* @returns An `InteractiveSpotlightContent` sub-controller instance.
|
|
34
|
+
*
|
|
35
|
+
* @group Buildable controllers
|
|
36
|
+
* @category CoreInteractiveSpotlightContent
|
|
37
|
+
*/
|
|
38
|
+
export declare function buildCoreInteractiveSpotlightContent(engine: CommerceEngine, props: InteractiveSpotlightContentCoreProps): InteractiveSpotlightContent;
|
|
@@ -16,6 +16,7 @@ import { type BreadcrumbManager } from '../breadcrumb-manager/headless-core-brea
|
|
|
16
16
|
import type { FetchProductsActionCreator } from '../common.js';
|
|
17
17
|
import { type FacetGenerator } from '../facets/generator/headless-commerce-facet-generator.js';
|
|
18
18
|
import { type InteractiveProduct, type InteractiveProductProps } from '../interactive-product/headless-core-interactive-product.js';
|
|
19
|
+
import { type InteractiveSpotlightContent, type InteractiveSpotlightContentProps } from '../interactive-spotlight-content/headless-core-interactive-spotlight-content.js';
|
|
19
20
|
import { type Pagination, type PaginationProps } from '../pagination/headless-core-commerce-pagination.js';
|
|
20
21
|
import { type ParameterManager, type ParameterManagerProps } from '../parameter-manager/headless-core-parameter-manager.js';
|
|
21
22
|
import { type Sort, type SortProps } from '../sort/headless-core-commerce-sort.js';
|
|
@@ -77,6 +78,14 @@ export interface SearchSubControllers extends SearchAndListingSubControllers<Com
|
|
|
77
78
|
*/
|
|
78
79
|
didYouMean(): DidYouMean;
|
|
79
80
|
}
|
|
81
|
+
export interface ProductListingSubControllers extends SearchAndListingSubControllers<ProductListingParameters, ProductListingSummaryState> {
|
|
82
|
+
/**
|
|
83
|
+
* Creates an `InteractiveSpotlightContent` sub-controller, for use when `enableResults` is set on the controller.
|
|
84
|
+
* @param props - The properties for the `InteractiveSpotlightContent` sub-controller.
|
|
85
|
+
* @returns An `InteractiveSpotlightContent` sub-controller.
|
|
86
|
+
*/
|
|
87
|
+
interactiveSpotlightContent(props: InteractiveSpotlightContentProps): InteractiveSpotlightContent;
|
|
88
|
+
}
|
|
80
89
|
interface BaseSubControllerProps<S extends SummaryState> {
|
|
81
90
|
responseIdSelector: (state: CommerceEngineState) => string;
|
|
82
91
|
isLoadingSelector: (state: CommerceEngineState) => boolean;
|
|
@@ -115,7 +124,7 @@ export declare function buildSearchSubControllers(engine: CommerceEngine, subCon
|
|
|
115
124
|
* @param subControllerProps - The properties for the listing sub-controllers.
|
|
116
125
|
* @returns The product listing sub-controllers.
|
|
117
126
|
*/
|
|
118
|
-
export declare function buildProductListingSubControllers(engine: CommerceEngine, subControllerProps: Omit<SearchAndListingSubControllerProps<ProductListingParameters, ProductListingSummaryState>, 'facetSearchType'>):
|
|
127
|
+
export declare function buildProductListingSubControllers(engine: CommerceEngine, subControllerProps: Omit<SearchAndListingSubControllerProps<ProductListingParameters, ProductListingSummaryState>, 'facetSearchType'>): ProductListingSubControllers;
|
|
119
128
|
/**
|
|
120
129
|
* Builds the sub-controllers for the commerce search and product listing use cases.
|
|
121
130
|
*
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import type { SerializedError } from '@reduxjs/toolkit';
|
|
2
|
+
import type { CommerceAPIErrorResponse } from '../../../api/commerce/commerce-api-error-response.js';
|
|
3
|
+
import type { BadgesProduct } from '../../../api/commerce/product-enrichment/product-enrichment-response.js';
|
|
4
|
+
import type { CommerceEngine } from '../../../app/commerce-engine/commerce-engine.js';
|
|
5
|
+
import { type FetchBadgesPayload } from '../../../features/commerce/product-enrichment/product-enrichment-actions.js';
|
|
6
|
+
import { type Controller } from '../../controller/headless-controller.js';
|
|
7
|
+
export interface ProductEnrichmentOptions extends FetchBadgesPayload {
|
|
8
|
+
}
|
|
9
|
+
export interface ProductEnrichmentProps {
|
|
10
|
+
/**
|
|
11
|
+
* The options for the `ProductEnrichment` controller.
|
|
12
|
+
*/
|
|
13
|
+
options?: ProductEnrichmentOptions;
|
|
14
|
+
}
|
|
15
|
+
export interface ProductEnrichment extends Controller {
|
|
16
|
+
/**
|
|
17
|
+
* The state of the ProductEnrichment controller.
|
|
18
|
+
* */
|
|
19
|
+
state: ProductEnrichmentState;
|
|
20
|
+
/**
|
|
21
|
+
* Fetches badges for the configured product and placement IDs.
|
|
22
|
+
*
|
|
23
|
+
* The results are accessible through the controller's `state.products` property.
|
|
24
|
+
*
|
|
25
|
+
* @remarks
|
|
26
|
+
* This method will not execute if no placement IDs were provided during controller initialization.
|
|
27
|
+
* The request will include the configured `productId` in the context if provided.
|
|
28
|
+
* */
|
|
29
|
+
getBadges(): void;
|
|
30
|
+
}
|
|
31
|
+
export interface ProductEnrichmentState {
|
|
32
|
+
/**
|
|
33
|
+
* An array of products with their badge placements.
|
|
34
|
+
*/
|
|
35
|
+
products: BadgesProduct[];
|
|
36
|
+
/**
|
|
37
|
+
* Whether a request to fetch badges is currently being executed.
|
|
38
|
+
*/
|
|
39
|
+
isLoading: boolean;
|
|
40
|
+
/**
|
|
41
|
+
* The error returned when executing a badge fetch request, if any. This is `null` otherwise.
|
|
42
|
+
*/
|
|
43
|
+
error: CommerceAPIErrorResponse | SerializedError | null;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Creates a `ProductEnrichment` controller instance.
|
|
47
|
+
*
|
|
48
|
+
* @param engine - The headless engine.
|
|
49
|
+
* @param props - The configuration `ProductEnrichment` properties.
|
|
50
|
+
* @returns A `ProductEnrichment` controller instance.
|
|
51
|
+
*
|
|
52
|
+
* @group Buildable controllers
|
|
53
|
+
* @category ProductEnrichment
|
|
54
|
+
*
|
|
55
|
+
* */
|
|
56
|
+
export declare function buildProductEnrichment(engine: CommerceEngine, props?: ProductEnrichmentProps): ProductEnrichment;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import type { CommerceAPIErrorStatusResponse } from '../../../api/commerce/commerce-api-error-response.js';
|
|
2
2
|
import type { ChildProduct, Product } from '../../../api/commerce/common/product.js';
|
|
3
|
+
import type { Result } from '../../../api/commerce/common/result.js';
|
|
3
4
|
import type { CommerceEngine } from '../../../app/commerce-engine/commerce-engine.js';
|
|
4
|
-
import type {
|
|
5
|
+
import type { FetchProductListingPayload } from '../../../features/commerce/product-listing/product-listing-actions.js';
|
|
5
6
|
import { type Controller } from '../../controller/headless-controller.js';
|
|
6
|
-
import { type
|
|
7
|
-
import type { ProductListingSummaryState } from './summary/headless-product-listing-summary.js';
|
|
7
|
+
import { type ProductListingSubControllers } from '../core/sub-controller/headless-sub-controller.js';
|
|
8
8
|
/**
|
|
9
9
|
* The `ProductListing` controller exposes a method for retrieving product listing content in a commerce interface.
|
|
10
10
|
*
|
|
@@ -13,7 +13,7 @@ import type { ProductListingSummaryState } from './summary/headless-product-list
|
|
|
13
13
|
* @group Buildable controllers
|
|
14
14
|
* @category ProductListing
|
|
15
15
|
*/
|
|
16
|
-
export interface ProductListing extends Controller,
|
|
16
|
+
export interface ProductListing extends Controller, ProductListingSubControllers {
|
|
17
17
|
/**
|
|
18
18
|
* Fetches the product listing.
|
|
19
19
|
*/
|
|
@@ -51,17 +51,26 @@ export interface ProductListing extends Controller, SearchAndListingSubControlle
|
|
|
51
51
|
*/
|
|
52
52
|
export interface ProductListingState {
|
|
53
53
|
products: Product[];
|
|
54
|
+
results: Result[];
|
|
54
55
|
error: CommerceAPIErrorStatusResponse | null;
|
|
55
56
|
isLoading: boolean;
|
|
56
57
|
responseId: string;
|
|
57
58
|
}
|
|
59
|
+
/**
|
|
60
|
+
* Options for configuring the `ProductListing` controller.
|
|
61
|
+
* @group Buildable controllers
|
|
62
|
+
* @category ProductListing
|
|
63
|
+
*/
|
|
64
|
+
export interface ProductListingOptions extends FetchProductListingPayload {
|
|
65
|
+
}
|
|
58
66
|
/**
|
|
59
67
|
* Creates a `ProductListing` controller instance.
|
|
60
68
|
*
|
|
61
69
|
* @param engine - The headless commerce engine.
|
|
70
|
+
* @param options - The configurable `ProductListing` controller options.
|
|
62
71
|
* @returns A `ProductListing` controller instance.
|
|
63
72
|
*
|
|
64
73
|
* @group Buildable controllers
|
|
65
74
|
* @category ProductListing
|
|
66
75
|
*/
|
|
67
|
-
export declare function buildProductListing(engine: CommerceEngine): ProductListing;
|
|
76
|
+
export declare function buildProductListing(engine: CommerceEngine, { enableResults }?: ProductListingOptions): ProductListing;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { AsyncThunkAction } from '@reduxjs/toolkit';
|
|
2
|
+
import type { AsyncThunkCommerceOptions } from '../../../api/commerce/commerce-api-client.js';
|
|
3
|
+
import type { CommerceEngine } from '../../../app/commerce-engine/commerce-engine.js';
|
|
4
|
+
import { type FetchBadgesPayload, type FetchBadgesThunkReturn, type StateNeededByFetchBadges } from './product-enrichment-actions.js';
|
|
5
|
+
/**
|
|
6
|
+
* The product enrichment action creators.
|
|
7
|
+
*
|
|
8
|
+
* @group Actions
|
|
9
|
+
* @category ProductEnrichment
|
|
10
|
+
*/
|
|
11
|
+
export interface ProductEnrichmentActionCreators {
|
|
12
|
+
/**
|
|
13
|
+
* Fetches the badges.
|
|
14
|
+
*
|
|
15
|
+
* @returns A dispatchable action.
|
|
16
|
+
*/
|
|
17
|
+
fetchBadges(payload?: FetchBadgesPayload): AsyncThunkAction<FetchBadgesThunkReturn, FetchBadgesPayload, AsyncThunkCommerceOptions<StateNeededByFetchBadges>>;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Loads the commerce product enrichment reducer and returns the available product enrichment action creators.
|
|
21
|
+
*
|
|
22
|
+
* @param engine - The headless commerce engine.
|
|
23
|
+
* @returns An object holding the product enrichment action creators.
|
|
24
|
+
*
|
|
25
|
+
* @group Actions
|
|
26
|
+
* @category ProductEnrichment
|
|
27
|
+
*/
|
|
28
|
+
export declare function loadProductEnrichmentActions(engine: CommerceEngine): ProductEnrichmentActionCreators;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { ProductEnrichmentSuccessBadgesResponse } from '../../../api/commerce/product-enrichment/product-enrichment-response.js';
|
|
2
|
+
import type { ProductEnrichmentSection } from '../../../state/state-sections.js';
|
|
3
|
+
import { type StateNeededForBaseCommerceAPIRequest } from '../common/base-commerce-api-request-builder.js';
|
|
4
|
+
export type StateNeededByFetchBadges = StateNeededForBaseCommerceAPIRequest & ProductEnrichmentSection;
|
|
5
|
+
export interface FetchBadgesPayload {
|
|
6
|
+
/**
|
|
7
|
+
* An array of placement IDs to fetch badges for.
|
|
8
|
+
*/
|
|
9
|
+
placementIds?: string[];
|
|
10
|
+
/**
|
|
11
|
+
* The product ID to fetch badges for.
|
|
12
|
+
*/
|
|
13
|
+
productId?: string;
|
|
14
|
+
}
|
|
15
|
+
export interface FetchBadgesThunkReturn {
|
|
16
|
+
response: ProductEnrichmentSuccessBadgesResponse;
|
|
17
|
+
}
|
|
18
|
+
export declare const fetchBadges: import("@reduxjs/toolkit").AsyncThunk<FetchBadgesThunkReturn, FetchBadgesPayload, {
|
|
19
|
+
state: StateNeededByFetchBadges;
|
|
20
|
+
rejectValue: import("../../../api/commerce/commerce-api-error-response.js").CommerceAPIErrorStatusResponse;
|
|
21
|
+
extra: import("../../../app/commerce-thunk-extra-arguments.js").CommerceThunkExtraArguments;
|
|
22
|
+
dispatch?: import("redux-thunk").ThunkDispatch<unknown, unknown, import("@reduxjs/toolkit").UnknownAction> | undefined;
|
|
23
|
+
serializedErrorType?: unknown;
|
|
24
|
+
pendingMeta?: unknown;
|
|
25
|
+
fulfilledMeta?: unknown;
|
|
26
|
+
rejectedMeta?: unknown;
|
|
27
|
+
}>;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { CommerceAPIErrorStatusResponse } from '../../../api/commerce/commerce-api-error-response.js';
|
|
2
|
+
import type { BadgesProduct } from '../../../api/commerce/product-enrichment/product-enrichment-response.js';
|
|
3
|
+
export interface ProductEnrichmentState {
|
|
4
|
+
/**
|
|
5
|
+
* The array of products containing badge placements for each product.
|
|
6
|
+
*/
|
|
7
|
+
products: BadgesProduct[];
|
|
8
|
+
/**
|
|
9
|
+
* Whether a request to fetch badges is currently being executed.
|
|
10
|
+
*/
|
|
11
|
+
isLoading: boolean;
|
|
12
|
+
/**
|
|
13
|
+
* The error message if the request failed.
|
|
14
|
+
*/
|
|
15
|
+
error: CommerceAPIErrorStatusResponse | null;
|
|
16
|
+
}
|
|
17
|
+
export declare function getProductEnrichmentInitialState(): ProductEnrichmentState;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { ArrayValue, Schema } from '@coveo/bueno';
|
|
2
|
+
import type { ProductEnrichmentOptions } from '../../../controllers/commerce/product-enrichment/headless-product-enrichment.js';
|
|
3
|
+
export declare const productEnrichmentDefinition: {
|
|
4
|
+
placementIds: ArrayValue<import("@coveo/bueno").PrimitivesValues>;
|
|
5
|
+
productId: import("@coveo/bueno").StringValue<string>;
|
|
6
|
+
};
|
|
7
|
+
export declare const productEnrichmentOptionsSchema: Schema<ProductEnrichmentOptions>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { AsyncThunkAction, PayloadAction } from '@reduxjs/toolkit';
|
|
2
2
|
import type { AsyncThunkCommerceOptions } from '../../../api/commerce/commerce-api-client.js';
|
|
3
3
|
import type { CommerceEngine } from '../../../app/commerce-engine/commerce-engine.js';
|
|
4
|
-
import {
|
|
4
|
+
import type { FetchProductListingPayload, PromoteChildToParentPayload, QueryCommerceAPIThunkReturn, StateNeededByFetchProductListing } from './product-listing-actions.js';
|
|
5
5
|
/**
|
|
6
6
|
* The product listing action creators.
|
|
7
7
|
*
|
|
@@ -14,13 +14,13 @@ export interface ProductListingActionCreators {
|
|
|
14
14
|
*
|
|
15
15
|
* @returns A dispatchable action.
|
|
16
16
|
*/
|
|
17
|
-
fetchProductListing(): AsyncThunkAction<QueryCommerceAPIThunkReturn,
|
|
17
|
+
fetchProductListing(payload?: FetchProductListingPayload): AsyncThunkAction<QueryCommerceAPIThunkReturn, FetchProductListingPayload, AsyncThunkCommerceOptions<StateNeededByFetchProductListing>>;
|
|
18
18
|
/**
|
|
19
19
|
* Fetches and additional page of products and appends it to the current list.
|
|
20
20
|
*
|
|
21
21
|
* @returns A dispatchable action.
|
|
22
22
|
*/
|
|
23
|
-
fetchMoreProducts(): AsyncThunkAction<QueryCommerceAPIThunkReturn | null,
|
|
23
|
+
fetchMoreProducts(payload?: FetchProductListingPayload): AsyncThunkAction<QueryCommerceAPIThunkReturn | null, FetchProductListingPayload, AsyncThunkCommerceOptions<StateNeededByFetchProductListing>>;
|
|
24
24
|
/**
|
|
25
25
|
* Promotes a child product to a parent product.
|
|
26
26
|
*
|
|
@@ -1,13 +1,21 @@
|
|
|
1
1
|
import type { ChildProduct } from '../../../api/commerce/common/product.js';
|
|
2
|
-
import type {
|
|
2
|
+
import type { ListingCommerceSuccessResponse } from '../../../api/commerce/listing/response.js';
|
|
3
3
|
import type { ProductListingSection } from '../../../state/state-sections.js';
|
|
4
4
|
import { type StateNeededForFilterableCommerceAPIRequest } from '../common/filterable-commerce-api-request-builder.js';
|
|
5
5
|
export interface QueryCommerceAPIThunkReturn {
|
|
6
6
|
/** The successful response. */
|
|
7
|
-
response:
|
|
7
|
+
response: ListingCommerceSuccessResponse;
|
|
8
8
|
}
|
|
9
9
|
export type StateNeededByFetchProductListing = StateNeededForFilterableCommerceAPIRequest & ProductListingSection;
|
|
10
|
-
export
|
|
10
|
+
export interface FetchProductListingPayload {
|
|
11
|
+
/**
|
|
12
|
+
* When set to true, fills the `results` field rather than the `products` field
|
|
13
|
+
* in the response. It may also include Spotlight Content in the results.
|
|
14
|
+
* @default false
|
|
15
|
+
*/
|
|
16
|
+
enableResults?: boolean;
|
|
17
|
+
}
|
|
18
|
+
export declare const fetchProductListing: import("@reduxjs/toolkit").AsyncThunk<QueryCommerceAPIThunkReturn, FetchProductListingPayload, {
|
|
11
19
|
state: StateNeededByFetchProductListing;
|
|
12
20
|
rejectValue: import("../../../api/commerce/commerce-api-error-response.js").CommerceAPIErrorStatusResponse;
|
|
13
21
|
extra: import("../../../app/commerce-thunk-extra-arguments.js").CommerceThunkExtraArguments;
|
|
@@ -17,7 +25,7 @@ export declare const fetchProductListing: import("@reduxjs/toolkit").AsyncThunk<
|
|
|
17
25
|
fulfilledMeta?: unknown;
|
|
18
26
|
rejectedMeta?: unknown;
|
|
19
27
|
}>;
|
|
20
|
-
export declare const fetchMoreProducts: import("@reduxjs/toolkit").AsyncThunk<QueryCommerceAPIThunkReturn | null,
|
|
28
|
+
export declare const fetchMoreProducts: import("@reduxjs/toolkit").AsyncThunk<QueryCommerceAPIThunkReturn | null, FetchProductListingPayload, {
|
|
21
29
|
state: StateNeededByFetchProductListing;
|
|
22
30
|
rejectValue: import("../../../api/commerce/commerce-api-error-response.js").CommerceAPIErrorStatusResponse;
|
|
23
31
|
extra: import("../../../app/commerce-thunk-extra-arguments.js").CommerceThunkExtraArguments;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { CommerceAPIErrorStatusResponse } from '../../../api/commerce/commerce-api-error-response.js';
|
|
2
2
|
import type { Product } from '../../../api/commerce/common/product.js';
|
|
3
|
+
import type { Result } from '../../../api/commerce/common/result.js';
|
|
3
4
|
import type { AnyFacetResponse } from '../facets/facet-set/interfaces/response.js';
|
|
4
5
|
export interface ProductListingState {
|
|
5
6
|
error: CommerceAPIErrorStatusResponse | null;
|
|
@@ -8,5 +9,6 @@ export interface ProductListingState {
|
|
|
8
9
|
responseId: string;
|
|
9
10
|
facets: AnyFacetResponse[];
|
|
10
11
|
products: Product[];
|
|
12
|
+
results: Result[];
|
|
11
13
|
}
|
|
12
14
|
export declare const getProductListingInitialState: () => ProductListingState;
|