@constructor-io/constructorio-node 5.3.1 → 5.4.0

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,12 +1,11 @@
1
1
  {
2
2
  "name": "@constructor-io/constructorio-node",
3
- "version": "5.3.1",
3
+ "version": "5.4.0",
4
4
  "description": "Constructor.io Node.js client",
5
5
  "main": "src/constructorio.js",
6
6
  "types": "src/types/constructorio.d.ts",
7
7
  "scripts": {
8
- "verify-node-version": "chmod +x ./scripts/verify-node-version.sh && ./scripts/verify-node-version.sh",
9
- "version": "npm run verify-node-version && npm run docs && git add ./docs/*",
8
+ "version": "npm run docs && git add ./docs/*",
10
9
  "check-license": "license-checker --production --onlyAllow 'Apache-2.0;BSD-3-Clause;MIT;0BSD;BSD-2-Clause'",
11
10
  "lint": "eslint 'src/**/*.js' 'spec/**/*.js' 'src/**/*.d.ts'",
12
11
  "test:parallel": "mkdir -p test && cp -rf src/* test && mocha --retries 3 --parallel ./spec/*",
@@ -64,5 +63,9 @@
64
63
  },
65
64
  "tsd": {
66
65
  "directory": "src/types/tests"
66
+ },
67
+ "volta": {
68
+ "node": "22.18.0",
69
+ "npm": "10.9.3"
67
70
  }
68
71
  }
@@ -44,7 +44,7 @@ function createQuizUrl(quizId, parameters, userParameters, options, path) {
44
44
  }
45
45
 
46
46
  if (parameters) {
47
- const { section, answers, quizVersionId, quizSessionId, filters, resultsPerPage, page } = parameters;
47
+ const { section, answers, quizVersionId, quizSessionId, filters, resultsPerPage, page, skipTracking } = parameters;
48
48
 
49
49
  // Pull section from parameters
50
50
  if (section) {
@@ -61,6 +61,11 @@ function createQuizUrl(quizId, parameters, userParameters, options, path) {
61
61
  queryParams.quiz_session_id = quizSessionId;
62
62
  }
63
63
 
64
+ // Pull skip_tracking from parameters
65
+ if (skipTracking) {
66
+ queryParams.skip_tracking = skipTracking;
67
+ }
68
+
64
69
  if (!helpers.isNil(page)) {
65
70
  queryParams.page = page;
66
71
  }
@@ -112,6 +117,7 @@ class Quizzes {
112
117
  * @param {string} [parameters.section] - Product catalog section
113
118
  * @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.com/reference/configuration-quizzes}
114
119
  * @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.com/reference/configuration-quizzes}
120
+ * @param {boolean} [parameters.skipTracking] - If true, tracking for this question will be skipped. This is useful for preloading the first question of a quiz
115
121
  * @param {object} [userParameters] - Parameters relevant to the user request
116
122
  * @param {number} [userParameters.sessionId] - Session ID, utilized to personalize results
117
123
  * @param {string} [userParameters.clientId] - Client ID, utilized to personalize results
@@ -164,6 +164,7 @@ export interface ItemData extends Record<string, any> {
164
164
  keywords?: string[];
165
165
  url?: string;
166
166
  image_url?: string;
167
+ /** @deprecated This field is deprecated and will be removed in a future version. */
167
168
  facets?: Record<string, string[] | number[]>;
168
169
  group_ids?: string[];
169
170
  description?: string;
@@ -21,6 +21,10 @@ export interface QuizzesParameters {
21
21
  quizSessionId?: string;
22
22
  }
23
23
 
24
+ export interface NextQuestionQuizzesParameters extends QuizzesParameters {
25
+ skipTracking?: boolean;
26
+ }
27
+
24
28
  export interface QuizzesResultsParameters extends QuizzesParameters {
25
29
  answers: any[];
26
30
  page?: number;
@@ -35,7 +39,7 @@ declare class Quizzes {
35
39
 
36
40
  getQuizNextQuestion(
37
41
  quizId: string,
38
- parameters?: QuizzesParameters,
42
+ parameters?: NextQuestionQuizzesParameters,
39
43
  userParameters?: UserParameters,
40
44
  networkParameters?: NetworkParameters
41
45
  ): Promise<NextQuestionResponse>;