@constructor-io/constructorio-client-javascript 2.50.0 → 2.51.2

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/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2019 Constructor.io
3
+ Copyright (c) 2019 Constructor.io Corporation
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
@@ -164,7 +164,8 @@ var ConstructorIO = /*#__PURE__*/function () {
164
164
  var apiKey = options.apiKey,
165
165
  segments = options.segments,
166
166
  testCells = options.testCells,
167
- userId = options.userId;
167
+ _options$userId = options.userId,
168
+ userId = _options$userId === void 0 ? '' : _options$userId;
168
169
  if (apiKey) {
169
170
  this.options.apiKey = apiKey;
170
171
  }
@@ -174,9 +175,7 @@ var ConstructorIO = /*#__PURE__*/function () {
174
175
  if (testCells) {
175
176
  this.options.testCells = testCells;
176
177
  }
177
- if (userId) {
178
- this.options.userId = userId;
179
- }
178
+ this.options.userId = userId;
180
179
  }
181
180
  }
182
181
  }]);
@@ -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.2';
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.2",
4
4
  "description": "Constructor.io JavaScript client",
5
5
  "main": "lib/constructorio.js",
6
6
  "types": "lib/types/index.d.ts",
@@ -32,7 +32,7 @@
32
32
  "type": "git",
33
33
  "url": "git+https://github.com/Constructor-io/constructorio-client-javascript.git"
34
34
  },
35
- "author": "constructor.io",
35
+ "author": "Constructor.io Corporation",
36
36
  "license": "MIT",
37
37
  "bugs": {
38
38
  "url": "https://github.com/Constructor-io/constructorio-client-javascript/issues"