@constructor-io/constructorio-client-javascript 2.51.2 → 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/lib/constructorio.js +9 -5
- package/lib/version.js +1 -1
- package/package.json +2 -3
package/lib/constructorio.js
CHANGED
|
@@ -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
|
-
|
|
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:
|
|
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,6 +162,7 @@ var ConstructorIO = /*#__PURE__*/function () {
|
|
|
164
162
|
var apiKey = options.apiKey,
|
|
165
163
|
segments = options.segments,
|
|
166
164
|
testCells = options.testCells,
|
|
165
|
+
sessionId = options.sessionId,
|
|
167
166
|
_options$userId = options.userId,
|
|
168
167
|
userId = _options$userId === void 0 ? '' : _options$userId;
|
|
169
168
|
if (apiKey) {
|
|
@@ -175,6 +174,11 @@ var ConstructorIO = /*#__PURE__*/function () {
|
|
|
175
174
|
if (testCells) {
|
|
176
175
|
this.options.testCells = testCells;
|
|
177
176
|
}
|
|
177
|
+
|
|
178
|
+
// Set Session ID in dom-less environments only
|
|
179
|
+
if (sessionId && !helpers.canUseDOM()) {
|
|
180
|
+
this.options.sessionId = sessionId;
|
|
181
|
+
}
|
|
178
182
|
this.options.userId = userId;
|
|
179
183
|
}
|
|
180
184
|
}
|
package/lib/version.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@constructor-io/constructorio-client-javascript",
|
|
3
|
-
"version": "2.
|
|
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",
|
|
@@ -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"
|