rudder-sdk-js 2.9.1 → 2.9.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.
Files changed (2) hide show
  1. package/index.js +33 -7
  2. 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.1';
4942
+ var CONFIG_URL = 'https://api.rudderlabs.com/sourceConfig/?p=npm&v=2.9.2';
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;
@@ -10371,7 +10371,15 @@
10371
10371
  }
10372
10372
 
10373
10373
  function getReferrer() {
10374
- return document.referrer || "$direct";
10374
+ // This error handling is in place to avoid accessing dead object(document)
10375
+ var defaultReferrer = "$direct";
10376
+
10377
+ try {
10378
+ return document.referrer || defaultReferrer;
10379
+ } catch (e) {
10380
+ logger.error("Error trying to access 'document.referrer': ", e);
10381
+ return defaultReferrer;
10382
+ }
10375
10383
  }
10376
10384
 
10377
10385
  function getReferringDomain(referrer) {
@@ -10589,7 +10597,7 @@
10589
10597
  this.build = "1.0.0";
10590
10598
  this.name = "RudderLabs JavaScript SDK";
10591
10599
  this.namespace = "com.rudderlabs.javascript";
10592
- this.version = "2.9.1";
10600
+ this.version = "2.9.2";
10593
10601
  });
10594
10602
 
10595
10603
  /* eslint-disable max-classes-per-file */
@@ -10598,7 +10606,7 @@
10598
10606
  _classCallCheck(this, RudderLibraryInfo);
10599
10607
 
10600
10608
  this.name = "RudderLabs JavaScript SDK";
10601
- this.version = "2.9.1";
10609
+ this.version = "2.9.2";
10602
10610
  }); // Operating System information class
10603
10611
 
10604
10612
 
@@ -13260,7 +13268,7 @@
13260
13268
  if (API_KEY.match(apiKeyRegex) !== null) return;
13261
13269
  window.rsBugsnagClient = window.Bugsnag.start({
13262
13270
  apiKey: API_KEY,
13263
- appVersion: "2.9.1",
13271
+ appVersion: "2.9.2",
13264
13272
  // Set SDK version as the app version
13265
13273
  metadata: META_DATA,
13266
13274
  onError: function onError(event) {
@@ -13425,6 +13433,24 @@
13425
13433
  return callback();
13426
13434
  });
13427
13435
  }
13436
+ /**
13437
+ * A function to validate integration SDK is available in window
13438
+ * and integration constructor is not undefined
13439
+ * @param {string} pluginName
13440
+ * @param {string} modName
13441
+ * @returns boolean
13442
+ */
13443
+
13444
+ }, {
13445
+ key: "integrationSDKLoaded",
13446
+ value: function integrationSDKLoaded(pluginName, modName) {
13447
+ try {
13448
+ return window.hasOwnProperty(pluginName) && typeof window[pluginName][modName].prototype.constructor !== 'undefined';
13449
+ } catch (e) {
13450
+ handleError(e);
13451
+ return false;
13452
+ }
13453
+ }
13428
13454
  /**
13429
13455
  * Process the response from control plane and
13430
13456
  * call initialize for integrations
@@ -13520,7 +13546,7 @@
13520
13546
 
13521
13547
  var self = _this2;
13522
13548
  var interval = setInterval(function () {
13523
- if (window.hasOwnProperty(pluginName)) {
13549
+ if (self.integrationSDKLoaded(pluginName, modName)) {
13524
13550
  var intMod = window[pluginName];
13525
13551
  clearInterval(interval); // logger.debug(pluginName, " dynamically loaded integration SDK");
13526
13552
 
@@ -13923,7 +13949,7 @@
13923
13949
  checkReservedKeywords(rudderElement.message, type); // if not specified at event level, All: true is default
13924
13950
 
13925
13951
  var clientSuppliedIntegrations = rudderElement.message.integrations || {
13926
- 'All': true
13952
+ All: true
13927
13953
  }; // structure user supplied integrations object to rudder format
13928
13954
 
13929
13955
  transformToRudderNames(clientSuppliedIntegrations);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rudder-sdk-js",
3
- "version": "2.9.1",
3
+ "version": "2.9.2",
4
4
  "description": "RudderStack Javascript SDK",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",