@constructor-io/constructorio-node 4.9.0 → 4.9.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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@constructor-io/constructorio-node",
3
- "version": "4.9.0",
3
+ "version": "4.9.2",
4
4
  "description": "Constructor.io Node.js client",
5
5
  "main": "src/constructorio.js",
6
6
  "types": "src/types/constructorio.d.ts",
@@ -9,8 +9,8 @@
9
9
  "version": "npm run verify-node-version && npm run docs && git add ./docs/*",
10
10
  "check-license": "license-checker --production --onlyAllow 'Apache-2.0;BSD-3-Clause;MIT;0BSD;BSD-2-Clause'",
11
11
  "lint": "eslint 'src/**/*.js' 'spec/**/*.js' 'src/**/*.d.ts'",
12
- "test:parallel": "mkdir -p test && cp -rf src/* test && mocha --parallel ./spec/*",
13
- "test": "mkdir -p test && cp -rf src/* test && mocha ./spec/*",
12
+ "test:parallel": "mkdir -p test && cp -rf src/* test && mocha --retries 3 --parallel ./spec/*",
13
+ "test": "mkdir -p test && cp -rf src/* test && mocha --retries 3 ./spec/*",
14
14
  "test:types": "tsd .",
15
15
  "precoverage": "rm -rf ./coverage && rm -rf ./.nyc_output",
16
16
  "coverage": "nyc --all --reporter=html npm run test:parallel",
@@ -278,6 +278,7 @@ class Tracker {
278
278
  * @param {string} parameters.url - Current page URL
279
279
  * @param {string} [parameters.variationId] - Product item variation unique identifier
280
280
  * @param {object} [parameters.analyticsTags] - Pass additional analytics data
281
+ * @param {string} [parameters.section] - Index section
281
282
  * @param {object} userParameters - Parameters relevant to the user request
282
283
  * @param {number} userParameters.sessionId - Session ID, utilized to personalize results
283
284
  * @param {string} userParameters.clientId - Client ID, utilized to personalize results
@@ -319,6 +320,7 @@ class Tracker {
319
320
  variationId = variation_id,
320
321
  url,
321
322
  analyticsTags,
323
+ section,
322
324
  } = parameters;
323
325
 
324
326
  // Ensure support for both item_name and name as parameters
@@ -343,6 +345,10 @@ class Tracker {
343
345
  bodyParams.analytics_tags = analyticsTags;
344
346
  }
345
347
 
348
+ if (section) {
349
+ bodyParams.section = section;
350
+ }
351
+
346
352
  const requestUrl = `${requestPath}${applyParamsAsString({}, userParameters, this.options)}`;
347
353
  const requestMethod = 'POST';
348
354
  const requestBody = applyParams(bodyParams, userParameters, { ...this.options, requestMethod });
@@ -558,6 +564,7 @@ class Tracker {
558
564
  * @param {object} parameters - Additional parameters to be sent with request
559
565
  * @param {number} parameters.numResults - Total number of results
560
566
  * @param {string[]} parameters.itemIds - List of product item unique identifiers in search results listing
567
+ * @param {string} [parameters.section] - Index section
561
568
  * @param {object} userParameters - Parameters relevant to the user request
562
569
  * @param {number} userParameters.sessionId - Session ID, utilized to personalize results
563
570
  * @param {string} userParameters.clientId - Client ID, utilized to personalize results
@@ -603,6 +610,7 @@ class Tracker {
603
610
  customerIds = customer_ids,
604
611
  item_ids,
605
612
  itemIds = item_ids,
613
+ section,
606
614
  } = parameters;
607
615
  let customerIDs;
608
616
 
@@ -621,6 +629,10 @@ class Tracker {
621
629
  queryParams.customer_ids = customerIDs.slice(0, 100).join(',');
622
630
  }
623
631
 
632
+ if (section) {
633
+ queryParams.section = section;
634
+ }
635
+
624
636
  const requestUrl = `${url}${applyParamsAsString(queryParams, userParameters, this.options)}`;
625
637
 
626
638
  send.call(
@@ -40,6 +40,7 @@ declare class Tracker {
40
40
  url: string;
41
41
  variationId?: string;
42
42
  analyticsTags?: Record<string, string>;
43
+ section?: string;
43
44
  },
44
45
  userParameters?: TrackerUserParameters,
45
46
  networkParameters?: NetworkParameters
@@ -74,6 +75,7 @@ declare class Tracker {
74
75
  parameters: {
75
76
  numResults: number;
76
77
  itemIds: string[];
78
+ section?: string;
77
79
  },
78
80
  userParameters?: TrackerUserParameters,
79
81
  networkParameters?: NetworkParameters
@@ -2,8 +2,7 @@
2
2
  const PII_REGEX = {
3
3
  email: /^[\w\-+\\.]+@([\w-]+\.)+[\w-]{2,4}$/,
4
4
  phoneNumber: /^(?:\+\d{11,12}|\+\d{1,3}\s\d{3}\s\d{3}\s\d{3,4}|\(\d{3}\)\d{7}|\(\d{3}\)\s\d{3}\s\d{4}|\(\d{3}\)\d{3}-\d{4}|\(\d{3}\)\s\d{3}-\d{4})$/,
5
- creditCard:
6
- /^(?:4[0-9]{12}(?:[0-9]{3})?|(?:5[1-5][0-9]{2}|222[1-9]|22[3-9][0-9]|2[3-6][0-9]{2}|27[01][0-9]|2720)[0-9]{12}|3[47][0-9]{13}|3(?:0[0-5]|[68][0-9])[0-9]{11}|6(?:011|5[0-9]{2})[0-9]{12}|(?:2131|1800|35\d{3})\d{11})$/, // Visa, Mastercard, Amex, Discover, JCB and Diners Club, regex source: https://www.regular-expressions.info/creditcard.html
5
+ creditCard: /^(?:4[0-9]{15}|(?:5[1-5][0-9]{2}|222[1-9]|22[3-9][0-9]|2[3-6][0-9]{2}|27[01][0-9]|2720)[0-9]{12}|3[47][0-9]{13}|3(?:0[0-5]|[68][0-9])[0-9]{11}|6(?:011|5[0-9]{2})[0-9]{12}|(?:2131|1800|35\d{3})\d{11})$/, // Visa, Mastercard, Amex, Discover, JCB and Diners Club, regex source: https://www.regular-expressions.info/creditcard.html
7
6
  // Add more PII REGEX
8
7
  };
9
8