as-ideas / oil

191 stars 56 forks source link

configuration ignored #293

Closed chhaas closed 4 years ago

chhaas commented 4 years ago

Hello, the configuration for oil.js is completely ignored (nor dark-theme, nor german-locale, etc.).

index.html:

<html lang="de">
    <head>
    <meta charset="UTF-8">
       <title>oil.js TEST</title>
    <meta http-equiv="content-type" content="text/html; charset=utf-8" />

    <!-- oil.js Cookie consent configuration-->
    <script id="oil-configuration" type="application/configuration">
        {
            "config_version": 1,
            "publicPath": "oil/",
            "advanced_settings": true,
            "timeout": -1,
            "cookie_expires_in_days": "1",
            "theme": "dark",
            "gdpr_applies_globally": true,
            "default_to_optin": true,
            "locale": {
                "localeId": "deDE_01",
                "texts": {
                    "label_intro_heading": "Wir verwenden Cookies und andere Technologien",
                    "label_intro": "Diese Website verwendet Cookies, Web Beacons, JavaScript und ähnliche Technologien. Detaillierte Informationen, auch zum Widerrufsrecht, finden Sie in der Datenschutzerklärung der Website.",
                    "label_button_yes": "OK",
                    "label_button_back": "Zurück",
                    "label_button_advanced_settings": "Erweiterte Einstellungen",
                    "label_cpc_heading": "Bite wählen Sie ihre Privatsphären-Einstellung aus:",
                    "label_cpc_text": "Cookie-Preference-Cener intro",
                    "label_cpc_activate_all": "Alles aktivieren",
                    "label_cpc_deactivate_all": "Alles deaktivieren",
                    "label_cpc_purpose_desc": "Zweck für Cookies: Funktion der Webseite",
                    "label_cpc_purpose_optout_confirm_heading": "Sind Sie sich wirklich sicher?",
                    "label_cpc_purpose_optout_confirm_text": "Diese Einstellung wirkt sich erheblich negativ auf Ihre Erfahrung auf unserer Website aus.",
                    "label_cpc_purpose_optout_confirm_proceed": "Wirklich sicher?",
                    "label_cpc_purpose_optout_confirm_cancel": "Abbrechen",
                    "label_poi_group_list_heading": "",
                    "label_poi_group_list_text": "",
                    "label_third_party": "Third Parties",
                    "label_nocookie_head": "Um unsere Dienstleistungen bestmöglich erbringen zu können, müssen in Ihrem Browser Cookies aktiviert sein.",
                    "label_nocookie_text": "Bitte aktivieren Sie Cookies in den Eigenschaften Ihres Browsers. So können Sie es in <a href=\\\"https://support.google.com/chrome/answer/95647?co=GENIE.Platform%3DDesktop&hl=en-GB\\\" class=\\\"as-oil__intro-txt--link\\\" target=\\\"_blank\\\">Google Chrome tun </a> oder in <a href=\\\"https://support.mozilla.org/en-US/kb/cookies-information-websites-store-on-your-computer\\\" class=\\\"as-oil__intro-txt--link\\\" target=\\\"_blank\\\">Firefox</a>."
                    }
            },
            "version": 1
        }
    </script>
    <!-- alternative to complete "locale"-definition: "locale_url": "oil/deDE_01.json" -->

    <!-- 2. CMP-STUB You need to add the CMP stub (a small script which stores all requests until the full script is loaded) and the script itself. -->
    <script>
            /*! 1.3.5-RELEASE */!function(e){var t={};function n(o){if(t[o])return t[o].exports;var r=t[o]={i:o,l:!1,exports:{}};return e[o].call(r.exports,r,r.exports,n),r.l=!0,r.exports}n.m=e,n.c=t,n.d=function(e,t,o){n.o(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:o})},n.r=function(e){Object.defineProperty(e,"__esModule",{value:!0})},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="https://unpkg.com/@ideasio/oil.js@1.3.5/release/current/",n(n.s=117)}({117:function(e,t,n){"use strict";!function(e,t){e.__cmp||(e.__cmp=function(){function n(e){if(e){var n=!0,r=t.querySelector('script[type="application/configuration"]#oil-configuration');if(null!==r&&r.text)try{var a=JSON.parse(r.text);a&&a.hasOwnProperty("gdpr_applies_globally")&&(n=a.gdpr_applies_globally)}catch(e){}e({gdprAppliesGlobally:n,cmpLoaded:o()},!0)}}function o(){return!(!e.AS_OIL||!e.AS_OIL.commandCollectionExecutor)}!function e(){if(!(t.getElementsByName("__cmpLocator").length>0))if(t.body){var n=t.createElement("iframe");n.style.display="none",n.name="__cmpLocator",t.body.appendChild(n)}else setTimeout(e,5)}();var r=[],a=function(t,a,c){if("ping"===t)n(c);else{var i={command:t,parameter:a,callback:c};r.push(i),o()&&e.AS_OIL.commandCollectionExecutor(i)}};return a.commandCollection=r,a.receiveMessage=function(t){var a=t&&t.data,c="string"==typeof a;if(a=c&&-1!==a.indexOf("__cmpCall")?JSON.parse(a).__cmpCall:a.__cmpCall)if("ping"===a.command)n(function(e,n){var o={__cmpReturn:{returnValue:e,success:n,callId:a.callId}};t.source.postMessage(c?JSON.stringify(o):o,t.origin)});else{var i={callId:a.callId,command:a.command,parameter:a.parameter,event:t};r.push(i),o()&&e.AS_OIL.commandCollectionExecutor(i)}},function(t){var n=e.addEventListener||e.attachEvent;n("attachEvent"===n?"onmessage":"message",function(e){t.receiveMessage(e)},!1)}(a),a}())}(window,document)}});
    </script>

    <!-- 3. Link to the OIL-Script itself -->
    <script src="oil/oil.1.3.5-RELEASE.min.js" type="text/javascript"></script>

