@coveo/headless 3.36.0 → 3.37.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 +4 -0
- package/dist/cjs/case-assist/headless.cjs +1 -1
- package/dist/cjs/commerce/headless.cjs +413 -229
- package/dist/cjs/commerce/node.cjs.stats.json +1 -1
- package/dist/cjs/headless.cjs +1 -1
- package/dist/cjs/insight/headless.cjs +1 -1
- package/dist/cjs/insight/node.cjs.stats.json +1 -1
- package/dist/cjs/node.cjs.stats.json +1 -1
- package/dist/cjs/recommendation/headless.cjs +1 -1
- package/dist/cjs/ssr/headless.cjs +1 -1
- package/dist/cjs/ssr/node.cjs.stats.json +1 -1
- package/dist/cjs/ssr-commerce/headless.cjs +39 -3
- package/dist/cjs/ssr-commerce/node.cjs.stats.json +1 -1
- package/dist/cjs/ssr-commerce-next/headless.cjs +39 -3
- package/dist/cjs/ssr-commerce-next/node.cjs.stats.json +1 -1
- package/dist/cjs/ssr-next/headless.cjs +1 -1
- package/dist/cjs/ssr-next/node.cjs.stats.json +1 -1
- package/dist/definitions/api/commerce/commerce-api-client.d.ts +3 -0
- package/dist/definitions/api/commerce/commerce-api-params.d.ts +3 -0
- package/dist/definitions/api/commerce/commerce-metadata.d.ts +7 -1
- package/dist/definitions/api/commerce/common/request.d.ts +2 -2
- package/dist/definitions/api/commerce/product-enrichment/product-enrichment-request.d.ts +29 -0
- package/dist/definitions/api/commerce/product-enrichment/product-enrichment-response.d.ts +17 -0
- package/dist/definitions/commerce.index.d.ts +4 -0
- package/dist/definitions/controllers/commerce/product-enrichment/headless-product-enrichment.d.ts +56 -0
- package/dist/definitions/features/commerce/product-enrichment/product-enrichment-actions-loader.d.ts +28 -0
- package/dist/definitions/features/commerce/product-enrichment/product-enrichment-actions.d.ts +27 -0
- package/dist/definitions/features/commerce/product-enrichment/product-enrichment-slice.d.ts +4 -0
- package/dist/definitions/features/commerce/product-enrichment/product-enrichment-state.d.ts +17 -0
- package/dist/definitions/features/commerce/product-enrichment/product-enrichment.d.ts +7 -0
- package/dist/definitions/state/commerce-app-state.d.ts +2 -2
- package/dist/definitions/state/state-sections.d.ts +7 -0
- package/dist/definitions/test/mock-product-enrichment.d.ts +6 -0
- package/dist/esm/api/commerce/commerce-api-client.js +7 -0
- package/dist/esm/api/commerce/commerce-metadata.js +8 -1
- package/dist/esm/api/commerce/common/request.js +13 -2
- package/dist/esm/api/commerce/product-enrichment/product-enrichment-request.js +18 -0
- package/dist/esm/api/commerce/product-enrichment/product-enrichment-response.js +1 -0
- package/dist/esm/commerce.index.js +2 -0
- package/dist/esm/controllers/commerce/product-enrichment/headless-product-enrichment.js +61 -0
- package/dist/esm/features/commerce/product-enrichment/product-enrichment-actions-loader.js +17 -0
- package/dist/esm/features/commerce/product-enrichment/product-enrichment-actions.js +26 -0
- package/dist/esm/features/commerce/product-enrichment/product-enrichment-slice.js +26 -0
- package/dist/esm/features/commerce/product-enrichment/product-enrichment-state.js +7 -0
- package/dist/esm/features/commerce/product-enrichment/product-enrichment.js +11 -0
- package/dist/esm/test/mock-commerce-state.js +2 -0
- package/dist/esm/test/mock-product-enrichment.js +30 -0
- package/dist/esm/utils/version.js +1 -1
- package/dist/quantic/browser.cjs.stats.json +1 -1
- package/dist/quantic/case-assist/headless.js +1 -1
- package/dist/quantic/commerce/browser.cjs.stats.json +1 -1
- package/dist/quantic/commerce/headless.js +8 -8
- package/dist/quantic/commerce/headless.js.map +4 -4
- package/dist/quantic/headless.js +9 -9
- package/dist/quantic/headless.js.map +4 -4
- package/dist/quantic/insight/browser.cjs.stats.json +1 -1
- package/dist/quantic/insight/headless.js +8 -8
- package/dist/quantic/insight/headless.js.map +4 -4
- package/dist/quantic/recommendation/headless.js +1 -1
- package/package.json +1 -1
|
@@ -467,7 +467,7 @@ var import_bueno8 = require("@coveo/bueno");
|
|
|
467
467
|
var import_toolkit3 = require("@reduxjs/toolkit");
|
|
468
468
|
|
|
469
469
|
// src/utils/version.ts
|
|
470
|
-
var VERSION = "3.
|
|
470
|
+
var VERSION = "3.37.0";
|
|
471
471
|
var COVEO_FRAMEWORK = ["@coveo/atomic", "@coveo/quantic"];
|
|
472
472
|
|
|
473
473
|
// src/features/configuration/configuration-actions.ts
|
|
@@ -8728,6 +8728,11 @@ function sanitizeNumericFacetParams(params) {
|
|
|
8728
8728
|
var import_bueno46 = require("@coveo/bueno");
|
|
8729
8729
|
var import_toolkit38 = require("@reduxjs/toolkit");
|
|
8730
8730
|
|
|
8731
|
+
// src/api/commerce/commerce-metadata.ts
|
|
8732
|
+
var TRACKING_ID_IN_PATH_METHODS = [
|
|
8733
|
+
"badges"
|
|
8734
|
+
];
|
|
8735
|
+
|
|
8731
8736
|
// src/api/commerce/common/request.ts
|
|
8732
8737
|
var getRequestOptions = (req, path) => {
|
|
8733
8738
|
return {
|
|
@@ -8762,8 +8767,8 @@ var prepareRequestParams = (req) => {
|
|
|
8762
8767
|
};
|
|
8763
8768
|
};
|
|
8764
8769
|
var baseRequest = (req, path) => {
|
|
8765
|
-
const { url, accessToken } = req;
|
|
8766
|
-
const baseUrl =
|
|
8770
|
+
const { url, trackingId, accessToken } = req;
|
|
8771
|
+
const baseUrl = buildUrlWithTrackingIdInPath(url, trackingId, path);
|
|
8767
8772
|
return {
|
|
8768
8773
|
accessToken,
|
|
8769
8774
|
method: "POST",
|
|
@@ -8773,6 +8778,31 @@ var baseRequest = (req, path) => {
|
|
|
8773
8778
|
requestMetadata: { method: path }
|
|
8774
8779
|
};
|
|
8775
8780
|
};
|
|
8781
|
+
var buildUrlWithTrackingIdInPath = (baseUrl, trackingId, path) => {
|
|
8782
|
+
if (trackingId && TRACKING_ID_IN_PATH_METHODS.includes(path)) {
|
|
8783
|
+
return `${baseUrl}/tracking-ids/${trackingId}/${path}`;
|
|
8784
|
+
}
|
|
8785
|
+
return `${baseUrl}/${path}`;
|
|
8786
|
+
};
|
|
8787
|
+
|
|
8788
|
+
// src/api/commerce/product-enrichment/product-enrichment-request.ts
|
|
8789
|
+
var buildProductEnrichmentBadgesRequest = (req) => {
|
|
8790
|
+
return {
|
|
8791
|
+
...baseRequest(req, "badges"),
|
|
8792
|
+
requestParams: prepareProductEnrichmentRequestParams(req)
|
|
8793
|
+
};
|
|
8794
|
+
};
|
|
8795
|
+
var prepareProductEnrichmentRequestParams = (req) => {
|
|
8796
|
+
const { language, country, currency, placementIds, context, clientId } = req;
|
|
8797
|
+
return {
|
|
8798
|
+
language,
|
|
8799
|
+
country,
|
|
8800
|
+
currency,
|
|
8801
|
+
placementIds,
|
|
8802
|
+
context,
|
|
8803
|
+
...clientId && { clientId }
|
|
8804
|
+
};
|
|
8805
|
+
};
|
|
8776
8806
|
|
|
8777
8807
|
// src/api/commerce/recommendations/recommendations-request.ts
|
|
8778
8808
|
var buildRecommendationsRequest = (req, path) => {
|
|
@@ -8899,6 +8929,12 @@ var CommerceAPIClient = class {
|
|
|
8899
8929
|
...this.options
|
|
8900
8930
|
});
|
|
8901
8931
|
}
|
|
8932
|
+
async getBadges(req) {
|
|
8933
|
+
return this.query({
|
|
8934
|
+
...buildProductEnrichmentBadgesRequest(req),
|
|
8935
|
+
...this.options
|
|
8936
|
+
});
|
|
8937
|
+
}
|
|
8902
8938
|
// eslint-disable-next-line @cspell/spellchecker
|
|
8903
8939
|
// TODO: CAPI-867 - Use Commerce API's equivalent of the /plan endpoint when it becomes available.
|
|
8904
8940
|
async plan(req) {
|