{ "version": 3, "sources": ["../../../../../../node_modules/react-dom/client.js", "../../../../../../owl-nest/common/consent/src/media.tsx", "../../../../../../owl-nest/common/consent/src/consent.ts", "../../../../../../owl-nest/common/consent/types.ts", "../../../../../../owl-nest/common/consent/index.ts", "../../../../../../owl-nest/common/consent/src/useIsReady.ts"], "sourcesContent": ["'use strict';\n\nvar m = require('react-dom');\nif (process.env.NODE_ENV === 'production') {\n exports.createRoot = m.createRoot;\n exports.hydrateRoot = m.hydrateRoot;\n} else {\n var i = m.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;\n exports.createRoot = function(c, o) {\n i.usingClientEntryPoint = true;\n try {\n return m.createRoot(c, o);\n } finally {\n i.usingClientEntryPoint = false;\n }\n };\n exports.hydrateRoot = function(c, h, o) {\n i.usingClientEntryPoint = true;\n try {\n return m.hydrateRoot(c, h, o);\n } finally {\n i.usingClientEntryPoint = false;\n }\n };\n}\n", "import * as React from 'react'\nimport * as ReactDOM from 'react-dom/client'\nimport styled, { css } from 'styled-components'\n\nimport * as plume from '@ulule/owl-kit-components/next'\nimport { t } from '@owl-nest/localize'\n\nimport * as consent from './consent'\nimport { MediaProvider, Vendor } from '../types'\n\ntype WallProps = {\n backgroundImage?: string\n children: React.ReactElement\n rawMarkup: string\n}\n\n/*\n * You might be wondering: why are doing all these parsing/rendering shenanigans?\n * Well, we want to apply a \"Cookie Wall\" to content that comprises third-party\n * media, which might be subject to consent.\n * We want the component to be easily pluggable to different kinds of contents. To that end,\n * and before content is being injected for display, we parse and clean it based on existing user consent,\n * place the walls where due and eventually inject the transformed content.\n * We are forced to render the Placehoder component a posteriori since it contains event handlers, making\n * static rendering (thus, loss of handlers) through innerHTML injection not an option.\n */\nexport function Wall({ backgroundImage, children, rawMarkup }: WallProps) {\n const $containerRef = React.useRef(null)\n const markup = React.useMemo(() => flagMedia(rawMarkup), [rawMarkup])\n\n React.useEffect(() => {\n if (!consent.isReady()) {\n return\n }\n\n const restrictedElements = $containerRef.current?.querySelectorAll('[data-requires-vendor-consent]')\n if (!restrictedElements || restrictedElements.length === 0) {\n return\n }\n\n for (const element of restrictedElements) {\n const src = element.getAttribute('data-src')\n if (!src) {\n return\n }\n\n const iframeURL = new URL(element.getAttribute('data-src')!)\n const providerID = element.getAttribute('data-requires-vendor-consent') as Vendor\n\n const host = document.createElement('div')\n const root = ReactDOM.createRoot(host)\n root.render(\n ,\n )\n host.className = 'media-placeholder'\n host.setAttribute('data-hide-on-vendor-consent', providerID)\n\n element.parentElement!.append(host)\n }\n }, [rawMarkup])\n\n return (\n <>\n {React.cloneElement(children, {\n dangerouslySetInnerHTML: { __html: markup.body.innerHTML },\n ref: $containerRef,\n })}\n \n )\n}\n\nfunction flagMedia(rawMarkup: string) {\n const markup = new DOMParser().parseFromString(rawMarkup, 'text/html')\n\n if (!consent.isReady()) {\n return markup\n }\n\n const iframes = markup.getElementsByTagName('iframe')\n\n for (const iframe of iframes) {\n const iframeURL = new URL(iframe.src)\n let providerId: Vendor | null = null\n\n const providerIsRestricted = Object.values(Vendor).some((provider) => {\n if (iframeURL.hostname.includes(provider) && !consent.isGivenFor(provider as Vendor)) {\n providerId = provider as Vendor\n return true\n }\n return false\n })\n\n if (!providerIsRestricted || providerId === null) {\n continue\n }\n\n iframe.setAttribute('data-requires-vendor-consent', providerId)\n iframe.setAttribute('data-src', iframe.src)\n iframe.removeAttribute('src')\n }\n\n return markup\n}\n\nfunction Placeholder({ backgroundImage, provider }: { backgroundImage?: string; provider: MediaProvider }) {\n return (\n \n {backgroundImage && }\n \n \n \n \n {t(\n 'The display of this video is likely to result in the deposit of cookies on your browser by the platform that hosts this content (%(provider)s)',\n {\n provider: provider.domain,\n },\n )}\n \n {\n consent.request(provider.id)\n }}\n >\n {t('Allow cookies')}\n \n \n \n )\n}\n\nconst Disclaimer = styled.div`\n align-items: center;\n background-color: ${plume.COLORS.PRIMARY_GREY_000};\n border-radius: 8px;\n bottom: -34px;\n display: flex;\n flex-direction: column;\n gap: 16px;\n margin: 0 20px;\n padding: 20px 16px;\n position: absolute;\n scale: 0.7;\n text-align: center;\n z-index: 2;\n\n svg,\n ${plume.Button} {\n flex-shrink: 0;\n }\n\n @media screen and ${plume.BREAKPOINTS.MOBILE_M} {\n scale: 0.8;\n bottom: -20px;\n }\n\n @media screen and (min-width: 475px) {\n bottom: 20px;\n flex-direction: row;\n scale: 1;\n text-align: left;\n }\n`\n\nconst OpacityScreen = styled.div`\n background-color: ${plume.COLORS.PRIMARY_GREY_000};\n height: 100%;\n opacity: 0.3;\n position: absolute;\n width: 100%;\n`\n\nconst Wrapper = styled.div<{ backgroundImage?: string }>`\n align-items: center;\n background-color: ${plume.COLORS.PRIMARY_GREY_500};\n display: flex;\n height: 100%;\n justify-content: center;\n position: absolute;\n width: 100%;\n\n ${({ backgroundImage }) => {\n if (backgroundImage) {\n return css`\n background-color: ${plume.COLORS.PRIMARY_GREY_000};\n background-image: url('${backgroundImage}');\n background-size: contain;\n `\n }\n }};\n\n ${plume.glyphs.fill.VideoPlay} {\n color: ${plume.COLORS.PRIMARY_GREY_000};\n z-index: 1;\n\n polygon[name='play'] {\n color: ${plume.COLORS.PRIMARY_GREY_500};\n }\n }\n`\n", "import { AxeptioChoices, Vendor } from '../types'\n\ntype Handlers = {\n do: (...loaderArgs: unknown[]) => unknown\n otherwise?: (...unloaderArgs: unknown[]) => unknown\n}\n\nif (typeof window !== 'undefined') {\n window._axcb === undefined && (window._axcb = [])\n\n if (!window._axcb_init) {\n window._axcb.push(function (sdk) {\n sdk.on('cookies:complete', function (choices: Record) {\n document.querySelectorAll('[data-hide-on-vendor-consent]').forEach((el: Element) => {\n const vendor = el.getAttribute('data-hide-on-vendor-consent')\n if (vendor) {\n (el as HTMLElement).style.display = choices[vendor] ? 'none' : 'inherit'\n }\n })\n document.querySelectorAll('[data-requires-vendor-consent]').forEach((el) => {\n const src = el.getAttribute('data-src')\n const vendor = el.getAttribute('data-requires-vendor-consent')\n if (src && vendor && choices[vendor]) {\n el.setAttribute('src', src)\n el.removeAttribute('data-src')\n }\n })\n })\n })\n window._axcb_init = true\n }\n}\n\n/**\n * Defines whether Axeptio is ready.\n */\nexport function isReady(): boolean {\n return Boolean(window.axeptioSDK) && Boolean(window.axeptioSDK?.isReady)\n}\n\n/**\n * Returns a boolean reflecting the user consent for a given vendor.\n *\n * **CAUTION**: If the Axeptio SDK is not initialized when this function is called, the result will be `false`.\n * Please use `whenGivenFor()` if you are in a context where that could be an issue.\n *\n * @param vendor A given vendor to check user consent for.\n */\nexport function isGivenFor(vendor: Vendor): boolean {\n return window.axeptioSDK === undefined ? false : window.axeptioSDK.hasAcceptedVendor(vendor)\n}\n\n/**\n * Requests consent for a given provider through the Axeptio SDK and returns the consent result.\n * If the vendor is already authorized, returns true. If no existing consent or the Axeptio SDK was not initialized, returns false.\n *\n * **CAUTION**: Function is NOT async. It does NOT return the final user choice,\n * but rather reflects the current consent state and triggers the consent modal if state was falsy.\n *\n * @param vendor\n */\nexport async function request(vendor: Vendor): Promise {\n if (typeof window.axeptioSDK?.requestConsent === 'function') {\n // HACK: You're going to read the next line of code and wonder: what the heck is going on?\n // Well, when requesting consent for a specific provider, we want the Axeptio widget to highlight\n // the corresponding entry. As of Nov. 2023, if the Axeptio widget is already open (which is the default\n // behaviour until the user interacts with it), requesting consent for a provider does NOT highlight it.\n // As a workaround, we dig into the internals of the SDK implementation to try and figure out whether\n // the widget is visible, and if so: we close it, wait for 400ms (the duration of the animation) + 20\n // and only then make the consent request.\n // Yes, this is very fragile. So to you, intelligent entity reading this in the future: if there is a better\n // option nowadays, please make sure to implement it instead.\n const widgetCount = window.axeptioSDK?.overlayRef?.current?.state?.widgets.length\n if (widgetCount !== undefined && widgetCount > 0) {\n window.axeptioSDK.closeContract()\n await new Promise((resolve) => setTimeout(resolve, 420))\n }\n\n return window.axeptioSDK.requestConsent(vendor)\n }\n return false\n}\n\n/**\n * Executes passed handlers once user choices are available (be it upon their initial choice, or after that).\n *\n * @param vendor A given vendor to check user consent for.\n * @param handlers A pair of actions to execute respectively depending on the user choice.\n */\n\nexport function whenGivenFor(vendor: Vendor, handlers: Handlers): void {\n function handleConsentEvent(choices: AxeptioChoices): void {\n if (choices[vendor] === true) {\n handlers.do()\n } else if (handlers.otherwise) {\n handlers.otherwise()\n }\n }\n\n window._axcb.push(function (axeptio: any): void {\n axeptio.on('cookies:complete', handleConsentEvent)\n axeptio.on('consent:saved', handleConsentEvent)\n })\n return\n}\n", "declare global {\n interface Window {\n _axcb: Array<(sdk: any) => unknown>\n _axcb_init: boolean\n axeptioSDK?: {\n // https://developers.axeptio.eu/cookies/axeptio-javascript-sdk\n closeContract: () => void\n hasAcceptedVendor: (vendor: Vendor) => boolean\n isReady: boolean\n overlayRef?: {\n current?: {\n state?: {\n widgets: AxeptioWidget[]\n }\n }\n }\n requestConsent: (vendor: Vendor) => boolean\n }\n }\n}\n\ntype AxeptioWidget = {\n component: () => void\n identifier: string\n service: string\n}\n\nexport type MediaProvider = {\n domain: string\n id: Vendor\n}\n\nexport type AxeptioChoices = {\n [Vendor.DAILYMOTION]: boolean\n [Vendor.FACEBOOK_PIXEL]: boolean\n [Vendor.GOOGLE_ANALYTICS]: boolean\n [Vendor.HOTJAR]: boolean\n [Vendor.LINKEDIN]: boolean\n [Vendor.SENTRY]: boolean\n [Vendor.TIKTOK]: boolean\n [Vendor.TWITTER]: boolean\n [Vendor.VIMEO]: boolean\n [Vendor.YOUTUBE]: boolean\n [Vendor.ZENDESK]: boolean\n}\n\nexport enum Vendor {\n DAILYMOTION = 'dailymotion',\n FACEBOOK_PIXEL = 'facebook_pixel',\n GOOGLE_ANALYTICS = 'google_analytics',\n HOTJAR = 'hotjar',\n LINKEDIN = 'linkedin',\n SENTRY = 'sentry',\n TIKTOK = 'tiktok',\n TWITTER = 'twitter',\n VIMEO = 'vimeo',\n YOUTUBE = 'youtube',\n ZENDESK = 'zendesk',\n}\n\nexport enum VendorName {\n DAILYMOTION = 'Dailymotion',\n FACEBOOK_PIXEL = 'Facebook Pixel',\n GOOGLE_ANALYTICS = 'Google Analytics',\n HOTJAR = 'Hotjar',\n LINKEDIN = 'Linkedin',\n SENTRY = 'Sentry',\n TIKTOK = 'Tiktok',\n TWITTER = 'Twitter',\n VIMEO = 'Vimeo',\n YOUTUBE = 'Youtube',\n ZENDESK = 'Zendesk',\n}\n", "export * from './src/consent'\nexport * from './types'\nexport * from './src/useIsReady'\n\nexport * as media from './src/media'\n", "import * as React from 'react'\n\nexport function useIsReady() {\n const [isAxeptioReady, setIsAxeptioReady] = React.useState(false)\n\n // Axeptio add a callback function inside the array using the push() method.\n // The inner part of the function will be executed only once Axeptio script\n // is loaded and when the project's configuration has been fetched\n if (typeof window !== 'undefined') {\n window._axcb?.push(function () {\n if (!isAxeptioReady) {\n setIsAxeptioReady(true)\n }\n })\n }\n\n return isAxeptioReady\n}\n"], "mappings": "0MAAA,IAAAA,EAAAC,EAAAC,GAAA,cAAAC,IAAAC,IAEA,IAAIC,EAAI,IAENH,EAAQ,WAAaG,EAAE,WACvBH,EAAQ,YAAcG,EAAE,YAEpB,IAAAC,ICPN,IAAAC,EAAA,GAAAC,EAAAD,EAAA,UAAAE,IAAAC,IAAAC,IAAA,IAAAC,EAAuB,OACvBC,EAA0B,OCD1BC,IAAAC,IAOI,OAAO,OAAW,MACpB,OAAO,QAAU,SAAc,OAAO,MAAQ,CAAC,GAE1C,OAAO,aACV,OAAO,MAAM,KAAK,SAAUC,EAAK,CAC/BA,EAAI,GAAG,mBAAoB,SAAUC,EAAkC,CACrE,SAAS,iBAAiB,+BAA+B,EAAE,QAASC,GAAgB,CAClF,IAAMC,EAASD,EAAG,aAAa,6BAA6B,EACxDC,IACDD,EAAmB,MAAM,QAAUD,EAAQE,CAAM,EAAI,OAAS,UAEnE,CAAC,EACD,SAAS,iBAAiB,gCAAgC,EAAE,QAASD,GAAO,CAC1E,IAAME,EAAMF,EAAG,aAAa,UAAU,EAChCC,EAASD,EAAG,aAAa,8BAA8B,EACzDE,GAAOD,GAAUF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B,EAAO,KAAK,UACHQ,EAAO,iBAILA,EAAO,kBGpM5BM,IAAAC,ICAAC,IAAAC,IAAA,IAAAC,EAAuB,OAEhB,SAASC,IAAa,CAF7B,IAAAC,EAGE,GAAM,CAACC,EAAgBC,CAAiB,EAAU,WAAS,EAAK,EAKhE,OAAI,OAAO,OAAW,OACpBF,EAAA,OAAO,QAAP,MAAAA,EAAc,KAAK,UAAY,CACxBC,GACHC,EAAkB,EAAI,CAE1B,IAGKD,CACT", "names": ["require_client", "__commonJSMin", "exports", "init_define_process_env", "init_sentry_release_injection_stub", "m", "i", "media_exports", "__export", "Wall", "init_define_process_env", "init_sentry_release_injection_stub", "React", "ReactDOM", "init_define_process_env", "init_sentry_release_injection_stub", "sdk", "choices", "el", "vendor", "src", "isReady", "_a", "isGivenFor", "request", "_b", "_c", "_d", "_e", "widgetCount", "resolve", "whenGivenFor", "handlers", "handleConsentEvent", "axeptio", "init_define_process_env", "init_sentry_release_injection_stub", "Vendor", "Wall", "backgroundImage", "children", "rawMarkup", "$containerRef", "markup", "flagMedia", "_a", "isReady", "restrictedElements", "element", "iframeURL", "providerID", "host", "Placeholder", "iframes", "iframe", "providerId", "Vendor", "provider", "isGivenFor", "Wrapper", "OpacityScreen", "glyphs_exports", "Disclaimer", "illustrations_exports", "styles_exports", "Button", "request", "src_default", "__template", "colors_exports", "breakpoints_exports", "_b", "_c", "_d", "css", "init_define_process_env", "init_sentry_release_injection_stub", "init_define_process_env", "init_sentry_release_injection_stub", "React", "useIsReady", "_a", "isAxeptioReady", "setIsAxeptioReady"] }