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N,SAAWM,EAAMtF,OAAS,EAAI,IAAM,IAAMsF,EAAMD,KAAK,KAE1DD,CAAA,CAGF,SAASI,EACdnE,EACAoE,EACAC,GAEA,MAAOC,EAAMC,GAAiBvE,EAAIkE,MAAM,KAExC,OAAO,IAEL,IAAe,UAAU,CAAC,MAAAG,OAAA,EAAAA,EAASG,eAEnC,IAAYJ,GAEZ,IAAe,cAAc,CAAC,MAAAC,OAAA,EAAAA,EAASI,mBAEvC,IAAOH,GACP,IAAO,KATF,CAULC,EAAA,C,SAGG,MAAMG,EAAoB,CAAC1E,EAAaoE,KAC7C,MAAOE,EAAMC,GAAiBvE,EAAIkE,MAAM,KAClCS,EAAc,UAASJ,GACvBK,EAAqB,IAAOR,EAAQO,GAE1C,OAA6B,IADVE,OAAOC,KAAKF,GACbjG,OACd2F,EACA,GAAGA,KAAQ,cAAaM,IAAqB,EAGtCG,EAAe,KAC1B,CAACC,EAAeC,KACd,QAAQD,EAAO,CAACE,OAAQC,oBAAxB,CAA6CF,I","sources":["webpack:///./scripts/apps/promotions/components/sharedUI.tsx","webpack:///./scripts/apps/promotions/components/PromotionGridSection.tsx","webpack:///./scripts/apps/promotions/components/HighlightedPromotion.tsx","webpack:///./scripts/apps/promotions/components/EmptyPage.tsx","webpack:///./scripts/apps/promotions/index.tsx","webpack:///./scripts/utils/php-js/index.ts","webpack:///../../../packages/pg-ui/src/base/Material/components/StyleableBaseComponents.tsx","webpack:///../../../packages/pg-util/src/UrlUtils.ts"],"sourcesContent":["import React from 'react';\nimport useMediaQuery from '@mui/material/useMediaQuery';\nimport {styled, Theme} from '@mui/material/styles';\nimport {\n Button,\n ButtonVariant,\n} from '@practicegenius/pg-ui/src/base/Material/components/Button';\n\nconst actionColor = '#0070C9';\n\nconst StyledButton = styled(Button)({\n color: actionColor,\n fontWeight: 600,\n '&:hover': {\n color: actionColor,\n },\n '&:focus': {\n color: actionColor,\n },\n});\n\nexport const ActionButton = (props: React.ComponentProps) => {\n const isMediumDown = useMediaQuery(theme =>\n theme.breakpoints.down('lg')\n );\n\n return (\n \n );\n};\n","import React from 'react';\nimport * as R from 'ramda';\nimport Box from '@mui/material/Box';\nimport Typography from '@mui/material/Typography';\nimport Grid from '@mui/material/Grid';\nimport {detect} from 'detect-browser';\nimport {PromotionListItem} from '@practicegenius/domain/src/data/promotions/promotion';\nimport {IMT} from '@practicegenius/pg-util/src/StringUtils';\nimport {PromotionCard} from './PromotionCard';\nimport {ActionButton} from './sharedUI';\nimport lang from '../lang';\n\ntype Props = {\n title: string;\n promotions: PromotionListItem[];\n};\n\nconst VISIBLE_PROMOTIONS_THRESHOLD = 3;\n\nconst browser = detect();\nconst isIEOrLegacyEdge = browser?.name === 'ie' || browser?.name === 'edge';\n\nexport const PromotionGridSection: React.FC = props => {\n const [showMore, setShowMore] = React.useState(false);\n const [scrollTop, setScrollTop] = React.useState(0);\n\n /**\n * Please refrain from touching. Beatings will commence otherwise.\n * This is here to make it so the page expands down instead of up when the button is clicked.\n * If it breaks, it might be because somebody removed some overflow styling from content-wrapper.\n */\n const contentRef = React.useRef(\n document.querySelector('.content-wrapper')\n );\n React.useLayoutEffect(() => {\n /* Support IE11 */\n !isIEOrLegacyEdge && contentRef.current?.scrollTo({top: scrollTop});\n });\n\n const visiblePromotions = showMore\n ? props.promotions\n : R.take(VISIBLE_PROMOTIONS_THRESHOLD, props.promotions);\n\n return (\n <>\n \n ({color: theme.palette.text.primary})}\n >\n {props.title}\n \n \n \n {visiblePromotions.map(promotion => (\n \n \n \n ))}\n \n {props.promotions.length > VISIBLE_PROMOTIONS_THRESHOLD && (\n \n {\n setShowMore(!showMore);\n contentRef.current && setScrollTop(contentRef.current.scrollTop);\n }}\n sx={{\n color: 'var(--template-color-1)',\n '&:hover': {color: 'var(--template-color-1)'},\n }}\n >\n {IMT(lang.main.showMore, {\n quantity: showMore ? 'Fewer' : 'More',\n title: props.title,\n })}\n \n \n )}\n \n );\n};\n","import React from 'react';\nimport useMediaQuery from '@mui/material/useMediaQuery';\nimport {Theme} from '@mui/material/styles';\nimport Box from '@mui/material/Box';\nimport Grid from '@mui/material/Grid';\nimport Typography from '@mui/material/Typography';\nimport Link from '@mui/material/Link';\nimport Hidden from '@mui/material/Hidden';\nimport {\n PromotionListItem,\n getPromotionFormattedDateRange,\n} from '@practicegenius/domain/src/data/promotions/promotion';\nimport {SxImg} from '@practicegenius/pg-ui/src/base/Material/components/StyleableBaseComponents';\nimport {makeSxStyles} from '@practicegenius/pg-ui/src/base/Material/utils/sx-helpers';\nimport lang from '../lang';\nimport {ActionButton} from './sharedUI';\n\nconst useStyles = makeSxStyles(theme => ({\n image: {\n width: '100%',\n },\n date: {\n color: theme.palette.text.primary,\n textTransform: 'none',\n },\n // This works in all webkit browsers and even Firefox!\n clampToTwoLines: {\n display: '-webkit-box',\n WebkitLineClamp: 2,\n '-webkit-box-orient': 'vertical',\n overflow: 'hidden',\n },\n title: {\n color: 'var(--template-color-1)',\n textDecoration: 'none',\n },\n}));\n\ntype Props = {\n promotion: PromotionListItem;\n};\n\nexport const HighlightedPromotion: React.FC = ({promotion}) => {\n const [styles] = useStyles();\n const isMediumDown = useMediaQuery(theme =>\n theme.breakpoints.down('lg')\n );\n\n const img = (\n \n );\n\n return (\n \n \n {promotion.url ? {img} : img}\n \n \n \n \n {promotion.url ? (\n \n {promotion.title}\n \n ) : (\n promotion.title\n )}\n \n \n \n \n {getPromotionFormattedDateRange(promotion)}\n \n \n \n \n \n {promotion.shortDescription}\n \n \n \n \n \n {lang.main.highlighted.actionButton}\n \n \n \n \n );\n};\n","import React from 'react';\nimport Container from '@mui/material/Container';\nimport Box from '@mui/material/Box';\nimport Typography from '@mui/material/Typography';\nimport {IMT} from '@practicegenius/pg-util/src/StringUtils';\nimport {urlJoin} from '@practicegenius/pg-util/src/UrlUtils';\nimport {usePhpJs} from '../../../utils/php-js';\nimport {FILES_URL} from '../../../constants/env';\nimport lang from '../lang';\n\ntype Practice$PhpJs = {\n practice: {\n practice_name: string;\n logo2: string;\n };\n};\n\nexport const EmptyPage: React.FC = () => {\n const {name, logo} = usePhpJs(({practice}: Practice$PhpJs) => ({\n name: practice.practice_name,\n logo: practice.logo2,\n }));\n\n return (\n \n \n \n \n \n \n \n
\n \n {lang.empty.title}\n \n
\n
\n \n {IMT(lang.empty.subtitle, {name})}\n \n
\n
\n
\n );\n};\n","import React from 'react';\nimport Box from '@mui/material/Box';\nimport Container from '@mui/material/Container';\nimport {Breakpoint} from '@mui/material/styles';\nimport * as R from 'ramda';\nimport {Hidden} from '@mui/material';\nimport {\n PromotionListItem,\n PromotionType,\n promotionsResponseToListItems,\n} from '@practicegenius/domain/src/data/promotions/promotion';\nimport {UnknownServerData} from '@practicegenius/http-clients-js/src/types';\nimport {usePhpJs} from '../../utils/php-js';\nimport {PromotionGridSection} from './components/PromotionGridSection';\nimport {HighlightedPromotion} from './components/HighlightedPromotion';\nimport {EmptyPage} from './components/EmptyPage';\nimport lang from './lang';\nimport {UnauthenticatedStandardProvider} from '../../components/StandardProvider';\n\nconst getPromotionsByType = (\n promotions: PromotionListItem[],\n type: PromotionType\n) => R.filter(R.propEq(type, 'type'), promotions);\n\nconst Promotions = () => {\n const promotions: PromotionListItem[] = usePhpJs(\n ({promotions}: {promotions: UnknownServerData}) =>\n promotionsResponseToListItems({items: promotions} as UnknownServerData)\n );\n const ongoingPromotions = promotions.filter(p => p.status !== 'past');\n\n if (promotions.length === 0) {\n return ;\n }\n\n /** This comes sorted by earliest end date, but now that ended giveaways persist\n * we need to filter out past promotions so the highlighted promotion is always\n * an active one. */\n const highlightedPromotion = ongoingPromotions[0];\n\n const events = getPromotionsByType(promotions, PromotionType.event);\n const offers = getPromotionsByType(promotions, PromotionType.offer);\n const giveaways = getPromotionsByType(promotions, PromotionType.giveaway);\n\n return (\n ({\n paddingTop: theme.spacing(5),\n [theme.breakpoints.down('md')]: {\n paddingTop: theme.spacing(3),\n },\n })}\n >\n {highlightedPromotion && (\n \n \n \n \n \n )}\n\n {giveaways.length > 0 && (\n \n \n \n )}\n\n {events.length > 0 && (\n \n \n \n )}\n {offers.length > 0 && (\n \n \n \n )}\n \n );\n};\n\nconst PromotionsApp: React.FC<{\n breakpoint?: Breakpoint;\n}> = ({breakpoint}) => (\n // TODO We don't really have a great way to detect the authenticated vs unauthenticated context in a 'free' way\n // but we currently don't need anything from that context yet. So just using the unauthenticated context is fine.\n // When we refactor to Next.Js we'll be forced to find a clever way to provide this 😁\n \n \n \n);\n\nexport default PromotionsApp;\n","import * as React from 'react';\n\ntype PhpJsType = {\n [x: string]: any;\n};\n\nexport interface PhpJsWindow extends Window {\n phpJs: PhpJs;\n}\n\n/**\n * This is currently reading directly from window.\n * This poor excuse of a hook hopes to see this promoted somewhere better...\n * *Really, this is just as legitimate and equivalent to the withPhpJs HoC\n */\nexport function usePhpJs(\n callback: (a: PhpJs) => Return,\n global: {\n phpJs: PhpJs;\n } = window as PhpJsWindow\n) {\n return callback(global.phpJs);\n}\n\n/**\n * HoC to pluck out and pass down data from phpJs\n */\nexport const withPhpJs =\n (\n getPhpJs: (a: PhpJs) => Return,\n global: {\n phpJs: PhpJs;\n } = window as PhpJsWindow\n ) =>\n (component: React.ComponentType): React.ComponentType => {\n return props =>\n React.createElement(component, {...getPhpJs(global.phpJs), ...props});\n };\n","import {styled} from '@mui/material';\n\n/** An unstyled div element that can take the sx prop */\nexport const SxDiv = styled('div')({});\n/** An unstyled span element that can take the sx prop */\nexport const SxSpan = styled('span')({});\n/** An unstyled img element that can take the sx prop */\nexport const SxImg = styled('img')({});\n/** An unstyled 'a' element that can take the sx prop */\nexport const SxAnchor = styled('a')({});\n/** An unstyled section element that can take the sx prop */\nexport const SxSection = styled('section')({});\n","import qs, {IParseOptions, IStringifyOptions} from 'qs';\nimport * as R from 'ramda';\nimport {compile} from 'path-to-regexp';\nimport {InvariantError} from 'ts-invariant';\n\nexport function urlJoin(...urlPieces: string[] | [string[]]) {\n let strArray: string[] = [];\n\n if (Array.isArray(urlPieces[0])) {\n strArray = urlPieces[0];\n } else {\n strArray = urlPieces as string[];\n }\n\n const resultArray = [];\n if (strArray.length === 0) {\n return '';\n }\n\n // If the first part is a plain protocol, we combine it with the next part.\n if (strArray[0].match(/^[^/:]+:\\/*$/) && strArray.length > 1) {\n const first = strArray.shift();\n strArray[0] = first + strArray[0];\n }\n\n // There must be two or three slashes in the file protocol, two slashes in anything else.\n if (strArray[0].match(/^file:\\/\\/\\//)) {\n strArray[0] = strArray[0].replace(/^([^/:]+):\\/*/, '$1:///');\n } else {\n strArray[0] = strArray[0].replace(/^([^/:]+):\\/*/, '$1://');\n }\n\n for (let i = 0; i < strArray.length; i++) {\n let component = strArray[i];\n\n if (component === '') {\n continue;\n }\n\n if (i > 0) {\n // Removing the starting slashes for each component but the first.\n component = component.replace(/^[\\/]+/, '');\n }\n if (i < strArray.length - 1) {\n // Removing the ending slashes for each component but the last.\n component = component.replace(/[\\/]+$/, '');\n } else {\n // For the last component we will combine multiple slashes to a single one.\n component = component.replace(/[\\/]+$/, '/');\n }\n\n resultArray.push(component);\n }\n\n let str = resultArray.join('/');\n // Each input component is now separated by a single slash except the possible first plain protocol part.\n\n // remove trailing slash before parameters or hash\n str = str.replace(/\\/(\\?|&|#[^!])/g, '$1');\n\n // replace ? in parameters with &\n const parts = str.split('?');\n str = parts.shift() + (parts.length > 0 ? '?' : '') + parts.join('&');\n\n return str;\n}\n\nexport function addQueryParams(\n url: string,\n params: Record,\n options?: {parseOptions?: IParseOptions; stringifyOptions?: IStringifyOptions}\n): string {\n const [base, existingQuery] = url.split('?');\n\n return R.pipe(\n // Parse the existing query params into an object\n R.partialRight(qs.parse, [options?.parseOptions]),\n // Merge existing query params with the new query params. Note: params will take precedence over the existing params.\n R.mergeLeft(params),\n // Convert query params object back into a string\n R.partialRight(qs.stringify, [options?.stringifyOptions]),\n // Join the base and the query params back into a fully-qualified URL\n R.pair(base),\n R.join('?')\n )(existingQuery);\n}\n\nexport const removeQueryParams = (url: string, params: string[]): string => {\n const [base, existingQuery] = url.split('?');\n const queryObject = qs.parse(existingQuery);\n const updatedQueryObject = R.omit(params, queryObject);\n const nextParams = Object.keys(updatedQueryObject);\n return nextParams.length === 0\n ? base\n : `${base}?${qs.stringify(updatedQueryObject)}`;\n};\n\nexport const resolveRoute = R.curry(\n (route: string, data: Record) =>\n compile(route, {encode: encodeURIComponent})(data)\n);\n\nexport const replaceSubdomainInUrl = (\n initialUrl: string | URL,\n newSubdomain: string\n): URL => {\n const url = new URL(initialUrl);\n const [, domain, tld] = url.hostname.split('.');\n url.hostname = `${newSubdomain}.${domain}.${tld}`;\n return url;\n};\n\nexport const objectToUrlSearchParams = (\n obj: Record\n): URLSearchParams => {\n const searchParams = new URLSearchParams();\n Object.entries(obj).forEach(([key, value]) => {\n if (!value || R.isEmpty(value)) return;\n if (Array.isArray(value))\n throw new InvariantError(\n \"objectToUrlSearchParams does not yet support arrays (because it didn't need it until now and it's not obvious which format is preferred)\"\n );\n\n if (typeof value === 'number')\n return searchParams.append(key, value.toString());\n\n if (typeof value === 'string') return searchParams.append(key, value);\n\n throw new InvariantError(\n `objectToUrlSearchParams does not support type ${typeof value} and it probably shouldn't`\n );\n });\n return searchParams;\n};\n"],"names":["actionColor","StyledButton","styled","Button","color","fontWeight","ActionButton","props","isMediumDown","useMediaQuery","theme","breakpoints","down","variant","text","size","browser","isIEOrLegacyEdge","name","PromotionGridSection","showMore","setShowMore","scrollTop","setScrollTop","contentRef","document","querySelector","current","scrollTo","top","visiblePromotions","promotions","Box","mb","Typography","sx","palette","primary","title","Grid","container","spacing","map","promotion","key","item","xs","md","PromotionCard","length","mt","onClick","lang","main","quantity","useStyles","image","width","date","textTransform","clampToTwoLines","display","WebkitLineClamp","overflow","textDecoration","HighlightedPromotion","styles","img","src","alt","url","href","Link","Hidden","mdDown","shortDescription","highlighted","actionButton","EmptyPage","logo","practice","practice_name","logo2","Container","justifyContent","maxWidth","empty","logoAlt","minHeight","pt","textAlign","subtitle","getPromotionsByType","type","Promotions","items","ongoingPromotions","filter","p","status","highlightedPromotion","events","event","offers","offer","giveaways","giveaway","paddingTop","pl","component","breakpoint","usePhpJs","callback","global","window","phpJs","withPhpJs","getPhpJs","SxDiv","SxSpan","SxImg","urlJoin","urlPieces","strArray","Array","isArray","resultArray","match","first","shift","replace","i","push","str","join","parts","split","addQueryParams","params","options","base","existingQuery","parseOptions","stringifyOptions","removeQueryParams","queryObject","updatedQueryObject","Object","keys","resolveRoute","route","data","encode","encodeURIComponent"],"sourceRoot":""}