@carbon/ibmdotcom-web-components 2.55.1 → 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 +1 -1
- package/dist/dotcom-shell.min.js +1 -1
- package/dist/ibmdotcom-web-components-dotcom-shell.js +1 -1
- package/dist/ibmdotcom-web-components-dotcom-shell.min.js +1 -1
- package/dist/{index-b430b0ae.js → index-5becb925.js} +195 -22
- package/dist/{index-7a169f38.js → index-9b1155d4.js} +265 -265
- package/dist/{left-nav-menu-8c8dd8f6.js → left-nav-menu-4a6c5357.js} +1 -1
- package/dist/{left-nav-menu-f4e37cd0.js → left-nav-menu-96dbffa3.js} +1 -1
- package/dist/{left-nav-menu-category-heading-5327ae32.js → left-nav-menu-category-heading-4eaaa1cb.js} +1 -1
- package/dist/{left-nav-menu-category-heading-bd361f31.js → left-nav-menu-category-heading-8c2b8ed1.js} +1 -1
- package/dist/{left-nav-menu-item-0e1fd732.js → left-nav-menu-item-2919662e.js} +1 -1
- package/dist/{left-nav-menu-item-57370ce4.js → left-nav-menu-item-e3cb7a75.js} +1 -1
- package/dist/{left-nav-menu-section-87419045.js → left-nav-menu-section-3f725e26.js} +1 -1
- package/dist/{left-nav-menu-section-c8f7f7b2.js → left-nav-menu-section-ee8222d1.js} +1 -1
- package/dist/{left-nav-overlay-24894419.js → left-nav-overlay-69df9fd0.js} +1 -1
- package/dist/{left-nav-overlay-dfd13a09.js → left-nav-overlay-eb67d1de.js} +1 -1
- package/dist/{megamenu-category-group-f8e3a37e.js → megamenu-category-group-3f2bfe7c.js} +1 -1
- package/dist/{megamenu-category-group-f1604a05.js → megamenu-category-group-6c76c126.js} +1 -1
- package/dist/{megamenu-category-group-copy-27038d51.js → megamenu-category-group-copy-2f09fb89.js} +1 -1
- package/dist/{megamenu-category-group-copy-32dbffb9.js → megamenu-category-group-copy-62f21ae2.js} +1 -1
- package/dist/{megamenu-category-heading-217fdbb3.js → megamenu-category-heading-32e44d96.js} +1 -1
- package/dist/{megamenu-category-heading-7329423a.js → megamenu-category-heading-478cfb1a.js} +1 -1
- package/dist/{megamenu-category-link-8eb1e240.js → megamenu-category-link-05dee472.js} +1 -1
- package/dist/{megamenu-category-link-b50a0ba1.js → megamenu-category-link-82d0de27.js} +1 -1
- package/dist/{megamenu-category-link-group-cb65ec0f.js → megamenu-category-link-group-8099bca4.js} +1 -1
- package/dist/{megamenu-category-link-group-29472273.js → megamenu-category-link-group-8e7eb5a1.js} +1 -1
- package/dist/{megamenu-left-navigation-f1a8beee.js → megamenu-left-navigation-5cea51eb.js} +1 -1
- package/dist/{megamenu-left-navigation-e1b82079.js → megamenu-left-navigation-946e6ecd.js} +1 -1
- package/dist/{megamenu-overlay-6936cfe6.js → megamenu-overlay-8b50d36d.js} +1 -1
- package/dist/{megamenu-overlay-65c1352d.js → megamenu-overlay-babb56ff.js} +1 -1
- package/dist/{megamenu-tab-1870d088.js → megamenu-tab-62d05074.js} +1 -1
- package/dist/{megamenu-tab-4a5b3184.js → megamenu-tab-8b71189a.js} +1 -1
- 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/pricing-table/pricing-table.css.js +1 -1
- 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/icons/IBM-8bar-logo--h65-white.js +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
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"video-player-container.js","names":["bindActionCreators","property","KalturaPlayerAPI","settings","store","loadMediaData","ConnectMixin","StableSelectorMixin","C4DVideoPlayerComposite","carbonElement","customElement","LocaleAPI","stablePrefix","c4dPrefix","mapStateToProps","state","kalturaPlayerAPI","mediaData","mapDispatchToProps","dispatch","_loadVideoData","C4DVideoPlayerContainerMixin","Base","C4DVideoPlayerContainerMixinImpl","_decorate","_initialize","_StableSelectorMixin","constructor","args","F","d","kind","key","value","decorators","type","String","attribute","_captureCTA","ctaElement","querySelector","parentNode","removeChild","_returnCTA","appendChild","_setRequestEmbedVideoInProgress","videoId","request","_requestsEmbedVideo","oldRequestsEmbedVideo","_objectSpread","_setErrorRequestEmbedVideo","error","Promise","reject","_setEmbeddedVideo","kalturaPlayer","resolve","embeddedVideos","oldEmbeddedVideos","_setAutoplayPreference","preference","updatedValue","localStorage","setItem","prefersAutoplayStorageKey","_getAutoplayPreference","storedValue","getItem","window","matchMedia","matches","Boolean","parseInt","_getPlayerOptions","backgroundMode","intersectionMode","autoPlay","muted","mediaTitle","lc","toLowerCase","playerOptions","autoplayPreference","playerMode","loop","playerType","_embedVideoImpl","_getElementById","doc","Object","prototype","hasOwnProperty","call","getRootNode","ownerDocument","playerId","Math","random","toString","slice","div","document","createElement","id","className","_videoPlayer","videoPlayer","TypeError","embedVideoHandle","embedMedia","width","height","api","style","setProperty","getElementById","dataset","videoEmbed","firstElementChild","focus","preventScroll","requestsEmbedVideo","requestEmbedVideo","promiseEmbedVideo","firstUpdated","requestAnimationFrame","_this$querySelector","button","shadowRoot","getAttribute","setAttribute","transposeAttributes","getLocale","C4DVideoPlayerContainer","_initialize2","_ConnectMixin"],"sources":["components/video-player-v7/video-player-container.ts"],"sourcesContent":["/**\n * @license\n *\n * Copyright IBM Corp. 2020, 2025\n *\n * This source code is licensed under the Apache-2.0 license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nimport {\n ActionCreatorsMapObject,\n Dispatch,\n Store,\n bindActionCreators,\n} from 'redux';\nimport {} from 'lit';\nimport { property } from 'lit/decorators.js';\nimport KalturaPlayerAPI from '@carbon/ibmdotcom-services/es/services/KalturaPlayerV7/KalturaPlayer.js';\nimport settings from '@carbon/ibmdotcom-utilities/es/utilities/settings/settings.js';\nimport store from '../../internal/vendor/@carbon/ibmdotcom-services-store/store.js';\nimport {\n MediaData,\n MediaPlayerAPIState,\n} from '../../internal/vendor/@carbon/ibmdotcom-services-store/types/kalturaPlayerAPIv7';\nimport { loadMediaData } from '../../internal/vendor/@carbon/ibmdotcom-services-store/actions/kalturaPlayerAPIv7.js';\nimport { MediaPlayerAPIActions } from '../../internal/vendor/@carbon/ibmdotcom-services-store/actions/kalturaPlayerAPIv7';\nimport { Constructor } from '../../globals/defs';\nimport ConnectMixin from '../../globals/mixins/connect';\nimport StableSelectorMixin from '../../globals/mixins/stable-selector';\nimport C4DVideoPlayerComposite from './video-player-composite';\nimport { carbonElement as customElement } from '@carbon/web-components/es/globals/decorators/carbon-element.js';\nimport { LocaleAPI } from '@carbon/ibmdotcom-services/es/services/Locale/index';\n\nconst { stablePrefix: c4dPrefix } = settings;\n\n/**\n * The Redux state used for `<c4d-video-player-container-v7>`.\n */\nexport interface VideoPlayerContainerState {\n /**\n * The Redux state for `KalturaPlayerAPI`.\n */\n kalturaPlayerAPI?: MediaPlayerAPIState;\n}\n\n/**\n * The properties for `<c4d-video-player-container-v7>` from Redux state.\n */\nexport interface VideoPlayerContainerStateProps {\n /**\n * The video data, keyed by the video ID.\n */\n mediaData?: { [videoId: string]: MediaData };\n}\n\nexport type VideoPlayerActions = ReturnType<typeof loadMediaData>;\n\n/**\n * @param state The Redux state for video player.\n * @returns The converted version of the given state, tailored for `<c4d-video-player-container-v7>`.\n */\nexport function mapStateToProps(\n state: VideoPlayerContainerState\n): VideoPlayerContainerStateProps {\n const { kalturaPlayerAPI } = state;\n const { mediaData } = kalturaPlayerAPI ?? {};\n return !mediaData ? {} : { mediaData };\n}\n\n/**\n * @param dispatch The Redux `dispatch()` API.\n * @returns The methods in `<c4d-video-player-container-v7>` to dispatch Redux actions.\n */\nexport function mapDispatchToProps(dispatch: Dispatch<MediaPlayerAPIActions>) {\n return bindActionCreators<\n VideoPlayerActions,\n ActionCreatorsMapObject<VideoPlayerActions>\n >(\n {\n _loadVideoData: loadMediaData,\n },\n dispatch as Dispatch // TS definition of `bindActionCreators()` seems to have no templated `Dispatch`\n );\n}\n\n/**\n * @param Base The base class.\n * @returns A mix-in that implements video embedding API calls.\n */\nexport const C4DVideoPlayerContainerMixin = <\n T extends Constructor<HTMLElement>\n>(\n Base: T\n) => {\n /**\n * A mix-in class that sets up and cleans up event listeners defined by `@HostListener` decorator.\n */\n abstract class C4DVideoPlayerContainerMixinImpl extends StableSelectorMixin(\n Base\n ) {\n /**\n * The video player.\n */\n abstract _videoPlayer?: HTMLElement;\n\n /**\n * The embedded Kaltura player element (that has APIs), keyed by the video ID.\n */\n abstract embeddedVideos?: { [videoId: string]: any };\n\n /**\n * The request for the embedded Kaltura player element (that has APIs), keyed by the video ID.\n *\n * @protected\n */\n // Not using TypeScript `private` due to: microsoft/TypeScript#17744\n _requestsEmbedVideo: { [videoId: string]: Promise<any> } = {};\n\n /**\n * Custom video name\n */\n @property({ type: String, attribute: 'customvideoname' })\n customVideoName = '';\n\n /**\n * Language code\n */\n @property()\n lc = '';\n\n /**\n * Stored CTA element for forwarding to lightbox\n */\n @property({ attribute: false })\n ctaElement?: HTMLElement | null;\n\n /**\n * Captures and removes the CTA element from light DOM\n * @returns The captured CTA element or null\n */\n _captureCTA(): HTMLElement | null {\n const ctaElement = this.querySelector('[slot=\"cta\"]');\n if (ctaElement && ctaElement.parentNode) {\n this.ctaElement = ctaElement.parentNode.removeChild(\n ctaElement\n ) as HTMLElement;\n return this.ctaElement;\n }\n return null;\n }\n\n /**\n * Returns the CTA element to the container\n */\n _returnCTA(): void {\n if (this.ctaElement) {\n this.appendChild(this.ctaElement);\n }\n }\n\n /**\n * Sets the state that the API call for embedding the video for the given video ID is in progress.\n *\n * @param videoId The video ID.\n * @param request The promise of the API call for embedding the video of the given video ID that is in progress.\n * @private\n */\n // Not using TypeScript `private` due to: microsoft/TypeScript#17744\n _setRequestEmbedVideoInProgress(videoId: string, request: Promise<any>) {\n const { _requestsEmbedVideo: oldRequestsEmbedVideo } = this;\n this._requestsEmbedVideo = {\n ...oldRequestsEmbedVideo,\n [videoId]: request,\n };\n }\n\n /**\n * Set the state that the API call for embedding the video for the given video ID is failed.\n *\n * @param videoId The video ID.\n * @param error An error from the API call for embedding the video of the given video ID.\n * @private\n */\n // Not using TypeScript `private` due to: microsoft/TypeScript#17744\n _setErrorRequestEmbedVideo(videoId: string, error: Error) {\n this._setRequestEmbedVideoInProgress(videoId, Promise.reject(error));\n }\n\n /**\n * Sets the given embedded Kaltura player element (that has APIs) for the given video ID.\n *\n * @param videoId The video ID.\n * @param kalturaPlayer The embedded Kaltura player element (that has APIs).\n * @private\n */\n // Not using TypeScript `private` due to: microsoft/TypeScript#17744\n _setEmbeddedVideo(videoId: string, kalturaPlayer: any) {\n this._setRequestEmbedVideoInProgress(\n videoId,\n Promise.resolve(kalturaPlayer)\n );\n const { embeddedVideos: oldEmbeddedVideos } = this;\n this.embeddedVideos = {\n ...oldEmbeddedVideos,\n [videoId]: kalturaPlayer,\n };\n }\n\n _setAutoplayPreference(preference: boolean) {\n const updatedValue = preference ? '1' : '0';\n localStorage.setItem(`${this.prefersAutoplayStorageKey}`, updatedValue);\n }\n\n _getAutoplayPreference() {\n const storedValue = localStorage.getItem(\n `${this.prefersAutoplayStorageKey}`\n );\n\n if (storedValue === null) {\n return !window.matchMedia('(prefers-reduced-motion: reduce)').matches;\n } else {\n return Boolean(parseInt(storedValue, 10));\n }\n }\n\n _getPlayerOptions() {\n const { backgroundMode, intersectionMode, autoPlay, muted } =\n this as unknown as C4DVideoPlayerComposite;\n /**\n * The overwritten media title.\n *\n * Quick and dirty turn around as C4DVideoPlayerComposite uses caption\n * and C4DLightboxVideoPlayer uses customVideoName and none are\n * part of the same type\n *\n * <c4d-video-player-container-v7 customVideoName=\"overwritten media title here\">...\n *\n */\n\n let mediaTitle: string;\n\n if (this.lc.toLowerCase() === 'en') {\n mediaTitle = this?.['customVideoName'] || this?.['caption'];\n } else {\n mediaTitle = ' ';\n }\n\n let playerOptions: any = {};\n const autoplayPreference = this._getAutoplayPreference();\n\n switch (true) {\n case autoPlay:\n playerOptions = {\n muted,\n autoPlay: autoplayPreference,\n };\n break;\n\n case backgroundMode || intersectionMode:\n playerOptions = {\n playerMode: 'background',\n loop: true,\n muted: true,\n autoPlay: autoplayPreference,\n };\n break;\n\n default:\n playerOptions = {\n muted,\n };\n break;\n }\n\n if (mediaTitle) {\n playerOptions = {\n ...playerOptions,\n mediaTitle,\n };\n }\n\n /**\n * In the video player, the player type\n * will always be video\n */\n playerOptions.playerType = 'VIDEO';\n\n return playerOptions;\n }\n\n /**\n * Sets up and sends the API call for embedding video for the given video ID.\n *\n * @param videoId The video ID.\n * @private\n */\n // Not using TypeScript `private` due to: microsoft/TypeScript#17744\n async _embedVideoImpl(videoId: string) {\n const doc = Object.prototype.hasOwnProperty.call(this, 'getRootNode')\n ? (this.getRootNode() as Document | ShadowRoot)\n : this.ownerDocument;\n // Given Kaltura replaces the `<div>` here with `<iframe>` with the video player,\n // rendering this `<div>` in `renderLightDOM()` will cause the video player being clobbered\n const playerId = Math.random().toString(36).slice(2);\n const div = document.createElement('div');\n div.id = playerId;\n div.className = `${c4dPrefix}--video-player__video`;\n const { _videoPlayer: videoPlayer } = this;\n if (!videoPlayer) {\n throw new TypeError(\n 'Cannot find the video player component to put the video content into.'\n );\n }\n videoPlayer.appendChild(div);\n\n const embedVideoHandle = await KalturaPlayerAPI.embedMedia(\n videoId,\n playerId,\n this._getPlayerOptions()\n );\n const { width, height } = await KalturaPlayerAPI.api(videoId);\n videoPlayer.style.setProperty('--native-file-width', `${width}px`);\n videoPlayer.style.setProperty('--native-file-height', `${height}px`);\n videoPlayer.style.setProperty(\n '--native-file-aspect-ratio',\n `${width} / ${height}`\n );\n\n doc!.getElementById(playerId)!.dataset.videoId = videoId;\n const videoEmbed = doc!.getElementById(playerId)?.firstElementChild;\n if (videoEmbed) {\n (videoEmbed as HTMLElement).focus({ preventScroll: true });\n }\n return embedVideoHandle;\n }\n\n /**\n * Sends the API call for embedding video for the given video ID, and tracks the progress and the error of the REST call.\n *\n * @param videoId The video ID.\n * @internal\n */\n _embedMedia = async (videoId: string) => {\n const { _requestsEmbedVideo: requestsEmbedVideo } = this;\n const requestEmbedVideo = requestsEmbedVideo[videoId];\n\n if (requestEmbedVideo) {\n return requestEmbedVideo;\n }\n\n const promiseEmbedVideo = this._embedVideoImpl(videoId);\n\n this._setRequestEmbedVideoInProgress(videoId, promiseEmbedVideo);\n try {\n this._setEmbeddedVideo(videoId, await promiseEmbedVideo);\n } catch (error) {\n this._setErrorRequestEmbedVideo(videoId, error as Error);\n }\n return promiseEmbedVideo;\n };\n\n /**\n * Calls the data-* attribute transpose function to target `c4d-video-player`'s button element.\n */\n async firstUpdated() {\n window.requestAnimationFrame(() => {\n const button = this.querySelector(\n 'c4d-video-player-v7'\n )?.shadowRoot?.querySelector('button');\n if (!this.getAttribute('href') && this.getAttribute('video-id')) {\n this.setAttribute(\n 'href',\n `https://mediacenter.ibm.com/id/${this.getAttribute('video-id')}`\n );\n }\n this.transposeAttributes(button, ['href']);\n });\n\n //get LC\n const { lc } = await LocaleAPI.getLocale();\n this.lc = lc;\n }\n\n prefersAutoplayStorageKey = `${c4dPrefix}-background-video-prefers-autoplay`;\n }\n\n return C4DVideoPlayerContainerMixinImpl;\n};\n\n/**\n * Container component for video player.\n *\n * @element c4d-video-player-container-v7\n */\n@customElement(`${c4dPrefix}-video-player-container-v7`)\nclass C4DVideoPlayerContainer extends ConnectMixin<\n VideoPlayerContainerState,\n MediaPlayerAPIActions,\n VideoPlayerContainerStateProps,\n ActionCreatorsMapObject<VideoPlayerActions>\n>(\n store as Store<VideoPlayerContainerState, MediaPlayerAPIActions>,\n mapStateToProps,\n mapDispatchToProps\n)(C4DVideoPlayerContainerMixin(C4DVideoPlayerComposite)) {}\n\n/* @__GENERATE_REACT_CUSTOM_ELEMENT_TYPE__ */\nexport default C4DVideoPlayerContainer;\n"],"mappings":";;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAIEA,kBAAkB,QACb,OAAO;AACd,OAAe,KAAK;AACpB,SAASC,QAAQ,QAAQ,mBAAmB;AAC5C,OAAOC,gBAAgB,MAAM,yEAAyE;AACtG,OAAOC,QAAQ,MAAM,+DAA+D;AACpF,OAAOC,KAAK,MAAM,iEAAiE;AAKnF,SAASC,aAAa,QAAQ,sFAAsF;AAGpH,OAAOC,YAAY,MAAM,iCAA8B;AACvD,OAAOC,mBAAmB,MAAM,yCAAsC;AACtE,OAAOC,uBAAuB,MAAM,6BAA0B;AAC9D,SAASC,aAAa,IAAIC,aAAa,QAAQ,gEAAgE;AAC/G,SAASC,SAAS,QAAQ,qDAAqD;AAE/E,MAAM;EAAEC,YAAY,EAAEC;AAAU,CAAC,GAAGV,QAAQ;;AAE5C;AACA;AACA;;AAQA;AACA;AACA;;AAUA;AACA;AACA;AACA;AACA,OAAO,SAASW,eAAeA,CAC7BC,KAAgC,EACA;EAChC,MAAM;IAAEC;EAAiB,CAAC,GAAGD,KAAK;EAClC,MAAM;IAAEE;EAAU,CAAC,GAAGD,gBAAgB,aAAhBA,gBAAgB,cAAhBA,gBAAgB,GAAI,CAAC,CAAC;EAC5C,OAAO,CAACC,SAAS,GAAG,CAAC,CAAC,GAAG;IAAEA;EAAU,CAAC;AACxC;;AAEA;AACA;AACA;AACA;AACA,OAAO,SAASC,kBAAkBA,CAACC,QAAyC,EAAE;EAC5E,OAAOnB,kBAAkB,CAIvB;IACEoB,cAAc,EAAEf;EAClB,CAAC,EACDc,QAAQ,CAAa;EACvB,CAAC;AACH;;AAEA;AACA;AACA;AACA;AACA,OAAO,MAAME,4BAA4B,GAGvCC,IAAO,IACJ;EACH;AACF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AA0H,YAAA,EAAAC,aAAA;EAAxD,MACMF,uBAAuB,SAAAE,aAAA,CAS4B;IAAA7G,YAAA,GAAAC,IAAA;MAAA,SAAAA,IAAA;MAAA2G,YAAA;IAAA;EAAC;EAAC;IAAA1G,CAAA,EATrDyG,uBAAuB;IAAAxG,CAAA;EAAA;AAAA,GAASxB,YAAY,CAMhDF,KAAK,EACLU,eAAe,EACfI,kBACF,CAAC,CAACG,4BAA4B,CAACb,uBAAuB,CAAC,CAAC;AAExD;AACA,eAAe8H,uBAAuB","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"video-player-container.js","names":["bindActionCreators","property","KalturaPlayerAPI","settings","store","loadMediaData","ConnectMixin","StableSelectorMixin","C4DVideoPlayerComposite","carbonElement","customElement","LocaleAPI","stablePrefix","c4dPrefix","mapStateToProps","state","kalturaPlayerAPI","mediaData","mapDispatchToProps","dispatch","_loadVideoData","C4DVideoPlayerContainerMixin","Base","C4DVideoPlayerContainerMixinImpl","_decorate","_initialize","_StableSelectorMixin","constructor","args","F","d","kind","key","value","decorators","type","String","attribute","_captureCTA","ctaElement","querySelector","parentNode","removeChild","_returnCTA","appendChild","_setRequestEmbedVideoInProgress","videoId","request","_requestsEmbedVideo","oldRequestsEmbedVideo","_objectSpread","_setErrorRequestEmbedVideo","error","Promise","reject","_setEmbeddedVideo","kalturaPlayer","resolve","embeddedVideos","oldEmbeddedVideos","_setAutoplayPreference","preference","updatedValue","localStorage","setItem","prefersAutoplayStorageKey","_getAutoplayPreference","storedValue","getItem","window","matchMedia","matches","Boolean","parseInt","_getPlayerOptions","backgroundMode","intersectionMode","autoPlay","muted","mediaTitle","lc","toLowerCase","playerOptions","autoplayPreference","playerMode","loop","playerType","_embedVideoImpl","_getElementById","doc","Object","prototype","hasOwnProperty","call","getRootNode","ownerDocument","playerId","Math","random","toString","slice","div","document","createElement","id","className","_videoPlayer","videoPlayer","TypeError","style","cssText","body","_ibmPendingEmbedDivs","Set","add","embedVideoHandle","_this$_videoPlayer","_this$_ibmPendingEmbe2","handle","width","height","all","embedMedia","api","isConnected","_this$_ibmPendingEmbe","remove","delete","currentVideoPlayer","setProperty","_this$_ibmPendingEmbe3","parentElement","playerEl","getElementById","dataset","videoEmbed","firstElementChild","focus","preventScroll","requestsEmbedVideo","requestEmbedVideo","promiseEmbedVideo","firstUpdated","requestAnimationFrame","_this$querySelector","button","shadowRoot","getAttribute","setAttribute","transposeAttributes","getLocale","C4DVideoPlayerContainer","_initialize2","_ConnectMixin"],"sources":["components/video-player-v7/video-player-container.ts"],"sourcesContent":["/**\n * @license\n *\n * Copyright IBM Corp. 2020, 2025\n *\n * This source code is licensed under the Apache-2.0 license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nimport {\n ActionCreatorsMapObject,\n Dispatch,\n Store,\n bindActionCreators,\n} from 'redux';\nimport {} from 'lit';\nimport { property } from 'lit/decorators.js';\nimport KalturaPlayerAPI from '@carbon/ibmdotcom-services/es/services/KalturaPlayerV7/KalturaPlayer.js';\nimport settings from '@carbon/ibmdotcom-utilities/es/utilities/settings/settings.js';\nimport store from '../../internal/vendor/@carbon/ibmdotcom-services-store/store.js';\nimport {\n MediaData,\n MediaPlayerAPIState,\n} from '../../internal/vendor/@carbon/ibmdotcom-services-store/types/kalturaPlayerAPIv7';\nimport { loadMediaData } from '../../internal/vendor/@carbon/ibmdotcom-services-store/actions/kalturaPlayerAPIv7.js';\nimport { MediaPlayerAPIActions } from '../../internal/vendor/@carbon/ibmdotcom-services-store/actions/kalturaPlayerAPIv7';\nimport { Constructor } from '../../globals/defs';\nimport ConnectMixin from '../../globals/mixins/connect';\nimport StableSelectorMixin from '../../globals/mixins/stable-selector';\nimport C4DVideoPlayerComposite from './video-player-composite';\nimport { carbonElement as customElement } from '@carbon/web-components/es/globals/decorators/carbon-element.js';\nimport { LocaleAPI } from '@carbon/ibmdotcom-services/es/services/Locale/index';\n\nconst { stablePrefix: c4dPrefix } = settings;\n\n/**\n * The Redux state used for `<c4d-video-player-container-v7>`.\n */\nexport interface VideoPlayerContainerState {\n /**\n * The Redux state for `KalturaPlayerAPI`.\n */\n kalturaPlayerAPI?: MediaPlayerAPIState;\n}\n\n/**\n * The properties for `<c4d-video-player-container-v7>` from Redux state.\n */\nexport interface VideoPlayerContainerStateProps {\n /**\n * The video data, keyed by the video ID.\n */\n mediaData?: { [videoId: string]: MediaData };\n}\n\nexport type VideoPlayerActions = ReturnType<typeof loadMediaData>;\n\n/**\n * @param state The Redux state for video player.\n * @returns The converted version of the given state, tailored for `<c4d-video-player-container-v7>`.\n */\nexport function mapStateToProps(\n state: VideoPlayerContainerState\n): VideoPlayerContainerStateProps {\n const { kalturaPlayerAPI } = state;\n const { mediaData } = kalturaPlayerAPI ?? {};\n return !mediaData ? {} : { mediaData };\n}\n\n/**\n * @param dispatch The Redux `dispatch()` API.\n * @returns The methods in `<c4d-video-player-container-v7>` to dispatch Redux actions.\n */\nexport function mapDispatchToProps(dispatch: Dispatch<MediaPlayerAPIActions>) {\n return bindActionCreators<\n VideoPlayerActions,\n ActionCreatorsMapObject<VideoPlayerActions>\n >(\n {\n _loadVideoData: loadMediaData,\n },\n dispatch as Dispatch // TS definition of `bindActionCreators()` seems to have no templated `Dispatch`\n );\n}\n\n/**\n * @param Base The base class.\n * @returns A mix-in that implements video embedding API calls.\n */\nexport const C4DVideoPlayerContainerMixin = <\n T extends Constructor<HTMLElement>\n>(\n Base: T\n) => {\n /**\n * A mix-in class that sets up and cleans up event listeners defined by `@HostListener` decorator.\n */\n abstract class C4DVideoPlayerContainerMixinImpl extends StableSelectorMixin(\n Base\n ) {\n /**\n * The video player.\n */\n abstract _videoPlayer?: HTMLElement;\n\n /**\n * The embedded Kaltura player element (that has APIs), keyed by the video ID.\n */\n abstract embeddedVideos?: { [videoId: string]: any };\n\n /**\n * The request for the embedded Kaltura player element (that has APIs), keyed by the video ID.\n *\n * @protected\n */\n // Not using TypeScript `private` due to: microsoft/TypeScript#17744\n _requestsEmbedVideo: { [videoId: string]: Promise<any> } = {};\n\n /**\n * Placeholder divs parked in `document.body` by `_embedVideoImpl` while a\n * Kaltura embed is queued or in flight. `disconnectedCallback` (in the\n * composite) removes them so dead embeds drain from\n * `_ibmKalturaEmbedQueue` immediately after this component is removed\n * (e.g. when Adobe Target swaps DC for an XF).\n *\n * @internal\n */\n _ibmPendingEmbedDivs?: Set<HTMLElement>;\n\n /**\n * Custom video name\n */\n @property({ type: String, attribute: 'customvideoname' })\n customVideoName = '';\n\n /**\n * Language code\n */\n @property()\n lc = '';\n\n /**\n * Stored CTA element for forwarding to lightbox\n */\n @property({ attribute: false })\n ctaElement?: HTMLElement | null;\n\n /**\n * Captures and removes the CTA element from light DOM\n * @returns The captured CTA element or null\n */\n _captureCTA(): HTMLElement | null {\n const ctaElement = this.querySelector('[slot=\"cta\"]');\n if (ctaElement && ctaElement.parentNode) {\n this.ctaElement = ctaElement.parentNode.removeChild(\n ctaElement\n ) as HTMLElement;\n return this.ctaElement;\n }\n return null;\n }\n\n /**\n * Returns the CTA element to the container\n */\n _returnCTA(): void {\n if (this.ctaElement) {\n this.appendChild(this.ctaElement);\n }\n }\n\n /**\n * Sets the state that the API call for embedding the video for the given video ID is in progress.\n *\n * @param videoId The video ID.\n * @param request The promise of the API call for embedding the video of the given video ID that is in progress.\n * @private\n */\n // Not using TypeScript `private` due to: microsoft/TypeScript#17744\n _setRequestEmbedVideoInProgress(videoId: string, request: Promise<any>) {\n const { _requestsEmbedVideo: oldRequestsEmbedVideo } = this;\n this._requestsEmbedVideo = {\n ...oldRequestsEmbedVideo,\n [videoId]: request,\n };\n }\n\n /**\n * Set the state that the API call for embedding the video for the given video ID is failed.\n *\n * @param videoId The video ID.\n * @param error An error from the API call for embedding the video of the given video ID.\n * @private\n */\n // Not using TypeScript `private` due to: microsoft/TypeScript#17744\n _setErrorRequestEmbedVideo(videoId: string, error: Error) {\n this._setRequestEmbedVideoInProgress(videoId, Promise.reject(error));\n }\n\n /**\n * Sets the given embedded Kaltura player element (that has APIs) for the given video ID.\n *\n * @param videoId The video ID.\n * @param kalturaPlayer The embedded Kaltura player element (that has APIs).\n * @private\n */\n // Not using TypeScript `private` due to: microsoft/TypeScript#17744\n _setEmbeddedVideo(videoId: string, kalturaPlayer: any) {\n this._setRequestEmbedVideoInProgress(\n videoId,\n Promise.resolve(kalturaPlayer)\n );\n const { embeddedVideos: oldEmbeddedVideos } = this;\n this.embeddedVideos = {\n ...oldEmbeddedVideos,\n [videoId]: kalturaPlayer,\n };\n }\n\n _setAutoplayPreference(preference: boolean) {\n const updatedValue = preference ? '1' : '0';\n localStorage.setItem(`${this.prefersAutoplayStorageKey}`, updatedValue);\n }\n\n _getAutoplayPreference() {\n const storedValue = localStorage.getItem(\n `${this.prefersAutoplayStorageKey}`\n );\n\n if (storedValue === null) {\n return !window.matchMedia('(prefers-reduced-motion: reduce)').matches;\n } else {\n return Boolean(parseInt(storedValue, 10));\n }\n }\n\n _getPlayerOptions() {\n const { backgroundMode, intersectionMode, autoPlay, muted } =\n this as unknown as C4DVideoPlayerComposite;\n /**\n * The overwritten media title.\n *\n * Quick and dirty turn around as C4DVideoPlayerComposite uses caption\n * and C4DLightboxVideoPlayer uses customVideoName and none are\n * part of the same type\n *\n * <c4d-video-player-container-v7 customVideoName=\"overwritten media title here\">...\n *\n */\n\n let mediaTitle: string;\n\n if (this.lc.toLowerCase() === 'en') {\n mediaTitle = this?.['customVideoName'] || this?.['caption'];\n } else {\n mediaTitle = ' ';\n }\n\n let playerOptions: any = {};\n const autoplayPreference = this._getAutoplayPreference();\n\n switch (true) {\n case autoPlay:\n playerOptions = {\n muted,\n autoPlay: autoplayPreference,\n };\n break;\n\n case backgroundMode || intersectionMode:\n playerOptions = {\n playerMode: 'background',\n loop: true,\n muted: true,\n autoPlay: autoplayPreference,\n };\n break;\n\n default:\n playerOptions = {\n muted,\n };\n break;\n }\n\n if (mediaTitle) {\n playerOptions = {\n ...playerOptions,\n mediaTitle,\n };\n }\n\n /**\n * In the video player, the player type\n * will always be video\n */\n playerOptions.playerType = 'VIDEO';\n\n return playerOptions;\n }\n\n /**\n * Sets up and sends the API call for embedding video for the given video ID.\n *\n * @param videoId The video ID.\n * @private\n */\n // Not using TypeScript `private` due to: microsoft/TypeScript#17744\n async _embedVideoImpl(videoId: string) {\n const doc = Object.prototype.hasOwnProperty.call(this, 'getRootNode')\n ? (this.getRootNode() as Document | ShadowRoot)\n : this.ownerDocument;\n // Given Kaltura replaces the `<div>` here with `<iframe>` with the video player,\n // rendering this `<div>` in `renderLightDOM()` will cause the video player being clobbered\n const playerId = Math.random().toString(36).slice(2);\n const div = document.createElement('div');\n div.id = playerId;\n div.className = `${c4dPrefix}--video-player__video`;\n const { _videoPlayer: videoPlayer } = this;\n if (!videoPlayer) {\n throw new TypeError(\n 'Cannot find the video player component to put the video content into.'\n );\n }\n // Parked in document.body, not videoPlayer, so Lit's renderLightDOM()\n // can't detach it mid-embed (the queue wait can run 6-20s) and orphan\n // legacyPromiseKWidget's getElementById(playerId) lookup.\n div.style.cssText = 'position:fixed;left:-9999px;visibility:hidden';\n document.body.appendChild(div);\n // Tracked so disconnectedCallback can remove it if this component is\n // torn down mid-queue, freeing the embed instead of leaving it to\n // finish as a hidden orphan.\n if (!this._ibmPendingEmbedDivs) {\n this._ibmPendingEmbedDivs = new Set();\n }\n this._ibmPendingEmbedDivs.add(div);\n\n let embedVideoHandle;\n try {\n // Run the embed and the metadata fetch in parallel — saves a round-trip.\n const [handle, { width, height }] = await Promise.all([\n KalturaPlayerAPI.embedMedia(\n videoId,\n playerId,\n this._getPlayerOptions()\n ),\n KalturaPlayerAPI.api(videoId),\n ]);\n embedVideoHandle = handle;\n\n // If we were disconnected during the wait, discard the embed.\n if (!this.isConnected) {\n div.remove();\n this._ibmPendingEmbedDivs?.delete(div);\n return null;\n }\n\n // Move the div (now containing Kaltura's iframe) into the video player.\n // Re-fetch _videoPlayer in case Lit re-rendered and replaced the element\n // while we were awaiting the embed queue.\n const currentVideoPlayer = this._videoPlayer ?? videoPlayer;\n div.style.cssText = '';\n currentVideoPlayer.appendChild(div);\n this._ibmPendingEmbedDivs?.delete(div);\n\n currentVideoPlayer.style.setProperty(\n '--native-file-width',\n `${width}px`\n );\n currentVideoPlayer.style.setProperty(\n '--native-file-height',\n `${height}px`\n );\n currentVideoPlayer.style.setProperty(\n '--native-file-aspect-ratio',\n `${width} / ${height}`\n );\n } catch (error) {\n // Clean up hidden div if embed failed\n if (div.parentElement) {\n div.remove();\n }\n this._ibmPendingEmbedDivs?.delete(div);\n throw error;\n }\n\n const playerEl = doc!.getElementById(playerId);\n if (playerEl) {\n playerEl.dataset.videoId = videoId;\n }\n const videoEmbed = doc!.getElementById(playerId)?.firstElementChild;\n if (videoEmbed) {\n (videoEmbed as HTMLElement).focus({ preventScroll: true });\n }\n return embedVideoHandle;\n }\n\n /**\n * Sends the API call for embedding video for the given video ID, and tracks the progress and the error of the REST call.\n *\n * @param videoId The video ID.\n * @internal\n */\n _embedMedia = async (videoId: string) => {\n const { _requestsEmbedVideo: requestsEmbedVideo } = this;\n const requestEmbedVideo = requestsEmbedVideo[videoId];\n\n if (requestEmbedVideo) {\n return requestEmbedVideo;\n }\n\n const promiseEmbedVideo = this._embedVideoImpl(videoId);\n\n this._setRequestEmbedVideoInProgress(videoId, promiseEmbedVideo);\n try {\n this._setEmbeddedVideo(videoId, await promiseEmbedVideo);\n } catch (error) {\n this._setErrorRequestEmbedVideo(videoId, error as Error);\n }\n return promiseEmbedVideo;\n };\n\n /**\n * Calls the data-* attribute transpose function to target `c4d-video-player`'s button element.\n */\n async firstUpdated() {\n window.requestAnimationFrame(() => {\n const button = this.querySelector(\n 'c4d-video-player-v7'\n )?.shadowRoot?.querySelector('button');\n if (!this.getAttribute('href') && this.getAttribute('video-id')) {\n this.setAttribute(\n 'href',\n `https://mediacenter.ibm.com/id/${this.getAttribute('video-id')}`\n );\n }\n this.transposeAttributes(button, ['href']);\n });\n\n //get LC\n const { lc } = await LocaleAPI.getLocale();\n this.lc = lc;\n }\n\n prefersAutoplayStorageKey = `${c4dPrefix}-background-video-prefers-autoplay`;\n }\n\n return C4DVideoPlayerContainerMixinImpl;\n};\n\n/**\n * Container component for video player.\n *\n * @element c4d-video-player-container-v7\n */\n@customElement(`${c4dPrefix}-video-player-container-v7`)\nclass C4DVideoPlayerContainer extends ConnectMixin<\n VideoPlayerContainerState,\n MediaPlayerAPIActions,\n VideoPlayerContainerStateProps,\n ActionCreatorsMapObject<VideoPlayerActions>\n>(\n store as Store<VideoPlayerContainerState, MediaPlayerAPIActions>,\n mapStateToProps,\n mapDispatchToProps\n)(C4DVideoPlayerContainerMixin(C4DVideoPlayerComposite)) {}\n\n/* @__GENERATE_REACT_CUSTOM_ELEMENT_TYPE__ */\nexport default C4DVideoPlayerContainer;\n"],"mappings":";;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAIEA,kBAAkB,QACb,OAAO;AACd,OAAe,KAAK;AACpB,SAASC,QAAQ,QAAQ,mBAAmB;AAC5C,OAAOC,gBAAgB,MAAM,yEAAyE;AACtG,OAAOC,QAAQ,MAAM,+DAA+D;AACpF,OAAOC,KAAK,MAAM,iEAAiE;AAKnF,SAASC,aAAa,QAAQ,sFAAsF;AAGpH,OAAOC,YAAY,MAAM,iCAA8B;AACvD,OAAOC,mBAAmB,MAAM,yCAAsC;AACtE,OAAOC,uBAAuB,MAAM,6BAA0B;AAC9D,SAASC,aAAa,IAAIC,aAAa,QAAQ,gEAAgE;AAC/G,SAASC,SAAS,QAAQ,qDAAqD;AAE/E,MAAM;EAAEC,YAAY,EAAEC;AAAU,CAAC,GAAGV,QAAQ;;AAE5C;AACA;AACA;;AAQA;AACA;AACA;;AAUA;AACA;AACA;AACA;AACA,OAAO,SAASW,eAAeA,CAC7BC,KAAgC,EACA;EAChC,MAAM;IAAEC;EAAiB,CAAC,GAAGD,KAAK;EAClC,MAAM;IAAEE;EAAU,CAAC,GAAGD,gBAAgB,aAAhBA,gBAAgB,cAAhBA,gBAAgB,GAAI,C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C,MAAM,CAAC,CAAC;UAC5C,CAAC,CAAC;;UAEF;UACA,MAAM;YAAEjE;UAAG,CAAC,GAAG,MAAMrE,SAAS,CAAC2I,SAAS,CAAC,CAAC;UAC1C,IAAI,CAACtE,EAAE,GAAGA,EAAE;QACd;MAAC;QAAAjD,IAAA;QAAAC,GAAA;QAAAC,MAAA;UAAA,OAE2B,GAAGpB,SAAS,oCAAoC;QAAA;MAAA;IAAA;EAAA,GA3VtBN,mBAAmB,CACzEe,IACF,CAAC;EA4VD,OAAOC,gCAAgC;AACzC,CAAC;;AAED;AACA;AACA;AACA;AACA;AAJA,IAMMgI,uBAAuB,GAAA/H,SAAA,EAD5Bd,aAAa,CAAC,GAAGG,SAAS,4BAA4B,CAAC,aAAA2I,YAAA,EAAAC,aAAA;EAAxD,MACMF,uBAAuB,SAAAE,aAAA,CAS4B;IAAA9H,YAAA,GAAAC,IAAA;MAAA,SAAAA,IAAA;MAAA4H,YAAA;IAAA;EAAC;EAAC;IAAA3H,CAAA,EATrD0H,uBAAuB;IAAAzH,CAAA;EAAA;AAAA,GAASxB,YAAY,CAMhDF,KAAK,EACLU,eAAe,EACfI,kBACF,CAAC,CAACG,4BAA4B,CAACb,uBAAuB,CAAC,CAAC;AAExD;AACA,eAAe+I,uBAAuB","ignoreList":[]}
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
import { svg } from 'lit';
|
|
10
10
|
import spread from '@carbon/web-components/es/globals/directives/spread.js';
|
|
11
11
|
const svgResultIBMdotcomIcon = ({ children, ...attrs } = {}) =>
|
|
12
|
-
svg`<svg focusable="false" preserveAspectRatio="xMidYMid meet" class="c4d--footer-logo__logo" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" role="img" aria-
|
|
12
|
+
svg`<svg focusable="false" preserveAspectRatio="xMidYMid meet" class="c4d--footer-logo__logo" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" role="img" aria-label="IBM Logo" ...="${spread(
|
|
13
13
|
attrs
|
|
14
14
|
)}" width="157" height="65" viewBox="0 0 157 65">${children}<path d="M30.4436498,60.2076728 L30.4436498,64.2376746 L-2.91322522e-13,64.2376746 L-2.91322522e-13,60.2076728 L30.4436498,60.2076728 Z M108.735358,60.2067171 L108.735358,64.2376746 L86.9826603,64.2376746 L86.9826603,60.2067171 L108.735358,60.2067171 Z M156.592795,60.2067171 L156.592795,64.2376746 L134.840096,64.2376746 L134.840096,60.2067171 L156.592795,60.2067171 Z M123.176704,60.2067171 L121.779475,64.2376746 L120.398188,60.2067171 L123.176704,60.2067171 Z M34.7933454,60.2078639 L77.5682441,60.2078639 C74.7705526,62.6327259 71.1773563,64.1319583 67.2410591,64.2324704 L66.8180207,64.2378657 L34.7933454,64.2378657 L34.7933454,60.2078639 L77.5682441,60.2078639 Z M30.4436498,51.7462936 L30.4436498,55.7762954 L-2.91322522e-13,55.7762954 L-2.91322522e-13,51.7462936 L30.4436498,51.7462936 Z M82.8448933,51.7469625 C82.5134031,52.9954078 82.0440654,54.1860508 81.4563549,55.3022459 L81.1972884,55.7760087 L34.7933454,55.7760087 L34.7933454,51.7469625 L82.8448933,51.7469625 Z M156.592795,51.742471 L156.592795,55.7734284 L134.840096,55.7734284 L134.840096,51.742471 L156.592795,51.742471 Z M108.735358,51.742471 L108.735358,55.7734284 L86.9826603,55.7734284 L86.9826603,51.742471 L108.735358,51.742471 Z M126.109666,51.7420887 L124.712437,55.7730462 L118.86283,55.7730462 L117.466539,51.7420887 L126.109666,51.7420887 Z M21.7451962,43.2849144 L21.7451962,47.3149162 L8.69751584,47.3149162 L8.69751584,43.2849144 L21.7451962,43.2849144 Z M82.940355,43.2851055 C83.2119472,44.4164829 83.378718,45.588834 83.4161671,46.7957568 L83.4242276,47.3151073 L68.7955217,47.3151073 L68.7955217,43.2851055 L82.940355,43.2851055 Z M56.5390105,43.2849144 L56.5390105,47.3149162 L43.4913301,47.3149162 L43.4913301,43.2849144 L56.5390105,43.2849144 Z M129.041034,43.2784159 L127.644742,47.3084177 L115.930525,47.3084177 L114.534234,43.2784159 L129.041034,43.2784159 Z M147.891528,43.2782248 L147.891528,47.3082266 L134.840096,47.3082266 L134.840096,43.2782248 L147.891528,43.2782248 Z M108.735358,43.2782248 L108.735358,47.3082266 L95.6839271,47.3082266 L95.6839271,43.2782248 L108.735358,43.2782248 Z M21.7451962,34.8235352 L21.7451962,38.853537 L8.69751584,38.853537 L8.69751584,34.8235352 L21.7451962,34.8235352 Z M77.8615684,34.8232485 C78.9907919,35.873419 79.9779764,37.0776317 80.7882576,38.4059297 L81.0517515,38.8532503 L43.4916115,38.8532503 L43.4916115,34.8232485 L77.8615684,34.8232485 Z M108.735358,34.8139786 L108.735358,38.8449361 L95.6839271,38.8449361 L95.6839271,34.8139786 L108.735358,34.8139786 Z M147.891528,34.8139786 L147.891528,38.8449361 L134.840096,38.8449361 L134.840096,34.8139786 L147.891528,34.8139786 Z M131.973433,34.8136919 L130.577142,38.8446494 L112.998313,38.8446494 L111.602022,34.8136919 L131.973433,34.8136919 Z M81.1948503,26.3623471 C80.4234674,27.7178498 79.472067,28.9518216 78.3755133,30.0356991 L78.0046671,30.3913933 L43.4912364,30.3913933 L43.4912364,26.3623471 L81.1948503,26.3623471 Z M21.7451962,26.362156 L21.7451962,30.3912022 L8.69751584,30.3912022 L8.69751584,26.362156 L21.7451962,26.362156 Z M147.891528,26.3490635 L147.891528,30.380021 L134.840096,30.380021 L134.839345,26.5412738 L133.509447,30.380021 L122.054045,30.380021 L123.426893,26.3490635 L147.891528,26.3490635 Z M120.148562,26.3492547 L121.52141,30.3802121 L110.06507,30.3802121 L108.735358,26.5413415 L108.735358,30.3802121 L95.6839271,30.3802121 L95.6839271,26.3492547 L120.148562,26.3492547 Z M21.7451962,17.9007768 L21.7451962,21.9307786 L8.69751584,21.9307786 L8.69751584,17.9007768 L21.7451962,17.9007768 Z M83.4242276,17.900299 C83.4242276,19.1161325 83.2914058,20.2997723 83.0502626,21.4428957 L82.940355,21.9303008 L68.7955217,21.9303008 L68.7955217,17.900299 L83.4242276,17.900299 Z M56.5390105,17.8998212 L56.5390105,21.929823 L43.4913301,21.929823 L43.4913301,17.8998212 L56.5390105,17.8998212 Z M147.891434,17.8846262 L147.891434,21.9155837 L124.936556,21.9155837 L126.307529,17.8846262 L147.891434,17.8846262 Z M117.266988,17.8844351 L118.638898,21.9153926 L95.6840208,21.9153926 L95.6840208,17.8844351 L117.266988,17.8844351 Z M30.4436498,9.43844199 L30.4436498,13.4684438 L-2.91322522e-13,13.4684438 L-2.91322522e-13,9.43844199 L30.4436498,9.43844199 Z M81.197476,9.43844199 C81.8186099,10.5338628 82.324153,11.7053777 82.6946307,12.9369814 L82.8450809,13.4684438 L34.793533,13.4684438 L34.793533,9.43844199 L81.197476,9.43844199 Z M156.593451,9.41971113 L156.593451,13.4506686 L127.817099,13.4506686 L129.189946,9.41971113 L156.593451,9.41971113 Z M114.385696,9.41999783 L115.757606,13.4509553 L86.9821914,13.4509553 L86.9821914,9.41999783 L114.385696,9.41999783 Z M30.4436498,0.978018462 L30.4436498,5.00706462 L-2.91322522e-13,5.00706462 L-2.91322522e-13,0.978018462 L30.4436498,0.978018462 Z M66.818302,0.977540633 C70.7785294,0.977540633 74.4118131,2.3931571 77.2657493,4.75043913 L77.5685254,5.00658679 L34.7936268,5.00658679 L34.7936268,0.977540633 L66.818302,0.977540633 Z M156.592607,0.956229502 L156.592607,4.98718697 L130.69886,4.98718697 L132.07077,0.956229502 L156.592607,0.956229502 Z M111.495495,0.955273846 L112.867405,4.98527566 L86.9820976,4.98527566 L86.9820976,0.955273846 L111.495495,0.955273846 Z"></path></svg>`;
|
|
15
15
|
export default svgResultIBMdotcomIcon;
|
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);
|