@clickview/streamable-learning 0.48.0-rc.1 → 0.48.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 +605 -605
- package/dist/bundles.json +1 -1
- package/dist/en.json +1 -1
- package/dist/scripts/{CN8PeBwg.chunk.js → BIisq8ZO.chunk.js} +2 -2
- package/dist/scripts/{CN8PeBwg.chunk.js.map → BIisq8ZO.chunk.js.map} +1 -1
- package/dist/scripts/{BaMNOAYj2.chunk.js → BWU6_pPN2.chunk.js} +2 -2
- package/dist/scripts/{BaMNOAYj2.chunk.js.map → BWU6_pPN2.chunk.js.map} +1 -1
- package/dist/scripts/{BvJXPFoz2.chunk.js → BcZFo9Vw2.chunk.js} +2 -2
- package/dist/scripts/{BvJXPFoz2.chunk.js.map → BcZFo9Vw2.chunk.js.map} +1 -1
- package/dist/scripts/Bd2bbHru.chunk.js +1 -0
- package/dist/scripts/{CkYqp83j.chunk.js → BfNy0Hvk.chunk.js} +2 -2
- package/dist/scripts/{CkYqp83j.chunk.js.map → BfNy0Hvk.chunk.js.map} +1 -1
- package/dist/scripts/{D0SYGnyF.chunk.js → BivP7X20.chunk.js} +2 -2
- package/dist/scripts/{D0SYGnyF.chunk.js.map → BivP7X20.chunk.js.map} +1 -1
- package/dist/scripts/{BihZ4r0z2.chunk.js → BjbY4Fbp2.chunk.js} +3 -3
- package/dist/scripts/{BihZ4r0z2.chunk.js.map → BjbY4Fbp2.chunk.js.map} +1 -1
- package/dist/scripts/{DO8_mR5i2.chunk.js → BmxcE73n2.chunk.js} +2 -2
- package/dist/scripts/{DO8_mR5i2.chunk.js.map → BmxcE73n2.chunk.js.map} +1 -1
- package/dist/scripts/{bycmewy72.chunk.js → BnEMhkEE2.chunk.js} +2 -2
- package/dist/scripts/{bycmewy72.chunk.js.map → BnEMhkEE2.chunk.js.map} +1 -1
- package/dist/scripts/{jWpq99N3.chunk.js → Buc8GegC.chunk.js} +2 -2
- package/dist/scripts/{jWpq99N3.chunk.js.map → Buc8GegC.chunk.js.map} +1 -1
- package/dist/scripts/{CrCAJmt6.chunk.js → Byczy1lS.chunk.js} +2 -2
- package/dist/scripts/{CrCAJmt6.chunk.js.map → Byczy1lS.chunk.js.map} +1 -1
- package/dist/scripts/{BZOcEcTA2.chunk.js → C2itEpvc2.chunk.js} +2 -2
- package/dist/scripts/{BZOcEcTA2.chunk.js.map → C2itEpvc2.chunk.js.map} +1 -1
- package/dist/scripts/{smdLElLq.chunk.js → CEFKXxac.chunk.js} +2 -2
- package/dist/scripts/{smdLElLq.chunk.js.map → CEFKXxac.chunk.js.map} +1 -1
- package/dist/scripts/{B-qOny0I2.chunk.js → CEYjJAp52.chunk.js} +2 -2
- package/dist/scripts/{B-qOny0I2.chunk.js.map → CEYjJAp52.chunk.js.map} +1 -1
- package/dist/scripts/{CNJrD44-2.chunk.js → CJSc4YDq2.chunk.js} +2 -2
- package/dist/scripts/{CNJrD44-2.chunk.js.map → CJSc4YDq2.chunk.js.map} +1 -1
- package/dist/scripts/{Br0Uc4GG.chunk.js → CKUA5J3R.chunk.js} +2 -2
- package/dist/scripts/{Br0Uc4GG.chunk.js.map → CKUA5J3R.chunk.js.map} +1 -1
- package/dist/scripts/{CWFInhB82.chunk.js → CYrzupmS2.chunk.js} +2 -2
- package/dist/scripts/{CWFInhB82.chunk.js.map → CYrzupmS2.chunk.js.map} +1 -1
- package/dist/scripts/{Llxar-VU.chunk.js → CcGYZb9f.chunk.js} +2 -2
- package/dist/scripts/{Llxar-VU.chunk.js.map → CcGYZb9f.chunk.js.map} +1 -1
- package/dist/scripts/{BTYwcYPL2.chunk.js → CeQGaFi-2.chunk.js} +2 -2
- package/dist/scripts/{BTYwcYPL2.chunk.js.map → CeQGaFi-2.chunk.js.map} +1 -1
- package/dist/scripts/{D7tastET2.chunk.js → Cr3Blj6H2.chunk.js} +2 -2
- package/dist/scripts/{D7tastET2.chunk.js.map → Cr3Blj6H2.chunk.js.map} +1 -1
- package/dist/scripts/{Dr1flAez.chunk.js → CxCkwLio.chunk.js} +2 -2
- package/dist/scripts/{Dr1flAez.chunk.js.map → CxCkwLio.chunk.js.map} +1 -1
- package/dist/scripts/{DyT1OGvP2.chunk.js → Cxj75Dqe2.chunk.js} +2 -2
- package/dist/scripts/{DyT1OGvP2.chunk.js.map → Cxj75Dqe2.chunk.js.map} +1 -1
- package/dist/scripts/{CsC3VVvE2.chunk.js → D-VNmhoM2.chunk.js} +2 -2
- package/dist/scripts/{CsC3VVvE2.chunk.js.map → D-VNmhoM2.chunk.js.map} +1 -1
- package/dist/scripts/{CKdklY2o2.chunk.js → D2FqnK9m2.chunk.js} +2 -2
- package/dist/scripts/{CKdklY2o2.chunk.js.map → D2FqnK9m2.chunk.js.map} +1 -1
- package/dist/scripts/{qcrBN1zR2.chunk.js → D3sdyN2Q2.chunk.js} +2 -2
- package/dist/scripts/{qcrBN1zR2.chunk.js.map → D3sdyN2Q2.chunk.js.map} +1 -1
- package/dist/scripts/{Ce1TZZdV2.chunk.js → D6IzS-bj2.chunk.js} +2 -2
- package/dist/scripts/{Ce1TZZdV2.chunk.js.map → D6IzS-bj2.chunk.js.map} +1 -1
- package/dist/scripts/{B703cBe72.chunk.js → D8g6nOG92.chunk.js} +2 -2
- package/dist/scripts/{B703cBe72.chunk.js.map → D8g6nOG92.chunk.js.map} +1 -1
- package/dist/scripts/{CCoZQmgX.chunk.js → DCKKwz9L.chunk.js} +2 -2
- package/dist/scripts/{CCoZQmgX.chunk.js.map → DCKKwz9L.chunk.js.map} +1 -1
- package/dist/scripts/{DIavEegC.chunk.js → DL4UFxRK.chunk.js} +2 -2
- package/dist/scripts/{DIavEegC.chunk.js.map → DL4UFxRK.chunk.js.map} +1 -1
- package/dist/scripts/{C5i1HsPp2.chunk.js → DLofRa642.chunk.js} +2 -2
- package/dist/scripts/{C5i1HsPp2.chunk.js.map → DLofRa642.chunk.js.map} +1 -1
- package/dist/scripts/{B5jBIPaP.chunk.js → DMZ--ok1.chunk.js} +2 -2
- package/dist/scripts/{B5jBIPaP.chunk.js.map → DMZ--ok1.chunk.js.map} +1 -1
- package/dist/scripts/{CUUUI6pl.chunk.js → DQFcbMMk.chunk.js} +2 -2
- package/dist/scripts/{CUUUI6pl.chunk.js.map → DQFcbMMk.chunk.js.map} +1 -1
- package/dist/scripts/{Dj4AeYQQ2.chunk.js → DVeqPzBe2.chunk.js} +2 -2
- package/dist/scripts/{Dj4AeYQQ2.chunk.js.map → DVeqPzBe2.chunk.js.map} +1 -1
- package/dist/scripts/{CGxa1Jzq.chunk.js → DWerltCT.chunk.js} +2 -2
- package/dist/scripts/{CGxa1Jzq.chunk.js.map → DWerltCT.chunk.js.map} +1 -1
- package/dist/scripts/{CbLL7dIz2.chunk.js → DatscYpA2.chunk.js} +2 -2
- package/dist/scripts/{CbLL7dIz2.chunk.js.map → DatscYpA2.chunk.js.map} +1 -1
- package/dist/scripts/{DwzBzBlI2.chunk.js → DkaGC5IU2.chunk.js} +2 -2
- package/dist/scripts/{DwzBzBlI2.chunk.js.map → DkaGC5IU2.chunk.js.map} +1 -1
- package/dist/scripts/{BLrjbrp8.chunk.js → DqZWSPDJ.chunk.js} +2 -2
- package/dist/scripts/{BLrjbrp8.chunk.js.map → DqZWSPDJ.chunk.js.map} +1 -1
- package/dist/scripts/{BKnxYKDu2.chunk.js → Dql-1E6g2.chunk.js} +2 -2
- package/dist/scripts/{BKnxYKDu2.chunk.js.map → Dql-1E6g2.chunk.js.map} +1 -1
- package/dist/scripts/{B7iwtSij.chunk.js → DuBHin02.chunk.js} +2 -2
- package/dist/scripts/{B7iwtSij.chunk.js.map → DuBHin02.chunk.js.map} +1 -1
- package/dist/scripts/{BpgHKWR52.chunk.js → QMuFwiiF2.chunk.js} +2 -2
- package/dist/scripts/{BpgHKWR52.chunk.js.map → QMuFwiiF2.chunk.js.map} +1 -1
- package/dist/scripts/{Ces-KTwe.chunk.js → U_sIlzAD.chunk.js} +2 -2
- package/dist/scripts/{Ces-KTwe.chunk.js.map → U_sIlzAD.chunk.js.map} +1 -1
- package/dist/scripts/{ACTQklJQ.chunk.js → WLyOm9Lj.chunk.js} +2 -2
- package/dist/scripts/{ACTQklJQ.chunk.js.map → WLyOm9Lj.chunk.js.map} +1 -1
- package/dist/scripts/{DR80oZtZ.chunk.js → Ymq7JLkU.chunk.js} +2 -2
- package/dist/scripts/{DR80oZtZ.chunk.js.map → Ymq7JLkU.chunk.js.map} +1 -1
- package/dist/scripts/{app-BIigh9wv.js → app-gjHxcZG3.js} +4 -4
- package/dist/scripts/app-gjHxcZG3.js.map +1 -0
- package/dist/scripts/{CNmmq34f.chunk.js → djRnI462.chunk.js} +2 -2
- package/dist/scripts/{CNmmq34f.chunk.js.map → djRnI462.chunk.js.map} +1 -1
- package/dist/scripts/{oTYyWWB-.chunk.js → e2K2YU7z.chunk.js} +2 -2
- package/dist/scripts/{oTYyWWB-.chunk.js.map → e2K2YU7z.chunk.js.map} +1 -1
- package/dist/scripts/{BxypZGPK.chunk.js → fnfhCa1P.chunk.js} +2 -2
- package/dist/scripts/{BxypZGPK.chunk.js.map → fnfhCa1P.chunk.js.map} +1 -1
- package/dist/scripts/{BsAo7Lri2.chunk.js → iyIL3kim2.chunk.js} +2 -2
- package/dist/scripts/{BsAo7Lri2.chunk.js.map → iyIL3kim2.chunk.js.map} +1 -1
- package/dist/scripts/{DK3xia1t.chunk.js → kfFYr9dc.chunk.js} +2 -2
- package/dist/scripts/{DK3xia1t.chunk.js.map → kfFYr9dc.chunk.js.map} +1 -1
- package/dist/scripts/{BXJetawx2.chunk.js → kts5xiiM2.chunk.js} +2 -2
- package/dist/scripts/{BXJetawx2.chunk.js.map → kts5xiiM2.chunk.js.map} +1 -1
- package/dist/scripts/{tYi-sUb22.chunk.js → lLAYbgAy2.chunk.js} +2 -2
- package/dist/scripts/{tYi-sUb22.chunk.js.map → lLAYbgAy2.chunk.js.map} +1 -1
- package/dist/scripts/{BCBfXCYM2.chunk.js → p9ukva5a2.chunk.js} +2 -2
- package/dist/scripts/{BCBfXCYM2.chunk.js.map → p9ukva5a2.chunk.js.map} +1 -1
- package/dist/scripts/{DKnZ8BaN.chunk.js → wOeN2ls0.chunk.js} +2 -2
- package/dist/scripts/{DKnZ8BaN.chunk.js.map → wOeN2ls0.chunk.js.map} +1 -1
- package/dist/scripts/{DU1SE31v2.chunk.js → zp2BHOp82.chunk.js} +2 -2
- package/dist/scripts/{DU1SE31v2.chunk.js.map → zp2BHOp82.chunk.js.map} +1 -1
- package/dist/scripts/{DnSy_Myx.chunk.js → zyVwH8JF.chunk.js} +2 -2
- package/dist/scripts/{DnSy_Myx.chunk.js.map → zyVwH8JF.chunk.js.map} +1 -1
- package/package.json +1 -1
- package/dist/scripts/C4MLxDS-.chunk.js +0 -1
- package/dist/scripts/app-BIigh9wv.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Llxar-VU.chunk.js","names":[],"sources":["../../../../libs/shared/src/interfaces/models/Widget.ts","../../../../libs/shared/src/enums/WidgetContents.ts","../../../../libs/shared/src/components/widgets/fixed-widget/FixedWidgetUtils.ts","../../../../libs/shared/src/components/widgets/fixed-widget/FixedWidgetReducer.tsx","../../../../libs/shared/src/components/widgets/curated-widgets/components/header/partial-loading/PartialWidgetHeader.tsx","../../../../libs/shared/src/components/widgets/fixed-widget/fixed-widget.module.scss","../../../../libs/shared/src/components/widgets/fixed-widget/PartialFixedWidget.tsx","../../../../libs/shared/src/components/widgets/fixed-widget/FixedWidget.tsx","../../../../libs/shared/src/components/widgets/items/resource-widget-item/resource-widget-item.module.scss","../../../../libs/shared/src/components/widgets/items/resource-widget-item/ResourceWidgetItem.tsx"],"sourcesContent":["import { BaseObject } from 'libs/shared/interfaces';\n\n/**\n * This maps directly against the widget types from Domain.\n * Update is only required where the backend changes.\n */\nexport enum WidgetType {\n Row = 0, // At full-size, this will contain a row of 4 items\n LargeRow = 1, // At full-size, this will contain a row of 3 times\n Hero = 2,\n ResourcesTile = 3 // Deprecated. Widget's with this type will fall back to the `Row` type (0).\n}\n\nexport interface Widget extends Omit<BaseObject, 'type'> {\n collectionId: string;\n dashboardId: string;\n type: WidgetType;\n}\n","export enum WidgetContents {\n Videos = 'videos',\n FeedVideos = 'feed videos',\n Series = 'series',\n Subjects = 'subjects',\n Playlists = 'playlists',\n Interactives = 'interactives',\n Clips = 'clips',\n PlayPageResources = 'play page resources',\n DashboardResources = 'dashboard resources',\n Libraries = 'Libraries',\n Folders = 'Folders',\n RecentActivities = 'recent activities',\n SmallSeries = 'small series',\n Companies = 'companies',\n PartnerProfiles = 'partner profiles',\n Ratings = 'ratings',\n SpecialEvents = 'special events',\n\n InteractivesV2 = 'interactives v2',\n ClipsV2 = 'clips v2',\n PlayPageResourcesV2 = 'playpage resources v2'\n}\n","import * as React from 'react';\n\nimport { FunctionHelper } from 'libs/common/backbone/utils/FunctionHelper';\nimport { Core } from 'libs/common/core';\nimport { Flight } from 'libs/common/flight';\nimport { ReducerActions } from 'libs/common/react/interfaces';\nimport { ObjectHelper } from 'libs/common/react/utils/ObjectHelper';\nimport { TextHelper } from 'libs/common/react/utils/TextHelper';\n\nimport { FixedWidgetItemProps } from 'libs/shared/components/widgets/items/FixedWidgetItemProps';\nimport { WidgetContents } from 'libs/shared/enums/WidgetContents';\nimport { WidgetInteraction } from 'libs/shared/enums/WidgetInteraction';\nimport { Breakpoints, useBreakpoints } from 'libs/shared/hooks/useBreakpoints';\nimport { BaseObject, WidgetType } from 'libs/shared/interfaces';\n\nimport { FixedWidgetProps, WIDGET_ITEM_LIMIT } from './FixedWidget';\nimport { FixedWidgetPayload, FixedWidgetState } from './FixedWidgetReducer';\n\nexport interface WidgetData {\n id?: string;\n name?: string;\n description?: string;\n}\n\nexport function useFetchData<T extends React.ComponentType<FixedWidgetItemProps>>(\n props: FixedWidgetProps<T>,\n dispatch: React.Dispatch<ReducerActions<WidgetInteraction, FixedWidgetPayload>>,\n shouldFetch: boolean\n): Flight.Response<any> {\n let data = props.collection;\n let res: Flight.Response<any>;\n\n if ((!data || ObjectHelper.isEmpty(data)) && !props.prefetched) {\n res = props.fetch(shouldFetch);\n data = res.data;\n }\n\n /**\n * Once we have the widget data, lazily update our state with the new collection\n */\n const collection = (FunctionHelper.isFunction(props.setData) && data) ? props.setData(data) : data;\n let collectionToDisplay = collection;\n\n const breakpoints = useBreakpoints();\n\n React.useEffect(() => {\n if (!data || ObjectHelper.isEmpty(data))\n return;\n\n if (props.limitTotalItems)\n collectionToDisplay = collection.length > WIDGET_ITEM_LIMIT ? collection.slice(0, WIDGET_ITEM_LIMIT) : collection;\n\n let type = props.type;\n\n // The ResourcesTile widget type is deprecated. We render the Row type instead in this case\n if (type === WidgetType.ResourcesTile)\n type = WidgetType.Row;\n\n dispatch({\n type: WidgetInteraction.Init,\n payload: {\n totalItems: collectionToDisplay.length,\n breakpoints,\n type,\n contents: props.contents\n }\n });\n }, [collection?.length]);\n\n return res;\n}\n\n/**\n * This function wrapper determines which widget item images should be pre-fetched by the LazyImage component.\n * It does this by looking at which images are going to be shown after the users clicks on the \"Next\"\n * widget button.\n */\nexport function getShouldPreload(state: FixedWidgetState, collection: any[]): (widgetItem: any) => boolean {\n const { offset, viewableItems } = state;\n\n // The index of the latest item that has been fetched\n const maxLoadedIndex = offset;\n\n /**\n * The indicesToPreload is an array of indices of widget items that should be prefetched by the\n * LazyImage component\n */\n const indicesToPreload: number[] = [];\n for (let i = 0; i < maxLoadedIndex + viewableItems; i++) {\n indicesToPreload.push(i);\n }\n\n /**\n * A widget item calls this function to determine whether or not its image can be pre-fetched.\n * This is determined by whether or not its index has been deemed valid to be pre-fetched\n * by the scope above\n */\n return function shouldPreload(widgetItem: any): boolean {\n const index = collection.indexOf(widgetItem);\n\n return indicesToPreload.includes(index);\n };\n}\n\nexport function getCollectionAppLink(appLink: Core.AppLink, data: WidgetData): Core.AppLink {\n if (!appLink)\n return;\n\n return {\n ...appLink,\n args: appLink.args || [ data.id, TextHelper.slugify(data.name) ]\n };\n}\n\n/**\n * Allow explicit name and description props to override the fetched\n * data properties.\n * \n * @param props \n * @param data \n */\nexport function formatData<T extends React.ComponentType<FixedWidgetItemProps>>(\n props: FixedWidgetProps<T>,\n data: BaseObject\n): WidgetData {\n const { id, name, description } = props;\n\n const overrideProps: WidgetData = {};\n\n if (Array.isArray(data))\n return { id, name, description };\n\n if (props.id) overrideProps.id = id;\n if (props.name) overrideProps.name = name;\n if (props.description) overrideProps.description = description;\n\n return { ...data, ...overrideProps };\n}\n\n/**\n * The functions below are used by the reducer to compute the number of widget items\n * displayed on the screen based on the media query, widget type, and total number of items.\n */\ntype ComputeFunction = (breakpoints: Breakpoints, type: WidgetType, itemCount: number) => number;\n\n/**\n * TODO:\n * This and the `WidgetType` enum need to be replaced entirely as this is no longer maintainable.\n * Each widget type + template combination should define it's own item count per\n * breakpoint and pass it in as props.\n */\nexport function getComputeFunction(contents: WidgetContents): ComputeFunction {\n switch (contents) {\n case WidgetContents.Playlists:\n return computeViewablePlaylists;\n\n case WidgetContents.Videos:\n return computeViewableVideos;\n\n case WidgetContents.RecentActivities:\n return computeViewableRecentActivities;\n\n case WidgetContents.FeedVideos:\n return computeViewableFeedVideos;\n\n case WidgetContents.Subjects:\n return computeViewableSubjects;\n\n case WidgetContents.InteractivesV2:\n return computeViewableInteractivesV2;\n\n case WidgetContents.Interactives:\n return computeViewableInteractives;\n\n case WidgetContents.ClipsV2:\n return computeViewableClipsV2;\n\n case WidgetContents.Clips:\n return computeViewableClips;\n\n case WidgetContents.PlayPageResources:\n return computeViewablePlayPageResources;\n\n case WidgetContents.PlayPageResourcesV2:\n return computeViewablePlayPageResourcesV2;\n\n case WidgetContents.DashboardResources:\n return computeViewableVideos;\n\n case WidgetContents.Libraries:\n case WidgetContents.Folders:\n return computeViewableLibraries;\n\n case WidgetContents.Ratings:\n return computeViewableRatings;\n\n case WidgetContents.SpecialEvents:\n return computeViewableSpecialEvents;\n\n case WidgetContents.Companies:\n return computeViewableCompanies;\n\n case WidgetContents.SmallSeries:\n return computeViewableSmallSeries;\n\n case WidgetContents.PartnerProfiles:\n return computeViewablePartnerProfiles;\n\n case WidgetContents.Series:\n default:\n return computeViewableSeries;\n }\n}\n\nfunction computeViewablePartnerProfiles(breakpoints: Breakpoints, type: WidgetType, itemCount: number): number {\n let maxItems: number = 6;\n\n if (breakpoints.xs || breakpoints.sm)\n maxItems = 2;\n else if (breakpoints.md)\n maxItems = 4;\n\n if (itemCount < maxItems)\n maxItems = itemCount;\n\n return maxItems;\n}\n\nfunction computeViewablePlaylists(breakpoints: Breakpoints, type: WidgetType, itemCount: number): number {\n let maxItems: number = 5;\n\n if (breakpoints.xs)\n maxItems = 2;\n else if (breakpoints.sm)\n maxItems = 3;\n else if (breakpoints.md)\n maxItems = 4;\n\n if (itemCount < maxItems)\n maxItems = itemCount;\n\n return maxItems;\n}\n\nfunction computeViewableCompanies(breakpoints: Breakpoints, type: WidgetType, itemCount: number): number {\n let maxItems: number = 8;\n\n if (breakpoints.xs || breakpoints.sm)\n maxItems = 4;\n else if (breakpoints.md)\n maxItems = 6;\n\n if (itemCount < maxItems)\n maxItems = itemCount;\n\n return maxItems;\n}\n\nfunction computeViewableLibraries(breakpoints: Breakpoints, type: WidgetType, itemCount: number): number {\n let maxItems: number = 3;\n\n if (breakpoints.xs || breakpoints.sm)\n maxItems = 1;\n else if (breakpoints.md)\n maxItems = 2;\n else if (breakpoints.lg)\n maxItems = 3;\n\n if (itemCount < maxItems)\n maxItems = itemCount;\n\n return maxItems;\n}\n\nfunction computeViewableVideos(breakpoints: Breakpoints, type: WidgetType, itemCount: number): number {\n let maxItems = 4;\n\n if (breakpoints.xs)\n maxItems = 1;\n\n if (breakpoints.sm)\n maxItems = 2;\n\n if (breakpoints.md || breakpoints.lg)\n maxItems = 3;\n\n if (type === WidgetType.LargeRow && maxItems > 3)\n maxItems = 3;\n\n if (itemCount < maxItems)\n maxItems = itemCount;\n\n return maxItems;\n}\n\nfunction computeViewableRecentActivities(breakpoints: Breakpoints, type: WidgetType, itemCount: number): number {\n let maxItems = 4;\n\n if (breakpoints.xs)\n maxItems = 2;\n\n if (breakpoints.sm)\n maxItems = 3;\n\n if (itemCount < maxItems)\n maxItems = itemCount;\n\n return maxItems;\n}\n\n// eslint-disable-next-line\nfunction computeViewableFeedVideos(breakpoints: Breakpoints, type: WidgetType, itemCount: number): number {\n return 1;\n}\n\nfunction computeViewableSubjects(breakpoints: Breakpoints, type: WidgetType, itemCount: number): number {\n if (type === WidgetType.LargeRow) {\n let maxItems: number = 5;\n\n if (breakpoints.xs)\n maxItems = 2;\n else if (breakpoints.sm)\n maxItems = 3;\n else if (breakpoints.md)\n maxItems = 4;\n\n if (itemCount < maxItems)\n maxItems = itemCount;\n\n return maxItems;\n }\n\n let maxItems: number = 6;\n\n if (breakpoints.xs)\n maxItems = 2;\n else if (breakpoints.sm)\n maxItems = 3;\n else if (breakpoints.md)\n maxItems = 4;\n else if (breakpoints.lg)\n maxItems = 5;\n else if (breakpoints.xl || breakpoints.xxl)\n maxItems = 6;\n\n if (itemCount < maxItems)\n maxItems = itemCount;\n\n return maxItems;\n}\n\nfunction computeViewableInteractives(breakpoints: Breakpoints, type: WidgetType, itemCount: number): number {\n let maxItems: number = 3;\n\n if (breakpoints.md || breakpoints.sm)\n maxItems = 2;\n\n if (breakpoints.xs)\n maxItems = 1;\n\n if (itemCount < Math.ceil(maxItems))\n maxItems = itemCount;\n\n return maxItems;\n}\n\nfunction computeViewableClips(breakpoints: Breakpoints, type: WidgetType, itemCount: number): number {\n let maxItems: number = 3;\n\n if (breakpoints.md || breakpoints.sm)\n maxItems = 2;\n\n if (breakpoints.xs)\n maxItems = 1;\n\n if (itemCount < Math.ceil(maxItems))\n maxItems = itemCount;\n\n return maxItems;\n}\n\nfunction computeViewableInteractivesV2(breakpoints: Breakpoints, type: WidgetType, itemCount: number): number {\n let maxItems: number = 3;\n\n if (breakpoints.xs)\n maxItems = 2;\n\n if (itemCount < maxItems)\n maxItems = itemCount;\n\n return maxItems;\n}\n\nfunction computeViewableClipsV2(breakpoints: Breakpoints, type: WidgetType, itemCount: number): number {\n let maxItems: number = 3;\n\n if (breakpoints.xs)\n maxItems = 2;\n\n if (itemCount < maxItems)\n maxItems = itemCount;\n\n return maxItems;\n}\n\nfunction computeViewablePlayPageResources(breakpoints: Breakpoints, type: WidgetType, itemCount: number): number {\n let maxItems: number = 4;\n\n if (breakpoints.sm)\n maxItems = 3;\n\n if (breakpoints.xs)\n maxItems = 2;\n\n if (itemCount < maxItems)\n maxItems = itemCount;\n\n return maxItems;\n}\n\nfunction computeViewablePlayPageResourcesV2(breakpoints: Breakpoints, type: WidgetType, itemCount: number): number {\n let maxItems: number = 3;\n\n if (breakpoints.xs)\n maxItems = 2;\n\n if (itemCount < maxItems)\n maxItems = itemCount;\n\n return maxItems;\n}\n\nfunction computeViewableSeries(breakpoints: Breakpoints, type: WidgetType, itemCount: number): number {\n let maxItems: number = 4;\n\n if (breakpoints.xs)\n maxItems = 2;\n else if (breakpoints.sm)\n maxItems = 3;\n\n if (itemCount < maxItems)\n maxItems = itemCount;\n\n return maxItems;\n}\n\nfunction computeViewableSmallSeries(breakpoints: Breakpoints, type: WidgetType, itemCount: number): number {\n let maxItems: number = 6;\n\n if (breakpoints.xs)\n maxItems = 2;\n else if (breakpoints.sm)\n maxItems = 3;\n else if (breakpoints.md)\n maxItems = 4;\n\n else if (breakpoints.lg)\n maxItems = 5;\n\n if (itemCount < maxItems)\n maxItems = itemCount;\n\n return maxItems;\n}\n\nfunction computeViewableRatings(breakpoints: Breakpoints, type: WidgetType, itemCount: number): number {\n if (itemCount < 4)\n return itemCount;\n\n let maxItems: number = 5;\n\n if (breakpoints.xs || breakpoints.sm)\n maxItems = 3;\n\n if (breakpoints.md || breakpoints.lg)\n maxItems = 4;\n\n if (itemCount === 4 && (breakpoints.xs || breakpoints.sm)) {\n maxItems = 3;\n }\n\n if (itemCount < maxItems)\n maxItems = itemCount;\n\n return maxItems;\n}\n\nfunction computeViewableSpecialEvents(breakpoints: Breakpoints, type: WidgetType, itemCount: number): number {\n let maxItems: number = 6;\n\n if (breakpoints.xs)\n maxItems = 2;\n\n if (breakpoints.sm)\n maxItems = 3;\n\n if (breakpoints.md)\n maxItems = 4;\n\n if (breakpoints.lg)\n maxItems = 5;\n\n if (breakpoints.xl || breakpoints.xxl)\n maxItems = 6;\n\n if (itemCount < maxItems)\n maxItems = itemCount;\n\n return maxItems;\n}\n\n/**\n * Touch event handlers\n */\nexport function getOnTouchStart(\n widgetState: FixedWidgetState,\n containerRef: React.MutableRefObject<HTMLUListElement>,\n containerWidth: number,\n setContainerWidth: React.Dispatch<number>,\n initialTouchX: number,\n setInitialTouchX: React.Dispatch<number>,\n setPercentageDragged: React.Dispatch<number>\n): (event: React.TouchEvent<HTMLUListElement>) => void {\n return function(event: React.TouchEvent<HTMLUListElement>): void {\n const firstTouch = event.touches.item(0);\n const touchX = firstTouch.clientX;\n\n /**\n * Runs only on the very first touch event.\n * \n * Sets the initial x-coordinate as a reference point to calculate how far the user has dragged before\n * they release their finder\n */\n if (!initialTouchX) {\n containerRef.current.style.transition = '';\n\n setContainerWidth(containerRef.current.getBoundingClientRect().width);\n setInitialTouchX(touchX);\n }\n\n const pixelsDragged = initialTouchX - touchX;\n\n // Calculate how far the user has moved their finger as a percentage of the widget's container element\n let currentPercentageDragged = ((pixelsDragged / containerWidth) * 100);\n\n /**\n * These 2 if statements prevent the user from dragging the widget beyond its limits.\n * One if statement handles if they have dragged to the left, and the other is for dragging to the right.\n * \n * The same logic is used to hide the widget buttons (see the `hide` prop passed to `<WidgetButton />`)\n */\n if (currentPercentageDragged < 0 && (widgetState.offset === widgetState.viewableItems))\n currentPercentageDragged = 0;\n\n else if (currentPercentageDragged > 0 && (widgetState.offset === widgetState.totalItems))\n currentPercentageDragged = 0;\n\n setPercentageDragged(currentPercentageDragged);\n };\n}\n\nconst DRAG_TOLERANCE = 7.5; // % of container width using to trigger a transition.\n\nexport function getOnTouchEnd(\n containerRef: React.MutableRefObject<HTMLDivElement>,\n setInitialTouchX: React.Dispatch<number>,\n percentageDragged: number,\n setPercentageDragged: React.Dispatch<number>,\n dispatch: React.Dispatch<ReducerActions<WidgetInteraction, FixedWidgetPayload>>,\n onNext: () => void,\n onPrevious: () => void\n): () => void {\n return function (): void {\n containerRef.current.style.transition = 'transform .4s ease-in-out';\n setInitialTouchX(null);\n\n /**\n * Only trigger a Next/Previous widget event if the user has dragged beyond DRAG_TOLERANCE% either way of the\n * container's width. This means if the user only drags left/right a tiny little bit, the widget\n * will simply slide back into its original place.\n */\n if (Math.abs(percentageDragged) >= DRAG_TOLERANCE) {\n const reducerAction = percentageDragged > 0 ? WidgetInteraction.Next : WidgetInteraction.Previous;\n\n dispatch({\n type: reducerAction\n });\n\n if (percentageDragged > 0 && onNext) {\n onNext();\n } else if (percentageDragged < 0 && onPrevious) {\n onPrevious();\n }\n }\n\n setPercentageDragged(0);\n };\n}\n\nexport function hideBackButton(\n isHoveringOnFarLeft: boolean,\n isHoveringOnWidget: boolean,\n widgetOffset: number,\n maxViewableItems: number,\n widgetCollectionSize: number,\n isTabbing: boolean\n): boolean {\n // When hovering on the very far left widget item, hide the back button\n if (isHoveringOnFarLeft)\n return true;\n\n // if the collection size is smaller than the max viewable items, hide the back button\n if (widgetCollectionSize <= maxViewableItems)\n return true;\n\n // When hovering on the entire widget area, hide the back button if the widget is in the far left position\n if (isHoveringOnWidget)\n return (widgetOffset === maxViewableItems);\n\n if (isTabbing)\n return widgetOffset === maxViewableItems;\n\n return true;\n}\n\nexport function hideNextButton(\n isHoveringOnFarRight: boolean,\n isHoveringOnWidget: boolean,\n widgetOffset: number,\n maxViewableItems: number,\n widgetCollectionSize: number,\n showSeeMoreButton: boolean,\n isTabbing: boolean\n): boolean {\n // When hovering on the very far right widget item, hide the next button\n if (isHoveringOnFarRight)\n return true;\n\n // if the collection size is smaller than the max viewable items, hide the next button\n if (widgetCollectionSize <= maxViewableItems)\n return true;\n\n // Always show the next button if the widget is in the far left position\n if (widgetOffset === maxViewableItems)\n return false;\n\n // When the user is hovering over the entire widget area...\n if (isHoveringOnWidget) {\n // If we want to show the \"See more\" button, don't hide the next button\n if (showSeeMoreButton)\n return false;\n\n // Only show the next button if there are still more items to show\n return widgetCollectionSize <= widgetOffset;\n }\n\n if (isTabbing)\n return widgetOffset === widgetCollectionSize;\n\n return true;\n}\n\nexport interface FixedWidgetControls {\n jumpToIndex: (index: number) => void;\n}\n\n/**\n * If a component consuming FixedWidget needs to dispatch events to FixedWidget,\n * it can pass in a `controlsRef` prop, which will receive the API defined\n * below. This API can be extended as needed.\n * See FeedVideoCollection.tsx for an example\n */\nexport function useControlsRef(\n ref: React.MutableRefObject<FixedWidgetControls>,\n dispatch: React.Dispatch<ReducerActions<WidgetInteraction, FixedWidgetPayload>>\n): void {\n React.useEffect(() => {\n if (!ref || ref.current)\n return;\n\n ref.current = {\n jumpToIndex: (index: number) => dispatch({\n type: WidgetInteraction.JumpToIndex,\n payload: {\n offset: index + 1\n }\n })\n };\n }, [ref?.current]);\n}\n","import { ReducerActions } from 'libs/common/react/interfaces';\n\nimport { WidgetContents } from 'libs/shared/enums/WidgetContents';\nimport { WidgetInteraction } from 'libs/shared/enums/WidgetInteraction';\nimport { Breakpoints } from 'libs/shared/hooks/useBreakpoints';\nimport { WidgetType } from 'libs/shared/interfaces';\n\nimport { getComputeFunction } from './FixedWidgetUtils';\n\nexport interface FixedWidgetPayload {\n breakpoints?: Breakpoints;\n contents?: WidgetContents;\n type?: WidgetType;\n offset?: number;\n totalItems?: number;\n}\n\nexport interface FixedWidgetState {\n // Current position within the widget collection\n offset: number;\n // Number of items viewable in slider for the current breakpoint/viewport size\n viewableItems: number;\n // Relative position of slider in the window. Used for an inline translate3d().\n position: number;\n // Type of widget being managed. May change on `Resize`.\n type: WidgetType;\n // What object type the widget uses :vomit: (this needs to be phased out of this god forsaken component)\n contents: WidgetContents;\n // Total number of items in the widget\n totalItems: number;\n}\n\nexport const initialWidgetState: FixedWidgetState = {\n offset: 0,\n viewableItems: 4,\n position: 0,\n totalItems: 0,\n contents: null,\n type: WidgetType.Row\n};\n\nconst computeNextPosition = (prevState: FixedWidgetState) => {\n const { viewableItems, offset, position, totalItems } = prevState;\n\n const remainingCount = totalItems - offset;\n\n /**\n * If the remaining items are evening divisible by the items in view, or,\n * we have more items that can be displayed in the view, move the slider a full 100%.\n */\n if (remainingCount % viewableItems === 0 || remainingCount > viewableItems)\n return {\n position: position - 100,\n offset: offset + viewableItems\n };\n\n /**\n * Where there are less items than we can show in a full slide, \n * calculate the % movement required to only show those items.\n */\n if (remainingCount < viewableItems)\n return {\n position: position - (remainingCount / viewableItems * 100),\n offset: offset + remainingCount\n };\n\n /**\n * Default back to the current state as a fallback\n */\n return {\n position: position,\n offset: offset\n };\n};\n\nconst computePreviousPosition = (prevState: FixedWidgetState) => {\n const { viewableItems, offset, position } = prevState;\n\n const remainingCount = offset - viewableItems;\n\n if (remainingCount % viewableItems === 0 || remainingCount > viewableItems)\n return {\n position: position + 100,\n offset: offset - viewableItems\n };\n\n if (remainingCount < viewableItems)\n return {\n position: position + (remainingCount / viewableItems * 100),\n offset: offset - remainingCount\n };\n\n return {\n position: position,\n offset: offset\n };\n};\n\nexport function FixedWidgetReducer(\n prevState: FixedWidgetState,\n action: ReducerActions<WidgetInteraction, FixedWidgetPayload>\n): FixedWidgetState {\n const { type, payload = {} } = action;\n\n switch (type) {\n case WidgetInteraction.Next: {\n return {\n ...prevState,\n ...computeNextPosition(prevState)\n };\n }\n\n case WidgetInteraction.Previous: {\n return {\n ...prevState,\n ...computePreviousPosition(prevState)\n };\n }\n\n case WidgetInteraction.JumpToIndex: {\n return {\n ...prevState,\n offset: payload.offset,\n position: (payload.offset - 1) * -100\n };\n }\n\n case WidgetInteraction.Resize: {\n const computeViewableItems = getComputeFunction(prevState.contents);\n const initialSeen = computeViewableItems(payload.breakpoints, prevState.type, prevState.totalItems);\n\n return {\n ...prevState,\n position: 0,\n offset: initialSeen,\n viewableItems: initialSeen\n };\n }\n\n case WidgetInteraction.Init: {\n const computeViewableItems = getComputeFunction(payload.contents);\n const initialSeen = computeViewableItems(payload.breakpoints, payload.type, payload.totalItems);\n\n return lazyWidgetInit({\n ...prevState,\n offset: initialSeen,\n viewableItems: initialSeen,\n type: payload.type,\n contents: payload.contents,\n totalItems: payload.totalItems,\n position: 0\n });\n }\n\n case WidgetInteraction.Update: {\n return {\n ...prevState,\n totalItems: payload.totalItems\n };\n }\n\n default:\n return prevState;\n }\n}\n\nexport function lazyWidgetInit(newState: FixedWidgetState): FixedWidgetState {\n return { ...initialWidgetState, ...newState };\n}\n","import React from 'react';\n\nimport { WidgetHeader } from '../WidgetHeader';\n\ninterface PartialWidgetHeaderProps {\n hideHeading?: boolean;\n hideDescription?: boolean;\n name?: string;\n description?: string;\n isPreviewing?: boolean;\n}\n\nexport function PartialWidgetHeader(props: PartialWidgetHeaderProps): JSX.Element {\n if (props.hideDescription && props.hideHeading)\n return <></>;\n\n if (props.isPreviewing) {\n return (\n <WidgetHeader\n name={props.name}\n description={props.description}\n />\n );\n }\n\n return (\n <div className='curated-widget-header'>\n {!props.hideHeading && (\n <div className='partial-loading-background curated-widget-heading' style={{ height: '1.5rem', width: '12rem' }} />\n )}\n\n {!props.hideDescription && (\n <div className='partial-loading-background curated-widget-description' style={{ height: '1.434375rem', width: '16rem' }} />\n )}\n </div>\n );\n}\n",":local {\n %overflowGradient {\n position: absolute;\n width: 2.5rem;\n height: 101%;\n z-index: 2;\n top: 50%;\n transform: translateY(-50%);\n }\n\n .leftOverflowGradient {\n @extend %overflowGradient;\n left: 0;\n margin-left: -#{map-get($spacers, 4)};\n background-image: linear-gradient(to left, $cv-safe-transparent 0%, $white 70%);\n }\n\n .rightOverflowGradient {\n @extend %overflowGradient;\n right: 0;\n margin-right: -#{map-get($spacers, 4)};\n background-image: linear-gradient(to right, $cv-safe-transparent 0%, $white 70%);\n }\n\n .partialItem {\n display: inline-block;\n width: 100%;\n padding-bottom: percentage(calc(9 / 16));\n }\n\n .mobileScroll {\n overflow-x: scroll;\n -ms-overflow-style: none;\n scrollbar-width: none;\n\n &::-webkit-scrollbar {\n display: none;\n }\n }\n\n .widgetItemWrapper {\n display: contents;\n }\n}\n","import * as React from 'react';\n\nimport { HashObject } from 'libs/common/react/interfaces/HashObject';\n\nimport { PartialWidgetHeader } from 'libs/shared/components/widgets/curated-widgets/components/header/partial-loading/PartialWidgetHeader';\nimport { useBreakpoints } from 'libs/shared/hooks/useBreakpoints';\n\nimport { PartialWidgetTemplateProps } from '../curated-widgets/WidgetProps';\n\nimport styles from './fixed-widget.module.scss';\n\nfunction useGetSize(size?: 'sm' | 'lg'): HashObject {\n const breakpoints = useBreakpoints();\n\n if (breakpoints.xs)\n return {\n itemCount: 1,\n colSize: 12\n };\n\n if (breakpoints.sm)\n return {\n itemCount: 2,\n colSize: 6\n };\n\n if (breakpoints.md || breakpoints.lg)\n return {\n itemCount: 3,\n colSize: 4\n };\n\n return {\n itemCount: size === 'sm' ? 4 : 3,\n colSize: size === 'sm' ? 3 : 4\n };\n}\n\nexport interface PartialFixedWidgetItemProps {\n colSize: number;\n}\n\nconst PartialLoadingItem = ({ colSize }: PartialFixedWidgetItemProps) => (\n <div className={`col-${colSize} px-1`}>\n <div className={`${styles.partialItem} partial-loading-background rounded-3`} />\n </div>\n);\n\nexport interface PartialFixedWidgetProps {\n hideDescription?: boolean;\n hideHeading?: boolean;\n size?: 'sm' | 'lg';\n childComponent?: (props: PartialFixedWidgetItemProps) => JSX.Element;\n}\n\nPartialFixedWidget.defaultProps = {\n size: 'sm',\n childComponent: PartialLoadingItem\n};\n\nexport function PartialFixedWidget(props: PartialWidgetTemplateProps): JSX.Element {\n const { itemCount, colSize } = useGetSize(props.size);\n\n const ChildComponent = props.childComponent;\n\n const items = [];\n for (let i = 0; i < itemCount; i++) {\n items.push(<ChildComponent key={i} colSize={colSize} />);\n }\n\n return (\n <div className='widget'>\n <PartialWidgetHeader\n hideHeading={props.hideHeading}\n hideDescription={props.hideDescription}\n name={props.name}\n description={props.description}\n isPreviewing={props.isPreviewing}\n />\n <div className='row g-0 mx-n1'>\n {items}\n </div>\n </div>\n );\n}\n","import React from 'react';\n\nimport { LanguageService } from 'libs/common/backbone/services/LanguageService';\nimport { FunctionHelper } from 'libs/common/backbone/utils/FunctionHelper';\nimport { UserAgentHelper } from 'libs/common/backbone/utils/UserAgentHelper';\nimport { Core } from 'libs/common/core';\nimport { Flight } from 'libs/common/flight';\n\nimport { AnalyticsHelper } from 'libs/analytics/AnalyticsHelper';\nimport { AnalyticsOptions, HashObject } from 'libs/analytics/interfaces';\n\nimport { WidgetHeader } from 'libs/shared/components/widgets/curated-widgets/components/header/WidgetHeader';\nimport { useWidgetKeyboard } from 'libs/shared/components/widgets/hooks/useWidgetKeyboard';\nimport { FixedWidgetItemProps } from 'libs/shared/components/widgets/items/FixedWidgetItemProps';\nimport { SlidingListContainer } from 'libs/shared/components/widgets/sliding-list/SlidingListContainer';\nimport { WidgetButton, WidgetButtonDirection } from 'libs/shared/components/widgets/widget-button/WidgetButton';\nimport { CssMeasurement } from 'libs/shared/enums/CssMeasurement';\nimport { ImageSize } from 'libs/shared/enums/Images';\nimport { WidgetContents } from 'libs/shared/enums/WidgetContents';\nimport { WidgetInteraction } from 'libs/shared/enums/WidgetInteraction';\nimport { WidgetTypeId } from 'libs/shared/enums/WidgetTypeId';\nimport { useBreakpoints } from 'libs/shared/hooks/useBreakpoints';\nimport { useHover } from 'libs/shared/hooks/UseHover';\nimport { useLazyLoad } from 'libs/shared/hooks/UseLazyLoad';\nimport { WidgetContext, WidgetType } from 'libs/shared/interfaces';\nimport { WidgetHelper } from 'libs/shared/utils/WidgetHelper';\n\nimport { FixedWidgetReducer, initialWidgetState, lazyWidgetInit } from './FixedWidgetReducer';\nimport { FixedWidgetControls, formatData, getCollectionAppLink, getOnTouchEnd, getOnTouchStart, getShouldPreload, hideBackButton, hideNextButton, useControlsRef, useFetchData } from './FixedWidgetUtils';\nimport { PartialFixedWidget } from './PartialFixedWidget';\n\nimport styles from './fixed-widget.module.scss';\n\nconst namespace = 'shared.fixedWidget';\n\n// Max number of widget items whenever `props.limitTotalItems` is `true`\nexport const WIDGET_ITEM_LIMIT = 12;\n\ninterface BaseFixedWidgetProps<\n T extends React.ComponentType<FixedWidgetItemProps>\n> {\n id?: string;\n name?: string;\n description?: string;\n\n type: WidgetType;\n contents: WidgetContents;\n thumbnailSize?: ImageSize;\n minimumItemCount?: number;\n limitTotalItems?: boolean;\n setData?: (data: any) => any[] | null;\n isPreviewing?: boolean;\n widgetTypeId?: WidgetTypeId;\n\n childComponent: T;\n extraChildComponentProps: Omit<React.ComponentProps<T>, keyof FixedWidgetItemProps>;\n\n partialComponent?: React.ElementType;\n getChildAppLink?: (item?: any) => Core.AppLink;\n appLink?: Core.AppLink;\n onAppLinkClick?: () => void;\n headingBadgeComponent?: JSX.Element;\n showSeeMoreLink?: boolean;\n\n analyticsData?: HashObject;\n analyticsOptions?: AnalyticsOptions;\n\n getWidgetItemAnalyticsData?: (data: any) => HashObject;\n\n onNext?: () => void;\n onPrevious?: () => void;\n onClose?: () => void;\n onFollow?: (shouldFollow: boolean) => void;\n isFollowing?: boolean;\n showFollowSpinner?: boolean;\n controlsRef?: React.MutableRefObject<FixedWidgetControls>;\n touchBehavior?: 'drag' | 'scroll';\n\n leftWidgetButtonClassName?: string;\n rightWidgetButtonClassName?: string;\n\n hideName?: boolean;\n hideBleedingContent?: boolean;\n hideExtendedClickableArea?: boolean;\n hideButtons?: boolean;\n // This is for any additional items that need to be rendered at the end of the widget item list\n // such as a \"See More\" card.\n trailingItems?: JSX.Element;\n // Indicate how many extra items we added through trailingItems\n trailingItemLength?: number;\n}\n\ntype FixedWidgetWithFetchProps<T extends React.ComponentType<FixedWidgetItemProps>> = BaseFixedWidgetProps<T> &\n {\n lazyLoad: true,\n collection?: never,\n fetch: (...args: any) => Flight.Response<any>,\n prefetched?: false\n };\n\ntype FixedWidgetWithCollectionProps<T extends React.ComponentType<FixedWidgetItemProps>> = BaseFixedWidgetProps<T> &\n {\n collection: any,\n lazyLoad?: false,\n fetch?: never,\n prefetched: true\n };\n\nexport type FixedWidgetProps<T extends React.ComponentType<FixedWidgetItemProps>> =\n FixedWidgetWithCollectionProps<T> |\n FixedWidgetWithFetchProps<T>;\n\nFixedWidget.defaultProps = {\n type: WidgetType.Row,\n minimumItemCount: 0,\n extraChildComponentProps: {},\n touchBehavior: 'scroll'\n};\n\n/**\n * If your childProps complains that \"value\" is not assignable ot type \n */\nexport function FixedWidget<T extends React.ComponentType<FixedWidgetItemProps>>(\n props: FixedWidgetProps<T>\n): JSX.Element {\n const { analyticsData = {}, getWidgetItemAnalyticsData = () => {} } = props;\n\n const [ initialTouchX, setInitialTouchX ] = React.useState(null);\n const [ containerWidth, setContainerWidth ] = React.useState(null);\n const [ percentageDragged, setPercentageDragged ] = React.useState(0);\n\n const [ state, dispatch ] = React.useReducer(FixedWidgetReducer, initialWidgetState, lazyWidgetInit);\n\n const containerRef = React.useRef(null);\n const [ buttonsRef, isHovering ] = useHover<HTMLDivElement>();\n\n const [ isHoveringOnFarLeft, setIsHoveringOnFarLeft ] = React.useState(false);\n const [ isHoveringOnFarRight, setIsHoveringOnFarRight ] = React.useState(false);\n\n useControlsRef(props.controlsRef, dispatch);\n\n const { ref, inView: shouldFetch } = useLazyLoad({ prevent: !props.lazyLoad });\n\n const response = useFetchData(props, dispatch, shouldFetch);\n\n function getWidgetCollection(limit: number): any[] {\n const responseData = props.prefetched ? props.collection : response.data;\n\n if (!responseData)\n return [];\n\n const formattedResponse = FunctionHelper.isFunction(props.setData) ? props.setData(responseData) : responseData;\n return formattedResponse?.slice(0, limit) ?? [];\n }\n\n const widgetItems = getWidgetCollection(props.limitTotalItems ? WIDGET_ITEM_LIMIT : Infinity);\n const widgetLength = props.trailingItems && props.trailingItemLength ?\n widgetItems.length + props.trailingItemLength :\n widgetItems.length;\n\n function hasMoreItems(): boolean {\n if (!props.limitTotalItems)\n return false;\n\n const unlimitedItems = getWidgetCollection(Infinity);\n\n return unlimitedItems.length > widgetLength;\n }\n\n const hasReachedEnd = state.offset === widgetLength;\n\n const breakpoints = useBreakpoints();\n \n const { onFocusWidget, onBlurWidget, isTabbing, getFixedAttributes, focusNext, focusPrev } = useWidgetKeyboard({ type: 'fixed', state, containerRef });\n\n React.useEffect(() => {\n dispatch({\n type: WidgetInteraction.Resize,\n payload: { breakpoints }\n });\n }, [breakpoints]);\n\n React.useEffect(() => {\n if (!props.prefetched)\n return;\n\n let type = props.type;\n\n // The ResourcesTile widget type is deprecated. We render the Row type instead in this case\n if (type === WidgetType.ResourcesTile)\n type = WidgetType.Row;\n\n // If the prefetched collection changes, re-initialize the widget state.\n dispatch({\n type: WidgetInteraction.Init,\n payload: {\n breakpoints,\n type,\n contents: props.contents,\n totalItems: widgetLength\n }\n });\n }, [ props.collection?.length, props.prefetched ]);\n\n function onSetIsHovering(hovering: boolean, index: number): void {\n if (widgetLength === state.viewableItems) {\n setIsHoveringOnFarLeft(hovering);\n setIsHoveringOnFarRight(hovering);\n return;\n }\n\n // This callback will hide the far left button if the user is hovering on the far left widget item.\n // Same goes for the far right button & widget item.\n if (index + 1 === widgetLength) {\n setIsHoveringOnFarRight(hovering);\n return;\n }\n\n if (index === 0) {\n setIsHoveringOnFarLeft(hovering);\n return;\n }\n\n if ((index + 1 - (state.offset % state.viewableItems)) % state.viewableItems === 0) {\n setIsHoveringOnFarRight(hovering);\n return;\n }\n\n if ((index - (state.offset % state.viewableItems)) % state.viewableItems === 0) {\n setIsHoveringOnFarLeft(hovering);\n return;\n }\n }\n\n function shouldScroll(): boolean {\n if (props.touchBehavior !== 'scroll')\n return false;\n\n return UserAgentHelper.isTabletOrMobile();\n }\n\n const widgetContext: WidgetContext = {\n type: state.type,\n collectionSize: widgetLength,\n contents: props.contents\n };\n\n const data = formatData(props, response?.data || props.collection);\n\n if (response?.hasError)\n return <></>;\n\n if (!props.prefetched && !response?.data) {\n const PartialComponent = props.partialComponent || PartialFixedWidget;\n\n return (\n <div ref={ref}>\n <PartialComponent />\n </div>\n );\n }\n\n if (!widgetLength || widgetLength < props.minimumItemCount)\n return <></>;\n\n /**\n * Don't merge this if Sha forgot to fix it.\n */\n const WidgetItemComponent = props.childComponent as React.ComponentType<FixedWidgetItemProps>;\n\n const getSliderAnalyticsData = (type: WidgetInteraction) => ({\n id: data?.id,\n name: data?.name,\n direction: type === WidgetInteraction.Next ? 'right' : 'left',\n ...props.analyticsData\n });\n\n const showSeeMoreButton = (() => {\n // Only show if there is an applink and we've reached the end of the widget\n if (!props.appLink || !hasReachedEnd)\n return false;\n\n // Also only show if we've exceeded the widget limit, if one has been set\n return hasMoreItems();\n })();\n\n const hideButtons = shouldScroll() || props.hideButtons;\n const hideBackGradient = state.offset === state.viewableItems;\n const hideNextGradient = widgetLength <= state.offset;\n const hasMoreThanViewable = state.viewableItems < widgetLength;\n\n return (\n <div className='mx-n4 mb-n3'>\n <div className={shouldScroll() ? 'pb-3 overflow-hidden' : 'px-4 pb-3 overflow-hidden'}>\n {!props.hideName &&\n <div className={shouldScroll() ? 'px-4' : ''}>\n <WidgetHeader\n name={data.name}\n description={data.description}\n appLink={getCollectionAppLink(props.appLink, data)}\n onAppLinkClick={props.onAppLinkClick}\n analyticsData={{ id: data?.id, name: data?.name, ...props.analyticsData }}\n analyticsOptions={WidgetHelper.getSliderHeadingAnalyticsOptions()}\n showSeeMoreLink={props.showSeeMoreLink ?? hasMoreThanViewable}\n content={widgetItems}\n isPreviewing={props.isPreviewing}\n widgetTypeId={props.widgetTypeId}\n badgeComponent={props.headingBadgeComponent}\n onClose={props.onClose}\n onFollow={props.onFollow}\n isFollowing={props.isFollowing}\n showFollowSpinner={props.showFollowSpinner}\n />\n </div>\n }\n <div\n ref={buttonsRef}\n className={`position-relative mx-n1 ${shouldScroll() ? `${styles.mobileScroll} px-4` : ''} ${props.hideBleedingContent ? 'overflow-hidden-x' : ''}`}\n >\n {!hideButtons && (\n <>\n {(!props.hideBleedingContent && !isHoveringOnFarLeft && !hideBackGradient) && (\n <div className={styles.leftOverflowGradient} />\n )}\n <WidgetButton\n direction={WidgetButtonDirection.Left}\n onClick={() => {\n focusPrev();\n\n dispatch({ type: WidgetInteraction.Previous });\n AnalyticsHelper.logUserAction(\n getSliderAnalyticsData(WidgetInteraction.Previous),\n WidgetHelper.getSliderAnalyticsOptions()\n );\n\n FunctionHelper.isFunction(props.onPrevious) && props.onPrevious();\n }}\n hide={!!props.hideButtons || hideBackButton(\n isHoveringOnFarLeft,\n isHovering,\n state.offset,\n state.viewableItems,\n widgetLength,\n isTabbing\n )}\n contents={props.contents}\n className={props.leftWidgetButtonClassName}\n hideExtendedClickableArea={props.hideExtendedClickableArea}\n state={state}\n />\n </>\n )}\n \n <SlidingListContainer\n position={state.position}\n positionType={CssMeasurement.Percentage}\n onTouchMove={props.touchBehavior === 'drag' && getOnTouchStart(\n state,\n containerRef,\n containerWidth,\n setContainerWidth,\n initialTouchX,\n setInitialTouchX,\n setPercentageDragged\n )}\n onTouchEnd={props.touchBehavior === 'drag' && getOnTouchEnd(\n containerRef,\n setInitialTouchX,\n percentageDragged,\n setPercentageDragged,\n dispatch,\n props.onNext,\n props.onPrevious\n )}\n ref={containerRef}\n percentageDragged={percentageDragged}\n >\n {widgetItems.map((widgetItem: any, index: number) => {\n return (\n <li\n key={`${widgetItem.id}:${index}`}\n onFocus={() => onFocusWidget(index)}\n onBlur={onBlurWidget}\n className={styles.widgetItemWrapper}\n {...getFixedAttributes(index)}\n >\n <WidgetItemComponent\n data={widgetItem}\n collectionAppLink={props.appLink}\n getAppLink={\n props.getChildAppLink ? () => props.getChildAppLink(widgetItem) : () => null as any\n }\n context={widgetContext}\n preloadImage={getShouldPreload(state, widgetItems)(widgetItem)}\n thumbnailSize={props.thumbnailSize || ImageSize.Medium}\n analyticsData={{\n widgetId: data.id,\n widgetName: data.name,\n itemIndex: index,\n ...analyticsData,\n ...getWidgetItemAnalyticsData(widgetItem)\n }}\n analyticsOptions={{ ...props.analyticsOptions, ...WidgetHelper.getSliderItemAnalyticsOptions() }}\n onHover={(hovering: boolean) => {\n if (shouldScroll())\n return;\n /**\n * For some reason this needs to be called after a set timeout, otherwise\n * the `useHover` listener on the `buttonsRef` element will not detect it's hover\n * event. A delay of 200ms is used for when `hovering` is false so that the effects of\n * setting `isHoveringOnFarX` aren't applied until the CSS transform transition has\n * completed.\n */\n window.setTimeout(() => {\n onSetIsHovering(hovering, index);\n }, hovering ? 0 : 200);\n }}\n {...props.extraChildComponentProps}\n />\n </li>\n );\n })}\n {props.trailingItems}\n {shouldScroll() && <div className='ps-4'></div>}\n </SlidingListContainer>\n\n {!hideButtons && (\n <>\n <WidgetButton\n direction={WidgetButtonDirection.Right}\n onClick={() => {\n if (showSeeMoreButton) {\n Core.AppLinkHelper.trigger(getCollectionAppLink(props.appLink, data));\n return;\n }\n focusNext();\n\n dispatch({ type: WidgetInteraction.Next });\n AnalyticsHelper.logUserAction(\n getSliderAnalyticsData(WidgetInteraction.Next),\n WidgetHelper.getSliderAnalyticsOptions()\n );\n\n FunctionHelper.isFunction(props.onNext) && props.onNext();\n }}\n hide={!!props.hideButtons || hideNextButton(\n isHoveringOnFarRight,\n isHovering,\n state.offset,\n state.viewableItems,\n widgetLength,\n showSeeMoreButton,\n isTabbing\n )}\n contents={props.contents}\n hoverText={showSeeMoreButton && LanguageService.getPhrase(namespace, 'seeMore')}\n className={props.rightWidgetButtonClassName}\n hideExtendedClickableArea={props.hideExtendedClickableArea}\n state={state}\n />\n {(!props.hideBleedingContent && !isHoveringOnFarRight && !hideNextGradient) && (\n <div className={styles.rightOverflowGradient} />\n )}\n </>\n )}\n </div>\n </div>\n </div>\n );\n}\n","@import '~styles/utils/include-media';\n:local {\n .imageStyle {\n border-top-left-radius: $border-radius-lg;\n border-top-right-radius: $border-radius-lg;\n filter: drop-shadow(0px -1px 4px rgba(0, 0, 0, 0.1));\n }\n\n .item {\n width: 25%;\n\n &.dashboard {\n @include media('<=xl') {\n width: 33.33333%;\n }\n \n @include media('<=md') {\n width: 50%;\n }\n \n @include media('<=sm') {\n width: 100%;\n }\n }\n\n &.playPage {\n @include media('<=md') {\n width: percentage(calc(1 / 3));\n }\n \n @include media('<=sm') {\n width: 50%;\n }\n }\n }\n\n .aspectRatio {\n position: relative;\n padding-bottom: 56.25%;\n width: 100%;\n }\n\n .outerContainer {\n position: absolute;\n top: 0;\n bottom: 0;\n left: 0;\n right: 0;\n }\n\n .innerContainer {\n .actions {\n display: none;\n position: absolute;\n top: map-get($spacers, 2);\n right: map-get($spacers, 2);\n z-index: 5;\n }\n\n &:hover {\n .actions {\n display: block;\n }\n }\n }\n\n .titleBelow:hover {\n text-decoration: underline;\n }\n\n .thumbnailContainer {\n height: 85%;\n\n &.titleAbove {\n height: percentage(calc(2 / 3));\n }\n }\n\n // Resource type colour classes\n .teacherPack {\n .text {\n color: $blue;\n }\n\n background-color: scale-color($blue, $lightness: 86%, $saturation: 100%);\n\n &.hoverState {\n &:hover {\n background-color: scale-color($blue, $lightness: 93%, $saturation: 100%);\n }\n }\n }\n\n .atomGuide {\n .text {\n color: $indigo;\n }\n\n background-color: scale-color($indigo, $lightness: 80%, $saturation: 100%);\n\n &.hoverState {\n &:hover {\n background-color: scale-color($indigo, $lightness: 90%, $saturation: 100%);\n }\n }\n }\n\n .studentActivity {\n .text {\n color: $purple;\n }\n \n background-color: scale-color($purple, $lightness: 84%, $saturation: 100%);\n\n &.hoverState {\n &:hover {\n background-color: scale-color($purple, $lightness: 92%, $saturation: 100%);\n }\n }\n }\n\n .additionalMaterials {\n .text {\n color: $green;\n }\n \n background-color: scale-color($green, $lightness: 82%, $saturation: 100%);\n\n &.hoverState {\n &:hover {\n background-color: scale-color($green, $lightness: 88%, $saturation: 100%);\n }\n }\n }\n\n .userUploaded {\n .text {\n color: $teal;\n }\n\n background-color: scale-color($teal, $lightness: 80%, $saturation: 100%);\n\n &.hoverState {\n &:hover {\n background-color: scale-color($teal, $lightness: 89%, $saturation: 100%);\n }\n }\n }\n\n .imageTypeResource {\n width: auto;\n object-fit: contain;\n left: 50% !important;\n transform: translateX(-50%);\n }\n\n .download {\n color: $dark;\n background-color: rgba(darken($white, 2%), 0.8);\n border-radius: 50%;\n width: 2rem;\n height: 2rem;\n\n &:hover {\n background-color: $white;\n }\n }\n}","import React from 'react';\n\nimport { AppLinkHelper } from 'libs/common/backbone/core';\n\nimport { AnalyticsHelper } from 'libs/analytics/AnalyticsHelper';\nimport { AnalyticsOptions, EntityType, UserAction } from 'libs/analytics/interfaces';\n\nimport { AppLink } from 'libs/shared/components/app-link/AppLink';\nimport { DivButton } from 'libs/shared/components/div-button/DivButton';\nimport { ResourceThumbnail } from 'libs/shared/components/resource-thumbnail/ResourceThumbnail';\nimport { SvgContainer } from 'libs/shared/components/svg-container/SvgContainer';\nimport { TitleSubText } from 'libs/shared/components/title-sub-text/TitleSubText';\nimport { Tooltip } from 'libs/shared/components/tooltip/Tooltip';\nimport { TypeBadge } from 'libs/shared/components/type-badge/TypeBadge';\nimport { FixedWidgetItemProps } from 'libs/shared/components/widgets/items/FixedWidgetItemProps';\nimport { SeoConstants } from 'libs/shared/constants/SeoConstants';\nimport { MasterType } from 'libs/shared/enums/MasterType';\nimport { ResourceFileType } from 'libs/shared/enums/ResourceFileType';\nimport { useBreakpoints } from 'libs/shared/hooks/useBreakpoints';\nimport { DownloadSvg } from 'libs/shared/images/svg/actions/DownloadSvg';\nimport { Link, Resource, ResourceType } from 'libs/shared/interfaces';\nimport { MasterTypeHelper } from 'libs/shared/utils/MasterTypeHelper';\nimport { ResourceHelper } from 'libs/shared/utils/ResourceHelper';\n\nimport styles from './resource-widget-item.module.scss';\n\nfunction getColour(resourceType?: ResourceType): string {\n switch (resourceType) {\n case 'atom-guide':\n return styles.atomGuide;\n case 'student-activity':\n return styles.studentActivity;\n case 'teacher-pack':\n return styles.teacherPack;\n case 'additional-materials':\n return styles.additionalMaterials;\n default:\n return styles.userUploaded;\n }\n}\n\nfunction useCanPreview(data: Resource | Link, actionBehaviour: 'normal' | 'public'): boolean {\n const breakpoints = useBreakpoints();\n\n /**\n * When viewing publicly, the resource applink will\n * prompt the user to sign-up (not preview the underlying resource)\n */\n if (actionBehaviour === 'public')\n return true;\n\n if (breakpoints.xs || breakpoints.sm)\n return false;\n\n if (data.type !== 'resource')\n return false;\n \n // Require metadata\n if (!('metadata' in data))\n return false;\n\n // We can preview images\n if (data.metadata.type === ResourceFileType.Image)\n return true;\n\n // If we are a pdf and have a url\n if (data.metadata.type === ResourceFileType.Pdf)\n return !!data.url;\n\n // If we have a pdf assoc\n return !!data.pdf?.url;\n}\n\ninterface ResourceTheme {\n containerClass?: string;\n thumbnailContainerClass?: string;\n}\n\nexport interface ResourceTileProps {\n data: Resource | Link;\n imageCdnUrl: string;\n imageErrorFallbackUrl?: string;\n theme?: ResourceTheme;\n\n titlePosition: 'above' | 'below' | 'none';\n hideTypeBadge?: boolean;\n onClickDownload?: (e: React.MouseEvent<HTMLElement>, resource: Resource) => void;\n applyHoverState?: boolean;\n preloadImage: boolean;\n actionBehaviour?: 'normal' | 'public';\n}\n\nResourceTile.defaultProps = {\n preloadImage: true,\n actionBehaviour: 'normal'\n};\n\n/**\n * This component intentionally doesn't contain an appLink/download link\n * so that the resource download behaviour can be handled differently depending\n * on where this is rendered (e.g. primary play page vs embedded player)\n */\nexport function ResourceTile(props: ResourceTileProps): JSX.Element {\n let metadata = null;\n\n if ('metadata' in props.data) {\n metadata = props.data.metadata;\n }\n\n const isResource = MasterTypeHelper.isType<Resource>(props.data, MasterType.Resource);\n\n function getInnerContainerClass(resourceType: ResourceType): string {\n let baseClass = `\n d-flex flex-column align-items-center justify-content-end rounded-3 h-100\n position-relative ${getColour(resourceType)} ${styles.innerContainer}`;\n\n if (props.theme?.containerClass) {\n baseClass += ` ${props.theme.containerClass}`;\n } else {\n baseClass += ` pt-3 px-3`;\n }\n\n if (props.applyHoverState) {\n baseClass += ` ${styles.hoverState}`;\n }\n\n return baseClass;\n }\n\n return (\n <>\n <div className={styles.aspectRatio}>\n <div className={styles.outerContainer}>\n <div className={getInnerContainerClass(metadata?.resourceType)}>\n {props.titlePosition === 'above' && (\n <Tooltip title={props.data.name}>\n <h3 className={`text-center text-break h5 mb-3 ${styles.text}`}>\n <span className='clamp-1'>{props.data.name}</span>\n </h3>\n </Tooltip>\n )}\n\n <div className={`\n ${props.theme?.thumbnailContainerClass ?? ''} w-75 overflow-hidden \n ${styles.thumbnailContainer} ${props.titlePosition === 'above' ? styles.titleAbove : ''} \n ${styles.imageStyle}\n `}>\n <ResourceThumbnail\n resource={props.data}\n imageCdnUrl={props.imageCdnUrl}\n imageErrorFallbackUrl={props.imageErrorFallbackUrl}\n preloadImage={props.preloadImage}\n />\n </div>\n\n {isResource && props.onClickDownload && props.actionBehaviour === 'normal' && (\n <div className={styles.actions}>\n <DivButton\n onClick={e => props.onClickDownload(e, props.data as Resource)}\n className={`${styles.download} d-flex align-items-center justify-content-center`}\n >\n <SvgContainer svg={DownloadSvg} />\n </DivButton>\n </div>\n )}\n\n {!props.hideTypeBadge && isResource && (\n <TypeBadge typeId={MasterType.Resource} />\n )}\n </div>\n </div>\n </div>\n {props.titlePosition === 'below' && (\n <div className={`mt-1 ${styles.titleBelow}`}>\n {(\n MasterTypeHelper.isType<Resource>(props.data, MasterType.Resource) &&\n !!props.data?.metadata?.resourceType\n ) && (\n <TitleSubText>\n {ResourceHelper.getResourceTypeName(props.data.metadata.resourceType)}\n </TitleSubText>\n )}\n <h3 className='h6 clamp-2'>\n {props.data.name}\n </h3>\n </div>\n )}\n </>\n );\n}\n\nexport interface ResourceWidgetItemProps extends ResourceTileProps, FixedWidgetItemProps<Resource | Link> {\n location: 'play-page' | 'dashboard';\n}\n\nexport const ResourceWidgetItem = React.memo(function(props: ResourceWidgetItemProps): JSX.Element {\n // Mobile is not allowed to preview\n const canPreview = useCanPreview(props.data, props.actionBehaviour);\n\n function getLocationClass(): string {\n if (props.location === 'play-page')\n return styles.playPage;\n\n return styles.dashboard;\n }\n\n const analyticsData = { ...props.analyticsData, ...props.data };\n\n const analyticsOptions: AnalyticsOptions = {\n ...props.analyticsOptions,\n actionType: UserAction.Click,\n entity: props.data.typeId === MasterType.Resource ? EntityType.Resource : EntityType.Link\n };\n\n function logAction(): void {\n AnalyticsHelper.logUserAction(analyticsData, analyticsOptions);\n }\n\n const tileProps: ResourceTileProps = {\n ...props,\n // Apply the hover state if we have a url or the resource can be previewed\n applyHoverState: canPreview || !!props.data.url\n };\n\n return (\n <div className={`px-1 flex-shrink-0 ${styles.item} ${getLocationClass()} ${SeoConstants.RESOURCE_ITEM_SELECTOR}`}>\n {(() => {\n const className = `d-block no-decoration`;\n\n // Handle resource links\n if (props.data.type === 'link') {\n return (\n <a href={props.data.url} target='_blank' className={className} onClick={logAction}>\n <ResourceTile {...tileProps} />\n </a>\n );\n }\n\n if (canPreview) {\n /**\n * Previewing resources in a public context will always display the sign-up popup, so there \n * will never be a full URL. For SEO purposes, we deliberately use a span over an anchor\n * to ensure we're not creating self-referencing elements that will burn crawl budget.\n */\n if (props.actionBehaviour === 'public') {\n return (\n <div className={`${className} cursor-pointer d-inline`} onClick={() => {\n logAction();\n AppLinkHelper.trigger(props.getAppLink(props.data));\n }}>\n <ResourceTile {...tileProps} />\n </div>\n );\n }\n\n return (\n <AppLink\n appLink={props.getAppLink(props.data)}\n className={className}\n analyticsData={analyticsData}\n analyticsOptions={analyticsOptions}\n >\n <ResourceTile {...tileProps} />\n </AppLink>\n );\n }\n\n // URLs cannot be previewed\n if (props.data.url) {\n return (\n <a href={props.data.url} className={className} onClick={logAction}>\n <ResourceTile {...tileProps} />\n </a>\n );\n }\n\n // Theres no url, so don't render an <a>\n return (\n <div className={className}>\n <ResourceTile {...tileProps} />\n </div>\n );\n })()}\n </div>\n );\n});\n"],"mappings":"u4BAMA,IAAY,EAAL,SAAA,EAAA,OACL,GAAA,EAAA,IAAA,GAAA,MACA,EAAA,EAAA,SAAA,GAAA,WACA,EAAA,EAAA,KAAA,GAAA,OACA,EA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,CACN,IAAM,EAAY,wBAkDlB,OA/CI,EAAM,KAAK,OAAS,QAEpB,EAAA,EAAA,KAAC,IAAD,CAAG,KAAM,EAAM,KAAK,IAAK,OAAO,SAAoB,YAAW,QAAS,YACtE,EAAA,EAAA,KAAC,EAAD,CAAc,GAAI,EAAa,CAAA,CAC7B,CAAA,CAIJ,EAME,EAAM,kBAAoB,UAE1B,EAAA,EAAA,KAAC,MAAD,CAAK,UAAW,GAAG,EAAU,0BAA2B,YAAe,CACrE,GAAW,CACX,EAAc,QAAQ,EAAM,WAAW,EAAM,KAAK,CAAC,YAEnD,EAAA,EAAA,KAAC,EAAD,CAAc,GAAI,EAAa,CAAA,CAC3B,CAAA,EAKR,EAAA,EAAA,KAAC,EAAD,CACE,QAAS,EAAM,WAAW,EAAM,KAAK,CAC1B,YACI,gBACG,6BAElB,EAAA,EAAA,KAAC,EAAD,CAAc,GAAI,EAAa,CAAA,CACvB,CAAA,CAKV,EAAM,KAAK,KAEX,EAAA,EAAA,KAAC,IAAD,CAAG,KAAM,EAAM,KAAK,IAAgB,YAAW,QAAS,YACtD,EAAA,EAAA,KAAC,EAAD,CAAc,GAAI,EAAa,CAAA,CAC7B,CAAA,EAMN,EAAA,EAAA,KAAC,MAAD,CAAgB,sBACd,EAAA,EAAA,KAAC,EAAD,CAAc,GAAI,EAAa,CAAA,CAC3B,CAAA,KAGN,CAAA,EAER"}
|
|
1
|
+
{"version":3,"file":"CcGYZb9f.chunk.js","names":[],"sources":["../../../../libs/shared/src/interfaces/models/Widget.ts","../../../../libs/shared/src/enums/WidgetContents.ts","../../../../libs/shared/src/components/widgets/fixed-widget/FixedWidgetUtils.ts","../../../../libs/shared/src/components/widgets/fixed-widget/FixedWidgetReducer.tsx","../../../../libs/shared/src/components/widgets/curated-widgets/components/header/partial-loading/PartialWidgetHeader.tsx","../../../../libs/shared/src/components/widgets/fixed-widget/fixed-widget.module.scss","../../../../libs/shared/src/components/widgets/fixed-widget/PartialFixedWidget.tsx","../../../../libs/shared/src/components/widgets/fixed-widget/FixedWidget.tsx","../../../../libs/shared/src/components/widgets/items/resource-widget-item/resource-widget-item.module.scss","../../../../libs/shared/src/components/widgets/items/resource-widget-item/ResourceWidgetItem.tsx"],"sourcesContent":["import { BaseObject } from 'libs/shared/interfaces';\n\n/**\n * This maps directly against the widget types from Domain.\n * Update is only required where the backend changes.\n */\nexport enum WidgetType {\n Row = 0, // At full-size, this will contain a row of 4 items\n LargeRow = 1, // At full-size, this will contain a row of 3 times\n Hero = 2,\n ResourcesTile = 3 // Deprecated. Widget's with this type will fall back to the `Row` type (0).\n}\n\nexport interface Widget extends Omit<BaseObject, 'type'> {\n collectionId: string;\n dashboardId: string;\n type: WidgetType;\n}\n","export enum WidgetContents {\n Videos = 'videos',\n FeedVideos = 'feed videos',\n Series = 'series',\n Subjects = 'subjects',\n Playlists = 'playlists',\n Interactives = 'interactives',\n Clips = 'clips',\n PlayPageResources = 'play page resources',\n DashboardResources = 'dashboard resources',\n Libraries = 'Libraries',\n Folders = 'Folders',\n RecentActivities = 'recent activities',\n SmallSeries = 'small series',\n Companies = 'companies',\n PartnerProfiles = 'partner profiles',\n Ratings = 'ratings',\n SpecialEvents = 'special events',\n\n InteractivesV2 = 'interactives v2',\n ClipsV2 = 'clips v2',\n PlayPageResourcesV2 = 'playpage resources v2'\n}\n","import * as React from 'react';\n\nimport { FunctionHelper } from 'libs/common/backbone/utils/FunctionHelper';\nimport { Core } from 'libs/common/core';\nimport { Flight } from 'libs/common/flight';\nimport { ReducerActions } from 'libs/common/react/interfaces';\nimport { ObjectHelper } from 'libs/common/react/utils/ObjectHelper';\nimport { TextHelper } from 'libs/common/react/utils/TextHelper';\n\nimport { FixedWidgetItemProps } from 'libs/shared/components/widgets/items/FixedWidgetItemProps';\nimport { WidgetContents } from 'libs/shared/enums/WidgetContents';\nimport { WidgetInteraction } from 'libs/shared/enums/WidgetInteraction';\nimport { Breakpoints, useBreakpoints } from 'libs/shared/hooks/useBreakpoints';\nimport { BaseObject, WidgetType } from 'libs/shared/interfaces';\n\nimport { FixedWidgetProps, WIDGET_ITEM_LIMIT } from './FixedWidget';\nimport { FixedWidgetPayload, FixedWidgetState } from './FixedWidgetReducer';\n\nexport interface WidgetData {\n id?: string;\n name?: string;\n description?: string;\n}\n\nexport function useFetchData<T extends React.ComponentType<FixedWidgetItemProps>>(\n props: FixedWidgetProps<T>,\n dispatch: React.Dispatch<ReducerActions<WidgetInteraction, FixedWidgetPayload>>,\n shouldFetch: boolean\n): Flight.Response<any> {\n let data = props.collection;\n let res: Flight.Response<any>;\n\n if ((!data || ObjectHelper.isEmpty(data)) && !props.prefetched) {\n res = props.fetch(shouldFetch);\n data = res.data;\n }\n\n /**\n * Once we have the widget data, lazily update our state with the new collection\n */\n const collection = (FunctionHelper.isFunction(props.setData) && data) ? props.setData(data) : data;\n let collectionToDisplay = collection;\n\n const breakpoints = useBreakpoints();\n\n React.useEffect(() => {\n if (!data || ObjectHelper.isEmpty(data))\n return;\n\n if (props.limitTotalItems)\n collectionToDisplay = collection.length > WIDGET_ITEM_LIMIT ? collection.slice(0, WIDGET_ITEM_LIMIT) : collection;\n\n let type = props.type;\n\n // The ResourcesTile widget type is deprecated. We render the Row type instead in this case\n if (type === WidgetType.ResourcesTile)\n type = WidgetType.Row;\n\n dispatch({\n type: WidgetInteraction.Init,\n payload: {\n totalItems: collectionToDisplay.length,\n breakpoints,\n type,\n contents: props.contents\n }\n });\n }, [collection?.length]);\n\n return res;\n}\n\n/**\n * This function wrapper determines which widget item images should be pre-fetched by the LazyImage component.\n * It does this by looking at which images are going to be shown after the users clicks on the \"Next\"\n * widget button.\n */\nexport function getShouldPreload(state: FixedWidgetState, collection: any[]): (widgetItem: any) => boolean {\n const { offset, viewableItems } = state;\n\n // The index of the latest item that has been fetched\n const maxLoadedIndex = offset;\n\n /**\n * The indicesToPreload is an array of indices of widget items that should be prefetched by the\n * LazyImage component\n */\n const indicesToPreload: number[] = [];\n for (let i = 0; i < maxLoadedIndex + viewableItems; i++) {\n indicesToPreload.push(i);\n }\n\n /**\n * A widget item calls this function to determine whether or not its image can be pre-fetched.\n * This is determined by whether or not its index has been deemed valid to be pre-fetched\n * by the scope above\n */\n return function shouldPreload(widgetItem: any): boolean {\n const index = collection.indexOf(widgetItem);\n\n return indicesToPreload.includes(index);\n };\n}\n\nexport function getCollectionAppLink(appLink: Core.AppLink, data: WidgetData): Core.AppLink {\n if (!appLink)\n return;\n\n return {\n ...appLink,\n args: appLink.args || [ data.id, TextHelper.slugify(data.name) ]\n };\n}\n\n/**\n * Allow explicit name and description props to override the fetched\n * data properties.\n * \n * @param props \n * @param data \n */\nexport function formatData<T extends React.ComponentType<FixedWidgetItemProps>>(\n props: FixedWidgetProps<T>,\n data: BaseObject\n): WidgetData {\n const { id, name, description } = props;\n\n const overrideProps: WidgetData = {};\n\n if (Array.isArray(data))\n return { id, name, description };\n\n if (props.id) overrideProps.id = id;\n if (props.name) overrideProps.name = name;\n if (props.description) overrideProps.description = description;\n\n return { ...data, ...overrideProps };\n}\n\n/**\n * The functions below are used by the reducer to compute the number of widget items\n * displayed on the screen based on the media query, widget type, and total number of items.\n */\ntype ComputeFunction = (breakpoints: Breakpoints, type: WidgetType, itemCount: number) => number;\n\n/**\n * TODO:\n * This and the `WidgetType` enum need to be replaced entirely as this is no longer maintainable.\n * Each widget type + template combination should define it's own item count per\n * breakpoint and pass it in as props.\n */\nexport function getComputeFunction(contents: WidgetContents): ComputeFunction {\n switch (contents) {\n case WidgetContents.Playlists:\n return computeViewablePlaylists;\n\n case WidgetContents.Videos:\n return computeViewableVideos;\n\n case WidgetContents.RecentActivities:\n return computeViewableRecentActivities;\n\n case WidgetContents.FeedVideos:\n return computeViewableFeedVideos;\n\n case WidgetContents.Subjects:\n return computeViewableSubjects;\n\n case WidgetContents.InteractivesV2:\n return computeViewableInteractivesV2;\n\n case WidgetContents.Interactives:\n return computeViewableInteractives;\n\n case WidgetContents.ClipsV2:\n return computeViewableClipsV2;\n\n case WidgetContents.Clips:\n return computeViewableClips;\n\n case WidgetContents.PlayPageResources:\n return computeViewablePlayPageResources;\n\n case WidgetContents.PlayPageResourcesV2:\n return computeViewablePlayPageResourcesV2;\n\n case WidgetContents.DashboardResources:\n return computeViewableVideos;\n\n case WidgetContents.Libraries:\n case WidgetContents.Folders:\n return computeViewableLibraries;\n\n case WidgetContents.Ratings:\n return computeViewableRatings;\n\n case WidgetContents.SpecialEvents:\n return computeViewableSpecialEvents;\n\n case WidgetContents.Companies:\n return computeViewableCompanies;\n\n case WidgetContents.SmallSeries:\n return computeViewableSmallSeries;\n\n case WidgetContents.PartnerProfiles:\n return computeViewablePartnerProfiles;\n\n case WidgetContents.Series:\n default:\n return computeViewableSeries;\n }\n}\n\nfunction computeViewablePartnerProfiles(breakpoints: Breakpoints, type: WidgetType, itemCount: number): number {\n let maxItems: number = 6;\n\n if (breakpoints.xs || breakpoints.sm)\n maxItems = 2;\n else if (breakpoints.md)\n maxItems = 4;\n\n if (itemCount < maxItems)\n maxItems = itemCount;\n\n return maxItems;\n}\n\nfunction computeViewablePlaylists(breakpoints: Breakpoints, type: WidgetType, itemCount: number): number {\n let maxItems: number = 5;\n\n if (breakpoints.xs)\n maxItems = 2;\n else if (breakpoints.sm)\n maxItems = 3;\n else if (breakpoints.md)\n maxItems = 4;\n\n if (itemCount < maxItems)\n maxItems = itemCount;\n\n return maxItems;\n}\n\nfunction computeViewableCompanies(breakpoints: Breakpoints, type: WidgetType, itemCount: number): number {\n let maxItems: number = 8;\n\n if (breakpoints.xs || breakpoints.sm)\n maxItems = 4;\n else if (breakpoints.md)\n maxItems = 6;\n\n if (itemCount < maxItems)\n maxItems = itemCount;\n\n return maxItems;\n}\n\nfunction computeViewableLibraries(breakpoints: Breakpoints, type: WidgetType, itemCount: number): number {\n let maxItems: number = 3;\n\n if (breakpoints.xs || breakpoints.sm)\n maxItems = 1;\n else if (breakpoints.md)\n maxItems = 2;\n else if (breakpoints.lg)\n maxItems = 3;\n\n if (itemCount < maxItems)\n maxItems = itemCount;\n\n return maxItems;\n}\n\nfunction computeViewableVideos(breakpoints: Breakpoints, type: WidgetType, itemCount: number): number {\n let maxItems = 4;\n\n if (breakpoints.xs)\n maxItems = 1;\n\n if (breakpoints.sm)\n maxItems = 2;\n\n if (breakpoints.md || breakpoints.lg)\n maxItems = 3;\n\n if (type === WidgetType.LargeRow && maxItems > 3)\n maxItems = 3;\n\n if (itemCount < maxItems)\n maxItems = itemCount;\n\n return maxItems;\n}\n\nfunction computeViewableRecentActivities(breakpoints: Breakpoints, type: WidgetType, itemCount: number): number {\n let maxItems = 4;\n\n if (breakpoints.xs)\n maxItems = 2;\n\n if (breakpoints.sm)\n maxItems = 3;\n\n if (itemCount < maxItems)\n maxItems = itemCount;\n\n return maxItems;\n}\n\n// eslint-disable-next-line\nfunction computeViewableFeedVideos(breakpoints: Breakpoints, type: WidgetType, itemCount: number): number {\n return 1;\n}\n\nfunction computeViewableSubjects(breakpoints: Breakpoints, type: WidgetType, itemCount: number): number {\n if (type === WidgetType.LargeRow) {\n let maxItems: number = 5;\n\n if (breakpoints.xs)\n maxItems = 2;\n else if (breakpoints.sm)\n maxItems = 3;\n else if (breakpoints.md)\n maxItems = 4;\n\n if (itemCount < maxItems)\n maxItems = itemCount;\n\n return maxItems;\n }\n\n let maxItems: number = 6;\n\n if (breakpoints.xs)\n maxItems = 2;\n else if (breakpoints.sm)\n maxItems = 3;\n else if (breakpoints.md)\n maxItems = 4;\n else if (breakpoints.lg)\n maxItems = 5;\n else if (breakpoints.xl || breakpoints.xxl)\n maxItems = 6;\n\n if (itemCount < maxItems)\n maxItems = itemCount;\n\n return maxItems;\n}\n\nfunction computeViewableInteractives(breakpoints: Breakpoints, type: WidgetType, itemCount: number): number {\n let maxItems: number = 3;\n\n if (breakpoints.md || breakpoints.sm)\n maxItems = 2;\n\n if (breakpoints.xs)\n maxItems = 1;\n\n if (itemCount < Math.ceil(maxItems))\n maxItems = itemCount;\n\n return maxItems;\n}\n\nfunction computeViewableClips(breakpoints: Breakpoints, type: WidgetType, itemCount: number): number {\n let maxItems: number = 3;\n\n if (breakpoints.md || breakpoints.sm)\n maxItems = 2;\n\n if (breakpoints.xs)\n maxItems = 1;\n\n if (itemCount < Math.ceil(maxItems))\n maxItems = itemCount;\n\n return maxItems;\n}\n\nfunction computeViewableInteractivesV2(breakpoints: Breakpoints, type: WidgetType, itemCount: number): number {\n let maxItems: number = 3;\n\n if (breakpoints.xs)\n maxItems = 2;\n\n if (itemCount < maxItems)\n maxItems = itemCount;\n\n return maxItems;\n}\n\nfunction computeViewableClipsV2(breakpoints: Breakpoints, type: WidgetType, itemCount: number): number {\n let maxItems: number = 3;\n\n if (breakpoints.xs)\n maxItems = 2;\n\n if (itemCount < maxItems)\n maxItems = itemCount;\n\n return maxItems;\n}\n\nfunction computeViewablePlayPageResources(breakpoints: Breakpoints, type: WidgetType, itemCount: number): number {\n let maxItems: number = 4;\n\n if (breakpoints.sm)\n maxItems = 3;\n\n if (breakpoints.xs)\n maxItems = 2;\n\n if (itemCount < maxItems)\n maxItems = itemCount;\n\n return maxItems;\n}\n\nfunction computeViewablePlayPageResourcesV2(breakpoints: Breakpoints, type: WidgetType, itemCount: number): number {\n let maxItems: number = 3;\n\n if (breakpoints.xs)\n maxItems = 2;\n\n if (itemCount < maxItems)\n maxItems = itemCount;\n\n return maxItems;\n}\n\nfunction computeViewableSeries(breakpoints: Breakpoints, type: WidgetType, itemCount: number): number {\n let maxItems: number = 4;\n\n if (breakpoints.xs)\n maxItems = 2;\n else if (breakpoints.sm)\n maxItems = 3;\n\n if (itemCount < maxItems)\n maxItems = itemCount;\n\n return maxItems;\n}\n\nfunction computeViewableSmallSeries(breakpoints: Breakpoints, type: WidgetType, itemCount: number): number {\n let maxItems: number = 6;\n\n if (breakpoints.xs)\n maxItems = 2;\n else if (breakpoints.sm)\n maxItems = 3;\n else if (breakpoints.md)\n maxItems = 4;\n\n else if (breakpoints.lg)\n maxItems = 5;\n\n if (itemCount < maxItems)\n maxItems = itemCount;\n\n return maxItems;\n}\n\nfunction computeViewableRatings(breakpoints: Breakpoints, type: WidgetType, itemCount: number): number {\n if (itemCount < 4)\n return itemCount;\n\n let maxItems: number = 5;\n\n if (breakpoints.xs || breakpoints.sm)\n maxItems = 3;\n\n if (breakpoints.md || breakpoints.lg)\n maxItems = 4;\n\n if (itemCount === 4 && (breakpoints.xs || breakpoints.sm)) {\n maxItems = 3;\n }\n\n if (itemCount < maxItems)\n maxItems = itemCount;\n\n return maxItems;\n}\n\nfunction computeViewableSpecialEvents(breakpoints: Breakpoints, type: WidgetType, itemCount: number): number {\n let maxItems: number = 6;\n\n if (breakpoints.xs)\n maxItems = 2;\n\n if (breakpoints.sm)\n maxItems = 3;\n\n if (breakpoints.md)\n maxItems = 4;\n\n if (breakpoints.lg)\n maxItems = 5;\n\n if (breakpoints.xl || breakpoints.xxl)\n maxItems = 6;\n\n if (itemCount < maxItems)\n maxItems = itemCount;\n\n return maxItems;\n}\n\n/**\n * Touch event handlers\n */\nexport function getOnTouchStart(\n widgetState: FixedWidgetState,\n containerRef: React.MutableRefObject<HTMLUListElement>,\n containerWidth: number,\n setContainerWidth: React.Dispatch<number>,\n initialTouchX: number,\n setInitialTouchX: React.Dispatch<number>,\n setPercentageDragged: React.Dispatch<number>\n): (event: React.TouchEvent<HTMLUListElement>) => void {\n return function(event: React.TouchEvent<HTMLUListElement>): void {\n const firstTouch = event.touches.item(0);\n const touchX = firstTouch.clientX;\n\n /**\n * Runs only on the very first touch event.\n * \n * Sets the initial x-coordinate as a reference point to calculate how far the user has dragged before\n * they release their finder\n */\n if (!initialTouchX) {\n containerRef.current.style.transition = '';\n\n setContainerWidth(containerRef.current.getBoundingClientRect().width);\n setInitialTouchX(touchX);\n }\n\n const pixelsDragged = initialTouchX - touchX;\n\n // Calculate how far the user has moved their finger as a percentage of the widget's container element\n let currentPercentageDragged = ((pixelsDragged / containerWidth) * 100);\n\n /**\n * These 2 if statements prevent the user from dragging the widget beyond its limits.\n * One if statement handles if they have dragged to the left, and the other is for dragging to the right.\n * \n * The same logic is used to hide the widget buttons (see the `hide` prop passed to `<WidgetButton />`)\n */\n if (currentPercentageDragged < 0 && (widgetState.offset === widgetState.viewableItems))\n currentPercentageDragged = 0;\n\n else if (currentPercentageDragged > 0 && (widgetState.offset === widgetState.totalItems))\n currentPercentageDragged = 0;\n\n setPercentageDragged(currentPercentageDragged);\n };\n}\n\nconst DRAG_TOLERANCE = 7.5; // % of container width using to trigger a transition.\n\nexport function getOnTouchEnd(\n containerRef: React.MutableRefObject<HTMLDivElement>,\n setInitialTouchX: React.Dispatch<number>,\n percentageDragged: number,\n setPercentageDragged: React.Dispatch<number>,\n dispatch: React.Dispatch<ReducerActions<WidgetInteraction, FixedWidgetPayload>>,\n onNext: () => void,\n onPrevious: () => void\n): () => void {\n return function (): void {\n containerRef.current.style.transition = 'transform .4s ease-in-out';\n setInitialTouchX(null);\n\n /**\n * Only trigger a Next/Previous widget event if the user has dragged beyond DRAG_TOLERANCE% either way of the\n * container's width. This means if the user only drags left/right a tiny little bit, the widget\n * will simply slide back into its original place.\n */\n if (Math.abs(percentageDragged) >= DRAG_TOLERANCE) {\n const reducerAction = percentageDragged > 0 ? WidgetInteraction.Next : WidgetInteraction.Previous;\n\n dispatch({\n type: reducerAction\n });\n\n if (percentageDragged > 0 && onNext) {\n onNext();\n } else if (percentageDragged < 0 && onPrevious) {\n onPrevious();\n }\n }\n\n setPercentageDragged(0);\n };\n}\n\nexport function hideBackButton(\n isHoveringOnFarLeft: boolean,\n isHoveringOnWidget: boolean,\n widgetOffset: number,\n maxViewableItems: number,\n widgetCollectionSize: number,\n isTabbing: boolean\n): boolean {\n // When hovering on the very far left widget item, hide the back button\n if (isHoveringOnFarLeft)\n return true;\n\n // if the collection size is smaller than the max viewable items, hide the back button\n if (widgetCollectionSize <= maxViewableItems)\n return true;\n\n // When hovering on the entire widget area, hide the back button if the widget is in the far left position\n if (isHoveringOnWidget)\n return (widgetOffset === maxViewableItems);\n\n if (isTabbing)\n return widgetOffset === maxViewableItems;\n\n return true;\n}\n\nexport function hideNextButton(\n isHoveringOnFarRight: boolean,\n isHoveringOnWidget: boolean,\n widgetOffset: number,\n maxViewableItems: number,\n widgetCollectionSize: number,\n showSeeMoreButton: boolean,\n isTabbing: boolean\n): boolean {\n // When hovering on the very far right widget item, hide the next button\n if (isHoveringOnFarRight)\n return true;\n\n // if the collection size is smaller than the max viewable items, hide the next button\n if (widgetCollectionSize <= maxViewableItems)\n return true;\n\n // Always show the next button if the widget is in the far left position\n if (widgetOffset === maxViewableItems)\n return false;\n\n // When the user is hovering over the entire widget area...\n if (isHoveringOnWidget) {\n // If we want to show the \"See more\" button, don't hide the next button\n if (showSeeMoreButton)\n return false;\n\n // Only show the next button if there are still more items to show\n return widgetCollectionSize <= widgetOffset;\n }\n\n if (isTabbing)\n return widgetOffset === widgetCollectionSize;\n\n return true;\n}\n\nexport interface FixedWidgetControls {\n jumpToIndex: (index: number) => void;\n}\n\n/**\n * If a component consuming FixedWidget needs to dispatch events to FixedWidget,\n * it can pass in a `controlsRef` prop, which will receive the API defined\n * below. This API can be extended as needed.\n * See FeedVideoCollection.tsx for an example\n */\nexport function useControlsRef(\n ref: React.MutableRefObject<FixedWidgetControls>,\n dispatch: React.Dispatch<ReducerActions<WidgetInteraction, FixedWidgetPayload>>\n): void {\n React.useEffect(() => {\n if (!ref || ref.current)\n return;\n\n ref.current = {\n jumpToIndex: (index: number) => dispatch({\n type: WidgetInteraction.JumpToIndex,\n payload: {\n offset: index + 1\n }\n })\n };\n }, [ref?.current]);\n}\n","import { ReducerActions } from 'libs/common/react/interfaces';\n\nimport { WidgetContents } from 'libs/shared/enums/WidgetContents';\nimport { WidgetInteraction } from 'libs/shared/enums/WidgetInteraction';\nimport { Breakpoints } from 'libs/shared/hooks/useBreakpoints';\nimport { WidgetType } from 'libs/shared/interfaces';\n\nimport { getComputeFunction } from './FixedWidgetUtils';\n\nexport interface FixedWidgetPayload {\n breakpoints?: Breakpoints;\n contents?: WidgetContents;\n type?: WidgetType;\n offset?: number;\n totalItems?: number;\n}\n\nexport interface FixedWidgetState {\n // Current position within the widget collection\n offset: number;\n // Number of items viewable in slider for the current breakpoint/viewport size\n viewableItems: number;\n // Relative position of slider in the window. Used for an inline translate3d().\n position: number;\n // Type of widget being managed. May change on `Resize`.\n type: WidgetType;\n // What object type the widget uses :vomit: (this needs to be phased out of this god forsaken component)\n contents: WidgetContents;\n // Total number of items in the widget\n totalItems: number;\n}\n\nexport const initialWidgetState: FixedWidgetState = {\n offset: 0,\n viewableItems: 4,\n position: 0,\n totalItems: 0,\n contents: null,\n type: WidgetType.Row\n};\n\nconst computeNextPosition = (prevState: FixedWidgetState) => {\n const { viewableItems, offset, position, totalItems } = prevState;\n\n const remainingCount = totalItems - offset;\n\n /**\n * If the remaining items are evening divisible by the items in view, or,\n * we have more items that can be displayed in the view, move the slider a full 100%.\n */\n if (remainingCount % viewableItems === 0 || remainingCount > viewableItems)\n return {\n position: position - 100,\n offset: offset + viewableItems\n };\n\n /**\n * Where there are less items than we can show in a full slide, \n * calculate the % movement required to only show those items.\n */\n if (remainingCount < viewableItems)\n return {\n position: position - (remainingCount / viewableItems * 100),\n offset: offset + remainingCount\n };\n\n /**\n * Default back to the current state as a fallback\n */\n return {\n position: position,\n offset: offset\n };\n};\n\nconst computePreviousPosition = (prevState: FixedWidgetState) => {\n const { viewableItems, offset, position } = prevState;\n\n const remainingCount = offset - viewableItems;\n\n if (remainingCount % viewableItems === 0 || remainingCount > viewableItems)\n return {\n position: position + 100,\n offset: offset - viewableItems\n };\n\n if (remainingCount < viewableItems)\n return {\n position: position + (remainingCount / viewableItems * 100),\n offset: offset - remainingCount\n };\n\n return {\n position: position,\n offset: offset\n };\n};\n\nexport function FixedWidgetReducer(\n prevState: FixedWidgetState,\n action: ReducerActions<WidgetInteraction, FixedWidgetPayload>\n): FixedWidgetState {\n const { type, payload = {} } = action;\n\n switch (type) {\n case WidgetInteraction.Next: {\n return {\n ...prevState,\n ...computeNextPosition(prevState)\n };\n }\n\n case WidgetInteraction.Previous: {\n return {\n ...prevState,\n ...computePreviousPosition(prevState)\n };\n }\n\n case WidgetInteraction.JumpToIndex: {\n return {\n ...prevState,\n offset: payload.offset,\n position: (payload.offset - 1) * -100\n };\n }\n\n case WidgetInteraction.Resize: {\n const computeViewableItems = getComputeFunction(prevState.contents);\n const initialSeen = computeViewableItems(payload.breakpoints, prevState.type, prevState.totalItems);\n\n return {\n ...prevState,\n position: 0,\n offset: initialSeen,\n viewableItems: initialSeen\n };\n }\n\n case WidgetInteraction.Init: {\n const computeViewableItems = getComputeFunction(payload.contents);\n const initialSeen = computeViewableItems(payload.breakpoints, payload.type, payload.totalItems);\n\n return lazyWidgetInit({\n ...prevState,\n offset: initialSeen,\n viewableItems: initialSeen,\n type: payload.type,\n contents: payload.contents,\n totalItems: payload.totalItems,\n position: 0\n });\n }\n\n case WidgetInteraction.Update: {\n return {\n ...prevState,\n totalItems: payload.totalItems\n };\n }\n\n default:\n return prevState;\n }\n}\n\nexport function lazyWidgetInit(newState: FixedWidgetState): FixedWidgetState {\n return { ...initialWidgetState, ...newState };\n}\n","import React from 'react';\n\nimport { WidgetHeader } from '../WidgetHeader';\n\ninterface PartialWidgetHeaderProps {\n hideHeading?: boolean;\n hideDescription?: boolean;\n name?: string;\n description?: string;\n isPreviewing?: boolean;\n}\n\nexport function PartialWidgetHeader(props: PartialWidgetHeaderProps): JSX.Element {\n if (props.hideDescription && props.hideHeading)\n return <></>;\n\n if (props.isPreviewing) {\n return (\n <WidgetHeader\n name={props.name}\n description={props.description}\n />\n );\n }\n\n return (\n <div className='curated-widget-header'>\n {!props.hideHeading && (\n <div className='partial-loading-background curated-widget-heading' style={{ height: '1.5rem', width: '12rem' }} />\n )}\n\n {!props.hideDescription && (\n <div className='partial-loading-background curated-widget-description' style={{ height: '1.434375rem', width: '16rem' }} />\n )}\n </div>\n );\n}\n",":local {\n %overflowGradient {\n position: absolute;\n width: 2.5rem;\n height: 101%;\n z-index: 2;\n top: 50%;\n transform: translateY(-50%);\n }\n\n .leftOverflowGradient {\n @extend %overflowGradient;\n left: 0;\n margin-left: -#{map-get($spacers, 4)};\n background-image: linear-gradient(to left, $cv-safe-transparent 0%, $white 70%);\n }\n\n .rightOverflowGradient {\n @extend %overflowGradient;\n right: 0;\n margin-right: -#{map-get($spacers, 4)};\n background-image: linear-gradient(to right, $cv-safe-transparent 0%, $white 70%);\n }\n\n .partialItem {\n display: inline-block;\n width: 100%;\n padding-bottom: percentage(calc(9 / 16));\n }\n\n .mobileScroll {\n overflow-x: scroll;\n -ms-overflow-style: none;\n scrollbar-width: none;\n\n &::-webkit-scrollbar {\n display: none;\n }\n }\n\n .widgetItemWrapper {\n display: contents;\n }\n}\n","import * as React from 'react';\n\nimport { HashObject } from 'libs/common/react/interfaces/HashObject';\n\nimport { PartialWidgetHeader } from 'libs/shared/components/widgets/curated-widgets/components/header/partial-loading/PartialWidgetHeader';\nimport { useBreakpoints } from 'libs/shared/hooks/useBreakpoints';\n\nimport { PartialWidgetTemplateProps } from '../curated-widgets/WidgetProps';\n\nimport styles from './fixed-widget.module.scss';\n\nfunction useGetSize(size?: 'sm' | 'lg'): HashObject {\n const breakpoints = useBreakpoints();\n\n if (breakpoints.xs)\n return {\n itemCount: 1,\n colSize: 12\n };\n\n if (breakpoints.sm)\n return {\n itemCount: 2,\n colSize: 6\n };\n\n if (breakpoints.md || breakpoints.lg)\n return {\n itemCount: 3,\n colSize: 4\n };\n\n return {\n itemCount: size === 'sm' ? 4 : 3,\n colSize: size === 'sm' ? 3 : 4\n };\n}\n\nexport interface PartialFixedWidgetItemProps {\n colSize: number;\n}\n\nconst PartialLoadingItem = ({ colSize }: PartialFixedWidgetItemProps) => (\n <div className={`col-${colSize} px-1`}>\n <div className={`${styles.partialItem} partial-loading-background rounded-3`} />\n </div>\n);\n\nexport interface PartialFixedWidgetProps {\n hideDescription?: boolean;\n hideHeading?: boolean;\n size?: 'sm' | 'lg';\n childComponent?: (props: PartialFixedWidgetItemProps) => JSX.Element;\n}\n\nPartialFixedWidget.defaultProps = {\n size: 'sm',\n childComponent: PartialLoadingItem\n};\n\nexport function PartialFixedWidget(props: PartialWidgetTemplateProps): JSX.Element {\n const { itemCount, colSize } = useGetSize(props.size);\n\n const ChildComponent = props.childComponent;\n\n const items = [];\n for (let i = 0; i < itemCount; i++) {\n items.push(<ChildComponent key={i} colSize={colSize} />);\n }\n\n return (\n <div className='widget'>\n <PartialWidgetHeader\n hideHeading={props.hideHeading}\n hideDescription={props.hideDescription}\n name={props.name}\n description={props.description}\n isPreviewing={props.isPreviewing}\n />\n <div className='row g-0 mx-n1'>\n {items}\n </div>\n </div>\n );\n}\n","import React from 'react';\n\nimport { LanguageService } from 'libs/common/backbone/services/LanguageService';\nimport { FunctionHelper } from 'libs/common/backbone/utils/FunctionHelper';\nimport { UserAgentHelper } from 'libs/common/backbone/utils/UserAgentHelper';\nimport { Core } from 'libs/common/core';\nimport { Flight } from 'libs/common/flight';\n\nimport { AnalyticsHelper } from 'libs/analytics/AnalyticsHelper';\nimport { AnalyticsOptions, HashObject } from 'libs/analytics/interfaces';\n\nimport { WidgetHeader } from 'libs/shared/components/widgets/curated-widgets/components/header/WidgetHeader';\nimport { useWidgetKeyboard } from 'libs/shared/components/widgets/hooks/useWidgetKeyboard';\nimport { FixedWidgetItemProps } from 'libs/shared/components/widgets/items/FixedWidgetItemProps';\nimport { SlidingListContainer } from 'libs/shared/components/widgets/sliding-list/SlidingListContainer';\nimport { WidgetButton, WidgetButtonDirection } from 'libs/shared/components/widgets/widget-button/WidgetButton';\nimport { CssMeasurement } from 'libs/shared/enums/CssMeasurement';\nimport { ImageSize } from 'libs/shared/enums/Images';\nimport { WidgetContents } from 'libs/shared/enums/WidgetContents';\nimport { WidgetInteraction } from 'libs/shared/enums/WidgetInteraction';\nimport { WidgetTypeId } from 'libs/shared/enums/WidgetTypeId';\nimport { useBreakpoints } from 'libs/shared/hooks/useBreakpoints';\nimport { useHover } from 'libs/shared/hooks/UseHover';\nimport { useLazyLoad } from 'libs/shared/hooks/UseLazyLoad';\nimport { WidgetContext, WidgetType } from 'libs/shared/interfaces';\nimport { WidgetHelper } from 'libs/shared/utils/WidgetHelper';\n\nimport { FixedWidgetReducer, initialWidgetState, lazyWidgetInit } from './FixedWidgetReducer';\nimport { FixedWidgetControls, formatData, getCollectionAppLink, getOnTouchEnd, getOnTouchStart, getShouldPreload, hideBackButton, hideNextButton, useControlsRef, useFetchData } from './FixedWidgetUtils';\nimport { PartialFixedWidget } from './PartialFixedWidget';\n\nimport styles from './fixed-widget.module.scss';\n\nconst namespace = 'shared.fixedWidget';\n\n// Max number of widget items whenever `props.limitTotalItems` is `true`\nexport const WIDGET_ITEM_LIMIT = 12;\n\ninterface BaseFixedWidgetProps<\n T extends React.ComponentType<FixedWidgetItemProps>\n> {\n id?: string;\n name?: string;\n description?: string;\n\n type: WidgetType;\n contents: WidgetContents;\n thumbnailSize?: ImageSize;\n minimumItemCount?: number;\n limitTotalItems?: boolean;\n setData?: (data: any) => any[] | null;\n isPreviewing?: boolean;\n widgetTypeId?: WidgetTypeId;\n\n childComponent: T;\n extraChildComponentProps: Omit<React.ComponentProps<T>, keyof FixedWidgetItemProps>;\n\n partialComponent?: React.ElementType;\n getChildAppLink?: (item?: any) => Core.AppLink;\n appLink?: Core.AppLink;\n onAppLinkClick?: () => void;\n headingBadgeComponent?: JSX.Element;\n showSeeMoreLink?: boolean;\n\n analyticsData?: HashObject;\n analyticsOptions?: AnalyticsOptions;\n\n getWidgetItemAnalyticsData?: (data: any) => HashObject;\n\n onNext?: () => void;\n onPrevious?: () => void;\n onClose?: () => void;\n onFollow?: (shouldFollow: boolean) => void;\n isFollowing?: boolean;\n showFollowSpinner?: boolean;\n controlsRef?: React.MutableRefObject<FixedWidgetControls>;\n touchBehavior?: 'drag' | 'scroll';\n\n leftWidgetButtonClassName?: string;\n rightWidgetButtonClassName?: string;\n\n hideName?: boolean;\n hideBleedingContent?: boolean;\n hideExtendedClickableArea?: boolean;\n hideButtons?: boolean;\n // This is for any additional items that need to be rendered at the end of the widget item list\n // such as a \"See More\" card.\n trailingItems?: JSX.Element;\n // Indicate how many extra items we added through trailingItems\n trailingItemLength?: number;\n}\n\ntype FixedWidgetWithFetchProps<T extends React.ComponentType<FixedWidgetItemProps>> = BaseFixedWidgetProps<T> &\n {\n lazyLoad: true,\n collection?: never,\n fetch: (...args: any) => Flight.Response<any>,\n prefetched?: false\n };\n\ntype FixedWidgetWithCollectionProps<T extends React.ComponentType<FixedWidgetItemProps>> = BaseFixedWidgetProps<T> &\n {\n collection: any,\n lazyLoad?: false,\n fetch?: never,\n prefetched: true\n };\n\nexport type FixedWidgetProps<T extends React.ComponentType<FixedWidgetItemProps>> =\n FixedWidgetWithCollectionProps<T> |\n FixedWidgetWithFetchProps<T>;\n\nFixedWidget.defaultProps = {\n type: WidgetType.Row,\n minimumItemCount: 0,\n extraChildComponentProps: {},\n touchBehavior: 'scroll'\n};\n\n/**\n * If your childProps complains that \"value\" is not assignable ot type \n */\nexport function FixedWidget<T extends React.ComponentType<FixedWidgetItemProps>>(\n props: FixedWidgetProps<T>\n): JSX.Element {\n const { analyticsData = {}, getWidgetItemAnalyticsData = () => {} } = props;\n\n const [ initialTouchX, setInitialTouchX ] = React.useState(null);\n const [ containerWidth, setContainerWidth ] = React.useState(null);\n const [ percentageDragged, setPercentageDragged ] = React.useState(0);\n\n const [ state, dispatch ] = React.useReducer(FixedWidgetReducer, initialWidgetState, lazyWidgetInit);\n\n const containerRef = React.useRef(null);\n const [ buttonsRef, isHovering ] = useHover<HTMLDivElement>();\n\n const [ isHoveringOnFarLeft, setIsHoveringOnFarLeft ] = React.useState(false);\n const [ isHoveringOnFarRight, setIsHoveringOnFarRight ] = React.useState(false);\n\n useControlsRef(props.controlsRef, dispatch);\n\n const { ref, inView: shouldFetch } = useLazyLoad({ prevent: !props.lazyLoad });\n\n const response = useFetchData(props, dispatch, shouldFetch);\n\n function getWidgetCollection(limit: number): any[] {\n const responseData = props.prefetched ? props.collection : response.data;\n\n if (!responseData)\n return [];\n\n const formattedResponse = FunctionHelper.isFunction(props.setData) ? props.setData(responseData) : responseData;\n return formattedResponse?.slice(0, limit) ?? [];\n }\n\n const widgetItems = getWidgetCollection(props.limitTotalItems ? WIDGET_ITEM_LIMIT : Infinity);\n const widgetLength = props.trailingItems && props.trailingItemLength ?\n widgetItems.length + props.trailingItemLength :\n widgetItems.length;\n\n function hasMoreItems(): boolean {\n if (!props.limitTotalItems)\n return false;\n\n const unlimitedItems = getWidgetCollection(Infinity);\n\n return unlimitedItems.length > widgetLength;\n }\n\n const hasReachedEnd = state.offset === widgetLength;\n\n const breakpoints = useBreakpoints();\n \n const { onFocusWidget, onBlurWidget, isTabbing, getFixedAttributes, focusNext, focusPrev } = useWidgetKeyboard({ type: 'fixed', state, containerRef });\n\n React.useEffect(() => {\n dispatch({\n type: WidgetInteraction.Resize,\n payload: { breakpoints }\n });\n }, [breakpoints]);\n\n React.useEffect(() => {\n if (!props.prefetched)\n return;\n\n let type = props.type;\n\n // The ResourcesTile widget type is deprecated. We render the Row type instead in this case\n if (type === WidgetType.ResourcesTile)\n type = WidgetType.Row;\n\n // If the prefetched collection changes, re-initialize the widget state.\n dispatch({\n type: WidgetInteraction.Init,\n payload: {\n breakpoints,\n type,\n contents: props.contents,\n totalItems: widgetLength\n }\n });\n }, [ props.collection?.length, props.prefetched ]);\n\n function onSetIsHovering(hovering: boolean, index: number): void {\n if (widgetLength === state.viewableItems) {\n setIsHoveringOnFarLeft(hovering);\n setIsHoveringOnFarRight(hovering);\n return;\n }\n\n // This callback will hide the far left button if the user is hovering on the far left widget item.\n // Same goes for the far right button & widget item.\n if (index + 1 === widgetLength) {\n setIsHoveringOnFarRight(hovering);\n return;\n }\n\n if (index === 0) {\n setIsHoveringOnFarLeft(hovering);\n return;\n }\n\n if ((index + 1 - (state.offset % state.viewableItems)) % state.viewableItems === 0) {\n setIsHoveringOnFarRight(hovering);\n return;\n }\n\n if ((index - (state.offset % state.viewableItems)) % state.viewableItems === 0) {\n setIsHoveringOnFarLeft(hovering);\n return;\n }\n }\n\n function shouldScroll(): boolean {\n if (props.touchBehavior !== 'scroll')\n return false;\n\n return UserAgentHelper.isTabletOrMobile();\n }\n\n const widgetContext: WidgetContext = {\n type: state.type,\n collectionSize: widgetLength,\n contents: props.contents\n };\n\n const data = formatData(props, response?.data || props.collection);\n\n if (response?.hasError)\n return <></>;\n\n if (!props.prefetched && !response?.data) {\n const PartialComponent = props.partialComponent || PartialFixedWidget;\n\n return (\n <div ref={ref}>\n <PartialComponent />\n </div>\n );\n }\n\n if (!widgetLength || widgetLength < props.minimumItemCount)\n return <></>;\n\n /**\n * Don't merge this if Sha forgot to fix it.\n */\n const WidgetItemComponent = props.childComponent as React.ComponentType<FixedWidgetItemProps>;\n\n const getSliderAnalyticsData = (type: WidgetInteraction) => ({\n id: data?.id,\n name: data?.name,\n direction: type === WidgetInteraction.Next ? 'right' : 'left',\n ...props.analyticsData\n });\n\n const showSeeMoreButton = (() => {\n // Only show if there is an applink and we've reached the end of the widget\n if (!props.appLink || !hasReachedEnd)\n return false;\n\n // Also only show if we've exceeded the widget limit, if one has been set\n return hasMoreItems();\n })();\n\n const hideButtons = shouldScroll() || props.hideButtons;\n const hideBackGradient = state.offset === state.viewableItems;\n const hideNextGradient = widgetLength <= state.offset;\n const hasMoreThanViewable = state.viewableItems < widgetLength;\n\n return (\n <div className='mx-n4 mb-n3'>\n <div className={shouldScroll() ? 'pb-3 overflow-hidden' : 'px-4 pb-3 overflow-hidden'}>\n {!props.hideName &&\n <div className={shouldScroll() ? 'px-4' : ''}>\n <WidgetHeader\n name={data.name}\n description={data.description}\n appLink={getCollectionAppLink(props.appLink, data)}\n onAppLinkClick={props.onAppLinkClick}\n analyticsData={{ id: data?.id, name: data?.name, ...props.analyticsData }}\n analyticsOptions={WidgetHelper.getSliderHeadingAnalyticsOptions()}\n showSeeMoreLink={props.showSeeMoreLink ?? hasMoreThanViewable}\n content={widgetItems}\n isPreviewing={props.isPreviewing}\n widgetTypeId={props.widgetTypeId}\n badgeComponent={props.headingBadgeComponent}\n onClose={props.onClose}\n onFollow={props.onFollow}\n isFollowing={props.isFollowing}\n showFollowSpinner={props.showFollowSpinner}\n />\n </div>\n }\n <div\n ref={buttonsRef}\n className={`position-relative mx-n1 ${shouldScroll() ? `${styles.mobileScroll} px-4` : ''} ${props.hideBleedingContent ? 'overflow-hidden-x' : ''}`}\n >\n {!hideButtons && (\n <>\n {(!props.hideBleedingContent && !isHoveringOnFarLeft && !hideBackGradient) && (\n <div className={styles.leftOverflowGradient} />\n )}\n <WidgetButton\n direction={WidgetButtonDirection.Left}\n onClick={() => {\n focusPrev();\n\n dispatch({ type: WidgetInteraction.Previous });\n AnalyticsHelper.logUserAction(\n getSliderAnalyticsData(WidgetInteraction.Previous),\n WidgetHelper.getSliderAnalyticsOptions()\n );\n\n FunctionHelper.isFunction(props.onPrevious) && props.onPrevious();\n }}\n hide={!!props.hideButtons || hideBackButton(\n isHoveringOnFarLeft,\n isHovering,\n state.offset,\n state.viewableItems,\n widgetLength,\n isTabbing\n )}\n contents={props.contents}\n className={props.leftWidgetButtonClassName}\n hideExtendedClickableArea={props.hideExtendedClickableArea}\n state={state}\n />\n </>\n )}\n \n <SlidingListContainer\n position={state.position}\n positionType={CssMeasurement.Percentage}\n onTouchMove={props.touchBehavior === 'drag' && getOnTouchStart(\n state,\n containerRef,\n containerWidth,\n setContainerWidth,\n initialTouchX,\n setInitialTouchX,\n setPercentageDragged\n )}\n onTouchEnd={props.touchBehavior === 'drag' && getOnTouchEnd(\n containerRef,\n setInitialTouchX,\n percentageDragged,\n setPercentageDragged,\n dispatch,\n props.onNext,\n props.onPrevious\n )}\n ref={containerRef}\n percentageDragged={percentageDragged}\n >\n {widgetItems.map((widgetItem: any, index: number) => {\n return (\n <li\n key={`${widgetItem.id}:${index}`}\n onFocus={() => onFocusWidget(index)}\n onBlur={onBlurWidget}\n className={styles.widgetItemWrapper}\n {...getFixedAttributes(index)}\n >\n <WidgetItemComponent\n data={widgetItem}\n collectionAppLink={props.appLink}\n getAppLink={\n props.getChildAppLink ? () => props.getChildAppLink(widgetItem) : () => null as any\n }\n context={widgetContext}\n preloadImage={getShouldPreload(state, widgetItems)(widgetItem)}\n thumbnailSize={props.thumbnailSize || ImageSize.Medium}\n analyticsData={{\n widgetId: data.id,\n widgetName: data.name,\n itemIndex: index,\n ...analyticsData,\n ...getWidgetItemAnalyticsData(widgetItem)\n }}\n analyticsOptions={{ ...props.analyticsOptions, ...WidgetHelper.getSliderItemAnalyticsOptions() }}\n onHover={(hovering: boolean) => {\n if (shouldScroll())\n return;\n /**\n * For some reason this needs to be called after a set timeout, otherwise\n * the `useHover` listener on the `buttonsRef` element will not detect it's hover\n * event. A delay of 200ms is used for when `hovering` is false so that the effects of\n * setting `isHoveringOnFarX` aren't applied until the CSS transform transition has\n * completed.\n */\n window.setTimeout(() => {\n onSetIsHovering(hovering, index);\n }, hovering ? 0 : 200);\n }}\n {...props.extraChildComponentProps}\n />\n </li>\n );\n })}\n {props.trailingItems}\n {shouldScroll() && <div className='ps-4'></div>}\n </SlidingListContainer>\n\n {!hideButtons && (\n <>\n <WidgetButton\n direction={WidgetButtonDirection.Right}\n onClick={() => {\n if (showSeeMoreButton) {\n Core.AppLinkHelper.trigger(getCollectionAppLink(props.appLink, data));\n return;\n }\n focusNext();\n\n dispatch({ type: WidgetInteraction.Next });\n AnalyticsHelper.logUserAction(\n getSliderAnalyticsData(WidgetInteraction.Next),\n WidgetHelper.getSliderAnalyticsOptions()\n );\n\n FunctionHelper.isFunction(props.onNext) && props.onNext();\n }}\n hide={!!props.hideButtons || hideNextButton(\n isHoveringOnFarRight,\n isHovering,\n state.offset,\n state.viewableItems,\n widgetLength,\n showSeeMoreButton,\n isTabbing\n )}\n contents={props.contents}\n hoverText={showSeeMoreButton && LanguageService.getPhrase(namespace, 'seeMore')}\n className={props.rightWidgetButtonClassName}\n hideExtendedClickableArea={props.hideExtendedClickableArea}\n state={state}\n />\n {(!props.hideBleedingContent && !isHoveringOnFarRight && !hideNextGradient) && (\n <div className={styles.rightOverflowGradient} />\n )}\n </>\n )}\n </div>\n </div>\n </div>\n );\n}\n","@import '~styles/utils/include-media';\n:local {\n .imageStyle {\n border-top-left-radius: $border-radius-lg;\n border-top-right-radius: $border-radius-lg;\n filter: drop-shadow(0px -1px 4px rgba(0, 0, 0, 0.1));\n }\n\n .item {\n width: 25%;\n\n &.dashboard {\n @include media('<=xl') {\n width: 33.33333%;\n }\n \n @include media('<=md') {\n width: 50%;\n }\n \n @include media('<=sm') {\n width: 100%;\n }\n }\n\n &.playPage {\n @include media('<=md') {\n width: percentage(calc(1 / 3));\n }\n \n @include media('<=sm') {\n width: 50%;\n }\n }\n }\n\n .aspectRatio {\n position: relative;\n padding-bottom: 56.25%;\n width: 100%;\n }\n\n .outerContainer {\n position: absolute;\n top: 0;\n bottom: 0;\n left: 0;\n right: 0;\n }\n\n .innerContainer {\n .actions {\n display: none;\n position: absolute;\n top: map-get($spacers, 2);\n right: map-get($spacers, 2);\n z-index: 5;\n }\n\n &:hover {\n .actions {\n display: block;\n }\n }\n }\n\n .titleBelow:hover {\n text-decoration: underline;\n }\n\n .thumbnailContainer {\n height: 85%;\n\n &.titleAbove {\n height: percentage(calc(2 / 3));\n }\n }\n\n // Resource type colour classes\n .teacherPack {\n .text {\n color: $blue;\n }\n\n background-color: scale-color($blue, $lightness: 86%, $saturation: 100%);\n\n &.hoverState {\n &:hover {\n background-color: scale-color($blue, $lightness: 93%, $saturation: 100%);\n }\n }\n }\n\n .atomGuide {\n .text {\n color: $indigo;\n }\n\n background-color: scale-color($indigo, $lightness: 80%, $saturation: 100%);\n\n &.hoverState {\n &:hover {\n background-color: scale-color($indigo, $lightness: 90%, $saturation: 100%);\n }\n }\n }\n\n .studentActivity {\n .text {\n color: $purple;\n }\n \n background-color: scale-color($purple, $lightness: 84%, $saturation: 100%);\n\n &.hoverState {\n &:hover {\n background-color: scale-color($purple, $lightness: 92%, $saturation: 100%);\n }\n }\n }\n\n .additionalMaterials {\n .text {\n color: $green;\n }\n \n background-color: scale-color($green, $lightness: 82%, $saturation: 100%);\n\n &.hoverState {\n &:hover {\n background-color: scale-color($green, $lightness: 88%, $saturation: 100%);\n }\n }\n }\n\n .userUploaded {\n .text {\n color: $teal;\n }\n\n background-color: scale-color($teal, $lightness: 80%, $saturation: 100%);\n\n &.hoverState {\n &:hover {\n background-color: scale-color($teal, $lightness: 89%, $saturation: 100%);\n }\n }\n }\n\n .imageTypeResource {\n width: auto;\n object-fit: contain;\n left: 50% !important;\n transform: translateX(-50%);\n }\n\n .download {\n color: $dark;\n background-color: rgba(darken($white, 2%), 0.8);\n border-radius: 50%;\n width: 2rem;\n height: 2rem;\n\n &:hover {\n background-color: $white;\n }\n }\n}","import React from 'react';\n\nimport { AppLinkHelper } from 'libs/common/backbone/core';\n\nimport { AnalyticsHelper } from 'libs/analytics/AnalyticsHelper';\nimport { AnalyticsOptions, EntityType, UserAction } from 'libs/analytics/interfaces';\n\nimport { AppLink } from 'libs/shared/components/app-link/AppLink';\nimport { DivButton } from 'libs/shared/components/div-button/DivButton';\nimport { ResourceThumbnail } from 'libs/shared/components/resource-thumbnail/ResourceThumbnail';\nimport { SvgContainer } from 'libs/shared/components/svg-container/SvgContainer';\nimport { TitleSubText } from 'libs/shared/components/title-sub-text/TitleSubText';\nimport { Tooltip } from 'libs/shared/components/tooltip/Tooltip';\nimport { TypeBadge } from 'libs/shared/components/type-badge/TypeBadge';\nimport { FixedWidgetItemProps } from 'libs/shared/components/widgets/items/FixedWidgetItemProps';\nimport { SeoConstants } from 'libs/shared/constants/SeoConstants';\nimport { MasterType } from 'libs/shared/enums/MasterType';\nimport { ResourceFileType } from 'libs/shared/enums/ResourceFileType';\nimport { useBreakpoints } from 'libs/shared/hooks/useBreakpoints';\nimport { DownloadSvg } from 'libs/shared/images/svg/actions/DownloadSvg';\nimport { Link, Resource, ResourceType } from 'libs/shared/interfaces';\nimport { MasterTypeHelper } from 'libs/shared/utils/MasterTypeHelper';\nimport { ResourceHelper } from 'libs/shared/utils/ResourceHelper';\n\nimport styles from './resource-widget-item.module.scss';\n\nfunction getColour(resourceType?: ResourceType): string {\n switch (resourceType) {\n case 'atom-guide':\n return styles.atomGuide;\n case 'student-activity':\n return styles.studentActivity;\n case 'teacher-pack':\n return styles.teacherPack;\n case 'additional-materials':\n return styles.additionalMaterials;\n default:\n return styles.userUploaded;\n }\n}\n\nfunction useCanPreview(data: Resource | Link, actionBehaviour: 'normal' | 'public'): boolean {\n const breakpoints = useBreakpoints();\n\n /**\n * When viewing publicly, the resource applink will\n * prompt the user to sign-up (not preview the underlying resource)\n */\n if (actionBehaviour === 'public')\n return true;\n\n if (breakpoints.xs || breakpoints.sm)\n return false;\n\n if (data.type !== 'resource')\n return false;\n \n // Require metadata\n if (!('metadata' in data))\n return false;\n\n // We can preview images\n if (data.metadata.type === ResourceFileType.Image)\n return true;\n\n // If we are a pdf and have a url\n if (data.metadata.type === ResourceFileType.Pdf)\n return !!data.url;\n\n // If we have a pdf assoc\n return !!data.pdf?.url;\n}\n\ninterface ResourceTheme {\n containerClass?: string;\n thumbnailContainerClass?: string;\n}\n\nexport interface ResourceTileProps {\n data: Resource | Link;\n imageCdnUrl: string;\n imageErrorFallbackUrl?: string;\n theme?: ResourceTheme;\n\n titlePosition: 'above' | 'below' | 'none';\n hideTypeBadge?: boolean;\n onClickDownload?: (e: React.MouseEvent<HTMLElement>, resource: Resource) => void;\n applyHoverState?: boolean;\n preloadImage: boolean;\n actionBehaviour?: 'normal' | 'public';\n}\n\nResourceTile.defaultProps = {\n preloadImage: true,\n actionBehaviour: 'normal'\n};\n\n/**\n * This component intentionally doesn't contain an appLink/download link\n * so that the resource download behaviour can be handled differently depending\n * on where this is rendered (e.g. primary play page vs embedded player)\n */\nexport function ResourceTile(props: ResourceTileProps): JSX.Element {\n let metadata = null;\n\n if ('metadata' in props.data) {\n metadata = props.data.metadata;\n }\n\n const isResource = MasterTypeHelper.isType<Resource>(props.data, MasterType.Resource);\n\n function getInnerContainerClass(resourceType: ResourceType): string {\n let baseClass = `\n d-flex flex-column align-items-center justify-content-end rounded-3 h-100\n position-relative ${getColour(resourceType)} ${styles.innerContainer}`;\n\n if (props.theme?.containerClass) {\n baseClass += ` ${props.theme.containerClass}`;\n } else {\n baseClass += ` pt-3 px-3`;\n }\n\n if (props.applyHoverState) {\n baseClass += ` ${styles.hoverState}`;\n }\n\n return baseClass;\n }\n\n return (\n <>\n <div className={styles.aspectRatio}>\n <div className={styles.outerContainer}>\n <div className={getInnerContainerClass(metadata?.resourceType)}>\n {props.titlePosition === 'above' && (\n <Tooltip title={props.data.name}>\n <h3 className={`text-center text-break h5 mb-3 ${styles.text}`}>\n <span className='clamp-1'>{props.data.name}</span>\n </h3>\n </Tooltip>\n )}\n\n <div className={`\n ${props.theme?.thumbnailContainerClass ?? ''} w-75 overflow-hidden \n ${styles.thumbnailContainer} ${props.titlePosition === 'above' ? styles.titleAbove : ''} \n ${styles.imageStyle}\n `}>\n <ResourceThumbnail\n resource={props.data}\n imageCdnUrl={props.imageCdnUrl}\n imageErrorFallbackUrl={props.imageErrorFallbackUrl}\n preloadImage={props.preloadImage}\n />\n </div>\n\n {isResource && props.onClickDownload && props.actionBehaviour === 'normal' && (\n <div className={styles.actions}>\n <DivButton\n onClick={e => props.onClickDownload(e, props.data as Resource)}\n className={`${styles.download} d-flex align-items-center justify-content-center`}\n >\n <SvgContainer svg={DownloadSvg} />\n </DivButton>\n </div>\n )}\n\n {!props.hideTypeBadge && isResource && (\n <TypeBadge typeId={MasterType.Resource} />\n )}\n </div>\n </div>\n </div>\n {props.titlePosition === 'below' && (\n <div className={`mt-1 ${styles.titleBelow}`}>\n {(\n MasterTypeHelper.isType<Resource>(props.data, MasterType.Resource) &&\n !!props.data?.metadata?.resourceType\n ) && (\n <TitleSubText>\n {ResourceHelper.getResourceTypeName(props.data.metadata.resourceType)}\n </TitleSubText>\n )}\n <h3 className='h6 clamp-2'>\n {props.data.name}\n </h3>\n </div>\n )}\n </>\n );\n}\n\nexport interface ResourceWidgetItemProps extends ResourceTileProps, FixedWidgetItemProps<Resource | Link> {\n location: 'play-page' | 'dashboard';\n}\n\nexport const ResourceWidgetItem = React.memo(function(props: ResourceWidgetItemProps): JSX.Element {\n // Mobile is not allowed to preview\n const canPreview = useCanPreview(props.data, props.actionBehaviour);\n\n function getLocationClass(): string {\n if (props.location === 'play-page')\n return styles.playPage;\n\n return styles.dashboard;\n }\n\n const analyticsData = { ...props.analyticsData, ...props.data };\n\n const analyticsOptions: AnalyticsOptions = {\n ...props.analyticsOptions,\n actionType: UserAction.Click,\n entity: props.data.typeId === MasterType.Resource ? EntityType.Resource : EntityType.Link\n };\n\n function logAction(): void {\n AnalyticsHelper.logUserAction(analyticsData, analyticsOptions);\n }\n\n const tileProps: ResourceTileProps = {\n ...props,\n // Apply the hover state if we have a url or the resource can be previewed\n applyHoverState: canPreview || !!props.data.url\n };\n\n return (\n <div className={`px-1 flex-shrink-0 ${styles.item} ${getLocationClass()} ${SeoConstants.RESOURCE_ITEM_SELECTOR}`}>\n {(() => {\n const className = `d-block no-decoration`;\n\n // Handle resource links\n if (props.data.type === 'link') {\n return (\n <a href={props.data.url} target='_blank' className={className} onClick={logAction}>\n <ResourceTile {...tileProps} />\n </a>\n );\n }\n\n if (canPreview) {\n /**\n * Previewing resources in a public context will always display the sign-up popup, so there \n * will never be a full URL. For SEO purposes, we deliberately use a span over an anchor\n * to ensure we're not creating self-referencing elements that will burn crawl budget.\n */\n if (props.actionBehaviour === 'public') {\n return (\n <div className={`${className} cursor-pointer d-inline`} onClick={() => {\n logAction();\n AppLinkHelper.trigger(props.getAppLink(props.data));\n }}>\n <ResourceTile {...tileProps} />\n </div>\n );\n }\n\n return (\n <AppLink\n appLink={props.getAppLink(props.data)}\n className={className}\n analyticsData={analyticsData}\n analyticsOptions={analyticsOptions}\n >\n <ResourceTile {...tileProps} />\n </AppLink>\n );\n }\n\n // URLs cannot be previewed\n if (props.data.url) {\n return (\n <a href={props.data.url} className={className} onClick={logAction}>\n <ResourceTile {...tileProps} />\n </a>\n );\n }\n\n // Theres no url, so don't render an <a>\n return (\n <div className={className}>\n <ResourceTile {...tileProps} />\n </div>\n );\n })()}\n </div>\n );\n});\n"],"mappings":"u4BAMA,IAAY,EAAL,SAAA,EAAA,OACL,GAAA,EAAA,IAAA,GAAA,MACA,EAAA,EAAA,SAAA,GAAA,WACA,EAAA,EAAA,KAAA,GAAA,OACA,EAAA,EAAA,cAAA,GAAA,sBACD,CCXW,EAAL,SAAA,EAAA,OACL,GAAA,OAAA,SACA,EAAA,WAAA,cACA,EAAA,OAAA,SACA,EAAA,SAAA,WACA,EAAA,UAAA,YACA,EAAA,aAAA,eACA,EAAA,MAAA,QACA,EAAA,kBAAA,sBACA,EAAA,mBAAA,sBACA,EAAA,UAAA,YACA,EAAA,QAAA,UACA,EAAA,iBAAA,oBACA,EAAA,YAAA,eACA,EAAA,UAAA,YACA,EAAA,gBAAA,mBACA,EAAA,QAAA,UACA,EAAA,cAAA,iBAEA,EAAA,eAAA,kBACA,EAAA,QAAA,WACA,EAAA,oBAAA,8BACD,UCED,SAAgB,GACd,EACA,EACA,EACsB,CACtB,IAAI,EAAO,EAAM,WACb,GAEC,CAAC,GAAQ,EAAa,QAAQ,EAAK,GAAK,CAAC,EAAM,aAClD,EAAM,EAAM,MAAM,EAAY,CAC9B,EAAO,EAAI,MAMb,IAAM,EAAc,EAAe,WAAW,EAAM,QAAQ,EAAI,EAAQ,EAAM,QAAQ,EAAK,CAAG,EAC1F,EAAsB,EAEpB,EAAc,GAAgB,CA0BpC,OAxBA,EAAM,cAAgB,CACpB,GAAI,CAAC,GAAQ,EAAa,QAAQ,EAAK,CACrC,OAEE,EAAM,kBACR,EAAsB,EAAW,OAAA,GAA6B,EAAW,MAAM,EAAA,GAAqB,CAAG,GAEzG,IAAI,EAAO,EAAM,KAGb,IAAS,EAAW,gBACtB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
|
-
import"./Dp9qJj1C.chunk.js";import{t as e}from"./ImQRQGZr.chunk.js";import{dt as t,lt as n,ut as r}from"./Dun43GrB.chunk.js";import{t as i}from"./B-OL6Vs7.chunk.js";import{l as a}from"./BQ5XMoHG.chunk.js";import{t as o}from"./ibuOpDkQ.chunk.js";import{t as s}from"./DeldjYRc.chunk.js";import{i as c}from"./CEsevkum.chunk.js";import{t as l}from"./DjIdG9LL2.chunk.js";import{n as u,t as d}from"./CL1ST5J62.chunk.js";import{a as f}from"./D2om474U2.chunk.js";import{a as p,i as m}from"./B8R4YVaF2.chunk.js";import{X as h,q as g}from"./app-
|
|
2
|
-
//# sourceMappingURL=
|
|
1
|
+
import"./Dp9qJj1C.chunk.js";import{t as e}from"./ImQRQGZr.chunk.js";import{dt as t,lt as n,ut as r}from"./Dun43GrB.chunk.js";import{t as i}from"./B-OL6Vs7.chunk.js";import{l as a}from"./BQ5XMoHG.chunk.js";import{t as o}from"./ibuOpDkQ.chunk.js";import{t as s}from"./DeldjYRc.chunk.js";import{i as c}from"./CEsevkum.chunk.js";import{t as l}from"./DjIdG9LL2.chunk.js";import{n as u,t as d}from"./CL1ST5J62.chunk.js";import{a as f}from"./D2om474U2.chunk.js";import{a as p,i as m}from"./B8R4YVaF2.chunk.js";import{X as h,q as g}from"./app-gjHxcZG3.js";import{t as _}from"./DlFudnBx.chunk.js";import{n as v,t as y}from"./C9tPKnK22.chunk.js";import{n as b}from"./Byczy1lS.chunk.js";import{n as x,t as S}from"./DMZ--ok1.chunk.js";import{t as C}from"./CEFKXxac.chunk.js";import{n as w,t as T}from"./CxCkwLio.chunk.js";import{n as E}from"./CIGsvs1s.chunk.js";r();var D={classificationPane:`_classificationPane_sns98_1`},O=n(),k=e.encloseNamespace(`subjects.classificationsView`);function A(e,t){let n=a(e&&_.classification(e,t));return e?n?.data:{name:k(`exploreAllTopicsHeading`),banner:{url:v.Images.STREAMABLE_TOPIC_BANNER}}}function j(e){let t=a(e&&_.path(e));return e?t?.data:[]}function M(e){let n=a(o.currentUser()),r=a(h.config()),v=a(g.streamablePresentation()),M=A(e.id,n.data?.id),N=j(e.id);l({title:k(`exploreAllTopicsHeading`)});let P=a(e.id?_.children(e.id):v.data&&_.topLevelTopics(v.data?.id)),[F]=u(d.AUDIENCE_FILTER,void 0,{storage:c.SessionStorage}),I=e=>{let n=y.getAudienceParams(F);return{application:i.SUBJECTS,action:s.Subjects.CLASSIFICATION,args:e?[e.id,t.slugify(e.name)]:[],params:n||{}}};function L(){let t=[{name:k(`discover`),appLink:{application:i.DASHBOARD,action:s.Dashboard.HOME}},{name:k(`exploreAllTopicsHeading`),appLink:{application:i.SUBJECTS,action:s.Subjects.CLASSIFICATION_ALL},active:!e.id}];return N.forEach(e=>{t.push({name:e.name,appLink:I(e)})}),e.id&&t.push({name:k(`subview`),active:!0}),t}let R=(e.id?!!M:!0)&&!!r.data&&P.data,z=!!N,B={presentationId:v.data?.id,presentationName:v.data?.name,currentClassificationName:M?.name,widgetId:m.Classifications,templateId:p.CoverFixedPillListLarge};return(0,O.jsxs)(`main`,{className:`bg-white px-4`,children:[R?(0,O.jsx)(S,{heading:M?.name,banner:M?.banner,imageCdnUrl:r.data.imageCdnUrl,actions:[],imageOptions:!e.id&&{resizeType:f.Cover}}):(0,O.jsx)(x,{}),(0,O.jsx)(`div`,{className:`py-3 mb-3 border-bottom`,children:z?(0,O.jsx)(T,{breadcrumbs:L()}):(0,O.jsx)(w,{})}),(0,O.jsx)(`div`,{className:D.classificationPane,children:R?(0,O.jsx)(C,{name:``,description:``,analyticsData:B,content:P?.data,appLinks:{classification:I},hasTableOfContents:!1,settings:{hasTopicDirectories:!1}}):(0,O.jsx)(b,{partialLoadingComponent:E})})]})}export{M as StreamableClassificationsView};
|
|
2
|
+
//# sourceMappingURL=CeQGaFi-2.chunk.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"
|
|
1
|
+
{"version":3,"file":"CeQGaFi-2.chunk.js","names":[],"sources":["../../src/apps/subjects/views/classifications/classifications.module.scss","../../src/apps/subjects/views/classifications/StreamableClassificationsView.tsx"],"sourcesContent":[":local {\n .classificationPane {\n min-height: 70vh;\n }\n}\n","import React from 'react';\n\nimport { LanguageService } from 'libs/common/backbone/services/LanguageService';\nimport { StorageType } from 'libs/common/backbone/utils/LocalStorageHelper';\nimport { Flight } from 'libs/common/flight';\nimport { useViewModel } from 'libs/common/react/hooks/UseViewModel';\nimport { TextHelper } from 'libs/common/react/utils/TextHelper';\n\nimport { BannerHeader, PartialBannerHeader } from 'libs/shared/components/banner-header/BannerHeader';\nimport { Breadcrumb, Breadcrumbs, PartialBreadcrumbs } from 'libs/shared/components/breadcrumbs/Breadcrumbs';\nimport { CoverFixedPillListLargeWidgetTemplate } from 'libs/shared/components/widgets/curated-widgets/templates/cover-fixed-pill-list-large/CoverFixedPillListLargeWidgetTemplate';\nimport { PartialDynamicWidget } from 'libs/shared/components/widgets/dynamic-widget';\nimport { PartialSubjectWidgetItem } from 'libs/shared/components/widgets/items/subject-widget-item';\nimport { HardCoded } from 'libs/shared/constants/HardCoded';\nimport { SharedViewModelKeys } from 'libs/shared/constants/SharedViewModelKeys';\nimport { ResizeType } from 'libs/shared/enums/Images';\nimport { WidgetTemplate } from 'libs/shared/enums/WidgetTemplate';\nimport { WidgetTypeId } from 'libs/shared/enums/WidgetTypeId';\nimport { ClassificationRequests } from 'libs/shared/flight-requests/ClassificationRequests';\nimport { ConfigRequests } from 'libs/shared/flight-requests/ConfigRequests';\nimport { UserRequests } from 'libs/shared/flight-requests/UserRequests';\nimport { useSetPageMetadata } from 'libs/shared/hooks/useSetPageMetadata';\nimport { Classification, Config, CurrentUser, Presentation, PresentationAudience } from 'libs/shared/interfaces';\nimport { AudienceHelper } from 'libs/shared/utils/audience-helper/AudienceHelper';\n\nimport { Actions } from 'shared/constants/StreamableActions';\nimport { AppChannels } from 'shared/constants/StreamableRadioChannels';\nimport { PresentationRequests } from 'shared/flight-requests/PresentationRequests';\n\nimport styles from './classifications.module.scss';\n\nconst namespace = 'subjects.classificationsView';\nconst getPhrase = LanguageService.encloseNamespace(namespace);\n\nfunction useGetClassification(\n id?: string,\n userId?: string\n): Classification {\n /**\n * With an id, we're fetching the classification to show the child topics in the\n * classification list.\n */\n const classification = Flight.useBasicFetch<Classification>(\n id &&\n ClassificationRequests.classification(id, userId)\n );\n\n /**\n * Without an id, we should be displaying the All Subjects page. So we'll construct\n * a synthetic classification.\n */\n if (!id)\n return {\n name: getPhrase('exploreAllTopicsHeading'),\n banner: {\n url: HardCoded.Images.STREAMABLE_TOPIC_BANNER\n }\n } as Classification;\n\n return classification?.data;\n}\n\nfunction useGetPaths(id?: string): Classification[] {\n const path = Flight.useBasicFetch<Classification[]>(id && ClassificationRequests.path(id));\n\n if (!id)\n return [];\n\n return path?.data;\n}\n\ninterface StreamableClassificationsViewProps {\n id?: string;\n}\n\nexport function StreamableClassificationsView(props: StreamableClassificationsViewProps): JSX.Element {\n /**\n * Data fetching\n */\n const currentUser = Flight.useBasicFetch<CurrentUser>(UserRequests.currentUser());\n const config = Flight.useBasicFetch<Config>(ConfigRequests.config());\n\n const presentation = Flight.useBasicFetch<Presentation>(\n PresentationRequests.streamablePresentation()\n );\n\n const classification = useGetClassification(\n props.id,\n currentUser.data?.id\n );\n\n const paths = useGetPaths(props.id);\n\n useSetPageMetadata({ title: getPhrase('exploreAllTopicsHeading') });\n\n /**\n * With an id, we'll fetch the classification's children.\n * With a presentationId, we'll fetch the presentation's top level topics.\n * For public access, we will always have a presentationId available.\n */\n const request = props.id ?\n ClassificationRequests.children(props.id) :\n presentation.data && ClassificationRequests.topLevelTopics(presentation.data?.id);\n\n const children = Flight.useBasicFetch<Classification[]>(request);\n\n const [activeAudiences] = useViewModel<PresentationAudience[]>(\n SharedViewModelKeys.AUDIENCE_FILTER,\n undefined,\n { storage: StorageType.SessionStorage }\n );\n\n const classificationAppLinkFn = (classification?: Classification) => {\n const params = AudienceHelper.getAudienceParams(activeAudiences);\n return {\n application: AppChannels.SUBJECTS,\n action: Actions.Subjects.CLASSIFICATION,\n args: classification ? [ classification.id, TextHelper.slugify(classification.name) ] : [],\n params: params || {}\n };\n };\n\n function getBreadcrumbs(): Breadcrumb[] {\n const breadcrumbs: Breadcrumb[] = [{\n name: getPhrase('discover'),\n appLink: {\n application: AppChannels.DASHBOARD,\n action: Actions.Dashboard.HOME\n }\n }, {\n name: getPhrase('exploreAllTopicsHeading'),\n appLink: { application: AppChannels.SUBJECTS, action: Actions.Subjects.CLASSIFICATION_ALL },\n active: !props.id\n }];\n\n paths.forEach(item => {\n breadcrumbs.push({\n name: item.name,\n appLink: classificationAppLinkFn(item)\n });\n });\n\n if (props.id)\n breadcrumbs.push({\n name: getPhrase('subview'),\n active: true\n });\n\n return breadcrumbs;\n }\n\n /**\n * Render Variable\n */\n const dataLoaded = (props.id ? !!classification : true) && !!config.data && children.data;\n const breadcrumbsDataLoaded = !!paths;\n\n /**\n * Additional subjects data to be mixed in with lower-level component analytics collection\n */\n const analyticsData = {\n presentationId: presentation.data?.id,\n presentationName: presentation.data?.name,\n currentClassificationName: classification?.name,\n widgetId: WidgetTypeId.Classifications,\n templateId: WidgetTemplate.CoverFixedPillListLarge\n };\n\n return (\n <main className='bg-white px-4'>\n {dataLoaded ?\n (\n <BannerHeader\n heading={classification?.name}\n banner={classification?.banner}\n imageCdnUrl={config.data.imageCdnUrl}\n actions={[]}\n imageOptions={!props.id && { resizeType: ResizeType.Cover }}\n />\n ) : <PartialBannerHeader />\n }\n <div className='py-3 mb-3 border-bottom'>\n {(() => {\n if (!breadcrumbsDataLoaded)\n return <PartialBreadcrumbs />;\n\n return <Breadcrumbs breadcrumbs={getBreadcrumbs()} />;\n })()}\n </div>\n <div className={styles.classificationPane}>\n {dataLoaded ?\n (\n <CoverFixedPillListLargeWidgetTemplate\n name=''\n description=''\n analyticsData={analyticsData}\n content={children?.data}\n appLinks={{ classification: classificationAppLinkFn }}\n hasTableOfContents={false}\n settings={{\n hasTopicDirectories: false\n }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,eAAgB,EAAyB,CACrD,mBAAoB,GACpB,SAAU,CACR,oBAAqB,GACtB,CACD,CAAA,EACA,EAAA,EAAA,KAAC,EAAD,CAAsB,wBAAyB,EAA4B,CAAA,CAC7E,CAAA,CACD"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{gt as e}from"./Dp9qJj1C.chunk.js";import{t}from"./ImQRQGZr.chunk.js";import{C as n,l as r,n as i,ut as a,v as o}from"./Dun43GrB.chunk.js";import{d as s,l as c,y as l}from"./BQ5XMoHG.chunk.js";import{t as u}from"./B7tm2CBz.chunk.js";import{t as d}from"./C9ET3pjZ.chunk.js";import{n as f}from"./CAEQvGr_.chunk.js";import{n as p}from"./LVrVQvKT.chunk.js";import{t as m}from"./ibuOpDkQ.chunk.js";import{t as h}from"./BVWg3YHX.chunk.js";import{i as g}from"./CEsevkum.chunk.js";import{t as _}from"./H6wjCesG.chunk.js";import{n as v,t as y}from"./CL1ST5J62.chunk.js";import{M as b}from"./app-
|
|
2
|
-
//# sourceMappingURL=
|
|
1
|
+
import{gt as e}from"./Dp9qJj1C.chunk.js";import{t}from"./ImQRQGZr.chunk.js";import{C as n,l as r,n as i,ut as a,v as o}from"./Dun43GrB.chunk.js";import{d as s,l as c,y as l}from"./BQ5XMoHG.chunk.js";import{t as u}from"./B7tm2CBz.chunk.js";import{t as d}from"./C9ET3pjZ.chunk.js";import{n as f}from"./CAEQvGr_.chunk.js";import{n as p}from"./LVrVQvKT.chunk.js";import{t as m}from"./ibuOpDkQ.chunk.js";import{t as h}from"./BVWg3YHX.chunk.js";import{i as g}from"./CEsevkum.chunk.js";import{t as _}from"./H6wjCesG.chunk.js";import{n as v,t as y}from"./CL1ST5J62.chunk.js";import{M as b}from"./app-gjHxcZG3.js";import{t as x}from"./DlFudnBx.chunk.js";var S=p.CLASSIFICATION_COLLECTION,C={allSubjectPreferences:()=>`{gateway}/v1/users/me/classifications/preferences?query=${S}&type=subject`,mySubjectPreferences:()=>`{gateway}/v1/users/me/classifications/following?query=${S}`,followSubjects:()=>`{gateway}/v1/users/me/classifications/following`,unfollowSubjects:e=>f.urlBuilder(`{gateway}/v1/users/me/classifications/following`,{id:e}),allLevelPreferences:()=>`{gateway}/v1/users/me/audiences?type=subject`,myLevelPreferences:()=>`{gateway}/v1/users/me/audiences/following`,followLevels:()=>`{gateway}/v1/users/me/audiences/following`,unfollowLevels:e=>f.urlBuilder(`{gateway}/v1/users/me/audiences/following`,{id:e}),getCurrentPresentations:e=>`{gateway}/v1/users/me/presentations${e?`?type=${e}`:``}`,getAvailablePresentations:e=>`{gateway}/v1/users/me/presentations/available${e?`?type=${e}`:``}`,setPresentation:e=>`{gateway}/v1/users/me/presentations/${e}`},w={availablePresentations(e){return{url:C.getAvailablePresentations(e),key:`available:presentations:${e}`,normalizeOptions:{namespace:`presentation`}}},setPresentation(e,t,n,r){return{url:C.setPresentation(e.id),key:`set:${t}:presentation`,type:l.POST,data:{},normalizeOptions:{namespace:`presentation`},invalidationKeys:[`current:presentation:${t.toLocaleLowerCase()}`,`subject:preference:options`,`my:subject:preferences`,`level:preference:options`,`my:level:preferences`,`classifications`,`presentation:audiences`,`widgets:v3`,`content:update:videos`,`content:updates`],success:n,error:r}},allSubjectPreferences(){return{url:C.allSubjectPreferences(),key:`subject:preference:options`}},mySubjectPreferences(e){return{url:C.mySubjectPreferences(),key:`my:subject:preferences`,normalize:!1,success:e}},followSubjects(e,t,n,r){return{url:C.followSubjects(),key:`follow:subjects`,data:e,type:l.POST,success:t,error:n,always:r,invalidationKeys:[...e.map(e=>`classification:${e}`),`my:subject:preferences`,`classifications`,`content:updates`]}},unfollowSubjects(e,t,n,r){return{url:C.unfollowSubjects(e),key:`unfollow:subjects`,type:l.DELETE,success:t,error:n,always:r,invalidationKeys:[...e.map(e=>`classification:${e}`),`my:subject:preferences`,`classifications`,`content:updates`]}},allLevelPreferences(){return{url:C.allLevelPreferences(),key:`level:preference:options`,normalize:!1}},myLevelPreferences(e){return{url:C.myLevelPreferences(),key:`my:level:preferences`,normalizeOptions:{idAttribute:`masterId`},success:e}},followLevels(e,t,n,r){return{url:C.followLevels(),key:`follow:levels`,data:e.map(e=>e.masterId),normalize:!1,updateState:{keys:`my:level:preferences`,updateData:t=>{let n=t[`my:level:preferences`]??[];return e.forEach(e=>{n.find(t=>t.masterId===e.masterId)||n.push(e)}),{"my:level:preferences":n}}},type:l.POST,success:t,error:n,always:r}},unfollowLevels(e,t,n,r){return{url:C.unfollowLevels(e.map(e=>e.masterId)),key:`unfollow:levels`,normalize:!1,updateState:{keys:`my:level:preferences`,updateData:t=>{let n=t[`my:level:preferences`]??[];return e.forEach(e=>{if(!n.find(t=>t.masterId===e.masterId))return;let t=n.findIndex(t=>t.masterId===e.masterId);n=[...n.slice(0,t),...n.slice(t+1)]}),{"my:level:preferences":n}}},type:l.DELETE,success:t,error:n,always:r}}},T=e(a()),E=`videos.hooks`,D=new Map,O=e=>{function a(e){return`${e.toLowerCase()}:${y.PRESENTATION_ID}`}let[l,f]=v(a(h.Curriculum),void 0,{storage:g.LocalStorage}),[p,S]=T.useState(null),[C,O]=T.useState(null),[k,A]=T.useState(!1),j=c(m.currentUser()),M=c(x.availablePresentations(h.Curriculum)),N=s(),P=_(),{hasLocalPermissions:F}=b(),I=F(d.ManagePublicPresentation);function L(){return isNaN(+l)?u.first(M.data)?.id:l}function R(){if(j.data?.isAuthenticated)return x.presentation(h.Curriculum);let e=L();return e?x.presentationById(e):null}let z=c(R());T.useEffect(()=>{z.data&&(S(z.data),e&&!C&&N(x.curriculumLinks(e,z.data?.id)).then(e=>{O(e),D.set(z.data?.id?.toString(),e)}))},[z.data?.id]);let B=M.data?.map(e=>e.id)??[],V=c(e&&B.length&&x.getMappedCurriculums(e,B));async function H(n,r){if(p.id.toString()===n.toString())return;let i=M.data.find(e=>e.id.toString()===n.toString());S(i),I&&f(n);try{if(e&&await U(n),I)return;await N(w.setPresentation(i,h.Curriculum)),W(i,r)}catch{P.error(t.getPhrase(E,`curriculumUpdateError`)),S(p)}}async function U(t){if(!e)return;if(D.has(t.toString())){O(D.get(t.toString()));return}if(!V.data.find(e=>e.id.toString()===t.toString())){O([]);return}A(!0);let n=await N(x.curriculumLinks(e,t));O(n),D.set(t.toString(),n),A(!1)}function W(e,t){if(!t.shouldLog)return;let a={id:e.id,name:e.id,description:e.description};t.video&&(a.videoId=t.video.id,a.videoName=t.video.name),i.logUserAction(a,{entity:r.Presentation,actionType:n.Select,descriptor:o.Curriculum,location:t.locationContext})}function G(){return p?e?!!C&&V.hasCompleted:!0:!1}return{preferredCurriculum:p||z.data,curriculumLinks:C||[],availableCurriculums:M.data||[],mappedCurriculums:V.data||[],updateCurriculum:H,hasCompleted:G(),isFetching:k}};export{O as t};
|
|
2
|
+
//# sourceMappingURL=Cr3Blj6H2.chunk.js.map
|