</head>
<body>
    <h2>Private oil.js Testseite!</h2>
    <p>zum Test des Cookie-Banners von oil.js</p>
</body>
</html>

Alternative json-configuration instead of locale-definition in the config-section (makes no difference whether using full definition in config section or pointing to the "locale_url"): oil/deDE_01.json:

{
    "localeId": "deDE_01",
    "texts": {
        "label_intro_heading": "Wir verwenden Cookies und andere Technologien",
        "label_intro": "Diese Website verwendet Cookies, Web Beacons, JavaScript und ähnliche Technologien. Detaillierte Informationen, auch zum Widerrufsrecht, finden Sie in der Datenschutzerklärung der Website.",
        "label_button_yes": "OK",
        "label_button_back": "Zurück",
        "label_button_advanced_settings": "Erweiterte Einstellungen",
        "label_cpc_heading": "Bite wählen Sie ihre Privatsphären-Einstellung aus:",
        "label_cpc_text": "Cookie-Preference-Cener intro",
        "label_cpc_activate_all": "Alles aktivieren",
        "label_cpc_deactivate_all": "Alles deaktivieren",
        "label_cpc_purpose_desc": "Zweck für Cookies: Funktion der Webseite",
        "label_cpc_purpose_optout_confirm_heading": "Sind Sie sich wirklich sicher?",
        "label_cpc_purpose_optout_confirm_text": "Diese Einstellung wirkt sich erheblich negativ auf Ihre Erfahrung auf unserer Website aus.",
        "label_cpc_purpose_optout_confirm_proceed": "Wirklich sicher?",
        "label_cpc_purpose_optout_confirm_cancel": "Abbrechen",
        "label_poi_group_list_heading": "",
        "label_poi_group_list_text": "",
        "label_third_party": "Third Parties",
        "label_nocookie_head": "Um unsere Dienstleistungen bestmöglich erbringen zu können, müssen in Ihrem Browser Cookies aktiviert sein.",
        "label_nocookie_text": "Bitte aktivieren Sie Cookies in den Eigenschaften Ihres Browsers. So können Sie es in <a href=\\\"https://support.google.com/chrome/answer/95647?co=GENIE.Platform%3DDesktop&hl=en-GB\\\" class=\\\"as-oil__intro-txt--link\\\" target=\\\"_blank\\\">Google Chrome tun </a> oder in <a href=\\\"https://support.mozilla.org/en-US/kb/cookies-information-websites-store-on-your-computer\\\" class=\\\"as-oil__intro-txt--link\\\" target=\\\"_blank\\\">Firefox</a>."
    },
    "version": 1
}

**Why is the defined configuration not used?

Instead the standard oil.js-banner in English language with light theme appears, but configured is the localized german version in dark theme...**

Content of the oil_data-cookie:

{%22opt_in%22:true%2C%22version%22:%221.3.5-RELEASE%22%2C%22localeVariantName%22:%22enEN_00%22%2C%22localeVariantVersion%22:0%2C%22customPurposes%22:[]%2C%22consentString%22:%22BOsgCfDOsgCfDBQABBENAk-AAAAXyABgACAvgA%22%2C%22configVersion%22:0}`

Thanks Christoph.

chhaas commented 4 years ago

Seemed to be a typo in my configuration. Issue solved!