@constructor-io/constructorio-client-javascript 2.50.0 → 2.51.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.
@@ -57,7 +57,8 @@ function createAutocompleteUrl(query, parameters, options) {
57
57
  filters = parameters.filters,
58
58
  filtersPerSection = parameters.filtersPerSection,
59
59
  hiddenFields = parameters.hiddenFields,
60
- variationsMap = parameters.variationsMap;
60
+ variationsMap = parameters.variationsMap,
61
+ preFilterExpression = parameters.preFilterExpression;
61
62
 
62
63
  // Pull results number from parameters
63
64
  if (numResults) {
@@ -83,6 +84,11 @@ function createAutocompleteUrl(query, parameters, options) {
83
84
  });
84
85
  }
85
86
 
87
+ // Pull filter expression from parameters
88
+ if (preFilterExpression) {
89
+ queryParams.pre_filter_expression = JSON.stringify(preFilterExpression);
90
+ }
91
+
86
92
  // Pull hidden fields from parameters
87
93
  if (hiddenFields) {
88
94
  if (queryParams.fmt_options) {
@@ -132,6 +138,7 @@ var Autocomplete = /*#__PURE__*/function () {
132
138
  * @param {object} [parameters.filters] - Key / value mapping (dictionary) of filters used to refine results
133
139
  * @param {object} [parameters.filtersPerSection] - Filters used to refine results per section
134
140
  * @param {object} [parameters.resultsPerSection] - Number of results to return (value) per section (key)
141
+ * @param {object} [parameters.preFilterExpression] - Faceting expression to scope autocomplete results. Please refer to https://docs.constructor.io/rest_api/collections/#add-items-dynamically for details
135
142
  * @param {string[]} [parameters.hiddenFields] - Hidden metadata fields to return
136
143
  * @param {object} [parameters.variationsMap] - The variations map object to aggregate variations. Please refer to https://docs.constructor.io/rest_api/variations_mapping for details
137
144
  * @param {object} [networkParameters] - Parameters relevant to the network request
@@ -5,6 +5,7 @@ import {
5
5
  RequestFeature,
6
6
  RequestFeatureVariant,
7
7
  VariationsMap,
8
+ FilterExpression,
8
9
  } from '.';
9
10
  import EventDispatcher from './event-dispatcher';
10
11
 
@@ -17,6 +18,7 @@ export interface IAutocompleteParameters {
17
18
  resultsPerSection?: Record<string, number>;
18
19
  hiddenFields?: string[];
19
20
  variationsMap?: VariationsMap;
21
+ preFilterExpression?: FilterExpression;
20
22
  }
21
23
 
22
24
  declare class Autocomplete {
@@ -49,4 +51,6 @@ export interface AutocompleteRequestType extends Record<string, any> {
49
51
  features: Partial<RequestFeature>;
50
52
  feature_variants: Partial<RequestFeatureVariant>;
51
53
  searchandized_items: Record<string, any>;
54
+ variations_map?: VariationsMap;
55
+ pre_filter_expression?: FilterExpression;
52
56
  }
@@ -141,4 +141,6 @@ export interface BrowseRequestType extends Record<string, any> {
141
141
  features: Partial<RequestFeature>;
142
142
  feature_variants: Partial<RequestFeatureVariant>;
143
143
  searchandized_items: Record<string, any>;
144
+ variations_map?: VariationsMap;
145
+ pre_filter_expression?: FilterExpression;
144
146
  }
@@ -84,6 +84,8 @@ export interface SearchRequestType extends Record<string, any> {
84
84
  feature_variants: Partial<RequestFeatureVariant>;
85
85
  searchandized_items: Record<string, any>;
86
86
  original_query?: string;
87
+ variations_map?: VariationsMap;
88
+ pre_filter_expression?: FilterExpression;
87
89
  }
88
90
 
89
91
  export interface Result extends Record<string, any> {
package/lib/version.js CHANGED
@@ -4,5 +4,5 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports["default"] = void 0;
7
- var _default = '2.50.0';
7
+ var _default = '2.51.0';
8
8
  exports["default"] = _default;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@constructor-io/constructorio-client-javascript",
3
- "version": "2.50.0",
3
+ "version": "2.51.0",
4
4
  "description": "Constructor.io JavaScript client",
5
5
  "main": "lib/constructorio.js",
6
6
  "types": "lib/types/index.d.ts",