@coveo/quantic 3.33.5 → 3.34.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.
Files changed (24) hide show
  1. package/docs/out/quantic-docs.json +1 -1
  2. package/force-app/main/default/lwc/jsconfig.json +1 -1
  3. package/force-app/main/default/lwc/quanticResultQuickview/__tests__/quanticResultQuickview.test.js +8 -1
  4. package/force-app/main/default/lwc/quanticResultQuickview/quanticResultQuickview.js +13 -5
  5. package/force-app/main/default/lwc/quanticUtils/quanticUtils.js +8 -8
  6. package/force-app/main/default/staticresources/coveoheadless/case-assist/headless.js +2 -2
  7. package/force-app/main/default/staticresources/coveoheadless/definitions/api/commerce/commerce-api-client.d.ts +3 -2
  8. package/force-app/main/default/staticresources/coveoheadless/definitions/api/commerce/commerce-api-params.d.ts +3 -0
  9. package/force-app/main/default/staticresources/coveoheadless/definitions/api/commerce/common/product.d.ts +5 -6
  10. package/force-app/main/default/staticresources/coveoheadless/definitions/api/commerce/common/result.d.ts +52 -0
  11. package/force-app/main/default/staticresources/coveoheadless/definitions/api/commerce/listing/request.d.ts +3 -0
  12. package/force-app/main/default/staticresources/coveoheadless/definitions/api/commerce/listing/response.d.ts +5 -0
  13. package/force-app/main/default/staticresources/coveoheadless/definitions/commerce.index.d.ts +3 -1
  14. package/force-app/main/default/staticresources/coveoheadless/definitions/controllers/commerce/product-listing/headless-product-listing.d.ts +12 -1
  15. package/force-app/main/default/staticresources/coveoheadless/definitions/features/commerce/product-listing/product-listing-actions-loader.d.ts +3 -3
  16. package/force-app/main/default/staticresources/coveoheadless/definitions/features/commerce/product-listing/product-listing-actions.d.ts +12 -4
  17. package/force-app/main/default/staticresources/coveoheadless/definitions/features/commerce/product-listing/product-listing-state.d.ts +2 -0
  18. package/force-app/main/default/staticresources/coveoheadless/definitions/ssr-commerce.index.d.ts +2 -1
  19. package/force-app/main/default/staticresources/coveoheadless/definitions/test/mock-product-listing.d.ts +2 -2
  20. package/force-app/main/default/staticresources/coveoheadless/definitions/test/mock-spotlight-content.d.ts +3 -0
  21. package/force-app/main/default/staticresources/coveoheadless/headless.js +3 -3
  22. package/force-app/main/default/staticresources/coveoheadless/insight/headless.js +3 -3
  23. package/force-app/main/default/staticresources/coveoheadless/recommendation/headless.js +2 -2
  24. package/package.json +2 -2
