@carbon/ibmdotcom-services 2.49.0 → 2.50.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.
@@ -92,31 +92,36 @@ function _loadScript() {
92
92
  var _timeoutRetries = 50;
93
93
 
94
94
  /**
95
- * Tracks the number of attempts for the script ready loop
95
+ * Tracks the script status
96
96
  *
97
- * @type {number}
97
+ * @type {boolean} _scriptLoading to track the script loading or not
98
98
  * @private
99
99
  */
100
- var _attempt = 0;
100
+ var _scriptLoading = false;
101
101
 
102
102
  /**
103
- * Tracks the script status
103
+ * Serializes concurrent embed calls. The IBM Mediacenter player.embed() does
104
+ * not reliably support simultaneous calls for the same entryId, so we chain
105
+ * each call onto the previous one to ensure they run sequentially.
104
106
  *
105
- * @type {boolean} _scriptLoading to track the script loading or not
107
+ * @type {Promise<any>}
106
108
  * @private
107
109
  */
108
- var _scriptLoading = false;
110
+ var _embedQueue = Promise.resolve();
109
111
 
110
112
  /**
111
113
  * Timeout loop to check script state is the _scriptLoaded state or _scriptLoading state
112
114
  *
113
115
  * @param {Function} resolve Resolve function
114
116
  * @param {Function} reject Reject function
117
+ * @param {string} environment The player environment
118
+ * @param {number} attempt Per-call retry count
115
119
  * @private
116
120
  */
117
121
  function _scriptReady(resolve, reject) {
118
122
  var _root$IBM;
119
123
  var environment = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : _ibmEnvironment;
124
+ var attempt = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
120
125
  /**
121
126
  * @param {object} root?.IBM.Mediacenter.player if exists then resolve
122
127
  */
@@ -124,17 +129,16 @@ function _scriptReady(resolve, reject) {
124
129
  _scriptLoading = false;
125
130
  resolve();
126
131
  } else if (_scriptLoading) {
127
- _attempt++;
128
- if (_attempt < _timeoutRetries) {
132
+ if (attempt < _timeoutRetries) {
129
133
  setTimeout(function () {
130
- _scriptReady(resolve, reject, environment);
134
+ _scriptReady(resolve, reject, environment, attempt + 1);
131
135
  }, 100);
132
136
  } else {
133
137
  reject();
134
138
  }
135
139
  } else {
136
140
  _loadScript(environment);
137
- _scriptReady(resolve, reject, environment);
141
+ _scriptReady(resolve, reject, environment, attempt);
138
142
  }
139
143
  }
140
144
 
@@ -346,7 +350,10 @@ var KalturaPlayerAPIV7 = /*#__PURE__*/function () {
346
350
  return _ref7.apply(this, arguments);
347
351
  };
348
352
  }();
349
- return legacyPromiseKWidget();
353
+ _embedQueue = _embedQueue.then(function () {
354
+ return legacyPromiseKWidget();
355
+ });
356
+ return _embedQueue;
350
357
  });
351
358
  case 1:
352
359
  return _context3.abrupt("return", _context3.sent);
@@ -97,31 +97,36 @@ function _loadScript() {
97
97
  var _timeoutRetries = 50;
98
98
 
99
99
  /**
100
- * Tracks the number of attempts for the script ready loop
100
+ * Tracks the script status
101
101
  *
102
- * @type {number}
102
+ * @type {boolean} _scriptLoading to track the script loading or not
103
103
  * @private
104
104
  */
105
- var _attempt = 0;
105
+ var _scriptLoading = false;
106
106
 
107
107
  /**
108
- * Tracks the script status
108
+ * Serializes concurrent embed calls. The IBM Mediacenter player.embed() does
109
+ * not reliably support simultaneous calls for the same entryId, so we chain
110
+ * each call onto the previous one to ensure they run sequentially.
109
111
  *
110
- * @type {boolean} _scriptLoading to track the script loading or not
112
+ * @type {Promise<any>}
111
113
  * @private
112
114
  */
113
- var _scriptLoading = false;
115
+ var _embedQueue = Promise.resolve();
114
116
 
115
117
  /**
116
118
  * Timeout loop to check script state is the _scriptLoaded state or _scriptLoading state
117
119
  *
118
120
  * @param {Function} resolve Resolve function
119
121
  * @param {Function} reject Reject function
122
+ * @param {string} environment The player environment
123
+ * @param {number} attempt Per-call retry count
120
124
  * @private
121
125
  */
122
126
  function _scriptReady(resolve, reject) {
123
127
  var _root$IBM;
124
128
  var environment = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : _ibmEnvironment;
129
+ var attempt = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
125
130
  /**
126
131
  * @param {object} root?.IBM.Mediacenter.player if exists then resolve
127
132
  */
@@ -129,17 +134,16 @@ function _scriptReady(resolve, reject) {
129
134
  _scriptLoading = false;
130
135
  resolve();
131
136
  } else if (_scriptLoading) {
132
- _attempt++;
133
- if (_attempt < _timeoutRetries) {
137
+ if (attempt < _timeoutRetries) {
134
138
  setTimeout(function () {
135
- _scriptReady(resolve, reject, environment);
139
+ _scriptReady(resolve, reject, environment, attempt + 1);
136
140
  }, 100);
137
141
  } else {
138
142
  reject();
139
143
  }
140
144
  } else {
141
145
  _loadScript(environment);
142
- _scriptReady(resolve, reject, environment);
146
+ _scriptReady(resolve, reject, environment, attempt);
143
147
  }
144
148
  }
145
149
 
@@ -351,7 +355,10 @@ var KalturaPlayerAPIV7 = /*#__PURE__*/function () {
351
355
  return _ref7.apply(this, arguments);
352
356
  };
353
357
  }();
354
- return legacyPromiseKWidget();
358
+ _embedQueue = _embedQueue.then(function () {
359
+ return legacyPromiseKWidget();
360
+ });
361
+ return _embedQueue;
355
362
  });
356
363
  case 1:
357
364
  return _context3.abrupt("return", _context3.sent);
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.49.0",
4
+ "version": "2.50.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.49.0",
50
+ "@carbon/ibmdotcom-utilities": "2.50.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": "ec99dc47af545a8ebac1c8f10da9d8cdc15cff9b"
92
+ "gitHead": "90004ae02a5848126f877e64512cb6d6464fba18"
93
93
  }