{"version":3,"file":"192.96c13f6fbaebbbd7.js","mappings":"kHAEO,MAAMA,EAAsBC,MAC/BC,EACAC,EACAC,EAAW,cAELC,EAAAA,EAAAA,IAAM,kBAAkB,CAC1BC,SAAUJ,EAAMK,UAAUC,eACpBN,EAAMK,UAAUC,eAChBN,EAAMO,YACZC,WAAYP,EACZQ,iBAAkBC,OAAOC,SAASC,KAClCC,YAAa,IACLb,EAAMK,UAAUS,OAAS,CAAEA,MAAOd,EAAMK,UAAUS,OACtDC,SAAUf,EAAMK,UAAUU,SAC1BC,aAAcC,SAASC,MACvBC,YAAanB,EAAMK,UAAUe,MAAMC,KAAKC,GAAMA,EAAEC,UAChDC,aAAc,iBAGlBC,UAAW,IACHvB,GAAYA,EAASwB,OAAS,CAAEC,GAAIzB,EAASwB,UAC7CxB,GAAYA,EAAS0B,WAAa,CAAEC,GAAI3B,EAAS0B,cACjD1B,GAAYA,EAAS4B,UAAY,CAAEC,GAAI7B,EAAS4B,aAChD5B,GACAA,EAAS8B,aAAe,CAAEC,GAAI/B,EAAS8B,gBAG9CE,MAAMC,GAAaA,EAASC,SAC5BF,MAAMG,IACHC,QAAQC,IAAIF,EAAZ,IAEHG,OAAOC,IACAA,EAAMC,SACNJ,QAAQC,IAAIE,EAAMC,QACrB,GA7BT,C,uECJJ,MA8BA,EA9BoBC,KAChBC,EAAAA,EAAAA,YAAU,KACN,MAAMC,EAAc9C,gBACVD,EAAAA,EAAAA,GACFgD,KAAKC,MAAMJ,EAAM3C,OACjB2C,EAAM1C,UACN0C,EAAMK,SAAWF,KAAKC,MAAMJ,EAAMK,UAAY,KAHlD,EAOAtC,OAAOuC,WACPvC,OAAOuC,UAAUC,SACjBxC,OAAOuC,UAAUC,QAAQC,UAEzBN,IAEAnC,OAAO0C,iBACH,qBACArD,eAAgBsD,GACR3C,OAAOuC,UAAUC,QAAQC,WACzBN,GAEP,IACD,EAEP,GACF,IAEI,K","sources":["webpack:///./Scripts/Actions/Conversion.action.js","webpack:///./Scripts/Components/Conversion.js"],"sourcesContent":["import { post } from '../Services/http';\r\n\r\nexport const postConversionEvent = async (\r\n    event,\r\n    eventName,\r\n    cDetails = null\r\n) => {\r\n    await post(`/api/conversion`, {\r\n        event_id: event.ecommerce.transaction_id\r\n            ? event.ecommerce.transaction_id\r\n            : event.fb_event_id,\r\n        event_name: eventName,\r\n        event_source_url: window.location.href,\r\n        custom_data: {\r\n            ...(event.ecommerce.value && { value: event.ecommerce.value }),\r\n            currency: event.ecommerce.currency,\r\n            content_name: document.title,\r\n            content_ids: event.ecommerce.items.map((x) => x.item_id),\r\n            content_type: 'product_group',\r\n        },\r\n\r\n        user_data: {\r\n            ...(cDetails && cDetails.email && { em: cDetails.email }),\r\n            ...(cDetails && cDetails.firstName && { fn: cDetails.firstName }),\r\n            ...(cDetails && cDetails.lastName && { ln: cDetails.lastName }),\r\n            ...(cDetails &&\r\n                cDetails.phoneNumber && { ph: cDetails.phoneNumber }),\r\n        },\r\n    })\r\n        .then((response) => response.json())\r\n        .then((d) => {\r\n            console.log(d);\r\n        })\r\n        .catch((error) => {\r\n            if (error.message) {\r\n                console.log(error.message);\r\n            }\r\n        });\r\n};\r\n\r\nconst getCookieValue = (cname) => {\r\n    let name = cname + '=';\r\n    let decodedCookie = decodeURIComponent(document.cookie);\r\n    let ca = decodedCookie.split(';');\r\n    for (let i = 0; i < ca.length; i++) {\r\n        let c = ca[i];\r\n        while (c.charAt(0) == ' ') {\r\n            c = c.substring(1);\r\n        }\r\n        if (c.indexOf(name) == 0) {\r\n            return c.substring(name.length, c.length);\r\n        }\r\n    }\r\n    return '';\r\n};\r\n\r\nexport const cookieAccepted = () => {\r\n    const val = getCookieValue('cookie_consent_level');\r\n    if (val) {\r\n        const valObj = JSON.parse(val);\r\n        if (typeof valObj.targeting != 'undefined') {\r\n            return valObj.targeting;\r\n        }\r\n    }\r\n    return false;\r\n};\r\n","import React, { useEffect } from 'react';\r\nimport { postConversionEvent } from '../Actions/Conversion.action';\r\n\r\nconst Conversion = (props) => {\r\n    useEffect(() => {\r\n        const postFbEvent = async () => {\r\n            await postConversionEvent(\r\n                JSON.parse(props.event),\r\n                props.eventName,\r\n                props.customer ? JSON.parse(props.customer) : null\r\n            );\r\n        };\r\n        if (\r\n            window.Cookiebot &&\r\n            window.Cookiebot.consent &&\r\n            window.Cookiebot.consent.marketing\r\n        ) {\r\n            postFbEvent();\r\n        } else {\r\n            window.addEventListener(\r\n                'CookiebotOnAccept',\r\n                async function (e) {\r\n                    if (window.Cookiebot.consent.marketing) {\r\n                        postFbEvent();\r\n                    }\r\n                },\r\n                false\r\n            );\r\n        }\r\n    }, []);\r\n\r\n    return null;\r\n};\r\nexport default Conversion;\r\n"],"names":["postConversionEvent","async","event","eventName","cDetails","post","event_id","ecommerce","transaction_id","fb_event_id","event_name","event_source_url","window","location","href","custom_data","value","currency","content_name","document","title","content_ids","items","map","x","item_id","content_type","user_data","email","em","firstName","fn","lastName","ln","phoneNumber","ph","then","response","json","d","console","log","catch","error","message","props","useEffect","postFbEvent","JSON","parse","customer","Cookiebot","consent","marketing","addEventListener","e"],"sourceRoot":""}