rudder-sdk-js 1.3.2 → 1.3.3
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 +118 -39
- package/package.json +1 -1
package/index.js
CHANGED
@@ -5345,17 +5345,20 @@
|
|
5345
5345
|
Comscore: "COMSCORE",
|
5346
5346
|
COMSCORE: "COMSCORE",
|
5347
5347
|
Customerio: "CUSTOMERIO",
|
5348
|
+
CUSTOMERIO: "CUSTOMERIO",
|
5348
5349
|
"Customer.io": "CUSTOMERIO",
|
5349
5350
|
"FB Pixel": "FACEBOOK_PIXEL",
|
5350
5351
|
"Facebook Pixel": "FACEBOOK_PIXEL",
|
5351
5352
|
FB_PIXEL: "FACEBOOK_PIXEL",
|
5352
|
-
|
5353
|
+
FACEBOOK_PIXEL: "FACEBOOK_PIXEL",
|
5354
|
+
"Google Tag Manager": "GTM",
|
5353
5355
|
GTM: "GTM",
|
5354
5356
|
Hotjar: "HOTJAR",
|
5355
5357
|
hotjar: "HOTJAR",
|
5356
5358
|
HOTJAR: "HOTJAR",
|
5357
5359
|
Hubspot: "HS",
|
5358
5360
|
HUBSPOT: "HS",
|
5361
|
+
HS: "HS",
|
5359
5362
|
Intercom: "INTERCOM",
|
5360
5363
|
INTERCOM: "INTERCOM",
|
5361
5364
|
Keen: "KEEN",
|
@@ -5374,17 +5377,19 @@
|
|
5374
5377
|
FullStory: "FULLSTORY",
|
5375
5378
|
BUGSNAG: "BUGSNAG",
|
5376
5379
|
TVSQUARED: "TVSQUARED",
|
5380
|
+
TVSquared: "TVSQUARED",
|
5377
5381
|
"Google Analytics 4": "GA4",
|
5378
5382
|
GoogleAnalytics4: "GA4",
|
5379
5383
|
GA4: "GA4",
|
5380
|
-
|
5384
|
+
MoEngage: "MOENGAGE",
|
5385
|
+
MOENGAGE: "MOENGAGE",
|
5381
5386
|
AM: "AM",
|
5382
5387
|
AMPLITUDE: "AM",
|
5383
5388
|
Amplitude: "AM",
|
5384
5389
|
Pendo: "PENDO",
|
5385
5390
|
PENDO: "PENDO",
|
5386
|
-
Lytics: "
|
5387
|
-
LYTICS: "
|
5391
|
+
Lytics: "LYTICS",
|
5392
|
+
LYTICS: "LYTICS",
|
5388
5393
|
Appcues: "APPCUES",
|
5389
5394
|
APPCUES: "APPCUES",
|
5390
5395
|
POSTHOG: "POSTHOG",
|
@@ -5395,6 +5400,7 @@
|
|
5395
5400
|
CLEVERTAP: "CLEVERTAP",
|
5396
5401
|
Clevertap: "CLEVERTAP",
|
5397
5402
|
BingAds: "BINGADS",
|
5403
|
+
BINGADS: "BINGADS",
|
5398
5404
|
PinterestTag: "PINTEREST_TAG",
|
5399
5405
|
Pinterest_Tag: "PINTEREST_TAG",
|
5400
5406
|
PINTERESTTAG: "PINTEREST_TAG",
|
@@ -5416,6 +5422,7 @@
|
|
5416
5422
|
Linkedininsighttag: "LINKEDIN_INSIGHT_TAG",
|
5417
5423
|
LINKEDININSIGHTTAG: "LINKEDIN_INSIGHT_TAG",
|
5418
5424
|
Reddit_Pixel: "REDDIT_PIXEL",
|
5425
|
+
REDDIT_PIXEL: "REDDIT_PIXEL",
|
5419
5426
|
RedditPixel: "REDDIT_PIXEL",
|
5420
5427
|
REDDITPIXEL: "REDDIT_PIXEL",
|
5421
5428
|
redditpixel: "REDDIT_PIXEL",
|
@@ -5424,6 +5431,7 @@
|
|
5424
5431
|
"reddit pixel": "REDDIT_PIXEL",
|
5425
5432
|
Drip: "DRIP",
|
5426
5433
|
drip: "DRIP",
|
5434
|
+
DRIP: "DRIP",
|
5427
5435
|
Heap: "HEAP",
|
5428
5436
|
heap: "HEAP",
|
5429
5437
|
"Heap.io": "HEAP",
|
@@ -5433,6 +5441,7 @@
|
|
5433
5441
|
CRITEO: "CRITEO",
|
5434
5442
|
MIXPANEL: "MP",
|
5435
5443
|
Mixpanel: "MP",
|
5444
|
+
MP: "MP",
|
5436
5445
|
Qualtrics: "QUALTRICS",
|
5437
5446
|
qualtrics: "QUALTRICS",
|
5438
5447
|
QUALTRICS: "QUALTRICS",
|
@@ -5440,6 +5449,7 @@
|
|
5440
5449
|
SnapPixel: "SNAP_PIXEL",
|
5441
5450
|
SNAPPIXEL: "SNAP_PIXEL",
|
5442
5451
|
snappixel: "SNAP_PIXEL",
|
5452
|
+
SNAP_PIXEL: "SNAP_PIXEL",
|
5443
5453
|
"Snap Pixel": "SNAP_PIXEL",
|
5444
5454
|
"SNAP PIXEL": "SNAP_PIXEL",
|
5445
5455
|
"snap pixel": "SNAP_PIXEL",
|
@@ -5454,6 +5464,7 @@
|
|
5454
5464
|
quantumMetric: "QUANTUMMETRIC",
|
5455
5465
|
quantummetric: "QUANTUMMETRIC",
|
5456
5466
|
Quantum_Metric: "QUANTUMMETRIC",
|
5467
|
+
QUANTUMMETRIC: "QUANTUMMETRIC",
|
5457
5468
|
"Google Optimize": "GOOGLE_OPTIMIZE",
|
5458
5469
|
GOOGLE_OPTIMIZE: "GOOGLE_OPTIMIZE",
|
5459
5470
|
GoogleOptimize: "GOOGLE_OPTIMIZE",
|
@@ -5561,7 +5572,7 @@
|
|
5561
5572
|
PRODUCT_REVIEWED: "Product Reviewed"
|
5562
5573
|
}; // Enumeration for integrations supported
|
5563
5574
|
|
5564
|
-
var CONFIG_URL = "https://api.rudderlabs.com/sourceConfig/?p=npm&v=1.3.
|
5575
|
+
var CONFIG_URL = "https://api.rudderlabs.com/sourceConfig/?p=npm&v=1.3.3";
|
5565
5576
|
var MAX_WAIT_FOR_INTEGRATION_LOAD = 10000;
|
5566
5577
|
var INTEGRATION_LOAD_CHECK_INTERVAL = 1000;
|
5567
5578
|
/* module.exports = {
|
@@ -25505,7 +25516,7 @@
|
|
25505
25516
|
function Criteo(config) {
|
25506
25517
|
_classCallCheck(this, Criteo);
|
25507
25518
|
|
25508
|
-
this.name = "
|
25519
|
+
this.name = "CRITEO";
|
25509
25520
|
this.hashMethod = config.hashMethod;
|
25510
25521
|
this.accountId = config.accountId;
|
25511
25522
|
this.url = config.homePageUrl; // eslint-disable-next-line no-nested-ternary
|
@@ -26930,7 +26941,7 @@
|
|
26930
26941
|
this.legacyConversionPixelId = config.legacyConversionPixelId;
|
26931
26942
|
this.userIdAsPixelId = config.userIdAsPixelId;
|
26932
26943
|
this.whitelistPiiProperties = config.whitelistPiiProperties;
|
26933
|
-
this.name = "
|
26944
|
+
this.name = "FACEBOOK_PIXEL";
|
26934
26945
|
}
|
26935
26946
|
|
26936
26947
|
_createClass(FacebookPixel, [{
|
@@ -29372,7 +29383,7 @@
|
|
29372
29383
|
_classCallCheck(this, GoogleTagManager);
|
29373
29384
|
|
29374
29385
|
this.containerID = config.containerID;
|
29375
|
-
this.name = "
|
29386
|
+
this.name = "GTM";
|
29376
29387
|
this.serverUrl = config.serverUrl;
|
29377
29388
|
}
|
29378
29389
|
|
@@ -29788,7 +29799,7 @@
|
|
29788
29799
|
function INTERCOM(config) {
|
29789
29800
|
_classCallCheck(this, INTERCOM);
|
29790
29801
|
|
29791
|
-
this.
|
29802
|
+
this.name = "INTERCOM";
|
29792
29803
|
this.API_KEY = config.apiKey;
|
29793
29804
|
this.APP_ID = config.appId;
|
29794
29805
|
this.MOBILE_APP_ID = config.mobileAppId;
|
@@ -31421,7 +31432,7 @@
|
|
31421
31432
|
function Mixpanel(config) {
|
31422
31433
|
_classCallCheck(this, Mixpanel);
|
31423
31434
|
|
31424
|
-
this.name = "
|
31435
|
+
this.name = "MP";
|
31425
31436
|
this.accountId = config.accountId;
|
31426
31437
|
this.token = config.token;
|
31427
31438
|
this.people = config.people || false;
|
@@ -31846,7 +31857,7 @@
|
|
31846
31857
|
this.apiId = config.apiId;
|
31847
31858
|
this.debug = config.debug;
|
31848
31859
|
this.region = config.region;
|
31849
|
-
this.name = "
|
31860
|
+
this.name = "MOENGAGE";
|
31850
31861
|
this.analyticsinstance = analyticsinstance;
|
31851
31862
|
}
|
31852
31863
|
|
@@ -32945,7 +32956,7 @@
|
|
32945
32956
|
|
32946
32957
|
this.publicApiKey = config.publicApiKey;
|
32947
32958
|
this.siteType = config.siteType;
|
32948
|
-
this.name = "
|
32959
|
+
this.name = "PROFITWELL";
|
32949
32960
|
}
|
32950
32961
|
|
32951
32962
|
_createClass(ProfitWell, [{
|
@@ -33028,7 +33039,7 @@
|
|
33028
33039
|
function Qualtrics(config) {
|
33029
33040
|
_classCallCheck(this, Qualtrics);
|
33030
33041
|
|
33031
|
-
this.name = "
|
33042
|
+
this.name = "QUALTRICS";
|
33032
33043
|
this.projectId = config.projectId;
|
33033
33044
|
this.brandId = config.brandId;
|
33034
33045
|
this.enableGenericPageTitle = config.enableGenericPageTitle;
|
@@ -33070,7 +33081,7 @@
|
|
33070
33081
|
this.set = function (a, c) {
|
33071
33082
|
var b = "",
|
33072
33083
|
b = new Date();
|
33073
|
-
b.setTime(b.getTime() +
|
33084
|
+
b.setTime(b.getTime() + 6048e5);
|
33074
33085
|
b = "; expires=" + b.toGMTString();
|
33075
33086
|
document.cookie = a + "=" + c + b + "; path=/; ";
|
33076
33087
|
};
|
@@ -33377,7 +33388,7 @@
|
|
33377
33388
|
function Sentry(config) {
|
33378
33389
|
_classCallCheck(this, Sentry);
|
33379
33390
|
|
33380
|
-
this.name = "
|
33391
|
+
this.name = "SENTRY";
|
33381
33392
|
this.dsn = config.dsn;
|
33382
33393
|
this.debugMode = config.debugMode;
|
33383
33394
|
this.environment = config.environment;
|
@@ -33839,7 +33850,7 @@
|
|
33839
33850
|
this.clientId = config.clientId;
|
33840
33851
|
this.eventWhiteList = config.eventWhiteList || [];
|
33841
33852
|
this.customMetrics = config.customMetrics || [];
|
33842
|
-
this.name = "
|
33853
|
+
this.name = "TVSQUARED";
|
33843
33854
|
}
|
33844
33855
|
|
33845
33856
|
_createClass(TVSquared, [{
|
@@ -34337,7 +34348,7 @@
|
|
34337
34348
|
function LaunchDarkly(config) {
|
34338
34349
|
_classCallCheck(this, LaunchDarkly);
|
34339
34350
|
|
34340
|
-
this.name = "
|
34351
|
+
this.name = "LAUNCHDARKLY";
|
34341
34352
|
this.clientSideId = config.clientSideId;
|
34342
34353
|
}
|
34343
34354
|
|
@@ -34462,7 +34473,7 @@
|
|
34462
34473
|
this.build = "1.0.0";
|
34463
34474
|
this.name = "RudderLabs JavaScript SDK";
|
34464
34475
|
this.namespace = "com.rudderlabs.javascript";
|
34465
|
-
this.version = "1.3.
|
34476
|
+
this.version = "1.3.3";
|
34466
34477
|
});
|
34467
34478
|
|
34468
34479
|
// Library information class
|
@@ -34470,7 +34481,7 @@
|
|
34470
34481
|
_classCallCheck(this, RudderLibraryInfo);
|
34471
34482
|
|
34472
34483
|
this.name = "RudderLabs JavaScript SDK";
|
34473
|
-
this.version = "1.3.
|
34484
|
+
this.version = "1.3.3";
|
34474
34485
|
}); // Operating System information class
|
34475
34486
|
|
34476
34487
|
|
@@ -37477,11 +37488,15 @@
|
|
37477
37488
|
try {
|
37478
37489
|
if (!succesfulLoadedIntersectClientSuppliedIntegrations[i].isFailed || !succesfulLoadedIntersectClientSuppliedIntegrations[i].isFailed()) {
|
37479
37490
|
if (succesfulLoadedIntersectClientSuppliedIntegrations[i][methodName]) {
|
37480
|
-
var
|
37491
|
+
var sendEvent = !object.IsEventBlackListed(event[0].message.event, succesfulLoadedIntersectClientSuppliedIntegrations[i].name); // Block the event if it is blacklisted for the device-mode destination
|
37492
|
+
|
37493
|
+
if (sendEvent) {
|
37494
|
+
var _succesfulLoadedInter;
|
37481
37495
|
|
37482
|
-
|
37496
|
+
var clonedBufferEvent = lodash_clonedeep(event);
|
37483
37497
|
|
37484
|
-
|
37498
|
+
(_succesfulLoadedInter = succesfulLoadedIntersectClientSuppliedIntegrations[i])[methodName].apply(_succesfulLoadedInter, _toConsumableArray(clonedBufferEvent));
|
37499
|
+
}
|
37485
37500
|
}
|
37486
37501
|
}
|
37487
37502
|
} catch (error) {
|
@@ -37788,6 +37803,64 @@
|
|
37788
37803
|
value: function trackEvent(rudderElement, options, callback) {
|
37789
37804
|
this.processAndSendDataToDestinations("track", rudderElement, options, callback);
|
37790
37805
|
}
|
37806
|
+
}, {
|
37807
|
+
key: "IsEventBlackListed",
|
37808
|
+
value: function IsEventBlackListed(eventName, intgName) {
|
37809
|
+
if (!eventName || !(typeof eventName === "string")) {
|
37810
|
+
return false;
|
37811
|
+
}
|
37812
|
+
|
37813
|
+
var sdkIntgName = commonNames[intgName];
|
37814
|
+
var intg = this.clientIntegrations.find(function (intg) {
|
37815
|
+
return intg.name === sdkIntgName;
|
37816
|
+
});
|
37817
|
+
var _intg$config = intg.config,
|
37818
|
+
blacklistedEvents = _intg$config.blacklistedEvents,
|
37819
|
+
whitelistedEvents = _intg$config.whitelistedEvents,
|
37820
|
+
eventFilteringOption = _intg$config.eventFilteringOption;
|
37821
|
+
|
37822
|
+
if (!eventFilteringOption) {
|
37823
|
+
return false;
|
37824
|
+
}
|
37825
|
+
|
37826
|
+
switch (eventFilteringOption) {
|
37827
|
+
// disabled filtering
|
37828
|
+
case "disable":
|
37829
|
+
return false;
|
37830
|
+
// Blacklist is choosen for filtering events
|
37831
|
+
|
37832
|
+
case "blacklistedEvents":
|
37833
|
+
var isValidBlackList = blacklistedEvents && Array.isArray(blacklistedEvents) && blacklistedEvents.every(function (x) {
|
37834
|
+
return x.eventName !== "";
|
37835
|
+
});
|
37836
|
+
|
37837
|
+
if (isValidBlackList) {
|
37838
|
+
return blacklistedEvents.find(function (eventObj) {
|
37839
|
+
return eventObj.eventName.trim().toUpperCase() === eventName.trim().toUpperCase();
|
37840
|
+
}) === undefined ? false : true;
|
37841
|
+
} else {
|
37842
|
+
return false;
|
37843
|
+
}
|
37844
|
+
|
37845
|
+
// Whitelist is choosen for filtering events
|
37846
|
+
|
37847
|
+
case "whitelistedEvents":
|
37848
|
+
var isValidWhiteList = whitelistedEvents && Array.isArray(whitelistedEvents) && whitelistedEvents.some(function (x) {
|
37849
|
+
return x.eventName !== "";
|
37850
|
+
});
|
37851
|
+
|
37852
|
+
if (isValidWhiteList) {
|
37853
|
+
return whitelistedEvents.find(function (eventObj) {
|
37854
|
+
return eventObj.eventName.trim().toUpperCase() === eventName.trim().toUpperCase();
|
37855
|
+
}) === undefined ? true : false;
|
37856
|
+
} else {
|
37857
|
+
return true;
|
37858
|
+
}
|
37859
|
+
|
37860
|
+
default:
|
37861
|
+
return false;
|
37862
|
+
}
|
37863
|
+
}
|
37791
37864
|
/**
|
37792
37865
|
* Process and send data to destinations along with rudder BE
|
37793
37866
|
*
|
@@ -37800,6 +37873,8 @@
|
|
37800
37873
|
}, {
|
37801
37874
|
key: "processAndSendDataToDestinations",
|
37802
37875
|
value: function processAndSendDataToDestinations(type, rudderElement, options, callback) {
|
37876
|
+
var _this3 = this;
|
37877
|
+
|
37803
37878
|
try {
|
37804
37879
|
if (!this.anonymousId) {
|
37805
37880
|
this.setAnonymousId();
|
@@ -37841,8 +37916,12 @@
|
|
37841
37916
|
succesfulLoadedIntersectClientSuppliedIntegrations.forEach(function (obj) {
|
37842
37917
|
if (!obj.isFailed || !obj.isFailed()) {
|
37843
37918
|
if (obj[type]) {
|
37844
|
-
var
|
37845
|
-
|
37919
|
+
var sendEvent = !_this3.IsEventBlackListed(rudderElement.message.event, obj.name); // Block the event if it is blacklisted for the device-mode destination
|
37920
|
+
|
37921
|
+
if (sendEvent) {
|
37922
|
+
var clonedRudderElement = lodash_clonedeep(rudderElement);
|
37923
|
+
obj[type](clonedRudderElement);
|
37924
|
+
}
|
37846
37925
|
}
|
37847
37926
|
}
|
37848
37927
|
});
|
@@ -38037,7 +38116,7 @@
|
|
38037
38116
|
}, {
|
38038
38117
|
key: "load",
|
38039
38118
|
value: function load(writeKey, serverUrl, options) {
|
38040
|
-
var
|
38119
|
+
var _this4 = this;
|
38041
38120
|
|
38042
38121
|
logger.debug("inside load ");
|
38043
38122
|
if (options && options.cookieConsentManager) this.cookieConsentOptions = lodash_clonedeep(options.cookieConsentManager);
|
@@ -38095,9 +38174,9 @@
|
|
38095
38174
|
// convert to rudder recognised method names
|
38096
38175
|
var tranformedCallbackMapping = {};
|
38097
38176
|
Object.keys(this.methodToCallbackMapping).forEach(function (methodName) {
|
38098
|
-
if (
|
38099
|
-
if (options.clientSuppliedCallbacks[
|
38100
|
-
tranformedCallbackMapping[methodName] = options.clientSuppliedCallbacks[
|
38177
|
+
if (_this4.methodToCallbackMapping.hasOwnProperty(methodName)) {
|
38178
|
+
if (options.clientSuppliedCallbacks[_this4.methodToCallbackMapping[methodName]]) {
|
38179
|
+
tranformedCallbackMapping[methodName] = options.clientSuppliedCallbacks[_this4.methodToCallbackMapping[methodName]];
|
38101
38180
|
}
|
38102
38181
|
}
|
38103
38182
|
});
|
@@ -38146,7 +38225,7 @@
|
|
38146
38225
|
|
38147
38226
|
if (res instanceof Promise) {
|
38148
38227
|
res.then(function (res) {
|
38149
|
-
return
|
38228
|
+
return _this4.processResponse(200, res);
|
38150
38229
|
}).catch(errorHandler);
|
38151
38230
|
} else {
|
38152
38231
|
this.processResponse(200, res);
|
@@ -38181,25 +38260,25 @@
|
|
38181
38260
|
}, {
|
38182
38261
|
key: "initializeCallbacks",
|
38183
38262
|
value: function initializeCallbacks() {
|
38184
|
-
var
|
38263
|
+
var _this5 = this;
|
38185
38264
|
|
38186
38265
|
Object.keys(this.methodToCallbackMapping).forEach(function (methodName) {
|
38187
|
-
if (
|
38188
|
-
|
38266
|
+
if (_this5.methodToCallbackMapping.hasOwnProperty(methodName)) {
|
38267
|
+
_this5.on(methodName, function () {});
|
38189
38268
|
}
|
38190
38269
|
});
|
38191
38270
|
}
|
38192
38271
|
}, {
|
38193
38272
|
key: "registerCallbacks",
|
38194
38273
|
value: function registerCallbacks(calledFromLoad) {
|
38195
|
-
var
|
38274
|
+
var _this6 = this;
|
38196
38275
|
|
38197
38276
|
if (!calledFromLoad) {
|
38198
38277
|
Object.keys(this.methodToCallbackMapping).forEach(function (methodName) {
|
38199
|
-
if (
|
38278
|
+
if (_this6.methodToCallbackMapping.hasOwnProperty(methodName)) {
|
38200
38279
|
if (window.rudderanalytics) {
|
38201
|
-
if (typeof window.rudderanalytics[
|
38202
|
-
|
38280
|
+
if (typeof window.rudderanalytics[_this6.methodToCallbackMapping[methodName]] === "function") {
|
38281
|
+
_this6.clientSuppliedCallbacks[methodName] = window.rudderanalytics[_this6.methodToCallbackMapping[methodName]];
|
38203
38282
|
}
|
38204
38283
|
} // let callback =
|
38205
38284
|
// ? typeof window.rudderanalytics[
|
@@ -38216,10 +38295,10 @@
|
|
38216
38295
|
}
|
38217
38296
|
|
38218
38297
|
Object.keys(this.clientSuppliedCallbacks).forEach(function (methodName) {
|
38219
|
-
if (
|
38220
|
-
logger.debug("registerCallbacks", methodName,
|
38298
|
+
if (_this6.clientSuppliedCallbacks.hasOwnProperty(methodName)) {
|
38299
|
+
logger.debug("registerCallbacks", methodName, _this6.clientSuppliedCallbacks[methodName]);
|
38221
38300
|
|
38222
|
-
|
38301
|
+
_this6.on(methodName, _this6.clientSuppliedCallbacks[methodName]);
|
38223
38302
|
}
|
38224
38303
|
});
|
38225
38304
|
}
|