@constructor-io/constructorio-node 4.7.5 → 4.8.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@constructor-io/constructorio-node",
3
- "version": "4.7.5",
3
+ "version": "4.8.0",
4
4
  "description": "Constructor.io Node.js client",
5
5
  "main": "src/constructorio.js",
6
6
  "types": "src/types/constructorio.d.ts",
@@ -38,7 +38,7 @@ function createRecommendationsUrl(podId, parameters, userParameters, options) {
38
38
  }
39
39
 
40
40
  if (parameters) {
41
- const { numResults, itemIds, section, term, filters, variationsMap } = parameters;
41
+ const { numResults, itemIds, section, term, filters, variationsMap, hiddenFields } = parameters;
42
42
 
43
43
  // Pull num results number from parameters
44
44
  if (!helpers.isNil(numResults)) {
@@ -65,6 +65,15 @@ function createRecommendationsUrl(podId, parameters, userParameters, options) {
65
65
  queryParams.filters = filters;
66
66
  }
67
67
 
68
+ // Pull hidden fields from parameters
69
+ if (hiddenFields) {
70
+ if (queryParams.fmt_options) {
71
+ queryParams.fmt_options.hidden_fields = hiddenFields;
72
+ } else {
73
+ queryParams.fmt_options = { hidden_fields: hiddenFields };
74
+ }
75
+ }
76
+
68
77
  // Pull variations map from parameters
69
78
  if (variationsMap) {
70
79
  queryParams.variations_map = JSON.stringify(variationsMap);
@@ -102,6 +111,7 @@ class Recommendations {
102
111
  * @param {string} [parameters.term] - The term to use to refine results (strategy specific)
103
112
  * @param {object} [parameters.filters] - Key / value mapping of filters used to refine results
104
113
  * @param {object} [parameters.variationsMap] - The variations map object to aggregate variations. Please refer to https://docs.constructor.io/rest_api/variations_mapping for details
114
+ * @param {string[]} [parameters.hiddenFields] - Hidden metadata fields to return
105
115
  * @param {object} [userParameters] - Parameters relevant to the user request
106
116
  * @param {number} [userParameters.sessionId] - Session ID, utilized to personalize results
107
117
  * @param {string} [userParameters.clientId] - Client ID, utilized to personalize results
@@ -9,6 +9,7 @@ export interface RecommendationsParameters {
9
9
  term?: string;
10
10
  filters?: Record<string, any>;
11
11
  variationsMap?: VariationsMap;
12
+ hiddenFields?: string[];
12
13
  }
13
14
 
14
15
  declare class Recommendations {