@constructor-io/constructorio-client-javascript 2.27.2 → 2.27.3
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/lib/modules/browse.js +25 -2
- package/lib/modules/search.js +23 -2
- package/package.json +1 -1
package/lib/modules/browse.js
CHANGED
|
@@ -12,6 +12,8 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
|
|
|
12
12
|
|
|
13
13
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
14
14
|
|
|
15
|
+
/* eslint-disable max-len */
|
|
16
|
+
|
|
15
17
|
/* eslint-disable object-curly-newline, no-underscore-dangle */
|
|
16
18
|
var qs = require('qs');
|
|
17
19
|
|
|
@@ -63,7 +65,8 @@ function createQueryParams(parameters, options) {
|
|
|
63
65
|
sortOrder = parameters.sortOrder,
|
|
64
66
|
section = parameters.section,
|
|
65
67
|
fmtOptions = parameters.fmtOptions,
|
|
66
|
-
hiddenFields = parameters.hiddenFields
|
|
68
|
+
hiddenFields = parameters.hiddenFields,
|
|
69
|
+
hiddenFacets = parameters.hiddenFacets; // Pull page from parameters
|
|
67
70
|
|
|
68
71
|
if (!helpers.isNil(page)) {
|
|
69
72
|
queryParams.page = page;
|
|
@@ -100,7 +103,24 @@ function createQueryParams(parameters, options) {
|
|
|
100
103
|
|
|
101
104
|
|
|
102
105
|
if (hiddenFields) {
|
|
103
|
-
queryParams.
|
|
106
|
+
if (queryParams.fmt_options) {
|
|
107
|
+
queryParams.fmt_options.hidden_fields = hiddenFields;
|
|
108
|
+
} else {
|
|
109
|
+
queryParams.fmt_options = {
|
|
110
|
+
hidden_fields: hiddenFields
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
} // Pull hidden facets from parameters
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
if (hiddenFacets) {
|
|
117
|
+
if (queryParams.fmt_options) {
|
|
118
|
+
queryParams.fmt_options.hidden_facets = hiddenFacets;
|
|
119
|
+
} else {
|
|
120
|
+
queryParams.fmt_options = {
|
|
121
|
+
hidden_facets: hiddenFacets
|
|
122
|
+
};
|
|
123
|
+
}
|
|
104
124
|
}
|
|
105
125
|
}
|
|
106
126
|
|
|
@@ -192,6 +212,7 @@ var Browse = /*#__PURE__*/function () {
|
|
|
192
212
|
* @param {string} [parameters.sortOrder='descending'] - The sort order for results
|
|
193
213
|
* @param {object} [parameters.fmtOptions] - The format options used to refine result groups
|
|
194
214
|
* @param {string[]} [parameters.hiddenFields] - Hidden metadata fields to return
|
|
215
|
+
* @param {string[]} [parameters.hiddenFacets] - Hidden facets to return
|
|
195
216
|
* @param {object} [networkParameters] - Parameters relevant to the network request
|
|
196
217
|
* @param {number} [networkParameters.timeout] - Request timeout (in milliseconds)
|
|
197
218
|
* @returns {Promise}
|
|
@@ -269,6 +290,8 @@ var Browse = /*#__PURE__*/function () {
|
|
|
269
290
|
* @param {string} [parameters.sortBy='relevance'] - The sort method for results
|
|
270
291
|
* @param {string} [parameters.sortOrder='descending'] - The sort order for results
|
|
271
292
|
* @param {object} [parameters.fmtOptions] - The format options used to refine result groups
|
|
293
|
+
* @param {string[]} [parameters.hiddenFields] - Hidden metadata fields to return
|
|
294
|
+
* @param {string[]} [parameters.hiddenFacets] - Hidden facets to return
|
|
272
295
|
* @param {object} [networkParameters] - Parameters relevant to the network request
|
|
273
296
|
* @param {number} [networkParameters.timeout] - Request timeout (in milliseconds)
|
|
274
297
|
* @returns {Promise}
|
package/lib/modules/search.js
CHANGED
|
@@ -6,6 +6,8 @@ var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/cl
|
|
|
6
6
|
|
|
7
7
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
8
8
|
|
|
9
|
+
/* eslint-disable max-len */
|
|
10
|
+
|
|
9
11
|
/* eslint-disable object-curly-newline, no-underscore-dangle */
|
|
10
12
|
var qs = require('qs');
|
|
11
13
|
|
|
@@ -63,7 +65,8 @@ function createSearchUrl(query, parameters, options) {
|
|
|
63
65
|
sortOrder = parameters.sortOrder,
|
|
64
66
|
section = parameters.section,
|
|
65
67
|
fmtOptions = parameters.fmtOptions,
|
|
66
|
-
hiddenFields = parameters.hiddenFields
|
|
68
|
+
hiddenFields = parameters.hiddenFields,
|
|
69
|
+
hiddenFacets = parameters.hiddenFacets; // Pull page from parameters
|
|
67
70
|
|
|
68
71
|
if (!helpers.isNil(page)) {
|
|
69
72
|
queryParams.page = page;
|
|
@@ -101,7 +104,24 @@ function createSearchUrl(query, parameters, options) {
|
|
|
101
104
|
|
|
102
105
|
|
|
103
106
|
if (hiddenFields) {
|
|
104
|
-
queryParams.
|
|
107
|
+
if (queryParams.fmt_options) {
|
|
108
|
+
queryParams.fmt_options.hidden_fields = hiddenFields;
|
|
109
|
+
} else {
|
|
110
|
+
queryParams.fmt_options = {
|
|
111
|
+
hidden_fields: hiddenFields
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
} // Pull hidden facets from parameters
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
if (hiddenFacets) {
|
|
118
|
+
if (queryParams.fmt_options) {
|
|
119
|
+
queryParams.fmt_options.hidden_facets = hiddenFacets;
|
|
120
|
+
} else {
|
|
121
|
+
queryParams.fmt_options = {
|
|
122
|
+
hidden_facets: hiddenFacets
|
|
123
|
+
};
|
|
124
|
+
}
|
|
105
125
|
}
|
|
106
126
|
}
|
|
107
127
|
|
|
@@ -142,6 +162,7 @@ var Search = /*#__PURE__*/function () {
|
|
|
142
162
|
* @param {string} [parameters.section='Products'] - The section name for results
|
|
143
163
|
* @param {object} [parameters.fmtOptions] - The format options used to refine result groups
|
|
144
164
|
* @param {string[]} [parameters.hiddenFields] - Hidden metadata fields to return
|
|
165
|
+
* @param {string[]} [parameters.hiddenFacets] - Hidden facets to return
|
|
145
166
|
* @param {object} [networkParameters] - Parameters relevant to the network request
|
|
146
167
|
* @param {number} [networkParameters.timeout] - Request timeout (in milliseconds)
|
|
147
168
|
* @returns {Promise}
|