@constructor-io/constructorio-client-javascript 2.35.7 → 2.35.10
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/autocomplete.js +2 -2
- package/lib/modules/browse.js +2 -2
- package/lib/modules/quizzes.js +8 -8
- package/lib/modules/recommendations.js +2 -2
- package/lib/modules/search.js +2 -2
- package/lib/modules/tracker.js +1 -1
- package/lib/types/browse.d.ts +1 -1
- package/lib/types/quizzes.d.ts +2 -2
- package/lib/types/search.d.ts +1 -1
- package/package.json +1 -1
|
@@ -48,11 +48,11 @@ function createAutocompleteUrl(query, parameters, options) {
|
|
|
48
48
|
|
|
49
49
|
if (segments && segments.length) {
|
|
50
50
|
queryParams.us = segments;
|
|
51
|
-
} // Pull user id from options
|
|
51
|
+
} // Pull user id from options and ensure string
|
|
52
52
|
|
|
53
53
|
|
|
54
54
|
if (userId) {
|
|
55
|
-
queryParams.ui = userId;
|
|
55
|
+
queryParams.ui = String(userId);
|
|
56
56
|
}
|
|
57
57
|
|
|
58
58
|
if (parameters) {
|
package/lib/modules/browse.js
CHANGED
|
@@ -42,11 +42,11 @@ function createQueryParams(parameters, options) {
|
|
|
42
42
|
|
|
43
43
|
if (segments && segments.length) {
|
|
44
44
|
queryParams.us = segments;
|
|
45
|
-
} // Pull user id from options
|
|
45
|
+
} // Pull user id from options and ensure string
|
|
46
46
|
|
|
47
47
|
|
|
48
48
|
if (userId) {
|
|
49
|
-
queryParams.ui = userId;
|
|
49
|
+
queryParams.ui = String(userId);
|
|
50
50
|
}
|
|
51
51
|
|
|
52
52
|
if (parameters) {
|
package/lib/modules/quizzes.js
CHANGED
|
@@ -34,11 +34,11 @@ function createQuizUrl(quizId, parameters, options, path) {
|
|
|
34
34
|
|
|
35
35
|
if (segments && segments.length) {
|
|
36
36
|
queryParams.us = segments;
|
|
37
|
-
} // Pull user id from options
|
|
37
|
+
} // Pull user id from options and ensure string
|
|
38
38
|
|
|
39
39
|
|
|
40
40
|
if (userId) {
|
|
41
|
-
queryParams.ui = userId;
|
|
41
|
+
queryParams.ui = String(userId);
|
|
42
42
|
} // Validate quiz id is provided
|
|
43
43
|
|
|
44
44
|
|
|
@@ -122,7 +122,7 @@ var Quizzes = /*#__PURE__*/function () {
|
|
|
122
122
|
*
|
|
123
123
|
* @function getQuizNextQuestion
|
|
124
124
|
* @description Retrieve next question from Constructor.io API
|
|
125
|
-
* @param {string}
|
|
125
|
+
* @param {string} quizId - The identifier of the quiz
|
|
126
126
|
* @param {string} [parameters] - Additional parameters to refine result set
|
|
127
127
|
* @param {string} [parameters.section] - Product catalog section
|
|
128
128
|
* @param {array} [parameters.answers] - An array of answers in the format [[1,2],[1]]
|
|
@@ -144,7 +144,7 @@ var Quizzes = /*#__PURE__*/function () {
|
|
|
144
144
|
|
|
145
145
|
(0, _createClass2["default"])(Quizzes, [{
|
|
146
146
|
key: "getQuizNextQuestion",
|
|
147
|
-
value: function getQuizNextQuestion(
|
|
147
|
+
value: function getQuizNextQuestion(quizId, parameters) {
|
|
148
148
|
var _this = this;
|
|
149
149
|
|
|
150
150
|
var networkParameters = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
@@ -154,7 +154,7 @@ var Quizzes = /*#__PURE__*/function () {
|
|
|
154
154
|
var signal = controller.signal;
|
|
155
155
|
|
|
156
156
|
try {
|
|
157
|
-
requestUrl = createQuizUrl(
|
|
157
|
+
requestUrl = createQuizUrl(quizId, parameters, this.options, 'next');
|
|
158
158
|
} catch (e) {
|
|
159
159
|
return Promise.reject(e);
|
|
160
160
|
} // Handle network timeout if specified
|
|
@@ -184,7 +184,7 @@ var Quizzes = /*#__PURE__*/function () {
|
|
|
184
184
|
*
|
|
185
185
|
* @function getQuizResults
|
|
186
186
|
* @description Retrieve quiz recommendation and filter expression from Constructor.io API
|
|
187
|
-
* @param {string}
|
|
187
|
+
* @param {string} quizId - The identifier of the quiz
|
|
188
188
|
* @param {string} parameters - Additional parameters to refine result set
|
|
189
189
|
* @param {array} parameters.answers - An array of answers in the format [[1,2],[1]]
|
|
190
190
|
* @param {string} [parameters.section] - Product catalog section
|
|
@@ -208,7 +208,7 @@ var Quizzes = /*#__PURE__*/function () {
|
|
|
208
208
|
|
|
209
209
|
}, {
|
|
210
210
|
key: "getQuizResults",
|
|
211
|
-
value: function getQuizResults(
|
|
211
|
+
value: function getQuizResults(quizId, parameters) {
|
|
212
212
|
var _this2 = this;
|
|
213
213
|
|
|
214
214
|
var networkParameters = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
@@ -218,7 +218,7 @@ var Quizzes = /*#__PURE__*/function () {
|
|
|
218
218
|
var signal = controller.signal;
|
|
219
219
|
|
|
220
220
|
try {
|
|
221
|
-
requestUrl = createQuizUrl(
|
|
221
|
+
requestUrl = createQuizUrl(quizId, parameters, this.options, 'results');
|
|
222
222
|
} catch (e) {
|
|
223
223
|
return Promise.reject(e);
|
|
224
224
|
} // Handle network timeout if specified
|
|
@@ -34,11 +34,11 @@ function createRecommendationsUrl(podId, parameters, options) {
|
|
|
34
34
|
|
|
35
35
|
if (segments && segments.length) {
|
|
36
36
|
queryParams.us = segments;
|
|
37
|
-
} // Pull user id from options
|
|
37
|
+
} // Pull user id from options and ensure string
|
|
38
38
|
|
|
39
39
|
|
|
40
40
|
if (userId) {
|
|
41
|
-
queryParams.ui = userId;
|
|
41
|
+
queryParams.ui = String(userId);
|
|
42
42
|
}
|
|
43
43
|
|
|
44
44
|
if (parameters) {
|
package/lib/modules/search.js
CHANGED
|
@@ -47,11 +47,11 @@ function createSearchUrl(query, parameters, options) {
|
|
|
47
47
|
|
|
48
48
|
if (segments && segments.length) {
|
|
49
49
|
queryParams.us = segments;
|
|
50
|
-
} // Pull user id from options
|
|
50
|
+
} // Pull user id from options and ensure string
|
|
51
51
|
|
|
52
52
|
|
|
53
53
|
if (userId) {
|
|
54
|
-
queryParams.ui = userId;
|
|
54
|
+
queryParams.ui = String(userId);
|
|
55
55
|
}
|
|
56
56
|
|
|
57
57
|
if (parameters) {
|
package/lib/modules/tracker.js
CHANGED
package/lib/types/browse.d.ts
CHANGED
|
@@ -25,7 +25,7 @@ export interface IBrowseParameters {
|
|
|
25
25
|
sortOrder?: string;
|
|
26
26
|
section?: string;
|
|
27
27
|
fmtOptions?: FmtOptions;
|
|
28
|
-
preFilterExpression
|
|
28
|
+
preFilterExpression?: FilterExpression;
|
|
29
29
|
hiddenFields?: string[];
|
|
30
30
|
hiddenFacets?: string[];
|
|
31
31
|
variationsMap?: Record<string, any>;
|
package/lib/types/quizzes.d.ts
CHANGED
|
@@ -34,13 +34,13 @@ declare class Quizzes {
|
|
|
34
34
|
options: ConstructorClientOptions;
|
|
35
35
|
|
|
36
36
|
getQuizNextQuestion(
|
|
37
|
-
|
|
37
|
+
quizId: string,
|
|
38
38
|
parameters?: QuizzesParameters,
|
|
39
39
|
networkParameters?: NetworkParameters
|
|
40
40
|
): Promise<NextQuestionResponse>;
|
|
41
41
|
|
|
42
42
|
getQuizResults(
|
|
43
|
-
|
|
43
|
+
quizId: string,
|
|
44
44
|
parameters?: QuizzesResultsParameters,
|
|
45
45
|
networkParameters?: NetworkParameters
|
|
46
46
|
): Promise<QuizResultsResponse>;
|
package/lib/types/search.d.ts
CHANGED
|
@@ -24,7 +24,7 @@ export interface SearchParameters {
|
|
|
24
24
|
sortOrder?: string;
|
|
25
25
|
section?: string;
|
|
26
26
|
fmtOptions?: FmtOptions;
|
|
27
|
-
preFilterExpression
|
|
27
|
+
preFilterExpression?: FilterExpression;
|
|
28
28
|
hiddenFields?: string[];
|
|
29
29
|
hiddenFacets?: string[];
|
|
30
30
|
variationsMap?: Record<string, any>;
|
package/package.json
CHANGED