@constructor-io/constructorio-node 4.16.0 → 4.16.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/package.json +1 -1
- package/src/modules/quizzes.js +16 -1
- package/src/modules/tracker.js +3 -2
package/package.json
CHANGED
package/src/modules/quizzes.js
CHANGED
|
@@ -43,7 +43,7 @@ function createQuizUrl(quizId, parameters, userParameters, options, path) {
|
|
|
43
43
|
}
|
|
44
44
|
|
|
45
45
|
if (parameters) {
|
|
46
|
-
const { section, answers, quizVersionId, quizSessionId } = parameters;
|
|
46
|
+
const { section, answers, quizVersionId, quizSessionId, filters, resultsPerPage, page } = parameters;
|
|
47
47
|
|
|
48
48
|
// Pull section from parameters
|
|
49
49
|
if (section) {
|
|
@@ -60,6 +60,18 @@ function createQuizUrl(quizId, parameters, userParameters, options, path) {
|
|
|
60
60
|
queryParams.quiz_session_id = quizSessionId;
|
|
61
61
|
}
|
|
62
62
|
|
|
63
|
+
if (!helpers.isNil(page)) {
|
|
64
|
+
queryParams.page = page;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
if (!helpers.isNil(resultsPerPage)) {
|
|
68
|
+
queryParams.num_results_per_page = resultsPerPage;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
if (filters) {
|
|
72
|
+
queryParams.filters = filters;
|
|
73
|
+
}
|
|
74
|
+
|
|
63
75
|
// Pull answers from parameters and transform
|
|
64
76
|
if (answers) {
|
|
65
77
|
answers.forEach((ans) => {
|
|
@@ -177,6 +189,9 @@ class Quizzes {
|
|
|
177
189
|
* @param {string} [parameters.section] - Product catalog section
|
|
178
190
|
* @param {string} [parameters.quizVersionId] - Version identifier for the quiz. Version ID will be returned with the first request and it should be passed with subsequent requests. More information can be found [here]{@link https://docs.constructor.io/rest_api/quiz/using_quizzes/#quiz-versioning}
|
|
179
191
|
* @param {string} [parameters.quizSessionId] - Session identifier for the quiz. Session ID will be returned with the first request and it should be passed with subsequent requests. More information can be found [here]{@link https://docs.constructor.io/rest_api/quiz/using_quizzes/#quiz-sessions}
|
|
192
|
+
* @param {number} [parameters.page] - The page number of the results
|
|
193
|
+
* @param {number} [parameters.resultsPerPage] - The number of results per page to return
|
|
194
|
+
* @param {object} [parameters.filters] - Key / value mapping (dictionary) of filters used to refine results
|
|
180
195
|
* @param {object} [userParameters] - Parameters relevant to the user request
|
|
181
196
|
* @param {number} [userParameters.sessionId] - Session ID, utilized to personalize results
|
|
182
197
|
* @param {string} [userParameters.clientId] - Client ID, utilized to personalize results
|
package/src/modules/tracker.js
CHANGED
|
@@ -376,7 +376,7 @@ class Tracker {
|
|
|
376
376
|
* Send autocomplete select event to API
|
|
377
377
|
*
|
|
378
378
|
* @function trackAutocompleteSelect
|
|
379
|
-
* @param {string} term - Term of selected autocomplete item
|
|
379
|
+
* @param {string} term - Term of selected autocomplete item (Search Suggestion or Product name)
|
|
380
380
|
* @param {object} parameters - Additional parameters to be sent with request
|
|
381
381
|
* @param {string} parameters.originalQuery - The current autocomplete search query
|
|
382
382
|
* @param {string} parameters.section - Section the selected item resides within
|
|
@@ -398,7 +398,8 @@ class Tracker {
|
|
|
398
398
|
* @param {object} [networkParameters] - Parameters relevant to the network request
|
|
399
399
|
* @param {number} [networkParameters.timeout] - Request timeout (in milliseconds)
|
|
400
400
|
* @returns {(true|Error)}
|
|
401
|
-
* @description User selected (clicked, or navigated to via keyboard) a result that appeared
|
|
401
|
+
* @description User selected (clicked, or navigated to via keyboard) a result that appeared
|
|
402
|
+
* within autocomplete (Search Suggestions, Products, or a custom section eg. Brands, Categories)
|
|
402
403
|
* @example
|
|
403
404
|
* constructorio.tracker.trackAutocompleteSelect(
|
|
404
405
|
* 'T-Shirt',
|