Problem/Motivation

Saving the dialog with functional as always active settings sets the group's value to false.

Agreeing the dialog sets the value functional to true.

Steps to reproduce

  1. Enable module.
  2. Saving with functional group enabled.
  3. Reloading the page, via browser tools, inspect cookiesjsr value after decoding.

Proposed resolution

Should be set true in both cases.
Only “Decline” should set always active group values to false

Comments

stolzenhain created an issue. See original summary.

stolzenhain’s picture

Issue summary: View changes
knvc’s picture

I'm also experiencing this issue in version 1.2.13.

neptune-dc’s picture

Problem is in CDN content: /libraries/cookiesjsr/dist/cookiesjsr.min.css: {}

It treats always on cookies as any service that does not need consent with the variable `service.needConsent`.

// cookiesjsr/src/components/layer/SingleService.svelte
<li class="cookiesjsr-service">
  <div class="cookiesjsr-service__description">
    <h3>{ service.name }</h3>
    <BaseLinks links={links} class="cookiesjsr-service__links" direction="row"/>
  </div>
  <div class="cookiesjsr-service__action">
    {#if service.needConsent}
      <TheSwitch
        title={$services[service.key] ? t('allowed') : t('denied')}
        activated={$services[service.key]}
        changed={setConsent} />
    {:else}
      <div class="cookiesjsr-service__always-on">
        <span>{t('alwaysActive')}</span>
      </div>
    {/if}
  </div>
</li>

However, it does not consider `service.needConsent` when saving:

// cookiesjsr/src/components/ui/SetAllServices.svelte
<script>
  import StoreCookieService from '../../services/StoreCookieService.js';
  import BaseButton from './BaseButton.svelte'
  import {services, setAllServices, closeBanner, closeLayer} from "../../store.js";

  export let btnType = '';
  export let setAll = false;

  function setAllSaveAndClose() {
    let servicesState = {...$services};
    for (let id in servicesState) {
      if (typeof servicesState[id] !== 'undefined') {
        servicesState[id] = setAll;
      }
    }
    StoreCookieService.setServices(servicesState);
    setAllServices(servicesState);
    closeBanner();
    closeLayer();
  }
</script>

<BaseButton
    clicked="{setAllSaveAndClose}"
    btnType="{btnType}">
  <slot/>
</BaseButton>

Since the problem is in the CDN, I don't think this can be solved with a patch.

stolzenhain’s picture

Thanks for the decution! I lost track of this issue. The library is maintained by the same people working on this module:

https://github.com/jfeltkamp/cookiesjsr/tree/1.x

so far, nobody has brought up the issue there, so we could as well propose a patch .. will try to get back on this.