{"version":3,"sources":["webpack:///./pandosites.web/mvc/scripts/Controls/OneTrust/_oneTrust.js"],"names":["__webpack_require__","r","__webpack_exports__","_Shared_Common__WEBPACK_IMPORTED_MODULE_0__","config","_initializeOneTrust","domainId","window","GeneralMills","getGlobalSetting","OneTrustLoadScript","isMultilingual","document","addEventListener","e","target","getAttribute","classList","contains","preventDefault","OneTrustShowPreferenceCenter","OneTrustUpdateEventHandler","debugMode","console","log","callback","dataAttributes","name","value","push","Object","checkCount","otCheck","setInterval","OneTrust","ToggleInfoDisplay","clearInterval","OneTrustCurrentGroupData","ev","groupData","detail","join","indexOf","cookie","location","reload"],"mappings":"2FAAAA,EAAAC,EAAAC,GAAA,IAAAC,EAAAH,EAAA,GAAgBE,EAAA,iBAAAE,GAChB,OAAAC,EAAAD,IAIA,IAAAC,EAAA,SAAAD,GACAA,KAAAE,UAEAC,OAAAC,aAAAC,iBAAA,6BAGAC,EAAAN,EAAAE,SAAAF,EAAAO,gBAIAC,SAAAC,iBAAA,iBAAAC,IACA,KAAAA,EAAAC,OAAAC,aAAA,gCAAAF,EAAAC,OAAAE,UAAAC,SAAA,2BACAJ,EAAAK,iBACAC,EAAAhB,EAAAE,SAAAF,EAAAO,mBAIAJ,OAAAM,iBAAA,mBAAAQ,GAAA,IACGb,aAAAc,WACHC,QAAAC,IAAA,sCAIAd,EAAA,SAAAJ,EAAAK,EAAAc,GACA,IAAAC,EAAA,EACAC,KAAA,qBACAC,MAAAtB,IAGAK,GACAe,EAAAG,KAAA,CACAF,KAAA,yBACAC,MAAA,SAIEE,OAAA3B,EAAA,EAAA2B,CAAkB,oEAAAL,EAAAC,IAGpBN,EAAA,SAAAd,EAAAK,GACAD,EAAAJ,EAAAK,EAAA,WAEA,IAAAoB,EAAA,EACAC,EAAAC,YAAA,WACAF,IAEAxB,OAAA2B,UAAA,mBAAA3B,OAAA2B,SAAAC,oBACA5B,OAAA2B,SAAAC,oBACAC,cAAAJ,IAGAD,EAAA,IACAK,cAAAJ,IAEK,QAILK,EAAA,GAEAhB,EAAA,SAAAiB,GACA,IAIAC,EAAA,IAAAD,EAAAE,OAJA,0BAIAF,EAAAE,OAAAC,KAAA,KAEA,IAAAJ,EACAA,EAAAE,EACGF,IAAAC,EAAAE,OAAAC,KAAA,OAEHH,EAAAE,OAAAE,QAAA,aAEA9B,SAAA+B,OAAA,oEAGApC,OAAAqC,SAAAC,QAAA","file":"oneTrust.cfe9e50428002f68ebeb.chunk.js","sourcesContent":["export default (function (config) {\n return _initializeOneTrust(config);\n});\nimport { loadExternalScript } from '@Shared/Common';\n\nvar _initializeOneTrust = function _initializeOneTrust(config) {\n if (config && config.domainId) {\n // Check if we need to present the banner\n var cookieExists = window.GeneralMills.getGlobalSetting(\"userPrivacy_CookieExists\");\n\n if (!cookieExists) {\n OneTrustLoadScript(config.domainId, config.isMultilingual);\n } // Capture clicks from ShowPreferenceCenter links\n\n\n document.addEventListener(\"click\", function (e) {\n if (e.target.getAttribute(\"data-show-preference-center\") == \"1\" || e.target.classList.contains(\"showPreferenceCenter\")) {\n e.preventDefault();\n OneTrustShowPreferenceCenter(config.domainId, config.isMultilingual);\n }\n }); // Add event listener for updates\n\n window.addEventListener(\"consent.onetrust\", OneTrustUpdateEventHandler, false);\n } else if (GeneralMills.debugMode) {\n console.log('[OneTrust] Domain ID not provided');\n }\n};\n\nvar OneTrustLoadScript = function OneTrustLoadScript(domainId, isMultilingual, callback) {\n var dataAttributes = [{\n name: 'data-domain-script',\n value: domainId\n }];\n\n if (isMultilingual) {\n dataAttributes.push({\n name: 'data-document-language',\n value: 'true'\n });\n }\n\n loadExternalScript('https://cdn.cookielaw.org/scripttemplates/otSDKStub.js', 'onetrust', callback, dataAttributes);\n};\n\nvar OneTrustShowPreferenceCenter = function OneTrustShowPreferenceCenter(domainId, isMultilingual) {\n OneTrustLoadScript(domainId, isMultilingual, function () {\n // Since the main script loads another script, we need to wait for that to load before accessing the OneTrust object\n var checkCount = 0;\n var otCheck = setInterval(function () {\n checkCount++;\n\n if (window.OneTrust && typeof window.OneTrust.ToggleInfoDisplay === \"function\") {\n window.OneTrust.ToggleInfoDisplay();\n clearInterval(otCheck);\n }\n\n if (checkCount > 20) {\n clearInterval(otCheck);\n }\n }, 250);\n });\n};\n\nvar OneTrustCurrentGroupData = \"\";\n\nvar OneTrustUpdateEventHandler = function OneTrustUpdateEventHandler(ev) {\n var OneTrustDefaultGroupData = \"C0001-C0003-C0002-C0004\"; // Event fires initially when banner loads\n // If first view of banner, groups is empty\n // If preference update, groups will have at least one (strictly necessary)\n\n var groupData = ev.detail == \"\" ? OneTrustDefaultGroupData : ev.detail.join('-');\n\n if (OneTrustCurrentGroupData == \"\") {\n OneTrustCurrentGroupData = groupData;\n } else if (OneTrustCurrentGroupData !== ev.detail.join('-')) {\n // if preferences have changed, reload page\n if (ev.detail.indexOf(\"C0003\") < 0) {\n // If functional is not present, remove DNM geolocation cookie\n document.cookie = 'DNMselectedZipCode=;path=/;expires=Thu, 01 Jan 1970 00:00:00 GMT';\n }\n\n window.location.reload(true);\n }\n};"],"sourceRoot":""}