rudder-sdk-js 2.9.2 → 2.9.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 +33 -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.3';
|
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.3";
|
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.3";
|
10610
10610
|
}); // Operating System information class
|
10611
10611
|
|
10612
10612
|
|
@@ -10650,13 +10650,17 @@
|
|
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; // For supporting Brave browser detection,
|
10654
|
+
// add "Brave/<version>" to the user agent with the version value from the Chrome component
|
10654
10655
|
|
10655
10656
|
if (navigator.brave && Object.getPrototypeOf(navigator.brave).isBrave) {
|
10656
|
-
|
10657
|
-
|
10658
|
-
|
10659
|
-
|
10657
|
+
// Example:
|
10658
|
+
// 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
|
10659
|
+
var matchedArr = this.userAgent.match(/(Chrome)\/([\w\.]+)/i);
|
10660
|
+
|
10661
|
+
if (matchedArr) {
|
10662
|
+
this.userAgent = "".concat(this.userAgent, " Brave/").concat(matchedArr[2]);
|
10663
|
+
}
|
10660
10664
|
} // property name differs based on browser version
|
10661
10665
|
|
10662
10666
|
|
@@ -13268,7 +13272,7 @@
|
|
13268
13272
|
if (API_KEY.match(apiKeyRegex) !== null) return;
|
13269
13273
|
window.rsBugsnagClient = window.Bugsnag.start({
|
13270
13274
|
apiKey: API_KEY,
|
13271
|
-
appVersion: "2.9.
|
13275
|
+
appVersion: "2.9.3",
|
13272
13276
|
// Set SDK version as the app version
|
13273
13277
|
metadata: META_DATA,
|
13274
13278
|
onError: function onError(event) {
|
@@ -13445,7 +13449,7 @@
|
|
13445
13449
|
key: "integrationSDKLoaded",
|
13446
13450
|
value: function integrationSDKLoaded(pluginName, modName) {
|
13447
13451
|
try {
|
13448
|
-
return window.hasOwnProperty(pluginName) && typeof window[pluginName][modName].prototype.constructor !== 'undefined';
|
13452
|
+
return window.hasOwnProperty(pluginName) && window[pluginName][modName] && typeof window[pluginName][modName].prototype.constructor !== 'undefined';
|
13449
13453
|
} catch (e) {
|
13450
13454
|
handleError(e);
|
13451
13455
|
return false;
|
@@ -13522,11 +13526,10 @@
|
|
13522
13526
|
var suffix = ''; // default suffix
|
13523
13527
|
// Get the CDN base URL is rudder staging url
|
13524
13528
|
|
13525
|
-
var
|
13526
|
-
|
13527
|
-
staging = _checkSDKUrl.staging;
|
13529
|
+
var _getSDKUrlInfo = getSDKUrlInfo(),
|
13530
|
+
isStaging = _getSDKUrlInfo.isStaging;
|
13528
13531
|
|
13529
|
-
if (
|
13532
|
+
if (isStaging) {
|
13530
13533
|
suffix = '-staging'; // stagging suffix
|
13531
13534
|
}
|
13532
13535
|
|
@@ -14289,11 +14292,11 @@
|
|
14289
14292
|
}
|
14290
14293
|
} else {
|
14291
14294
|
// Get the CDN base URL from the included 'rudder-analytics.min.js' script tag
|
14292
|
-
var
|
14293
|
-
|
14295
|
+
var _getSDKUrlInfo2 = getSDKUrlInfo(),
|
14296
|
+
sdkURL = _getSDKUrlInfo2.sdkURL;
|
14294
14297
|
|
14295
|
-
if (
|
14296
|
-
this.destSDKBaseURL =
|
14298
|
+
if (sdkURL) {
|
14299
|
+
this.destSDKBaseURL = sdkURL.split('/').slice(0, -1).concat(CDN_INT_DIR).join('/');
|
14297
14300
|
}
|
14298
14301
|
}
|
14299
14302
|
|