@carbon/ibmdotcom-services 2.51.0 → 2.51.1
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.
|
@@ -76,7 +76,7 @@ var _ibmScriptUrl = function _ibmScriptUrl() {
|
|
|
76
76
|
*/
|
|
77
77
|
function _loadScript() {
|
|
78
78
|
var environment = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : _ibmEnvironment;
|
|
79
|
-
|
|
79
|
+
root._ibmKalturaScriptLoading = true;
|
|
80
80
|
var script = document.createElement('script');
|
|
81
81
|
script.src = _ibmScriptUrl(environment);
|
|
82
82
|
script.async = true;
|
|
@@ -92,12 +92,19 @@ function _loadScript() {
|
|
|
92
92
|
var _timeoutRetries = 50;
|
|
93
93
|
|
|
94
94
|
/**
|
|
95
|
-
* Tracks the script status
|
|
95
|
+
* Tracks the script loading status. Stored on `root` (window) so the value
|
|
96
|
+
* persists when this module is executed more than once in the same page
|
|
97
|
+
* (e.g. once as an async page script and again as a deferred Adobe Target
|
|
98
|
+
* Experience Fragment script). Without this, a second execution resets the
|
|
99
|
+
* flag to false and causes _loadScript() to inject loader.js a second time,
|
|
100
|
+
* creating a race condition that leaves embedMedia() pending indefinitely.
|
|
96
101
|
*
|
|
97
|
-
* @type {boolean}
|
|
102
|
+
* @type {boolean}
|
|
98
103
|
* @private
|
|
99
104
|
*/
|
|
100
|
-
|
|
105
|
+
if (root._ibmKalturaScriptLoading === undefined) {
|
|
106
|
+
root._ibmKalturaScriptLoading = false;
|
|
107
|
+
}
|
|
101
108
|
|
|
102
109
|
/**
|
|
103
110
|
* Serializes concurrent embed calls. The IBM Mediacenter player.embed() does
|
|
@@ -126,9 +133,9 @@ function _scriptReady(resolve, reject) {
|
|
|
126
133
|
* @param {object} root?.IBM.Mediacenter.player if exists then resolve
|
|
127
134
|
*/
|
|
128
135
|
if (root !== null && root !== void 0 && (_root$IBM = root.IBM) !== null && _root$IBM !== void 0 && (_root$IBM = _root$IBM.Mediacenter) !== null && _root$IBM !== void 0 && _root$IBM.player) {
|
|
129
|
-
|
|
136
|
+
root._ibmKalturaScriptLoading = false;
|
|
130
137
|
resolve();
|
|
131
|
-
} else if (
|
|
138
|
+
} else if (root._ibmKalturaScriptLoading) {
|
|
132
139
|
if (attempt < _timeoutRetries) {
|
|
133
140
|
setTimeout(function () {
|
|
134
141
|
_scriptReady(resolve, reject, environment, attempt + 1);
|
|
@@ -81,7 +81,7 @@ var _ibmScriptUrl = function _ibmScriptUrl() {
|
|
|
81
81
|
*/
|
|
82
82
|
function _loadScript() {
|
|
83
83
|
var environment = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : _ibmEnvironment;
|
|
84
|
-
|
|
84
|
+
_windowOrGlobal.default._ibmKalturaScriptLoading = true;
|
|
85
85
|
var script = document.createElement('script');
|
|
86
86
|
script.src = _ibmScriptUrl(environment);
|
|
87
87
|
script.async = true;
|
|
@@ -97,12 +97,19 @@ function _loadScript() {
|
|
|
97
97
|
var _timeoutRetries = 50;
|
|
98
98
|
|
|
99
99
|
/**
|
|
100
|
-
* Tracks the script status
|
|
100
|
+
* Tracks the script loading status. Stored on `root` (window) so the value
|
|
101
|
+
* persists when this module is executed more than once in the same page
|
|
102
|
+
* (e.g. once as an async page script and again as a deferred Adobe Target
|
|
103
|
+
* Experience Fragment script). Without this, a second execution resets the
|
|
104
|
+
* flag to false and causes _loadScript() to inject loader.js a second time,
|
|
105
|
+
* creating a race condition that leaves embedMedia() pending indefinitely.
|
|
101
106
|
*
|
|
102
|
-
* @type {boolean}
|
|
107
|
+
* @type {boolean}
|
|
103
108
|
* @private
|
|
104
109
|
*/
|
|
105
|
-
|
|
110
|
+
if (_windowOrGlobal.default._ibmKalturaScriptLoading === undefined) {
|
|
111
|
+
_windowOrGlobal.default._ibmKalturaScriptLoading = false;
|
|
112
|
+
}
|
|
106
113
|
|
|
107
114
|
/**
|
|
108
115
|
* Serializes concurrent embed calls. The IBM Mediacenter player.embed() does
|
|
@@ -131,9 +138,9 @@ function _scriptReady(resolve, reject) {
|
|
|
131
138
|
* @param {object} root?.IBM.Mediacenter.player if exists then resolve
|
|
132
139
|
*/
|
|
133
140
|
if (_windowOrGlobal.default !== null && _windowOrGlobal.default !== void 0 && (_root$IBM = _windowOrGlobal.default.IBM) !== null && _root$IBM !== void 0 && (_root$IBM = _root$IBM.Mediacenter) !== null && _root$IBM !== void 0 && _root$IBM.player) {
|
|
134
|
-
|
|
141
|
+
_windowOrGlobal.default._ibmKalturaScriptLoading = false;
|
|
135
142
|
resolve();
|
|
136
|
-
} else if (
|
|
143
|
+
} else if (_windowOrGlobal.default._ibmKalturaScriptLoading) {
|
|
137
144
|
if (attempt < _timeoutRetries) {
|
|
138
145
|
setTimeout(function () {
|
|
139
146
|
_scriptReady(resolve, reject, environment, attempt + 1);
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@carbon/ibmdotcom-services",
|
|
3
3
|
"description": "Carbon for IBM.com Services",
|
|
4
|
-
"version": "2.51.
|
|
4
|
+
"version": "2.51.1",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"main": "lib/index.js",
|
|
7
7
|
"module": "es/index.js",
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
},
|
|
48
48
|
"dependencies": {
|
|
49
49
|
"@babel/runtime": "^7.16.3",
|
|
50
|
-
"@carbon/ibmdotcom-utilities": "2.51.
|
|
50
|
+
"@carbon/ibmdotcom-utilities": "2.51.1",
|
|
51
51
|
"@ibm/telemetry-js": "^1.5.0",
|
|
52
52
|
"axios": "^1.6.8",
|
|
53
53
|
"marked": "^4.0.10",
|
|
@@ -89,5 +89,5 @@
|
|
|
89
89
|
"rollup-plugin-sizes": "^1.0.4",
|
|
90
90
|
"whatwg-fetch": "^2.0.3"
|
|
91
91
|
},
|
|
92
|
-
"gitHead": "
|
|
92
|
+
"gitHead": "7e8c033625cb7618402890710fa091c85d1fbb0e"
|
|
93
93
|
}
|