@clickview/lite 0.103.0-rc.0 → 0.103.0
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/.vite/manifest.json +640 -640
- package/dist/bundles.json +1 -1
- package/dist/en.json +1 -1
- package/dist/scripts/{BXosUOUS.chunk.js → 14z5Gy8L.chunk.js} +2 -2
- package/dist/scripts/{BXosUOUS.chunk.js.map → 14z5Gy8L.chunk.js.map} +1 -1
- package/dist/scripts/{BqkK_0Jk2.chunk.js → B4AZn1xm2.chunk.js} +2 -2
- package/dist/scripts/{BqkK_0Jk2.chunk.js.map → B4AZn1xm2.chunk.js.map} +1 -1
- package/dist/scripts/{_wBbQ-0z2.chunk.js → BBndy2td2.chunk.js} +2 -2
- package/dist/scripts/{_wBbQ-0z2.chunk.js.map → BBndy2td2.chunk.js.map} +1 -1
- package/dist/scripts/{BhgNNQjX.chunk.js → BOQck-Qs.chunk.js} +2 -2
- package/dist/scripts/{BhgNNQjX.chunk.js.map → BOQck-Qs.chunk.js.map} +1 -1
- package/dist/scripts/{BCTM3KG42.chunk.js → BQNOt7_Q2.chunk.js} +2 -2
- package/dist/scripts/{BCTM3KG42.chunk.js.map → BQNOt7_Q2.chunk.js.map} +1 -1
- package/dist/scripts/{DBdkd4Ag2.chunk.js → BTXOoJko2.chunk.js} +3 -3
- package/dist/scripts/{DBdkd4Ag2.chunk.js.map → BTXOoJko2.chunk.js.map} +1 -1
- package/dist/scripts/{wmwWqIeA.chunk.js → BTr5dJhb.chunk.js} +2 -2
- package/dist/scripts/{wmwWqIeA.chunk.js.map → BTr5dJhb.chunk.js.map} +1 -1
- package/dist/scripts/{B-aaIChO2.chunk.js → BTugVIIN2.chunk.js} +2 -2
- package/dist/scripts/{B-aaIChO2.chunk.js.map → BTugVIIN2.chunk.js.map} +1 -1
- package/dist/scripts/{_eRiDJm1.chunk.js → Ba4uGz_V.chunk.js} +2 -2
- package/dist/scripts/{_eRiDJm1.chunk.js.map → Ba4uGz_V.chunk.js.map} +1 -1
- package/dist/scripts/{Bx6qaXLc.chunk.js → Bdbe2u0R.chunk.js} +2 -2
- package/dist/scripts/{Bx6qaXLc.chunk.js.map → Bdbe2u0R.chunk.js.map} +1 -1
- package/dist/scripts/{syYCrnUX.chunk.js → BgoVmaXQ.chunk.js} +2 -2
- package/dist/scripts/{syYCrnUX.chunk.js.map → BgoVmaXQ.chunk.js.map} +1 -1
- package/dist/scripts/{B5DWwtp0.chunk.js → BjA9XV5y.chunk.js} +2 -2
- package/dist/scripts/{B5DWwtp0.chunk.js.map → BjA9XV5y.chunk.js.map} +1 -1
- package/dist/scripts/{Dp8z_udC.chunk.js → BoT5D3IL.chunk.js} +2 -2
- package/dist/scripts/{Dp8z_udC.chunk.js.map → BoT5D3IL.chunk.js.map} +1 -1
- package/dist/scripts/{BYMMqtaN.chunk.js → BqdHoEFM.chunk.js} +2 -2
- package/dist/scripts/{BYMMqtaN.chunk.js.map → BqdHoEFM.chunk.js.map} +1 -1
- package/dist/scripts/{BIvmcqND2.chunk.js → CCUznsdX2.chunk.js} +2 -2
- package/dist/scripts/{BIvmcqND2.chunk.js.map → CCUznsdX2.chunk.js.map} +1 -1
- package/dist/scripts/{BsNCh4UD.chunk.js → CFqL2Hm5.chunk.js} +3 -3
- package/dist/scripts/{BsNCh4UD.chunk.js.map → CFqL2Hm5.chunk.js.map} +1 -1
- package/dist/scripts/{BE8Ze3Fa2.chunk.js → CHmbcl4Y2.chunk.js} +2 -2
- package/dist/scripts/{BE8Ze3Fa2.chunk.js.map → CHmbcl4Y2.chunk.js.map} +1 -1
- package/dist/scripts/{RuVwpX36.chunk.js → CWCtYUUU.chunk.js} +2 -2
- package/dist/scripts/{RuVwpX36.chunk.js.map → CWCtYUUU.chunk.js.map} +1 -1
- package/dist/scripts/{CO8EIpI8.chunk.js → CXUrMkZu.chunk.js} +2 -2
- package/dist/scripts/{CO8EIpI8.chunk.js.map → CXUrMkZu.chunk.js.map} +1 -1
- package/dist/scripts/{DLqG-wwP.chunk.js → CYrelpYt.chunk.js} +2 -2
- package/dist/scripts/{DLqG-wwP.chunk.js.map → CYrelpYt.chunk.js.map} +1 -1
- package/dist/scripts/{Drx3PvJj.chunk.js → Cc9f2ux0.chunk.js} +2 -2
- package/dist/scripts/{Drx3PvJj.chunk.js.map → Cc9f2ux0.chunk.js.map} +1 -1
- package/dist/scripts/Cj_F4Lv92.chunk.js +2 -0
- package/dist/scripts/{C8l37H7t2.chunk.js.map → Cj_F4Lv92.chunk.js.map} +1 -1
- package/dist/scripts/{B5M-3wpn.chunk.js → CjwT65ug.chunk.js} +2 -2
- package/dist/scripts/{B5M-3wpn.chunk.js.map → CjwT65ug.chunk.js.map} +1 -1
- package/dist/scripts/{Dd23z1_x2.chunk.js → CvSpUZcJ2.chunk.js} +2 -2
- package/dist/scripts/{Dd23z1_x2.chunk.js.map → CvSpUZcJ2.chunk.js.map} +1 -1
- package/dist/scripts/{QrUfkwZX.chunk.js → DFleEz5_.chunk.js} +2 -2
- package/dist/scripts/{QrUfkwZX.chunk.js.map → DFleEz5_.chunk.js.map} +1 -1
- package/dist/scripts/{ygwO7HPs2.chunk.js → DIaT_eGy2.chunk.js} +2 -2
- package/dist/scripts/{ygwO7HPs2.chunk.js.map → DIaT_eGy2.chunk.js.map} +1 -1
- package/dist/scripts/{DXRsxBJw.chunk.js → DTliAJ8L.chunk.js} +2 -2
- package/dist/scripts/{DXRsxBJw.chunk.js.map → DTliAJ8L.chunk.js.map} +1 -1
- package/dist/scripts/{CfVIZBcI2.chunk.js → DXkvlC_92.chunk.js} +2 -2
- package/dist/scripts/{CfVIZBcI2.chunk.js.map → DXkvlC_92.chunk.js.map} +1 -1
- package/dist/scripts/{DE5jvfAx2.chunk.js → D_t70KgV2.chunk.js} +2 -2
- package/dist/scripts/{DE5jvfAx2.chunk.js.map → D_t70KgV2.chunk.js.map} +1 -1
- package/dist/scripts/{Dc01PBv1.chunk.js → Dn2EPvQj.chunk.js} +2 -2
- package/dist/scripts/{Dc01PBv1.chunk.js.map → Dn2EPvQj.chunk.js.map} +1 -1
- package/dist/scripts/{C4CuJJXy2.chunk.js → Dvl1XgHV2.chunk.js} +2 -2
- package/dist/scripts/{C4CuJJXy2.chunk.js.map → Dvl1XgHV2.chunk.js.map} +1 -1
- package/dist/scripts/{YzhKditE.chunk.js → ESLgHTNq.chunk.js} +2 -2
- package/dist/scripts/{YzhKditE.chunk.js.map → ESLgHTNq.chunk.js.map} +1 -1
- package/dist/scripts/{DfSzsD3P.chunk.js → FysETOFv.chunk.js} +2 -2
- package/dist/scripts/{DfSzsD3P.chunk.js.map → FysETOFv.chunk.js.map} +1 -1
- package/dist/scripts/{OmYpHs7g.chunk.js → _Cm5O72d.chunk.js} +3 -3
- package/dist/scripts/{OmYpHs7g.chunk.js.map → _Cm5O72d.chunk.js.map} +1 -1
- package/dist/scripts/{app-BzCWmnrr.js → app-k0jrat-b.js} +4 -4
- package/dist/scripts/{app-BzCWmnrr.js.map → app-k0jrat-b.js.map} +1 -1
- package/dist/scripts/{C46080Xd.chunk.js → dxqgnrOi.chunk.js} +2 -2
- package/dist/scripts/{C46080Xd.chunk.js.map → dxqgnrOi.chunk.js.map} +1 -1
- package/package.json +1 -1
- package/dist/scripts/C8l37H7t2.chunk.js +0 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"_wBbQ-0z2.chunk.js","names":[],"sources":["../../src/shared/hooks/useShouldPreviewInteractive.ts","../../src/apps/interactives/components/interactive-title-and-actions/InteractiveTitleAndActions.tsx","../../src/apps/interactives/components/play-interactive/PlayInteractive.tsx","../../src/apps/interactives/components/preview-interactive/InteractiveAlertBanner.tsx","../../src/apps/interactives/hooks/interactiveHooks.tsx","../../src/apps/interactives/components/preview-interactive/PreviewInteractive.tsx"],"sourcesContent":["import { Flight } from 'libs/common/flight';\n\nimport { PermissionName } from 'libs/shared/enums/PermissionName';\nimport { ProductId } from 'libs/shared/enums/ProductId';\nimport { UserRequests } from 'libs/shared/flight-requests/UserRequests';\nimport { usePermissions } from 'libs/shared/hooks/usePermissions';\nimport { useProducts } from 'libs/shared/hooks/UseProducts';\nimport { CurrentUser, UnionShareObject } from 'libs/shared/interfaces';\n\nexport function useShouldPreviewInteractive(shareLink?: UnionShareObject) {\n const { hasPermissions } = usePermissions();\n const { hasProduct } = useProducts();\n const currentUser = Flight.useBasicFetch<CurrentUser>(UserRequests.currentUser());\n\n return !hasPermissions(PermissionName.StudentExperience) &&\n hasProduct(ProductId.Primary) &&\n currentUser.data.isAuthenticated &&\n (!shareLink || shareLink.version === 'v1'); // Previewing shares is not supported for Share 2.0 links\n}\n","import React from 'react';\n\nimport { Core } from 'libs/common/backbone/index';\nimport { TextHelper } from 'libs/common/react/utils/TextHelper';\n\nimport { Actions as ActionsComponent } from 'libs/shared/components/actions/Actions';\nimport { AppLink } from 'libs/shared/components/app-link/AppLink';\nimport { LanguageNamespaceContext, Text } from 'libs/shared/components/text/Text';\nimport { RestrictionPadlock } from 'libs/shared/components/video-list/components/restriction-padlock/RestrictionPadlock';\nimport { CurationStatus } from 'libs/shared/enums/CurationStatus';\nimport { PermissionName } from 'libs/shared/enums/PermissionName';\nimport { usePermissions } from 'libs/shared/hooks/usePermissions';\nimport { InteractiveMetadata } from 'libs/shared/interfaces';\nimport { CommonVideoProps } from 'libs/shared/interfaces/CommonVideoProps';\nimport { VideoHelper } from 'libs/shared/utils/VideoHelper';\n\nimport { Actions } from 'shared/constants/LiteActions';\nimport { AppChannels } from 'shared/constants/LiteRadioChannels';\nimport { useVideoActions, VideoActionsLocation } from 'shared/hooks/use-video-actions/useVideoActions';\n\nconst namespace = 'interactives.interactiveTitleAndActions';\n\nfunction getBackToData(interactive: InteractiveMetadata): [name: string, appLink: Core.AppLink] {\n let name: string;\n let appLink: Core.AppLink;\n \n if (interactive._parentClip) {\n name = interactive._parentClip.name;\n appLink = {\n application: AppChannels.CLIPS,\n action: Actions.Clips.PLAY_CLIP,\n args: [ interactive._parentClip.id, TextHelper.slugify(interactive._parentClip.name) ]\n };\n } else {\n name = interactive._parentVideo.name;\n appLink = {\n application: AppChannels.VIDEOS,\n action: Actions.Videos.PLAY_VIDEO,\n args: [\n null,\n interactive._parentVideo.id,\n TextHelper.slugify(interactive._parentVideo.name)\n ]\n };\n }\n\n return [ name, appLink ];\n}\n\ninterface InteractiveTitleAndActionsProps {\n interactive: InteractiveMetadata;\n location: VideoActionsLocation;\n shareId?: string;\n commonVideoProps: CommonVideoProps;\n}\n\nexport function InteractiveTitleAndActions(props: InteractiveTitleAndActionsProps): JSX.Element {\n const { hasPermissions } = usePermissions();\n const videoActions = useVideoActions({\n location: props.location,\n shareId: props.shareId,\n presentationSlug: null\n });\n\n const hasStudentExperience = hasPermissions(PermissionName.StudentExperience);\n\n const isDraft = props.interactive.status === CurationStatus.Draft;\n const [ backToName, backToAppLink ] = getBackToData(props.interactive);\n \n return (\n <LanguageNamespaceContext.Provider value={namespace}>\n <div className='d-flex justify-content-between align-items-center'>\n <div className='inline-block w-100'>\n <div className='ms-2 float-end'>\n {!hasStudentExperience &&\n <ActionsComponent\n actions={videoActions.getVideoActions(props.interactive)}\n actionsDropdownClassName='btn btn-outline-dark'\n fetchMore={() => videoActions.fetchMoreActions(props.interactive)}\n />\n }\n </div>\n\n <h1 className='h3 mb-2'>\n {isDraft && (\n <div className='badge draft-badge me-2 align-bottom flex-shrink-0 h-auto lh-base'>\n <Text phrase='draft' />\n </div>\n )}\n {props.interactive.name}\n {!hasStudentExperience && (\n <RestrictionPadlock\n tooltipPlacement='right'\n className='ps-1 d-inline-block'\n video={props.interactive}\n yearGroups={props.commonVideoProps.yearGroups}\n />\n )}\n </h1>\n {VideoHelper.canViewOriginalVideo(props.interactive) &&\n <div className='mb-1 me-3 clamp-1'>\n <Text phrase='viewOriginal' /> <AppLink appLink={backToAppLink} className='text-info'>{backToName}</AppLink>\n </div>\n }\n </div>\n </div>\n </LanguageNamespaceContext.Provider>\n );\n}\n","import React from 'react';\nimport { createHtmlPortalNode, OutPortal } from 'react-reverse-portal';\n\nimport { CheckMarkStatus } from 'libs/shared/components/check-mark-button/CheckMarkButton';\nimport { PermissionName } from 'libs/shared/enums/PermissionName';\nimport { usePermissions } from 'libs/shared/hooks/usePermissions';\nimport { Config, CurrentUser, InteractiveMetadata, PlayerViewKey, PresentationAudience, UnionShareObject, YearGroup } from 'libs/shared/interfaces';\nimport { CommonVideoProps } from 'libs/shared/interfaces/CommonVideoProps';\nimport { AuthToken } from 'libs/shared/interfaces/models/AuthToken';\nimport { PlayViewQueryParams } from 'libs/shared/interfaces/query-params/PlayViewQueryParams';\nimport { VideoHelper } from 'libs/shared/utils/VideoHelper';\n\nimport { ArchivedBanner } from 'shared/components/play-page/ArchivedBanner';\nimport { RelatedVideos } from 'shared/components/related-videos/RelatedVideos';\nimport { VideoActionsLocation } from 'shared/hooks/use-video-actions/useVideoActions';\nimport { RelatedVideosHash } from 'shared/hooks/useGetRelatedVideos';\nimport { VideoAppLinkHelper } from 'shared/utils/VideoAppLinkHelper';\nimport { LitePlayerView } from 'shared/views/lite-player/LitePlayerView';\n\nimport { InteractiveTitleAndActions } from '../interactive-title-and-actions/InteractiveTitleAndActions';\n\ninterface PlayInteractiveProps {\n interactive: InteractiveMetadata;\n yearGroups: YearGroup[];\n currentUser: CurrentUser;\n token: AuthToken;\n config: Config;\n audiences: PresentationAudience[];\n queryParams: PlayViewQueryParams;\n viewKey: PlayerViewKey;\n startTime?: string;\n endTime?: string;\n relatedVideos: RelatedVideosHash;\n commonVideoProps: CommonVideoProps;\n\n // Share view only\n shareLink?: UnionShareObject;\n sharerInstanceRegion?: string;\n checkMarkStatus?: CheckMarkStatus;\n collectAnonResults?: boolean;\n\n publicName?: string;\n profileId?: string;\n}\n\nexport function PlayInteractive(props: PlayInteractiveProps): JSX.Element {\n const [ showHeading, setShowHeading ] = React.useState(true);\n\n const isArchived = VideoHelper.isVideoTypeArchived(props.interactive);\n\n const summaryPortalNode = React.useMemo(() => createHtmlPortalNode(), []);\n\n const { hasPermissions } = usePermissions();\n\n function onShowSummary(showing: boolean): void {\n setShowHeading(!showing);\n }\n\n return (\n <div className='px-3'>\n {isArchived && <ArchivedBanner typeId={props.interactive.typeId} hasStudentExperience />}\n\n <div className='mb-3'>\n <LitePlayerView\n config={props.config}\n video={props.interactive}\n currentUser={props.currentUser}\n shareLink={props.shareLink}\n viewKey={props.viewKey}\n startTime={props.startTime}\n presentationSlug={null}\n context={props.queryParams?.context}\n contextId={props.queryParams?.contextId}\n playNext={props.queryParams?.playNext}\n mode='default'\n relatedVideos={props.relatedVideos?.videos}\n onShowSummary={onShowSummary}\n summaryPortalNode={summaryPortalNode}\n token={props.token}\n collectAnonResults={props.collectAnonResults}\n />\n </div>\n\n {/* This wrapping div is here because react seems to not want to play nice\n with adding or removing a node just ahead of an OutPortal */}\n <div>\n {showHeading && (\n <InteractiveTitleAndActions\n interactive={props.interactive}\n location={VideoActionsLocation.PlayPage}\n commonVideoProps={props.commonVideoProps}\n shareId={props.shareLink?.id}\n />\n )}\n </div>\n \n <OutPortal node={summaryPortalNode}></OutPortal>\n\n {!hasPermissions(PermissionName.StudentExperience) && (\n <RelatedVideos\n presentationSlug={null}\n currentVideo={props.interactive}\n currentUser={props.currentUser}\n relatedVideos={props.relatedVideos}\n audiences={props.audiences}\n getVideoAppLink={(v, opts) => VideoAppLinkHelper.getAppLink(v, {\n ...opts,\n context: props.queryParams.context,\n contextId: props.queryParams.contextId,\n playNext: props.queryParams.playNext,\n shareId: props.shareLink?.id,\n moviesAndTv: props.queryParams.mtv,\n includeContext: props.currentUser?.isAuthenticated\n }, null)}\n moviesAndTv={props.queryParams.mtv}\n commonVideoProps={props.commonVideoProps}\n />\n )}\n </div>\n );\n}\n","import React from 'react';\n\nimport { LanguageService } from 'libs/common/backbone/services/LanguageService';\n\nimport { SvgContainer, SvgContainerSize } from 'libs/shared/components/svg-container/SvgContainer';\nimport { Text } from 'libs/shared/components/text/Text';\nimport { ToggleSwitch } from 'libs/shared/components/toggle-switch/ToggleSwitch';\nimport { Tooltip } from 'libs/shared/components/tooltip/Tooltip';\nimport { ArchiveSvg } from 'libs/shared/images/svg/objects/ArchiveSvg';\n\nconst namespace = 'interactives.previewInteractive';\nconst getPhrase = LanguageService.encloseNamespace(namespace);\n\ninterface InteractiveAlertBannerProps {\n isPreviewPreventScrubbingEnabled: boolean;\n isPreviewingPreventScrubbing: boolean;\n toggleStudentMode: () => void;\n isArchived: boolean;\n}\n\nexport function InteractiveAlertBanner(props: InteractiveAlertBannerProps): JSX.Element {\n return (\n <div className='alert text-dark bg-light-blue px-2 rounded d-flex flex-column flex-lg-row justify-content-between mb-3 align-items-center' role='alert'>\n {!props.isArchived ? <Text phrase='alert' /> : (\n <div className='d-flex align-items-center'>\n <SvgContainer\n svg={ArchiveSvg}\n size={SvgContainerSize.Standard}\n className='me-2 svg-container'\n />\n \n <div className='w-100'>\n <p className='fw-semibold mb-0'>{getPhrase('archivedInfoTitle')}</p>\n <p className='mb-1'>{getPhrase('archivedInfo')}</p>\n </div>\n </div>\n )}\n {props.isPreviewPreventScrubbingEnabled && (\n <Tooltip\n title={getPhrase('previewPreventScrubbingExplain')}\n trigger={[ 'hover', 'focus' ]}\n spanHack\n >\n <div className='d-flex mt-1 mt-lg-0'>\n <div className='me-2'><Text phrase='previewPreventScrubbing'/></div>\n <ToggleSwitch on={props.isPreviewingPreventScrubbing} onClick={props.toggleStudentMode} />\n </div>\n </Tooltip>\n )}\n </div>\n );\n}\n","import React from 'react';\n\nexport function usePreviewPreventInteractive(\n previewPreventInteractive: boolean,\n togglePreviewPreventInteractive: () => void\n): void {\n React.useEffect(() => {\n togglePreviewPreventInteractive();\n }, [previewPreventInteractive]);\n}\n","import * as React from 'react';\nimport { OutPortal } from 'react-reverse-portal';\n\nimport { LanguageService } from 'libs/common/backbone/services/LanguageService';\nimport { TextHelper } from 'libs/common/react/utils/TextHelper';\n\nimport { Breadcrumb, Breadcrumbs } from 'libs/shared/components/breadcrumbs/Breadcrumbs';\nimport { ExpandableText } from 'libs/shared/components/expandable-text/ExpandableText';\nimport { InteractiveWidgetItem } from 'libs/shared/components/play-page/interactives-widget/InteractiveWidgetItem';\nimport { LanguageNamespaceContext } from 'libs/shared/components/text/Text';\nimport { FixedWidget } from 'libs/shared/components/widgets/fixed-widget';\nimport { GlobalPlayerConsumer } from 'libs/shared/context/player-context/components/GlobalPlayerConsumer';\nimport { usePlayerContext } from 'libs/shared/context/player-context/PlayerContext';\nimport { MasterType } from 'libs/shared/enums/MasterType';\nimport { WidgetContents } from 'libs/shared/enums/WidgetContents';\nimport { CurrentUser, Interactive, InteractiveMetadata, PresentationAudience } from 'libs/shared/interfaces';\nimport { CommonVideoProps } from 'libs/shared/interfaces/CommonVideoProps';\nimport { AuthToken } from 'libs/shared/interfaces/models/AuthToken';\nimport { PlayViewQueryParams } from 'libs/shared/interfaces/query-params/PlayViewQueryParams';\nimport { VideoHelper } from 'libs/shared/utils/VideoHelper';\n\nimport { CitationWidget } from 'shared/components/citations/CitationWidget';\nimport { RestrictionBanner } from 'shared/components/play-page/RestrictionBanner';\nimport { RelatedVideos } from 'shared/components/related-videos/RelatedVideos';\nimport { Actions } from 'shared/constants/LiteActions';\nimport { AppChannels } from 'shared/constants/LiteRadioChannels';\nimport { VideoActionsLocation } from 'shared/hooks/use-video-actions/useVideoActions';\nimport { RelatedVideosHash } from 'shared/hooks/useGetRelatedVideos';\nimport { VideoAppLinkHelper } from 'shared/utils/VideoAppLinkHelper';\n\nimport { InteractiveAlertBanner } from 'apps/interactives/components/preview-interactive/InteractiveAlertBanner';\nimport { usePreviewPreventInteractive } from 'apps/interactives/hooks/interactiveHooks';\n\nimport { InteractiveTitleAndActions } from '../interactive-title-and-actions/InteractiveTitleAndActions';\n\nconst namespace = 'interactives.previewInteractive';\nconst getPhrase = LanguageService.encloseNamespace(namespace);\n\ninterface PreviewInteractiveProps {\n interactive: InteractiveMetadata;\n interactives: InteractiveMetadata[];\n token?: AuthToken;\n currentUser: CurrentUser;\n queryParams: PlayViewQueryParams;\n audiences: PresentationAudience[];\n isPreviewPreventScrubbingEnabled: boolean;\n relatedVideos: RelatedVideosHash;\n canManageVideoAccess: boolean;\n breadcrumbs?: Breadcrumb[];\n commonVideoProps: CommonVideoProps;\n\n // Share view only\n shareId?: string;\n}\n\nexport function PreviewInteractive(props: PreviewInteractiveProps): JSX.Element {\n const playerContext = usePlayerContext();\n\n const [ isPreviewingPreventScrubbing, setIsPreviewingPreventScrubbing ] = React.useState(false);\n\n const { canConsume } = VideoHelper.getCanBeConsumed(props.interactive);\n\n usePreviewPreventInteractive(isPreviewingPreventScrubbing, togglePreviewPreventScrubbing);\n\n function togglePreviewPreventScrubbing() {\n playerContext.playerRef?.current?.togglePreviewPreventScrubbing?.();\n }\n\n function toggleStudentMode() {\n setIsPreviewingPreventScrubbing(!isPreviewingPreventScrubbing);\n }\n \n const otherInteractives: InteractiveMetadata[] = props.interactives?.filter(i => {\n return i.id.toString() !== props.interactive.id.toString();\n });\n\n return (\n <LanguageNamespaceContext.Provider value={namespace}>\n <div className='px-4'>\n {!!props.breadcrumbs?.length &&\n <div className='mb-2'>\n <Breadcrumbs breadcrumbs={props.breadcrumbs} />\n </div>\n }\n\n <RestrictionBanner\n restrictions={props.interactive._restrictions}\n yearGroups={props.commonVideoProps.yearGroups}\n objectId={props.interactive.id}\n objectTypeId={MasterType.Interactive}\n canManageVideoAccess={props.canManageVideoAccess}\n />\n\n <InteractiveAlertBanner\n isPreviewPreventScrubbingEnabled={props.isPreviewPreventScrubbingEnabled}\n isPreviewingPreventScrubbing={isPreviewingPreventScrubbing}\n toggleStudentMode={toggleStudentMode}\n isArchived={VideoHelper.isVideoTypeArchived(props.interactive)}\n />\n\n <div className='mb-3'>\n {canConsume && (\n <GlobalPlayerConsumer\n key={props.interactive.id}\n objectId={props.interactive.id}\n objectTypeId={props.interactive.typeId}\n shareId={props.shareId}\n startTime={props.queryParams.t ?? props.queryParams.startTime}\n context={props.queryParams?.context}\n contextId={props.queryParams?.contextId}\n playNext={props.queryParams?.playNext}\n mode='default'\n location='play-page'\n token={props.token}\n />\n )}\n </div>\n \n <InteractiveTitleAndActions\n interactive={props.interactive}\n location={VideoActionsLocation.PlayPage}\n shareId={props.shareId}\n commonVideoProps={props.commonVideoProps}\n />\n\n {props.interactive.description && (\n <ExpandableText lines={5}>\n {() => <p className='mb-0 d-inline'>{props.interactive.description}</p>}\n </ExpandableText>\n )}\n\n <div className='mb-3'>\n <OutPortal node={playerContext.questionListPortalNode}></OutPortal>\n </div>\n\n {!!otherInteractives?.length && (\n <div className='pb-3'>\n \n <FixedWidget\n name={getPhrase('otherInteractives', { count: otherInteractives.length })}\n contents={WidgetContents.Interactives}\n collection={otherInteractives}\n prefetched\n getChildAppLink={(interactive: Interactive) => {\n return {\n application: AppChannels.INTERACTIVES,\n action: Actions.Interactives.VIEW_INTERACTIVE,\n args: [ interactive.id, TextHelper.slugify(interactive.name) ]\n };\n }}\n childComponent={InteractiveWidgetItem}\n extraChildComponentProps={{\n questionsAppLink: {\n application: AppChannels.INTERACTIVES,\n action: Actions.Interactives.PREVIEW_QUESTIONS\n },\n commonVideoProps: props.commonVideoProps\n }}\n analyticsData={{ widgetId: 'interactives' }}\n />\n </div>\n )}\n\n {!VideoHelper.isUgc(props.interactive) && (\n <CitationWidget\n media={props.interactive}\n parentVideo={props.interactive._parentClip || props.interactive._parentVideo}\n contentRegion={props.currentUser.contentRegion}\n shareId={props.shareId}\n presentationSlug={null}\n />\n )}\n\n <RelatedVideos\n presentationSlug={null}\n currentVideo={props.interactive}\n currentUser={props.currentUser}\n audiences={props.audiences}\n relatedVideos={props.relatedVideos}\n getVideoAppLink={(v, opts) => VideoAppLinkHelper.getAppLink(v, {\n ...opts,\n context: props.queryParams.context,\n contextId: props.queryParams.contextId,\n playNext: props.queryParams.playNext,\n shareId: props.shareId,\n moviesAndTv: props.queryParams.mtv,\n includeContext: props.currentUser?.isAuthenticated\n }, null)}\n moviesAndTv={props.queryParams.mtv}\n commonVideoProps={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EAAG,IAAI,EACP,YAAa,EAAM,YAAY,IAC/B,iBAAkB,EAAM,gBACzB,CAAA,CACE,GAC4B,CAAA,CAEvC"}
|
|
1
|
+
{"version":3,"file":"BBndy2td2.chunk.js","names":[],"sources":["../../src/shared/hooks/useShouldPreviewInteractive.ts","../../src/apps/interactives/components/interactive-title-and-actions/InteractiveTitleAndActions.tsx","../../src/apps/interactives/components/play-interactive/PlayInteractive.tsx","../../src/apps/interactives/components/preview-interactive/InteractiveAlertBanner.tsx","../../src/apps/interactives/hooks/interactiveHooks.tsx","../../src/apps/interactives/components/preview-interactive/PreviewInteractive.tsx"],"sourcesContent":["import { Flight } from 'libs/common/flight';\n\nimport { PermissionName } from 'libs/shared/enums/PermissionName';\nimport { ProductId } from 'libs/shared/enums/ProductId';\nimport { UserRequests } from 'libs/shared/flight-requests/UserRequests';\nimport { usePermissions } from 'libs/shared/hooks/usePermissions';\nimport { useProducts } from 'libs/shared/hooks/UseProducts';\nimport { CurrentUser, UnionShareObject } from 'libs/shared/interfaces';\n\nexport function useShouldPreviewInteractive(shareLink?: UnionShareObject) {\n const { hasPermissions } = usePermissions();\n const { hasProduct } = useProducts();\n const currentUser = Flight.useBasicFetch<CurrentUser>(UserRequests.currentUser());\n\n return !hasPermissions(PermissionName.StudentExperience) &&\n hasProduct(ProductId.Primary) &&\n currentUser.data.isAuthenticated &&\n (!shareLink || shareLink.version === 'v1'); // Previewing shares is not supported for Share 2.0 links\n}\n","import React from 'react';\n\nimport { Core } from 'libs/common/backbone/index';\nimport { TextHelper } from 'libs/common/react/utils/TextHelper';\n\nimport { Actions as ActionsComponent } from 'libs/shared/components/actions/Actions';\nimport { AppLink } from 'libs/shared/components/app-link/AppLink';\nimport { LanguageNamespaceContext, Text } from 'libs/shared/components/text/Text';\nimport { RestrictionPadlock } from 'libs/shared/components/video-list/components/restriction-padlock/RestrictionPadlock';\nimport { CurationStatus } from 'libs/shared/enums/CurationStatus';\nimport { PermissionName } from 'libs/shared/enums/PermissionName';\nimport { usePermissions } from 'libs/shared/hooks/usePermissions';\nimport { InteractiveMetadata } from 'libs/shared/interfaces';\nimport { CommonVideoProps } from 'libs/shared/interfaces/CommonVideoProps';\nimport { VideoHelper } from 'libs/shared/utils/VideoHelper';\n\nimport { Actions } from 'shared/constants/LiteActions';\nimport { AppChannels } from 'shared/constants/LiteRadioChannels';\nimport { useVideoActions, VideoActionsLocation } from 'shared/hooks/use-video-actions/useVideoActions';\n\nconst namespace = 'interactives.interactiveTitleAndActions';\n\nfunction getBackToData(interactive: InteractiveMetadata): [name: string, appLink: Core.AppLink] {\n let name: string;\n let appLink: Core.AppLink;\n \n if (interactive._parentClip) {\n name = interactive._parentClip.name;\n appLink = {\n application: AppChannels.CLIPS,\n action: Actions.Clips.PLAY_CLIP,\n args: [ interactive._parentClip.id, TextHelper.slugify(interactive._parentClip.name) ]\n };\n } else {\n name = interactive._parentVideo.name;\n appLink = {\n application: AppChannels.VIDEOS,\n action: Actions.Videos.PLAY_VIDEO,\n args: [\n null,\n interactive._parentVideo.id,\n TextHelper.slugify(interactive._parentVideo.name)\n ]\n };\n }\n\n return [ name, appLink ];\n}\n\ninterface InteractiveTitleAndActionsProps {\n interactive: InteractiveMetadata;\n location: VideoActionsLocation;\n shareId?: string;\n commonVideoProps: CommonVideoProps;\n}\n\nexport function InteractiveTitleAndActions(props: InteractiveTitleAndActionsProps): JSX.Element {\n const { hasPermissions } = usePermissions();\n const videoActions = useVideoActions({\n location: props.location,\n shareId: props.shareId,\n presentationSlug: null\n });\n\n const hasStudentExperience = hasPermissions(PermissionName.StudentExperience);\n\n const isDraft = props.interactive.status === CurationStatus.Draft;\n const [ backToName, backToAppLink ] = getBackToData(props.interactive);\n \n return (\n <LanguageNamespaceContext.Provider value={namespace}>\n <div className='d-flex justify-content-between align-items-center'>\n <div className='inline-block w-100'>\n <div className='ms-2 float-end'>\n {!hasStudentExperience &&\n <ActionsComponent\n actions={videoActions.getVideoActions(props.interactive)}\n actionsDropdownClassName='btn btn-outline-dark'\n fetchMore={() => videoActions.fetchMoreActions(props.interactive)}\n />\n }\n </div>\n\n <h1 className='h3 mb-2'>\n {isDraft && (\n <div className='badge draft-badge me-2 align-bottom flex-shrink-0 h-auto lh-base'>\n <Text phrase='draft' />\n </div>\n )}\n {props.interactive.name}\n {!hasStudentExperience && (\n <RestrictionPadlock\n tooltipPlacement='right'\n className='ps-1 d-inline-block'\n video={props.interactive}\n yearGroups={props.commonVideoProps.yearGroups}\n />\n )}\n </h1>\n {VideoHelper.canViewOriginalVideo(props.interactive) &&\n <div className='mb-1 me-3 clamp-1'>\n <Text phrase='viewOriginal' /> <AppLink appLink={backToAppLink} className='text-info'>{backToName}</AppLink>\n </div>\n }\n </div>\n </div>\n </LanguageNamespaceContext.Provider>\n );\n}\n","import React from 'react';\nimport { createHtmlPortalNode, OutPortal } from 'react-reverse-portal';\n\nimport { CheckMarkStatus } from 'libs/shared/components/check-mark-button/CheckMarkButton';\nimport { PermissionName } from 'libs/shared/enums/PermissionName';\nimport { usePermissions } from 'libs/shared/hooks/usePermissions';\nimport { Config, CurrentUser, InteractiveMetadata, PlayerViewKey, PresentationAudience, UnionShareObject, YearGroup } from 'libs/shared/interfaces';\nimport { CommonVideoProps } from 'libs/shared/interfaces/CommonVideoProps';\nimport { AuthToken } from 'libs/shared/interfaces/models/AuthToken';\nimport { PlayViewQueryParams } from 'libs/shared/interfaces/query-params/PlayViewQueryParams';\nimport { VideoHelper } from 'libs/shared/utils/VideoHelper';\n\nimport { ArchivedBanner } from 'shared/components/play-page/ArchivedBanner';\nimport { RelatedVideos } from 'shared/components/related-videos/RelatedVideos';\nimport { VideoActionsLocation } from 'shared/hooks/use-video-actions/useVideoActions';\nimport { RelatedVideosHash } from 'shared/hooks/useGetRelatedVideos';\nimport { VideoAppLinkHelper } from 'shared/utils/VideoAppLinkHelper';\nimport { LitePlayerView } from 'shared/views/lite-player/LitePlayerView';\n\nimport { InteractiveTitleAndActions } from '../interactive-title-and-actions/InteractiveTitleAndActions';\n\ninterface PlayInteractiveProps {\n interactive: InteractiveMetadata;\n yearGroups: YearGroup[];\n currentUser: CurrentUser;\n token: AuthToken;\n config: Config;\n audiences: PresentationAudience[];\n queryParams: PlayViewQueryParams;\n viewKey: PlayerViewKey;\n startTime?: string;\n endTime?: string;\n relatedVideos: RelatedVideosHash;\n commonVideoProps: CommonVideoProps;\n\n // Share view only\n shareLink?: UnionShareObject;\n sharerInstanceRegion?: string;\n checkMarkStatus?: CheckMarkStatus;\n collectAnonResults?: boolean;\n\n publicName?: string;\n profileId?: string;\n}\n\nexport function PlayInteractive(props: PlayInteractiveProps): JSX.Element {\n const [ showHeading, setShowHeading ] = React.useState(true);\n\n const isArchived = VideoHelper.isVideoTypeArchived(props.interactive);\n\n const summaryPortalNode = React.useMemo(() => createHtmlPortalNode(), []);\n\n const { hasPermissions } = usePermissions();\n\n function onShowSummary(showing: boolean): void {\n setShowHeading(!showing);\n }\n\n return (\n <div className='px-3'>\n {isArchived && <ArchivedBanner typeId={props.interactive.typeId} hasStudentExperience />}\n\n <div className='mb-3'>\n <LitePlayerView\n config={props.config}\n video={props.interactive}\n currentUser={props.currentUser}\n shareLink={props.shareLink}\n viewKey={props.viewKey}\n startTime={props.startTime}\n presentationSlug={null}\n context={props.queryParams?.context}\n contextId={props.queryParams?.contextId}\n playNext={props.queryParams?.playNext}\n mode='default'\n relatedVideos={props.relatedVideos?.videos}\n onShowSummary={onShowSummary}\n summaryPortalNode={summaryPortalNode}\n token={props.token}\n collectAnonResults={props.collectAnonResults}\n />\n </div>\n\n {/* This wrapping div is here because react seems to not want to play nice\n with adding or removing a node just ahead of an OutPortal */}\n <div>\n {showHeading && (\n <InteractiveTitleAndActions\n interactive={props.interactive}\n location={VideoActionsLocation.PlayPage}\n commonVideoProps={props.commonVideoProps}\n shareId={props.shareLink?.id}\n />\n )}\n </div>\n \n <OutPortal node={summaryPortalNode}></OutPortal>\n\n {!hasPermissions(PermissionName.StudentExperience) && (\n <RelatedVideos\n presentationSlug={null}\n currentVideo={props.interactive}\n currentUser={props.currentUser}\n relatedVideos={props.relatedVideos}\n audiences={props.audiences}\n getVideoAppLink={(v, opts) => VideoAppLinkHelper.getAppLink(v, {\n ...opts,\n context: props.queryParams.context,\n contextId: props.queryParams.contextId,\n playNext: props.queryParams.playNext,\n shareId: props.shareLink?.id,\n moviesAndTv: props.queryParams.mtv,\n includeContext: props.currentUser?.isAuthenticated\n }, null)}\n moviesAndTv={props.queryParams.mtv}\n commonVideoProps={props.commonVideoProps}\n />\n )}\n </div>\n );\n}\n","import React from 'react';\n\nimport { LanguageService } from 'libs/common/backbone/services/LanguageService';\n\nimport { SvgContainer, SvgContainerSize } from 'libs/shared/components/svg-container/SvgContainer';\nimport { Text } from 'libs/shared/components/text/Text';\nimport { ToggleSwitch } from 'libs/shared/components/toggle-switch/ToggleSwitch';\nimport { Tooltip } from 'libs/shared/components/tooltip/Tooltip';\nimport { ArchiveSvg } from 'libs/shared/images/svg/objects/ArchiveSvg';\n\nconst namespace = 'interactives.previewInteractive';\nconst getPhrase = LanguageService.encloseNamespace(namespace);\n\ninterface InteractiveAlertBannerProps {\n isPreviewPreventScrubbingEnabled: boolean;\n isPreviewingPreventScrubbing: boolean;\n toggleStudentMode: () => void;\n isArchived: boolean;\n}\n\nexport function InteractiveAlertBanner(props: InteractiveAlertBannerProps): JSX.Element {\n return (\n <div className='alert text-dark bg-light-blue px-2 rounded d-flex flex-column flex-lg-row justify-content-between mb-3 align-items-center' role='alert'>\n {!props.isArchived ? <Text phrase='alert' /> : (\n <div className='d-flex align-items-center'>\n <SvgContainer\n svg={ArchiveSvg}\n size={SvgContainerSize.Standard}\n className='me-2 svg-container'\n />\n \n <div className='w-100'>\n <p className='fw-semibold mb-0'>{getPhrase('archivedInfoTitle')}</p>\n <p className='mb-1'>{getPhrase('archivedInfo')}</p>\n </div>\n </div>\n )}\n {props.isPreviewPreventScrubbingEnabled && (\n <Tooltip\n title={getPhrase('previewPreventScrubbingExplain')}\n trigger={[ 'hover', 'focus' ]}\n spanHack\n >\n <div className='d-flex mt-1 mt-lg-0'>\n <div className='me-2'><Text phrase='previewPreventScrubbing'/></div>\n <ToggleSwitch on={props.isPreviewingPreventScrubbing} onClick={props.toggleStudentMode} />\n </div>\n </Tooltip>\n )}\n </div>\n );\n}\n","import React from 'react';\n\nexport function usePreviewPreventInteractive(\n previewPreventInteractive: boolean,\n togglePreviewPreventInteractive: () => void\n): void {\n React.useEffect(() => {\n togglePreviewPreventInteractive();\n }, [previewPreventInteractive]);\n}\n","import * as React from 'react';\nimport { OutPortal } from 'react-reverse-portal';\n\nimport { LanguageService } from 'libs/common/backbone/services/LanguageService';\nimport { TextHelper } from 'libs/common/react/utils/TextHelper';\n\nimport { Breadcrumb, Breadcrumbs } from 'libs/shared/components/breadcrumbs/Breadcrumbs';\nimport { ExpandableText } from 'libs/shared/components/expandable-text/ExpandableText';\nimport { InteractiveWidgetItem } from 'libs/shared/components/play-page/interactives-widget/InteractiveWidgetItem';\nimport { LanguageNamespaceContext } from 'libs/shared/components/text/Text';\nimport { FixedWidget } from 'libs/shared/components/widgets/fixed-widget';\nimport { GlobalPlayerConsumer } from 'libs/shared/context/player-context/components/GlobalPlayerConsumer';\nimport { usePlayerContext } from 'libs/shared/context/player-context/PlayerContext';\nimport { MasterType } from 'libs/shared/enums/MasterType';\nimport { WidgetContents } from 'libs/shared/enums/WidgetContents';\nimport { CurrentUser, Interactive, InteractiveMetadata, PresentationAudience } from 'libs/shared/interfaces';\nimport { CommonVideoProps } from 'libs/shared/interfaces/CommonVideoProps';\nimport { AuthToken } from 'libs/shared/interfaces/models/AuthToken';\nimport { PlayViewQueryParams } from 'libs/shared/interfaces/query-params/PlayViewQueryParams';\nimport { VideoHelper } from 'libs/shared/utils/VideoHelper';\n\nimport { CitationWidget } from 'shared/components/citations/CitationWidget';\nimport { RestrictionBanner } from 'shared/components/play-page/RestrictionBanner';\nimport { RelatedVideos } from 'shared/components/related-videos/RelatedVideos';\nimport { Actions } from 'shared/constants/LiteActions';\nimport { AppChannels } from 'shared/constants/LiteRadioChannels';\nimport { VideoActionsLocation } from 'shared/hooks/use-video-actions/useVideoActions';\nimport { RelatedVideosHash } from 'shared/hooks/useGetRelatedVideos';\nimport { VideoAppLinkHelper } from 'shared/utils/VideoAppLinkHelper';\n\nimport { InteractiveAlertBanner } from 'apps/interactives/components/preview-interactive/InteractiveAlertBanner';\nimport { usePreviewPreventInteractive } from 'apps/interactives/hooks/interactiveHooks';\n\nimport { InteractiveTitleAndActions } from '../interactive-title-and-actions/InteractiveTitleAndActions';\n\nconst namespace = 'interactives.previewInteractive';\nconst getPhrase = LanguageService.encloseNamespace(namespace);\n\ninterface PreviewInteractiveProps {\n interactive: InteractiveMetadata;\n interactives: InteractiveMetadata[];\n token?: AuthToken;\n currentUser: CurrentUser;\n queryParams: PlayViewQueryParams;\n audiences: PresentationAudience[];\n isPreviewPreventScrubbingEnabled: boolean;\n relatedVideos: RelatedVideosHash;\n canManageVideoAccess: boolean;\n breadcrumbs?: Breadcrumb[];\n commonVideoProps: CommonVideoProps;\n\n // Share view only\n shareId?: string;\n}\n\nexport function PreviewInteractive(props: PreviewInteractiveProps): JSX.Element {\n const playerContext = usePlayerContext();\n\n const [ isPreviewingPreventScrubbing, setIsPreviewingPreventScrubbing ] = React.useState(false);\n\n const { canConsume } = VideoHelper.getCanBeConsumed(props.interactive);\n\n usePreviewPreventInteractive(isPreviewingPreventScrubbing, togglePreviewPreventScrubbing);\n\n function togglePreviewPreventScrubbing() {\n playerContext.playerRef?.current?.togglePreviewPreventScrubbing?.();\n }\n\n function toggleStudentMode() {\n setIsPreviewingPreventScrubbing(!isPreviewingPreventScrubbing);\n }\n \n const otherInteractives: InteractiveMetadata[] = props.interactives?.filter(i => {\n return i.id.toString() !== props.interactive.id.toString();\n });\n\n return (\n <LanguageNamespaceContext.Provider value={namespace}>\n <div className='px-4'>\n {!!props.breadcrumbs?.length &&\n <div className='mb-2'>\n <Breadcrumbs breadcrumbs={props.breadcrumbs} />\n </div>\n }\n\n <RestrictionBanner\n restrictions={props.interactive._restrictions}\n yearGroups={props.commonVideoProps.yearGroups}\n objectId={props.interactive.id}\n objectTypeId={MasterType.Interactive}\n canManageVideoAccess={props.canManageVideoAccess}\n />\n\n <InteractiveAlertBanner\n isPreviewPreventScrubbingEnabled={props.isPreviewPreventScrubbingEnabled}\n isPreviewingPreventScrubbing={isPreviewingPreventScrubbing}\n toggleStudentMode={toggleStudentMode}\n isArchived={VideoHelper.isVideoTypeArchived(props.interactive)}\n />\n\n <div className='mb-3'>\n {canConsume && (\n <GlobalPlayerConsumer\n key={props.interactive.id}\n objectId={props.interactive.id}\n objectTypeId={props.interactive.typeId}\n shareId={props.shareId}\n startTime={props.queryParams.t ?? props.queryParams.startTime}\n context={props.queryParams?.context}\n contextId={props.queryParams?.contextId}\n playNext={props.queryParams?.playNext}\n mode='default'\n location='play-page'\n token={props.token}\n />\n )}\n </div>\n \n <InteractiveTitleAndActions\n interactive={props.interactive}\n location={VideoActionsLocation.PlayPage}\n shareId={props.shareId}\n commonVideoProps={props.commonVideoProps}\n />\n\n {props.interactive.description && (\n <ExpandableText lines={5}>\n {() => <p className='mb-0 d-inline'>{props.interactive.description}</p>}\n </ExpandableText>\n )}\n\n <div className='mb-3'>\n <OutPortal node={playerContext.questionListPortalNode}></OutPortal>\n </div>\n\n {!!otherInteractives?.length && (\n <div className='pb-3'>\n \n <FixedWidget\n name={getPhrase('otherInteractives', { count: otherInteractives.length })}\n contents={WidgetContents.Interactives}\n collection={otherInteractives}\n prefetched\n getChildAppLink={(interactive: Interactive) => {\n return {\n application: AppChannels.INTERACTIVES,\n action: Actions.Interactives.VIEW_INTERACTIVE,\n args: [ interactive.id, TextHelper.slugify(interactive.name) ]\n };\n }}\n childComponent={InteractiveWidgetItem}\n extraChildComponentProps={{\n questionsAppLink: {\n application: AppChannels.INTERACTIVES,\n action: Actions.Interactives.PREVIEW_QUESTIONS\n },\n commonVideoProps: props.commonVideoProps\n }}\n analyticsData={{ widgetId: 'interactives' }}\n />\n </div>\n )}\n\n {!VideoHelper.isUgc(props.interactive) && (\n <CitationWidget\n media={props.interactive}\n parentVideo={props.interactive._parentClip || props.interactive._parentVideo}\n contentRegion={props.currentUser.contentRegion}\n shareId={props.shareId}\n presentationSlug={null}\n />\n )}\n\n <RelatedVideos\n presentationSlug={null}\n currentVideo={props.interactive}\n currentUser={props.currentUser}\n audiences={props.audiences}\n relatedVideos={props.relatedVideos}\n getVideoAppLink={(v, opts) => VideoAppLinkHelper.getAppLink(v, {\n ...opts,\n context: props.queryParams.context,\n contextId: props.queryParams.contextId,\n playNext: props.queryParams.playNext,\n shareId: props.shareId,\n moviesAndTv: props.queryParams.mtv,\n includeContext: props.currentUser?.isAuthenticated\n }, null)}\n moviesAndTv={props.queryParams.mtv}\n commonVideoProps={props.commonVideoProps}\n />\n </div>\n </LanguageNamespaceContext.Provider>\n );\n}\n"],"mappings":"q1CASA,SAAgB,EAA4B,EAA8B,CACxE,GAAM,CAAE,kBAAmB,EAAe,EACpC,CAAE,cAAe,EAAY,EAC7B,EAAc,EAAkC,EAAa,YAAY,CAAC,EAEhF,MAAO,CAAC,EAAe,EAAe,iBAAiB,GACrD,EAAW,EAAU,OAAO,GAC5B,EAAY,KAAK,kBAChB,CAAC,GAAa,EAAU,UAAY,KACzC,sBCEM,EAAY,0CAElB,SAAS,EAAc,EAAyE,CAC9F,IAAI,EACA,EAsBJ,OApBI,EAAY,aACd,EAAO,EAAY,YAAY,KAC/B,EAAU,CACR,YAAa,EAAY,MACzB,OAAQ,EAAQ,MAAM,UACtB,KAAM,CAAE,EAAY,YAAY,GAAI,EAAW,QAAQ,EAAY,YAAY,IAAI,CAAE,CACvF,IAEA,EAAO,EAAY,aAAa,KAChC,EAAU,CACR,YAAa,EAAY,OACzB,OAAQ,EAAQ,OAAO,WACvB,KAAM,CACJ,KACA,EAAY,aAAa,GACzB,EAAW,QAAQ,EAAY,aAAa,IAAI,CAClD,CACF,GAGK,CAAE,EA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Y,MAAM,EAAM,WAAW,IACnC,EAAA,EAAA,IAAA,CAAC,EAAD,CACE,MAAO,EAAM,YACb,YAAa,EAAM,YAAY,aAAe,EAAM,YAAY,aAChE,cAAe,EAAM,YAAY,cACjC,QAAS,EAAM,QACf,iBAAkB,IACnB,CAAA,GAGH,EAAA,EAAA,IAAA,CAAC,EAAD,CACE,iBAAkB,KAClB,aAAc,EAAM,YACpB,YAAa,EAAM,YACnB,UAAW,EAAM,UACjB,cAAe,EAAM,cACrB,iBAAkB,EAAG,IAAS,EAAmB,WAAW,EAAG,CAC7D,GAAG,EACH,QAAS,EAAM,YAAY,QAC3B,UAAW,EAAM,YAAY,UAC7B,SAAU,EAAM,YAAY,SAC5B,QAAS,EAAM,QACf,YAAa,EAAM,YAAY,IAC/B,eAAgB,EAAM,aAAa,eACrC,EAAG,IAAI,EACP,YAAa,EAAM,YAAY,IAC/B,iBAAkB,EAAM,gBACzB,CAAA,CACE,GAC4B,CAAA,CAEvC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{o as e}from"./DAXXjFlN.chunk.js";import{x as t}from"./BftnFbcr.chunk.js";import{t as n}from"./C2w0pmFW.chunk.js";import{t as r}from"./wrLrTezN.chunk.js";import{C as i,U as a,d as o,l as s,z as c}from"./NlCAcBdo.chunk.js";import{t as l}from"./DC8Dg20g.chunk.js";import{a as u,c as d,d as f,f as p,l as ee,n as m,o as h,p as g,s as te,t as _,u as v}from"./
|
|
1
|
+
import{o as e}from"./DAXXjFlN.chunk.js";import{x as t}from"./BftnFbcr.chunk.js";import{t as n}from"./C2w0pmFW.chunk.js";import{t as r}from"./wrLrTezN.chunk.js";import{C as i,U as a,d as o,l as s,z as c}from"./NlCAcBdo.chunk.js";import{t as l}from"./DC8Dg20g.chunk.js";import{a as u,c as d,d as f,f as p,l as ee,n as m,o as h,p as g,s as te,t as _,u as v}from"./DTliAJ8L.chunk.js";import{t as y}from"./CnnDkGmK.chunk.js";import{n as b}from"./CvLLqEKv.chunk.js";import"./14z5Gy8L.chunk.js";import"./FysETOFv.chunk.js";import{t as ne}from"./BiKac8UT2.chunk.js";import"./CXUrMkZu.chunk.js";import{a as x,i as S,n as C,o as w,r as T,s as E,t as D}from"./_jJAx6fU.chunk.js";import{t as re}from"./CLjADRa42.chunk.js";var O=e(n()),ie=g.getComponent(`Button`),k=class extends ie{constructor(...e){super(...e),this.alwaysCollapsed=!1,this.isCollapsed=!1,this.isCollabsible=!0}buildCSSClass(){return`cv-create-clip-button`}getCollabsibleName(){return this.controlText_}getCollabsibleValue(){return``}showInCollabsibleMenu(){return!0}showCollapsibleMenu(){super.handleClick(null)}};k.prototype.controlText_=`Create clip`,g.registerComponent(`CreateClipButton`,k);var ae=g.getPlugin(`plugin`),oe=class extends ae{constructor(e,t){super(e,t),this.options=t,e.ready(()=>this.onReady())}onReady(){let e=this.player.getChild(`collapserator`);e&&e.addChild(`CreateClipButton`,{clickHandler:this.options.onClick})}};g.registerPlugin(`createClipButtonPlugin`,oe);var se=g.getComponent(`PictureInPictureToggle`),ce=class extends se{handlePictureInPictureEnabledChange(){this.enable()}};g.registerComponent(`PictureInPictureToggle`,ce);var le=g.getComponent(`PlayToggle`),ue=g.getPlugin(`plugin`),de=800,fe=class extends ue{constructor(e,t){super(e,t),this.options=t,this.bindFunctions(),e.ready(()=>this.initialize())}bindFunctions(){this.requestPictureInPicture=this.requestPictureInPicture.bind(this),this.exitPictureInPicture=this.exitPictureInPicture.bind(this),this.onPlayerResize=this.onPlayerResize.bind(this),this.playerRequestPictureInPictureFn=this.player.requestPictureInPicture,this.playerExitPictureInPictureFn=this.player.exitPictureInPicture,this.player.requestPictureInPicture=this.requestPictureInPicture,this.player.exitPictureInPicture=this.exitPictureInPicture}initialize(){let e=this.player.getChild(`collapserator`);this.toggle=e.addChild(`pictureInPictureToggle`,{}),this.toggle.enable(),this.player.on(`playerresize`,this.onPlayerResize),this.player.on(`dispose`,()=>{this.player?.off(`playerresize`,this.onPlayerResize)})}togglePictureInPicture(e){if(e===this.player.isInPictureInPicture())return;let t=e?`enterpictureinpicture`:`leavepictureinpicture`;this.player.isInPictureInPicture(e),this.player.trigger(t),e?this.addPipStyles():this.removePipStyles()}onPlayerResize(){if(this.player.isInPictureInPicture())return;let e=this.player.el().getBoundingClientRect();e.width!==0&&(e.width<de?this.toggle?.hide():this.toggle?.show())}addPipStyles(){this.player.addClass(`cv-picture-in-picture`),this.playToggle=new le(this.player),this.playToggle.addClass(`cv-pip-play-toggle`),this.player.addChild(this.playToggle),this.player.paused()?this.playToggle.handlePause():this.playToggle.handlePlay()}removePipStyles(){this.player.removeClass(`cv-picture-in-picture`),this.player.removeChild(this.playToggle),delete this.playToggle}requestPictureInPicture(){this.togglePictureInPicture(!0),typeof this.options?.onRequestPictureInPicture==`function`&&this.options.onRequestPictureInPicture(!0)}async exitPictureInPicture(){this.togglePictureInPicture(!1),this.options.onRequestPictureInPicture(!1),this.removePipStyles()}dispose(){this.player.requestPictureInPicture=this.playerRequestPictureInPictureFn,this.player.exitPictureInPicture=this.playerExitPictureInPictureFn,super.dispose()}};g.registerPlugin(`pictureInPicture`,fe);var pe=g.getComponent(`Component`),me=class extends pe{constructor(e,t){super(e,t),this.hasBuffered=!1,this.hasPlayed=!1,this.eventsService=re,this.pointOfInterest=t.pointOfInterest,this.onMouseOver=this.onMouseOver.bind(this),this.onMouseLeave=this.onMouseLeave.bind(this),this.onGlancePointOfInterestMouseEnter=this.onGlancePointOfInterestMouseEnter.bind(this),this.onGlancePointOfInterestMouseLeave=this.onGlancePointOfInterestMouseLeave.bind(this),this.initialize()}initialize(){this.setPosition(),this.bindListeners()}buildCSSClass(){return`cv-point-of-interest-indicator ${super.buildCSSClass()}`}createEl(e,t,n){return super.createEl(e,{...t,className:this.buildCSSClass()},n)}bindListeners(){this.on(`mouseover`,this.onMouseOver),this.on(`mouseleave`,this.onMouseLeave),this.eventsService.subscribe(`glance:poi:mouseover`,this.onGlancePointOfInterestMouseEnter),this.eventsService.subscribe(`glance:poi:mouseleave`,this.onGlancePointOfInterestMouseLeave)}dispose(){this.eventsService.unsubscribe(`glance:poi:mouseover`,this.onGlancePointOfInterestMouseEnter),this.eventsService.unsubscribe(`glance:poi:mouseleave`,this.onGlancePointOfInterestMouseLeave)}getPointOfInterestTime(){return this.pointOfInterest.startTime}setPosition(){let e=this.player().duration();this.el_.style.left=this.getPointOfInterestTime()/e*100+`%`}updateBuffered(e){let t=this.getPointOfInterestTime()<=e;if(t===this.hasBuffered)return;this.hasBuffered=t;let n=`cv-point-of-interest-indicator-buffered`;this.hasBuffered?this.addClass(n):this.removeClass(n)}updatePlaybackProgress(e){let t=this.getPointOfInterestTime()<=e;if(t===this.hasPlayed)return;this.hasPlayed=t;let n=`cv-point-of-interest-indicator-played`;t?this.addClass(n):this.removeClass(n)}toggleVisibility(e){let t=`cv-point-of-interest-indicator-hidden`;e?this.removeClass(t):this.addClass(t)}onMouseOver(){this.setTimeTooltipText(),this.eventsService.trigger(`player:poi:mouseover`,this.pointOfInterest)}onMouseLeave(){this.clearTimeTooltipText(),this.eventsService.trigger(`player:poi:mouseleave`)}onGlancePointOfInterestMouseEnter(e){e.id===this.pointOfInterest.id&&(this.addClass(`cv-point-of-interest-indicator-highlight`),this.setTimeTooltipTime(),this.setTimeTooltipText(),this.positionMouseTimeDisplay(),this.showMouseTimeDisplay())}onGlancePointOfInterestMouseLeave(){this.removeClass(`cv-point-of-interest-indicator-highlight`),this.hideMouseTimeDisplay()}setTimeTooltipText(){this.getTimeTooltip()?.setCustomChapterText(this.pointOfInterest.description)}clearTimeTooltipText(){this.getTimeTooltip()?.setCustomChapterText()}setTimeTooltipTime(){this.getTimeTooltip()?.updateTime(this.getPointOfInterestTime())}positionMouseTimeDisplay(){let e=this.getSeekBar()?.el();if(!e)return;let t=g.dom.findPosition(e),n=this.getPointOfInterestTime()/this.player().duration();this.getMouseTimeDisplay()?.update(t,n)}showMouseTimeDisplay(){this.getMouseTimeDisplay()?.forceShow()}hideMouseTimeDisplay(){this.getMouseTimeDisplay()?.removeForceShow()}getSeekBar(){return this.player().controlBar.getChild(`ProgressControl`)?.getChild(`SeekBar`)}getMouseTimeDisplay(){return this.getSeekBar()?.getChild(`MouseTimeDisplay`)}getTimeTooltip(){return this.getMouseTimeDisplay()?.getChild(`TimeTooltip`)}},A=g.getComponent(`MenuItem`),j=class extends A{constructor(e,t){super(e,t),this.pointsOfInterestVisible=t.pointsOfInterestVisible,this.toggle(this.pointsOfInterestVisible)}handleToggle(){this.toggle(!this.pointsOfInterestVisible)}toggle(e){e?this.toggleOn():this.toggleOff()}toggleOn(){g.dom.addClass(this.toggleEl,`on`),g.dom.setAttribute(this.toggleEl,`aria-checked`,`true`),this.pointsOfInterestVisible=!0,this.player().pointsOfInterestPlugin().togglePointsOfInterest(this.pointsOfInterestVisible)}toggleOff(){g.dom.removeClass(this.toggleEl,`on`),g.dom.setAttribute(this.toggleEl,`aria-checked`,`false`),this.pointsOfInterestVisible=!1,this.player().pointsOfInterestPlugin().togglePointsOfInterest(this.pointsOfInterestVisible)}handleClick(e){e.stopImmediatePropagation()}createEl(e,t,n){this.handlerBound||=(this.handleToggle=this.handleToggle.bind(this),!0),this.toggleEl&&this.toggleEl.removeEventListener(`click`,this.handleToggle),this.toggleEl=g.dom.createEl(`div`,{className:`custom-toggle custom-toggle-info toggle-option float-end`,innerHTML:`<span class="handle"></span></div>`}),g.dom.setAttribute(this.toggleEl,`id`,`poi-toggle`),g.dom.setAttribute(this.toggleEl,`role`,`switch`),this.toggleEl.addEventListener(`click`,this.handleToggle);let r=super.createEl(e,{className:`vjs-menu-item cv-cog-menu-item cv-poi-toggle`,innerHTML:`
|
|
2
2
|
<span for="poi-toggle" class="vjs-menu-item-text">Points of Interest</span>
|
|
3
3
|
<span class="cv-toggle-container"></span>`},n);return r.children[1].appendChild(this.toggleEl),r}};g.registerComponent(`PointsOfInterestMenuItem`,j);var M=g.getPlugin(`plugin`),N=`cvplayer-points-of-interest`,P=class extends M{constructor(e,t){super(e),this.pointOfInterestIndicators=[],this.enabled=!0,this.pointsOfInterest=t?.pointsOfInterest,this.initialize=this.initialize.bind(this),this.updateBuffered=this.updateBuffered.bind(this),this.updatePlaybackProgress=this.updatePlaybackProgress.bind(this),this.player.one(`loadedmetadata`,()=>this.player.ready(this.initialize))}initialize(){this.pointsOfInterest&&(b.hasLocalStorage()&&b.get(N)===`false`&&(this.enabled=!1),this.setupTrack(),this.createPointOfInterestIndicators(),this.addMenuItem(),this.bindListeners())}bindListeners(){this.player.on(`progress`,this.updateBuffered),this.player.on(`timeupdate`,this.updatePlaybackProgress),this.player.on(`dispose`,()=>{this.player?.off(`progress`,this.updateBuffered),this.player?.off(`timeupdate`,this.updatePlaybackProgress)})}togglePointsOfInterest(e){b.set(N,e.toString()),this.pointOfInterestIndicators.forEach(t=>t.toggleVisibility(e))}setupTrack(){let e=this.player.addTextTrack(`metadata`,`pointsofinterest`);this.pointsOfInterest.forEach(t=>{e.addCue({startTime:t.startTime,endTime:t.endTime,text:t.description})}),e.trigger({type:`loadeddata`,target:e})}createPointOfInterestIndicators(){let e=this.player.controlBar.getChild(`ProgressControl`)?.getChild(`SeekBar`);this.pointsOfInterest.forEach(t=>{let n=new me(this.player,{pointOfInterest:t});this.pointOfInterestIndicators.push(n),e.addChild(n)})}addMenuItem(){(this.player.getChild(`collapserator`)?.getChild(`cogButton`)).addItem({ctor:j,name:`PointsOfInterestMenuItem`,options:{pointsOfInterestVisible:this.enabled}})}updateBuffered(){this.pointOfInterestIndicators.forEach(e=>e.updateBuffered(u(this.player)))}updatePlaybackProgress(){this.pointOfInterestIndicators.forEach(e=>e.updatePlaybackProgress(this.player.currentTime()))}};g.registerPlugin(`pointsOfInterestPlugin`,P);var F=g.getComponent(`Component`),I=class extends F{constructor(e,t){super(e,t),this.initialize()}initialize(){this.setPosition()}buildCSSClass(){return`cv-range-indicator ${super.buildCSSClass()}`}createEl(e,t,n){return super.createEl(e,{...t,className:this.buildCSSClass()},n)}setPosition(){let e=this.player().duration();this.el_.style.left=this.options_.time/e*100+`%`}},L=g.getComponent(`ClickableComponent`),R=class extends L{constructor(e,t){super(e,t)}buildCSSClass(){return`cv-replay-view-button ${super.buildCSSClass()}`}createEl(e,t,n){return super.createEl(e,{...t,innerHTML:`<span class="${this.options_.iconClassName}"></span><span>${this.options_.label}</span>`,className:this.buildCSSClass()},n)}handleClick(){this.options_.onPress()}},z=g.getComponent(`Component`),he=class extends z{constructor(e,t){super(e,t)}buildCSSClass(){return`cv-replay-view ${super.buildCSSClass()}`}createEl(e,t,n){let r=super.createEl(e,{...t,className:this.buildCSSClass()},n),i=g.dom.createEl(`h5`,{innerHTML:this.localize(`This clip has finished`),className:`cv-replay-heading`}),a=g.dom.createEl(`div`,{className:`cv-button-container`}),o=new R(this.player_,{label:this.localize(`Replay clip`),iconClassName:`cv-replay-icon`,onPress:this.options_.onReplayPress}),s=new R(this.player_,{label:this.localize(`Continue watching`),iconClassName:`cv-continue-icon`,onPress:this.options_.onContinuePress});return r.appendChild(i),r.appendChild(a),a.appendChild(o.el()),a.appendChild(s.el()),r}},ge=g.getPlugin(`plugin`),_e=class extends ge{constructor(e,t){if(super(e,t),this.startTime=parseFloat(t.startTime.toPrecision(4)),this.endTime=parseFloat(t.endTime.toPrecision(4)),this.dismissed=!1,this.startTime>this.endTime)throw Error(`Range start cannot be greater than range end`);this.bindFunctions(),this.initialize()}bindFunctions(){this.onReady=this.onReady.bind(this),this.onTimeUpdateOrSeeked=this.onTimeUpdateOrSeeked.bind(this),this.onReplayPress=this.onReplayPress.bind(this),this.onContinuePress=this.onContinuePress.bind(this)}initialize(){this.player.one(`loadedmetadata`,()=>this.player.ready(this.onReady)),this.player.on(`timeupdate`,this.onTimeUpdateOrSeeked),this.player.on(`seeked`,this.onTimeUpdateOrSeeked)}onReady(){this.addCssClasses(),this.showRangeIndicators(),this.addMaskToProgressBar()}onTimeUpdateOrSeeked(){if(this.dismissed)return;let e=this.player.currentTime();if(e<this.startTime){this.player.currentTime(this.startTime);return}if(e>this.endTime){this.showReplayView(),this.disablePlayToggle(),this.player.pause(),this.player.currentTime(this.endTime);return}}onReplayPress(){this.player.currentTime(this.startTime),this.player.play(),this.hideReplayView(),this.enablePlayToggle()}onContinuePress(){this.dismissed=!0,this.player.play(),this.hideRangeIndicators(),this.removeMaskFromProgressBar(),this.hideReplayView(),this.enablePlayToggle(),this.removeCssClasses()}showRangeIndicators(){let e=this.player.controlBar.getChild(`ProgressControl`)?.getChild(`SeekBar`);this.startTimeIndicator||(this.startTimeIndicator=new I(this.player,{time:this.startTime}),e?.addChild(this.startTimeIndicator)),this.endTimeIndicator||(this.endTimeIndicator=new I(this.player,{time:this.endTime}),e?.addChild(this.endTimeIndicator))}hideRangeIndicators(){this.startTimeIndicator?.hide(),this.endTimeIndicator?.hide()}addMaskToProgressBar(){let e=(this.player.controlBar.getChild(`ProgressControl`)?.getChild(`SeekBar`))?.el().getElementsByClassName(`cv-chapter-bar-items`);if(e&&e.length){let t=e[0],n=this.player.duration(),r=this.startTime/n*100,i=100-this.endTime/n*100;t.style.clipPath=`inset(-5em ${i}% -5em ${r}%)`}}removeMaskFromProgressBar(){let e=(this.player.controlBar.getChild(`ProgressControl`)?.getChild(`SeekBar`))?.el().getElementsByClassName(`cv-chapter-bar-items`);if(e&&e.length){let t=e[0];t.style.clipPath=``}}showReplayView(){this.replayView||(this.replayView=new he(this.player,{onContinuePress:this.onContinuePress,onReplayPress:this.onReplayPress}),this.player.addChild(this.replayView)),this.replayView.show()}hideReplayView(){this.replayView?.hide()}getPlayToggle(){return this.player.getChild(`collapserator`)?.getChild(`PlayToggle`)}enablePlayToggle(){let e=this.getPlayToggle();e&&e.enable()}disablePlayToggle(){let e=this.getPlayToggle();e&&e.disable()}addCssClasses(){this.player.addClass(`cv-range-indicator-plugin`)}removeCssClasses(){this.player.removeClass(`cv-range-indicator-plugin`)}dispose(){this.removeCssClasses(),this.player.off(`timeupdate`,this.onTimeUpdateOrSeeked),this.player.off(`seeked`,this.onTimeUpdateOrSeeked),this.startTimeIndicator?.dispose(),this.endTimeIndicator?.dispose(),this.replayView?.dispose(),super.dispose()}};g.registerPlugin(`rangeIndicatorPlugin`,_e);var B={generateRandomId:()=>window.crypto?.randomUUID?.()??Math.random().toString()},ve=class extends _{constructor(e,t){super(e,t)}getPlayerOptions(){let e=super.getPlayerOptions();return this.options.allowTranscript&&(e.allowTranscript=!0),e.devicesConfig?.canUserCastToDevices?{...e,techOrder:[`devices`,...e.techOrder],devices:{instanceId:B.generateRandomId()}}:e}configurePlugins(){try{this.options.onClickCreateClip&&this.player.createClipButtonPlugin({onClick:this.options.onClickCreateClip}),this.options.onRequestPictureInPicture&&this.player.pictureInPicture({onRequestPictureInPicture:this.options.onRequestPictureInPicture}),this.options.pointsOfInterest?.length&&this.player.pointsOfInterestPlugin({pointsOfInterest:this.options.pointsOfInterest}),this.player.loopVideoPlugin({allowLoop:this.options.allowLoop})}catch(e){console.log(`failed to register plugins`,e)}}setNextVideo(e,t,n){this.player.nextVideoPlugin&&this.player.nextVideoPlugin().setNextVideo(e,t,n)}togglePictureInPicture(e){let t=this.player.pictureInPicture();t&&t.togglePictureInPicture(e)}toggleTheatreMode(e){let t=this.player.theatreModePlugin();t&&t.toggleTheatreMode(e,{shouldLog:!0})}toggleTranscript(e){if(!this.player.viewTranscriptPlugin)return;let t=this.player.viewTranscriptPlugin();t&&t.toggleTranscript(e)}hasStarted(){return this.player.hasStarted()}async additionalSetup(e){if(this.options.onRequestTheatreMode&&this.options.allowTheatreMode&&this.player.theatreModePlugin&&this.player.theatreModePlugin({onRequestTheatreMode:this.options.onRequestTheatreMode,theatreMode:this.options.theatreMode,playbackObject:e}),super.additionalSetup(e),this.options.showResources&&e.resources&&this.player.resourcesPlugin&&this.player.resourcesPlugin({resources:e.resources.list,imageCdnUrl:this.options.imageCdnUrl}),e.mediaType===`MasterClip`){let t=e.additionalData;if(t===null)throw Error(`Invalid clip data`);this.player.clipPlugin({startTime:t.startTime,endTime:t.endTime})}e.mediaType===`MasterVideo`&&this.options.startTime&&this.options.endTime&&this.player.rangeIndicatorPlugin({startTime:this.options.startTime,endTime:this.options.endTime})}setupAnalyticsDependentPlugins(e){super.setupAnalyticsDependentPlugins(e),this.options.allowTranscript&&this.player.viewTranscriptPlugin().registerAnalytics(this.analyticsService,e),this.options.onRequestTheatreMode&&this.options.allowTheatreMode&&this.player.theatreModePlugin&&this.player.theatreModePlugin().registerAnalytics(this.analyticsService),this.options.devicesConfig?.canUserCastToDevices&&this.player.devicesPlugin&&this.player.devicesPlugin({...this.options.devicesConfig,userId:parseInt(e.viewerId),title:e.title,analyticsService:this.analyticsService})}setActivityStatus(e,t){this.player.activityStatusPlugin().setActivityStatus(e,t)}useCurrentTranscript(e,t){f.useMetadataTracks(this.player,`transcript`,e,t)}useChapters(e){f.useChapters(this.player,e)}},V={reconnectIntervalInMilliseconds:3e3,heartbeatEnabled:!1,heartbeatIntervalInMillseconds:1e4,heartbeatMessage:``},ye=class{constructor(e,t=V){this.bindFunctions(),this.url=e,this.options={...V,...t},this.webSocket=this.connect(),this.heartbeat=new T().schedule(()=>this.send(this.options.heartbeatMessage)).every(this.options.heartbeatIntervalInMillseconds)}bindFunctions(){this.cleanup=this.cleanup.bind(this),this.handleOpen=this.handleOpen.bind(this),this.handleMessage=this.handleMessage.bind(this),this.handleClose=this.handleClose.bind(this),this.handleError=this.handleError.bind(this),this.connect=this.connect.bind(this),this.send=this.send.bind(this),this.dipose=this.dipose.bind(this)}cleanup(){this.heartbeat.stop(),this.webSocket.removeEventListener(`error`,this.handleError),this.webSocket.removeEventListener(`message`,this.handleMessage),this.webSocket.removeEventListener(`open`,this.handleOpen),this.webSocket.removeEventListener(`close`,this.handleClose)}handleOpen(e){this.onOpen?.(e),this.options.heartbeatEnabled&&this.heartbeat.start()}handleMessage(e){this.onMessage?.(e)}handleClose(e){this.onClose?.(e),this.cleanup(),setTimeout(()=>{this.webSocket=this.connect()},this.options.reconnectIntervalInMilliseconds)}handleError(e){this.onError?.(e),this.handleClose()}connect(){let e=new WebSocket(this.url);return e.addEventListener(`open`,this.handleOpen),e.addEventListener(`message`,this.handleMessage),e.addEventListener(`close`,this.handleClose),e.addEventListener(`error`,this.handleError),e}send(e){this.webSocket.send(e)}dipose(){this.cleanup(),this.webSocket.close()}},be=2e3,xe=class{constructor(e,t){return this._timerStartedAt=0,this.position=0,this.duration=void 0,this.playing=!1,this.mute=!1,this.videoSource=``,this.subtitleSource=``,this.subtitles=!1,this.volume=0,this.title=e,this.device=t,this.ready=!1,this.playbackFinished=!1,this.debounced=C.withDebouncedSetters(this,be),C.withTimestampedSetters(this)}get position(){return this._position+this.getTimerDurationInSeconds()}set position(e){this._position=e,this.restartTimer()}get playing(){return this._playing}set playing(e){this._playing=e,e?this.restartTimer():(this._position+=this.getTimerDurationInSeconds(),this.stopTimer())}restartTimer(){this._timerStartedAt=Date.now()}stopTimer(){this._timerStartedAt=0}getTimerDurationInSeconds(){return this._timerStartedAt?(Date.now()-this._timerStartedAt)/1e3:0}},H=function(e){return e.Update=`update`,e.Volume=`volume`,e.Playing=`playing`,e.Paused=`paused`,e.NewChapter=`new_chapter`,e.Stopped=`stopped`,e.Ready=`ready`,e.Mute=`mute`,e.Finished=`finished`,e.Subtitles=`subtitles`,e}({}),Se=class extends x{constructor(e,t){super(),this.client=e,this.localState=new xe(t.title,t.device),this.bindFunctions(),this.initialize()}bindFunctions(){this.initialize=this.initialize.bind(this),this.dispose=this.dispose.bind(this),this.handleClientConnected=this.handleClientConnected.bind(this),this.handleDisconnectMessage=this.handleDisconnectMessage.bind(this),this.handleAllVideoMessages=this.handleAllVideoMessages.bind(this),this.handleUpdateMessage=this.handleUpdateMessage.bind(this),this.handleVolumeMessage=this.handleVolumeMessage.bind(this),this.handlePlayingMessage=this.handlePlayingMessage.bind(this),this.handlePausedMessage=this.handlePausedMessage.bind(this),this.handleFinishedMessage=this.handleFinishedMessage.bind(this),this.handleNewChapterMessage=this.handleNewChapterMessage.bind(this),this.handleStoppedMessage=this.handleStoppedMessage.bind(this),this.loadSource=this.loadSource.bind(this),this.play=this.play.bind(this),this.pause=this.pause.bind(this),this.seek=this.seek.bind(this),this.setVolume=this.setVolume.bind(this),this.isPlaying=this.isPlaying.bind(this),this.getPosition=this.getPosition.bind(this),this.getDuration=this.getDuration.bind(this),this.getVolume=this.getVolume.bind(this)}initialize(){this.client.on(`dispose`,this.dispose),this.client.on(`connected`,this.handleClientConnected),this.client.on(`message`,this.handleDisconnectMessage).filter(e=>e.source===this.getDevice().id&&e.message.type===`disconnect`),this.client.on(`message`,this.handleAllVideoMessages).filter(e=>e.source===this.getDevice().id&&e.message.type===`video_event`)}dispose(){this.client.off(`dispose`,this.dispose),this.client.off(`connected`,this.handleClientConnected),this.client.off(`message`,this.handleDisconnectMessage),this.client.off(`message`,this.handleAllVideoMessages),this.client.stop(this.getDevice().id).catch(e=>console.error(e)),super.dispose()}async handleClientConnected(){try{await this.client.joinRoom(this.getDevice().id)}catch(e){this.trigger(`error`,e)}}handleDisconnectMessage(){this.dispose()}handleAllVideoMessages(e){let t=this.localState.debounced,n=e.message.payload.params||{};switch(e.message.payload.event){case H.Update:this.handleUpdateMessage(t,n);break;case H.NewChapter:this.handleNewChapterMessage(t,n);break;case H.Volume:this.handleVolumeMessage(t,n);break;case H.Playing:this.handlePlayingMessage(t);break;case H.Paused:this.handlePausedMessage(t);break;case H.Finished:this.handleFinishedMessage(t);break;case H.Stopped:this.handleStoppedMessage();break}}handleUpdateMessage(e,t){e.duration!==t.duration&&(e.duration=t.duration,this.trigger(`durationchange`,S.void)),e.position!==t.position&&(e.position=t.position,this.trigger(`positionchange`,S.void)),e.subtitles!==t.subtitles&&(e.subtitles=t.subtitles,this.trigger(`subtitleschange`,S.void))}handleVolumeMessage(e,t){e.volume!==t.level&&(e.volume=t.level,e.mute=t.level===0,this.trigger(`volumechange`,S.void))}handlePlayingMessage(e){e.playing!==!0&&(e.playing=!0,e.playbackFinished=!1,this.trigger(`playingchange`,S.void))}handlePausedMessage(e){e.playing!==!1&&(e.playing=!1,this.trigger(`playingchange`,S.void))}handleFinishedMessage(e){e.playbackFinished!==!0&&(e.playing=!1,e.playbackFinished=!0,this.trigger(`playingchange`,S.void))}handleNewChapterMessage(e,t){let n=(t.queue??[]).find(t=>t.url===e.videoSource);if(!n){console.info(`The device is no longer playing the source we loaded - disposing the session`),this.dispose();return}e.subtitleSource!==n.suburl&&(e.subtitleSource=n.suburl,this.trigger(`subtitleschange`,S.void))}handleStoppedMessage(){this.dispose()}async loadSource(e,t){if(!(this.localState.videoSource===e&&this.localState.subtitleSource===t))try{let n=this.getDevice().id,r=this.getPosition();this.localState.videoSource=e,this.localState.subtitleSource=t,this.localState.ready=!1,await this.client.joinRoom(n),await this.client.loadQueue({title:this.getTitle(),roomId:n,videoSource:e,subtitleSource:t}),this.localState.ready=!0,this.trigger(`sourceloaded`,S.void),r>0&&this.seek(r),t&&this.setSubtitles(t)}catch(e){console.error(e),this.trigger(`error`,Error(`Could not load video on Vivi device`))}}play(){this.localState.ready&&this.localState.playing!==!0&&(this.localState.playing=!0,this.client.play(this.getDevice().id),this.trigger(`playingchange`,S.void))}pause(){this.localState.ready&&this.localState.playing!==!1&&(this.localState.playing=!1,this.client.pause(this.getDevice().id),this.trigger(`playingchange`,S.void))}seek(e){this.localState.ready&&this.localState.position!==e&&(this.localState.position=e,this.client.seek(this.getDevice().id,e),this.trigger(`positionchange`,S.void))}setVolume(e){this.localState.ready&&this.localState.volume!==e&&(this.localState.volume=e,this.client.setVolume(this.getDevice().id,e),this.trigger(`volumechange`,S.void))}setMuted(e){this.localState.ready&&this.localState.mute!==e&&(this.localState.mute=e,this.client.setMuted(this.getDevice().id,e),this.trigger(`volumechange`,S.void))}async setSubtitles(e){if(!this.localState.ready)return;e&&await this.loadSource(this.localState.videoSource,e);let t=!!e;this.localState.subtitles!==t&&(this.localState.subtitles=t,this.client.setSubtitles(this.getDevice().id,t),this.trigger(`subtitleschange`,S.void))}isPlaying(){return this.localState.playing}isPlaybackFinished(){return this.localState.playbackFinished}getPosition(){return this.localState.position}getDuration(){return this.localState.duration}getVolume(){return this.localState.volume}getMuted(){return this.localState.mute}getSubtitles(){if(this.localState.subtitles)return this.localState.subtitleSource}getDevice(){return this.localState.device}getTitle(){return this.localState.title}},U=1e4,Ce=500,we=1e4,W=class e extends x{constructor(e){super(),this.options=e,this.accessToken=``,this.devices=[],this.devicesFingerprint=``,this.deviceDiscovery=new T,this.bindFunctions(),this.initialize()}bindFunctions(){this.initialize=this.initialize.bind(this),this.sendMessage=this.sendMessage.bind(this),this.sendMessageDebounced=y(this.sendMessage,Ce,!0),this.beginDeviceDiscovery=this.beginDeviceDiscovery.bind(this),this.dispose=this.dispose.bind(this),this.canCastToDevice=this.canCastToDevice.bind(this),this.getDevices=this.getDevices.bind(this),this.startCastSession=this.startCastSession.bind(this),this.authenticateWithVivi=this.authenticateWithVivi.bind(this),this.getRoomList=this.getRoomList.bind(this),this.joinRoom=this.joinRoom.bind(this),this.query=this.query.bind(this),this.loadQueue=this.loadQueue.bind(this),this.play=this.play.bind(this),this.pause=this.pause.bind(this),this.stop=this.stop.bind(this),this.seek=this.seek.bind(this),this.setVolume=this.setVolume.bind(this),this.setMuted=this.setMuted.bind(this),this.setSubtitles=this.setSubtitles.bind(this)}initialize(){this.webSocket=new ye(this.options.url),this.webSocket.onMessage=e=>this.trigger(`message`,JSON.parse(e.data)),this.webSocket.onOpen=async()=>{try{this.accessToken=await this.options.fetchAccessToken(),await this.authenticateWithVivi(),this.beginDeviceDiscovery(),this.trigger(`connected`,S.void)}catch(e){console.error(e),this.trigger(`error`,Error(`Could not connect to Vivi`))}}}sendMessage(e){this.webSocket?.send(JSON.stringify(e))}beginDeviceDiscovery(){this.deviceDiscovery.every(we).schedule(async()=>{try{let t=await this.getRoomList(),n=e.calculateFingerprint(t);if(n===this.devicesFingerprint)return;let r=new Set(t.map(e=>e.organisation??``)).size,i=new Set(t.map(e=>e.location??``)).size;this.devices=t.map(e=>({id:e.id,name:e.name,schoolName:r>1?e.organisation:``,description:i>1?e.location:``,type:E.Vivi,status:w.Available})),this.devicesFingerprint=n,this.trigger(`deviceschange`,S.void)}catch(e){console.warn(e)}}).trigger().start()}dispose(){this.deviceDiscovery.stop(),this.webSocket?.dipose(),super.dispose()}canCastToDevice(e){return e===E.Vivi}getDevices(){return this.devices}startCastSession(e){return new Se(this,e)}async authenticateWithVivi(){this.sendMessage({destination:`relay`,message:{token:this.accessToken,type:`identify_video_api`}}),await this.one(`message`,e=>e.message.type===`video_api_identified`).timeout(U).catch(()=>{throw Error(`Failed to authenticate with Vivi`)})}async getRoomList(){return this.sendMessage({destination:`relay`,message:{type:`video_api_rooms`}}),(await this.one(`message`,e=>e.message.type===`video_api_rooms`).timeout(U).catch(()=>{throw Error(`Failed to fetch rooms`)})).message.rooms||[]}async joinRoom(e){this.sendMessage({destination:`relay`,message:{destination_type:`box`,new_destination:e,token:this.accessToken,type:`connect`}}),await this.one(`message`,t=>{if(t.source===e&&t.message.type===`connect`||t.message.type===`error`&&t.message.error_type===`already_connected`)return!0}).timeout(U).catch(()=>{throw Error(`Failed to join room`)})}async query(t){let n=e.createAckId();return this.sendMessage({destination:t,message:{type:`message_with_ack`,ack_id:n,name:`query`}}),await this.one(`message`,e=>e.message.ack_id===n).timeout(U).catch(()=>{throw Error(`Failed to fetch query`)})}async loadQueue({roomId:t,title:n,videoSource:r,subtitleSource:i}){this.sendMessage({destination:t,message:{type:`message_with_ack`,ack_id:e.createAckId(),name:`queue_load`,payload:{urls:[{title:n,url:r,suburl:i}]}}}),await this.one(`message`,e=>e.source===t&&e.message.payload?.event===`ready`).timeout(U).catch(()=>{throw Error(`Failed to load media`)})}async play(e){this.sendMessage({destination:e,message:{type:`message`,name:`video_play`,payload:{}}}),await this.one(`message`,t=>t.source===e&&t.message.payload?.event===`playing`).timeout(U).catch(()=>{throw Error(`Failed to play video`)})}async pause(e){this.sendMessage({destination:e,message:{type:`message`,name:`video_pause`}}),await this.one(`message`,t=>t.source===e&&t.message.payload?.event===`paused`).timeout(U).catch(()=>{throw Error(`Failed to pause video`)})}async stop(e){this.sendMessage({destination:e,message:{type:`message`,name:`video_stop`}}),await this.one(`message`,t=>t.source===e&&t.message.payload?.event===`stopped`).timeout(U).catch(()=>{throw Error(`Failed to stop video`)})}async seek(e,t){this.sendMessageDebounced({destination:e,message:{type:`message`,name:`video_seek`,payload:{position:t}}})&&await this.one(`message`,t=>t.source===e&&t.message.payload?.event===`playing`).timeout(U).catch(()=>{throw Error(`Failed to seek video`)})}async setVolume(e,t){this.sendMessageDebounced({destination:e,message:{type:`message`,name:`set_volume`,payload:{volume:t}}})&&await this.one(`message`,t=>t.source===e&&t.message.payload?.event===`volume`).timeout(U).catch(()=>{throw Error(`Failed to set volume`)})}async setMuted(e,t){this.sendMessage({destination:e,message:{type:`message`,name:`set_mute`,payload:{mute:t}}}),await this.one(`message`,t=>t.source===e&&t.message.payload?.event===`mute`).timeout(U).catch(()=>{throw Error(`Failed to set mute`)})}async setSubtitles(t,n){let r=e.createAckId();this.sendMessage({destination:t,message:{type:`message_with_ack`,ack_id:r,name:`set_subtitles`,payload:{subtitles:n}}}),await this.one(`message`,e=>e.source===t&&e.message.payload?.event===`subtitles`).timeout(U).catch(()=>{throw Error(`Failed to set subtitles`)})}static createAckId(){return B.generateRandomId()}static calculateFingerprint(e){return e.map(e=>e.id).sort().join(`,`)}},G=class e extends x{constructor(e){super(),this.instanceId=e,this.clients=[],this.bindFunctions()}bindFunctions(){this.addClient=this.addClient.bind(this),this.hasInstanceOfClient=this.hasInstanceOfClient.bind(this),this.startCastSession=this.startCastSession.bind(this),this.gatherAndPublishDevices=this.gatherAndPublishDevices.bind(this),this.dispose=this.dispose.bind(this)}addClient(e){e.on(`deviceschange`,this.gatherAndPublishDevices),e.on(`error`,e=>this.trigger(`error`,e)),this.clients.push(e)}hasInstanceOfClient(e){return this.clients.some(t=>t instanceof e)}startCastSession(e){if(this.castSession)if(this.castSession.getDevice().id!==e.device.id)this.castSession.dispose();else{console.info(`A session with device ${e.device.id} already exists - this is a no-op`);return}let t=this.clients.find(t=>t.canCastToDevice(e.device.type));t&&(this.castSession=t.startCastSession(e),this.castSession.on(`error`,e=>{this.castSession.dispose(),this.trigger(`error`,e)}),this.castSession.on(`dispose`,()=>{this.castSession=void 0,this.trigger(`castsessionchange`,void 0)}),this.trigger(`castsessionchange`,this.castSession))}getCastSession(){return this.castSession}gatherAndPublishDevices(){let e=this.clients.map(e=>e.getDevices()).reduce((e,t)=>[...e,...t],[]);this.trigger(`deviceschange`,e)}dispose(){this.castSession?.dispose(),this.clients.forEach(e=>e.dispose()),this.castSession=void 0,this.clients=[],super.dispose()}static{this.instances={}}static getOrCreateInstance(t){if(!t)throw Error(`instanceId is required`);return this.instances[t]||(this.instances[t]=new e(t)),this.instances[t]}static disposeAndRemoveInstance(e){e.dispose(),delete this.instances[e.instanceId]}static isActive(){return Object.keys(this.instances).length>0}},Te=g.getComponent(`MenuItem`),K=class extends Te{constructor(e,t){super(e,t),this.isVisible=this.isVisible.bind(this)}createEl(){let e={vivi:`cv-vivi-icon`,"apple-tv":`cv-apple-icon`},t=super.createEl(`li`,{className:`vjs-menu-item cv-device-menu-item`}),n=g.dom.createEl(`div`,{className:`cv-device-menu-item-body`,innerHTML:`
|
|
4
4
|
<span class="cv-device-icon ${e[this.options_.type]}"></span>
|
|
@@ -14,4 +14,4 @@ import{o as e}from"./DAXXjFlN.chunk.js";import{x as t}from"./BftnFbcr.chunk.js";
|
|
|
14
14
|
</div>
|
|
15
15
|
<div class="cv-devices-background" style="background-image: url(${this.poster})"></div>
|
|
16
16
|
`;let t=document.createElement(`button`),n=e=>{e.stopPropagation(),this.options_.onStopCasting()};t.onclick=n,t.ontouchstart=n,t.className=`stop-casting-button`,t.innerHTML=this.localize(`Stop casting`),this.el_.querySelector(`.cv-devices-content`).appendChild(t)}play(){}},Fe=g.getComponent(`Tech`),Ie=class extends Fe{constructor(e,t){super(e,t),this.featuresVolumeControl=!0,this.featuresPlaybackRate=!1,this.movingMediaElementInDOM=!1,this.featuresFullscreenResize=!0,this.featuresTimeupdateEvents=!0,this.featuresProgressEvents=!1,this.featuresNativeTextTracks=!1,this.featuresNativeAudioTracks=!1,this.featuresNativeVideoTracks=!1,this.featuresMuteControl=!0,this.featuresSourceset=!1,this.videojsPlayer=g(this.options_.playerId),this.bindFunctions(),this.bindEventListeners(),this.ready(()=>{this.setSource(this.options_.source)}),this.triggerReady()}bindFunctions(){this.bindEventListeners=this.bindEventListeners.bind(this),this.onTextTrackChanged=this.onTextTrackChanged.bind(this),this.getSelectedTextTrack=this.getSelectedTextTrack.bind(this),this.setSelectedTextTrack=this.setSelectedTextTrack.bind(this),this.showUI=this.showUI.bind(this),this.hideUI=this.hideUI.bind(this),this.dispose=this.dispose.bind(this),this.setSource=this.setSource.bind(this),this.getCastSession=this.getCastSession.bind(this)}bindEventListeners(){let e=this.getCastSession();e&&(this.textTracks().on(`change`,this.onTextTrackChanged),this.videojsPlayer.one(`ended`,()=>{e.dispose()}),e.on(`durationchange`,()=>{this.trigger(`durationchange`)}),e.on(`dispose`,()=>{this.trigger(`ended`),this.hideUI()}),e.on(`playingchange`,()=>{e.isPlaying()?(this.trigger(`play`),this.trigger(`playing`)):this.trigger(`pause`)}),e.on(`volumechange`,()=>{this.trigger(`volumechange`)}),e.on(`sourceloaded`,()=>{this.trigger(`loadeddata`)}),e.on(`subtitleschange`,()=>{this.setSelectedTextTrack(e.getSubtitles())}))}onTextTrackChanged(){let e=this.getSelectedTextTrack();this.getCastSession()?.setSubtitles(e?.src)}getSelectedTextTrack(){return f.findTrackByPredicate(this.videojsPlayer.player_,e=>e.mode===`showing`&&!!e.src)}setSelectedTextTrack(e){f.forEachTrack(this.videojsPlayer.player_,t=>{t.kind===`subtitles`&&(t.src===e?t.mode=`showing`:t.mode=`disabled`)})}showUI(e){this.ui&&(this.ui.setPoster(this.options_.poster),this.ui.setDevice(e),this.ui.show())}hideUI(){this.ui?.hide()}dispose(){this.textTracks().off(`change`,this.onTextTrackChanged);let e=this.getCastSession();e&&e.dispose(),super.cleanupAutoTextTracks(),super.dispose()}createEl(){return this.ui=this.ui||new Pe({onStopCasting:()=>{this.getCastSession()?.dispose()}}),this.ui.el()}setSource(e){let t=this.getCastSession();if(!t)return;this.showUI(t.getDevice()),this.trigger(`loadstart`);let n=this.getSelectedTextTrack();t.loadSource(d.getOriginalUrl(e.src),n?.src)}addRemoteTextTrack(e){return super.addRemoteTextTrack(e,!0)}getCastSession(){return G.getOrCreateInstance(this.options_.instanceId??``).getCastSession()}play(){this.getCastSession()?.play()}pause(){this.getCastSession()?.pause()}paused(){return this.getCastSession()?.isPlaying()===!1}ended(){return this.getCastSession()?.isPlaybackFinished()??!1}setCurrentTime(e){this.getCastSession()?.seek(e??0)}currentTime(){return this.getCastSession()?.getPosition()??0}duration(){return this.getCastSession()?.getDuration()??this.videojsPlayer.duration()}volume(){return this.getCastSession()?.getVolume()??1}setVolume(e){this.getCastSession()?.setVolume(e)}muted(){return this.getCastSession()?.getMuted()??!1}setMuted(e){this.getCastSession()?.setMuted(e)}buffered(){}seekable(){return g.createTimeRanges(0,this.duration())}playbackRate(){return 1}readyState(){return 4}controls(){return!1}playsinline(){return!0}supportsFullScreen(){return!0}setAutoplay(){}preload(){}load(){}setPlaybackRate(){}static canPlayType(){return``}static canPlaySource(e,t){return!!G.getOrCreateInstance(t?.instanceId??``).getCastSession()}static isSupported(){return G.isActive()}};g.registerTech(`devices`,Ie);var Z=g.getPlugin(`plugin`),Le=class extends Z{constructor(e,t){super(e,t),this.options=t,this.instanceId=this.player.options_.devices?.instanceId??``,this.bindFunctions(),this.initialize()}bindFunctions(){this.initialize=this.initialize.bind(this),this.onReady=this.onReady.bind(this),this.onDevicesChanged=this.onDevicesChanged.bind(this),this.onCastSessionChanged=this.onCastSessionChanged.bind(this),this.onDevicesError=this.onDevicesError.bind(this),this.addViviClient=this.addViviClient.bind(this),this.addAppleTvClient=this.addAppleTvClient.bind(this),this.reloadTech=this.reloadTech.bind(this),this.getSessionManager=this.getSessionManager.bind(this),this.dispose=this.dispose.bind(this)}initialize(){this.player.ready(this.onReady)}onReady(){let e=this.player.getChild(`collapserator`),t=this.getSessionManager();if(!e||!t)return;t.on(`deviceschange`,this.onDevicesChanged),t.on(`castsessionchange`,this.onCastSessionChanged),t.on(`error`,this.onDevicesError);let n=()=>{this.addViviClient(t),this.addAppleTvClient(t)},r=(e,n)=>{t.startCastSession({device:n,title:this.options.title}),this.options.analyticsService?.logUserAction(n,{actionType:c.Select,workflowPhase:a.Complete,descriptor:i.ChangeDevice,entity:s.Device,eventVersion:o.V3})},l=this.options.ctaOptions,u=this.options.vivi,d=this.options.appleTv,f=[];d.enabled||f.push(E.AppleTv),(!u.enabled||!u.accountConnected)&&f.push(E.Vivi);let p={onClick:n,onDeviceMenuItemClick:r,ctaOptions:{...l,inactiveIntegrations:f}};this.devicesButton=e.addChild(`DevicesButton`,p)}onDevicesChanged(e){this.devicesButton?.setDevices(e)}onCastSessionChanged(e){this.devicesButton?.setCastSession(e),this.reloadTech(),e?(this.player.addClass(`cv-device-casting`),this.player.addClass(`cv-device-${e.getDevice().type}`),this.player.isFullscreen()&&this.player.exitFullscreen()):(this.player.removeClass(`cv-device-casting`),this.player.removeClass(`cv-device-${E.AppleTv}`),this.player.removeClass(`cv-device-${E.Vivi}`))}onDevicesError(e){this.player.error(e.message),this.player.pause()}addViviClient(e){if(!this.options.vivi.enabled||!this.options.vivi.accountConnected||!this.options.vivi.apiUrl||e.hasInstanceOfClient(W))return;let t=new W({url:this.options.vivi.apiUrl,fetchAccessToken:this.options.vivi.fetchAccessToken});e.addClient(t)}addAppleTvClient(e){if(!this.options.appleTv.enabled||!this.options.trackingCode||!this.options.userId||e.hasInstanceOfClient(D))return;let t=new D({fetchAccessToken:this.options.appleTv.fetchAccessToken,trackingCode:this.options.trackingCode,userId:this.options.userId});e.addClient(t)}reloadTech(){let e=this.player,t=e.currentSources(),n=e.volume(),r=e.muted(),i=e.currentTime(),a=e.paused();e.src(t),e.one(`playing`,()=>{e.volume(n),e.muted(r),e.currentTime(i),a?e.pause():e.play()})}getSessionManager(){if(this.instanceId)return G.getOrCreateInstance(this.instanceId)}dispose(){let e=this.getSessionManager();e&&(e.off(`deviceschange`,this.onDevicesChanged),e.off(`castsessionchange`,this.onCastSessionChanged),e.off(`error`,this.onDevicesError),G.disposeAndRemoveInstance(e),super.dispose())}};g.registerPlugin(`devicesPlugin`,Le);function Re(e){return(0,J.jsx)(`div`,{className:`cv-resource-item`,children:(0,J.jsx)(l,{data:e.resource,imageCdnUrl:e.imageCdnUrl,titlePosition:`above`,hideTypeBadge:!0})})}var ze=m((e,t)=>(0,J.jsx)(Re,{...t})),Be=g.getComponent(`MenuItem`),Ve=class extends Be{constructor(e,t){super(e,t);let n=new ze(e,{resource:t.resource,imageCdnUrl:t.imageCdnUrl});this.addChild(n)}createEl(e,t={},n){return super.createEl(e,{...t,className:`${t.className} cv-resource-menu-item`},n)}handleClick(e){e.stopImmediatePropagation(),this.options_.downloadResource(this.options_.resource)}},He=g.getComponent(`MenuButton`),Q=class extends He{constructor(...e){super(...e),this.alwaysCollapsed=!1,this.isCollapsed=!1,this.isCollabsible=!0}buildWrapperCSSClass(){return`cv-menu-small cv-resources-button-wrapper ${super.buildWrapperCSSClass()}`}buildCSSClass(){return`cv-resources-button ${super.buildCSSClass()}`}update(){super.update()}createItems(){let e=[];return e.push(new p(this.player_,{label:`Resources`})),this.options_.resources.forEach(t=>{let n=new Ve(this.player(),{resource:t,imageCdnUrl:this.options_.imageCdnUrl,downloadResource:e=>this.downloadResource(e),label:t.name});e.push(n)}),e}downloadResource(e){if(e.type===`link`){t.PageLoad(e.url,!0);return}this.getDownloadIframe().src=e.url}getDownloadIframe(){return this.downloadIframe?this.downloadIframe:(this.downloadIframe=g.dom.createEl(`iframe`),this.downloadIframe.style.display=`none`,g.dom.appendContent(g.dom.$(`body`),this.downloadIframe),this.downloadIframe)}getCollabsibleName(){return this.controlText_}getCollabsibleValue(){return``}showInCollabsibleMenu(){return!0}showCollapsibleMenu(){super.handleClick(null)}};Q.prototype.controlText_=`Resources`,g.registerComponent(`ResourcesButton`,Q);var Ue=g.getPlugin(`plugin`),We=class extends Ue{constructor(e,t){super(e,t),this.options=t,e.ready(()=>this.onReady())}onReady(){this.options.resources.length&&this.player.getChild(`collapserator`).addChild(`ResourcesButton`,{resources:this.options.resources,imageCdnUrl:this.options.imageCdnUrl})}};g.registerPlugin(`resourcesPlugin`,We);function $(e){let{className:t=``,playerApi:n,onReady:r,onDispose:i,...a}=e,o=O.useRef(null);return O.useEffect(()=>{if(!o)return;let e=new ve(o.current,{...a,playerApi:n});return r&&e.ready(()=>{r(ne(e))}),i&&e.one(`dispose`,i),()=>{e?.dispose()}},[e.viewKey]),(0,J.jsx)(`div`,{ref:o,className:t})}export{$ as ClickViewPlayer,$ as default};
|
|
17
|
-
//# sourceMappingURL=
|
|
17
|
+
//# sourceMappingURL=BOQck-Qs.chunk.js.map
|