@@ -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,3 @@
1
+ import type { EnableResultsParam } from '../commerce-api-params.js';
2
+ import type { FilterableCommerceAPIRequest } from '../common/request.js';
3
+ export type CommerceListingRequest = FilterableCommerceAPIRequest & EnableResultsParam;
@@ -0,0 +1,5 @@
1
+ import type { CommerceSuccessResponse } from '../common/response.js';
2
+ import type { BaseResult } from '../common/result.js';
3
+ export interface ListingCommerceSuccessResponse extends CommerceSuccessResponse {
4
+ results: BaseResult[];
5
+ }
@@ -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';
@@ -94,7 +96,7 @@ export type { FilterSuggestionsGenerator, GeneratedFilterSuggestionsControllers,
94
96
  export { buildFilterSuggestionsGenerator } from './controllers/commerce/filter-suggestions/headless-filter-suggestions-generator.js';
95
97
  export type { InstantProducts, InstantProductsOptions, InstantProductsProps, InstantProductsState, } from './controllers/commerce/instant-products/headless-instant-products.js';
96
98
  export { buildInstantProducts } from './controllers/commerce/instant-products/headless-instant-products.js';
97
- export type { ProductListing, ProductListingState, } from './controllers/commerce/product-listing/headless-product-listing.js';
99
+ export type { ProductListing, ProductListingOptions, ProductListingState, } from './controllers/commerce/product-listing/headless-product-listing.js';
98
100
  export { buildProductListing } from './controllers/commerce/product-listing/headless-product-listing.js';
99
101
  export type { ProductListingSummaryState } from './controllers/commerce/product-listing/summary/headless-product-listing-summary.js';
100
102
  export type { ProductView } from './controllers/commerce/product-view/headless-product-view.js';
@@ -1,7 +1,9 @@
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
5
  import type { Parameters } from '../../../features/commerce/parameters/parameters-actions.js';
6
+ import type { FetchProductListingPayload } from '../../../features/commerce/product-listing/product-listing-actions.js';
5
7
  import { type Controller } from '../../controller/headless-controller.js';
6
8
  import { type SearchAndListingSubControllers } from '../core/sub-controller/headless-sub-controller.js';
7
9
  import type { ProductListingSummaryState } from './summary/headless-product-listing-summary.js';
@@ -51,17 +53,26 @@ export interface ProductListing extends Controller, SearchAndListingSubControlle
51
53
  */
52
54
  export interface ProductListingState {
53
55
  products: Product[];
56
+ results: Result[];
54
57
  error: CommerceAPIErrorStatusResponse | null;
55
58
  isLoading: boolean;
56
59
  responseId: string;
57
60
  }
61
+ /**
62
+ * Options for configuring the `ProductListing` controller.
63
+ * @group Buildable controllers
64
+ * @category ProductListing
65
+ */
66
+ export interface ProductListingOptions extends FetchProductListingPayload {
67
+ }
58
68
  /**
59
69
  * Creates a `ProductListing` controller instance.
60
70
  *
61
71
  * @param engine - The headless commerce engine.
72
+ * @param options - The configurable `ProductListing` controller options.
62
73
  * @returns A `ProductListing` controller instance.
63
74
  *
64
75
  * @group Buildable controllers
65
76
  * @category ProductListing
66
77
  */
67
- export declare function buildProductListing(engine: CommerceEngine): ProductListing;
78
+ export declare function buildProductListing(engine: CommerceEngine, { enableResults }?: ProductListingOptions): ProductListing;
@@ -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 { type PromoteChildToParentPayload, type QueryCommerceAPIThunkReturn, type StateNeededByFetchProductListing } from './product-listing-actions.js';
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, void, AsyncThunkCommerceOptions<StateNeededByFetchProductListing>>;
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, void, AsyncThunkCommerceOptions<StateNeededByFetchProductListing>>;
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 { CommerceSuccessResponse } from '../../../api/commerce/common/response.js';
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: CommerceSuccessResponse;
7
+ response: ListingCommerceSuccessResponse;
8
8
  }
9
9
  export type StateNeededByFetchProductListing = StateNeededForFilterableCommerceAPIRequest & ProductListingSection;
10
- export declare const fetchProductListing: import("@reduxjs/toolkit").AsyncThunk<QueryCommerceAPIThunkReturn, void, {
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, void, {
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;
@@ -1,5 +1,5 @@
1
1
  /**
2
- * The Coveo Headless SSR Commerce sub-package exposes exposes the engine, definers, controllers, actions, and utility functions to build a server side rendered commerce experience.
2
+ * The Coveo Headless SSR Commerce sub-package exposes the engine, definers, controllers, actions, and utility functions to build a server side rendered commerce experience.
3
3
  *
4
4
  * @example
5
5
  * ```typescript
@@ -151,6 +151,7 @@ export * from './features/commerce/triggers/triggers-actions-loader.js';
151
151
  export { buildResultTemplatesManager } from './features/result-templates/result-templates-manager.js';
152
152
  export { getCommerceApiBaseUrl } from './api/commerce/commerce-api-client.js';
153
153
  export type { BaseProduct, ChildProduct, Product, } from './api/commerce/common/product.js';
154
+ export { ResultType } from './api/commerce/common/result.js';
154
155
  export { getAnalyticsNextApiBaseUrl, getOrganizationEndpoint, } from './api/platform-client.js';
155
156
  export type { RelativeDate, RelativeDatePeriod, RelativeDateUnit, } from './api/search/date/relative-date.js';
156
157
  export { deserializeRelativeDate, validateRelativeDate, } from './api/search/date/relative-date.js';
@@ -1,3 +1,3 @@
1
- import type { CommerceSuccessResponse } from '../api/commerce/common/response.js';
1
+ import type { ListingCommerceSuccessResponse } from '../api/commerce/listing/response.js';
2
2
  import type { QueryCommerceAPIThunkReturn } from '../features/commerce/product-listing/product-listing-actions.js';
3
- export declare function buildFetchProductListingResponse(response?: Partial<CommerceSuccessResponse>): QueryCommerceAPIThunkReturn;
3
+ export declare function buildFetchProductListingResponse(response?: Partial<ListingCommerceSuccessResponse>): QueryCommerceAPIThunkReturn;
@@ -0,0 +1,3 @@
1
+ import type { BaseSpotlightContent, SpotlightContent } from '../api/commerce/common/result.js';
2
+ export declare function buildMockBaseSpotlightContent(config?: Partial<BaseSpotlightContent>): BaseSpotlightContent;
3
+ export declare function buildMockSpotlightContent(config?: Partial<SpotlightContent>): SpotlightContent;