@constructor-io/constructorio-client-javascript 2.39.0 → 2.40.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.
@@ -55,6 +55,7 @@ function createAutocompleteUrl(query, parameters, options) {
55
55
  var numResults = parameters.numResults,
56
56
  resultsPerSection = parameters.resultsPerSection,
57
57
  filters = parameters.filters,
58
+ filtersPerSection = parameters.filtersPerSection,
58
59
  hiddenFields = parameters.hiddenFields,
59
60
  variationsMap = parameters.variationsMap;
60
61
 
@@ -75,6 +76,13 @@ function createAutocompleteUrl(query, parameters, options) {
75
76
  queryParams.filters = filters;
76
77
  }
77
78
 
79
+ // Pull filtersPerSection from parameters
80
+ if (filtersPerSection) {
81
+ Object.keys(filtersPerSection).forEach(function (section) {
82
+ queryParams["filters[".concat(section, "]")] = filtersPerSection[section];
83
+ });
84
+ }
85
+
78
86
  // Pull hidden fields from parameters
79
87
  if (hiddenFields) {
80
88
  if (queryParams.fmt_options) {
@@ -122,6 +130,7 @@ var Autocomplete = /*#__PURE__*/function () {
122
130
  * @param {object} [parameters] - Additional parameters to refine result set
123
131
  * @param {number} [parameters.numResults] - The total number of results to return
124
132
  * @param {object} [parameters.filters] - Key / value mapping (dictionary) of filters used to refine results
133
+ * @param {object} [parameters.filtersPerSection] - Filters used to refine results per section
125
134
  * @param {object} [parameters.resultsPerSection] - Number of results to return (value) per section (key)
126
135
  * @param {string[]} [parameters.hiddenFields] - Hidden metadata fields to return
127
136
  * @param {object} [parameters.variationsMap] - The variations map object to aggregate variations. Please refer to https://docs.constructor.io/rest_api/variations_mapping for details
@@ -13,6 +13,7 @@ export default Autocomplete;
13
13
  export interface IAutocompleteParameters {
14
14
  numResults?: number;
15
15
  filters?: Record<string, any>;
16
+ filtersPerSection?: Record<string, Record<string, any>>;
16
17
  resultsPerSection?: Record<string, number>;
17
18
  hiddenFields?: string[];
18
19
  variationsMap?: VariationsMap;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@constructor-io/constructorio-client-javascript",
3
- "version": "2.39.0",
3
+ "version": "2.40.0",
4
4
  "description": "Constructor.io JavaScript client",
5
5
  "main": "lib/constructorio.js",
6
6
  "types": "lib/types/index.d.ts",
@@ -71,7 +71,7 @@
71
71
  "tsd": "^0.24.1"
72
72
  },
73
73
  "dependencies": {
74
- "@constructor-io/constructorio-id": "^2.4.10",
74
+ "@constructor-io/constructorio-id": "^2.4.17",
75
75
  "crc-32": "^1.2.2",
76
76
  "fetch-ponyfill": "^7.1.0",
77
77
  "store2": "^2.14.2"