@constructor-io/constructorio-client-javascript 2.51.0 → 2.53.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/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2019 Constructor.io
3
+ Copyright (c) 2019 Constructor.io Corporation
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
@@ -5,7 +5,6 @@ var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/cl
5
5
  var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
6
6
  /* eslint-disable camelcase, no-unneeded-ternary, max-len, complexity */
7
7
  var ConstructorioID = require('@constructor-io/constructorio-id');
8
- var fetchPonyfill = require('fetch-ponyfill');
9
8
 
10
9
  // Modules
11
10
  var Search = require('./modules/search');
@@ -80,7 +79,7 @@ var ConstructorIO = /*#__PURE__*/function () {
80
79
  clientId = options.clientId,
81
80
  sessionId = options.sessionId,
82
81
  userId = options.userId,
83
- fetch = options.fetch,
82
+ fetchFromOptions = options.fetch,
84
83
  trackingSendDelay = options.trackingSendDelay,
85
84
  sendReferrerWithTrackingEvents = options.sendReferrerWithTrackingEvents,
86
85
  sendTrackingEvents = options.sendTrackingEvents,
@@ -123,9 +122,7 @@ var ConstructorIO = /*#__PURE__*/function () {
123
122
  userId: userId,
124
123
  segments: segments,
125
124
  testCells: testCells,
126
- fetch: fetch || fetchPonyfill({
127
- Promise: Promise
128
- }).fetch,
125
+ fetch: fetchFromOptions || fetch,
129
126
  trackingSendDelay: trackingSendDelay,
130
127
  sendTrackingEvents: sendTrackingEvents,
131
128
  sendReferrerWithTrackingEvents: sendReferrerWithTrackingEvents,
@@ -155,6 +152,7 @@ var ConstructorIO = /*#__PURE__*/function () {
155
152
  * @param {string} [options.apiKey] - Constructor.io API key
156
153
  * @param {array} [options.segments] - User segments
157
154
  * @param {object} [options.testCells] - User test cells
155
+ * @param {number} [options.sessionId] - Session ID - Will only be set in DOM-less environments
158
156
  * @param {string} [options.userId] - User ID
159
157
  */
160
158
  (0, _createClass2["default"])(ConstructorIO, [{
@@ -164,7 +162,9 @@ var ConstructorIO = /*#__PURE__*/function () {
164
162
  var apiKey = options.apiKey,
165
163
  segments = options.segments,
166
164
  testCells = options.testCells,
167
- userId = options.userId;
165
+ sessionId = options.sessionId,
166
+ _options$userId = options.userId,
167
+ userId = _options$userId === void 0 ? '' : _options$userId;
168
168
  if (apiKey) {
169
169
  this.options.apiKey = apiKey;
170
170
  }
@@ -174,9 +174,12 @@ var ConstructorIO = /*#__PURE__*/function () {
174
174
  if (testCells) {
175
175
  this.options.testCells = testCells;
176
176
  }
177
- if (userId) {
178
- this.options.userId = userId;
177
+
178
+ // Set Session ID in dom-less environments only
179
+ if (sessionId && !helpers.canUseDOM()) {
180
+ this.options.sessionId = sessionId;
179
181
  }
182
+ this.options.userId = userId;
180
183
  }
181
184
  }
182
185
  }]);
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.51.0';
7
+ var _default = '2.53.0';
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.51.0",
3
+ "version": "2.53.0",
4
4
  "description": "Constructor.io JavaScript client",
5
5
  "main": "lib/constructorio.js",
6
6
  "types": "lib/types/index.d.ts",
@@ -32,7 +32,7 @@
32
32
  "type": "git",
33
33
  "url": "git+https://github.com/Constructor-io/constructorio-client-javascript.git"
34
34
  },
35
- "author": "constructor.io",
35
+ "author": "Constructor.io Corporation",
36
36
  "license": "MIT",
37
37
  "bugs": {
38
38
  "url": "https://github.com/Constructor-io/constructorio-client-javascript/issues"
@@ -74,8 +74,7 @@
74
74
  },
75
75
  "dependencies": {
76
76
  "@constructor-io/constructorio-id": "^2.4.17",
77
- "crc-32": "^1.2.2",
78
- "fetch-ponyfill": "^7.1.0"
77
+ "crc-32": "^1.2.2"
79
78
  },
80
79
  "peerDependencies": {
81
80
  "@babel/runtime": "^7.19.0"