{"version":3,"sources":["webpack:///./Avensia.Common/Features/Shared/Blocks/PodPlayer/PodPlayerBlock.tsx","webpack:///./Avensia.Common/Features/Shared/BoxLayout/index.tsx"],"names":["state","currentBreakpoint","dispatch","onToggleRadioPlay","isOpen","embedRadioPlayUrl","props","isMobile","Medium","Wrapper","css","compose","className","title","Description","description","CustomButton","to","embedUrl","url","target","appearance","Secondary","button","onClick","div","padding","y","fontWeight","letterSpacing","x","SPACING_DEFAULT","SPACING_MOBILE","BOX_ITEM_CLASSNAME","fractions","spacingDefaulter","value","Tiny","isThin","fraction","Column","display","flexDirection","flexGrow","minWidth","Block","sort","entities","a","b","render","children","Children","toArray","this","row","allowSorting","Small","map","entry","element","shift","columns","Micro","reduce","current","item","convert","layout","spacing","spacingBetweenBlocks","Div","flexWrap","margin","xy","wrap","entity","index","isColumn","key","flexBasis","Component","BoxLayout"],"mappings":"2FAAA,W,EAAA,wFAkDe,sBACb,aACE,SAACA,GAA4B,OAC3BC,kBAAmBD,EAAMC,sBAE3B,SAACC,GAAgC,OAC/BC,kBAAiB,SAACC,EAAQC,GACxBH,EAAS,YAAgBE,EAAQC,QANvC,EAxBqB,SAACC,GACtB,IAAMC,EAAWD,EAAML,kBAAoB,IAAWO,OACtD,OACE,kBAACC,EAAO,CAACC,IAAKJ,EAAMK,UAAWC,UAAW,KACxC,4BAAK,YAAiBN,EAAMO,QAC5B,kBAACC,EAAW,KAAE,YAAiBR,EAAMS,cACpCR,EACC,kBAACS,EAAY,CAACC,GAAI,YAAiBX,EAAMY,UAAUC,IAAKC,OAAO,SAASC,WAAY,IAAiBC,WAClG,YAAiBhB,EAAMiB,SAG1B,kBAACP,E,CAECQ,QAAS,WAAM,OAAAlB,EAAMH,mBAAkB,EAAM,YAAiBG,EAAMY,UAAUC,MAC9EE,WAAY,IAAiBC,WAE5B,YAAiBhB,EAAMiB,cAoBlC,IAAMd,EAAU,IAAOgB,MAAG,GACxBC,QAAS,CAAEC,EAAG,QACb,MAAsB,CACrBD,Q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CACb3C,QAAS,CACPgD,GAAI,QAAQL,EAAO,WAErB,CACFW,UAAWX,EAAU,QAA0B,IAAlBO,EAAOrC,SAAc,OAAO8B,EAAO,IAA2B,IAAlBO,EAAOrC,SAAc,OAG/FqC,EAAOhB,UAyCIe,CAAKrB,KAAKhD,MAAMgE,qBAAsBhB,KAAKhD,MAAML,sBAIvE,EAzBA,CAAwB,IAAMgF,WA6Bf,gBACb,aACE,SAACjF,GAA4B,OAC3BC,kBAAmBD,EAAMC,qBAF7B,CAIEiF","file":"assets/32.chunk.540b69a04d5c2b15c599.js","sourcesContent":["/**\r\n * @ComponentFor PodPlayerBlock\r\n */\r\n\r\nimport React from 'react';\r\nimport { Breakpoint } from '@avensia/scope';\r\nimport { epiPropertyValue } from '@avensia/scope-episerver';\r\nimport { styled, StyledProps } from '@glitz/react';\r\nimport PodPlayerType from './PodPlayerBlock.type';\r\nimport { Appearance as ButtonAppearance } from 'Shared/Button';\r\nimport P from 'Shared/Generic/P';\r\nimport Button from 'Shared/Button';\r\nimport { pixelsToUnit, large, minMediumMediaQuery, huge } from 'Shared/Style';\r\nimport connect from 'Shared/connect';\r\nimport { BOX_ITEM_CLASSNAME } from 'Shared/BoxLayout';\r\nimport { toggleRadioPlay } from 'RadioPlay/action-creators';\r\n\r\ntype ConnectStateType = {\r\n currentBreakpoint: number;\r\n};\r\n\r\ntype ConnectActionType = {\r\n onToggleRadioPlay: (isOpen: boolean, embedRadioPlayUrl: string) => void;\r\n};\r\n\r\ntype PropType = PodPlayerType & ConnectActionType & ConnectStateType & StyledProps;\r\n\r\nconst podPlayerBlock = (props: PropType) => {\r\n const isMobile = props.currentBreakpoint < Breakpoint.Medium;\r\n return (\r\n \r\n

{epiPropertyValue(props.title)}

\r\n {epiPropertyValue(props.description)}\r\n {isMobile ? (\r\n \r\n {epiPropertyValue(props.button)}\r\n \r\n ) : (\r\n props.onToggleRadioPlay(true, epiPropertyValue(props.embedUrl).url)}\r\n appearance={ButtonAppearance.Secondary}\r\n >\r\n {epiPropertyValue(props.button)}\r\n \r\n )}\r\n
\r\n );\r\n};\r\n\r\nexport default styled(\r\n connect(\r\n (state): ConnectStateType => ({\r\n currentBreakpoint: state.currentBreakpoint,\r\n }),\r\n (dispatch): ConnectActionType => ({\r\n onToggleRadioPlay(isOpen, embedRadioPlayUrl) {\r\n dispatch(toggleRadioPlay(isOpen, embedRadioPlayUrl));\r\n },\r\n }),\r\n )(podPlayerBlock),\r\n);\r\n\r\nconst Wrapper = styled.div({\r\n padding: { y: large },\r\n [minMediumMediaQuery]: {\r\n padding: { y: huge },\r\n },\r\n});\r\n\r\nconst Description = styled(P, {\r\n fontWeight: 'bold',\r\n padding: {\r\n y: large,\r\n },\r\n});\r\n\r\nconst CustomButton = styled(Button, {\r\n letterSpacing: pixelsToUnit(0.8),\r\n padding: {\r\n y: 0,\r\n x: pixelsToUnit(30),\r\n },\r\n});\r\n","import React from 'react';\r\nimport { styled, StyledProps } from '@glitz/react';\r\nimport connect from '../connect';\r\nimport { Breakpoint } from '@avensia/scope';\r\nimport * as style from '../Style';\r\n\r\nexport const SPACING_DEFAULT = style.pixelsToUnit(25);\r\nexport const SPACING_MOBILE = style.pixelsToUnit(15);\r\nexport const BOX_CLASSNAME = 'purefun-box';\r\nexport const BOX_ITEM_CLASSNAME = 'purefun-box-item';\r\n\r\nconst fractions = {\r\n '1:2': 1 / 2,\r\n '1:3': 1 / 3,\r\n '1:4': 1 / 4,\r\n '2:3': 2 / 3,\r\n '3:4': 3 / 4,\r\n};\r\n\r\nexport type LayoutAliasType = keyof typeof fractions;\r\n\r\ntype LayoutColumnType = LayoutAliasType[] & {\r\n 0: LayoutAliasType;\r\n 1: LayoutAliasType[] & {\r\n 0: LayoutAliasType;\r\n 1: LayoutAliasType;\r\n };\r\n};\r\n\r\nexport type LayoutType = LayoutAliasType | LayoutColumnType;\r\n\r\nfunction spacingDefaulter(value: boolean | string, currentBreakpoint: number) {\r\n return value === true ? (currentBreakpoint > Breakpoint.Tiny ? SPACING_DEFAULT : SPACING_MOBILE) : value;\r\n}\r\n\r\nfunction isThin(fraction: number) {\r\n return fraction <= 1 / 3;\r\n}\r\n\r\nconst Column = styled.div({\r\n display: 'flex',\r\n flexDirection: 'column',\r\n flexGrow: 1,\r\n minWidth: 0,\r\n});\r\n\r\nconst Block = styled.div({\r\n flexGrow: 1,\r\n minWidth: 0,\r\n});\r\n\r\ntype BlockEntityType = {\r\n fraction: number;\r\n element: React.ReactNode;\r\n};\r\n\r\ntype ColumnEntityType = {\r\n fraction: number;\r\n columns: BlockEntityType[];\r\n};\r\n\r\nfunction sort(entities: BlockEntityType[]) {\r\n return entities.sort((a, b) => b.fraction - a.fraction);\r\n}\r\n\r\nfunction convert(\r\n row: LayoutType[],\r\n children: React.ReactNode[],\r\n currentBreakpoint: number,\r\n allowSorting?: boolean,\r\n ): (BlockEntityType | ColumnEntityType)[] {\r\n if (currentBreakpoint > Breakpoint.Small) {\r\n return row.map(entry => {\r\n if (typeof entry === 'string') {\r\n return {\r\n fraction: fractions[entry],\r\n element: children.shift(),\r\n };\r\n }\r\n\r\n return {\r\n fraction: fractions[entry[0]],\r\n columns: entry[1].map(entry => ({\r\n fraction: fractions[entry],\r\n element: children.shift(),\r\n })),\r\n };\r\n });\r\n }\r\n\r\n // Flatten all blocks to full or half width\r\n if (currentBreakpoint > Breakpoint.Micro) {\r\n const entities = row.reduce((current, item) => {\r\n if (typeof item === 'string') {\r\n return [\r\n ...current,\r\n {\r\n fraction: isThin(fractions[item]) ? 0.5 : 1,\r\n element: children.shift(),\r\n },\r\n ];\r\n }\r\n\r\n const value = isThin(fractions[item[0]]) ? 0.5 : 1;\r\n return [\r\n ...current,\r\n ...item[1].map(() => ({\r\n fraction: value,\r\n element: children.shift(),\r\n })),\r\n ];\r\n }, []);\r\n\r\n return allowSorting ? sort(entities) : entities;\r\n }\r\n\r\n // Flatten all blocks to full width\r\n const entities = row.reduce(\r\n (current, entry) =>\r\n typeof entry === 'string'\r\n ? [\r\n ...current,\r\n {\r\n fraction: 1,\r\n element: children.shift(),\r\n },\r\n ]\r\n : [\r\n ...current,\r\n ...entry[1].map(() => ({\r\n fraction: 1,\r\n element: children.shift(),\r\n })),\r\n ],\r\n [],\r\n );\r\n\r\n return allowSorting ? sort(entities) : entities;\r\n}\r\n\r\nfunction isColumn(entity: BlockEntityType | ColumnEntityType): entity is ColumnEntityType {\r\n return 'columns' in entity;\r\n}\r\n\r\nfunction wrap(spacingBetweenBlocks: boolean | string, currentBreakpoint: number) {\r\n const spacing = spacingDefaulter(spacingBetweenBlocks, currentBreakpoint);\r\n return (entity: BlockEntityType | ColumnEntityType, index: number): React.ReactNode => {\r\n return isColumn(entity) ? (\r\n \r\n {entity.columns.map(wrap(spacingBetweenBlocks, currentBreakpoint))}\r\n \r\n ) : (\r\n \r\n {entity.element}\r\n \r\n );\r\n };\r\n}\r\n\r\ntype RequiredPropType = {\r\n layout: LayoutType[];\r\n spacingBetweenBlocks?: boolean | string;\r\n allowSorting?: boolean;\r\n className?: string;\r\n style?: React.CSSProperties;\r\n};\r\n\r\ntype ConnectStateType = {\r\n currentBreakpoint: number;\r\n};\r\n\r\ntype PropType = StyledProps & RequiredPropType & ConnectStateType;\r\n\r\nclass BoxLayout extends React.Component {\r\n render() {\r\n const children = React.Children.toArray(this.props.children);\r\n const entities = convert(this.props.layout, children, this.props.currentBreakpoint, this.props.allowSorting);\r\n const spacing = spacingDefaulter(this.props.spacingBetweenBlocks, this.props.currentBreakpoint);\r\n return (\r\n Breakpoint.Small && {\r\n flexWrap: 'nowrap',\r\n }),\r\n }}\r\n className={BOX_CLASSNAME}\r\n >\r\n {entities.map(wrap(this.props.spacingBetweenBlocks, this.props.currentBreakpoint))}\r\n \r\n );\r\n }\r\n}\r\n\r\n\r\n\r\nexport default styled(\r\n connect(\r\n (state): ConnectStateType => ({\r\n currentBreakpoint: state.currentBreakpoint,\r\n }),\r\n )(BoxLayout),\r\n);\r\n"],"sourceRoot":""}