rudder-sdk-js 2.4.0 → 2.4.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.
Files changed (2) hide show
  1. package/index.js +39 -21
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -4829,7 +4829,7 @@
4829
4829
 
4830
4830
  // Reserved Keywords for properties/traits
4831
4831
  var ReservedPropertyKeywords = ["anonymous_id", "id", "sent_at", "received_at", "timestamp", "original_timestamp", "event_text", "event"]; // ECommerce Parameter Names Enumeration
4832
- var CONFIG_URL = "https://api.rudderlabs.com/sourceConfig/?p=npm&v=2.4.0";
4832
+ var CONFIG_URL = "https://api.rudderlabs.com/sourceConfig/?p=npm&v=2.4.3";
4833
4833
  var CDN_INT_DIR = "js-integrations";
4834
4834
  var DEST_SDK_BASE_URL = "https://cdn.rudderlabs.com/v1.1/".concat(CDN_INT_DIR);
4835
4835
  var MAX_WAIT_FOR_INTEGRATION_LOAD = 10000;
@@ -11045,7 +11045,7 @@
11045
11045
  // fetch it from cookie
11046
11046
 
11047
11047
 
11048
- if (!anonId && Cookie.IsCookieSupported()) {
11048
+ if (!anonId && Cookie.isSupportAvailable) {
11049
11049
  anonId = Cookie.get(anonymousIdKeyMap[key]);
11050
11050
  }
11051
11051
 
@@ -11397,23 +11397,32 @@
11397
11397
  allValue = sdkSuppliedIntegrations.All;
11398
11398
  }
11399
11399
 
11400
- var intgData = {};
11400
+ var intgData = [];
11401
11401
 
11402
11402
  if (typeof configPlaneEnabledIntegrations[0] === "string") {
11403
11403
  configPlaneEnabledIntegrations.forEach(function (intg) {
11404
- intgData[intg] = intg;
11404
+ intgData.push({
11405
+ intgName: intg,
11406
+ intObj: intg
11407
+ });
11405
11408
  });
11406
11409
  } else if (_typeof(configPlaneEnabledIntegrations[0]) === "object") {
11407
11410
  configPlaneEnabledIntegrations.forEach(function (intg) {
11408
- intgData[intg.name] = intg;
11411
+ intgData.push({
11412
+ intgName: intg.name,
11413
+ intObj: intg
11414
+ });
11409
11415
  });
11410
11416
  }
11411
11417
 
11412
- Object.keys(intgData).forEach(function (intgName) {
11418
+ intgData.forEach(function (_ref) {
11419
+ var intgName = _ref.intgName,
11420
+ intObj = _ref.intObj;
11421
+
11413
11422
  if (!allValue) {
11414
11423
  // All false ==> check if intg true supplied
11415
11424
  if (sdkSuppliedIntegrations[intgName] != undefined && sdkSuppliedIntegrations[intgName] == true) {
11416
- enabledList.push(intgData[intgName]);
11425
+ enabledList.push(intObj);
11417
11426
  }
11418
11427
  } else {
11419
11428
  // All true ==> intg true by default
@@ -11424,7 +11433,7 @@
11424
11433
  }
11425
11434
 
11426
11435
  if (intgValue) {
11427
- enabledList.push(intgData[intgName]);
11436
+ enabledList.push(intObj);
11428
11437
  }
11429
11438
  }
11430
11439
  });
@@ -11526,7 +11535,7 @@
11526
11535
  this.build = "1.0.0";
11527
11536
  this.name = "RudderLabs JavaScript SDK";
11528
11537
  this.namespace = "com.rudderlabs.javascript";
11529
- this.version = "2.4.0";
11538
+ this.version = "2.4.3";
11530
11539
  });
11531
11540
 
11532
11541
  /* eslint-disable max-classes-per-file */
@@ -11535,7 +11544,7 @@
11535
11544
  _classCallCheck(this, RudderLibraryInfo);
11536
11545
 
11537
11546
  this.name = "RudderLabs JavaScript SDK";
11538
- this.version = "2.4.0";
11547
+ this.version = "2.4.3";
11539
11548
  }); // Operating System information class
11540
11549
 
11541
11550
 
@@ -11951,8 +11960,8 @@
11951
11960
  */
11952
11961
  var byteToHex = [];
11953
11962
 
11954
- for (var i = 0; i < 256; ++i) {
11955
- byteToHex[i] = (i + 0x100).toString(16).substr(1);
11963
+ for (var i$1 = 0; i$1 < 256; ++i$1) {
11964
+ byteToHex[i$1] = (i$1 + 0x100).toString(16).substr(1);
11956
11965
  }
11957
11966
 
11958
11967
  function bytesToUuid$2(buf, offset) {
@@ -14860,21 +14869,30 @@
14860
14869
 
14861
14870
  instance.registerCallbacks(false);
14862
14871
  var defaultMethod = "load";
14863
- var argumentsArray = window.rudderanalytics || []; // Skip all the methods queued prior to the 'defaultMethod'
14872
+ var argumentsArray = window.rudderanalytics;
14873
+ var isValidArgsArray = Array.isArray(argumentsArray);
14864
14874
 
14865
- while (argumentsArray.length > 0) {
14866
- if (argumentsArray[0][0] === defaultMethod) {
14867
- instance.toBeProcessedArray.push(argumentsArray[0]);
14868
- argumentsArray.shift();
14869
- break;
14870
- }
14875
+ if (isValidArgsArray) {
14876
+ /**
14877
+ * Iterate the buffered API calls until we find load call and
14878
+ * queue it first for processing
14879
+ */
14880
+ var i = 0;
14871
14881
 
14872
- argumentsArray.shift();
14882
+ while (i < argumentsArray.length) {
14883
+ if (argumentsArray[i] && argumentsArray[i][0] === defaultMethod) {
14884
+ instance.toBeProcessedArray.push(argumentsArray[i]);
14885
+ argumentsArray.splice(i, 1);
14886
+ break;
14887
+ }
14888
+
14889
+ i += 1;
14890
+ }
14873
14891
  } // parse querystring of the page url to send events
14874
14892
 
14875
14893
 
14876
14894
  parseQueryString(window.location.search);
14877
- if (Array.isArray(argumentsArray)) argumentsArray.forEach(function (x) {
14895
+ if (isValidArgsArray) argumentsArray.forEach(function (x) {
14878
14896
  return instance.toBeProcessedArray.push(x);
14879
14897
  });
14880
14898
  processDataInAnalyticsArray(instance);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rudder-sdk-js",
3
- "version": "2.4.0",
3
+ "version": "2.4.3",
4
4
  "description": "RudderStack Javascript SDK",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",