rudder-sdk-js 1.2.19 → 1.2.20

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 +95 -8
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -5561,7 +5561,7 @@
5561
5561
  PRODUCT_REVIEWED: "Product Reviewed"
5562
5562
  }; // Enumeration for integrations supported
5563
5563
 
5564
- var CONFIG_URL = "https://api.rudderlabs.com/sourceConfig/?p=npm&v=1.2.19";
5564
+ var CONFIG_URL = "https://api.rudderlabs.com/sourceConfig/?p=npm&v=1.2.20";
5565
5565
  var MAX_WAIT_FOR_INTEGRATION_LOAD = 10000;
5566
5566
  var INTEGRATION_LOAD_CHECK_INTERVAL = 1000;
5567
5567
  /* module.exports = {
@@ -22878,10 +22878,17 @@
22878
22878
  js.async = async === undefined ? defaultAsyncState : async;
22879
22879
  js.type = "text/javascript";
22880
22880
  js.id = id;
22881
- var e = document.getElementsByTagName("script")[0];
22882
- logger.debug("==parent script==", e);
22883
- logger.debug("==adding script==", js);
22884
- e.parentNode.insertBefore(js, e);
22881
+ var headElmColl = document.getElementsByTagName("head");
22882
+
22883
+ if (headElmColl.length !== 0) {
22884
+ logger.debug("==adding script==", js);
22885
+ headElmColl[0].insertBefore(js, headElmColl[0].firstChild);
22886
+ } else {
22887
+ var e = document.getElementsByTagName("script")[0];
22888
+ logger.debug("==parent script==", e);
22889
+ logger.debug("==adding script==", js);
22890
+ e.parentNode.insertBefore(js, e);
22891
+ }
22885
22892
  };
22886
22893
 
22887
22894
  var AdobeAnalytics = /*#__PURE__*/function () {
@@ -27547,12 +27554,13 @@
27547
27554
  camelcase.default = default_1;
27548
27555
 
27549
27556
  var Fullstory = /*#__PURE__*/function () {
27550
- function Fullstory(config) {
27557
+ function Fullstory(config, analytics) {
27551
27558
  _classCallCheck(this, Fullstory);
27552
27559
 
27553
27560
  this.fs_org = config.fs_org;
27554
27561
  this.fs_debug_mode = config.fs_debug_mode;
27555
27562
  this.name = "FULLSTORY";
27563
+ this.analytics = analytics;
27556
27564
  }
27557
27565
 
27558
27566
  _createClass(Fullstory, [{
@@ -27638,6 +27646,85 @@
27638
27646
  return g._w[y].apply(this, arguments);
27639
27647
  };
27640
27648
  })(window, document, window._fs_namespace, "script", "user");
27649
+
27650
+ var FULLSTORY = this.analytics.loadOnlyIntegrations.FULLSTORY; // Checking if crossDomainSupport is their or not.
27651
+
27652
+ if ((FULLSTORY === null || FULLSTORY === void 0 ? void 0 : FULLSTORY.crossDomainSupport) === true) {
27653
+ // This function will check if the customer hash is available or not in localStorage
27654
+ window._fs_identity = function () {
27655
+ if (window.localStorage) {
27656
+ var tata_customer_hash = window.localStorage.tata_customer_hash;
27657
+
27658
+ if (tata_customer_hash) {
27659
+ return {
27660
+ uid: tata_customer_hash,
27661
+ displayName: tata_customer_hash
27662
+ };
27663
+ }
27664
+ } else {
27665
+ logger.debug("Unable to access locaStorage");
27666
+ }
27667
+
27668
+ return null;
27669
+ };
27670
+
27671
+ (function () {
27672
+ function fs(api) {
27673
+ if (!window._fs_namespace) {
27674
+ console.error('FullStory unavailable, window["_fs_namespace"] must be defined');
27675
+ return undefined;
27676
+ }
27677
+
27678
+ return api ? window[window._fs_namespace][api] : window[window._fs_namespace];
27679
+ }
27680
+
27681
+ function waitUntil(predicateFn, callbackFn, timeout, timeoutFn) {
27682
+ var totalTime = 0;
27683
+ var delay = 64;
27684
+
27685
+ var resultFn = function resultFn() {
27686
+ if (typeof predicateFn === "function" && predicateFn()) {
27687
+ callbackFn();
27688
+ return;
27689
+ }
27690
+
27691
+ delay = Math.min(delay * 2, 1024);
27692
+
27693
+ if (totalTime > timeout) {
27694
+ if (timeoutFn) {
27695
+ timeoutFn();
27696
+ }
27697
+ }
27698
+
27699
+ totalTime += delay;
27700
+ setTimeout(resultFn, delay);
27701
+ };
27702
+
27703
+ resultFn();
27704
+ } // Checking if timeout is provided or not.
27705
+
27706
+
27707
+ var timeout = FULLSTORY.timeout || 2000;
27708
+
27709
+ function identify() {
27710
+ if (typeof window._fs_identity === "function") {
27711
+ var userVars = window._fs_identity();
27712
+
27713
+ if (_typeof(userVars) === "object" && typeof userVars.uid === "string") {
27714
+ fs("setUserVars")(userVars);
27715
+ fs("restart")();
27716
+ } else {
27717
+ fs("log")("error", "FS.setUserVars requires an object that contains uid");
27718
+ }
27719
+ } else {
27720
+ fs("log")("error", 'window["_fs_identity"] function not found');
27721
+ }
27722
+ }
27723
+
27724
+ fs("shutdown")();
27725
+ waitUntil(window._fs_identity, identify, timeout, fs("restart"));
27726
+ })();
27727
+ }
27641
27728
  }
27642
27729
  }, {
27643
27730
  key: "page",
@@ -34366,7 +34453,7 @@
34366
34453
  this.build = "1.0.0";
34367
34454
  this.name = "RudderLabs JavaScript SDK";
34368
34455
  this.namespace = "com.rudderlabs.javascript";
34369
- this.version = "1.2.19";
34456
+ this.version = "1.2.20";
34370
34457
  });
34371
34458
 
34372
34459
  // Library information class
@@ -34374,7 +34461,7 @@
34374
34461
  _classCallCheck(this, RudderLibraryInfo);
34375
34462
 
34376
34463
  this.name = "RudderLabs JavaScript SDK";
34377
- this.version = "1.2.19";
34464
+ this.version = "1.2.20";
34378
34465
  }); // Operating System information class
34379
34466
 
34380
34467
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rudder-sdk-js",
3
- "version": "1.2.19",
3
+ "version": "1.2.20",
4
4
  "description": "RudderStack Javascript SDK",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",