{"version":3,"sources":["components/CallToAction/validation.ts","components/CallToAction/StyledCallToAction.ts","components/CallToAction/index.tsx"],"names":["callToActionFieldValidators","field","errorMessage","required","validators","isValidLink","ctaLink","jss","allowRenderOnError","componentProps","rendering","params","variant","links","length","CTA","styled","div","theme","callToAction","backgroundColor","color","css","borderColor","spacing","p","normal","borderRadius","nextBestAction","shadows","elevation4","mq","Heading","Text","$variant","headingH2","headingH4","Description","textBody2","mt","mb","xs","md","TextWrapper","LinkWrapper","linkWrapper","multiLink","ml","LinkItem","Link","linkStyle","colors","link","white","textBody1","iconColor","LinkButton","button","linkButton","pathFillColor","LinkList","ul","listReset","pr","ITBLabel","h5","fixedBody12","StyledLink","a","safeFocusRemoval","text","interactive1","outline","focusColor","ITBLink","interactive1Hover","compose","withDataSourceValidation","withDigitalDataContext","withSitecoreContext","withEditMode","withCoveoNoIndexTags","digitalData","editMode","setDigitalData","sitecoreContext","isCorporate","isCorporateSite","headingLevel","uid","description","title","fields","data","datasource","isAuthenticated","authenticatedContent","validatedLinks","filter","getCTAButtons","map","ctaButtonText","value","className","id","AuthenticatedContentIcon","iconStyleConfig","iconSize","mr","top","renderField","tag","join","tabIndex","handleClick","firstLink","onClick","e","href","fallbackTitle","linkTheme","linkSize","key","renderLinks","name","destination","setObjectData","linkName","linkDestination","emitTrackEvent"],"mappings":"qNAKO,MAAMA,EAAwD,CACnE,CACEC,MAAO,wDACPC,aAAc,qCACdC,UAAU,GAEZ,CACEF,MAAO,yCACPC,aAAc,mCACdE,WAAY,CACTH,GAAUI,YAAYJ,aAAD,EAACA,EAAOK,QAAQC,OAG1C,CACEN,MAAO,mCACPC,aAAc,kGACdM,oBAAoB,EACpBJ,WAAY,CACV,CAACH,EAAOQ,KAAR,gBACiD,sBAA/CA,SAAA,UAAAA,EAAgBC,iBAAhB,mBAA2BC,cAA3B,eAAmCC,UACN,KAAzBX,SAAA,UAAAA,EAAOY,aAAP,eAAcC,Y,wFCLnB,MAAMC,EAAMC,UAAOC,IAA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UH,EACVI,gBAAiBH,GAEnB3C,IAGJ+C,YAAe","file":"static/js/CallToAction.0a4af71c.chunk.js","sourcesContent":["import { isValidLink } from '_utils/validationChecks';\r\nimport { SitecoreFieldValidator } from '_utils/validationChecks/definitions';\r\n\r\nimport { CallToActionProps } from './definitions'\r\n\r\nexport const callToActionFieldValidators: SitecoreFieldValidator[] = [\r\n {\r\n field: 'rendering.fields.data.datasource.links[0].ctaLink.jss',\r\n errorMessage: 'At least one link must be provided',\r\n required: true,\r\n },\r\n {\r\n field: 'rendering.fields.data.datasource.links',\r\n errorMessage: 'Some links are not set correctly',\r\n validators: [\r\n (field) => isValidLink(field?.ctaLink.jss)\r\n ],\r\n },\r\n {\r\n field: 'rendering.fields.data.datasource',\r\n errorMessage: 'The Next Best Action variant will only display the first link if multiple links have been added',\r\n allowRenderOnError: true,\r\n validators: [\r\n (field, componentProps: CallToActionProps) =>\r\n componentProps?.rendering?.params?.variant === 'Next Best Action'\r\n ? field?.links?.length === 1\r\n : true\r\n ],\r\n },\r\n];\r\n","import { Text } from '@sitecore-jss/sitecore-jss-react';\r\nimport styled, { css } from 'styled-components';\r\n\r\nimport { Link } from '_utils/components';\r\nimport {Link as Linking} from 'react-router-dom'\r\nimport { spacing } from '_utils/props';\r\nimport {\r\n button,\r\n fixedBody12,\r\n headingH2,\r\n headingH4,\r\n linkStyle,\r\n listReset,\r\n mq,\r\n safeFocusRemoval,\r\n svg,\r\n textBody1,\r\n textBody2,\r\n} from '_utils/styles';\r\n\r\nexport const CTA = styled.div`\r\n background-color: ${({ theme }) => theme?.callToAction?.backgroundColor};\r\n color: ${({ theme }) => theme.callToAction.color};\r\n display: flex;\r\n\r\n ${({ variant }) => {\r\n\r\n if (variant === 'InTheBlack') {\r\n return css`\r\n border-color: ${({ theme }) => theme.callToAction.borderColor};\r\n border-style: solid;\r\n border-width: 1px 0;\r\n flex-direction: column;\r\n ${({ theme }) => spacing({ theme, p: 3 })};\r\n `;\r\n }\r\n\r\n return variant === 'Normal'\r\n ? css`\r\n border-radius: ${({ theme }) => theme.callToAction.normal.borderRadius}px;\r\n flex-direction: column;\r\n `\r\n : css`\r\n border-radius: ${({ theme }) => theme.callToAction.nextBestAction.borderRadius}px;\r\n box-shadow: ${({ theme }) => theme.shadows.elevation4};\r\n flex-direction: column;\r\n justify-content: space-between;\r\n\r\n ${mq('md')} {\r\n align-items: center;\r\n flex-direction: row;\r\n }\r\n `\r\n }}\r\n\r\n ${({ theme }) => spacing({ theme, p: 3 })};\r\n`;\r\n\r\nexport const Heading = styled(Text)`\r\n color: ${({ theme }) => theme.callToAction.color};\r\n display: inline;\r\n\r\n ${({ $variant }) =>\r\n $variant === 'Normal'\r\n ? css`\r\n ${headingH2};\r\n `\r\n : css`\r\n ${headingH4};\r\n `\r\n }\r\n`;\r\n\r\nexport const Description = styled.p`\r\n ${textBody2};\r\n\r\n ${({ theme }) => spacing({ theme, mt: 1 })};\r\n\r\n ${({ variant }) =>\r\n variant === 'Next Best Action' && css`\r\n ${({ theme }) => spacing({ theme, mb: { xs: 3, md: 0 } })};\r\n `\r\n }\r\n`;\r\n\r\nexport const TextWrapper = styled.div``;\r\n\r\nexport const LinkWrapper = styled.div`\r\n color: ${({ theme }) => theme.callToAction.linkWrapper.color};\r\n\r\n ${({ multiLink, variant }) => {\r\n // InTheBlack\r\n if (variant === 'InTheBlack') {\r\n return css`\r\n ${({ theme }) => spacing({ theme, mt: 1 })};\r\n `;\r\n }\r\n // Corporate\r\n if (!multiLink) {\r\n return css`\r\n ${variant === 'Next Best Action'\r\n ? css`\r\n ${({ theme }) => spacing({ theme, ml: { xs: 0, md: 4 } })};\r\n `\r\n : css`\r\n ${mq('md')} {\r\n display: flex;\r\n justify-content: flex-end;\r\n }\r\n `\r\n }\r\n `;\r\n }\r\n }}\r\n`;\r\n\r\nexport const LinkItem = styled(Link)`\r\n a {\r\n ${({ theme }) => linkStyle(theme.colors.link.white)};\r\n ${textBody1};\r\n text-decoration: none;\r\n\r\n svg {\r\n transform: scale(1.1);\r\n }\r\n\r\n path {\r\n fill: ${({ theme }) => theme.callToAction.iconColor};\r\n }\r\n }\r\n`;\r\n\r\nexport const LinkButton = styled(Link)`\r\n a {\r\n ${({ variant }) =>\r\n variant === 'Normal'\r\n ? css`\r\n ${button('default', 'primary')};\r\n `\r\n : css`\r\n ${button('default', 'tertiaryDark')};\r\n `\r\n }\r\n\r\n ${textBody1};\r\n\r\n margin-bottom: 0;\r\n min-width: 140px;\r\n white-space: nowrap;\r\n width: 100%;\r\n\r\n ${mq('md')} {\r\n width: auto;\r\n }\r\n\r\n path {\r\n fill: ${({ theme }) => theme.callToAction.linkButton.pathFillColor};\r\n }\r\n }\r\n`;\r\n\r\nexport const LinkList = styled.ul`\r\n ${listReset}\r\n\r\n ${mq('md')} {\r\n display: flex;\r\n flex-wrap: wrap;\r\n }\r\n\r\n li {\r\n position: relative;\r\n\r\n ${({ theme }) => spacing({ theme, mb: '12px' })};\r\n\r\n &:last-child {\r\n margin-bottom: 0;\r\n }\r\n\r\n ${mq('md')} {\r\n flex: 0 0 50%;\r\n max-width: 50%;\r\n\r\n &:nth-child(2n + 1) {\r\n ${({ theme }) => spacing({ theme, pr: 3 })};\r\n }\r\n\r\n &:nth-last-child(2) {\r\n margin-bottom:0;\r\n }\r\n }\r\n }\r\n`;\r\n\r\nexport const EditorDiv = styled.div``;\r\n\r\n// InTheBlack only elements\r\nexport const ITBLabel = styled.h5`\r\n ${fixedBody12}\r\n font-weight: bold;\r\n text-transform: uppercase;\r\n margin: 0;\r\n`;\r\n\r\nexport const StyledLink = styled.a`\r\n ${({ theme }) => linkStyle(theme.colors.link.white)};\r\n text-decoration: none;\r\n border: 1px solid ${({ theme }) => theme.callToAction.borderColor};\r\n border-radius: 50px;\r\n padding: 20px;\r\n font-weight: 700;\r\n box-shadow: ${({ theme }) => theme.shadows.elevation4};\r\n flex-direction: column;\r\n justify-content: space-between;\r\n\r\n ${mq('md')} {\r\n align-items: center;\r\n flex-direction: row;\r\n }\r\n svg {\r\n transform: scale(1.1);\r\n }\r\n\r\n path {\r\n fill: ${({ theme }) => theme.callToAction.iconColor};\r\n }\r\n\r\n &:hover {\r\n box-shadow: white 0px 0px 0px 3px;\r\n color: white;\r\n }\r\n\r\n &:focus {\r\n ${safeFocusRemoval}\r\n border: 0;\r\n color: ${({ theme }) => theme.colors.text.interactive1};\r\n display: block;\r\n outline-color: ${({ theme }) => theme?.callToAction?.outline?.focusColor};\r\n outline-style: solid;\r\n outline-width: 2px;\r\n text-decoration: none;\r\n }\r\n\r\n`;\r\n\r\nexport const ITBLink = styled(Link)`\r\n a {\r\n border-bottom: 0;\r\n color: ${({ theme }) => theme.colors.text.interactive1};\r\n font-weight: bold;\r\n text-decoration: none;\r\n ${textBody1}\r\n\r\n &:hover {\r\n color: ${({ theme }) => theme.colors.text.interactive1Hover};\r\n text-decoration: underline;\r\n }\r\n\r\n &:focus {\r\n ${safeFocusRemoval}\r\n border: 0;\r\n color: ${({ theme }) => theme.colors.text.interactive1};\r\n display: block;\r\n outline-color: ${({ theme }) => theme?.callToAction?.outline?.focusColor};\r\n outline-style: solid;\r\n outline-width: 2px;\r\n text-decoration: none;\r\n }\r\n\r\n }\r\n`;","import { Text } from '@sitecore-jss/sitecore-jss-react'\r\nimport { compose } from 'ramda'\r\nimport React from 'react'\r\nimport { withDataSourceValidation, withEditMode, withCoveoNoIndexTags, withSitecoreContext } from '_containers/BaseComponent'\r\nimport { withDigitalDataContext } from '_containers/DigitalDataContext';\r\nimport { LinkTrackingEvent } from '_containers/DigitalDataContext/definitions';\r\n\r\nimport { AuthenticatedContentIcon } from '_utils/components/AuthenticatedContentIcon';\r\nimport { emitTrackEvent, setObjectData } from '_utils/helpers/analytics';\r\nimport { isCorporateSite, renderField } from '_utils/helpers/render';\r\nimport { isValidLink } from '_utils/validationChecks'\r\n\r\nimport {\r\n CallToActionLink,\r\n CallToActionProps,\r\n CallToActionVariant,\r\n} from './definitions'\r\nimport { callToActionFieldValidators } from './validation'\r\n\r\nimport {\r\n CTA,\r\n Description,\r\n Heading,\r\n ITBLabel,\r\n ITBLink,\r\n LinkButton,\r\n LinkItem,\r\n LinkList,\r\n LinkWrapper,\r\n TextWrapper,\r\n StyledLink\r\n} from './StyledCallToAction'\r\n\r\nconst renderLinks = (links: CallToActionLink[], variant: CallToActionVariant, handleClick) => {\r\n\r\n const firstLink = links?.[0];\r\n\r\n // InTheBlack\r\n if (variant === \"InTheBlack\") {\r\n return (\r\n {\r\n handleClick(\r\n firstLink?.ctaLink?.jss?.value?.text ?? '',\r\n firstLink?.ctaLink?.jss?.value?.href,\r\n );\r\n }}\r\n >\r\n \r\n \r\n )\r\n }\r\n\r\n const getCTAButtons = links?.map((link) => link?.ctaButtonText?.jss?.value);\r\n\r\n if (links?.length === 1 && getCTAButtons.join('') === '' || variant === 'Next Best Action') {\r\n // Render a single button\r\n return (\r\n \r\n \r\n \r\n );\r\n }\r\n\r\n\r\n // if(getCTAButtons.join('') !== '') {\r\n // return (\r\n // \r\n // \r\n // \r\n // )\r\n // }\r\n\r\n // Render a list of links if there are more links added\r\n return (\r\n \r\n \r\n {\r\n links?.map((link) => (\r\n \r\n \r\n \r\n ))\r\n }\r\n \r\n \r\n );\r\n};\r\n\r\nconst CallToAction: React.FC = ({\r\n digitalData,\r\n editMode,\r\n rendering,\r\n setDigitalData,\r\n sitecoreContext,\r\n}) => {\r\n const isCorporate = isCorporateSite(sitecoreContext);\r\n const headingLevel = rendering?.params?.headingLevel ?? \"h2\";\r\n const variant = isCorporate ? rendering?.params?.variant ?? 'Normal' : 'InTheBlack';\r\n const uid = rendering?.uid;\r\n\r\n const {\r\n description,\r\n links,\r\n title,\r\n } = rendering?.fields?.data?.datasource;\r\n const isAuthenticated = rendering?.fields?.data?.datasource?.authenticatedContent?.isAuthenticated ?? false;\r\n\r\n const validatedLinks =\r\n links?.filter((link) => editMode || isValidLink(link?.ctaLink?.jss));\r\n\r\n const getCTAButtons = links?.map((link) => link?.ctaButtonText?.jss?.value);\r\n\r\n // handle analytics\r\n const handleClick: LinkTrackingEvent = (name, destination) => {\r\n if (typeof setDigitalData === 'function') {\r\n\r\n setDigitalData(\r\n setObjectData(\r\n ['link'],\r\n {\r\n linkName: name,\r\n linkDestination: destination,\r\n },\r\n digitalData)\r\n );\r\n\r\n emitTrackEvent('linkClick');\r\n }\r\n }\r\n\r\n const normalVariantIconConfig = {\r\n xs: {\r\n iconSize: 24,\r\n mr: 10,\r\n top: 2\r\n },\r\n md: {\r\n iconSize: 32,\r\n mr: 10,\r\n top: 2\r\n },\r\n };\r\n const nextBestActionVariantIconConfig = {\r\n xs: {\r\n iconSize: 18,\r\n mr: 10,\r\n top: 2\r\n },\r\n md: {\r\n iconSize: 20,\r\n mr: 10,\r\n top: 2\r\n },\r\n };\r\n\r\n return (\r\n 1}\r\n variant={variant}\r\n >\r\n \r\n {variant === 'Normal' &&\r\n \r\n }\r\n {variant === 'Next Best Action' &&\r\n \r\n }\r\n\r\n {\r\n isCorporate ?\r\n // Corporate\r\n renderField(\r\n editMode,\r\n title?.jss,\r\n \r\n )\r\n :\r\n // InTheBlack\r\n (\r\n {title?.jss?.value}\r\n )\r\n }\r\n {\r\n // description only shown on Corporate site\r\n isCorporate &&\r\n renderField(\r\n editMode,\r\n description?.jss,\r\n \r\n \r\n \r\n )\r\n }\r\n \r\n {getCTAButtons.join() === 'Change Privacy Preferences' ? \r\n ( \r\n {getCTAButtons.join()}\r\n \r\n )\r\n\r\n : renderLinks(validatedLinks, variant, handleClick) }\r\n \r\n );\r\n};\r\n\r\nexport default compose(\r\n withDataSourceValidation(callToActionFieldValidators),\r\n withDigitalDataContext,\r\n withSitecoreContext(),\r\n withEditMode,\r\n withCoveoNoIndexTags\r\n)(CallToAction);\r\n"],"sourceRoot":""}