@constructor-io/constructorio-node 3.6.1 → 3.7.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,6 +1,6 @@
1
1
  {
2
2
  "name": "@constructor-io/constructorio-node",
3
- "version": "3.6.1",
3
+ "version": "3.7.0",
4
4
  "description": "Constructor.io Node.js client",
5
5
  "main": "src/constructorio.js",
6
6
  "scripts": {
@@ -477,6 +477,7 @@ class Tracker {
477
477
  const url = `${this.options.serviceUrl}/behavior?`;
478
478
  const queryParams = { action: 'search-results', term };
479
479
  const { num_results, customer_ids, item_ids } = parameters;
480
+ let customerIDs;
480
481
 
481
482
  if (!helpers.isNil(num_results)) {
482
483
  queryParams.num_results = num_results;
@@ -484,9 +485,13 @@ class Tracker {
484
485
 
485
486
  // Ensure support for both item_ids and customer_ids as parameters
486
487
  if (item_ids && Array.isArray(item_ids)) {
487
- queryParams.customer_ids = item_ids.join(',');
488
+ customerIDs = item_ids;
488
489
  } else if (customer_ids && Array.isArray(customer_ids)) {
489
- queryParams.customer_ids = customer_ids.join(',');
490
+ customerIDs = customer_ids;
491
+ }
492
+
493
+ if (customerIDs && Array.isArray(customerIDs) && customerIDs.length) {
494
+ queryParams.customer_ids = customerIDs.slice(0, 100).join(',');
490
495
  }
491
496
 
492
497
  const requestUrl = `${url}${applyParamsAsString(queryParams, userParameters, this.options)}`;
@@ -1156,7 +1161,7 @@ class Tracker {
1156
1161
  }
1157
1162
 
1158
1163
  if (items && Array.isArray(items)) {
1159
- bodyParams.items = items;
1164
+ bodyParams.items = items.slice(0, 100);
1160
1165
  }
1161
1166
 
1162
1167
  const requestUrl = `${requestPath}${applyParamsAsString({}, userParameters, this.options)}`;
@@ -58,7 +58,9 @@ const utils = {
58
58
  // Abort network request based on supplied timeout interval (in milliseconds)
59
59
  // - method call parameter takes precedence over global options parameter
60
60
  applyNetworkTimeout: (options = {}, networkParameters = {}, controller = undefined) => {
61
- const timeout = options.networkParameters.timeout || networkParameters.timeout;
61
+ const optionsTimeout = options && options.networkParameters && options.networkParameters.timeout;
62
+ const networkParametersTimeout = networkParameters && networkParameters.timeout;
63
+ const timeout = optionsTimeout || networkParametersTimeout;
62
64
 
63
65
  if (typeof timeout === 'number') {
64
66
  setTimeout(() => controller.abort(), timeout);