@constructor-io/constructorio-client-javascript 2.63.0 → 2.64.1

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.
@@ -4,8 +4,8 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
4
4
  var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
5
5
  var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
6
6
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
7
- function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
8
- function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2["default"])(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
7
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
8
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
9
9
  /* eslint-disable object-curly-newline, no-underscore-dangle, max-len, complexity */
10
10
  var EventDispatcher = require('../utils/event-dispatcher');
11
11
  var helpers = require('../utils/helpers');
@@ -5,8 +5,8 @@ var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
5
5
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
6
6
  var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
7
7
  var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
8
- function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
9
- function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2["default"])(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
8
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
9
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
10
10
  /* eslint-disable complexity */
11
11
  /* eslint-disable max-len */
12
12
  /* eslint-disable object-curly-newline, no-underscore-dangle, camelcase, no-unneeded-ternary */
@@ -280,6 +280,8 @@ var Tracker = /*#__PURE__*/function () {
280
280
  * @param {string} [parameters.itemId] - Item id of the selected item
281
281
  * @param {string} [parameters.variationId] - Variation id of the selected item
282
282
  * @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"
283
+ * @param {string} [parameters.slCampaignId] - Pass campaign id of sponsored listing
284
+ * @param {string} [parameters.slCampaignOwner] - Pass campaign owner of sponsored listing
283
285
  * @param {object} [networkParameters] - Parameters relevant to the network request
284
286
  * @param {number} [networkParameters.timeout] - Request timeout (in milliseconds)
285
287
  * @returns {(true|Error)}
@@ -294,6 +296,8 @@ var Tracker = /*#__PURE__*/function () {
294
296
  * groupId: '88JU230',
295
297
  * itemId: '12345',
296
298
  * variationId: '12345-A',
299
+ * slCampaignId: 'Campaign 123',
300
+ * slCampaignOwner: 'Store 123',
297
301
  * },
298
302
  * );
299
303
  */
@@ -324,7 +328,9 @@ var Tracker = /*#__PURE__*/function () {
324
328
  itemId = _parameters$itemId2 === void 0 ? item_id : _parameters$itemId2,
325
329
  variation_id = parameters.variation_id,
326
330
  _parameters$variation2 = parameters.variationId,
327
- variationId = _parameters$variation2 === void 0 ? variation_id : _parameters$variation2;
331
+ variationId = _parameters$variation2 === void 0 ? variation_id : _parameters$variation2,
332
+ slCampaignId = parameters.slCampaignId,
333
+ slCampaignOwner = parameters.slCampaignOwner;
328
334
  var queryParams = {};
329
335
  var bodyParams = {
330
336
  user_input: userInput,
@@ -338,6 +344,12 @@ var Tracker = /*#__PURE__*/function () {
338
344
  if (section) {
339
345
  queryParams.section = section;
340
346
  }
347
+ if (slCampaignId) {
348
+ bodyParams.sl_campaign_id = slCampaignId;
349
+ }
350
+ if (slCampaignOwner) {
351
+ bodyParams.sl_campaign_owner = slCampaignOwner;
352
+ }
341
353
  var requestURL = "".concat(baseUrl).concat(applyParamsAsString(queryParams, this.options));
342
354
  var requestMethod = 'POST';
343
355
  var requestBody = applyParams(bodyParams, _objectSpread(_objectSpread({}, this.options), {}, {
@@ -366,6 +378,8 @@ var Tracker = /*#__PURE__*/function () {
366
378
  * @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"
367
379
  * @param {string} [parameters.displayName] - Display name of group of selected item
368
380
  * @param {string} [parameters.itemId] - Item id of the selected item
381
+ * @param {string} [parameters.slCampaignId] - Pass campaign id of sponsored listing
382
+ * @param {string} [parameters.slCampaignOwner] - Pass campaign owner of sponsored listing
369
383
  * @param {object} [networkParameters] - Parameters relevant to the network request
370
384
  * @param {number} [networkParameters.timeout] - Request timeout (in milliseconds)
371
385
  * @returns {(true|Error)}
@@ -380,6 +394,8 @@ var Tracker = /*#__PURE__*/function () {
380
394
  * groupId: '88JU230',
381
395
  * displayName: 'apparel',
382
396
  * itemId: '12345',
397
+ * slCampaignId: 'Campaign 123',
398
+ * slCampaignOwner: 'Store 123',
383
399
  * },
384
400
  * );
385
401
  */
@@ -409,7 +425,9 @@ var Tracker = /*#__PURE__*/function () {
409
425
  displayName = _parameters$displayNa === void 0 ? display_name : _parameters$displayNa,
410
426
  item_id = parameters.item_id,
411
427
  _parameters$itemId3 = parameters.itemId,
412
- itemId = _parameters$itemId3 === void 0 ? item_id : _parameters$itemId3;
428
+ itemId = _parameters$itemId3 === void 0 ? item_id : _parameters$itemId3,
429
+ slCampaignOwner = parameters.slCampaignOwner,
430
+ slCampaignId = parameters.slCampaignId;
413
431
  if (originalQuery) {
414
432
  queryParams.original_query = originalQuery;
415
433
  }
@@ -428,6 +446,12 @@ var Tracker = /*#__PURE__*/function () {
428
446
  if (itemId) {
429
447
  queryParams.item_id = itemId;
430
448
  }
449
+ if (slCampaignId) {
450
+ queryParams.sl_campaign_id = slCampaignId;
451
+ }
452
+ if (slCampaignOwner) {
453
+ queryParams.sl_campaign_owner = slCampaignOwner;
454
+ }
431
455
  this.requests.queue("".concat(url).concat(applyParamsAsString(queryParams, this.options)), undefined, undefined, networkParameters);
432
456
  this.requests.send();
433
457
  return true;
@@ -719,8 +743,8 @@ var Tracker = /*#__PURE__*/function () {
719
743
  * @param {object} [parameters.selectedFilters] - Key - Value map of selected filters
720
744
  * @param {string} [parameters.section] - The section name for the item Ex. "Products"
721
745
  * @param {object} [parameters.analyticsTags] - Pass additional analytics data
722
- * @param {object} [parameters.slCampaignId] - Pass campaign id of sponsored listing
723
- * @param {object} [parameters.slCampaignOwner] - Pass campaign owner of sponsored listing
746
+ * @param {string} [parameters.slCampaignId] - Pass campaign id of sponsored listing
747
+ * @param {string} [parameters.slCampaignOwner] - Pass campaign owner of sponsored listing
724
748
  * @param {object} [networkParameters] - Parameters relevant to the network request
725
749
  * @param {number} [networkParameters.timeout] - Request timeout (in milliseconds)
726
750
  * @returns {(true|Error)}
@@ -829,8 +853,8 @@ var Tracker = /*#__PURE__*/function () {
829
853
  * @param {string} [parameters.itemIsConvertible] - Whether or not an item is available for a conversion
830
854
  * @param {string} [parameters.section] - The section name for the item Ex. "Products"
831
855
  * @param {object} [parameters.analyticsTags] - Pass additional analytics data
832
- * @param {object} [parameters.slCampaignId] - Pass campaign id of sponsored listing
833
- * @param {object} [parameters.slCampaignOwner] - Pass campaign owner of sponsored listing
856
+ * @param {string} [parameters.slCampaignId] - Pass campaign id of sponsored listing
857
+ * @param {string} [parameters.slCampaignOwner] - Pass campaign owner of sponsored listing
834
858
  * @param {object} [networkParameters] - Parameters relevant to the network request
835
859
  * @param {number} [networkParameters.timeout] - Request timeout (in milliseconds)
836
860
  * @returns {(true|Error)}
@@ -1496,8 +1520,8 @@ var Tracker = /*#__PURE__*/function () {
1496
1520
  * @param {number} [parameters.numResultsPerPage] - Number of results shown
1497
1521
  * @param {object} [parameters.selectedFilters] - Selected filters
1498
1522
  * @param {object} [parameters.analyticsTags] - Pass additional analytics data
1499
- * @param {object} [parameters.slCampaignId] - Pass campaign id of sponsored listing
1500
- * @param {object} [parameters.slCampaignOwner] - Pass campaign owner of sponsored listing
1523
+ * @param {string} [parameters.slCampaignId] - Pass campaign id of sponsored listing
1524
+ * @param {string} [parameters.slCampaignOwner] - Pass campaign owner of sponsored listing
1501
1525
  * @param {object} [networkParameters] - Parameters relevant to the network request
1502
1526
  * @param {number} [networkParameters.timeout] - Request timeout (in milliseconds)
1503
1527
  * @returns {(true|Error)}
@@ -37,6 +37,11 @@ export interface IdOptions extends Record<string, any> {
37
37
  session_id_storage_location?: string;
38
38
  }
39
39
 
40
+ export interface EventDispatcherOptions {
41
+ enabled?: boolean;
42
+ waitForBeacon?: boolean;
43
+ }
44
+
40
45
  export interface ConstructorClientOptions {
41
46
  apiKey: string;
42
47
  version?: string;
@@ -53,7 +58,7 @@ export interface ConstructorClientOptions {
53
58
  trackingSendDelay?: number;
54
59
  sendTrackingEvents?: boolean;
55
60
  sendReferrerWithTrackingEvents?: boolean;
56
- eventDispatcher?: EventDispatcher;
61
+ eventDispatcher?: EventDispatcherOptions;
57
62
  beaconMode?: boolean;
58
63
  networkParameters?: NetworkParameters;
59
64
  }
@@ -45,6 +45,8 @@ declare class Tracker {
45
45
  groupId?: string;
46
46
  displayName?: string;
47
47
  itemId?: string;
48
+ slCampaignId?: string;
49
+ slCampaignOwner?: string;
48
50
  },
49
51
  networkParameters?: NetworkParameters
50
52
  ): true | Error;
package/lib/version.js CHANGED
@@ -4,5 +4,5 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports["default"] = void 0;
7
- var _default = '2.63.0';
7
+ var _default = '2.64.1';
8
8
  exports["default"] = _default;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@constructor-io/constructorio-client-javascript",
3
- "version": "2.63.0",
3
+ "version": "2.64.1",
4
4
  "description": "Constructor.io JavaScript client",
5
5
  "main": "lib/constructorio.js",
6
6
  "types": "lib/types/index.d.ts",