@carbon/ibmdotcom-web-components 2.55.2 → 2.55.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.
- package/dist/dotcom-shell.js +2 -2
- package/dist/dotcom-shell.min.js +2 -2
- package/dist/ibmdotcom-web-components-dotcom-shell.js +2 -2
- package/dist/ibmdotcom-web-components-dotcom-shell.min.js +2 -2
- package/dist/{index-be1f0d99.js → index-5becb925.js} +195 -22
- package/dist/{index-b326a4b8.js → index-9b1155d4.js} +265 -265
- package/dist/{left-nav-menu-9f0d5440.js → left-nav-menu-4a6c5357.js} +2 -2
- package/dist/{left-nav-menu-a8434277.js → left-nav-menu-96dbffa3.js} +2 -2
- package/dist/{left-nav-menu-category-heading-d5ebb582.js → left-nav-menu-category-heading-4eaaa1cb.js} +2 -2
- package/dist/{left-nav-menu-category-heading-0db7fdac.js → left-nav-menu-category-heading-8c2b8ed1.js} +2 -2
- package/dist/{left-nav-menu-item-c52800b2.js → left-nav-menu-item-2919662e.js} +2 -2
- package/dist/{left-nav-menu-item-fdaa0bb7.js → left-nav-menu-item-e3cb7a75.js} +2 -2
- package/dist/{left-nav-menu-section-5d57cc54.js → left-nav-menu-section-3f725e26.js} +2 -2
- package/dist/{left-nav-menu-section-2272b80a.js → left-nav-menu-section-ee8222d1.js} +2 -2
- package/dist/{left-nav-overlay-69843140.js → left-nav-overlay-69df9fd0.js} +2 -2
- package/dist/{left-nav-overlay-ced9c29b.js → left-nav-overlay-eb67d1de.js} +2 -2
- package/dist/{megamenu-category-group-c69fb5d2.js → megamenu-category-group-3f2bfe7c.js} +2 -2
- package/dist/{megamenu-category-group-de1f78af.js → megamenu-category-group-6c76c126.js} +2 -2
- package/dist/{megamenu-category-group-copy-854dcd81.js → megamenu-category-group-copy-2f09fb89.js} +2 -2
- package/dist/{megamenu-category-group-copy-7b95d53d.js → megamenu-category-group-copy-62f21ae2.js} +2 -2
- package/dist/{megamenu-category-heading-9a6fa4b2.js → megamenu-category-heading-32e44d96.js} +2 -2
- package/dist/{megamenu-category-heading-78122438.js → megamenu-category-heading-478cfb1a.js} +2 -2
- package/dist/{megamenu-category-link-531caec6.js → megamenu-category-link-05dee472.js} +2 -2
- package/dist/{megamenu-category-link-8e7e7d24.js → megamenu-category-link-82d0de27.js} +2 -2
- package/dist/{megamenu-category-link-group-a017d5e6.js → megamenu-category-link-group-8099bca4.js} +2 -2
- package/dist/{megamenu-category-link-group-15bba423.js → megamenu-category-link-group-8e7eb5a1.js} +2 -2
- package/dist/{megamenu-left-navigation-df0c2578.js → megamenu-left-navigation-5cea51eb.js} +2 -2
- package/dist/{megamenu-left-navigation-42583912.js → megamenu-left-navigation-946e6ecd.js} +2 -2
- package/dist/{megamenu-overlay-295ba580.js → megamenu-overlay-8b50d36d.js} +2 -2
- package/dist/{megamenu-overlay-49a05565.js → megamenu-overlay-babb56ff.js} +2 -2
- package/dist/{megamenu-tab-7188fba7.js → megamenu-tab-62d05074.js} +2 -2
- package/dist/{megamenu-tab-f667b3bf.js → megamenu-tab-8b71189a.js} +2 -2
- package/es/components/cta/video-cta-container.d.ts +1 -0
- package/es/components/lightbox-media-viewer/lightbox-video-player-container.d.ts +1 -0
- package/es/components/video-player-v7/video-player-composite.d.ts +18 -0
- package/es/components/video-player-v7/video-player-composite.js +136 -7
- package/es/components/video-player-v7/video-player-composite.js.map +1 -1
- package/es/components/video-player-v7/video-player-container.d.ts +20 -0
- package/es/components/video-player-v7/video-player-container.js +63 -10
- package/es/components/video-player-v7/video-player-container.js.map +1 -1
- package/es/internal/vendor/@carbon/ibmdotcom-services/services/KalturaPlayerV7/KalturaPlayer.js +192 -19
- package/lib/internal/vendor/@carbon/ibmdotcom-services/services/KalturaPlayerV7/KalturaPlayer.js +192 -19
- package/package.json +5 -5
package/es/internal/vendor/@carbon/ibmdotcom-services/services/KalturaPlayerV7/KalturaPlayer.js
CHANGED
|
@@ -76,9 +76,19 @@ var _ibmScriptUrl = function _ibmScriptUrl() {
|
|
|
76
76
|
*/
|
|
77
77
|
function _loadScript() {
|
|
78
78
|
var environment = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : _ibmEnvironment;
|
|
79
|
+
// loader.js uses top-level const/let declarations and cannot be safely re-injected
|
|
80
|
+
// into the same page — doing so throws "SyntaxError: Identifier already declared".
|
|
81
|
+
// If a script tag for this URL already exists in the DOM, skip injection and rely
|
|
82
|
+
// on the existing execution to eventually set IBM.Mediacenter.player. We still set
|
|
83
|
+
// the flag to true so _scriptReady stays in polling mode.
|
|
84
|
+
var loaderUrl = _ibmScriptUrl(environment);
|
|
85
|
+
if (document.querySelector("script[src=\"".concat(loaderUrl, "\"]"))) {
|
|
86
|
+
root._ibmKalturaScriptLoading = true;
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
79
89
|
root._ibmKalturaScriptLoading = true;
|
|
80
90
|
var script = document.createElement('script');
|
|
81
|
-
script.src =
|
|
91
|
+
script.src = loaderUrl;
|
|
82
92
|
script.async = true;
|
|
83
93
|
document.body.appendChild(script);
|
|
84
94
|
}
|
|
@@ -91,6 +101,18 @@ function _loadScript() {
|
|
|
91
101
|
*/
|
|
92
102
|
var _timeoutRetries = 50;
|
|
93
103
|
|
|
104
|
+
/**
|
|
105
|
+
* Milliseconds to wait for IBM.Mediacenter.player.embed() to resolve before
|
|
106
|
+
* treating it as a missed-event hang. On cached page loads, loader.js's
|
|
107
|
+
* player-plugin.js can fire its ready event before embed() registers its
|
|
108
|
+
* listener, leaving the returned Promise pending indefinitely. If that
|
|
109
|
+
* happens we reset the loader state and retry from scratch.
|
|
110
|
+
*
|
|
111
|
+
* @type {number}
|
|
112
|
+
* @private
|
|
113
|
+
*/
|
|
114
|
+
var _embedTimeoutMs = 8000;
|
|
115
|
+
|
|
94
116
|
/**
|
|
95
117
|
* Tracks the script loading status. Stored on `root` (window) so the value
|
|
96
118
|
* persists when this module is executed more than once in the same page
|
|
@@ -111,10 +133,69 @@ if (root._ibmKalturaScriptLoading === undefined) {
|
|
|
111
133
|
* not reliably support simultaneous calls for the same entryId, so we chain
|
|
112
134
|
* each call onto the previous one to ensure they run sequentially.
|
|
113
135
|
*
|
|
136
|
+
* Stored on `root` (window) so the value persists when this module is executed
|
|
137
|
+
* more than once in the same page (e.g. once as an async page script and again
|
|
138
|
+
* as a deferred Adobe Target Experience Fragment script). Without this, a second
|
|
139
|
+
* execution resets the queue to Promise.resolve(), breaking serialization and
|
|
140
|
+
* allowing simultaneous embed() calls that hang indefinitely.
|
|
141
|
+
*
|
|
114
142
|
* @type {Promise<any>}
|
|
115
143
|
* @private
|
|
116
144
|
*/
|
|
117
|
-
|
|
145
|
+
if (root._ibmKalturaEmbedQueue === undefined) {
|
|
146
|
+
root._ibmKalturaEmbedQueue = Promise.resolve();
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
/**
|
|
150
|
+
* Installs a one-time Object.defineProperty setter on root.IBM.Mediacenter.player
|
|
151
|
+
* so that resolve() is called SYNCHRONOUSLY the instant loader.js assigns the
|
|
152
|
+
* player object — before player-plugin.js can fire its ready event. This closes
|
|
153
|
+
* the ~100 ms gap that the polling fallback leaves between the assignment and
|
|
154
|
+
* the first poll tick, which was causing embed() to miss the ready event (Bug 2).
|
|
155
|
+
*
|
|
156
|
+
* Falls back to the polling loop (_scriptReady) if defineProperty is not available
|
|
157
|
+
* or if IBM.Mediacenter has already been replaced after the trap was installed.
|
|
158
|
+
*
|
|
159
|
+
* @param {Function} resolve Resolve function
|
|
160
|
+
* @private
|
|
161
|
+
*/
|
|
162
|
+
function _trapPlayerReady(resolve) {
|
|
163
|
+
var _root$IBM, _root$IBM2, _root$IBM3, _root$IBM3$Mediacente;
|
|
164
|
+
// If the player is already set, resolve immediately.
|
|
165
|
+
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) {
|
|
166
|
+
root._ibmKalturaScriptLoading = false;
|
|
167
|
+
resolve();
|
|
168
|
+
return;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
// Ensure the IBM.Mediacenter path exists so we have an object to trap.
|
|
172
|
+
(_root$IBM2 = root.IBM) !== null && _root$IBM2 !== void 0 ? _root$IBM2 : root.IBM = {};
|
|
173
|
+
(_root$IBM3$Mediacente = (_root$IBM3 = root.IBM).Mediacenter) !== null && _root$IBM3$Mediacente !== void 0 ? _root$IBM3$Mediacente : _root$IBM3.Mediacenter = {};
|
|
174
|
+
var mc = root.IBM.Mediacenter;
|
|
175
|
+
var trapped = false;
|
|
176
|
+
try {
|
|
177
|
+
Object.defineProperty(mc, 'player', {
|
|
178
|
+
configurable: true,
|
|
179
|
+
enumerable: true,
|
|
180
|
+
set: function set(value) {
|
|
181
|
+
// Restore as a plain writable property before anything else runs.
|
|
182
|
+
Object.defineProperty(mc, 'player', {
|
|
183
|
+
configurable: true,
|
|
184
|
+
enumerable: true,
|
|
185
|
+
writable: true,
|
|
186
|
+
value: value
|
|
187
|
+
});
|
|
188
|
+
if (!trapped) {
|
|
189
|
+
trapped = true;
|
|
190
|
+
root._ibmKalturaScriptLoading = false;
|
|
191
|
+
resolve();
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
});
|
|
195
|
+
} catch (_e) {
|
|
196
|
+
// defineProperty not supported in this environment — fall through to polling.
|
|
197
|
+
}
|
|
198
|
+
}
|
|
118
199
|
|
|
119
200
|
/**
|
|
120
201
|
* Timeout loop to check script state is the _scriptLoaded state or _scriptLoading state
|
|
@@ -126,13 +207,13 @@ var _embedQueue = Promise.resolve();
|
|
|
126
207
|
* @private
|
|
127
208
|
*/
|
|
128
209
|
function _scriptReady(resolve, reject) {
|
|
129
|
-
var _root$
|
|
210
|
+
var _root$IBM4;
|
|
130
211
|
var environment = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : _ibmEnvironment;
|
|
131
212
|
var attempt = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
|
|
132
213
|
/**
|
|
133
214
|
* @param {object} root?.IBM.Mediacenter.player if exists then resolve
|
|
134
215
|
*/
|
|
135
|
-
if (root !== null && root !== void 0 && (_root$
|
|
216
|
+
if (root !== null && root !== void 0 && (_root$IBM4 = root.IBM) !== null && _root$IBM4 !== void 0 && (_root$IBM4 = _root$IBM4.Mediacenter) !== null && _root$IBM4 !== void 0 && _root$IBM4.player) {
|
|
136
217
|
root._ibmKalturaScriptLoading = false;
|
|
137
218
|
resolve();
|
|
138
219
|
} else if (root._ibmKalturaScriptLoading) {
|
|
@@ -144,8 +225,19 @@ function _scriptReady(resolve, reject) {
|
|
|
144
225
|
reject();
|
|
145
226
|
}
|
|
146
227
|
} else {
|
|
228
|
+
// Install the defineProperty trap BEFORE injecting loader.js so we catch
|
|
229
|
+
// the player assignment synchronously when loader.js sets IBM.Mediacenter.player.
|
|
230
|
+
_trapPlayerReady(resolve, reject);
|
|
147
231
|
_loadScript(environment);
|
|
148
|
-
|
|
232
|
+
// Also poll as a backstop: if IBM.Mediacenter gets replaced wholesale instead
|
|
233
|
+
// of mutated in place, the trap above is orphaned and would never fire.
|
|
234
|
+
if (attempt < _timeoutRetries) {
|
|
235
|
+
setTimeout(function () {
|
|
236
|
+
_scriptReady(resolve, reject, environment, attempt + 1);
|
|
237
|
+
}, 100);
|
|
238
|
+
} else {
|
|
239
|
+
reject();
|
|
240
|
+
}
|
|
149
241
|
}
|
|
150
242
|
}
|
|
151
243
|
|
|
@@ -203,7 +295,7 @@ var KalturaPlayerAPIV7 = /*#__PURE__*/function () {
|
|
|
203
295
|
}, {
|
|
204
296
|
key: "getThumbnailUrl",
|
|
205
297
|
value: function getThumbnailUrl(_ref6) {
|
|
206
|
-
var _root$
|
|
298
|
+
var _root$IBM5;
|
|
207
299
|
var _ref6$mediaId = _ref6.mediaId,
|
|
208
300
|
mediaId = _ref6$mediaId === void 0 ? '' : _ref6$mediaId,
|
|
209
301
|
_ref6$height = _ref6.height,
|
|
@@ -212,7 +304,7 @@ var KalturaPlayerAPIV7 = /*#__PURE__*/function () {
|
|
|
212
304
|
width = _ref6$width === void 0 ? 0 : _ref6$width,
|
|
213
305
|
_ref6$partnerId = _ref6.partnerId,
|
|
214
306
|
partnerId = _ref6$partnerId === void 0 ? _partnerId : _ref6$partnerId;
|
|
215
|
-
return (root === null || root === void 0 || (_root$
|
|
307
|
+
return (root === null || root === void 0 || (_root$IBM5 = root.IBM) === null || _root$IBM5 === void 0 || (_root$IBM5 = _root$IBM5.Mediacenter) === null || _root$IBM5 === void 0 || (_root$IBM5 = _root$IBM5.player) === null || _root$IBM5 === void 0 || (_root$IBM5 = _root$IBM5.api) === null || _root$IBM5 === void 0 ? void 0 : _root$IBM5.getThumbnail(partnerId, mediaId, width, height)) || '';
|
|
216
308
|
}
|
|
217
309
|
|
|
218
310
|
/**
|
|
@@ -243,8 +335,8 @@ var KalturaPlayerAPIV7 = /*#__PURE__*/function () {
|
|
|
243
335
|
partnerId = _args.length > 1 && _args[1] !== undefined ? _args[1] : _partnerId;
|
|
244
336
|
_context.next = 1;
|
|
245
337
|
return this.checkScript().then(function () {
|
|
246
|
-
var _root$
|
|
247
|
-
return (root === null || root === void 0 || (_root$
|
|
338
|
+
var _root$IBM6;
|
|
339
|
+
return (root === null || root === void 0 || (_root$IBM6 = root.IBM) === null || _root$IBM6 === void 0 || (_root$IBM6 = _root$IBM6.Mediacenter) === null || _root$IBM6 === void 0 || (_root$IBM6 = _root$IBM6.player) === null || _root$IBM6 === void 0 || (_root$IBM6 = _root$IBM6.api) === null || _root$IBM6 === void 0 ? void 0 : _root$IBM6.getMediaProperties(partnerId, mediaId)) || {};
|
|
248
340
|
});
|
|
249
341
|
case 1:
|
|
250
342
|
return _context.abrupt("return", _context.sent);
|
|
@@ -297,14 +389,15 @@ var KalturaPlayerAPIV7 = /*#__PURE__*/function () {
|
|
|
297
389
|
return this.checkScript().then(function () {
|
|
298
390
|
var legacyPromiseKWidget = /*#__PURE__*/function () {
|
|
299
391
|
var _ref7 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
|
|
300
|
-
var _configuration$player, _ibmEnvironments$conf, _configuration$
|
|
301
|
-
var playerType, playerEnvironment, playerUiConfId, playerConfiguration, isCustomCreated, newVideoDiv, kalturaPlayer, previousVideoDiv;
|
|
392
|
+
var _configuration$player, _configuration$player2, _ibmEnvironments$conf, _configuration$player3;
|
|
393
|
+
var playerType, envKey, playerEnvironment, playerUiConfId, playerConfiguration, isCustomCreated, newVideoDiv, kalturaPlayer, loaderUrl, loaderAlreadyInjected, _root$IBM7, previousVideoDiv, _t, _t2;
|
|
302
394
|
return _regeneratorRuntime.wrap(function (_context2) {
|
|
303
395
|
while (1) switch (_context2.prev = _context2.next) {
|
|
304
396
|
case 0:
|
|
305
397
|
playerType = (_configuration$player = configuration === null || configuration === void 0 ? void 0 : configuration.playerType) !== null && _configuration$player !== void 0 ? _configuration$player : 'VIDEO';
|
|
398
|
+
envKey = (_configuration$player2 = configuration.playerEnvironment) !== null && _configuration$player2 !== void 0 ? _configuration$player2 : _ibmEnvironment;
|
|
306
399
|
playerEnvironment = (_ibmEnvironments$conf = _ibmEnvironments[configuration.playerEnvironment]) !== null && _ibmEnvironments$conf !== void 0 ? _ibmEnvironments$conf : _ibmEnvironments[_ibmEnvironment];
|
|
307
|
-
playerUiConfId = (_configuration$
|
|
400
|
+
playerUiConfId = (_configuration$player3 = configuration.playerUiConfId) !== null && _configuration$player3 !== void 0 ? _configuration$player3 : _uiConfIds[playerType];
|
|
308
401
|
playerConfiguration = _objectSpread({
|
|
309
402
|
playerType: playerType,
|
|
310
403
|
autoPlay: true,
|
|
@@ -335,32 +428,112 @@ var KalturaPlayerAPIV7 = /*#__PURE__*/function () {
|
|
|
335
428
|
}
|
|
336
429
|
|
|
337
430
|
/**
|
|
338
|
-
* Embed the player and execute custom callback
|
|
431
|
+
* Embed the player and execute custom callback.
|
|
432
|
+
*
|
|
433
|
+
* Wraps embed() with a timeout guard: on cached page loads,
|
|
434
|
+
* loader.js's player-plugin.js may fire its ready event before
|
|
435
|
+
* embed() registers its listener, leaving the Promise pending
|
|
436
|
+
* indefinitely. If the timeout fires we reset the loader state so
|
|
437
|
+
* _scriptReady() re-injects loader.js, giving the plugin a fresh
|
|
438
|
+
* chance to fire its event after the listener is in place.
|
|
339
439
|
*/
|
|
340
|
-
|
|
341
|
-
|
|
440
|
+
// If the target element was removed from the DOM before we get here
|
|
441
|
+
// (e.g. Adobe Target replaced the mbox while embed() was queued),
|
|
442
|
+
// skip the embed entirely so we don't block _embedQueue indefinitely.
|
|
443
|
+
if (document.getElementById(targetId)) {
|
|
444
|
+
_context2.next = 1;
|
|
445
|
+
break;
|
|
446
|
+
}
|
|
447
|
+
return _context2.abrupt("return", null);
|
|
342
448
|
case 1:
|
|
449
|
+
_context2.prev = 1;
|
|
450
|
+
_context2.next = 2;
|
|
451
|
+
return Promise.race([root.IBM.Mediacenter.player.embed(playerConfiguration), new Promise(function (_, reject) {
|
|
452
|
+
return setTimeout(function () {
|
|
453
|
+
return reject(new Error('ibm_embed_timeout'));
|
|
454
|
+
}, _embedTimeoutMs);
|
|
455
|
+
})]);
|
|
456
|
+
case 2:
|
|
457
|
+
kalturaPlayer = _context2.sent;
|
|
458
|
+
_context2.next = 10;
|
|
459
|
+
break;
|
|
460
|
+
case 3:
|
|
461
|
+
_context2.prev = 3;
|
|
462
|
+
_t = _context2["catch"](1);
|
|
463
|
+
if (!((_t === null || _t === void 0 ? void 0 : _t.message) !== 'ibm_embed_timeout')) {
|
|
464
|
+
_context2.next = 4;
|
|
465
|
+
break;
|
|
466
|
+
}
|
|
467
|
+
throw _t;
|
|
468
|
+
case 4:
|
|
469
|
+
// Only perform a full reset (delete player, re-inject loader.js) when
|
|
470
|
+
// the loader has already finished (_ibmKalturaScriptLoading === false)
|
|
471
|
+
// AND loader.js is not yet in the DOM (so re-injection is safe).
|
|
472
|
+
// loader.js uses top-level const/let declarations and crashes with
|
|
473
|
+
// "SyntaxError: Identifier already declared" on a second injection, so
|
|
474
|
+
// we skip the delete+reinject path when it's already present and instead
|
|
475
|
+
// rely on polling to detect when IBM.Mediacenter.player becomes available.
|
|
476
|
+
loaderUrl = _ibmScriptUrl(envKey);
|
|
477
|
+
loaderAlreadyInjected = !!document.querySelector("script[src=\"".concat(loaderUrl, "\"]"));
|
|
478
|
+
if (root._ibmKalturaScriptLoading === false && !loaderAlreadyInjected) {
|
|
479
|
+
root._ibmKalturaScriptLoading = undefined;
|
|
480
|
+
if ((_root$IBM7 = root.IBM) !== null && _root$IBM7 !== void 0 && _root$IBM7.Mediacenter) {
|
|
481
|
+
delete root.IBM.Mediacenter;
|
|
482
|
+
}
|
|
483
|
+
}
|
|
484
|
+
_context2.next = 5;
|
|
485
|
+
return new Promise(function (res, rej) {
|
|
486
|
+
return _scriptReady(res, rej, envKey);
|
|
487
|
+
});
|
|
488
|
+
case 5:
|
|
489
|
+
if (document.getElementById(targetId)) {
|
|
490
|
+
_context2.next = 6;
|
|
491
|
+
break;
|
|
492
|
+
}
|
|
493
|
+
return _context2.abrupt("return", null);
|
|
494
|
+
case 6:
|
|
495
|
+
_context2.prev = 6;
|
|
496
|
+
_context2.next = 7;
|
|
497
|
+
return Promise.race([root.IBM.Mediacenter.player.embed(playerConfiguration), new Promise(function (_, reject) {
|
|
498
|
+
return setTimeout(function () {
|
|
499
|
+
return reject(new Error('ibm_embed_timeout_retry'));
|
|
500
|
+
}, _embedTimeoutMs);
|
|
501
|
+
})]);
|
|
502
|
+
case 7:
|
|
343
503
|
kalturaPlayer = _context2.sent;
|
|
504
|
+
_context2.next = 10;
|
|
505
|
+
break;
|
|
506
|
+
case 8:
|
|
507
|
+
_context2.prev = 8;
|
|
508
|
+
_t2 = _context2["catch"](6);
|
|
509
|
+
if (!((_t2 === null || _t2 === void 0 ? void 0 : _t2.message) !== 'ibm_embed_timeout_retry')) {
|
|
510
|
+
_context2.next = 9;
|
|
511
|
+
break;
|
|
512
|
+
}
|
|
513
|
+
throw _t2;
|
|
514
|
+
case 9:
|
|
515
|
+
return _context2.abrupt("return", null);
|
|
516
|
+
case 10:
|
|
344
517
|
customReadyCallback(kalturaPlayer);
|
|
345
518
|
if (isCustomCreated) {
|
|
346
519
|
previousVideoDiv = document.querySelector('cds-tabs-extended-media').shadowRoot.querySelector(".bx--accordion__item--active cds-video-player").lastChild;
|
|
347
520
|
previousVideoDiv.parentElement.appendChild(document.getElementById(targetId));
|
|
348
521
|
}
|
|
349
522
|
return _context2.abrupt("return", kalturaPlayer);
|
|
350
|
-
case
|
|
523
|
+
case 11:
|
|
351
524
|
case "end":
|
|
352
525
|
return _context2.stop();
|
|
353
526
|
}
|
|
354
|
-
}, _callee2);
|
|
527
|
+
}, _callee2, null, [[1, 3], [6, 8]]);
|
|
355
528
|
}));
|
|
356
529
|
return function legacyPromiseKWidget() {
|
|
357
530
|
return _ref7.apply(this, arguments);
|
|
358
531
|
};
|
|
359
532
|
}();
|
|
360
|
-
|
|
533
|
+
root._ibmKalturaEmbedQueue = root._ibmKalturaEmbedQueue.catch(function () {}).then(function () {
|
|
361
534
|
return legacyPromiseKWidget();
|
|
362
535
|
});
|
|
363
|
-
return
|
|
536
|
+
return root._ibmKalturaEmbedQueue;
|
|
364
537
|
});
|
|
365
538
|
case 1:
|
|
366
539
|
return _context3.abrupt("return", _context3.sent);
|
package/lib/internal/vendor/@carbon/ibmdotcom-services/services/KalturaPlayerV7/KalturaPlayer.js
CHANGED
|
@@ -81,9 +81,19 @@ var _ibmScriptUrl = function _ibmScriptUrl() {
|
|
|
81
81
|
*/
|
|
82
82
|
function _loadScript() {
|
|
83
83
|
var environment = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : _ibmEnvironment;
|
|
84
|
+
// loader.js uses top-level const/let declarations and cannot be safely re-injected
|
|
85
|
+
// into the same page — doing so throws "SyntaxError: Identifier already declared".
|
|
86
|
+
// If a script tag for this URL already exists in the DOM, skip injection and rely
|
|
87
|
+
// on the existing execution to eventually set IBM.Mediacenter.player. We still set
|
|
88
|
+
// the flag to true so _scriptReady stays in polling mode.
|
|
89
|
+
var loaderUrl = _ibmScriptUrl(environment);
|
|
90
|
+
if (document.querySelector("script[src=\"".concat(loaderUrl, "\"]"))) {
|
|
91
|
+
_windowOrGlobal.default._ibmKalturaScriptLoading = true;
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
84
94
|
_windowOrGlobal.default._ibmKalturaScriptLoading = true;
|
|
85
95
|
var script = document.createElement('script');
|
|
86
|
-
script.src =
|
|
96
|
+
script.src = loaderUrl;
|
|
87
97
|
script.async = true;
|
|
88
98
|
document.body.appendChild(script);
|
|
89
99
|
}
|
|
@@ -96,6 +106,18 @@ function _loadScript() {
|
|
|
96
106
|
*/
|
|
97
107
|
var _timeoutRetries = 50;
|
|
98
108
|
|
|
109
|
+
/**
|
|
110
|
+
* Milliseconds to wait for IBM.Mediacenter.player.embed() to resolve before
|
|
111
|
+
* treating it as a missed-event hang. On cached page loads, loader.js's
|
|
112
|
+
* player-plugin.js can fire its ready event before embed() registers its
|
|
113
|
+
* listener, leaving the returned Promise pending indefinitely. If that
|
|
114
|
+
* happens we reset the loader state and retry from scratch.
|
|
115
|
+
*
|
|
116
|
+
* @type {number}
|
|
117
|
+
* @private
|
|
118
|
+
*/
|
|
119
|
+
var _embedTimeoutMs = 8000;
|
|
120
|
+
|
|
99
121
|
/**
|
|
100
122
|
* Tracks the script loading status. Stored on `root` (window) so the value
|
|
101
123
|
* persists when this module is executed more than once in the same page
|
|
@@ -116,10 +138,69 @@ if (_windowOrGlobal.default._ibmKalturaScriptLoading === undefined) {
|
|
|
116
138
|
* not reliably support simultaneous calls for the same entryId, so we chain
|
|
117
139
|
* each call onto the previous one to ensure they run sequentially.
|
|
118
140
|
*
|
|
141
|
+
* Stored on `root` (window) so the value persists when this module is executed
|
|
142
|
+
* more than once in the same page (e.g. once as an async page script and again
|
|
143
|
+
* as a deferred Adobe Target Experience Fragment script). Without this, a second
|
|
144
|
+
* execution resets the queue to Promise.resolve(), breaking serialization and
|
|
145
|
+
* allowing simultaneous embed() calls that hang indefinitely.
|
|
146
|
+
*
|
|
119
147
|
* @type {Promise<any>}
|
|
120
148
|
* @private
|
|
121
149
|
*/
|
|
122
|
-
|
|
150
|
+
if (_windowOrGlobal.default._ibmKalturaEmbedQueue === undefined) {
|
|
151
|
+
_windowOrGlobal.default._ibmKalturaEmbedQueue = Promise.resolve();
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
/**
|
|
155
|
+
* Installs a one-time Object.defineProperty setter on root.IBM.Mediacenter.player
|
|
156
|
+
* so that resolve() is called SYNCHRONOUSLY the instant loader.js assigns the
|
|
157
|
+
* player object — before player-plugin.js can fire its ready event. This closes
|
|
158
|
+
* the ~100 ms gap that the polling fallback leaves between the assignment and
|
|
159
|
+
* the first poll tick, which was causing embed() to miss the ready event (Bug 2).
|
|
160
|
+
*
|
|
161
|
+
* Falls back to the polling loop (_scriptReady) if defineProperty is not available
|
|
162
|
+
* or if IBM.Mediacenter has already been replaced after the trap was installed.
|
|
163
|
+
*
|
|
164
|
+
* @param {Function} resolve Resolve function
|
|
165
|
+
* @private
|
|
166
|
+
*/
|
|
167
|
+
function _trapPlayerReady(resolve) {
|
|
168
|
+
var _root$IBM, _root$IBM2, _root$IBM3, _root$IBM3$Mediacente;
|
|
169
|
+
// If the player is already set, resolve immediately.
|
|
170
|
+
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) {
|
|
171
|
+
_windowOrGlobal.default._ibmKalturaScriptLoading = false;
|
|
172
|
+
resolve();
|
|
173
|
+
return;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
// Ensure the IBM.Mediacenter path exists so we have an object to trap.
|
|
177
|
+
(_root$IBM2 = _windowOrGlobal.default.IBM) !== null && _root$IBM2 !== void 0 ? _root$IBM2 : _windowOrGlobal.default.IBM = {};
|
|
178
|
+
(_root$IBM3$Mediacente = (_root$IBM3 = _windowOrGlobal.default.IBM).Mediacenter) !== null && _root$IBM3$Mediacente !== void 0 ? _root$IBM3$Mediacente : _root$IBM3.Mediacenter = {};
|
|
179
|
+
var mc = _windowOrGlobal.default.IBM.Mediacenter;
|
|
180
|
+
var trapped = false;
|
|
181
|
+
try {
|
|
182
|
+
Object.defineProperty(mc, 'player', {
|
|
183
|
+
configurable: true,
|
|
184
|
+
enumerable: true,
|
|
185
|
+
set: function set(value) {
|
|
186
|
+
// Restore as a plain writable property before anything else runs.
|
|
187
|
+
Object.defineProperty(mc, 'player', {
|
|
188
|
+
configurable: true,
|
|
189
|
+
enumerable: true,
|
|
190
|
+
writable: true,
|
|
191
|
+
value: value
|
|
192
|
+
});
|
|
193
|
+
if (!trapped) {
|
|
194
|
+
trapped = true;
|
|
195
|
+
_windowOrGlobal.default._ibmKalturaScriptLoading = false;
|
|
196
|
+
resolve();
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
});
|
|
200
|
+
} catch (_e) {
|
|
201
|
+
// defineProperty not supported in this environment — fall through to polling.
|
|
202
|
+
}
|
|
203
|
+
}
|
|
123
204
|
|
|
124
205
|
/**
|
|
125
206
|
* Timeout loop to check script state is the _scriptLoaded state or _scriptLoading state
|
|
@@ -131,13 +212,13 @@ var _embedQueue = Promise.resolve();
|
|
|
131
212
|
* @private
|
|
132
213
|
*/
|
|
133
214
|
function _scriptReady(resolve, reject) {
|
|
134
|
-
var _root$
|
|
215
|
+
var _root$IBM4;
|
|
135
216
|
var environment = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : _ibmEnvironment;
|
|
136
217
|
var attempt = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
|
|
137
218
|
/**
|
|
138
219
|
* @param {object} root?.IBM.Mediacenter.player if exists then resolve
|
|
139
220
|
*/
|
|
140
|
-
if (_windowOrGlobal.default !== null && _windowOrGlobal.default !== void 0 && (_root$
|
|
221
|
+
if (_windowOrGlobal.default !== null && _windowOrGlobal.default !== void 0 && (_root$IBM4 = _windowOrGlobal.default.IBM) !== null && _root$IBM4 !== void 0 && (_root$IBM4 = _root$IBM4.Mediacenter) !== null && _root$IBM4 !== void 0 && _root$IBM4.player) {
|
|
141
222
|
_windowOrGlobal.default._ibmKalturaScriptLoading = false;
|
|
142
223
|
resolve();
|
|
143
224
|
} else if (_windowOrGlobal.default._ibmKalturaScriptLoading) {
|
|
@@ -149,8 +230,19 @@ function _scriptReady(resolve, reject) {
|
|
|
149
230
|
reject();
|
|
150
231
|
}
|
|
151
232
|
} else {
|
|
233
|
+
// Install the defineProperty trap BEFORE injecting loader.js so we catch
|
|
234
|
+
// the player assignment synchronously when loader.js sets IBM.Mediacenter.player.
|
|
235
|
+
_trapPlayerReady(resolve, reject);
|
|
152
236
|
_loadScript(environment);
|
|
153
|
-
|
|
237
|
+
// Also poll as a backstop: if IBM.Mediacenter gets replaced wholesale instead
|
|
238
|
+
// of mutated in place, the trap above is orphaned and would never fire.
|
|
239
|
+
if (attempt < _timeoutRetries) {
|
|
240
|
+
setTimeout(function () {
|
|
241
|
+
_scriptReady(resolve, reject, environment, attempt + 1);
|
|
242
|
+
}, 100);
|
|
243
|
+
} else {
|
|
244
|
+
reject();
|
|
245
|
+
}
|
|
154
246
|
}
|
|
155
247
|
}
|
|
156
248
|
|
|
@@ -208,7 +300,7 @@ var KalturaPlayerAPIV7 = /*#__PURE__*/function () {
|
|
|
208
300
|
}, {
|
|
209
301
|
key: "getThumbnailUrl",
|
|
210
302
|
value: function getThumbnailUrl(_ref6) {
|
|
211
|
-
var _root$
|
|
303
|
+
var _root$IBM5;
|
|
212
304
|
var _ref6$mediaId = _ref6.mediaId,
|
|
213
305
|
mediaId = _ref6$mediaId === void 0 ? '' : _ref6$mediaId,
|
|
214
306
|
_ref6$height = _ref6.height,
|
|
@@ -217,7 +309,7 @@ var KalturaPlayerAPIV7 = /*#__PURE__*/function () {
|
|
|
217
309
|
width = _ref6$width === void 0 ? 0 : _ref6$width,
|
|
218
310
|
_ref6$partnerId = _ref6.partnerId,
|
|
219
311
|
partnerId = _ref6$partnerId === void 0 ? _partnerId : _ref6$partnerId;
|
|
220
|
-
return (_windowOrGlobal.default === null || _windowOrGlobal.default === void 0 || (_root$
|
|
312
|
+
return (_windowOrGlobal.default === null || _windowOrGlobal.default === void 0 || (_root$IBM5 = _windowOrGlobal.default.IBM) === null || _root$IBM5 === void 0 || (_root$IBM5 = _root$IBM5.Mediacenter) === null || _root$IBM5 === void 0 || (_root$IBM5 = _root$IBM5.player) === null || _root$IBM5 === void 0 || (_root$IBM5 = _root$IBM5.api) === null || _root$IBM5 === void 0 ? void 0 : _root$IBM5.getThumbnail(partnerId, mediaId, width, height)) || '';
|
|
221
313
|
}
|
|
222
314
|
|
|
223
315
|
/**
|
|
@@ -248,8 +340,8 @@ var KalturaPlayerAPIV7 = /*#__PURE__*/function () {
|
|
|
248
340
|
partnerId = _args.length > 1 && _args[1] !== undefined ? _args[1] : _partnerId;
|
|
249
341
|
_context.next = 1;
|
|
250
342
|
return this.checkScript().then(function () {
|
|
251
|
-
var _root$
|
|
252
|
-
return (_windowOrGlobal.default === null || _windowOrGlobal.default === void 0 || (_root$
|
|
343
|
+
var _root$IBM6;
|
|
344
|
+
return (_windowOrGlobal.default === null || _windowOrGlobal.default === void 0 || (_root$IBM6 = _windowOrGlobal.default.IBM) === null || _root$IBM6 === void 0 || (_root$IBM6 = _root$IBM6.Mediacenter) === null || _root$IBM6 === void 0 || (_root$IBM6 = _root$IBM6.player) === null || _root$IBM6 === void 0 || (_root$IBM6 = _root$IBM6.api) === null || _root$IBM6 === void 0 ? void 0 : _root$IBM6.getMediaProperties(partnerId, mediaId)) || {};
|
|
253
345
|
});
|
|
254
346
|
case 1:
|
|
255
347
|
return _context.abrupt("return", _context.sent);
|
|
@@ -302,14 +394,15 @@ var KalturaPlayerAPIV7 = /*#__PURE__*/function () {
|
|
|
302
394
|
return this.checkScript().then(function () {
|
|
303
395
|
var legacyPromiseKWidget = /*#__PURE__*/function () {
|
|
304
396
|
var _ref7 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee2() {
|
|
305
|
-
var _configuration$player, _ibmEnvironments$conf, _configuration$
|
|
306
|
-
var playerType, playerEnvironment, playerUiConfId, playerConfiguration, isCustomCreated, newVideoDiv, kalturaPlayer, previousVideoDiv;
|
|
397
|
+
var _configuration$player, _configuration$player2, _ibmEnvironments$conf, _configuration$player3;
|
|
398
|
+
var playerType, envKey, playerEnvironment, playerUiConfId, playerConfiguration, isCustomCreated, newVideoDiv, kalturaPlayer, loaderUrl, loaderAlreadyInjected, _root$IBM7, previousVideoDiv, _t, _t2;
|
|
307
399
|
return _regenerator.default.wrap(function (_context2) {
|
|
308
400
|
while (1) switch (_context2.prev = _context2.next) {
|
|
309
401
|
case 0:
|
|
310
402
|
playerType = (_configuration$player = configuration === null || configuration === void 0 ? void 0 : configuration.playerType) !== null && _configuration$player !== void 0 ? _configuration$player : 'VIDEO';
|
|
403
|
+
envKey = (_configuration$player2 = configuration.playerEnvironment) !== null && _configuration$player2 !== void 0 ? _configuration$player2 : _ibmEnvironment;
|
|
311
404
|
playerEnvironment = (_ibmEnvironments$conf = _ibmEnvironments[configuration.playerEnvironment]) !== null && _ibmEnvironments$conf !== void 0 ? _ibmEnvironments$conf : _ibmEnvironments[_ibmEnvironment];
|
|
312
|
-
playerUiConfId = (_configuration$
|
|
405
|
+
playerUiConfId = (_configuration$player3 = configuration.playerUiConfId) !== null && _configuration$player3 !== void 0 ? _configuration$player3 : _uiConfIds[playerType];
|
|
313
406
|
playerConfiguration = _objectSpread({
|
|
314
407
|
playerType: playerType,
|
|
315
408
|
autoPlay: true,
|
|
@@ -340,32 +433,112 @@ var KalturaPlayerAPIV7 = /*#__PURE__*/function () {
|
|
|
340
433
|
}
|
|
341
434
|
|
|
342
435
|
/**
|
|
343
|
-
* Embed the player and execute custom callback
|
|
436
|
+
* Embed the player and execute custom callback.
|
|
437
|
+
*
|
|
438
|
+
* Wraps embed() with a timeout guard: on cached page loads,
|
|
439
|
+
* loader.js's player-plugin.js may fire its ready event before
|
|
440
|
+
* embed() registers its listener, leaving the Promise pending
|
|
441
|
+
* indefinitely. If the timeout fires we reset the loader state so
|
|
442
|
+
* _scriptReady() re-injects loader.js, giving the plugin a fresh
|
|
443
|
+
* chance to fire its event after the listener is in place.
|
|
344
444
|
*/
|
|
345
|
-
|
|
346
|
-
|
|
445
|
+
// If the target element was removed from the DOM before we get here
|
|
446
|
+
// (e.g. Adobe Target replaced the mbox while embed() was queued),
|
|
447
|
+
// skip the embed entirely so we don't block _embedQueue indefinitely.
|
|
448
|
+
if (document.getElementById(targetId)) {
|
|
449
|
+
_context2.next = 1;
|
|
450
|
+
break;
|
|
451
|
+
}
|
|
452
|
+
return _context2.abrupt("return", null);
|
|
347
453
|
case 1:
|
|
454
|
+
_context2.prev = 1;
|
|
455
|
+
_context2.next = 2;
|
|
456
|
+
return Promise.race([_windowOrGlobal.default.IBM.Mediacenter.player.embed(playerConfiguration), new Promise(function (_, reject) {
|
|
457
|
+
return setTimeout(function () {
|
|
458
|
+
return reject(new Error('ibm_embed_timeout'));
|
|
459
|
+
}, _embedTimeoutMs);
|
|
460
|
+
})]);
|
|
461
|
+
case 2:
|
|
462
|
+
kalturaPlayer = _context2.sent;
|
|
463
|
+
_context2.next = 10;
|
|
464
|
+
break;
|
|
465
|
+
case 3:
|
|
466
|
+
_context2.prev = 3;
|
|
467
|
+
_t = _context2["catch"](1);
|
|
468
|
+
if (!((_t === null || _t === void 0 ? void 0 : _t.message) !== 'ibm_embed_timeout')) {
|
|
469
|
+
_context2.next = 4;
|
|
470
|
+
break;
|
|
471
|
+
}
|
|
472
|
+
throw _t;
|
|
473
|
+
case 4:
|
|
474
|
+
// Only perform a full reset (delete player, re-inject loader.js) when
|
|
475
|
+
// the loader has already finished (_ibmKalturaScriptLoading === false)
|
|
476
|
+
// AND loader.js is not yet in the DOM (so re-injection is safe).
|
|
477
|
+
// loader.js uses top-level const/let declarations and crashes with
|
|
478
|
+
// "SyntaxError: Identifier already declared" on a second injection, so
|
|
479
|
+
// we skip the delete+reinject path when it's already present and instead
|
|
480
|
+
// rely on polling to detect when IBM.Mediacenter.player becomes available.
|
|
481
|
+
loaderUrl = _ibmScriptUrl(envKey);
|
|
482
|
+
loaderAlreadyInjected = !!document.querySelector("script[src=\"".concat(loaderUrl, "\"]"));
|
|
483
|
+
if (_windowOrGlobal.default._ibmKalturaScriptLoading === false && !loaderAlreadyInjected) {
|
|
484
|
+
_windowOrGlobal.default._ibmKalturaScriptLoading = undefined;
|
|
485
|
+
if ((_root$IBM7 = _windowOrGlobal.default.IBM) !== null && _root$IBM7 !== void 0 && _root$IBM7.Mediacenter) {
|
|
486
|
+
delete _windowOrGlobal.default.IBM.Mediacenter;
|
|
487
|
+
}
|
|
488
|
+
}
|
|
489
|
+
_context2.next = 5;
|
|
490
|
+
return new Promise(function (res, rej) {
|
|
491
|
+
return _scriptReady(res, rej, envKey);
|
|
492
|
+
});
|
|
493
|
+
case 5:
|
|
494
|
+
if (document.getElementById(targetId)) {
|
|
495
|
+
_context2.next = 6;
|
|
496
|
+
break;
|
|
497
|
+
}
|
|
498
|
+
return _context2.abrupt("return", null);
|
|
499
|
+
case 6:
|
|
500
|
+
_context2.prev = 6;
|
|
501
|
+
_context2.next = 7;
|
|
502
|
+
return Promise.race([_windowOrGlobal.default.IBM.Mediacenter.player.embed(playerConfiguration), new Promise(function (_, reject) {
|
|
503
|
+
return setTimeout(function () {
|
|
504
|
+
return reject(new Error('ibm_embed_timeout_retry'));
|
|
505
|
+
}, _embedTimeoutMs);
|
|
506
|
+
})]);
|
|
507
|
+
case 7:
|
|
348
508
|
kalturaPlayer = _context2.sent;
|
|
509
|
+
_context2.next = 10;
|
|
510
|
+
break;
|
|
511
|
+
case 8:
|
|
512
|
+
_context2.prev = 8;
|
|
513
|
+
_t2 = _context2["catch"](6);
|
|
514
|
+
if (!((_t2 === null || _t2 === void 0 ? void 0 : _t2.message) !== 'ibm_embed_timeout_retry')) {
|
|
515
|
+
_context2.next = 9;
|
|
516
|
+
break;
|
|
517
|
+
}
|
|
518
|
+
throw _t2;
|
|
519
|
+
case 9:
|
|
520
|
+
return _context2.abrupt("return", null);
|
|
521
|
+
case 10:
|
|
349
522
|
customReadyCallback(kalturaPlayer);
|
|
350
523
|
if (isCustomCreated) {
|
|
351
524
|
previousVideoDiv = document.querySelector('cds-tabs-extended-media').shadowRoot.querySelector(".bx--accordion__item--active cds-video-player").lastChild;
|
|
352
525
|
previousVideoDiv.parentElement.appendChild(document.getElementById(targetId));
|
|
353
526
|
}
|
|
354
527
|
return _context2.abrupt("return", kalturaPlayer);
|
|
355
|
-
case
|
|
528
|
+
case 11:
|
|
356
529
|
case "end":
|
|
357
530
|
return _context2.stop();
|
|
358
531
|
}
|
|
359
|
-
}, _callee2);
|
|
532
|
+
}, _callee2, null, [[1, 3], [6, 8]]);
|
|
360
533
|
}));
|
|
361
534
|
return function legacyPromiseKWidget() {
|
|
362
535
|
return _ref7.apply(this, arguments);
|
|
363
536
|
};
|
|
364
537
|
}();
|
|
365
|
-
|
|
538
|
+
_windowOrGlobal.default._ibmKalturaEmbedQueue = _windowOrGlobal.default._ibmKalturaEmbedQueue.catch(function () {}).then(function () {
|
|
366
539
|
return legacyPromiseKWidget();
|
|
367
540
|
});
|
|
368
|
-
return
|
|
541
|
+
return _windowOrGlobal.default._ibmKalturaEmbedQueue;
|
|
369
542
|
});
|
|
370
543
|
case 1:
|
|
371
544
|
return _context3.abrupt("return", _context3.sent);
|