rudder-sdk-js 2.9.2 → 2.9.5
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 +34 -30
- package/package.json +1 -1
package/index.js
CHANGED
@@ -4939,7 +4939,7 @@
|
|
4939
4939
|
|
4940
4940
|
// Reserved Keywords for properties/traits
|
4941
4941
|
var RESERVED_KEYS = ['anonymous_id', 'id', 'sent_at', 'received_at', 'timestamp', 'original_timestamp', 'event_text', 'event'];
|
4942
|
-
var CONFIG_URL = 'https://api.rudderlabs.com/sourceConfig/?p=npm&v=2.9.
|
4942
|
+
var CONFIG_URL = 'https://api.rudderlabs.com/sourceConfig/?p=npm&v=2.9.5';
|
4943
4943
|
var CDN_INT_DIR = 'js-integrations';
|
4944
4944
|
var DEST_SDK_BASE_URL = "https://cdn.rudderlabs.com/v1.1/".concat(CDN_INT_DIR);
|
4945
4945
|
var MAX_WAIT_FOR_INTEGRATION_LOAD = 10000;
|
@@ -10565,28 +10565,28 @@
|
|
10565
10565
|
return CONFIG_URL.concat(CONFIG_URL.includes("?") ? "&" : "?").concat(writeKey ? "writeKey=".concat(writeKey) : "");
|
10566
10566
|
};
|
10567
10567
|
|
10568
|
-
var
|
10568
|
+
var getSDKUrlInfo = function getSDKUrlInfo() {
|
10569
10569
|
var scripts = document.getElementsByTagName("script");
|
10570
|
-
var
|
10571
|
-
var
|
10570
|
+
var sdkURL;
|
10571
|
+
var isStaging = false;
|
10572
10572
|
|
10573
10573
|
for (var i = 0; i < scripts.length; i += 1) {
|
10574
|
-
var curScriptSrc = removeTrailingSlashes(scripts[i].getAttribute("src"));
|
10574
|
+
var curScriptSrc = removeTrailingSlashes(scripts[i].getAttribute("src"));
|
10575
10575
|
|
10576
|
-
if (curScriptSrc
|
10577
|
-
|
10576
|
+
if (curScriptSrc) {
|
10577
|
+
var urlMatches = curScriptSrc.match(/^(https?:)?\/\/.*rudder-analytics(-staging)?(\.min)?\.js$/);
|
10578
10578
|
|
10579
|
-
if (
|
10580
|
-
|
10579
|
+
if (urlMatches) {
|
10580
|
+
sdkURL = curScriptSrc;
|
10581
|
+
isStaging = urlMatches[2] !== undefined;
|
10582
|
+
break;
|
10581
10583
|
}
|
10582
|
-
|
10583
|
-
break;
|
10584
10584
|
}
|
10585
10585
|
}
|
10586
10586
|
|
10587
10587
|
return {
|
10588
|
-
|
10589
|
-
|
10588
|
+
sdkURL: sdkURL,
|
10589
|
+
isStaging: isStaging
|
10590
10590
|
};
|
10591
10591
|
};
|
10592
10592
|
|
@@ -10597,7 +10597,7 @@
|
|
10597
10597
|
this.build = "1.0.0";
|
10598
10598
|
this.name = "RudderLabs JavaScript SDK";
|
10599
10599
|
this.namespace = "com.rudderlabs.javascript";
|
10600
|
-
this.version = "2.9.
|
10600
|
+
this.version = "2.9.5";
|
10601
10601
|
});
|
10602
10602
|
|
10603
10603
|
/* eslint-disable max-classes-per-file */
|
@@ -10606,7 +10606,7 @@
|
|
10606
10606
|
_classCallCheck(this, RudderLibraryInfo);
|
10607
10607
|
|
10608
10608
|
this.name = "RudderLabs JavaScript SDK";
|
10609
|
-
this.version = "2.9.
|
10609
|
+
this.version = "2.9.5";
|
10610
10610
|
}); // Operating System information class
|
10611
10611
|
|
10612
10612
|
|
@@ -10650,13 +10650,18 @@
|
|
10650
10650
|
this.screen.height = window.screen.height;
|
10651
10651
|
this.screen.density = window.devicePixelRatio;
|
10652
10652
|
this.screen.innerWidth = window.innerWidth;
|
10653
|
-
this.screen.innerHeight = window.innerHeight;
|
10653
|
+
this.screen.innerHeight = window.innerHeight;
|
10654
|
+
this.userAgent = navigator.userAgent; // For supporting Brave browser detection,
|
10655
|
+
// add "Brave/<version>" to the user agent with the version value from the Chrome component
|
10654
10656
|
|
10655
10657
|
if (navigator.brave && Object.getPrototypeOf(navigator.brave).isBrave) {
|
10656
|
-
|
10657
|
-
|
10658
|
-
|
10659
|
-
|
10658
|
+
// Example:
|
10659
|
+
// Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/103.0.5060.114 Safari/537.36
|
10660
|
+
var matchedArr = this.userAgent.match(/(Chrome)\/([\w\.]+)/i);
|
10661
|
+
|
10662
|
+
if (matchedArr) {
|
10663
|
+
this.userAgent = "".concat(this.userAgent, " Brave/").concat(matchedArr[2]);
|
10664
|
+
}
|
10660
10665
|
} // property name differs based on browser version
|
10661
10666
|
|
10662
10667
|
|
@@ -13268,7 +13273,7 @@
|
|
13268
13273
|
if (API_KEY.match(apiKeyRegex) !== null) return;
|
13269
13274
|
window.rsBugsnagClient = window.Bugsnag.start({
|
13270
13275
|
apiKey: API_KEY,
|
13271
|
-
appVersion: "2.9.
|
13276
|
+
appVersion: "2.9.5",
|
13272
13277
|
// Set SDK version as the app version
|
13273
13278
|
metadata: META_DATA,
|
13274
13279
|
onError: function onError(event) {
|
@@ -13445,7 +13450,7 @@
|
|
13445
13450
|
key: "integrationSDKLoaded",
|
13446
13451
|
value: function integrationSDKLoaded(pluginName, modName) {
|
13447
13452
|
try {
|
13448
|
-
return window.hasOwnProperty(pluginName) && typeof window[pluginName][modName].prototype.constructor !== 'undefined';
|
13453
|
+
return window.hasOwnProperty(pluginName) && window[pluginName][modName] && typeof window[pluginName][modName].prototype.constructor !== 'undefined';
|
13449
13454
|
} catch (e) {
|
13450
13455
|
handleError(e);
|
13451
13456
|
return false;
|
@@ -13522,11 +13527,10 @@
|
|
13522
13527
|
var suffix = ''; // default suffix
|
13523
13528
|
// Get the CDN base URL is rudder staging url
|
13524
13529
|
|
13525
|
-
var
|
13526
|
-
|
13527
|
-
staging = _checkSDKUrl.staging;
|
13530
|
+
var _getSDKUrlInfo = getSDKUrlInfo(),
|
13531
|
+
isStaging = _getSDKUrlInfo.isStaging;
|
13528
13532
|
|
13529
|
-
if (
|
13533
|
+
if (isStaging) {
|
13530
13534
|
suffix = '-staging'; // stagging suffix
|
13531
13535
|
}
|
13532
13536
|
|
@@ -14289,11 +14293,11 @@
|
|
14289
14293
|
}
|
14290
14294
|
} else {
|
14291
14295
|
// Get the CDN base URL from the included 'rudder-analytics.min.js' script tag
|
14292
|
-
var
|
14293
|
-
|
14296
|
+
var _getSDKUrlInfo2 = getSDKUrlInfo(),
|
14297
|
+
sdkURL = _getSDKUrlInfo2.sdkURL;
|
14294
14298
|
|
14295
|
-
if (
|
14296
|
-
this.destSDKBaseURL =
|
14299
|
+
if (sdkURL) {
|
14300
|
+
this.destSDKBaseURL = sdkURL.split('/').slice(0, -1).concat(CDN_INT_DIR).join('/');
|
14297
14301
|
}
|
14298
14302
|
}
|
14299
14303
|
|