rudder-sdk-js 2.5.1 → 2.5.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.
- package/index.js +42 -13
- package/package.json +1 -1
package/index.js
CHANGED
@@ -4835,7 +4835,7 @@
|
|
4835
4835
|
|
4836
4836
|
// Reserved Keywords for properties/traits
|
4837
4837
|
var ReservedPropertyKeywords = ["anonymous_id", "id", "sent_at", "received_at", "timestamp", "original_timestamp", "event_text", "event"]; // ECommerce Parameter Names Enumeration
|
4838
|
-
var CONFIG_URL = "https://api.rudderlabs.com/sourceConfig/?p=npm&v=2.5.
|
4838
|
+
var CONFIG_URL = "https://api.rudderlabs.com/sourceConfig/?p=npm&v=2.5.2";
|
4839
4839
|
var CDN_INT_DIR = "js-integrations";
|
4840
4840
|
var DEST_SDK_BASE_URL = "https://cdn.rudderlabs.com/v1.1/".concat(CDN_INT_DIR);
|
4841
4841
|
var MAX_WAIT_FOR_INTEGRATION_LOAD = 10000;
|
@@ -11541,7 +11541,7 @@
|
|
11541
11541
|
this.build = "1.0.0";
|
11542
11542
|
this.name = "RudderLabs JavaScript SDK";
|
11543
11543
|
this.namespace = "com.rudderlabs.javascript";
|
11544
|
-
this.version = "2.5.
|
11544
|
+
this.version = "2.5.2";
|
11545
11545
|
});
|
11546
11546
|
|
11547
11547
|
/* eslint-disable max-classes-per-file */
|
@@ -11550,7 +11550,7 @@
|
|
11550
11550
|
_classCallCheck(this, RudderLibraryInfo);
|
11551
11551
|
|
11552
11552
|
this.name = "RudderLabs JavaScript SDK";
|
11553
|
-
this.version = "2.5.
|
11553
|
+
this.version = "2.5.2";
|
11554
11554
|
}); // Operating System information class
|
11555
11555
|
|
11556
11556
|
|
@@ -13809,10 +13809,9 @@
|
|
13809
13809
|
this.eventRepository = eventRepository;
|
13810
13810
|
this.sendAdblockPage = false;
|
13811
13811
|
this.sendAdblockPageOptions = {};
|
13812
|
-
this.clientSuppliedCallbacks = {};
|
13813
|
-
|
13814
|
-
this.readyCallback = function () {};
|
13812
|
+
this.clientSuppliedCallbacks = {}; // Array to store the callback functions registered in the ready API
|
13815
13813
|
|
13814
|
+
this.readyCallbacks = [];
|
13816
13815
|
this.methodToCallbackMapping = {
|
13817
13816
|
syncPixel: "syncPixelCallback"
|
13818
13817
|
};
|
@@ -13821,7 +13820,9 @@
|
|
13821
13820
|
this.dynamicallyLoadedIntegrations = {};
|
13822
13821
|
this.destSDKBaseURL = DEST_SDK_BASE_URL;
|
13823
13822
|
this.cookieConsentOptions = {};
|
13824
|
-
this.logLevel = undefined;
|
13823
|
+
this.logLevel = undefined; // flag to indicate client integrations` ready status
|
13824
|
+
|
13825
|
+
this.clientIntegrationsReady = false;
|
13825
13826
|
}
|
13826
13827
|
/**
|
13827
13828
|
* initialize the user after load config
|
@@ -13880,6 +13881,18 @@
|
|
13880
13881
|
});
|
13881
13882
|
});
|
13882
13883
|
}
|
13884
|
+
/**
|
13885
|
+
* Function to execute the ready method callbacks
|
13886
|
+
* @param {Analytics} self
|
13887
|
+
*/
|
13888
|
+
|
13889
|
+
}, {
|
13890
|
+
key: "executeReadyCallback",
|
13891
|
+
value: function executeReadyCallback() {
|
13892
|
+
this.readyCallbacks.forEach(function (callback) {
|
13893
|
+
return callback();
|
13894
|
+
});
|
13895
|
+
}
|
13883
13896
|
/**
|
13884
13897
|
* Process the response from control plane and
|
13885
13898
|
* call initialize for integrations
|
@@ -13987,11 +14000,13 @@
|
|
13987
14000
|
var self = this;
|
13988
14001
|
this.allModulesInitialized().then(function () {
|
13989
14002
|
if (!self.clientIntegrations || self.clientIntegrations.length == 0) {
|
13990
|
-
|
13991
|
-
|
13992
|
-
|
14003
|
+
// If no integrations are there to be loaded
|
14004
|
+
// set clientIntegrationsReady to be true
|
14005
|
+
_this2.clientIntegrationsReady = true; // Execute the callbacks if any
|
13993
14006
|
|
13994
|
-
|
14007
|
+
_this2.executeReadyCallback();
|
14008
|
+
|
14009
|
+
_this2.toBeProcessedByIntegrationArray = [];
|
13995
14010
|
return;
|
13996
14011
|
}
|
13997
14012
|
|
@@ -14024,7 +14039,11 @@
|
|
14024
14039
|
if (object.clientIntegrationObjects.every(function (intg) {
|
14025
14040
|
return !intg.isReady || intg.isReady();
|
14026
14041
|
})) {
|
14027
|
-
|
14042
|
+
// Integrations are ready
|
14043
|
+
// set clientIntegrationsReady to be true
|
14044
|
+
object.clientIntegrationsReady = true; // Execute the callbacks if any
|
14045
|
+
|
14046
|
+
object.executeReadyCallback();
|
14028
14047
|
} // send the queued events to the fetched integration
|
14029
14048
|
|
14030
14049
|
|
@@ -14753,7 +14772,17 @@
|
|
14753
14772
|
if (!this.loaded) return;
|
14754
14773
|
|
14755
14774
|
if (typeof callback === "function") {
|
14756
|
-
|
14775
|
+
/**
|
14776
|
+
* If integrations are loaded or no integration is available for loading
|
14777
|
+
* execute the callback immediately
|
14778
|
+
* else push the callbacks to a queue that will be executed after loading completes
|
14779
|
+
*/
|
14780
|
+
if (this.clientIntegrationsReady) {
|
14781
|
+
callback();
|
14782
|
+
} else {
|
14783
|
+
this.readyCallbacks.push(callback);
|
14784
|
+
}
|
14785
|
+
|
14757
14786
|
return;
|
14758
14787
|
}
|
14759
14788
|
|