{"version":3,"sources":["webpack:///./src/components/common/SvgImage/index.tsx","webpack:///./src/core/config/index.ts","webpack:///./src/utilities/browser.ts","webpack:///./src/components/common/SharePane/index.tsx"],"names":["title","reference","ariaHidden","className","aria-hidden","xlinkHref","config","env","apiUrl","webSettings","baseUrl","webUrl","storybookApi","localizations","shareConfig","key","id","shareUrl","mobileOnly","cookieConfig","cookiePolicy","cookiePolicyExpirationDays","xsrfRequestToken","insertUrlParam","value","includeHash","history","pushState","searchParams","URLSearchParams","window","location","search","set","newurl","protocol","host","pathname","toString","hash","path","getUrlParamValue","Object","entries","hashes","slice","indexOf","split","params","map","val","decodeURIComponent","getAllUrlParams","href","filter","param","isMobile","test","navigator","scrollIntoView","elemToScrollTo","behaviour","MSInputMethodContext","document","behavior","isPortrait","image","file","details","height","sharePlatforms","isVertical","urlOverride","openShareDialog","url","platform","open","getBaseShareUrl","find","handleDesktopClick","event","preventDefault","replace","encodeURIComponent","share","currentTarget","dataset","sharePlatform","onClick","data-platform","handleMobileClick"],"mappings":"0FAAA,WAuBe,IAdE,SAAC,G,IAChBA,EAAK,QACLC,EAAS,YACTC,EAAU,aACVC,EAAS,YACU,OACnB,uBAAKA,UAAWA,EAAWC,cAAaF,GACrCF,GACC,6BAAQA,GAEV,uBAAKK,UAAWJ,O,gCCIpB,sGAAO,IAAMK,EAA2B,CACtCC,IAAK,MACLC,OAAWC,YAAYC,QAAU,MACjCC,OAAQF,YAAYC,QACpBE,aAAoC,OACpCC,cAAeJ,YAAYI,eAShBC,EAAqC,CAChD,CACEC,IAAK,EACLC,GAAI,WACJC,SAAU,gDACVC,YAAY,GAEd,CACEH,IAAK,EACLC,GAAI,UACJC,SAAU,wCACVC,YAAY,GAEd,CACEH,IAAK,EACLC,GAAI,WACJC,SAAU,wBACVC,YAAY,GAEd,CACEH,IAAK,EACLC,GAAI,WACJC,SAAU,KACVC,YAAY,IAIHC,EAA6B,CACxCC,aAAc,WACdC,2BAA4B,GAC5BC,iBAAkB,uB,weCtDd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A,KAC7E,gBAAC,IAAD,CAAU1F,MAAM,QAAQC,UAAU,gBAClC,wBAAME,UAAU,mBAAmB","file":"habitat.40.component.js","sourcesContent":["import * as React from 'react';\r\n\r\ninterface SvgImageProps {\r\n title?: string;\r\n reference: string;\r\n ariaHidden?: boolean;\r\n className?: string;\r\n}\r\n\r\nconst SvgImage = ({\r\n title,\r\n reference,\r\n ariaHidden,\r\n className,\r\n}: SvgImageProps) => (\r\n \r\n {title && (\r\n {title}\r\n )}\r\n \r\n \r\n);\r\n\r\nexport default SvgImage;\r\n","import LocalizationsState from '../typings/localization';\r\n\r\ndeclare const Config: AppConfiguration;\r\n\r\ndeclare const webSettings: {\r\n baseUrl: string;\r\n localizations: LocalizationsState;\r\n};\r\nexport interface AppConfiguration {\r\n env: string;\r\n apiUrl: string;\r\n webUrl: string;\r\n storybookApi?: string;\r\n localizations: LocalizationsState;\r\n}\r\n\r\nexport interface SharePlatformDetail {\r\n key: number;\r\n id: string;\r\n shareUrl: string | null;\r\n mobileOnly: boolean;\r\n}\r\n\r\nexport const config: AppConfiguration = {\r\n env: Config.env,\r\n apiUrl: `${webSettings.baseUrl}${Config.apiUrl}`,\r\n webUrl: webSettings.baseUrl,\r\n storybookApi: Config.storybookApi ? Config.storybookApi : undefined,\r\n localizations: webSettings.localizations,\r\n};\r\n\r\nexport interface CookieConfig {\r\n cookiePolicy: string;\r\n cookiePolicyExpirationDays: number;\r\n xsrfRequestToken: string;\r\n}\r\n\r\nexport const shareConfig: SharePlatformDetail[] = [\r\n {\r\n key: 1,\r\n id: 'facebook',\r\n shareUrl: 'https://www.facebook.com/sharer/sharer.php?u=',\r\n mobileOnly: false,\r\n },\r\n {\r\n key: 2,\r\n id: 'twitter',\r\n shareUrl: 'https://twitter.com/intent/tweet?url=',\r\n mobileOnly: false,\r\n },\r\n {\r\n key: 3,\r\n id: 'whatsapp',\r\n shareUrl: 'whatsapp://send?text=',\r\n mobileOnly: true,\r\n },\r\n {\r\n key: 4,\r\n id: 'copylink',\r\n shareUrl: null,\r\n mobileOnly: false,\r\n },\r\n];\r\n\r\nexport const cookieConfig: CookieConfig = {\r\n cookiePolicy: 'c_policy',\r\n cookiePolicyExpirationDays: 60,\r\n xsrfRequestToken: 'XSRF-REQUEST-TOKEN',\r\n};\r\n","import { Image } from '../typings/index';\r\n\r\ndeclare global {\r\n interface Document {\r\n documentMode?: any;\r\n }\r\n}\r\n\r\nconst isIE = () => (\r\n !!window.MSInputMethodContext && !!document.documentMode\r\n);\r\n\r\n// Insert url param\r\nconst insertUrlParam = (key: string, value: string, includeHash?: boolean) => {\r\n // @ts-ignore\r\n if (history.pushState) {\r\n const searchParams = new URLSearchParams(window.location.search);\r\n searchParams.set(key, value);\r\n let newurl = `${window.location.protocol}//${window.location.host}${window.location.pathname}?${searchParams.toString()}`;\r\n if (includeHash && window.location.hash) {\r\n newurl = `${newurl}${window.location.hash}`;\r\n }\r\n window.history.pushState({ path: newurl }, '', newurl);\r\n }\r\n};\r\n\r\n// Removes all query string entires\r\nconst removeAllQueryStrings = () => {\r\n const url = window.location.href.replace(/(\\?.*)|(@.*)/g, '');\r\n window.history.pushState({ path: url }, '', url);\r\n};\r\n\r\n// Get All url params\r\nconst getAllUrlParams = (search: string) => {\r\n const hashes = search.slice(search.indexOf('?') + 1).split('&');\r\n const params: { [key: string]: string } = {};\r\n hashes.map((hash) => {\r\n const [key, val] = hash.split('=');\r\n params[key] = decodeURIComponent(val);\r\n return true;\r\n });\r\n return params;\r\n};\r\n\r\n// Get param value\r\nconst getUrlParamValue = (key: any) => {\r\n const search = Object.entries(getAllUrlParams(window.location.href)).filter((param) => (\r\n param[0] === key\r\n ));\r\n return search[0] ? search[0][1] : null;\r\n};\r\n\r\n// Script exists in head of document.\r\n// Taken from: https://github.com/kaimallea/isMobile\r\nconst isMobile = () => (\r\n /Mobi/.test(navigator.userAgent)\r\n);\r\n\r\nconst scrollIntoView = (elemToScrollTo: HTMLElement, behaviour: ScrollBehavior) => {\r\n if (!isIE()) {\r\n elemToScrollTo.scrollIntoView({\r\n behavior: behaviour,\r\n });\r\n }\r\n};\r\n\r\nconst isPortrait = (image: Image) => (\r\n // @ts-ignore\r\n (image.file.details.image.height > image.file.details.image.width)\r\n);\r\n\r\nconst elementInViewport = (el: any) => {\r\n let top = el.offsetTop;\r\n let left = el.offsetLeft;\r\n const width = el.offsetWidth;\r\n const height = el.offsetHeight;\r\n\r\n while (el.offsetParent) {\r\n // eslint-disable-next-line no-param-reassign\r\n el = el.offsetParent;\r\n top += el.offsetTop;\r\n left += el.offsetLeft;\r\n }\r\n\r\n return (\r\n top >= window.pageYOffset\r\n && left >= window.pageXOffset\r\n && (top + height) <= (window.pageYOffset + window.innerHeight)\r\n && (left + width) <= (window.pageXOffset + window.innerWidth)\r\n );\r\n};\r\n\r\nconst toDataURL = (url: string, callback: Function) => {\r\n const xhr = new XMLHttpRequest();\r\n xhr.onload = () => {\r\n const reader = new FileReader();\r\n reader.onloadend = () => {\r\n if (callback) {\r\n callback(reader.result);\r\n }\r\n };\r\n reader.readAsDataURL(xhr.response);\r\n };\r\n xhr.open('GET', url);\r\n xhr.responseType = 'blob';\r\n xhr.send();\r\n};\r\n\r\nexport {\r\n insertUrlParam,\r\n getAllUrlParams,\r\n getUrlParamValue,\r\n removeAllQueryStrings,\r\n isMobile,\r\n scrollIntoView,\r\n isPortrait,\r\n elementInViewport,\r\n toDataURL,\r\n};\r\n","import * as React from 'react';\r\nimport { shareConfig, SharePlatformDetail } from '../../../core/config';\r\nimport { isMobile } from '../../../utilities/browser';\r\nimport SvgImage from '../SvgImage';\r\nimport SharePaneProps from './type';\r\nimport './styles.scss';\r\n\r\nconst SharePane = ({\r\n sharePlatforms,\r\n isVertical,\r\n urlOverride,\r\n}: SharePaneProps) => {\r\n const openShareDialog = (url: string, platform: string) => {\r\n const strWindowFeatures = 'resizable=yes,scrollbars=yes,status=yes,height=500,width=800';\r\n window.open(url, `Share on ${platform}`, strWindowFeatures);\r\n };\r\n\r\n const getBaseShareUrl = (platform: string) => (\r\n shareConfig.find(({ id }) => id === platform)\r\n )?.shareUrl;\r\n\r\n const share = (platform: SharePlatformDetail) => {\r\n let url = window.location.href;\r\n const title = document.title.replace('|', ' ');\r\n\r\n if (urlOverride) {\r\n url = urlOverride;\r\n }\r\n\r\n switch (platform.id) {\r\n case 'facebook':\r\n openShareDialog(`${getBaseShareUrl(platform.id)}${encodeURIComponent(url)}`, platform.id);\r\n break;\r\n case 'twitter':\r\n openShareDialog(`${getBaseShareUrl(platform.id)}${url}&text=${title}`, platform.id);\r\n break;\r\n case 'whatsapp':\r\n window.location.href = `${getBaseShareUrl(platform.id)}${title} | ${url}`;\r\n break;\r\n case 'copylink':\r\n // copyToClipBoard(url, () => {\r\n // /* eslint-disable-next-line */\r\n // alert('Link copied!');\r\n // });\r\n break;\r\n default:\r\n break;\r\n }\r\n };\r\n\r\n const handleDesktopClick = (event: React.MouseEvent) => {\r\n event.preventDefault();\r\n const platform: SharePlatformDetail = shareConfig.find(\r\n ({ id }) => id === event.currentTarget.dataset.platform,\r\n ) || shareConfig[0];\r\n share(platform);\r\n };\r\n\r\n const handleMobileClick = (event: React.MouseEvent) => {\r\n event.preventDefault();\r\n navigator.share({ url: window.location.href });\r\n };\r\n\r\n return (\r\n
\r\n
    \r\n {sharePlatforms.map((sharePlatform) => (\r\n \r\n {(!sharePlatform?.mobileOnly || (sharePlatform.mobileOnly && isMobile())) && (\r\n
  • \r\n ) => handleDesktopClick(event)\r\n }\r\n data-platform={sharePlatform.id}\r\n >\r\n \r\n \r\n {sharePlatform.id}\r\n \r\n \r\n
  • \r\n )}\r\n
    \r\n ))}\r\n {navigator && typeof navigator.share === 'function' && (\r\n
  • \r\n \r\n
  • \r\n )}\r\n
\r\n
\r\n );\r\n};\r\n\r\nexport default SharePane;\r\n"],"sourceRoot":""}