rudder-sdk-js 1.3.0 → 1.3.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/index.js +23 -91
- package/package.json +1 -1
package/index.js
CHANGED
@@ -5561,7 +5561,7 @@
|
|
5561
5561
|
PRODUCT_REVIEWED: "Product Reviewed"
|
5562
5562
|
}; // Enumeration for integrations supported
|
5563
5563
|
|
5564
|
-
var CONFIG_URL = "https://api.rudderlabs.com/sourceConfig/?p=npm&v=1.3.
|
5564
|
+
var CONFIG_URL = "https://api.rudderlabs.com/sourceConfig/?p=npm&v=1.3.2";
|
5565
5565
|
var MAX_WAIT_FOR_INTEGRATION_LOAD = 10000;
|
5566
5566
|
var INTEGRATION_LOAD_CHECK_INTERVAL = 1000;
|
5567
5567
|
/* module.exports = {
|
@@ -34462,7 +34462,7 @@
|
|
34462
34462
|
this.build = "1.0.0";
|
34463
34463
|
this.name = "RudderLabs JavaScript SDK";
|
34464
34464
|
this.namespace = "com.rudderlabs.javascript";
|
34465
|
-
this.version = "1.3.
|
34465
|
+
this.version = "1.3.2";
|
34466
34466
|
});
|
34467
34467
|
|
34468
34468
|
// Library information class
|
@@ -34470,7 +34470,7 @@
|
|
34470
34470
|
_classCallCheck(this, RudderLibraryInfo);
|
34471
34471
|
|
34472
34472
|
this.name = "RudderLabs JavaScript SDK";
|
34473
|
-
this.version = "1.3.
|
34473
|
+
this.version = "1.3.2";
|
34474
34474
|
}); // Operating System information class
|
34475
34475
|
|
34476
34476
|
|
@@ -37477,15 +37477,11 @@
|
|
37477
37477
|
try {
|
37478
37478
|
if (!succesfulLoadedIntersectClientSuppliedIntegrations[i].isFailed || !succesfulLoadedIntersectClientSuppliedIntegrations[i].isFailed()) {
|
37479
37479
|
if (succesfulLoadedIntersectClientSuppliedIntegrations[i][methodName]) {
|
37480
|
-
var
|
37480
|
+
var _succesfulLoadedInter;
|
37481
37481
|
|
37482
|
-
|
37483
|
-
var _succesfulLoadedInter;
|
37482
|
+
var clonedBufferEvent = lodash_clonedeep(event);
|
37484
37483
|
|
37485
|
-
|
37486
|
-
|
37487
|
-
(_succesfulLoadedInter = succesfulLoadedIntersectClientSuppliedIntegrations[i])[methodName].apply(_succesfulLoadedInter, _toConsumableArray(clonedBufferEvent));
|
37488
|
-
}
|
37484
|
+
(_succesfulLoadedInter = succesfulLoadedIntersectClientSuppliedIntegrations[i])[methodName].apply(_succesfulLoadedInter, _toConsumableArray(clonedBufferEvent));
|
37489
37485
|
}
|
37490
37486
|
}
|
37491
37487
|
} catch (error) {
|
@@ -37792,64 +37788,6 @@
|
|
37792
37788
|
value: function trackEvent(rudderElement, options, callback) {
|
37793
37789
|
this.processAndSendDataToDestinations("track", rudderElement, options, callback);
|
37794
37790
|
}
|
37795
|
-
}, {
|
37796
|
-
key: "IsEventBlackListed",
|
37797
|
-
value: function IsEventBlackListed(eventName, intgName) {
|
37798
|
-
if (!eventName || !(typeof eventName === "string")) {
|
37799
|
-
return false;
|
37800
|
-
}
|
37801
|
-
|
37802
|
-
var sdkIntgName = commonNames[intgName];
|
37803
|
-
var intg = this.clientIntegrations.find(function (intg) {
|
37804
|
-
return intg.name === sdkIntgName;
|
37805
|
-
});
|
37806
|
-
var _intg$config = intg.config,
|
37807
|
-
blacklistedEvents = _intg$config.blacklistedEvents,
|
37808
|
-
whitelistedEvents = _intg$config.whitelistedEvents,
|
37809
|
-
eventFilteringOption = _intg$config.eventFilteringOption;
|
37810
|
-
|
37811
|
-
if (!eventFilteringOption) {
|
37812
|
-
return false;
|
37813
|
-
}
|
37814
|
-
|
37815
|
-
switch (eventFilteringOption) {
|
37816
|
-
// disabled filtering
|
37817
|
-
case "disable":
|
37818
|
-
return false;
|
37819
|
-
// Blacklist is choosen for filtering events
|
37820
|
-
|
37821
|
-
case "blacklistedEvents":
|
37822
|
-
var isValidBlackList = blacklistedEvents && Array.isArray(blacklistedEvents) && blacklistedEvents.every(function (x) {
|
37823
|
-
return x.eventName !== "";
|
37824
|
-
});
|
37825
|
-
|
37826
|
-
if (isValidBlackList) {
|
37827
|
-
return blacklistedEvents.find(function (eventObj) {
|
37828
|
-
return eventObj.eventName.trim().toUpperCase() === eventName.trim().toUpperCase();
|
37829
|
-
}) === undefined ? false : true;
|
37830
|
-
} else {
|
37831
|
-
return false;
|
37832
|
-
}
|
37833
|
-
|
37834
|
-
// Whitelist is choosen for filtering events
|
37835
|
-
|
37836
|
-
case "whitelistedEvents":
|
37837
|
-
var isValidWhiteList = whitelistedEvents && Array.isArray(whitelistedEvents) && whitelistedEvents.some(function (x) {
|
37838
|
-
return x.eventName !== "";
|
37839
|
-
});
|
37840
|
-
|
37841
|
-
if (isValidWhiteList) {
|
37842
|
-
return whitelistedEvents.find(function (eventObj) {
|
37843
|
-
return eventObj.eventName.trim().toUpperCase() === eventName.trim().toUpperCase();
|
37844
|
-
}) === undefined ? true : false;
|
37845
|
-
} else {
|
37846
|
-
return true;
|
37847
|
-
}
|
37848
|
-
|
37849
|
-
default:
|
37850
|
-
return false;
|
37851
|
-
}
|
37852
|
-
}
|
37853
37791
|
/**
|
37854
37792
|
* Process and send data to destinations along with rudder BE
|
37855
37793
|
*
|
@@ -37862,8 +37800,6 @@
|
|
37862
37800
|
}, {
|
37863
37801
|
key: "processAndSendDataToDestinations",
|
37864
37802
|
value: function processAndSendDataToDestinations(type, rudderElement, options, callback) {
|
37865
|
-
var _this3 = this;
|
37866
|
-
|
37867
37803
|
try {
|
37868
37804
|
if (!this.anonymousId) {
|
37869
37805
|
this.setAnonymousId();
|
@@ -37905,12 +37841,8 @@
|
|
37905
37841
|
succesfulLoadedIntersectClientSuppliedIntegrations.forEach(function (obj) {
|
37906
37842
|
if (!obj.isFailed || !obj.isFailed()) {
|
37907
37843
|
if (obj[type]) {
|
37908
|
-
var
|
37909
|
-
|
37910
|
-
if (sendEvent) {
|
37911
|
-
var clonedRudderElement = lodash_clonedeep(rudderElement);
|
37912
|
-
obj[type](clonedRudderElement);
|
37913
|
-
}
|
37844
|
+
var clonedRudderElement = lodash_clonedeep(rudderElement);
|
37845
|
+
obj[type](clonedRudderElement);
|
37914
37846
|
}
|
37915
37847
|
}
|
37916
37848
|
});
|
@@ -38105,7 +38037,7 @@
|
|
38105
38037
|
}, {
|
38106
38038
|
key: "load",
|
38107
38039
|
value: function load(writeKey, serverUrl, options) {
|
38108
|
-
var
|
38040
|
+
var _this3 = this;
|
38109
38041
|
|
38110
38042
|
logger.debug("inside load ");
|
38111
38043
|
if (options && options.cookieConsentManager) this.cookieConsentOptions = lodash_clonedeep(options.cookieConsentManager);
|
@@ -38163,9 +38095,9 @@
|
|
38163
38095
|
// convert to rudder recognised method names
|
38164
38096
|
var tranformedCallbackMapping = {};
|
38165
38097
|
Object.keys(this.methodToCallbackMapping).forEach(function (methodName) {
|
38166
|
-
if (
|
38167
|
-
if (options.clientSuppliedCallbacks[
|
38168
|
-
tranformedCallbackMapping[methodName] = options.clientSuppliedCallbacks[
|
38098
|
+
if (_this3.methodToCallbackMapping.hasOwnProperty(methodName)) {
|
38099
|
+
if (options.clientSuppliedCallbacks[_this3.methodToCallbackMapping[methodName]]) {
|
38100
|
+
tranformedCallbackMapping[methodName] = options.clientSuppliedCallbacks[_this3.methodToCallbackMapping[methodName]];
|
38169
38101
|
}
|
38170
38102
|
}
|
38171
38103
|
});
|
@@ -38214,7 +38146,7 @@
|
|
38214
38146
|
|
38215
38147
|
if (res instanceof Promise) {
|
38216
38148
|
res.then(function (res) {
|
38217
|
-
return
|
38149
|
+
return _this3.processResponse(200, res);
|
38218
38150
|
}).catch(errorHandler);
|
38219
38151
|
} else {
|
38220
38152
|
this.processResponse(200, res);
|
@@ -38249,25 +38181,25 @@
|
|
38249
38181
|
}, {
|
38250
38182
|
key: "initializeCallbacks",
|
38251
38183
|
value: function initializeCallbacks() {
|
38252
|
-
var
|
38184
|
+
var _this4 = this;
|
38253
38185
|
|
38254
38186
|
Object.keys(this.methodToCallbackMapping).forEach(function (methodName) {
|
38255
|
-
if (
|
38256
|
-
|
38187
|
+
if (_this4.methodToCallbackMapping.hasOwnProperty(methodName)) {
|
38188
|
+
_this4.on(methodName, function () {});
|
38257
38189
|
}
|
38258
38190
|
});
|
38259
38191
|
}
|
38260
38192
|
}, {
|
38261
38193
|
key: "registerCallbacks",
|
38262
38194
|
value: function registerCallbacks(calledFromLoad) {
|
38263
|
-
var
|
38195
|
+
var _this5 = this;
|
38264
38196
|
|
38265
38197
|
if (!calledFromLoad) {
|
38266
38198
|
Object.keys(this.methodToCallbackMapping).forEach(function (methodName) {
|
38267
|
-
if (
|
38199
|
+
if (_this5.methodToCallbackMapping.hasOwnProperty(methodName)) {
|
38268
38200
|
if (window.rudderanalytics) {
|
38269
|
-
if (typeof window.rudderanalytics[
|
38270
|
-
|
38201
|
+
if (typeof window.rudderanalytics[_this5.methodToCallbackMapping[methodName]] === "function") {
|
38202
|
+
_this5.clientSuppliedCallbacks[methodName] = window.rudderanalytics[_this5.methodToCallbackMapping[methodName]];
|
38271
38203
|
}
|
38272
38204
|
} // let callback =
|
38273
38205
|
// ? typeof window.rudderanalytics[
|
@@ -38284,10 +38216,10 @@
|
|
38284
38216
|
}
|
38285
38217
|
|
38286
38218
|
Object.keys(this.clientSuppliedCallbacks).forEach(function (methodName) {
|
38287
|
-
if (
|
38288
|
-
logger.debug("registerCallbacks", methodName,
|
38219
|
+
if (_this5.clientSuppliedCallbacks.hasOwnProperty(methodName)) {
|
38220
|
+
logger.debug("registerCallbacks", methodName, _this5.clientSuppliedCallbacks[methodName]);
|
38289
38221
|
|
38290
|
-
|
38222
|
+
_this5.on(methodName, _this5.clientSuppliedCallbacks[methodName]);
|
38291
38223
|
}
|
38292
38224
|
});
|
38293
38225
|
}
|