rudder-sdk-js 1.2.15 → 1.2.16

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 +26 -19
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -5555,7 +5555,7 @@
5555
5555
  PRODUCT_REVIEWED: "Product Reviewed"
5556
5556
  }; // Enumeration for integrations supported
5557
5557
 
5558
- var CONFIG_URL = "https://api.rudderlabs.com/sourceConfig/?p=npm&v=1.2.15";
5558
+ var CONFIG_URL = "https://api.rudderlabs.com/sourceConfig/?p=npm&v=1.2.16";
5559
5559
  var MAX_WAIT_FOR_INTEGRATION_LOAD = 10000;
5560
5560
  var INTEGRATION_LOAD_CHECK_INTERVAL = 1000;
5561
5561
  /* module.exports = {
@@ -32671,10 +32671,11 @@
32671
32671
  this.disableCookie = config.disableCookie || false;
32672
32672
  this.propertyBlackList = [];
32673
32673
  this.xhrHeaders = {};
32674
+ this.enableLocalStoragePersistence = config.enableLocalStoragePersistence;
32674
32675
 
32675
32676
  if (config.xhrHeaders && config.xhrHeaders.length > 0) {
32676
32677
  config.xhrHeaders.forEach(function (header) {
32677
- if (header && header.key && header.value && header.key.trim() != "" && header.value.trim() != "") {
32678
+ if (header && header.key && header.value && header.key.trim() !== "" && header.value.trim() !== "") {
32678
32679
  _this.xhrHeaders[header.key] = header.value;
32679
32680
  }
32680
32681
  });
@@ -32682,7 +32683,7 @@
32682
32683
 
32683
32684
  if (config.propertyBlackList && config.propertyBlackList.length > 0) {
32684
32685
  config.propertyBlackList.forEach(function (element) {
32685
- if (element && element.property && element.property.trim() != "") {
32686
+ if (element && element.property && element.property.trim() !== "") {
32686
32687
  _this.propertyBlackList.push(element.property);
32687
32688
  }
32688
32689
  });
@@ -32730,6 +32731,10 @@
32730
32731
  configObject.xhr_headers = this.xhrHeaders;
32731
32732
  }
32732
32733
 
32734
+ if (this.enableLocalStoragePersistence) {
32735
+ configObject.persistence = "localStorage+cookie";
32736
+ }
32737
+
32733
32738
  posthog.init(this.teamApiKey, configObject);
32734
32739
  }
32735
32740
  /**
@@ -32759,7 +32764,7 @@
32759
32764
 
32760
32765
  if (unsetProperties && unsetProperties.length > 0) {
32761
32766
  unsetProperties.forEach(function (property) {
32762
- if (property && property.trim() != "") {
32767
+ if (property && property.trim() !== "") {
32763
32768
  posthog.unregister(property);
32764
32769
  }
32765
32770
  });
@@ -32791,7 +32796,7 @@
32791
32796
  posthog.capture(event, properties);
32792
32797
  }
32793
32798
  /**
32794
- *
32799
+ *
32795
32800
  *
32796
32801
  * @memberof Posthog
32797
32802
  */
@@ -34247,7 +34252,7 @@
34247
34252
  this.build = "1.0.0";
34248
34253
  this.name = "RudderLabs JavaScript SDK";
34249
34254
  this.namespace = "com.rudderlabs.javascript";
34250
- this.version = "1.2.15";
34255
+ this.version = "1.2.16";
34251
34256
  });
34252
34257
 
34253
34258
  // Library information class
@@ -34255,7 +34260,7 @@
34255
34260
  _classCallCheck(this, RudderLibraryInfo);
34256
34261
 
34257
34262
  this.name = "RudderLabs JavaScript SDK";
34258
- this.version = "1.2.15";
34263
+ this.version = "1.2.16";
34259
34264
  }); // Operating System information class
34260
34265
 
34261
34266
 
@@ -36904,8 +36909,7 @@
36904
36909
  // we will not be filtering any of the destinations.
36905
36910
 
36906
36911
  if (!window.OneTrust || !window.OnetrustActiveGroups) {
36907
- logger.debug("Onetrust window objects not retrieved. Thus events are sent.");
36908
- return true;
36912
+ throw new Error("OneTrust resources are not accessible. Thus all the destinations will be loaded");
36909
36913
  } // OneTrust Cookie Compliance populates a data layer object OnetrustActiveGroups with
36910
36914
  // the cookie categories that the user has consented to.
36911
36915
  // Eg: ',C0001,C0003,'
@@ -36989,7 +36993,7 @@
36989
36993
 
36990
36994
  _createClass(CookieConsentFactory, null, [{
36991
36995
  key: "initialize",
36992
- value: function initialize(sourceConfig, cookieConsentOptions) {
36996
+ value: function initialize(cookieConsentOptions) {
36993
36997
  var _cookieConsentOptions;
36994
36998
 
36995
36999
  /**
@@ -37148,21 +37152,24 @@
37148
37152
  }, this);
37149
37153
  logger.debug("this.clientIntegrations: ", this.clientIntegrations); // intersection of config-plane native sdk destinations with sdk load time destination list
37150
37154
 
37151
- this.clientIntegrations = findAllEnabledDestinations(this.loadOnlyIntegrations, this.clientIntegrations);
37152
- var cookieConsent = undefined; // Check if cookie consent manager is being set through load options
37155
+ this.clientIntegrations = findAllEnabledDestinations(this.loadOnlyIntegrations, this.clientIntegrations); // Check if cookie consent manager is being set through load options
37153
37156
 
37154
37157
  if (Object.keys(this.cookieConsentOptions).length) {
37155
37158
  // Call the cookie consent factory to initialise and return the type of cookie
37156
37159
  // consent being set. For now we only support OneTrust.
37157
- cookieConsent = CookieConsentFactory.initialize(response, this.cookieConsentOptions);
37158
- } // If cookie consent object is return we filter according to consents given by user
37159
- // else we do not consider any filtering for cookie consent.
37160
+ try {
37161
+ var cookieConsent = CookieConsentFactory.initialize(this.cookieConsentOptions); // If cookie consent object is return we filter according to consents given by user
37162
+ // else we do not consider any filtering for cookie consent.
37160
37163
 
37164
+ this.clientIntegrations = this.clientIntegrations.filter(function (intg) {
37165
+ return integrations[intg.name] != undefined && (!cookieConsent || // check if cookieconsent object is present and then do filtering
37166
+ cookieConsent && cookieConsent.isEnabled(intg.config));
37167
+ });
37168
+ } catch (e) {
37169
+ logger.error(e);
37170
+ }
37171
+ }
37161
37172
 
37162
- this.clientIntegrations = this.clientIntegrations.filter(function (intg) {
37163
- return integrations[intg.name] != undefined && (!cookieConsent || // check if cookieconsent object is present and then do filtering
37164
- cookieConsent && cookieConsent.isEnabled(intg.config));
37165
- });
37166
37173
  this.init(this.clientIntegrations);
37167
37174
  } catch (error) {
37168
37175
  handleError(error);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rudder-sdk-js",
3
- "version": "1.2.15",
3
+ "version": "1.2.16",
4
4
  "description": "RudderStack Javascript SDK",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",