@constructor-io/constructorio-node 4.16.1 → 4.16.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@constructor-io/constructorio-node",
3
- "version": "4.16.1",
3
+ "version": "4.16.3",
4
4
  "description": "Constructor.io Node.js client",
5
5
  "main": "src/constructorio.js",
6
6
  "types": "src/types/constructorio.d.ts",
@@ -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
@@ -1,3 +1,4 @@
1
+ /* eslint-disable max-len */
1
2
  /* eslint-disable camelcase, no-underscore-dangle, no-unneeded-ternary, brace-style */
2
3
  const qs = require('qs');
3
4
  const { AbortController } = require('node-abort-controller');
@@ -381,8 +382,8 @@ class Tracker {
381
382
  * @param {string} parameters.originalQuery - The current autocomplete search query
382
383
  * @param {string} parameters.section - Section the selected item resides within
383
384
  * @param {string} [parameters.tr] - Trigger used to select the item (click, etc.)
384
- * @param {string} [parameters.groupId] - Group identifier of selected item
385
- * @param {string} [parameters.displayName] - Display name of group of selected item
385
+ * @param {string} [parameters.groupId] - Group identifier of the group to search within. Only required if searching within a group, i.e. "Pumpkin in Canned Goods"
386
+ * @param {string} [parameters.displayName] - Display name of the group to search within. Only required if searching within a group, i.e. "Pumpkin in Canned Goods"
386
387
  * @param {object} userParameters - Parameters relevant to the user request
387
388
  * @param {number} userParameters.sessionId - Session ID, utilized to personalize results
388
389
  * @param {string} userParameters.clientId - Client ID, utilized to personalize results
@@ -483,8 +484,8 @@ class Tracker {
483
484
  * @param {string} term - Term of submitted autocomplete event
484
485
  * @param {object} parameters - Additional parameters to be sent with request
485
486
  * @param {string} parameters.originalQuery - The current autocomplete search query
486
- * @param {string} [parameters.groupId] - Group identifier of selected item
487
- * @param {string} [parameters.displayName] - Display name of group of selected item
487
+ * @param {string} [parameters.groupId] - Group identifier of the group to search within. Only required if searching within a group, i.e. "Pumpkin in Canned Goods"
488
+ * @param {string} [parameters.displayName] - Display name of the group to search within. Only required if searching within a group, i.e. "Pumpkin in Canned Goods"
488
489
  * @param {object} userParameters - Parameters relevant to the user request
489
490
  * @param {number} userParameters.sessionId - Session ID, utilized to personalize results
490
491
  * @param {string} userParameters.clientId - Client ID, utilized to personalize results